cli-jaw 2.17.62 → 2.17.63
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.ja.md +17 -17
- package/README.ko.md +17 -17
- package/README.md +17 -17
- package/README.zh-CN.md +17 -17
- package/dist/bin/commands/tui/input-handler.js +19 -0
- package/dist/bin/commands/tui/input-handler.js.map +1 -1
- package/dist/bin/commands/tui/overlays.js +8 -4
- package/dist/bin/commands/tui/overlays.js.map +1 -1
- package/dist/bin/star-prompt.js +1 -1
- package/dist/bin/star-prompt.js.map +1 -1
- package/dist/server.js +14 -1
- package/dist/server.js.map +1 -1
- package/dist/src/agent/claude-runtime-pool.js +2 -1
- package/dist/src/agent/claude-runtime-pool.js.map +1 -1
- package/dist/src/agent/claude-runtime-run.js +28 -7
- package/dist/src/agent/claude-runtime-run.js.map +1 -1
- package/dist/src/agent/lifecycle-handler.js +34 -6
- package/dist/src/agent/lifecycle-handler.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-events.js +136 -9
- package/dist/src/agent/runtime/claude-sdk-events.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-history-loader.js +24 -0
- package/dist/src/agent/runtime/claude-sdk-history-loader.js.map +1 -0
- package/dist/src/agent/runtime/claude-sdk-hooks.js +10 -4
- package/dist/src/agent/runtime/claude-sdk-hooks.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-messages.js +25 -2
- package/dist/src/agent/runtime/claude-sdk-messages.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-options.js +36 -3
- package/dist/src/agent/runtime/claude-sdk-options.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-permissions.js +32 -9
- package/dist/src/agent/runtime/claude-sdk-permissions.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-session.js +165 -17
- package/dist/src/agent/runtime/claude-sdk-session.js.map +1 -1
- package/dist/src/agent/runtime/claude-sdk-version.js +8 -0
- package/dist/src/agent/runtime/claude-sdk-version.js.map +1 -0
- package/dist/src/agent/spawn/backend-codex-app.js +619 -0
- package/dist/src/agent/spawn/backend-codex-app.js.map +1 -0
- package/dist/src/agent/spawn/backend-context.js +2 -0
- package/dist/src/agent/spawn/backend-context.js.map +1 -0
- package/dist/src/agent/spawn/backend-copilot.js +385 -0
- package/dist/src/agent/spawn/backend-copilot.js.map +1 -0
- package/dist/src/agent/spawn/backend-native-acp.js +379 -0
- package/dist/src/agent/spawn/backend-native-acp.js.map +1 -0
- package/dist/src/agent/spawn/backend-pi.js +565 -0
- package/dist/src/agent/spawn/backend-pi.js.map +1 -0
- package/dist/src/agent/spawn/types.js +2 -0
- package/dist/src/agent/spawn/types.js.map +1 -0
- package/dist/src/agent/spawn.js +44 -1858
- package/dist/src/agent/spawn.js.map +1 -1
- package/dist/src/cli/claude-default-model-boot.js +36 -0
- package/dist/src/cli/claude-default-model-boot.js.map +1 -0
- package/dist/src/cli/claude-model-discovery.js +13 -1
- package/dist/src/cli/claude-model-discovery.js.map +1 -1
- package/dist/src/cli/claude-models.js +7 -1
- package/dist/src/cli/claude-models.js.map +1 -1
- package/dist/src/cli/commands.js +5 -15
- package/dist/src/cli/commands.js.map +1 -1
- package/dist/src/cli/tui/composer.js +3 -3
- package/dist/src/cli/tui/composer.js.map +1 -1
- package/dist/src/cli/tui/skill-mention.js +15 -0
- package/dist/src/cli/tui/skill-mention.js.map +1 -0
- package/dist/src/code-mode/manager.js +174 -9
- package/dist/src/code-mode/manager.js.map +1 -1
- package/dist/src/code-mode/providers/catalog.js +5 -3
- package/dist/src/code-mode/providers/catalog.js.map +1 -1
- package/dist/src/code-mode/providers/claude-history.js +132 -0
- package/dist/src/code-mode/providers/claude-history.js.map +1 -0
- package/dist/src/code-mode/providers/claude.js +74 -7
- package/dist/src/code-mode/providers/claude.js.map +1 -1
- package/dist/src/code-mode/providers/codex-app.js +7 -1
- package/dist/src/code-mode/providers/codex-app.js.map +1 -1
- package/dist/src/code-mode/session.js +158 -11
- package/dist/src/code-mode/session.js.map +1 -1
- package/dist/src/code-mode/store.js +416 -28
- package/dist/src/code-mode/store.js.map +1 -1
- package/dist/src/command-contract/catalog.js +3 -22
- package/dist/src/command-contract/catalog.js.map +1 -1
- package/dist/src/core/codex-config.js +3 -62
- package/dist/src/core/codex-config.js.map +1 -1
- package/dist/src/core/config.js +116 -14
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/runtime-settings.js +20 -10
- package/dist/src/core/runtime-settings.js.map +1 -1
- package/dist/src/core/settings-watch.js +1 -0
- package/dist/src/core/settings-watch.js.map +1 -1
- package/dist/src/core/skill-mentions.js +83 -0
- package/dist/src/core/skill-mentions.js.map +1 -0
- package/dist/src/manager/registry.js +5 -1
- package/dist/src/manager/registry.js.map +1 -1
- package/dist/src/manager/routes/desktop-status.js +1 -1
- package/dist/src/manager/routes/desktop-status.js.map +1 -1
- package/dist/src/orchestrator/pipeline.js +11 -1
- package/dist/src/orchestrator/pipeline.js.map +1 -1
- package/dist/src/prompt/builder.js +10 -4
- package/dist/src/prompt/builder.js.map +1 -1
- package/dist/src/prompt/templates/a1-system.md +1 -1
- package/dist/src/routes/code-native.js +51 -3
- package/dist/src/routes/code-native.js.map +1 -1
- package/dist/src/routes/settings.js +1 -4
- package/dist/src/routes/settings.js.map +1 -1
- package/dist/src/routes/skills.js +7 -0
- package/dist/src/routes/skills.js.map +1 -1
- package/dist/src/shared/skill-mention.js +61 -0
- package/dist/src/shared/skill-mention.js.map +1 -0
- package/dist/src/shared/tool-input.js +137 -0
- package/dist/src/shared/tool-input.js.map +1 -0
- package/package.json +7 -5
- package/public/css/activity.css +83 -20
- package/public/css/layout.css +2 -2
- package/public/css/sidebar.css +18 -0
- package/public/css/variables.css +23 -2
- package/public/dist/.vite/manifest.json +302 -334
- package/public/dist/assets/Activity-DPLlOJ46.js +1 -0
- package/public/dist/assets/AdvancedExport-BgOgGvc5.js +1 -0
- package/public/dist/assets/Agent-O_U8ny90.js +1 -0
- package/public/dist/assets/Browser-m6VynQXV.js +1 -0
- package/public/dist/assets/BrowserPanel-Bb-Bge6B.js +3 -0
- package/public/dist/assets/ChannelEnablementControl-BSuKQhTW.js +85 -0
- package/public/dist/assets/ChannelSetupEntry-DHLoZEzJ.js +1 -0
- package/public/dist/assets/ChannelsDiscord-B-G8vsYy.js +1 -0
- package/public/dist/assets/ChannelsSlack-oPuh922z.js +1 -0
- package/public/dist/assets/ChannelsTelegram-PmTv43KQ.js +1 -0
- package/public/dist/assets/CodeCanvas-CVbdp0S-.js +3 -0
- package/public/dist/assets/DashboardMeta-BqEiJrvr.js +1 -0
- package/public/dist/assets/DesignPanel-BOb-HMbl.js +2 -0
- package/public/dist/assets/{Developer-BdKPcw8Z.js → Developer-CbySB7_Z.js} +1 -1
- package/public/dist/assets/{DiffPanel-DtJuvU5y.js → DiffPanel-D9Cch5FG.js} +1 -1
- package/public/dist/assets/Display-C0Zdamcb.js +1 -0
- package/public/dist/assets/Display-DU4_76cS.js +1 -0
- package/public/dist/assets/DocPanel-DvtFw8AP.js +1 -0
- package/public/dist/assets/{Embedding-DvdTj1BF.js → Embedding-CCFMOB_2.js} +1 -1
- package/public/dist/assets/Employees-BanvF58d.js +1 -0
- package/public/dist/assets/FolderPanel-CJvwRwIV.js +3 -0
- package/public/dist/assets/Heartbeat-uyi_MpUd.js +1 -0
- package/public/dist/assets/InlineWarn-Cq4z28F3.js +1 -0
- package/public/dist/assets/MarkdownRenderer-Cc3DeHvm.js +1 -0
- package/public/dist/assets/{MarkdownRenderer-DhonsAPC.js → MarkdownRenderer-DzN66XVb.js} +1 -1
- package/public/dist/assets/Mcp-rjPoL_Zo.js +4 -0
- package/public/dist/assets/Memory-C9I33pIi.js +1 -0
- package/public/dist/assets/{MilkdownWysiwygEditor-D6JaLDE4.js → MilkdownWysiwygEditor-xObhviw7.js} +1 -1
- package/public/dist/assets/ModelProvider-fiUktMaO.js +1 -0
- package/public/dist/assets/Network-CuqFrOvR.js +1 -0
- package/public/dist/assets/NotesGraphWorkspace-DO9LtVGF.js +1 -0
- package/public/dist/assets/PanelLayoutProvider-DRZ4QkBC.js +1 -0
- package/public/dist/assets/Permissions-BltXiZnz.js +1 -0
- package/public/dist/assets/{Permissions-BwiMEoTV.js → Permissions-DcCbFMIq.js} +1 -1
- package/public/dist/assets/Profile-DUL7-RE_.js +1 -0
- package/public/dist/assets/Prompts-C9vY8ivQ.js +1 -0
- package/public/dist/assets/SpeechKeys-BJ8V7U5E.js +1 -0
- package/public/dist/assets/TelegramHub-DtyjLGFR.js +1 -0
- package/public/dist/assets/{TerminalPanel-Bu9i-P2f.js → TerminalPanel-c1xhiy53.js} +1 -1
- package/public/dist/assets/app-BjKzqXCv.css +1 -0
- package/public/dist/assets/app-CZwx0V6K.js +59 -0
- package/public/dist/assets/bgtask-badge-CnVkcp3c.js +1 -0
- package/public/dist/assets/{bgtask-badge-DfiHuzxT.js → bgtask-badge-Cp26S8Uq.js} +1 -1
- package/public/dist/assets/client-platform-WO8m6kPQ.js +1 -0
- package/public/dist/assets/{employees-BQaJNp-u.js → employees-CsvI0_5V.js} +1 -1
- package/public/dist/assets/error-normalize-clOi-AAA.js +1 -0
- package/public/dist/assets/fields-CicOWY-X.js +1 -0
- package/public/dist/assets/iframe-renderer-DWx9v2Iz.js +1 -0
- package/public/dist/assets/iframe-renderer-DmHYOI1A.js +142 -0
- package/public/dist/assets/{react-C_pPTFsM.js → jsx-runtime-CkEUZM6i.js} +1 -1
- package/public/dist/assets/manager-CCXm5Yfe.js +5 -0
- package/public/dist/assets/manager-D9rhKFKc.css +1 -0
- package/public/dist/assets/manager-shortcuts-Cqmr0mEq.js +1 -0
- package/public/dist/assets/{memory-EG1B51up.js → memory-C6qtAMdJ.js} +1 -1
- package/public/dist/assets/memory-PPofQPeB.js +1 -0
- package/public/dist/assets/message-history-DcjBuubA.js +4 -0
- package/public/dist/assets/message-history-bw4qF01Z.js +1 -0
- package/public/dist/assets/page-shell-DfinU3mb.js +1 -0
- package/public/dist/assets/react-dom-URBLzV3w.js +1 -0
- package/public/dist/assets/{render-Dp07lZAJ.js → render-DfYro-fG.js} +1 -1
- package/public/dist/assets/{settings-jlI4X-zt.js → settings-CvsLWlJn.js} +38 -30
- package/public/dist/assets/settings-DMiQe469.js +1 -0
- package/public/dist/assets/settings-DgAlohx9.js +1 -0
- package/public/dist/assets/settings-core-BH7J_Rbm.js +1 -0
- package/public/dist/assets/{settings-core-B5Uf_lWY.js → settings-core-pnpw-eZv.js} +1 -1
- package/public/dist/assets/{settings-embedding-BfWzWKMM.js → settings-embedding-BRW0WZvh.js} +3 -3
- package/public/dist/assets/{settings-embedding-DhEdT86W.css → settings-embedding-CUQ8Is3y.css} +1 -1
- package/public/dist/assets/settings-types-CYKy0xz4.js +1 -0
- package/public/dist/assets/shared-D1begqvi.js +1 -0
- package/public/dist/assets/{sidebar-BUemG2ZN.js → sidebar-C_80w4iY.js} +3 -3
- package/public/dist/assets/{skills-CKUcEN9m.js → skills-D_2adqge.js} +1 -1
- package/public/dist/assets/skills-DeNVAVgt.js +1 -0
- package/public/dist/assets/{slash-commands-D34GgHFX.js → slash-commands-B_Hq5RkC.js} +2 -2
- package/public/dist/assets/slash-commands-Cj5qoRWc.js +1 -0
- package/public/dist/assets/tool-input-DI7uu8Ah.js +2 -0
- package/public/dist/assets/{trace-drawer-DBmK-5F_.js → trace-drawer-B6XuPodh.js} +1 -1
- package/public/dist/assets/ui-BbR_fFiK.js +1 -0
- package/public/dist/assets/{ui-vm2iuLcS.js → ui-D8xzm7DN.js} +1 -1
- package/public/dist/index.html +11 -3
- package/public/dist/manager/index.html +3 -3
- package/public/dist/settings/index.html +2 -2
- package/public/index.html +9 -1
- package/public/js/features/activity-history.ts +50 -21
- package/public/js/features/activity-rows.ts +158 -10
- package/public/js/features/activity-view.ts +5 -5
- package/public/js/features/chat.ts +2 -0
- package/public/js/features/employees.ts +1 -0
- package/public/js/features/resize-guard.ts +39 -0
- package/public/js/features/settings-cli-status.ts +49 -17
- package/public/js/features/settings-types.ts +39 -1
- package/public/js/features/skill-mentions.ts +143 -0
- package/public/js/main.ts +15 -0
- package/public/js/virtual-scroll.ts +67 -1
- package/public/locales/en.json +2 -0
- package/public/locales/ja.json +2 -0
- package/public/locales/ko.json +2 -0
- package/public/locales/zh.json +2 -0
- package/public/manager/src/AppChrome.tsx +2 -0
- package/public/manager/src/InstancePreview.tsx +1 -1
- package/public/manager/src/SidebarRailRouter.tsx +3 -1
- package/public/manager/src/browser-panel/BrowserPanel.tsx +47 -12
- package/public/manager/src/browser-panel/browser-address-state.ts +11 -0
- package/public/manager/src/client-platform.ts +18 -0
- package/public/manager/src/code/CodeCanvas.tsx +4 -2
- package/public/manager/src/code/CodeComposer.tsx +22 -10
- package/public/manager/src/code/CodeDraftEmptyState.tsx +64 -0
- package/public/manager/src/code/CodeSessionList.tsx +154 -40
- package/public/manager/src/code/CodeTranscript.tsx +104 -16
- package/public/manager/src/code/CodeWorkbench.tsx +21 -11
- package/public/manager/src/code/CodeWorkspaceHeader.tsx +5 -10
- package/public/manager/src/code/ComposerFooter.tsx +9 -1
- package/public/manager/src/code/code-composer.css +1 -1
- package/public/manager/src/code/code-controller-draft-storage.ts +16 -8
- package/public/manager/src/code/code-controller-drafts.ts +33 -6
- package/public/manager/src/code/code-controller-runtime.ts +189 -17
- package/public/manager/src/code/code-controller-types.ts +19 -1
- package/public/manager/src/code/code-recent-workspaces.ts +25 -0
- package/public/manager/src/code/code-session-client.ts +19 -1
- package/public/manager/src/code/code-session-sidebar.css +38 -0
- package/public/manager/src/code/code-session-state.ts +2 -0
- package/public/manager/src/code/code-types.ts +47 -0
- package/public/manager/src/code/code-workbench.css +36 -1
- package/public/manager/src/code/code.css +171 -7
- package/public/manager/src/code/session-order.ts +80 -0
- package/public/manager/src/code/tool-summary.ts +45 -11
- package/public/manager/src/folder-panel/folder-shortcuts.ts +5 -9
- package/public/manager/src/hooks/useCommandPalette.ts +3 -7
- package/public/manager/src/main.tsx +1 -0
- package/public/manager/src/manager-components.css +25 -23
- package/public/manager/src/manager-dashboard-reminders.css +2 -2
- package/public/manager/src/manager-layout.css +1 -1
- package/public/manager/src/manager-shortcut-runner.ts +9 -2
- package/public/manager/src/manager-shortcuts.ts +83 -21
- package/public/manager/src/panels/desktop-bridge.ts +4 -1
- package/public/manager/src/panels/panels.css +9 -0
- package/public/manager/src/preview.ts +19 -4
- package/public/manager/src/settings/pages/AdvancedExport.tsx +28 -30
- package/public/manager/src/settings/pages/Browser.tsx +45 -47
- package/public/manager/src/settings/pages/ChannelsDiscord.tsx +51 -26
- package/public/manager/src/settings/pages/ChannelsSlack.tsx +59 -17
- package/public/manager/src/settings/pages/ChannelsTelegram.tsx +51 -26
- package/public/manager/src/settings/pages/Display.tsx +2 -1
- package/public/manager/src/settings/pages/Employees.tsx +3 -3
- package/public/manager/src/settings/pages/Mcp.tsx +220 -200
- package/public/manager/src/settings/pages/Memory.tsx +35 -41
- package/public/manager/src/settings/pages/ModelProvider.tsx +23 -98
- package/public/manager/src/settings/pages/Network.tsx +5 -4
- package/public/manager/src/settings/pages/Permissions.tsx +38 -16
- package/public/manager/src/settings/pages/Prompts.tsx +12 -9
- package/public/manager/src/settings/pages/SpeechKeys.tsx +132 -139
- package/public/manager/src/settings/pages/TelegramHub.tsx +67 -20
- package/public/manager/src/settings/pages/components/AvatarCard.tsx +9 -8
- package/public/manager/src/settings/pages/components/ChannelSetupEntry.tsx +2 -2
- package/public/manager/src/settings/pages/components/EmployeeRow.tsx +6 -12
- package/public/manager/src/settings/pages/components/HealthBadge.tsx +11 -6
- package/public/manager/src/settings/pages/components/HeartbeatJobRow.tsx +35 -16
- package/public/manager/src/settings/pages/components/HeartbeatJobsSection.tsx +11 -11
- package/public/manager/src/settings/pages/components/HeartbeatMarkdownSection.tsx +7 -7
- package/public/manager/src/settings/pages/components/InlineWarn.tsx +4 -9
- package/public/manager/src/settings/pages/components/McpServerCard.tsx +39 -27
- package/public/manager/src/settings/pages/components/MemoryRow.tsx +21 -16
- package/public/manager/src/settings/pages/components/PerCliRow.tsx +122 -121
- package/public/manager/src/settings/pages/components/PiProfileDialog.tsx +9 -6
- package/public/manager/src/settings/pages/components/SlackSetup.tsx +8 -8
- package/public/manager/src/settings/pages/components/TransportStatusChips.tsx +14 -10
- package/public/manager/src/settings/pages/components/agent/AgentEmployeesSection.tsx +26 -26
- package/public/manager/src/settings/pages/components/agent/PermissionQuickSection.tsx +5 -5
- package/public/manager/src/settings/pages/components/agent/RuntimeEmployeeRow.tsx +14 -11
- package/public/manager/src/settings/pages/components/agent/RuntimeHeader.tsx +1 -3
- package/public/manager/src/settings/pages/components/agent/agent-meta.ts +0 -2
- package/public/manager/src/settings/pages/components/runtime-transport-field.tsx +2 -2
- package/public/manager/src/settings/pages/manager/Activity.tsx +6 -2
- package/public/manager/src/settings/pages/manager/Display.tsx +3 -8
- package/public/manager/src/settings/pages/manager/shared.tsx +44 -33
- package/public/manager/src/settings/pages/page-shell.tsx +66 -0
- package/public/manager/src/settings-agent.css +185 -36
- package/public/manager/src/settings-standalone.tsx +1 -0
- package/public/manager/src/settings-surface.css +96 -0
- package/public/manager/src/types.ts +1 -0
- package/scripts/ci/install-ripgrep.sh +35 -0
- package/scripts/collect-fresh-install-evidence.sh +2 -2
- package/scripts/install-risk-gate.mjs +2 -3
- package/scripts/install-wsl.sh +1 -1
- package/scripts/install.ps1 +1 -1
- package/scripts/install.sh +1 -1
- package/scripts/release-1.6.0.sh +1 -1
- package/scripts/release-gates.mjs +48 -13
- package/scripts/release-preview.sh +2 -2
- package/scripts/restack-pr.sh +88 -0
- package/scripts/verify-electron-update-metadata.mjs +1 -1
- package/scripts/windows-support-contract.json +1 -1
- package/public/dist/assets/Activity-BUrp73Re.js +0 -1
- package/public/dist/assets/AdvancedExport-B7h_ZvBu.js +0 -1
- package/public/dist/assets/Agent-DnbZJP7b.js +0 -1
- package/public/dist/assets/Browser-CiBoK5Qx.js +0 -1
- package/public/dist/assets/BrowserPanel-SZAUc9T2.js +0 -3
- package/public/dist/assets/ChannelEnablementControl-Dl0uYx38.js +0 -85
- package/public/dist/assets/ChannelSetupEntry-DxtOrN01.js +0 -1
- package/public/dist/assets/ChannelsDiscord-BEGGwd_3.js +0 -1
- package/public/dist/assets/ChannelsSlack-BryC2Ahr.js +0 -1
- package/public/dist/assets/ChannelsTelegram-CGSpaImJ.js +0 -1
- package/public/dist/assets/CodeCanvas-DpkFi5Au.js +0 -2
- package/public/dist/assets/DashboardMeta-Dh-tasbY.js +0 -1
- package/public/dist/assets/DesignPanel-NLNK9wCo.js +0 -2
- package/public/dist/assets/Display-BHGFX3O0.js +0 -1
- package/public/dist/assets/Display-BW-_pKRf.js +0 -1
- package/public/dist/assets/DocPanel-BM41cYpS.js +0 -1
- package/public/dist/assets/Employees-BuFw6-fT.js +0 -1
- package/public/dist/assets/FolderPanel-C-eQT3Yq.js +0 -3
- package/public/dist/assets/Heartbeat-CIVtKWNc.js +0 -1
- package/public/dist/assets/InlineWarn-DIMbcbzk.js +0 -1
- package/public/dist/assets/MarkdownRenderer-DyVx6DxM.js +0 -1
- package/public/dist/assets/Mcp-uKjor7vh.js +0 -4
- package/public/dist/assets/Memory-BSDIXT0B.js +0 -1
- package/public/dist/assets/ModelProvider-DMh2tXUx.js +0 -1
- package/public/dist/assets/Network-4Pa6JkhK.js +0 -1
- package/public/dist/assets/NotesGraphWorkspace-CgdC-fM6.js +0 -1
- package/public/dist/assets/PanelLayoutProvider-mn8sI0h-.js +0 -1
- package/public/dist/assets/Permissions-CodIW-Yd.js +0 -1
- package/public/dist/assets/Profile-DPqrYA44.js +0 -1
- package/public/dist/assets/Prompts-CvAx7QqR.js +0 -1
- package/public/dist/assets/SpeechKeys-CVBCqoBn.js +0 -1
- package/public/dist/assets/TelegramHub-4zKwpk0P.js +0 -1
- package/public/dist/assets/app-ByMfeXp-.js +0 -55
- package/public/dist/assets/app-DAJWqs33.css +0 -1
- package/public/dist/assets/bgtask-badge-Ch88fnhf.js +0 -1
- package/public/dist/assets/error-normalize-CL69Bl7z.js +0 -1
- package/public/dist/assets/fields-mlGpofqQ.js +0 -1
- package/public/dist/assets/iframe-renderer-Bj1JolO8.js +0 -142
- package/public/dist/assets/iframe-renderer-DWnvUSrx.js +0 -1
- package/public/dist/assets/jsx-runtime-NZYk81nU.js +0 -1
- package/public/dist/assets/manager-Bi_xw7TW.js +0 -5
- package/public/dist/assets/manager-BnQHAKk6.css +0 -1
- package/public/dist/assets/manager-shortcuts-BDOzd8zm.js +0 -1
- package/public/dist/assets/memory-Bk_cb3sw.js +0 -1
- package/public/dist/assets/message-history-D2vniu04.js +0 -4
- package/public/dist/assets/message-history-GAtF_wbZ.js +0 -1
- package/public/dist/assets/page-shell-BeGD0rRQ.js +0 -1
- package/public/dist/assets/react-dom-DyUOYpVL.js +0 -1
- package/public/dist/assets/settings-W4KG9ivu.js +0 -1
- package/public/dist/assets/settings-WVGhtneN.js +0 -1
- package/public/dist/assets/settings-client-CmwRsVd1.js +0 -1
- package/public/dist/assets/settings-core-CgKGnMA5.js +0 -1
- package/public/dist/assets/settings-types-D3cd6SWy.js +0 -1
- package/public/dist/assets/shared-CiNP20HB.js +0 -1
- package/public/dist/assets/skills-Co7Mr-qP.js +0 -1
- package/public/dist/assets/slash-commands-BEr-vmIr.js +0 -1
- package/public/dist/assets/ui-TUyJsMUf.js +0 -1
- package/public/manager/src/settings/pages/components/EngineSubsection.tsx +0 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-sdk-version.js","sourceRoot":"","sources":["../../../../src/agent/runtime/claude-sdk-version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
// Extracted from spawnAgent (src/agent/spawn.ts). Body moved verbatim; the two
|
|
2
|
+
// destructuring lines bind the same names the branch read from spawnAgent scope.
|
|
3
|
+
import { broadcast } from '../../core/bus.js';
|
|
4
|
+
import { settings } from '../../core/config.js';
|
|
5
|
+
import { clearEmployeeSession, insertMessage } from '../../core/db.js';
|
|
6
|
+
import { stripUndefined } from '../../core/strip-undefined.js';
|
|
7
|
+
import { appendTraceEvent, finalizeTraceRun, stampTraceTool, startTraceRun } from '../../trace/store.js';
|
|
8
|
+
import { loadCatalogEfforts, resolveCatalogPath, validateModelEffort } from '../codex-app-catalog.js';
|
|
9
|
+
import { CodexAppClient, CodexSteerError, isRecoverableResumeError } from '../codex-app-client.js';
|
|
10
|
+
import { applyCodexAppTextEvent, listenCodexAppTurnAdapter } from '../codex-app-events.js';
|
|
11
|
+
import { CodexHostGenerationStaleError, acquireCodexAppLane, prepareCodexAppHost } from '../codex-host-pool.js';
|
|
12
|
+
import { appendAssistantRawText, emitAgentTool } from '../events/helpers.js';
|
|
13
|
+
import { handleAgentExit } from '../lifecycle-handler.js';
|
|
14
|
+
import { clearLiveRun, getLiveRun, replaceLiveRunTools, setLiveRunTraceId } from '../live-run-state.js';
|
|
15
|
+
import { withSteerContext } from '../prompt-context.js';
|
|
16
|
+
import { acquireCodexAppRuntime } from '../runtime-pool.js';
|
|
17
|
+
import { CodexProjection } from '../runtime/codex-projection.js';
|
|
18
|
+
import { RuntimeProjection } from '../runtime/projection.js';
|
|
19
|
+
import { persistMainSession } from '../session-persistence.js';
|
|
20
|
+
import { detectSmokeResponse } from '../smoke-detector.js';
|
|
21
|
+
import { settleExit } from './exit-settle.js';
|
|
22
|
+
import { isLifecycleSteerReason } from './kill-reason.js';
|
|
23
|
+
import { FALLBACK_MAX_RETRIES } from './queue.js';
|
|
24
|
+
import { shouldEmitHeartbeat } from './resume.js';
|
|
25
|
+
import { attachWatchdog } from '../watchdog.js';
|
|
26
|
+
import crypto from 'node:crypto';
|
|
27
|
+
import { stripSkillMentionBlock } from '../../core/skill-mentions.js';
|
|
28
|
+
export function runCodexAppBackend(backendLocals, backendHost) {
|
|
29
|
+
const { agentLabel, cfg, chatSessionId, cli, codexMultiplexMain, currentBucket, detected, effectiveLiveScope, effort, empSid, empTag, forceNew, historyBlock, isResume, liveScope, mainManaged, mainRun, model, opts, origin, ownerGeneration, parentLiveScopeForChild, persistenceOwner, prompt, resolve, resultPromise, resumeKey, resumeSessionId, runPin, runtimeTransport, scopeKey, slackToolGrant, spawnCwd, spawnEnv, sysPrompt, traceAudience } = backendLocals;
|
|
30
|
+
const { CODEX_APP_ACQUIRE_RETRY_BACKOFF_MAX_MS, DEFAULT_CODEX_APP_ACQUIRE_WAIT_MS, DEFAULT_CODEX_APP_TURN_ABS_MS, DEFAULT_CODEX_APP_TURN_IDLE_MS, activeMainProcesses, activeProcesses, appendParentLiveRunTool, broadcastAgentOutput, cleanupEmployeeTmpDir, configuredPositiveMs, consumeKillReason, processQueue, queueCtrl, registerActiveProcess, releaseMainRun, stoppedBeforeStart } = backendHost;
|
|
31
|
+
const catalogPath = resolveCatalogPath();
|
|
32
|
+
if (catalogPath) {
|
|
33
|
+
const verdict = validateModelEffort(model, effort, loadCatalogEfforts(catalogPath));
|
|
34
|
+
if (!verdict.ok) {
|
|
35
|
+
throw new Error(`[codex-app] ${verdict.error}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (mainManaged && !opts.internal && !opts._skipInsert) {
|
|
39
|
+
insertMessage.run('user', stripSkillMentionBlock(prompt), cli, model, settings["workingDir"] || null, chatSessionId);
|
|
40
|
+
}
|
|
41
|
+
if (!opts.internal)
|
|
42
|
+
broadcast('agent_status', { status: 'running', cli, agentId: agentLabel, ...empTag }, traceAudience);
|
|
43
|
+
const traceRunId = startTraceRun({ cli, model, workingDir: settings["workingDir"] || null, agentLabel, audience: traceAudience, sessionId: chatSessionId, scopeKey });
|
|
44
|
+
if (mainManaged && !opts.internal)
|
|
45
|
+
setLiveRunTraceId(liveScope, traceRunId);
|
|
46
|
+
const ctx = {
|
|
47
|
+
fullText: '', traceLog: [], toolLog: [], seenToolKeys: new Set(),
|
|
48
|
+
hasClaudeStreamEvents: false, sessionId: null, cost: null,
|
|
49
|
+
turns: null, duration: null, tokens: null, stderrBuf: '',
|
|
50
|
+
thinkingBuf: '',
|
|
51
|
+
runStartedAt: Date.now(),
|
|
52
|
+
...(opts.requestId ? { requestId: opts.requestId } : {}),
|
|
53
|
+
...(origin ? { origin } : {}),
|
|
54
|
+
liveScope: effectiveLiveScope,
|
|
55
|
+
parentLiveScope: parentLiveScopeForChild,
|
|
56
|
+
traceRunId,
|
|
57
|
+
traceAudience,
|
|
58
|
+
activityIdentity: { sessionId: chatSessionId, scope: scopeKey },
|
|
59
|
+
};
|
|
60
|
+
const activity = new RuntimeProjection({
|
|
61
|
+
runId: traceRunId, sessionId: chatSessionId, scope: scopeKey,
|
|
62
|
+
turnId: traceRunId, audience: traceAudience,
|
|
63
|
+
...(opts.runtimeParentItemId ? { parentItemId: opts.runtimeParentItemId } : {}),
|
|
64
|
+
});
|
|
65
|
+
const codexProjection = new CodexProjection(activity);
|
|
66
|
+
activity.start('codex-app');
|
|
67
|
+
function flushCodexAppThinking() {
|
|
68
|
+
if (!ctx.thinkingBuf)
|
|
69
|
+
return;
|
|
70
|
+
const merged = ctx.thinkingBuf.trim();
|
|
71
|
+
if (merged) {
|
|
72
|
+
const singleLine = merged.replace(/\s+/g, ' ').trim();
|
|
73
|
+
const label = singleLine.length > 120 ? `${singleLine.slice(0, 119)}…` : singleLine;
|
|
74
|
+
console.log(` 💭 ${label}`);
|
|
75
|
+
const tool = { icon: '💭', label, toolType: 'thinking', detail: merged };
|
|
76
|
+
stampTraceTool(tool, ctx, 'thinking');
|
|
77
|
+
ctx.toolLog.push(tool);
|
|
78
|
+
if (ctx.liveScope)
|
|
79
|
+
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
80
|
+
appendParentLiveRunTool(ctx, tool);
|
|
81
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
82
|
+
}
|
|
83
|
+
ctx.thinkingBuf = '';
|
|
84
|
+
}
|
|
85
|
+
let lastVisibleBroadcastTs = Date.now();
|
|
86
|
+
let heartbeatSent = false;
|
|
87
|
+
let turnCompleted = false;
|
|
88
|
+
let turnReportedFailure = false;
|
|
89
|
+
let markCodexProgress = () => { };
|
|
90
|
+
let settleTurn;
|
|
91
|
+
let rejectTurn;
|
|
92
|
+
const turnDone = new Promise((resolveTurn, rejectTurnPromise) => {
|
|
93
|
+
settleTurn = resolveTurn;
|
|
94
|
+
rejectTurn = rejectTurnPromise;
|
|
95
|
+
});
|
|
96
|
+
const consumeCodexAppEvent = (method, parsed) => {
|
|
97
|
+
if (!parsed) {
|
|
98
|
+
if (method === 'turn/completed')
|
|
99
|
+
settleTurn();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (parsed.flushThinking) {
|
|
103
|
+
flushCodexAppThinking();
|
|
104
|
+
}
|
|
105
|
+
if (parsed.tool) {
|
|
106
|
+
const parsedTool = parsed.tool;
|
|
107
|
+
if (parsedTool.icon === '💭') {
|
|
108
|
+
ctx.thinkingBuf += parsedTool.detail || parsedTool.label;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
flushCodexAppThinking();
|
|
112
|
+
const key = `${parsedTool.icon}:${parsedTool.label}:${parsedTool.stepRef || ''}:${parsedTool.status || ''}`;
|
|
113
|
+
if (!ctx.seenToolKeys.has(key)) {
|
|
114
|
+
ctx.seenToolKeys.add(key);
|
|
115
|
+
stampTraceTool(parsedTool, ctx, parsedTool.toolType || 'tool');
|
|
116
|
+
ctx.toolLog.push(parsedTool);
|
|
117
|
+
if (ctx.liveScope)
|
|
118
|
+
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
119
|
+
appendParentLiveRunTool(ctx, parsedTool);
|
|
120
|
+
emitAgentTool(ctx, agentLabel, parsedTool, empTag);
|
|
121
|
+
lastVisibleBroadcastTs = Date.now();
|
|
122
|
+
heartbeatSent = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Sticky channel/item bookkeeping and the durable-vs-live decision live
|
|
126
|
+
// in applyCodexAppTextEvent so they can be tested without a live runtime.
|
|
127
|
+
if (parsed.text)
|
|
128
|
+
flushCodexAppThinking();
|
|
129
|
+
const textDecision = applyCodexAppTextEvent(ctx, parsed);
|
|
130
|
+
if (textDecision.durable) {
|
|
131
|
+
// codex-app streams item/agentMessage/delta at TOKEN granularity;
|
|
132
|
+
// the segment formatter would inject "\n- " between unjoined
|
|
133
|
+
// tokens ("이"+"지만" → "이\n- 지만"). Raw-append like the plain
|
|
134
|
+
// `claude` text_delta path (events/index.ts) instead.
|
|
135
|
+
const segment = appendAssistantRawText(ctx, textDecision.durable);
|
|
136
|
+
if (segment) {
|
|
137
|
+
broadcastAgentOutput(ctx, agentLabel, cli, segment, empTag, traceAudience);
|
|
138
|
+
lastVisibleBroadcastTs = Date.now();
|
|
139
|
+
heartbeatSent = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (textDecision.live) {
|
|
143
|
+
// Commentary is a transient progress update, not part of the durable
|
|
144
|
+
// response. Broadcast it for live UI preview but keep it out of
|
|
145
|
+
// fullText — that way agent_done (and therefore Slack/Telegram/
|
|
146
|
+
// Discord delivery) contains only the final answer.
|
|
147
|
+
broadcastAgentOutput(ctx, agentLabel, cli, textDecision.live, empTag, traceAudience);
|
|
148
|
+
}
|
|
149
|
+
if (parsed.sessionId && !ctx.sessionId) {
|
|
150
|
+
ctx.sessionId = parsed.sessionId;
|
|
151
|
+
}
|
|
152
|
+
if (parsed.tokens) {
|
|
153
|
+
ctx.tokens = parsed.tokens;
|
|
154
|
+
}
|
|
155
|
+
if (parsed.turnStatus && parsed.turnStatus !== 'completed') {
|
|
156
|
+
console.warn(`[codex-app:turn] final status: ${parsed.turnStatus}`);
|
|
157
|
+
turnReportedFailure = true;
|
|
158
|
+
}
|
|
159
|
+
opts.lifecycle?.onActivity?.('codex-app');
|
|
160
|
+
if (method === 'turn/completed')
|
|
161
|
+
settleTurn();
|
|
162
|
+
};
|
|
163
|
+
const handleStderr = (text) => {
|
|
164
|
+
appendTraceEvent({ runId: ctx.traceRunId, source: 'stderr', eventType: 'stderr', raw: text });
|
|
165
|
+
if (ctx.stderrBuf.length < 4000) {
|
|
166
|
+
ctx.stderrBuf += text + '\n';
|
|
167
|
+
}
|
|
168
|
+
opts.lifecycle?.onActivity?.('stderr');
|
|
169
|
+
if (shouldEmitHeartbeat(lastVisibleBroadcastTs, heartbeatSent)) {
|
|
170
|
+
heartbeatSent = true;
|
|
171
|
+
const elapsed = Math.round((Date.now() - lastVisibleBroadcastTs) / 1000);
|
|
172
|
+
console.log(` ⏳ agent active (no visible event for ${elapsed}s)`);
|
|
173
|
+
emitAgentTool(ctx, agentLabel, {
|
|
174
|
+
icon: '⏳',
|
|
175
|
+
label: 'working... (no visible progress)',
|
|
176
|
+
}, empTag);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const effectiveFastMode = cfg.fastMode ?? settings["perCli"]?.["codex"]?.fastMode ?? false;
|
|
180
|
+
const runCodexAppTurn = async (appClient, lease, laneScope) => {
|
|
181
|
+
const child = appClient.proc;
|
|
182
|
+
if (!child)
|
|
183
|
+
throw new Error('Codex AppServer process was not created');
|
|
184
|
+
if (mainManaged)
|
|
185
|
+
mainRun.process = child;
|
|
186
|
+
else
|
|
187
|
+
registerActiveProcess(agentLabel, child);
|
|
188
|
+
if (!opts.internal)
|
|
189
|
+
broadcast('agent_status', { running: true, agentId: agentLabel, cli, ...empTag });
|
|
190
|
+
const processExit = { value: null };
|
|
191
|
+
// The one documented cross-runtime exception. codex-app keeps a 300s idle
|
|
192
|
+
// bound where the shared watchdog defaults to 90s, because an appserver turn
|
|
193
|
+
// reports sparse STRUCTURED progress instead of a continuous stream and
|
|
194
|
+
// nothing here counts stdout as liveness. settings.agentTimeout deliberately
|
|
195
|
+
// does not narrow it either: a global idleMs written for print CLIs would
|
|
196
|
+
// cut the default runtime's bound by two thirds. The env overrides remain
|
|
197
|
+
// the supported knob and are mapped into the watchdog config below.
|
|
198
|
+
const idleMs = configuredPositiveMs(process.env["CODEX_APP_TURN_IDLE_MS"], DEFAULT_CODEX_APP_TURN_IDLE_MS);
|
|
199
|
+
const absoluteMs = configuredPositiveMs(process.env["CODEX_APP_TURN_ABS_MS"], DEFAULT_CODEX_APP_TURN_ABS_MS);
|
|
200
|
+
let watchdogCancel = null;
|
|
201
|
+
let leaseCancel = null;
|
|
202
|
+
const requestLeaseCancel = () => {
|
|
203
|
+
if (!lease) {
|
|
204
|
+
appClient.kill();
|
|
205
|
+
return Promise.resolve();
|
|
206
|
+
}
|
|
207
|
+
leaseCancel ??= lease.cancel().catch((err) => {
|
|
208
|
+
console.warn('[codex-app:turn] cancel failed:', err.message);
|
|
209
|
+
});
|
|
210
|
+
return leaseCancel;
|
|
211
|
+
};
|
|
212
|
+
const cancelHook = (_reason) => { void requestLeaseCancel(); };
|
|
213
|
+
if (lease && mainRun)
|
|
214
|
+
mainRun.cancelTurn = cancelHook;
|
|
215
|
+
// Same-turn steer (turn/steer) for the duration of THIS turn only:
|
|
216
|
+
// installed and torn down with cancelHook so capability reads never
|
|
217
|
+
// outlive the steerable window.
|
|
218
|
+
const steerHook = async (text) => {
|
|
219
|
+
try {
|
|
220
|
+
await appClient.steerTurn(laneScope, text, { clientUserMessageId: crypto.randomUUID() });
|
|
221
|
+
return 'steered';
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
if (err instanceof CodexSteerError) {
|
|
225
|
+
// review/compact turns reject steer; a mismatched/finished
|
|
226
|
+
// turn raced us. Both are queue-fallback territory.
|
|
227
|
+
return err.code === 'not-steerable' ? 'rejected' : 'unavailable';
|
|
228
|
+
}
|
|
229
|
+
throw err;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
if (mainRun)
|
|
233
|
+
mainRun.steerTurnInBand = steerHook;
|
|
234
|
+
// The same watchdog every other runtime uses. The bespoke timer pair this
|
|
235
|
+
// replaces never set `ctx.stallReason`, and that field is the ONLY trigger
|
|
236
|
+
// for the #405 truncation notice (`error-classifier.ts:149-159`). So on the
|
|
237
|
+
// DEFAULT runtime a timeout surfaced as a generic error and the #405 fix
|
|
238
|
+
// never applied to the path most turns actually take.
|
|
239
|
+
const turnWatchdog = attachWatchdog(child, agentLabel, reason => {
|
|
240
|
+
if (watchdogCancel)
|
|
241
|
+
return;
|
|
242
|
+
console.warn(`[codex-app:turn] watchdog stall (${reason}, idleMs=${idleMs}, absoluteMs=${absoluteMs})`);
|
|
243
|
+
ctx.stallReason = reason;
|
|
244
|
+
watchdogCancel = requestLeaseCancel();
|
|
245
|
+
rejectTurn(new Error(`Codex AppServer turn watchdog timeout: ${reason}`));
|
|
246
|
+
}, {
|
|
247
|
+
// This child's stdout IS the JSON-RPC stream and readline already owns
|
|
248
|
+
// it, so counting raw traffic as liveness would keep a wedged turn
|
|
249
|
+
// looking alive forever. Progress comes from the turn adapter instead.
|
|
250
|
+
observeStdio: false,
|
|
251
|
+
// The two bespoke timers map onto the watchdog's two real gates:
|
|
252
|
+
// markProgress slides absoluteDeadline to now+absoluteMs, giving
|
|
253
|
+
// "no progress for idleMs", capped at startedAt+absoluteHardCapMs,
|
|
254
|
+
// giving "total run beyond absoluteMs". firstProgressMs bounds a turn
|
|
255
|
+
// that never reports at all.
|
|
256
|
+
firstProgressMs: idleMs, idleMs, absoluteMs: idleMs, absoluteHardCapMs: absoluteMs,
|
|
257
|
+
});
|
|
258
|
+
ctx.stallWatchdog = turnWatchdog;
|
|
259
|
+
markCodexProgress = () => { turnWatchdog.markProgress(); };
|
|
260
|
+
const listener = listenCodexAppTurnAdapter(appClient, lease, laneScope, ctx, {
|
|
261
|
+
onProgress: () => { markCodexProgress(); },
|
|
262
|
+
onRawNotification: (method, params) => {
|
|
263
|
+
if (method === 'turn/completed' || method === 'turn/started' || method === 'error') {
|
|
264
|
+
console.log(`[codex-app:notify] ${method}`);
|
|
265
|
+
}
|
|
266
|
+
appendTraceEvent({ runId: ctx.traceRunId, source: 'codex_app_raw', eventType: method, raw: params });
|
|
267
|
+
},
|
|
268
|
+
onDiagnosticNotification: (entry) => {
|
|
269
|
+
appendTraceEvent({
|
|
270
|
+
runId: ctx.traceRunId,
|
|
271
|
+
source: 'codex_app_raw',
|
|
272
|
+
eventType: 'unrouted-notification',
|
|
273
|
+
raw: entry,
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
onEvent: consumeCodexAppEvent,
|
|
277
|
+
onProjectionNotification: (method, params, parsed) => {
|
|
278
|
+
codexProjection.observe(method, params, parsed, ctx.codexAppActiveChannel || '');
|
|
279
|
+
},
|
|
280
|
+
onStderr: handleStderr,
|
|
281
|
+
onExit: (code, signal) => {
|
|
282
|
+
processExit.value = { code, signal };
|
|
283
|
+
rejectTurn(new Error(`Codex AppServer exited (code=${code}, signal=${signal})`));
|
|
284
|
+
},
|
|
285
|
+
onError: rejectTurn,
|
|
286
|
+
onInterruptFailed: (err) => {
|
|
287
|
+
console.warn(`[codex-app:interrupt] ${err.message}`);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
try {
|
|
291
|
+
if (lease) {
|
|
292
|
+
ctx.sessionId = lease.threadId;
|
|
293
|
+
console.log(`[codex-app:pool] thread=${lease.threadId.slice(0, 12)}... reused=${lease.reused} resumed=${lease.resumedThread}`);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
const initResult = await appClient.initialize();
|
|
297
|
+
if (process.env["DEBUG"])
|
|
298
|
+
console.log('[codex-app:init]', JSON.stringify(initResult).slice(0, 200));
|
|
299
|
+
const threadOptions = {
|
|
300
|
+
model,
|
|
301
|
+
effort,
|
|
302
|
+
cwd: spawnCwd,
|
|
303
|
+
fastMode: effectiveFastMode,
|
|
304
|
+
instructions: sysPrompt,
|
|
305
|
+
};
|
|
306
|
+
if (isResume && resumeSessionId) {
|
|
307
|
+
try {
|
|
308
|
+
await appClient.resumeThread(laneScope, resumeSessionId, threadOptions);
|
|
309
|
+
console.log(`[codex-app:session] resumeThread OK: ${resumeSessionId.slice(0, 12)}...`);
|
|
310
|
+
}
|
|
311
|
+
catch (resumeErr) {
|
|
312
|
+
const message = resumeErr.message || '';
|
|
313
|
+
if (!isRecoverableResumeError(message))
|
|
314
|
+
throw resumeErr;
|
|
315
|
+
console.warn(`[codex-app:session] resumeThread FAILED (recoverable): ${message} — starting new thread`);
|
|
316
|
+
if (empSid && opts.agentId)
|
|
317
|
+
clearEmployeeSession.run(opts.agentId);
|
|
318
|
+
await appClient.startThread(laneScope, threadOptions);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
await appClient.startThread(laneScope, threadOptions);
|
|
323
|
+
}
|
|
324
|
+
ctx.sessionId = appClient.getThreadId(laneScope) ?? '';
|
|
325
|
+
}
|
|
326
|
+
const shouldPrependHistory = lease
|
|
327
|
+
? !(lease.resumedThread || lease.reused)
|
|
328
|
+
: !(isResume && Boolean(resumeSessionId));
|
|
329
|
+
const codexAppPrompt = (shouldPrependHistory && historyBlock)
|
|
330
|
+
? `${historyBlock}\n\n[User Message]\n${prompt}`
|
|
331
|
+
: prompt;
|
|
332
|
+
const codexAppPromptWithSteer = withSteerContext(codexAppPrompt, opts.steerContext);
|
|
333
|
+
const startTurn = appClient.startTurn(laneScope, codexAppPromptWithSteer);
|
|
334
|
+
await Promise.race([startTurn, turnDone]);
|
|
335
|
+
await turnDone;
|
|
336
|
+
turnCompleted = !turnReportedFailure;
|
|
337
|
+
flushCodexAppThinking();
|
|
338
|
+
const persistedThreadId = lease?.threadId ?? appClient.getThreadId(laneScope);
|
|
339
|
+
if (persistedThreadId && persistMainSession(stripUndefined({
|
|
340
|
+
persistenceOwner,
|
|
341
|
+
scopeKey,
|
|
342
|
+
forceNew,
|
|
343
|
+
employeeSessionId: empSid,
|
|
344
|
+
sessionId: persistedThreadId,
|
|
345
|
+
isFallback: opts._isFallback,
|
|
346
|
+
cli,
|
|
347
|
+
model,
|
|
348
|
+
resumeKey,
|
|
349
|
+
effort: cfg.effort || '',
|
|
350
|
+
skipSessionPersist: opts._skipSessionPersist === true,
|
|
351
|
+
...(lease?.bucketKey ? { codexAppBucket: lease.bucketKey } : {}),
|
|
352
|
+
// With multiplex off there is no lease bucket key, and without this the
|
|
353
|
+
// save lands on the bare `codex-app` row that belongs to the default
|
|
354
|
+
// session. codex-app is the default runtime, so that is the common case.
|
|
355
|
+
runtimeTransport,
|
|
356
|
+
scopedBucket: currentBucket,
|
|
357
|
+
}))) {
|
|
358
|
+
console.log(`[jaw:session] saved ${cli} session=${persistedThreadId.slice(0, 12)}... (pre-shutdown)`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
362
|
+
console.error(`[codex-app:error] ${err.message}`);
|
|
363
|
+
if (ctx.stderrBuf.length < 4000)
|
|
364
|
+
ctx.stderrBuf += err.message;
|
|
365
|
+
if (!lease)
|
|
366
|
+
appClient.kill();
|
|
367
|
+
}
|
|
368
|
+
finally {
|
|
369
|
+
turnWatchdog.stop();
|
|
370
|
+
markCodexProgress = () => { };
|
|
371
|
+
if (watchdogCancel)
|
|
372
|
+
await watchdogCancel;
|
|
373
|
+
if (mainRun?.cancelTurn === cancelHook)
|
|
374
|
+
delete mainRun.cancelTurn;
|
|
375
|
+
if (mainRun?.steerTurnInBand === steerHook)
|
|
376
|
+
delete mainRun.steerTurnInBand;
|
|
377
|
+
listener.dispose();
|
|
378
|
+
if (lease)
|
|
379
|
+
lease.release();
|
|
380
|
+
else {
|
|
381
|
+
await appClient.closeGracefully();
|
|
382
|
+
appClient.cleanup();
|
|
383
|
+
cleanupEmployeeTmpDir(spawnCwd, settings["workingDir"], agentLabel);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// A turn that never completed is a failure even when the process it
|
|
387
|
+
// was running on exited cleanly. Trusting the child's status here
|
|
388
|
+
// reports success for a turn that produced nothing, which is exactly
|
|
389
|
+
// what happens when a shared host is closed mid-turn.
|
|
390
|
+
const exitCode = turnCompleted ? 0 : (processExit.value?.code || 1);
|
|
391
|
+
opts.lifecycle?.onExit?.(exitCode);
|
|
392
|
+
const killReason = consumeKillReason(child.pid);
|
|
393
|
+
if (processExit.value && processExit.value.code !== 0 && !killReason) {
|
|
394
|
+
console.warn(`[codex-app:unexpected-exit] code=${processExit.value.code} signal=${processExit.value.signal} threadId=${ctx.sessionId || 'none'}`);
|
|
395
|
+
}
|
|
396
|
+
const wasKilled = !!killReason;
|
|
397
|
+
const wasSteer = isLifecycleSteerReason(killReason);
|
|
398
|
+
flushCodexAppThinking();
|
|
399
|
+
const smokeResult = detectSmokeResponse(ctx.fullText, ctx.toolLog, exitCode, cli);
|
|
400
|
+
await handleAgentExit({
|
|
401
|
+
onRuntimeEnd: (end) => { activity.close(end); },
|
|
402
|
+
ctx, code: exitCode, cli, model, agentLabel, mainManaged, origin,
|
|
403
|
+
killReason,
|
|
404
|
+
resumeKey,
|
|
405
|
+
prompt, opts, cfg, ownerGeneration, persistenceOwner, forceNew, empSid,
|
|
406
|
+
isResume, wasKilled, wasSteer, smokeResult,
|
|
407
|
+
effortDefault: '', costLine: '',
|
|
408
|
+
resolve: resolve,
|
|
409
|
+
activeProcesses,
|
|
410
|
+
scopeKey,
|
|
411
|
+
runtimeTransport,
|
|
412
|
+
scopedBucket: currentBucket,
|
|
413
|
+
chatSessionId,
|
|
414
|
+
...(lease?.bucketKey ? { codexAppBucket: lease.bucketKey } : {}),
|
|
415
|
+
childProcess: child,
|
|
416
|
+
releaseMainRun,
|
|
417
|
+
retryState: queueCtrl.retryStateForScope(scopeKey),
|
|
418
|
+
fallbackState: queueCtrl.fallbackStateForScope(scopeKey),
|
|
419
|
+
fallbackMaxRetries: FALLBACK_MAX_RETRIES,
|
|
420
|
+
processQueue,
|
|
421
|
+
}).catch((err) => {
|
|
422
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Lifecycle failed' });
|
|
423
|
+
console.error('[jaw:lifecycle] handleAgentExit failed (codex-app):', err.message);
|
|
424
|
+
}).finally(() => settleExit(scopeKey));
|
|
425
|
+
};
|
|
426
|
+
if (opts.agentId) {
|
|
427
|
+
const employeeLaneScope = `employee:${opts.agentId}`;
|
|
428
|
+
const appClient = new CodexAppClient({
|
|
429
|
+
binary: detected.path || 'codex', workDir: spawnCwd, env: spawnEnv,
|
|
430
|
+
});
|
|
431
|
+
let child;
|
|
432
|
+
try {
|
|
433
|
+
appClient.spawn();
|
|
434
|
+
if (!appClient.proc)
|
|
435
|
+
throw new Error('Codex AppServer process was not created');
|
|
436
|
+
child = appClient.proc;
|
|
437
|
+
}
|
|
438
|
+
catch (error) {
|
|
439
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Codex process creation failed' });
|
|
440
|
+
finalizeTraceRun(traceRunId, 'error', 'Codex process creation failed');
|
|
441
|
+
cleanupEmployeeTmpDir(spawnCwd, settings["workingDir"], agentLabel);
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
444
|
+
void runCodexAppTurn(appClient, null, employeeLaneScope);
|
|
445
|
+
return { child, promise: resultPromise };
|
|
446
|
+
}
|
|
447
|
+
mainRun.starting = true;
|
|
448
|
+
let codexAcquireStopReason;
|
|
449
|
+
const cancelCodexAcquire = (reason) => { codexAcquireStopReason ??= reason; };
|
|
450
|
+
const releaseCodexAcquireHook = () => {
|
|
451
|
+
if (mainRun.cancelPending === cancelCodexAcquire)
|
|
452
|
+
delete mainRun.cancelPending;
|
|
453
|
+
};
|
|
454
|
+
mainRun.cancelPending = cancelCodexAcquire;
|
|
455
|
+
const acquireCodexAppForTurn = async () => {
|
|
456
|
+
const acquireWasCancelled = () => codexAcquireStopReason !== undefined || activeMainProcesses.get(scopeKey) !== mainRun;
|
|
457
|
+
try {
|
|
458
|
+
if (!codexMultiplexMain) {
|
|
459
|
+
const lease = await acquireCodexAppRuntime({
|
|
460
|
+
binary: detected.path || 'codex', env: spawnEnv,
|
|
461
|
+
route: 'legacy',
|
|
462
|
+
key: {
|
|
463
|
+
scopeKey,
|
|
464
|
+
cwd: spawnCwd, model, effort, fastMode: effectiveFastMode,
|
|
465
|
+
},
|
|
466
|
+
storedThreadId: resumeSessionId || null,
|
|
467
|
+
instructions: sysPrompt,
|
|
468
|
+
forceNew: forceNew || Boolean(slackToolGrant),
|
|
469
|
+
});
|
|
470
|
+
return { kind: 'lease', lease };
|
|
471
|
+
}
|
|
472
|
+
const waitMs = configuredPositiveMs(process.env["CODEX_APP_ACQUIRE_WAIT_MS"], DEFAULT_CODEX_APP_ACQUIRE_WAIT_MS);
|
|
473
|
+
const deadlineAt = Date.now() + waitMs;
|
|
474
|
+
let lastStaleError = null;
|
|
475
|
+
let staleAttempts = 0;
|
|
476
|
+
const deadlineError = (stage) => lastStaleError
|
|
477
|
+
?? new Error(`Codex App ${stage} timed out after ${waitMs}ms`);
|
|
478
|
+
const awaitWithinDeadline = async (stage, pending, onLateValue) => {
|
|
479
|
+
let deadlineWon = false;
|
|
480
|
+
let timeout;
|
|
481
|
+
void pending.then((value) => {
|
|
482
|
+
if (deadlineWon)
|
|
483
|
+
onLateValue?.(value);
|
|
484
|
+
}, () => { });
|
|
485
|
+
const remainingMs = deadlineAt - Date.now();
|
|
486
|
+
if (remainingMs <= 0) {
|
|
487
|
+
deadlineWon = true;
|
|
488
|
+
throw deadlineError(stage);
|
|
489
|
+
}
|
|
490
|
+
const deadline = new Promise((_resolveDeadline, rejectDeadline) => {
|
|
491
|
+
timeout = setTimeout(() => {
|
|
492
|
+
deadlineWon = true;
|
|
493
|
+
rejectDeadline(deadlineError(stage));
|
|
494
|
+
}, remainingMs);
|
|
495
|
+
});
|
|
496
|
+
try {
|
|
497
|
+
return await Promise.race([pending, deadline]);
|
|
498
|
+
}
|
|
499
|
+
finally {
|
|
500
|
+
if (timeout)
|
|
501
|
+
clearTimeout(timeout);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
for (;;) {
|
|
505
|
+
if (acquireWasCancelled())
|
|
506
|
+
return { kind: 'cancelled', reason: codexAcquireStopReason };
|
|
507
|
+
// Check the budget before spawning more work. awaitWithinDeadline()
|
|
508
|
+
// only measures what remains once the promise already exists, so a
|
|
509
|
+
// backoff that consumed the last of the budget would still get to
|
|
510
|
+
// start one more prepare.
|
|
511
|
+
if (deadlineAt - Date.now() <= 0)
|
|
512
|
+
throw lastStaleError ?? deadlineError('prepare');
|
|
513
|
+
try {
|
|
514
|
+
const prepared = await awaitWithinDeadline('prepare', prepareCodexAppHost({
|
|
515
|
+
binary: detected.path || 'codex', cwd: spawnCwd,
|
|
516
|
+
fastMode: effectiveFastMode, env: spawnEnv, model, effort,
|
|
517
|
+
}));
|
|
518
|
+
if (acquireWasCancelled())
|
|
519
|
+
return { kind: 'cancelled', reason: codexAcquireStopReason };
|
|
520
|
+
const lease = await awaitWithinDeadline('acquire', acquireCodexAppLane(prepared, {
|
|
521
|
+
scopeKey,
|
|
522
|
+
bucketKey: currentBucket,
|
|
523
|
+
storedThreadId: resumeSessionId || null,
|
|
524
|
+
instructions: sysPrompt,
|
|
525
|
+
forceNew: forceNew || Boolean(slackToolGrant),
|
|
526
|
+
waitMs: deadlineAt - Date.now(),
|
|
527
|
+
}), (lateLease) => { lateLease.release(); });
|
|
528
|
+
if (acquireWasCancelled()) {
|
|
529
|
+
lease.release();
|
|
530
|
+
return { kind: 'cancelled', reason: codexAcquireStopReason };
|
|
531
|
+
}
|
|
532
|
+
return { kind: 'lease', lease };
|
|
533
|
+
}
|
|
534
|
+
catch (err) {
|
|
535
|
+
if (!(err instanceof CodexHostGenerationStaleError))
|
|
536
|
+
throw err;
|
|
537
|
+
lastStaleError = err;
|
|
538
|
+
if (acquireWasCancelled())
|
|
539
|
+
return { kind: 'cancelled', reason: codexAcquireStopReason };
|
|
540
|
+
const remainingMs = deadlineAt - Date.now();
|
|
541
|
+
if (remainingMs <= 0)
|
|
542
|
+
throw lastStaleError;
|
|
543
|
+
staleAttempts += 1;
|
|
544
|
+
const backoffMs = Math.min(remainingMs, CODEX_APP_ACQUIRE_RETRY_BACKOFF_MAX_MS, 25 * staleAttempts);
|
|
545
|
+
await new Promise((done) => { setTimeout(done, backoffMs); });
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
finally {
|
|
550
|
+
// The next promise continuation still owns the acquired lease.
|
|
551
|
+
// Keep its cancellation hook until it hands off or abandons it.
|
|
552
|
+
mainRun.starting = false;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
// A run that never started a turn owns nothing but its own map slot.
|
|
556
|
+
// releaseMainRun() matches on (process, ownerGeneration), and a pending
|
|
557
|
+
// run has process=null while sharing the global generation with whatever
|
|
558
|
+
// replaced it, so calling it here would delete the replacement's entry.
|
|
559
|
+
// Compare the captured object instead and only drop our own slot.
|
|
560
|
+
const abandonTurn = (lease) => {
|
|
561
|
+
lease?.release();
|
|
562
|
+
activity.close({ kind: 'turn-end', status: 'stopped', finalText: null });
|
|
563
|
+
finalizeTraceRun(traceRunId, 'interrupted');
|
|
564
|
+
if (!activeMainProcesses.has(scopeKey) || activeMainProcesses.get(scopeKey) === mainRun) {
|
|
565
|
+
const currentLive = getLiveRun(liveScope);
|
|
566
|
+
const ownsLive = currentLive.traceRunId === traceRunId;
|
|
567
|
+
if (ownsLive)
|
|
568
|
+
clearLiveRun(liveScope);
|
|
569
|
+
if (ownsLive || (!currentLive.running && currentLive.traceRunId === undefined)) {
|
|
570
|
+
broadcast('agent_status', { running: false, agentId: agentLabel });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
resolve(stoppedBeforeStart(codexAcquireStopReason, traceRunId));
|
|
574
|
+
if (activeMainProcesses.get(scopeKey) === mainRun)
|
|
575
|
+
activeMainProcesses.delete(scopeKey);
|
|
576
|
+
void processQueue(scopeKey);
|
|
577
|
+
};
|
|
578
|
+
void acquireCodexAppForTurn().then(async (outcome) => {
|
|
579
|
+
releaseCodexAcquireHook();
|
|
580
|
+
if (outcome.kind === 'cancelled') {
|
|
581
|
+
abandonTurn(null);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const lease = outcome.lease;
|
|
585
|
+
if (codexAcquireStopReason !== undefined || activeMainProcesses.get(scopeKey) !== mainRun) {
|
|
586
|
+
abandonTurn(lease);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
await runCodexAppTurn(lease.client, lease, lease.laneScope);
|
|
590
|
+
}).catch((err) => {
|
|
591
|
+
releaseCodexAcquireHook();
|
|
592
|
+
if (codexAcquireStopReason !== undefined) {
|
|
593
|
+
abandonTurn(null);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
console.error(`[codex-app:pool] acquire failed: ${err.message}`);
|
|
597
|
+
activity.close({ kind: 'turn-end', status: 'error', finalText: null, error: 'Codex acquisition failed' });
|
|
598
|
+
try {
|
|
599
|
+
finalizeTraceRun(traceRunId, 'error', 'Codex acquisition failed');
|
|
600
|
+
}
|
|
601
|
+
catch {
|
|
602
|
+
console.warn('[runtime] Codex acquisition trace finalization failed');
|
|
603
|
+
}
|
|
604
|
+
const ownsRun = activeMainProcesses.get(scopeKey) === mainRun;
|
|
605
|
+
if (ownsRun) {
|
|
606
|
+
clearLiveRun(liveScope);
|
|
607
|
+
broadcast('agent_status', { running: false, agentId: agentLabel });
|
|
608
|
+
broadcast('agent_done', { ...runPin, text: `❌ Codex AppServer acquire failed: ${err.message}`, error: true, origin }, 'public');
|
|
609
|
+
releaseMainRun(scopeKey, null, ownerGeneration);
|
|
610
|
+
}
|
|
611
|
+
resolve({ text: '', code: 1 });
|
|
612
|
+
if (ownsRun) {
|
|
613
|
+
settleExit(scopeKey);
|
|
614
|
+
void processQueue(scopeKey);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
return { child: null, promise: resultPromise };
|
|
618
|
+
}
|
|
619
|
+
//# sourceMappingURL=backend-codex-app.js.map
|