@bastani/atomic 0.9.76-alpha.1 → 0.9.77-alpha.1
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 +29 -0
- package/dist/builtin/intercom/CHANGELOG.md +13 -0
- package/dist/builtin/intercom/broker/broker.ts +153 -6
- package/dist/builtin/intercom/broker/client.ts +85 -3
- package/dist/builtin/intercom/broker/departed-children.ts +471 -0
- package/dist/builtin/intercom/broker/recipient-gone-errors.ts +280 -0
- package/dist/builtin/intercom/broker/restoring-recipients.ts +108 -7
- package/dist/builtin/intercom/broker/send-handler.ts +42 -0
- package/dist/builtin/intercom/broker/workflow-stage-aliases.ts +69 -0
- package/dist/builtin/intercom/index.bundle.mjs +374 -129
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/types.ts +30 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +15 -0
- package/dist/builtin/subagents/README.md +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +64 -4
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +14 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +71 -56
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +315 -112
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +168 -9
- package/dist/builtin/workflows/src/index.js +168 -9
- package/dist/builtin/workflows/src/local-worker-entry.mjs +168 -9
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +2 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +7 -2
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +6 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +13 -25
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +1 -0
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +3 -3
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +2 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +9 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/sdk-types.d.ts +5 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +26 -18
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.js +2 -2
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/cancel-reason.d.ts +20 -0
- package/dist/core/tasks/cancel-reason.d.ts.map +1 -0
- package/dist/core/tasks/cancel-reason.js +47 -0
- package/dist/core/tasks/cancel-reason.js.map +1 -0
- package/dist/core/tasks/child-command-owner.d.ts +1 -1
- package/dist/core/tasks/child-command-owner.d.ts.map +1 -1
- package/dist/core/tasks/child-command-owner.js +22 -0
- package/dist/core/tasks/child-command-owner.js.map +1 -1
- package/dist/core/tasks/completion-message.d.ts +11 -0
- package/dist/core/tasks/completion-message.d.ts.map +1 -0
- package/dist/core/tasks/completion-message.js +30 -0
- package/dist/core/tasks/completion-message.js.map +1 -0
- package/dist/core/tasks/completion.d.ts +2 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +30 -14
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +4 -0
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +29 -3
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +48 -25
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +6 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +49 -0
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +6 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +5 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +14 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts +15 -1
- package/dist/core/tools/history-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +9 -7
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/shell-task-status.d.ts.map +1 -1
- package/dist/core/tools/shell-task-status.js +3 -13
- package/dist/core/tools/shell-task-status.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +2 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +36 -6
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +12 -8
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +6 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +5 -2
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +8 -5
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +5 -2
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/input-label.d.ts +29 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -0
- package/dist/modes/interactive/components/input-label.js +75 -0
- package/dist/modes/interactive/components/input-label.js.map +1 -0
- package/dist/modes/interactive/components/task-inspector.d.ts +4 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +6 -2
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +12 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +63 -6
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +1 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +1 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.js.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.d.ts +2 -2
- package/dist/modes/rpc/task-ui-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.js +2 -0
- package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
- package/docs/background-tasks.md +14 -1
- package/docs/getting-started/first-session.md +1 -1
- package/docs/intercom/operations.md +4 -2
- package/docs/intercom/reference.md +18 -1
- package/docs/llama-cpp.md +1 -1
- package/docs/sessions.md +1 -1
- package/docs/subagents.md +5 -1
- package/docs/tools.md +1 -1
- package/docs/usage.md +1 -12
- package/docs/workflows/operations.md +3 -1
- package/docs/workflows/verification.md +1 -8
- package/npm-shrinkwrap.json +83 -98
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-session-stats.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-session-stats.ts"],"names":[],"mappings":"AAIA,MAAM,eAAe,GAAG,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"engine-session-stats.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-session-stats.ts"],"names":[],"mappings":"AAIA,MAAM,eAAe,GAAG,IAAI,OAAO,EAA8B,CAAC;AAElE,2GAA2G;AAC3G,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACpD,OAAO,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACtB,KAAK,CAA2B;IAChC,KAAK,GAAG,CAAC,CAAC;IACV,QAAQ,GAAG,KAAK,CAAC;IACjB,aAAa,GAAG,KAAK,CAAC;IACb,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IAClC,MAAM,CAAuD;IAE9E,YAAY,MAA4D;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAqB;QAC1B,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ,CAAC,QAAoB;QAC5B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC,CAAC;IACH,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,OAAO;QACR,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,KAAa;QAClC,IAAI,CAAC;YACJ,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAe,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAC7F,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;gBAAE,OAAO;YAC/E,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAAE,QAAQ,EAAE,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACR,+EAA+E;QAChF,CAAC;gBAAS,CAAC;YACV,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACtB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;oBACxB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;oBAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChB,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { AgentSession } from \"../../core/agent-session.js\";\nimport type { SessionStats } from \"../../core/agent-session-types.js\";\nimport type { RpcClient } from \"../rpc/rpc-client.ts\";\n\nconst trackedSessions = new WeakMap<object, EngineSessionStats>();\n\n/** The engine's latest session stats for an isolated host session, or undefined before the first reply. */\nexport function getEngineSessionStats(session: object): SessionStats | undefined {\n\treturn trackedSessions.get(session)?.current;\n}\n\n/**\n * Caches the engine's `get_session_stats` reply for the host footer. One request\n * is in flight at a time; triggers that arrive meanwhile share one trailing\n * request. `reset()` drops the cache and discards every reply already in flight.\n */\nexport class EngineSessionStats {\n\tprivate stats: SessionStats | undefined;\n\tprivate epoch = 0;\n\tprivate inFlight = false;\n\tprivate refreshQueued = false;\n\tprivate readonly listeners = new Set<() => void>();\n\tprivate readonly client: Pick<RpcClient, \"requestInternal\" | \"getGeneration\">;\n\n\tconstructor(client: Pick<RpcClient, \"requestInternal\" | \"getGeneration\">) {\n\t\tthis.client = client;\n\t}\n\n\tget current(): SessionStats | undefined {\n\t\treturn this.stats;\n\t}\n\n\ttrack(session: AgentSession): void {\n\t\ttrackedSessions.set(session, this);\n\t}\n\n\tonChange(listener: () => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\treset(): void {\n\t\tthis.epoch += 1;\n\t\tthis.stats = undefined;\n\t\tthis.inFlight = false;\n\t\tthis.refreshQueued = false;\n\t}\n\n\trefresh(): void {\n\t\tif (this.inFlight) {\n\t\t\tthis.refreshQueued = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.inFlight = true;\n\t\tvoid this.request(this.epoch);\n\t}\n\n\tprivate async request(epoch: number): Promise<void> {\n\t\ttry {\n\t\t\tconst generation = this.client.getGeneration();\n\t\t\tconst stats = await this.client.requestInternal<SessionStats>({ type: \"get_session_stats\" });\n\t\t\tif (epoch !== this.epoch || generation !== this.client.getGeneration()) return;\n\t\t\tthis.stats = stats;\n\t\t\tfor (const listener of [...this.listeners]) listener();\n\t\t} catch {\n\t\t\t// A failed refresh keeps the previous stats; the next message refreshes again.\n\t\t} finally {\n\t\t\tif (epoch === this.epoch) {\n\t\t\t\tthis.inFlight = false;\n\t\t\t\tif (this.refreshQueued) {\n\t\t\t\t\tthis.refreshQueued = false;\n\t\t\t\t\tthis.refresh();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import type { ExtensionUIContext } from "../../core/extensions/index.js";
|
|
|
3
3
|
import { type OwnerTaskStore } from "../../core/tasks/owner-store.js";
|
|
4
4
|
import type { EngineHostRenderSettings } from "../interactive-engine/protocol.ts";
|
|
5
5
|
/** The UI a task inspector mounts in: its custom UI, and the chat render settings its transcripts inherit. */
|
|
6
|
-
export type TaskInspectorUi = Pick<ExtensionUIContext, "custom"> & Partial<Pick<ExtensionUIContext, "getChatRenderSettings" | "getToolsExpanded" | "setToolsExpanded" | "notify">>;
|
|
6
|
+
export type TaskInspectorUi = Pick<ExtensionUIContext, "custom"> & Partial<Pick<ExtensionUIContext, "getChatRenderSettings" | "getToolsExpanded" | "setToolsExpanded" | "notify" | "getFooterDataProvider">>;
|
|
7
7
|
/** The engine's custom UI, with the render settings of the host chat that opened the inspector. */
|
|
8
8
|
export type EngineTaskInspectorMount = Pick<ExtensionUIContext, "custom"> & {
|
|
9
9
|
getHostRenderSettings?(): EngineHostRenderSettings | undefined;
|
|
@@ -13,7 +13,7 @@ export type EngineTaskInspectorMount = Pick<ExtensionUIContext, "custom"> & {
|
|
|
13
13
|
* (the engine's own state stands in until a render request carries the host's), and Ctrl+O there changes it for this
|
|
14
14
|
* inspector only, as an attached stage chat keeps its own.
|
|
15
15
|
*/
|
|
16
|
-
export declare function engineTaskInspectorUi(ui: Pick<ExtensionUIContext, "getChatRenderSettings" | "getToolsExpanded" | "notify">, mount: EngineTaskInspectorMount): TaskInspectorUi;
|
|
16
|
+
export declare function engineTaskInspectorUi(ui: Pick<ExtensionUIContext, "getChatRenderSettings" | "getToolsExpanded" | "notify" | "getFooterDataProvider">, mount: EngineTaskInspectorMount): TaskInspectorUi;
|
|
17
17
|
/** Render against the engine's owner. Native capabilities never cross the UI bridge. */
|
|
18
18
|
export declare function bindEngineTaskWidget(session: AgentSession, ui: ExtensionUIContext): () => void;
|
|
19
19
|
export declare function showEngineTaskInspector(session: AgentSession, ui: TaskInspectorUi, taskId?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-ui-bridge.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/task-ui-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAqB,KAAK,cAAc,EAA8B,MAAM,iCAAiC,CAAC;AAOrH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,8GAA8G;AAC9G,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"task-ui-bridge.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/task-ui-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAqB,KAAK,cAAc,EAA8B,MAAM,iCAAiC,CAAC;AAOrH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,8GAA8G;AAC9G,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAC/D,OAAO,CACN,IAAI,CACH,kBAAkB,EAClB,uBAAuB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,QAAQ,GAAG,uBAAuB,CACtG,CACD,CAAC;AAEH,mGAAmG;AACnG,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAAG;IAC3E,qBAAqB,CAAC,IAAI,wBAAwB,GAAG,SAAS,CAAC;CAC/D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACpC,EAAE,EAAE,IAAI,CAAC,kBAAkB,EAAE,uBAAuB,GAAG,kBAAkB,GAAG,QAAQ,GAAG,uBAAuB,CAAC,EAC/G,KAAK,EAAE,wBAAwB,GAC7B,eAAe,CAajB;AAID,wFAAwF;AACxF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAqD9F;AAED,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,eAAe,EACnB,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wEAAwE;AACxE,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFlH"}
|
|
@@ -21,6 +21,7 @@ export function engineTaskInspectorUi(ui, mount) {
|
|
|
21
21
|
setToolsExpanded: (expanded) => {
|
|
22
22
|
toggled = expanded;
|
|
23
23
|
},
|
|
24
|
+
getFooterDataProvider: () => ui.getFooterDataProvider(),
|
|
24
25
|
notify: (message, type) => ui.notify(message, type),
|
|
25
26
|
};
|
|
26
27
|
}
|
|
@@ -127,6 +128,7 @@ export async function showTaskInspector(ui, store, taskId) {
|
|
|
127
128
|
...(ui.setToolsExpanded
|
|
128
129
|
? { setToolsExpanded: (expanded) => ui.setToolsExpanded?.(expanded) }
|
|
129
130
|
: {}),
|
|
131
|
+
...(ui.getFooterDataProvider ? { footerData: ui.getFooterDataProvider() } : {}),
|
|
130
132
|
...(ui.notify ? { notify: (message) => ui.notify?.(message, "warning") } : {}),
|
|
131
133
|
};
|
|
132
134
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-ui-bridge.js","sourceRoot":"","sources":["../../../src/modes/rpc/task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AG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;4BACtD,OAAO,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;wBACnE,CAAC,CAAC,CAAC;oBACJ,CAAC;oBACD,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE;wBAC7B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;4BAAE,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBAC/D,MAAM,GAAG,IAAI,CAAC;wBACd,IAAI,EAAE,CAAC;wBACP,OAAO,IAAI,CAAC;oBACb,CAAC;iBACD,CAAC;YACH,CAAC,EACD;gBACC,OAAO,EAAE,UAAU;gBACnB,OAAO,EAAE,YAAY;gBACrB,YAAY,EAAE,IAAI;gBAClB,wBAAwB,EAAE,IAAI;gBAC9B,uBAAuB,EAAE,IAAI;gBAC7B,GAAG,CAAC,UAAU;oBACb,CAAC,CAAC;wBACA,cAAc,EAAE;4BACf,MAAM,EAAE,QAAiB;4BACzB,KAAK,EAAE,MAAe;4BACtB,SAAS,EAAE,MAAe;4BAC1B,MAAM,EAAE,CAAC;yBACT;qBACD;oBACF,CAAC,CAAC,EAAE,CAAC;aACN,CACD,CAAC;YACF,2EAA2E;YAC3E,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU;gBAAE,MAAM,GAAG,IAAI,CAAC;QACxD,CAAC;IACF,CAAC;YAAS,CAAC;QACV,SAAS,EAAE,OAAO,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { TaskId } from \"../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../core/tasks/owner-store.js\";\nimport { ChatSessionHost } from \"../interactive/components/chat-session-host.ts\";\nimport { TaskInspector } from \"../interactive/components/task-inspector.js\";\nimport { isActiveBackgroundTask, renderTaskFooter } from \"../interactive/components/task-list.js\";\nimport { type TaskTranscriptEnvironment, themedChatHostStyle } from \"../interactive/components/task-transcript-page.ts\";\nimport { isPhysicalCtrlC } from \"../interactive/interactive-key-identity.ts\";\nimport { getEditorTheme } from \"../interactive/theme/theme.js\";\nimport type { EngineHostRenderSettings } from \"../interactive-engine/protocol.ts\";\n\n/** The UI a task inspector mounts in: its custom UI, and the chat render settings its transcripts inherit. */\nexport type TaskInspectorUi = Pick<ExtensionUIContext, \"custom\"> &\n\tPartial<Pick<ExtensionUIContext, \"getChatRenderSettings\" | \"getToolsExpanded\" | \"setToolsExpanded\" | \"notify\">>;\n\n/** The engine's custom UI, with the render settings of the host chat that opened the inspector. */\nexport type EngineTaskInspectorMount = Pick<ExtensionUIContext, \"custom\"> & {\n\tgetHostRenderSettings?(): EngineHostRenderSettings | undefined;\n};\n\n/**\n * The isolated engine's `/tasks`, opened from the host's chat. Its transcripts show tool output as the host chat does\n * (the engine's own state stands in until a render request carries the host's), and Ctrl+O there changes it for this\n * inspector only, as an attached stage chat keeps its own.\n */\nexport function engineTaskInspectorUi(\n\tui: Pick<ExtensionUIContext, \"getChatRenderSettings\" | \"getToolsExpanded\" | \"notify\">,\n\tmount: EngineTaskInspectorMount,\n): TaskInspectorUi {\n\tlet toggled: boolean | undefined;\n\tconst toolsExpanded = () => toggled ?? mount.getHostRenderSettings?.()?.toolOutputExpanded ?? ui.getToolsExpanded();\n\treturn {\n\t\tcustom: mount.custom,\n\t\tgetChatRenderSettings: () => ({ ...ui.getChatRenderSettings(), toolOutputExpanded: toolsExpanded() }),\n\t\tgetToolsExpanded: toolsExpanded,\n\t\tsetToolsExpanded: (expanded) => {\n\t\t\ttoggled = expanded;\n\t\t},\n\t\tnotify: (message, type) => ui.notify(message, type),\n\t};\n}\n\nconst widgetVisibility = new WeakMap<AgentSession, (visible: boolean) => void>();\n\n/** Render against the engine's owner. Native capabilities never cross the UI bridge. */\nexport function bindEngineTaskWidget(session: AgentSession, ui: ExtensionUIContext): () => void {\n\tconst key = \"atomic.background-tasks\";\n\tlet unsubscribe = () => {};\n\tlet disposed = false;\n\tlet mounted = false;\n\tlet visible = true;\n\tconst connect = () => {\n\t\tunsubscribe();\n\t\tif (mounted) ui.setWidget(key, undefined);\n\t\tmounted = false;\n\t\tconst store = getOwnerTaskStore(session);\n\t\tconst update = () => {\n\t\t\tif (disposed) return;\n\t\t\tif (!visible || !store?.backgroundTasks.some(isActiveBackgroundTask)) {\n\t\t\t\tif (mounted) ui.setWidget(key, undefined);\n\t\t\t\tmounted = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mounted) {\n\t\t\t\tmounted = true;\n\t\t\t\tui.setWidget(\n\t\t\t\t\tkey,\n\t\t\t\t\t() => ({\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t\trender(width: number) {\n\t\t\t\t\t\t\treturn renderTaskFooter(store?.backgroundTasks ?? [], width);\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\t{ placement: \"belowEditor\" },\n\t\t\t\t);\n\t\t\t}\n\t\t\tui.requestRender();\n\t\t};\n\t\tunsubscribe = store?.subscribe(update) ?? (() => {});\n\t\tupdate();\n\t};\n\tconst unwatch = watchOwnerTaskStoreBinding(session, connect);\n\tconst unwatchWidget = ui.onWidgetRelease?.(key, () => {\n\t\tmounted = false;\n\t});\n\twidgetVisibility.set(session, (value) => {\n\t\tvisible = value;\n\t\tconnect();\n\t});\n\tconnect();\n\treturn () => {\n\t\tdisposed = true;\n\t\twidgetVisibility.delete(session);\n\t\tunwatch();\n\t\tunwatchWidget?.();\n\t\tunsubscribe();\n\t\tif (mounted) ui.setWidget(key, undefined);\n\t};\n}\n\nexport async function showEngineTaskInspector(\n\tsession: AgentSession,\n\tui: TaskInspectorUi,\n\ttaskId?: string,\n): Promise<void> {\n\tsession.getAgentTaskHost();\n\tconst store = getOwnerTaskStore(session);\n\tif (!store) throw new Error(\"Task owner is unavailable\");\n\ttry {\n\t\twidgetVisibility.get(session)?.(false);\n\t\tawait showTaskInspector(ui, store, taskId);\n\t} finally {\n\t\twidgetVisibility.get(session)?.(true);\n\t}\n}\n\n/** Main CLI mount, shared by the local host and its isolated engine. */\nexport async function showTaskInspector(ui: TaskInspectorUi, store: OwnerTaskStore, taskId?: string): Promise<void> {\n\tlet requestRender = () => {};\n\tlet finishView = () => {};\n\tlet closed = false;\n\tlet fullscreen = false;\n\tlet environment: TaskTranscriptEnvironment | undefined;\n\tconst inspector = new TaskInspector(\n\t\tstore,\n\t\t() => {\n\t\t\tif (inspector.fullscreen !== fullscreen) finishView();\n\t\t\telse requestRender();\n\t\t},\n\t\t() => {\n\t\t\tclosed = true;\n\t\t\tfinishView();\n\t\t},\n\t\tundefined,\n\t\t() => environment,\n\t);\n\tinspector.open(taskId as TaskId | undefined);\n\ttry {\n\t\twhile (!closed) {\n\t\t\tfullscreen = inspector.fullscreen;\n\t\t\tawait ui.custom<void>(\n\t\t\t\t(tui, _theme, keybindings, done) => {\n\t\t\t\t\trequestRender = () => tui.requestRender();\n\t\t\t\t\tfinishView = () => done();\n\t\t\t\t\tenvironment = {\n\t\t\t\t\t\tcreateChat: (opts) => new ChatSessionHost(opts),\n\t\t\t\t\t\ttui,\n\t\t\t\t\t\tkeybindings,\n\t\t\t\t\t\teditorTheme: getEditorTheme(),\n\t\t\t\t\t\tstyle: themedChatHostStyle(),\n\t\t\t\t\t\t...(ui.getChatRenderSettings ? { getChatRenderSettings: () => ui.getChatRenderSettings?.() } : {}),\n\t\t\t\t\t\t...(ui.getToolsExpanded ? { getToolsExpanded: () => ui.getToolsExpanded?.() === true } : {}),\n\t\t\t\t\t\t...(ui.setToolsExpanded\n\t\t\t\t\t\t\t? { setToolsExpanded: (expanded: boolean) => ui.setToolsExpanded?.(expanded) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(ui.notify ? { notify: (message: string) => ui.notify?.(message, \"warning\") } : {}),\n\t\t\t\t\t};\n\t\t\t\t\treturn {\n\t\t\t\t\t\tinvalidate: () => inspector.invalidate(),\n\t\t\t\t\t\trender: (width: number) => {\n\t\t\t\t\t\t\tconst height = Math.max(1, tui.terminal.rows);\n\t\t\t\t\t\t\tif (!fullscreen) return inspector.renderPicker(width, height);\n\t\t\t\t\t\t\tconst lines = inspector.renderViewport(width, height);\n\t\t\t\t\t\t\t// Fullscreen detail pages cover all parent chat and prompt cells.\n\t\t\t\t\t\t\treturn Array.from({ length: height }, (_, row) => {\n\t\t\t\t\t\t\t\tconst line = truncateToWidth(lines[row] ?? \"\", width);\n\t\t\t\t\t\t\t\treturn line + \" \".repeat(Math.max(0, width - visibleWidth(line)));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandleInput: (data: string) => {\n\t\t\t\t\t\t\tif (!isPhysicalCtrlC(data)) return inspector.handleInput(data);\n\t\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay: fullscreen,\n\t\t\t\t\tpurpose: \"navigation\",\n\t\t\t\t\thandlesCtrlC: true,\n\t\t\t\t\tdeferInlineCustomUiFocus: true,\n\t\t\t\t\thandlesInternalUiAction: true,\n\t\t\t\t\t...(fullscreen\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toverlayOptions: {\n\t\t\t\t\t\t\t\t\tanchor: \"center\" as const,\n\t\t\t\t\t\t\t\t\twidth: \"100%\" as const,\n\t\t\t\t\t\t\t\t\tmaxHeight: \"100%\" as const,\n\t\t\t\t\t\t\t\t\tmargin: 0,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t);\n\t\t\t// Host dismissal without a navigation transition must not reopen the view.\n\t\t\tif (inspector.fullscreen === fullscreen) closed = true;\n\t\t}\n\t} finally {\n\t\tinspector?.dispose();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-ui-bridge.js","sourceRoot":"","sources":["../../../src/modes/rpc/task-ui-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAIvE,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAClG,OAAO,EAAkC,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxH,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAiB/D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,EAA+G,EAC/G,KAA+B;IAE/B,IAAI,OAA4B,CAAC;IACjC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,qBAAqB,EAAE,EAAE,EAAE,kBAAkB,IAAI,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACpH,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE,EAAE,kBAAkB,EAAE,aAAa,EAAE,EAAE,CAAC;QACrG,gBAAgB,EAAE,aAAa;QAC/B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC9B,OAAO,GAAG,Q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;4BAC1B,MAAM,EAAE,CAAC;yBACT;qBACD;oBACF,CAAC,CAAC,EAAE,CAAC;aACN,CACD,CAAC;YACF,2EAA2E;YAC3E,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU;gBAAE,MAAM,GAAG,IAAI,CAAC;QACxD,CAAC;IACF,CAAC;YAAS,CAAC;QACV,SAAS,EAAE,OAAO,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { TaskId } from \"../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../core/tasks/owner-store.js\";\nimport { ChatSessionHost } from \"../interactive/components/chat-session-host.ts\";\nimport { TaskInspector } from \"../interactive/components/task-inspector.js\";\nimport { isActiveBackgroundTask, renderTaskFooter } from \"../interactive/components/task-list.js\";\nimport { type TaskTranscriptEnvironment, themedChatHostStyle } from \"../interactive/components/task-transcript-page.ts\";\nimport { isPhysicalCtrlC } from \"../interactive/interactive-key-identity.ts\";\nimport { getEditorTheme } from \"../interactive/theme/theme.js\";\nimport type { EngineHostRenderSettings } from \"../interactive-engine/protocol.ts\";\n\n/** The UI a task inspector mounts in: its custom UI, and the chat render settings its transcripts inherit. */\nexport type TaskInspectorUi = Pick<ExtensionUIContext, \"custom\"> &\n\tPartial<\n\t\tPick<\n\t\t\tExtensionUIContext,\n\t\t\t\"getChatRenderSettings\" | \"getToolsExpanded\" | \"setToolsExpanded\" | \"notify\" | \"getFooterDataProvider\"\n\t\t>\n\t>;\n\n/** The engine's custom UI, with the render settings of the host chat that opened the inspector. */\nexport type EngineTaskInspectorMount = Pick<ExtensionUIContext, \"custom\"> & {\n\tgetHostRenderSettings?(): EngineHostRenderSettings | undefined;\n};\n\n/**\n * The isolated engine's `/tasks`, opened from the host's chat. Its transcripts show tool output as the host chat does\n * (the engine's own state stands in until a render request carries the host's), and Ctrl+O there changes it for this\n * inspector only, as an attached stage chat keeps its own.\n */\nexport function engineTaskInspectorUi(\n\tui: Pick<ExtensionUIContext, \"getChatRenderSettings\" | \"getToolsExpanded\" | \"notify\" | \"getFooterDataProvider\">,\n\tmount: EngineTaskInspectorMount,\n): TaskInspectorUi {\n\tlet toggled: boolean | undefined;\n\tconst toolsExpanded = () => toggled ?? mount.getHostRenderSettings?.()?.toolOutputExpanded ?? ui.getToolsExpanded();\n\treturn {\n\t\tcustom: mount.custom,\n\t\tgetChatRenderSettings: () => ({ ...ui.getChatRenderSettings(), toolOutputExpanded: toolsExpanded() }),\n\t\tgetToolsExpanded: toolsExpanded,\n\t\tsetToolsExpanded: (expanded) => {\n\t\t\ttoggled = expanded;\n\t\t},\n\t\tgetFooterDataProvider: () => ui.getFooterDataProvider(),\n\t\tnotify: (message, type) => ui.notify(message, type),\n\t};\n}\n\nconst widgetVisibility = new WeakMap<AgentSession, (visible: boolean) => void>();\n\n/** Render against the engine's owner. Native capabilities never cross the UI bridge. */\nexport function bindEngineTaskWidget(session: AgentSession, ui: ExtensionUIContext): () => void {\n\tconst key = \"atomic.background-tasks\";\n\tlet unsubscribe = () => {};\n\tlet disposed = false;\n\tlet mounted = false;\n\tlet visible = true;\n\tconst connect = () => {\n\t\tunsubscribe();\n\t\tif (mounted) ui.setWidget(key, undefined);\n\t\tmounted = false;\n\t\tconst store = getOwnerTaskStore(session);\n\t\tconst update = () => {\n\t\t\tif (disposed) return;\n\t\t\tif (!visible || !store?.backgroundTasks.some(isActiveBackgroundTask)) {\n\t\t\t\tif (mounted) ui.setWidget(key, undefined);\n\t\t\t\tmounted = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mounted) {\n\t\t\t\tmounted = true;\n\t\t\t\tui.setWidget(\n\t\t\t\t\tkey,\n\t\t\t\t\t() => ({\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t\trender(width: number) {\n\t\t\t\t\t\t\treturn renderTaskFooter(store?.backgroundTasks ?? [], width);\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\t{ placement: \"belowEditor\" },\n\t\t\t\t);\n\t\t\t}\n\t\t\tui.requestRender();\n\t\t};\n\t\tunsubscribe = store?.subscribe(update) ?? (() => {});\n\t\tupdate();\n\t};\n\tconst unwatch = watchOwnerTaskStoreBinding(session, connect);\n\tconst unwatchWidget = ui.onWidgetRelease?.(key, () => {\n\t\tmounted = false;\n\t});\n\twidgetVisibility.set(session, (value) => {\n\t\tvisible = value;\n\t\tconnect();\n\t});\n\tconnect();\n\treturn () => {\n\t\tdisposed = true;\n\t\twidgetVisibility.delete(session);\n\t\tunwatch();\n\t\tunwatchWidget?.();\n\t\tunsubscribe();\n\t\tif (mounted) ui.setWidget(key, undefined);\n\t};\n}\n\nexport async function showEngineTaskInspector(\n\tsession: AgentSession,\n\tui: TaskInspectorUi,\n\ttaskId?: string,\n): Promise<void> {\n\tsession.getAgentTaskHost();\n\tconst store = getOwnerTaskStore(session);\n\tif (!store) throw new Error(\"Task owner is unavailable\");\n\ttry {\n\t\twidgetVisibility.get(session)?.(false);\n\t\tawait showTaskInspector(ui, store, taskId);\n\t} finally {\n\t\twidgetVisibility.get(session)?.(true);\n\t}\n}\n\n/** Main CLI mount, shared by the local host and its isolated engine. */\nexport async function showTaskInspector(ui: TaskInspectorUi, store: OwnerTaskStore, taskId?: string): Promise<void> {\n\tlet requestRender = () => {};\n\tlet finishView = () => {};\n\tlet closed = false;\n\tlet fullscreen = false;\n\tlet environment: TaskTranscriptEnvironment | undefined;\n\tconst inspector = new TaskInspector(\n\t\tstore,\n\t\t() => {\n\t\t\tif (inspector.fullscreen !== fullscreen) finishView();\n\t\t\telse requestRender();\n\t\t},\n\t\t() => {\n\t\t\tclosed = true;\n\t\t\tfinishView();\n\t\t},\n\t\tundefined,\n\t\t() => environment,\n\t);\n\tinspector.open(taskId as TaskId | undefined);\n\ttry {\n\t\twhile (!closed) {\n\t\t\tfullscreen = inspector.fullscreen;\n\t\t\tawait ui.custom<void>(\n\t\t\t\t(tui, _theme, keybindings, done) => {\n\t\t\t\t\trequestRender = () => tui.requestRender();\n\t\t\t\t\tfinishView = () => done();\n\t\t\t\t\tenvironment = {\n\t\t\t\t\t\tcreateChat: (opts) => new ChatSessionHost(opts),\n\t\t\t\t\t\ttui,\n\t\t\t\t\t\tkeybindings,\n\t\t\t\t\t\teditorTheme: getEditorTheme(),\n\t\t\t\t\t\tstyle: themedChatHostStyle(),\n\t\t\t\t\t\t...(ui.getChatRenderSettings ? { getChatRenderSettings: () => ui.getChatRenderSettings?.() } : {}),\n\t\t\t\t\t\t...(ui.getToolsExpanded ? { getToolsExpanded: () => ui.getToolsExpanded?.() === true } : {}),\n\t\t\t\t\t\t...(ui.setToolsExpanded\n\t\t\t\t\t\t\t? { setToolsExpanded: (expanded: boolean) => ui.setToolsExpanded?.(expanded) }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(ui.getFooterDataProvider ? { footerData: ui.getFooterDataProvider() } : {}),\n\t\t\t\t\t\t...(ui.notify ? { notify: (message: string) => ui.notify?.(message, \"warning\") } : {}),\n\t\t\t\t\t};\n\t\t\t\t\treturn {\n\t\t\t\t\t\tinvalidate: () => inspector.invalidate(),\n\t\t\t\t\t\trender: (width: number) => {\n\t\t\t\t\t\t\tconst height = Math.max(1, tui.terminal.rows);\n\t\t\t\t\t\t\tif (!fullscreen) return inspector.renderPicker(width, height);\n\t\t\t\t\t\t\tconst lines = inspector.renderViewport(width, height);\n\t\t\t\t\t\t\t// Fullscreen detail pages cover all parent chat and prompt cells.\n\t\t\t\t\t\t\treturn Array.from({ length: height }, (_, row) => {\n\t\t\t\t\t\t\t\tconst line = truncateToWidth(lines[row] ?? \"\", width);\n\t\t\t\t\t\t\t\treturn line + \" \".repeat(Math.max(0, width - visibleWidth(line)));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandleInput: (data: string) => {\n\t\t\t\t\t\t\tif (!isPhysicalCtrlC(data)) return inspector.handleInput(data);\n\t\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay: fullscreen,\n\t\t\t\t\tpurpose: \"navigation\",\n\t\t\t\t\thandlesCtrlC: true,\n\t\t\t\t\tdeferInlineCustomUiFocus: true,\n\t\t\t\t\thandlesInternalUiAction: true,\n\t\t\t\t\t...(fullscreen\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\toverlayOptions: {\n\t\t\t\t\t\t\t\t\tanchor: \"center\" as const,\n\t\t\t\t\t\t\t\t\twidth: \"100%\" as const,\n\t\t\t\t\t\t\t\t\tmaxHeight: \"100%\" as const,\n\t\t\t\t\t\t\t\t\tmargin: 0,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t);\n\t\t\t// Host dismissal without a navigation transition must not reopen the view.\n\t\t\tif (inspector.fullscreen === fullscreen) closed = true;\n\t\t}\n\t} finally {\n\t\tinspector?.dispose();\n\t}\n}\n"]}
|
package/docs/background-tasks.md
CHANGED
|
@@ -210,7 +210,9 @@ The cadence is fixed when the task starts, and a running task's `/tasks` detail
|
|
|
210
210
|
| Transcript | Scrolls like a workflow stage chat: it opens at the latest message and follows new output; PageUp/PageDown move one viewport; Ctrl+Home/Ctrl+End jump to the top and to the latest message; Ctrl+Up/Ctrl+Down jump between prompts; the mouse wheel scrolls (Alt+wheel five times faster). Earlier retained history loads as you scroll toward the top. |
|
|
211
211
|
| Transcript display | A transcript opens with the chat's thinking and tool-output settings. Ctrl+T toggles thinking blocks, as in the chat, and Ctrl+O toggles the transcript's tool output. |
|
|
212
212
|
| Message the agent | Type in the transcript's prompt and press Enter to send the text to the agent through Intercom. Up/Down, Home/End and Left/Right edit the prompt. |
|
|
213
|
-
|
|
|
213
|
+
| Subagent chat | A subagent's transcript has the chat box of a workflow stage chat. The prompt's top rule names the subagent's session, for example `[subagent: subagent-worker-aabcf28b-1]`: its Intercom name, or its agent name when it has none. Long names end in `…`, and terminals narrower than 40 columns show no name. While the subagent runs in this session, its usage meter and model line appear around the prompt, along with the working line and any queued messages. The footer counts the subagent's own running tasks. |
|
|
214
|
+
| Subagent's tasks | Type `/tasks` in a subagent's transcript to list that subagent's own tasks: the shells it ran and the subagents it launched, not the parent's. In a nested subagent's transcript, `/tasks` lists that subagent's tasks. Escape or Left on that list returns to the subagent's chat. |
|
|
215
|
+
| Go back | Escape returns from transcript to detail, then from detail to the list. Left does the same when the prompt is empty. While a subagent's own task list is open, Escape and Left go back within that list first. |
|
|
214
216
|
| Stop | On a task's detail page, `x` requests cancellation; confirm with `y`, or keep running with `n` or Escape. A bound `app.tasks.cancel` key also works from the list. |
|
|
215
217
|
| Shell input | Select Input when offered; Enter sends the text plus a newline; Escape leaves input mode. |
|
|
216
218
|
|
|
@@ -263,6 +265,14 @@ bash({ command: "npm test", wait: { kind: "foreground", budgetMs: 30000 }, timeo
|
|
|
263
265
|
|
|
264
266
|
The shell execution timeout is separate: `timeout` is seconds and defaults to 300, with a maximum of 3600. It continues counting after backgrounding. Choose a timeout appropriate for the command; reducing `budgetMs` does not shorten or extend it. Use the returned task ID to inspect or stop the existing task through `/tasks`. Background completion notifies the parent automatically, so there is no need to launch the command again to collect its result.
|
|
265
267
|
|
|
268
|
+
A launch that continues in the background names the timeout that will stop it:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
Command is still running (task task-1-0-3). Its execution timeout stops it after 300 seconds; launch it with a larger timeout (up to 3600 seconds) for a longer run.
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
When the timeout stops the command, a `wait` on it returns an error ending `Task <id> was cancelled (timed out after 300 seconds).`, and its completion notice reads `Background shell timed out after 300 seconds` with `Stop reason: execution-timeout (timed out after 300 seconds)`. A test suite that can run longer than five minutes needs an explicit `timeout`, for example `timeout: 3600`. 3600 seconds is the longest timeout: a launch or notice at that limit says to split a longer run into shorter commands instead of asking for a larger timeout.
|
|
275
|
+
|
|
266
276
|
Observe an existing task without running its command again:
|
|
267
277
|
|
|
268
278
|
```ts
|
|
@@ -296,8 +306,11 @@ Subagents can run background `bash` and `powershell` commands too. Their shell t
|
|
|
296
306
|
|
|
297
307
|
- The subagent can wait on and `kill` the shells it launched, but not the parent's own tasks or another subagent's.
|
|
298
308
|
- The parent can inspect, wait on, and stop those shells from its own `/tasks`, `bash({ action: "wait", id })`, or `kill({ id })`.
|
|
309
|
+
- `/tasks` typed in the subagent's own transcript lists the shells it launched while it ran.
|
|
299
310
|
- While the subagent is still running, a background shell's completion notice goes to the subagent. After the subagent finishes, the notice goes to the parent.
|
|
300
311
|
- Shells keep running after the subagent finishes. They stop when the parent's session or workflow stage closes, or when a workflow stage pauses.
|
|
312
|
+
- In a workflow, a subagent keeps its shells for as long as it runs, even when the stage that launched it is released while it waits (see [Suspended stages](/workflows/operations#suspended-stages)) or its session is replaced. The subagent can still wait on, stop, and start shells, and their completion notices still reach it while the stage is released. A subagent that was itself released while it waited is woken by its stage's session, so its shells' completion notices wait in its saved conversation until that session is back.
|
|
313
|
+
- A shell that ends early says why. Its wait result and completion notice name the stop: `timed out after <n> seconds`, `stopped by a pause`, `workflow stage closed`, `session closed`, or `Atomic shut down`.
|
|
301
314
|
|
|
302
315
|
Custom operations adapters receive `wait` but must implement it themselves. External-terminal processes are not adopted into `/tasks`. A child's own tool use appears in that subagent's activity and transcript.
|
|
303
316
|
|
|
@@ -120,7 +120,7 @@ Skills are reusable expert instructions. Trigger one with `/skill:<name>` follow
|
|
|
120
120
|
| `liteparse` | Pull text, tables, or values out of PDF, DOCX, PPTX, XLSX, and image files locally. | `/skill:liteparse` |
|
|
121
121
|
| `show-me` | Explain a topic visually with concise diagrams, code-shape sketches, or focused HTML artifacts. HumanLayer, MIT licensed. | `/skill:show-me` |
|
|
122
122
|
|
|
123
|
-
Impeccable 4.8.
|
|
123
|
+
Impeccable 4.8.2 runs its commands (`context`, `live`, `detect`, hooks, and the rest) through a self-contained engine binary instead of Node scripts. The bundled launcher, `scripts/impeccable` (`impeccable.cmd` on Windows), looks for a binary next to itself, then in `~/.impeccable/bin/`, and otherwise downloads the pinned engine release for your platform into `~/.impeccable/bin/<version>/` and verifies it against the SHA-256 digest that ships with the skill (`scripts/engine-checksums.txt`) before running it, so the first use needs network access. A download or a cached engine that does not match its digest is refused, and a binary next to the launcher that reports a different engine version is skipped. Point `IMPECCABLE_BIN` at a preinstalled engine or set `IMPECCABLE_HOME` to a writable cache when that is not possible. Atomic's launcher keeps the engine's anonymous telemetry pings and its `npx impeccable update` check switched off, since the skill ships with each Atomic release. A concept roll still fetches its catalog with a `GET /api/roll` request to `impeccable.style`, which carries the scope, mode, a short seed key, and a re-roll counter, but no project files, prompts, code, or conversation. Live sessions resolve to the selected app root and support SvelteKit, Nuxt, TanStack Start, Astro, Next.js, Vite, and static HTML injection. The image fallback runs only with `OPENAI_API_KEY`, sends prompts and optional reference images to OpenAI, or to the endpoint in `OPENAI_BASE_URL` when that variable is set, and spends that account's API credit. Generated image prompts are embedded in the image or a sidecar, so do not include secrets.
|
|
124
124
|
|
|
125
125
|
Use `/skill:research-codebase` for a focused subsystem or question. For repository-wide research, use `fan-out-and-synthesize` with distinct repository partitions and an artifact synthesis barrier. Use Goal for ledger-backed bounded orchestration and Ralph for research-first delegated implementation with iterative review; task size alone does not select either workflow.
|
|
126
126
|
|
|
@@ -23,8 +23,10 @@ Start with the state you can observe. The existing sections below explain the co
|
|
|
23
23
|
| Broker does not start | The startup or readiness error quotes the broker log path and includes a bounded tail. | Read `~/.atomic/agent/intercom/broker.log`, or the equivalent path below `ATOMIC_CODING_AGENT_DIR`. See [How it works](#how-it-works). |
|
|
24
24
|
| Half-closed peer or undeliverable send | The send returns `Session not found`; its message id remains retryable. | Refresh the session list and retry after the target reconnects. See [How it works](#how-it-works). |
|
|
25
25
|
| Subagent being restored after a restart | A send or ask to a background subagent that its owner will restore, or is restoring, waits instead of returning `Session not found`. For a plain session's subagent this holds from the moment its reopened session starts. For a subagent of an interrupted workflow stage it holds from the moment the session that launched the run is back and the run is addressable, until the stage, once running again, restores it. It holds for the owner and for any session in the subagent's group, whether the message uses the subagent's name, its Atomic session ID, or the Intercom session ID it had before the restart. The name and Atomic session ID are held from the first moment; the pre-restart ID is held once the owner has read it from the subagent's own session, usually within a fraction of a second. Each waiting message is delivered once, in the order it was sent, when the subagent reconnects. If the subagent has not reconnected within 20 seconds, the sender gets a "still being restored" error. If the subagent did not survive the restart, the sender gets an explicit "did not survive the restart and is gone" error. If another Atomic session takes over the interrupted run, the senders waiting for its subagents get an error saying so. None of these returns `Session not found`. | Retry later if the subagent has not reconnected yet, launch a new subagent if the old one is gone, or send again to the session that took over the run. See [How it works](#how-it-works). |
|
|
26
|
+
| Subagent that ended or dropped off | A send or ask to a subagent whose session just ended or lost its connection waits up to 20 seconds instead of returning `Session not found`. If the subagent reconnects, each waiting message is delivered once, in order. If the session that launched it reports how it ended, the sender gets a typed error that names why and what to do: `recipient_completed`, `recipient_failed` or `recipient_stopped` with the `subagent({ action: "resume", id, message })` call its launching session can make, or `recipient_cancelled` for a subagent that cannot be resumed. Later sends get the same answer at once, by its name, Atomic session ID or Intercom session ID. If nobody says why within 20 seconds, the sender gets `recipient_disconnected`, which is retryable. What its launching session reported is kept while that session is away, as a suspended workflow stage is, and answers senders until the session is back; a subagent that drops after that session left waits 20 seconds for the report and then gets `recipient_disconnected`. Only senders in the subagent's group, and its launching session, are told anything; others still get `Session not found`. The [error codes](/intercom/reference#subagents-with-no-live-session) are in the reference. | Ask the session that launched the subagent to resume it, or launch a fresh subagent for a cancelled one. See [How it works](#how-it-works). |
|
|
27
|
+
| Workflow stage whose session was replaced or released | A send to a stage's session name (`subagent-chat-<id>`), Atomic session ID or Intercom session ID reaches the stage's current session after the stage's session was replaced. While the stage waits with its session released (suspended), the message is queued for the stage and delivered when it reopens, as a send to `workflow:<rootRunId>/<stage>` is. `contact_supervisor` from a subagent of such a stage is queued the same way. This works for senders in the stage's group and for the session that launched the run, for as long as the run's route lives. | Nothing to do. `intercom list` shows the stage under `workflow:<rootRunId>/<stage>` while it has no live session. See [How it works](#how-it-works). |
|
|
26
28
|
| Queued for a workflow stage that has not started | A send to `workflow:<rootRunId>/<path>` returns `Message queued for <target>` with no warning, even when the path is outside the run's known stages, or adds one `No stage named <x> is expected; did you mean <closest>?` line for a likely typo. | Nothing to do for a valid path. After a `did you mean` line, send again to the suggested path if that was the intent. See [Messages to workflow stages that have not started](#messages-to-workflow-stages-that-have-not-started). |
|
|
27
|
-
| Subagent released while it waits | A send or ask to a [released subagent](/subagents#released-subagents) waits while the session that launched it wakes the subagent from its saved session. Each waiting message is delivered once, in the order it was sent, when the subagent reconnects, usually within a second. If it has not reconnected within 20 seconds, the sender gets the same "still being restored" error as above.
|
|
29
|
+
| Subagent released while it waits | A send or ask to a [released subagent](/subagents#released-subagents) waits while the session that launched it wakes the subagent from its saved session. Each waiting message is delivered once, in the order it was sent, when the subagent reconnects, usually within a second. If it has not reconnected within 20 seconds, the sender gets the same "still being restored" error as above. If the connection of the session that launched it closes, as a suspended workflow stage's does, its sends are still held, but nobody can wake it until that session is back: after 20 seconds the sender gets a retryable `recipient_owner_suspended` error, and the session, once back, wakes the subagent for the sends waiting then. A paused or quit released subagent is not woken, and senders get the "still being restored" error too. When the subagent was woken but a heavy load keeps it from reconnecting, the wait can grow to 120 seconds once the launching session confirms the wake. A sender whose own broker is on another node always waits at most 20 seconds. The delivery failure carries a `reasonCode` so callers need not read the text: `recipient_not_restored` when the wait ended while the subagent was being restored or woken, and `recipient_parked` when it is paused or quit and not woken for a send. Other codes are `session_not_found` and `message_id_conflict`. | Retry later, or `resume` the subagent if it was paused or quit. Only the session that launched it owns its hold ([Released subagents](/intercom/reference#released-subagents)). See [How it works](#how-it-works). |
|
|
28
30
|
| Queued for an offline session | With [multi-node routing](#running-intercom-across-machines) on, a send, ask, or reply to a session that has disconnected is reported as queued at once (`Message queued for <target>`, with `target: "offline session"` in the result details). An ask returns without waiting for an answer. | Nothing to retry: the message is delivered when that session connects to Intercom again on any machine that uses the same storage. Do not send it again as a new message. See [Offline sessions](#offline-sessions). |
|
|
29
31
|
|
|
30
32
|
## How Connection Works
|
|
@@ -305,7 +307,7 @@ When a whole machine or its broker stops, its sessions still look connected for
|
|
|
305
307
|
- **Only connected sessions appear** — The list shows sessions that have connected to the broker, not every open Atomic process
|
|
306
308
|
- **Broker lifecycle** — The broker auto-spawns on first use and exits when idle; sessions reconnect automatically if it restarts
|
|
307
309
|
- **Unsaved sessions** — A session started with `--no-session` keeps received messages only in memory; if it exits before showing them, they are lost
|
|
308
|
-
- **Paused or quit subagent** — A send or ask to a subagent you paused with `subagent({ action: "pause" })` waits until you resume it, but only while the Atomic process that paused it keeps running. After a restart, or for a subagent you quit, sends
|
|
310
|
+
- **Paused or quit subagent** — A send or ask to a subagent you paused with `subagent({ action: "pause" })` waits until you resume it, but only while the Atomic process that paused it keeps running. After a restart, or for a subagent you quit, sends are not delivered until you resume it with `subagent({ action: "resume", id, message? })`: while the session that launched it, or its Atomic session when it is suspended, has reported the subagent, they are refused with `recipient_stopped`, which names that call; otherwise they return `Session not found`. See [Run control](/subagents#run-control)
|
|
309
311
|
- **Subagent whose owning process is not running** — Sends to a subagent are held only while an Atomic process that owns it is running: the reopened session for a plain session's subagent, the session that launched the run for a workflow stage's subagent (once the crashed session's lease has expired, about 120 seconds, and the run is addressable). Atomic keeps no durable mailbox for a subagent. While no such process runs, for example before the owning session is reopened, a send to the subagent is not queued and returns `Session not found`, the same as for a top-level session that is not running. The same applies for the few milliseconds after the owning session connects to Intercom and before it has placed its hold. Sends are also not held for a stage's subagent whose stage session cannot be read, or for a subagent that cannot use Intercom. A hold that nothing restores ends on its own: after 60 seconds for a session whose host does not run recovery, such as `atomic -p`, and when its owning session disconnects
|
|
310
312
|
- **A released subagent's question to a session on its own broker** — With multi-node routing on, a reply from another machine reaches a released subagent whose `ask` or `contact_supervisor` question went to a session on another node. A question to a session on the subagent's own broker is kept only by that broker: if the broker restarts, the subagent receives its reply timeout instead. See [Released subagents](/intercom/reference#released-subagents)
|
|
311
313
|
- **Offline sessions with multi-node routing** — With [multi-node routing](#running-intercom-across-machines) on, a send to a session that disconnected within about the last 7 days, including a subagent's session, is queued for it instead of returning `Session not found`, unless one of the holds above applies first. See [Offline sessions](#offline-sessions)
|
|
@@ -114,7 +114,7 @@ The background subagents that the run's stages launched stay addressable too. Wh
|
|
|
114
114
|
|
|
115
115
|
### Released subagents
|
|
116
116
|
|
|
117
|
-
A [released subagent](/subagents#released-subagents) stays addressable through the session that launched it: that session asks the broker to hold sends to the child's name and ids, and the broker tells it to wake the child when one arrives. Only that session owns the child's hold. The owner is the session that reserved the child first, or the one that authorized it as its supervisor when launching it. A session that reconnects with the same Intercom session id stays the owner. Another session cannot reserve, drop or acknowledge the child.
|
|
117
|
+
A [released subagent](/subagents#released-subagents) stays addressable through the session that launched it: that session asks the broker to hold sends to the child's name and ids, and the broker tells it to wake the child when one arrives. Only that session owns the child's hold. The owner is the session that reserved the child first, or the one that authorized it as its supervisor when launching it. A session that reconnects with the same Intercom session id stays the owner. If the owner's connection closes while it keeps a released child, as a [suspended](/workflows/operations#suspended-stages) workflow stage's does, the broker keeps the child's hold for the owner's Atomic session: sends wait up to 20 seconds and then get `recipient_owner_suspended` (see [Subagents with no live session](#subagents-with-no-live-session)). When a session of the same Atomic session reconnects and reserves its released children again, it takes the child over and wakes it for the sends waiting then. Such holds end with their workflow run. Another session cannot reserve, drop or acknowledge the child.
|
|
118
118
|
|
|
119
119
|
A background subagent waiting on an `ask`, or on `contact_supervisor` with `need_decision` or `interview_request`, is released like any other waiting subagent when its broker uses local routing or [multi-node routing](/intercom/operations#running-intercom-across-machines). While multi-node routing is still starting or is unavailable, the subagent stays live and receives the reply as before. Its question stays open while it holds no session.
|
|
120
120
|
|
|
@@ -151,6 +151,23 @@ SDK integrations can import these classes, their guards, `IntercomReleasedChildE
|
|
|
151
151
|
|
|
152
152
|
With [multi-node routing](/intercom/operations#running-intercom-across-machines) on, a child reserved through one broker stays with its owner. A reservation that another session makes for it through a different broker is withdrawn as soon as the shared store refuses it.
|
|
153
153
|
|
|
154
|
+
### Subagents with no live session
|
|
155
|
+
|
|
156
|
+
When a subagent's session ends or loses its connection and the subagent is not released, the broker holds sends and asks to its name, Atomic session ID and Intercom session ID for up to 20 seconds. A subagent that reconnects under its launching session's authorization receives each held message once, in order. The session that launched the subagent reports how its run ended, and the broker answers held and later senders with a typed error instead of `Session not found`. The launching session makes the report again whenever it reconnects, and it ends when the subagent registers again. If the launching session's connection closes, as a [suspended](/workflows/operations#suspended-stages) workflow stage's does, what it reported stays for its Atomic session, and the session takes it over when it reconnects. A subagent that disconnects after its launching session did waits up to 20 seconds for that report, then the sender gets `recipient_disconnected`. Both end with the workflow run. Only the launching session and senders in the subagent's group are held or told anything.
|
|
157
|
+
|
|
158
|
+
The send result's `error` is an `IntercomRecipientGoneError` and `reasonCode` is its `code`. It carries `target` (as the send addressed it), `childName`, `childId` when the launching session reported it, a `hint` and `retryable`. Check `isIntercomRecipientGoneError`, `isSubagentRecipientEndedError`, `isSubagentRecipientDisconnectedError`, `isSubagentRecipientOwnerSuspendedError` or `isRetryableIntercomRecipientGoneError`, never the message. SDK integrations can import these, `IntercomRecipientGoneErrorCode`, and `serializeIntercomRecipientGoneError` / `rehydrateIntercomRecipientGoneError` from `@bastani/intercom`. An Intercom client older than this release receives only the error's message as the send's reason.
|
|
159
|
+
|
|
160
|
+
| Class | `code` | When | `retryable` | What to do |
|
|
161
|
+
| --- | --- | --- | --- | --- |
|
|
162
|
+
| `SubagentRecipientEndedError` | `recipient_completed` | The subagent's last run completed. | `false` | Its launching session continues it with `subagent({ action: "resume", id: "<childId>", message })`. |
|
|
163
|
+
| `SubagentRecipientEndedError` | `recipient_failed` | The subagent's last run failed. | `false` | Same as above. |
|
|
164
|
+
| `SubagentRecipientEndedError` | `recipient_stopped` | The subagent was paused, quit or interrupted, or its workflow stage paused. | `false` | Same as above. |
|
|
165
|
+
| `SubagentRecipientEndedError` | `recipient_cancelled` | The subagent was cancelled for good, or its workflow stage ended. | `false` | Launch a fresh subagent if its work is still needed. |
|
|
166
|
+
| `SubagentRecipientDisconnectedError` | `recipient_disconnected` | The subagent disconnected, did not reconnect within 20 seconds, and its launching session did not say why. | `true` | Check `subagent({ action: "status" })` in its launching session, or try again shortly. |
|
|
167
|
+
| `SubagentRecipientOwnerSuspendedError` | `recipient_owner_suspended` | The subagent is released and the session that launched it, which wakes it, is suspended or disconnected; the send waited 20 seconds, or could not wait. | `true` | Try again once that session is back, or send to its workflow stage target (`workflow:<rootRunId>/<stage>`), which queues the message until the stage reopens. |
|
|
168
|
+
|
|
169
|
+
A launching session reports at most 500 subagents per request; a malformed report is refused with the `ReleasedChildReservationError` codes above, and a report naming a subagent another session owns with `not_owner`.
|
|
170
|
+
|
|
154
171
|
### Groups
|
|
155
172
|
|
|
156
173
|
Every session belongs to a non-empty set of intercom **groups**. Sessions with no group configured retain exactly the legacy behavior: they belong only to the implicit `"default"` group and can see and message each other. A session can ordinarily discover, resolve, and message another session when their membership sets intersect; exact-ID sends with no shared membership are rejected by the broker.
|
package/docs/llama-cpp.md
CHANGED
|
@@ -18,7 +18,7 @@ curl -LsSf https://llama.app/install.sh | sh
|
|
|
18
18
|
Verify the installation:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
llama
|
|
21
|
+
llama --version
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
See [llama.app](https://llama.app) for other installation methods, including package managers and building from source.
|
package/docs/sessions.md
CHANGED
|
@@ -166,7 +166,7 @@ Sessions created by workflow stage execution are marked as **internal** and are
|
|
|
166
166
|
|
|
167
167
|
## Recalling earlier work
|
|
168
168
|
|
|
169
|
-
The agent can look back at this project's earlier sessions and workflow runs, even in a fresh session, through `history://` URLs that `read` and `search` accept. They go through the configured session store and workflow journal, so they work the same for the default SQLite store, JSONL directories, memory and custom stores.
|
|
169
|
+
The agent can look back at this project's earlier sessions and workflow runs, even in a fresh session, through `history://` URLs that `read` and `search` accept. They go through the configured session store and workflow journal, so they work the same for the default SQLite store, JSONL directories, memory and custom stores. Workflow stages and subagents read the same history as the session that started them, with no extra configuration: a subagent lists the project's sessions rather than only its own, and opens its own transcript through its own `history://sessions/<id>` URL.
|
|
170
170
|
|
|
171
171
|
| URL | Result |
|
|
172
172
|
| --- | --- |
|
package/docs/subagents.md
CHANGED
|
@@ -269,6 +269,8 @@ Paused, quit, interrupted, completed, and failed children are resumable, includi
|
|
|
269
269
|
- **Stage ended**: the workflow stage that launched it finished, or its run ended or was cancelled. This covers every subagent of that stage, including ones you paused or quit, and also a run killed while it waited, after a restart, for `/workflow resume`. The error reads `<agent> (<child-id>, <intercom-name>) is terminal and cannot be resumed: its workflow stage ended (the stage finished, or its run ended or was cancelled). Launch a fresh subagent if its work is still needed.`
|
|
270
270
|
- **Gone**: it could not be restored after a restart.
|
|
271
271
|
|
|
272
|
+
An Intercom `send` or `ask` to a child that has no live session, because it completed, failed, was stopped or cancelled, does not return a bare `Session not found` while the session that launched it is connected. The sender gets an error that says how the child ended and names the call to make, for example `Subagent "subagent-worker-aabcf28b-1" completed and has no live session (recipient_completed). Its launching session can continue it with subagent({ action: "resume", id: "aabcf28b:0", message: "<your message>" }).` A send made in the moment a child's session closes waits up to 20 seconds for that answer, and is delivered if the child reconnects instead. See [Subagents with no live session](/intercom/reference#subagents-with-no-live-session) for the error codes.
|
|
273
|
+
|
|
272
274
|
Resume also refuses a child that is still running (pause or quit it first) and an id this session did not launch. A resume that fails, for example because the child's agent is no longer defined, keeps its `worktree: true` worktree with its changes and branch.
|
|
273
275
|
|
|
274
276
|
An SDK session without a task host runs its subagents directly and records them in its session the same way, so `pause`, `resume` (with or without `message`, queued messages included) and `quit` work there by id and with `all: true`, also after the session is reopened. A child resumed there runs in the background, and its result arrives as a completion notice. Closing the session stops such a child; reopening the session relaunches it automatically, and the messages it had queued and not read are delivered once, in order. For a terminal child, launch a fresh child with an explicit context handoff.
|
|
@@ -284,7 +286,7 @@ A background subagent that waits more than a minute on a tool call marked `detac
|
|
|
284
286
|
- Steering and follow-up messages the child had queued and not yet read when it was released are delivered when it wakes, once and in order.
|
|
285
287
|
- A result that arrives while a woken child is running is kept, and wakes the child again once that run ends.
|
|
286
288
|
- `pause` and `quit` on a released child only stop it from being woken; results that arrive meanwhile are kept and delivered when you `resume` it. `resume` wakes it with your `message` if given, as soon as fewer than `parallel.runningCapacity` of the session's released children are waking; it does not count once the child runs, and results that arrive while that run goes on are saved with the child at once.
|
|
287
|
-
- Released children wake through the session that launched them
|
|
289
|
+
- Released children wake through the session that launched them. If that session's connection closes while they wait, as a workflow stage's does while the stage is [suspended](/workflows/operations#suspended-stages), Intercom keeps their holds: a message to one waits up to 20 seconds and then gets a retryable `recipient_owner_suspended` error, and when the same session is back it takes its released children over and is asked to wake them for the messages waiting then. To reach a suspended stage meanwhile, send to its `workflow:<rootRunId>/<stage>` target, which queues the message until the stage reopens.
|
|
288
290
|
- Each run of a child that has finished stays listed in `/tasks` as one small record, with no live session, socket or timer, until that session closes.
|
|
289
291
|
- The results a wake carries are saved with the child before the child is reopened, so a restart in between wakes it with them instead of running the finished call again. If a wake fails, for example because the child's agent is no longer defined, the results it carried stay saved with the child. `status` shows the failure, its code and what to do, and the session that launched the child gets one notice. `resume` tries again and delivers the saved results.
|
|
290
292
|
- If a child record could not be saved, `status` reports the last failure and its hint for the launching session. Check the session store before retrying; unsaved state cannot survive a restart.
|
|
@@ -328,6 +330,8 @@ In the default isolated CLI, background subagents continue running after their l
|
|
|
328
330
|
|
|
329
331
|
Transcript inspection shows the child's conversation as a chat, with the same scrolling, keys, and display settings as a workflow stage chat: it opens at the latest message, follows new output, and loads earlier retained history as you scroll toward the top. Thinking blocks follow Ctrl+T and tool output follows Ctrl+O. Compaction boundaries, branch summaries, and extension notices appear as they do in the chat. Missing capture is reported as `Transcript unavailable`; metrics never substitute for missing messages. See [Inspect tasks](/background-tasks#inspect-tasks) for the controls.
|
|
330
332
|
|
|
333
|
+
A subagent's transcript names the subagent in its prompt's top rule, as `[subagent: subagent-worker-aabcf28b-1]`, the way an attached workflow stage chat shows `[stage: <name>]`. The name is the subagent's Intercom name, or its agent name when it has none. The chat box is the stage chat's: pending messages, the working line and the usage meter sit above the prompt, and the model and folder line and a count of the subagent's own running tasks sit below it. While the subagent runs in this session, the usage meter and model line show its own session, and a transcript opened mid-turn shows the working line and any messages already queued for it. A subagent that has finished, or runs in another process, shows the task count only. Typing `/tasks` there opens that subagent's own tasks, the shells it ran and the subagents it launched, instead of the parent's. Inside a nested subagent's transcript, `/tasks` lists that subagent's tasks. Escape or Left returns to the subagent's chat. The main chat's `/tasks` still lists every task, including the shells subagents ran.
|
|
334
|
+
|
|
331
335
|
Type in a transcript's prompt and press Enter to message the child through its Intercom target, as an Intercom message from your session would. The child records the message, so it appears in the transcript once delivered; a message Intercom refuses or does not confirm stays in the prompt with the reason.
|
|
332
336
|
|
|
333
337
|
Live transcripts refresh streaming text, tool results, and compaction status without reopening. Earlier pages remain anchored, and leaving the view does not affect execution.
|
package/docs/tools.md
CHANGED
|
@@ -139,7 +139,7 @@ A cancelled `edit` or `write` throws `FileToolAbortedError` (`name: "AbortError"
|
|
|
139
139
|
The `bash` tool executes shell commands in the session workspace. It accepts `cwd`, `env`, `timeout`, `pty`, and `heartbeatMs`.
|
|
140
140
|
|
|
141
141
|
- `cwd` and `env` set the working directory and environment for local execution.
|
|
142
|
-
- `timeout` is in seconds and defaults to 300. Explicit values must be finite, greater than zero, and no more than 3600. Invalid values fail before execution. Fractions round down, with a one-second floor.
|
|
142
|
+
- `timeout` is in seconds and defaults to 300. Explicit values must be finite, greater than zero, and no more than 3600. Invalid values fail before execution. Fractions round down, with a one-second floor. The timeout keeps counting after a command continues in the background: the launch result names it, and a later `wait` on a command it stopped returns an error naming the timeout. See [Background shells](/background-tasks#background-shells).
|
|
143
143
|
- `pty: true` uses the bundled native PTY session, falling back to pipes if unavailable. Set `PI_NO_PTY=1` or `ATOMIC_NO_PTY=1` to force pipes.
|
|
144
144
|
- `heartbeatMs` sets how often a command that keeps running as a background task sends a [task heartbeat](/background-tasks#task-heartbeats). Omit it for the chat's default (15 minutes unless `tasks.heartbeatMs` changes it), use `0` to turn heartbeats off, or give at least `60000`.
|
|
145
145
|
|
package/docs/usage.md
CHANGED
|
@@ -170,18 +170,7 @@ Append to the default prompt without replacing it with `APPEND_SYSTEM.md` in eit
|
|
|
170
170
|
|
|
171
171
|
The default prompt asks the agent to write self-describing code and not add code comments unless you ask for them or the task calls for them. To get comments, request them in your prompt (for example "add JSDoc to the exported functions"), or make it a standing rule in a context file or `APPEND_SYSTEM.md` (for example "Document every exported function with a JSDoc block"). The default guideline explicitly defers to those instructions, so no other configuration is needed.
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```text
|
|
176
|
-
Assistant-workflow: ralph (run 1a2b3c4d)
|
|
177
|
-
Assistant-duration: 42m converged, estimated 30m
|
|
178
|
-
Assistant-verification: vitest unit passed: npm run test:unit
|
|
179
|
-
Assistant-verification: herdr terminal E2E passed: /tasks lists running tasks first at 80x24
|
|
180
|
-
User-preference: keep PRs under 500 changed lines
|
|
181
|
-
Co-authored-by: Ada Lovelace <ada@example.com>
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Tasks done without a workflow record `Assistant-workflow: inline`. Each `Assistant-verification` line names one check that ran or was attempted, such as unit or E2E tests, agent-browser, agent-desktop, Herdr terminal automation, or the qlty CLI, with its outcome (`passed`, `failed`, or `unavailable`). Each preference carries a `Co-authored-by` line naming the user who expressed it. Before choosing between a workflow and inline work, deciding how to verify a change, or estimating how long a task will take, the agent looks up comparable records with your version control system and its hosting CLI (for example `git log` and `gh` on GitHub) and uses them as a guide alongside your request. A lack of workflow history, or a history of mostly inline tasks, does not make the agent default to inline work: it still judges from the task itself whether a workflow would help unless you have stated or recorded a preference. For verification, it starts from the checks that proved similar changes and skips setups previously recorded as unavailable unless something has changed, while still running the project's required checks. It applies your own recorded preferences first and falls back to other contributors' preferences as repository conventions only when yours don't cover the situation, so you can always override a convention by stating your preference. To turn off any of these records, such as only preferences or all of them, say so in your request, a context file, or `APPEND_SYSTEM.md`.
|
|
173
|
+
The agent remembers earlier work through `history://`: it recalls this project's past sessions and workflow runs, and the preferences you stated in them, when you refer to earlier work, when a task resembles one done before, and before it chooses between a workflow and inline work, how to verify a change, or how long a task will take. Workflow stages and subagents recall the same history by default. With a shell tool, the agent also searches commits, issues, PRs and their comments for relevant prior work. See [Recalling earlier work](/sessions#recalling-earlier-work).
|
|
185
174
|
|
|
186
175
|
## Exporting and Sharing Sessions
|
|
187
176
|
|
|
@@ -210,8 +210,9 @@ Common controls:
|
|
|
210
210
|
Surface behavior:
|
|
211
211
|
|
|
212
212
|
- **Graph vs. stage chat** - Use `connect` for the workflow graph. Use `attach` when you want a chat pane for a specific stage.
|
|
213
|
+
- **Run state** - The graph header puts the run's state before its stage counts and colors the ORCHESTRATOR pill to match: `↑ blocked`, followed by the exit reason when the workflow gave one and shortened to fit; `❚❚ paused`; `○ quit`; or `● resumed` while a resumed run is live, so you know more stages will appear. `↑ N` counts blocked stages. The stage switcher (`/`), `/workflow status`, and the `/workflow connect` picker show the same state.
|
|
213
214
|
- **Hierarchy chord** - `ctrl+x` is the workflow hierarchy chord: in an attached stage chat it means **return to graph**, and in the graph it means **return to main chat**. The workflow surface handles `ctrl+x` before configurable editor or tool actions, including while a composer draft, primitive prompt, custom question, stage switcher, or legacy prompt card owns input.
|
|
214
|
-
- **Stage input label** - Attached stage chats show `[stage: name]` on the composer top rule, a mounted question's top rule, and awaiting-input prompt borders so you can tell which stage owns the input. Long names truncate with `…`.
|
|
215
|
+
- **Stage input label** - Attached stage chats show `[stage: name]` on the composer top rule, a mounted question's top rule, and awaiting-input prompt borders so you can tell which stage owns the input. Long names truncate with `…`. A subagent's transcript opened from `/tasks` labels its prompt `[subagent: name]` the same way.
|
|
215
216
|
- **Draft preservation** - Leaving a stage preserves unsent composer and prompt drafts and keeps pending custom questions unresolved so they reappear when you attach again.
|
|
216
217
|
- **Queued-message survival** - Detaching preserves queued steering and follow-up text. Reattach to see the pending messages; the graph shows their count as `✉ N queued`. Queues also survive model fallback and eligible post-mortem reopening. Custom session adapters must publish `queue_update` snapshots and expose pre-attachment queues as described in [authoring](/workflows/authoring#stage-follow-on-user-messages).
|
|
217
218
|
- **Reserved keys** - `ctrl+d` and `q` do not navigate workflow surfaces; `ctrl+d` keeps its ordinary editor or prompt behavior where applicable, and `q` remains printable in text-owning prompts. Existing `esc`, `ctrl+c`, and graph `h` close/hide controls are unchanged.
|
|
@@ -340,6 +341,7 @@ Controls work on a suspended stage:
|
|
|
340
341
|
|
|
341
342
|
- Messages and steering to a stage waiting on a tool call are held, and reach the stage in order when it reopens. They are held in memory, so they are lost if Atomic stops before the stage wakes; Intercom sends wait in the run's queue and survive a restart. A message to a stage waiting between turns reopens it.
|
|
342
343
|
- `pause` holds the stage: results that arrive meanwhile wait until you resume it.
|
|
344
|
+
- Subagents the stage launched keep running, and keep their shells: they can still wait on, stop and start background shells, and get those shells' completion notices. The stage's own session launches nothing until it reopens.
|
|
343
345
|
- While a stage's conversation waits on a tool call's result, nothing starts a new turn on its session: a notification such as a finished subagent's, steering and follow-ups wait, and join the turn the result continues, and a compaction leaves the waiting call's turn in the conversation. If the conversation has moved past a waiting call anyway, for example because the model kept working, Atomic cancels that call and drops its late result instead of failing the stage: the stage keeps its own result, including a captured `structured_output`, and the run goes on. A result that arrives while the stage's session is still running waits for that run to settle first. A dropped call, and a stage prompt or retry that was not sent because the session waits on a result, are recorded in the [debug log](/development#debugging) as `stale-detached-call` and `stage-input-held-for-detached-results`.
|
|
344
346
|
- `quit`, or a crash of the Atomic process, stops the wait. `/workflow resume` reopens the stage and starts the pending tool call again with the same call id and arguments, then continues the turn; a call whose result was saved before the stop is not started again, and the turn continues from that result. It does not send the stage's prompt again, also for a stage that waited between turns. A tool call can therefore run more than once across a restart.
|
|
345
347
|
- If the session store the run resumes with does not hold a waiting stage's session, `/workflow resume` fails with `StageRehydrationError` (`session-not-found`) before changing anything, for a run that stopped with Atomic and for one that failed or is blocked alike. Resume with the session storage the run was started with; `atomic storage status` shows which one this process selects. On a machine that uses local-only storage and is not joined to shared storage, run `atomic team join <url> --token-file <path>` first (see [Team and CI setup](/guides/team-setup)); joining sets the team database but keeps sessions in a local store, so also select the session storage that holds the waiting stage's session. A child workflow, including one a worker pool runs, checks its own waiting stages when it starts again: a missing session fails the child with the same error before it does any work, and the pool does not retry it until the root is resumed, when the child checks again. The error's `rootRunId` names the run to resume; a worker pool keeps its children's sessions in a store that run's journal selects, so resume it with the journal storage it was started with, on the machine that ran a local pool.
|
|
@@ -23,14 +23,7 @@ See [tool selection](/computer-use#choose-the-right-tool) before operating a ses
|
|
|
23
23
|
|
|
24
24
|
### Reuse past verification
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
Assistant-verification: herdr terminal E2E passed: /tasks lists running tasks first at 80x24
|
|
30
|
-
Assistant-verification: agent-desktop unavailable: Accessibility permission not granted
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Before choosing checks for a change, the agent looks up these lines for comparable changes (for example with `git log --format='%h %s%n%(trailers:key=Assistant-verification)' -- <path>`) and reuses the commands and scenarios that proved them. A setup recorded as `unavailable` is not retried without a reason to expect a different result. Past records guide the choice; they do not replace the project's required checks. See [execution history](/usage#system-prompt-files) to turn these records off.
|
|
26
|
+
Before choosing checks for a change, the agent can look up how comparable work was verified in earlier sessions and workflow runs through `history://` (see [Recalling earlier work](/sessions#recalling-earlier-work)), and in the commits and PRs that made those changes. Earlier checks guide the choice; they do not replace the project's required checks.
|
|
34
27
|
|
|
35
28
|
## Define a reproducible scenario
|
|
36
29
|
|