/** * File-backed control plane for detached Taskflow runs. * * A detached runner cannot rely on an IPC channel surviving its parent MCP * process. Cancellation is therefore requested through a small durable marker * in a user-private control directory keyed by the canonical invocation root. * The child polls that marker and aborts the normal RuntimeDeps signal, * preserving the runtime's existing paused semantics and process-tree cleanup. */ export interface DetachedCancelRequest { requestedAt: number; reason?: string; } export declare const DETACHED_CONTROL_VERSION = 1; export declare const DETACHED_CONTROL_CWD_ENV = "TASKFLOW_DETACHED_CONTROL_CWD"; export declare const DETACHED_CONTROL_RUN_ID_ENV = "TASKFLOW_DETACHED_CONTROL_RUN_ID"; export declare const DETACHED_CONTROL_INSTANCE_ENV = "TASKFLOW_DETACHED_CONTROL_INSTANCE"; export declare const DETACHED_CONTROL_OWNER_PID_ENV = "TASKFLOW_DETACHED_CONTROL_OWNER_PID"; export declare const DETACHED_CONTROL_SIGNAL_READY_ENV = "TASKFLOW_DETACHED_CONTROL_SIGNAL_READY"; export interface DetachedProcessRegistry { version: number; instanceId: string; ownerPid: number; heartbeatAt: number; pids: number[]; } /** Resolve the cancel marker for a run without accepting caller-selected paths. */ export declare function detachedCancelRequestPath(cwd: string, runId: string): string; /** Persist an idempotent cancellation request for a detached runner. */ export declare function requestDetachedCancel(cwd: string, runId: string, reason?: string): DetachedCancelRequest; /** Read a cancellation request. Corrupt markers still mean "cancel" fail-safe. */ export declare function readDetachedCancelRequest(cwd: string, runId: string): DetachedCancelRequest | null; export declare function clearDetachedCancelRequest(cwd: string, runId: string): void; export declare function detachedProcessRegistryPath(cwd: string, runId: string): string; export declare function readDetachedProcessRegistry(cwd: string, runId: string): DetachedProcessRegistry | null; export declare function heartbeatDetachedProcessRegistry(cwd: string, runId: string, instanceId: string, ownerPid?: number): void; /** True only after this exact detached owner installed its persistence-aware signal bridge. */ export declare function isDetachedSignalOwnerReady(): boolean; /** Best-effort hook used by runner-core whenever a Host CLI process group starts. */ export declare function registerDetachedProcessTreeFromEnv(pid: number): void; /** Best-effort hook used by runner-core after a Host CLI process group is reaped. */ export declare function unregisterDetachedProcessTreeFromEnv(pid: number): void; /** Reap every Host CLI process group owned by exactly this worker instance. */ export declare function terminateDetachedProcessTrees(cwd: string, runId: string, instanceId: string): number[]; export declare function clearDetachedProcessRegistry(cwd: string, runId: string, instanceId?: string): void; /** * Poll a detached cancellation marker and bridge it into an AbortController. * Returns a cleanup callback. The timer is unref'd so it never keeps a * completed detached runner alive by itself. */ export declare function watchDetachedCancel(cwd: string, runId: string, controller: AbortController, pollMs?: number, onRequest?: (request: DetachedCancelRequest) => void): () => void; //# sourceMappingURL=detached-control.d.ts.map