agentroam-runtime-darwin-arm64 0.2.0-preview.76 → 0.2.0-preview.77
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-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +2 -2
- package/runtime/.next/prerender-manifest.json +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/abort/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js.nft.json +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/run/route.js.nft.json +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/steer/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
- package/runtime/.next/server/app/api/agent/stream/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js.nft.json +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 +4 -4
- package/runtime/.next/server/app/api/collaboration/route.js.nft.json +1 -1
- 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/catalog/route.js.nft.json +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]/cancel/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -4
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/notifications/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/notifications/stream/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/stream/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/subscribe/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/push/vapid/route.js +3 -3
- package/runtime/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js.nft.json +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 +3 -3
- 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/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js.nft.json +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]/query-index/route.js.nft.json +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]/route.js.nft.json +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-goal/route.js.nft.json +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/parallel/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/todos/route.js +1 -1
- package/runtime/.next/server/app/api/todos/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js.nft.json +1 -1
- package/runtime/.next/server/app-paths-manifest.json +36 -36
- package/runtime/.next/server/chunks/535.js +1 -0
- package/runtime/.next/server/chunks/5762.js +3 -3
- package/runtime/.next/server/chunks/5801.js +1 -1
- package/runtime/.next/server/chunks/5812.js +1 -0
- package/runtime/.next/server/chunks/685.js +1 -0
- package/runtime/.next/server/chunks/9119.js +4 -4
- package/runtime/.next/server/chunks/9457.js +1 -4
- 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/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 +17 -17
- package/runtime/node_modules/@agent/core/dist/index.js +9 -4
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +439 -90
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +81 -85
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +65 -65
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0vfvgmex.mjs +39 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-k19jejpn.mjs → core-3h0s3zzg.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-a8ty0dnc.mjs → core-6w7w19rc.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-8fprsbvz.mjs +42 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-avz7wgsg.mjs +23 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b9ebje8h.mjs +20 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-kag24kjr.mjs → core-e1h3fbg3.mjs} +3 -3
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ae73vzp2.mjs → core-ge6en8c9.mjs} +4 -4
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-e93r8awg.mjs → core-htcq9qj1.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-v6sp3qjw.mjs → core-nv0a4kre.mjs} +4 -4
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y4qk5bdp.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-nfa6p2rw.mjs → core-yrdmz7je.mjs} +3 -3
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-z276fcqp.mjs +28 -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 +21 -21
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +23 -25
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +85 -85
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +72 -45
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +13 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +13 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +72 -45
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +72 -45
- package/runtime/node_modules/mediabunny/dist/modules/src/input.js +6 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +52 -35
- package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +2 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +7 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/source.js +7 -4
- 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/wave/wave-demuxer.js +6 -6
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/input.ts +7 -0
- package/runtime/node_modules/mediabunny/src/media-sink.ts +56 -37
- package/runtime/node_modules/mediabunny/src/media-source.ts +3 -0
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +6 -1
- package/runtime/node_modules/mediabunny/src/source.ts +7 -4
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/node_modules/mediabunny/src/wave/wave-demuxer.ts +6 -6
- package/runtime/node_modules/source-map-js/lib/quick-sort.js +92 -22
- package/runtime/node_modules/source-map-js/package.json +1 -1
- package/runtime/package-lock.json +41 -65
- package/runtime/webapp/dist/assets/{AIHubView-DF0D5qd2.js → AIHubView-CrtJMKfW.js} +1 -1
- package/runtime/webapp/dist/assets/{AgentManager-Ccj6ZefC.js → AgentManager-C2O-Dacy.js} +1 -1
- package/runtime/webapp/dist/assets/{AiHubPane-3PRSxzO0.js → AiHubPane-D2XWxc9R.js} +1 -1
- package/runtime/webapp/dist/assets/App-Bum2L4_E.js +63 -0
- package/runtime/webapp/dist/assets/{BrowserLivePanel-BZDtF0ne.js → BrowserLivePanel-DkBugqrH.js} +13 -18
- package/runtime/webapp/dist/assets/{CalendarPage-B8Jo-3Da.js → CalendarPage-DzYWlqoZ.js} +1 -1
- package/runtime/webapp/dist/assets/CalendarView-BjjC_t12.css +1 -0
- package/runtime/webapp/dist/assets/CalendarView-HQls5G-1.js +31 -0
- package/runtime/webapp/dist/assets/{CollaborationCreateDialog-CU1t0iYL.js → CollaborationCreateDialog-BwiSJbjb.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationDashboard-BZhWQXzn.js → CollaborationDashboard-CNHt31kl.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationPage-BwRJN55v.js → CollaborationPage-C4l-tTvn.js} +2 -2
- package/runtime/webapp/dist/assets/{FilePreview-Oo8sZH0t.js → FilePreview-EGUAbGpH.js} +3 -3
- package/runtime/webapp/dist/assets/{FileTree-qJTRdDPQ.js → FileTree-aJGl1V0W.js} +1 -1
- package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-D40WNAqC.js → FileWorkspaceDrawer-zpD91eB6.js} +1 -1
- package/runtime/webapp/dist/assets/{FlowStudioPane-C1tgSbGo.js → FlowStudioPane-K1o4pSkZ.js} +1 -1
- package/runtime/webapp/dist/assets/{HostProjectPicker-BEfXuqxT.js → HostProjectPicker-BvboCQ0a.js} +1 -1
- package/runtime/webapp/dist/assets/{LSPServerList-DQRv04aP.js → LSPServerList-BSLzGLtW.js} +1 -1
- package/runtime/webapp/dist/assets/{MCPServerList-BmsejJC9.js → MCPServerList-CeWTI1-m.js} +1 -1
- package/runtime/webapp/dist/assets/{MemoryViewer-qZMdVrli.js → MemoryViewer-YcceFawC.js} +1 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-C_HCQQnW.js +1 -0
- package/runtime/webapp/dist/assets/NewSessionWindow-DOLG1XEp.css +1 -0
- package/runtime/webapp/dist/assets/{RemoteDesktopPage-Dz_6-rOL.js → RemoteDesktopPage-Cpzv8zH0.js} +1 -1
- package/runtime/webapp/dist/assets/{RunningSessionsIcon-DJxTmxZn.js → RunningSessionsIcon-DmCYwIYD.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboard-DuR9r_ZP.js → SessionDashboard-C58Mke8a.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboardBridge-BHVjvDHa.js → SessionDashboardBridge-BPsNDY5Y.js} +1 -1
- package/runtime/webapp/dist/assets/{SettingsPanel-B-g919uV.js → SettingsPanel-CPBIPT-Z.js} +1 -1
- package/runtime/webapp/dist/assets/{SkillManager-nrWIOtEO.js → SkillManager-_qaGEuOE.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-C4HiD2IC.js → TerminalPane-mYe76Pgb.js} +1 -1
- package/runtime/webapp/dist/assets/TodoPage-DdF5_SkL.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-BXRYzdBT.js → abnfDiagram-VCTEODGH-DLd8EeCY.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-BeG7yjCw.js → arc-D4smlqs5.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-DIQbpqn7.js → architectureDiagram-5GKGNRK7-ByE3DRU4.js} +1 -1
- package/runtime/webapp/dist/assets/{arrow-right-B03zMFiC.js → arrow-right-BtIv2jiq.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DvgKV01C.js → blockDiagram-I7D4REHJ-BvTUm5vA.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DIr7nDIg.js → c4Diagram-7LVT6UL2-XKwj5RmQ.js} +1 -1
- package/runtime/webapp/dist/assets/{calendar-days-D1OJEOKr.js → calendar-days-BeI09qof.js} +1 -1
- package/runtime/webapp/dist/assets/channel-wxCRUEc2.js +1 -0
- package/runtime/webapp/dist/assets/{check-BDiCDSY5.js → check-BdadwkYj.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-down-DIt_NscV.js → chevron-down-DwzPFeq8.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-right-DVhYkZeF.js → chevron-right-kcIXzCMb.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cykdc4to.js → chunk-2Q5K7J3B-7A6CDWIw.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-DL-gBU30.js → chunk-5VM5RSS4-mkNEWbY6.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-z0F9O96j.js → chunk-F27PBJKO-DKG-1HL0.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-DcSgatN1.js → chunk-IMKFNOWR-kiJDyKM7.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-BmG1ozp9.js → chunk-JWPE2WC7-DS7C5_M7.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BK2jifSN.js → chunk-POPQ4Y6H-DvgeK_lX.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DtInGjiG.js → chunk-SVP7TREG-BLo_2ua-.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DWdiL4Y6.js → chunk-TICWLB2K-CJT6Qkz4.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-w8UYxZUB.js → chunk-XXDRQBXY-D1OLqjNu.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-Ct3Cgqrl.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-Ct3Cgqrl.js +1 -0
- package/runtime/webapp/dist/assets/{codeSyntax-Cprr1Nm9.js → codeSyntax-Dd0hAazb.js} +1 -1
- package/runtime/webapp/dist/assets/collaboration-CAgt9AiV.js +6 -0
- package/runtime/webapp/dist/assets/composer-file-routing-DSC2Eojr.js +6 -0
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-BJgwy7Y5.js → cose-bilkent-JH36ORCC-CI6EKHP8.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BssWa1kU.js → cynefin-OW5HDTMX-CJTXYieX.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-Bv_-fuG_.js → cynefinDiagram-5FMLGOSQ-CPl1UVhy.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BjA5n2Zi.js → dagre-GXQ25YYZ-Dq3ZQGTN.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-CCT38L0E.js → diagram-S7CK7UJ4-DJyU-2Di.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-4fLw8kje.js → diagram-UQ7AKVKN-Csg8hC8m.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-43_Qj0Se.js → diagram-VSXAHHWV-B14uLH_N.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-BHEXgMDZ.js → diagram-VX7I27RA-D2Ww2nHe.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-BRTSiXVr.js → diagram-Z3DM3KII-D_YC6AVP.js} +1 -1
- package/runtime/webapp/dist/assets/{download-CuYS63Ny.js → download-COWHIKec.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-B4GImY-o.js → ebnfDiagram-PWID7BFC-s66xVEGY.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-EmEsAxWS.js → erDiagram-RLTQ6QDP-CgZh5cEn.js} +1 -1
- package/runtime/webapp/dist/assets/{external-link-Baeyco26.js → external-link-T3kil1jt.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-CykGmGsd.js → file-types-0e-tNIVd.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-sky_wmbX.js → flowDiagram-HODETNUW-BISMKynN.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-Cc71xV1j.js → ganttDiagram-EL5Y4UJY-Cbyu0NcF.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-z7uQ8-8z.js → gitGraphDiagram-WWUBYQGX-Cs6IQGBz.js} +1 -1
- package/runtime/webapp/dist/assets/{history-C7WUwl_W.js → history-Df4LXw6L.js} +1 -1
- package/runtime/webapp/dist/assets/{image-plus-B2RK1ogI.js → image-plus-COHCHOpI.js} +1 -1
- package/runtime/webapp/dist/assets/index-CQTDnt74.css +1 -0
- package/runtime/webapp/dist/assets/{index-d8fS3JdV.js → index-CTJNAMck.js} +52 -52
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DXLEePz0.js → infoDiagram-27XIBGKW-4f3bFqNV.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-DCFXm_zQ.js → ishikawaDiagram-5VMMS53U-D-cJ9vio.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-DHWCpvY6.js → journeyDiagram-3NMN7TZE-CeToS0Qx.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-D_uP81aw.js → kanban-definition-UXKFOSKX-DStbIUk1.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-Bcu83-1p.js → layout-i2D4wlYd.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-CPim5SQa.js → linear-BcJhiCv3.js} +1 -1
- package/runtime/webapp/dist/assets/{list-todo-F1W4yBLx.js → list-todo-7yETOqQe.js} +1 -1
- package/runtime/webapp/dist/assets/{loader-circle-DesEGpVH.js → loader-circle-CZdAfU-D.js} +1 -1
- package/runtime/webapp/dist/assets/{locate-fixed-UXM91vCS.js → locate-fixed-ByJuEKxC.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-CyzKk3O2.js → mermaid.core-BjNFAB9I.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-0MHQpQro.js → mindmap-definition-YA3MSWOX-BUIHHUVG.js} +1 -1
- package/runtime/webapp/dist/assets/new-session-window-C7R76XMp.css +1 -0
- package/runtime/webapp/dist/assets/new-session-window-DwtkwFBQ.js +190 -0
- package/runtime/webapp/dist/assets/{page-C2e368Dx.js → page-9-9EC7QM.js} +3 -3
- package/runtime/webapp/dist/assets/{pause-_h6c8qPD.js → pause-DXyBDZlg.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BNinoE-7.js → pegDiagram-XKGWAZYB-BY5Bio5e.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-CfPzV9yb.js → pieDiagram-E7YTZNPT-CF8DVW3F.js} +1 -1
- package/runtime/webapp/dist/assets/{pin-BcXr5230.js → pin-2YlrlSJv.js} +1 -1
- package/runtime/webapp/dist/assets/{play-BdB0D0rZ.js → play-BxEpdvoI.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-0qLb33lM.js → quadrantDiagram-AXDQQJYC-CXWHO3a-.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-DNU4eRJt.js → railroadDiagram-O6MQD6OU-C20JeJZ-.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-BWJRwKX8.js → requirementDiagram-BXWQKSXE-IYd9UrO9.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-ccw-BdZpOTYP.js → rotate-ccw-CFIRtbUD.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-D-zPMe4i.js → rotate-cw-B_vFqNsz.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-CGW9pvun.js → sankeyDiagram-P5KCCOFB-ysBhpblA.js} +1 -1
- package/runtime/webapp/dist/assets/{send-DCVOqOap.js → send-DUE2vBoK.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-CeVAD519.js → sequenceDiagram-WJ2MYXX4-CQMmk6cu.js} +1 -1
- package/runtime/webapp/dist/assets/session-dashboard-DnFhQhBN.js +1 -0
- package/runtime/webapp/dist/assets/{shield-check-DrxVJwVC.js → shield-check-Btyos6Iv.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-Dj5SukiO.js → sizeCapture-INFHLROL-DekvKUn1.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-UtRSslyd.js → stateDiagram-D77RDMKH-Ds_FEmbr.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DxJ1ks_8.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-DKbrz8SF.js → swimlanes-42K2YHIH-cjPcEO_T.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-JGHIAQXy.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-mtVdMOBL.js → timeline-definition-24CTP7MA-CEOprVt5.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-Bbhd8-xd.js → trash-2-DLDxY6J7.js} +1 -1
- package/runtime/webapp/dist/assets/{types-CMhUwzwJ.js → types-CFAnlTif.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-ZcuGEhJx.js → vennDiagram-4TSXK5OY-D82uxYY9.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CnAYI2ZE.js → wardleyDiagram-VM6X3IG4-JFt7Izt0.js} +1 -1
- package/runtime/webapp/dist/assets/{web-BH9JgWsL.js → web-BMqaP0jw.js} +1 -1
- package/runtime/webapp/dist/assets/{web-CBiaPgEe.js → web-Q9VPRftY.js} +1 -1
- package/runtime/webapp/dist/assets/{x-1GQMVfza.js → x-CeSbythI.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-B_uJt0Bg.js → xychartDiagram-S5SC5T6Z-1WCa4SfL.js} +1 -1
- package/runtime/webapp/dist/assets/{zoom-out-BNKdrTFD.js → zoom-out-CRr_o1NV.js} +8 -3
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/ws-server.mjs +11 -0
- package/runtime/.next/server/chunks/2480.js +0 -4
- package/runtime/.next/server/chunks/3604.js +0 -4
- package/runtime/.next/server/chunks/732.js +0 -1
- package/runtime/.next/server/chunks/7788.js +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-25bstexa.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-4ps8vwh1.mjs +0 -42
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9a7zb9bm.mjs +0 -53
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dsa3p77h.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-eqz9ara6.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-esw7xtkz.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ey906mbk.mjs +0 -20
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-mhczx7zp.mjs +0 -18
- package/runtime/webapp/dist/assets/App-HomcUet2.js +0 -63
- package/runtime/webapp/dist/assets/CalendarView-BD7GhA0i.js +0 -36
- package/runtime/webapp/dist/assets/CalendarView-DHi-mzjY.css +0 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-BOCZ0mXT.css +0 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-uzVK5LVS.js +0 -1
- package/runtime/webapp/dist/assets/TodoPage-Bn6j6kR6.js +0 -1
- package/runtime/webapp/dist/assets/channel-Cchxg6Fx.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BGv4sK1I.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BGv4sK1I.js +0 -1
- package/runtime/webapp/dist/assets/collaboration-acdqOxaY.js +0 -6
- package/runtime/webapp/dist/assets/composer-file-routing-BsSxfxUa.js +0 -6
- package/runtime/webapp/dist/assets/index-B_fTpc5K.css +0 -1
- package/runtime/webapp/dist/assets/new-session-window-B4BJYrds.css +0 -1
- package/runtime/webapp/dist/assets/new-session-window-fsYu53Ht.js +0 -188
- package/runtime/webapp/dist/assets/session-dashboard-BAYi5acZ.js +0 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Se3lznH6.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C-Zsmae7.js +0 -8
- /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_ssgManifest.js +0 -0
|
@@ -17442,20 +17442,24 @@ class TodoServiceClient {
|
|
|
17442
17442
|
var str = { type: "string" };
|
|
17443
17443
|
var num = { type: "integer", minimum: 0 };
|
|
17444
17444
|
var trigger = { oneOf: [{ type: "object", properties: { kind: { const: "once" }, at: num }, required: ["kind", "at"], additionalProperties: false }, { type: "object", properties: { kind: { const: "cron" }, expression: str }, required: ["kind", "expression"], additionalProperties: false }] };
|
|
17445
|
-
var target = { type: "object", properties: { agentType: str, model: str, cwd: str, permissionMode: { enum: ["default", "acceptEdits", "bypassPermissions"] } },
|
|
17445
|
+
var target = { type: "object", properties: { agentType: str, model: str, cwd: str, permissionMode: { enum: ["default", "acceptEdits", "bypassPermissions"] } }, additionalProperties: false };
|
|
17446
17446
|
var tool = (name, description, properties, required) => ({ name, description, inputSchema: { type: "object", properties, required, additionalProperties: false } });
|
|
17447
17447
|
var existing = { taskId: str, expectedVersion: num, requestId: str };
|
|
17448
|
-
var TODO_TOOL_INSTRUCTIONS = "这些工具管理 AgentRoam 日历中可见的个人待办,跨会话和 Agent 持久保存,与会话临时计划、Wiki 工作线程不同。用户要求创建个人待办或日历待办时,使用 todo_create
|
|
17448
|
+
var TODO_TOOL_INSTRUCTIONS = "这些工具管理 AgentRoam 日历中可见的个人待办,跨会话和 Agent 持久保存,与会话临时计划、Wiki 工作线程不同。用户要求创建个人待办或日历待办时,使用 todo_create。要求到点执行时,创建 scheduled 待办并启用执行计划,使用本工具集,不调用引擎原生 CronCreate。创建时省略 target 会交给发起会话的 Agent。只有用户明确指定时才另选 Agent。改派或改时间时先用 todo_get 获取版本,再用 todo_schedule 提交变更。不要把 Wiki 待办、Markdown 文件或会话计划当作已同步到 AgentRoam 日历。只有工具成功返回待办 ID 才能确认创建;无日期的待办显示在日历的未安排区域。写操作必须使用稳定唯一 requestId,重试同一操作沿用原值。更新前 todo_get 取得 version。普通待办只提醒;只有显式 scheduled 类型并启用执行计划才自动启动 Agent。普通待办仅按用户操作或明确管理指令更新;用户明确说完成可 todo_complete,明确开始可 todo_start。定时执行凭据必须 todo_report_execution 报告,不能完成整个周期事项。";
|
|
17449
17449
|
var TODO_TOOLS = [
|
|
17450
|
-
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"
|
|
17450
|
+
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"]),
|
|
17451
17451
|
tool("todo_get", "读取待办、version、提醒、执行计划和最近十次执行;执行凭据只读取本次待办。", { taskId: str }, ["taskId"]),
|
|
17452
17452
|
tool("todo_list", "列出 AgentRoam 日历中跨会话的个人待办;不扫描 Wiki 待办或会话临时计划。", { status: { enum: ["pending", "in_progress", "completed", "failed", "cancelled"] }, kind: { enum: ["normal", "scheduled"] }, limit: num, cursor: str }, []),
|
|
17453
17453
|
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"]),
|
|
17454
17454
|
...["start", "complete", "cancel", "reopen"].map((action) => tool(`todo_${action}`, { start: "标记实际已开始的待办为进行中。", complete: "确认完成后打勾并停用自有提醒/执行计划。", cancel: "取消待办并停止未来提醒/执行。", reopen: "重新打开;不会自动恢复旧提醒或旧执行计划。" }[action], existing, Object.keys(existing))),
|
|
17455
17455
|
tool("todo_remind", "设置一次性/五字段 cron 提醒,timeZone 默认 Asia/Shanghai;trigger=null 停止提醒。不会启动 Agent。", { ...existing, trigger: { anyOf: [trigger, { type: "null" }] }, timeZone: str }, [...Object.keys(existing), "trigger"]),
|
|
17456
17456
|
tool("todo_link_schedule", "关联外部定时任务的稳定 scheduleRef,仅关联,不启动、不停止外部任务。", { ...existing, scheduleRef: str, label: str }, [...Object.keys(existing), "scheduleRef"]),
|
|
17457
|
-
tool("todo_schedule", "
|
|
17458
|
-
tool("todo_report_execution", "
|
|
17457
|
+
tool("todo_schedule", "修改 scheduled 待办的执行计划。改派时只传 target.agentType,改时间时只传 trigger,保留其他设置。一次性触发使用毫秒时间戳。保留现有 enabled 状态,除非用户要求启用或暂停。", { ...existing, enabled: { type: "boolean" }, trigger, timeZone: str, target }, [...Object.keys(existing), "enabled"]),
|
|
17458
|
+
tool("todo_report_execution", "报告当前定时执行的进度或最终结果。进度回报和最终回报各使用独立的 requestId。运行成功结束后才会结算。", {
|
|
17459
|
+
requestId: { ...str, description: "使用定时执行指令给出的对应编号。只有原样重试同一份回报时才复用该编号。" },
|
|
17460
|
+
outcome: { enum: ["progress", "succeeded", "failed"] },
|
|
17461
|
+
summary: str
|
|
17462
|
+
}, ["requestId", "outcome", "summary"])
|
|
17459
17463
|
];
|
|
17460
17464
|
function todoToolOperation(name, input) {
|
|
17461
17465
|
if (!TODO_TOOLS.some((t) => t.name === name))
|
|
@@ -31362,7 +31366,7 @@ class CodexRuntimeAdapter {
|
|
|
31362
31366
|
rolloutCommentaryReader;
|
|
31363
31367
|
rolloutUserMessageReader;
|
|
31364
31368
|
agentMessagePhases = new Map;
|
|
31365
|
-
|
|
31369
|
+
emittedInstantToolItems = new Map;
|
|
31366
31370
|
todoMcp = new Map;
|
|
31367
31371
|
freshTodoThreads = new Set;
|
|
31368
31372
|
nativePagingSupported = true;
|
|
@@ -32204,7 +32208,12 @@ class CodexRuntimeAdapter {
|
|
|
32204
32208
|
}
|
|
32205
32209
|
async archiveSession(nativeSessionId) {
|
|
32206
32210
|
this.ensureAvailable();
|
|
32207
|
-
|
|
32211
|
+
try {
|
|
32212
|
+
await this.client.request("thread/archive", { threadId: nativeSessionId });
|
|
32213
|
+
} catch (error) {
|
|
32214
|
+
if (!(error instanceof RuntimeSessionError && error.code === "NATIVE_PROTOCOL_ERROR" && error.message === `no rollout found for thread id ${nativeSessionId}`))
|
|
32215
|
+
throw error;
|
|
32216
|
+
}
|
|
32208
32217
|
}
|
|
32209
32218
|
async* run(nativeSessionId, input, images, _agentIds, _agentName, options) {
|
|
32210
32219
|
if (this.activeQueues.has(nativeSessionId)) {
|
|
@@ -32339,7 +32348,7 @@ class CodexRuntimeAdapter {
|
|
|
32339
32348
|
this.desktopContinuations.delete(nativeSessionId);
|
|
32340
32349
|
this.clearAsyncInputs(nativeSessionId);
|
|
32341
32350
|
this.activeTurnIds.delete(nativeSessionId);
|
|
32342
|
-
this.
|
|
32351
|
+
this.emittedInstantToolItems.delete(nativeSessionId);
|
|
32343
32352
|
this.runUsages.delete(nativeSessionId);
|
|
32344
32353
|
this.clearLocalInterruptionTimer(nativeSessionId);
|
|
32345
32354
|
this.locallyInterruptedTurnIds.delete(nativeSessionId);
|
|
@@ -32516,7 +32525,7 @@ ${value2}`, text_elements: [] }]
|
|
|
32516
32525
|
for (const continuation of this.desktopContinuations.values())
|
|
32517
32526
|
continuation.close();
|
|
32518
32527
|
this.desktopContinuations.clear();
|
|
32519
|
-
this.
|
|
32528
|
+
this.emittedInstantToolItems.clear();
|
|
32520
32529
|
await Promise.all([...this.freshTodoThreads].map((threadId) => this.client.request("thread/unsubscribe", { threadId }).catch(() => {
|
|
32521
32530
|
return;
|
|
32522
32531
|
})));
|
|
@@ -32773,13 +32782,13 @@ ${value2}`, text_elements: [] }]
|
|
|
32773
32782
|
if (message.method === "item/started") {
|
|
32774
32783
|
const toolCall = codexItemToToolCall(params.item);
|
|
32775
32784
|
if (toolCall) {
|
|
32776
|
-
if (
|
|
32777
|
-
const emitted = this.
|
|
32785
|
+
if (isCodexInstantToolItem(notificationItem)) {
|
|
32786
|
+
const emitted = this.emittedInstantToolItems.get(threadId) ?? new Set;
|
|
32778
32787
|
const key = `${eventTurnId ?? ""}:${toolCall.id}`;
|
|
32779
32788
|
if (emitted.has(key))
|
|
32780
32789
|
return;
|
|
32781
32790
|
emitted.add(key);
|
|
32782
|
-
this.
|
|
32791
|
+
this.emittedInstantToolItems.set(threadId, emitted);
|
|
32783
32792
|
}
|
|
32784
32793
|
queue.push({ type: "tool_call", toolCall, ...eventTurnId ? { turnId: eventTurnId } : {} });
|
|
32785
32794
|
}
|
|
@@ -32789,8 +32798,8 @@ ${value2}`, text_elements: [] }]
|
|
|
32789
32798
|
if (notificationItem?.type === "agentMessage" && typeof notificationItem.id === "string") {
|
|
32790
32799
|
this.agentMessagePhases.delete(`${threadId}:${notificationItem.id}`);
|
|
32791
32800
|
}
|
|
32792
|
-
if (
|
|
32793
|
-
const emitted = this.
|
|
32801
|
+
if (isCodexInstantToolItem(notificationItem) && notificationItem?.id) {
|
|
32802
|
+
const emitted = this.emittedInstantToolItems.get(threadId) ?? new Set;
|
|
32794
32803
|
const key = `${eventTurnId ?? ""}:${notificationItem.id}`;
|
|
32795
32804
|
if (emitted.has(`${key}:completed`))
|
|
32796
32805
|
return;
|
|
@@ -32800,7 +32809,7 @@ ${value2}`, text_elements: [] }]
|
|
|
32800
32809
|
emitted.add(key);
|
|
32801
32810
|
}
|
|
32802
32811
|
emitted.add(`${key}:completed`);
|
|
32803
|
-
this.
|
|
32812
|
+
this.emittedInstantToolItems.set(threadId, emitted);
|
|
32804
32813
|
}
|
|
32805
32814
|
const result = codexItemToToolResult(notificationItem);
|
|
32806
32815
|
if (result)
|
|
@@ -32813,7 +32822,7 @@ ${value2}`, text_elements: [] }]
|
|
|
32813
32822
|
const metadata = this.runUsageMetadata(threadId);
|
|
32814
32823
|
const locallyInterrupted = this.consumeLocalInterruption(threadId, turn?.id);
|
|
32815
32824
|
this.activeTurnIds.delete(threadId);
|
|
32816
|
-
this.
|
|
32825
|
+
this.emittedInstantToolItems.delete(threadId);
|
|
32817
32826
|
for (const key of this.agentMessagePhases.keys()) {
|
|
32818
32827
|
if (key.startsWith(`${threadId}:`))
|
|
32819
32828
|
this.agentMessagePhases.delete(key);
|
|
@@ -33602,7 +33611,7 @@ async function codexTurnsToMessages(turns, options = {}) {
|
|
|
33602
33611
|
toolCalls: [convertedToolCall]
|
|
33603
33612
|
});
|
|
33604
33613
|
const result = codexItemToToolResult(item);
|
|
33605
|
-
if (result && options.toolResultMode === "lazy" && options.revision && item.id) {
|
|
33614
|
+
if (result && item.type !== "imageView" && options.toolResultMode === "lazy" && options.revision && item.id) {
|
|
33606
33615
|
messages3.push({
|
|
33607
33616
|
role: "tool",
|
|
33608
33617
|
content: "",
|
|
@@ -33625,7 +33634,8 @@ async function codexTurnsToMessages(turns, options = {}) {
|
|
|
33625
33634
|
historyId: codexTraceHistoryId(turn.id, "tool-result", item.id)
|
|
33626
33635
|
} : {},
|
|
33627
33636
|
toolCallId: result.toolCallId,
|
|
33628
|
-
name: toolCall?.name
|
|
33637
|
+
name: toolCall?.name,
|
|
33638
|
+
...result.isError ? { isError: true } : {}
|
|
33629
33639
|
});
|
|
33630
33640
|
}
|
|
33631
33641
|
}
|
|
@@ -33756,6 +33766,9 @@ function codexProgressNotificationToEvent(message) {
|
|
|
33756
33766
|
function codexItemToToolCall(item) {
|
|
33757
33767
|
if (!item?.id)
|
|
33758
33768
|
return null;
|
|
33769
|
+
if (item.type === "imageView" && typeof item.path === "string" && item.path.trim()) {
|
|
33770
|
+
return { id: item.id, name: "view_image", arguments: { path: item.path } };
|
|
33771
|
+
}
|
|
33759
33772
|
if (item.type === "subAgentActivity") {
|
|
33760
33773
|
return {
|
|
33761
33774
|
id: item.id,
|
|
@@ -33817,6 +33830,9 @@ function codexItemToToolCall(item) {
|
|
|
33817
33830
|
function codexItemToToolResult(item) {
|
|
33818
33831
|
if (!item?.id)
|
|
33819
33832
|
return null;
|
|
33833
|
+
if (item.type === "imageView" && typeof item.path === "string" && item.path.trim()) {
|
|
33834
|
+
return { toolCallId: item.id, content: "" };
|
|
33835
|
+
}
|
|
33820
33836
|
if (item.type === "subAgentActivity") {
|
|
33821
33837
|
return {
|
|
33822
33838
|
toolCallId: item.id,
|
|
@@ -33833,14 +33849,18 @@ function codexItemToToolResult(item) {
|
|
|
33833
33849
|
};
|
|
33834
33850
|
}
|
|
33835
33851
|
if (item.type === "commandExecution") {
|
|
33852
|
+
if (item.status === "inProgress")
|
|
33853
|
+
return null;
|
|
33836
33854
|
return {
|
|
33837
33855
|
toolCallId: item.id,
|
|
33838
33856
|
content: typeof item.aggregatedOutput === "string" ? item.aggregatedOutput : "",
|
|
33839
|
-
isError: typeof item.exitCode === "number" && item.exitCode !== 0
|
|
33857
|
+
isError: item.status === "failed" || item.status === "declined" || typeof item.exitCode === "number" && item.exitCode !== 0
|
|
33840
33858
|
};
|
|
33841
33859
|
}
|
|
33842
33860
|
if (item.type === "fileChange") {
|
|
33843
|
-
|
|
33861
|
+
if (item.status === "inProgress")
|
|
33862
|
+
return null;
|
|
33863
|
+
return { toolCallId: item.id, content: JSON.stringify(item.changes ?? [], null, 2), isError: item.status === "failed" || item.status === "declined" };
|
|
33844
33864
|
}
|
|
33845
33865
|
if (item.type === "mcpToolCall" || item.type === "dynamicToolCall") {
|
|
33846
33866
|
return {
|
|
@@ -33851,8 +33871,8 @@ function codexItemToToolResult(item) {
|
|
|
33851
33871
|
}
|
|
33852
33872
|
return null;
|
|
33853
33873
|
}
|
|
33854
|
-
function
|
|
33855
|
-
return item?.type === "subAgentActivity" || item?.type === "collabAgentToolCall";
|
|
33874
|
+
function isCodexInstantToolItem(item) {
|
|
33875
|
+
return item?.type === "imageView" || item?.type === "subAgentActivity" || item?.type === "collabAgentToolCall";
|
|
33856
33876
|
}
|
|
33857
33877
|
function codexTurnUsage(turn) {
|
|
33858
33878
|
const usage = asRecord3(asRecord3(turn).usage);
|
|
@@ -35825,7 +35845,8 @@ function openCodeHistoryToMessages(history) {
|
|
|
35825
35845
|
messages3.push({
|
|
35826
35846
|
role: "tool",
|
|
35827
35847
|
toolCallId: part.callID,
|
|
35828
|
-
content: part.state.status === "completed" ? part.state.output : part.state.error
|
|
35848
|
+
content: part.state.status === "completed" ? part.state.output : part.state.error,
|
|
35849
|
+
...part.state.status === "error" ? { isError: true } : {}
|
|
35829
35850
|
});
|
|
35830
35851
|
}
|
|
35831
35852
|
for (const cards of questionCards.values())
|
|
@@ -38041,6 +38062,7 @@ function decodeZCodeHistory(value, sessionId = "", imageData) {
|
|
|
38041
38062
|
return image ? [image] : [];
|
|
38042
38063
|
}) : [];
|
|
38043
38064
|
const messageId = info.messageId ?? info.id;
|
|
38065
|
+
const isSteered = info.role === "user" && nativeRecord(info.metadata).turnSteerDelivery === "guide";
|
|
38044
38066
|
const reasoning = parts.filter((part) => part.type === "reasoning" && typeof part.text === "string").map((part, index) => ({ itemId: String(part.partId ?? part.id ?? `${messageId}:reasoning:${index}`), sectionIndex: 0, text: String(part.text) }));
|
|
38045
38067
|
const questionMessages = [];
|
|
38046
38068
|
let hasQuestionTool = false;
|
|
@@ -38059,6 +38081,7 @@ function decodeZCodeHistory(value, sessionId = "", imageData) {
|
|
|
38059
38081
|
role: info.role,
|
|
38060
38082
|
content: text2,
|
|
38061
38083
|
historyId: typeof messageId === "string" ? messageId : undefined,
|
|
38084
|
+
...isSteered ? { name: `__native_steered:${messageId}` } : {},
|
|
38062
38085
|
...images.length ? { images } : {},
|
|
38063
38086
|
...reasoning.length ? { presentation: { reasoning } } : {},
|
|
38064
38087
|
...tools.length ? { toolCalls: tools.map((part) => ({ id: String(part.callId ?? part.callID ?? part.toolCallId ?? part.partId ?? part.id), name: String(part.tool ?? part.toolName ?? "ZCode tool"), arguments: nativeRecord(nativeRecord(part.state).input ?? part.input) })) } : {}
|
|
@@ -38237,7 +38260,9 @@ class ZCodeClient {
|
|
|
38237
38260
|
if (this.sessions.get(id)?.readOnly)
|
|
38238
38261
|
throw new RuntimeSessionError("ZCode child sessions are read-only", "SESSION_OCCUPIED");
|
|
38239
38262
|
const previous = this.todoMcp.get(id);
|
|
38240
|
-
if (
|
|
38263
|
+
if (!configuration && !previous)
|
|
38264
|
+
return;
|
|
38265
|
+
if (configuration && previous && JSON.stringify(todoMcpServers(previous)) === JSON.stringify(todoMcpServers(configuration)))
|
|
38241
38266
|
return;
|
|
38242
38267
|
if (this.runs.has(id))
|
|
38243
38268
|
throw new RuntimeSessionError("ZCode session is already running", "SESSION_ALREADY_RUNNING");
|
|
@@ -38253,7 +38278,10 @@ class ZCodeClient {
|
|
|
38253
38278
|
this.loaded.delete(id);
|
|
38254
38279
|
}
|
|
38255
38280
|
signal?.throwIfAborted();
|
|
38256
|
-
|
|
38281
|
+
if (configuration)
|
|
38282
|
+
this.todoMcp.set(id, { command: configuration.command, args: [...configuration.args], env: { ...configuration.env } });
|
|
38283
|
+
else
|
|
38284
|
+
this.todoMcp.delete(id);
|
|
38257
38285
|
}
|
|
38258
38286
|
async withActiveSession(id, operation, signal) {
|
|
38259
38287
|
signal?.throwIfAborted();
|
|
@@ -38380,7 +38408,7 @@ class ZCodeClient {
|
|
|
38380
38408
|
async* run(id, input, images, options) {
|
|
38381
38409
|
if (this.pendingTodoRuns.has(id))
|
|
38382
38410
|
throw new RuntimeSessionError("ZCode session is already running", "SESSION_ALREADY_RUNNING");
|
|
38383
|
-
const preparation = options?.todoMcp ? new AbortController : undefined;
|
|
38411
|
+
const preparation = options?.todoMcp !== undefined ? new AbortController : undefined;
|
|
38384
38412
|
if (preparation)
|
|
38385
38413
|
this.pendingTodoRuns.set(id, preparation);
|
|
38386
38414
|
try {
|
|
@@ -38417,7 +38445,7 @@ class ZCodeClient {
|
|
|
38417
38445
|
yield { type: "done", finalText: "" };
|
|
38418
38446
|
return;
|
|
38419
38447
|
}
|
|
38420
|
-
if (options?.todoMcp)
|
|
38448
|
+
if (options?.todoMcp !== undefined)
|
|
38421
38449
|
await this.configureTodoMcp(id, options.todoMcp, signal);
|
|
38422
38450
|
signal?.throwIfAborted();
|
|
38423
38451
|
const subscribed = await this.withActiveSession(id, async (session) => {
|
|
@@ -39298,19 +39326,89 @@ class WorkBuddyRuntimeAdapter extends StdioNativeRuntimeAdapter {
|
|
|
39298
39326
|
}
|
|
39299
39327
|
}
|
|
39300
39328
|
// src/agent-runtime/detached-native-runtime-host.ts
|
|
39301
|
-
import { spawn as spawn6 } from "node:child_process";
|
|
39302
|
-
import { closeSync, mkdirSync as mkdirSync2, openSync } from "node:fs";
|
|
39329
|
+
import { execFile as execFile11, spawn as spawn6 } from "node:child_process";
|
|
39330
|
+
import { closeSync, lstatSync, mkdirSync as mkdirSync2, openSync, unlinkSync } from "node:fs";
|
|
39331
|
+
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
39303
39332
|
import { createConnection as createConnection5 } from "node:net";
|
|
39304
39333
|
import { homedir as homedir18 } from "node:os";
|
|
39305
|
-
import { join as
|
|
39334
|
+
import { join as join20 } from "node:path";
|
|
39306
39335
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
39336
|
+
import { promisify as promisify11 } from "node:util";
|
|
39337
|
+
import { compareAgentRoamVersions, parseAgentRoamVersion } from "@agent/core";
|
|
39338
|
+
|
|
39339
|
+
// src/agent-runtime/context-session-fork.ts
|
|
39340
|
+
import { sessionHistoryMessageId as sessionHistoryMessageId3 } from "@agent/core";
|
|
39341
|
+
var contextForkAgents = new Set(["zcode", "qoder", "deepseek-harness", "workbuddy", "copilot"]);
|
|
39342
|
+
function supportsContextFork(agentType) {
|
|
39343
|
+
return contextForkAgents.has(agentType);
|
|
39344
|
+
}
|
|
39345
|
+
function contextForkPoints(messages3, running) {
|
|
39346
|
+
let haveBoundary = !running;
|
|
39347
|
+
const marked = messages3.slice();
|
|
39348
|
+
for (let index = messages3.length - 1;index >= 0; index--) {
|
|
39349
|
+
const message = messages3[index];
|
|
39350
|
+
if (message.role === "user" && !message.name?.startsWith("__native_steered") && message.name !== "__native_steering_pending") {
|
|
39351
|
+
haveBoundary = true;
|
|
39352
|
+
}
|
|
39353
|
+
if (message.role !== "assistant")
|
|
39354
|
+
continue;
|
|
39355
|
+
const canFork = haveBoundary && message.content.trim() && !message.toolCalls?.length && !message.presentation?.question && message.presentation?.agentMessagePhase !== "commentary" && (!message.presentation?.runResult || message.presentation.runResult.status === "completed");
|
|
39356
|
+
if (message.content.trim() || message.toolCalls?.length || message.presentation?.question || message.presentation?.reasoning?.length)
|
|
39357
|
+
haveBoundary = false;
|
|
39358
|
+
if (!canFork && !message.presentation?.forkPoint)
|
|
39359
|
+
continue;
|
|
39360
|
+
marked[index] = {
|
|
39361
|
+
...message,
|
|
39362
|
+
presentation: {
|
|
39363
|
+
...message.presentation,
|
|
39364
|
+
forkPoint: canFork ? { messageId: sessionHistoryMessageId3(index, message) } : undefined
|
|
39365
|
+
}
|
|
39366
|
+
};
|
|
39367
|
+
}
|
|
39368
|
+
return marked;
|
|
39369
|
+
}
|
|
39370
|
+
|
|
39371
|
+
// src/agent-runtime/context-history-artifact.ts
|
|
39372
|
+
import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
39373
|
+
import { join as join17 } from "node:path";
|
|
39374
|
+
async function materializeContextHistory(runtimeDirectory, input) {
|
|
39375
|
+
if (!/^[a-zA-Z0-9-]+$/.test(input.id))
|
|
39376
|
+
throw new Error("Invalid handoff artifact id");
|
|
39377
|
+
const directory = join17(runtimeDirectory, ".agent-data", "engine-handoffs", input.id);
|
|
39378
|
+
await mkdir3(directory, { recursive: true, mode: 448 });
|
|
39379
|
+
const items = [];
|
|
39380
|
+
for (const [index, message] of input.messages.entries()) {
|
|
39381
|
+
const images = [...new Set([...message.images ?? [], ...(message.presentation?.attachments ?? []).flatMap((attachment) => attachment.dataUrl ? [attachment.dataUrl] : [])])];
|
|
39382
|
+
const imageFiles = [];
|
|
39383
|
+
for (const [imageIndex, data] of images.entries()) {
|
|
39384
|
+
const match = /^data:image\/(png|jpeg|jpg|gif|webp);base64,([\s\S]+)$/.exec(data);
|
|
39385
|
+
if (!match)
|
|
39386
|
+
throw new Error("交接图片格式无法保存");
|
|
39387
|
+
const path2 = join17(directory, `${index}-${imageIndex}.${match[1]}`);
|
|
39388
|
+
await writeFile3(path2, Buffer.from(match[2], "base64"), { mode: 384 });
|
|
39389
|
+
imageFiles.push(path2);
|
|
39390
|
+
}
|
|
39391
|
+
items.push({
|
|
39392
|
+
historyId: message.historyId,
|
|
39393
|
+
role: message.role,
|
|
39394
|
+
content: message.content,
|
|
39395
|
+
toolCalls: message.toolCalls,
|
|
39396
|
+
toolCallId: message.toolCallId,
|
|
39397
|
+
isError: message.isError,
|
|
39398
|
+
imageFiles
|
|
39399
|
+
});
|
|
39400
|
+
}
|
|
39401
|
+
const path = join17(directory, "history.json");
|
|
39402
|
+
await writeFile3(path, JSON.stringify({ workState: input.workStateText, items }, null, 2), { mode: 384 });
|
|
39403
|
+
return path;
|
|
39404
|
+
}
|
|
39307
39405
|
|
|
39308
39406
|
// src/agent-runtime/native-runtime-broker.ts
|
|
39309
39407
|
import { createHash as createHash8, randomUUID as randomUUID14 } from "node:crypto";
|
|
39310
39408
|
import { chmodSync, existsSync as existsSync2, mkdirSync, rmSync } from "node:fs";
|
|
39311
39409
|
import { createConnection as createConnection4, createServer as createServer2 } from "node:net";
|
|
39312
39410
|
import { homedir as homedir17 } from "node:os";
|
|
39313
|
-
import { join as
|
|
39411
|
+
import { join as join19, resolve as resolve9 } from "node:path";
|
|
39314
39412
|
import {
|
|
39315
39413
|
isNativeAgentType,
|
|
39316
39414
|
cancelQueuedSessionMessage,
|
|
@@ -39330,11 +39428,13 @@ import {
|
|
|
39330
39428
|
reorderQueuedSessionGoals,
|
|
39331
39429
|
reorderQueuedSessionMessages,
|
|
39332
39430
|
sessionQueueItemKind,
|
|
39333
|
-
sessionHistoryMessageId as
|
|
39431
|
+
sessionHistoryMessageId as sessionHistoryMessageId4,
|
|
39334
39432
|
SQLiteDatabase,
|
|
39335
39433
|
SQLiteEngineSwitchRepository,
|
|
39336
39434
|
EngineSwitchDelivery,
|
|
39337
39435
|
cleanEngineHistory,
|
|
39436
|
+
renderContextHandoff,
|
|
39437
|
+
scopedHistory,
|
|
39338
39438
|
SessionQueryIndexCache as SessionQueryIndexCache2,
|
|
39339
39439
|
StaleSessionAnchorError as StaleSessionAnchorError3,
|
|
39340
39440
|
updateQueuedSessionMessage,
|
|
@@ -39347,7 +39447,7 @@ import { open as open8, readdir as readdir12, realpath as realpath2, stat as sta
|
|
|
39347
39447
|
import { createReadStream as createReadStream4, watch } from "node:fs";
|
|
39348
39448
|
import { createInterface as createInterface4 } from "node:readline";
|
|
39349
39449
|
import { availableParallelism } from "node:os";
|
|
39350
|
-
import { dirname as dirname2, isAbsolute as isAbsolute4, join as
|
|
39450
|
+
import { dirname as dirname2, isAbsolute as isAbsolute4, join as join18, relative as relative3, resolve as resolve7, sep as sep3 } from "node:path";
|
|
39351
39451
|
var CODEX_CATALOG_SCHEMA_VERSION = 1;
|
|
39352
39452
|
var CODEX_COMPATIBILITY_REGISTRY_VERSION = 1;
|
|
39353
39453
|
var CODEX_METADATA_LIMIT_BYTES = 256 * 1024;
|
|
@@ -39512,7 +39612,7 @@ class CodexSessionDiskCatalog {
|
|
|
39512
39612
|
};
|
|
39513
39613
|
}
|
|
39514
39614
|
async refreshTitles() {
|
|
39515
|
-
const indexPath =
|
|
39615
|
+
const indexPath = join18(dirname2(this.options.sessionRoot), "session_index.jsonl");
|
|
39516
39616
|
try {
|
|
39517
39617
|
const info = await stat9(indexPath, { bigint: true });
|
|
39518
39618
|
const version = `${info.ino}:${info.size}:${info.mtimeNs}`;
|
|
@@ -39653,7 +39753,7 @@ var nodeCatalogFileSystem = {
|
|
|
39653
39753
|
const directory = pending.pop();
|
|
39654
39754
|
const entries = await readdir12(directory, { withFileTypes: true });
|
|
39655
39755
|
for (const entry of entries) {
|
|
39656
|
-
const path =
|
|
39756
|
+
const path = join18(directory, entry.name);
|
|
39657
39757
|
if (entry.isSymbolicLink())
|
|
39658
39758
|
continue;
|
|
39659
39759
|
if (entry.isDirectory())
|
|
@@ -39754,6 +39854,13 @@ function emptyMetrics(breakerOpen) {
|
|
|
39754
39854
|
}
|
|
39755
39855
|
|
|
39756
39856
|
// src/agent-runtime/codex-session-compatibility.ts
|
|
39857
|
+
function sessionReadFailureReason(entry, error) {
|
|
39858
|
+
if (error instanceof RuntimeSessionError && error.code === "NATIVE_PROTOCOL_ERROR" && /^(?:invalid paginated history lineage for \S+: missing source rollout|no rollout found for thread id \S+)$/.test(error.message)) {
|
|
39859
|
+
return "Codex 会话缺少原始历史文件。恢复该文件后才能读取会话。";
|
|
39860
|
+
}
|
|
39861
|
+
return entry.producerVersion ? `该会话由 Codex ${entry.producerVersion} 创建,当前 Codex ${entry.compatibility.readerVersion} 无法读取` : `当前 Codex ${entry.compatibility.readerVersion} 无法读取该会话的历史格式`;
|
|
39862
|
+
}
|
|
39863
|
+
|
|
39757
39864
|
class CodexSessionCompatibilityService {
|
|
39758
39865
|
adapter;
|
|
39759
39866
|
catalog;
|
|
@@ -39818,7 +39925,7 @@ class CodexSessionCompatibilityService {
|
|
|
39818
39925
|
});
|
|
39819
39926
|
throw new RuntimeSessionError(reason2, "CODEX_SESSION_VERSION_INCOMPATIBLE");
|
|
39820
39927
|
}
|
|
39821
|
-
const reason = entry
|
|
39928
|
+
const reason = sessionReadFailureReason(entry, error);
|
|
39822
39929
|
this.catalog.updateCompatibility(nativeSessionId, {
|
|
39823
39930
|
status: "incompatible",
|
|
39824
39931
|
readerVersion: entry.compatibility.readerVersion,
|
|
@@ -39876,7 +39983,7 @@ class CodexSessionCompatibilityService {
|
|
|
39876
39983
|
return;
|
|
39877
39984
|
if (!this.isCurrentEntry(entry))
|
|
39878
39985
|
return;
|
|
39879
|
-
const reason = entry
|
|
39986
|
+
const reason = sessionReadFailureReason(entry, error);
|
|
39880
39987
|
this.catalog.updateCompatibility(entry.nativeSessionId, {
|
|
39881
39988
|
status: "incompatible",
|
|
39882
39989
|
readerVersion: entry.compatibility.readerVersion,
|
|
@@ -40372,16 +40479,18 @@ class RuntimeNotificationOutbox {
|
|
|
40372
40479
|
throw new Error("Native session is already bound to another Todo scope");
|
|
40373
40480
|
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));
|
|
40374
40481
|
}
|
|
40375
|
-
append(sessionId, runId, sequence, event, createdAt) {
|
|
40376
|
-
|
|
40377
|
-
|
|
40482
|
+
append(sessionId, runId, sequence, event, createdAt, resolveDestination) {
|
|
40483
|
+
if (!["ask_user", "approval_resolved", "done", "error", "turn_aborted"].includes(event.type))
|
|
40484
|
+
return;
|
|
40485
|
+
const destination = resolveDestination();
|
|
40486
|
+
if (!destination?.relayPath)
|
|
40378
40487
|
return;
|
|
40379
40488
|
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 }), JSON.stringify(destination), createdAt);
|
|
40380
40489
|
}
|
|
40381
|
-
async bindRun(
|
|
40382
|
-
|
|
40383
|
-
|
|
40384
|
-
|
|
40490
|
+
async bindRun(context, runId) {
|
|
40491
|
+
if (context.executionId && context.relayPath) {
|
|
40492
|
+
await new TodoServiceClient({ serviceId: context.serviceId, descriptorPath: context.relayPath, registry: context.discoveryDirectory }).call("bind_execution", { runId });
|
|
40493
|
+
}
|
|
40385
40494
|
}
|
|
40386
40495
|
async flush() {
|
|
40387
40496
|
if (this.flushing || this.closed)
|
|
@@ -40720,7 +40829,7 @@ class NativeRuntimeBrokerState {
|
|
|
40720
40829
|
VALUES (?, ?, ?)
|
|
40721
40830
|
`).run(agentType, workspaceId, normalizedPath);
|
|
40722
40831
|
}
|
|
40723
|
-
recoverInterruptedRuns() {
|
|
40832
|
+
recoverInterruptedRuns(endInterruptedGoals = false) {
|
|
40724
40833
|
const runs = this.database.db.prepare("SELECT * FROM native_runtime_run WHERE status = 'active'").all();
|
|
40725
40834
|
for (const row of runs) {
|
|
40726
40835
|
this.appendTerminal(row.run_id, {
|
|
@@ -40729,8 +40838,9 @@ class NativeRuntimeBrokerState {
|
|
|
40729
40838
|
message: BROKER_RESTART_MESSAGE
|
|
40730
40839
|
});
|
|
40731
40840
|
const activeItem = this.getGoalState(row.session_id).active;
|
|
40732
|
-
if (row.goal_id && activeItem?.id === row.goal_id && sessionQueueItemKind(activeItem) === "message") {
|
|
40733
|
-
|
|
40841
|
+
if (row.goal_id && activeItem?.id === row.goal_id && (endInterruptedGoals || sessionQueueItemKind(activeItem) === "message")) {
|
|
40842
|
+
const reason = sessionQueueItemKind(activeItem) === "message" ? "Native runtime restarted during this message." : BROKER_RESTART_MESSAGE;
|
|
40843
|
+
this.finishGoal(row.session_id, row.goal_id, "failed", reason);
|
|
40734
40844
|
}
|
|
40735
40845
|
}
|
|
40736
40846
|
this.pruneExpiredTerminals();
|
|
@@ -40860,6 +40970,17 @@ class NativeRuntimeBrokerState {
|
|
|
40860
40970
|
startedMessage(sessionId, sourceMessageId) {
|
|
40861
40971
|
return !!this.database.db.prepare("SELECT 1 FROM native_runtime_message_receipt WHERE session_id=? AND source_message_id=? AND run_id IS NOT NULL").get(sessionId, sourceMessageId);
|
|
40862
40972
|
}
|
|
40973
|
+
todoContextForRun(run, context) {
|
|
40974
|
+
if (!context?.executionId)
|
|
40975
|
+
return context;
|
|
40976
|
+
if (!run.goalId)
|
|
40977
|
+
return;
|
|
40978
|
+
const receipt = this.database.db.prepare(`
|
|
40979
|
+
SELECT 1 FROM native_runtime_message_receipt
|
|
40980
|
+
WHERE session_id=? AND source_message_id=? AND queue_item_id=? AND run_id=?
|
|
40981
|
+
`).get(run.sessionId, context.executionId, run.goalId, run.runId);
|
|
40982
|
+
return receipt ? context : undefined;
|
|
40983
|
+
}
|
|
40863
40984
|
reorderGoals(sessionId, orderedIds) {
|
|
40864
40985
|
return this.updateGoalState(sessionId, (state14) => reorderQueuedSessionGoals(state14, orderedIds));
|
|
40865
40986
|
}
|
|
@@ -41054,7 +41175,7 @@ class NativeRuntimeBrokerState {
|
|
|
41054
41175
|
recordedEvent = { ...event, durationMs: result.durationMs, usage: result.usage, result };
|
|
41055
41176
|
}
|
|
41056
41177
|
const sequence = run.nextSequence + 1;
|
|
41057
|
-
this.todoOutbox.append(run.sessionId, runId, sequence, recordedEvent, eventAt);
|
|
41178
|
+
this.todoOutbox.append(run.sessionId, runId, sequence, recordedEvent, eventAt, () => this.todoContextForRun(run, this.todoOutbox.get(run.sessionId)));
|
|
41058
41179
|
this.database.db.prepare("INSERT INTO native_runtime_event(run_id, sequence, payload, created_at) VALUES (?, ?, ?, ?)").run(runId, sequence, JSON.stringify(recordedEvent), eventAt);
|
|
41059
41180
|
this.database.db.prepare("UPDATE native_runtime_run SET next_sequence = ? WHERE run_id = ?").run(sequence, runId);
|
|
41060
41181
|
if (recordedEvent.type === "ask_user") {
|
|
@@ -41255,11 +41376,14 @@ class NativeRuntimeBrokerState {
|
|
|
41255
41376
|
}
|
|
41256
41377
|
}
|
|
41257
41378
|
applyDetail(detail, options = {}) {
|
|
41379
|
+
const canForkWithHistory = supportsContextFork(detail.agentType);
|
|
41380
|
+
const fork = canForkWithHistory ? this.engineSwitch.handoffs.forkForSession(detail.id) : null;
|
|
41258
41381
|
const threadKey = this.engineSwitch.records.threadOfSession(detail.id);
|
|
41259
|
-
|
|
41260
|
-
|
|
41382
|
+
const handoffs = threadKey ? this.engineSwitch.handoffs.summariesForThread(threadKey) : [];
|
|
41383
|
+
if (fork)
|
|
41384
|
+
handoffs.push(fork);
|
|
41385
|
+
if (handoffs.length)
|
|
41261
41386
|
detail = { ...detail, messages: cleanEngineHistory(detail.messages, handoffs) };
|
|
41262
|
-
}
|
|
41263
41387
|
const summary = this.applySummary(detail);
|
|
41264
41388
|
const projection = this.projection(detail.id);
|
|
41265
41389
|
const mergeProjection = options.mergeProjection ?? true;
|
|
@@ -41307,7 +41431,7 @@ class NativeRuntimeBrokerState {
|
|
|
41307
41431
|
return {
|
|
41308
41432
|
...detail,
|
|
41309
41433
|
...summary,
|
|
41310
|
-
messages: messages3,
|
|
41434
|
+
messages: canForkWithHistory ? contextForkPoints([...fork?.forkHistory ?? [], ...messages3], summary.status === "running") : messages3,
|
|
41311
41435
|
events: detail.agentType === "copilot" ? [...mergeProjection ? projection.events.flatMap(({ event }) => event.type === "ask_user" || event.type === "approval_resolved" || event.type === "error" && event.message === BROKER_RESTART_MESSAGE ? [] : [event]) : [], ...detail.events] : detail.agentType === "opencode" ? [...detail.events, ...projection.events.flatMap(({ event }) => {
|
|
41312
41436
|
if ((event.type === "ask_user" || event.type === "approval_resolved") && isOpenCodeQuestionId(event.questionId))
|
|
41313
41437
|
return [];
|
|
@@ -41417,6 +41541,7 @@ function activityMetadata(session) {
|
|
|
41417
41541
|
|
|
41418
41542
|
class NativeRuntimeBrokerHost {
|
|
41419
41543
|
directory;
|
|
41544
|
+
packageVersion;
|
|
41420
41545
|
state;
|
|
41421
41546
|
runtime;
|
|
41422
41547
|
activeExecutions = new Map;
|
|
@@ -41431,8 +41556,9 @@ class NativeRuntimeBrokerHost {
|
|
|
41431
41556
|
ownsSocket = false;
|
|
41432
41557
|
stopped = false;
|
|
41433
41558
|
abortFallbackTimers = new Set;
|
|
41434
|
-
constructor(directory, runtime, now = Date.now) {
|
|
41559
|
+
constructor(directory, runtime, now = Date.now, packageVersion) {
|
|
41435
41560
|
this.directory = directory;
|
|
41561
|
+
this.packageVersion = packageVersion;
|
|
41436
41562
|
this.state = new NativeRuntimeBrokerState(directory, now);
|
|
41437
41563
|
this.runtime = typeof runtime === "function" ? runtime({
|
|
41438
41564
|
onApprovalResolved: (questionId) => this.handleApprovalResolved(questionId),
|
|
@@ -41447,7 +41573,7 @@ class NativeRuntimeBrokerHost {
|
|
|
41447
41573
|
get socketPath() {
|
|
41448
41574
|
return resolveNativeRuntimeSocketPath(this.directory);
|
|
41449
41575
|
}
|
|
41450
|
-
async start() {
|
|
41576
|
+
async start(options = {}) {
|
|
41451
41577
|
if (this.server)
|
|
41452
41578
|
return;
|
|
41453
41579
|
mkdirSync(this.directory, { recursive: true, mode: 448 });
|
|
@@ -41480,7 +41606,7 @@ class NativeRuntimeBrokerHost {
|
|
|
41480
41606
|
}
|
|
41481
41607
|
this.server = server;
|
|
41482
41608
|
this.ownsSocket = true;
|
|
41483
|
-
this.state.recoverInterruptedRuns();
|
|
41609
|
+
this.state.recoverInterruptedRuns(options.endInterruptedGoals);
|
|
41484
41610
|
for (const item of this.state.listResumableQueueItems()) {
|
|
41485
41611
|
this.startQueueItem(item, "web");
|
|
41486
41612
|
}
|
|
@@ -41635,10 +41761,71 @@ class NativeRuntimeBrokerHost {
|
|
|
41635
41761
|
}
|
|
41636
41762
|
async fork(id, point) {
|
|
41637
41763
|
this.state.assertSessionVisible(id);
|
|
41764
|
+
if (supportsContextFork(decodeNativeSessionId(id).agentType))
|
|
41765
|
+
return this.forkFromHistory(id, point);
|
|
41638
41766
|
const forked = point ? await this.runtime.fork(id, point) : await this.runtime.fork(id);
|
|
41639
41767
|
this.pendingCreations.set(forked.id, forked);
|
|
41640
41768
|
return this.state.applySummary(forked);
|
|
41641
41769
|
}
|
|
41770
|
+
async forkFromHistory(id, point) {
|
|
41771
|
+
const source = await this.get(id);
|
|
41772
|
+
const agentType = decodeNativeSessionId(id).agentType;
|
|
41773
|
+
let end = source.messages.length - 1;
|
|
41774
|
+
for (;end >= 0; end--) {
|
|
41775
|
+
const candidate = source.messages[end].presentation?.forkPoint?.messageId;
|
|
41776
|
+
if (candidate && (!point || point.messageId === candidate))
|
|
41777
|
+
break;
|
|
41778
|
+
}
|
|
41779
|
+
if (end < 0)
|
|
41780
|
+
throw new RuntimeSessionError("该轮次不存在或尚未完成,请刷新会话后重试", "INVALID_SESSION_ID");
|
|
41781
|
+
if (!source.cwd)
|
|
41782
|
+
throw new RuntimeSessionError("源会话没有本地工作目录", "OPERATION_NOT_SUPPORTED");
|
|
41783
|
+
const handoffId = randomUUID14();
|
|
41784
|
+
const inherited = scopedHistory(source.messages.slice(0, end + 1), handoffId).map((message) => {
|
|
41785
|
+
if (message.presentation?.question?.status !== "pending")
|
|
41786
|
+
return message;
|
|
41787
|
+
return { ...message, presentation: { ...message.presentation, question: { ...message.presentation.question, status: "cancelled" } } };
|
|
41788
|
+
});
|
|
41789
|
+
const workStateText = `工作目录:${source.cwd}`;
|
|
41790
|
+
let target2;
|
|
41791
|
+
try {
|
|
41792
|
+
const historyFile = await materializeContextHistory(this.directory, { id: handoffId, messages: inherited, workStateText });
|
|
41793
|
+
const rendered = renderContextHandoff(inherited, source.title, agentType, { purpose: "fork", historyFile, workStateText });
|
|
41794
|
+
target2 = await this.createRuntimeSession({
|
|
41795
|
+
agentType,
|
|
41796
|
+
cwd: source.cwd,
|
|
41797
|
+
projectId: source.projectId,
|
|
41798
|
+
title: `${source.title}(副本)`
|
|
41799
|
+
});
|
|
41800
|
+
if (target2.id === source.id || target2.agentType !== agentType) {
|
|
41801
|
+
throw new RuntimeSessionError("引擎未返回独立的副本会话", "NATIVE_PROTOCOL_ERROR");
|
|
41802
|
+
}
|
|
41803
|
+
this.state.engineSwitch.handoffs.insert({
|
|
41804
|
+
id: handoffId,
|
|
41805
|
+
threadKey: `fork:${target2.id}`,
|
|
41806
|
+
fromSessionId: id,
|
|
41807
|
+
fromAgentType: agentType,
|
|
41808
|
+
toSessionId: target2.id,
|
|
41809
|
+
toAgentType: agentType,
|
|
41810
|
+
strategy: "full",
|
|
41811
|
+
status: "pending",
|
|
41812
|
+
createdBy: "user",
|
|
41813
|
+
created: new Date().toISOString(),
|
|
41814
|
+
consumedAt: null,
|
|
41815
|
+
historyFile,
|
|
41816
|
+
forkHistory: inherited,
|
|
41817
|
+
...rendered
|
|
41818
|
+
});
|
|
41819
|
+
return target2;
|
|
41820
|
+
} catch (error) {
|
|
41821
|
+
if (target2 && target2.id !== source.id) {
|
|
41822
|
+
this.pendingCreations.delete(target2.id);
|
|
41823
|
+
this.state.hideSession(target2.id);
|
|
41824
|
+
}
|
|
41825
|
+
rmSync(join19(this.directory, ".agent-data", "engine-handoffs", handoffId), { recursive: true, force: true });
|
|
41826
|
+
throw error;
|
|
41827
|
+
}
|
|
41828
|
+
}
|
|
41642
41829
|
async delete(sessionId) {
|
|
41643
41830
|
if (this.state.isSessionHidden(sessionId))
|
|
41644
41831
|
return;
|
|
@@ -42089,9 +42276,12 @@ class NativeRuntimeBrokerHost {
|
|
|
42089
42276
|
}
|
|
42090
42277
|
} : {}
|
|
42091
42278
|
};
|
|
42092
|
-
const
|
|
42279
|
+
const sessionTodoContext = this.state.todoOutbox.get(run.sessionId);
|
|
42280
|
+
const todoContext = this.state.todoContextForRun(run, sessionTodoContext);
|
|
42281
|
+
if (sessionTodoContext?.executionId && !todoContext && run.agentType === "zcode")
|
|
42282
|
+
options.todoMcp = null;
|
|
42093
42283
|
if (todoContext) {
|
|
42094
|
-
await this.state.todoOutbox.bindRun(
|
|
42284
|
+
await this.state.todoOutbox.bindRun(todoContext, run.runId);
|
|
42095
42285
|
let todoInjectionUnavailable = false;
|
|
42096
42286
|
try {
|
|
42097
42287
|
const injection = await prepareTodoInjection(todoContext, run.agentType);
|
|
@@ -42118,8 +42308,22 @@ class NativeRuntimeBrokerHost {
|
|
|
42118
42308
|
if (warning)
|
|
42119
42309
|
this.broadcast(warning);
|
|
42120
42310
|
}
|
|
42121
|
-
|
|
42122
|
-
|
|
42311
|
+
const modelId = todoContext.model;
|
|
42312
|
+
if (modelId && !options.model) {
|
|
42313
|
+
options.model = { id: modelId };
|
|
42314
|
+
if (run.agentType === "zcode") {
|
|
42315
|
+
const models = await this.runtime.listModels(run.agentType);
|
|
42316
|
+
const providers = new Set(models.filter((model) => model.id === modelId).map((model) => model.providerID).filter(Boolean));
|
|
42317
|
+
const [providerID] = providers;
|
|
42318
|
+
if (!providerID) {
|
|
42319
|
+
throw new RuntimeSessionError(`Scheduled ZCode model "${modelId}" is no longer available`, "NATIVE_PROTOCOL_ERROR");
|
|
42320
|
+
}
|
|
42321
|
+
if (providers.size > 1) {
|
|
42322
|
+
throw new RuntimeSessionError(`Scheduled ZCode model "${modelId}" matches multiple providers`, "NATIVE_PROTOCOL_ERROR");
|
|
42323
|
+
}
|
|
42324
|
+
options.model.providerID = providerID;
|
|
42325
|
+
}
|
|
42326
|
+
}
|
|
42123
42327
|
}
|
|
42124
42328
|
for await (const event of this.runtime.run(run.sessionId, delivery.input, delivery.images, agentIds, agentName, options)) {
|
|
42125
42329
|
try {
|
|
@@ -42347,7 +42551,7 @@ class NativeRuntimeBrokerHost {
|
|
|
42347
42551
|
const sessionId = stringParam(request.params, "sessionId");
|
|
42348
42552
|
switch (request.method) {
|
|
42349
42553
|
case "ping":
|
|
42350
|
-
return { ok: true, pid: process.pid };
|
|
42554
|
+
return { ok: true, pid: process.pid, packageVersion: this.packageVersion };
|
|
42351
42555
|
case "health":
|
|
42352
42556
|
return this.health();
|
|
42353
42557
|
case "listWorkspaces":
|
|
@@ -42895,7 +43099,7 @@ function createNativeRuntimeBrokerHostRuntime(codexExecutable, callbacks, openco
|
|
|
42895
43099
|
onApprovalResolved: callbacks?.onApprovalResolved
|
|
42896
43100
|
});
|
|
42897
43101
|
const codexCompatibility = callbacks?.codexSessionCatalogRepository ? new CodexSessionCompatibilityService(codexAdapter, new CodexSessionDiskCatalog({
|
|
42898
|
-
sessionRoot:
|
|
43102
|
+
sessionRoot: join19(process.env.CODEX_HOME?.trim() || join19(homedir17(), ".codex"), "sessions"),
|
|
42899
43103
|
readerVersion: "0.153.0",
|
|
42900
43104
|
repository: callbacks.codexSessionCatalogRepository
|
|
42901
43105
|
})) : undefined;
|
|
@@ -42923,11 +43127,11 @@ function createNativeRuntimeBrokerHostRuntime(codexExecutable, callbacks, openco
|
|
|
42923
43127
|
return service;
|
|
42924
43128
|
}
|
|
42925
43129
|
function resolveNativeRuntimeDirectory(explicit) {
|
|
42926
|
-
return explicit || process.env.AGENT_NATIVE_RUNTIME_DIR?.trim() ||
|
|
43130
|
+
return explicit || process.env.AGENT_NATIVE_RUNTIME_DIR?.trim() || join19(homedir17(), ".agentroam", "native-runtime");
|
|
42927
43131
|
}
|
|
42928
43132
|
function resolveNativeRuntimeSocketPath(directory, platform = process.platform) {
|
|
42929
43133
|
if (platform !== "win32")
|
|
42930
|
-
return
|
|
43134
|
+
return join19(directory, BROKER_SOCKET_NAME);
|
|
42931
43135
|
const scope = createHash8("sha256").update(resolve9(directory).toLowerCase()).digest("hex").slice(0, 24);
|
|
42932
43136
|
return `\\\\.\\pipe\\agentroam-native-runtime-${scope}`;
|
|
42933
43137
|
}
|
|
@@ -43017,7 +43221,7 @@ function restoreHarnessInputQueryIdentity(index, messages3) {
|
|
|
43017
43221
|
continue;
|
|
43018
43222
|
const sourceId = harnessInputSourceId(message);
|
|
43019
43223
|
if (sourceId)
|
|
43020
|
-
aliases.set(
|
|
43224
|
+
aliases.set(sessionHistoryMessageId4(visibleIndex, message), sourceId);
|
|
43021
43225
|
visibleIndex += 1;
|
|
43022
43226
|
}
|
|
43023
43227
|
if (!aliases.size)
|
|
@@ -43055,6 +43259,19 @@ function mergeProjectionMessages(messages3, run, events) {
|
|
|
43055
43259
|
}
|
|
43056
43260
|
const persistedAssistantText = hasPersistedRunInput ? projected.slice(runUserIndex + 1, nextUserIndex).filter((message) => message.role === "assistant").map((message) => message.content).join("") : null;
|
|
43057
43261
|
const nativeTurn = preserveNativeOrder && hasPersistedRunInput ? projected.slice(runUserIndex + 1, nextUserIndex) : [];
|
|
43262
|
+
const completedCodexTurns = new Set;
|
|
43263
|
+
const codexHistoryIds = new Set;
|
|
43264
|
+
if (run.agentType === "codex" && run.status === "terminal") {
|
|
43265
|
+
for (const message of messages3) {
|
|
43266
|
+
if (message.role !== "assistant" || !message.content.trim())
|
|
43267
|
+
continue;
|
|
43268
|
+
if (message.historyId)
|
|
43269
|
+
codexHistoryIds.add(message.historyId);
|
|
43270
|
+
const turnId = message.presentation?.forkPoint?.turnId;
|
|
43271
|
+
if (turnId)
|
|
43272
|
+
completedCodexTurns.add(turnId);
|
|
43273
|
+
}
|
|
43274
|
+
}
|
|
43058
43275
|
const nativeReasoning = nativeTurn.flatMap((message) => (message.presentation?.reasoning ?? []).map((section) => ({ message, section })));
|
|
43059
43276
|
const persistedReasoningText = nativeReasoning.map(({ section }) => section.text).join("");
|
|
43060
43277
|
let consumedReasoningText = 0;
|
|
@@ -43093,6 +43310,11 @@ function mergeProjectionMessages(messages3, run, events) {
|
|
|
43093
43310
|
}
|
|
43094
43311
|
if (event.type !== "text_chunk" && event.type !== "tool_call")
|
|
43095
43312
|
continue;
|
|
43313
|
+
if (event.type === "text_chunk" && event.turnId && completedCodexTurns.has(event.turnId)) {
|
|
43314
|
+
const historyId = codexTraceHistoryId(event.turnId, "agent", event.itemId);
|
|
43315
|
+
if (historyId && codexHistoryIds.has(historyId))
|
|
43316
|
+
continue;
|
|
43317
|
+
}
|
|
43096
43318
|
if (activeAssistantIndex === null) {
|
|
43097
43319
|
activeAssistantIndex = eventMessages.length;
|
|
43098
43320
|
eventMessages.push({ role: "assistant", content: "", name: `__native_run:${run.runId}` });
|
|
@@ -43546,9 +43768,12 @@ process.once("SIGTERM", stop);
|
|
|
43546
43768
|
process.once("SIGINT", stop);
|
|
43547
43769
|
try {
|
|
43548
43770
|
const runtime = await import(config.moduleUrl);
|
|
43771
|
+
const startup = await runtime.prepareDetachedNativeRuntimeHost(config);
|
|
43772
|
+
if (startup === "reuse") process.exit(0);
|
|
43549
43773
|
host = new runtime.NativeRuntimeBrokerHost(config.directory, callbacks =>
|
|
43550
|
-
runtime.createNativeRuntimeBrokerHostRuntime(config.codexExecutable, callbacks, config.opencodeExecutable)
|
|
43551
|
-
|
|
43774
|
+
runtime.createNativeRuntimeBrokerHostRuntime(config.codexExecutable, callbacks, config.opencodeExecutable),
|
|
43775
|
+
Date.now, config.packageVersion);
|
|
43776
|
+
await host.start({ endInterruptedGoals: startup === "replaced" });
|
|
43552
43777
|
console.log(JSON.stringify({ event: "native-runtime-host.started", pid: process.pid, at: new Date().toISOString() }));
|
|
43553
43778
|
} catch (error) {
|
|
43554
43779
|
if (host) await host.stop().catch(() => {});
|
|
@@ -43559,22 +43784,26 @@ try {
|
|
|
43559
43784
|
releaseLock();
|
|
43560
43785
|
}
|
|
43561
43786
|
`;
|
|
43562
|
-
function
|
|
43787
|
+
function requestHost(directory, method, params, timeoutMs) {
|
|
43563
43788
|
return new Promise((resolve10, reject) => {
|
|
43564
43789
|
const socket = createConnection5(resolveNativeRuntimeSocketPath(directory));
|
|
43790
|
+
const id = randomUUID15();
|
|
43565
43791
|
let buffer = "";
|
|
43566
|
-
const
|
|
43792
|
+
const timer = setTimeout(() => finish(new Error("Native runtime host response timed out")), timeoutMs);
|
|
43793
|
+
const finish = (error, reply = null) => {
|
|
43794
|
+
clearTimeout(timer);
|
|
43567
43795
|
socket.destroy();
|
|
43568
43796
|
if (error)
|
|
43569
43797
|
reject(error);
|
|
43570
43798
|
else
|
|
43571
|
-
resolve10(
|
|
43799
|
+
resolve10(reply);
|
|
43572
43800
|
};
|
|
43573
43801
|
socket.setEncoding("utf8");
|
|
43574
|
-
socket.
|
|
43575
|
-
|
|
43576
|
-
|
|
43577
|
-
socket.once("
|
|
43802
|
+
socket.once("error", (error) => {
|
|
43803
|
+
finish(error.code === "ENOENT" || error.code === "ECONNREFUSED" ? undefined : error);
|
|
43804
|
+
});
|
|
43805
|
+
socket.once("end", () => finish(new Error("Native runtime host closed before replying")));
|
|
43806
|
+
socket.once("connect", () => socket.write(JSON.stringify({ id, method, params }) + `
|
|
43578
43807
|
`));
|
|
43579
43808
|
socket.on("data", (chunk) => {
|
|
43580
43809
|
buffer += chunk;
|
|
@@ -43584,22 +43813,139 @@ function hostPid(directory) {
|
|
|
43584
43813
|
try {
|
|
43585
43814
|
const response = JSON.parse(buffer.slice(0, buffer.indexOf(`
|
|
43586
43815
|
`)));
|
|
43587
|
-
if (
|
|
43588
|
-
throw new Error("Native runtime host returned
|
|
43589
|
-
|
|
43590
|
-
finish(undefined, response.result.pid);
|
|
43816
|
+
if (response?.id !== id)
|
|
43817
|
+
throw new Error("Native runtime host returned an unexpected response");
|
|
43818
|
+
finish(undefined, response);
|
|
43591
43819
|
} catch (error) {
|
|
43592
43820
|
finish(error instanceof Error ? error : new Error(String(error)));
|
|
43593
43821
|
}
|
|
43594
43822
|
});
|
|
43595
43823
|
});
|
|
43596
43824
|
}
|
|
43597
|
-
async function
|
|
43825
|
+
async function readHost(directory) {
|
|
43826
|
+
const response = await requestHost(directory, "ping", {}, 500);
|
|
43827
|
+
if (!response)
|
|
43828
|
+
return null;
|
|
43829
|
+
const host = response.result;
|
|
43830
|
+
if (!response.ok || !host || !Number.isSafeInteger(host.pid) || host.pid <= 1) {
|
|
43831
|
+
throw new Error("Native runtime host returned invalid readiness");
|
|
43832
|
+
}
|
|
43833
|
+
return host;
|
|
43834
|
+
}
|
|
43835
|
+
function canReuseHost(host, packageVersion) {
|
|
43836
|
+
return !packageVersion || typeof host.packageVersion === "string" && Boolean(parseAgentRoamVersion(host.packageVersion)) && compareAgentRoamVersions(host.packageVersion, packageVersion) >= 0;
|
|
43837
|
+
}
|
|
43838
|
+
var runFile = promisify11(execFile11);
|
|
43839
|
+
var processOptions = { timeout: 3000, windowsHide: true };
|
|
43840
|
+
async function readProcessIdentity(pid) {
|
|
43841
|
+
if (process.platform === "win32") {
|
|
43842
|
+
const { stdout: stdout2 } = await runFile("powershell.exe", [
|
|
43843
|
+
"-NoProfile",
|
|
43844
|
+
"-NonInteractive",
|
|
43845
|
+
"-Command",
|
|
43846
|
+
`Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}' | Select-Object CommandLine,CreationDate | ConvertTo-Json -Compress`
|
|
43847
|
+
], processOptions);
|
|
43848
|
+
return stdout2.trim();
|
|
43849
|
+
}
|
|
43850
|
+
const { stdout } = await runFile("ps", ["-ww", "-p", String(pid), "-o", "lstart=", "-o", "command="], processOptions);
|
|
43851
|
+
return stdout.trim();
|
|
43852
|
+
}
|
|
43853
|
+
function isDetachedBrokerProcess(identity2, directory) {
|
|
43854
|
+
const windows = process.platform === "win32";
|
|
43855
|
+
const command = windows ? JSON.parse(identity2 || "null")?.CommandLine : identity2;
|
|
43856
|
+
if (!command?.includes("--input-type=module") || !command.includes("--eval") || !command.includes("native-runtime-start.lock") || !command.includes("createNativeRuntimeBrokerHostRuntime"))
|
|
43857
|
+
return false;
|
|
43858
|
+
const configPrefix = JSON.stringify({ directory }).slice(0, -1) + ",";
|
|
43859
|
+
if (!windows)
|
|
43860
|
+
return command.includes(configPrefix);
|
|
43861
|
+
const quotedPrefix = configPrefix.replace(/(\\*)"/g, (_, slashes) => slashes + slashes + "\\\"");
|
|
43862
|
+
return command.toLowerCase().includes(quotedPrefix.toLowerCase());
|
|
43863
|
+
}
|
|
43864
|
+
async function interruptBrokerRuns(directory) {
|
|
43865
|
+
const { DatabaseSync } = await import("node:sqlite");
|
|
43866
|
+
const database = new DatabaseSync(join20(directory, ".agent-data", "agent.db"), { readOnly: true });
|
|
43867
|
+
let runs;
|
|
43598
43868
|
try {
|
|
43599
|
-
|
|
43600
|
-
}
|
|
43869
|
+
runs = database.prepare("SELECT session_id, run_id FROM native_runtime_run WHERE status = 'active'").all();
|
|
43870
|
+
} finally {
|
|
43871
|
+
database.close();
|
|
43872
|
+
}
|
|
43873
|
+
await Promise.allSettled(runs.map((run) => requestHost(directory, "abort", {
|
|
43874
|
+
sessionId: run.session_id,
|
|
43875
|
+
expectedRunId: run.run_id,
|
|
43876
|
+
source: "cli-upgrade"
|
|
43877
|
+
}, 1500)));
|
|
43878
|
+
}
|
|
43879
|
+
function processExists(pid) {
|
|
43880
|
+
try {
|
|
43881
|
+
process.kill(pid, 0);
|
|
43882
|
+
return true;
|
|
43883
|
+
} catch (error) {
|
|
43884
|
+
if (error.code === "ESRCH")
|
|
43885
|
+
return false;
|
|
43886
|
+
throw error;
|
|
43887
|
+
}
|
|
43888
|
+
}
|
|
43889
|
+
async function waitForProcessExit(pid, timeoutMs) {
|
|
43890
|
+
const deadline = Date.now() + timeoutMs;
|
|
43891
|
+
while (processExists(pid)) {
|
|
43892
|
+
if (Date.now() >= deadline)
|
|
43893
|
+
return false;
|
|
43894
|
+
await delay2(50);
|
|
43895
|
+
}
|
|
43896
|
+
return true;
|
|
43897
|
+
}
|
|
43898
|
+
async function stopHostForUpgrade(directory, host) {
|
|
43899
|
+
const identity2 = await readProcessIdentity(host.pid);
|
|
43900
|
+
if (!isDetachedBrokerProcess(identity2, directory) || (await readHost(directory))?.pid !== host.pid) {
|
|
43901
|
+
throw new Error("Cannot verify the previous AgentRoam broker process");
|
|
43902
|
+
}
|
|
43903
|
+
await interruptBrokerRuns(directory).catch((error) => console.warn("Could not interrupt turns before replacing the broker:", error));
|
|
43904
|
+
if (!processExists(host.pid))
|
|
43905
|
+
return;
|
|
43906
|
+
if (await readProcessIdentity(host.pid) !== identity2)
|
|
43907
|
+
throw new Error("AgentRoam broker process changed during upgrade");
|
|
43908
|
+
if (process.platform === "win32") {
|
|
43909
|
+
await runFile("taskkill.exe", ["/PID", String(host.pid), "/T", "/F"], processOptions);
|
|
43910
|
+
} else {
|
|
43911
|
+
process.kill(host.pid, "SIGTERM");
|
|
43912
|
+
}
|
|
43913
|
+
if (await waitForProcessExit(host.pid, 4000))
|
|
43914
|
+
return;
|
|
43915
|
+
if (process.platform !== "win32" && await readProcessIdentity(host.pid) === identity2) {
|
|
43916
|
+
process.kill(host.pid, "SIGKILL");
|
|
43917
|
+
if (await waitForProcessExit(host.pid, 1000))
|
|
43918
|
+
return;
|
|
43919
|
+
}
|
|
43920
|
+
throw new Error("Previous AgentRoam broker did not exit");
|
|
43921
|
+
}
|
|
43922
|
+
async function prepareDetachedNativeRuntimeHost({ directory, packageVersion }) {
|
|
43923
|
+
const existing2 = await readHost(directory);
|
|
43924
|
+
if (existing2 && canReuseHost(existing2, packageVersion))
|
|
43925
|
+
return "reuse";
|
|
43926
|
+
if (existing2)
|
|
43927
|
+
await stopHostForUpgrade(directory, existing2);
|
|
43928
|
+
if (process.platform !== "win32" && !await readHost(directory)) {
|
|
43929
|
+
const socketPath = resolveNativeRuntimeSocketPath(directory);
|
|
43930
|
+
try {
|
|
43931
|
+
if (lstatSync(socketPath).isSocket())
|
|
43932
|
+
unlinkSync(socketPath);
|
|
43933
|
+
} catch (error) {
|
|
43934
|
+
if (error.code !== "ENOENT")
|
|
43935
|
+
throw error;
|
|
43936
|
+
}
|
|
43937
|
+
}
|
|
43938
|
+
return existing2 ? "replaced" : "start";
|
|
43939
|
+
}
|
|
43940
|
+
async function startDetachedNativeRuntimeHost(options) {
|
|
43941
|
+
if (options.packageVersion && !parseAgentRoamVersion(options.packageVersion)) {
|
|
43942
|
+
throw new Error("Invalid AgentRoam broker package version");
|
|
43943
|
+
}
|
|
43944
|
+
const current = await readHost(options.directory);
|
|
43945
|
+
if (current && canReuseHost(current, options.packageVersion))
|
|
43946
|
+
return current.pid;
|
|
43601
43947
|
mkdirSync2(options.directory, { recursive: true, mode: 448 });
|
|
43602
|
-
const logPath =
|
|
43948
|
+
const logPath = join20(options.directory, "native-runtime-host.log");
|
|
43603
43949
|
const log = openSync(logPath, "a", 384);
|
|
43604
43950
|
let startupError;
|
|
43605
43951
|
let exitCode;
|
|
@@ -43610,7 +43956,8 @@ async function startDetachedNativeRuntimeHost(options) {
|
|
|
43610
43956
|
directory: options.directory,
|
|
43611
43957
|
codexExecutable: options.codexExecutable,
|
|
43612
43958
|
opencodeExecutable: options.opencodeExecutable,
|
|
43613
|
-
moduleUrl: options.moduleUrl ?? import.meta.url
|
|
43959
|
+
moduleUrl: options.moduleUrl ?? import.meta.url,
|
|
43960
|
+
packageVersion: options.packageVersion
|
|
43614
43961
|
})], {
|
|
43615
43962
|
cwd: homedir18(),
|
|
43616
43963
|
detached: true,
|
|
@@ -43632,16 +43979,16 @@ async function startDetachedNativeRuntimeHost(options) {
|
|
|
43632
43979
|
while (Date.now() < deadline) {
|
|
43633
43980
|
if (startupError || exitCode !== undefined && exitCode !== null && exitCode !== 0)
|
|
43634
43981
|
break;
|
|
43635
|
-
let
|
|
43982
|
+
let host = null;
|
|
43636
43983
|
try {
|
|
43637
|
-
|
|
43984
|
+
host = await readHost(options.directory);
|
|
43638
43985
|
} catch {}
|
|
43639
|
-
if (
|
|
43640
|
-
if (pid !== child.pid && exitCode === undefined) {
|
|
43986
|
+
if (host && canReuseHost(host, options.packageVersion)) {
|
|
43987
|
+
if (host.pid !== child.pid && exitCode === undefined) {
|
|
43641
43988
|
child.kill("SIGTERM");
|
|
43642
43989
|
await childExit;
|
|
43643
43990
|
}
|
|
43644
|
-
return pid;
|
|
43991
|
+
return host.pid;
|
|
43645
43992
|
}
|
|
43646
43993
|
await delay2(50);
|
|
43647
43994
|
}
|
|
@@ -43680,7 +44027,7 @@ import { dirname as dirname4 } from "node:path";
|
|
|
43680
44027
|
import { computeNextFireAt } from "@agent/core";
|
|
43681
44028
|
|
|
43682
44029
|
// src/cron/cronTasksLock.ts
|
|
43683
|
-
import { writeFileSync, readFileSync, existsSync as existsSync3, unlinkSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
44030
|
+
import { writeFileSync, readFileSync, existsSync as existsSync3, unlinkSync as unlinkSync2, mkdirSync as mkdirSync3 } from "node:fs";
|
|
43684
44031
|
import { dirname as dirname3 } from "node:path";
|
|
43685
44032
|
|
|
43686
44033
|
class CronTasksLock {
|
|
@@ -43721,7 +44068,7 @@ class CronTasksLock {
|
|
|
43721
44068
|
if (!this._acquired)
|
|
43722
44069
|
return;
|
|
43723
44070
|
try {
|
|
43724
|
-
|
|
44071
|
+
unlinkSync2(this.lockPath);
|
|
43725
44072
|
} catch {}
|
|
43726
44073
|
this._acquired = false;
|
|
43727
44074
|
}
|
|
@@ -50320,9 +50667,11 @@ export {
|
|
|
50320
50667
|
runTodoCommandBridge,
|
|
50321
50668
|
resolveNativeRuntimeDirectory,
|
|
50322
50669
|
provisionedTodoTools,
|
|
50670
|
+
prepareDetachedNativeRuntimeHost,
|
|
50323
50671
|
parseSessionForkPoint,
|
|
50324
50672
|
parseNativeGoalMutation,
|
|
50325
50673
|
paginateByOffset,
|
|
50674
|
+
materializeContextHistory,
|
|
50326
50675
|
encodeUnifiedSessionId,
|
|
50327
50676
|
encodeOffsetCursor,
|
|
50328
50677
|
discoverHarnessEndpoint,
|
|
@@ -50358,4 +50707,4 @@ export {
|
|
|
50358
50707
|
AgentWorkspaceIndexService
|
|
50359
50708
|
};
|
|
50360
50709
|
|
|
50361
|
-
//# debugId=
|
|
50710
|
+
//# debugId=572AACB533B4C3E564756E2164756E21
|