/** * Public spawn surface for the detached task subsystem. * * `startDetachedTask` is the synchronous entry point used by the `Task` * agent tool and by `franklin task` callers. It writes a queued * TaskRecord to disk, opens log.txt for stdout/stderr capture, then * spawns `franklin _task-runner ` with `detached: true` and * unrefs the child so this process can exit without waiting on the * task. The runner subprocess takes over from there: it spawns the * actual user command, drives heartbeats, and finalizes meta on exit. * * Performance contract: startDetachedTask must return in <250ms. That * is enforced by the integration test in test/local.mjs and is the * reason all I/O here is sync — we want one fs write + one spawn, not * an async chain that could be interrupted by a slow microtask. * * CLI path resolution (in priority order): * 1. process.env.FRANKLIN_CLI_PATH — escape hatch for tests / dev. * 2. STARTUP_CLI_PATH (captured at module load) — absolute path of * the script Node is currently executing. Captured early so it * survives any later chdir; resolved to absolute so it survives * the spawn's `cwd:` override (the bug it fixes — verified * 2026-05-04 from a real session: dev-mode `node dist/index.js` * run, then Detach with workingDir=other-repo, child fails with * MODULE_NOT_FOUND on `/dist/index.js`). */ export interface StartDetachedTaskInput { label: string; command: string; workingDir: string; } export declare function startDetachedTask(input: StartDetachedTaskInput): string;