cli-jaw 2.17.38 → 2.17.39
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/README.md +40 -1
- package/dist/bin/commands/chat.js +19 -2
- package/dist/bin/commands/chat.js.map +1 -1
- package/dist/bin/commands/dashboard.js +27 -10
- package/dist/bin/commands/dashboard.js.map +1 -1
- package/dist/bin/commands/init.js +10 -1
- package/dist/bin/commands/init.js.map +1 -1
- package/dist/bin/commands/tui/activity-answer-read.js +122 -0
- package/dist/bin/commands/tui/activity-answer-read.js.map +1 -0
- package/dist/bin/commands/tui/activity-fallback.js +40 -0
- package/dist/bin/commands/tui/activity-fallback.js.map +1 -0
- package/dist/bin/commands/tui/activity-handler.js +273 -0
- package/dist/bin/commands/tui/activity-handler.js.map +1 -0
- package/dist/bin/commands/tui/activity-history.js +245 -0
- package/dist/bin/commands/tui/activity-history.js.map +1 -0
- package/dist/bin/commands/tui/activity-http.js +88 -0
- package/dist/bin/commands/tui/activity-http.js.map +1 -0
- package/dist/bin/commands/tui/activity-replay.js +250 -0
- package/dist/bin/commands/tui/activity-replay.js.map +1 -0
- package/dist/bin/commands/tui/api.js +48 -1
- package/dist/bin/commands/tui/api.js.map +1 -1
- package/dist/bin/commands/tui/channel.js +11 -1
- package/dist/bin/commands/tui/channel.js.map +1 -1
- package/dist/bin/commands/tui/fullscreen-mode.js +78 -12
- package/dist/bin/commands/tui/fullscreen-mode.js.map +1 -1
- package/dist/bin/commands/tui/input-handler.js +7 -0
- package/dist/bin/commands/tui/input-handler.js.map +1 -1
- package/dist/bin/commands/tui/overlays.js +6 -3
- package/dist/bin/commands/tui/overlays.js.map +1 -1
- package/dist/bin/commands/tui/renderer.js +27 -15
- package/dist/bin/commands/tui/renderer.js.map +1 -1
- package/dist/bin/commands/tui/types.js.map +1 -1
- package/dist/bin/commands/tui/ws-handler.js +158 -13
- package/dist/bin/commands/tui/ws-handler.js.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/src/agent/claude-runtime-pool.js +386 -0
- package/dist/src/agent/claude-runtime-pool.js.map +1 -0
- package/dist/src/agent/claude-runtime-run.js +366 -0
- package/dist/src/agent/claude-runtime-run.js.map +1 -0
- package/dist/src/agent/codex-app-events.js +3 -1
- package/dist/src/agent/codex-app-events.js.map +1 -1
- package/dist/src/agent/events/claude.js +11 -9
- package/dist/src/agent/events/claude.js.map +1 -1
- package/dist/src/agent/events/codex.js +2 -0
- package/dist/src/agent/events/codex.js.map +1 -1
- package/dist/src/agent/events/cursor.js +49 -21
- package/dist/src/agent/events/cursor.js.map +1 -1
- package/dist/src/agent/events/grok.js +33 -5
- package/dist/src/agent/events/grok.js.map +1 -1
- package/dist/src/agent/events/helpers.js +9 -0
- package/dist/src/agent/events/helpers.js.map +1 -1
- package/dist/src/agent/events/index.js +13 -1
- package/dist/src/agent/events/index.js.map +1 -1
- package/dist/src/agent/events/opencode.js +65 -1
- package/dist/src/agent/events/opencode.js.map +1 -1
- package/dist/src/agent/lifecycle-handler.js +185 -62
- package/dist/src/agent/lifecycle-handler.js.map +1 -1
- package/dist/src/agent/merge-tool-log.js +77 -0
- package/dist/src/agent/merge-tool-log.js.map +1 -0
- package/dist/src/agent/native-runtime-run.js +235 -0
- package/dist/src/agent/native-runtime-run.js.map +1 -0
- package/dist/src/agent/pi-runtime.js +468 -101
- package/dist/src/agent/pi-runtime.js.map +1 -1
- package/dist/src/agent/prompt-context.js +88 -2
- package/dist/src/agent/prompt-context.js.map +1 -1
- package/dist/src/agent/runtime/acp/callbacks.js +223 -0
- package/dist/src/agent/runtime/acp/callbacks.js.map +1 -0
- package/dist/src/agent/runtime/acp/config.js +182 -0
- package/dist/src/agent/runtime/acp/config.js.map +1 -0
- package/dist/src/agent/runtime/acp/connection.js +254 -0
- package/dist/src/agent/runtime/acp/connection.js.map +1 -0
- package/dist/src/agent/runtime/acp/content.js +63 -0
- package/dist/src/agent/runtime/acp/content.js.map +1 -0
- package/dist/src/agent/runtime/acp/cursor-session.js +92 -0
- package/dist/src/agent/runtime/acp/cursor-session.js.map +1 -0
- package/dist/src/agent/runtime/acp/grok-control.js +3 -0
- package/dist/src/agent/runtime/acp/grok-control.js.map +1 -0
- package/dist/src/agent/runtime/acp/grok-events.js +28 -0
- package/dist/src/agent/runtime/acp/grok-events.js.map +1 -0
- package/dist/src/agent/runtime/acp/grok-options.js +63 -0
- package/dist/src/agent/runtime/acp/grok-options.js.map +1 -0
- package/dist/src/agent/runtime/acp/grok-session.js +118 -0
- package/dist/src/agent/runtime/acp/grok-session.js.map +1 -0
- package/dist/src/agent/runtime/acp/notification-queue.js +107 -0
- package/dist/src/agent/runtime/acp/notification-queue.js.map +1 -0
- package/dist/src/agent/runtime/acp/permissions.js +133 -0
- package/dist/src/agent/runtime/acp/permissions.js.map +1 -0
- package/dist/src/agent/runtime/acp/projection.js +162 -0
- package/dist/src/agent/runtime/acp/projection.js.map +1 -0
- package/dist/src/agent/runtime/acp/replacement-turn.js +187 -0
- package/dist/src/agent/runtime/acp/replacement-turn.js.map +1 -0
- package/dist/src/agent/runtime/acp/replacement.js +159 -0
- package/dist/src/agent/runtime/acp/replacement.js.map +1 -0
- package/dist/src/agent/runtime/acp/runtime-session.js +245 -0
- package/dist/src/agent/runtime/acp/runtime-session.js.map +1 -0
- package/dist/src/agent/runtime/acp/session.js +426 -0
- package/dist/src/agent/runtime/acp/session.js.map +1 -0
- package/dist/src/agent/runtime/acp/wire.js +46 -0
- package/dist/src/agent/runtime/acp/wire.js.map +1 -0
- package/dist/src/agent/runtime/claude-run-controls.js +41 -0
- package/dist/src/agent/runtime/claude-run-controls.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-children.js +405 -0
- package/dist/src/agent/runtime/claude-sdk-children.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-close.js +43 -0
- package/dist/src/agent/runtime/claude-sdk-close.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-content.js +42 -0
- package/dist/src/agent/runtime/claude-sdk-content.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-events.js +337 -0
- package/dist/src/agent/runtime/claude-sdk-events.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-hooks.js +32 -0
- package/dist/src/agent/runtime/claude-sdk-hooks.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-input.js +58 -0
- package/dist/src/agent/runtime/claude-sdk-input.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-loader.js +21 -0
- package/dist/src/agent/runtime/claude-sdk-loader.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-messages.js +133 -0
- package/dist/src/agent/runtime/claude-sdk-messages.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-metadata.js +40 -0
- package/dist/src/agent/runtime/claude-sdk-metadata.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-options.js +70 -0
- package/dist/src/agent/runtime/claude-sdk-options.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-owners.js +113 -0
- package/dist/src/agent/runtime/claude-sdk-owners.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-permissions.js +283 -0
- package/dist/src/agent/runtime/claude-sdk-permissions.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-process.js +72 -0
- package/dist/src/agent/runtime/claude-sdk-process.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-roots.js +103 -0
- package/dist/src/agent/runtime/claude-sdk-roots.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-session.js +518 -0
- package/dist/src/agent/runtime/claude-sdk-session.js.map +1 -0
- package/dist/src/agent/runtime/codex-projection.js +126 -0
- package/dist/src/agent/runtime/codex-projection.js.map +1 -0
- package/dist/src/agent/runtime/events.js +39 -0
- package/dist/src/agent/runtime/events.js.map +1 -0
- package/dist/src/agent/runtime/grok-main.js +7 -0
- package/dist/src/agent/runtime/grok-main.js.map +1 -0
- package/dist/src/agent/runtime/outcome.js +28 -0
- package/dist/src/agent/runtime/outcome.js.map +1 -0
- package/dist/src/agent/runtime/pi-projection.js +97 -0
- package/dist/src/agent/runtime/pi-projection.js.map +1 -0
- package/dist/src/agent/runtime/pi-raw-trace.js +87 -0
- package/dist/src/agent/runtime/pi-raw-trace.js.map +1 -0
- package/dist/src/agent/runtime/pi-turn.js +159 -0
- package/dist/src/agent/runtime/pi-turn.js.map +1 -0
- package/dist/src/agent/runtime/print-activity.js +47 -0
- package/dist/src/agent/runtime/print-activity.js.map +1 -0
- package/dist/src/agent/runtime/print-projection.js +51 -0
- package/dist/src/agent/runtime/print-projection.js.map +1 -0
- package/dist/src/agent/runtime/projection.js +283 -0
- package/dist/src/agent/runtime/projection.js.map +1 -0
- package/dist/src/agent/runtime/replace-turn.js +36 -0
- package/dist/src/agent/runtime/replace-turn.js.map +1 -0
- package/dist/src/agent/runtime/requests.js +207 -0
- package/dist/src/agent/runtime/requests.js.map +1 -0
- package/dist/src/agent/runtime/selection.js +31 -0
- package/dist/src/agent/runtime/selection.js.map +1 -0
- package/dist/src/agent/runtime/session.js +2 -0
- package/dist/src/agent/runtime/session.js.map +1 -0
- package/dist/src/agent/runtime-pool-contract.js +2 -0
- package/dist/src/agent/runtime-pool-contract.js.map +1 -0
- package/dist/src/agent/runtime-pool.js +317 -9
- package/dist/src/agent/runtime-pool.js.map +1 -1
- package/dist/src/agent/session-persistence.js +10 -2
- package/dist/src/agent/session-persistence.js.map +1 -1
- package/dist/src/agent/spawn.js +990 -143
- package/dist/src/agent/spawn.js.map +1 -1
- package/dist/src/agent/steer-input-guard.js +33 -0
- package/dist/src/agent/steer-input-guard.js.map +1 -0
- package/dist/src/cli/acp-client.js +20 -21
- package/dist/src/cli/acp-client.js.map +1 -1
- package/dist/src/cli/handlers-runtime.js +21 -12
- package/dist/src/cli/handlers-runtime.js.map +1 -1
- package/dist/src/cli/registry.js +2 -0
- package/dist/src/cli/registry.js.map +1 -1
- package/dist/src/cli/tui/activity-answer.js +97 -0
- package/dist/src/cli/tui/activity-answer.js.map +1 -0
- package/dist/src/cli/tui/activity-history.js +364 -0
- package/dist/src/cli/tui/activity-history.js.map +1 -0
- package/dist/src/cli/tui/activity-linear.js +29 -0
- package/dist/src/cli/tui/activity-linear.js.map +1 -0
- package/dist/src/cli/tui/activity-terminal-text.js +111 -0
- package/dist/src/cli/tui/activity-terminal-text.js.map +1 -0
- package/dist/src/cli/tui/activity.js +95 -0
- package/dist/src/cli/tui/activity.js.map +1 -0
- package/dist/src/cli/tui/cell-width.js +41 -0
- package/dist/src/cli/tui/cell-width.js.map +1 -0
- package/dist/src/cli/tui/events.js +15 -0
- package/dist/src/cli/tui/events.js.map +1 -1
- package/dist/src/cli/tui/keymap.js +2 -0
- package/dist/src/cli/tui/keymap.js.map +1 -1
- package/dist/src/cli/tui/render/composer-box.js +12 -14
- package/dist/src/cli/tui/render/composer-box.js.map +1 -1
- package/dist/src/cli/tui/render/viewport.js +9 -5
- package/dist/src/cli/tui/render/viewport.js.map +1 -1
- package/dist/src/cli/tui/renderers.js +119 -139
- package/dist/src/cli/tui/renderers.js.map +1 -1
- package/dist/src/cli/tui/settings-screen.js +11 -0
- package/dist/src/cli/tui/settings-screen.js.map +1 -1
- package/dist/src/cli/tui/store.js +3 -0
- package/dist/src/cli/tui/store.js.map +1 -1
- package/dist/src/cli/tui/transcript.js +68 -0
- package/dist/src/cli/tui/transcript.js.map +1 -1
- package/dist/src/core/bus.js +8 -0
- package/dist/src/core/bus.js.map +1 -1
- package/dist/src/core/chat-sessions.js +1 -0
- package/dist/src/core/chat-sessions.js.map +1 -1
- package/dist/src/core/compact.js +10 -3
- package/dist/src/core/compact.js.map +1 -1
- package/dist/src/core/config.js +21 -0
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/db.js +26 -0
- package/dist/src/core/db.js.map +1 -1
- package/dist/src/core/runtime-settings.js +44 -3
- package/dist/src/core/runtime-settings.js.map +1 -1
- package/dist/src/core/session-ops.js +40 -9
- package/dist/src/core/session-ops.js.map +1 -1
- package/dist/src/core/settings-merge.js +31 -1
- package/dist/src/core/settings-merge.js.map +1 -1
- package/dist/src/core/settings-watch.js +8 -1
- package/dist/src/core/settings-watch.js.map +1 -1
- package/dist/src/discord/bot.js +28 -9
- package/dist/src/discord/bot.js.map +1 -1
- package/dist/src/discord/send-only-client.js +4 -0
- package/dist/src/discord/send-only-client.js.map +1 -1
- package/dist/src/manager/routes/telegram-hub.js +2 -1
- package/dist/src/manager/routes/telegram-hub.js.map +1 -1
- package/dist/src/manager/scan.js +12 -0
- package/dist/src/manager/scan.js.map +1 -1
- package/dist/src/manager/server.js +89 -13
- package/dist/src/manager/server.js.map +1 -1
- package/dist/src/manager/telegram-hub/hub-bot.js +9 -3
- package/dist/src/manager/telegram-hub/hub-bot.js.map +1 -1
- package/dist/src/orchestrator/collect.js +80 -6
- package/dist/src/orchestrator/collect.js.map +1 -1
- package/dist/src/orchestrator/gateway.js +13 -10
- package/dist/src/orchestrator/gateway.js.map +1 -1
- package/dist/src/orchestrator/pipeline.js +68 -29
- package/dist/src/orchestrator/pipeline.js.map +1 -1
- package/dist/src/orchestrator/request-registry.js +2 -0
- package/dist/src/orchestrator/request-registry.js.map +1 -1
- package/dist/src/orchestrator/scope.js +15 -0
- package/dist/src/orchestrator/scope.js.map +1 -1
- package/dist/src/routes/memory.js +2 -2
- package/dist/src/routes/memory.js.map +1 -1
- package/dist/src/routes/messages.js +51 -18
- package/dist/src/routes/messages.js.map +1 -1
- package/dist/src/routes/orchestrate.js +29 -17
- package/dist/src/routes/orchestrate.js.map +1 -1
- package/dist/src/routes/runtime-request-notices.js +23 -0
- package/dist/src/routes/runtime-request-notices.js.map +1 -0
- package/dist/src/routes/runtime-requests.js +43 -0
- package/dist/src/routes/runtime-requests.js.map +1 -0
- package/dist/src/routes/settings.js +7 -1
- package/dist/src/routes/settings.js.map +1 -1
- package/dist/src/routes/traces.js +93 -6
- package/dist/src/routes/traces.js.map +1 -1
- package/dist/src/shared/activity-read.js +158 -0
- package/dist/src/shared/activity-read.js.map +1 -0
- package/dist/src/shared/activity-replay.js +279 -0
- package/dist/src/shared/activity-replay.js.map +1 -0
- package/dist/src/shared/activity-state.js +144 -0
- package/dist/src/shared/activity-state.js.map +1 -0
- package/dist/src/shared/isolated-qa.js +132 -0
- package/dist/src/shared/isolated-qa.js.map +1 -0
- package/dist/src/shared/presentation.js +21 -0
- package/dist/src/shared/presentation.js.map +1 -0
- package/dist/src/shared/runtime-contract.js +2 -0
- package/dist/src/shared/runtime-contract.js.map +1 -0
- package/dist/src/shared/runtime-event-parse.js +99 -0
- package/dist/src/shared/runtime-event-parse.js.map +1 -0
- package/dist/src/shared/runtime-request-notice.js +9 -0
- package/dist/src/shared/runtime-request-notice.js.map +1 -0
- package/dist/src/shared/tool-log-sanitize.js +11 -5
- package/dist/src/shared/tool-log-sanitize.js.map +1 -1
- package/dist/src/slack/bot.js +20 -7
- package/dist/src/slack/bot.js.map +1 -1
- package/dist/src/slack/send-only-client.js +3 -0
- package/dist/src/slack/send-only-client.js.map +1 -1
- package/dist/src/telegram/bot.js +27 -5
- package/dist/src/telegram/bot.js.map +1 -1
- package/dist/src/telegram/rich-message.js +47 -1
- package/dist/src/telegram/rich-message.js.map +1 -1
- package/dist/src/trace/activity-control.js +87 -0
- package/dist/src/trace/activity-control.js.map +1 -0
- package/dist/src/trace/activity-journal.js +155 -0
- package/dist/src/trace/activity-journal.js.map +1 -0
- package/dist/src/trace/activity-retention.js +55 -0
- package/dist/src/trace/activity-retention.js.map +1 -0
- package/dist/src/trace/runtime-body-codec.js +162 -0
- package/dist/src/trace/runtime-body-codec.js.map +1 -0
- package/dist/src/trace/store.js +65 -22
- package/dist/src/trace/store.js.map +1 -1
- package/package.json +8 -5
- package/public/css/activity.css +211 -0
- package/public/css/chat-search.css +13 -1
- package/public/css/chat.css +10 -0
- package/public/css/native-requests.css +55 -0
- package/public/css/trace-drawer.css +15 -8
- package/public/dist/assets/AdvancedExport-q4DnVxpT.js +1 -0
- package/public/dist/assets/Agent-CI1AfYOA.js +1 -0
- package/public/dist/assets/Browser-D9kwPJfN.js +1 -0
- package/public/dist/assets/BrowserPanel-CVZyvbth.js +3 -0
- package/public/dist/assets/{ChannelEnablementControl-B9KiYDZZ.js → ChannelEnablementControl-BkxeZonM.js} +1 -1
- package/public/dist/assets/ChannelsDiscord-CulKFTiX.js +1 -0
- package/public/dist/assets/ChannelsSlack-D09H8GKC.js +1 -0
- package/public/dist/assets/ChannelsTelegram-yA_NMLfM.js +1 -0
- package/public/dist/assets/CodeCanvas-DUaLWPBe.js +3 -0
- package/public/dist/assets/{DashboardEmbeddingSection-CIOwsVB5.js → DashboardEmbeddingSection-R9vUu9X2.js} +1 -1
- package/public/dist/assets/{DashboardMeta-D6nJsY8n.js → DashboardMeta-BKutQ9Ps.js} +1 -1
- package/public/dist/assets/DesignPanel-CE5jvzt4.js +2 -0
- package/public/dist/assets/{DiffPanel-ZaDoV7qS.js → DiffPanel-D9Cch5FG.js} +2 -2
- package/public/dist/assets/Display-BPYZ295k.js +1 -0
- package/public/dist/assets/DocPanel-DvtFw8AP.js +1 -0
- package/public/dist/assets/{Employees-CR41RcWo.js → Employees-bxErTlcA.js} +1 -1
- package/public/dist/assets/FolderPanel-u2YeiFFr.js +3 -0
- package/public/dist/assets/HealthBadge-CDPKdSXc.js +1 -0
- package/public/dist/assets/{Heartbeat-CD1R95Kv.js → Heartbeat-BCt4mFWz.js} +1 -1
- package/public/dist/assets/{InlineWarn-B3bJfG-Z.js → InlineWarn-DakL-ThS.js} +1 -1
- package/public/dist/assets/MarkdownRenderer-Cc3DeHvm.js +1 -0
- package/public/dist/assets/MarkdownRenderer-DzN66XVb.js +15 -0
- package/public/dist/assets/{Mcp-DSIEQZfH.js → Mcp-Cp1ffHWt.js} +2 -2
- package/public/dist/assets/{Memory-CpZIdE1o.js → Memory-Rq4fHjZv.js} +1 -1
- package/public/dist/assets/MilkdownWysiwygEditor-xObhviw7.js +160 -0
- package/public/dist/assets/ModelProvider-BNDxlWHC.js +1 -0
- package/public/dist/assets/Network-D_OYGb_C.js +1 -0
- package/public/dist/assets/NotesGraphWorkspace-DO9LtVGF.js +1 -0
- package/public/dist/assets/PanelLayoutProvider-BFxal5fZ.js +1 -0
- package/public/dist/assets/Permissions-DZ3ADB4i.js +1 -0
- package/public/dist/assets/Permissions-wj06yuy6.js +1 -0
- package/public/dist/assets/Profile-BQiNETCP.js +1 -0
- package/public/dist/assets/Prompts-DrMb2Kom.js +1 -0
- package/public/dist/assets/{SpeechKeys-CIq4c1iz.js → SpeechKeys-DqMhN-bl.js} +1 -1
- package/public/dist/assets/{TelegramHub-BrCeAZEf.js → TelegramHub-BSZ3xTdS.js} +1 -1
- package/public/dist/assets/TerminalPanel-Dwfd6Mhs.js +16 -0
- package/public/dist/assets/TerminalPanel-muGat3B1.css +1 -0
- package/public/dist/assets/{abnfDiagram-VCTEODGH-DOF68zXc.js → abnfDiagram-VCTEODGH-Bh3YzulT.js} +1 -1
- package/public/dist/assets/api-CLHen33W.js +1 -0
- package/public/dist/assets/api-CUtiCd2-.js +1 -0
- package/public/dist/assets/{apl-CYLd9I-9.js → apl-gfMMiTNf.js} +1 -1
- package/public/dist/assets/app-Dskscukr.css +1 -0
- package/public/dist/assets/app-ckFtOSgc.js +55 -0
- package/public/dist/assets/architecture-7GRP2DOG-Bp3iCG16.js +1 -0
- package/public/dist/assets/architectureDiagram-5GKGNRK7-COhidFYz.js +36 -0
- package/public/dist/assets/asciiarmor-C_eisQCp.js +1 -0
- package/public/dist/assets/{asn1-BlhHp3qx.js → asn1-DCl_8MCW.js} +1 -1
- package/public/dist/assets/{asterisk-Q0-IBwUt.js → asterisk-BEn0Cwpx.js} +1 -1
- package/public/dist/assets/{bgtask-badge-Cu1w7rg2.js → bgtask-badge-BmSGU6nQ.js} +1 -1
- package/public/dist/assets/bgtask-badge-DKpNEyny.js +1 -0
- package/public/dist/assets/{blockDiagram-OSKFZWR5-CRNzDJwU.js → blockDiagram-OSKFZWR5--OxgY2yr.js} +4 -4
- package/public/dist/assets/bounded-api-DdpT93LB.js +1 -0
- package/public/dist/assets/{bounded-set-DXkYOGnQ.js → bounded-set-BELTet1M.js} +1 -1
- package/public/dist/assets/c4Diagram-7LVT6UL2-C0DocmNb.js +38 -0
- package/public/dist/assets/channel-DO94Q0oH.js +1 -0
- package/public/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/public/dist/assets/{chunk-2ZTRR5NV-DF9qGbFc.js → chunk-2ZTRR5NV-BFt7Dm5O.js} +1 -1
- package/public/dist/assets/chunk-3NF5O7KM-FbOqoUnr.js +168 -0
- package/public/dist/assets/{chunk-3Z5EZCMW-D-umBnbE.js → chunk-3Z5EZCMW-udVqggne.js} +1 -1
- package/public/dist/assets/{chunk-4HAMMTFA-BzeIXjef.js → chunk-4HAMMTFA-UBUVs5kk.js} +2 -2
- package/public/dist/assets/{chunk-5V3GS4D5-DB7RMaO_.js → chunk-5V3GS4D5-ecLo0f1p.js} +1 -1
- package/public/dist/assets/{chunk-5VM5RSS4-CEUkek2W.js → chunk-5VM5RSS4-ZNzvKenW.js} +1 -1
- package/public/dist/assets/{chunk-6AZGARVD-qPN7cVYY.js → chunk-6AZGARVD-Cou1D2Ji.js} +1 -1
- package/public/dist/assets/{chunk-6EIED4P4-Bt6lS0r9.js → chunk-6EIED4P4-DeqPLKcQ.js} +1 -1
- package/public/dist/assets/{chunk-6K3QC6MW-BC_6hNGf.js → chunk-6K3QC6MW-Cn9odKk7.js} +1 -1
- package/public/dist/assets/{chunk-6TQVIW2G-NQr1OdRE.js → chunk-6TQVIW2G-IVBzI7O8.js} +1 -1
- package/public/dist/assets/{chunk-747NJXEK-CukETSeX.js → chunk-747NJXEK-Bxgd5wfl.js} +1 -1
- package/public/dist/assets/{chunk-75Z2AOVW-BLiFJXcr.js → chunk-75Z2AOVW-B1-fK2mN.js} +1 -1
- package/public/dist/assets/chunk-CLGD4ZFX-CotBINqH.js +1 -0
- package/public/dist/assets/{chunk-DU6HZSFF-CqT8wcBs.js → chunk-DU6HZSFF-vsD_dO7e.js} +3 -3
- package/public/dist/assets/{chunk-F27PBJKO-Ccrogyxp.js → chunk-F27PBJKO-C3O21Si2.js} +1 -1
- package/public/dist/assets/{chunk-FOHPRMQF--f9XSh-3.js → chunk-FOHPRMQF-CoA4358r.js} +35 -35
- package/public/dist/assets/{chunk-GMAD6QVW-BJLz4nC-.js → chunk-GMAD6QVW-BSVfzVP1.js} +2 -2
- package/public/dist/assets/chunk-GVQU2GXP-CsYaquup.js +1 -0
- package/public/dist/assets/chunk-H2I77ZZE-ytBKuGMS.js +1 -0
- package/public/dist/assets/{chunk-HLEWEB6X-BKWwzzZJ.js → chunk-HLEWEB6X-bHrMh27k.js} +3 -3
- package/public/dist/assets/{chunk-I5DQTOEV-B46sdKHC.js → chunk-I5DQTOEV-BYKVfZyL.js} +1 -1
- package/public/dist/assets/{chunk-ICYGCRZG-CSu4gXtC.js → chunk-ICYGCRZG-hvV-gq8M.js} +1 -1
- package/public/dist/assets/{chunk-IH6LHLGP-B2m3mWfU.js → chunk-IH6LHLGP-DTNFuJiP.js} +1 -1
- package/public/dist/assets/{chunk-JWPE2WC7-D-FE5omP.js → chunk-JWPE2WC7-DVXcaiue.js} +1 -1
- package/public/dist/assets/{chunk-KI3K4JFJ-Bfn6wbch.js → chunk-KI3K4JFJ-B4ZziqcX.js} +1 -1
- package/public/dist/assets/chunk-L3NEJ4N5-DxbPaCWe.js +1 -0
- package/public/dist/assets/{chunk-LNGE3PJU-Dyjtq0ks.js → chunk-LNGE3PJU-5-SxdO55.js} +7 -7
- package/public/dist/assets/chunk-LQGUR6SS-C7emO-i3.js +2 -0
- package/public/dist/assets/chunk-OSK3NFVY-D_HWIC0H.js +10 -0
- package/public/dist/assets/{chunk-OUJLGHUK-DkWSHliq.js → chunk-OUJLGHUK-CTWiVXba.js} +1 -1
- package/public/dist/assets/{chunk-P2QGCYS3-B-9ymCdr.js → chunk-P2QGCYS3-D9LpOEME.js} +1 -1
- package/public/dist/assets/{chunk-POPQ4Y6H-Df0_Odad.js → chunk-POPQ4Y6H-BzSgf7pO.js} +1 -1
- package/public/dist/assets/{chunk-PWAF6VOD-B1cuaLs-.js → chunk-PWAF6VOD-CqSJPGBE.js} +1 -1
- package/public/dist/assets/{chunk-SVP7TREG-DCh4QTp-.js → chunk-SVP7TREG-NOSK04BT.js} +1 -1
- package/public/dist/assets/{chunk-UY3FDG6J--uyeDRt4.js → chunk-UY3FDG6J-BVPsKpVN.js} +1 -1
- package/public/dist/assets/{chunk-X3CZISLH-C1s9nTVF.js → chunk-X3CZISLH-ChyOdCnY.js} +1 -1
- package/public/dist/assets/{chunk-XHIXRSVI-CQtpMKYq.js → chunk-XHIXRSVI-CQipzMEr.js} +1 -1
- package/public/dist/assets/chunk-XXDRQBXY-Uq2wLB4L.js +1 -0
- package/public/dist/assets/{chunk-ZLD2IHE6-DOKyEMMC.js → chunk-ZLD2IHE6-CWSP7frq.js} +3 -3
- package/public/dist/assets/classDiagram-CYGNFDIV-C1ssjdiH.js +1 -0
- package/public/dist/assets/classDiagram-v2-TLXNO2FR-C1ssjdiH.js +1 -0
- package/public/dist/assets/clike-D_6L3tnO.js +1 -0
- package/public/dist/assets/cmake-84nbDH0I.js +1 -0
- package/public/dist/assets/cobol-DHLQUbN7.js +1 -0
- package/public/dist/assets/coffeescript-De_zI4J0.js +1 -0
- package/public/dist/assets/commonlisp-DgAKBe0r.js +1 -0
- package/public/dist/assets/{constants-BfYYzHNr.js → constants-TRkDoXvF.js} +1 -1
- package/public/dist/assets/{copy-text-Dy0kfmb9.js → copy-text-WsUHYigB.js} +1 -1
- package/public/dist/assets/cose-bilkent-JH36ORCC-BqCMCbxR.js +1 -0
- package/public/dist/assets/crystal-Bsdphhtm.js +1 -0
- package/public/dist/assets/css-CnaYoQib.js +1 -0
- package/public/dist/assets/cynefin-OW5HDTMX-57vG-IQU.js +1 -0
- package/public/dist/assets/cynefinDiagram-5FMLGOSQ-UAM-DZmU.js +62 -0
- package/public/dist/assets/cytoscape.esm-Ql0ZPabT.js +321 -0
- package/public/dist/assets/{d-BfHF1VVF.js → d-DWkQyNnU.js} +1 -1
- package/public/dist/assets/dagre-Fg-GCROL.js +1 -0
- package/public/dist/assets/{dagre-OS7QT2EB-c-JkA4ju.js → dagre-OS7QT2EB-CflcJHKB.js} +2 -2
- package/public/dist/assets/{diagram-S7CK7UJ4-CgObZnGW.js → diagram-S7CK7UJ4-Dzl9sLZD.js} +1 -1
- package/public/dist/assets/{diagram-UQ7AKVKN-DTiko3yH.js → diagram-UQ7AKVKN-BhpfQUAt.js} +2 -2
- package/public/dist/assets/{diagram-VSXAHHWV-BtwoQsOH.js → diagram-VSXAHHWV-CnuHIxOm.js} +1 -1
- package/public/dist/assets/{diagram-VX7I27RA-BvFpphqo.js → diagram-VX7I27RA-CQzbjtqd.js} +13 -13
- package/public/dist/assets/{diagram-Z3DM3KII-Zq8iJClC.js → diagram-Z3DM3KII-DR3Ie5C2.js} +1 -1
- package/public/dist/assets/dist--wUCkuiC.js +9 -0
- package/public/dist/assets/dist-B2ugUS7T.js +1 -0
- package/public/dist/assets/dist-B6-H00Bu.js +1 -0
- package/public/dist/assets/{dist-CD7tjeNO.js → dist-B_o5XbiL.js} +1 -1
- package/public/dist/assets/{dist-D8Zky4R1.js → dist-Bn361Kgk.js} +2 -2
- package/public/dist/assets/{dist-BspKh_Zg.js → dist-Box-O1ow.js} +1 -1
- package/public/dist/assets/dist-Bp7q5-Qc.js +39 -0
- package/public/dist/assets/dist-C9i-hLBK.js +1 -0
- package/public/dist/assets/{dist-JnCmAxGR.js → dist-CGUtB2hn.js} +1 -1
- package/public/dist/assets/dist-CHO5CBK1.js +1 -0
- package/public/dist/assets/dist-CJNnOuaA.js +1 -0
- package/public/dist/assets/dist-CPYD5RoF.js +1 -0
- package/public/dist/assets/dist-CW1HDUim.js +1 -0
- package/public/dist/assets/dist-Cbkb9LHa.js +1 -0
- package/public/dist/assets/dist-CcmA2WLJ.js +2 -0
- package/public/dist/assets/dist-ClT6EIJP.js +1 -0
- package/public/dist/assets/dist-D011G-p-.js +13 -0
- package/public/dist/assets/dist-DBX5LjYY.js +6 -0
- package/public/dist/assets/dist-DBpt7gM8.js +1 -0
- package/public/dist/assets/{dist-CgIOBybm.js → dist-DJGc9cyj.js} +1 -1
- package/public/dist/assets/{dist-CTpw6PFT.js → dist-DUl4SBwX.js} +1 -1
- package/public/dist/assets/{dist-DKd_hdkE.js → dist-DWvaIPaS.js} +1 -1
- package/public/dist/assets/{dist-DS7cuuIk.js → dist-Ds6qQDMC.js} +1 -1
- package/public/dist/assets/dist-Dxy8kUAu.js +1 -0
- package/public/dist/assets/{dist-Bg80xGMJ.js → dist-OaQUa3cd.js} +1 -1
- package/public/dist/assets/dist-Ohtnri73.js +11 -0
- package/public/dist/assets/dist-TN2_Nms3.js +2 -0
- package/public/dist/assets/dist-XM8qpb8C.js +1 -0
- package/public/dist/assets/dist-Y0iINzVl.js +1 -0
- package/public/dist/assets/{dist-uSfGXqs6.js → dist-kYfyPZP9.js} +1 -1
- package/public/dist/assets/{dist-D3ShDeDU.js → dist-lsEiXLAb.js} +1 -1
- package/public/dist/assets/{dockerfile-DkX5AHzr.js → dockerfile-DJkHQgkl.js} +1 -1
- package/public/dist/assets/{dylan-BQ0i5j3T.js → dylan-BCDoL_-p.js} +1 -1
- package/public/dist/assets/{ebnfDiagram-PWID7BFC-_fcO3z5G.js → ebnfDiagram-PWID7BFC-D_FcQuZg.js} +1 -1
- package/public/dist/assets/{ecl-oXh4vhiy.js → ecl-BVIeWmwY.js} +1 -1
- package/public/dist/assets/{employees-qLLnQlAv.js → employees-BJRRI3rV.js} +3 -3
- package/public/dist/assets/{erDiagram-2YWLMYGG-YIq0Go-p.js → erDiagram-2YWLMYGG-CLpGDU8-.js} +3 -3
- package/public/dist/assets/{erlang-GRIYhTbY.js → erlang-BV0c4Hdn.js} +1 -1
- package/public/dist/assets/{error-normalize-CLRJh19F.js → error-normalize-UHvG8s92.js} +1 -1
- package/public/dist/assets/esm-Q6VOkDbn.js +4 -0
- package/public/dist/assets/eventmodeling-NTZA5JFV-Dz1yjNT-.js +1 -0
- package/public/dist/assets/{factor-Xro2mWdw.js → factor-LKH5gN8L.js} +1 -1
- package/public/dist/assets/fields-CSdFjOgg.js +1 -0
- package/public/dist/assets/flowDiagram-T62WH6J4-jooH4x9e.js +1 -0
- package/public/dist/assets/forth-D6RzAl64.js +1 -0
- package/public/dist/assets/ganttDiagram-EL5Y4UJY-B9_NJDV6.js +292 -0
- package/public/dist/assets/gitGraph-4MIJSDKK-NIO2XoGv.js +1 -0
- package/public/dist/assets/{gitGraphDiagram-WWUBYQGX-Bg3OM_0S.js → gitGraphDiagram-WWUBYQGX-BO0vc7Qh.js} +4 -4
- package/public/dist/assets/graphlib-CGJNr7IJ.js +1 -0
- package/public/dist/assets/groovy-CUpZ7dEl.js +1 -0
- package/public/dist/assets/{haxe-BrZpr4Ca.js → haxe-DjVOVvNP.js} +1 -1
- package/public/dist/assets/idb-cache-BRpjf_a8.js +1 -0
- package/public/dist/assets/idb-cache-CFBnPfHz.js +1 -0
- package/public/dist/assets/iframe-renderer-BngLCbh9.js +1 -0
- package/public/dist/assets/iframe-renderer-CFD7rXuQ.js +142 -0
- package/public/dist/assets/info-A6RAGUB7-yRMwEr76.js +1 -0
- package/public/dist/assets/{infoDiagram-FKFFQAWI-Dbi9pIPw.js → infoDiagram-FKFFQAWI-BM2g31_p.js} +1 -1
- package/public/dist/assets/{ishikawaDiagram-5VMMS53U-C1FUP-sO.js → ishikawaDiagram-5VMMS53U-BZvjesKs.js} +2 -2
- package/public/dist/assets/javascript-B9I2pbsP.js +1 -0
- package/public/dist/assets/javascript-DctB8BJo.js +1 -0
- package/public/dist/assets/{journeyDiagram-EYS64GPL-CaEEa3uT.js → journeyDiagram-EYS64GPL-CqtePaqZ.js} +3 -3
- package/public/dist/assets/{jsx-runtime-CYoNlHAD.js → jsx-runtime-CkEUZM6i.js} +1 -1
- package/public/dist/assets/{kanban-definition-UXKFOSKX-DQjqFxtj.js → kanban-definition-UXKFOSKX-ChZA_T7a.js} +5 -5
- package/public/dist/assets/katex-DL-Py6bk.js +1 -0
- package/public/dist/assets/{lua-CxVmDfKg.js → lua-zbJo2mq3.js} +1 -1
- package/public/dist/assets/manager-Bfy42VgJ.css +1 -0
- package/public/dist/assets/manager-CTX6I1Jk.js +13 -0
- package/public/dist/assets/memory-BXcwokaP.js +1 -0
- package/public/dist/assets/{memory-I_6c8skr.js → memory-D2wwkOUi.js} +10 -10
- package/public/dist/assets/mermaid-loader-Beqble_i.js +1 -0
- package/public/dist/assets/{mermaid-parser.core-CBiGpWk6.js → mermaid-parser.core-J035_CYr.js} +1 -1
- package/public/dist/assets/{mermaid-preprocess-4oGDpf1X.js → mermaid-preprocess-D8xe5R2A.js} +1 -1
- package/public/dist/assets/mermaid.core-D1YZrgc_.js +11 -0
- package/public/dist/assets/mermaid.core-DSXunyto.js +1 -0
- package/public/dist/assets/message-history-C2JH-y2v.js +1 -0
- package/public/dist/assets/message-history-CYp7fqXy.js +4 -0
- package/public/dist/assets/{mindmap-definition-THT77NOG-CXOyjall.js → mindmap-definition-THT77NOG-C4c47DPO.js} +3 -3
- package/public/dist/assets/{mumps-BdPrWvs5.js → mumps-BSzj6Xyz.js} +1 -1
- package/public/dist/assets/{nginx-C7cLiM4x.js → nginx-8H7HVH4w.js} +1 -1
- package/public/dist/assets/{notes-graph-settings-Cl4lMj-A.js → notes-graph-settings-BUoTzvqs.js} +1 -1
- package/public/dist/assets/{nsis-iX94j4T9.js → nsis-CfSuhXs5.js} +1 -1
- package/public/dist/assets/{ntriples-DLMpvgb1.js → ntriples-B9h1VB_g.js} +1 -1
- package/public/dist/assets/packet-AYTQ26CC-BreuCLNh.js +1 -0
- package/public/dist/assets/{page-shell-DZ1lls_P.js → page-shell-Bs0RBRoD.js} +1 -1
- package/public/dist/assets/{pegDiagram-XKGWAZYB-DVD3P7WU.js → pegDiagram-XKGWAZYB-BHiELbRn.js} +1 -1
- package/public/dist/assets/perl-BkSkiI9m.js +1 -0
- package/public/dist/assets/pi-settings-B7e38HJP.js +1 -0
- package/public/dist/assets/{pi-settings-DEuKgvIj.js → pi-settings-BmvRWRpc.js} +1 -1
- package/public/dist/assets/pie-WAS4IAKB-Co3_rQ80.js +1 -0
- package/public/dist/assets/{pieDiagram-E7YTZNPT-DEH6UJP4.js → pieDiagram-E7YTZNPT-BEKTktaH.js} +2 -2
- package/public/dist/assets/{powershell-Dfw2t4-B.js → powershell-BcIto6Sf.js} +1 -1
- package/public/dist/assets/preload-helper-CfbQpVni.js +1 -0
- package/public/dist/assets/presentation-DWHWElFr.js +1 -0
- package/public/dist/assets/presentation-preference-BYEPPRPg.js +1 -0
- package/public/dist/assets/presentation-preference-D9u6LD07.js +1 -0
- package/public/dist/assets/{pug-C8nPBT90.js → pug-CqqUmdG7.js} +1 -1
- package/public/dist/assets/puppet-BZyAS7I4.js +1 -0
- package/public/dist/assets/python-B_1Jd8HM.js +1 -0
- package/public/dist/assets/{quadrantDiagram-AXDQQJYC-CAbCNOON.js → quadrantDiagram-AXDQQJYC-CeJGAkDA.js} +2 -2
- package/public/dist/assets/r-CxDmU1I4.js +1 -0
- package/public/dist/assets/radar-RG4KPBEZ-C2cOxc85.js +1 -0
- package/public/dist/assets/railroad-74A4TZTK-BZ4umY4g.js +1 -0
- package/public/dist/assets/railroad-abnf-HS5TGJTU-DxbXiuYs.js +1 -0
- package/public/dist/assets/railroad-ebnf-LZEXJU2U-Bthp2_-B.js +1 -0
- package/public/dist/assets/railroad-peg-WCYAUIDC-YcQ4ouxQ.js +1 -0
- package/public/dist/assets/{railroadDiagram-O6MQD6OU-CEs81LrU.js → railroadDiagram-O6MQD6OU-CsT34rgN.js} +1 -1
- package/public/dist/assets/{render-Cc0Y43E3.js → render-DRweFDYR.js} +13 -13
- package/public/dist/assets/{requirementDiagram-IS5BZ75X-DsPApdKv.js → requirementDiagram-IS5BZ75X-4PwTKQWK.js} +2 -2
- package/public/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/public/dist/assets/{rough.esm-DQG0wzX4.js → rough.esm-Dy-Kn_BL.js} +1 -1
- package/public/dist/assets/ruby-BjXV7-Qa.js +1 -0
- package/public/dist/assets/{sankeyDiagram-P5KCCOFB-Im52Eou9.js → sankeyDiagram-P5KCCOFB-BykRKMDj.js} +2 -2
- package/public/dist/assets/scheme-D9qYN0V5.js +1 -0
- package/public/dist/assets/sequenceDiagram-WJ2MYXX4-Dyj787ok.js +162 -0
- package/public/dist/assets/settings-2diaN51W.js +1 -0
- package/public/dist/assets/{settings-DpjZSu2J.js → settings-DuqNWkxS.js} +3 -3
- package/public/dist/assets/settings-client-CSHmzyxv.js +1 -0
- package/public/dist/assets/settings-core-CIPKFBNN.js +162 -0
- package/public/dist/assets/settings-core-DiYr5EbU.js +1 -0
- package/public/dist/assets/{shell-BBoIO9l0.js → shell-DwuoZtxw.js} +1 -1
- package/public/dist/assets/sidebar-DumxhgAD.js +49 -0
- package/public/dist/assets/{sieve-8oEe6gDx.js → sieve-tLWDfEkZ.js} +1 -1
- package/public/dist/assets/{simple-mode-BNw0K2rL.js → simple-mode-DXiLM1-G.js} +1 -1
- package/public/dist/assets/{sizeCapture-INFHLROL-D9Rpk-aA.js → sizeCapture-INFHLROL-B0uUizjq.js} +1 -1
- package/public/dist/assets/skills-CCXE-bXK.js +1 -0
- package/public/dist/assets/skills-D3AfzYbP.js +12 -0
- package/public/dist/assets/slash-commands-Cn9AWqF6.js +1 -0
- package/public/dist/assets/slash-commands-DCHYDCYa.js +20 -0
- package/public/dist/assets/solr-B78wSQJQ.js +1 -0
- package/public/dist/assets/sql-DuQMFDvy.js +1 -0
- package/public/dist/assets/state-Dl-xxPoS.js +1 -0
- package/public/dist/assets/{stateDiagram-XQSTLZYL-B5CxGVqv.js → stateDiagram-XQSTLZYL-6p5Yrm8S.js} +1 -1
- package/public/dist/assets/stateDiagram-v2-IH3M54BS-DfXrMbZg.js +1 -0
- package/public/dist/assets/{stex-32iK7T_9.js → stex-DNzd62Q_.js} +1 -1
- package/public/dist/assets/{stylus-C689wDNM.js → stylus-BOVgKnng.js} +1 -1
- package/public/dist/assets/swimlanes-V6O3JKXN-Pyw_hrrE.js +1 -0
- package/public/dist/assets/swimlanesDiagram-JKAHXJPX-R-OHp34K.js +8 -0
- package/public/dist/assets/textile-C4jVoHG1.js +1 -0
- package/public/dist/assets/tiki-AK6FwT8q.js +1 -0
- package/public/dist/assets/timeline-definition-24CTP7MA-V_LwIXs0.js +120 -0
- package/public/dist/assets/toml-BPTmHmyx.js +1 -0
- package/public/dist/assets/trace-drawer-B05Fa2ja.js +20 -0
- package/public/dist/assets/treeView-Q6P3EWNA-CDjnLfDO.js +1 -0
- package/public/dist/assets/treemap-WGGIJYW6-CbGUwvA1.js +1 -0
- package/public/dist/assets/{ttcn-CPOduycD.js → ttcn-PPSTk1ow.js} +1 -1
- package/public/dist/assets/{ttcn-cfg-DmA__-R_.js → ttcn-cfg-2b4Gb5sE.js} +1 -1
- package/public/dist/assets/turtle-Cx3rYX2g.js +1 -0
- package/public/dist/assets/ui-BO9pdl-p.js +1 -0
- package/public/dist/assets/ui-CCXcKDL5.js +2 -0
- package/public/dist/assets/vendor-render-Cmfl_oW8.js +383 -0
- package/public/dist/assets/vendor-render-DSSkXCir.css +1 -0
- package/public/dist/assets/vendor-utils-C1xaEGmb.js +1 -0
- package/public/dist/assets/{vennDiagram-4TSXK5OY-fVndHq7T.js → vennDiagram-4TSXK5OY-ZagiHlwi.js} +3 -3
- package/public/dist/assets/{verilog-DMw8DKoT.js → verilog-CjI9Y6RI.js} +1 -1
- package/public/dist/assets/vhdl-kS471soi.js +1 -0
- package/public/dist/assets/wardley-WFR3VGLG-Cj73o4Iq.js +1 -0
- package/public/dist/assets/{wardleyDiagram-VM6X3IG4-CXIfS7ZF.js → wardleyDiagram-VM6X3IG4-BBAHdIq-.js} +35 -35
- package/public/dist/assets/wiki-link-resolver-CbJATnBn.js +22 -0
- package/public/dist/assets/wiki-link-suggestions-BcEfThgf.js +2 -0
- package/public/dist/assets/{xquery-CYbd_YmJ.js → xquery-BKJx4mf9.js} +1 -1
- package/public/dist/assets/{xychartDiagram-S5SC5T6Z-CqC-Uvuc.js → xychartDiagram-S5SC5T6Z-C43SenTd.js} +4 -4
- package/public/dist/assets/z80-Co3PbHdE.js +1 -0
- package/public/dist/index.html +4 -4
- package/public/dist/manager/index.html +3 -3
- package/public/index.html +3 -1
- package/public/js/api.ts +2 -2
- package/public/js/bounded-api.ts +49 -0
- package/public/js/features/activity-discovery.ts +142 -0
- package/public/js/features/activity-history.ts +334 -0
- package/public/js/features/activity-http.ts +17 -0
- package/public/js/features/activity-live.ts +330 -0
- package/public/js/features/activity-view.ts +218 -0
- package/public/js/features/chat-messages.ts +13 -4
- package/public/js/features/idb-cache.ts +37 -3
- package/public/js/features/message-history.ts +144 -16
- package/public/js/features/message-item-html.ts +7 -3
- package/public/js/features/native-request-bridge.ts +133 -0
- package/public/js/features/native-requests.ts +337 -0
- package/public/js/features/presentation-preference.ts +52 -0
- package/public/js/features/process-block.ts +35 -1
- package/public/js/features/process-log-adapter.ts +11 -1
- package/public/js/features/settings-core.ts +20 -1
- package/public/js/features/settings-types.ts +5 -1
- package/public/js/features/trace-drawer.ts +145 -43
- package/public/js/features/ui-status.ts +5 -0
- package/public/js/state.ts +3 -0
- package/public/js/ui.ts +41 -8
- package/public/js/virtual-scroll.ts +66 -4
- package/public/js/ws.ts +324 -29
- package/public/manager/src/settings/fields/SelectField.tsx +7 -5
- package/public/manager/src/settings/pages/Agent.tsx +3 -2
- package/public/manager/src/settings/pages/Display.tsx +100 -19
- package/public/manager/src/settings/pages/ModelProvider.tsx +133 -45
- package/public/manager/src/settings/pages/Permissions.tsx +18 -10
- package/public/manager/src/settings/pages/components/PerCliRow.tsx +42 -6
- package/public/manager/src/settings/pages/components/PiProfileDialog.tsx +59 -6
- package/public/manager/src/settings/pages/components/agent/PermissionQuickSection.tsx +9 -6
- package/public/manager/src/settings/pages/components/agent/agent-meta.ts +3 -0
- package/public/manager/src/settings/pages/components/runtime-transport-field.tsx +68 -0
- package/public/manager/src/settings-controls.css +43 -0
- package/public/manager/src/settings-shell.css +21 -1
- package/scripts/bundle-sidecar.sh +282 -37
- package/scripts/check-sidecar-smoke.mjs +250 -137
- package/scripts/sidecar-smoke-probe.mjs +171 -0
- package/public/dist/assets/AdvancedExport-tXydxVAh.js +0 -1
- package/public/dist/assets/Agent-CHaTUS7c.js +0 -1
- package/public/dist/assets/Browser-Dm5J1gXP.js +0 -1
- package/public/dist/assets/BrowserPanel-0b3deLGR.js +0 -3
- package/public/dist/assets/ChannelsDiscord-D6jmfyHe.js +0 -1
- package/public/dist/assets/ChannelsSlack-BcykASIN.js +0 -1
- package/public/dist/assets/ChannelsTelegram-XkNtVi8o.js +0 -1
- package/public/dist/assets/CodeCanvas-D-JH2Ikl.js +0 -3
- package/public/dist/assets/DesignPanel-SuUOoyQN.js +0 -2
- package/public/dist/assets/Display-B25HqCMH.js +0 -1
- package/public/dist/assets/DocPanel-qiqo6365.js +0 -1
- package/public/dist/assets/FolderPanel-BkggPdTP.js +0 -3
- package/public/dist/assets/HealthBadge-D7BQ-LHD.js +0 -1
- package/public/dist/assets/MarkdownRenderer-DZ-hWmCB.js +0 -15
- package/public/dist/assets/MarkdownRenderer-uwE0Wam5.js +0 -1
- package/public/dist/assets/MilkdownWysiwygEditor-DanGAZL5.js +0 -160
- package/public/dist/assets/ModelProvider-tL42E5dy.js +0 -1
- package/public/dist/assets/Network-ByNu-VCZ.js +0 -1
- package/public/dist/assets/NotesGraphWorkspace-Be6ctzYE.js +0 -1
- package/public/dist/assets/PanelLayoutProvider-B9fYsunp.js +0 -1
- package/public/dist/assets/Permissions-B-74b-nO.js +0 -1
- package/public/dist/assets/Permissions-x_6_kLC1.js +0 -1
- package/public/dist/assets/Profile-Bf9-QN2Y.js +0 -1
- package/public/dist/assets/Prompts-DGDw56NQ.js +0 -1
- package/public/dist/assets/TerminalPanel-DdE69MNo.css +0 -1
- package/public/dist/assets/TerminalPanel-gXH7bTXQ.js +0 -36
- package/public/dist/assets/api-DNnX8m0u.js +0 -1
- package/public/dist/assets/api-tVoG39dL.js +0 -1
- package/public/dist/assets/app-CXraFyoA.js +0 -55
- package/public/dist/assets/app-DuyLYRC6.css +0 -1
- package/public/dist/assets/architecture-7GRP2DOG-DxLizWvy.js +0 -1
- package/public/dist/assets/architectureDiagram-5GKGNRK7-BpxFEoT5.js +0 -36
- package/public/dist/assets/asciiarmor-7YwhfGDq.js +0 -1
- package/public/dist/assets/bgtask-badge-BjyAbBio.js +0 -1
- package/public/dist/assets/c4Diagram-7LVT6UL2-Bg0DdRYW.js +0 -38
- package/public/dist/assets/channel-BjgXjYj8.js +0 -1
- package/public/dist/assets/chunk-2Q5K7J3B-BClkI2P5.js +0 -1
- package/public/dist/assets/chunk-3NF5O7KM-DXOprKA_.js +0 -168
- package/public/dist/assets/chunk-CLGD4ZFX-B5zkZ8n6.js +0 -1
- package/public/dist/assets/chunk-GVQU2GXP-BlVn1fMW.js +0 -1
- package/public/dist/assets/chunk-H2I77ZZE-BXf4_vA2.js +0 -1
- package/public/dist/assets/chunk-L3NEJ4N5-FGXu31jw.js +0 -1
- package/public/dist/assets/chunk-LQGUR6SS-qUTD5FMI.js +0 -2
- package/public/dist/assets/chunk-OSK3NFVY-CrXjNywV.js +0 -10
- package/public/dist/assets/chunk-XXDRQBXY-DEwmqeYc.js +0 -1
- package/public/dist/assets/classDiagram-CYGNFDIV-hbaxbeYd.js +0 -1
- package/public/dist/assets/classDiagram-v2-TLXNO2FR-_OfX3b6Y.js +0 -1
- package/public/dist/assets/clike-BcV5UqGE.js +0 -1
- package/public/dist/assets/cmake-DhPsEu0W.js +0 -1
- package/public/dist/assets/cobol-BEekiT-v.js +0 -1
- package/public/dist/assets/coffeescript-Bgk4ZVWF.js +0 -1
- package/public/dist/assets/commonlisp-Dw4PRJwx.js +0 -1
- package/public/dist/assets/cose-bilkent-JH36ORCC-HnUYAhwC.js +0 -1
- package/public/dist/assets/crystal-CJ-iCD_G.js +0 -1
- package/public/dist/assets/css-BDUaiSMY.js +0 -1
- package/public/dist/assets/cynefin-OW5HDTMX-VXYSLvft.js +0 -1
- package/public/dist/assets/cynefinDiagram-5FMLGOSQ-D0dmg5fA.js +0 -62
- package/public/dist/assets/cytoscape.esm-CS3SmpXd.js +0 -321
- package/public/dist/assets/dagre-DDTOgfwg.js +0 -1
- package/public/dist/assets/dist-BCCaGGDY.js +0 -1
- package/public/dist/assets/dist-BPE4W9iX.js +0 -6
- package/public/dist/assets/dist-BQMBTYXL.js +0 -1
- package/public/dist/assets/dist-BaPGPaX4.js +0 -1
- package/public/dist/assets/dist-CBnlLSQZ.js +0 -1
- package/public/dist/assets/dist-CINTuhik.js +0 -2
- package/public/dist/assets/dist-CX7KjpF3.js +0 -39
- package/public/dist/assets/dist-CczLsP0o.js +0 -9
- package/public/dist/assets/dist-CdfDDy4r.js +0 -1
- package/public/dist/assets/dist-Cl_pRobr.js +0 -1
- package/public/dist/assets/dist-CruwQXwE.js +0 -1
- package/public/dist/assets/dist-CvE8Qa9r.js +0 -2
- package/public/dist/assets/dist-Cy3mcP1e.js +0 -1
- package/public/dist/assets/dist-CzCFEnHw.js +0 -1
- package/public/dist/assets/dist-D2h9T4I9.js +0 -13
- package/public/dist/assets/dist-DLOg6n0b.js +0 -1
- package/public/dist/assets/dist-DW0I56_o.js +0 -1
- package/public/dist/assets/dist-TombgBki.js +0 -11
- package/public/dist/assets/dist-hBRIxDzG.js +0 -1
- package/public/dist/assets/dist-z5Z70wW8.js +0 -1
- package/public/dist/assets/esm-CT1xxdH5.js +0 -4
- package/public/dist/assets/eventmodeling-NTZA5JFV-Csqcv5T_.js +0 -1
- package/public/dist/assets/fields-E1L8aEhU.js +0 -1
- package/public/dist/assets/flowDiagram-T62WH6J4-Del9dfOW.js +0 -1
- package/public/dist/assets/forth-DNnBFTm6.js +0 -1
- package/public/dist/assets/ganttDiagram-EL5Y4UJY-CezfIvti.js +0 -292
- package/public/dist/assets/gitGraph-4MIJSDKK-D_1mlgPm.js +0 -1
- package/public/dist/assets/graphlib-Cjg_soTo.js +0 -1
- package/public/dist/assets/groovy-Cm4gdIYU.js +0 -1
- package/public/dist/assets/idb-cache-B5PX63p7.js +0 -1
- package/public/dist/assets/idb-cache-lOntwU3S.js +0 -1
- package/public/dist/assets/iframe-renderer-BLP8Army.js +0 -1
- package/public/dist/assets/iframe-renderer-vuNrU6aI.js +0 -142
- package/public/dist/assets/info-A6RAGUB7-ce7F80NR.js +0 -1
- package/public/dist/assets/javascript-DD7UxIxH.js +0 -1
- package/public/dist/assets/javascript-DZFdG8BN.js +0 -1
- package/public/dist/assets/katex-BoGadFcG.js +0 -1
- package/public/dist/assets/manager-BspQvGAC.js +0 -13
- package/public/dist/assets/manager-Cmu0aKPb.css +0 -1
- package/public/dist/assets/memory-CRji7xpO.js +0 -1
- package/public/dist/assets/mermaid-loader-BcReSszT.js +0 -1
- package/public/dist/assets/mermaid.core-BJIXJ0Ir.js +0 -11
- package/public/dist/assets/mermaid.core-J6tiqiVK.js +0 -1
- package/public/dist/assets/message-history-C1ThtA4i.js +0 -1
- package/public/dist/assets/message-history-CXg12lcd.js +0 -1
- package/public/dist/assets/packet-AYTQ26CC-86oNpyWh.js +0 -1
- package/public/dist/assets/perl-DfpfXWOH.js +0 -1
- package/public/dist/assets/pi-settings-5HVg1sXJ.js +0 -1
- package/public/dist/assets/pie-WAS4IAKB-CMzmzfvT.js +0 -1
- package/public/dist/assets/preload-helper-DFYRRz9w.js +0 -1
- package/public/dist/assets/puppet-DnsvBfcg.js +0 -1
- package/public/dist/assets/python-mfoZJSDM.js +0 -1
- package/public/dist/assets/r-FO7GgXB8.js +0 -1
- package/public/dist/assets/radar-RG4KPBEZ-CsDBxCx4.js +0 -1
- package/public/dist/assets/railroad-74A4TZTK-B6s85Oul.js +0 -1
- package/public/dist/assets/railroad-abnf-HS5TGJTU-jnABoAnr.js +0 -1
- package/public/dist/assets/railroad-ebnf-LZEXJU2U-C_VWXbk9.js +0 -1
- package/public/dist/assets/railroad-peg-WCYAUIDC-y3jeoP_s.js +0 -1
- package/public/dist/assets/rolldown-runtime-XQCOJYun.js +0 -1
- package/public/dist/assets/ruby-Cg1fwXaw.js +0 -1
- package/public/dist/assets/scheme-DGFmPoR2.js +0 -1
- package/public/dist/assets/sequenceDiagram-WJ2MYXX4-BChOR6yh.js +0 -162
- package/public/dist/assets/settings-B2Ix6Y7k.js +0 -1
- package/public/dist/assets/settings-client-D9KY2Ufl.js +0 -1
- package/public/dist/assets/settings-core-Bkb0BoYY.js +0 -1
- package/public/dist/assets/settings-core-DWYQIIoe.js +0 -162
- package/public/dist/assets/sidebar-C8WKweCz.js +0 -49
- package/public/dist/assets/skills-QWf6vRIB.js +0 -12
- package/public/dist/assets/skills-bEGqvmiQ.js +0 -1
- package/public/dist/assets/slash-commands-BbA0Y1up.js +0 -1
- package/public/dist/assets/slash-commands-qD6yScsx.js +0 -20
- package/public/dist/assets/solr-BwGyzi2H.js +0 -1
- package/public/dist/assets/sql-B6Phvk1R.js +0 -1
- package/public/dist/assets/state-DxpgDKMO.js +0 -1
- package/public/dist/assets/stateDiagram-v2-IH3M54BS-BmdRqxzy.js +0 -1
- package/public/dist/assets/swimlanes-V6O3JKXN-Ckem4dQh.js +0 -1
- package/public/dist/assets/swimlanesDiagram-JKAHXJPX-DW_0PiOk.js +0 -8
- package/public/dist/assets/textile-xOWO1SH7.js +0 -1
- package/public/dist/assets/tiki-OG7n6UAo.js +0 -1
- package/public/dist/assets/timeline-definition-24CTP7MA-CJRsjFnd.js +0 -120
- package/public/dist/assets/toml-DkxT-aUR.js +0 -1
- package/public/dist/assets/trace-drawer-Ct8sP4j-.js +0 -15
- package/public/dist/assets/treeView-Q6P3EWNA-ChnMvz2a.js +0 -1
- package/public/dist/assets/treemap-WGGIJYW6-DZJ4jE42.js +0 -1
- package/public/dist/assets/turtle-CEzrJHdY.js +0 -1
- package/public/dist/assets/ui-BZxyyJUk.js +0 -1
- package/public/dist/assets/ui-xoW9x-Pz.js +0 -2
- package/public/dist/assets/vendor-render-BpGO1zp3.js +0 -383
- package/public/dist/assets/vendor-render-kIxHrxDV.css +0 -1
- package/public/dist/assets/vendor-utils-BUFU5ypz.js +0 -1
- package/public/dist/assets/vhdl-M4wLPuJt.js +0 -1
- package/public/dist/assets/wardley-WFR3VGLG-CGM_JiX0.js +0 -1
- package/public/dist/assets/wiki-link-resolver-BGpGBLMp.js +0 -22
- package/public/dist/assets/wiki-link-suggestions-cvpqJp6c.js +0 -2
- package/public/dist/assets/z80-nGsPT_fm.js +0 -1
- /package/public/dist/assets/{agent-meta-KPnVam9G.js → agent-meta-WqLP4HPi.js} +0 -0
- /package/public/dist/assets/{api-FOqKQ9fm.js → api-B9RiiOMM.js} +0 -0
- /package/public/dist/assets/{brainfuck-CM8jf4Gu.js → brainfuck-D5EjA2JK.js} +0 -0
- /package/public/dist/assets/{chunk-Y2CYZVJY-DlLjK0OJ.js → chunk-Y2CYZVJY-DsF7k-Jl.js} +0 -0
- /package/public/dist/assets/{clojure-XHu9GAjV.js → clojure-BflJGmDX.js} +0 -0
- /package/public/dist/assets/{cypher-CJ05ZgAu.js → cypher-p9eYesGn.js} +0 -0
- /package/public/dist/assets/{desktop-bridge-DtydAvqu.js → desktop-bridge-DbRfkg8l.js} +0 -0
- /package/public/dist/assets/{diff-BVcHwfdB.js → diff-ChtP43wD.js} +0 -0
- /package/public/dist/assets/{dtd-Bg0TgBY9.js → dtd-DTF72YNO.js} +0 -0
- /package/public/dist/assets/{ebnf-QSFUkOiT.js → ebnf-D4c0_ac3.js} +0 -0
- /package/public/dist/assets/{eiffel-S15DDWzw.js → eiffel-BEjRio4Q.js} +0 -0
- /package/public/dist/assets/{elm-B746ZFPi.js → elm-Cshzl8qu.js} +0 -0
- /package/public/dist/assets/{fcl-DjQMeb0v.js → fcl-ClOhbFR7.js} +0 -0
- /package/public/dist/assets/{folder-drag-payload-CJ0dxhZa.js → folder-drag-payload-BhV9yzhH.js} +0 -0
- /package/public/dist/assets/{fortran-yg6K9z9n.js → fortran-Bt6PBEDR.js} +0 -0
- /package/public/dist/assets/{gas-fbsH19hy.js → gas-BHEdbvp9.js} +0 -0
- /package/public/dist/assets/{gherkin-BCy9haeT.js → gherkin-oBAE_ms0.js} +0 -0
- /package/public/dist/assets/{haskell-Dq28dVw2.js → haskell-BRsoo5mP.js} +0 -0
- /package/public/dist/assets/{http-B3zr0y0o.js → http-CLVgA2GD.js} +0 -0
- /package/public/dist/assets/{idl-C9CL9hdG.js → idl-BUZw3wgd.js} +0 -0
- /package/public/dist/assets/{julia-CjwfSXBk.js → julia-CQfgDRfP.js} +0 -0
- /package/public/dist/assets/{livescript-vRjI6jFU.js → livescript-BXxG0Yva.js} +0 -0
- /package/public/dist/assets/{locale-DC-ZsWOf.js → locale-B9w_kUtW.js} +0 -0
- /package/public/dist/assets/{mathematica-DJZPFt8k.js → mathematica-u8YMmbU0.js} +0 -0
- /package/public/dist/assets/{mbox-CxBBnlIA.js → mbox-BEMVcqjs.js} +0 -0
- /package/public/dist/assets/{mirc-CBWc0vcU.js → mirc-C9zpzAZU.js} +0 -0
- /package/public/dist/assets/{mllike-DYddHpeS.js → mllike-B45xgp2S.js} +0 -0
- /package/public/dist/assets/{modelica-B94rrYMn.js → modelica-CqHI_q-D.js} +0 -0
- /package/public/dist/assets/{mscgen-D0PO0iPT.js → mscgen-qgSLujhx.js} +0 -0
- /package/public/dist/assets/{octave-DeJPElAr.js → octave-D2Q8cUp1.js} +0 -0
- /package/public/dist/assets/{oz-4dtXWqwe.js → oz-BwTct_5T.js} +0 -0
- /package/public/dist/assets/{pascal-TdeXcL-o.js → pascal-Dp_KdFgX.js} +0 -0
- /package/public/dist/assets/{path-utils-QbjARuCC.js → path-utils-B6vBr0DD.js} +0 -0
- /package/public/dist/assets/{pig-xQ4essgV.js → pig-AF4Hwhju.js} +0 -0
- /package/public/dist/assets/{properties-CrJLOvU2.js → properties-C357ku5U.js} +0 -0
- /package/public/dist/assets/{protobuf-BYv78GYU.js → protobuf-D1ij_kNL.js} +0 -0
- /package/public/dist/assets/{provider-icons-CXA2mnPO.js → provider-icons-Det0fC-4.js} +0 -0
- /package/public/dist/assets/{q-BrTIu4PU.js → q-B9NhS7L_.js} +0 -0
- /package/public/dist/assets/{rpm-D8Wbdep5.js → rpm-gpDK5sbt.js} +0 -0
- /package/public/dist/assets/{sas-Ch1GEx-n.js → sas-C2OyD2Y6.js} +0 -0
- /package/public/dist/assets/{settings-types-DPhhM-cj.js → settings-types-B09BmpYe.js} +0 -0
- /package/public/dist/assets/{smalltalk-ChbxX23N.js → smalltalk-BLp5-jwC.js} +0 -0
- /package/public/dist/assets/{sparql-D9wgprRx.js → sparql-Dz-mlCAC.js} +0 -0
- /package/public/dist/assets/{spreadsheet-BySehl32.js → spreadsheet-CTIncYxj.js} +0 -0
- /package/public/dist/assets/{swift-DZwxTp-L.js → swift-DKB6_1j6.js} +0 -0
- /package/public/dist/assets/{tcl-BSOjIY_8.js → tcl-BGfruO1u.js} +0 -0
- /package/public/dist/assets/{tiddlywiki-B8jhOxrf.js → tiddlywiki-VlUiK86J.js} +0 -0
- /package/public/dist/assets/{troff-vE5gOX7Y.js → troff-C2dAgh7P.js} +0 -0
- /package/public/dist/assets/{vb-Cii5IQTv.js → vb-BthdM_4N.js} +0 -0
- /package/public/dist/assets/{vbscript-DcZWGZ_S.js → vbscript-D9f6rSsU.js} +0 -0
- /package/public/dist/assets/{velocity-BEag7EnK.js → velocity-CqftRsjg.js} +0 -0
- /package/public/dist/assets/{vendor-icons-Begb5v1n.js → vendor-icons-CNcMX6Ac.js} +0 -0
- /package/public/dist/assets/{w3c-keyname-hgmz1BF7.js → w3c-keyname-BOAvb0qz.js} +0 -0
- /package/public/dist/assets/{webidl-CjehKbx5.js → webidl-D5jiJvOU.js} +0 -0
- /package/public/dist/assets/{yacas-ClBNsli2.js → yacas-CXXgtw0p.js} +0 -0
package/dist/src/agent/spawn.js
CHANGED
|
@@ -29,7 +29,7 @@ import { extractSessionId, extractFromEvent, extractFromAcpUpdate, extractOutput
|
|
|
29
29
|
import { detectSmokeResponse } from './smoke-detector.js';
|
|
30
30
|
import { saveUpload as _saveUpload, buildMediaPrompt, buildMediaPromptMany } from '../../lib/upload.js';
|
|
31
31
|
import { resolveMainCli, consumePendingBootstrapPrompt, peekPendingBootstrapPrompt } from '../core/main-session.js';
|
|
32
|
-
import { getSessionOwnershipGeneration, persistMainSession, } from './session-persistence.js';
|
|
32
|
+
import { getSessionOwnershipGeneration, isCurrentSessionOwner, persistMainSession, } from './session-persistence.js';
|
|
33
33
|
import { isCompactMarkerRow } from '../core/compact.js';
|
|
34
34
|
import { isRuntimeSettingsMutationInFlight, waitForRuntimeSettingsIdle } from '../core/runtime-settings-gate.js';
|
|
35
35
|
import { hasBlockingWorkers, hasPendingWorkerReplays, getActiveWorkers, clearAllWorkers, clearWorkersForScope } from '../orchestrator/worker-registry.js';
|
|
@@ -37,19 +37,37 @@ import { sanitizeWorkerProgressTools } from '../orchestrator/worker-progress.js'
|
|
|
37
37
|
import { handleAgentExit, setSpawnAgent, setMainMetaHandler } from './lifecycle-handler.js';
|
|
38
38
|
import { buildServicePath } from '../core/runtime-path.js';
|
|
39
39
|
import { formatCliUnavailableMessage, detectCliBinary } from '../core/cli-detect.js';
|
|
40
|
-
import { LOCAL_SESSION_SCOPE_ACTIVATION,
|
|
40
|
+
import { LOCAL_SESSION_SCOPE_ACTIVATION, resolveExecutionBinding } from '../orchestrator/scope.js';
|
|
41
41
|
import { stripInterviewTracker } from '../orchestrator/sanitize.js';
|
|
42
42
|
import { beginLiveRun, appendLiveRunText, setLiveRunTraceId, clearLiveRun, replaceLiveRunTools, appendLiveRunTool, getLiveRun } from './live-run-state.js';
|
|
43
43
|
import { setSpawnRef as setMemorySpawnRef, } from './memory-flush-controller.js';
|
|
44
44
|
import { applyCliEnvDefaults, buildSessionResumeKey, ensureOpencodeAlwaysAllowPermissions, mergeEnvWindowsSafe } from './spawn-env.js';
|
|
45
|
-
import { buildPromptForArgs, shouldBuildHistoryBlock, withHistoryPrompt, withSteerContext } from './prompt-context.js';
|
|
45
|
+
import { buildPromptForArgs, shouldBuildHistoryBlock, withHistoryPrompt, withSteerContext, PROMPT_HISTORY_MAX_ROWS, PROMPT_HISTORY_MAX_CHARS, appendCursorAcceptedInstruction, buildCursorReplacementPrompt } from './prompt-context.js';
|
|
46
46
|
import { attachWatchdog, DEFAULT_WATCHDOG_ABSOLUTE_HARD_CAP_MS } from './watchdog.js';
|
|
47
47
|
import { buildOpencodeRuntimeSnapshot, buildOpencodeSpawnAudit, pushOpencodeRawEvent, resolveOpencodeBinary, } from './opencode-diagnostics.js';
|
|
48
|
+
import { handoffRuntimeOutcome } from './runtime/outcome.js';
|
|
49
|
+
import { AcpRuntimeSession } from './runtime/acp/runtime-session.js';
|
|
50
|
+
import { MainReplacementOwnerMismatchError, replaceAcpMainTurn } from './runtime/replace-turn.js';
|
|
51
|
+
import { AcpReplacement } from './runtime/acp/replacement.js';
|
|
52
|
+
import { beginSteerInput, cancelSteerInputs, cancelAllSteerInputs } from './steer-input-guard.js';
|
|
53
|
+
import { runNativeRuntime, NativeRunFailure } from './native-runtime-run.js';
|
|
54
|
+
import { startClaudeNativeRun } from './claude-runtime-run.js';
|
|
55
|
+
import { hasClaudeRuns, hasClaudeMainRuns, hasClaudeWorker, cancelClaudeWorker, cancelClaudeScope, cancelAllClaudeRuns } from './runtime/claude-run-controls.js';
|
|
56
|
+
import { syncLiveTools } from './events/helpers.js';
|
|
57
|
+
import { RuntimeProjection } from './runtime/projection.js';
|
|
58
|
+
import { recordRuntimeEvent } from './runtime/events.js';
|
|
59
|
+
import { CodexProjection } from './runtime/codex-projection.js';
|
|
60
|
+
import { PiProjection } from './runtime/pi-projection.js';
|
|
61
|
+
import { PiRawTrace } from './runtime/pi-raw-trace.js';
|
|
62
|
+
import { createPrintActivity, finishPrintActivity } from './runtime/print-activity.js';
|
|
63
|
+
import { isNativeAdapterImplemented, isNativeWorkerImplemented, isSwitchableNativeCli, resolveRuntimeTransport, runtimeSessionBucket } from './runtime/selection.js';
|
|
48
64
|
import { asCliEventRecord, discriminate, fieldString } from '../types/cli-events.js';
|
|
65
|
+
import { isRemoteTarget } from '../messaging/types.js';
|
|
66
|
+
import { buildRemoteBindingKey } from '../messaging/session-key.js';
|
|
49
67
|
import { isJawRuntimeEvent, handleJawRuntimeEvent } from './claude-e-runtime.js';
|
|
50
68
|
import { jawRuntimesByScope, runtimeForScope } from './jwc-runtime.js';
|
|
51
69
|
import { applyOutputPolicy, runBeforeSpawnChecks } from '../core/policy-hooks.js';
|
|
52
|
-
import { appendTraceEvent, finalizeTraceRun, stampTraceTool, startTraceRun } from '../trace/store.js';
|
|
70
|
+
import { appendTraceEvent, createTraceId, finalizeTraceRun, stampTraceTool, startTraceRun, updateTraceToolRow } from '../trace/store.js';
|
|
53
71
|
import { AGY_COMPLETE_KILL_REASON, appendAgyFullText, classifyAgyTranscriptMode, describeAgyFinalSource, extractAgyConversationId, finalizeAgyFallbackText, AGY_PLANNER_ONLY_NOTICE, isAgyIntermediatePlannerText, formatAgyWatchdogContext, resolveAgyEmptyCloseError, formatAgyTimeoutMessage, getAgyQuietCompletionDelayMs, isAgyStaleSessionOutput, normalizeAgyCloseText, shouldFreezeAgyLiveDisplay, stripAgyPromptEchoPrefix, stripAgyResumeReplayPrefix, stripAgyResumeReplayPrefixes, } from './agy-runtime.js';
|
|
54
72
|
import { detectAgyCapabilities } from './agy-capabilities.js';
|
|
55
73
|
import { buildAgyBootstrapEnvelope, resolveAgyPromptOrder, } from './agy-bootstrap.js';
|
|
@@ -58,13 +76,29 @@ import { appendAssistantRawText, appendAssistantTextSegment, emitAgentTool, norm
|
|
|
58
76
|
import { captureKiroSessionIdAfterExit, finalizeKiroFullText, flushKiroStdoutContext, isKiroPlainTextCli, isKiroStaleSessionOutput, parseAiESessionIdFromStderr, processKiroStdoutChunk, spawnWithKiroSnapshot, } from './kiro-runtime.js';
|
|
59
77
|
import { resolveCursorModelVariant } from './cursor-runtime.js';
|
|
60
78
|
import { normalizePiSettings, spawnPiRpc } from './pi-runtime.js';
|
|
79
|
+
import * as piExecutionControls from './pi-runtime.js';
|
|
80
|
+
import { piFailureOutcome } from './runtime/pi-turn.js';
|
|
61
81
|
import { getEmployeeMcpServers } from './mcp-passthrough.js';
|
|
62
82
|
// ─── State ───────────────────────────────────────────
|
|
63
83
|
export const activeProcesses = new Map(); // agentId → child process
|
|
84
|
+
export function hasActiveAgent(agentId) {
|
|
85
|
+
return activeProcesses.has(agentId) || hasClaudeWorker(agentId);
|
|
86
|
+
}
|
|
64
87
|
/** Kill reason recorded when a duplicate registration reaps the previous child. */
|
|
65
88
|
const DUP_REGISTRATION_KILL_REASON = 'dup-registration';
|
|
66
89
|
/** Grace before escalating that kill to SIGKILL, matching the sibling kill paths. */
|
|
67
90
|
const DUP_REGISTRATION_KILL_GRACE_MS = 2_000;
|
|
91
|
+
function cancelOwnedPiProcess(child, reason) {
|
|
92
|
+
const cancel = piExecutionControls.cancelPiExecution;
|
|
93
|
+
if (typeof cancel !== 'function')
|
|
94
|
+
return false;
|
|
95
|
+
const live = !hasChildExited(child);
|
|
96
|
+
if (!cancel(child))
|
|
97
|
+
return false;
|
|
98
|
+
if (live && child.pid && reason)
|
|
99
|
+
killReasons.set(child.pid, reason);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
68
102
|
function registerActiveProcess(agentLabel, child) {
|
|
69
103
|
// Defensive: the concrete spawn site should already own this child, and
|
|
70
104
|
// ownProcess is memoized, so this returns that existing owner rather than
|
|
@@ -77,7 +111,10 @@ function registerActiveProcess(agentLabel, child) {
|
|
|
77
111
|
// Treating it as exited would drop that survivor from the map without
|
|
78
112
|
// even scheduling the escalation below — the exact invisible process
|
|
79
113
|
// this branch exists to prevent.
|
|
80
|
-
if (
|
|
114
|
+
if (cancelOwnedPiProcess(prev, DUP_REGISTRATION_KILL_REASON)) {
|
|
115
|
+
// Its captured pair owns cleanup; never start a second tree timer.
|
|
116
|
+
}
|
|
117
|
+
else if (hasChildExited(prev)) {
|
|
81
118
|
activeProcesses.delete(agentLabel);
|
|
82
119
|
}
|
|
83
120
|
else {
|
|
@@ -171,9 +208,10 @@ function broadcastAgentOutput(ctx, agentLabel, cli, text, empTag, audience) {
|
|
|
171
208
|
agentId: agentLabel,
|
|
172
209
|
cli,
|
|
173
210
|
text,
|
|
174
|
-
...(ctx.traceRunId ? { traceRunId: ctx.traceRunId } : {}),
|
|
175
211
|
...(textLen !== null ? { textLen } : {}),
|
|
176
212
|
...empTag,
|
|
213
|
+
...(ctx.traceRunId ? { traceRunId: ctx.traceRunId } : {}),
|
|
214
|
+
...(ctx.activityIdentity ?? {}),
|
|
177
215
|
}, audience);
|
|
178
216
|
}
|
|
179
217
|
function appendParentLiveRunTool(ctx, tool) {
|
|
@@ -199,6 +237,7 @@ function emitKiroStreamEvents(events, ctx, agentLabel, cli, empTag, traceAudienc
|
|
|
199
237
|
const segment = normalizeAssistantDisplayText(event.text);
|
|
200
238
|
if (!segment)
|
|
201
239
|
continue;
|
|
240
|
+
ctx.printActivity?.message(segment, 'append', 'unknown');
|
|
202
241
|
if (ctx.liveOutputText !== undefined) {
|
|
203
242
|
ctx.liveOutputText += segment;
|
|
204
243
|
}
|
|
@@ -229,10 +268,14 @@ function emitKiroStreamEvents(events, ctx, agentLabel, cli, empTag, traceAudienc
|
|
|
229
268
|
}
|
|
230
269
|
}
|
|
231
270
|
export function killAgentById(agentId) {
|
|
271
|
+
if (cancelClaudeWorker(agentId, 'user'))
|
|
272
|
+
return true;
|
|
232
273
|
const proc = activeProcesses.get(agentId);
|
|
233
274
|
if (!proc)
|
|
234
275
|
return false;
|
|
235
276
|
try {
|
|
277
|
+
if (cancelOwnedPiProcess(proc, 'user'))
|
|
278
|
+
return true;
|
|
236
279
|
if (proc.pid) {
|
|
237
280
|
killProcessTree(proc.pid, 'SIGTERM');
|
|
238
281
|
}
|
|
@@ -449,6 +492,8 @@ function abortInProcessRuntimeOnStop(scopeKey, reason) {
|
|
|
449
492
|
export function killActiveAgent(scopeKeyOrReason = 'user', scopedReason) {
|
|
450
493
|
const scopeKey = scopedReason === undefined ? 'default' : scopeKeyOrReason;
|
|
451
494
|
const reason = scopedReason ?? scopeKeyOrReason;
|
|
495
|
+
cancelSteerInputs(scopeKey);
|
|
496
|
+
const cancelledClaude = cancelClaudeScope(scopeKey, reason, reason === 'api' || reason === 'user');
|
|
452
497
|
const run = activeMainProcesses.get(scopeKey);
|
|
453
498
|
const hadTimer = queueCtrl.isRetryPending(scopeKey);
|
|
454
499
|
const cancelledPendingMain = run?.cancelPending ? (run.cancelPending(reason), true) : false;
|
|
@@ -466,7 +511,7 @@ export function killActiveAgent(scopeKeyOrReason = 'user', scopedReason) {
|
|
|
466
511
|
settleOnce(run?.meta?.requestId, 'cancelled', { reason });
|
|
467
512
|
clearWorkerSlotsOnStop(scopeKey, reason);
|
|
468
513
|
}
|
|
469
|
-
if (run?.cancelTurn &&
|
|
514
|
+
if (run?.cancelTurn && ['codex-app', 'pi', 'cursor', 'grok', 'claude'].includes(getActiveMainCli(scopeKey) || '')) {
|
|
470
515
|
if (run.process?.pid)
|
|
471
516
|
killReasons.set(run.process.pid, reason);
|
|
472
517
|
console.log(`[jaw:kill] reason=${reason} scope=${scopeKey} cli=${getActiveMainCli(scopeKey)} action=lease.cancel`);
|
|
@@ -481,7 +526,7 @@ export function killActiveAgent(scopeKeyOrReason = 'user', scopedReason) {
|
|
|
481
526
|
if (!activeProcess) {
|
|
482
527
|
if (reason === 'api' || reason === 'user' || reason === 'steer' || reason === 'interrupt')
|
|
483
528
|
activeMainProcesses.delete(scopeKey);
|
|
484
|
-
return hadTimer || cancelledPendingMain || abortedInProcess;
|
|
529
|
+
return hadTimer || cancelledPendingMain || abortedInProcess || cancelledClaude;
|
|
485
530
|
}
|
|
486
531
|
const policy = getKillPolicy(scopeKey, reason);
|
|
487
532
|
console.log(`[jaw:kill] reason=${reason} scope=${scopeKey} cli=${getActiveMainCli(scopeKey) || 'unknown'} signal=${policy.signal} escalationMs=${policy.escalationMs}`);
|
|
@@ -518,6 +563,8 @@ export function killActiveAgent(scopeKeyOrReason = 'user', scopedReason) {
|
|
|
518
563
|
return true;
|
|
519
564
|
}
|
|
520
565
|
export function killAllAgents(reason = 'user') {
|
|
566
|
+
cancelAllSteerInputs();
|
|
567
|
+
const cancelledClaude = cancelAllClaudeRuns(reason);
|
|
521
568
|
const hadTimer = queueCtrl.isRetryPending(null);
|
|
522
569
|
const mainScopes = [...activeMainProcesses.keys()];
|
|
523
570
|
let killedMain = false;
|
|
@@ -531,6 +578,10 @@ export function killAllAgents(reason = 'user') {
|
|
|
531
578
|
console.log(`[jaw:killAll] killing ${id}, reason=${reason}`);
|
|
532
579
|
if (proc.pid)
|
|
533
580
|
killReasons.set(proc.pid, reason);
|
|
581
|
+
if (cancelOwnedPiProcess(proc, reason)) {
|
|
582
|
+
killed++;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
534
585
|
// Same owner contract as killActiveAgent: tree walk now, escalation
|
|
535
586
|
// after the grace, guarded by real exit state rather than `killed`.
|
|
536
587
|
ownProcess(proc, {
|
|
@@ -550,16 +601,23 @@ export function killAllAgents(reason = 'user') {
|
|
|
550
601
|
activeMainProcesses.clear();
|
|
551
602
|
clearAllWorkers();
|
|
552
603
|
}
|
|
553
|
-
return killed > 0 || killedMain || hadTimer;
|
|
604
|
+
return killed > 0 || killedMain || hadTimer || cancelledClaude;
|
|
554
605
|
}
|
|
555
606
|
export function waitForProcessEnd(scopeKeyOrTimeout = 'default', scopedTimeout = 3000) {
|
|
556
607
|
const scopeKey = typeof scopeKeyOrTimeout === 'string' ? scopeKeyOrTimeout : 'default';
|
|
557
608
|
const timeoutMs = typeof scopeKeyOrTimeout === 'number' ? scopeKeyOrTimeout : scopedTimeout;
|
|
558
|
-
|
|
609
|
+
return waitForScopedProcessEnd(scopeKey, timeoutMs, hasClaudeRuns);
|
|
610
|
+
}
|
|
611
|
+
/** Steer waits for main accounting, including pending main cleanup, but not surviving workers. */
|
|
612
|
+
export function waitForMainProcessEnd(scopeKey, timeoutMs = 3000) {
|
|
613
|
+
return waitForScopedProcessEnd(scopeKey, timeoutMs, hasClaudeMainRuns);
|
|
614
|
+
}
|
|
615
|
+
function waitForScopedProcessEnd(scopeKey, timeoutMs, hasClaude) {
|
|
616
|
+
if (!activeMainProcesses.has(scopeKey) && !hasClaude(scopeKey))
|
|
559
617
|
return Promise.resolve();
|
|
560
618
|
return new Promise(resolve => {
|
|
561
619
|
const check = setInterval(() => {
|
|
562
|
-
if (!activeMainProcesses.has(scopeKey)) {
|
|
620
|
+
if (!activeMainProcesses.has(scopeKey) && !hasClaude(scopeKey)) {
|
|
563
621
|
clearInterval(check);
|
|
564
622
|
clearTimeout(deadline);
|
|
565
623
|
resolve();
|
|
@@ -586,11 +644,11 @@ export function waitForProcessEnd(scopeKeyOrTimeout = 'default', scopedTimeout =
|
|
|
586
644
|
* force-exit budget. Returning on timeout is the same outcome as today, minus
|
|
587
645
|
* the common case where the child would have finished in milliseconds. */
|
|
588
646
|
export function waitForAllProcessesEnd(timeoutMs = 2000) {
|
|
589
|
-
if (activeMainProcesses.size === 0)
|
|
647
|
+
if (activeMainProcesses.size === 0 && !hasClaudeRuns())
|
|
590
648
|
return Promise.resolve();
|
|
591
649
|
return new Promise(resolve => {
|
|
592
650
|
const check = setInterval(() => {
|
|
593
|
-
if (activeMainProcesses.size === 0) {
|
|
651
|
+
if (activeMainProcesses.size === 0 && !hasClaudeRuns()) {
|
|
594
652
|
clearInterval(check);
|
|
595
653
|
clearTimeout(deadline);
|
|
596
654
|
resolve();
|
|
@@ -603,8 +661,9 @@ export function canSteerAgent(scopeKey) {
|
|
|
603
661
|
const run = activeMainProcesses.get(scopeKey);
|
|
604
662
|
if (run?.meta.cli === 'jwc' && jawRuntimesByScope.get(scopeKey)?.busy === true)
|
|
605
663
|
return true;
|
|
606
|
-
//
|
|
607
|
-
|
|
664
|
+
// Route CLI steering through either the in-band hook or the native replacement hook.
|
|
665
|
+
// Each owning hook decides whether the current turn can still accept the input.
|
|
666
|
+
return typeof run?.steerTurnInBand === 'function' || typeof run?.replaceTurn === 'function';
|
|
608
667
|
}
|
|
609
668
|
export async function steerAgent(scopeKey, newPrompt, source, meta) {
|
|
610
669
|
const run = activeMainProcesses.get(scopeKey);
|
|
@@ -613,7 +672,7 @@ export async function steerAgent(scopeKey, newPrompt, source, meta) {
|
|
|
613
672
|
if (run?.meta.cli === 'jwc' && runtime.busy) {
|
|
614
673
|
insertMessage.run('user', newPrompt, source, '', settings["workingDir"] || null, chatSessionId);
|
|
615
674
|
broadcast('new_message', { role: 'user', content: newPrompt, source, scope: scopeKey, sessionId: chatSessionId });
|
|
616
|
-
broadcast('steer_started', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey, sessionId: chatSessionId, target: meta?.target, chatId: meta?.chatId, requestId: meta?.requestId, remoteKey: meta?.remoteKey, replyViaTarget: meta?.replyViaTarget }));
|
|
675
|
+
broadcast('steer_started', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey, sessionId: chatSessionId, target: meta?.target, chatId: meta?.chatId, requestId: meta?.requestId, remoteKey: meta?.remoteKey, replyViaTarget: meta?.replyViaTarget, mode: 'native-input' }));
|
|
617
676
|
await runtime.steer(settings["workingDir"] || process.cwd(), newPrompt);
|
|
618
677
|
// A steer injects into the turn already running; no new completion
|
|
619
678
|
// event will ever carry this id. Settling here is what stops a caller
|
|
@@ -621,6 +680,64 @@ export async function steerAgent(scopeKey, newPrompt, source, meta) {
|
|
|
621
680
|
settleOnce(meta?.requestId, 'steered');
|
|
622
681
|
return 'steered';
|
|
623
682
|
}
|
|
683
|
+
if (typeof run?.replaceTurn === 'function') {
|
|
684
|
+
const capturedSessionOwner = getSessionOwnershipGeneration(scopeKey);
|
|
685
|
+
const owner = run.meta;
|
|
686
|
+
const ownerTarget = isRemoteTarget(owner.target) ? owner.target : undefined;
|
|
687
|
+
const ownerRemoteKey = owner.remoteKey ?? (ownerTarget ? buildRemoteBindingKey(ownerTarget) : undefined);
|
|
688
|
+
const suppliedTarget = meta?.target;
|
|
689
|
+
if ((meta?.chatSessionId !== undefined && meta.chatSessionId !== owner.chatSessionId)
|
|
690
|
+
|| (meta?.remoteKey !== undefined && meta.remoteKey !== ownerRemoteKey)
|
|
691
|
+
|| (suppliedTarget !== undefined && (!isRemoteTarget(suppliedTarget)
|
|
692
|
+
|| buildRemoteBindingKey(suppliedTarget) !== ownerRemoteKey
|
|
693
|
+
|| (ownerTarget !== undefined && (buildRemoteBindingKey(suppliedTarget) !== buildRemoteBindingKey(ownerTarget)
|
|
694
|
+
|| suppliedTarget.targetKind !== ownerTarget.targetKind
|
|
695
|
+
|| suppliedTarget.guildId !== ownerTarget.guildId
|
|
696
|
+
|| suppliedTarget.parentTargetId !== ownerTarget.parentTargetId))))) {
|
|
697
|
+
throw new MainReplacementOwnerMismatchError();
|
|
698
|
+
}
|
|
699
|
+
const capturedMeta = { ...meta, ...(suppliedTarget === undefined ? {} : { target: { ...suppliedTarget } }) };
|
|
700
|
+
const capturedOwnerGeneration = run.ownerGeneration;
|
|
701
|
+
const workingDir = settings['workingDir'] || null;
|
|
702
|
+
let attempted = false;
|
|
703
|
+
const inputGuard = beginSteerInput(scopeKey);
|
|
704
|
+
let outcome, inputCancelled;
|
|
705
|
+
try {
|
|
706
|
+
outcome = await run.replaceTurn(newPrompt, () => {
|
|
707
|
+
if (activeMainProcesses.get(scopeKey) !== run || run.ownerGeneration !== capturedOwnerGeneration
|
|
708
|
+
|| !isCurrentSessionOwner(capturedSessionOwner, scopeKey)) {
|
|
709
|
+
throw new MainReplacementOwnerMismatchError();
|
|
710
|
+
}
|
|
711
|
+
if (attempted)
|
|
712
|
+
throw new Error('native_replacement_duplicate_input');
|
|
713
|
+
attempted = true; // A partial recording failure must never retry this input.
|
|
714
|
+
insertMessage.run('user', newPrompt, source, '', workingDir, chatSessionId);
|
|
715
|
+
broadcast('new_message', { role: 'user', content: newPrompt, source, scope: scopeKey, sessionId: chatSessionId });
|
|
716
|
+
broadcast('steer_started', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey,
|
|
717
|
+
sessionId: chatSessionId, target: capturedMeta.target, chatId: capturedMeta.chatId,
|
|
718
|
+
requestId: capturedMeta.requestId, remoteKey: capturedMeta.remoteKey, replyViaTarget: capturedMeta.replyViaTarget,
|
|
719
|
+
mode: 'cancel-reprompt', localDispatch: true }));
|
|
720
|
+
settleOnce(capturedMeta.requestId, 'steered');
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
finally {
|
|
724
|
+
inputCancelled = inputGuard.isCancelled();
|
|
725
|
+
inputGuard.release();
|
|
726
|
+
}
|
|
727
|
+
if (outcome.kind === 'failed')
|
|
728
|
+
throw outcome.error;
|
|
729
|
+
if ((outcome.kind === 'dispatched') !== attempted)
|
|
730
|
+
throw new Error('native_replacement_inconsistent_receipt');
|
|
731
|
+
if (outcome.kind === 'dispatched')
|
|
732
|
+
return 'steered';
|
|
733
|
+
if (outcome.kind === 'cancelled' || inputCancelled) {
|
|
734
|
+
settleOnce(capturedMeta.requestId, 'cancelled', { reason: 'native-steer-stopped', scope: scopeKey, sessionId: chatSessionId });
|
|
735
|
+
return 'cancelled';
|
|
736
|
+
}
|
|
737
|
+
broadcast('steer_rejected', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey,
|
|
738
|
+
sessionId: chatSessionId, reason: outcome.reason, requestId: capturedMeta.requestId }));
|
|
739
|
+
return 'fallback-queue';
|
|
740
|
+
}
|
|
624
741
|
if (typeof run?.steerTurnInBand === 'function') {
|
|
625
742
|
// codex-app same-turn steer. The user row is written only AFTER the
|
|
626
743
|
// server accepts — a fallback must not leave a duplicate insert for the
|
|
@@ -643,7 +760,7 @@ export async function steerAgent(scopeKey, newPrompt, source, meta) {
|
|
|
643
760
|
}
|
|
644
761
|
insertMessage.run('user', newPrompt, source, '', settings["workingDir"] || null, chatSessionId);
|
|
645
762
|
broadcast('new_message', { role: 'user', content: newPrompt, source, scope: scopeKey, sessionId: chatSessionId });
|
|
646
|
-
broadcast('steer_started', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey, sessionId: chatSessionId, target: meta?.target, chatId: meta?.chatId, requestId: meta?.requestId, remoteKey: meta?.remoteKey, replyViaTarget: meta?.replyViaTarget }));
|
|
763
|
+
broadcast('steer_started', stripUndefined({ prompt: newPrompt, origin: source || 'web', scope: scopeKey, sessionId: chatSessionId, target: meta?.target, chatId: meta?.chatId, requestId: meta?.requestId, remoteKey: meta?.remoteKey, replyViaTarget: meta?.replyViaTarget, mode: 'native-input' }));
|
|
647
764
|
settleOnce(meta?.requestId, 'steered');
|
|
648
765
|
return 'steered';
|
|
649
766
|
}
|
|
@@ -654,7 +771,7 @@ export async function steerAgent(scopeKey, newPrompt, source, meta) {
|
|
|
654
771
|
const maxIdBeforeKill = getMaxMessageId(chatSessionId);
|
|
655
772
|
const wasRunning = killActiveAgent(scopeKey, 'steer');
|
|
656
773
|
if (wasRunning)
|
|
657
|
-
await
|
|
774
|
+
await waitForMainProcessEnd(scopeKey, steerWaitMs);
|
|
658
775
|
// The kill removes the scope's map entry synchronously, so the wait above can
|
|
659
776
|
// return before the exit handler's salvage insert. Wait for the settle barrier
|
|
660
777
|
// armed by the kill so the follow-up run actually sees the partial output.
|
|
@@ -748,7 +865,7 @@ export function makeCleanEnv(extraEnv = {}, inheritedEnv = process.env, platform
|
|
|
748
865
|
merged["PATH"] = buildServicePath(extraPath || env["PATH"] || '', [], os.homedir(), platform);
|
|
749
866
|
return merged;
|
|
750
867
|
}
|
|
751
|
-
function buildHistoryBlock(currentPrompt, workingDir, chatSessionId, maxSessions =
|
|
868
|
+
function buildHistoryBlock(currentPrompt, workingDir, chatSessionId, maxSessions = PROMPT_HISTORY_MAX_ROWS, maxTotalChars = PROMPT_HISTORY_MAX_CHARS) {
|
|
752
869
|
const recent = getRecentMessages.all(workingDir || null, chatSessionId, Math.max(1, maxSessions * 2));
|
|
753
870
|
if (!recent.length)
|
|
754
871
|
return '';
|
|
@@ -837,7 +954,8 @@ export { buildMediaPrompt, buildMediaPromptMany };
|
|
|
837
954
|
// ─── Spawn Agent ─────────────────────────────────────
|
|
838
955
|
import { AcpClient } from '../cli/acp-client.js';
|
|
839
956
|
import { CodexAppClient, CodexSteerError, isRecoverableResumeError } from './codex-app-client.js';
|
|
840
|
-
import { acquireCodexAppRuntime, acquirePiRuntime, } from './runtime-pool.js';
|
|
957
|
+
import { acquireCodexAppRuntime, acquirePiRuntime, acquireCursorRuntime, acquireGrokRuntime, } from './runtime-pool.js';
|
|
958
|
+
import { grokMainOptions } from './runtime/grok-main.js';
|
|
841
959
|
import { acquireCodexAppLane, CodexHostGenerationStaleError, prepareCodexAppHost, } from './codex-host-pool.js';
|
|
842
960
|
import { loadCatalogEfforts, resolveCatalogPath, validateModelEffort } from './codex-app-catalog.js';
|
|
843
961
|
import { listenCodexAppTurnAdapter, applyCodexAppTextEvent, } from './codex-app-events.js';
|
|
@@ -864,27 +982,13 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
864
982
|
const empTag = isEmployee ? { isEmployee: true } : {};
|
|
865
983
|
const multiSessionEnabled = settings["multiSession"]?.enabled === true;
|
|
866
984
|
const capturedScope = currentSessionScope();
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
multiSessionEnabled,
|
|
875
|
-
})))
|
|
876
|
-
: 'default';
|
|
877
|
-
const chatSessionId = multiSessionEnabled
|
|
878
|
-
? (opts.chatSessionId || capturedScope?.chatSessionId || getActiveChatSession())
|
|
879
|
-
: getActiveChatSession();
|
|
880
|
-
if (multiSessionEnabled) {
|
|
881
|
-
opts = stripUndefined({
|
|
882
|
-
...opts,
|
|
883
|
-
scopeKey,
|
|
884
|
-
chatSessionId,
|
|
885
|
-
...(opts.remoteKey ? { remoteKey: opts.remoteKey } : {}),
|
|
886
|
-
});
|
|
887
|
-
}
|
|
985
|
+
const binding = resolveExecutionBinding(stripUndefined({ scope: opts.scopeKey, chatSessionId: opts.chatSessionId,
|
|
986
|
+
captured: capturedScope, activeChatSessionId: getActiveChatSession(), origin,
|
|
987
|
+
target: opts.target, chatId: opts.chatId, workingDir: settings['workingDir'] || null,
|
|
988
|
+
persistedScopeId: opts.remoteKey, multiSessionEnabled }));
|
|
989
|
+
const scopeKey = binding.scope, chatSessionId = binding.chatSessionId;
|
|
990
|
+
opts = stripUndefined({ ...opts, scopeKey, chatSessionId,
|
|
991
|
+
...(opts.remoteKey ? { remoteKey: opts.remoteKey } : {}) });
|
|
888
992
|
let mainRun = mainManaged ? activeMainProcesses.get(scopeKey) : undefined;
|
|
889
993
|
if (mainManaged && mainRun && !opts._settingsGateWaited) {
|
|
890
994
|
console.log(`[jaw] Agent already running for scope=${scopeKey}, skipping`);
|
|
@@ -905,14 +1009,15 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
905
1009
|
console.log('[jaw] Agent already running, skipping');
|
|
906
1010
|
return { child: null, promise: Promise.resolve({ text: '', code: -1 }) };
|
|
907
1011
|
}
|
|
908
|
-
|
|
1012
|
+
const waitingRun = mainRun;
|
|
1013
|
+
waitingRun.starting = true;
|
|
909
1014
|
let cancelled = false;
|
|
910
1015
|
let cancelReason = 'user';
|
|
911
1016
|
const cancelThisSpawn = (reason) => {
|
|
912
1017
|
cancelled = true;
|
|
913
1018
|
cancelReason = reason;
|
|
914
1019
|
};
|
|
915
|
-
|
|
1020
|
+
waitingRun.cancelPending = cancelThisSpawn;
|
|
916
1021
|
const promise = (async () => {
|
|
917
1022
|
try {
|
|
918
1023
|
await waitForRuntimeSettingsIdle();
|
|
@@ -924,15 +1029,57 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
924
1029
|
}
|
|
925
1030
|
finally {
|
|
926
1031
|
const latest = activeMainProcesses.get(scopeKey);
|
|
927
|
-
if (latest
|
|
928
|
-
|
|
929
|
-
|
|
1032
|
+
if (latest === waitingRun) {
|
|
1033
|
+
if (latest.cancelPending === cancelThisSpawn)
|
|
1034
|
+
delete latest.cancelPending;
|
|
930
1035
|
latest.starting = false;
|
|
1036
|
+
}
|
|
931
1037
|
void processQueue(scopeKey);
|
|
932
1038
|
}
|
|
933
1039
|
})();
|
|
934
1040
|
return { child: null, promise };
|
|
935
1041
|
}
|
|
1042
|
+
let resolve;
|
|
1043
|
+
const resultPromise = new Promise(r => { resolve = r; });
|
|
1044
|
+
const session = getSession() ?? {};
|
|
1045
|
+
const persistenceOwner = getSessionOwnershipGeneration(scopeKey);
|
|
1046
|
+
const ownerGeneration = persistenceOwner.global;
|
|
1047
|
+
if (mainRun)
|
|
1048
|
+
mainRun.ownerGeneration = ownerGeneration;
|
|
1049
|
+
let cli = resolveMainCli(opts.cli, settings, session);
|
|
1050
|
+
if (mainRun)
|
|
1051
|
+
mainRun.meta.cli = cli;
|
|
1052
|
+
// Namespace selection is captured once for this run. Builtin native
|
|
1053
|
+
// Codex/Pi keep their existing bucket keys; only switchable adapters use
|
|
1054
|
+
// the new namespace. Reject unavailable native choices before fallback,
|
|
1055
|
+
// saved-session reads, bootstrap consumption, or worker isolation.
|
|
1056
|
+
const runtimeTransport = isSwitchableNativeCli(cli)
|
|
1057
|
+
? resolveRuntimeTransport(settings['perCli']?.[cli]?.transport) : 'print';
|
|
1058
|
+
const permissions = opts.permissions || settings['permissions'] || session.permissions || 'auto';
|
|
1059
|
+
const unavailableNative = runtimeTransport === 'native'
|
|
1060
|
+
&& (!isNativeAdapterImplemented(cli) || (isEmployee && !isNativeWorkerImplemented(cli)));
|
|
1061
|
+
const restrictiveNative = runtimeTransport === 'native' && (cli === 'cursor' || cli === 'grok') && permissions !== 'auto';
|
|
1062
|
+
const unsupportedClaudePolicy = runtimeTransport === 'native' && cli === 'claude'
|
|
1063
|
+
&& permissions !== 'auto' && permissions !== 'safe';
|
|
1064
|
+
const duplicateClaudeWorker = isEmployee && (hasClaudeWorker(opts.agentId || 'main')
|
|
1065
|
+
|| (runtimeTransport === 'native' && cli === 'claude' && activeProcesses.has(opts.agentId || 'main')));
|
|
1066
|
+
if (unavailableNative || restrictiveNative || unsupportedClaudePolicy || duplicateClaudeWorker) {
|
|
1067
|
+
const message = duplicateClaudeWorker ? 'Worker is still completing its previous assignment.'
|
|
1068
|
+
: unsupportedClaudePolicy ? 'Claude native supports auto or safe permissions. Select print to retain this permission profile.'
|
|
1069
|
+
: unavailableNative
|
|
1070
|
+
? `${cli} native ${isEmployee ? 'worker ' : ''}transport is not implemented in this build. Set perCli.${cli}.transport to "print" to use compatibility mode.`
|
|
1071
|
+
: `${cli === 'cursor' ? 'Cursor' : 'Grok'} native restrictive permissions are not verified in this build. Select print transport to retain restrictive permission behavior.`;
|
|
1072
|
+
const released = mainManaged && activeMainProcesses.get(scopeKey) === mainRun
|
|
1073
|
+
&& releaseMainRun(scopeKey, null, ownerGeneration);
|
|
1074
|
+
broadcast('agent_done', {
|
|
1075
|
+
text: message, error: true, origin, cli, scope: scopeKey, sessionId: chatSessionId,
|
|
1076
|
+
...(opts.requestId ? { requestId: opts.requestId } : {}), ...empTag,
|
|
1077
|
+
}, isEmployee ? 'internal' : 'public');
|
|
1078
|
+
resolve({ text: message, code: 78 });
|
|
1079
|
+
if (released)
|
|
1080
|
+
void processQueue(scopeKey);
|
|
1081
|
+
return { child: null, promise: resultPromise };
|
|
1082
|
+
}
|
|
936
1083
|
// Ensure AGENTS.md on disk is fresh before CLI reads it
|
|
937
1084
|
// Skip for employee spawns — distribute.ts manages AGENTS.md isolation
|
|
938
1085
|
if (!opts.internal && !opts._isFallback && !opts.agentId)
|
|
@@ -951,6 +1098,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
951
1098
|
if (mainManaged) {
|
|
952
1099
|
setCurrentMainMeta(scopeKey, stripUndefined({
|
|
953
1100
|
origin,
|
|
1101
|
+
cli,
|
|
954
1102
|
target: opts.target,
|
|
955
1103
|
chatId: opts.chatId,
|
|
956
1104
|
requestId: opts.requestId,
|
|
@@ -960,21 +1108,11 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
960
1108
|
...(opts.remoteKey ? { remoteKey: opts.remoteKey } : {}),
|
|
961
1109
|
}));
|
|
962
1110
|
}
|
|
963
|
-
let resolve;
|
|
964
|
-
const resultPromise = new Promise(r => { resolve = r; });
|
|
965
|
-
const session = getSession() ?? {};
|
|
966
|
-
const persistenceOwner = getSessionOwnershipGeneration(scopeKey);
|
|
967
|
-
const ownerGeneration = persistenceOwner.global;
|
|
968
|
-
if (mainRun)
|
|
969
|
-
mainRun.ownerGeneration = ownerGeneration;
|
|
970
|
-
let cli = resolveMainCli(opts.cli, settings, session);
|
|
971
|
-
if (mainRun)
|
|
972
|
-
mainRun.meta.cli = cli;
|
|
973
1111
|
// Phase 52: Bootstrap consumption is moved BELOW the bucket-aware `isResume`
|
|
974
1112
|
// computation so we can use the authoritative per-bucket resume decision
|
|
975
1113
|
// instead of the legacy `isResumeGuess` heuristic. See comment near line 762.
|
|
976
1114
|
// ─── Fallback retry: skip to fallback if retries exhausted ───
|
|
977
|
-
if (!opts._isFallback && !opts.internal) {
|
|
1115
|
+
if (runtimeTransport !== 'native' && !opts._isFallback && !opts.internal) {
|
|
978
1116
|
const st = queueCtrl.fallbackStateForScope(scopeKey).get(cli);
|
|
979
1117
|
if (st?.fallbackCli && st.retriesLeft <= 0) {
|
|
980
1118
|
const fbAvail = detectCli(st.fallbackCli)?.available;
|
|
@@ -1041,7 +1179,6 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1041
1179
|
});
|
|
1042
1180
|
return { child: null, promise: resultPromise };
|
|
1043
1181
|
}
|
|
1044
|
-
const permissions = opts.permissions || settings["permissions"] || session.permissions || 'auto';
|
|
1045
1182
|
if (cli === 'opencode') {
|
|
1046
1183
|
ensureOpencodeAlwaysAllowPermissions();
|
|
1047
1184
|
}
|
|
@@ -1059,7 +1196,8 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1059
1196
|
const model = cli === 'ai-e' && effectiveProvider === 'claude'
|
|
1060
1197
|
? migrateLegacyClaudeValue(requestedModel)
|
|
1061
1198
|
: requestedModel;
|
|
1062
|
-
const runtimeModel = cli === 'cursor' ? resolveCursorModelVariant(model, effort)
|
|
1199
|
+
const runtimeModel = cli === 'cursor' && runtimeTransport !== 'native' ? resolveCursorModelVariant(model, effort)
|
|
1200
|
+
: cli === 'grok' && runtimeTransport === 'native' && model === 'default' ? 'grok-build' : model;
|
|
1063
1201
|
const codexMultiplexMain = cli === 'codex-app' && mainManaged && !opts.agentId
|
|
1064
1202
|
&& settings["runtime"]?.codexApp?.multiplex === true;
|
|
1065
1203
|
if (mainManaged) {
|
|
@@ -1092,7 +1230,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1092
1230
|
// snapshot, no stale clear — because sharing one was worse. Having its own is better
|
|
1093
1231
|
// than either. The default scope keeps the bare bucket name, so a session that existed
|
|
1094
1232
|
// before this change continues the conversation it was already in.
|
|
1095
|
-
const currentBucket = resolveScopedSessionBucket(cli, runtimeModel, effectiveProvider, scopeKey, effort, 'fallback', codexMultiplexMain);
|
|
1233
|
+
const currentBucket = runtimeSessionBucket(resolveScopedSessionBucket(cli, runtimeModel, effectiveProvider, scopeKey, effort, 'fallback', codexMultiplexMain), runtimeTransport);
|
|
1096
1234
|
const envDefaultsCli = cli === 'ai-e' ? effectiveProvider : cli;
|
|
1097
1235
|
const cliEnv = applyCliEnvDefaults(envDefaultsCli, opts.env);
|
|
1098
1236
|
const spawnEnv = makeCleanEnv(cliEnv);
|
|
@@ -1217,12 +1355,13 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1217
1355
|
codexMultiplexMain,
|
|
1218
1356
|
});
|
|
1219
1357
|
const historyBlock = needsHistory
|
|
1220
|
-
? buildHistoryBlock(prompt, settings["workingDir"], chatSessionId,
|
|
1358
|
+
? buildHistoryBlock(prompt, settings["workingDir"], chatSessionId, PROMPT_HISTORY_MAX_ROWS, PROMPT_HISTORY_MAX_CHARS)
|
|
1221
1359
|
: '';
|
|
1222
1360
|
let agyBootstrap = null;
|
|
1223
1361
|
let promptForArgs = buildPromptForArgs({
|
|
1224
1362
|
cli,
|
|
1225
1363
|
effectiveProvider,
|
|
1364
|
+
runtimeTransport,
|
|
1226
1365
|
prompt,
|
|
1227
1366
|
historyBlock,
|
|
1228
1367
|
sysPrompt,
|
|
@@ -1278,7 +1417,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1278
1417
|
return buildResumeArgs(cli, runtimeModel, effort, sid, promptForArgs, permissions, options);
|
|
1279
1418
|
};
|
|
1280
1419
|
let args = [];
|
|
1281
|
-
if (cli !== 'agy')
|
|
1420
|
+
if (cli !== 'agy' && runtimeTransport !== 'native')
|
|
1282
1421
|
args = buildCurrentArgs(argOptions);
|
|
1283
1422
|
const agentLabel = agentId || 'main';
|
|
1284
1423
|
const traceAudience = (opts.internal || isEmployee) ? 'internal' : 'public';
|
|
@@ -1287,13 +1426,51 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1287
1426
|
// All CLIs auto-read AGENTS.md/CLAUDE.md/GEMINI.md from cwd.
|
|
1288
1427
|
// Employees must NOT see the Boss's instruction files.
|
|
1289
1428
|
let spawnCwd = settings["workingDir"];
|
|
1429
|
+
let claudeEmployeeTmpDir;
|
|
1430
|
+
let piEmployeeTmp;
|
|
1431
|
+
const cleanupPiEmployee = () => {
|
|
1432
|
+
if (!piEmployeeTmp)
|
|
1433
|
+
return;
|
|
1434
|
+
const owned = piEmployeeTmp;
|
|
1435
|
+
try {
|
|
1436
|
+
const stat = fs.lstatSync(owned.path, { bigint: true });
|
|
1437
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || stat.dev !== owned.dev || stat.ino !== owned.ino
|
|
1438
|
+
|| fs.realpathSync(owned.path) !== owned.path) {
|
|
1439
|
+
console.warn('[jaw:pi] retaining employee cwd: directory ownership changed', owned.path);
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
fs.rmSync(owned.path, { recursive: true });
|
|
1443
|
+
piEmployeeTmp = undefined;
|
|
1444
|
+
}
|
|
1445
|
+
catch (error) {
|
|
1446
|
+
if (error.code === 'ENOENT')
|
|
1447
|
+
return;
|
|
1448
|
+
console.warn('[jaw:pi] retaining employee cwd: cleanup failed', owned.path);
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1290
1451
|
if (opts.agentId && (customSysPrompt || sysPrompt)) {
|
|
1291
1452
|
const empPrompt = customSysPrompt || sysPrompt;
|
|
1292
1453
|
const empPromptWithWorkspace = opts.workspaceContext
|
|
1293
1454
|
? `${opts.workspaceContext}\n\n${empPrompt}`
|
|
1294
1455
|
: empPrompt;
|
|
1295
|
-
const
|
|
1456
|
+
const nativeClaude = runtimeTransport === 'native' && cli === 'claude';
|
|
1457
|
+
const tmpDir = nativeClaude || cli === 'pi'
|
|
1458
|
+
? fs.mkdtempSync(join(cli === 'pi' ? fs.realpathSync(os.tmpdir()) : os.tmpdir(), `jaw-emp-${agentLabel.slice(0, 80).replace(/[^\w.-]/g, '_')}-`))
|
|
1459
|
+
: join(os.tmpdir(), `jaw-emp-${agentLabel}-${Date.now()}`);
|
|
1296
1460
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1461
|
+
if (nativeClaude)
|
|
1462
|
+
claudeEmployeeTmpDir = tmpDir;
|
|
1463
|
+
if (cli === 'pi') {
|
|
1464
|
+
const created = fs.lstatSync(tmpDir, { bigint: true });
|
|
1465
|
+
if (!created.isDirectory() || created.isSymbolicLink())
|
|
1466
|
+
throw new Error('Pi employee cwd ownership unavailable');
|
|
1467
|
+
const canonical = fs.realpathSync(tmpDir);
|
|
1468
|
+
const stat = fs.lstatSync(canonical, { bigint: true });
|
|
1469
|
+
if (canonical !== tmpDir || !stat.isDirectory() || stat.isSymbolicLink()
|
|
1470
|
+
|| stat.dev !== created.dev || stat.ino !== created.ino)
|
|
1471
|
+
throw new Error('Pi employee cwd ownership unavailable');
|
|
1472
|
+
piEmployeeTmp = { path: canonical, dev: stat.dev, ino: stat.ino };
|
|
1473
|
+
}
|
|
1297
1474
|
for (const name of ['AGENTS.md', 'CLAUDE.md', 'GEMINI.md', 'CONTEXT.md']) {
|
|
1298
1475
|
fs.writeFileSync(join(tmpDir, name), empPromptWithWorkspace);
|
|
1299
1476
|
}
|
|
@@ -1359,6 +1536,428 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1359
1536
|
if (cli === 'claude-e')
|
|
1360
1537
|
console.log(`[jaw:${agentLabel}:args] ${JSON.stringify(args)}`);
|
|
1361
1538
|
}
|
|
1539
|
+
// ─── Native Claude: provider adaptation uses the shared host/lifecycle. ───
|
|
1540
|
+
if (runtimeTransport === 'native' && cli === 'claude') {
|
|
1541
|
+
const cleanupClaudeWorker = () => {
|
|
1542
|
+
if (claudeEmployeeTmpDir)
|
|
1543
|
+
cleanupEmployeeTmpDir(claudeEmployeeTmpDir, '', agentLabel);
|
|
1544
|
+
};
|
|
1545
|
+
const capturedRun = mainRun;
|
|
1546
|
+
let capturedExit;
|
|
1547
|
+
const ownedRun = () => isCurrentSessionOwner(persistenceOwner, scopeKey)
|
|
1548
|
+
&& (!mainManaged || activeMainProcesses.get(scopeKey) === capturedRun);
|
|
1549
|
+
let attachedCancel;
|
|
1550
|
+
const watchdog = {};
|
|
1551
|
+
for (const key of ['firstProgressMs', 'idleMs', 'absoluteMs', 'absoluteHardCapMs']) {
|
|
1552
|
+
const value = mergedTimeoutCfg[key];
|
|
1553
|
+
if (typeof value === 'number')
|
|
1554
|
+
watchdog[key] = value;
|
|
1555
|
+
}
|
|
1556
|
+
const prepared = { cwd: spawnCwd || process.cwd(), binary: detected.path || 'claude',
|
|
1557
|
+
env: spawnEnv, model: runtimeModel, systemPrompt: sysPrompt, permissions: permissions,
|
|
1558
|
+
fastMode: cfg.fastMode === true, ...(effort ? { effort: effort } : {}) };
|
|
1559
|
+
try {
|
|
1560
|
+
return startClaudeNativeRun({ prepared, timeoutMs: resolvedAgyPrintTimeoutMs, watchdog,
|
|
1561
|
+
prompt: { text: withSteerContext(withHistoryPrompt(prompt, historyBlock), opts.steerContext), ...(opts.images ? { images: opts.images } : {}) },
|
|
1562
|
+
audience: traceAudience, liveScope: effectiveLiveScope, parentLiveScope: parentLiveScopeForChild,
|
|
1563
|
+
...(opts.runtimeParentItemId ? { parentItemId: opts.runtimeParentItemId } : {}),
|
|
1564
|
+
storedSessionId: resumeSessionId, fresh: forceNew || opts._skipResume === true || isEmployee,
|
|
1565
|
+
cleanupUnleased: cleanupClaudeWorker,
|
|
1566
|
+
isCurrent: ownedRun, isCurrentOwner: token => isCurrentSessionOwner(token, scopeKey), consumeKillReason,
|
|
1567
|
+
activity: identity => opts.lifecycle?.onActivity?.('native-runtime', identity),
|
|
1568
|
+
exited: code => opts.lifecycle?.onExit?.(code),
|
|
1569
|
+
cancelling: reason => {
|
|
1570
|
+
if (reason === 'steer' || reason === 'interrupt') {
|
|
1571
|
+
armExitSettle(scopeKey);
|
|
1572
|
+
capturedExit ??= exitSettlers.get(scopeKey);
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
exit: { cli, model: runtimeModel, effectiveProvider, agentLabel, mainManaged, origin, resumeKey, prompt, opts,
|
|
1576
|
+
cfg: { ...cfg, effort }, ownerGeneration, persistenceOwner, forceNew, empSid, isResume, effortDefault: effort,
|
|
1577
|
+
activeProcesses, scopeKey, runtimeTransport, scopedBucket: currentBucket, chatSessionId, releaseMainRun,
|
|
1578
|
+
retryState: queueCtrl.retryStateForScope(scopeKey), fallbackState: queueCtrl.fallbackStateForScope(scopeKey), fallbackMaxRetries: FALLBACK_MAX_RETRIES },
|
|
1579
|
+
starting: cancel => {
|
|
1580
|
+
attachedCancel = cancel;
|
|
1581
|
+
if (capturedRun) {
|
|
1582
|
+
capturedRun.starting = true;
|
|
1583
|
+
capturedRun.cancelPending = cancel;
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
ready: (child, cancel) => {
|
|
1587
|
+
if (!ownedRun())
|
|
1588
|
+
throw new Error('claude_owner_lost');
|
|
1589
|
+
attachedCancel ??= cancel;
|
|
1590
|
+
if (capturedRun) {
|
|
1591
|
+
capturedRun.process = child;
|
|
1592
|
+
capturedRun.starting = false;
|
|
1593
|
+
if (capturedRun.cancelPending === attachedCancel)
|
|
1594
|
+
delete capturedRun.cancelPending;
|
|
1595
|
+
capturedRun.cancelTurn = attachedCancel;
|
|
1596
|
+
}
|
|
1597
|
+
else
|
|
1598
|
+
registerActiveProcess(agentLabel, child);
|
|
1599
|
+
},
|
|
1600
|
+
finished: (child, _cancel, queued, cleanupSafe) => {
|
|
1601
|
+
try {
|
|
1602
|
+
if (capturedRun && capturedRun.cancelPending === attachedCancel)
|
|
1603
|
+
delete capturedRun.cancelPending;
|
|
1604
|
+
if (capturedRun && capturedRun.cancelTurn === attachedCancel)
|
|
1605
|
+
delete capturedRun.cancelTurn;
|
|
1606
|
+
if (capturedRun && activeMainProcesses.get(scopeKey) === capturedRun)
|
|
1607
|
+
releaseMainRun(scopeKey, child, ownerGeneration);
|
|
1608
|
+
if (!mainManaged && activeProcesses.get(agentLabel) === child)
|
|
1609
|
+
activeProcesses.delete(agentLabel);
|
|
1610
|
+
if (cleanupSafe)
|
|
1611
|
+
cleanupClaudeWorker();
|
|
1612
|
+
}
|
|
1613
|
+
finally {
|
|
1614
|
+
if (capturedExit && exitSettlers.get(scopeKey) === capturedExit) {
|
|
1615
|
+
exitSettlers.delete(scopeKey);
|
|
1616
|
+
capturedExit.resolve();
|
|
1617
|
+
}
|
|
1618
|
+
if (mainManaged && (queued || !activeMainProcesses.has(scopeKey)))
|
|
1619
|
+
void processQueue(scopeKey);
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
catch {
|
|
1625
|
+
if (capturedRun && activeMainProcesses.get(scopeKey) === capturedRun)
|
|
1626
|
+
releaseMainRun(scopeKey, null, ownerGeneration);
|
|
1627
|
+
cleanupClaudeWorker();
|
|
1628
|
+
const text = 'Claude native runtime could not be admitted.';
|
|
1629
|
+
broadcast('agent_done', { text, error: true, origin, cli, scope: scopeKey, sessionId: chatSessionId, ...empTag }, traceAudience);
|
|
1630
|
+
if (mainManaged && !activeMainProcesses.has(scopeKey))
|
|
1631
|
+
void processQueue(scopeKey);
|
|
1632
|
+
return { child: null, promise: Promise.resolve({ text, code: 1 }) };
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
// ─── Native ACP main: protocol ownership is separate from application settlement. ───
|
|
1636
|
+
if (runtimeTransport === 'native' && (cli === 'cursor' || cli === 'grok') && mainManaged) {
|
|
1637
|
+
const grok = cli === 'grok';
|
|
1638
|
+
const acquireRuntime = grok ? acquireGrokRuntime : acquireCursorRuntime;
|
|
1639
|
+
const capturedRun = mainRun;
|
|
1640
|
+
const nativeCwd = spawnCwd || process.cwd();
|
|
1641
|
+
let traceRunId;
|
|
1642
|
+
try {
|
|
1643
|
+
traceRunId = startTraceRun({ cli, model: runtimeModel, workingDir: nativeCwd, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
1644
|
+
}
|
|
1645
|
+
catch {
|
|
1646
|
+
traceRunId = createTraceId();
|
|
1647
|
+
console.warn(`[runtime:${cli}] trace creation unavailable`);
|
|
1648
|
+
}
|
|
1649
|
+
const identity = Object.freeze({ runId: traceRunId, sessionId: chatSessionId, scope: scopeKey,
|
|
1650
|
+
turnId: traceRunId, audience: traceAudience,
|
|
1651
|
+
...(opts.runtimeParentItemId ? { parentItemId: opts.runtimeParentItemId } : {}) });
|
|
1652
|
+
const ctx = { fullText: '', traceLog: [], toolLog: [], seenToolKeys: new Set(),
|
|
1653
|
+
hasClaudeStreamEvents: false, sessionId: null, cost: null, turns: null, duration: null, tokens: null,
|
|
1654
|
+
stderrBuf: '', runStartedAt: Date.now(), origin,
|
|
1655
|
+
...(opts.requestId ? { requestId: opts.requestId } : {}),
|
|
1656
|
+
liveScope: effectiveLiveScope, parentLiveScope: parentLiveScopeForChild, traceRunId, traceAudience };
|
|
1657
|
+
const toolMirror = new Map();
|
|
1658
|
+
const mirrorLimit = 160;
|
|
1659
|
+
let facade = null, ownedLease = null;
|
|
1660
|
+
let failedStart = null;
|
|
1661
|
+
let nativeStarted = false, runtimeEnded = false, finalizeFailed = false, finalized = false;
|
|
1662
|
+
let stopReason = null, queueRequested = false;
|
|
1663
|
+
let capturedExit;
|
|
1664
|
+
let selectedResult;
|
|
1665
|
+
const ownsRun = () => !finalized && activeMainProcesses.get(scopeKey) === capturedRun
|
|
1666
|
+
&& isCurrentSessionOwner(persistenceOwner, scopeKey);
|
|
1667
|
+
const cursorTarget = opts.target ? { ...opts.target } : undefined;
|
|
1668
|
+
let acceptedContext = { messages: [], omitted: false };
|
|
1669
|
+
const prepareReplacement = (instruction, partialText) => {
|
|
1670
|
+
if (!ownsRun())
|
|
1671
|
+
throw new Error('cursor_acp_owner_lost');
|
|
1672
|
+
return { text: buildCursorReplacementPrompt({
|
|
1673
|
+
instruction: prependRemoteConversationContext(instruction, cursorTarget),
|
|
1674
|
+
originalRequest: promptForSnapshot, accepted: acceptedContext, partialText, sysPrompt,
|
|
1675
|
+
}) };
|
|
1676
|
+
};
|
|
1677
|
+
const cursorReplaceHook = (instruction, commitInput) => replaceAcpMainTurn(facade, instruction, () => {
|
|
1678
|
+
if (!ownsRun())
|
|
1679
|
+
throw new Error('cursor_acp_owner_lost');
|
|
1680
|
+
const next = appendCursorAcceptedInstruction(acceptedContext, instruction);
|
|
1681
|
+
const result = commitInput();
|
|
1682
|
+
if (result !== null && (typeof result === 'object' || typeof result === 'function')
|
|
1683
|
+
&& typeof result.then === 'function') {
|
|
1684
|
+
void Promise.resolve(result).catch(() => undefined);
|
|
1685
|
+
throw new Error('cursor_acp_async_input_commit');
|
|
1686
|
+
}
|
|
1687
|
+
acceptedContext = next;
|
|
1688
|
+
});
|
|
1689
|
+
const resultFor = (outcome) => ({
|
|
1690
|
+
text: outcome.finalText?.trim() ?? '', code: outcome.status === 'done' ? 0 : outcome.status === 'stopped' ? 130 : 1,
|
|
1691
|
+
runtimeOutcome: outcome, traceRunId,
|
|
1692
|
+
});
|
|
1693
|
+
const diagnostic = () => grok ? 'Grok native runtime failed. Check the native model, effort and existing CLI login.' : facade?.lastError?.includes('config')
|
|
1694
|
+
? 'Cursor native model or effort is unsupported. Choose an advertised model/effort; Composer models may require an unset effort.'
|
|
1695
|
+
: 'Cursor native runtime failed. Check the native model, effort and existing CLI login.';
|
|
1696
|
+
const startFailedRuntime = () => {
|
|
1697
|
+
if (!failedStart) {
|
|
1698
|
+
failedStart = new RuntimeProjection(identity);
|
|
1699
|
+
failedStart.start(cli);
|
|
1700
|
+
}
|
|
1701
|
+
return failedStart;
|
|
1702
|
+
};
|
|
1703
|
+
const closeFailedTrace = (outcome) => {
|
|
1704
|
+
try {
|
|
1705
|
+
finalizeTraceRun(traceRunId, outcome.status === 'stopped' ? 'interrupted' : outcome.status, outcome.status === 'error' ? diagnostic() : null, { onlyIfRunning: true });
|
|
1706
|
+
}
|
|
1707
|
+
catch {
|
|
1708
|
+
console.warn(`[runtime:${cli}] failure trace finalization unavailable`);
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
const endRuntime = (end) => {
|
|
1712
|
+
if (runtimeEnded)
|
|
1713
|
+
return;
|
|
1714
|
+
runtimeEnded = true;
|
|
1715
|
+
if (facade?.claimTurnOutcome(traceRunId)) {
|
|
1716
|
+
if (!facade.finalizeTurn(traceRunId, end))
|
|
1717
|
+
finalizeFailed = true;
|
|
1718
|
+
}
|
|
1719
|
+
else if (!nativeStarted) {
|
|
1720
|
+
startFailedRuntime().close(end);
|
|
1721
|
+
}
|
|
1722
|
+
else {
|
|
1723
|
+
finalizeFailed = true;
|
|
1724
|
+
console.warn(`[runtime:${cli}] missing owned finalizer`);
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1727
|
+
const failRuntime = (outcome) => {
|
|
1728
|
+
ctx.stallWatchdog?.stop();
|
|
1729
|
+
const selected = ctx.runtimeTerminalAttempted && ctx.runtimeOutcome ? ctx.runtimeOutcome : {
|
|
1730
|
+
status: stopReason || ctx.stallReason ? 'stopped' : 'error',
|
|
1731
|
+
finalText: null, partialText: outcome.partialText,
|
|
1732
|
+
};
|
|
1733
|
+
handoffRuntimeOutcome(ctx, selected);
|
|
1734
|
+
try {
|
|
1735
|
+
// Admit the captured run before compatibility consumers retire it.
|
|
1736
|
+
if (!nativeStarted && !runtimeEnded)
|
|
1737
|
+
startFailedRuntime();
|
|
1738
|
+
if (!ctx.runtimeTerminalAttempted) {
|
|
1739
|
+
ctx.runtimeTerminalAttempted = true;
|
|
1740
|
+
broadcast('agent_done', { traceRunId, scope: scopeKey, sessionId: chatSessionId, origin, cli,
|
|
1741
|
+
...(opts.requestId ? { requestId: opts.requestId } : {}),
|
|
1742
|
+
text: selected.status === 'stopped' ? '' : `❌ ${diagnostic()}`, error: true,
|
|
1743
|
+
runtimeStatus: selected.status, runtimeFinality: selected.finalText === null ? 'absent' : 'present',
|
|
1744
|
+
}, traceAudience);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
finally {
|
|
1748
|
+
try {
|
|
1749
|
+
endRuntime({ kind: 'turn-end', status: selected.status, finalText: selected.finalText,
|
|
1750
|
+
...(selected.status === 'error' ? { error: diagnostic() } : {}) });
|
|
1751
|
+
}
|
|
1752
|
+
finally {
|
|
1753
|
+
closeFailedTrace(selected);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return selectedResult ?? resultFor(selected);
|
|
1757
|
+
};
|
|
1758
|
+
let nativeRun;
|
|
1759
|
+
const cancelHook = (reason) => {
|
|
1760
|
+
stopReason ??= reason;
|
|
1761
|
+
if (reason === 'steer' || reason === 'interrupt') {
|
|
1762
|
+
armExitSettle(scopeKey);
|
|
1763
|
+
capturedExit ??= exitSettlers.get(scopeKey);
|
|
1764
|
+
}
|
|
1765
|
+
nativeRun.cancel(reason);
|
|
1766
|
+
};
|
|
1767
|
+
const grokReplaceHook = async (text, commitInput) => {
|
|
1768
|
+
if (!ownsRun())
|
|
1769
|
+
return { kind: 'race', reason: 'native-owner-lost' };
|
|
1770
|
+
const result = await replaceAcpMainTurn(facade, text, commitInput);
|
|
1771
|
+
return result.kind === 'unavailable' && !ownsRun() ? { kind: 'race', reason: 'native-owner-lost' } : result;
|
|
1772
|
+
};
|
|
1773
|
+
const replaceHook = grok ? grokReplaceHook : cursorReplaceHook;
|
|
1774
|
+
if (grok)
|
|
1775
|
+
capturedRun.replaceTurn = replaceHook;
|
|
1776
|
+
capturedRun.starting = true;
|
|
1777
|
+
nativeRun = runNativeRuntime({
|
|
1778
|
+
turnId: traceRunId, prompt: { text: promptForArgs }, isCurrent: ownsRun,
|
|
1779
|
+
acquire: async (signal) => {
|
|
1780
|
+
const lease = await acquireRuntime({
|
|
1781
|
+
key: { scopeKey, cwd: nativeCwd, model: runtimeModel === 'default' ? '' : runtimeModel, effort, permissions },
|
|
1782
|
+
binary: detected.path || (grok ? 'grok' : 'cursor-agent'), env: spawnEnv, promptTimeoutMs: resolvedAgyPrintTimeoutMs,
|
|
1783
|
+
persistenceOwner, isCurrentOwner: token => isCurrentSessionOwner(token, scopeKey), canAcquire: ownsRun,
|
|
1784
|
+
storedSessionId: resumeSessionId, forceNew, signal,
|
|
1785
|
+
});
|
|
1786
|
+
facade = new AcpRuntimeSession(lease.session, { provider: cli, deferTurnEnd: true,
|
|
1787
|
+
...(grok ? grokMainOptions : { createReplacement: io => new AcpReplacement(io), prepareReplacement }),
|
|
1788
|
+
getTurnContext: () => ({ ...identity, isCurrent: ownsRun }),
|
|
1789
|
+
capabilities: { transport: 'native', steer: 'cancel-reprompt', resume: lease.session.agentCapabilities['loadSession'] === true,
|
|
1790
|
+
tools: true, toolOutput: true, approvals: true, questions: false, images: false, subagents: false },
|
|
1791
|
+
record: (context, body) => {
|
|
1792
|
+
if (body.kind === 'turn-start')
|
|
1793
|
+
nativeStarted = true;
|
|
1794
|
+
return recordRuntimeEvent(context, body);
|
|
1795
|
+
},
|
|
1796
|
+
});
|
|
1797
|
+
ownedLease = { child: lease.session.child, session: facade,
|
|
1798
|
+
release: () => lease.release(), retire: reason => lease.retire(reason) };
|
|
1799
|
+
return ownedLease;
|
|
1800
|
+
},
|
|
1801
|
+
ready: lease => {
|
|
1802
|
+
if (!ownsRun())
|
|
1803
|
+
throw new Error('native_run_owner_lost');
|
|
1804
|
+
capturedRun.process = lease.child;
|
|
1805
|
+
if (!opts._skipInsert)
|
|
1806
|
+
insertMessage.run('user', prompt, cli, runtimeModel, nativeCwd, chatSessionId);
|
|
1807
|
+
capturedRun.starting = false;
|
|
1808
|
+
ctx.sessionId = lease.session.nativeSessionId || null;
|
|
1809
|
+
if (capturedRun.cancelPending === cancelHook)
|
|
1810
|
+
delete capturedRun.cancelPending;
|
|
1811
|
+
capturedRun.cancelTurn = cancelHook;
|
|
1812
|
+
capturedRun.replaceTurn = replaceHook;
|
|
1813
|
+
beginLiveRun(liveScope, cli);
|
|
1814
|
+
setLiveRunTraceId(liveScope, traceRunId);
|
|
1815
|
+
const activityIdentity = { runId: traceRunId, sessionId: chatSessionId,
|
|
1816
|
+
scope: scopeKey, origin, ...(opts.requestId ? { requestId: opts.requestId } : {}) };
|
|
1817
|
+
const onIo = () => {
|
|
1818
|
+
if (!ownsRun())
|
|
1819
|
+
return;
|
|
1820
|
+
try {
|
|
1821
|
+
opts.lifecycle?.onActivity?.('native-runtime', activityIdentity);
|
|
1822
|
+
}
|
|
1823
|
+
catch {
|
|
1824
|
+
console.warn(`[runtime:${cli}] liveness observer failed`);
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
const dispose = () => {
|
|
1828
|
+
ctx.stallWatchdog?.stop();
|
|
1829
|
+
if (capturedRun.replaceTurn === replaceHook)
|
|
1830
|
+
delete capturedRun.replaceTurn;
|
|
1831
|
+
lease.child.stdout?.off('data', onIo);
|
|
1832
|
+
lease.child.stderr?.off('data', onIo);
|
|
1833
|
+
};
|
|
1834
|
+
try {
|
|
1835
|
+
lease.child.stdout?.on('data', onIo);
|
|
1836
|
+
lease.child.stderr?.on('data', onIo);
|
|
1837
|
+
ctx.stallWatchdog = attachWatchdog(lease.child, agentLabel, reason => {
|
|
1838
|
+
ctx.stallReason = reason;
|
|
1839
|
+
nativeRun.cancel(reason);
|
|
1840
|
+
});
|
|
1841
|
+
broadcast('agent_status', { running: true, status: 'running', agentId: agentLabel, cli,
|
|
1842
|
+
scope: scopeKey, sessionId: chatSessionId, traceRunId,
|
|
1843
|
+
...(opts.requestId ? { requestId: opts.requestId } : {}) }, traceAudience);
|
|
1844
|
+
return dispose;
|
|
1845
|
+
}
|
|
1846
|
+
catch (error) {
|
|
1847
|
+
dispose();
|
|
1848
|
+
throw error;
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1851
|
+
event: (event) => {
|
|
1852
|
+
if (event.kind === 'usage') {
|
|
1853
|
+
ctx.tokens = { ...(event.inputTokens === undefined ? {} : { input_tokens: event.inputTokens }),
|
|
1854
|
+
...(event.outputTokens === undefined ? {} : { output_tokens: event.outputTokens }),
|
|
1855
|
+
...(event.cachedTokens === undefined ? {} : { cached_input_tokens: event.cachedTokens }) };
|
|
1856
|
+
}
|
|
1857
|
+
if (event.kind !== 'tool')
|
|
1858
|
+
return;
|
|
1859
|
+
let tool = toolMirror.get(event.itemId);
|
|
1860
|
+
if (!tool && toolMirror.size >= mirrorLimit)
|
|
1861
|
+
return;
|
|
1862
|
+
const detail = [event.input, event.output, event.detail].filter(value => value !== undefined && value !== '').join('\n');
|
|
1863
|
+
if (!tool) {
|
|
1864
|
+
tool = { icon: '🔧', label: event.name, toolType: 'tool', status: event.status, detail,
|
|
1865
|
+
stepRef: `runtime:${traceRunId}:${event.itemId}` };
|
|
1866
|
+
stampTraceTool(tool, ctx, 'tool');
|
|
1867
|
+
toolMirror.set(event.itemId, tool);
|
|
1868
|
+
}
|
|
1869
|
+
else {
|
|
1870
|
+
Object.assign(tool, { label: event.name, status: event.status, detail });
|
|
1871
|
+
updateTraceToolRow(tool);
|
|
1872
|
+
}
|
|
1873
|
+
ctx.toolLog = [...toolMirror.values()];
|
|
1874
|
+
syncLiveTools(ctx);
|
|
1875
|
+
},
|
|
1876
|
+
settle: async (lease, outcome, problem) => {
|
|
1877
|
+
// Immediate Stop can settle without entering acquire/ready/send.
|
|
1878
|
+
if (!nativeStarted && !runtimeEnded)
|
|
1879
|
+
startFailedRuntime();
|
|
1880
|
+
ctx.stallWatchdog?.stop();
|
|
1881
|
+
ctx.fullText = outcome.partialText;
|
|
1882
|
+
if (problem)
|
|
1883
|
+
ctx.stderrBuf = problem;
|
|
1884
|
+
if (lease)
|
|
1885
|
+
ctx.sessionId = lease.session.nativeSessionId || null;
|
|
1886
|
+
const recordedReason = consumeKillReason(lease?.child.pid);
|
|
1887
|
+
const killReason = stopReason || recordedReason;
|
|
1888
|
+
const wasKilled = Boolean(killReason), wasSteer = killReason === 'steer' || killReason === 'interrupt' || killReason === DUP_REGISTRATION_KILL_REASON;
|
|
1889
|
+
const code = outcome.status === 'done' ? 0 : outcome.status === 'stopped' ? 130 : 1;
|
|
1890
|
+
handoffRuntimeOutcome(ctx, outcome);
|
|
1891
|
+
try {
|
|
1892
|
+
opts.lifecycle?.onExit?.(code);
|
|
1893
|
+
}
|
|
1894
|
+
catch {
|
|
1895
|
+
console.warn(`[runtime:${cli}] exit observer failed`);
|
|
1896
|
+
}
|
|
1897
|
+
await handleAgentExit({ onRuntimeEnd: endRuntime,
|
|
1898
|
+
ctx, code, cli, model: runtimeModel, effectiveProvider, agentLabel, mainManaged, origin,
|
|
1899
|
+
resumeKey, prompt, opts, cfg: { ...cfg, effort }, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
1900
|
+
isResume, wasKilled, wasSteer, smokeResult: detectSmokeResponse(outcome.finalText ?? '', ctx.toolLog, code, cli),
|
|
1901
|
+
effortDefault: effort, costLine: '', resolve: value => { selectedResult ??= value; },
|
|
1902
|
+
activeProcesses, scopeKey, runtimeTransport, scopedBucket: currentBucket, chatSessionId,
|
|
1903
|
+
childProcess: lease?.child ?? null, releaseMainRun,
|
|
1904
|
+
retryState: queueCtrl.retryStateForScope(scopeKey), fallbackState: queueCtrl.fallbackStateForScope(scopeKey),
|
|
1905
|
+
fallbackMaxRetries: FALLBACK_MAX_RETRIES, processQueue: () => { queueRequested = true; },
|
|
1906
|
+
});
|
|
1907
|
+
if (finalizeFailed && lease)
|
|
1908
|
+
await lease.retire(new Error('native_runtime_finalization_failed'));
|
|
1909
|
+
return selectedResult ?? resultFor(ctx.runtimeOutcome ?? outcome);
|
|
1910
|
+
},
|
|
1911
|
+
failed: (_error, _lease, outcome) => failRuntime(outcome),
|
|
1912
|
+
finalized: () => {
|
|
1913
|
+
finalized = true;
|
|
1914
|
+
try {
|
|
1915
|
+
if (capturedRun.cancelPending === cancelHook)
|
|
1916
|
+
delete capturedRun.cancelPending;
|
|
1917
|
+
if (capturedRun.cancelTurn === cancelHook)
|
|
1918
|
+
delete capturedRun.cancelTurn;
|
|
1919
|
+
if (capturedRun.replaceTurn === replaceHook)
|
|
1920
|
+
delete capturedRun.replaceTurn;
|
|
1921
|
+
if (activeMainProcesses.get(scopeKey) === capturedRun) {
|
|
1922
|
+
const child = ownedLease?.child ?? null;
|
|
1923
|
+
if (releaseMainRun(scopeKey, child, ownerGeneration)) {
|
|
1924
|
+
if (getLiveRun(liveScope).traceRunId === traceRunId)
|
|
1925
|
+
clearLiveRun(liveScope);
|
|
1926
|
+
broadcast('agent_status', { running: false, agentId: agentLabel, cli, scope: scopeKey,
|
|
1927
|
+
sessionId: chatSessionId, traceRunId }, traceAudience);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
finally {
|
|
1932
|
+
// Projection/listener/cleanup failure must not leave our durable
|
|
1933
|
+
// row running or rewrite a lifecycle that already selected a result.
|
|
1934
|
+
if (ctx.runtimeOutcome)
|
|
1935
|
+
closeFailedTrace(ctx.runtimeOutcome);
|
|
1936
|
+
if (capturedExit && exitSettlers.get(scopeKey) === capturedExit) {
|
|
1937
|
+
exitSettlers.delete(scopeKey);
|
|
1938
|
+
capturedExit.resolve();
|
|
1939
|
+
}
|
|
1940
|
+
// Exceptional settlement can release the slot before lifecycle requests its normal wake.
|
|
1941
|
+
if (queueRequested || !activeMainProcesses.has(scopeKey))
|
|
1942
|
+
void processQueue(scopeKey);
|
|
1943
|
+
}
|
|
1944
|
+
},
|
|
1945
|
+
});
|
|
1946
|
+
capturedRun.cancelPending = cancelHook;
|
|
1947
|
+
let resolved = false;
|
|
1948
|
+
const resolveOnce = (value) => { if (!resolved) {
|
|
1949
|
+
resolved = true;
|
|
1950
|
+
resolve(value);
|
|
1951
|
+
} };
|
|
1952
|
+
nativeRun.done.then(resolveOnce, error => {
|
|
1953
|
+
const prior = ctx.runtimeTerminalAttempted && ctx.runtimeOutcome ? ctx.runtimeOutcome
|
|
1954
|
+
: error instanceof NativeRunFailure ? { ...error.outcome,
|
|
1955
|
+
status: stopReason || ctx.stallReason || error.outcome.status === 'stopped' ? 'stopped' : 'error', finalText: null }
|
|
1956
|
+
: { status: 'error', finalText: null, partialText: ctx.fullText };
|
|
1957
|
+
resolveOnce(selectedResult ?? resultFor(prior));
|
|
1958
|
+
});
|
|
1959
|
+
return { child: null, promise: resultPromise };
|
|
1960
|
+
}
|
|
1362
1961
|
// ─── Copilot ACP branch ──────────────────────
|
|
1363
1962
|
if (cli === 'copilot') {
|
|
1364
1963
|
// Write model + reasoning_effort to ~/.copilot/config.json (CLI flags unsupported)
|
|
@@ -1423,6 +2022,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1423
2022
|
activeProcesses.delete(agentLabel);
|
|
1424
2023
|
}
|
|
1425
2024
|
broadcast('agent_done', { text: `❌ ${msg}`, error: true, origin, ...empTag }, isEmployee ? 'internal' : 'public');
|
|
2025
|
+
finishPrintActivity(ctx, { kind: 'turn-end', status: 'error', finalText: null, error: msg });
|
|
1426
2026
|
resolve({ text: '', code: 1 });
|
|
1427
2027
|
if (mainManaged)
|
|
1428
2028
|
void processQueue(scopeKey);
|
|
@@ -1434,7 +2034,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1434
2034
|
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, ...empTag }, traceAudience);
|
|
1435
2035
|
if (mainManaged && !opts.internal)
|
|
1436
2036
|
beginLiveRun(liveScope, cli);
|
|
1437
|
-
const traceRunId = startTraceRun({ cli, model, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience });
|
|
2037
|
+
const traceRunId = startTraceRun({ cli, model, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
1438
2038
|
if (mainManaged && !opts.internal)
|
|
1439
2039
|
setLiveRunTraceId(liveScope, traceRunId);
|
|
1440
2040
|
const ctx = {
|
|
@@ -1449,7 +2049,10 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1449
2049
|
parentLiveScope: parentLiveScopeForChild,
|
|
1450
2050
|
traceRunId,
|
|
1451
2051
|
traceAudience,
|
|
2052
|
+
activityIdentity: { sessionId: chatSessionId, scope: scopeKey },
|
|
1452
2053
|
};
|
|
2054
|
+
ctx.printActivity = createPrintActivity({ runId: traceRunId, sessionId: chatSessionId,
|
|
2055
|
+
scope: scopeKey, turnId: traceRunId, audience: traceAudience }, cli);
|
|
1453
2056
|
// Flush accumulated 💭 thinking buffer as a single merged event
|
|
1454
2057
|
function flushThinking() {
|
|
1455
2058
|
if (!ctx.thinkingBuf)
|
|
@@ -1485,6 +2088,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1485
2088
|
const parsedTool = parsed.tool;
|
|
1486
2089
|
// Buffer 💭 thought chunks → flush when different event arrives
|
|
1487
2090
|
if (parsedTool.icon === '💭') {
|
|
2091
|
+
ctx.printActivity?.reasoning(parsedTool.detail || parsedTool.label, 'append');
|
|
1488
2092
|
ctx.thinkingBuf += parsedTool.detail || parsedTool.label;
|
|
1489
2093
|
return;
|
|
1490
2094
|
}
|
|
@@ -1515,11 +2119,13 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1515
2119
|
// carry no boundary signal and simply accumulate.
|
|
1516
2120
|
if (parsed.messageId && ctx.acpAssistantMessageId !== undefined
|
|
1517
2121
|
&& ctx.acpAssistantMessageId !== parsed.messageId) {
|
|
2122
|
+
ctx.printActivity?.nextMessage();
|
|
1518
2123
|
ctx.fullText = '';
|
|
1519
2124
|
ctx.outputTextStarted = false;
|
|
1520
2125
|
}
|
|
1521
2126
|
if (parsed.messageId)
|
|
1522
2127
|
ctx.acpAssistantMessageId = parsed.messageId;
|
|
2128
|
+
ctx.printActivity?.message(parsed.text, 'append', 'unknown');
|
|
1523
2129
|
const segment = appendAssistantTextSegment(ctx, parsed.text);
|
|
1524
2130
|
if (segment) {
|
|
1525
2131
|
broadcastAgentOutput(ctx, agentLabel, cli, segment, empTag, traceAudience);
|
|
@@ -1648,6 +2254,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1648
2254
|
// successful turn in another session writes its vendor id into the row
|
|
1649
2255
|
// the default session resumes from. The exit handler below passes the
|
|
1650
2256
|
// same value; this path runs first and must not disagree with it.
|
|
2257
|
+
runtimeTransport,
|
|
1651
2258
|
scopedBucket: currentBucket,
|
|
1652
2259
|
}))) {
|
|
1653
2260
|
console.log(`[jaw:session] saved ${cli} session=${persistedAcpSessionId.slice(0, 12)}... (pre-shutdown)`);
|
|
@@ -1684,6 +2291,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1684
2291
|
// - trace: if (traceText) traceText = `⏹️ [interrupted]…`
|
|
1685
2292
|
handleAgentExit({
|
|
1686
2293
|
ctx, code: acpCode, cli, model, agentLabel, mainManaged, origin,
|
|
2294
|
+
onRuntimeEnd: end => ctx.printActivity?.finish(end),
|
|
1687
2295
|
resumeKey,
|
|
1688
2296
|
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
1689
2297
|
isResume, wasKilled, wasSteer, smokeResult,
|
|
@@ -1691,6 +2299,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1691
2299
|
resolve: resolve,
|
|
1692
2300
|
activeProcesses,
|
|
1693
2301
|
scopeKey,
|
|
2302
|
+
runtimeTransport,
|
|
1694
2303
|
scopedBucket: currentBucket,
|
|
1695
2304
|
chatSessionId,
|
|
1696
2305
|
childProcess: child,
|
|
@@ -1707,6 +2316,13 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1707
2316
|
}
|
|
1708
2317
|
// ─── Pi RPC branch ─────────────────────────────
|
|
1709
2318
|
if (cli === 'pi') {
|
|
2319
|
+
let piExit = exitSettlers.get(scopeKey);
|
|
2320
|
+
const settlePiExit = () => {
|
|
2321
|
+
if (!piExit || exitSettlers.get(scopeKey) !== piExit)
|
|
2322
|
+
return;
|
|
2323
|
+
exitSettlers.delete(scopeKey);
|
|
2324
|
+
piExit.resolve();
|
|
2325
|
+
};
|
|
1710
2326
|
const pi = normalizePiSettings(settings["pi"]);
|
|
1711
2327
|
const profileId = cfg.provider || pi.defaultProfileId;
|
|
1712
2328
|
const profile = pi.profiles.find((entry) => entry.id === profileId) || pi.profiles[0];
|
|
@@ -1716,7 +2332,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1716
2332
|
const piSessionId = isResume && bucketSessionId ? bucketSessionId : '';
|
|
1717
2333
|
console.log(`[jaw:pi] isResume=${isResume}, bucketSessionId=${bucketSessionId || 'none'}, piSessionId=${piSessionId || 'new'}`);
|
|
1718
2334
|
const piPrompt = withSteerContext(piSessionId ? prompt : withHistoryPrompt(prompt, historyBlock), opts.steerContext);
|
|
1719
|
-
const traceRunId = startTraceRun({ cli, model: runtimeModel, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience });
|
|
2335
|
+
const traceRunId = startTraceRun({ cli, model: runtimeModel, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
1720
2336
|
const ctx = {
|
|
1721
2337
|
fullText: '',
|
|
1722
2338
|
traceLog: [],
|
|
@@ -1742,6 +2358,19 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1742
2358
|
parentLiveScope: parentLiveScopeForChild,
|
|
1743
2359
|
traceRunId,
|
|
1744
2360
|
traceAudience,
|
|
2361
|
+
activityIdentity: { sessionId: chatSessionId, scope: scopeKey },
|
|
2362
|
+
};
|
|
2363
|
+
const activity = new RuntimeProjection({
|
|
2364
|
+
runId: traceRunId, sessionId: chatSessionId, scope: scopeKey,
|
|
2365
|
+
turnId: traceRunId, audience: traceAudience,
|
|
2366
|
+
...(opts.runtimeParentItemId ? { parentItemId: opts.runtimeParentItemId } : {}),
|
|
2367
|
+
});
|
|
2368
|
+
const piProjection = new PiProjection(activity);
|
|
2369
|
+
const rawTrace = new PiRawTrace(traceRunId, appendTraceEvent, () => activity.report('persistence'));
|
|
2370
|
+
activity.start('pi');
|
|
2371
|
+
const onPiRawRecord = (raw) => {
|
|
2372
|
+
rawTrace.record(raw);
|
|
2373
|
+
piProjection.observeRecord(raw);
|
|
1745
2374
|
};
|
|
1746
2375
|
function flushPiThinking() {
|
|
1747
2376
|
if (!ctx.thinkingBuf)
|
|
@@ -1767,7 +2396,13 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1767
2396
|
].join('\n');
|
|
1768
2397
|
const piSysPrompt = sysPrompt ? `${sysPrompt}\n\n${piToolDiscipline}` : piToolDiscipline;
|
|
1769
2398
|
const onPiEvent = (event) => {
|
|
1770
|
-
|
|
2399
|
+
piProjection.observe(event);
|
|
2400
|
+
try {
|
|
2401
|
+
opts.lifecycle?.onActivity?.('pi-rpc');
|
|
2402
|
+
}
|
|
2403
|
+
catch {
|
|
2404
|
+
console.warn('[jaw:pi] activity observer failed');
|
|
2405
|
+
}
|
|
1771
2406
|
if (event.kind === 'thinking') {
|
|
1772
2407
|
ctx.thinkingBuf = (ctx.thinkingBuf || '') + event.text;
|
|
1773
2408
|
return;
|
|
@@ -1811,10 +2446,29 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1811
2446
|
if (event.kind === 'session')
|
|
1812
2447
|
ctx.sessionId = event.sessionId;
|
|
1813
2448
|
};
|
|
1814
|
-
const runPiTurn = (child, done, lease) => {
|
|
2449
|
+
const runPiTurn = (child, done, lease, directCleanup) => {
|
|
1815
2450
|
let leaseCancel = null;
|
|
2451
|
+
let cleanupDone = false, queueRequested = false;
|
|
2452
|
+
let selectedResult;
|
|
2453
|
+
const recordResult = (result) => {
|
|
2454
|
+
if (selectedResult !== undefined)
|
|
2455
|
+
return;
|
|
2456
|
+
selectedResult = result;
|
|
2457
|
+
if (cleanupDone)
|
|
2458
|
+
resolve(result);
|
|
2459
|
+
};
|
|
2460
|
+
const requestQueue = () => {
|
|
2461
|
+
if (cleanupDone)
|
|
2462
|
+
void processQueue(scopeKey);
|
|
2463
|
+
else
|
|
2464
|
+
queueRequested = true;
|
|
2465
|
+
};
|
|
1816
2466
|
const requestCancel = () => {
|
|
2467
|
+
if (cleanupDone)
|
|
2468
|
+
return Promise.resolve();
|
|
1817
2469
|
if (!lease) {
|
|
2470
|
+
if (cancelOwnedPiProcess(child))
|
|
2471
|
+
return Promise.resolve();
|
|
1818
2472
|
if (child.pid) {
|
|
1819
2473
|
const pid = child.pid;
|
|
1820
2474
|
killProcessTree(pid, 'SIGTERM');
|
|
@@ -1829,43 +2483,85 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1829
2483
|
leaseCancel ??= lease.cancel();
|
|
1830
2484
|
return leaseCancel;
|
|
1831
2485
|
};
|
|
1832
|
-
const cancelHook = (
|
|
2486
|
+
const cancelHook = (reason) => {
|
|
2487
|
+
if (cleanupDone)
|
|
2488
|
+
return;
|
|
2489
|
+
if (reason === 'steer' || reason === 'interrupt')
|
|
2490
|
+
piExit = exitSettlers.get(scopeKey);
|
|
2491
|
+
void requestCancel();
|
|
2492
|
+
};
|
|
1833
2493
|
if (lease && mainRun)
|
|
1834
2494
|
mainRun.cancelTurn = cancelHook;
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
2495
|
+
let piWatchdog;
|
|
2496
|
+
let watchdogStopped = false;
|
|
2497
|
+
const stopWatchdog = () => { if (!watchdogStopped) {
|
|
2498
|
+
watchdogStopped = true;
|
|
2499
|
+
piWatchdog?.stop();
|
|
2500
|
+
} };
|
|
2501
|
+
let setupError;
|
|
2502
|
+
try {
|
|
2503
|
+
piWatchdog = attachWatchdog(child, agentLabel, (reason) => {
|
|
2504
|
+
console.log(`[jaw:watchdog] cancelling ${agentLabel} (pi) — ${reason}`);
|
|
2505
|
+
ctx.stallReason = reason;
|
|
2506
|
+
void requestCancel();
|
|
2507
|
+
});
|
|
2508
|
+
ctx.stallWatchdog = piWatchdog;
|
|
2509
|
+
if (mainManaged)
|
|
2510
|
+
mainRun.process = child;
|
|
2511
|
+
else
|
|
2512
|
+
registerActiveProcess(agentLabel, child);
|
|
2513
|
+
if (!opts.internal)
|
|
2514
|
+
broadcast('agent_status', { running: true, agentId: agentLabel, cli, provider: profile.id, ...empTag });
|
|
2515
|
+
if (mainManaged && !opts.internal) {
|
|
2516
|
+
beginLiveRun(liveScope, cli);
|
|
2517
|
+
setLiveRunTraceId(liveScope, traceRunId);
|
|
2518
|
+
}
|
|
2519
|
+
if (mainManaged && !opts.internal && !opts._skipInsert) {
|
|
2520
|
+
insertMessage.run('user', prompt, cli, runtimeModel, settings["workingDir"] || null, chatSessionId);
|
|
2521
|
+
}
|
|
2522
|
+
if (!opts.internal)
|
|
2523
|
+
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, provider: profile.id, ...empTag }, traceAudience);
|
|
1850
2524
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
2525
|
+
catch (error) {
|
|
2526
|
+
setupError = error;
|
|
2527
|
+
try {
|
|
2528
|
+
void requestCancel().catch(() => { console.warn('[jaw:pi] setup cancellation failed'); });
|
|
2529
|
+
}
|
|
2530
|
+
catch {
|
|
2531
|
+
console.warn('[jaw:pi] setup cancellation failed');
|
|
2532
|
+
}
|
|
1853
2533
|
}
|
|
1854
|
-
if (!opts.internal)
|
|
1855
|
-
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, provider: profile.id, ...empTag }, traceAudience);
|
|
1856
2534
|
const releaseLease = async () => {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
2535
|
+
try {
|
|
2536
|
+
if (leaseCancel)
|
|
2537
|
+
await leaseCancel;
|
|
2538
|
+
}
|
|
2539
|
+
finally {
|
|
2540
|
+
if (mainRun?.cancelTurn === cancelHook)
|
|
2541
|
+
delete mainRun.cancelTurn;
|
|
2542
|
+
consumeKillReason(child.pid);
|
|
2543
|
+
if (lease)
|
|
2544
|
+
lease.release();
|
|
2545
|
+
else {
|
|
2546
|
+
let receipt;
|
|
2547
|
+
try {
|
|
2548
|
+
receipt = await directCleanup ?? undefined;
|
|
2549
|
+
}
|
|
2550
|
+
catch { /* Missing/rejected evidence never authorizes deletion. */ }
|
|
2551
|
+
if (receipt?.cwdDisposition === 'removable')
|
|
2552
|
+
cleanupPiEmployee();
|
|
2553
|
+
else
|
|
2554
|
+
console.warn('[jaw:pi] retaining employee cwd: physical cleanup unconfirmed', spawnCwd);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
1865
2557
|
};
|
|
1866
2558
|
done.then(async (result) => {
|
|
1867
|
-
|
|
1868
|
-
|
|
2559
|
+
if (setupError !== undefined)
|
|
2560
|
+
throw setupError;
|
|
2561
|
+
if (result.runtimeOutcome !== undefined)
|
|
2562
|
+
handoffRuntimeOutcome(ctx, result.runtimeOutcome);
|
|
2563
|
+
const killReason = consumeKillReason(child.pid);
|
|
2564
|
+
stopWatchdog();
|
|
1869
2565
|
flushPiThinking();
|
|
1870
2566
|
if (ctx.stderrBuf.length < 4000)
|
|
1871
2567
|
ctx.stderrBuf += result.stderr || '';
|
|
@@ -1873,8 +2569,12 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1873
2569
|
ctx.sessionId = result.sessionId;
|
|
1874
2570
|
if (!ctx.fullText && result.text)
|
|
1875
2571
|
ctx.fullText = result.text;
|
|
1876
|
-
|
|
1877
|
-
|
|
2572
|
+
try {
|
|
2573
|
+
opts.lifecycle?.onExit?.(result.code);
|
|
2574
|
+
}
|
|
2575
|
+
catch {
|
|
2576
|
+
console.warn('[jaw:pi] exit observer failed');
|
|
2577
|
+
}
|
|
1878
2578
|
const wasKilled = !!killReason;
|
|
1879
2579
|
// 'dup-registration' behaves like a steer for cleanup purposes: a
|
|
1880
2580
|
// replacement child already owns this label, so the stale exit handler
|
|
@@ -1882,62 +2582,116 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1882
2582
|
const wasSteer = killReason === 'steer' || killReason === DUP_REGISTRATION_KILL_REASON;
|
|
1883
2583
|
const smokeResult = detectSmokeResponse(ctx.fullText, ctx.toolLog, result.code, cli);
|
|
1884
2584
|
return handleAgentExit({
|
|
2585
|
+
onRuntimeEnd: (end) => { activity.close(end); },
|
|
1885
2586
|
ctx, code: result.code, cli, model: runtimeModel, effectiveProvider: profile.id, agentLabel, mainManaged, origin,
|
|
1886
2587
|
resumeKey,
|
|
1887
2588
|
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
1888
2589
|
isResume: false, wasKilled, wasSteer, smokeResult,
|
|
1889
2590
|
effortDefault: 'medium', costLine: '',
|
|
1890
|
-
resolve:
|
|
2591
|
+
resolve: recordResult,
|
|
1891
2592
|
activeProcesses,
|
|
1892
2593
|
scopeKey,
|
|
2594
|
+
runtimeTransport,
|
|
1893
2595
|
scopedBucket: currentBucket,
|
|
1894
2596
|
chatSessionId,
|
|
1895
2597
|
childProcess: child,
|
|
1896
|
-
releaseMainRun,
|
|
2598
|
+
releaseMainRun: (scope, process, generation) => activeMainProcesses.get(scope) === mainRun
|
|
2599
|
+
&& releaseMainRun(scope, process, generation),
|
|
1897
2600
|
retryState: queueCtrl.retryStateForScope(scopeKey),
|
|
1898
2601
|
fallbackState: queueCtrl.fallbackStateForScope(scopeKey),
|
|
1899
2602
|
fallbackMaxRetries: FALLBACK_MAX_RETRIES,
|
|
1900
|
-
processQueue,
|
|
1901
|
-
})
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
|
|
2603
|
+
processQueue: requestQueue,
|
|
2604
|
+
});
|
|
2605
|
+
}, async (err) => {
|
|
2606
|
+
if (setupError !== undefined)
|
|
2607
|
+
throw setupError;
|
|
2608
|
+
const failedOutcome = piFailureOutcome(err);
|
|
2609
|
+
if (failedOutcome !== undefined)
|
|
2610
|
+
handoffRuntimeOutcome(ctx, failedOutcome);
|
|
2611
|
+
const killReason = consumeKillReason(child.pid);
|
|
2612
|
+
const wasKilled = !!killReason;
|
|
2613
|
+
const wasSteer = killReason === 'steer' || killReason === DUP_REGISTRATION_KILL_REASON;
|
|
2614
|
+
stopWatchdog();
|
|
1905
2615
|
if (ctx.stderrBuf.length < 4000)
|
|
1906
2616
|
ctx.stderrBuf += err.message;
|
|
1907
2617
|
console.error('[jaw:pi] runtime failed:', err.message);
|
|
1908
|
-
handleAgentExit({
|
|
2618
|
+
return handleAgentExit({
|
|
2619
|
+
onRuntimeEnd: (end) => { activity.close(end); },
|
|
1909
2620
|
ctx, code: 1, cli, model: runtimeModel, effectiveProvider: profile.id, agentLabel, mainManaged, origin,
|
|
1910
2621
|
resumeKey,
|
|
1911
2622
|
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
1912
|
-
isResume: false, wasKilled
|
|
2623
|
+
isResume: false, wasKilled, wasSteer, smokeResult: detectSmokeResponse('', [], 1, cli),
|
|
1913
2624
|
effortDefault: 'medium', costLine: '',
|
|
1914
|
-
resolve:
|
|
2625
|
+
resolve: recordResult,
|
|
1915
2626
|
activeProcesses,
|
|
1916
2627
|
scopeKey,
|
|
2628
|
+
runtimeTransport,
|
|
1917
2629
|
scopedBucket: currentBucket,
|
|
1918
2630
|
chatSessionId,
|
|
1919
2631
|
childProcess: child,
|
|
1920
|
-
releaseMainRun,
|
|
2632
|
+
releaseMainRun: (scope, process, generation) => activeMainProcesses.get(scope) === mainRun
|
|
2633
|
+
&& releaseMainRun(scope, process, generation),
|
|
1921
2634
|
retryState: queueCtrl.retryStateForScope(scopeKey),
|
|
1922
2635
|
fallbackState: queueCtrl.fallbackStateForScope(scopeKey),
|
|
1923
2636
|
fallbackMaxRetries: FALLBACK_MAX_RETRIES,
|
|
1924
|
-
processQueue,
|
|
1925
|
-
})
|
|
1926
|
-
|
|
1927
|
-
|
|
2637
|
+
processQueue: requestQueue,
|
|
2638
|
+
});
|
|
2639
|
+
}).catch((handleErr) => {
|
|
2640
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Lifecycle failed' });
|
|
2641
|
+
console.error('[jaw:lifecycle] handleAgentExit failed (Pi):', handleErr.message);
|
|
2642
|
+
try {
|
|
2643
|
+
finalizeTraceRun(traceRunId, 'error', 'Lifecycle failed', { onlyIfRunning: true });
|
|
2644
|
+
}
|
|
2645
|
+
catch {
|
|
2646
|
+
console.warn('[runtime] Pi lifecycle trace finalization failed');
|
|
2647
|
+
}
|
|
2648
|
+
if (mainManaged && activeMainProcesses.get(scopeKey) === mainRun) {
|
|
2649
|
+
if (releaseMainRun(scopeKey, mainRun.process, ownerGeneration) && !opts.internal)
|
|
2650
|
+
requestQueue();
|
|
2651
|
+
if (getLiveRun(liveScope).traceRunId === traceRunId)
|
|
2652
|
+
clearLiveRun(liveScope);
|
|
2653
|
+
}
|
|
2654
|
+
else if (!mainManaged && activeProcesses.get(agentLabel) === child)
|
|
2655
|
+
activeProcesses.delete(agentLabel);
|
|
2656
|
+
recordResult({ text: ctx.runtimeOutcome?.finalText ?? '', code: 1,
|
|
2657
|
+
...(ctx.runtimeOutcome === undefined ? {} : { runtimeOutcome: { ...ctx.runtimeOutcome } }) });
|
|
2658
|
+
}).finally(async () => {
|
|
2659
|
+
try {
|
|
2660
|
+
stopWatchdog();
|
|
2661
|
+
await releaseLease();
|
|
2662
|
+
}
|
|
2663
|
+
catch {
|
|
2664
|
+
console.warn('[jaw:pi] runtime cleanup failed');
|
|
2665
|
+
recordResult({ text: '', code: 1 });
|
|
2666
|
+
}
|
|
2667
|
+
finally {
|
|
2668
|
+
cleanupDone = true;
|
|
2669
|
+
settlePiExit();
|
|
2670
|
+
if (queueRequested)
|
|
2671
|
+
void processQueue(scopeKey);
|
|
2672
|
+
if (selectedResult !== undefined)
|
|
2673
|
+
resolve(selectedResult);
|
|
2674
|
+
}
|
|
1928
2675
|
});
|
|
1929
2676
|
};
|
|
1930
2677
|
if (opts.agentId) {
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1940
|
-
|
|
2678
|
+
let execution;
|
|
2679
|
+
try {
|
|
2680
|
+
execution = spawnPiRpc(profile, pi, {
|
|
2681
|
+
prompt: piPrompt, model: runtimeModel,
|
|
2682
|
+
...(piSessionId ? { sessionId: piSessionId } : {}),
|
|
2683
|
+
effort, cwd: spawnCwd, sysPrompt: piSysPrompt,
|
|
2684
|
+
onEvent: onPiEvent, onRawRecord: onPiRawRecord,
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
catch (error) {
|
|
2688
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Pi process creation failed' });
|
|
2689
|
+
finalizeTraceRun(traceRunId, 'error', 'Pi process creation failed');
|
|
2690
|
+
cleanupPiEmployee();
|
|
2691
|
+
throw error;
|
|
2692
|
+
}
|
|
2693
|
+
const { child, done, cleanup } = execution;
|
|
2694
|
+
runPiTurn(child, done, null, cleanup ?? null);
|
|
1941
2695
|
return { child, promise: resultPromise };
|
|
1942
2696
|
}
|
|
1943
2697
|
const profileFp = crypto.createHmac('sha256', piProfileFingerprintKey)
|
|
@@ -1962,20 +2716,62 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1962
2716
|
forceNew,
|
|
1963
2717
|
}).then((lease) => {
|
|
1964
2718
|
mainRun.starting = false;
|
|
2719
|
+
if (activeMainProcesses.get(scopeKey) !== mainRun || !isCurrentSessionOwner(persistenceOwner, scopeKey)) {
|
|
2720
|
+
lease.release();
|
|
2721
|
+
activity.close({ kind: 'turn-end', status: 'stopped', finalText: null });
|
|
2722
|
+
try {
|
|
2723
|
+
finalizeTraceRun(traceRunId, 'interrupted');
|
|
2724
|
+
}
|
|
2725
|
+
catch {
|
|
2726
|
+
console.warn('[runtime] Pi cancelled acquisition trace finalization failed');
|
|
2727
|
+
}
|
|
2728
|
+
if (activeMainProcesses.get(scopeKey) === mainRun) {
|
|
2729
|
+
if (getLiveRun(liveScope).traceRunId === traceRunId)
|
|
2730
|
+
clearLiveRun(liveScope);
|
|
2731
|
+
releaseMainRun(scopeKey, null, ownerGeneration);
|
|
2732
|
+
settlePiExit();
|
|
2733
|
+
}
|
|
2734
|
+
resolve({ text: '', code: 130, runtimeOutcome: { status: 'stopped', finalText: null, partialText: '' } });
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
1965
2737
|
ctx.sessionId = lease.session.sessionId;
|
|
1966
2738
|
console.log(`[jaw:pi:pool] reused=${lease.reused} sessionId=${lease.session.sessionId || 'new'}`);
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
2739
|
+
let done;
|
|
2740
|
+
try {
|
|
2741
|
+
done = lease.session.sendPrompt(piPrompt, { effort, onEvent: onPiEvent, onRawRecord: onPiRawRecord })
|
|
2742
|
+
.then((result) => ({ ...result, code: 0, sessionId: lease.session.sessionId }));
|
|
2743
|
+
}
|
|
2744
|
+
catch (error) {
|
|
2745
|
+
done = Promise.reject(error);
|
|
2746
|
+
}
|
|
2747
|
+
runPiTurn(lease.session.child, done, lease, null);
|
|
1970
2748
|
}).catch((err) => {
|
|
1971
2749
|
mainRun.starting = false;
|
|
1972
2750
|
console.error(`[jaw:pi:pool] acquire failed: ${err.message}`);
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2751
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Pi acquisition failed' });
|
|
2752
|
+
try {
|
|
2753
|
+
finalizeTraceRun(traceRunId, 'error', 'Pi acquisition failed');
|
|
2754
|
+
}
|
|
2755
|
+
catch {
|
|
2756
|
+
console.warn('[runtime] Pi acquisition trace finalization failed');
|
|
2757
|
+
}
|
|
2758
|
+
const ownsRun = activeMainProcesses.get(scopeKey) === mainRun;
|
|
2759
|
+
if (ownsRun) {
|
|
2760
|
+
clearLiveRun(liveScope);
|
|
2761
|
+
try {
|
|
2762
|
+
broadcast('agent_status', { running: false, agentId: agentLabel });
|
|
2763
|
+
broadcast('agent_done', { text: `❌ Pi RPC acquire failed: ${err.message}`, error: true, origin }, 'public');
|
|
2764
|
+
}
|
|
2765
|
+
catch {
|
|
2766
|
+
console.warn('[jaw:pi] acquisition diagnostic delivery failed');
|
|
2767
|
+
}
|
|
2768
|
+
releaseMainRun(scopeKey, null, ownerGeneration);
|
|
2769
|
+
}
|
|
1977
2770
|
resolve({ text: '', code: 1 });
|
|
1978
|
-
|
|
2771
|
+
if (ownsRun) {
|
|
2772
|
+
settlePiExit();
|
|
2773
|
+
void processQueue(scopeKey);
|
|
2774
|
+
}
|
|
1979
2775
|
});
|
|
1980
2776
|
return { child: null, promise: resultPromise };
|
|
1981
2777
|
}
|
|
@@ -1993,7 +2789,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1993
2789
|
}
|
|
1994
2790
|
if (!opts.internal)
|
|
1995
2791
|
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, ...empTag }, traceAudience);
|
|
1996
|
-
const traceRunId = startTraceRun({ cli, model, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience });
|
|
2792
|
+
const traceRunId = startTraceRun({ cli, model, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
1997
2793
|
if (mainManaged && !opts.internal)
|
|
1998
2794
|
setLiveRunTraceId(liveScope, traceRunId);
|
|
1999
2795
|
const ctx = {
|
|
@@ -2008,7 +2804,15 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2008
2804
|
parentLiveScope: parentLiveScopeForChild,
|
|
2009
2805
|
traceRunId,
|
|
2010
2806
|
traceAudience,
|
|
2807
|
+
activityIdentity: { sessionId: chatSessionId, scope: scopeKey },
|
|
2011
2808
|
};
|
|
2809
|
+
const activity = new RuntimeProjection({
|
|
2810
|
+
runId: traceRunId, sessionId: chatSessionId, scope: scopeKey,
|
|
2811
|
+
turnId: traceRunId, audience: traceAudience,
|
|
2812
|
+
...(opts.runtimeParentItemId ? { parentItemId: opts.runtimeParentItemId } : {}),
|
|
2813
|
+
});
|
|
2814
|
+
const codexProjection = new CodexProjection(activity);
|
|
2815
|
+
activity.start('codex-app');
|
|
2012
2816
|
function flushCodexAppThinking() {
|
|
2013
2817
|
if (!ctx.thinkingBuf)
|
|
2014
2818
|
return;
|
|
@@ -2202,6 +3006,9 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2202
3006
|
});
|
|
2203
3007
|
},
|
|
2204
3008
|
onEvent: consumeCodexAppEvent,
|
|
3009
|
+
onProjectionNotification: (method, params, parsed) => {
|
|
3010
|
+
codexProjection.observe(method, params, parsed, ctx.codexAppActiveChannel || '');
|
|
3011
|
+
},
|
|
2205
3012
|
onStderr: handleStderr,
|
|
2206
3013
|
onExit: (code, signal) => {
|
|
2207
3014
|
processExit.value = { code, signal };
|
|
@@ -2277,6 +3084,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2277
3084
|
// With multiplex off there is no lease bucket key, and without this the
|
|
2278
3085
|
// save lands on the bare `codex-app` row that belongs to the default
|
|
2279
3086
|
// session. codex-app is the default runtime, so that is the common case.
|
|
3087
|
+
runtimeTransport,
|
|
2280
3088
|
scopedBucket: currentBucket,
|
|
2281
3089
|
}))) {
|
|
2282
3090
|
console.log(`[jaw:session] saved ${cli} session=${persistedThreadId.slice(0, 12)}... (pre-shutdown)`);
|
|
@@ -2324,6 +3132,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2324
3132
|
flushCodexAppThinking();
|
|
2325
3133
|
const smokeResult = detectSmokeResponse(ctx.fullText, ctx.toolLog, exitCode, cli);
|
|
2326
3134
|
await handleAgentExit({
|
|
3135
|
+
onRuntimeEnd: (end) => { activity.close(end); },
|
|
2327
3136
|
ctx, code: exitCode, cli, model, agentLabel, mainManaged, origin,
|
|
2328
3137
|
resumeKey,
|
|
2329
3138
|
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
@@ -2332,6 +3141,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2332
3141
|
resolve: resolve,
|
|
2333
3142
|
activeProcesses,
|
|
2334
3143
|
scopeKey,
|
|
3144
|
+
runtimeTransport,
|
|
2335
3145
|
scopedBucket: currentBucket,
|
|
2336
3146
|
chatSessionId,
|
|
2337
3147
|
...(lease?.bucketKey ? { codexAppBucket: lease.bucketKey } : {}),
|
|
@@ -2342,6 +3152,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2342
3152
|
fallbackMaxRetries: FALLBACK_MAX_RETRIES,
|
|
2343
3153
|
processQueue,
|
|
2344
3154
|
}).catch((err) => {
|
|
3155
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Lifecycle failed' });
|
|
2345
3156
|
console.error('[jaw:lifecycle] handleAgentExit failed (codex-app):', err.message);
|
|
2346
3157
|
}).finally(() => settleExit(scopeKey));
|
|
2347
3158
|
};
|
|
@@ -2350,10 +3161,19 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2350
3161
|
const appClient = new CodexAppClient({
|
|
2351
3162
|
binary: detected.path || 'codex', workDir: spawnCwd, env: spawnEnv,
|
|
2352
3163
|
});
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
3164
|
+
let child;
|
|
3165
|
+
try {
|
|
3166
|
+
appClient.spawn();
|
|
3167
|
+
if (!appClient.proc)
|
|
3168
|
+
throw new Error('Codex AppServer process was not created');
|
|
3169
|
+
child = appClient.proc;
|
|
3170
|
+
}
|
|
3171
|
+
catch (error) {
|
|
3172
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Codex process creation failed' });
|
|
3173
|
+
finalizeTraceRun(traceRunId, 'error', 'Codex process creation failed');
|
|
3174
|
+
cleanupEmployeeTmpDir(spawnCwd, settings["workingDir"], agentLabel);
|
|
3175
|
+
throw error;
|
|
3176
|
+
}
|
|
2357
3177
|
void runCodexAppTurn(appClient, null, employeeLaneScope);
|
|
2358
3178
|
return { child, promise: resultPromise };
|
|
2359
3179
|
}
|
|
@@ -2474,6 +3294,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2474
3294
|
// Compare the captured object instead and only drop our own slot.
|
|
2475
3295
|
const abandonTurn = (lease) => {
|
|
2476
3296
|
lease?.release();
|
|
3297
|
+
activity.close({ kind: 'turn-end', status: 'stopped', finalText: null });
|
|
2477
3298
|
finalizeTraceRun(traceRunId, 'interrupted');
|
|
2478
3299
|
clearLiveRun(liveScope);
|
|
2479
3300
|
broadcast('agent_status', { running: false, agentId: agentLabel });
|
|
@@ -2494,12 +3315,25 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2494
3315
|
await runCodexAppTurn(lease.client, lease, lease.laneScope);
|
|
2495
3316
|
}).catch((err) => {
|
|
2496
3317
|
console.error(`[codex-app:pool] acquire failed: ${err.message}`);
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
3318
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Codex acquisition failed' });
|
|
3319
|
+
try {
|
|
3320
|
+
finalizeTraceRun(traceRunId, 'error', 'Codex acquisition failed');
|
|
3321
|
+
}
|
|
3322
|
+
catch {
|
|
3323
|
+
console.warn('[runtime] Codex acquisition trace finalization failed');
|
|
3324
|
+
}
|
|
3325
|
+
const ownsRun = activeMainProcesses.get(scopeKey) === mainRun;
|
|
3326
|
+
if (ownsRun) {
|
|
3327
|
+
clearLiveRun(liveScope);
|
|
3328
|
+
broadcast('agent_status', { running: false, agentId: agentLabel });
|
|
3329
|
+
broadcast('agent_done', { text: `❌ Codex AppServer acquire failed: ${err.message}`, error: true, origin }, 'public');
|
|
3330
|
+
releaseMainRun(scopeKey, null, ownerGeneration);
|
|
3331
|
+
}
|
|
2501
3332
|
resolve({ text: '', code: 1 });
|
|
2502
|
-
|
|
3333
|
+
if (ownsRun) {
|
|
3334
|
+
settleExit(scopeKey);
|
|
3335
|
+
void processQueue(scopeKey);
|
|
3336
|
+
}
|
|
2503
3337
|
});
|
|
2504
3338
|
return { child: null, promise: resultPromise };
|
|
2505
3339
|
}
|
|
@@ -2638,6 +3472,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2638
3472
|
activeProcesses.delete(agentLabel);
|
|
2639
3473
|
}
|
|
2640
3474
|
broadcast('agent_done', { text: `❌ ${msg}`, error: true, origin, ...empTag }, isEmployee ? 'internal' : 'public');
|
|
3475
|
+
finishPrintActivity(ctx, { kind: 'turn-end', status: 'error', finalText: null, error: msg });
|
|
2641
3476
|
resolve({ text: '', code: 127 });
|
|
2642
3477
|
if (mainManaged)
|
|
2643
3478
|
void processQueue(scopeKey);
|
|
@@ -2665,7 +3500,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2665
3500
|
child.stdin.end();
|
|
2666
3501
|
if (!opts.internal)
|
|
2667
3502
|
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, ...runtimeStatusMeta, ...empTag }, traceAudience);
|
|
2668
|
-
const traceRunId = startTraceRun({ cli, model: runtimeModel, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience });
|
|
3503
|
+
const traceRunId = startTraceRun({ cli, model: runtimeModel, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
2669
3504
|
if (mainManaged && !opts.internal)
|
|
2670
3505
|
setLiveRunTraceId(liveScope, traceRunId);
|
|
2671
3506
|
// Native `agy --conversation ... -p` may emit only the current answer.
|
|
@@ -2694,6 +3529,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2694
3529
|
parentLiveScope: parentLiveScopeForChild,
|
|
2695
3530
|
traceRunId,
|
|
2696
3531
|
traceAudience,
|
|
3532
|
+
activityIdentity: { sessionId: chatSessionId, scope: scopeKey },
|
|
2697
3533
|
...(opencodeSpawnAudit ? { opencodeSpawnAudit: opencodeSpawnAudit } : {}),
|
|
2698
3534
|
...(agyResumeOffset > 0 ? { agyResumeOffset, agyBytesReceived: 0 } : {}),
|
|
2699
3535
|
...(cli === 'agy' ? {
|
|
@@ -2710,6 +3546,8 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2710
3546
|
...(kiroPlainText || cli === 'agy' || cli === 'pi' ? { liveOutputText: '' } : {}),
|
|
2711
3547
|
...(kiroPlainText ? { kiroLastVisibleAt: Date.now(), kiroHeartbeatSent: false } : {}),
|
|
2712
3548
|
};
|
|
3549
|
+
ctx.printActivity = createPrintActivity({ runId: traceRunId, sessionId: chatSessionId,
|
|
3550
|
+
scope: scopeKey, turnId: traceRunId, audience: traceAudience }, cli);
|
|
2713
3551
|
let agyClosing = false;
|
|
2714
3552
|
let agyGuardedStaleDetected = false;
|
|
2715
3553
|
const scheduleAgyQuietCompletion = () => {
|
|
@@ -2866,6 +3704,10 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2866
3704
|
}
|
|
2867
3705
|
const outputChunk = extractOutputChunk(dispatchCli, event, ctx);
|
|
2868
3706
|
if (outputChunk) {
|
|
3707
|
+
// Dedicated providers observe before their destructive legacy resets.
|
|
3708
|
+
// Copilot's ordinary print fallback exposes only accepted assistant text here.
|
|
3709
|
+
if (dispatchCli === 'copilot')
|
|
3710
|
+
ctx.printActivity?.message(outputChunk, 'append', 'unknown');
|
|
2869
3711
|
broadcastAgentOutput(ctx, agentLabel, cli, outputChunk, empTag, (opts.internal || isEmployee) ? 'internal' : 'public');
|
|
2870
3712
|
}
|
|
2871
3713
|
};
|
|
@@ -2916,6 +3758,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2916
3758
|
ctx.agyResumeOffset = 0;
|
|
2917
3759
|
if (!newText)
|
|
2918
3760
|
return;
|
|
3761
|
+
ctx.printActivity?.message(newText, 'append', 'unknown');
|
|
2919
3762
|
if (ctx.liveOutputText !== undefined)
|
|
2920
3763
|
ctx.liveOutputText += newText;
|
|
2921
3764
|
ctx.outputTextStarted = true;
|
|
@@ -2948,6 +3791,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2948
3791
|
return;
|
|
2949
3792
|
}
|
|
2950
3793
|
appendTraceEvent({ runId: ctx.traceRunId, source: 'cli_raw', eventType: 'plain_text', raw: displayText });
|
|
3794
|
+
ctx.printActivity?.message(displayFullText, 'replace', 'unknown');
|
|
2951
3795
|
broadcastAgentOutput(ctx, agentLabel, cli, displayText, empTag, traceAudience);
|
|
2952
3796
|
scheduleAgyQuietCompletion();
|
|
2953
3797
|
return;
|
|
@@ -3086,6 +3930,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
3086
3930
|
releaseMainRun(scopeKey, child, ownerGeneration);
|
|
3087
3931
|
else
|
|
3088
3932
|
activeProcesses.delete(agentLabel);
|
|
3933
|
+
finishPrintActivity(ctx, { kind: 'turn-end', status: 'stopped', finalText: null, error: 'AGY stale resume; retrying fresh' });
|
|
3089
3934
|
const { promise: freshPromise } = spawnAgent(prompt, {
|
|
3090
3935
|
...opts, _agyStaleFreshRetry: true, _skipResume: true, _skipInsert: true,
|
|
3091
3936
|
});
|
|
@@ -3257,6 +4102,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
3257
4102
|
// - trace: if (traceText) traceText = `⏹️ [interrupted]…`
|
|
3258
4103
|
handleAgentExit({
|
|
3259
4104
|
ctx, code: effectiveExitCode, cli, model: runtimeModel, effectiveProvider, agentLabel, mainManaged, origin,
|
|
4105
|
+
onRuntimeEnd: end => ctx.printActivity?.finish(end),
|
|
3260
4106
|
resumeKey,
|
|
3261
4107
|
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
3262
4108
|
isResume, wasKilled, wasSteer, smokeResult,
|
|
@@ -3264,6 +4110,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
3264
4110
|
resolve: resolve,
|
|
3265
4111
|
activeProcesses,
|
|
3266
4112
|
scopeKey,
|
|
4113
|
+
runtimeTransport,
|
|
3267
4114
|
scopedBucket: currentBucket,
|
|
3268
4115
|
chatSessionId,
|
|
3269
4116
|
childProcess: child,
|