/** * Work a restart cut off inside an agent's Claude Code conversation * (crewly#1361). A `tool_use` block whose `tool_use_id` never received a * `tool_result` before the transcript ends was still running when the process * died: a sub-agent (Task / Agent tool) or a background / long-running shell * command. Neither survives the restart, but the agent's last words in the * transcript say the work is "still in progress", so a resumed agent waited on * it for 16 hours. The handover lists these calls as interrupted, near its * top and again under "Open work", so the new conversation restarts them or * reports them lost instead of waiting. * * @module services/agent/handover-interrupted */ /** A `tool_use` block of the transcript that has not received its result (yet). */ export interface PendingToolCall { /** `tool_use.id` */ id: string; /** Tool name ("Task", "Agent", "Bash", …) */ name: string; /** `tool_use.input` as recorded */ input: unknown; } /** One interrupted call, as the handover describes it. */ export interface InterruptedWork { kind: 'sub-agent' | 'background-command'; /** What it was doing: the sub-agent's description and prompt head, or the command head (clipped) */ text: string; } /** * Whether a pending call is long-running work that dies with the process: a * sub-agent, or a shell command run in the background or that looks like a * render / encode / build ({@link HANDOVER_CONSTANTS.LONG_COMMAND_PATTERN}). * A short command that merely had no result yet (the last `cat` before the * cut) is not listed: nothing was lost but its output. * * @param call - Pending tool call * @returns The interrupted work it stands for, or null */ export declare function interruptedFromCall(call: PendingToolCall): InterruptedWork | null; /** * The interrupted work among the calls still pending at the end of a * transcript, oldest first, at most {@link HANDOVER_CONSTANTS.INTERRUPTED_MAX_ITEMS}. * * @param pending - Tool calls without a result, in transcript order * @returns Interrupted sub-agents and background commands * * @example * interruptedWork([{ id: 't1', name: 'Task', input: { description: 'Make v4', prompt: '…' } }]) * // → [{ kind: 'sub-agent', text: 'Make v4: …' }] */ export declare function interruptedWork(pending: readonly PendingToolCall[]): InterruptedWork[]; /** * One bullet of the section. * * @param item - Interrupted work * @returns The line */ export declare function interruptedLine(item: InterruptedWork): string; /** * The "Interrupted by the restart" section of a handover: factual, one bullet * per call, nothing about mechanics. * * @param items - Interrupted work * @returns Markdown, or '' when nothing was interrupted */ export declare function formatInterruptedSection(items: readonly InterruptedWork[]): string; /** * Read the interrupted work back out of a handover body that carries the * section (the pointers header is written by a different module and lists * the same items under "Open work"). * * @param body - Handover body * @returns The items, in order; [] when the section is absent */ export declare function interruptedFromHandoverBody(body: string): InterruptedWork[]; //# sourceMappingURL=handover-interrupted.d.ts.map