agentroam-runtime-darwin-arm64 0.2.0-preview.80 → 0.2.0-preview.82
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/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +8 -8
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +5 -5
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/composer/route.js +1 -0
- package/runtime/.next/server/app/api/agent/composer/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +1 -1
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/calendar/route.js +2 -2
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/collaboration/route.js +2 -2
- package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
- package/runtime/.next/server/app/api/engine-threads.body +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/messaging/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/session-views/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
- package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/todos/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +4 -4
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +36 -35
- package/runtime/.next/server/chunks/5303.js +2 -2
- package/runtime/.next/server/chunks/5801.js +1 -1
- package/runtime/.next/server/chunks/9119.js +3 -3
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/app/web/{error-f313c4014e78cef5.js → error-828d278147a0619d.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +1 -0
- package/runtime/.next/static/chunks/app/web/{page-2e962377e57d3383.js → page-f008ab6dfeab7ce7.js} +1 -1
- package/runtime/.next/static/chunks/{main-68faabab5d101471.js → main-9c08f7656f9692e6.js} +1 -1
- package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
- package/runtime/lib/remote-control/application/paced-video-sender.mjs +20 -1
- package/runtime/lib/remote-control/application/remote-video-session.mjs +18 -4
- package/runtime/lib/remote-control/helper-manager.mjs +36 -2
- package/runtime/lib/remote-control/infrastructure/native-video-encoder.mjs +15 -2
- package/runtime/lib/remote-control/infrastructure/werift-video-transport.mjs +3 -1
- package/runtime/lib/remote-control/macos-helper-app.mjs +85 -15
- package/runtime/lib/remote-control/macos-helper-permissions.mjs +113 -0
- package/runtime/lib/remote-control/remote-authorization.mjs +2 -2
- package/runtime/lib/remote-control/remote-video-signal.mjs +2 -0
- package/runtime/lib/todo-completion-worker.mjs +45 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/node_modules/.package-lock.json +129 -129
- package/runtime/node_modules/@agent/core/dist/index.js +286 -68
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +444 -127
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -79
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -52
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2g5j09ba.mjs +16 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-q4cwy1ja.mjs → core-664d5mmy.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zn1abzvs.mjs → core-70sfhqm6.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-kvdt1szx.mjs +18 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x6bt758j.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -23
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +84 -83
- package/runtime/node_modules/caniuse-lite/package.json +1 -1
- package/runtime/node_modules/mediabunny/README.md +4 -0
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +11 -11
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +12 -12
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.worker.js +8 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js +4 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/aes.js +6 -4
- package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-demuxer.js +6 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-segmented-input.js +17 -5
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +2 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +34 -18
- package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +3 -8
- package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +5 -12
- package/runtime/node_modules/mediabunny/dist/modules/src/misc.js +19 -5
- package/runtime/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js +4 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -13
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
- package/runtime/node_modules/mediabunny/dist/modules/src/segmented-input.js +70 -65
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/worker.js +26 -0
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/adts/adts-demuxer.ts +5 -0
- package/runtime/node_modules/mediabunny/src/aes.ts +7 -4
- package/runtime/node_modules/mediabunny/src/hls/hls-demuxer.ts +7 -0
- package/runtime/node_modules/mediabunny/src/hls/hls-segmented-input.ts +19 -6
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +2 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +15 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +37 -19
- package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
- package/runtime/node_modules/mediabunny/src/media-sink.ts +3 -12
- package/runtime/node_modules/mediabunny/src/media-source.ts +5 -20
- package/runtime/node_modules/mediabunny/src/misc.ts +26 -5
- package/runtime/node_modules/mediabunny/src/mp3/mp3-demuxer.ts +5 -0
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +30 -19
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
- package/runtime/node_modules/mediabunny/src/segmented-input.ts +76 -79
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/node_modules/mediabunny/src/worker.ts +28 -0
- package/runtime/package-lock.json +162 -162
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/AIHubView-CNKanNZa.js +1 -0
- package/runtime/webapp/dist/assets/{AgentManager-dXI31b0a.js → AgentManager-B8TTqJaL.js} +2 -2
- package/runtime/webapp/dist/assets/AiHubPane-Coyn3P-J.js +1 -0
- package/runtime/webapp/dist/assets/App-BGIGpBp3.js +68 -0
- package/runtime/webapp/dist/assets/BrowserLivePanel-DnzJOz5w.js +61 -0
- package/runtime/webapp/dist/assets/CalendarPage-D0oaq2_l.js +1 -0
- package/runtime/webapp/dist/assets/{CalendarView-QfbrlL9X.js → CalendarView-QXZbXnXA.js} +3 -3
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-CE8OML-A.js +1 -0
- package/runtime/webapp/dist/assets/CollaborationDashboard-CV18iiBO.js +1 -0
- package/runtime/webapp/dist/assets/{CollaborationPage-B1tiqgnG.js → CollaborationPage-B2mIAc-h.js} +2 -2
- package/runtime/webapp/dist/assets/{FilePreview-CPY6dP8Q.js → FilePreview-BCEiERA1.js} +9 -9
- package/runtime/webapp/dist/assets/{FileTree-BBgrOian.js → FileTree-CMbs1Gj3.js} +2 -2
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BxFS-0sF.js +1 -0
- package/runtime/webapp/dist/assets/FlowStudioPane-CVP0Q6zR.js +5 -0
- package/runtime/webapp/dist/assets/HostProjectPicker-DUUgM2Cm.js +1 -0
- package/runtime/webapp/dist/assets/{LSPServerList-B-R7HDSP.js → LSPServerList-COMVmsvb.js} +1 -1
- package/runtime/webapp/dist/assets/{MCPServerList-CTc0iAwT.js → MCPServerList-C_juD6B4.js} +1 -1
- package/runtime/webapp/dist/assets/{MemoryViewer-Dzh_miRv.js → MemoryViewer-Et2vysSN.js} +1 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-DwJhkRJd.js +1 -0
- package/runtime/webapp/dist/assets/RemoteDesktopPage-Cqsea4X7.js +1 -0
- package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-BA_HQv3V.js → RemoteDesktopTabBridge-BFzNwpUn.js} +1 -1
- package/runtime/webapp/dist/assets/{RunningSessionsIcon-BvFSI9OF.js → RunningSessionsIcon-D_cOqmmk.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboard-DcPPoXe2.js → SessionDashboard-yjdEKypJ.js} +2 -2
- package/runtime/webapp/dist/assets/{SessionDashboardBridge-CjoeUy-v.js → SessionDashboardBridge-Kc_1Et9r.js} +1 -1
- package/runtime/webapp/dist/assets/{SettingsPanel-DmdXDQUm.js → SettingsPanel-t26XhKHP.js} +2 -2
- package/runtime/webapp/dist/assets/{SkillManager-CS_skFZj.js → SkillManager-nZU7b1sc.js} +1 -1
- package/runtime/webapp/dist/assets/{TaskPaneTerminal-BFHDRCb9.js → TaskPaneTerminal-BPaCKman.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-Dr_nY9pI.js → TerminalPane-CiIpI1Id.js} +1 -1
- package/runtime/webapp/dist/assets/TodoPage-CG__S6_l.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-FEEApB15.js → abnfDiagram-VCTEODGH-DmKjGVfG.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-CycwMc2c.js → arc-D6bpvBke.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BFq9JapX.js → architectureDiagram-5GKGNRK7-NEKc2BYf.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DkOJ55Ag.js → blockDiagram-I7D4REHJ-V6G00twZ.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CRvi_3RM.js → c4Diagram-7LVT6UL2-CojA33V5.js} +1 -1
- package/runtime/webapp/dist/assets/{calendar-days-CLwKstxM.js → calendar-days-DXE_2mLa.js} +1 -1
- package/runtime/webapp/dist/assets/channel-D66Qxmo0.js +1 -0
- package/runtime/webapp/dist/assets/{check-8EVJMrTV.js → check-UipgMBET.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-down-ChNxfI2x.js → chevron-down-Dvinwg2S.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-right-Cbkc_d70.js → chevron-right-BGU3tcLA.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cklzvs8u.js → chunk-2Q5K7J3B-DObpPEgk.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-NxozE5UP.js → chunk-5VM5RSS4-PaTzAg6w.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-Dyb8E7YM.js → chunk-F27PBJKO-Pn4gut94.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BqbMMc1n.js → chunk-IMKFNOWR-nRaVFzK9.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-do0R2H6U.js → chunk-JWPE2WC7-CxssjKKN.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-B2HIaynf.js → chunk-POPQ4Y6H-CweDXr-B.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-C_zmjkwn.js → chunk-SVP7TREG-C7T3FGE-.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Dh2bZgM1.js → chunk-TICWLB2K-Nc0H-0_V.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CnqciVDz.js → chunk-XXDRQBXY-D_GQGF5g.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BAX0-S6b.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BAX0-S6b.js +1 -0
- package/runtime/webapp/dist/assets/{client-I0ZVCjOI.js → client-Bb0hpbIR.js} +1 -1
- package/runtime/webapp/dist/assets/{codeSyntax-C8n4_KZS.js → codeSyntax-DHonp3tF.js} +3 -3
- package/runtime/webapp/dist/assets/{collaboration-lVxWL5ce.js → collaboration-e_iziKU1.js} +1 -1
- package/runtime/webapp/dist/assets/composer-file-routing-CWyT7leB.js +6 -0
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CulKVUkj.js → cose-bilkent-JH36ORCC-Ac_FBan4.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-C1LUI1_G.js → cynefin-OW5HDTMX-vr6c389q.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-D3Ymzw_P.js → cynefinDiagram-5FMLGOSQ-sXmUCrp_.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DRaL0cGu.js → dagre-GXQ25YYZ-B0DmGxDv.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-D8gLHoZo.js → diagram-S7CK7UJ4-Dn-2jJ6S.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CaVU0aQT.js → diagram-UQ7AKVKN-BcasYsju.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-LFAKRvZz.js → diagram-VSXAHHWV-DCgGkc82.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXpxUERc.js → diagram-VX7I27RA-Cjs0Ny4i.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-vAiik55G.js → diagram-Z3DM3KII-0nyddp0v.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-MaFL7Kgb.js → ebnfDiagram-PWID7BFC-By7gCUsz.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DuEu79B3.js → erDiagram-RLTQ6QDP-DdwBp45A.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-ZVLWtslN.js → file-types-nujx8XUw.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BAQ6nP2D.js → flowDiagram-HODETNUW-DbOwRaT9.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C48VBnPy.js → ganttDiagram-EL5Y4UJY-CG8obc7O.js} +3 -3
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-BfWAh9Kr.js → gitGraphDiagram-WWUBYQGX-ru6aSu_g.js} +1 -1
- package/runtime/webapp/dist/assets/{history-D4E3D_aM.js → history-DaBh5_SJ.js} +1 -1
- package/runtime/webapp/dist/assets/{image-plus-DQV_EEAN.js → image-plus-Cm9jq1yo.js} +1 -1
- package/runtime/webapp/dist/assets/index-BAGzBXQc.css +1 -0
- package/runtime/webapp/dist/assets/index-YrEOkxAg.js +500 -0
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BM7P_-u_.js → infoDiagram-27XIBGKW-Crx1iSbW.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Cwd8XR-p.js → ishikawaDiagram-5VMMS53U-ClQPMEk5.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-MOgiksTh.js → journeyDiagram-3NMN7TZE-DHso2Xht.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DulC5OLL.js → kanban-definition-UXKFOSKX-D6psIAhv.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-Dku9sXQ7.js → layout-B6AVZ9v9.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-B3-dddD7.js → linear-CEZOUjlB.js} +1 -1
- package/runtime/webapp/dist/assets/{list-todo-Bik5IY2r.js → list-todo-D9ChIz0f.js} +1 -1
- package/runtime/webapp/dist/assets/{loader-circle-C5C-IzGK.js → loader-circle-CAHZbD5s.js} +1 -1
- package/runtime/webapp/dist/assets/{locate-fixed-CHkezEEh.js → locate-fixed-2R48MVg_.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-CRRXKysA.js → mermaid.core-DH0df9xk.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CaaP-nEb.js → mindmap-definition-YA3MSWOX-QWt8leZC.js} +1 -1
- package/runtime/webapp/dist/assets/{mobileViewport-CekmYKqS.js → mobileViewport-CKvpvxYc.js} +1 -1
- package/runtime/webapp/dist/assets/new-session-window-CiRwM3Od.js +191 -0
- package/runtime/webapp/dist/assets/{new-session-window-BfDMd-h3.css → new-session-window-DIU2v1uh.css} +1 -1
- package/runtime/webapp/dist/assets/{page-_fFyRId-.js → page-Cd9ci9uo.js} +6 -6
- package/runtime/webapp/dist/assets/{pause-BsmUCuwZ.js → pause-ddt7BLlm.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BqybPEwk.js → pegDiagram-XKGWAZYB-JNBt0nDx.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BX1H2lh2.js → pieDiagram-E7YTZNPT-g0hnDqNp.js} +1 -1
- package/runtime/webapp/dist/assets/{pin-BsEEYq8M.js → pin-BTP5lC_c.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Btnywv1k.js → quadrantDiagram-AXDQQJYC-mLZASjSm.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-Da_TV1ER.js → railroadDiagram-O6MQD6OU-CAXNAZhB.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-5V1Aow9h.js → requirementDiagram-BXWQKSXE-BC8y1ZXE.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-ccw-BbSby0GQ.js → rotate-ccw-CHFTy38a.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-BMdX-ln4.js → rotate-cw-CFCtRFDl.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-D_OIVihV.js → sankeyDiagram-P5KCCOFB-Boi5NPjT.js} +1 -1
- package/runtime/webapp/dist/assets/{send-Cb7EWSJF.js → send-CzCncLlt.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-LKeF5Mri.js → sequenceDiagram-WJ2MYXX4-D4ccoVEB.js} +1 -1
- package/runtime/webapp/dist/assets/{session-dashboard-BFqNDCc8.js → session-dashboard-C0KfSCDl.js} +1 -1
- package/runtime/webapp/dist/assets/{session-tree-BK_qaCnb.js → session-tree-CTzXmV6R.js} +1 -1
- package/runtime/webapp/dist/assets/{shield-check-C-r87aMq.js → shield-check-Da6EGdIt.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-B6j7Q_MN.js → sizeCapture-INFHLROL-Cd5jIVgK.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-zhPFqHdQ.js → stateDiagram-D77RDMKH-DXlmaNwu.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Dh6coc1l.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-C_FCENx1.js → swimlanes-42K2YHIH-DyhRB_e0.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BzriATjP.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-C3DBXjDU.js → timeline-definition-24CTP7MA-Bkfs9Mi-.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-DjggJGbw.js → trash-2-C682LDDA.js} +1 -1
- package/runtime/webapp/dist/assets/{types-BQCEWNQz.js → types-CfOuS-6l.js} +1 -1
- package/runtime/webapp/dist/assets/{use-session-activity-BbTXGW7Z.js → use-session-activity-C9Cn92Hj.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CssdTIB0.js → vennDiagram-4TSXK5OY-APWT64sw.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C58K2vVU.js → wardleyDiagram-VM6X3IG4-H7xLoxwM.js} +1 -1
- package/runtime/webapp/dist/assets/{web-B4y8vdRZ.js → web-CT8e03DV.js} +1 -1
- package/runtime/webapp/dist/assets/{web-D9rJZXHW.js → web-DG022HwJ.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQi8bD6A.js → xychartDiagram-S5SC5T6Z-DIrxZ4UJ.js} +1 -1
- package/runtime/webapp/dist/assets/{zoom-out-iMMWRXJs.js → zoom-out-CRN76HNZ.js} +1 -1
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/ws-server.mjs +5 -0
- package/runtime/.next/static/chunks/app/web/layout-80fa1b5f4c96b0b5.js +0 -1
- package/runtime/.next/static/chunks/main-app-ea4c5663714943e2.js +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0e6mn0ck.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0ssqfy51.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82ghff97.mjs +0 -39
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82yhcz2x.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b8jr1m8m.mjs +0 -23
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cj0jh226.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ebtbxtjf.mjs +0 -28
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-pb4erfqh.mjs +0 -42
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rs058s2g.mjs +0 -16
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-w6pv4szb.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wjeh40nr.mjs +0 -20
- package/runtime/webapp/dist/assets/AIHubView-CM6ugXG3.js +0 -1
- package/runtime/webapp/dist/assets/AiHubPane-DFzC3nbd.js +0 -1
- package/runtime/webapp/dist/assets/App-mF6ELC07.js +0 -68
- package/runtime/webapp/dist/assets/BrowserLivePanel-CamAULwS.js +0 -61
- package/runtime/webapp/dist/assets/CalendarPage-BbYdGYWn.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-CWhmFQtA.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationDashboard-XL5SnFOu.js +0 -1
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BXDuKlrL.js +0 -1
- package/runtime/webapp/dist/assets/FlowStudioPane-lnjLcd9c.js +0 -5
- package/runtime/webapp/dist/assets/HostProjectPicker-DN_vGqQb.js +0 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-zjqAUfKb.js +0 -1
- package/runtime/webapp/dist/assets/RemoteDesktopPage-9AhztqA2.js +0 -1
- package/runtime/webapp/dist/assets/TodoPage-guIvBCW0.js +0 -1
- package/runtime/webapp/dist/assets/artifact-links-B0ApmgK6.js +0 -2
- package/runtime/webapp/dist/assets/channel-BwDuyJO4.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BfyV8P0w.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BfyV8P0w.js +0 -1
- package/runtime/webapp/dist/assets/composer-file-routing-qSvJpT-v.js +0 -6
- package/runtime/webapp/dist/assets/download-BE31-Qm0.js +0 -6
- package/runtime/webapp/dist/assets/index-DSgLFE4Q.js +0 -489
- package/runtime/webapp/dist/assets/index-zQk0NCEB.css +0 -1
- package/runtime/webapp/dist/assets/new-session-window-Dgl7UWPR.js +0 -190
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DWnBZAiI.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DOZCbCJP.js +0 -8
- package/runtime/webapp/dist/assets/x-BYUglEo9.js +0 -6
- /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_ssgManifest.js +0 -0
|
@@ -17737,13 +17737,22 @@ var trigger = { oneOf: [{ type: "object", properties: { kind: { const: "once" },
|
|
|
17737
17737
|
var target = { type: "object", properties: { agentType: str, model: str, cwd: str, permissionMode: { enum: ["default", "acceptEdits", "bypassPermissions"] } }, additionalProperties: false };
|
|
17738
17738
|
var tool = (name, description, properties, required) => ({ name, description, inputSchema: { type: "object", properties, required, additionalProperties: false } });
|
|
17739
17739
|
var existing = { taskId: str, expectedVersion: num, requestId: str };
|
|
17740
|
-
var
|
|
17740
|
+
var TODO_COMPLETION_INSTRUCTIONS = "普通日历待办由后台在会话成功结束后异步核对。交付时明确说明实际完成的工作名称或维护已有计划中的完成项。自动同步无需在答复前查询或修改日历。用户明确要求查看或管理待办时,按要求调用工具并核实结果。";
|
|
17741
|
+
var TODO_EXECUTION_INSTRUCTIONS = "定时执行会话用 todo_get 读取本次待办,用 todo_report_execution 报告本次执行结果。";
|
|
17742
|
+
var TODO_TOOL_INSTRUCTIONS = [
|
|
17743
|
+
"这些工具管理 AgentRoam 日历中可见的个人待办,跨会话和 Agent 持久保存,与会话临时计划、Wiki 工作线程不同。用户要求创建个人待办或日历待办时,使用 todo_create。",
|
|
17744
|
+
"要求到点执行时,创建 scheduled 待办并启用执行计划,使用本工具集,不调用引擎原生 CronCreate。创建时省略 target 会交给发起会话的 Agent。只有用户明确指定时才另选 Agent。",
|
|
17745
|
+
"改派或改时间时先用 todo_get 获取版本,再用 todo_schedule 提交变更。不要把 Wiki 待办、Markdown 文件或会话计划当作已同步到 AgentRoam 日历。只有工具成功返回待办 ID 才能确认创建;无日期的待办显示在日历的未安排区域。",
|
|
17746
|
+
"写操作必须使用稳定唯一 requestId,重试同一操作沿用原值。更新前 todo_get 取得 version。普通待办到期只提醒;只有显式 scheduled 类型并启用执行计划才自动启动 Agent。用户明确开始可 todo_start。",
|
|
17747
|
+
TODO_COMPLETION_INSTRUCTIONS,
|
|
17748
|
+
TODO_EXECUTION_INSTRUCTIONS
|
|
17749
|
+
].join("");
|
|
17741
17750
|
var TODO_TOOLS = [
|
|
17742
17751
|
tool("todo_create", `创建独立个人待办,可在同一事务设置提醒和执行计划。有未来日期默认在该时刻提醒;reminder=null 可关闭默认提醒。${TODO_TOOL_INSTRUCTIONS}`, { title: str, description: str, kind: { enum: ["normal", "scheduled"] }, dueAt: num, timeZone: str, reminder: { anyOf: [trigger, { type: "null" }] }, executionSchedule: { type: "object", properties: { trigger, target, timeZone: str, enabled: { type: "boolean" } }, required: ["trigger"], additionalProperties: false }, scheduleRef: str, projectId: str, requestId: str }, ["title", "requestId"]),
|
|
17743
17752
|
tool("todo_get", "读取待办、version、提醒、执行计划和最近十次执行;执行凭据只读取本次待办。", { taskId: str }, ["taskId"]),
|
|
17744
|
-
tool("todo_list",
|
|
17753
|
+
tool("todo_list", `列出 AgentRoam 日历中跨会话的个人待办。${TODO_COMPLETION_INSTRUCTIONS}`, { status: { enum: ["pending", "in_progress", "completed", "failed", "cancelled"] }, kind: { enum: ["normal", "scheduled"] }, limit: num, cursor: str }, []),
|
|
17745
17754
|
tool("todo_update", "修改标题、描述、日期或项目;dueAt=null 移除日期。", { ...existing, patch: { type: "object", properties: { title: str, description: str, dueAt: { type: ["integer", "null"] }, projectId: str }, additionalProperties: false } }, [...Object.keys(existing), "patch"]),
|
|
17746
|
-
...["start", "complete", "cancel", "reopen"].map((action) => tool(`todo_${action}`, { start: "标记实际已开始的待办为进行中。", complete: "
|
|
17755
|
+
...["start", "complete", "cancel", "reopen"].map((action) => tool(`todo_${action}`, { start: "标记实际已开始的待办为进行中。", complete: "给待办打勾并停用自有提醒和执行计划。用于用户明确要求完成待办的操作。", cancel: "取消待办并停止未来提醒/执行。", reopen: "重新打开;不会自动恢复旧提醒或旧执行计划。" }[action], existing, Object.keys(existing))),
|
|
17747
17756
|
tool("todo_remind", "设置一次性/五字段 cron 提醒,timeZone 默认 Asia/Shanghai;trigger=null 停止提醒。不会启动 Agent。", { ...existing, trigger: { anyOf: [trigger, { type: "null" }] }, timeZone: str }, [...Object.keys(existing), "trigger"]),
|
|
17748
17757
|
tool("todo_link_schedule", "关联外部定时任务的稳定 scheduleRef,仅关联,不启动、不停止外部任务。", { ...existing, scheduleRef: str, label: str }, [...Object.keys(existing), "scheduleRef"]),
|
|
17749
17758
|
tool("todo_schedule", "修改 scheduled 待办的执行计划。改派时只传 target.agentType,改时间时只传 trigger,保留其他设置。一次性触发使用毫秒时间戳。保留现有 enabled 状态,除非用户要求启用或暂停。", { ...existing, enabled: { type: "boolean" }, trigger, timeZone: str, target }, [...Object.keys(existing), "enabled"]),
|
|
@@ -21273,10 +21282,14 @@ function claudeHistoryToMessages(history, includeReasoning = true) {
|
|
|
21273
21282
|
const text2 = textFromContent(content);
|
|
21274
21283
|
const attachments = claudeImageAttachments(blocks);
|
|
21275
21284
|
if (text2 || attachments.length > 0) {
|
|
21285
|
+
const goal = text2.match(/^\/goal\s+([\s\S]+)$/i)?.[1].trim();
|
|
21276
21286
|
result.push({
|
|
21277
21287
|
role: "user",
|
|
21278
|
-
content: text2,
|
|
21279
|
-
...attachments.length
|
|
21288
|
+
content: goal || text2,
|
|
21289
|
+
...goal || attachments.length ? { presentation: {
|
|
21290
|
+
...goal ? { isGoal: true } : {},
|
|
21291
|
+
...attachments.length ? { attachments } : {}
|
|
21292
|
+
} } : {}
|
|
21280
21293
|
});
|
|
21281
21294
|
}
|
|
21282
21295
|
for (const block of blocks) {
|
|
@@ -29892,10 +29905,11 @@ import { logGlobal as logGlobal3 } from "@agent/core";
|
|
|
29892
29905
|
import { execFile as execFile6 } from "node:child_process";
|
|
29893
29906
|
import { mkdir, mkdtemp, readFile as readFile9, realpath, rm, stat as stat4, writeFile } from "node:fs/promises";
|
|
29894
29907
|
import { homedir as homedir8 } from "node:os";
|
|
29895
|
-
import { basename as basename5, extname, isAbsolute, join as join7, relative, resolve as resolve5, sep, win32 as
|
|
29908
|
+
import { basename as basename5, extname, isAbsolute as isAbsolute2, join as join7, relative, resolve as resolve5, sep, win32 as win325 } from "node:path";
|
|
29896
29909
|
import { promisify as promisify6 } from "node:util";
|
|
29897
29910
|
import {
|
|
29898
29911
|
buildSessionQueryIndex as buildSessionQueryIndex2,
|
|
29912
|
+
cleanEngineHistory,
|
|
29899
29913
|
computeSessionHistoryRevision as computeSessionHistoryRevision2,
|
|
29900
29914
|
decodeSessionHistoryAnchor as decodeSessionHistoryAnchor2,
|
|
29901
29915
|
normalizeToolPermissionMode as normalizeToolPermissionMode2,
|
|
@@ -30275,9 +30289,9 @@ class CodexAppServerClient {
|
|
|
30275
30289
|
setServerRequestHandler(handler) {
|
|
30276
30290
|
this.serverRequestHandler = handler;
|
|
30277
30291
|
}
|
|
30278
|
-
async request(method, params) {
|
|
30292
|
+
async request(method, params, timeoutMs) {
|
|
30279
30293
|
await this.ensureStarted();
|
|
30280
|
-
return this.sendRequest(method, params);
|
|
30294
|
+
return this.sendRequest(method, params, timeoutMs);
|
|
30281
30295
|
}
|
|
30282
30296
|
respond(id, result) {
|
|
30283
30297
|
this.write({ id, result });
|
|
@@ -30647,11 +30661,104 @@ function normalizeCodexEnvironment(environment) {
|
|
|
30647
30661
|
return normalized;
|
|
30648
30662
|
}
|
|
30649
30663
|
|
|
30664
|
+
// src/agent-runtime/codex-composer.ts
|
|
30665
|
+
import { isAbsolute, win32 as win323 } from "node:path";
|
|
30666
|
+
var PREDICTION_TIMEOUT_MS = 8000;
|
|
30667
|
+
var CATALOG_TIMEOUT_MS = 5000;
|
|
30668
|
+
var MAX_RECENT_THREADS = 64;
|
|
30669
|
+
async function listCodexSkills(client, cwd) {
|
|
30670
|
+
const response = await client.request("skills/list", {
|
|
30671
|
+
cwds: cwd ? [cwd] : [],
|
|
30672
|
+
forceReload: false
|
|
30673
|
+
}, CATALOG_TIMEOUT_MS);
|
|
30674
|
+
return (response.data ?? []).flatMap((entry) => entry.skills ?? []).filter((skill) => skill.enabled !== false && typeof skill.name === "string" && typeof skill.path === "string");
|
|
30675
|
+
}
|
|
30676
|
+
async function loadCodexComposerCatalog(client, cwd, fileQuery) {
|
|
30677
|
+
if (fileQuery === undefined) {
|
|
30678
|
+
const skills = await listCodexSkills(client, cwd);
|
|
30679
|
+
return { skills: skills.map(({ name, description }) => ({ name, description })), files: [] };
|
|
30680
|
+
}
|
|
30681
|
+
if (!fileQuery.trim() || !cwd)
|
|
30682
|
+
return { skills: [], files: [] };
|
|
30683
|
+
const response = await client.request("fuzzyFileSearch", {
|
|
30684
|
+
query: fileQuery,
|
|
30685
|
+
roots: [cwd],
|
|
30686
|
+
cancellationToken: null
|
|
30687
|
+
}, CATALOG_TIMEOUT_MS);
|
|
30688
|
+
const paths = (response.files ?? []).flatMap(({ path, match_type }) => typeof path === "string" && path && match_type !== "directory" && !isAbsolute(path) && !win323.isAbsolute(path) && !path.split(/[\\/]/).includes("..") && !/[\r\n]/.test(path) ? [path] : []);
|
|
30689
|
+
return { skills: [], files: [...new Set(paths)].slice(0, 12) };
|
|
30690
|
+
}
|
|
30691
|
+
function parseCodexReviewTarget(input) {
|
|
30692
|
+
const command = /^\/review(?:\s+([\s\S]+))?$/i.exec(input.trim());
|
|
30693
|
+
if (!command)
|
|
30694
|
+
return null;
|
|
30695
|
+
const argument = command[1]?.trim();
|
|
30696
|
+
if (!argument)
|
|
30697
|
+
return { type: "uncommittedChanges" };
|
|
30698
|
+
const base = /^--base\s+(\S+)$/.exec(argument);
|
|
30699
|
+
return base ? { type: "baseBranch", branch: base[1] } : { type: "custom", instructions: argument };
|
|
30700
|
+
}
|
|
30701
|
+
|
|
30702
|
+
class CodexComposerPredictions {
|
|
30703
|
+
client;
|
|
30704
|
+
recent = new Map;
|
|
30705
|
+
unsupported = false;
|
|
30706
|
+
constructor(client) {
|
|
30707
|
+
this.client = client;
|
|
30708
|
+
client.onExit(() => {
|
|
30709
|
+
this.recent.clear();
|
|
30710
|
+
this.unsupported = false;
|
|
30711
|
+
});
|
|
30712
|
+
}
|
|
30713
|
+
completed(threadId, turnId) {
|
|
30714
|
+
this.recent.delete(threadId);
|
|
30715
|
+
if (this.recent.size >= MAX_RECENT_THREADS)
|
|
30716
|
+
this.recent.delete(this.recent.keys().next().value);
|
|
30717
|
+
this.recent.set(threadId, { turnId });
|
|
30718
|
+
}
|
|
30719
|
+
clear(threadId) {
|
|
30720
|
+
this.recent.delete(threadId);
|
|
30721
|
+
}
|
|
30722
|
+
async request(threadId, turnId) {
|
|
30723
|
+
const current = this.recent.get(threadId);
|
|
30724
|
+
if (this.unsupported || current?.turnId !== turnId)
|
|
30725
|
+
return null;
|
|
30726
|
+
current.result ??= this.collect(threadId, turnId);
|
|
30727
|
+
const suggestion = await current.result;
|
|
30728
|
+
return this.recent.get(threadId) === current ? suggestion : null;
|
|
30729
|
+
}
|
|
30730
|
+
collect(threadId, turnId) {
|
|
30731
|
+
return new Promise((resolve4) => {
|
|
30732
|
+
const finish = (text2) => {
|
|
30733
|
+
clearTimeout(timer);
|
|
30734
|
+
unsubscribe();
|
|
30735
|
+
unwatchExit();
|
|
30736
|
+
resolve4(text2);
|
|
30737
|
+
};
|
|
30738
|
+
const unsubscribe = this.client.onNotification(({ method, params }) => {
|
|
30739
|
+
if (method !== "thread/prediction/updated" || params?.threadId !== threadId || params.sourceTurnId !== turnId)
|
|
30740
|
+
return;
|
|
30741
|
+
const result = params.result;
|
|
30742
|
+
const text2 = result?.type === "completed" && typeof result.text === "string" ? result.text.trim() : "";
|
|
30743
|
+
finish(text2 && text2.length <= 600 ? text2 : null);
|
|
30744
|
+
});
|
|
30745
|
+
const unwatchExit = this.client.onExit(() => finish(null));
|
|
30746
|
+
const timer = setTimeout(() => finish(null), PREDICTION_TIMEOUT_MS);
|
|
30747
|
+
this.client.request("thread/prediction/request", { threadId, sourceTurnId: turnId }, PREDICTION_TIMEOUT_MS).catch((error) => {
|
|
30748
|
+
if (error instanceof Error && /not implemented|method not found|unknown method/i.test(error.message)) {
|
|
30749
|
+
this.unsupported = true;
|
|
30750
|
+
}
|
|
30751
|
+
finish(null);
|
|
30752
|
+
});
|
|
30753
|
+
});
|
|
30754
|
+
}
|
|
30755
|
+
}
|
|
30756
|
+
|
|
30650
30757
|
// src/agent-runtime/codex-desktop-tools.ts
|
|
30651
30758
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
30652
30759
|
import { readdir as readdir5 } from "node:fs/promises";
|
|
30653
30760
|
import { createConnection as createConnection3 } from "node:net";
|
|
30654
|
-
import { resolve as resolve4, win32 as
|
|
30761
|
+
import { resolve as resolve4, win32 as win324 } from "node:path";
|
|
30655
30762
|
var MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
30656
30763
|
|
|
30657
30764
|
class CodexDesktopTools {
|
|
@@ -30717,7 +30824,7 @@ class CodexDesktopTools {
|
|
|
30717
30824
|
close: () => rpc.close()
|
|
30718
30825
|
};
|
|
30719
30826
|
const snapshot = await connection.read();
|
|
30720
|
-
const canonical = (path2) => (this.options.platform ?? process.platform) === "win32" ?
|
|
30827
|
+
const canonical = (path2) => (this.options.platform ?? process.platform) === "win32" ? win324.resolve(path2).toLowerCase() : resolve4(path2);
|
|
30721
30828
|
if (!snapshot.thread.cwd || canonical(snapshot.thread.cwd) !== canonical(cwd)) {
|
|
30722
30829
|
throw new Error("Codex Desktop workspace does not match the requested conversation");
|
|
30723
30830
|
}
|
|
@@ -31671,6 +31778,7 @@ class CodexRuntimeAdapter {
|
|
|
31671
31778
|
emittedInstantToolItems = new Map;
|
|
31672
31779
|
todoMcp = new Map;
|
|
31673
31780
|
freshTodoThreads = new Set;
|
|
31781
|
+
composerPredictions;
|
|
31674
31782
|
nativePagingSupported = true;
|
|
31675
31783
|
pagedTurnItems = new Map;
|
|
31676
31784
|
finalizingAnswers = new Map;
|
|
@@ -31705,6 +31813,7 @@ class CodexRuntimeAdapter {
|
|
|
31705
31813
|
});
|
|
31706
31814
|
this.discoveryClient = options.discoveryClient ?? new CodexAppServerClient({ executable: this.codexExecutable, environment: options.environment });
|
|
31707
31815
|
this.codexHome = resolveCodexHome(options.environment, options.homeDir);
|
|
31816
|
+
this.composerPredictions = new CodexComposerPredictions(this.client);
|
|
31708
31817
|
this.sessionRoot = options.sessionRoot ?? join7(this.codexHome, "sessions");
|
|
31709
31818
|
this.imageStorageRoot = options.imageStorageRoot ?? join7(this.codexHome, "agentroam-images");
|
|
31710
31819
|
this.platform = options.platform ?? process.platform;
|
|
@@ -31726,9 +31835,11 @@ class CodexRuntimeAdapter {
|
|
|
31726
31835
|
}
|
|
31727
31836
|
});
|
|
31728
31837
|
this.onApprovalResolved = options.onApprovalResolved;
|
|
31838
|
+
this.threadHandoffs = options.threadHandoffs;
|
|
31729
31839
|
this.coreInlineImageBudgetBytes = options.coreInlineImageBudgetBytes ?? CODEX_CORE_INLINE_IMAGE_BUDGET_BYTES;
|
|
31730
31840
|
}
|
|
31731
31841
|
onApprovalResolved;
|
|
31842
|
+
threadHandoffs;
|
|
31732
31843
|
coreInlineImageBudgetBytes;
|
|
31733
31844
|
async health() {
|
|
31734
31845
|
if (this.unavailableError) {
|
|
@@ -31772,6 +31883,13 @@ class CodexRuntimeAdapter {
|
|
|
31772
31883
|
} : {}
|
|
31773
31884
|
}));
|
|
31774
31885
|
}
|
|
31886
|
+
getComposerCatalog(cwd, fileQuery) {
|
|
31887
|
+
this.ensureAvailable();
|
|
31888
|
+
return loadCodexComposerCatalog(this.client, cwd, fileQuery);
|
|
31889
|
+
}
|
|
31890
|
+
requestComposerPrediction(nativeSessionId, turnId) {
|
|
31891
|
+
return this.composerPredictions.request(nativeSessionId, turnId);
|
|
31892
|
+
}
|
|
31775
31893
|
async discoverSessions() {
|
|
31776
31894
|
this.ensureAvailable();
|
|
31777
31895
|
await this.refreshDiscoveryConnection();
|
|
@@ -31929,11 +32047,12 @@ class CodexRuntimeAdapter {
|
|
|
31929
32047
|
let meta;
|
|
31930
32048
|
let openFiles;
|
|
31931
32049
|
let ascTurns;
|
|
32050
|
+
const readHandoffs = this.goalHandoffs(nativeSessionId);
|
|
31932
32051
|
try {
|
|
31933
32052
|
[meta, openFiles, ascTurns] = await Promise.all([
|
|
31934
32053
|
metadata,
|
|
31935
32054
|
occupancy,
|
|
31936
|
-
metadata.then(({ thread }) => this.loadSummaryTurns(nativeSessionId, thread.path))
|
|
32055
|
+
metadata.then(({ thread }) => this.loadSummaryTurns(nativeSessionId, thread.path, readHandoffs))
|
|
31937
32056
|
]);
|
|
31938
32057
|
} catch (error) {
|
|
31939
32058
|
throw this.normalizePagedError(error);
|
|
@@ -31961,7 +32080,7 @@ class CodexRuntimeAdapter {
|
|
|
31961
32080
|
skeleton.push({ turnId: turn.id, role: "user" });
|
|
31962
32081
|
else if (item.id && questionHistory.has(item.id)) {
|
|
31963
32082
|
skeleton.push(...questionHistory.get(item.id).map(() => ({ turnId: turn.id, role: "assistant" })));
|
|
31964
|
-
} else if (isCodexCoreAgentMessage(item, turn.status, legacyFinalAgentMessage)) {
|
|
32083
|
+
} else if (codexPlanText(item) || isCodexCoreAgentMessage(item, turn.status, legacyFinalAgentMessage)) {
|
|
31965
32084
|
skeleton.push({ turnId: turn.id, role: "assistant" });
|
|
31966
32085
|
}
|
|
31967
32086
|
}
|
|
@@ -31980,7 +32099,7 @@ class CodexRuntimeAdapter {
|
|
|
31980
32099
|
refreshTurnId: ascTurns.at(-1)?.id === turn.id ? turn.id : undefined,
|
|
31981
32100
|
preserveRefreshedItems: summary.status === "running"
|
|
31982
32101
|
});
|
|
31983
|
-
let hydratedItems = mergeCodexGoalInput(this.pagedTurnItems.get(nativeSessionId)?.turns.get(turn.id) ?? turn.items ?? [], turn.items?.find((item) => item.isGoal === true));
|
|
32102
|
+
let hydratedItems = mergeCodexGoalInput(this.pagedTurnItems.get(nativeSessionId)?.turns.get(turn.id) ?? turn.items ?? [], turn.items?.find((item) => item.isGoal === true), readHandoffs);
|
|
31984
32103
|
if (meta.thread.path) {
|
|
31985
32104
|
const commentary = await this.rolloutCommentaryReader.read(meta.thread.path, turn.id);
|
|
31986
32105
|
hydratedItems = mergeCodexRolloutCommentary(hydratedItems, commentary);
|
|
@@ -32043,7 +32162,7 @@ class CodexRuntimeAdapter {
|
|
|
32043
32162
|
const state14 = this.pagedTurnItems.get(nativeSessionId);
|
|
32044
32163
|
const windowTurns = selectedSummaryTurns.map((turn) => ({
|
|
32045
32164
|
...turn,
|
|
32046
|
-
items: mergeCodexGoalInput(state14?.turns.get(turn.id) ?? turn.items ?? [], turn.items?.find((item) => item.isGoal === true))
|
|
32165
|
+
items: mergeCodexGoalInput(state14?.turns.get(turn.id) ?? turn.items ?? [], turn.items?.find((item) => item.isGoal === true), readHandoffs)
|
|
32047
32166
|
}));
|
|
32048
32167
|
const messages3 = await codexTurnsToMessages(windowTurns, {
|
|
32049
32168
|
nativeSessionId,
|
|
@@ -32125,7 +32244,7 @@ class CodexRuntimeAdapter {
|
|
|
32125
32244
|
revision
|
|
32126
32245
|
};
|
|
32127
32246
|
}
|
|
32128
|
-
async loadSummaryTurns(nativeSessionId, knownRolloutPath) {
|
|
32247
|
+
async loadSummaryTurns(nativeSessionId, knownRolloutPath, readHandoffs = this.goalHandoffs(nativeSessionId)) {
|
|
32129
32248
|
const response = await this.client.request("thread/turns/list", {
|
|
32130
32249
|
threadId: nativeSessionId,
|
|
32131
32250
|
itemsView: "summary"
|
|
@@ -32142,7 +32261,7 @@ class CodexRuntimeAdapter {
|
|
|
32142
32261
|
if (!rolloutPath)
|
|
32143
32262
|
return turns;
|
|
32144
32263
|
const userMessages = await this.rolloutUserMessageReader.read(rolloutPath);
|
|
32145
|
-
const merged = mergeCodexSummaryUserMessages(turns, userMessages);
|
|
32264
|
+
const merged = mergeCodexSummaryUserMessages(turns, userMessages, readHandoffs);
|
|
32146
32265
|
const asyncMessages = await this.rolloutUserMessageReader.readAsyncMessages?.(rolloutPath) ?? [];
|
|
32147
32266
|
for (const message of [...asyncMessages].reverse()) {
|
|
32148
32267
|
const turn = merged.find((candidate) => candidate.id === message.turnId);
|
|
@@ -32159,6 +32278,10 @@ class CodexRuntimeAdapter {
|
|
|
32159
32278
|
}
|
|
32160
32279
|
return this.withCompletionDurations(merged, rolloutPath);
|
|
32161
32280
|
}
|
|
32281
|
+
goalHandoffs(nativeSessionId) {
|
|
32282
|
+
let handoffs;
|
|
32283
|
+
return () => handoffs ??= this.threadHandoffs?.(encodeUnifiedSessionId(this.agentType, nativeSessionId)) ?? [];
|
|
32284
|
+
}
|
|
32162
32285
|
async withCompletionDurations(turns, rolloutPath) {
|
|
32163
32286
|
if (!rolloutPath || !this.rolloutUserMessageReader.readCompletionDurations)
|
|
32164
32287
|
return turns;
|
|
@@ -32413,7 +32536,7 @@ class CodexRuntimeAdapter {
|
|
|
32413
32536
|
includeTurns: false
|
|
32414
32537
|
});
|
|
32415
32538
|
const candidate = response.thread.path;
|
|
32416
|
-
if (!candidate || !
|
|
32539
|
+
if (!candidate || !isAbsolute2(candidate))
|
|
32417
32540
|
return null;
|
|
32418
32541
|
try {
|
|
32419
32542
|
const [rootPath, transcriptPath, transcriptStat] = await Promise.all([
|
|
@@ -32422,7 +32545,7 @@ class CodexRuntimeAdapter {
|
|
|
32422
32545
|
stat4(candidate)
|
|
32423
32546
|
]);
|
|
32424
32547
|
const fromRoot = relative(resolve5(rootPath), resolve5(transcriptPath));
|
|
32425
|
-
if (transcriptStat.isFile() && fromRoot !== "" && !fromRoot.startsWith(`..${sep}`) && fromRoot !== ".." && !
|
|
32548
|
+
if (transcriptStat.isFile() && fromRoot !== "" && !fromRoot.startsWith(`..${sep}`) && fromRoot !== ".." && !isAbsolute2(fromRoot)) {
|
|
32426
32549
|
return transcriptPath;
|
|
32427
32550
|
}
|
|
32428
32551
|
} catch {}
|
|
@@ -32517,7 +32640,16 @@ class CodexRuntimeAdapter {
|
|
|
32517
32640
|
if (this.activeQueues.has(nativeSessionId)) {
|
|
32518
32641
|
throw new RuntimeSessionError("Codex session is already running", "SESSION_ALREADY_RUNNING");
|
|
32519
32642
|
}
|
|
32643
|
+
this.composerPredictions.clear(nativeSessionId);
|
|
32520
32644
|
const detail = await this.getSession(nativeSessionId);
|
|
32645
|
+
const compact = !options?.goal && /^\/compact$/i.test(input.trim());
|
|
32646
|
+
const review = options?.goal ? null : parseCodexReviewTarget(input);
|
|
32647
|
+
if ((compact || review) && detail.status === "running") {
|
|
32648
|
+
throw new RuntimeSessionError("请等待当前 Codex 回合结束", "SESSION_OCCUPIED");
|
|
32649
|
+
}
|
|
32650
|
+
if ((compact || review) && (images?.length || options?.attachments?.length)) {
|
|
32651
|
+
throw new RuntimeSessionError("请先移除附件,再执行 Codex 指令", "OPERATION_NOT_SUPPORTED");
|
|
32652
|
+
}
|
|
32521
32653
|
const todoMcp = options?.todoMcp ?? this.todoMcp.get(nativeSessionId);
|
|
32522
32654
|
const requiresTodoMcp = Boolean(todoMcp && todoMcp.readiness !== "background");
|
|
32523
32655
|
if (requiresTodoMcp && detail.status === "running") {
|
|
@@ -32529,6 +32661,7 @@ class CodexRuntimeAdapter {
|
|
|
32529
32661
|
const todoPreparation = requiresTodoMcp ? new AbortController : undefined;
|
|
32530
32662
|
let imageDirectory = null;
|
|
32531
32663
|
let imageDirectoryReferencedByTurn = false;
|
|
32664
|
+
let compactionStartTimer;
|
|
32532
32665
|
this.activeQueues.set(nativeSessionId, queue);
|
|
32533
32666
|
if (todoPreparation)
|
|
32534
32667
|
this.pendingTodoRuns.set(nativeSessionId, todoPreparation);
|
|
@@ -32537,6 +32670,7 @@ class CodexRuntimeAdapter {
|
|
|
32537
32670
|
if (options?.brokerRunId)
|
|
32538
32671
|
this.activeBrokerRunIds.set(nativeSessionId, options.brokerRunId);
|
|
32539
32672
|
try {
|
|
32673
|
+
let resumed;
|
|
32540
32674
|
try {
|
|
32541
32675
|
if (todoMcp) {
|
|
32542
32676
|
if (this.freshTodoThreads.has(nativeSessionId)) {
|
|
@@ -32545,7 +32679,7 @@ class CodexRuntimeAdapter {
|
|
|
32545
32679
|
} else if (requiresTodoMcp) {
|
|
32546
32680
|
await resumeCodexThreadWithTodo(this.client, nativeSessionId, todoMcp, todoPreparation?.signal);
|
|
32547
32681
|
} else {
|
|
32548
|
-
await this.client.request("thread/resume", {
|
|
32682
|
+
resumed = await this.client.request("thread/resume", {
|
|
32549
32683
|
threadId: nativeSessionId,
|
|
32550
32684
|
excludeTurns: true,
|
|
32551
32685
|
config: codexTodoMcpConfiguration(todoMcp).config
|
|
@@ -32553,7 +32687,7 @@ class CodexRuntimeAdapter {
|
|
|
32553
32687
|
}
|
|
32554
32688
|
this.todoMcp.set(nativeSessionId, { ...todoMcp, args: [...todoMcp.args], env: { ...todoMcp.env } });
|
|
32555
32689
|
} else {
|
|
32556
|
-
await this.client.request("thread/resume", { threadId: nativeSessionId, excludeTurns: true });
|
|
32690
|
+
resumed = await this.client.request("thread/resume", { threadId: nativeSessionId, excludeTurns: true });
|
|
32557
32691
|
}
|
|
32558
32692
|
} catch (error) {
|
|
32559
32693
|
if (requiresTodoMcp)
|
|
@@ -32563,7 +32697,7 @@ class CodexRuntimeAdapter {
|
|
|
32563
32697
|
const connection = await this.desktopTools.connect(nativeSessionId, detail.cwd);
|
|
32564
32698
|
if (!connection)
|
|
32565
32699
|
throw new RuntimeSessionError("原客户端仍持有此会话,且当前无法连接 Codex 桌面端。请保持桌面端运行后在原会话重试。", "SESSION_OCCUPIED");
|
|
32566
|
-
if (parsedImages.length || options?.goal || permissionMode !== "full-access") {
|
|
32700
|
+
if (parsedImages.length || options?.goal || options?.codexMode || compact || review || permissionMode !== "full-access") {
|
|
32567
32701
|
connection.close();
|
|
32568
32702
|
throw new RuntimeSessionError("原会话由 Codex 桌面端执行:当前支持文字追问,并沿用原客户端权限。图片、目标任务或单独的审批模式请在原客户端处理。", "OPERATION_NOT_SUPPORTED");
|
|
32569
32703
|
}
|
|
@@ -32572,6 +32706,9 @@ class CodexRuntimeAdapter {
|
|
|
32572
32706
|
yield* continuation.run(input, options);
|
|
32573
32707
|
return;
|
|
32574
32708
|
}
|
|
32709
|
+
if ((compact || review) && resumed?.thread?.status?.type === "active") {
|
|
32710
|
+
throw new RuntimeSessionError("请等待当前 Codex 回合结束", "SESSION_OCCUPIED");
|
|
32711
|
+
}
|
|
32575
32712
|
todoPreparation?.signal.throwIfAborted();
|
|
32576
32713
|
if (options?.goal) {
|
|
32577
32714
|
await this.client.request("thread/goal/set", {
|
|
@@ -32585,40 +32722,74 @@ class CodexRuntimeAdapter {
|
|
|
32585
32722
|
imageDirectory = result.directory;
|
|
32586
32723
|
return result.inputs;
|
|
32587
32724
|
}) : [];
|
|
32588
|
-
const skillInvocation = parseExplicitSkillInvocation(input);
|
|
32725
|
+
const skillInvocation = review ? null : parseExplicitSkillInvocation(input);
|
|
32589
32726
|
const skillPath = skillInvocation ? await this.resolveSkillPath(detail.cwd, skillInvocation.name) : null;
|
|
32590
32727
|
const text2 = skillInvocation ? codexSkillPrompt(skillInvocation) : input;
|
|
32591
32728
|
const runUsage = {
|
|
32592
32729
|
completedTurnIds: new Set,
|
|
32593
32730
|
startedTurnIds: new Set,
|
|
32594
32731
|
pendingNotifications: [],
|
|
32732
|
+
...compact ? { awaitingCompaction: true } : {},
|
|
32595
32733
|
partial: false
|
|
32596
32734
|
};
|
|
32597
32735
|
this.runUsages.set(nativeSessionId, runUsage);
|
|
32598
32736
|
todoPreparation?.signal.throwIfAborted();
|
|
32599
32737
|
if (this.pendingTodoRuns.get(nativeSessionId) === todoPreparation)
|
|
32600
32738
|
this.pendingTodoRuns.delete(nativeSessionId);
|
|
32601
|
-
|
|
32602
|
-
|
|
32603
|
-
|
|
32604
|
-
|
|
32605
|
-
|
|
32606
|
-
|
|
32607
|
-
|
|
32608
|
-
|
|
32609
|
-
|
|
32610
|
-
|
|
32611
|
-
|
|
32739
|
+
let turnId;
|
|
32740
|
+
if (compact) {
|
|
32741
|
+
await this.client.request("thread/compact/start", { threadId: nativeSessionId });
|
|
32742
|
+
compactionStartTimer = setTimeout(() => {
|
|
32743
|
+
if (runUsage.initialTurnId)
|
|
32744
|
+
return;
|
|
32745
|
+
queue.push({ type: "error", code: "NATIVE_PROTOCOL_ERROR", message: "Codex 未确认上下文压缩已开始" });
|
|
32746
|
+
queue.close();
|
|
32747
|
+
}, 1e4);
|
|
32748
|
+
} else if (review) {
|
|
32749
|
+
const response = await this.client.request("review/start", {
|
|
32750
|
+
threadId: nativeSessionId,
|
|
32751
|
+
target: review,
|
|
32752
|
+
delivery: "inline"
|
|
32753
|
+
});
|
|
32754
|
+
turnId = response.turn.id;
|
|
32755
|
+
} else {
|
|
32756
|
+
let collaborationMode;
|
|
32757
|
+
if (options?.codexMode) {
|
|
32758
|
+
resumed ??= await this.client.request("thread/resume", { threadId: nativeSessionId, excludeTurns: true });
|
|
32759
|
+
const model = options.model?.id || resumed?.model;
|
|
32760
|
+
if (!model)
|
|
32761
|
+
throw new RuntimeSessionError("请选择 Codex 模型后再切换计划模式", "OPERATION_NOT_SUPPORTED");
|
|
32762
|
+
collaborationMode = {
|
|
32763
|
+
mode: options.codexMode,
|
|
32764
|
+
settings: { model, reasoning_effort: options.reasoningEffort ?? resumed?.reasoningEffort ?? null, developer_instructions: null }
|
|
32765
|
+
};
|
|
32766
|
+
}
|
|
32767
|
+
const response = await this.client.request("turn/start", {
|
|
32768
|
+
threadId: nativeSessionId,
|
|
32769
|
+
input: [
|
|
32770
|
+
{ type: "text", text: text2, text_elements: [] },
|
|
32771
|
+
...skillInvocation && skillPath ? [{ type: "skill", name: skillInvocation.name, path: skillPath }] : [],
|
|
32772
|
+
...imageInputs
|
|
32773
|
+
],
|
|
32774
|
+
...options?.model?.id ? { model: options.model.id } : {},
|
|
32775
|
+
...options?.reasoningEffort ? { effort: options.reasoningEffort } : {},
|
|
32776
|
+
...collaborationMode ? { collaborationMode } : {},
|
|
32777
|
+
...codexTurnPermissionOptions(permissionMode, detail.cwd)
|
|
32778
|
+
});
|
|
32779
|
+
turnId = response.turn.id;
|
|
32780
|
+
}
|
|
32612
32781
|
imageDirectoryReferencedByTurn = imageDirectory !== null;
|
|
32613
32782
|
this.freshTodoThreads.delete(nativeSessionId);
|
|
32614
|
-
|
|
32615
|
-
|
|
32783
|
+
if (turnId) {
|
|
32784
|
+
runUsage.initialTurnId = turnId;
|
|
32785
|
+
runUsage.startedTurnIds.add(turnId);
|
|
32786
|
+
}
|
|
32616
32787
|
const pendingNotifications = runUsage.pendingNotifications ?? [];
|
|
32617
32788
|
runUsage.pendingNotifications = undefined;
|
|
32618
32789
|
for (const notification of pendingNotifications)
|
|
32619
32790
|
this.handleNotification(notification);
|
|
32620
|
-
if (!this.activeTurnIds.has(nativeSessionId) && !runUsage.completedTurnIds.has(
|
|
32621
|
-
this.activeTurnIds.set(nativeSessionId,
|
|
32791
|
+
if (turnId && !this.activeTurnIds.has(nativeSessionId) && !runUsage.completedTurnIds.has(turnId)) {
|
|
32792
|
+
this.activeTurnIds.set(nativeSessionId, turnId);
|
|
32622
32793
|
}
|
|
32623
32794
|
for await (const event of queue)
|
|
32624
32795
|
yield event;
|
|
@@ -32640,6 +32811,7 @@ class CodexRuntimeAdapter {
|
|
|
32640
32811
|
});
|
|
32641
32812
|
yield { type: "error", message: normalized.message, code: normalized.code, ...this.runUsageMetadata(nativeSessionId) };
|
|
32642
32813
|
} finally {
|
|
32814
|
+
clearTimeout(compactionStartTimer);
|
|
32643
32815
|
if (this.pendingTodoRuns.get(nativeSessionId) === todoPreparation)
|
|
32644
32816
|
this.pendingTodoRuns.delete(nativeSessionId);
|
|
32645
32817
|
this.desktopContinuations.get(nativeSessionId)?.close();
|
|
@@ -32731,6 +32903,7 @@ class CodexRuntimeAdapter {
|
|
|
32731
32903
|
}
|
|
32732
32904
|
async release(nativeSessionId) {
|
|
32733
32905
|
this.ensureAvailable();
|
|
32906
|
+
this.composerPredictions.clear(nativeSessionId);
|
|
32734
32907
|
await this.client.request("thread/unsubscribe", { threadId: nativeSessionId });
|
|
32735
32908
|
this.unconfirmedInterruptedTurnIds.delete(nativeSessionId);
|
|
32736
32909
|
}
|
|
@@ -32874,11 +33047,8 @@ ${value2}`, text_elements: [] }]
|
|
|
32874
33047
|
} catch {}
|
|
32875
33048
|
}
|
|
32876
33049
|
try {
|
|
32877
|
-
const
|
|
32878
|
-
|
|
32879
|
-
forceReload: false
|
|
32880
|
-
});
|
|
32881
|
-
return findSkillPath(response, name);
|
|
33050
|
+
const skills = await listCodexSkills(this.client, cwd);
|
|
33051
|
+
return skills.find((skill) => skill.name === name)?.path ?? null;
|
|
32882
33052
|
} catch {
|
|
32883
33053
|
return null;
|
|
32884
33054
|
}
|
|
@@ -32939,6 +33109,8 @@ ${value2}`, text_elements: [] }]
|
|
|
32939
33109
|
if (message.method === "turn/started") {
|
|
32940
33110
|
if (!runUsage || !notificationTurnId || runUsage.completedTurnIds.has(notificationTurnId))
|
|
32941
33111
|
return;
|
|
33112
|
+
if (runUsage.awaitingCompaction && !runUsage.initialTurnId)
|
|
33113
|
+
runUsage.initialTurnId = notificationTurnId;
|
|
32942
33114
|
if (!this.activeGoalThreads.has(threadId) && notificationTurnId !== runUsage.initialTurnId)
|
|
32943
33115
|
return;
|
|
32944
33116
|
} else if (message.method === "turn/completed" || message.method === "turn/interrupt") {
|
|
@@ -33063,6 +33235,16 @@ ${value2}`, text_elements: [] }]
|
|
|
33063
33235
|
}
|
|
33064
33236
|
if (message.method === "item/reasoning/textDelta")
|
|
33065
33237
|
return;
|
|
33238
|
+
if (message.method === "item/plan/delta" && typeof params.delta === "string") {
|
|
33239
|
+
queue.push({
|
|
33240
|
+
type: "text_chunk",
|
|
33241
|
+
text: params.delta,
|
|
33242
|
+
messagePhase: "final_answer",
|
|
33243
|
+
...typeof params.itemId === "string" ? { itemId: params.itemId } : {},
|
|
33244
|
+
...eventTurnId ? { turnId: eventTurnId } : {}
|
|
33245
|
+
});
|
|
33246
|
+
return;
|
|
33247
|
+
}
|
|
33066
33248
|
if (message.method === "item/agentMessage/delta" && typeof params.delta === "string") {
|
|
33067
33249
|
const itemId = typeof params.itemId === "string" ? params.itemId : undefined;
|
|
33068
33250
|
if (itemId && this.asyncInputItems.has(`${threadId}:${itemId}`))
|
|
@@ -33093,6 +33275,19 @@ ${value2}`, text_elements: [] }]
|
|
|
33093
33275
|
return;
|
|
33094
33276
|
}
|
|
33095
33277
|
if (message.method === "item/completed") {
|
|
33278
|
+
if (runUsage && eventTurnId === runUsage.initialTurnId && notificationItem?.type === "plan") {
|
|
33279
|
+
runUsage.completedPlanText = codexPlanText(notificationItem);
|
|
33280
|
+
}
|
|
33281
|
+
if (notificationItem?.type === "exitedReviewMode" && typeof notificationItem.review === "string" && notificationItem.review.trim()) {
|
|
33282
|
+
queue.push({
|
|
33283
|
+
type: "text_chunk",
|
|
33284
|
+
text: notificationItem.review,
|
|
33285
|
+
messagePhase: "final_answer",
|
|
33286
|
+
...notificationItem.id ? { itemId: notificationItem.id } : {},
|
|
33287
|
+
...eventTurnId ? { turnId: eventTurnId } : {}
|
|
33288
|
+
});
|
|
33289
|
+
return;
|
|
33290
|
+
}
|
|
33096
33291
|
if (notificationItem?.type === "agentMessage" && typeof notificationItem.id === "string") {
|
|
33097
33292
|
this.agentMessagePhases.delete(`${threadId}:${notificationItem.id}`);
|
|
33098
33293
|
}
|
|
@@ -33159,11 +33354,14 @@ ${value2}`, text_elements: [] }]
|
|
|
33159
33354
|
...metadata
|
|
33160
33355
|
});
|
|
33161
33356
|
} else {
|
|
33162
|
-
const finalText2 = lastCodexAgentText(turn?.items ?? []);
|
|
33357
|
+
const finalText2 = runUsage?.completedPlanText ?? lastCodexAgentText(turn?.items ?? []);
|
|
33358
|
+
const completedTurnId = turn?.status === "completed" && finalText2.trim() ? turn.id : undefined;
|
|
33359
|
+
if (completedTurnId)
|
|
33360
|
+
this.composerPredictions.completed(threadId, completedTurnId);
|
|
33163
33361
|
const contextUsage = codexContextUsageEvent(turn, ++this.contextUsageRequestIndex);
|
|
33164
33362
|
if (contextUsage)
|
|
33165
33363
|
queue.push(contextUsage);
|
|
33166
|
-
queue.push({ type: "done", finalText: finalText2, ...metadata, ...
|
|
33364
|
+
queue.push({ type: "done", finalText: finalText2, ...metadata, ...completedTurnId ? { forkPoint: { turnId: completedTurnId } } : {} });
|
|
33167
33365
|
}
|
|
33168
33366
|
queue.close();
|
|
33169
33367
|
return;
|
|
@@ -33511,40 +33709,19 @@ function rolloutPaths(threads, platform) {
|
|
|
33511
33709
|
return threads.flatMap((thread) => {
|
|
33512
33710
|
if (!thread.path)
|
|
33513
33711
|
return [];
|
|
33514
|
-
const absolute = platform === "win32" ?
|
|
33712
|
+
const absolute = platform === "win32" ? win325.isAbsolute(thread.path) : isAbsolute2(thread.path);
|
|
33515
33713
|
return absolute ? [thread.path] : [];
|
|
33516
33714
|
});
|
|
33517
33715
|
}
|
|
33518
33716
|
function parseExplicitSkillInvocation(input) {
|
|
33519
|
-
const match = input.trim().match(
|
|
33520
|
-
if (!match || ["goal", "compact", "loop"].includes(match[
|
|
33717
|
+
const match = input.trim().match(/^([/$])([\p{L}\p{N}_-]+)(?:\s+([\s\S]*))?$/u);
|
|
33718
|
+
if (!match || match[1] === "/" && ["goal", "compact", "loop"].includes(match[2].toLowerCase()))
|
|
33521
33719
|
return null;
|
|
33522
|
-
return { name: match[
|
|
33720
|
+
return { name: match[2], rest: match[3]?.trim() ?? "" };
|
|
33523
33721
|
}
|
|
33524
33722
|
function codexSkillPrompt({ name, rest }) {
|
|
33525
33723
|
return rest ? `$${name} ${rest}` : `$${name}`;
|
|
33526
33724
|
}
|
|
33527
|
-
function findSkillPath(value, name) {
|
|
33528
|
-
if (!value || typeof value !== "object")
|
|
33529
|
-
return null;
|
|
33530
|
-
if (Array.isArray(value)) {
|
|
33531
|
-
for (const item of value) {
|
|
33532
|
-
const found = findSkillPath(item, name);
|
|
33533
|
-
if (found)
|
|
33534
|
-
return found;
|
|
33535
|
-
}
|
|
33536
|
-
return null;
|
|
33537
|
-
}
|
|
33538
|
-
const record2 = value;
|
|
33539
|
-
if (record2.name === name && typeof record2.path === "string")
|
|
33540
|
-
return record2.path;
|
|
33541
|
-
for (const child of Object.values(record2)) {
|
|
33542
|
-
const found = findSkillPath(child, name);
|
|
33543
|
-
if (found)
|
|
33544
|
-
return found;
|
|
33545
|
-
}
|
|
33546
|
-
return null;
|
|
33547
|
-
}
|
|
33548
33725
|
function codexTurnPermissionOptions(permissionMode, cwd) {
|
|
33549
33726
|
if (permissionMode === "request-approval") {
|
|
33550
33727
|
return {
|
|
@@ -33696,7 +33873,7 @@ function decodeNativeHistoryCursor2(cursor, fallback) {
|
|
|
33696
33873
|
function codexUserImagePaths(entries) {
|
|
33697
33874
|
return (entries ?? []).flatMap((entry) => (entry.type === "local_image" || entry.type === "localImage") && typeof entry.path === "string" ? [entry.path] : []);
|
|
33698
33875
|
}
|
|
33699
|
-
function mergeCodexSummaryUserMessages(turns, rolloutMessages) {
|
|
33876
|
+
function mergeCodexSummaryUserMessages(turns, rolloutMessages, readHandoffs) {
|
|
33700
33877
|
return turns.map((turn) => {
|
|
33701
33878
|
const durable = rolloutMessages.get(turn.id);
|
|
33702
33879
|
if (!durable?.length)
|
|
@@ -33718,7 +33895,7 @@ function mergeCodexSummaryUserMessages(turns, rolloutMessages) {
|
|
|
33718
33895
|
items: mergeCodexGoalInput([
|
|
33719
33896
|
...users,
|
|
33720
33897
|
...(turn.items ?? []).filter((item) => item.type !== "userMessage")
|
|
33721
|
-
], goal && { type: "userMessage", id: goal.itemId, content: goal.content })
|
|
33898
|
+
], goal && { type: "userMessage", id: goal.itemId, content: goal.content }, readHandoffs)
|
|
33722
33899
|
};
|
|
33723
33900
|
});
|
|
33724
33901
|
}
|
|
@@ -33726,13 +33903,15 @@ function codexUserMessageText(entries) {
|
|
|
33726
33903
|
return entries?.filter((entry) => entry.type === "text" && typeof entry.text === "string").map((entry) => String(entry.text)).join(`
|
|
33727
33904
|
`).trim() ?? "";
|
|
33728
33905
|
}
|
|
33729
|
-
function mergeCodexGoalInput(items, goal) {
|
|
33906
|
+
function mergeCodexGoalInput(items, goal, readHandoffs) {
|
|
33730
33907
|
if (!goal)
|
|
33731
33908
|
return items;
|
|
33732
33909
|
const inputIndex = items.findIndex((item) => item.type === "userMessage");
|
|
33733
33910
|
const input = items[inputIndex];
|
|
33734
33911
|
const goalText = codexUserMessageText(goal.content);
|
|
33735
|
-
|
|
33912
|
+
const inputText = codexUserMessageText(input?.content);
|
|
33913
|
+
const skill = parseExplicitSkillInvocation(goalText);
|
|
33914
|
+
if (input && (inputText === goalText || goal.id && goal.id === input.id || skill && inputText === codexSkillPrompt(skill) || cleanEngineHistory([{ role: "user", content: inputText }], readHandoffs())[0].content === goalText)) {
|
|
33736
33915
|
return items.map((item, index) => index === inputIndex ? { ...item, isGoal: true } : item);
|
|
33737
33916
|
}
|
|
33738
33917
|
return [{ ...goal, isGoal: true }, ...items];
|
|
@@ -33743,6 +33922,7 @@ function codexSummaryTurnsToMessages(turns, imageAttachments, nativeSessionId, q
|
|
|
33743
33922
|
let segmentIndex = 0;
|
|
33744
33923
|
const legacyFinalAgentMessage = codexLegacyFinalAgentMessage(turn);
|
|
33745
33924
|
for (const item of turn.items ?? []) {
|
|
33925
|
+
const planText = codexPlanText(item);
|
|
33746
33926
|
if (item.type === "userMessage") {
|
|
33747
33927
|
const entries = item.content;
|
|
33748
33928
|
const sourceText = codexUserMessageText(entries);
|
|
@@ -33770,6 +33950,8 @@ function codexSummaryTurnsToMessages(turns, imageAttachments, nativeSessionId, q
|
|
|
33770
33950
|
segmentIndex += 1;
|
|
33771
33951
|
} else if (item.id && questionHistory.has(item.id)) {
|
|
33772
33952
|
messages3.push(...questionHistory.get(item.id));
|
|
33953
|
+
} else if (planText) {
|
|
33954
|
+
messages3.push({ role: "assistant", content: planText });
|
|
33773
33955
|
} else if (isCodexCoreAgentMessage(item, turn.status, legacyFinalAgentMessage) && typeof item.text === "string" && item.text.trim()) {
|
|
33774
33956
|
const presentation = {
|
|
33775
33957
|
...codexAgentMessagePresentation(item, turn.id),
|
|
@@ -33841,6 +34023,7 @@ async function codexTurnsToMessages(turns, options = {}) {
|
|
|
33841
34023
|
for (const turn of turns) {
|
|
33842
34024
|
let segmentIndex = -1;
|
|
33843
34025
|
for (const item of turn.items ?? []) {
|
|
34026
|
+
const planText = codexPlanText(item);
|
|
33844
34027
|
if (item.type === "contextCompaction") {
|
|
33845
34028
|
messages3.push({ role: "assistant", name: "__compaction_checkpoint__", content: JSON.stringify({ summary: "上下文已压缩" }) });
|
|
33846
34029
|
continue;
|
|
@@ -33867,6 +34050,8 @@ async function codexTurnsToMessages(turns, options = {}) {
|
|
|
33867
34050
|
}
|
|
33868
34051
|
} else if (item.id && questionHistory.has(item.id)) {
|
|
33869
34052
|
messages3.push(...questionHistory.get(item.id));
|
|
34053
|
+
} else if (planText) {
|
|
34054
|
+
messages3.push({ role: "assistant", content: planText });
|
|
33870
34055
|
} else if (item.type === "agentMessage" && typeof item.text === "string" && item.text.trim()) {
|
|
33871
34056
|
if (item.delivery === "async" && turn.status === "inProgress")
|
|
33872
34057
|
continue;
|
|
@@ -34243,12 +34428,19 @@ function codexContextUsageEvent(turn, requestIndex) {
|
|
|
34243
34428
|
};
|
|
34244
34429
|
}
|
|
34245
34430
|
function lastCodexAgentText(items) {
|
|
34431
|
+
let answer;
|
|
34246
34432
|
for (let index = items.length - 1;index >= 0; index--) {
|
|
34247
34433
|
const item = items[index];
|
|
34434
|
+
const composerResult = codexPlanText(item) ?? (item.type === "exitedReviewMode" && typeof item.review === "string" ? item.review : undefined);
|
|
34435
|
+
if (composerResult)
|
|
34436
|
+
return composerResult;
|
|
34248
34437
|
if (item.type === "agentMessage" && item.delivery !== "async" && typeof item.text === "string")
|
|
34249
|
-
|
|
34438
|
+
answer ??= item.text;
|
|
34250
34439
|
}
|
|
34251
|
-
return "";
|
|
34440
|
+
return answer ?? "";
|
|
34441
|
+
}
|
|
34442
|
+
function codexPlanText(item) {
|
|
34443
|
+
return item.type === "plan" && typeof item.text === "string" && item.text.trim() ? item.text : undefined;
|
|
34252
34444
|
}
|
|
34253
34445
|
function readCodexGoalStatus(value) {
|
|
34254
34446
|
const status = asRecord3(value).status;
|
|
@@ -36637,7 +36829,7 @@ class NativeRpcClient {
|
|
|
36637
36829
|
import { createReadStream } from "node:fs";
|
|
36638
36830
|
import { readdir as readdir6, stat as stat5 } from "node:fs/promises";
|
|
36639
36831
|
import { homedir as homedir10 } from "node:os";
|
|
36640
|
-
import { isAbsolute as
|
|
36832
|
+
import { isAbsolute as isAbsolute3, join as join9 } from "node:path";
|
|
36641
36833
|
import { createInterface } from "node:readline";
|
|
36642
36834
|
|
|
36643
36835
|
class QoderWorkspaceCatalog {
|
|
@@ -36660,11 +36852,11 @@ class QoderWorkspaceCatalog {
|
|
|
36660
36852
|
}
|
|
36661
36853
|
if (!row || typeof row !== "object")
|
|
36662
36854
|
continue;
|
|
36663
|
-
if (typeof row.cwd === "string" &&
|
|
36855
|
+
if (typeof row.cwd === "string" && isAbsolute3(row.cwd))
|
|
36664
36856
|
return [row.cwd];
|
|
36665
36857
|
if (row.type === "workspace-directories" && Array.isArray(row.directories)) {
|
|
36666
36858
|
for (const cwd of row.directories)
|
|
36667
|
-
if (typeof cwd === "string" &&
|
|
36859
|
+
if (typeof cwd === "string" && isAbsolute3(cwd))
|
|
36668
36860
|
roots.add(cwd);
|
|
36669
36861
|
}
|
|
36670
36862
|
}
|
|
@@ -37536,7 +37728,7 @@ import { join as join16 } from "node:path";
|
|
|
37536
37728
|
// src/agent-runtime/zcode-image-attachments.ts
|
|
37537
37729
|
import { constants } from "node:fs";
|
|
37538
37730
|
import { mkdir as mkdir2, mkdtemp as mkdtemp2, open as open5, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
37539
|
-
import { isAbsolute as
|
|
37731
|
+
import { isAbsolute as isAbsolute4, join as join12, relative as relative2, sep as sep2 } from "node:path";
|
|
37540
37732
|
async function readZCodeHistoryImages(value, storageRoot) {
|
|
37541
37733
|
const images = new Map;
|
|
37542
37734
|
if (!Array.isArray(value))
|
|
@@ -37551,10 +37743,10 @@ async function readZCodeHistoryImages(value, storageRoot) {
|
|
|
37551
37743
|
if (part.type !== "file" || typeof part.url !== "string" || images.has(part.url) || typeof part.mime !== "string" || !/^image\/(?:jpeg|png|gif|webp)$/.test(part.mime))
|
|
37552
37744
|
continue;
|
|
37553
37745
|
const path = nativeRecord(part.source).path;
|
|
37554
|
-
if (typeof path !== "string" || !
|
|
37746
|
+
if (typeof path !== "string" || !isAbsolute4(path))
|
|
37555
37747
|
continue;
|
|
37556
37748
|
const within = relative2(storageRoot, path);
|
|
37557
|
-
if (!within ||
|
|
37749
|
+
if (!within || isAbsolute4(within) || within === ".." || within.startsWith(`..${sep2}`))
|
|
37558
37750
|
continue;
|
|
37559
37751
|
let handle;
|
|
37560
37752
|
try {
|
|
@@ -38263,8 +38455,10 @@ function alive(pid) {
|
|
|
38263
38455
|
// src/agent-runtime/zcode-client.ts
|
|
38264
38456
|
var rows2 = (value) => Array.isArray(value) ? value.map(nativeRecord) : [];
|
|
38265
38457
|
var reasoningEfforts = ["low", "medium", "high", "xhigh", "max"];
|
|
38266
|
-
var
|
|
38267
|
-
|
|
38458
|
+
var nativeReasoningLevel = (value) => {
|
|
38459
|
+
const level = typeof value === "string" ? value : nativeRecord(value).value;
|
|
38460
|
+
return [...reasoningEfforts, "enabled", "disabled"].find((candidate) => candidate === level);
|
|
38461
|
+
};
|
|
38268
38462
|
var todoMcpServers = (configuration) => [{
|
|
38269
38463
|
name: "agentroam-todo",
|
|
38270
38464
|
command: configuration.command,
|
|
@@ -38423,12 +38617,13 @@ class ZCodeClient {
|
|
|
38423
38617
|
if (typeof ref.modelId !== "string" || typeof ref.providerId !== "string" || option.disabledReason)
|
|
38424
38618
|
return [];
|
|
38425
38619
|
const reasoning = nativeRecord(option.reasoning);
|
|
38426
|
-
const
|
|
38427
|
-
const
|
|
38428
|
-
return
|
|
38620
|
+
const levels = [...new Set((Array.isArray(reasoning.levels) ? reasoning.levels : []).flatMap((level) => {
|
|
38621
|
+
const value = nativeReasoningLevel(level);
|
|
38622
|
+
return value ? [value] : [];
|
|
38429
38623
|
}))];
|
|
38624
|
+
const efforts = levels.filter((level) => reasoningEfforts.includes(level));
|
|
38430
38625
|
const defaultEffort = nativeReasoningLevel(reasoning.defaultLevel);
|
|
38431
|
-
if (defaultEffort &&
|
|
38626
|
+
if (defaultEffort && levels.includes(defaultEffort))
|
|
38432
38627
|
this.modelDefaults.set(modelRefKey(ref.providerId, ref.modelId), defaultEffort);
|
|
38433
38628
|
return [{
|
|
38434
38629
|
id: ref.modelId,
|
|
@@ -38873,9 +39068,10 @@ class ZCodeClient {
|
|
|
38873
39068
|
if (this.pendingTodoRuns.get(id)?.signal === signal)
|
|
38874
39069
|
this.pendingTodoRuns.delete(id);
|
|
38875
39070
|
try {
|
|
39071
|
+
const inputId = options?.brokerRunId ?? randomUUID12();
|
|
38876
39072
|
const accepted = await this.rpc.request("session/send", {
|
|
38877
39073
|
sessionId: id,
|
|
38878
|
-
inputId
|
|
39074
|
+
inputId,
|
|
38879
39075
|
content: input,
|
|
38880
39076
|
...attachments.length ? { attachments } : {},
|
|
38881
39077
|
...options?.model ? { modelSelection: {
|
|
@@ -40196,7 +40392,7 @@ async function acpAttachmentBlocks(attachments, localFiles) {
|
|
|
40196
40392
|
// src/agent-runtime/acp-cli-client.ts
|
|
40197
40393
|
var ACP_CLI_LABELS = { grok: "Grok CLI", agy: "Antigravity CLI" };
|
|
40198
40394
|
var SESSION_TIMEOUT_MS = 45000;
|
|
40199
|
-
var
|
|
40395
|
+
var CATALOG_TIMEOUT_MS2 = 8000;
|
|
40200
40396
|
var GROK_SESSION_MODES = [
|
|
40201
40397
|
{ value: "default", label: "默认", description: "工具审批遵循 Grok CLI 当前规则" },
|
|
40202
40398
|
{ value: "plan", label: "计划", description: "使用 Grok 的原生计划模式" }
|
|
@@ -40326,7 +40522,7 @@ class AcpCliClient {
|
|
|
40326
40522
|
return session;
|
|
40327
40523
|
}
|
|
40328
40524
|
listPage(cursor) {
|
|
40329
|
-
return this.rpc.request("session/list", cursor ? { cursor } : {},
|
|
40525
|
+
return this.rpc.request("session/list", cursor ? { cursor } : {}, CATALOG_TIMEOUT_MS2);
|
|
40330
40526
|
}
|
|
40331
40527
|
async list() {
|
|
40332
40528
|
await this.connect();
|
|
@@ -40425,7 +40621,7 @@ class AcpCliClient {
|
|
|
40425
40621
|
if (typeof config.sessionId !== "string" || !config.sessionId) {
|
|
40426
40622
|
throw new RuntimeSessionError(`${this.label} returned no session ID`, "NATIVE_PROTOCOL_ERROR");
|
|
40427
40623
|
}
|
|
40428
|
-
await this.rpc.request("session/close", { sessionId: config.sessionId },
|
|
40624
|
+
await this.rpc.request("session/close", { sessionId: config.sessionId }, CATALOG_TIMEOUT_MS2);
|
|
40429
40625
|
if (!this.models.length)
|
|
40430
40626
|
this.models = acpModels(config);
|
|
40431
40627
|
return this.models;
|
|
@@ -40851,7 +41047,7 @@ import {
|
|
|
40851
41047
|
SQLiteDatabase,
|
|
40852
41048
|
SQLiteEngineSwitchRepository,
|
|
40853
41049
|
EngineSwitchDelivery,
|
|
40854
|
-
cleanEngineHistory,
|
|
41050
|
+
cleanEngineHistory as cleanEngineHistory2,
|
|
40855
41051
|
renderContextHandoff,
|
|
40856
41052
|
scopedHistory,
|
|
40857
41053
|
SessionQueryIndexCache as SessionQueryIndexCache2,
|
|
@@ -40866,7 +41062,7 @@ import { open as open8, readdir as readdir12, realpath as realpath3, stat as sta
|
|
|
40866
41062
|
import { createReadStream as createReadStream4, watch } from "node:fs";
|
|
40867
41063
|
import { createInterface as createInterface4 } from "node:readline";
|
|
40868
41064
|
import { availableParallelism } from "node:os";
|
|
40869
|
-
import { dirname as dirname2, isAbsolute as
|
|
41065
|
+
import { dirname as dirname2, isAbsolute as isAbsolute5, join as join20, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
|
|
40870
41066
|
var CODEX_CATALOG_SCHEMA_VERSION = 1;
|
|
40871
41067
|
var CODEX_COMPATIBILITY_REGISTRY_VERSION = 1;
|
|
40872
41068
|
var CODEX_METADATA_LIMIT_BYTES = 256 * 1024;
|
|
@@ -41259,7 +41455,7 @@ function stringValue(value) {
|
|
|
41259
41455
|
}
|
|
41260
41456
|
function isPathBelow(root, candidate) {
|
|
41261
41457
|
const fromRoot = relative3(resolve8(root), resolve8(candidate));
|
|
41262
|
-
return fromRoot !== "" && fromRoot !== ".." && !fromRoot.startsWith(`..${sep3}`) && !
|
|
41458
|
+
return fromRoot !== "" && fromRoot !== ".." && !fromRoot.startsWith(`..${sep3}`) && !isAbsolute5(fromRoot);
|
|
41263
41459
|
}
|
|
41264
41460
|
function emptyMetrics(breakerOpen) {
|
|
41265
41461
|
return {
|
|
@@ -41497,6 +41693,15 @@ class UnifiedSessionService {
|
|
|
41497
41693
|
}
|
|
41498
41694
|
return adapter.listModels();
|
|
41499
41695
|
}
|
|
41696
|
+
async getCodexComposerCatalog(cwd, fileQuery) {
|
|
41697
|
+
return await this.adapters.get("codex")?.getComposerCatalog?.(cwd, fileQuery) ?? { skills: [], files: [] };
|
|
41698
|
+
}
|
|
41699
|
+
async requestComposerPrediction(id, turnId) {
|
|
41700
|
+
const { adapter, nativeSessionId } = this.resolveAdapter(id);
|
|
41701
|
+
if (adapter.agentType !== "codex")
|
|
41702
|
+
return null;
|
|
41703
|
+
return await adapter.requestComposerPrediction?.(nativeSessionId, turnId) ?? null;
|
|
41704
|
+
}
|
|
41500
41705
|
async list(projectId) {
|
|
41501
41706
|
const sessions = await this.discoverAll();
|
|
41502
41707
|
return sessions.filter((session) => projectId === undefined || session.projectId === projectId);
|
|
@@ -41884,6 +42089,7 @@ class RuntimeNotificationOutbox {
|
|
|
41884
42089
|
constructor(db) {
|
|
41885
42090
|
this.db = db;
|
|
41886
42091
|
db.exec(`CREATE TABLE IF NOT EXISTS native_runtime_todo_context(session_id TEXT PRIMARY KEY,data TEXT NOT NULL);
|
|
42092
|
+
CREATE TABLE IF NOT EXISTS native_runtime_completion_plan(run_id TEXT PRIMARY KEY, todos TEXT NOT NULL);
|
|
41887
42093
|
CREATE TABLE IF NOT EXISTS native_runtime_notification_outbox(id TEXT PRIMARY KEY,session_id TEXT NOT NULL,payload TEXT NOT NULL,destination TEXT NOT NULL,created_at INTEGER NOT NULL);`);
|
|
41888
42094
|
this.timer = setInterval(() => {
|
|
41889
42095
|
this.flush().catch(() => {
|
|
@@ -41907,13 +42113,22 @@ class RuntimeNotificationOutbox {
|
|
|
41907
42113
|
throw new Error("Native session is already bound to another Todo scope");
|
|
41908
42114
|
this.db.prepare("INSERT INTO native_runtime_todo_context(session_id,data) VALUES(?,?) ON CONFLICT(session_id) DO UPDATE SET data=excluded.data").run(sessionId, JSON.stringify(context));
|
|
41909
42115
|
}
|
|
41910
|
-
append(sessionId, runId, sequence, event, createdAt, resolveDestination) {
|
|
42116
|
+
append(sessionId, runId, sequence, event, createdAt, resolveDestination, run) {
|
|
42117
|
+
if (event.type === "todo_update") {
|
|
42118
|
+
const dest = resolveDestination();
|
|
42119
|
+
if (dest?.relayPath && !dest.executionId) {
|
|
42120
|
+
this.db.prepare(`INSERT INTO native_runtime_completion_plan(run_id,todos) VALUES(?,?)
|
|
42121
|
+
ON CONFLICT(run_id) DO UPDATE SET todos=excluded.todos`).run(runId, JSON.stringify(event.todos));
|
|
42122
|
+
}
|
|
42123
|
+
return;
|
|
42124
|
+
}
|
|
41911
42125
|
if (!["ask_user", "approval_resolved", "done", "error", "turn_aborted"].includes(event.type))
|
|
41912
42126
|
return;
|
|
41913
42127
|
const destination = resolveDestination();
|
|
41914
42128
|
if (!destination?.relayPath)
|
|
41915
42129
|
return;
|
|
41916
|
-
|
|
42130
|
+
const completionSource = run && !destination.executionId && event.type === "done" && event.result?.status === "completed" ? { input: run.input, startedAt: run.createdAt } : undefined;
|
|
42131
|
+
this.db.prepare("INSERT OR IGNORE INTO native_runtime_notification_outbox(id,session_id,payload,destination,created_at) VALUES(?,?,?,?,?)").run(`${runId}:${sequence}`, sessionId, JSON.stringify({ runId, event, createdAt, completionSource }), JSON.stringify(destination), createdAt);
|
|
41917
42132
|
}
|
|
41918
42133
|
async bindRun(context, runId) {
|
|
41919
42134
|
if (context.executionId && context.relayPath) {
|
|
@@ -41932,9 +42147,19 @@ class RuntimeNotificationOutbox {
|
|
|
41932
42147
|
if (failed.has(c.serviceId))
|
|
41933
42148
|
continue;
|
|
41934
42149
|
try {
|
|
41935
|
-
|
|
42150
|
+
const payload = JSON.parse(row.payload);
|
|
42151
|
+
if (payload.completionSource) {
|
|
42152
|
+
const plan = this.db.prepare("SELECT todos FROM native_runtime_completion_plan WHERE run_id=?").get(payload.runId);
|
|
42153
|
+
payload.completionSource.plan = plan ? JSON.parse(plan.todos) : [];
|
|
42154
|
+
}
|
|
42155
|
+
await new TodoServiceClient({ serviceId: c.serviceId, descriptorPath: c.relayPath, registry: c.discoveryDirectory }).call("runtime_event", payload);
|
|
41936
42156
|
if (!this.closed)
|
|
41937
|
-
this.db.
|
|
42157
|
+
this.db.transaction(() => {
|
|
42158
|
+
this.db.prepare("DELETE FROM native_runtime_notification_outbox WHERE id=?").run(row.id);
|
|
42159
|
+
if (["done", "error", "turn_aborted"].includes(payload.event.type)) {
|
|
42160
|
+
this.db.prepare("DELETE FROM native_runtime_completion_plan WHERE run_id=?").run(payload.runId);
|
|
42161
|
+
}
|
|
42162
|
+
})();
|
|
41938
42163
|
} catch {
|
|
41939
42164
|
failed.add(c.serviceId);
|
|
41940
42165
|
}
|
|
@@ -42664,7 +42889,7 @@ class NativeRuntimeBrokerState {
|
|
|
42664
42889
|
delete recordedEvent.forkPoint;
|
|
42665
42890
|
}
|
|
42666
42891
|
const sequence = run.nextSequence + 1;
|
|
42667
|
-
this.todoOutbox.append(run.sessionId, runId, sequence, recordedEvent, eventAt, () => this.todoContextForRun(run, this.todoOutbox.get(run.sessionId)));
|
|
42892
|
+
this.todoOutbox.append(run.sessionId, runId, sequence, recordedEvent, eventAt, () => this.todoContextForRun(run, this.todoOutbox.get(run.sessionId)), run);
|
|
42668
42893
|
this.database.db.prepare("INSERT INTO native_runtime_event(run_id, sequence, payload, created_at) VALUES (?, ?, ?, ?)").run(runId, sequence, JSON.stringify(recordedEvent), eventAt);
|
|
42669
42894
|
this.database.db.prepare("UPDATE native_runtime_run SET next_sequence = ? WHERE run_id = ?").run(sequence, runId);
|
|
42670
42895
|
if (recordedEvent.type === "ask_user") {
|
|
@@ -42681,8 +42906,7 @@ class NativeRuntimeBrokerState {
|
|
|
42681
42906
|
`).run(recordedEvent.questionId, run.sessionId, run.input, JSON.stringify(recordedEvent), eventAt);
|
|
42682
42907
|
}
|
|
42683
42908
|
if (isTerminalEvent(recordedEvent)) {
|
|
42684
|
-
const
|
|
42685
|
-
const finalText2 = recordedEvent.type === "done" ? recordedEvent.finalText : previousEvents.map(({ payload }) => parseAgentEvent(payload)).flatMap((entry) => entry?.type === "text_chunk" ? [entry.text] : []).join("");
|
|
42909
|
+
const finalText2 = recordedEvent.type === "done" ? recordedEvent.finalText : this.database.db.prepare("SELECT payload FROM native_runtime_event WHERE run_id = ? ORDER BY sequence ASC").all(runId).map(({ payload }) => parseAgentEvent(payload)).flatMap((entry) => entry?.type === "text_chunk" ? [entry.text] : []).join("");
|
|
42686
42910
|
this.database.db.prepare(`
|
|
42687
42911
|
INSERT OR IGNORE INTO native_runtime_turn_completion(
|
|
42688
42912
|
run_id, session_id, input, final_text, duration_ms, completed_at, result, final_message_id
|
|
@@ -42874,17 +43098,20 @@ class NativeRuntimeBrokerState {
|
|
|
42874
43098
|
throw new RuntimeSessionError("此线程已切换到另一个引擎,请从当前会话继续", "STALE_THREAD");
|
|
42875
43099
|
}
|
|
42876
43100
|
}
|
|
43101
|
+
threadHandoffs(sessionId) {
|
|
43102
|
+
const threadKey = this.engineSwitch.records.threadOfSession(sessionId);
|
|
43103
|
+
return threadKey ? this.engineSwitch.handoffs.summariesForThread(threadKey) : [];
|
|
43104
|
+
}
|
|
42877
43105
|
applyDetail(detail, options = {}) {
|
|
42878
43106
|
const canForkWithHistory = supportsContextFork(detail.agentType);
|
|
42879
43107
|
const fork = canForkWithHistory ? this.engineSwitch.handoffs.forkForSession(detail.id) : null;
|
|
42880
|
-
const
|
|
42881
|
-
const handoffs = threadKey ? this.engineSwitch.handoffs.summariesForThread(threadKey) : [];
|
|
43108
|
+
const handoffs = this.threadHandoffs(detail.id);
|
|
42882
43109
|
if (fork)
|
|
42883
43110
|
handoffs.push(fork);
|
|
42884
43111
|
if (!options.windowed)
|
|
42885
43112
|
detail = { ...detail, messages: this.restoreAcpQuestions(detail.id, detail.messages) };
|
|
42886
43113
|
if (handoffs.length)
|
|
42887
|
-
detail = { ...detail, messages:
|
|
43114
|
+
detail = { ...detail, messages: cleanEngineHistory2(detail.messages, handoffs) };
|
|
42888
43115
|
const summary = this.applySummary(detail);
|
|
42889
43116
|
const projection = this.projection(detail.id);
|
|
42890
43117
|
const mergeProjection = options.mergeProjection ?? true;
|
|
@@ -42925,11 +43152,12 @@ class NativeRuntimeBrokerState {
|
|
|
42925
43152
|
}
|
|
42926
43153
|
}
|
|
42927
43154
|
const completedMessages = applyTurnCompletions(completionMessages, completionRows, { windowed });
|
|
43155
|
+
const projectedCompletedMessages = detail.agentType === "zcode" ? collapseFailedZCodeRetries(completedMessages) : completedMessages;
|
|
42928
43156
|
const harnessInputReceipt = detail.agentType === "deepseek-harness" && mergeProjection && projection.run?.goalId ? this.database.db.prepare(`
|
|
42929
43157
|
SELECT source_message_id FROM native_runtime_message_receipt
|
|
42930
43158
|
WHERE session_id = ? AND queue_item_id = ? AND run_id = ?
|
|
42931
43159
|
`).get(detail.id, projection.run.goalId, projection.run.runId) : undefined;
|
|
42932
|
-
const messages3 = detail.agentType === "copilot" ? this.restoreSteeredMessages(detail.id,
|
|
43160
|
+
const messages3 = detail.agentType === "copilot" ? this.restoreSteeredMessages(detail.id, projectedCompletedMessages) : detail.agentType === "deepseek-harness" && mergeProjection ? restoreHarnessRunInputIdentity(projectedCompletedMessages, projection.run, harnessInputReceipt?.source_message_id) : projectedCompletedMessages;
|
|
42933
43161
|
let snapshotTurnId = null;
|
|
42934
43162
|
for (const { event } of projection.events) {
|
|
42935
43163
|
if ("turnId" in event && typeof event.turnId === "string" && event.turnId)
|
|
@@ -43085,6 +43313,7 @@ class NativeRuntimeBrokerHost {
|
|
|
43085
43313
|
this.state = new NativeRuntimeBrokerState(directory, now);
|
|
43086
43314
|
this.runtime = typeof runtime === "function" ? runtime({
|
|
43087
43315
|
onApprovalResolved: (questionId) => this.handleApprovalResolved(questionId),
|
|
43316
|
+
threadHandoffs: (sessionId) => this.state.threadHandoffs(sessionId),
|
|
43088
43317
|
importedWorkspaceRepository: this.state,
|
|
43089
43318
|
codexSessionCatalogRepository: this.state
|
|
43090
43319
|
}) : runtime;
|
|
@@ -43541,6 +43770,15 @@ class NativeRuntimeBrokerHost {
|
|
|
43541
43770
|
async listModels(agentType) {
|
|
43542
43771
|
return this.runtime.listModels(agentType);
|
|
43543
43772
|
}
|
|
43773
|
+
getCodexComposerCatalog(cwd, fileQuery) {
|
|
43774
|
+
return this.runtime.getCodexComposerCatalog(cwd, fileQuery);
|
|
43775
|
+
}
|
|
43776
|
+
requestComposerPrediction(sessionId, turnId) {
|
|
43777
|
+
this.state.assertSessionVisible(sessionId);
|
|
43778
|
+
if (this.state.activeRun(sessionId))
|
|
43779
|
+
return Promise.resolve(null);
|
|
43780
|
+
return this.runtime.requestComposerPrediction(sessionId, turnId);
|
|
43781
|
+
}
|
|
43544
43782
|
async getGoals(sessionId, controller = "web", resume = true) {
|
|
43545
43783
|
let state14 = this.state.getGoalState(sessionId);
|
|
43546
43784
|
if (!resume || this.goalSteers.has(sessionId))
|
|
@@ -43890,6 +44128,7 @@ class NativeRuntimeBrokerHost {
|
|
|
43890
44128
|
brokerRunId: run.runId,
|
|
43891
44129
|
...runOverrides?.model ? { model: runOverrides.model } : {},
|
|
43892
44130
|
...runOverrides?.reasoningEffort ? { reasoningEffort: runOverrides.reasoningEffort } : {},
|
|
44131
|
+
...run.agentType === "codex" && runOverrides?.codexMode ? { codexMode: runOverrides.codexMode } : {},
|
|
43893
44132
|
...runOverrides?.attachments?.length ? { attachments: runOverrides.attachments } : {},
|
|
43894
44133
|
...run.goalId && activeItem?.id === run.goalId && sessionQueueItemKind(activeItem) === "goal" ? {
|
|
43895
44134
|
goal: {
|
|
@@ -44222,6 +44461,10 @@ class NativeRuntimeBrokerHost {
|
|
|
44222
44461
|
return this.startRun(requireSessionId(sessionId), stringParam(request.params, "input") || "", arrayOfStrings(request.params.images), controllerParam(request.params.controller), undefined, undefined, undefined, runOverridesParam(request.params));
|
|
44223
44462
|
case "listModels":
|
|
44224
44463
|
return this.listModels(nativeAgentTypeParam(request.params, "agentType"));
|
|
44464
|
+
case "getCodexComposerCatalog":
|
|
44465
|
+
return this.getCodexComposerCatalog(stringParam(request.params, "cwd") ?? "", stringParam(request.params, "fileQuery") ?? undefined);
|
|
44466
|
+
case "requestComposerPrediction":
|
|
44467
|
+
return this.requestComposerPrediction(requireSessionId(sessionId), requiredStringParam(request.params, "turnId"));
|
|
44225
44468
|
case "bindTodoContext": {
|
|
44226
44469
|
this.state.todoOutbox.set(requireSessionId(sessionId), request.params.context);
|
|
44227
44470
|
return { ok: true };
|
|
@@ -44546,6 +44789,12 @@ class NativeRuntimeBrokerClient {
|
|
|
44546
44789
|
async getNativeGoal(id) {
|
|
44547
44790
|
return this.request("getNativeGoal", { sessionId: id });
|
|
44548
44791
|
}
|
|
44792
|
+
getCodexComposerCatalog(cwd, fileQuery) {
|
|
44793
|
+
return this.request("getCodexComposerCatalog", { cwd, fileQuery });
|
|
44794
|
+
}
|
|
44795
|
+
requestComposerPrediction(id, turnId) {
|
|
44796
|
+
return this.request("requestComposerPrediction", { sessionId: id, turnId });
|
|
44797
|
+
}
|
|
44549
44798
|
async listBackgroundJobs(id) {
|
|
44550
44799
|
return this.request("listBackgroundJobs", { sessionId: id });
|
|
44551
44800
|
}
|
|
@@ -44730,7 +44979,8 @@ function createNativeRuntimeBrokerHostRuntime(codexExecutable, callbacks, openco
|
|
|
44730
44979
|
const codexAdapter = new CodexRuntimeAdapter({
|
|
44731
44980
|
client: codexClient,
|
|
44732
44981
|
codexExecutable: codexExecutable || "codex",
|
|
44733
|
-
onApprovalResolved: callbacks?.onApprovalResolved
|
|
44982
|
+
onApprovalResolved: callbacks?.onApprovalResolved,
|
|
44983
|
+
threadHandoffs: callbacks?.threadHandoffs
|
|
44734
44984
|
});
|
|
44735
44985
|
const codexCompatibility = callbacks?.codexSessionCatalogRepository ? new CodexSessionCompatibilityService(codexAdapter, new CodexSessionDiskCatalog({
|
|
44736
44986
|
sessionRoot: join21(process.env.CODEX_HOME?.trim() || join21(homedir19(), ".codex"), "sessions"),
|
|
@@ -44881,6 +45131,43 @@ function codexSkillRunInputIndex(messages3, run, events) {
|
|
|
44881
45131
|
const nativeInput = codexSkillPrompt(invocation);
|
|
44882
45132
|
return messages3.findIndex(({ role, content, presentation }) => role === "user" && content === nativeInput && presentation?.executionTrace?.turnId === turnId && presentation.executionTrace.segmentIndex === 0);
|
|
44883
45133
|
}
|
|
45134
|
+
function reconcileCodexReplayText(projected, events) {
|
|
45135
|
+
const nativeIndices = new Map;
|
|
45136
|
+
const completedTurns = new Set;
|
|
45137
|
+
for (const [index, message] of projected.entries()) {
|
|
45138
|
+
if (message.role !== "assistant" || !message.content)
|
|
45139
|
+
continue;
|
|
45140
|
+
const id = message.presentation?.nativeMessageId ?? message.historyId;
|
|
45141
|
+
if (id)
|
|
45142
|
+
nativeIndices.set(id, index);
|
|
45143
|
+
const turnId = message.presentation?.forkPoint?.turnId;
|
|
45144
|
+
if (turnId)
|
|
45145
|
+
completedTurns.add(turnId);
|
|
45146
|
+
}
|
|
45147
|
+
const matched = new Set;
|
|
45148
|
+
const partialReplay = new Map;
|
|
45149
|
+
for (const { event } of events) {
|
|
45150
|
+
if (event.type !== "text_chunk" || !event.turnId || !event.text)
|
|
45151
|
+
continue;
|
|
45152
|
+
const id = codexTraceHistoryId(event.turnId, "agent", event.itemId);
|
|
45153
|
+
if (!id)
|
|
45154
|
+
continue;
|
|
45155
|
+
const index = nativeIndices.get(id);
|
|
45156
|
+
if (index === undefined)
|
|
45157
|
+
continue;
|
|
45158
|
+
matched.add(id);
|
|
45159
|
+
if (!completedTurns.has(event.turnId)) {
|
|
45160
|
+
partialReplay.set(index, (partialReplay.get(index) ?? "") + event.text);
|
|
45161
|
+
}
|
|
45162
|
+
}
|
|
45163
|
+
for (const [index, text2] of partialReplay) {
|
|
45164
|
+
const message = projected[index];
|
|
45165
|
+
if (text2.length > message.content.length && text2.startsWith(message.content)) {
|
|
45166
|
+
projected[index] = { ...message, content: text2 };
|
|
45167
|
+
}
|
|
45168
|
+
}
|
|
45169
|
+
return matched;
|
|
45170
|
+
}
|
|
44884
45171
|
function mergeProjectionMessages(messages3, run, events, runUserIndex = -1) {
|
|
44885
45172
|
if (!run)
|
|
44886
45173
|
return messages3;
|
|
@@ -44906,21 +45193,9 @@ function mergeProjectionMessages(messages3, run, events, runUserIndex = -1) {
|
|
|
44906
45193
|
nextUserIndex = index;
|
|
44907
45194
|
break;
|
|
44908
45195
|
}
|
|
44909
|
-
const
|
|
45196
|
+
const reconciledCodexItems = run.agentType === "codex" ? reconcileCodexReplayText(projected, events) : null;
|
|
45197
|
+
const persistedAssistantText = hasPersistedRunInput ? projected.slice(runUserIndex + 1, nextUserIndex).filter((message) => message.role === "assistant" && (!reconciledCodexItems || message.name !== "__compaction_checkpoint__" && !reconciledCodexItems.has(message.presentation?.nativeMessageId ?? message.historyId ?? ""))).map((message) => message.content).join("") : null;
|
|
44910
45198
|
const nativeTurn = preserveNativeOrder && hasPersistedRunInput ? projected.slice(runUserIndex + 1, nextUserIndex) : [];
|
|
44911
|
-
const completedCodexTurns = new Set;
|
|
44912
|
-
const codexHistoryIds = new Set;
|
|
44913
|
-
if (run.agentType === "codex" && run.status === "terminal") {
|
|
44914
|
-
for (const message of messages3) {
|
|
44915
|
-
if (message.role !== "assistant" || !message.content.trim())
|
|
44916
|
-
continue;
|
|
44917
|
-
if (message.historyId)
|
|
44918
|
-
codexHistoryIds.add(message.historyId);
|
|
44919
|
-
const turnId = message.presentation?.forkPoint?.turnId;
|
|
44920
|
-
if (turnId)
|
|
44921
|
-
completedCodexTurns.add(turnId);
|
|
44922
|
-
}
|
|
44923
|
-
}
|
|
44924
45199
|
const nativeReasoning = nativeTurn.flatMap((message) => (message.presentation?.reasoning ?? []).map((section) => ({ message, section })));
|
|
44925
45200
|
const persistedReasoningText = nativeReasoning.map(({ section }) => section.text).join("");
|
|
44926
45201
|
let consumedReasoningText = 0;
|
|
@@ -44959,10 +45234,12 @@ function mergeProjectionMessages(messages3, run, events, runUserIndex = -1) {
|
|
|
44959
45234
|
}
|
|
44960
45235
|
if (event.type !== "text_chunk" && event.type !== "tool_call")
|
|
44961
45236
|
continue;
|
|
44962
|
-
if (event.type === "text_chunk" && event.turnId &&
|
|
44963
|
-
const
|
|
44964
|
-
if (
|
|
45237
|
+
if (event.type === "text_chunk" && event.turnId && reconciledCodexItems?.size) {
|
|
45238
|
+
const id = codexTraceHistoryId(event.turnId, "agent", event.itemId);
|
|
45239
|
+
if (id && reconciledCodexItems.has(id)) {
|
|
45240
|
+
activeAssistantIndex = null;
|
|
44965
45241
|
continue;
|
|
45242
|
+
}
|
|
44966
45243
|
}
|
|
44967
45244
|
if (activeAssistantIndex === null) {
|
|
44968
45245
|
activeAssistantIndex = eventMessages.length;
|
|
@@ -45155,6 +45432,41 @@ function applyTurnCompletions(messages3, rows3, options = {}) {
|
|
|
45155
45432
|
}
|
|
45156
45433
|
return completed;
|
|
45157
45434
|
}
|
|
45435
|
+
function collapseFailedZCodeRetries(messages3) {
|
|
45436
|
+
const isTurnInput = (message) => message.role === "user" && !message.name?.startsWith("__native_steered:") && message.name !== "__native_steering_pending";
|
|
45437
|
+
const turns = [];
|
|
45438
|
+
for (let start = 0;start < messages3.length; start += 1) {
|
|
45439
|
+
if (!isTurnInput(messages3[start]))
|
|
45440
|
+
continue;
|
|
45441
|
+
let end = messages3.length;
|
|
45442
|
+
for (let index = start + 1;index < messages3.length; index += 1) {
|
|
45443
|
+
if (isTurnInput(messages3[index])) {
|
|
45444
|
+
end = index;
|
|
45445
|
+
break;
|
|
45446
|
+
}
|
|
45447
|
+
}
|
|
45448
|
+
const result = messages3.slice(start, end).map((message) => message.presentation?.runResult).find(Boolean);
|
|
45449
|
+
const completed = result?.status === "completed" || messages3.slice(start, end).some((message) => {
|
|
45450
|
+
const duration = message.presentation?.completionDurationMs;
|
|
45451
|
+
return typeof duration === "number" && Number.isFinite(duration) && duration >= 0;
|
|
45452
|
+
});
|
|
45453
|
+
turns.push({ start, end, input: messages3[start].content, result, completed });
|
|
45454
|
+
start = end - 1;
|
|
45455
|
+
}
|
|
45456
|
+
const removed = new Set;
|
|
45457
|
+
const successfulInputsAfter = new Set;
|
|
45458
|
+
for (let index = turns.length - 1;index >= 0; index -= 1) {
|
|
45459
|
+
const turn = turns[index];
|
|
45460
|
+
const failed = turn.result?.status === "failed" || turn.result?.status === "interrupted";
|
|
45461
|
+
if (failed && successfulInputsAfter.has(turn.input)) {
|
|
45462
|
+
for (let messageIndex = turn.start;messageIndex < turn.end; messageIndex += 1)
|
|
45463
|
+
removed.add(messageIndex);
|
|
45464
|
+
}
|
|
45465
|
+
if (turn.completed)
|
|
45466
|
+
successfulInputsAfter.add(turn.input);
|
|
45467
|
+
}
|
|
45468
|
+
return removed.size ? messages3.filter((_message, index) => !removed.has(index)) : messages3;
|
|
45469
|
+
}
|
|
45158
45470
|
function missingProjectionMessage(messages3, candidate, persistedAssistantText) {
|
|
45159
45471
|
const assistantMessages = messages3.filter((message) => message.role === "assistant");
|
|
45160
45472
|
let content = candidate.content;
|
|
@@ -45299,8 +45611,13 @@ function runOverridesParam(params) {
|
|
|
45299
45611
|
const options = normalizeSessionMessageRunOptions(params.runOverrides);
|
|
45300
45612
|
if (!options)
|
|
45301
45613
|
return;
|
|
45302
|
-
const { model, reasoningEffort, attachments } = options;
|
|
45303
|
-
return {
|
|
45614
|
+
const { model, reasoningEffort, attachments, codexMode } = options;
|
|
45615
|
+
return {
|
|
45616
|
+
...model ? { model } : {},
|
|
45617
|
+
...reasoningEffort ? { reasoningEffort } : {},
|
|
45618
|
+
...attachments?.length ? { attachments } : {},
|
|
45619
|
+
...codexMode ? { codexMode } : {}
|
|
45620
|
+
};
|
|
45304
45621
|
}
|
|
45305
45622
|
function queryParam(params) {
|
|
45306
45623
|
const before = stringParam(params, "before") || undefined;
|
|
@@ -52270,7 +52587,7 @@ class StdioServerTransport {
|
|
|
52270
52587
|
// src/todo-mcp/stdio.ts
|
|
52271
52588
|
function createTodoMcpServer(client, scope) {
|
|
52272
52589
|
const allowed = scope === "execution" ? TODO_TOOLS.filter((t) => ["todo_get", "todo_report_execution"].includes(t.name)) : TODO_TOOLS.filter((t) => t.name !== "todo_report_execution");
|
|
52273
|
-
const server = new Server({ name: "agentroam-todo", version: "1.0.0" }, { capabilities: { tools: {} }, instructions: TODO_TOOL_INSTRUCTIONS });
|
|
52590
|
+
const server = new Server({ name: "agentroam-todo", version: "1.0.0" }, { capabilities: { tools: {} }, instructions: scope === "execution" ? TODO_EXECUTION_INSTRUCTIONS : TODO_TOOL_INSTRUCTIONS });
|
|
52274
52591
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: allowed }));
|
|
52275
52592
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
52276
52593
|
try {
|
|
@@ -52345,4 +52662,4 @@ export {
|
|
|
52345
52662
|
AcpCliRuntimeAdapter
|
|
52346
52663
|
};
|
|
52347
52664
|
|
|
52348
|
-
//# debugId=
|
|
52665
|
+
//# debugId=2538557D94E6A10D64756E2164756E21
|