/**
 * Per-task on-disk layout under $FRANKLIN_HOME/tasks/<runId>/.
 *   meta.json    — single TaskRecord, atomically rewritten
 *   events.jsonl — append-only event log
 *   log.txt      — child process stdout/stderr
 */
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
function franklinHome() {
    return process.env.FRANKLIN_HOME || path.join(os.homedir(), '.franklin');
}
export function getTasksDir() {
    return path.join(franklinHome(), 'tasks');
}
export function getTaskDir(runId) {
    return path.join(getTasksDir(), runId);
}
export function ensureTaskDir(runId) {
    const dir = getTaskDir(runId);
    fs.mkdirSync(dir, { recursive: true });
    return dir;
}
export function taskMetaPath(runId) {
    return path.join(getTaskDir(runId), 'meta.json');
}
export function taskEventsPath(runId) {
    return path.join(getTaskDir(runId), 'events.jsonl');
}
export function taskLogPath(runId) {
    return path.join(getTaskDir(runId), 'log.txt');
}
