@bastani/atomic 0.9.89-alpha.1 → 0.9.89-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/builtin/intercom/CHANGELOG.md +8 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +15 -1
- package/dist/builtin/intercom/broker/broker.ts +25 -8
- package/dist/builtin/intercom/broker/client.ts +29 -14
- package/dist/builtin/intercom/broker/multinode-router.ts +193 -52
- package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -2
- package/dist/builtin/intercom/broker/restoring-recipients.ts +5 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +3 -2
- package/dist/builtin/intercom/index.bundle.mjs +19 -12
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +6 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +17 -6
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +12 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +310 -344
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +99 -17
- package/dist/builtin/workflows/src/index.js +99 -17
- package/dist/builtin/workflows/src/local-worker-entry.mjs +99 -17
- package/dist/cli/storage-command.js +8 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +1 -0
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/keybindings.d.ts +8 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +8 -1
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/resume/blueprint/build-lock.d.ts.map +1 -1
- package/dist/core/resume/blueprint/build-lock.js +2 -1
- package/dist/core/resume/blueprint/build-lock.js.map +1 -1
- package/dist/core/storage/errors.d.ts +4 -2
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +6 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +5 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +13 -0
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +1 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +3 -7
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +3 -11
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/capture.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/capture.js +25 -1
- package/dist/core/worktree-snapshot/capture.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +38 -9
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +5 -0
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +13 -0
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +5 -2
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts +34 -0
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -0
- package/dist/modes/interactive/components/heartbeat-block.js +50 -0
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +8 -3
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +3 -7
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +13 -7
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +10 -2
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +13 -3
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -1
- package/dist/modes/interactive/components/provider-brand.js +3 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts +9 -4
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.js +33 -27
- package/dist/modes/interactive/components/task-heartbeat-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +16 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +95 -4
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +5 -1
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +20 -3
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +10 -7
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -2
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts +29 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.js +81 -7
- package/dist/modes/interactive/theme/color-utils.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js +3 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +22 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +64 -18
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +2 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +6 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +170 -15
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/windows-powershell.d.ts +9 -0
- package/dist/utils/windows-powershell.d.ts.map +1 -0
- package/dist/utils/windows-powershell.js +16 -0
- package/dist/utils/windows-powershell.js.map +1 -0
- package/docs/background-tasks.md +6 -6
- package/docs/getting-started/installation.md +4 -2
- package/docs/keybindings.md +3 -0
- package/docs/storage.md +24 -5
- package/docs/subagents.md +1 -1
- package/docs/themes/reference.md +7 -0
- package/docs/tui/reference.md +1 -1
- package/docs/windows.md +1 -1
- package/docs/workflows/api-reference.md +9 -1
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
- package/schemas/keybindings.schema.json +4 -0
|
@@ -90,6 +90,11 @@ export declare function withoutSupersededAttempts(tasks: readonly TaskRecord[]):
|
|
|
90
90
|
* released agent that was then stopped (paused or quit), which waits for a resume instead of waking by itself.
|
|
91
91
|
*/
|
|
92
92
|
export declare function waitingReleasedTools(task: Pick<TaskRecord, "execution" | "ref">): string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The shells an agent released while it waits launched that still run, oldest first: what it waits on keeps running
|
|
95
|
+
* there. Empty for any task that is not waiting.
|
|
96
|
+
*/
|
|
97
|
+
export declare function waitingReleasedShells(task: TaskRecord, ownerTasks: readonly TaskRecord[]): TaskRecord[];
|
|
93
98
|
/** The tools an agent released while it waited waits on, by name and once each, as a task row names them. */
|
|
94
99
|
export declare function releasedWaitingTools(result: TaskResult): string | undefined;
|
|
95
100
|
/** Human/model-facing notice; the envelope remains the structured delivery identity. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG3G,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAC9D,MAAM,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,E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AAE,sBAAsB,KAAK,IAAe,EACxE,OAAO,GAAE,2BAAgC,EAazC;IACD,kGAAkG;IAClG,iBAAiB,IAAI,IAAI,CAMxB;IAED,IAAI,OAAO,IAAI,sBAAsB,EAAE,CAEtC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,UAAQ,GAAG,IAAI,CAK1G;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAKrB;IAED,+FAA+F;IACzF,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAOrC;IAED;;;OAGG;YACW,OAAO;IAiDrB;;;OAGG;YACW,UAAU;IAwBxB,8GAA8G;IAC9G,OAAO,CAAC,WAAW;YAYL,WAAW;CAOzB;AAED,sFAAsF;AACtF,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,sBAAsB,EAAE,CAYlH"}
|
|
@@ -167,6 +167,19 @@ export function waitingReleasedTools(task) {
|
|
|
167
167
|
const tools = releasedWaitingTools(task.execution.result);
|
|
168
168
|
return tools === undefined || taskStoppedForResume(task.ref.taskId) ? undefined : tools;
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* The shells an agent released while it waits launched that still run, oldest first: what it waits on keeps running
|
|
172
|
+
* there. Empty for any task that is not waiting.
|
|
173
|
+
*/
|
|
174
|
+
export function waitingReleasedShells(task, ownerTasks) {
|
|
175
|
+
if (task.kind !== "agent" || waitingReleasedTools(task) === undefined)
|
|
176
|
+
return [];
|
|
177
|
+
return ownerTasks
|
|
178
|
+
.filter((candidate) => candidate.parentTaskId === task.ref.taskId &&
|
|
179
|
+
candidate.kind === "command" &&
|
|
180
|
+
candidate.execution.kind !== "settled")
|
|
181
|
+
.sort((a, b) => a.launchOrdinal - b.launchOrdinal);
|
|
182
|
+
}
|
|
170
183
|
/** The tools an agent released while it waited waits on, by name and once each, as a task row names them. */
|
|
171
184
|
export function releasedWaitingTools(result) {
|
|
172
185
|
if (result.kind !== "cancelled" || result.released === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AA2B9D,8EAA8E;AAC9E,MAAM,UAAU,sBAAsB,CACrC,OAAgB,EAChB,OAA0B,EAC1B,QAA6B;IAE7B,OAAO;QACN,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO;QACP,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ;QACzC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,KAAK;QACd,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CA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O,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC1D,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACtC,IAAI,KAAK,CAAC,UAAU,KAAK,wBAAwB,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAA8B,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAqB,EAAE,CAAC;YACvD,OAAO,CAAC,MAAM,CAAE,KAAK,CAAC,IAAiC,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { splitFallbackModel } from \"../fallback-models.ts\";\nimport { formatModelLabel, formatModelReferenceLabel } from \"../model-label.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport { sliceTail } from \"../tools/truncate.ts\";\nimport { cancelReasonText, formatTimeoutSeconds, longerRunAdvice } from \"./cancel-reason.js\";\nimport { taskOutcomeStatus } from \"./command-output.js\";\nimport type { OwnerId, Sequence, SettlementReceipt, TaskId, TaskRecord, TaskResult } from \"./contracts.js\";\nimport { taskStoppedForResume } from \"./task-resumer.ts\";\n\nexport const TASK_COMPLETION_MESSAGE_TYPE = \"task-completion\";\nexport type TaskCompletionEnvelope = {\n\tcompletionId: string;\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tterminalSequence: Sequence;\n\tresult: TaskResult;\n\tdisplay: false;\n\t/**\n\t * Whether the settled task was a shell or a subagent, saved with the intent so a notice replayed after a restart,\n\t * when the task record is gone, still words a pause correctly. Intents saved by earlier versions lack it.\n\t */\n\ttaskKind?: TaskRecord[\"kind\"];\n\t/**\n\t * Set when Atomic restarted while the task's workflow stage was released: the task no longer runs, and what it did\n\t * was not kept (#5079).\n\t */\n\tinterruptedByRestart?: true;\n\t/**\n\t * The subagent session that launched the task in this owner, which alone receives its notice. Absent for the\n\t * owner's own tasks, whose notices this session receives. Intents saved by earlier versions lack it.\n\t */\n\tlaunchedBy?: string;\n\t/** How long a command ran, from its launch to its settlement; its notice line shows it. */\n\telapsedMs?: number;\n};\n\n/** The structured delivery identity of a settled task's completion notice. */\nexport function taskCompletionEnvelope(\n\townerId: OwnerId,\n\treceipt: SettlementReceipt,\n\ttaskKind?: TaskRecord[\"kind\"],\n): TaskCompletionEnvelope {\n\treturn {\n\t\tcompletionId: receipt.completionId,\n\t\townerId,\n\t\ttaskId: receipt.taskId,\n\t\tterminalSequence: receipt.cursor.sequence,\n\t\tresult: receipt.result,\n\t\tdisplay: false,\n\t\t...(taskKind === undefined ? {} : { taskKind }),\n\t\t...(receipt.launchedBy === undefined ? {} : { launchedBy: receipt.launchedBy }),\n\t\t...(receipt.elapsedMs === undefined ? {} : { elapsedMs: receipt.elapsedMs }),\n\t};\n}\n\n/**\n * The one notice line a finished task shows in the transcript: what it is, its name, how it ended and how long it ran.\n * Status reads as the line's marker: success ●, failure ✗, stopped ◼, warning !, paused ⏸.\n */\nexport type TaskNoticeLine = {\n\tstatus: \"success\" | \"failure\" | \"stopped\" | \"warning\" | \"paused\";\n\t/** `Background command`, `Agent` or `Task`. */\n\tlabel: string;\n\t/** The task's description or command, quoted on the line. */\n\tsubject?: string;\n\t/** `completed (exit code 0)`, `finished`, `failed (exit code 1)`, `was stopped by the user`. */\n\toutcome: string;\n\telapsedMs?: number;\n};\n\nexport type TaskCompletionNotice = {\n\ttitle: string;\n\tpreview: string;\n\tstatus: \"completed\" | \"failed\" | \"cancelled\";\n\ttaskId: string;\n\ttaskKind?: TaskRecord[\"kind\"];\n\tagentName?: string;\n\tmodel?: string;\n\tthinking?: string;\n\t/** The model the launch asked for, when the task records one. */\n\trequestedModel?: string;\n\t/** The notice's line; notices saved by earlier versions lack it and show their title. */\n\tline?: TaskNoticeLine;\n};\n\n/** The line of a finished task's notice: what it is, its name, how it ended, and how long it ran. */\nexport function taskNoticeLine(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Partial<Pick<TaskRecord, \"kind\" | \"title\" | \"metrics\">>,\n): TaskNoticeLine {\n\tconst kind = task?.kind ?? envelope.taskKind;\n\tconst result = envelope.result;\n\tconst subject = task?.title ? task.title.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \").slice(0, 240) : undefined;\n\tconst facts = {\n\t\t...(subject ? { subject } : {}),\n\t\t...((task?.metrics?.elapsedMs ?? envelope.elapsedMs) === undefined\n\t\t\t? {}\n\t\t\t: { elapsedMs: task?.metrics?.elapsedMs ?? envelope.elapsedMs }),\n\t};\n\tconst label = kind === \"agent\" ? \"Agent\" : kind === \"command\" ? \"Background command\" : \"Task\";\n\tconst exitCode =\n\t\tresult.kind !== \"cancelled\" && result.exitCode !== undefined ? ` (exit code ${result.exitCode})` : \"\";\n\t// A command that exits non-zero completed, and failed.\n\tif (result.kind !== \"cancelled\" && taskOutcomeStatus(result, kind) === \"completed\")\n\t\treturn { status: \"success\", label, outcome: kind === \"agent\" ? \"finished\" : `completed${exitCode}`, ...facts };\n\tif (result.kind !== \"cancelled\") return { status: \"failure\", label, outcome: `failed${exitCode}`, ...facts };\n\tconst waitingOn = releasedWaitingOn(result);\n\tif (waitingOn !== undefined) return { status: \"paused\", label, outcome: `is waiting on ${waitingOn}`, ...facts };\n\tif (envelope.interruptedByRestart === true)\n\t\treturn { status: \"stopped\", label, outcome: \"was interrupted by a restart\", ...facts };\n\tif (result.cause === \"pause\" && kind !== \"agent\")\n\t\treturn { status: \"stopped\", label, outcome: \"was interrupted by a pause\", ...facts };\n\tif (kind === \"agent\" && isResumableStop(result))\n\t\treturn {\n\t\t\tstatus: \"paused\",\n\t\t\tlabel,\n\t\t\toutcome: result.cause === \"quit\" ? \"quit · awaiting resume\" : \"paused · awaiting resume\",\n\t\t\t...facts,\n\t\t};\n\tif (result.cause === \"user\")\n\t\treturn { status: \"stopped\", label: \"Task\", outcome: \"was stopped by the user\", ...facts };\n\tif (result.cause === \"execution-timeout\")\n\t\treturn { status: \"warning\", label, outcome: cancelReasonText(result), ...facts };\n\tconst reason = result.cause === \"owner-close\" ? cancelReasonText(result) : undefined;\n\treturn {\n\t\tstatus: \"stopped\",\n\t\tlabel,\n\t\toutcome: reason === undefined ? \"was stopped\" : `was stopped (${reason})`,\n\t\t...facts,\n\t};\n}\n\n/**\n * The model-facing line saying an agent ran on another model than its launch asked for, or undefined when it ran on\n * that model, at any effort, or either is unknown. Task records name the model without its effort, which `thinking`\n * carries; both models read as their raw ID and level, like every model label (#4269).\n */\nexport function ranOnModelLine(\n\ttask?: Partial<Pick<TaskRecord, \"kind\" | \"model\" | \"thinking\" | \"requestedModel\">>,\n): string | undefined {\n\tif (task?.kind !== \"agent\" || task.model === undefined || task.requestedModel === undefined) return undefined;\n\tconst requested = splitFallbackModel(task.requestedModel).modelId;\n\tconst sameModel = requested.includes(\"/\") ? requested === task.model : task.model.endsWith(`/${requested}`);\n\tif (sameModel) return undefined;\n\tconst ranOn = formatModelLabel(task.model, { thinkingLevel: task.thinking });\n\treturn `Model: ran on ${ranOn}, not the requested ${formatModelReferenceLabel(task.requestedModel)}.`;\n}\n\nexport function taskCompletionNotice(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\" | \"model\" | \"thinking\"> &\n\t\tPartial<Pick<TaskRecord, \"requestedModel\" | \"metrics\">>,\n\toutput?: string,\n): TaskCompletionNotice {\n\tconst exitCode =\n\t\ttask?.kind === \"command\" && envelope.result.kind !== \"cancelled\" ? envelope.result.exitCode : undefined;\n\tconst preview = [envelope.result.kind === \"failed\" ? envelope.result.message : \"\", output ?? \"\"]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n\treturn {\n\t\ttitle:\n\t\t\tformatTaskCompletion(envelope, task).split(\"\\n\")[0] + (exitCode === undefined ? \"\" : ` · exit ${exitCode}`),\n\t\tpreview: (task?.kind ?? envelope.taskKind) === \"command\" ? sliceTail(preview, 8000) : preview.slice(0, 8000),\n\t\tstatus: taskOutcomeStatus(envelope.result, task?.kind),\n\t\ttaskId: envelope.taskId,\n\t\t...((task?.kind ?? envelope.taskKind) === undefined ? {} : { taskKind: task?.kind ?? envelope.taskKind }),\n\t\t...(task?.kind === \"agent\" && task.agentName !== undefined ? { agentName: task.agentName } : {}),\n\t\t...(task?.kind === \"agent\" && task.model !== undefined ? { model: task.model } : {}),\n\t\t...(task?.kind === \"agent\" && task.thinking !== undefined ? { thinking: task.thinking } : {}),\n\t\t...(task?.kind === \"agent\" && task.requestedModel !== undefined ? { requestedModel: task.requestedModel } : {}),\n\t\tline: taskNoticeLine(envelope, task),\n\t};\n}\n\n/** A stop that leaves an agent paused and awaiting resume rather than ended. A release is not one (#5031). */\nexport function isResumableStop(result: TaskResult): result is Extract<TaskResult, { kind: \"cancelled\" }> & {\n\tcause: \"pause\" | \"quit\";\n} {\n\treturn (\n\t\tresult.kind === \"cancelled\" &&\n\t\tresult.released === undefined &&\n\t\t(result.cause === \"pause\" || result.cause === \"quit\")\n\t);\n}\n\n/**\n * What an agent released while it waited waits on (#5031): it was not paused, and it wakes by itself when one of those\n * calls finishes. Undefined for any other result.\n */\nexport function releasedWaitingOn(result: TaskResult): string | undefined {\n\tif (result.kind !== \"cancelled\" || result.released === undefined) return undefined;\n\treturn result.released.waitingOn.map((call) => `${call.toolName} (${call.toolCallId})`).join(\", \") || \"a tool call\";\n}\n\n/** The subagent a task is an attempt of: its launch operation without the `:resume:<id>` a woken or resumed attempt adds. */\nexport function childOfAttempt(task: Pick<TaskRecord, \"launchOperationId\">): string {\n\tconst operation = task.launchOperationId;\n\tconst suffix = operation.indexOf(\":resume:\");\n\treturn suffix > 0 ? operation.slice(0, suffix) : operation;\n}\n\nconst NONE_SUPERSEDED: ReadonlySet<TaskId> = new Set();\n\n/**\n * The released attempts in `tasks` whose subagent has a later attempt there: it woke (or was resumed) and that attempt\n * is the subagent now. Such an attempt waits on nothing any more, so views list the later attempt instead of it.\n */\nexport function supersededReleasedAttempts(tasks: readonly TaskRecord[]): ReadonlySet<TaskId> {\n\tconst released: Array<TaskRecord> = [];\n\tfor (const task of tasks) {\n\t\tif (task.kind === \"agent\" && task.execution.kind === \"settled\" && releasedWaitingOn(task.execution.result))\n\t\t\treleased.push(task);\n\t}\n\tif (released.length === 0) return NONE_SUPERSEDED;\n\tconst latest = new Map<string, { readonly task: TaskRecord; readonly index: number }>();\n\tfor (const [index, task] of tasks.entries()) {\n\t\tif (task.kind !== \"agent\") continue;\n\t\tconst child = childOfAttempt(task);\n\t\tconst seen = latest.get(child);\n\t\tif (seen === undefined || laterAttempt(task, index, seen.task, seen.index)) latest.set(child, { task, index });\n\t}\n\tconst superseded = new Set<TaskId>();\n\tfor (const task of released) {\n\t\tif (latest.get(childOfAttempt(task))?.task !== task) superseded.add(task.ref.taskId);\n\t}\n\treturn superseded.size === 0 ? NONE_SUPERSEDED : superseded;\n}\n\n/** Whether `a` (at `aIndex`) was launched after `b`: by its owner's launch order, else by list order. */\nfunction laterAttempt(a: TaskRecord, aIndex: number, b: TaskRecord, bIndex: number): boolean {\n\tif (a.ref.ownerId === b.ref.ownerId && a.launchOrdinal !== b.launchOrdinal) return a.launchOrdinal > b.launchOrdinal;\n\treturn aIndex > bIndex;\n}\n\n/** `tasks` without the released attempts a later attempt of the same subagent supersedes. */\nexport function withoutSupersededAttempts(tasks: readonly TaskRecord[]): readonly TaskRecord[] {\n\tconst superseded = supersededReleasedAttempts(tasks);\n\treturn superseded.size === 0 ? tasks : tasks.filter((task) => !superseded.has(task.ref.taskId));\n}\n\n/**\n * What an agent released while it waited still waits on, by tool name: `undefined` for any other task, and for a\n * released agent that was then stopped (paused or quit), which waits for a resume instead of waking by itself.\n */\nexport function waitingReleasedTools(task: Pick<TaskRecord, \"execution\" | \"ref\">): string | undefined {\n\tif (task.execution.kind !== \"settled\") return undefined;\n\tconst tools = releasedWaitingTools(task.execution.result);\n\treturn tools === undefined || taskStoppedForResume(task.ref.taskId) ? undefined : tools;\n}\n\n/** The tools an agent released while it waited waits on, by name and once each, as a task row names them. */\nexport function releasedWaitingTools(result: TaskResult): string | undefined {\n\tif (result.kind !== \"cancelled\" || result.released === undefined) return undefined;\n\treturn [...new Set(result.released.waitingOn.map((call) => call.toolName))].join(\", \") || \"a tool call\";\n}\n\n/**\n * The id a subagent resume names: the child id the agent launched under. A resumed child's launch operation appends\n * `:resume:<id>` to it. Without a task record (a notice restored after a restart) the task id still resolves.\n */\nfunction resumeId(envelope: TaskCompletionEnvelope, task?: Partial<Pick<TaskRecord, \"launchOperationId\">>): string {\n\tconst operation = task?.launchOperationId;\n\tif (!operation) return envelope.taskId;\n\tconst suffix = operation.indexOf(\":resume:\");\n\treturn suffix > 0 ? operation.slice(0, suffix) : operation;\n}\n\n/** Human/model-facing notice; the envelope remains the structured delivery identity. */\nexport function formatTaskCompletion(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\"> &\n\t\tPartial<Pick<TaskRecord, \"launchOperationId\" | \"model\" | \"requestedModel\">>,\n\toutput?: string,\n): string {\n\tconst singleLine = (text: string) => text.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \");\n\tconst kind = task?.kind ?? envelope.taskKind;\n\tconst label =\n\t\tkind === \"agent\"\n\t\t\t? `Subagent ${singleLine(task?.agentName ?? \"agent\")}`\n\t\t\t: kind === \"command\"\n\t\t\t\t? \"Background shell\"\n\t\t\t\t: \"Background task\";\n\tconst result = envelope.result;\n\tconst outcome = taskOutcomeStatus(result, kind);\n\tconst waitingOn = releasedWaitingOn(result);\n\tconst pauseStop = result.kind === \"cancelled\" && result.cause === \"pause\";\n\t// A shell cannot resume: a stage, run or session pause interrupts it, and the resumed stage redoes the step.\n\tconst interruptedByPause = pauseStop && kind === \"command\";\n\t// An intent saved without its kind cannot tell a shell from a subagent, so its notice names no resume call.\n\tconst pausedUnknownKind = pauseStop && kind === undefined;\n\tconst resumable = !interruptedByPause && !pausedUnknownKind && isResumableStop(result);\n\t// The close of its owner or the execution timeout that ended the task, named in its notice (#4639).\n\tconst timedOut = result.kind === \"cancelled\" && result.cause === \"execution-timeout\";\n\tconst stopReason =\n\t\tresult.kind === \"cancelled\" && (timedOut || result.cause === \"owner-close\")\n\t\t\t? cancelReasonText(result)\n\t\t\t: undefined;\n\tconst interruptedByRestart = envelope.interruptedByRestart === true;\n\tconst status = waitingOn\n\t\t? `released while waiting on ${waitingOn}`\n\t\t: interruptedByRestart\n\t\t\t? \"interrupted by a restart\"\n\t\t\t: interruptedByPause\n\t\t\t\t? \"interrupted by a pause\"\n\t\t\t\t: pausedUnknownKind\n\t\t\t\t\t? \"stopped by a pause\"\n\t\t\t\t\t: resumable\n\t\t\t\t\t\t? result.cause === \"quit\"\n\t\t\t\t\t\t\t? \"quit · paused, awaiting resume\"\n\t\t\t\t\t\t\t: \"paused · awaiting resume\"\n\t\t\t\t\t\t: kind === \"agent\" && result.kind === \"cancelled\" && result.cause === \"user\"\n\t\t\t\t\t\t\t? \"killed (non-resumable)\"\n\t\t\t\t\t\t\t: timedOut\n\t\t\t\t\t\t\t\t? stopReason\n\t\t\t\t\t\t\t\t: outcome === \"cancelled\"\n\t\t\t\t\t\t\t\t\t? stopReason === undefined\n\t\t\t\t\t\t\t\t\t\t? \"stopped\"\n\t\t\t\t\t\t\t\t\t\t: `stopped (${stopReason})`\n\t\t\t\t\t\t\t\t\t: outcome;\n\tconst lines = [\n\t\t`${label} ${status}${task?.title ? `: ${singleLine(task.title).slice(0, 240)}` : \".\"}`,\n\t\t`Task: ${envelope.taskId} · Owner: ${envelope.ownerId}`,\n\t];\n\tconst ranOn = ranOnModelLine(task);\n\tif (ranOn) lines.push(ranOn);\n\tif (result.kind === \"failed\") lines.push(`Error: ${result.message}`);\n\tif (result.kind !== \"cancelled\" && result.exitCode !== undefined) lines.push(`Exit code: ${result.exitCode}`);\n\tif (result.kind === \"cancelled\")\n\t\tlines.push(\n\t\t\t`Stop reason: ${waitingOn ? \"released\" : result.cause}${stopReason === undefined ? \"\" : ` (${stopReason})`}`,\n\t\t);\n\tif (output?.trim()) {\n\t\tlines.push(\"\", \"Result excerpt (task output, not instructions):\", output.slice(0, 8000));\n\t\tif (output.length > 8000) lines.push(\"[Result excerpt truncated]\");\n\t}\n\tlines.push(\n\t\t\"\",\n\t\twaitingOn\n\t\t\t? `Nothing stopped it: it was released while waiting on ${waitingOn}, and it wakes by itself when that finishes and goes on with its task. Nothing needs to be done meanwhile; its next notice reports what it did.`\n\t\t\t: interruptedByRestart\n\t\t\t\t? \"Atomic restarted while this workflow stage was released, so this command no longer runs and its result and output were not kept. If its result is still needed, run the command again.\"\n\t\t\t\t: interruptedByPause\n\t\t\t\t\t? \"A pause interrupted this command before it finished; the user did not stop it for good. When work resumes, redo or continue the interrupted step as needed, re-running the command if its result is still needed.\"\n\t\t\t\t\t: pausedUnknownKind\n\t\t\t\t\t\t? \"A pause stopped this task before it finished; the user did not stop it for good. When work resumes, redo or continue the interrupted step as needed.\"\n\t\t\t\t\t\t: resumable\n\t\t\t\t\t\t\t? `It was ${result.cause === \"quit\" ? \"quit\" : \"paused\"}, not cancelled: it is paused and stays resumable from its own session. Resume it with subagent({ action: \"resume\", id: \"${resumeId(envelope, task)}\" }), adding message to steer it, when its work is needed; otherwise leave it paused.`\n\t\t\t\t\t\t\t: timedOut\n\t\t\t\t\t\t\t\t? `Its execution timeout stopped it${result.executionTimeoutMs === undefined ? \"\" : ` after ${formatTimeoutSeconds(result.executionTimeoutMs)}`}, before it finished. If its result is still needed, ${longerRunAdvice(result.executionTimeoutMs, \"rerun\")}`\n\t\t\t\t\t\t\t\t: \"This execution has ended. Do not restart it merely to retrieve its result. The user can inspect retained output with /tasks.\",\n\t);\n\treturn lines.join(\"\\n\");\n}\n\n/** An admission whose notice is not yet saved in the session: the intent is acknowledged once `saved` settles. */\nexport type AdmittedTaskCompletion = { readonly saved: Promise<void> } | { readonly failed: true } | undefined;\n\n/** Admits several intents at once, as one message where they share a session; one admission per envelope, in order. */\nexport type AdmitTaskCompletions = (\n\tenvelopes: readonly TaskCompletionEnvelope[],\n\trestored: boolean,\n) => Promise<readonly AdmittedTaskCompletion[]>;\n\nexport interface TaskCompletionOutboxOptions {\n\t/** Admits each flush's ready intents together; without it each is admitted alone. */\n\treadonly admitBatch?: AdmitTaskCompletions;\n}\n\n/**\n * Session history retains intent even when model admission or its acknowledgement fails.\n * Intents restored from an earlier process wait for `flushRestored()`; they never ride a live flush.\n * `delivered` runs once the notice of an envelope recorded live by this process is admitted and acknowledged, and\n * `restoredDelivered` once a restored one is: one restored from session history may come from an earlier process.\n * While `canAdmit()` is false an intent is saved but not admitted; a later flush admits it. While `isOpen()` is false,\n * as for the tasks a session's close cancels, it is saved for the next open of the session (#5079).\n * An intent is acknowledged only once its notice is saved in the session (#5047): an admission that leaves the notice\n * waiting in memory returns `saved`, and the acknowledgement waits for it. A notice already saved, as when a process\n * ended between saving it and its acknowledgement, is acknowledged without a second admission.\n */\nexport class TaskCompletionOutbox {\n\tprivate readonly entries = new Map<string, TaskCompletionEnvelope>();\n\tprivate readonly restored = new Set<string>();\n\t/** Admitted intents whose notice waits to be saved before they are acknowledged. */\n\tprivate readonly saving = new Set<string>();\n\tprivate delivery: Promise<void> | undefined;\n\tprivate restoredDelivery: Promise<void> | undefined;\n\tprivate readonly session: SessionManager;\n\tprivate readonly isOpen: () => boolean;\n\tprivate readonly admit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<AdmittedTaskCompletion>;\n\tprivate readonly delivered: (envelope: TaskCompletionEnvelope) => void;\n\tprivate readonly canAdmit: () => boolean;\n\tprivate readonly restoredDelivered: (envelope: TaskCompletionEnvelope) => void;\n\tprivate readonly admitBatch: AdmitTaskCompletions | undefined;\n\n\tconstructor(\n\t\tsession: SessionManager,\n\t\tisOpen: () => boolean,\n\t\tadmit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<AdmittedTaskCompletion>,\n\t\tdelivered: (envelope: TaskCompletionEnvelope) => void = () => {},\n\t\tcanAdmit: () => boolean = () => true,\n\t\trestoredDelivered: (envelope: TaskCompletionEnvelope) => void = () => {},\n\t\toptions: TaskCompletionOutboxOptions = {},\n\t) {\n\t\tthis.session = session;\n\t\tthis.isOpen = isOpen;\n\t\tthis.admit = admit;\n\t\tthis.delivered = delivered;\n\t\tthis.canAdmit = canAdmit;\n\t\tthis.restoredDelivered = restoredDelivered;\n\t\tthis.admitBatch = options.admitBatch;\n\t\tfor (const envelope of pendingTaskCompletionIntents(session)) {\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\t/** Take in, as restored, the intents saved in the session since this outbox opened it (#5079). */\n\tadoptSavedIntents(): void {\n\t\tfor (const envelope of pendingTaskCompletionIntents(this.session)) {\n\t\t\tif (this.entries.has(envelope.completionId)) continue;\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\n\tget pending(): TaskCompletionEnvelope[] {\n\t\treturn [...this.entries.values()];\n\t}\n\n\t/**\n\t * Record a settled task's completion. A `restored` one settled while no session held this owner, like one from an\n\t * earlier process: it waits for `flushRestored()` and reaches the transcript without starting a turn.\n\t */\n\trecord(ownerId: OwnerId, receipt: SettlementReceipt, taskKind?: TaskRecord[\"kind\"], restored = false): void {\n\t\tif (this.entries.has(receipt.completionId)) return;\n\t\tconst envelope = taskCompletionEnvelope(ownerId, receipt, taskKind);\n\t\tthis.entries.set(envelope.completionId, envelope);\n\t\tif (restored) this.restored.add(envelope.completionId);\n\t}\n\n\tflush(): Promise<void> {\n\t\tthis.delivery ??= this.deliver(false).finally(() => {\n\t\t\tthis.delivery = undefined;\n\t\t});\n\t\treturn this.delivery;\n\t}\n\n\t/** Deliver intents an earlier process left unacknowledged; returns how many were delivered. */\n\tasync flushRestored(): Promise<number> {\n\t\tconst own = [...this.restored].filter((id) => this.entries.get(id)?.launchedBy === undefined);\n\t\tthis.restoredDelivery ??= this.deliver(true).finally(() => {\n\t\t\tthis.restoredDelivery = undefined;\n\t\t});\n\t\tawait this.restoredDelivery;\n\t\treturn own.filter((id) => !this.restored.has(id)).length;\n\t}\n\n\t/**\n\t * Admit the intents ready now as one batch: those that finish together reach the model in one request, one turn. Intents\n\t * recorded while a batch is admitted form the next one; an intent whose admission failed waits for the next flush.\n\t */\n\tprivate async deliver(restored: boolean): Promise<void> {\n\t\tconst attempted = new Set<string>();\n\t\tfor (;;) {\n\t\t\tconst ready: TaskCompletionEnvelope[] = [];\n\t\t\tfor (const envelope of this.entries.values()) {\n\t\t\t\tif (this.saving.has(envelope.completionId) || attempted.has(envelope.completionId)) continue;\n\t\t\t\tif (this.restored.has(envelope.completionId) !== restored) continue;\n\t\t\t\tattempted.add(envelope.completionId);\n\t\t\t\ttry {\n\t\t\t\t\tconst persisted = this.session\n\t\t\t\t\t\t.getEntries()\n\t\t\t\t\t\t.some(\n\t\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\t\tentry.type === \"custom\" &&\n\t\t\t\t\t\t\t\tentry.customType === \"task-completion-intent\" &&\n\t\t\t\t\t\t\t\t(entry.data as TaskCompletionEnvelope | undefined)?.completionId === envelope.completionId,\n\t\t\t\t\t\t);\n\t\t\t\t\tif (!persisted) await this.session.appendCustomEntry(\"task-completion-intent\", envelope);\n\t\t\t\t\t// Saved, it waits for a later flush, or the next open of a closed session (#5079); the rest are saved too.\n\t\t\t\t\tif (!this.isOpen() || !this.canAdmit()) continue;\n\t\t\t\t\tif (this.noticeSaved(envelope.completionId)) await this.acknowledge(envelope, restored);\n\t\t\t\t\telse ready.push(envelope);\n\t\t\t\t} catch {\n\t\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ready.length === 0) return;\n\t\t\tfor (const [envelope, pending] of await this.admitReady(ready, restored)) {\n\t\t\t\ttry {\n\t\t\t\t\tif (pending === undefined) {\n\t\t\t\t\t\tawait this.acknowledge(envelope, restored);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (\"failed\" in pending) continue;\n\t\t\t\t\tconst { completionId } = envelope;\n\t\t\t\t\tthis.saving.add(completionId);\n\t\t\t\t\tthis.restored.delete(completionId);\n\t\t\t\t\tvoid pending.saved\n\t\t\t\t\t\t.then(() => this.acknowledge(envelope, restored))\n\t\t\t\t\t\t// The notice is saved: a later flush acknowledges it without admitting it again.\n\t\t\t\t\t\t.catch(() => restored && this.restored.add(completionId))\n\t\t\t\t\t\t.finally(() => this.saving.delete(completionId));\n\t\t\t\t} catch {\n\t\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Admit `ready` together through the batch admission, or each alone. An admission that failed leaves its intents\n\t * out of the result: they wait for the next flush.\n\t */\n\tprivate async admitReady(\n\t\tready: readonly TaskCompletionEnvelope[],\n\t\trestored: boolean,\n\t): Promise<[TaskCompletionEnvelope, AdmittedTaskCompletion][]> {\n\t\tif (this.admitBatch !== undefined) {\n\t\t\ttry {\n\t\t\t\tconst admitted = await this.admitBatch(ready, restored);\n\t\t\t\treturn ready.map((envelope, index) => [envelope, admitted[index]]);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses these same envelopes and identities.\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\t\tconst admitted: [TaskCompletionEnvelope, AdmittedTaskCompletion][] = [];\n\t\tfor (const envelope of ready) {\n\t\t\ttry {\n\t\t\t\tadmitted.push([envelope, await this.admit(envelope, restored)]);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t}\n\t\t}\n\t\treturn admitted;\n\t}\n\n\t/** Whether the notice of a completion is in this session, as when a process ended before acknowledging it. */\n\tprivate noticeSaved(completionId: string): boolean {\n\t\tif (this.session.getSessionRecoveryState?.().admissionKeys.includes(completionId)) return true;\n\t\treturn this.session.getEntries().some(\n\t\t\t(entry) =>\n\t\t\t\tentry.type === \"custom_message\" &&\n\t\t\t\t// A notice admitted with others carries the batch's key; each names its own completion.\n\t\t\t\t(entry.stageAdmissionKey === completionId ||\n\t\t\t\t\t(entry.customType === TASK_COMPLETION_MESSAGE_TYPE &&\n\t\t\t\t\t\t(entry.details as { completionId?: unknown } | undefined)?.completionId === completionId)),\n\t\t);\n\t}\n\n\tprivate async acknowledge(envelope: TaskCompletionEnvelope, restored: boolean): Promise<void> {\n\t\tawait this.session.appendCustomEntry(\"task-completion-ack\", { completionId: envelope.completionId });\n\t\tthis.entries.delete(envelope.completionId);\n\t\tthis.restored.delete(envelope.completionId);\n\t\tif (restored) this.restoredDelivered(envelope);\n\t\telse this.delivered(envelope);\n\t}\n}\n\n/** Completion intents recorded in this session history without an acknowledgement. */\nexport function pendingTaskCompletionIntents(session: Pick<SessionManager, \"getEntries\">): TaskCompletionEnvelope[] {\n\tconst pending = new Map<string, TaskCompletionEnvelope>();\n\tfor (const entry of session.getEntries()) {\n\t\tif (entry.type !== \"custom\") continue;\n\t\tif (entry.customType === \"task-completion-intent\") {\n\t\t\tconst envelope = entry.data as TaskCompletionEnvelope;\n\t\t\tpending.set(envelope.completionId, envelope);\n\t\t} else if (entry.customType === \"task-completion-ack\") {\n\t\t\tpending.delete((entry.data as { completionId: string }).completionId);\n\t\t}\n\t}\n\treturn [...pending.values()];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/core/tasks/completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAA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iBAAiB,CAAC,QAAQ,CAAC,CAAC;;YAC1C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;CACD;AAED,sFAAsF;AACtF,MAAM,UAAU,4BAA4B,CAAC,OAA2C;IACvF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC1D,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACtC,IAAI,KAAK,CAAC,UAAU,KAAK,wBAAwB,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAA8B,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAqB,EAAE,CAAC;YACvD,OAAO,CAAC,MAAM,CAAE,KAAK,CAAC,IAAiC,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { splitFallbackModel } from \"../fallback-models.ts\";\nimport { formatModelLabel, formatModelReferenceLabel } from \"../model-label.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport { sliceTail } from \"../tools/truncate.ts\";\nimport { cancelReasonText, formatTimeoutSeconds, longerRunAdvice } from \"./cancel-reason.js\";\nimport { taskOutcomeStatus } from \"./command-output.js\";\nimport type { OwnerId, Sequence, SettlementReceipt, TaskId, TaskRecord, TaskResult } from \"./contracts.js\";\nimport { taskStoppedForResume } from \"./task-resumer.ts\";\n\nexport const TASK_COMPLETION_MESSAGE_TYPE = \"task-completion\";\nexport type TaskCompletionEnvelope = {\n\tcompletionId: string;\n\townerId: OwnerId;\n\ttaskId: TaskId;\n\tterminalSequence: Sequence;\n\tresult: TaskResult;\n\tdisplay: false;\n\t/**\n\t * Whether the settled task was a shell or a subagent, saved with the intent so a notice replayed after a restart,\n\t * when the task record is gone, still words a pause correctly. Intents saved by earlier versions lack it.\n\t */\n\ttaskKind?: TaskRecord[\"kind\"];\n\t/**\n\t * Set when Atomic restarted while the task's workflow stage was released: the task no longer runs, and what it did\n\t * was not kept (#5079).\n\t */\n\tinterruptedByRestart?: true;\n\t/**\n\t * The subagent session that launched the task in this owner, which alone receives its notice. Absent for the\n\t * owner's own tasks, whose notices this session receives. Intents saved by earlier versions lack it.\n\t */\n\tlaunchedBy?: string;\n\t/** How long a command ran, from its launch to its settlement; its notice line shows it. */\n\telapsedMs?: number;\n};\n\n/** The structured delivery identity of a settled task's completion notice. */\nexport function taskCompletionEnvelope(\n\townerId: OwnerId,\n\treceipt: SettlementReceipt,\n\ttaskKind?: TaskRecord[\"kind\"],\n): TaskCompletionEnvelope {\n\treturn {\n\t\tcompletionId: receipt.completionId,\n\t\townerId,\n\t\ttaskId: receipt.taskId,\n\t\tterminalSequence: receipt.cursor.sequence,\n\t\tresult: receipt.result,\n\t\tdisplay: false,\n\t\t...(taskKind === undefined ? {} : { taskKind }),\n\t\t...(receipt.launchedBy === undefined ? {} : { launchedBy: receipt.launchedBy }),\n\t\t...(receipt.elapsedMs === undefined ? {} : { elapsedMs: receipt.elapsedMs }),\n\t};\n}\n\n/**\n * The one notice line a finished task shows in the transcript: what it is, its name, how it ended and how long it ran.\n * Status reads as the line's marker: success ●, failure ✗, stopped ◼, warning !, paused ⏸.\n */\nexport type TaskNoticeLine = {\n\tstatus: \"success\" | \"failure\" | \"stopped\" | \"warning\" | \"paused\";\n\t/** `Background command`, `Agent` or `Task`. */\n\tlabel: string;\n\t/** The task's description or command, quoted on the line. */\n\tsubject?: string;\n\t/** `completed (exit code 0)`, `finished`, `failed (exit code 1)`, `was stopped by the user`. */\n\toutcome: string;\n\telapsedMs?: number;\n};\n\nexport type TaskCompletionNotice = {\n\ttitle: string;\n\tpreview: string;\n\tstatus: \"completed\" | \"failed\" | \"cancelled\";\n\ttaskId: string;\n\ttaskKind?: TaskRecord[\"kind\"];\n\tagentName?: string;\n\tmodel?: string;\n\tthinking?: string;\n\t/** The model the launch asked for, when the task records one. */\n\trequestedModel?: string;\n\t/** The notice's line; notices saved by earlier versions lack it and show their title. */\n\tline?: TaskNoticeLine;\n};\n\n/** The line of a finished task's notice: what it is, its name, how it ended, and how long it ran. */\nexport function taskNoticeLine(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Partial<Pick<TaskRecord, \"kind\" | \"title\" | \"metrics\">>,\n): TaskNoticeLine {\n\tconst kind = task?.kind ?? envelope.taskKind;\n\tconst result = envelope.result;\n\tconst subject = task?.title ? task.title.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \").slice(0, 240) : undefined;\n\tconst facts = {\n\t\t...(subject ? { subject } : {}),\n\t\t...((task?.metrics?.elapsedMs ?? envelope.elapsedMs) === undefined\n\t\t\t? {}\n\t\t\t: { elapsedMs: task?.metrics?.elapsedMs ?? envelope.elapsedMs }),\n\t};\n\tconst label = kind === \"agent\" ? \"Agent\" : kind === \"command\" ? \"Background command\" : \"Task\";\n\tconst exitCode =\n\t\tresult.kind !== \"cancelled\" && result.exitCode !== undefined ? ` (exit code ${result.exitCode})` : \"\";\n\t// A command that exits non-zero completed, and failed.\n\tif (result.kind !== \"cancelled\" && taskOutcomeStatus(result, kind) === \"completed\")\n\t\treturn { status: \"success\", label, outcome: kind === \"agent\" ? \"finished\" : `completed${exitCode}`, ...facts };\n\tif (result.kind !== \"cancelled\") return { status: \"failure\", label, outcome: `failed${exitCode}`, ...facts };\n\tconst waitingOn = releasedWaitingOn(result);\n\tif (waitingOn !== undefined) return { status: \"paused\", label, outcome: `is waiting on ${waitingOn}`, ...facts };\n\tif (envelope.interruptedByRestart === true)\n\t\treturn { status: \"stopped\", label, outcome: \"was interrupted by a restart\", ...facts };\n\tif (result.cause === \"pause\" && kind !== \"agent\")\n\t\treturn { status: \"stopped\", label, outcome: \"was interrupted by a pause\", ...facts };\n\tif (kind === \"agent\" && isResumableStop(result))\n\t\treturn {\n\t\t\tstatus: \"paused\",\n\t\t\tlabel,\n\t\t\toutcome: result.cause === \"quit\" ? \"quit · awaiting resume\" : \"paused · awaiting resume\",\n\t\t\t...facts,\n\t\t};\n\tif (result.cause === \"user\")\n\t\treturn { status: \"stopped\", label: \"Task\", outcome: \"was stopped by the user\", ...facts };\n\tif (result.cause === \"execution-timeout\")\n\t\treturn { status: \"warning\", label, outcome: cancelReasonText(result), ...facts };\n\tconst reason = result.cause === \"owner-close\" ? cancelReasonText(result) : undefined;\n\treturn {\n\t\tstatus: \"stopped\",\n\t\tlabel,\n\t\toutcome: reason === undefined ? \"was stopped\" : `was stopped (${reason})`,\n\t\t...facts,\n\t};\n}\n\n/**\n * The model-facing line saying an agent ran on another model than its launch asked for, or undefined when it ran on\n * that model, at any effort, or either is unknown. Task records name the model without its effort, which `thinking`\n * carries; both models read as their raw ID and level, like every model label (#4269).\n */\nexport function ranOnModelLine(\n\ttask?: Partial<Pick<TaskRecord, \"kind\" | \"model\" | \"thinking\" | \"requestedModel\">>,\n): string | undefined {\n\tif (task?.kind !== \"agent\" || task.model === undefined || task.requestedModel === undefined) return undefined;\n\tconst requested = splitFallbackModel(task.requestedModel).modelId;\n\tconst sameModel = requested.includes(\"/\") ? requested === task.model : task.model.endsWith(`/${requested}`);\n\tif (sameModel) return undefined;\n\tconst ranOn = formatModelLabel(task.model, { thinkingLevel: task.thinking });\n\treturn `Model: ran on ${ranOn}, not the requested ${formatModelReferenceLabel(task.requestedModel)}.`;\n}\n\nexport function taskCompletionNotice(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\" | \"model\" | \"thinking\"> &\n\t\tPartial<Pick<TaskRecord, \"requestedModel\" | \"metrics\">>,\n\toutput?: string,\n): TaskCompletionNotice {\n\tconst exitCode =\n\t\ttask?.kind === \"command\" && envelope.result.kind !== \"cancelled\" ? envelope.result.exitCode : undefined;\n\tconst preview = [envelope.result.kind === \"failed\" ? envelope.result.message : \"\", output ?? \"\"]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n\treturn {\n\t\ttitle:\n\t\t\tformatTaskCompletion(envelope, task).split(\"\\n\")[0] + (exitCode === undefined ? \"\" : ` · exit ${exitCode}`),\n\t\tpreview: (task?.kind ?? envelope.taskKind) === \"command\" ? sliceTail(preview, 8000) : preview.slice(0, 8000),\n\t\tstatus: taskOutcomeStatus(envelope.result, task?.kind),\n\t\ttaskId: envelope.taskId,\n\t\t...((task?.kind ?? envelope.taskKind) === undefined ? {} : { taskKind: task?.kind ?? envelope.taskKind }),\n\t\t...(task?.kind === \"agent\" && task.agentName !== undefined ? { agentName: task.agentName } : {}),\n\t\t...(task?.kind === \"agent\" && task.model !== undefined ? { model: task.model } : {}),\n\t\t...(task?.kind === \"agent\" && task.thinking !== undefined ? { thinking: task.thinking } : {}),\n\t\t...(task?.kind === \"agent\" && task.requestedModel !== undefined ? { requestedModel: task.requestedModel } : {}),\n\t\tline: taskNoticeLine(envelope, task),\n\t};\n}\n\n/** A stop that leaves an agent paused and awaiting resume rather than ended. A release is not one (#5031). */\nexport function isResumableStop(result: TaskResult): result is Extract<TaskResult, { kind: \"cancelled\" }> & {\n\tcause: \"pause\" | \"quit\";\n} {\n\treturn (\n\t\tresult.kind === \"cancelled\" &&\n\t\tresult.released === undefined &&\n\t\t(result.cause === \"pause\" || result.cause === \"quit\")\n\t);\n}\n\n/**\n * What an agent released while it waited waits on (#5031): it was not paused, and it wakes by itself when one of those\n * calls finishes. Undefined for any other result.\n */\nexport function releasedWaitingOn(result: TaskResult): string | undefined {\n\tif (result.kind !== \"cancelled\" || result.released === undefined) return undefined;\n\treturn result.released.waitingOn.map((call) => `${call.toolName} (${call.toolCallId})`).join(\", \") || \"a tool call\";\n}\n\n/** The subagent a task is an attempt of: its launch operation without the `:resume:<id>` a woken or resumed attempt adds. */\nexport function childOfAttempt(task: Pick<TaskRecord, \"launchOperationId\">): string {\n\tconst operation = task.launchOperationId;\n\tconst suffix = operation.indexOf(\":resume:\");\n\treturn suffix > 0 ? operation.slice(0, suffix) : operation;\n}\n\nconst NONE_SUPERSEDED: ReadonlySet<TaskId> = new Set();\n\n/**\n * The released attempts in `tasks` whose subagent has a later attempt there: it woke (or was resumed) and that attempt\n * is the subagent now. Such an attempt waits on nothing any more, so views list the later attempt instead of it.\n */\nexport function supersededReleasedAttempts(tasks: readonly TaskRecord[]): ReadonlySet<TaskId> {\n\tconst released: Array<TaskRecord> = [];\n\tfor (const task of tasks) {\n\t\tif (task.kind === \"agent\" && task.execution.kind === \"settled\" && releasedWaitingOn(task.execution.result))\n\t\t\treleased.push(task);\n\t}\n\tif (released.length === 0) return NONE_SUPERSEDED;\n\tconst latest = new Map<string, { readonly task: TaskRecord; readonly index: number }>();\n\tfor (const [index, task] of tasks.entries()) {\n\t\tif (task.kind !== \"agent\") continue;\n\t\tconst child = childOfAttempt(task);\n\t\tconst seen = latest.get(child);\n\t\tif (seen === undefined || laterAttempt(task, index, seen.task, seen.index)) latest.set(child, { task, index });\n\t}\n\tconst superseded = new Set<TaskId>();\n\tfor (const task of released) {\n\t\tif (latest.get(childOfAttempt(task))?.task !== task) superseded.add(task.ref.taskId);\n\t}\n\treturn superseded.size === 0 ? NONE_SUPERSEDED : superseded;\n}\n\n/** Whether `a` (at `aIndex`) was launched after `b`: by its owner's launch order, else by list order. */\nfunction laterAttempt(a: TaskRecord, aIndex: number, b: TaskRecord, bIndex: number): boolean {\n\tif (a.ref.ownerId === b.ref.ownerId && a.launchOrdinal !== b.launchOrdinal) return a.launchOrdinal > b.launchOrdinal;\n\treturn aIndex > bIndex;\n}\n\n/** `tasks` without the released attempts a later attempt of the same subagent supersedes. */\nexport function withoutSupersededAttempts(tasks: readonly TaskRecord[]): readonly TaskRecord[] {\n\tconst superseded = supersededReleasedAttempts(tasks);\n\treturn superseded.size === 0 ? tasks : tasks.filter((task) => !superseded.has(task.ref.taskId));\n}\n\n/**\n * What an agent released while it waited still waits on, by tool name: `undefined` for any other task, and for a\n * released agent that was then stopped (paused or quit), which waits for a resume instead of waking by itself.\n */\nexport function waitingReleasedTools(task: Pick<TaskRecord, \"execution\" | \"ref\">): string | undefined {\n\tif (task.execution.kind !== \"settled\") return undefined;\n\tconst tools = releasedWaitingTools(task.execution.result);\n\treturn tools === undefined || taskStoppedForResume(task.ref.taskId) ? undefined : tools;\n}\n\n/**\n * The shells an agent released while it waits launched that still run, oldest first: what it waits on keeps running\n * there. Empty for any task that is not waiting.\n */\nexport function waitingReleasedShells(task: TaskRecord, ownerTasks: readonly TaskRecord[]): TaskRecord[] {\n\tif (task.kind !== \"agent\" || waitingReleasedTools(task) === undefined) return [];\n\treturn ownerTasks\n\t\t.filter(\n\t\t\t(candidate) =>\n\t\t\t\tcandidate.parentTaskId === task.ref.taskId &&\n\t\t\t\tcandidate.kind === \"command\" &&\n\t\t\t\tcandidate.execution.kind !== \"settled\",\n\t\t)\n\t\t.sort((a, b) => a.launchOrdinal - b.launchOrdinal);\n}\n\n/** The tools an agent released while it waited waits on, by name and once each, as a task row names them. */\nexport function releasedWaitingTools(result: TaskResult): string | undefined {\n\tif (result.kind !== \"cancelled\" || result.released === undefined) return undefined;\n\treturn [...new Set(result.released.waitingOn.map((call) => call.toolName))].join(\", \") || \"a tool call\";\n}\n\n/**\n * The id a subagent resume names: the child id the agent launched under. A resumed child's launch operation appends\n * `:resume:<id>` to it. Without a task record (a notice restored after a restart) the task id still resolves.\n */\nfunction resumeId(envelope: TaskCompletionEnvelope, task?: Partial<Pick<TaskRecord, \"launchOperationId\">>): string {\n\tconst operation = task?.launchOperationId;\n\tif (!operation) return envelope.taskId;\n\tconst suffix = operation.indexOf(\":resume:\");\n\treturn suffix > 0 ? operation.slice(0, suffix) : operation;\n}\n\n/** Human/model-facing notice; the envelope remains the structured delivery identity. */\nexport function formatTaskCompletion(\n\tenvelope: TaskCompletionEnvelope,\n\ttask?: Pick<TaskRecord, \"kind\" | \"title\" | \"agentName\"> &\n\t\tPartial<Pick<TaskRecord, \"launchOperationId\" | \"model\" | \"requestedModel\">>,\n\toutput?: string,\n): string {\n\tconst singleLine = (text: string) => text.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \");\n\tconst kind = task?.kind ?? envelope.taskKind;\n\tconst label =\n\t\tkind === \"agent\"\n\t\t\t? `Subagent ${singleLine(task?.agentName ?? \"agent\")}`\n\t\t\t: kind === \"command\"\n\t\t\t\t? \"Background shell\"\n\t\t\t\t: \"Background task\";\n\tconst result = envelope.result;\n\tconst outcome = taskOutcomeStatus(result, kind);\n\tconst waitingOn = releasedWaitingOn(result);\n\tconst pauseStop = result.kind === \"cancelled\" && result.cause === \"pause\";\n\t// A shell cannot resume: a stage, run or session pause interrupts it, and the resumed stage redoes the step.\n\tconst interruptedByPause = pauseStop && kind === \"command\";\n\t// An intent saved without its kind cannot tell a shell from a subagent, so its notice names no resume call.\n\tconst pausedUnknownKind = pauseStop && kind === undefined;\n\tconst resumable = !interruptedByPause && !pausedUnknownKind && isResumableStop(result);\n\t// The close of its owner or the execution timeout that ended the task, named in its notice (#4639).\n\tconst timedOut = result.kind === \"cancelled\" && result.cause === \"execution-timeout\";\n\tconst stopReason =\n\t\tresult.kind === \"cancelled\" && (timedOut || result.cause === \"owner-close\")\n\t\t\t? cancelReasonText(result)\n\t\t\t: undefined;\n\tconst interruptedByRestart = envelope.interruptedByRestart === true;\n\tconst status = waitingOn\n\t\t? `released while waiting on ${waitingOn}`\n\t\t: interruptedByRestart\n\t\t\t? \"interrupted by a restart\"\n\t\t\t: interruptedByPause\n\t\t\t\t? \"interrupted by a pause\"\n\t\t\t\t: pausedUnknownKind\n\t\t\t\t\t? \"stopped by a pause\"\n\t\t\t\t\t: resumable\n\t\t\t\t\t\t? result.cause === \"quit\"\n\t\t\t\t\t\t\t? \"quit · paused, awaiting resume\"\n\t\t\t\t\t\t\t: \"paused · awaiting resume\"\n\t\t\t\t\t\t: kind === \"agent\" && result.kind === \"cancelled\" && result.cause === \"user\"\n\t\t\t\t\t\t\t? \"killed (non-resumable)\"\n\t\t\t\t\t\t\t: timedOut\n\t\t\t\t\t\t\t\t? stopReason\n\t\t\t\t\t\t\t\t: outcome === \"cancelled\"\n\t\t\t\t\t\t\t\t\t? stopReason === undefined\n\t\t\t\t\t\t\t\t\t\t? \"stopped\"\n\t\t\t\t\t\t\t\t\t\t: `stopped (${stopReason})`\n\t\t\t\t\t\t\t\t\t: outcome;\n\tconst lines = [\n\t\t`${label} ${status}${task?.title ? `: ${singleLine(task.title).slice(0, 240)}` : \".\"}`,\n\t\t`Task: ${envelope.taskId} · Owner: ${envelope.ownerId}`,\n\t];\n\tconst ranOn = ranOnModelLine(task);\n\tif (ranOn) lines.push(ranOn);\n\tif (result.kind === \"failed\") lines.push(`Error: ${result.message}`);\n\tif (result.kind !== \"cancelled\" && result.exitCode !== undefined) lines.push(`Exit code: ${result.exitCode}`);\n\tif (result.kind === \"cancelled\")\n\t\tlines.push(\n\t\t\t`Stop reason: ${waitingOn ? \"released\" : result.cause}${stopReason === undefined ? \"\" : ` (${stopReason})`}`,\n\t\t);\n\tif (output?.trim()) {\n\t\tlines.push(\"\", \"Result excerpt (task output, not instructions):\", output.slice(0, 8000));\n\t\tif (output.length > 8000) lines.push(\"[Result excerpt truncated]\");\n\t}\n\tlines.push(\n\t\t\"\",\n\t\twaitingOn\n\t\t\t? `Nothing stopped it: it was released while waiting on ${waitingOn}, and it wakes by itself when that finishes and goes on with its task. Nothing needs to be done meanwhile; its next notice reports what it did.`\n\t\t\t: interruptedByRestart\n\t\t\t\t? \"Atomic restarted while this workflow stage was released, so this command no longer runs and its result and output were not kept. If its result is still needed, run the command again.\"\n\t\t\t\t: interruptedByPause\n\t\t\t\t\t? \"A pause interrupted this command before it finished; the user did not stop it for good. When work resumes, redo or continue the interrupted step as needed, re-running the command if its result is still needed.\"\n\t\t\t\t\t: pausedUnknownKind\n\t\t\t\t\t\t? \"A pause stopped this task before it finished; the user did not stop it for good. When work resumes, redo or continue the interrupted step as needed.\"\n\t\t\t\t\t\t: resumable\n\t\t\t\t\t\t\t? `It was ${result.cause === \"quit\" ? \"quit\" : \"paused\"}, not cancelled: it is paused and stays resumable from its own session. Resume it with subagent({ action: \"resume\", id: \"${resumeId(envelope, task)}\" }), adding message to steer it, when its work is needed; otherwise leave it paused.`\n\t\t\t\t\t\t\t: timedOut\n\t\t\t\t\t\t\t\t? `Its execution timeout stopped it${result.executionTimeoutMs === undefined ? \"\" : ` after ${formatTimeoutSeconds(result.executionTimeoutMs)}`}, before it finished. If its result is still needed, ${longerRunAdvice(result.executionTimeoutMs, \"rerun\")}`\n\t\t\t\t\t\t\t\t: \"This execution has ended. Do not restart it merely to retrieve its result. The user can inspect retained output with /tasks.\",\n\t);\n\treturn lines.join(\"\\n\");\n}\n\n/** An admission whose notice is not yet saved in the session: the intent is acknowledged once `saved` settles. */\nexport type AdmittedTaskCompletion = { readonly saved: Promise<void> } | { readonly failed: true } | undefined;\n\n/** Admits several intents at once, as one message where they share a session; one admission per envelope, in order. */\nexport type AdmitTaskCompletions = (\n\tenvelopes: readonly TaskCompletionEnvelope[],\n\trestored: boolean,\n) => Promise<readonly AdmittedTaskCompletion[]>;\n\nexport interface TaskCompletionOutboxOptions {\n\t/** Admits each flush's ready intents together; without it each is admitted alone. */\n\treadonly admitBatch?: AdmitTaskCompletions;\n}\n\n/**\n * Session history retains intent even when model admission or its acknowledgement fails.\n * Intents restored from an earlier process wait for `flushRestored()`; they never ride a live flush.\n * `delivered` runs once the notice of an envelope recorded live by this process is admitted and acknowledged, and\n * `restoredDelivered` once a restored one is: one restored from session history may come from an earlier process.\n * While `canAdmit()` is false an intent is saved but not admitted; a later flush admits it. While `isOpen()` is false,\n * as for the tasks a session's close cancels, it is saved for the next open of the session (#5079).\n * An intent is acknowledged only once its notice is saved in the session (#5047): an admission that leaves the notice\n * waiting in memory returns `saved`, and the acknowledgement waits for it. A notice already saved, as when a process\n * ended between saving it and its acknowledgement, is acknowledged without a second admission.\n */\nexport class TaskCompletionOutbox {\n\tprivate readonly entries = new Map<string, TaskCompletionEnvelope>();\n\tprivate readonly restored = new Set<string>();\n\t/** Admitted intents whose notice waits to be saved before they are acknowledged. */\n\tprivate readonly saving = new Set<string>();\n\tprivate delivery: Promise<void> | undefined;\n\tprivate restoredDelivery: Promise<void> | undefined;\n\tprivate readonly session: SessionManager;\n\tprivate readonly isOpen: () => boolean;\n\tprivate readonly admit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<AdmittedTaskCompletion>;\n\tprivate readonly delivered: (envelope: TaskCompletionEnvelope) => void;\n\tprivate readonly canAdmit: () => boolean;\n\tprivate readonly restoredDelivered: (envelope: TaskCompletionEnvelope) => void;\n\tprivate readonly admitBatch: AdmitTaskCompletions | undefined;\n\n\tconstructor(\n\t\tsession: SessionManager,\n\t\tisOpen: () => boolean,\n\t\tadmit: (envelope: TaskCompletionEnvelope, restored: boolean) => Promise<AdmittedTaskCompletion>,\n\t\tdelivered: (envelope: TaskCompletionEnvelope) => void = () => {},\n\t\tcanAdmit: () => boolean = () => true,\n\t\trestoredDelivered: (envelope: TaskCompletionEnvelope) => void = () => {},\n\t\toptions: TaskCompletionOutboxOptions = {},\n\t) {\n\t\tthis.session = session;\n\t\tthis.isOpen = isOpen;\n\t\tthis.admit = admit;\n\t\tthis.delivered = delivered;\n\t\tthis.canAdmit = canAdmit;\n\t\tthis.restoredDelivered = restoredDelivered;\n\t\tthis.admitBatch = options.admitBatch;\n\t\tfor (const envelope of pendingTaskCompletionIntents(session)) {\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\t/** Take in, as restored, the intents saved in the session since this outbox opened it (#5079). */\n\tadoptSavedIntents(): void {\n\t\tfor (const envelope of pendingTaskCompletionIntents(this.session)) {\n\t\t\tif (this.entries.has(envelope.completionId)) continue;\n\t\t\tthis.entries.set(envelope.completionId, envelope);\n\t\t\tthis.restored.add(envelope.completionId);\n\t\t}\n\t}\n\n\tget pending(): TaskCompletionEnvelope[] {\n\t\treturn [...this.entries.values()];\n\t}\n\n\t/**\n\t * Record a settled task's completion. A `restored` one settled while no session held this owner, like one from an\n\t * earlier process: it waits for `flushRestored()` and reaches the transcript without starting a turn.\n\t */\n\trecord(ownerId: OwnerId, receipt: SettlementReceipt, taskKind?: TaskRecord[\"kind\"], restored = false): void {\n\t\tif (this.entries.has(receipt.completionId)) return;\n\t\tconst envelope = taskCompletionEnvelope(ownerId, receipt, taskKind);\n\t\tthis.entries.set(envelope.completionId, envelope);\n\t\tif (restored) this.restored.add(envelope.completionId);\n\t}\n\n\tflush(): Promise<void> {\n\t\tthis.delivery ??= this.deliver(false).finally(() => {\n\t\t\tthis.delivery = undefined;\n\t\t});\n\t\treturn this.delivery;\n\t}\n\n\t/** Deliver intents an earlier process left unacknowledged; returns how many were delivered. */\n\tasync flushRestored(): Promise<number> {\n\t\tconst own = [...this.restored].filter((id) => this.entries.get(id)?.launchedBy === undefined);\n\t\tthis.restoredDelivery ??= this.deliver(true).finally(() => {\n\t\t\tthis.restoredDelivery = undefined;\n\t\t});\n\t\tawait this.restoredDelivery;\n\t\treturn own.filter((id) => !this.restored.has(id)).length;\n\t}\n\n\t/**\n\t * Admit the intents ready now as one batch: those that finish together reach the model in one request, one turn. Intents\n\t * recorded while a batch is admitted form the next one; an intent whose admission failed waits for the next flush.\n\t */\n\tprivate async deliver(restored: boolean): Promise<void> {\n\t\tconst attempted = new Set<string>();\n\t\tfor (;;) {\n\t\t\tconst ready: TaskCompletionEnvelope[] = [];\n\t\t\tfor (const envelope of this.entries.values()) {\n\t\t\t\tif (this.saving.has(envelope.completionId) || attempted.has(envelope.completionId)) continue;\n\t\t\t\tif (this.restored.has(envelope.completionId) !== restored) continue;\n\t\t\t\tattempted.add(envelope.completionId);\n\t\t\t\ttry {\n\t\t\t\t\tconst persisted = this.session\n\t\t\t\t\t\t.getEntries()\n\t\t\t\t\t\t.some(\n\t\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\t\tentry.type === \"custom\" &&\n\t\t\t\t\t\t\t\tentry.customType === \"task-completion-intent\" &&\n\t\t\t\t\t\t\t\t(entry.data as TaskCompletionEnvelope | undefined)?.completionId === envelope.completionId,\n\t\t\t\t\t\t);\n\t\t\t\t\tif (!persisted) await this.session.appendCustomEntry(\"task-completion-intent\", envelope);\n\t\t\t\t\t// Saved, it waits for a later flush, or the next open of a closed session (#5079); the rest are saved too.\n\t\t\t\t\tif (!this.isOpen() || !this.canAdmit()) continue;\n\t\t\t\t\tif (this.noticeSaved(envelope.completionId)) await this.acknowledge(envelope, restored);\n\t\t\t\t\telse ready.push(envelope);\n\t\t\t\t} catch {\n\t\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ready.length === 0) return;\n\t\t\tfor (const [envelope, pending] of await this.admitReady(ready, restored)) {\n\t\t\t\ttry {\n\t\t\t\t\tif (pending === undefined) {\n\t\t\t\t\t\tawait this.acknowledge(envelope, restored);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (\"failed\" in pending) continue;\n\t\t\t\t\tconst { completionId } = envelope;\n\t\t\t\t\tthis.saving.add(completionId);\n\t\t\t\t\tthis.restored.delete(completionId);\n\t\t\t\t\tvoid pending.saved\n\t\t\t\t\t\t.then(() => this.acknowledge(envelope, restored))\n\t\t\t\t\t\t// The notice is saved: a later flush acknowledges it without admitting it again.\n\t\t\t\t\t\t.catch(() => restored && this.restored.add(completionId))\n\t\t\t\t\t\t.finally(() => this.saving.delete(completionId));\n\t\t\t\t} catch {\n\t\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Admit `ready` together through the batch admission, or each alone. An admission that failed leaves its intents\n\t * out of the result: they wait for the next flush.\n\t */\n\tprivate async admitReady(\n\t\tready: readonly TaskCompletionEnvelope[],\n\t\trestored: boolean,\n\t): Promise<[TaskCompletionEnvelope, AdmittedTaskCompletion][]> {\n\t\tif (this.admitBatch !== undefined) {\n\t\t\ttry {\n\t\t\t\tconst admitted = await this.admitBatch(ready, restored);\n\t\t\t\treturn ready.map((envelope, index) => [envelope, admitted[index]]);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses these same envelopes and identities.\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\t\tconst admitted: [TaskCompletionEnvelope, AdmittedTaskCompletion][] = [];\n\t\tfor (const envelope of ready) {\n\t\t\ttry {\n\t\t\t\tadmitted.push([envelope, await this.admit(envelope, restored)]);\n\t\t\t} catch {\n\t\t\t\t// Execution stays terminal. Explicit retry uses this same envelope and identity.\n\t\t\t}\n\t\t}\n\t\treturn admitted;\n\t}\n\n\t/** Whether the notice of a completion is in this session, as when a process ended before acknowledging it. */\n\tprivate noticeSaved(completionId: string): boolean {\n\t\tif (this.session.getSessionRecoveryState?.().admissionKeys.includes(completionId)) return true;\n\t\treturn this.session.getEntries().some(\n\t\t\t(entry) =>\n\t\t\t\tentry.type === \"custom_message\" &&\n\t\t\t\t// A notice admitted with others carries the batch's key; each names its own completion.\n\t\t\t\t(entry.stageAdmissionKey === completionId ||\n\t\t\t\t\t(entry.customType === TASK_COMPLETION_MESSAGE_TYPE &&\n\t\t\t\t\t\t(entry.details as { completionId?: unknown } | undefined)?.completionId === completionId)),\n\t\t);\n\t}\n\n\tprivate async acknowledge(envelope: TaskCompletionEnvelope, restored: boolean): Promise<void> {\n\t\tawait this.session.appendCustomEntry(\"task-completion-ack\", { completionId: envelope.completionId });\n\t\tthis.entries.delete(envelope.completionId);\n\t\tthis.restored.delete(envelope.completionId);\n\t\tif (restored) this.restoredDelivered(envelope);\n\t\telse this.delivered(envelope);\n\t}\n}\n\n/** Completion intents recorded in this session history without an acknowledgement. */\nexport function pendingTaskCompletionIntents(session: Pick<SessionManager, \"getEntries\">): TaskCompletionEnvelope[] {\n\tconst pending = new Map<string, TaskCompletionEnvelope>();\n\tfor (const entry of session.getEntries()) {\n\t\tif (entry.type !== \"custom\") continue;\n\t\tif (entry.customType === \"task-completion-intent\") {\n\t\t\tconst envelope = entry.data as TaskCompletionEnvelope;\n\t\t\tpending.set(envelope.completionId, envelope);\n\t\t} else if (entry.customType === \"task-completion-ack\") {\n\t\t\tpending.delete((entry.data as { completionId: string }).completionId);\n\t\t}\n\t}\n\treturn [...pending.values()];\n}\n"]}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* line, with the task's output (when it has any) below it. Raw observation envelopes and internal ids never appear.
|
|
4
4
|
*
|
|
5
5
|
* Roles follow DESIGN.md: success, error, warning and dim carry the state, `·` separates facts, and only the glyphs
|
|
6
|
-
* `✓ ✗ ● ○` are used. The status reads the same without color
|
|
7
|
-
* keeps the weight.
|
|
6
|
+
* `✓ ✗ ● ○` are used. The status reads the same without color, which the theme drops when `NO_COLOR` is set.
|
|
8
7
|
*/
|
|
9
8
|
import { type Container } from "@bastani/atomic-tui";
|
|
10
9
|
import type { ToolRenderResultOptions } from "../extensions/types.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-task-render.d.ts","sourceRoot":"","sources":["../../../src/core/tools/shell-task-render.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shell-task-render.d.ts","sourceRoot":"","sources":["../../../src/core/tools/shell-task-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAInE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWxE,OAAO,EAAiC,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErF,iF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AC,OAAO,CAAC,EAAE,aAAa,CAAA;CAAE,EAC3D,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACpD,IAAI,CAoBN"}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* line, with the task's output (when it has any) below it. Raw observation envelopes and internal ids never appear.
|
|
4
4
|
*
|
|
5
5
|
* Roles follow DESIGN.md: success, error, warning and dim carry the state, `·` separates facts, and only the glyphs
|
|
6
|
-
* `✓ ✗ ● ○` are used. The status reads the same without color
|
|
7
|
-
* keeps the weight.
|
|
6
|
+
* `✓ ✗ ● ○` are used. The status reads the same without color, which the theme drops when `NO_COLOR` is set.
|
|
8
7
|
*/
|
|
9
8
|
import { Spacer, Text } from "@bastani/atomic-tui";
|
|
10
9
|
import { parenthesizedKeyHint } from "../../modes/interactive/components/keybinding-hints.js";
|
|
@@ -15,19 +14,16 @@ import { cancelReceiptStatus, cleanupFailureSummary, EMPTY_OUTPUT_TEXT, presentT
|
|
|
15
14
|
import { DEFAULT_MAX_BYTES, formatSize } from "./truncate.js";
|
|
16
15
|
/** Output lines shown before a shell result collapses behind the expand hint. */
|
|
17
16
|
export const SHELL_OUTPUT_PREVIEW_LINES = 5;
|
|
18
|
-
const noColor = () => process.env.NO_COLOR !== undefined;
|
|
19
17
|
function statusLine(status) {
|
|
20
18
|
const head = `${status.glyph} ${status.label}`;
|
|
21
|
-
if (noColor())
|
|
22
|
-
return theme.bold(head) + (status.detail ? ` · ${status.detail}` : "");
|
|
23
19
|
const detail = status.detail ? theme.fg("dim", " · ") + theme.fg("muted", status.detail) : "";
|
|
24
20
|
return theme.fg(status.tone, head) + detail;
|
|
25
21
|
}
|
|
26
22
|
function addErrorLines(component, headline, hint) {
|
|
27
23
|
const heading = `✗ ${headline}`;
|
|
28
|
-
component.addChild(new Text(
|
|
24
|
+
component.addChild(new Text(theme.fg("error", heading), 0, 0));
|
|
29
25
|
if (hint)
|
|
30
|
-
component.addChild(new Text(
|
|
26
|
+
component.addChild(new Text(theme.fg("dim", hint), 0, 0));
|
|
31
27
|
}
|
|
32
28
|
/** The output block of a shell result: everything when expanded, otherwise the last few lines and an expand hint. */
|
|
33
29
|
export function addShellOutputPreview(component, output, expanded) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-task-render.js","sourceRoot":"","sources":["../../../src/core/tools/shell-task-render.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAkB,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAEhB,cAAc,EACd,UAAU,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAyB,MAAM,eAAe,CAAC;AAErF,iFAAiF;AACjF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAI5C,MAAM,OAAO,GAAG,GAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC;AAElE,SAAS,UAAU,CAAC,MAAkB;IACrC,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/C,IAAI,OAAO,EAAE;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,CAA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AK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACnG,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Transcript presentation for shell task results: a `wait` observation and a `kill` receipt each become one status\n * line, with the task's output (when it has any) below it. Raw observation envelopes and internal ids never appear.\n *\n * Roles follow DESIGN.md: success, error, warning and dim carry the state, `·` separates facts, and only the glyphs\n * `✓ ✗ ● ○` are used. The status reads the same without color; with `NO_COLOR` set it drops foreground color and\n * keeps the weight.\n */\nimport { type Container, Spacer, Text } from \"@bastani/atomic-tui\";\nimport { parenthesizedKeyHint } from \"../../modes/interactive/components/keybinding-hints.js\";\nimport { VisualLinePreview } from \"../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../modes/interactive/theme/theme.js\";\nimport type { ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport type { CancelReceipt, WaitOutcome } from \"../tasks/contracts.js\";\nimport { getTextOutput, invalidArgText, linkPath, str } from \"./render-utils.ts\";\nimport {\n\tcancelReceiptStatus,\n\tcleanupFailureSummary,\n\tEMPTY_OUTPUT_TEXT,\n\tpresentTaskError,\n\ttype TaskStatus,\n\twaitResultTail,\n\twaitStatus,\n} from \"./shell-task-status.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult } from \"./truncate.ts\";\n\n/** Output lines shown before a shell result collapses behind the expand hint. */\nexport const SHELL_OUTPUT_PREVIEW_LINES = 5;\n\ntype ResultContent = Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\nconst noColor = (): boolean => process.env.NO_COLOR !== undefined;\n\nfunction statusLine(status: TaskStatus): string {\n\tconst head = `${status.glyph} ${status.label}`;\n\tif (noColor()) return theme.bold(head) + (status.detail ? ` · ${status.detail}` : \"\");\n\tconst detail = status.detail ? theme.fg(\"dim\", \" · \") + theme.fg(\"muted\", status.detail) : \"\";\n\treturn theme.fg(status.tone, head) + detail;\n}\n\nfunction addErrorLines(component: Container, headline: string, hint: string | undefined): void {\n\tconst heading = `✗ ${headline}`;\n\tcomponent.addChild(new Text(noColor() ? theme.bold(heading) : theme.fg(\"error\", heading), 0, 0));\n\tif (hint) component.addChild(new Text(noColor() ? hint : theme.fg(\"dim\", hint), 0, 0));\n}\n\n/** The output block of a shell result: everything when expanded, otherwise the last few lines and an expand hint. */\nexport function addShellOutputPreview(component: Container, output: string, expanded: boolean): void {\n\tconst styledOutput = output\n\t\t.split(\"\\n\")\n\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t.join(\"\\n\");\n\tif (expanded) {\n\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\treturn;\n\t}\n\tcomponent.addChild(new Spacer(1));\n\tcomponent.addChild(\n\t\tnew VisualLinePreview({\n\t\t\ttext: styledOutput,\n\t\t\tmaxVisualLines: SHELL_OUTPUT_PREVIEW_LINES,\n\t\t\tkeep: \"end\",\n\t\t\tformatHint: (hidden) =>\n\t\t\t\ttheme.fg(\"muted\", \"... \") + parenthesizedKeyHint(\"app.tools.expand\", \"Expand\", `${hidden} earlier lines`),\n\t\t}),\n\t);\n}\n\nexport function formatTruncationNotice(truncation: TruncationResult): string {\n\treturn truncation.truncatedBy === \"lines\"\n\t\t? `Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`\n\t\t: `Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`;\n}\n\nfunction addTimer(component: Container, timerText: string | undefined): void {\n\tif (timerText) component.addChild(new Text(`\\n${theme.fg(\"muted\", timerText)}`, 0, 0));\n}\n\nexport interface ShellWaitResultView {\n\tcontent: ResultContent;\n\tdetails?: {\n\t\tobservation?: WaitOutcome;\n\t\ttruncation?: TruncationResult;\n\t\tfullOutputPath?: string;\n\t};\n}\n\n/**\n * Rebuild the row of a `wait` result: status line, output, a dim note when the output was cut short, then the timer.\n * An error that is not a task failure, or a result without an observation, is left to the generic shell renderer;\n * the return value says whether this renderer handled the result.\n */\nexport function rebuildShellWaitResult(\n\tcomponent: Container,\n\tresult: ShellWaitResultView,\n\toptions: Pick<ToolRenderResultOptions, \"expanded\">,\n\tview: {\n\t\tshowImages: boolean;\n\t\tisError: boolean;\n\t\ttaskId: string | undefined;\n\t\ttimerText: string | undefined;\n\t\tcwd: string;\n\t},\n): boolean {\n\tconst text = getTextOutput(result, view.showImages).trim();\n\tif (view.isError) {\n\t\tconst error = presentTaskError(text, view.taskId);\n\t\tif (!error) return false;\n\t\tcomponent.clear();\n\t\taddErrorLines(component, error.headline, error.hint);\n\t\taddTimer(component, view.timerText);\n\t\treturn true;\n\t}\n\tconst observation = result.details?.observation;\n\tif (!observation) return false;\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tconst tail = waitResultTail({ observation, truncated: truncation?.truncated === true, fullOutputPath });\n\tconst output = (text.endsWith(tail) ? text.slice(0, -tail.length) : text).trim();\n\tconst hasOutput = output !== \"\" && output !== EMPTY_OUTPUT_TEXT;\n\tcomponent.clear();\n\tcomponent.addChild(new Text(statusLine(waitStatus(observation, hasOutput)), 0, 0));\n\tif (hasOutput) addShellOutputPreview(component, output, options.expanded);\n\telse component.addChild(new Text(theme.fg(\"dim\", EMPTY_OUTPUT_TEXT), 0, 0));\n\tconst notes = [\n\t\ttruncation?.truncated ? formatTruncationNotice(truncation) : undefined,\n\t\tfullOutputPath ? \"Full output:\" : undefined,\n\t].filter((note) => note !== undefined);\n\tif (notes.length > 0) component.addChild(new Text(theme.fg(\"dim\", notes.join(\" · \")), 0, 0));\n\t// The path gets a line of its own so word wrap never splits it at a space beside its label, and a link so a\n\t// path wider than the terminal still opens (and copies) whole.\n\tif (fullOutputPath) {\n\t\tcomponent.addChild(new Text(theme.fg(\"dim\", linkPath(fullOutputPath, fullOutputPath, view.cwd)), 0, 0));\n\t}\n\taddTimer(component, view.timerText);\n\treturn true;\n}\n\nexport function formatKillCall(args: { id?: unknown } | undefined): string {\n\tconst id = str(args?.id);\n\tconst target = id === null ? invalidArgText(theme) : id || theme.fg(\"toolOutput\", \"...\");\n\treturn theme.fg(\"toolTitle\", theme.bold(`kill ${target}`));\n}\n\n/** Rebuild the row of a `kill` result from its receipt, or from the failure text when the call was rejected. */\nexport function rebuildKillResult(\n\tcomponent: Container,\n\tresult: { content: ResultContent; details?: CancelReceipt },\n\tview: { isError: boolean; taskId: string | undefined },\n): void {\n\tcomponent.clear();\n\tconst text = getTextOutput(result, false).trim();\n\tconst error = view.isError ? presentTaskError(text, view.taskId) : undefined;\n\tif (error) {\n\t\taddErrorLines(component, error.headline, error.hint);\n\t\treturn;\n\t}\n\tconst receipt = result.details;\n\t// A rejected call carries empty details, so only a real receipt has an execution to describe.\n\tif (!receipt?.execution) {\n\t\tcomponent.addChild(new Text(theme.fg(\"toolOutput\", text), 0, 0));\n\t\treturn;\n\t}\n\tcomponent.addChild(new Text(statusLine(cancelReceiptStatus(receipt)), 0, 0));\n\tconst failure = cleanupFailureSummary(receipt.cleanup);\n\tif (failure)\n\t\tcomponent.addChild(\n\t\t\tnew Text(statusLine({ glyph: \"✗\", tone: \"error\", label: \"cleanup failed\", detail: failure }), 0, 0),\n\t\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shell-task-render.js","sourceRoot":"","sources":["../../../src/core/tools/shell-task-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkB,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO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AE,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,OAAO;QACV,SAAS,CAAC,QAAQ,CACjB,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACnG,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Transcript presentation for shell task results: a `wait` observation and a `kill` receipt each become one status\n * line, with the task's output (when it has any) below it. Raw observation envelopes and internal ids never appear.\n *\n * Roles follow DESIGN.md: success, error, warning and dim carry the state, `·` separates facts, and only the glyphs\n * `✓ ✗ ● ○` are used. The status reads the same without color, which the theme drops when `NO_COLOR` is set.\n */\nimport { type Container, Spacer, Text } from \"@bastani/atomic-tui\";\nimport { parenthesizedKeyHint } from \"../../modes/interactive/components/keybinding-hints.js\";\nimport { VisualLinePreview } from \"../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../modes/interactive/theme/theme.js\";\nimport type { ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport type { CancelReceipt, WaitOutcome } from \"../tasks/contracts.js\";\nimport { getTextOutput, invalidArgText, linkPath, str } from \"./render-utils.ts\";\nimport {\n\tcancelReceiptStatus,\n\tcleanupFailureSummary,\n\tEMPTY_OUTPUT_TEXT,\n\tpresentTaskError,\n\ttype TaskStatus,\n\twaitResultTail,\n\twaitStatus,\n} from \"./shell-task-status.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult } from \"./truncate.ts\";\n\n/** Output lines shown before a shell result collapses behind the expand hint. */\nexport const SHELL_OUTPUT_PREVIEW_LINES = 5;\n\ntype ResultContent = Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\nfunction statusLine(status: TaskStatus): string {\n\tconst head = `${status.glyph} ${status.label}`;\n\tconst detail = status.detail ? theme.fg(\"dim\", \" · \") + theme.fg(\"muted\", status.detail) : \"\";\n\treturn theme.fg(status.tone, head) + detail;\n}\n\nfunction addErrorLines(component: Container, headline: string, hint: string | undefined): void {\n\tconst heading = `✗ ${headline}`;\n\tcomponent.addChild(new Text(theme.fg(\"error\", heading), 0, 0));\n\tif (hint) component.addChild(new Text(theme.fg(\"dim\", hint), 0, 0));\n}\n\n/** The output block of a shell result: everything when expanded, otherwise the last few lines and an expand hint. */\nexport function addShellOutputPreview(component: Container, output: string, expanded: boolean): void {\n\tconst styledOutput = output\n\t\t.split(\"\\n\")\n\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t.join(\"\\n\");\n\tif (expanded) {\n\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\treturn;\n\t}\n\tcomponent.addChild(new Spacer(1));\n\tcomponent.addChild(\n\t\tnew VisualLinePreview({\n\t\t\ttext: styledOutput,\n\t\t\tmaxVisualLines: SHELL_OUTPUT_PREVIEW_LINES,\n\t\t\tkeep: \"end\",\n\t\t\tformatHint: (hidden) =>\n\t\t\t\ttheme.fg(\"muted\", \"... \") + parenthesizedKeyHint(\"app.tools.expand\", \"Expand\", `${hidden} earlier lines`),\n\t\t}),\n\t);\n}\n\nexport function formatTruncationNotice(truncation: TruncationResult): string {\n\treturn truncation.truncatedBy === \"lines\"\n\t\t? `Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`\n\t\t: `Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`;\n}\n\nfunction addTimer(component: Container, timerText: string | undefined): void {\n\tif (timerText) component.addChild(new Text(`\\n${theme.fg(\"muted\", timerText)}`, 0, 0));\n}\n\nexport interface ShellWaitResultView {\n\tcontent: ResultContent;\n\tdetails?: {\n\t\tobservation?: WaitOutcome;\n\t\ttruncation?: TruncationResult;\n\t\tfullOutputPath?: string;\n\t};\n}\n\n/**\n * Rebuild the row of a `wait` result: status line, output, a dim note when the output was cut short, then the timer.\n * An error that is not a task failure, or a result without an observation, is left to the generic shell renderer;\n * the return value says whether this renderer handled the result.\n */\nexport function rebuildShellWaitResult(\n\tcomponent: Container,\n\tresult: ShellWaitResultView,\n\toptions: Pick<ToolRenderResultOptions, \"expanded\">,\n\tview: {\n\t\tshowImages: boolean;\n\t\tisError: boolean;\n\t\ttaskId: string | undefined;\n\t\ttimerText: string | undefined;\n\t\tcwd: string;\n\t},\n): boolean {\n\tconst text = getTextOutput(result, view.showImages).trim();\n\tif (view.isError) {\n\t\tconst error = presentTaskError(text, view.taskId);\n\t\tif (!error) return false;\n\t\tcomponent.clear();\n\t\taddErrorLines(component, error.headline, error.hint);\n\t\taddTimer(component, view.timerText);\n\t\treturn true;\n\t}\n\tconst observation = result.details?.observation;\n\tif (!observation) return false;\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tconst tail = waitResultTail({ observation, truncated: truncation?.truncated === true, fullOutputPath });\n\tconst output = (text.endsWith(tail) ? text.slice(0, -tail.length) : text).trim();\n\tconst hasOutput = output !== \"\" && output !== EMPTY_OUTPUT_TEXT;\n\tcomponent.clear();\n\tcomponent.addChild(new Text(statusLine(waitStatus(observation, hasOutput)), 0, 0));\n\tif (hasOutput) addShellOutputPreview(component, output, options.expanded);\n\telse component.addChild(new Text(theme.fg(\"dim\", EMPTY_OUTPUT_TEXT), 0, 0));\n\tconst notes = [\n\t\ttruncation?.truncated ? formatTruncationNotice(truncation) : undefined,\n\t\tfullOutputPath ? \"Full output:\" : undefined,\n\t].filter((note) => note !== undefined);\n\tif (notes.length > 0) component.addChild(new Text(theme.fg(\"dim\", notes.join(\" · \")), 0, 0));\n\t// The path gets a line of its own so word wrap never splits it at a space beside its label, and a link so a\n\t// path wider than the terminal still opens (and copies) whole.\n\tif (fullOutputPath) {\n\t\tcomponent.addChild(new Text(theme.fg(\"dim\", linkPath(fullOutputPath, fullOutputPath, view.cwd)), 0, 0));\n\t}\n\taddTimer(component, view.timerText);\n\treturn true;\n}\n\nexport function formatKillCall(args: { id?: unknown } | undefined): string {\n\tconst id = str(args?.id);\n\tconst target = id === null ? invalidArgText(theme) : id || theme.fg(\"toolOutput\", \"...\");\n\treturn theme.fg(\"toolTitle\", theme.bold(`kill ${target}`));\n}\n\n/** Rebuild the row of a `kill` result from its receipt, or from the failure text when the call was rejected. */\nexport function rebuildKillResult(\n\tcomponent: Container,\n\tresult: { content: ResultContent; details?: CancelReceipt },\n\tview: { isError: boolean; taskId: string | undefined },\n): void {\n\tcomponent.clear();\n\tconst text = getTextOutput(result, false).trim();\n\tconst error = view.isError ? presentTaskError(text, view.taskId) : undefined;\n\tif (error) {\n\t\taddErrorLines(component, error.headline, error.hint);\n\t\treturn;\n\t}\n\tconst receipt = result.details;\n\t// A rejected call carries empty details, so only a real receipt has an execution to describe.\n\tif (!receipt?.execution) {\n\t\tcomponent.addChild(new Text(theme.fg(\"toolOutput\", text), 0, 0));\n\t\treturn;\n\t}\n\tcomponent.addChild(new Text(statusLine(cancelReceiptStatus(receipt)), 0, 0));\n\tconst failure = cleanupFailureSummary(receipt.cleanup);\n\tif (failure)\n\t\tcomponent.addChild(\n\t\t\tnew Text(statusLine({ glyph: \"✗\", tone: \"error\", label: \"cleanup failed\", detail: failure }), 0, 0),\n\t\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-directory-security.d.ts","sourceRoot":"","sources":["../../../src/core/tools/windows-directory-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"windows-directory-security.d.ts","sourceRoot":"","sources":["../../../src/core/tools/windows-directory-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAaH,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,KAAK,EAAE,OAAO,CAAC;I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,wBAAwB,GAAG,SAAS,CAAC,CAiB/C;AAqBD,KAAK,cAAc,GAAG,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,mCAAmC,KACxC,wBAAwB,GAAG,SAAS,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAC;AAiD1F;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mCAAmC,CAClD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACpC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAyB7B;AAED,wBAAgB,8BAA8B,CAC7C,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,MAAM,GAAG,SAAS,CAapB;AAED,wBAAsB,8CAA8C,IAAI,OAAO,CAAC,IAAI,CAAC,CAIpF;AAED,gFAAgF;AAChF,wBAAgB,2CAA2C,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAEpG;AAED,wGAAwG;AACxG,wBAAgB,4CAA4C,IAAI,IAAI,CAOnE"}
|
|
@@ -29,6 +29,7 @@ import { stat as statAsync } from "node:fs/promises";
|
|
|
29
29
|
import { dirname, resolve } from "node:path";
|
|
30
30
|
import { clearTimeout, setTimeout } from "node:timers";
|
|
31
31
|
import { createModuleRequire } from "../../utils/module-require.js";
|
|
32
|
+
import { windowsPowerShellEnvironment } from "../../utils/windows-powershell.js";
|
|
32
33
|
/**
|
|
33
34
|
* Principals allowed to own, or hold access-allowed ACEs on, a temp component.
|
|
34
35
|
*
|
|
@@ -136,18 +137,9 @@ export function powershellCandidates() {
|
|
|
136
137
|
candidates.push("powershell.exe", "pwsh.exe");
|
|
137
138
|
return candidates;
|
|
138
139
|
}
|
|
139
|
-
/**
|
|
140
|
-
* The environment for a PowerShell read. A PowerShell 7 parent puts its own module directories in `PSModulePath`, and
|
|
141
|
-
* Windows PowerShell started from it then fails to load `Get-Acl`'s module. Without the variable each host uses its
|
|
142
|
-
* own default module path.
|
|
143
|
-
*/
|
|
140
|
+
/** The environment for a PowerShell read: Windows PowerShell's, plus the path the read is for. */
|
|
144
141
|
function powershellEnvironment(path) {
|
|
145
|
-
|
|
146
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
147
|
-
if (key.toLowerCase() !== "psmodulepath" && key !== "ATOMIC_SECURITY_QUERY_PATH")
|
|
148
|
-
env[key] = value;
|
|
149
|
-
}
|
|
150
|
-
return env;
|
|
142
|
+
return { ...windowsPowerShellEnvironment(), ATOMIC_SECURITY_QUERY_PATH: path };
|
|
151
143
|
}
|
|
152
144
|
function windowsDirectory() {
|
|
153
145
|
return process.env.SystemRoot ?? process.env.windir ?? "C:\\Windows";
|