/** * org_task_cancel stops the assignee's work on the task, not only the task's * status. On the 2.16.2 release run the coordinator cancelled task-25 at * 119.8m; nothing told the fixer, which kept working for 25 minutes, * committed its fix to the release fix worktree, and only learned of the * cancel when its org_task_done was refused. The commit was then integrated * after the final audit. * * Mail reaches a role only when its turn ends, so a notice alone arrives too * late for a role mid-turn. In task scope the role's live process belongs to * one task, so that process is ended the way a sandbox fault ends it * (session.ts aborts the runner, which kills its child): bounded, and no other * task's session is touched. In role scope one process serves every task, so * only the notice is sent. */ import type { OrgBus } from './bus.js'; import type { RunningOrg } from './daemon.js'; import type { Mailbox } from './mailbox.js'; import type { OrgTask, OrgTaskStatus } from './task-dag.js'; /** The reason a task-scoped process was ended: its task was cancelled. */ export declare class TaskCancelledError extends Error { readonly taskId: string; /** Queued by the session loop once the process is gone, so the dying * process cannot swallow it. */ readonly notice: string; constructor(taskId: string, /** Queued by the session loop once the process is gone, so the dying * process cannot swallow it. */ notice: string); } /** What the assignee is told, ahead of anything else it reads for the task. */ export declare function cancelNotice(taskId: string, by: string, reason?: string): string; /** Per role incarnation: which task the role's live process works on, and * the handle that ends that process. */ export declare class TaskProcesses { private live?; /** Called by the session loop for each task-scoped process; `release()` * when it is gone. The signal aborts only when `key` is cancelled. */ track(key: string): { signal: AbortSignal; release(): void; }; /** Ends the live process if it is working on `taskId`; the session loop * then queues `notice`. */ stop(taskId: string, notice: string): boolean; } /** After `task` (which was `priorStatus`) is cancelled by `by`: tell its * assignee and end the assignee's process for it. A role cancelling its own * task is mid-call and already knows. An assignee that never received the * task — never dispatched, or still held in the dispatch coalescing window — * is not told or woken: the held dispatch is withdrawn instead, so no notice * can overtake the task it cancels. */ export declare function stopCancelledTaskWork(running: RunningOrg, task: Pick, by: string, priorStatus: OrgTaskStatus, reason?: string): void; /** The session loop's handle for a task-scoped process (session key * `sessionKey`): cancelling that task ends the process. Role scope, or the * role's own session, is never tracked. */ export declare function trackTaskProcess(processes: TaskProcesses | undefined, scope: string, sessionKey: string): ReturnType | undefined; /** Links `signal` one way into `abort` (already aborted = abort now, since a * cancel can land during a session's setup awaits); returns the unlink. */ export declare function linkAbort(signal: AbortSignal | undefined, abort: AbortController): () => void; /** After a cancel ended the task's process: queue `err.notice` only now, so * the dead process's stream cannot take it, and say the process ended. */ export declare function queueCancelNotice(err: TaskCancelledError, mailbox: Mailbox, bus: OrgBus, role: string, sessionKey: string): void; //# sourceMappingURL=task-cancel.d.ts.map