import path from "node:path";
import { writeText } from "../utils/fs.js";
function contextTracePath(targetRoot) {
    return path.join(targetRoot, ".agent", "state", "context-trace.json");
}
function indexingPath(targetRoot) {
    return path.join(targetRoot, ".agent", "state", "indexing.json");
}
export async function persistContextTrace(targetRoot, trace) {
    const outputPath = contextTracePath(targetRoot);
    await writeText(outputPath, `${JSON.stringify(trace, null, 2)}\n`);
    return outputPath;
}
export async function persistIndexingState(targetRoot, indexing) {
    const outputPath = indexingPath(targetRoot);
    await writeText(outputPath, `${JSON.stringify(indexing, null, 2)}\n`);
    return outputPath;
}
