@gaodefa/daocore 2026.5.31 → 2026.5.33
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/dist/abort-5xSPv96j.js +277 -0
- package/dist/abort.runtime-0926E27Z.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/account-inspect-BgzS8u-D.js +173 -0
- package/dist/accounts-7v5WrRCh.js +2 -0
- package/dist/accounts-BzO41JQx.js +107 -0
- package/dist/accounts-CSbmdRcc.js +107 -0
- package/dist/accounts-CZQ5w4JW.js +119 -0
- package/dist/acp-runtime-BCeSAla4.js +26 -0
- package/dist/acp-spawn-Czqyiryw.js +1275 -0
- package/dist/acp-spawn-D39EyfB9.js +2 -0
- package/dist/acp-stateful-target-driver-Ds-A-N-E.js +89 -0
- package/dist/action-kill-BdD5_Aml.js +33 -0
- package/dist/action-runtime-COScp8ol.js +469 -0
- package/dist/action-runtime-api-BgjjgLcW.js +2 -0
- package/dist/action-send-DfeejIBh.js +39 -0
- package/dist/action-spawn-DO8scagE.js +47 -0
- package/dist/actions-XbUKh94t.js +161 -0
- package/dist/actions.runtime-D_FyKsqj.js +5 -0
- package/dist/agent-3M5jLi8y.js +2 -0
- package/dist/agent-_HmdUCr4.js +3 -0
- package/dist/agent-command-JdyQsbkT.js +1367 -0
- package/dist/agent-components.runtime-BiG6LL4q.js +10 -0
- package/dist/agent-components.runtime.js +1 -1
- package/dist/agent-harness-CEPgjZ3p.d.ts +146 -0
- package/dist/agent-harness-runtime-CHrYKoTd.js +180 -0
- package/dist/agent-harness-runtime-DMYJ4buZ.d.ts +691 -0
- package/dist/agent-harness-task-runtime-DHQNyKub.js +140 -0
- package/dist/agent-runner-execution-D20QTBXr.js +1713 -0
- package/dist/agent-runner-utils-Bqe6xxgK.js +266 -0
- package/dist/agent-runner.runtime-BDNZI9xP.js +3455 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-TYhcwEWD.js +229 -0
- package/dist/agent-via-gateway-Dr06Lb5b.js +463 -0
- package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
- package/dist/api-Bv6Yzx0U.js +639 -0
- package/dist/api-C9Dmd2CA.d.ts +52 -0
- package/dist/api-CKq871s7.js +134 -0
- package/dist/api-DX_U2wja.js +2 -0
- package/dist/api-U8Q33Ouw.js +6 -0
- package/dist/api-UYhicEhq.js +3 -0
- package/dist/api-yyfjBhjb.js +2 -0
- package/dist/apply-BaAAhGbT.js +41 -0
- package/dist/apply-DoPxVm4A.js +54 -0
- package/dist/approval-handler.runtime-BtGX8k1E.js +130 -0
- package/dist/assistant-B3I8-7Lv.js +291 -0
- package/dist/attachment-normalize-C0-A3gAr.js +225 -0
- package/dist/attempt-execution-B4Uh6AAn.js +558 -0
- package/dist/attempt-execution.runtime-CDwaTeFi.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt-execution.shared-LOacq8Oi.js +38 -0
- package/dist/attempt.prompt-helpers-DTLTH3Mn.js +475 -0
- package/dist/attempt.tool-run-context-CQfLOzhy.js +2094 -0
- package/dist/binding-routing-D1Ep8LYu.js +113 -0
- package/dist/binding-targets-DAx23oWo.js +121 -0
- package/dist/bot-Wv3X4bsa.js +7894 -0
- package/dist/bot-deps-Bl2rHw_I.js +747 -0
- package/dist/bot-deps-D5QFJ6Sp.js +2 -0
- package/dist/bot-message-context.runtime-CLTMWkIl.js +7 -0
- package/dist/bot-message-context.runtime.js +1 -1
- package/dist/bot-message-context.session.runtime-C7ixtg9D.js +12 -0
- package/dist/bot-message-context.session.runtime.js +1 -1
- package/dist/bot-native-commands.delivery.runtime-Dd7fg3sv.js +4 -0
- package/dist/bot-native-commands.delivery.runtime.js +1 -1
- package/dist/bot-native-commands.runtime-xxk9PH27.js +13 -0
- package/dist/bot-native-commands.runtime.js +1 -1
- package/dist/bridge-server-B2OfZKTC.js +113 -0
- package/dist/browser-cli-C5iosRvD.js +230 -0
- package/dist/browser-cli-CLz_3gcp.js +2 -0
- package/dist/browser-cli-actions-input-DmI7MUTC.js +473 -0
- package/dist/browser-cli-actions-observe-D3mxz2K_.js +81 -0
- package/dist/browser-cli-debug-D4ovrUvJ.js +137 -0
- package/dist/browser-cli-inspect-NM7kVusr.js +104 -0
- package/dist/browser-cli-manage--VYOZfBu.js +443 -0
- package/dist/browser-cli-resize-DrCL8Kq1.js +26 -0
- package/dist/browser-cli-shared-Cd6zdFZW.js +50 -0
- package/dist/browser-cli-state-CoB8ZyE6.js +337 -0
- package/dist/browser-control-auth-Bev4Zk62.js +2 -0
- package/dist/browser-profiles-BxPD8_vB.js +2 -0
- package/dist/browser-runtime-C07L-Zov.js +384 -0
- package/dist/build-CQUvEKPr.js +257 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/call-BAWIPJo2.d.ts +43 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-CgkX47xS.js +1782 -0
- package/dist/channel-4gVDslD_.js +653 -0
- package/dist/channel-6vrwZPs9.js +238 -0
- package/dist/channel-B6YcNFXw.d.ts +104 -0
- package/dist/channel-B9ZuUQ6v.js +562 -0
- package/dist/channel-BADrx_U3.js +1556 -0
- package/dist/channel-BGLIVapC.js +481 -0
- package/dist/channel-Bkp8v6zY.d.ts +14 -0
- package/dist/channel-BoK62YYe.d.ts +49 -0
- package/dist/channel-BwcQp8Rq.js +955 -0
- package/dist/channel-BzSKfrLf.js +740 -0
- package/dist/channel-C10lHKrC.d.ts +47 -0
- package/dist/channel-C4XSENg9.js +2126 -0
- package/dist/channel-C7ga9fTJ.js +1777 -0
- package/dist/channel-C8hBwzA1.js +362 -0
- package/dist/channel-CCG1mfB4.js +1496 -0
- package/dist/channel-CKOJY4Zd.js +1134 -0
- package/dist/channel-CYxTzhn7.js +376 -0
- package/dist/channel-CZrble5P.d.ts +8 -0
- package/dist/channel-D8X4fgB9.d.ts +106 -0
- package/dist/channel-D9LDQOYt.d.ts +8 -0
- package/dist/channel-DDg0cxDP.js +808 -0
- package/dist/channel-DVGMasO6.d.ts +7 -0
- package/dist/channel-Djgm5DE9.d.ts +64 -0
- package/dist/channel-Dl4eeuJ3.d.ts +114 -0
- package/dist/channel-DpQ6_cvo.d.ts +8 -0
- package/dist/channel-DpsxF3Mf.js +1249 -0
- package/dist/channel-JqEqZ04S.d.ts +6 -0
- package/dist/channel-MXOd30fz.d.ts +427 -0
- package/dist/channel-actions.runtime-DJOOf7eP.js +265 -0
- package/dist/channel-actions.runtime.js +1 -1
- package/dist/channel-cl_cgDg6.js +508 -0
- package/dist/channel-core-CbkDdNXh.d.ts +6 -0
- package/dist/channel-core-DTSpGZkc.js +5 -0
- package/dist/channel-emJStu3a.js +867 -0
- package/dist/channel-entry-contract-DUSF3gce.d.ts +112 -0
- package/dist/channel-hShoCuAc.d.ts +12 -0
- package/dist/channel-inbound-le9T0BS4.js +80 -0
- package/dist/channel-pIMjOo6Y.d.ts +28 -0
- package/dist/channel-plugin-runtime-COf6cDhp.js +998 -0
- package/dist/channel-plugin-runtime-Cg67QAiE.d.ts +7 -0
- package/dist/channel-runtime-LgCwu-e7.js +408 -0
- package/dist/channel-uP-mo8Q6.d.ts +7 -0
- package/dist/channel-whyHp4eY.d.ts +26 -0
- package/dist/channel.runtime-1b8dMgHq.js +4 -0
- package/dist/channel.runtime-BIZeTsuh.js +88 -0
- package/dist/channel.runtime-BPTDdF_t.js +1008 -0
- package/dist/channel.runtime-CMwMP86f.js +21009 -0
- package/dist/channel.runtime-CbR_S3Es.js +733 -0
- package/dist/channel.runtime-CoNDJV33.js +254 -0
- package/dist/channel.runtime-D1ve78xp.js +109 -0
- package/dist/channel.runtime-DAuGTOCS.js +652 -0
- package/dist/channel.runtime-DCHOoofn.js +2528 -0
- package/dist/channel.setup-BMXb23G7.d.ts +6 -0
- package/dist/channel.setup-BP1xL5Pf.js +1098 -0
- package/dist/channel.setup-BdEXf9Ic.d.ts +8 -0
- package/dist/channel.setup-ChiJ3GPS.js +10 -0
- package/dist/channel.setup-SmJQYInQ.js +343 -0
- package/dist/channel.setup-UZjcpncE.d.ts +7 -0
- package/dist/chat-zRdfy5a3.js +2666 -0
- package/dist/chrome-CKXrklba.js +1503 -0
- package/dist/cli/run-main.js +5 -5
- package/dist/cli-D8jOuVTO.js +1341 -0
- package/dist/cli-DYinYyHP.d.ts +20 -0
- package/dist/cli-backend-CSCGROD2.d.ts +5 -0
- package/dist/cli-backend-DmBwqwqy.d.ts +5 -0
- package/dist/cli-compaction-BLVrCsK5.js +347 -0
- package/dist/cli-metadata-CYvkEhJD.js +22 -0
- package/dist/cli-runner-BlM3bE0F.js +2 -0
- package/dist/cli-runner-D6RHy0cU.js +540 -0
- package/dist/cli-runner.runtime-BZAAFLDU.js +4 -0
- package/dist/cli-runner.runtime-CpX1HvG6.js +3 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-CXpra3BN.d.ts +20 -0
- package/dist/cli-startup-metadata.json +8 -8
- package/dist/client-CtRn_hQP.js +650 -0
- package/dist/client-adapter-BVIdEc7J.js +897 -0
- package/dist/client-factory-6n6tLSIi.js +9 -0
- package/dist/command-auth-B2r-fHTK.js +135 -0
- package/dist/command-handlers-Pnxu5_zT.js +1609 -0
- package/dist/command-registry-Ck2pwGIs.js +9 -0
- package/dist/command-registry-CmCmwAX7.js +4 -0
- package/dist/command-registry-core-Bpb8Zmai.js +110 -0
- package/dist/command-status.runtime-Bjq4f1lX.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-CqcnXnk-.d.ts +113 -0
- package/dist/commands-acp-B7zCM6RA.js +74 -0
- package/dist/commands-compact.runtime-CmtzRn-a.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-handlers.runtime-C4kTnIeK.js +6154 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-status-DVgiHsQ5.js +16 -0
- package/dist/commands-status-DlYd-7ik.js +3 -0
- package/dist/commands-status.runtime-DlYd-7ik.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-DgvtGIas.js +2 -0
- package/dist/commands-subagents-control.runtime-JdMGlKtk.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-BQyxb4tV.js +162 -0
- package/dist/commands-system-prompt-ByWU697p.js +2 -0
- package/dist/commands.runtime-CJP1VpiV.js +176 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/compact-DLUg6XJH.js +1141 -0
- package/dist/compact-_E6we35c.js +480 -0
- package/dist/compact.runtime-DPVrm-pW.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-DoizagFW.js +315 -0
- package/dist/computer-use-CCjnsa_1.js +367 -0
- package/dist/config-BilJG9EC.js +373 -0
- package/dist/config-BxPD8_vB.js +2 -0
- package/dist/config-mutations-D_EXryF0.js +159 -0
- package/dist/config-schema-Bqr7vPys.d.ts +20 -0
- package/dist/context-engine-host-compat-CqmA35DL.js +2 -0
- package/dist/context-engine-host-compat-CueTS2PS.js +288 -0
- package/dist/context-engine-lifecycle-BfMiEl15.js +1274 -0
- package/dist/contracts-testkit-DQ4aMv6G.d.ts +145 -0
- package/dist/control-auth-BU7xIoX-.js +114 -0
- package/dist/control-service-rkbW1sH-.js +145 -0
- package/dist/control-ui/assets/agents-C5B7sxKS.js +1008 -0
- package/dist/control-ui/assets/channel-config-extras-Kk_cpKPc.js +2 -0
- package/dist/control-ui/assets/channels-DFoMw3Un.js +367 -0
- package/dist/control-ui/assets/cron-B47q0Nyx.js +1013 -0
- package/dist/control-ui/assets/debug-BCHISZaA.js +97 -0
- package/dist/control-ui/assets/index-C-5z0KAE.js +7370 -0
- package/dist/control-ui/assets/instances-D6X4n6Vs.js +57 -0
- package/dist/control-ui/assets/logs-9ZSUT3JY.js +74 -0
- package/dist/control-ui/assets/nodes-4wxDgsSh.js +436 -0
- package/dist/control-ui/assets/sessions-Brjv8Xfd.js +399 -0
- package/dist/control-ui/assets/skills-BSp0fDdJ.js +314 -0
- package/dist/control-ui/assets/skills-shared-Csem-U3g.js +11 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/conversation-binding-runtime-DUU8Cbqn.js +4 -0
- package/dist/conversation-runtime-DPrqAWle.js +31 -0
- package/dist/core-CUD6UgSq.js +282 -0
- package/dist/core-DIQ0fbwp.d.ts +224 -0
- package/dist/core-api-B1g3Om3O.js +5 -0
- package/dist/core-api-C-O6aNhF.js +2 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-v9uXA3A2.js +55 -0
- package/dist/daocore-runtime-JsdCNe3l.d.ts +151 -0
- package/dist/daocore-tools-C28lHB0m.js +11727 -0
- package/dist/delivery-BuWQ2Vps.js +1002 -0
- package/dist/dialogue-DSYoyGRK.js +37 -0
- package/dist/dir-fetch-tool-Cp6QDtGT.js +565 -0
- package/dist/dir-list-tool-Cgwy8SnK.js +100 -0
- package/dist/direct-dm-B9jtIQVB.js +64 -0
- package/dist/directive-handling.fast-lane-DW5n01VF.js +68 -0
- package/dist/directive-handling.impl-BZXGBxBu.js +2 -0
- package/dist/directive-handling.impl-DvmlznGE.js +818 -0
- package/dist/directive-handling.model-selection-CdbAe1eC.js +122 -0
- package/dist/directive-handling.persist.runtime-B7WHo9zw.js +263 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/dispatch-Bysi6DFL.js +1640 -0
- package/dist/dispatch-acp-transcript.runtime-CrAnpqiX.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DkcXZIbM.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/doctor-CFmGWeIn.js +6 -0
- package/dist/doctor-_JI7RKJk.js +2 -0
- package/dist/doctor-config-flow-DVXxaLTb.js +1741 -0
- package/dist/doctor-core-checks-BfUW_u2R.js +2 -0
- package/dist/doctor-core-checks-lmN1Tw4N.js +573 -0
- package/dist/doctor-health-ZgTh34Za.js +65 -0
- package/dist/doctor-health-contributions-DV0Ff5cp.js +696 -0
- package/dist/doctor-lint-DbYtxQxC.js +94 -0
- package/dist/doctor-state-integrity-CZdBuNdm.js +1231 -0
- package/dist/doctor-update-DpFQTsrm.js +58 -0
- package/dist/dynamic-tools-DWocQS_t.js +486 -0
- package/dist/embedded-backend-DGDv3GDw.js +579 -0
- package/dist/embedded-gateway-stub.runtime-mATMWU23.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-provider-56qUY6a4.d.ts +16 -0
- package/dist/embedding-provider-CfSvDhLk.d.ts +65 -0
- package/dist/embedding-provider-DV9KtS1H.d.ts +21 -0
- package/dist/entry.d.ts +1 -1
- package/dist/exec-approvals-tk6i5Iy2.js +149 -0
- package/dist/extensionAPI.js +1 -1
- package/dist/extensions/active-memory/index.d.ts +1 -1
- package/dist/extensions/active-memory/index.js +1 -1
- package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/alibaba/index.d.ts +1 -1
- package/dist/extensions/anthropic/api.d.ts +3 -3
- package/dist/extensions/anthropic/cli-backend-api.d.ts +2 -2
- package/dist/extensions/anthropic/cli-backend.d.ts +1 -1
- package/dist/extensions/anthropic/cli-migration.d.ts +1 -1
- package/dist/extensions/anthropic/cli-shared.d.ts +1 -1
- package/dist/extensions/anthropic/contract-api.d.ts +1 -1
- package/dist/extensions/anthropic/index.d.ts +1 -1
- package/dist/extensions/anthropic/provider-contract-api.d.ts +1 -1
- package/dist/extensions/anthropic/provider-discovery.d.ts +1 -1
- package/dist/extensions/anthropic/provider-policy-api.d.ts +1 -1
- package/dist/extensions/anthropic/register.runtime.d.ts +1 -1
- package/dist/extensions/anthropic/replay-policy.d.ts +1 -1
- package/dist/extensions/anthropic/setup-api.d.ts +1 -1
- package/dist/extensions/anthropic/stream-wrappers.d.ts +1 -1
- package/dist/extensions/anthropic/test-api.d.ts +2 -2
- package/dist/extensions/arcee/index.d.ts +1 -1
- package/dist/extensions/azure-speech/index.d.ts +1 -1
- package/dist/extensions/azure-speech/speech-provider.d.ts +1 -1
- package/dist/extensions/bonjour/index.d.ts +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-config.js +4 -4
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +2 -2
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/cli-metadata.d.ts +1 -1
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.d.ts +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.d.ts +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.d.ts +2 -2
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.d.ts +3 -3
- package/dist/extensions/browser/runtime-api.js +13 -13
- package/dist/extensions/browser/setup-api.d.ts +1 -1
- package/dist/extensions/byteplus/index.d.ts +1 -1
- package/dist/extensions/byteplus/provider-discovery.d.ts +1 -1
- package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
- package/dist/extensions/canvas/index.d.ts +1 -1
- package/dist/extensions/canvas/index.js +1 -1
- package/dist/extensions/canvas/runtime-api.d.ts +2 -2
- package/dist/extensions/canvas/setup-api.d.ts +1 -1
- package/dist/extensions/cerebras/index.d.ts +1 -1
- package/dist/extensions/chutes/index.d.ts +1 -1
- package/dist/extensions/clickclack/api.d.ts +2 -2
- package/dist/extensions/clickclack/api.js +2 -2
- package/dist/extensions/clickclack/channel-plugin-api.d.ts +1 -1
- package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
- package/dist/extensions/clickclack/index.d.ts +2 -2
- package/dist/extensions/clickclack/runtime-api.d.ts +2 -2
- package/dist/extensions/clickclack/runtime-api.js +2 -2
- package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
- package/dist/extensions/cloudflare-ai-gateway/stream-wrappers.d.ts +1 -1
- package/dist/extensions/comfy/index.d.ts +1 -1
- package/dist/extensions/copilot-proxy/index.d.ts +1 -1
- package/dist/extensions/copilot-proxy/runtime-api.d.ts +2 -2
- package/dist/extensions/deepgram/index.d.ts +1 -1
- package/dist/extensions/deepgram/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/deepgram/test-api.d.ts +1 -1
- package/dist/extensions/deepinfra/api.d.ts +2 -2
- package/dist/extensions/deepinfra/embedding-provider.d.ts +1 -1
- package/dist/extensions/deepinfra/index.d.ts +1 -1
- package/dist/extensions/deepinfra/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/deepinfra/speech-provider.d.ts +1 -1
- package/dist/extensions/deepseek/api.d.ts +1 -1
- package/dist/extensions/deepseek/index.d.ts +1 -1
- package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
- package/dist/extensions/deepseek/provider-policy-api.d.ts +1 -1
- package/dist/extensions/deepseek/stream.d.ts +1 -1
- package/dist/extensions/deepseek/thinking.d.ts +1 -1
- package/dist/extensions/device-pair/api.d.ts +3 -3
- package/dist/extensions/device-pair/api.js +1 -1
- package/dist/extensions/device-pair/index.d.ts +1 -1
- package/dist/extensions/device-pair/notify.d.ts +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/document-extract/index.d.ts +1 -1
- package/dist/extensions/duckduckgo/index.d.ts +1 -1
- package/dist/extensions/elevenlabs/index.d.ts +1 -1
- package/dist/extensions/elevenlabs/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/elevenlabs/setup-api.d.ts +1 -1
- package/dist/extensions/elevenlabs/speech-provider.d.ts +1 -1
- package/dist/extensions/elevenlabs/test-api.d.ts +2 -2
- package/dist/extensions/exa/index.d.ts +1 -1
- package/dist/extensions/fal/index.d.ts +1 -1
- package/dist/extensions/fal/provider-contract-api.d.ts +1 -1
- package/dist/extensions/fal/provider-registration.d.ts +1 -1
- package/dist/extensions/file-transfer/index.d.ts +1 -1
- package/dist/extensions/file-transfer/index.js +4 -4
- package/dist/extensions/firecrawl/index.d.ts +1 -1
- package/dist/extensions/fireworks/index.d.ts +1 -1
- package/dist/extensions/fireworks/provider-policy-api.d.ts +1 -1
- package/dist/extensions/fireworks/stream.d.ts +1 -1
- package/dist/extensions/fireworks/thinking-policy.d.ts +1 -1
- package/dist/extensions/github-copilot/embeddings.d.ts +1 -1
- package/dist/extensions/github-copilot/index.d.ts +1 -1
- package/dist/extensions/github-copilot/models.d.ts +1 -1
- package/dist/extensions/github-copilot/register.runtime.d.ts +2 -2
- package/dist/extensions/github-copilot/stream.d.ts +1 -1
- package/dist/extensions/google/api.d.ts +5 -5
- package/dist/extensions/google/cli-backend.d.ts +1 -1
- package/dist/extensions/google/embedding-batch.d.ts +1 -1
- package/dist/extensions/google/embedding-provider.d.ts +1 -1
- package/dist/extensions/google/gemini-cli-provider.d.ts +1 -1
- package/dist/extensions/google/index.d.ts +1 -1
- package/dist/extensions/google/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/google/provider-contract-api.d.ts +1 -1
- package/dist/extensions/google/provider-hooks.d.ts +2 -2
- package/dist/extensions/google/provider-models.d.ts +1 -1
- package/dist/extensions/google/provider-policy-api.d.ts +1 -1
- package/dist/extensions/google/provider-policy.d.ts +1 -1
- package/dist/extensions/google/provider-registration.d.ts +1 -1
- package/dist/extensions/google/realtime-voice-provider.d.ts +1 -1
- package/dist/extensions/google/runtime-api.d.ts +3 -3
- package/dist/extensions/google/setup-api.d.ts +1 -1
- package/dist/extensions/google/speech-provider.d.ts +1 -1
- package/dist/extensions/google/test-api.d.ts +2 -2
- package/dist/extensions/google/thinking-api.d.ts +1 -1
- package/dist/extensions/google/thinking.d.ts +1 -1
- package/dist/extensions/google/transport-stream.d.ts +1 -1
- package/dist/extensions/gradium/index.d.ts +1 -1
- package/dist/extensions/gradium/speech-provider.d.ts +1 -1
- package/dist/extensions/groq/index.d.ts +1 -1
- package/dist/extensions/huggingface/index.d.ts +1 -1
- package/dist/extensions/image-generation-core/api.d.ts +3 -3
- package/dist/extensions/image-generation-core/runtime-api.d.ts +1 -1
- package/dist/extensions/imessage/api.d.ts +2 -2
- package/dist/extensions/imessage/api.js +2 -2
- package/dist/extensions/imessage/channel-plugin-api.d.ts +1 -1
- package/dist/extensions/imessage/channel-plugin-api.js +1 -1
- package/dist/extensions/imessage/index.d.ts +2 -2
- package/dist/extensions/imessage/message-tool-api.d.ts +1 -1
- package/dist/extensions/imessage/runtime-api.d.ts +2 -2
- package/dist/extensions/imessage/runtime-api.js +3 -3
- package/dist/extensions/imessage/setup-entry.d.ts +2 -2
- package/dist/extensions/imessage/test-api.d.ts +1 -1
- package/dist/extensions/inworld/index.d.ts +1 -1
- package/dist/extensions/inworld/speech-provider.d.ts +1 -1
- package/dist/extensions/irc/api.d.ts +1 -1
- package/dist/extensions/irc/api.js +2 -2
- package/dist/extensions/irc/channel-plugin-api.d.ts +1 -1
- package/dist/extensions/irc/channel-plugin-api.js +1 -1
- package/dist/extensions/irc/index.d.ts +2 -2
- package/dist/extensions/irc/setup-entry.d.ts +2 -2
- package/dist/extensions/kilocode/index.d.ts +1 -1
- package/dist/extensions/kimi-coding/index.d.ts +1 -1
- package/dist/extensions/kimi-coding/stream.d.ts +1 -1
- package/dist/extensions/litellm/index.d.ts +1 -1
- package/dist/extensions/llm-task/api.d.ts +2 -2
- package/dist/extensions/llm-task/index.d.ts +1 -1
- package/dist/extensions/llm-task/index.js +1 -1
- package/dist/extensions/lmstudio/api.d.ts +1 -1
- package/dist/extensions/lmstudio/index.d.ts +1 -1
- package/dist/extensions/lmstudio/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/mattermost/api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-api.d.ts +2 -2
- package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-runtime.d.ts +1 -1
- package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
- package/dist/extensions/mattermost/index.d.ts +2 -2
- package/dist/extensions/mattermost/policy-api.js +1 -1
- package/dist/extensions/mattermost/runtime-api.d.ts +3 -3
- package/dist/extensions/mattermost/runtime-api.js +2 -2
- package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
- package/dist/extensions/mattermost/slash-route-api.d.ts +1 -1
- package/dist/extensions/mattermost/slash-route-api.js +1 -1
- package/dist/extensions/memory-core/api.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/memory-core/index.d.ts +1 -1
- package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
- package/dist/extensions/memory-core/runtime-api.d.ts +2 -2
- package/dist/extensions/memory-wiki/api.d.ts +3 -3
- package/dist/extensions/memory-wiki/cli-metadata.d.ts +1 -1
- package/dist/extensions/memory-wiki/index.d.ts +1 -1
- package/dist/extensions/memory-wiki/setup-api.d.ts +1 -1
- package/dist/extensions/microsoft/index.d.ts +1 -1
- package/dist/extensions/microsoft/speech-provider.d.ts +1 -1
- package/dist/extensions/microsoft/test-api.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/auth.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/cli.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/index.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/onboard.d.ts +3 -3
- package/dist/extensions/microsoft-foundry/provider.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/runtime.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/shared.d.ts +1 -1
- package/dist/extensions/migrate-claude/apply.d.ts +1 -1
- package/dist/extensions/migrate-claude/apply.js +1 -1
- package/dist/extensions/migrate-claude/config.d.ts +1 -1
- package/dist/extensions/migrate-claude/helpers.d.ts +1 -1
- package/dist/extensions/migrate-claude/index.d.ts +1 -1
- package/dist/extensions/migrate-claude/index.js +1 -1
- package/dist/extensions/migrate-claude/memory.d.ts +2 -2
- package/dist/extensions/migrate-claude/plan.d.ts +1 -1
- package/dist/extensions/migrate-claude/plan.js +1 -1
- package/dist/extensions/migrate-claude/provider.d.ts +1 -1
- package/dist/extensions/migrate-claude/provider.js +1 -1
- package/dist/extensions/migrate-claude/skills.d.ts +2 -2
- package/dist/extensions/migrate-claude/targets.d.ts +1 -1
- package/dist/extensions/migrate-claude/targets.js +1 -1
- package/dist/extensions/migrate-hermes/apply.d.ts +1 -1
- package/dist/extensions/migrate-hermes/apply.js +1 -1
- package/dist/extensions/migrate-hermes/config.d.ts +1 -1
- package/dist/extensions/migrate-hermes/helpers.d.ts +1 -1
- package/dist/extensions/migrate-hermes/index.d.ts +1 -1
- package/dist/extensions/migrate-hermes/index.js +1 -1
- package/dist/extensions/migrate-hermes/items.d.ts +1 -1
- package/dist/extensions/migrate-hermes/model.d.ts +1 -1
- package/dist/extensions/migrate-hermes/model.js +1 -1
- package/dist/extensions/migrate-hermes/plan.d.ts +1 -1
- package/dist/extensions/migrate-hermes/plan.js +1 -1
- package/dist/extensions/migrate-hermes/provider.d.ts +1 -1
- package/dist/extensions/migrate-hermes/provider.js +1 -1
- package/dist/extensions/migrate-hermes/secrets.d.ts +2 -2
- package/dist/extensions/migrate-hermes/secrets.js +1 -1
- package/dist/extensions/migrate-hermes/skills.d.ts +2 -2
- package/dist/extensions/migrate-hermes/targets.d.ts +1 -1
- package/dist/extensions/migrate-hermes/targets.js +1 -1
- package/dist/extensions/minimax/index.d.ts +1 -1
- package/dist/extensions/minimax/provider-contract-api.d.ts +1 -1
- package/dist/extensions/minimax/provider-registration.d.ts +1 -1
- package/dist/extensions/minimax/speech-provider.d.ts +1 -1
- package/dist/extensions/mistral/embedding-provider.d.ts +1 -1
- package/dist/extensions/mistral/index.d.ts +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/mistral/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/mistral/test-api.d.ts +1 -1
- package/dist/extensions/moonshot/index.d.ts +1 -1
- package/dist/extensions/moonshot/provider-contract-api.d.ts +1 -1
- package/dist/extensions/moonshot/provider-discovery.d.ts +1 -1
- package/dist/extensions/nvidia/index.d.ts +1 -1
- package/dist/extensions/oc-path/cli-metadata.d.ts +1 -1
- package/dist/extensions/oc-path/cli-registration.d.ts +1 -1
- package/dist/extensions/oc-path/index.d.ts +1 -1
- package/dist/extensions/ollama/api.d.ts +1 -1
- package/dist/extensions/ollama/index.d.ts +1 -1
- package/dist/extensions/ollama/provider-discovery.d.ts +1 -1
- package/dist/extensions/ollama/provider-policy-api.d.ts +1 -1
- package/dist/extensions/ollama/runtime-api.d.ts +1 -1
- package/dist/extensions/open-prose/index.d.ts +1 -1
- package/dist/extensions/open-prose/runtime-api.d.ts +2 -2
- package/dist/extensions/openai/api.d.ts +4 -4
- package/dist/extensions/openai/embedding-batch.d.ts +1 -1
- package/dist/extensions/openai/embedding-provider.d.ts +1 -1
- package/dist/extensions/openai/index.d.ts +1 -1
- package/dist/extensions/openai/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/openai/openai-codex-oauth.runtime.d.ts +1 -1
- package/dist/extensions/openai/openai-codex-provider.d.ts +1 -1
- package/dist/extensions/openai/openai-provider.d.ts +1 -1
- package/dist/extensions/openai/prompt-overlay.d.ts +1 -1
- package/dist/extensions/openai/provider-contract-api.d.ts +1 -1
- package/dist/extensions/openai/provider-policy-api.d.ts +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/openai/realtime-voice-provider.d.ts +1 -1
- package/dist/extensions/openai/register.runtime.d.ts +6 -6
- package/dist/extensions/openai/replay-policy.d.ts +1 -1
- package/dist/extensions/openai/setup-api.d.ts +1 -1
- package/dist/extensions/openai/shared.d.ts +3 -3
- package/dist/extensions/openai/speech-provider.d.ts +1 -1
- package/dist/extensions/openai/test-api.d.ts +3 -3
- package/dist/extensions/openai/thinking-policy.d.ts +1 -1
- package/dist/extensions/openai/transport-policy.d.ts +1 -1
- package/dist/extensions/opencode/index.d.ts +1 -1
- package/dist/extensions/opencode/provider-policy-api.d.ts +1 -1
- package/dist/extensions/opencode-go/index.d.ts +1 -1
- package/dist/extensions/opencode-go/provider-catalog.d.ts +1 -1
- package/dist/extensions/opencode-go/stream.d.ts +1 -1
- package/dist/extensions/openrouter/api.d.ts +1 -1
- package/dist/extensions/openrouter/index.d.ts +1 -1
- package/dist/extensions/openrouter/provider-contract-api.d.ts +1 -1
- package/dist/extensions/openrouter/provider-policy-api.d.ts +1 -1
- package/dist/extensions/openrouter/speech-provider.d.ts +1 -1
- package/dist/extensions/openrouter/stream.d.ts +1 -1
- package/dist/extensions/openrouter/test-api.d.ts +1 -1
- package/dist/extensions/openrouter/thinking-policy.d.ts +1 -1
- package/dist/extensions/openrouter/video-generation-provider.d.ts +1 -1
- package/dist/extensions/openrouter/video-model-catalog.d.ts +1 -1
- package/dist/extensions/perplexity/index.d.ts +1 -1
- package/dist/extensions/phone-control/index.d.ts +1 -1
- package/dist/extensions/phone-control/runtime-api.d.ts +2 -2
- package/dist/extensions/policy/api.js +1 -1
- package/dist/extensions/policy/index.d.ts +1 -1
- package/dist/extensions/policy/index.js +2 -2
- package/dist/extensions/qianfan/index.d.ts +1 -1
- package/dist/extensions/qwen/api.d.ts +1 -1
- package/dist/extensions/qwen/index.d.ts +1 -1
- package/dist/extensions/qwen/stream.d.ts +1 -1
- package/dist/extensions/runway/index.d.ts +1 -1
- package/dist/extensions/searxng/index.d.ts +1 -1
- package/dist/extensions/senseaudio/index.d.ts +1 -1
- package/dist/extensions/sglang/index.d.ts +1 -1
- package/dist/extensions/signal/api.d.ts +2 -2
- package/dist/extensions/signal/api.js +6 -6
- package/dist/extensions/signal/channel-entry.d.ts +2 -2
- package/dist/extensions/signal/channel-plugin-api.d.ts +1 -1
- package/dist/extensions/signal/channel-plugin-api.js +1 -1
- package/dist/extensions/signal/index.d.ts +2 -2
- package/dist/extensions/signal/reaction-runtime-api.js +1 -1
- package/dist/extensions/signal/runtime-api.d.ts +4 -4
- package/dist/extensions/signal/runtime-api.js +7 -7
- package/dist/extensions/signal/setup-entry.d.ts +2 -2
- package/dist/extensions/skill-workshop/api.d.ts +2 -2
- package/dist/extensions/skill-workshop/api.js +1 -1
- package/dist/extensions/skill-workshop/index.d.ts +1 -1
- package/dist/extensions/skill-workshop/index.js +2 -2
- package/dist/extensions/speech-core/api.d.ts +3 -3
- package/dist/extensions/speech-core/runtime-api.d.ts +2 -2
- package/dist/extensions/stepfun/index.d.ts +1 -1
- package/dist/extensions/synthetic/index.d.ts +1 -1
- package/dist/extensions/talk-voice/api.d.ts +2 -2
- package/dist/extensions/talk-voice/index.d.ts +1 -1
- package/dist/extensions/tavily/index.d.ts +1 -1
- package/dist/extensions/telegram/account-inspect-api.js +1 -1
- package/dist/extensions/telegram/api.d.ts +3 -3
- package/dist/extensions/telegram/api.js +11 -11
- package/dist/extensions/telegram/channel-plugin-api.d.ts +2 -2
- package/dist/extensions/telegram/channel-plugin-api.js +2 -2
- package/dist/extensions/telegram/contract-api.d.ts +1 -1
- package/dist/extensions/telegram/contract-api.js +3 -3
- package/dist/extensions/telegram/index.d.ts +2 -2
- package/dist/extensions/telegram/runtime-api.d.ts +3 -3
- package/dist/extensions/telegram/runtime-api.js +7 -7
- package/dist/extensions/telegram/security-audit-contract-api.js +1 -1
- package/dist/extensions/telegram/setup-entry.d.ts +2 -2
- package/dist/extensions/telegram/setup-plugin-api.d.ts +1 -1
- package/dist/extensions/telegram/setup-plugin-api.js +1 -1
- package/dist/extensions/telegram/test-api.js +2 -2
- package/dist/extensions/tencent/index.d.ts +1 -1
- package/dist/extensions/tencent/provider-discovery.d.ts +1 -1
- package/dist/extensions/thread-ownership/api.d.ts +2 -2
- package/dist/extensions/thread-ownership/index.d.ts +1 -1
- package/dist/extensions/together/index.d.ts +1 -1
- package/dist/extensions/tokenjuice/index.d.ts +1 -1
- package/dist/extensions/tokenjuice/tool-result-middleware.d.ts +1 -1
- package/dist/extensions/tts-local-cli/index.d.ts +1 -1
- package/dist/extensions/tts-local-cli/speech-provider.d.ts +1 -1
- package/dist/extensions/venice/index.d.ts +1 -1
- package/dist/extensions/venice/stream.d.ts +1 -1
- package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
- package/dist/extensions/vercel-ai-gateway/thinking.d.ts +1 -1
- package/dist/extensions/video-generation-core/api.d.ts +2 -2
- package/dist/extensions/video-generation-core/runtime-api.d.ts +1 -1
- package/dist/extensions/vllm/api.d.ts +1 -1
- package/dist/extensions/vllm/index.d.ts +1 -1
- package/dist/extensions/vllm/stream.d.ts +1 -1
- package/dist/extensions/volcengine/index.d.ts +1 -1
- package/dist/extensions/volcengine/provider-discovery.d.ts +1 -1
- package/dist/extensions/volcengine/speech-provider.d.ts +1 -1
- package/dist/extensions/voyage/embedding-batch.d.ts +1 -1
- package/dist/extensions/voyage/embedding-provider.d.ts +1 -1
- package/dist/extensions/voyage/index.d.ts +1 -1
- package/dist/extensions/voyage/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/vydra/index.d.ts +1 -1
- package/dist/extensions/vydra/speech-provider.d.ts +1 -1
- package/dist/extensions/web-readability/index.d.ts +1 -1
- package/dist/extensions/webhooks/api.d.ts +2 -2
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.d.ts +1 -1
- package/dist/extensions/webhooks/index.js +1 -1
- package/dist/extensions/webhooks/runtime-api.d.ts +1 -1
- package/dist/extensions/xai/api.d.ts +1 -1
- package/dist/extensions/xai/index.d.ts +1 -1
- package/dist/extensions/xai/index.js +4 -4
- package/dist/extensions/xai/provider-contract-api.d.ts +1 -1
- package/dist/extensions/xai/provider-discovery.d.ts +1 -1
- package/dist/extensions/xai/provider-models.d.ts +1 -1
- package/dist/extensions/xai/provider-policy-api.d.ts +1 -1
- package/dist/extensions/xai/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/xai/setup-api.d.ts +1 -1
- package/dist/extensions/xai/speech-provider.d.ts +1 -1
- package/dist/extensions/xai/speech-provider.js +1 -1
- package/dist/extensions/xai/stream.d.ts +1 -1
- package/dist/extensions/xai/test-api.js +1 -1
- package/dist/extensions/xai/tts.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/xai-oauth.d.ts +1 -1
- package/dist/extensions/xai/xai-oauth.js +1 -1
- package/dist/extensions/xiaomi/index.d.ts +1 -1
- package/dist/extensions/xiaomi/speech-provider.d.ts +1 -1
- package/dist/extensions/xiaomi/stream.d.ts +1 -1
- package/dist/extensions/xiaomi/thinking.d.ts +1 -1
- package/dist/extensions/zai/index.d.ts +1 -1
- package/dist/file-fetch-tool-BVh97aps.js +124 -0
- package/dist/file-write-tool-Cfb7u51o.js +127 -0
- package/dist/format-Bqz5xYeB.js +250 -0
- package/dist/format-DpuFG9c5.js +1145 -0
- package/dist/gateway/protocol/index.d.ts +1 -1
- package/dist/gateway-cli-eCkwL4uy.js +435 -0
- package/dist/gateway-method-runtime-BXqKYfux.js +21 -0
- package/dist/gateway-runtime-COtKzRqi.d.ts +163 -0
- package/dist/gemini-cli-provider-BQgviROv.d.ts +6 -0
- package/dist/get-reply-Bc_T3z5w.js +4689 -0
- package/dist/get-reply-from-config.runtime-BKhFCEun.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/graph-users-BiokxXwA.js +1419 -0
- package/dist/group-access-DBAPYc28.js +112 -0
- package/dist/handle-action.guild-admin-S3qgTJJ3.js +288 -0
- package/dist/harness-B7wBXWh0.js +61 -0
- package/dist/health-DdXlm-1M.js +4 -0
- package/dist/health-state-BbDa6gRr.js +106 -0
- package/dist/heartbeat-runner-CZKQeDIE.js +5 -0
- package/dist/heartbeat-runner.runtime-D5VTmRkB.js +4 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/hooks-CJtypGfW.js +534 -0
- package/dist/http-registry-Yo_NvKls.d.ts +23 -0
- package/dist/image-generation-runtime-BIAvq6jv.d.ts +21 -0
- package/dist/inbound-direct-dm-runtime-D91V0BFn.js +2 -0
- package/dist/inbound-reply-dispatch-DTvJL7df.js +148 -0
- package/dist/index-7GMgTC5k.d.ts +3971 -0
- package/dist/index.js +1 -1
- package/dist/init-qWugBDhm.js +59 -0
- package/dist/inline-buttons-1E4EwLvT.js +40 -0
- package/dist/interactive-dispatch-ChuCQxzf.d.ts +56 -0
- package/dist/interactive-dispatch-DY_jVu-V.d.ts +143 -0
- package/dist/internal-events-DtxthZ8P.js +90 -0
- package/dist/isolated-agent-C0ZZI5QV.js +2 -0
- package/dist/isolated-agent-C7qWrmnX.js +1118 -0
- package/dist/lifecycle-Wq49oJK4.js +571 -0
- package/dist/list.probe-DWMHsvUW.js +449 -0
- package/dist/list.status-command-DSGGuDOk.js +789 -0
- package/dist/llm-slug-generator-Bp_C1mgK.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/loader-C-JyPvyF.d.ts +142 -0
- package/dist/local-dispatch.runtime-Cn8pnuYP.js +9 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/manager-CknaUr2b.d.ts +356 -0
- package/dist/manager.runtime-BdEdrDpV.js +2714 -0
- package/dist/manager.runtime.js +1 -1
- package/dist/markdown-to-line-D8Y0X3f4.js +811 -0
- package/dist/mcp-http-Cmug_nIB.js +555 -0
- package/dist/mcp-http-Dxmrs9Wm.js +2 -0
- package/dist/media-understanding-provider-BUGZ_tGW.js +339 -0
- package/dist/memory-core-host-engine-storage-izjrNFNA.d.ts +54 -0
- package/dist/memory-embedding-adapter-B3WLPdKc.d.ts +5 -0
- package/dist/message-actions-Bb5avCm0.js +145 -0
- package/dist/message-handler-7FxYBWCr.js +384 -0
- package/dist/message-handler-EXgLxNWG.js +1715 -0
- package/dist/message-handler.preflight-CtW30FUU.js +1125 -0
- package/dist/message-handler.process-D_tmiE76.js +1484 -0
- package/dist/migration-DVKbowM8.d.ts +45 -0
- package/dist/model-BSBoLWjJ.d.ts +33 -0
- package/dist/model-FzMER7bm.js +74 -0
- package/dist/model-selection-bti71700.js +272 -0
- package/dist/models-BvEw11kE.d.ts +24 -0
- package/dist/models-C8i8gMx4.js +2 -0
- package/dist/models-CdD9KMFY.js +104 -0
- package/dist/models-cli-gg_kT0t3.js +256 -0
- package/dist/monitor-Be8nfodW.js +1657 -0
- package/dist/monitor-Bvxk0x5H.js +715 -0
- package/dist/monitor-CE97mY08.js +2788 -0
- package/dist/monitor-CUf3qwuD.js +60 -0
- package/dist/monitor-D6mKqFJ6.js +834 -0
- package/dist/monitor-DU7GwGnr.js +4377 -0
- package/dist/monitor-DhcXz9j_.js +2 -0
- package/dist/monitor-auth-BRcGC8Y2.js +179 -0
- package/dist/monitor-polling.runtime-IxrlG8Xk.js +883 -0
- package/dist/monitor-polling.runtime.js +1 -1
- package/dist/monitor-vVY3N7u5.js +1370 -0
- package/dist/monitor-webhook.runtime-hc4RVNDK.js +387 -0
- package/dist/monitor-webhook.runtime.js +1 -1
- package/dist/monitor.account-XphC4gzs.js +5233 -0
- package/dist/monitor.runtime-6xS3OjmH.js +2 -0
- package/dist/monitor.runtime.js +1 -1
- package/dist/monitor.webhook-5EHwrXWd.js +180 -0
- package/dist/node-cli-sessions-DOBuRxFO.js +1228 -0
- package/dist/openai-codex-provider-C48t8ka8.d.ts +5 -0
- package/dist/openai-http-CGnGQIGW.js +824 -0
- package/dist/openai-provider-Df75q4KM.d.ts +5 -0
- package/dist/openresponses-http-BXPy59t0.js +1173 -0
- package/dist/operations-BvCPaweO.js +805 -0
- package/dist/outbound-adapter-DiSr_Bhn.js +543 -0
- package/dist/outbound-session-route-Cm1ZzMzO.js +45 -0
- package/dist/outbound.runtime-_iFVmHLo.js +2 -0
- package/dist/outbound.runtime.js +1 -1
- package/dist/pi-embedded-D5GNzI7q.js +4 -0
- package/dist/pi-embedded-DFFUgktH.js +3796 -0
- package/dist/pi-embedded.runtime-Cd4ObvwO.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools-BC8I1xvo.js +2413 -0
- package/dist/plan-CB-ExQ8I.js +112 -0
- package/dist/plan-XEE4NkGP.js +81 -0
- package/dist/plugin-DMYsMKAW.d.ts +17 -0
- package/dist/plugin-FgCZcV6y.js +12396 -0
- package/dist/plugin-app-cache-key-CDrzpMz5.js +46 -0
- package/dist/plugin-enabled-C63xoVby.js +233 -0
- package/dist/plugin-entry-DwVZtdM9.d.ts +47 -0
- package/dist/plugin-registration-DmMBSR62.js +88 -0
- package/dist/plugin-runtime-Dx9WRWX8.d.ts +117 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
- package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
- package/dist/plugin-sdk/agent-harness.js +7 -7
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +2 -2
- package/dist/plugin-sdk/channel-test-helpers.js +1 -1
- package/dist/plugin-sdk/command-auth.js +1 -1
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/health.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/mattermost.js +1 -1
- package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
- package/dist/plugin-sdk/provider-test-contracts.js +4 -4
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/testing.js +2 -2
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-service-Dt30fEbO.js +1229 -0
- package/dist/plugin-service-mHunWjlo.d.ts +24 -0
- package/dist/plugins/build-smoke-entry.d.ts +2 -2
- package/dist/plugins/loader.d.ts +1 -1
- package/dist/plugins/provider-discovery.runtime.d.ts +1 -1
- package/dist/plugins/provider-runtime.runtime.d.ts +1 -1
- package/dist/plugins/runtime/index.js +4 -4
- package/dist/policy-CtICwdgT.js +680 -0
- package/dist/policy-DT-VOML-.js +138 -0
- package/dist/prepare.runtime-BZWbkknM.js +732 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-c5wlaU-y.js +392 -0
- package/dist/probe-C0Gd1211.js +682 -0
- package/dist/probe-CM_9YKXA.js +2 -0
- package/dist/probe-CrkgoSu3.js +2204 -0
- package/dist/probe-DcbGYJMj.js +47 -0
- package/dist/program-DcIk29tW.js +131 -0
- package/dist/prompt-overlay-D0r0EA6z.d.ts +23 -0
- package/dist/provider-B2h8f0Br.js +8735 -0
- package/dist/provider-BXVr37w8.js +32 -0
- package/dist/provider-CIB7u7hX.js +152 -0
- package/dist/provider-api-key-auth-2Fp25hP8.d.ts +27 -0
- package/dist/provider-auth-result-mIg6RY-l.d.ts +21 -0
- package/dist/provider-bvVoUDev.js +32 -0
- package/dist/provider-catalog-runtime-B7e02aat.d.ts +23 -0
- package/dist/provider-catalog-shared-D0mIMF1C.d.ts +62 -0
- package/dist/provider-dispatcher-btaVKiyh.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-hook-runtime-CrtHxgL6.d.ts +61 -0
- package/dist/provider-model-shared-BESf3jvo.d.ts +143 -0
- package/dist/provider-models-B6wofKVD.d.ts +12 -0
- package/dist/provider-policy-0JjxJfxh.d.ts +30 -0
- package/dist/provider-registration-O7mvATZX.d.ts +6 -0
- package/dist/provider-registry-CtFVQxwM.d.ts +8 -0
- package/dist/provider-registry-DZxCJHb2.d.ts +8 -0
- package/dist/provider-registry-DcUASGbX.d.ts +30 -0
- package/dist/provider-runtime-CrrstiDP.d.ts +359 -0
- package/dist/provider-self-hosted-setup-DKlGE8A7.d.ts +74 -0
- package/dist/provider-session.runtime-CFBF4pr7.js +9 -0
- package/dist/provider-session.runtime.js +1 -1
- package/dist/provider-stream-C2vPdKh5.d.ts +140 -0
- package/dist/provider-stream-shared-CslVTt39.d.ts +128 -0
- package/dist/provider.runtime-CZfM-gk6.js +2 -0
- package/dist/provider.runtime.js +1 -1
- package/dist/providers.runtime-CHPPEG1J.d.ts +25 -0
- package/dist/public-surface-loader-BTQVJb2c.js +114 -0
- package/dist/pw-ai-CZwiW9VR.js +3029 -0
- package/dist/pw-role-snapshot-BBAmIGwb.js +333 -0
- package/dist/reaction-level-DBBuD-ww.js +19 -0
- package/dist/reaction-runtime-api-C1vrXLqZ.js +116 -0
- package/dist/realtime-transcription-Brox5yj7.d.ts +43 -0
- package/dist/realtime-transcription-provider-B9DWwCuO.d.ts +32 -0
- package/dist/realtime-transcription-provider-CGhoGie3.d.ts +28 -0
- package/dist/realtime-transcription-provider-CelUuvqm.js +205 -0
- package/dist/realtime-transcription-provider-Dau7Zk9V.d.ts +37 -0
- package/dist/realtime-transcription-provider-WgtPbRJc.d.ts +5 -0
- package/dist/realtime-voice-C5Xiylos.d.ts +333 -0
- package/dist/realtime-voice-provider-DUPM9wyW.d.ts +5 -0
- package/dist/register-OPqUqnP6.js +2178 -0
- package/dist/register.agent-DSrwwOvx.js +156 -0
- package/dist/register.crestodian-Xxxk2-Zl.js +24 -0
- package/dist/register.maintenance-CDfzLTNQ.js +83 -0
- package/dist/register.runtime-BVG-Dv_-.js +54 -0
- package/dist/register.runtime-BcgdXzLA.d.ts +6 -0
- package/dist/register.status-health-sessions-B36GUeBl.js +282 -0
- package/dist/register.subclis-BHzKPsu3.js +31 -0
- package/dist/register.subclis-Je6qsLUH.js +3 -0
- package/dist/register.subclis-core-DqSQ4XoR.js +273 -0
- package/dist/registry-DnnBulh_.d.ts +91 -0
- package/dist/registry-types-BQ26lhRo.d.ts +392 -0
- package/dist/repair-sequencing-DNO4k0Xf.js +640 -0
- package/dist/reply-delivery-37v9z05y.js +196 -0
- package/dist/reply-runtime-py2XHqw1.js +11 -0
- package/dist/reply.runtime-BKhFCEun.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/request-CoRpTCQ-.js +54 -0
- package/dist/resolve-allowlist-D-vOgxSP.js +220 -0
- package/dist/result-fallback-classifier-Dn3Dmp9k.js +79 -0
- package/dist/route-DW9RJF0S.js +469 -0
- package/dist/route-resolution-D_0Mvu67.js +274 -0
- package/dist/routes-437aa83D.js +3602 -0
- package/dist/routes-D7LQ3tMt.js +2 -0
- package/dist/run-DXGJiQoW.js +1162 -0
- package/dist/run-attempt-_0WJ7JVY.js +7704 -0
- package/dist/run-command-BkhBbZq4.js +23 -0
- package/dist/run-command-DMG9dO72.js +2 -0
- package/dist/run-embedded.runtime-D525I-KH.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-TuyJs3wn.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-subagent-registry.runtime-BcGVpK9w.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runtime-5_JhnRj0.js +438 -0
- package/dist/runtime-BEfdbKzt.js +6179 -0
- package/dist/runtime-DtQ2yT4g.js +1287 -0
- package/dist/runtime-api-Bm7IDGdk.js +24 -0
- package/dist/runtime-api-C8uxd9Js.js +4 -0
- package/dist/runtime-api-CLhw7d8A.js +13 -0
- package/dist/runtime-api-Ccg7ngfJ.js +13 -0
- package/dist/runtime-api-CpQqdZYq.js +21 -0
- package/dist/runtime-api-JulpTdFC.js +17 -0
- package/dist/runtime-api-zbqtuJt-.js +3 -0
- package/dist/runtime-api.actions-2fHneH-M.js +3 -0
- package/dist/runtime-api.monitor-Bpj7QCdL.js +6 -0
- package/dist/runtime-api.send-DeoFOMAr.js +4 -0
- package/dist/runtime-api.threads-b16O0JZ4.js +2 -0
- package/dist/runtime-channel-CuERpYnN.js +150 -0
- package/dist/runtime-channel-YbtclsiZ.js +2 -0
- package/dist/runtime-embedded-pi.runtime-DEcqs7Yu.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-taskflow-Co1PrqbP.d.ts +435 -0
- package/dist/sanitize-outbound-cOz4EipP.js +127 -0
- package/dist/sdk-setup-tools-Bur4xhiB.js +8 -0
- package/dist/secrets-B0P_1QcV.js +113 -0
- package/dist/security-audit-DRttHvfh.js +122 -0
- package/dist/security-audit-Dp26B_nd.js +118 -0
- package/dist/security-audit.runtime-DYK4iAnc.js +2 -0
- package/dist/security-audit.runtime.js +1 -1
- package/dist/selection-44C59Jt6.js +16157 -0
- package/dist/selection-QO-UjTkW.js +3 -0
- package/dist/send-C_D0mahx.js +2 -0
- package/dist/send-Cr-pK3Md.js +143 -0
- package/dist/send-DVhzeHKl.js +1631 -0
- package/dist/send-PmYvWFLe.js +192 -0
- package/dist/send.components-B2Mo6jm1.js +500 -0
- package/dist/send.components-BPYxo1GP.js +2 -0
- package/dist/send.runtime-D3JsvWwD.js +2 -0
- package/dist/send.runtime.js +1 -1
- package/dist/server-0ubKRVjg.js +24 -0
- package/dist/server-DfzdV9XR.js +73 -0
- package/dist/server-close.runtime.d.ts +1 -1
- package/dist/server-close.runtime.js +1 -1
- package/dist/server-context-CUWMZ_eM.js +2 -0
- package/dist/server-context-Cnl8idXT.js +955 -0
- package/dist/server-cron-D7QmsboM.js +2 -0
- package/dist/server-cron-mea_v_AH.js +2989 -0
- package/dist/server-maintenance-CzgBw90t.js +167 -0
- package/dist/server-methods-BQK-_CCw.js +16494 -0
- package/dist/server-node-events-C__xvGU1.js +596 -0
- package/dist/server-plugin-bootstrap-vC6fQjdM.js +70 -0
- package/dist/server-plugins-BfXHktel.js +432 -0
- package/dist/server-reload-handlers-CdagBZAE.js +714 -0
- package/dist/server-restart-sentinel-BO-vqR3K.js +747 -0
- package/dist/server-restart-sentinel-DND8yDHW.js +2 -0
- package/dist/server-runtime-services-Bao-oSOF.js +267 -0
- package/dist/server-runtime-services-D6cI6uO2.js +2 -0
- package/dist/server-startup-early-BDLTmiF5.js +87 -0
- package/dist/server-startup-plugins-q_W_iA3q.js +113 -0
- package/dist/server-startup-post-attach-CYKy2V3j.js +716 -0
- package/dist/server-ws-runtime-Da8L4ypZ.js +349 -0
- package/dist/server.impl-DGOSejqy.js +2586 -0
- package/dist/service-DlI2U-cK.js +1446 -0
- package/dist/session-binding-CwkYLNXf.js +2 -0
- package/dist/session-binding-DX-fo3c9.js +219 -0
- package/dist/session-kill-http-CFmTagxj.js +121 -0
- package/dist/session-reset-service-B25Jlagv.js +625 -0
- package/dist/session-route-bgMaGZRG.js +93 -0
- package/dist/session-status.runtime-Bs2EXyKA.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-DXxAjUOk.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-DacdZ4tB.js +521 -0
- package/dist/sessions-history-http-BVpW1ZcJ.js +430 -0
- package/dist/sessions.runtime-KBdCnSz6.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-api-CeIlDnWx.js +29 -0
- package/dist/setup-core-DLbBGLsw.js +174 -0
- package/dist/setup-surface-B2a2VaWD.js +221 -0
- package/dist/setup-surface-Bx_siWyS.js +320 -0
- package/dist/setup-surface-Cf4YnQu2.js +405 -0
- package/dist/setup-surface-DTcOOfre.js +288 -0
- package/dist/shared-2-FiBN51.d.ts +115 -0
- package/dist/shared-LAgU4fFs.js +121 -0
- package/dist/shared-client-Am1mCd-v.js +2 -0
- package/dist/shared-client-D3A48dlk.js +629 -0
- package/dist/side-question-DVTWk-tO.js +683 -0
- package/dist/simple-completion-runtime-JMnVclQ6.d.ts +73 -0
- package/dist/skill-tool-dispatch.runtime-igagKDUg.js +143 -0
- package/dist/skill-tool-dispatch.runtime.js +1 -1
- package/dist/slash-state-DJji-KSx.js +2166 -0
- package/dist/speech-CmQkc7zi.d.ts +47 -0
- package/dist/speech-core-CVkLGUxG.d.ts +36 -0
- package/dist/speech-provider-B73iu4fH.d.ts +5 -0
- package/dist/speech-provider-BEBH8vyF.d.ts +34 -0
- package/dist/speech-provider-BhCRdoMK.d.ts +8 -0
- package/dist/speech-provider-Cf1PVMAj.d.ts +8 -0
- package/dist/speech-provider-DdEPWhuR.d.ts +5 -0
- package/dist/speech-provider-Dsa05s8C.js +184 -0
- package/dist/speech-provider-ECom8JiZ.d.ts +5 -0
- package/dist/src-DqgvOnta.js +4256 -0
- package/dist/startup-context-CWwChEn9.js +313 -0
- package/dist/status-CUKFkF6b.js +3 -0
- package/dist/status-_UeuGVi3.js +4 -0
- package/dist/status-all-ChigLV_X.js +573 -0
- package/dist/status-json-CIdP1iBJ.js +14 -0
- package/dist/status-json-command-BDEUrp6M.js +84 -0
- package/dist/status-runtime-shared-Cq4a18dI.js +283 -0
- package/dist/status-subagents.runtime-CAVnAL4K.js +18 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-D4HAPHm1.js +296 -0
- package/dist/status.command-8BU177X9.js +2 -0
- package/dist/status.command-yh7emvuM.js +420 -0
- package/dist/status.command.text-runtime-B8OpdGCG.js +15 -0
- package/dist/status.scan-BIuwlU6G.js +68 -0
- package/dist/status.scan-overview-r9Sk69iQ.js +444 -0
- package/dist/status.scan.fast-json-3nlHM3LS.js +2 -0
- package/dist/status.scan.fast-json-DnwGPJ0_.js +127 -0
- package/dist/status.scan.runtime-CgdduW2l.js +479 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.update-BgFhUW7I.js +86 -0
- package/dist/status.update-rQL4_Irv.js +2 -0
- package/dist/sticker-cache-hPdFIaR8.js +206 -0
- package/dist/sticker-vision.runtime-CKwNUUYH.js +17 -0
- package/dist/sticker-vision.runtime.js +1 -1
- package/dist/stream-CYHgCxMh.d.ts +5 -0
- package/dist/stream-D8Ytt_tB.d.ts +120 -0
- package/dist/stream-DX9I-gkW.d.ts +19 -0
- package/dist/stream-DjL6Gw2C.d.ts +16 -0
- package/dist/stream-m7GKt3W2.d.ts +10 -0
- package/dist/stream-wrappers-UyEQes6p.d.ts +21 -0
- package/dist/subagent-announce-CPTinWX3.js +354 -0
- package/dist/subagent-announce-delivery-ohL5PocA.js +958 -0
- package/dist/subagent-control-BQDtHw6e.js +508 -0
- package/dist/subagent-hooks-BUKvlYGi.js +2 -0
- package/dist/subagent-hooks-CwwuJtIN.js +2 -0
- package/dist/subagent-hooks-D-6S1mpG.js +146 -0
- package/dist/subagent-hooks-DK4O9DHY.js +2 -0
- package/dist/subagent-hooks-DKrXETX6.js +230 -0
- package/dist/subagent-hooks-RtDD-o7f.js +116 -0
- package/dist/subagent-hooks-api-CSGGhB4Y.js +23 -0
- package/dist/subagent-hooks-api-Zf13FmkW.js +23 -0
- package/dist/subagent-hooks-api-fTY-dYum.js +22 -0
- package/dist/subagent-orphan-recovery-CR_zRTfz.js +352 -0
- package/dist/subagent-registry-BHt8-wIZ.js +2351 -0
- package/dist/subagent-registry-BuLz8xwh.js +3 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-session-cleanup-D7ihbQFh.js +525 -0
- package/dist/subagent-spawn-OIztmjv_.js +1164 -0
- package/dist/target-id-DWzawpWq.js +107 -0
- package/dist/targets-B5V5WYoi.js +19 -0
- package/dist/targets-D-0Biv4s.d.ts +10 -0
- package/dist/targets-HIPV3dV_.js +44 -0
- package/dist/targets-S-Pmze3w.d.ts +10 -0
- package/dist/targets-sXOKpsPF.js +19 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/telegram/token.js +1 -1
- package/dist/testing-a7plxbxs.js +267 -0
- package/dist/text-report-7eTN6lDu.js +695 -0
- package/dist/thinking-policy-B31-nCQk.d.ts +5 -0
- package/dist/thread-bindings-CFgQ6p2l.js +228 -0
- package/dist/thread-bindings-CJgi2r1R.js +232 -0
- package/dist/thread-bindings-CSoJgsSu.js +8 -0
- package/dist/thread-bindings-DvMQHqPr.js +571 -0
- package/dist/thread-bindings.discord-api-Btr2o7Dq.js +187 -0
- package/dist/thread-bindings.manager-B2MjrNW8.js +536 -0
- package/dist/thread-bindings.manager-DrIh5eqv.js +2 -0
- package/dist/thread-lifecycle-9hfhP6NM.js +1614 -0
- package/dist/token-D1xw1VoL.js +134 -0
- package/dist/tool-DTcPPGeG.js +139 -0
- package/dist/tool-actions.runtime-RP-p2ohJ.js +534 -0
- package/dist/tool-actions.runtime.js +1 -1
- package/dist/tool-plugin-B9aQw4fj.d.ts +77 -0
- package/dist/tool-resolution-FQZNVA7E.js +149 -0
- package/dist/tool-split-zov3PauL.d.ts +19 -0
- package/dist/tools-effective-inventory-D4IsbxCS.js +204 -0
- package/dist/tools-invoke-http-kcbjM-Jl.js +67 -0
- package/dist/tools-invoke-shared-CETqKcCV.js +200 -0
- package/dist/transport-stream-3OMu_lV2.d.ts +42 -0
- package/dist/tts-BMP6Xnk0.js +66 -0
- package/dist/tui-C36hUrre.js +2 -0
- package/dist/tui-DiM1ke7p.js +4709 -0
- package/dist/tui-backend-De30cpsu.js +256 -0
- package/dist/tui-cli-k2-5mPku.js +37 -0
- package/dist/types-D3enA0Vx.d.ts +786 -0
- package/dist/types-DHSQkzyq2.d.ts +3650 -0
- package/dist/types.public-DHQb4Kl9.d.ts +70 -0
- package/dist/update-check-Dq2TmP7u.js +372 -0
- package/dist/update-cli-CIH--yOA.js +3664 -0
- package/dist/update-runner-ON3AsN9h.js +2379 -0
- package/dist/update-startup-B1hNnHsG.js +2 -0
- package/dist/update-startup-DfHO6Sde.js +339 -0
- package/dist/video-generation-runtime-Dj060lga.d.ts +21 -0
- package/dist/video-model-catalog-CQ-f89xh.d.ts +16 -0
- package/dist/vision-tools-B2EWe9pv.js +1409 -0
- package/dist/web-search-DPki3TB7.js +62 -0
- package/dist/web-search-provider.runtime-CwRj50RV.js +2 -0
- package/dist/web-search-provider.runtime-DvOOme-j.js +328 -0
- package/dist/web-search-provider.runtime.js +1 -1
- package/dist/webhook-targets-CW4Nl_cq.d.ts +99 -0
- package/dist/xai-oauth-DtHB3Iav.js +479 -0
- package/dist/xai-user-agent-lpTplBOY.js +32 -0
- package/package.json +1 -1
- package/dist/abort-DI3P6TIb.js +0 -277
- package/dist/abort.runtime-B6Z7lDEa.js +0 -2
- package/dist/account-inspect-BFz7X0TX.js +0 -173
- package/dist/accounts-BoYYrY7x.js +0 -107
- package/dist/accounts-Busq29zW.js +0 -107
- package/dist/accounts-CuvH2tuN.js +0 -119
- package/dist/accounts-DkIcqvf7.js +0 -2
- package/dist/acp-runtime-BA8lzXzf.js +0 -26
- package/dist/acp-spawn-DPz2aX3A.js +0 -2
- package/dist/acp-spawn-DvVCsWYV.js +0 -1275
- package/dist/acp-stateful-target-driver-DcC76aZW.js +0 -89
- package/dist/action-kill-D-dVisIX.js +0 -33
- package/dist/action-runtime-BEiqwxDD.js +0 -469
- package/dist/action-runtime-api-1LzcGjcX.js +0 -2
- package/dist/action-send-c3CnDuPg.js +0 -39
- package/dist/action-spawn-Dj4kwpWs.js +0 -47
- package/dist/actions-qLccmQBc.js +0 -161
- package/dist/actions.runtime-B5vYAgNi.js +0 -5
- package/dist/agent-command-D6Ds198G.js +0 -1367
- package/dist/agent-components.runtime-xquK0B3L.js +0 -10
- package/dist/agent-harness-C5Qqf3rr.d.ts +0 -146
- package/dist/agent-harness-runtime-Dq1fCBOM.js +0 -180
- package/dist/agent-harness-runtime-moWkHG-i.d.ts +0 -691
- package/dist/agent-harness-task-runtime-DvSEqFkD.js +0 -140
- package/dist/agent-lm5ZYOFy.js +0 -3
- package/dist/agent-runner-execution-Dbh2pDhQ.js +0 -1713
- package/dist/agent-runner-utils-Di3r2T1T.js +0 -266
- package/dist/agent-runner.runtime-BW90EcGW.js +0 -3455
- package/dist/agent-runtime-BgIT5Ytc.js +0 -229
- package/dist/agent-via-gateway-DMMS8-hK.js +0 -463
- package/dist/agent-ylolD8-V.js +0 -2
- package/dist/api-BB4vXLtW.js +0 -2
- package/dist/api-BpymzRMa.d.ts +0 -52
- package/dist/api-CUhM3KNB.js +0 -134
- package/dist/api-CewRHSbT.js +0 -6
- package/dist/api-CfKjNJlW.js +0 -2
- package/dist/api-Rsnqui1u.js +0 -3
- package/dist/api-k7AvxwHr.js +0 -639
- package/dist/apply-DQ4TQNMA.js +0 -54
- package/dist/apply-S_75Py4Y.js +0 -41
- package/dist/approval-handler.runtime-Cthxrstu.js +0 -130
- package/dist/assistant-Cp9pGaBw.js +0 -291
- package/dist/attachment-normalize-5R0bLLOj.js +0 -225
- package/dist/attempt-execution-DuyyZYsU.js +0 -558
- package/dist/attempt-execution.runtime-DF2GPgNh.js +0 -3
- package/dist/attempt-execution.shared-CwdukA3t.js +0 -38
- package/dist/attempt.prompt-helpers-CUqKtIa5.js +0 -475
- package/dist/attempt.tool-run-context-BbN4_BYO.js +0 -2094
- package/dist/binding-routing-C6Ex2Blu.js +0 -113
- package/dist/binding-targets-BqREncSL.js +0 -121
- package/dist/bot-DGMEkaIJ.js +0 -7894
- package/dist/bot-deps-BltYjeMX.js +0 -2
- package/dist/bot-deps-XvGCor9f.js +0 -747
- package/dist/bot-message-context.runtime-kK-xvLV7.js +0 -7
- package/dist/bot-message-context.session.runtime-DpOIJUae.js +0 -12
- package/dist/bot-native-commands.delivery.runtime-D49p5Lc1.js +0 -4
- package/dist/bot-native-commands.runtime-8XBdSpkQ.js +0 -13
- package/dist/bridge-server-y_XGduPx.js +0 -113
- package/dist/browser-cli-B2jmmTT3.js +0 -230
- package/dist/browser-cli-actions-input-JQt5ZQcn.js +0 -473
- package/dist/browser-cli-actions-observe-CrfKh6AX.js +0 -81
- package/dist/browser-cli-debug-DQACWlvC.js +0 -137
- package/dist/browser-cli-inspect-DDnxx0Xw.js +0 -104
- package/dist/browser-cli-lEuOnZzs.js +0 -2
- package/dist/browser-cli-manage-DogmwtYt.js +0 -443
- package/dist/browser-cli-resize-BHuV71VZ.js +0 -26
- package/dist/browser-cli-shared-CidShgoF.js +0 -50
- package/dist/browser-cli-state-i8cCGbiQ.js +0 -337
- package/dist/browser-control-auth-CKfXdXWj.js +0 -2
- package/dist/browser-profiles-ATBTvUGh.js +0 -2
- package/dist/browser-runtime-KmCT6FuL.js +0 -384
- package/dist/build-DOOT6f62.js +0 -257
- package/dist/call-CxD79IcF.d.ts +0 -43
- package/dist/capability-cli-DwvrwB-g.js +0 -1782
- package/dist/channel-B-wgK1bK.js +0 -481
- package/dist/channel-B1e_k1P0.js +0 -867
- package/dist/channel-B2Zzd2k0.d.ts +0 -12
- package/dist/channel-B9WuAnZ8.d.ts +0 -106
- package/dist/channel-BRDfa5tc.js +0 -1777
- package/dist/channel-BVEO1O4p.js +0 -376
- package/dist/channel-BVjxNRMX.d.ts +0 -427
- package/dist/channel-BYlO5l1d.js +0 -508
- package/dist/channel-Bl0sPoNx.js +0 -653
- package/dist/channel-BsuDwswl.d.ts +0 -7
- package/dist/channel-Butzttww.d.ts +0 -8
- package/dist/channel-C84xtDBy.js +0 -1134
- package/dist/channel-CI3wvxHO.d.ts +0 -28
- package/dist/channel-CLgKq4Ds.js +0 -1556
- package/dist/channel-CZT0qxLh.js +0 -1249
- package/dist/channel-CffBHWkb.js +0 -955
- package/dist/channel-CkcbWRn6.d.ts +0 -64
- package/dist/channel-D34ZJvVB.js +0 -2126
- package/dist/channel-DIO2fCbZ.d.ts +0 -8
- package/dist/channel-DcdXLo_W.js +0 -238
- package/dist/channel-Di1RmAev.d.ts +0 -14
- package/dist/channel-DnK5TrXV.js +0 -362
- package/dist/channel-DwuWXl-e.d.ts +0 -104
- package/dist/channel-Dye4zV44.d.ts +0 -114
- package/dist/channel-Dzj4RHY2.js +0 -740
- package/dist/channel-EVxJIvsn.d.ts +0 -8
- package/dist/channel-OhZzLZCj.js +0 -562
- package/dist/channel-RzVdPJ-B.d.ts +0 -7
- package/dist/channel-actions.runtime-Cdvhqc9s.js +0 -265
- package/dist/channel-bt1sO_52.d.ts +0 -47
- package/dist/channel-core-DU6RaWEc.d.ts +0 -6
- package/dist/channel-core-Dz9I_R4j.js +0 -5
- package/dist/channel-entry-contract-DH5cFk0a.d.ts +0 -112
- package/dist/channel-inbound-COGoV_aS.js +0 -80
- package/dist/channel-j5sg3EWY.d.ts +0 -26
- package/dist/channel-mP6HCIMr.js +0 -1496
- package/dist/channel-plugin-runtime-C0R46KeG.js +0 -998
- package/dist/channel-plugin-runtime-CcM5mm-N.d.ts +0 -7
- package/dist/channel-prmoa-zo.d.ts +0 -49
- package/dist/channel-quGdgWel.js +0 -808
- package/dist/channel-runtime-FvPQoIF9.js +0 -408
- package/dist/channel-xyKfZAyc.d.ts +0 -6
- package/dist/channel.runtime-2vUz3gij.js +0 -109
- package/dist/channel.runtime-BZLDSNuQ.js +0 -254
- package/dist/channel.runtime-Bo5jO0Hj.js +0 -4
- package/dist/channel.runtime-CDgvrjM2.js +0 -652
- package/dist/channel.runtime-COf8SDFn.js +0 -88
- package/dist/channel.runtime-C_C1f8lu.js +0 -733
- package/dist/channel.runtime-CqPbsg8t.js +0 -2528
- package/dist/channel.runtime-DtV85Khx.js +0 -1008
- package/dist/channel.runtime-Spt1ukGW.js +0 -21009
- package/dist/channel.setup-Bc0LUQS1.js +0 -1098
- package/dist/channel.setup-ChTkj2hq.js +0 -343
- package/dist/channel.setup-Cim5RYKv.d.ts +0 -6
- package/dist/channel.setup-CpMD9F8i.js +0 -10
- package/dist/channel.setup-D066s5T2.d.ts +0 -8
- package/dist/channel.setup-DtDtKE3i.d.ts +0 -7
- package/dist/chat-mUsjD5YN.js +0 -2666
- package/dist/chrome-u314zcbM.js +0 -1503
- package/dist/cli-CJMoqXrc.js +0 -1341
- package/dist/cli-DxFO1nnC.d.ts +0 -20
- package/dist/cli-backend-6kG1m74b.d.ts +0 -5
- package/dist/cli-backend-BAkmSUUG.d.ts +0 -5
- package/dist/cli-compaction-qGYB7suI.js +0 -347
- package/dist/cli-metadata-BBJFpNU9.js +0 -22
- package/dist/cli-runner-C0kcts0I.js +0 -540
- package/dist/cli-runner-CTm8K6s8.js +0 -2
- package/dist/cli-runner.runtime-C8deL5FL.js +0 -3
- package/dist/cli-runner.runtime-DDAg1D0L.js +0 -4
- package/dist/cli-shared-BLWU6Cqi.d.ts +0 -20
- package/dist/client-CPxpgs4m.js +0 -650
- package/dist/client-adapter-CLlqOqfu.js +0 -897
- package/dist/client-factory-R7Rr2jwn.js +0 -9
- package/dist/command-auth-CkQP1buP.js +0 -135
- package/dist/command-handlers-CJEjFyMk.js +0 -1609
- package/dist/command-registry-BDgyOqDw.js +0 -4
- package/dist/command-registry-BVi5Jn1S.js +0 -9
- package/dist/command-registry-core-JCfsVRtz.js +0 -110
- package/dist/command-status.runtime-CM1JLzi6.js +0 -90
- package/dist/commands-CKuMcAVp.d.ts +0 -113
- package/dist/commands-acp-C1-I78U6.js +0 -74
- package/dist/commands-compact.runtime-DOsNavwp.js +0 -10
- package/dist/commands-handlers.runtime-BD1n2WGw.js +0 -6154
- package/dist/commands-status-DU_UTQz1.js +0 -16
- package/dist/commands-status-DejfTakp.js +0 -3
- package/dist/commands-status.runtime-DejfTakp.js +0 -3
- package/dist/commands-subagents-control.runtime-D7vo_2Y_.js +0 -3
- package/dist/commands-subagents-control.runtime-DGybTjJ6.js +0 -2
- package/dist/commands-system-prompt-BEBXAMea.js +0 -2
- package/dist/commands-system-prompt-gj3oQpQO.js +0 -162
- package/dist/commands.runtime-CgXX70IN.js +0 -176
- package/dist/compact-C41XxMDt.js +0 -480
- package/dist/compact-DUVAF9EC.js +0 -1141
- package/dist/compact.runtime-COMRg6s3.js +0 -12
- package/dist/completion-cli-CmEYoB9a.js +0 -315
- package/dist/computer-use-BwJHu1QF.js +0 -367
- package/dist/config-ATBTvUGh.js +0 -2
- package/dist/config-DlNgjF8W.js +0 -373
- package/dist/config-mutations-tl_OqI6d.js +0 -159
- package/dist/config-schema-SCmBztOw.d.ts +0 -20
- package/dist/context-engine-host-compat-BNPAIK9F.js +0 -288
- package/dist/context-engine-host-compat-C69CK7zS.js +0 -2
- package/dist/context-engine-lifecycle-iQ8f5a_-.js +0 -1274
- package/dist/contracts-testkit-IY5XZxjF.d.ts +0 -145
- package/dist/control-auth-vVxyGKxY.js +0 -114
- package/dist/control-service-73nj79EW.js +0 -145
- package/dist/control-ui/assets/agents-BdO_0kk5.js +0 -1008
- package/dist/control-ui/assets/channel-config-extras-BcTFMuAU.js +0 -2
- package/dist/control-ui/assets/channels-hbnP2CcI.js +0 -367
- package/dist/control-ui/assets/cron-ByzZ9SdY.js +0 -1013
- package/dist/control-ui/assets/debug-HrL-odD4.js +0 -97
- package/dist/control-ui/assets/index-C0IIxqOi.js +0 -7370
- package/dist/control-ui/assets/instances-D7u_JQ4E.js +0 -57
- package/dist/control-ui/assets/logs-BtcCmag8.js +0 -74
- package/dist/control-ui/assets/nodes-X76oCsfw.js +0 -436
- package/dist/control-ui/assets/sessions-d2TtEi9u.js +0 -399
- package/dist/control-ui/assets/skills-DZoG94r4.js +0 -314
- package/dist/control-ui/assets/skills-shared-CUBldL4J.js +0 -11
- package/dist/conversation-binding-runtime-CmoTKcY1.js +0 -4
- package/dist/conversation-runtime-BxOHxuin.js +0 -31
- package/dist/core-D0Y2H55f.js +0 -282
- package/dist/core-DM2Ct83m.d.ts +0 -224
- package/dist/core-api-BKlJUtDt.js +0 -5
- package/dist/core-api-_fiftUHn.js +0 -2
- package/dist/crestodian-BJifoQiR.js +0 -55
- package/dist/daocore-runtime-DMcB2cnr.d.ts +0 -151
- package/dist/daocore-tools-BMdF8RwK.js +0 -11727
- package/dist/delivery-e2ci_bcX.js +0 -1002
- package/dist/dialogue-BXayGhnz.js +0 -37
- package/dist/dir-fetch-tool-Cara5mZh.js +0 -565
- package/dist/dir-list-tool-CQ8Bo5Ez.js +0 -100
- package/dist/direct-dm-CPk6Qm9D.js +0 -64
- package/dist/directive-handling.fast-lane-BQ9aXqk8.js +0 -68
- package/dist/directive-handling.impl--a5AGurq.js +0 -818
- package/dist/directive-handling.impl-C4JqMwle.js +0 -2
- package/dist/directive-handling.model-selection-pyTYMIXn.js +0 -122
- package/dist/directive-handling.persist.runtime-B7vWT1r9.js +0 -263
- package/dist/dispatch-3Ru_eGq1.js +0 -1640
- package/dist/dispatch-acp-transcript.runtime-CYMP-5oE.js +0 -40
- package/dist/dispatch-acp.runtime-BVCiklXk.js +0 -18
- package/dist/doctor-B8mR3Sgr.js +0 -2
- package/dist/doctor-BJ6DuerV.js +0 -6
- package/dist/doctor-config-flow-BdOGs_zn.js +0 -1741
- package/dist/doctor-core-checks-CDf0stz-.js +0 -2
- package/dist/doctor-core-checks-Cpdnu2XI.js +0 -573
- package/dist/doctor-health-0qv_acBu.js +0 -65
- package/dist/doctor-health-contributions-Db1FQgFw.js +0 -696
- package/dist/doctor-lint-C1g4Llgl.js +0 -94
- package/dist/doctor-state-integrity-C8iXFLJ7.js +0 -1231
- package/dist/doctor-update-CsPu6p3d.js +0 -58
- package/dist/dynamic-tools-YQ0z0YKH.js +0 -486
- package/dist/embedded-backend-S0cahIZw.js +0 -579
- package/dist/embedded-gateway-stub.runtime-Cjw12ALm.js +0 -12
- package/dist/embedding-provider-8MdvWeKO.d.ts +0 -21
- package/dist/embedding-provider-BBQtqzJ9.d.ts +0 -65
- package/dist/embedding-provider-CBEwKWYD.d.ts +0 -16
- package/dist/exec-approvals-ArHHjoE-.js +0 -149
- package/dist/file-fetch-tool-DQpAtjX4.js +0 -124
- package/dist/file-write-tool-CkB0oYwe.js +0 -127
- package/dist/format-BUFz60TQ.js +0 -250
- package/dist/format-DUJUpMFQ.js +0 -1145
- package/dist/gateway-cli-CQo_E4Ka.js +0 -435
- package/dist/gateway-method-runtime-1QPgVJH7.js +0 -21
- package/dist/gateway-runtime-O_Wi0NT3.d.ts +0 -163
- package/dist/gemini-cli-provider-DdNgpy2W.d.ts +0 -6
- package/dist/get-reply-DfUcsC-O.js +0 -4689
- package/dist/get-reply-from-config.runtime-C95MG73O.js +0 -2
- package/dist/graph-users-DPJe0fPs.js +0 -1419
- package/dist/group-access-DefaNJ6L.js +0 -112
- package/dist/handle-action.guild-admin-C1sy1kGJ.js +0 -288
- package/dist/harness-BgPRdmNK.js +0 -61
- package/dist/health-DFR9A1YV.js +0 -4
- package/dist/health-state-BT1WDbbs.js +0 -106
- package/dist/heartbeat-runner-BiYVPs25.js +0 -5
- package/dist/heartbeat-runner.runtime-Bmaq8WUA.js +0 -4
- package/dist/hooks-CNJDuJUm.js +0 -534
- package/dist/http-registry-B-2IMGGY.d.ts +0 -23
- package/dist/image-generation-runtime-Bc2sooDl.d.ts +0 -21
- package/dist/inbound-direct-dm-runtime-DFt58p71.js +0 -2
- package/dist/inbound-reply-dispatch-kgSDM8ax.js +0 -148
- package/dist/index-DmaFd4LB.d.ts +0 -3971
- package/dist/init-B0zO_U4r.js +0 -59
- package/dist/inline-buttons-B6zgQW3J.js +0 -40
- package/dist/interactive-dispatch--tUd3qas.d.ts +0 -143
- package/dist/interactive-dispatch-C4z7lkyI.d.ts +0 -56
- package/dist/internal-events-C3Q5t6hg.js +0 -90
- package/dist/isolated-agent-CaSU5GCJ.js +0 -2
- package/dist/isolated-agent-CnsD2TmP.js +0 -1118
- package/dist/lifecycle-i3WZDaIn.js +0 -571
- package/dist/list.probe-g0rUiVXW.js +0 -449
- package/dist/list.status-command-DG3PrmeO.js +0 -789
- package/dist/llm-slug-generator-CHlf69FU.js +0 -78
- package/dist/loader-D5A-oM1D.d.ts +0 -142
- package/dist/local-dispatch.runtime-CDeHUp_A.js +0 -9
- package/dist/manager-DOBX6201.d.ts +0 -356
- package/dist/manager.runtime-BlLMPUTq.js +0 -2714
- package/dist/markdown-to-line-r_mBHMdy.js +0 -811
- package/dist/mcp-http-C5UPIJGR.js +0 -555
- package/dist/mcp-http-CTy9gpfA.js +0 -2
- package/dist/media-understanding-provider-BT6TOuVa.js +0 -339
- package/dist/memory-core-host-engine-storage-FuGbyvg1.d.ts +0 -54
- package/dist/memory-embedding-adapter-Ch5SpgXi.d.ts +0 -5
- package/dist/message-actions-BdcjjwFt.js +0 -145
- package/dist/message-handler-B29Tj2p2.js +0 -1715
- package/dist/message-handler-BhHb1FHI.js +0 -384
- package/dist/message-handler.preflight-ouZ_-3o8.js +0 -1125
- package/dist/message-handler.process-CrYiBx_F.js +0 -1484
- package/dist/migration-DJ7cUDW2.d.ts +0 -45
- package/dist/model-C5aopp74.d.ts +0 -33
- package/dist/model-CLbtocQX.js +0 -74
- package/dist/model-selection-BG_vU9Kl.js +0 -272
- package/dist/models-4KERn3ya.js +0 -104
- package/dist/models-BCa-ipxi.js +0 -2
- package/dist/models-CFT_VQvO.d.ts +0 -24
- package/dist/models-cli-DtpGXEsf.js +0 -256
- package/dist/monitor-B-egsvmI.js +0 -1657
- package/dist/monitor-BJX9Yv7k.js +0 -2
- package/dist/monitor-BPrIy3pV.js +0 -715
- package/dist/monitor-BWknZZ7N.js +0 -4377
- package/dist/monitor-C3y_PtI1.js +0 -60
- package/dist/monitor-DCzfdqE4.js +0 -1370
- package/dist/monitor-P24epSwE.js +0 -2788
- package/dist/monitor-auth-CEG_xldE.js +0 -179
- package/dist/monitor-jEePJbbS.js +0 -834
- package/dist/monitor-polling.runtime-BzlHK11u.js +0 -883
- package/dist/monitor-webhook.runtime-vFEhk_Zj.js +0 -387
- package/dist/monitor.account-BUIfgWXg.js +0 -5233
- package/dist/monitor.runtime-Cp7W4fhb.js +0 -2
- package/dist/monitor.webhook-DzrbeR4T.js +0 -180
- package/dist/node-cli-sessions-CLbI14UA.js +0 -1228
- package/dist/openai-codex-provider-DV8SJTzK.d.ts +0 -5
- package/dist/openai-http-BM9BIA_g.js +0 -824
- package/dist/openai-provider-DBfwo7pI.d.ts +0 -5
- package/dist/openresponses-http-CNoW9kk8.js +0 -1173
- package/dist/operations-DT4bsxV6.js +0 -805
- package/dist/outbound-adapter-CZRUOgY0.js +0 -543
- package/dist/outbound-session-route-DneMsGNx.js +0 -45
- package/dist/outbound.runtime-CHuoKJJI.js +0 -2
- package/dist/pi-embedded-1-rsueO_.js +0 -3796
- package/dist/pi-embedded-BRfDncVO.js +0 -4
- package/dist/pi-embedded.runtime-DEYoa6bW.js +0 -4
- package/dist/pi-tools-C0P3NgP5.js +0 -2413
- package/dist/plan-BQUkjBMY.js +0 -81
- package/dist/plan-CRO9_2_k.js +0 -112
- package/dist/plugin-3HfIuARf.d.ts +0 -17
- package/dist/plugin-BJCmWhnh.js +0 -12396
- package/dist/plugin-app-cache-key-CXAg0F7A.js +0 -46
- package/dist/plugin-enabled-D93Z9LSo.js +0 -233
- package/dist/plugin-entry-CnmrrtsZ.d.ts +0 -47
- package/dist/plugin-registration-BBrTcZnf.js +0 -88
- package/dist/plugin-runtime-C9rLv6cg.d.ts +0 -117
- package/dist/plugin-service-Bn32flyQ.d.ts +0 -24
- package/dist/plugin-service-DnZEPBEA.js +0 -1229
- package/dist/policy-CMv5QMPG.js +0 -138
- package/dist/policy-CeoP4t9J.js +0 -680
- package/dist/prepare.runtime-DZ55JiTt.js +0 -732
- package/dist/preview-warnings-O08PZRxu.js +0 -392
- package/dist/probe-C6w3bP8X.js +0 -682
- package/dist/probe-Cs1_X1NA.js +0 -47
- package/dist/probe-Cuee_jyM.js +0 -2204
- package/dist/probe-DZxCnDzn.js +0 -2
- package/dist/program-C2dT8VHB.js +0 -131
- package/dist/prompt-overlay-TZmqHUQy.d.ts +0 -23
- package/dist/provider-C2_vSzYh.js +0 -32
- package/dist/provider-DSfTDQbj.js +0 -152
- package/dist/provider-U8hrm9h-.js +0 -32
- package/dist/provider-_v910H8y.js +0 -8735
- package/dist/provider-api-key-auth-B5v8fc5t.d.ts +0 -27
- package/dist/provider-auth-result-BVBIW1K1.d.ts +0 -21
- package/dist/provider-catalog-runtime-DIpk2yCc.d.ts +0 -23
- package/dist/provider-catalog-shared-DIGBDDJ_.d.ts +0 -62
- package/dist/provider-dispatcher-C3kmmIEC.js +0 -22
- package/dist/provider-hook-runtime-CxMK4Nxj.d.ts +0 -61
- package/dist/provider-model-shared-C27mXTlf.d.ts +0 -143
- package/dist/provider-models-Cy0x8f2O.d.ts +0 -12
- package/dist/provider-policy-DXmndC7d.d.ts +0 -30
- package/dist/provider-registration-uSCbfm21.d.ts +0 -6
- package/dist/provider-registry-AT1quH-E.d.ts +0 -8
- package/dist/provider-registry-C35uRv4E.d.ts +0 -8
- package/dist/provider-registry-CvFYkCUP.d.ts +0 -30
- package/dist/provider-runtime-WhqIW1EN.d.ts +0 -359
- package/dist/provider-self-hosted-setup-DomISF6k.d.ts +0 -74
- package/dist/provider-session.runtime-Mg0fx5hH.js +0 -9
- package/dist/provider-stream-dOfsyID8.d.ts +0 -140
- package/dist/provider-stream-shared-B7iFu04Z.d.ts +0 -128
- package/dist/provider.runtime-pSTXuHrq.js +0 -2
- package/dist/providers.runtime-CA9amkvC.d.ts +0 -25
- package/dist/public-surface-loader-09t4TTue.js +0 -114
- package/dist/pw-ai-DjNqHV3_.js +0 -3029
- package/dist/pw-role-snapshot-DoGefdv7.js +0 -333
- package/dist/reaction-level-C8Mqxizo.js +0 -19
- package/dist/reaction-runtime-api-DOP6xOsm.js +0 -116
- package/dist/realtime-transcription-BVierbfq.d.ts +0 -43
- package/dist/realtime-transcription-provider-BFYQf3Mc.d.ts +0 -28
- package/dist/realtime-transcription-provider-BTGEXXna.js +0 -205
- package/dist/realtime-transcription-provider-BpGi7xsk.d.ts +0 -37
- package/dist/realtime-transcription-provider-DVDaXByF.d.ts +0 -5
- package/dist/realtime-transcription-provider-NsnHDYG_.d.ts +0 -32
- package/dist/realtime-voice-DIfFPO81.d.ts +0 -333
- package/dist/realtime-voice-provider-DgaPWM1q.d.ts +0 -5
- package/dist/register-CbZPpqI3.js +0 -2178
- package/dist/register.agent-DrBFuPKh.js +0 -156
- package/dist/register.crestodian-DwTbmaK8.js +0 -24
- package/dist/register.maintenance-BIeoYBub.js +0 -83
- package/dist/register.runtime-B5V9_Dwz.js +0 -54
- package/dist/register.runtime-D1DKtiFc.d.ts +0 -6
- package/dist/register.status-health-sessions-Bt261Z8-.js +0 -282
- package/dist/register.subclis-CJE9ISZY.js +0 -31
- package/dist/register.subclis-YQsKas8N.js +0 -3
- package/dist/register.subclis-core-CjwdGeGU.js +0 -273
- package/dist/registry-BNbSEDbx.d.ts +0 -91
- package/dist/registry-types-CoTdsByS.d.ts +0 -392
- package/dist/repair-sequencing-C0jrL5pw.js +0 -640
- package/dist/reply-delivery-B28mTIpb.js +0 -196
- package/dist/reply-runtime-BqQX7HHw.js +0 -11
- package/dist/reply.runtime-C95MG73O.js +0 -2
- package/dist/request-BqoMvXxH.js +0 -54
- package/dist/resolve-allowlist-hbKKd_kq.js +0 -220
- package/dist/result-fallback-classifier-BrORPoxj.js +0 -79
- package/dist/route-HHRgSzVy.js +0 -469
- package/dist/route-resolution-C7bafjVc.js +0 -274
- package/dist/routes-86XGeo7a.js +0 -2
- package/dist/routes-BhVGr9ie.js +0 -3602
- package/dist/run-Bb5QP5JV.js +0 -1162
- package/dist/run-attempt-CLi0wV7j.js +0 -7704
- package/dist/run-command-Be6GAxiW.js +0 -2
- package/dist/run-command-Ds4hr3iU.js +0 -23
- package/dist/run-embedded.runtime-wX9ORojX.js +0 -4
- package/dist/run-execution-cli.runtime-BmNZVB2N.js +0 -4
- package/dist/run-subagent-registry.runtime-Uq5sjftu.js +0 -2
- package/dist/runtime-BktLQ75j.js +0 -1287
- package/dist/runtime-C9XdR62_.js +0 -438
- package/dist/runtime-CTvWDPx9.js +0 -6179
- package/dist/runtime-api-BojB3MUw.js +0 -21
- package/dist/runtime-api-C92MlAwp.js +0 -13
- package/dist/runtime-api-CFNZE9Xt.js +0 -13
- package/dist/runtime-api-Cimpgm5_.js +0 -3
- package/dist/runtime-api-D8qG_lUm.js +0 -17
- package/dist/runtime-api-DMDMnQEG.js +0 -4
- package/dist/runtime-api-DupQdIlE.js +0 -24
- package/dist/runtime-api.actions-B8i3elqu.js +0 -3
- package/dist/runtime-api.monitor-BntFzf_M.js +0 -6
- package/dist/runtime-api.send-CPlmi1jc.js +0 -4
- package/dist/runtime-api.threads-D-H_r_Nl.js +0 -2
- package/dist/runtime-channel-BGhTxnXZ.js +0 -150
- package/dist/runtime-channel-CPFxNapZ.js +0 -2
- package/dist/runtime-embedded-pi.runtime-BjnMTurB.js +0 -2
- package/dist/runtime-taskflow-D0qw2_ew.d.ts +0 -435
- package/dist/sanitize-outbound-BMUv1NeS.js +0 -127
- package/dist/sdk-setup-tools-Do3DkQi_.js +0 -8
- package/dist/secrets-B8YVPHhk.js +0 -113
- package/dist/security-audit-7Gg_nL4o.js +0 -122
- package/dist/security-audit-Bk3CREj-.js +0 -118
- package/dist/security-audit.runtime-BmSJrdeq.js +0 -2
- package/dist/selection-BFGde9-_.js +0 -3
- package/dist/selection-DrLFlbgG.js +0 -16157
- package/dist/send-4dLa-BQo.js +0 -1631
- package/dist/send-CV6gCwYP.js +0 -192
- package/dist/send-aGiK3Efu.js +0 -143
- package/dist/send-dB3CehAN.js +0 -2
- package/dist/send.components-BcG9BlkC.js +0 -2
- package/dist/send.components-rLjDlfYU.js +0 -500
- package/dist/send.runtime-D20k2MSr.js +0 -2
- package/dist/server-BTRx_U1s.js +0 -73
- package/dist/server-CY0ymhBg.js +0 -24
- package/dist/server-context-BxGT8wbK.js +0 -955
- package/dist/server-context-DYlbhAaT.js +0 -2
- package/dist/server-cron-BB_15lcP.js +0 -2
- package/dist/server-cron-CfyJX_a4.js +0 -2989
- package/dist/server-maintenance-BwJ3OO_l.js +0 -167
- package/dist/server-methods-Ck2ab6TC.js +0 -16494
- package/dist/server-node-events-BdRizF-5.js +0 -596
- package/dist/server-plugin-bootstrap-CPUr8NFE.js +0 -70
- package/dist/server-plugins-__5AxjzH.js +0 -432
- package/dist/server-reload-handlers-BMl9Fx9b.js +0 -714
- package/dist/server-restart-sentinel-D11M_ZsH.js +0 -747
- package/dist/server-restart-sentinel-DGptQ27c.js +0 -2
- package/dist/server-runtime-services-BwtLs-8I.js +0 -2
- package/dist/server-runtime-services-aJydixRu.js +0 -267
- package/dist/server-startup-early-CIW_gExj.js +0 -87
- package/dist/server-startup-plugins-m_P3gY4m.js +0 -113
- package/dist/server-startup-post-attach-DuXQ1AXL.js +0 -716
- package/dist/server-ws-runtime-mXmxB1W8.js +0 -349
- package/dist/server.impl-fuV8aKSP.js +0 -2586
- package/dist/service-a8cTFka4.js +0 -1446
- package/dist/session-binding-BIycxo9u.js +0 -2
- package/dist/session-binding-xHwQr9vM.js +0 -219
- package/dist/session-kill-http-DiUZhcoN.js +0 -121
- package/dist/session-reset-service-DkepDoob.js +0 -625
- package/dist/session-route-Ba5u7ecb.js +0 -93
- package/dist/session-status.runtime-Cb1X69Rl.js +0 -2
- package/dist/session-subagent-reactivation.runtime-rbqmto4G.js +0 -2
- package/dist/session-tab-registry-DSKOoJta.js +0 -521
- package/dist/sessions-history-http-CWP88I_C.js +0 -430
- package/dist/sessions.runtime-1q1OwLn3.js +0 -2
- package/dist/setup-api-DtrOOYeP.js +0 -29
- package/dist/setup-core-DMrJS6LP.js +0 -174
- package/dist/setup-surface-BFPNu1qA.js +0 -405
- package/dist/setup-surface-CedShqhO.js +0 -288
- package/dist/setup-surface-DLOBH1Vf.js +0 -320
- package/dist/setup-surface-MhCeEWSj.js +0 -221
- package/dist/shared-CtNdbFXT.d.ts +0 -115
- package/dist/shared-DamL-e8D.js +0 -121
- package/dist/shared-client-B48JoAsz.js +0 -2
- package/dist/shared-client-BoSiDnUo.js +0 -629
- package/dist/side-question-DQoQ_ETb.js +0 -683
- package/dist/simple-completion-runtime-CeXfjzsh.d.ts +0 -73
- package/dist/skill-tool-dispatch.runtime-CWLloYA8.js +0 -143
- package/dist/slash-state-DrrWJQfv.js +0 -2166
- package/dist/speech-D7DDpTYF.d.ts +0 -47
- package/dist/speech-core-CFgx31sH.d.ts +0 -36
- package/dist/speech-provider-8Hx1uw41.js +0 -184
- package/dist/speech-provider-BNqGEAL3.d.ts +0 -8
- package/dist/speech-provider-BQKXDpVB.d.ts +0 -5
- package/dist/speech-provider-BQV7Iy5m.d.ts +0 -8
- package/dist/speech-provider-BxF18GTv.d.ts +0 -5
- package/dist/speech-provider-DctLyCSW.d.ts +0 -34
- package/dist/speech-provider-DiOnRJQu.d.ts +0 -5
- package/dist/src-BbUYOPwU.js +0 -4256
- package/dist/startup-context-opAJAamX.js +0 -313
- package/dist/status-BzYEqfpS.js +0 -3
- package/dist/status-DEkjbQ1i.js +0 -4
- package/dist/status-all-Ms1tbq5v.js +0 -573
- package/dist/status-json-UE2-MKTi.js +0 -14
- package/dist/status-json-command-m7JqlonZ.js +0 -84
- package/dist/status-runtime-shared-ByKptq1l.js +0 -283
- package/dist/status-subagents.runtime-DSo7ZK_Z.js +0 -18
- package/dist/status-text-AyPuDzrO.js +0 -296
- package/dist/status.command-CkX3w3hv.js +0 -2
- package/dist/status.command-DH5UrKNz.js +0 -420
- package/dist/status.command.text-runtime-4UIQj9vb.js +0 -15
- package/dist/status.scan-BRv7Br3F.js +0 -68
- package/dist/status.scan-overview-BcD2pLMY.js +0 -444
- package/dist/status.scan.fast-json-2dm_6iq-.js +0 -127
- package/dist/status.scan.fast-json-BkkA55xn.js +0 -2
- package/dist/status.scan.runtime-Bfv4GvoC.js +0 -479
- package/dist/status.update-BQyHDWCY.js +0 -86
- package/dist/status.update-I3jq8Q9m.js +0 -2
- package/dist/sticker-cache-91Tp8mLP.js +0 -206
- package/dist/sticker-vision.runtime-DjleFXi5.js +0 -17
- package/dist/stream-BgoZFYSR.d.ts +0 -10
- package/dist/stream-CVCS62xd.d.ts +0 -16
- package/dist/stream-D-yXCV2T.d.ts +0 -19
- package/dist/stream-Dp6BlyCy.d.ts +0 -5
- package/dist/stream-rAWDYPyO.d.ts +0 -120
- package/dist/stream-wrappers-DaahQDS8.d.ts +0 -21
- package/dist/subagent-announce-delivery-DS_2W9oZ.js +0 -958
- package/dist/subagent-announce-hatA_PZ2.js +0 -354
- package/dist/subagent-control-IyFIvc7T.js +0 -508
- package/dist/subagent-hooks-BCj5eB0Z.js +0 -2
- package/dist/subagent-hooks-BWjTBkox.js +0 -146
- package/dist/subagent-hooks-CdGLK9_3.js +0 -230
- package/dist/subagent-hooks-EH0tBkw9.js +0 -2
- package/dist/subagent-hooks-api-BhYaXQJV.js +0 -23
- package/dist/subagent-hooks-api-uGsV8Xn5.js +0 -22
- package/dist/subagent-hooks-api-wfJFKIPx.js +0 -23
- package/dist/subagent-hooks-l8Xd94dt.js +0 -2
- package/dist/subagent-hooks-m2eHUO_d.js +0 -116
- package/dist/subagent-orphan-recovery-Bq9zvX3L.js +0 -352
- package/dist/subagent-registry-Bcb3zy6b.js +0 -3
- package/dist/subagent-registry-CoZNTFx-.js +0 -2351
- package/dist/subagent-session-cleanup--00EjDLe.js +0 -525
- package/dist/subagent-spawn-ClJJkz3D.js +0 -1164
- package/dist/target-id-BsZLiF3x.js +0 -107
- package/dist/targets-CQMe4AZP.js +0 -44
- package/dist/targets-SmL1AU-H.js +0 -19
- package/dist/targets-Y-roiA47.js +0 -19
- package/dist/targets-cQYDQD_B.d.ts +0 -10
- package/dist/targets-hzI6P-Zc.d.ts +0 -10
- package/dist/testing-B5hNJDuF.js +0 -267
- package/dist/text-report-xqi7wg86.js +0 -695
- package/dist/thinking-policy-BQykkMxE.d.ts +0 -5
- package/dist/thread-bindings-BD3eE0kK.js +0 -232
- package/dist/thread-bindings-C9NNiv8K.js +0 -571
- package/dist/thread-bindings-Dl4PN1vZ.js +0 -228
- package/dist/thread-bindings-uK1LLAwy.js +0 -8
- package/dist/thread-bindings.discord-api-BHNEUbnk.js +0 -187
- package/dist/thread-bindings.manager-B0LXiH3F.js +0 -2
- package/dist/thread-bindings.manager-BTlH4XMG.js +0 -536
- package/dist/thread-lifecycle-DG8uyPHd.js +0 -1614
- package/dist/token-BbGCANnE.js +0 -134
- package/dist/tool-actions.runtime-oUUrD8HB.js +0 -534
- package/dist/tool-bqg-_vYv.js +0 -139
- package/dist/tool-plugin-Cq5ot8y6.d.ts +0 -77
- package/dist/tool-resolution-CSZsa3kP.js +0 -149
- package/dist/tool-split-Bsnq7D3T.d.ts +0 -19
- package/dist/tools-effective-inventory-0CqFp-vq.js +0 -204
- package/dist/tools-invoke-http-DhYHY0Yh.js +0 -67
- package/dist/tools-invoke-shared-CbVJJUj7.js +0 -200
- package/dist/transport-stream-DvmDLTCM.d.ts +0 -42
- package/dist/tts-C2qD-ad6.js +0 -66
- package/dist/tui-CzGY254f.js +0 -4709
- package/dist/tui-backend-fzoeoSN0.js +0 -256
- package/dist/tui-cli-B2RWb2gM.js +0 -37
- package/dist/tui-dgS8hdXU.js +0 -2
- package/dist/types-CbiucfoZ.d.ts +0 -786
- package/dist/types-iT2EyaH92.d.ts +0 -3650
- package/dist/types.public-M7pcmtBD.d.ts +0 -70
- package/dist/update-check-Cv1EQVBi.js +0 -372
- package/dist/update-cli-BmiBDf3c.js +0 -3664
- package/dist/update-runner-CM7QVX6u.js +0 -2379
- package/dist/update-startup-Byh39VP6.js +0 -339
- package/dist/update-startup-DdWr4m3x.js +0 -2
- package/dist/video-generation-runtime-Dg40PwEa.d.ts +0 -21
- package/dist/video-model-catalog-D4Bq34K4.d.ts +0 -16
- package/dist/vision-tools-BzoBZnIc.js +0 -1409
- package/dist/web-search-DmfOd66S.js +0 -62
- package/dist/web-search-provider.runtime-3C5-pODD.js +0 -328
- package/dist/web-search-provider.runtime-Doh-Z9We.js +0 -2
- package/dist/webhook-targets-Cz7-0fFY.d.ts +0 -99
- package/dist/xai-oauth-BLvQ43hx.js +0 -479
- package/dist/xai-user-agent-BdMQ_0_O.js +0 -32
- /package/dist/{acp-runtime-backend-Cxo7eBHf.js → acp-runtime-backend-Cn6L41Tg.js} +0 -0
- /package/dist/{channel-actions-UDeVjgGz.js → channel-actions-8G0w3eC5.js} +0 -0
- /package/dist/{command-status-runtime-CoHd4Fws.js → command-status-runtime-DEkrRb2G.js} +0 -0
- /package/dist/{delegate-B-2xZ77o.js → delegate-CIrV5fYx.js} +0 -0
- /package/dist/{dispatch-acp-DLPkmK7K.js → dispatch-acp-DSCi-ptu.js} +0 -0
- /package/dist/{heartbeat-runner-D2j6JwOI.js → heartbeat-runner-D_Iq9CmQ.js} +0 -0
- /package/dist/{library-DBT0cIPP.js → library-DhnQegiK.js} +0 -0
- /package/dist/{run-executor.runtime-DE4J7f4M.js → run-executor.runtime-feFJuDlS.js} +0 -0
- /package/dist/{shared-xeo8Yh5n.js → shared-docD3l41.js} +0 -0
|
@@ -1,2351 +0,0 @@
|
|
|
1
|
-
import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DyL154ka.js";
|
|
2
|
-
import { c as readErrorName, i as formatErrorMessage } from "./errors-D_oyTIw2.js";
|
|
3
|
-
import { n as createLazyPromiseLoader, t as createLazyImportLoader } from "./lazy-promise-Djskx0qC.js";
|
|
4
|
-
import { d as resolveAgentIdFromSessionKey } from "./session-key-Bte0mmcq.js";
|
|
5
|
-
import { n as defaultRuntime } from "./runtime-E_A14BX_.js";
|
|
6
|
-
import { s as toSafeImportPath } from "./plugin-module-loader-cache-BmzxlqNo.js";
|
|
7
|
-
import { t as createSubsystemLogger } from "./subsystem-CppbuBPw.js";
|
|
8
|
-
import { i as getRuntimeConfig } from "./io-Ct2JqgbR.js";
|
|
9
|
-
import "./config-CLrwLpl0.js";
|
|
10
|
-
import { r as callGateway } from "./call-BFqofFc5.js";
|
|
11
|
-
import { t as getGlobalHookRunner } from "./hook-runner-global-RR7B_IHd.js";
|
|
12
|
-
import { c as getAgentRunContext, l as onAgentEvent } from "./agent-events-Cfj53GyA.js";
|
|
13
|
-
import { o as normalizeDeliveryContext } from "./delivery-context.shared-XybGGRNt.js";
|
|
14
|
-
import { u as resolveStorePath } from "./paths-8MFrTNIB.js";
|
|
15
|
-
import { c as registerSessionMaintenancePreserveKeysProvider, t as loadSessionStore } from "./store-load-B817r-3Z.js";
|
|
16
|
-
import { u as updateSessionStore } from "./store-C4uyNaPD.js";
|
|
17
|
-
import "./sessions-4ZNlAnYc.js";
|
|
18
|
-
import { n as resolveRequiredCompletionTerminalResult, r as resolveAgentTimeoutMs, t as resolveRequiredCompletionDeliveryFailureTerminalResult } from "./task-completion-contract-D5t-_eBh.js";
|
|
19
|
-
import { n as extractTextFromChatContent } from "./chat-content-BNTcXm1Z.js";
|
|
20
|
-
import { a as failTaskRunByRunId, i as createRunningTaskRun, l as setDetachedTaskDeliveryStatusByRunId, n as completeTaskRunByRunId } from "./detached-task-runtime-B8jNifvc.js";
|
|
21
|
-
import { a as isSilentReplyText } from "./tokens-D8MVQSp9.js";
|
|
22
|
-
import { A as SUBAGENT_ENDED_REASON_KILLED, C as getSubagentSessionStartedAt, D as SUBAGENT_ENDED_OUTCOME_TIMEOUT, E as SUBAGENT_ENDED_OUTCOME_KILLED, M as subagentRuns, O as SUBAGENT_ENDED_REASON_COMPLETE, S as getSubagentSessionRuntimeMs, T as SUBAGENT_ENDED_OUTCOME_ERROR, b as isStaleUnendedSubagentRun, f as listDescendantRunsForRequesterFromRuns, i as restoreSubagentRunsFromDisk, j as SUBAGENT_TARGET_KIND_SUBAGENT, k as SUBAGENT_ENDED_REASON_ERROR, l as countPendingDescendantRunsFromRuns, n as persistSubagentRunsToDisk, o as countActiveDescendantRunsFromRuns, p as listRunsForControllerFromRuns, r as persistSubagentRunsToDiskOrThrow, s as countActiveRunsForSessionFromRuns, t as getSubagentRunsSnapshotForRead, u as getSubagentRunByChildSessionKeyFromRuns, w as resolveSubagentSessionStatus } from "./subagent-registry-state-IRjqqsbj.js";
|
|
23
|
-
import { c as retireSessionMcpRuntimeForSessionKey } from "./pi-bundle-mcp-runtime-DjzUKrET.js";
|
|
24
|
-
import "./pi-bundle-mcp-tools-CC14PQe1.js";
|
|
25
|
-
import { i as waitForAgentRun, l as formatBlockedLivenessError, t as isRecoverableAgentWaitError, u as isBlockedLivenessState } from "./run-wait-Ba5wh82_.js";
|
|
26
|
-
import { d as withSubagentOutcomeTiming, t as deleteSubagentSessionForCleanup } from "./subagent-session-cleanup--00EjDLe.js";
|
|
27
|
-
import { t as emitSessionLifecycleEvent } from "./session-lifecycle-events-CrY3-yco.js";
|
|
28
|
-
import { n as buildAnnounceIdempotencyKey, t as buildAnnounceIdFromChildRun } from "./announce-idempotency-DV6_8Blm.js";
|
|
29
|
-
import { t as configureSubagentRegistrySteerRuntime } from "./subagent-registry-steer-runtime-9Vso0zzU.js";
|
|
30
|
-
import fs, { promises } from "node:fs";
|
|
31
|
-
import path from "node:path";
|
|
32
|
-
//#region src/shared/runtime-import.ts
|
|
33
|
-
function resolveRuntimeImportSpecifier(baseUrl, parts) {
|
|
34
|
-
const joined = parts.join("");
|
|
35
|
-
const safeJoined = toSafeImportPath(joined);
|
|
36
|
-
if (safeJoined !== joined) return safeJoined;
|
|
37
|
-
return new URL(joined, toSafeImportPath(baseUrl)).href;
|
|
38
|
-
}
|
|
39
|
-
async function importRuntimeModule(baseUrl, parts, importModule = (specifier) => import(specifier)) {
|
|
40
|
-
return await importModule(resolveRuntimeImportSpecifier(baseUrl, parts));
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/agents/subagent-registry-completion.ts
|
|
44
|
-
function runOutcomesEqual(a, b) {
|
|
45
|
-
if (!a && !b) return true;
|
|
46
|
-
if (!a || !b) return false;
|
|
47
|
-
if (a.status !== b.status) return false;
|
|
48
|
-
if (a.status === "error" && b.status === "error") {
|
|
49
|
-
if ((a.error ?? "") !== (b.error ?? "")) return false;
|
|
50
|
-
}
|
|
51
|
-
if (!runOutcomeHasTiming(a) || !runOutcomeHasTiming(b)) return true;
|
|
52
|
-
return a.startedAt === b.startedAt && a.endedAt === b.endedAt && a.elapsedMs === b.elapsedMs;
|
|
53
|
-
}
|
|
54
|
-
function runOutcomeHasTiming(outcome) {
|
|
55
|
-
return Number.isFinite(outcome?.startedAt) || Number.isFinite(outcome?.endedAt) || Number.isFinite(outcome?.elapsedMs);
|
|
56
|
-
}
|
|
57
|
-
function shouldUpdateRunOutcome(current, next) {
|
|
58
|
-
return !runOutcomesEqual(current, next) || !runOutcomeHasTiming(current) && runOutcomeHasTiming(next);
|
|
59
|
-
}
|
|
60
|
-
function resolveLifecycleOutcomeFromRunOutcome(outcome) {
|
|
61
|
-
if (outcome?.status === "error") return SUBAGENT_ENDED_OUTCOME_ERROR;
|
|
62
|
-
if (outcome?.status === "timeout") return SUBAGENT_ENDED_OUTCOME_TIMEOUT;
|
|
63
|
-
return "ok";
|
|
64
|
-
}
|
|
65
|
-
async function emitSubagentEndedHookOnce(params) {
|
|
66
|
-
const runId = params.entry.runId.trim();
|
|
67
|
-
if (!runId) return false;
|
|
68
|
-
if (params.entry.endedHookEmittedAt) return false;
|
|
69
|
-
if (params.inFlightRunIds.has(runId)) return false;
|
|
70
|
-
params.inFlightRunIds.add(runId);
|
|
71
|
-
try {
|
|
72
|
-
const hookRunner = getGlobalHookRunner();
|
|
73
|
-
if (!hookRunner) return false;
|
|
74
|
-
if (hookRunner?.hasHooks("subagent_ended")) await hookRunner.runSubagentEnded({
|
|
75
|
-
targetSessionKey: params.entry.childSessionKey,
|
|
76
|
-
targetKind: SUBAGENT_TARGET_KIND_SUBAGENT,
|
|
77
|
-
reason: params.reason,
|
|
78
|
-
sendFarewell: params.sendFarewell,
|
|
79
|
-
accountId: params.accountId,
|
|
80
|
-
runId: params.entry.runId,
|
|
81
|
-
endedAt: params.entry.endedAt,
|
|
82
|
-
outcome: params.outcome,
|
|
83
|
-
error: params.error
|
|
84
|
-
}, {
|
|
85
|
-
runId: params.entry.runId,
|
|
86
|
-
childSessionKey: params.entry.childSessionKey,
|
|
87
|
-
requesterSessionKey: params.entry.requesterSessionKey
|
|
88
|
-
});
|
|
89
|
-
params.entry.endedHookEmittedAt = Date.now();
|
|
90
|
-
params.persist();
|
|
91
|
-
return true;
|
|
92
|
-
} catch {
|
|
93
|
-
return false;
|
|
94
|
-
} finally {
|
|
95
|
-
params.inFlightRunIds.delete(runId);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/agents/subagent-registry-helpers.ts
|
|
100
|
-
const MIN_ANNOUNCE_RETRY_DELAY_MS = 1e3;
|
|
101
|
-
const MAX_ANNOUNCE_RETRY_DELAY_MS = 8e3;
|
|
102
|
-
const ANNOUNCE_EXPIRY_MS = 5 * 6e4;
|
|
103
|
-
const ANNOUNCE_COMPLETION_HARD_EXPIRY_MS = 30 * 6e4;
|
|
104
|
-
const FROZEN_RESULT_TEXT_MAX_BYTES = 100 * 1024;
|
|
105
|
-
function capFrozenResultText(resultText) {
|
|
106
|
-
const trimmed = resultText.trim();
|
|
107
|
-
if (!trimmed) return "";
|
|
108
|
-
const totalBytes = Buffer.byteLength(trimmed, "utf8");
|
|
109
|
-
if (totalBytes <= FROZEN_RESULT_TEXT_MAX_BYTES) return trimmed;
|
|
110
|
-
const notice = `\n\n[truncated: frozen completion output exceeded ${Math.round(FROZEN_RESULT_TEXT_MAX_BYTES / 1024)}KB (${Math.round(totalBytes / 1024)}KB)]`;
|
|
111
|
-
const maxPayloadBytes = Math.max(0, FROZEN_RESULT_TEXT_MAX_BYTES - Buffer.byteLength(notice, "utf8"));
|
|
112
|
-
return `${Buffer.from(trimmed, "utf8").subarray(0, maxPayloadBytes).toString("utf8")}${notice}`;
|
|
113
|
-
}
|
|
114
|
-
function resolveAnnounceRetryDelayMs(retryCount) {
|
|
115
|
-
const baseDelay = MIN_ANNOUNCE_RETRY_DELAY_MS * 2 ** Math.max(0, Math.max(0, Math.min(retryCount, 10)) - 1);
|
|
116
|
-
return Math.min(baseDelay, MAX_ANNOUNCE_RETRY_DELAY_MS);
|
|
117
|
-
}
|
|
118
|
-
function formatAnnounceGiveUpLogField(value) {
|
|
119
|
-
const normalized = value.replace(/\s+/g, " ").trim();
|
|
120
|
-
return JSON.stringify(normalized.length > 2e3 ? `${normalized.slice(0, 2e3)}…` : normalized);
|
|
121
|
-
}
|
|
122
|
-
function logAnnounceGiveUp(entry, reason) {
|
|
123
|
-
const retryCount = entry.announceRetryCount ?? 0;
|
|
124
|
-
const endedAgoMs = typeof entry.endedAt === "number" ? Math.max(0, Date.now() - entry.endedAt) : void 0;
|
|
125
|
-
const endedAgoLabel = endedAgoMs != null ? `${Math.round(endedAgoMs / 1e3)}s` : "n/a";
|
|
126
|
-
const deliveryError = entry.lastAnnounceDeliveryError?.trim() ? ` deliveryError=${formatAnnounceGiveUpLogField(entry.lastAnnounceDeliveryError)}` : "";
|
|
127
|
-
defaultRuntime.log(`[warn] Subagent announce give up (${reason}) run=${entry.runId} child=${entry.childSessionKey} requester=${entry.requesterSessionKey} retries=${retryCount} endedAgo=${endedAgoLabel}${deliveryError}`);
|
|
128
|
-
}
|
|
129
|
-
function findSessionEntryByKey$1(store, sessionKey) {
|
|
130
|
-
const direct = store[sessionKey];
|
|
131
|
-
if (direct) return direct;
|
|
132
|
-
const normalized = normalizeLowercaseStringOrEmpty(sessionKey);
|
|
133
|
-
for (const [key, entry] of Object.entries(store)) if (normalizeLowercaseStringOrEmpty(key) === normalized) return entry;
|
|
134
|
-
}
|
|
135
|
-
async function persistSubagentSessionTiming(entry) {
|
|
136
|
-
const childSessionKey = entry.childSessionKey?.trim();
|
|
137
|
-
if (!childSessionKey) return;
|
|
138
|
-
const cfg = getRuntimeConfig();
|
|
139
|
-
const agentId = resolveAgentIdFromSessionKey(childSessionKey);
|
|
140
|
-
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
141
|
-
const startedAt = getSubagentSessionStartedAt(entry);
|
|
142
|
-
const endedAt = typeof entry.endedAt === "number" && Number.isFinite(entry.endedAt) ? entry.endedAt : void 0;
|
|
143
|
-
const runtimeMs = endedAt !== void 0 ? getSubagentSessionRuntimeMs(entry, endedAt) : getSubagentSessionRuntimeMs(entry);
|
|
144
|
-
const status = resolveSubagentSessionStatus(entry);
|
|
145
|
-
await updateSessionStore(storePath, (store) => {
|
|
146
|
-
const sessionEntry = findSessionEntryByKey$1(store, childSessionKey);
|
|
147
|
-
if (!sessionEntry) return;
|
|
148
|
-
if (typeof startedAt === "number" && Number.isFinite(startedAt)) sessionEntry.startedAt = startedAt;
|
|
149
|
-
else delete sessionEntry.startedAt;
|
|
150
|
-
if (typeof endedAt === "number" && Number.isFinite(endedAt)) sessionEntry.endedAt = endedAt;
|
|
151
|
-
else delete sessionEntry.endedAt;
|
|
152
|
-
if (typeof runtimeMs === "number" && Number.isFinite(runtimeMs)) sessionEntry.runtimeMs = runtimeMs;
|
|
153
|
-
else delete sessionEntry.runtimeMs;
|
|
154
|
-
if (status) sessionEntry.status = status;
|
|
155
|
-
else delete sessionEntry.status;
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
function resolveSubagentRunOrphanReason(params) {
|
|
159
|
-
const childSessionKey = params.entry.childSessionKey?.trim();
|
|
160
|
-
if (!childSessionKey) return "missing-session-entry";
|
|
161
|
-
try {
|
|
162
|
-
const cfg = getRuntimeConfig();
|
|
163
|
-
const agentId = resolveAgentIdFromSessionKey(childSessionKey);
|
|
164
|
-
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
165
|
-
let store = params.storeCache?.get(storePath);
|
|
166
|
-
if (!store) {
|
|
167
|
-
store = loadSessionStore(storePath);
|
|
168
|
-
params.storeCache?.set(storePath, store);
|
|
169
|
-
}
|
|
170
|
-
const sessionEntry = findSessionEntryByKey$1(store, childSessionKey);
|
|
171
|
-
if (!sessionEntry) return "missing-session-entry";
|
|
172
|
-
if (typeof sessionEntry.sessionId !== "string" || !sessionEntry.sessionId.trim()) return "missing-session-id";
|
|
173
|
-
if (params.includeStaleUnended === true && sessionEntry.abortedLastRun !== true && isStaleUnendedSubagentRun(params.entry, params.now)) return "stale-unended-run";
|
|
174
|
-
return null;
|
|
175
|
-
} catch {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function isResolvedChildPath(params) {
|
|
180
|
-
const rootWithSep = params.rootPath.endsWith(path.sep) ? params.rootPath : `${params.rootPath}${path.sep}`;
|
|
181
|
-
return params.childPath.startsWith(rootWithSep);
|
|
182
|
-
}
|
|
183
|
-
async function safeRemoveAttachmentsDir(entry) {
|
|
184
|
-
if (!entry.attachmentsDir || !entry.attachmentsRootDir) return;
|
|
185
|
-
const resolveReal = async (targetPath) => {
|
|
186
|
-
try {
|
|
187
|
-
return await promises.realpath(targetPath);
|
|
188
|
-
} catch (err) {
|
|
189
|
-
if (err?.code === "ENOENT") return null;
|
|
190
|
-
throw err;
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
try {
|
|
194
|
-
const [rootReal, dirReal] = await Promise.all([resolveReal(entry.attachmentsRootDir), resolveReal(entry.attachmentsDir)]);
|
|
195
|
-
if (!dirReal) return;
|
|
196
|
-
const rootBase = rootReal ?? path.resolve(entry.attachmentsRootDir);
|
|
197
|
-
const dirBase = dirReal;
|
|
198
|
-
if (!isResolvedChildPath({
|
|
199
|
-
childPath: dirBase,
|
|
200
|
-
rootPath: rootBase
|
|
201
|
-
})) return;
|
|
202
|
-
await promises.rm(dirBase, {
|
|
203
|
-
recursive: true,
|
|
204
|
-
force: true
|
|
205
|
-
});
|
|
206
|
-
} catch {}
|
|
207
|
-
}
|
|
208
|
-
function safeRemoveAttachmentsDirSync(entry) {
|
|
209
|
-
if (!entry.attachmentsDir || !entry.attachmentsRootDir) return;
|
|
210
|
-
const resolveReal = (targetPath) => {
|
|
211
|
-
try {
|
|
212
|
-
return fs.realpathSync.native(targetPath);
|
|
213
|
-
} catch (err) {
|
|
214
|
-
if (err?.code === "ENOENT") return null;
|
|
215
|
-
throw err;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
try {
|
|
219
|
-
const rootReal = resolveReal(entry.attachmentsRootDir);
|
|
220
|
-
const dirReal = resolveReal(entry.attachmentsDir);
|
|
221
|
-
if (!dirReal) return;
|
|
222
|
-
if (!isResolvedChildPath({
|
|
223
|
-
childPath: dirReal,
|
|
224
|
-
rootPath: rootReal ?? path.resolve(entry.attachmentsRootDir)
|
|
225
|
-
})) return;
|
|
226
|
-
fs.rmSync(dirReal, {
|
|
227
|
-
recursive: true,
|
|
228
|
-
force: true
|
|
229
|
-
});
|
|
230
|
-
} catch {}
|
|
231
|
-
}
|
|
232
|
-
function reconcileOrphanedRun(params) {
|
|
233
|
-
const now = Date.now();
|
|
234
|
-
let changed = false;
|
|
235
|
-
if (typeof params.entry.endedAt !== "number") {
|
|
236
|
-
params.entry.endedAt = now;
|
|
237
|
-
changed = true;
|
|
238
|
-
}
|
|
239
|
-
const orphanOutcome = withSubagentOutcomeTiming({
|
|
240
|
-
status: "error",
|
|
241
|
-
error: `orphaned subagent run (${params.reason})`
|
|
242
|
-
}, {
|
|
243
|
-
startedAt: params.entry.startedAt,
|
|
244
|
-
endedAt: params.entry.endedAt
|
|
245
|
-
});
|
|
246
|
-
if (shouldUpdateRunOutcome(params.entry.outcome, orphanOutcome)) {
|
|
247
|
-
params.entry.outcome = orphanOutcome;
|
|
248
|
-
changed = true;
|
|
249
|
-
}
|
|
250
|
-
if (params.entry.endedReason !== "subagent-error") {
|
|
251
|
-
params.entry.endedReason = SUBAGENT_ENDED_REASON_ERROR;
|
|
252
|
-
changed = true;
|
|
253
|
-
}
|
|
254
|
-
if (params.entry.cleanupHandled !== true) {
|
|
255
|
-
params.entry.cleanupHandled = true;
|
|
256
|
-
changed = true;
|
|
257
|
-
}
|
|
258
|
-
if (typeof params.entry.cleanupCompletedAt !== "number") {
|
|
259
|
-
params.entry.cleanupCompletedAt = now;
|
|
260
|
-
changed = true;
|
|
261
|
-
}
|
|
262
|
-
if (params.entry.cleanup === "delete" || !params.entry.retainAttachmentsOnKeep) safeRemoveAttachmentsDirSync(params.entry);
|
|
263
|
-
const removed = params.runs.delete(params.runId);
|
|
264
|
-
params.resumedRuns.delete(params.runId);
|
|
265
|
-
if (!removed && !changed) return false;
|
|
266
|
-
defaultRuntime.log(`[warn] Subagent orphan run pruned source=${params.source} run=${params.runId} child=${params.entry.childSessionKey} reason=${params.reason}`);
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
function reconcileOrphanedRestoredRuns(params) {
|
|
270
|
-
const storeCache = /* @__PURE__ */ new Map();
|
|
271
|
-
const now = Date.now();
|
|
272
|
-
let changed = false;
|
|
273
|
-
for (const [runId, entry] of params.runs.entries()) {
|
|
274
|
-
const orphanReason = resolveSubagentRunOrphanReason({
|
|
275
|
-
entry,
|
|
276
|
-
storeCache,
|
|
277
|
-
includeStaleUnended: true,
|
|
278
|
-
now
|
|
279
|
-
});
|
|
280
|
-
if (!orphanReason) continue;
|
|
281
|
-
if (reconcileOrphanedRun({
|
|
282
|
-
runId,
|
|
283
|
-
entry,
|
|
284
|
-
reason: orphanReason,
|
|
285
|
-
source: "restore",
|
|
286
|
-
runs: params.runs,
|
|
287
|
-
resumedRuns: params.resumedRuns
|
|
288
|
-
})) changed = true;
|
|
289
|
-
}
|
|
290
|
-
return changed;
|
|
291
|
-
}
|
|
292
|
-
function resolveArchiveAfterMs(cfg) {
|
|
293
|
-
const minutes = (cfg ?? getRuntimeConfig()).agents?.defaults?.subagents?.archiveAfterMinutes ?? 60;
|
|
294
|
-
if (!Number.isFinite(minutes) || minutes < 0) return;
|
|
295
|
-
if (minutes === 0) return;
|
|
296
|
-
return Math.max(1, Math.floor(minutes)) * 6e4;
|
|
297
|
-
}
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region src/agents/subagent-registry-cleanup.ts
|
|
300
|
-
function resolveCleanupCompletionReason(entry) {
|
|
301
|
-
return entry.endedReason ?? "subagent-complete";
|
|
302
|
-
}
|
|
303
|
-
function resolveEndedAgoMs(entry, now) {
|
|
304
|
-
return typeof entry.endedAt === "number" ? now - entry.endedAt : 0;
|
|
305
|
-
}
|
|
306
|
-
function resolveDeferredCleanupDecision(params) {
|
|
307
|
-
const endedAgo = resolveEndedAgoMs(params.entry, params.now);
|
|
308
|
-
const isCompletionMessageFlow = params.entry.expectsCompletionMessage === true;
|
|
309
|
-
const completionHardExpiryExceeded = isCompletionMessageFlow && endedAgo > params.announceCompletionHardExpiryMs;
|
|
310
|
-
if (isCompletionMessageFlow && params.activeDescendantRuns > 0) {
|
|
311
|
-
if (completionHardExpiryExceeded) return {
|
|
312
|
-
kind: "give-up",
|
|
313
|
-
reason: "expiry"
|
|
314
|
-
};
|
|
315
|
-
return {
|
|
316
|
-
kind: "defer-descendants",
|
|
317
|
-
delayMs: params.deferDescendantDelayMs
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
const retryCount = (params.entry.announceRetryCount ?? 0) + 1;
|
|
321
|
-
const expiryExceeded = isCompletionMessageFlow ? completionHardExpiryExceeded : endedAgo > params.announceExpiryMs;
|
|
322
|
-
if (retryCount >= params.maxAnnounceRetryCount || expiryExceeded) return {
|
|
323
|
-
kind: "give-up",
|
|
324
|
-
reason: retryCount >= params.maxAnnounceRetryCount ? "retry-limit" : "expiry",
|
|
325
|
-
retryCount
|
|
326
|
-
};
|
|
327
|
-
return {
|
|
328
|
-
kind: "retry",
|
|
329
|
-
retryCount,
|
|
330
|
-
resumeDelayMs: params.resolveAnnounceRetryDelayMs(retryCount)
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
//#endregion
|
|
334
|
-
//#region src/agents/subagent-registry-lifecycle.ts
|
|
335
|
-
const DELIVERY_MIRROR_HISTORY_MAX_CHARS = 128 * 1024;
|
|
336
|
-
const browserCleanupLoader$1 = createLazyImportLoader(() => import("./browser-lifecycle-cleanup-C9X09Vrg.js"));
|
|
337
|
-
async function loadCleanupBrowserSessionsForLifecycleEnd$1() {
|
|
338
|
-
return (await browserCleanupLoader$1.load()).cleanupBrowserSessionsForLifecycleEnd;
|
|
339
|
-
}
|
|
340
|
-
function createSubagentRegistryLifecycleController(params) {
|
|
341
|
-
const scheduledResumeTimers = /* @__PURE__ */ new Set();
|
|
342
|
-
const scheduleResumeSubagentRun = (runId, entry, delayMs) => {
|
|
343
|
-
const timer = setTimeout(() => {
|
|
344
|
-
scheduledResumeTimers.delete(timer);
|
|
345
|
-
if (params.runs.get(runId) !== entry) return;
|
|
346
|
-
params.resumeSubagentRun(runId);
|
|
347
|
-
}, delayMs);
|
|
348
|
-
timer.unref?.();
|
|
349
|
-
scheduledResumeTimers.add(timer);
|
|
350
|
-
};
|
|
351
|
-
const clearScheduledResumeTimers = () => {
|
|
352
|
-
for (const timer of scheduledResumeTimers) clearTimeout(timer);
|
|
353
|
-
scheduledResumeTimers.clear();
|
|
354
|
-
};
|
|
355
|
-
const maskRunId = (runId) => {
|
|
356
|
-
const trimmed = runId.trim();
|
|
357
|
-
if (!trimmed) return "unknown";
|
|
358
|
-
if (trimmed.length <= 8) return "***";
|
|
359
|
-
return `${trimmed.slice(0, 4)}…${trimmed.slice(-4)}`;
|
|
360
|
-
};
|
|
361
|
-
const maskSessionKey = (sessionKey) => {
|
|
362
|
-
const trimmed = sessionKey.trim();
|
|
363
|
-
if (!trimmed) return "unknown";
|
|
364
|
-
return `${trimmed.split(":").slice(0, 2).join(":") || "session"}:…`;
|
|
365
|
-
};
|
|
366
|
-
const buildSafeLifecycleErrorMeta = (err) => {
|
|
367
|
-
const message = formatErrorMessage(err);
|
|
368
|
-
const name = readErrorName(err);
|
|
369
|
-
return name ? {
|
|
370
|
-
name,
|
|
371
|
-
message
|
|
372
|
-
} : { message };
|
|
373
|
-
};
|
|
374
|
-
const formatAnnounceDeliveryError = (delivery) => {
|
|
375
|
-
const errors = [delivery.error, ...(delivery.phases ?? []).map((phase) => phase.error ? `${phase.phase}: ${phase.error}` : void 0)].map((value) => value?.trim()).filter((value) => Boolean(value));
|
|
376
|
-
return errors.length > 0 ? [...new Set(errors)].join("; ") : `delivery path ${delivery.path} did not complete`;
|
|
377
|
-
};
|
|
378
|
-
const recordAnnounceDeliveryResult = (entry, delivery) => {
|
|
379
|
-
if (typeof delivery.enqueuedAt === "number") entry.completionEnqueuedAt ??= delivery.enqueuedAt;
|
|
380
|
-
if (delivery.delivered) {
|
|
381
|
-
entry.completionDeliveredAt = typeof delivery.deliveredAt === "number" ? delivery.deliveredAt : Date.now();
|
|
382
|
-
entry.lastAnnounceDropReason = void 0;
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
const hasPriorRequesterDeliveryMirror = async (entry) => {
|
|
386
|
-
const expectedText = extractTextFromChatContent(entry.frozenResultText, { joinWith: "" });
|
|
387
|
-
if (entry.expectsCompletionMessage !== true || expectedText == null) return false;
|
|
388
|
-
const mirrorNotBefore = entry.startedAt ?? entry.createdAt;
|
|
389
|
-
const mirrorNotAfter = Date.now() + 3e4;
|
|
390
|
-
const expectedIdempotencyKey = buildAnnounceIdempotencyKey(buildAnnounceIdFromChildRun({
|
|
391
|
-
childSessionKey: entry.childSessionKey,
|
|
392
|
-
childRunId: entry.runId
|
|
393
|
-
}));
|
|
394
|
-
const isExpectedMirrorIdempotencyKey = (value) => typeof value === "string" && (value === expectedIdempotencyKey || value.startsWith(`${expectedIdempotencyKey}:internal-source-reply:`) || value.startsWith(`${expectedIdempotencyKey}:message-tool:internal-source-reply:`) || value.startsWith(`${entry.runId}:message-tool:`) || value.startsWith(`${entry.runId}:internal-source-reply:`));
|
|
395
|
-
try {
|
|
396
|
-
const mirror = (await params.callGateway({
|
|
397
|
-
method: "chat.history",
|
|
398
|
-
params: {
|
|
399
|
-
sessionKey: entry.requesterSessionKey,
|
|
400
|
-
limit: 25,
|
|
401
|
-
maxChars: DELIVERY_MIRROR_HISTORY_MAX_CHARS
|
|
402
|
-
},
|
|
403
|
-
timeoutMs: 5e3
|
|
404
|
-
})).messages?.find((message) => {
|
|
405
|
-
if (!message || typeof message !== "object") return false;
|
|
406
|
-
const record = message;
|
|
407
|
-
const timestamp = record.timestamp;
|
|
408
|
-
if (typeof timestamp !== "number" || !Number.isFinite(timestamp) || timestamp < mirrorNotBefore || timestamp > mirrorNotAfter || !isExpectedMirrorIdempotencyKey(record.idempotencyKey)) return false;
|
|
409
|
-
const text = extractTextFromChatContent(record.content, { joinWith: "" });
|
|
410
|
-
return record.role === "assistant" && record.provider === "daocore" && record.model === "delivery-mirror" && text === expectedText;
|
|
411
|
-
});
|
|
412
|
-
if (mirror) entry.completionDeliveredAt = mirror.timestamp;
|
|
413
|
-
return Boolean(mirror);
|
|
414
|
-
} catch {
|
|
415
|
-
return false;
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
const safeSetSubagentTaskDeliveryStatus = (args) => {
|
|
419
|
-
try {
|
|
420
|
-
setDetachedTaskDeliveryStatusByRunId({
|
|
421
|
-
runId: args.runId,
|
|
422
|
-
runtime: "subagent",
|
|
423
|
-
sessionKey: args.childSessionKey,
|
|
424
|
-
deliveryStatus: args.deliveryStatus,
|
|
425
|
-
error: args.deliveryStatus === "failed" ? args.deliveryError : void 0
|
|
426
|
-
});
|
|
427
|
-
} catch (err) {
|
|
428
|
-
params.warn("failed to update subagent background task delivery state", {
|
|
429
|
-
error: buildSafeLifecycleErrorMeta(err),
|
|
430
|
-
runId: maskRunId(args.runId),
|
|
431
|
-
childSessionKey: maskSessionKey(args.childSessionKey),
|
|
432
|
-
deliveryStatus: args.deliveryStatus
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
const safeFinalizeSubagentTaskRun = (args) => {
|
|
437
|
-
const endedAt = args.entry.endedAt ?? Date.now();
|
|
438
|
-
const lastEventAt = endedAt;
|
|
439
|
-
try {
|
|
440
|
-
if (args.outcome.status === "ok") {
|
|
441
|
-
const terminalResult = args.entry.expectsCompletionMessage === true ? resolveRequiredCompletionTerminalResult(args.entry.frozenResultText) : {};
|
|
442
|
-
completeTaskRunByRunId({
|
|
443
|
-
runId: args.entry.runId,
|
|
444
|
-
runtime: "subagent",
|
|
445
|
-
sessionKey: args.entry.childSessionKey,
|
|
446
|
-
endedAt,
|
|
447
|
-
lastEventAt,
|
|
448
|
-
progressSummary: args.entry.frozenResultText ?? void 0,
|
|
449
|
-
terminalSummary: terminalResult.terminalSummary ?? null,
|
|
450
|
-
terminalOutcome: terminalResult.terminalOutcome
|
|
451
|
-
});
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
failTaskRunByRunId({
|
|
455
|
-
runId: args.entry.runId,
|
|
456
|
-
runtime: "subagent",
|
|
457
|
-
sessionKey: args.entry.childSessionKey,
|
|
458
|
-
status: args.outcome.status === "timeout" ? "timed_out" : "failed",
|
|
459
|
-
endedAt,
|
|
460
|
-
lastEventAt,
|
|
461
|
-
error: args.outcome.status === "error" ? args.outcome.error : void 0,
|
|
462
|
-
progressSummary: args.entry.frozenResultText ?? void 0,
|
|
463
|
-
terminalSummary: null
|
|
464
|
-
});
|
|
465
|
-
} catch (err) {
|
|
466
|
-
params.warn("failed to finalize subagent background task state", {
|
|
467
|
-
error: buildSafeLifecycleErrorMeta(err),
|
|
468
|
-
runId: maskRunId(args.entry.runId),
|
|
469
|
-
childSessionKey: maskSessionKey(args.entry.childSessionKey),
|
|
470
|
-
outcomeStatus: args.outcome.status
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
const safeMarkRequiredCompletionDeliveryBlocked = (args) => {
|
|
475
|
-
if (args.entry.expectsCompletionMessage !== true || args.entry.outcome?.status !== "ok") return;
|
|
476
|
-
const endedAt = args.entry.endedAt ?? Date.now();
|
|
477
|
-
const terminalResult = resolveRequiredCompletionDeliveryFailureTerminalResult(args.reason);
|
|
478
|
-
try {
|
|
479
|
-
completeTaskRunByRunId({
|
|
480
|
-
runId: args.entry.runId,
|
|
481
|
-
runtime: "subagent",
|
|
482
|
-
sessionKey: args.entry.childSessionKey,
|
|
483
|
-
endedAt,
|
|
484
|
-
lastEventAt: Date.now(),
|
|
485
|
-
progressSummary: args.entry.frozenResultText ?? void 0,
|
|
486
|
-
terminalSummary: terminalResult.terminalSummary,
|
|
487
|
-
terminalOutcome: terminalResult.terminalOutcome
|
|
488
|
-
});
|
|
489
|
-
} catch (err) {
|
|
490
|
-
params.warn("failed to mark subagent completion delivery blocked", {
|
|
491
|
-
error: buildSafeLifecycleErrorMeta(err),
|
|
492
|
-
runId: maskRunId(args.entry.runId),
|
|
493
|
-
childSessionKey: maskSessionKey(args.entry.childSessionKey)
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
const freezeRunResultAtCompletion = async (entry, outcome) => {
|
|
498
|
-
if (entry.frozenResultText !== void 0) return false;
|
|
499
|
-
if (outcome.status === "error") {
|
|
500
|
-
entry.frozenResultText = null;
|
|
501
|
-
entry.frozenResultCapturedAt = Date.now();
|
|
502
|
-
return true;
|
|
503
|
-
}
|
|
504
|
-
try {
|
|
505
|
-
const captured = await params.captureSubagentCompletionReply(entry.childSessionKey, {
|
|
506
|
-
waitForReply: entry.expectsCompletionMessage === true,
|
|
507
|
-
outcome
|
|
508
|
-
});
|
|
509
|
-
entry.frozenResultText = captured?.trim() ? capFrozenResultText(captured) : null;
|
|
510
|
-
} catch {
|
|
511
|
-
entry.frozenResultText = null;
|
|
512
|
-
}
|
|
513
|
-
entry.frozenResultCapturedAt = Date.now();
|
|
514
|
-
return true;
|
|
515
|
-
};
|
|
516
|
-
const listPendingCompletionRunsForSession = (sessionKey) => {
|
|
517
|
-
const key = sessionKey.trim();
|
|
518
|
-
if (!key) return [];
|
|
519
|
-
const out = [];
|
|
520
|
-
for (const entry of params.runs.values()) {
|
|
521
|
-
if (entry.childSessionKey !== key) continue;
|
|
522
|
-
if (entry.expectsCompletionMessage !== true) continue;
|
|
523
|
-
if (typeof entry.endedAt !== "number") continue;
|
|
524
|
-
if (typeof entry.cleanupCompletedAt === "number") continue;
|
|
525
|
-
out.push(entry);
|
|
526
|
-
}
|
|
527
|
-
return out;
|
|
528
|
-
};
|
|
529
|
-
const refreshFrozenResultFromSession = async (sessionKey) => {
|
|
530
|
-
const candidates = listPendingCompletionRunsForSession(sessionKey).filter((entry) => entry.outcome?.status !== "error");
|
|
531
|
-
if (candidates.length === 0) return false;
|
|
532
|
-
let captured;
|
|
533
|
-
try {
|
|
534
|
-
captured = await params.captureSubagentCompletionReply(sessionKey);
|
|
535
|
-
} catch {
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
const trimmed = captured?.trim();
|
|
539
|
-
if (!trimmed || isSilentReplyText(trimmed, "NO_REPLY")) return false;
|
|
540
|
-
const nextFrozen = capFrozenResultText(trimmed);
|
|
541
|
-
const capturedAt = Date.now();
|
|
542
|
-
let changed = false;
|
|
543
|
-
for (const entry of candidates) {
|
|
544
|
-
if (entry.frozenResultText === nextFrozen) continue;
|
|
545
|
-
entry.frozenResultText = nextFrozen;
|
|
546
|
-
entry.frozenResultCapturedAt = capturedAt;
|
|
547
|
-
if (entry.pendingFinalDeliveryPayload) entry.pendingFinalDeliveryPayload = {
|
|
548
|
-
...entry.pendingFinalDeliveryPayload,
|
|
549
|
-
frozenResultText: nextFrozen
|
|
550
|
-
};
|
|
551
|
-
changed = true;
|
|
552
|
-
}
|
|
553
|
-
if (changed) params.persist();
|
|
554
|
-
return changed;
|
|
555
|
-
};
|
|
556
|
-
const emitCompletionEndedHookIfNeeded = async (entry, reason) => {
|
|
557
|
-
if (entry.expectsCompletionMessage === true && params.shouldEmitEndedHookForRun({
|
|
558
|
-
entry,
|
|
559
|
-
reason
|
|
560
|
-
})) await params.emitSubagentEndedHookForRun({
|
|
561
|
-
entry,
|
|
562
|
-
reason,
|
|
563
|
-
sendFarewell: true
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
const clearPendingFinalDelivery = (entry) => {
|
|
567
|
-
entry.pendingFinalDelivery = void 0;
|
|
568
|
-
entry.pendingFinalDeliveryCreatedAt = void 0;
|
|
569
|
-
entry.pendingFinalDeliveryLastAttemptAt = void 0;
|
|
570
|
-
entry.pendingFinalDeliveryAttemptCount = void 0;
|
|
571
|
-
entry.pendingFinalDeliveryLastError = void 0;
|
|
572
|
-
entry.pendingFinalDeliveryPayload = void 0;
|
|
573
|
-
};
|
|
574
|
-
const loadPendingFinalDeliveryPayload = (entry) => {
|
|
575
|
-
return {
|
|
576
|
-
requesterSessionKey: entry.pendingFinalDeliveryPayload?.requesterSessionKey ?? entry.requesterSessionKey,
|
|
577
|
-
requesterOrigin: entry.pendingFinalDeliveryPayload?.requesterOrigin ?? entry.requesterOrigin,
|
|
578
|
-
requesterDisplayKey: entry.pendingFinalDeliveryPayload?.requesterDisplayKey ?? entry.requesterDisplayKey,
|
|
579
|
-
childSessionKey: entry.pendingFinalDeliveryPayload?.childSessionKey ?? entry.childSessionKey,
|
|
580
|
-
childRunId: entry.pendingFinalDeliveryPayload?.childRunId ?? entry.runId,
|
|
581
|
-
task: entry.pendingFinalDeliveryPayload?.task ?? entry.task,
|
|
582
|
-
label: entry.pendingFinalDeliveryPayload?.label ?? entry.label,
|
|
583
|
-
startedAt: entry.pendingFinalDeliveryPayload?.startedAt ?? entry.startedAt,
|
|
584
|
-
endedAt: entry.pendingFinalDeliveryPayload?.endedAt ?? entry.endedAt,
|
|
585
|
-
outcome: entry.pendingFinalDeliveryPayload?.outcome ?? entry.outcome,
|
|
586
|
-
expectsCompletionMessage: entry.pendingFinalDeliveryPayload?.expectsCompletionMessage ?? entry.expectsCompletionMessage,
|
|
587
|
-
spawnMode: entry.pendingFinalDeliveryPayload?.spawnMode ?? entry.spawnMode,
|
|
588
|
-
frozenResultText: entry.pendingFinalDeliveryPayload?.frozenResultText ?? entry.frozenResultText,
|
|
589
|
-
fallbackFrozenResultText: entry.pendingFinalDeliveryPayload?.fallbackFrozenResultText ?? entry.fallbackFrozenResultText,
|
|
590
|
-
wakeOnDescendantSettle: entry.pendingFinalDeliveryPayload?.wakeOnDescendantSettle ?? entry.wakeOnDescendantSettle
|
|
591
|
-
};
|
|
592
|
-
};
|
|
593
|
-
const markPendingFinalDelivery = (args) => {
|
|
594
|
-
const now = Date.now();
|
|
595
|
-
const payload = loadPendingFinalDeliveryPayload(args.entry);
|
|
596
|
-
args.entry.pendingFinalDelivery = true;
|
|
597
|
-
args.entry.pendingFinalDeliveryCreatedAt ??= now;
|
|
598
|
-
args.entry.pendingFinalDeliveryLastAttemptAt = now;
|
|
599
|
-
args.entry.pendingFinalDeliveryAttemptCount = (args.entry.pendingFinalDeliveryAttemptCount ?? 0) + 1;
|
|
600
|
-
args.entry.pendingFinalDeliveryLastError = args.error ?? null;
|
|
601
|
-
args.entry.pendingFinalDeliveryPayload = payload;
|
|
602
|
-
};
|
|
603
|
-
const suspendPendingFinalDelivery = (args) => {
|
|
604
|
-
markPendingFinalDelivery({
|
|
605
|
-
entry: args.entry,
|
|
606
|
-
error: args.error ?? args.entry.lastAnnounceDeliveryError ?? args.reason
|
|
607
|
-
});
|
|
608
|
-
const now = Date.now();
|
|
609
|
-
args.entry.deliverySuspendedAt ??= now;
|
|
610
|
-
args.entry.deliverySuspendedReason = args.reason;
|
|
611
|
-
args.entry.cleanupHandled = false;
|
|
612
|
-
args.entry.wakeOnDescendantSettle = void 0;
|
|
613
|
-
args.entry.fallbackFrozenResultText = void 0;
|
|
614
|
-
args.entry.fallbackFrozenResultCapturedAt = void 0;
|
|
615
|
-
params.resumedRuns.delete(args.runId);
|
|
616
|
-
safeSetSubagentTaskDeliveryStatus({
|
|
617
|
-
runId: args.runId,
|
|
618
|
-
childSessionKey: args.entry.childSessionKey,
|
|
619
|
-
deliveryStatus: "failed",
|
|
620
|
-
deliveryError: args.entry.lastAnnounceDeliveryError ?? args.reason
|
|
621
|
-
});
|
|
622
|
-
safeMarkRequiredCompletionDeliveryBlocked({
|
|
623
|
-
entry: args.entry,
|
|
624
|
-
reason: args.entry.lastAnnounceDeliveryError ?? args.reason
|
|
625
|
-
});
|
|
626
|
-
logAnnounceGiveUp(args.entry, args.reason);
|
|
627
|
-
params.persist();
|
|
628
|
-
};
|
|
629
|
-
const shouldSuspendPendingFinalDelivery = (entry) => entry.expectsCompletionMessage === true && entry.cleanup === "keep" && entry.endedReason === "subagent-complete" && entry.outcome?.status === "ok";
|
|
630
|
-
const finalizeResumedAnnounceGiveUp = async (giveUpParams) => {
|
|
631
|
-
if (shouldSuspendPendingFinalDelivery(giveUpParams.entry)) {
|
|
632
|
-
suspendPendingFinalDelivery({
|
|
633
|
-
runId: giveUpParams.runId,
|
|
634
|
-
entry: giveUpParams.entry,
|
|
635
|
-
reason: giveUpParams.reason,
|
|
636
|
-
error: giveUpParams.entry.lastAnnounceDeliveryError
|
|
637
|
-
});
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
clearPendingFinalDelivery(giveUpParams.entry);
|
|
641
|
-
safeSetSubagentTaskDeliveryStatus({
|
|
642
|
-
runId: giveUpParams.runId,
|
|
643
|
-
childSessionKey: giveUpParams.entry.childSessionKey,
|
|
644
|
-
deliveryStatus: "failed",
|
|
645
|
-
deliveryError: giveUpParams.entry.lastAnnounceDeliveryError
|
|
646
|
-
});
|
|
647
|
-
safeMarkRequiredCompletionDeliveryBlocked({
|
|
648
|
-
entry: giveUpParams.entry,
|
|
649
|
-
reason: giveUpParams.entry.lastAnnounceDeliveryError ?? giveUpParams.reason
|
|
650
|
-
});
|
|
651
|
-
giveUpParams.entry.wakeOnDescendantSettle = void 0;
|
|
652
|
-
giveUpParams.entry.fallbackFrozenResultText = void 0;
|
|
653
|
-
giveUpParams.entry.fallbackFrozenResultCapturedAt = void 0;
|
|
654
|
-
if (giveUpParams.entry.cleanup === "delete" || !giveUpParams.entry.retainAttachmentsOnKeep) await safeRemoveAttachmentsDir(giveUpParams.entry);
|
|
655
|
-
const completionReason = resolveCleanupCompletionReason(giveUpParams.entry);
|
|
656
|
-
logAnnounceGiveUp(giveUpParams.entry, giveUpParams.reason);
|
|
657
|
-
completeCleanupBookkeeping({
|
|
658
|
-
runId: giveUpParams.runId,
|
|
659
|
-
entry: giveUpParams.entry,
|
|
660
|
-
cleanup: giveUpParams.entry.cleanup,
|
|
661
|
-
completedAt: Date.now()
|
|
662
|
-
});
|
|
663
|
-
await emitCompletionEndedHookIfNeeded(giveUpParams.entry, completionReason);
|
|
664
|
-
};
|
|
665
|
-
const beginSubagentCleanup = (runId) => {
|
|
666
|
-
const entry = params.runs.get(runId);
|
|
667
|
-
if (!entry) return false;
|
|
668
|
-
if (entry.cleanupCompletedAt || entry.cleanupHandled) return false;
|
|
669
|
-
entry.cleanupHandled = true;
|
|
670
|
-
params.persist();
|
|
671
|
-
return true;
|
|
672
|
-
};
|
|
673
|
-
const retryDeferredCompletedAnnounces = (excludeRunId) => {
|
|
674
|
-
const now = Date.now();
|
|
675
|
-
for (const [runId, entry] of params.runs.entries()) {
|
|
676
|
-
if (excludeRunId && runId === excludeRunId) continue;
|
|
677
|
-
if (typeof entry.endedAt !== "number") continue;
|
|
678
|
-
if (entry.cleanupCompletedAt || entry.cleanupHandled) continue;
|
|
679
|
-
if (entry.pendingFinalDelivery === true && typeof entry.deliverySuspendedAt === "number") continue;
|
|
680
|
-
if (params.suppressAnnounceForSteerRestart(entry)) continue;
|
|
681
|
-
const endedAgo = now - (entry.endedAt ?? now);
|
|
682
|
-
if (entry.expectsCompletionMessage !== true && endedAgo > 3e5) {
|
|
683
|
-
if (!beginSubagentCleanup(runId)) continue;
|
|
684
|
-
finalizeResumedAnnounceGiveUp({
|
|
685
|
-
runId,
|
|
686
|
-
entry,
|
|
687
|
-
reason: "expiry"
|
|
688
|
-
}).catch((error) => {
|
|
689
|
-
defaultRuntime.log(`[warn] Subagent expiry finalize failed during deferred retry for run ${runId}: ${String(error)}`);
|
|
690
|
-
const current = params.runs.get(runId);
|
|
691
|
-
if (!current || current.cleanupCompletedAt) return;
|
|
692
|
-
current.cleanupHandled = false;
|
|
693
|
-
params.persist();
|
|
694
|
-
});
|
|
695
|
-
continue;
|
|
696
|
-
}
|
|
697
|
-
params.resumedRuns.delete(runId);
|
|
698
|
-
params.resumeSubagentRun(runId);
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
const completeCleanupBookkeeping = (cleanupParams) => {
|
|
702
|
-
if (cleanupParams.entry.spawnMode !== "session") retireSessionMcpRuntimeForSessionKey({
|
|
703
|
-
sessionKey: cleanupParams.entry.childSessionKey,
|
|
704
|
-
reason: "subagent-run-cleanup",
|
|
705
|
-
onError: (error, sessionId) => {
|
|
706
|
-
params.warn("failed to retire subagent bundle MCP runtime", {
|
|
707
|
-
error: buildSafeLifecycleErrorMeta(error),
|
|
708
|
-
sessionId,
|
|
709
|
-
runId: maskRunId(cleanupParams.runId),
|
|
710
|
-
childSessionKey: maskSessionKey(cleanupParams.entry.childSessionKey)
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
if (cleanupParams.cleanup === "delete") {
|
|
715
|
-
params.clearPendingLifecycleError(cleanupParams.runId);
|
|
716
|
-
params.notifyContextEngineSubagentEnded({
|
|
717
|
-
childSessionKey: cleanupParams.entry.childSessionKey,
|
|
718
|
-
reason: "deleted",
|
|
719
|
-
agentDir: cleanupParams.entry.agentDir,
|
|
720
|
-
workspaceDir: cleanupParams.entry.workspaceDir
|
|
721
|
-
});
|
|
722
|
-
params.runs.delete(cleanupParams.runId);
|
|
723
|
-
params.persist();
|
|
724
|
-
retryDeferredCompletedAnnounces(cleanupParams.runId);
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
params.notifyContextEngineSubagentEnded({
|
|
728
|
-
childSessionKey: cleanupParams.entry.childSessionKey,
|
|
729
|
-
reason: "completed",
|
|
730
|
-
agentDir: cleanupParams.entry.agentDir,
|
|
731
|
-
workspaceDir: cleanupParams.entry.workspaceDir
|
|
732
|
-
});
|
|
733
|
-
cleanupParams.entry.cleanupCompletedAt = cleanupParams.completedAt;
|
|
734
|
-
params.persist();
|
|
735
|
-
retryDeferredCompletedAnnounces(cleanupParams.runId);
|
|
736
|
-
};
|
|
737
|
-
const retireRunModeBundleMcpRuntime = async (cleanupParams) => {
|
|
738
|
-
if (cleanupParams.entry.spawnMode === "session") return;
|
|
739
|
-
await retireSessionMcpRuntimeForSessionKey({
|
|
740
|
-
sessionKey: cleanupParams.entry.childSessionKey,
|
|
741
|
-
reason: cleanupParams.reason,
|
|
742
|
-
onError: (error, sessionId) => {
|
|
743
|
-
params.warn("failed to retire subagent bundle MCP runtime", {
|
|
744
|
-
error: buildSafeLifecycleErrorMeta(error),
|
|
745
|
-
sessionId,
|
|
746
|
-
runId: maskRunId(cleanupParams.runId),
|
|
747
|
-
childSessionKey: maskSessionKey(cleanupParams.entry.childSessionKey)
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
};
|
|
752
|
-
const finalizeSubagentCleanup = async (runId, cleanup, didAnnounce, options) => {
|
|
753
|
-
const entry = params.runs.get(runId);
|
|
754
|
-
if (!entry) return;
|
|
755
|
-
if (didAnnounce) {
|
|
756
|
-
if (!options?.skipAnnounce) {
|
|
757
|
-
const deliveredAt = entry.completionDeliveredAt ?? Date.now();
|
|
758
|
-
entry.completionDeliveredAt = deliveredAt;
|
|
759
|
-
entry.completionAnnouncedAt = deliveredAt;
|
|
760
|
-
params.persist();
|
|
761
|
-
}
|
|
762
|
-
clearPendingFinalDelivery(entry);
|
|
763
|
-
entry.deliverySuspendedAt = void 0;
|
|
764
|
-
entry.deliverySuspendedReason = void 0;
|
|
765
|
-
if (!options?.skipDeliveryStatus) safeSetSubagentTaskDeliveryStatus({
|
|
766
|
-
runId,
|
|
767
|
-
childSessionKey: entry.childSessionKey,
|
|
768
|
-
deliveryStatus: "delivered"
|
|
769
|
-
});
|
|
770
|
-
entry.lastAnnounceDeliveryError = void 0;
|
|
771
|
-
entry.lastAnnounceDropReason = void 0;
|
|
772
|
-
entry.wakeOnDescendantSettle = void 0;
|
|
773
|
-
entry.fallbackFrozenResultText = void 0;
|
|
774
|
-
entry.fallbackFrozenResultCapturedAt = void 0;
|
|
775
|
-
await emitCompletionEndedHookIfNeeded(entry, resolveCleanupCompletionReason(entry));
|
|
776
|
-
if (cleanup === "delete" || !entry.retainAttachmentsOnKeep) await safeRemoveAttachmentsDir(entry);
|
|
777
|
-
if (cleanup === "delete") {
|
|
778
|
-
entry.frozenResultText = void 0;
|
|
779
|
-
entry.frozenResultCapturedAt = void 0;
|
|
780
|
-
}
|
|
781
|
-
completeCleanupBookkeeping({
|
|
782
|
-
runId,
|
|
783
|
-
entry,
|
|
784
|
-
cleanup,
|
|
785
|
-
completedAt: Date.now()
|
|
786
|
-
});
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
const now = Date.now();
|
|
790
|
-
const deferredDecision = resolveDeferredCleanupDecision({
|
|
791
|
-
entry,
|
|
792
|
-
now,
|
|
793
|
-
activeDescendantRuns: Math.max(0, params.countPendingDescendantRuns(entry.childSessionKey)),
|
|
794
|
-
announceExpiryMs: ANNOUNCE_EXPIRY_MS,
|
|
795
|
-
announceCompletionHardExpiryMs: ANNOUNCE_COMPLETION_HARD_EXPIRY_MS,
|
|
796
|
-
maxAnnounceRetryCount: 3,
|
|
797
|
-
deferDescendantDelayMs: MIN_ANNOUNCE_RETRY_DELAY_MS,
|
|
798
|
-
resolveAnnounceRetryDelayMs
|
|
799
|
-
});
|
|
800
|
-
if (deferredDecision.kind === "defer-descendants") {
|
|
801
|
-
entry.lastAnnounceRetryAt = now;
|
|
802
|
-
entry.wakeOnDescendantSettle = true;
|
|
803
|
-
entry.cleanupHandled = false;
|
|
804
|
-
params.resumedRuns.delete(runId);
|
|
805
|
-
params.persist();
|
|
806
|
-
scheduleResumeSubagentRun(runId, entry, deferredDecision.delayMs);
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
if (deferredDecision.retryCount != null) {
|
|
810
|
-
entry.announceRetryCount = deferredDecision.retryCount;
|
|
811
|
-
entry.lastAnnounceRetryAt = now;
|
|
812
|
-
}
|
|
813
|
-
if (deferredDecision.kind === "give-up") {
|
|
814
|
-
if (shouldSuspendPendingFinalDelivery(entry)) {
|
|
815
|
-
suspendPendingFinalDelivery({
|
|
816
|
-
runId,
|
|
817
|
-
entry,
|
|
818
|
-
reason: deferredDecision.reason,
|
|
819
|
-
error: entry.lastAnnounceDeliveryError
|
|
820
|
-
});
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
clearPendingFinalDelivery(entry);
|
|
824
|
-
safeSetSubagentTaskDeliveryStatus({
|
|
825
|
-
runId,
|
|
826
|
-
childSessionKey: entry.childSessionKey,
|
|
827
|
-
deliveryStatus: "failed",
|
|
828
|
-
deliveryError: entry.lastAnnounceDeliveryError
|
|
829
|
-
});
|
|
830
|
-
safeMarkRequiredCompletionDeliveryBlocked({
|
|
831
|
-
entry,
|
|
832
|
-
reason: entry.lastAnnounceDeliveryError ?? deferredDecision.reason
|
|
833
|
-
});
|
|
834
|
-
entry.wakeOnDescendantSettle = void 0;
|
|
835
|
-
entry.fallbackFrozenResultText = void 0;
|
|
836
|
-
entry.fallbackFrozenResultCapturedAt = void 0;
|
|
837
|
-
if (cleanup === "delete" || !entry.retainAttachmentsOnKeep) await safeRemoveAttachmentsDir(entry);
|
|
838
|
-
const completionReason = resolveCleanupCompletionReason(entry);
|
|
839
|
-
logAnnounceGiveUp(entry, deferredDecision.reason);
|
|
840
|
-
completeCleanupBookkeeping({
|
|
841
|
-
runId,
|
|
842
|
-
entry,
|
|
843
|
-
cleanup,
|
|
844
|
-
completedAt: now
|
|
845
|
-
});
|
|
846
|
-
await emitCompletionEndedHookIfNeeded(entry, completionReason);
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
markPendingFinalDelivery({
|
|
850
|
-
entry,
|
|
851
|
-
error: didAnnounce ? void 0 : "announce deferred or direct delivery failed"
|
|
852
|
-
});
|
|
853
|
-
entry.cleanupHandled = false;
|
|
854
|
-
params.resumedRuns.delete(runId);
|
|
855
|
-
params.persist();
|
|
856
|
-
if (deferredDecision.resumeDelayMs == null) return;
|
|
857
|
-
scheduleResumeSubagentRun(runId, entry, deferredDecision.resumeDelayMs);
|
|
858
|
-
};
|
|
859
|
-
const startSubagentAnnounceCleanupFlow = (runId, entry) => {
|
|
860
|
-
if (typeof entry.completionAnnouncedAt === "number") {
|
|
861
|
-
if (!beginSubagentCleanup(runId)) return false;
|
|
862
|
-
finalizeSubagentCleanup(runId, entry.cleanup, true, { skipAnnounce: true }).catch((err) => {
|
|
863
|
-
defaultRuntime.log(`[warn] subagent cleanup finalize failed (${runId}): ${String(err)}`);
|
|
864
|
-
const current = params.runs.get(runId);
|
|
865
|
-
if (!current || current.cleanupCompletedAt) return;
|
|
866
|
-
current.cleanupHandled = false;
|
|
867
|
-
params.persist();
|
|
868
|
-
});
|
|
869
|
-
return true;
|
|
870
|
-
}
|
|
871
|
-
if (!beginSubagentCleanup(runId)) return false;
|
|
872
|
-
if (entry.expectsCompletionMessage === false) {
|
|
873
|
-
(async () => {
|
|
874
|
-
if (entry.cleanup === "delete") await deleteSubagentSessionForCleanup({
|
|
875
|
-
callGateway: params.callGateway,
|
|
876
|
-
childSessionKey: entry.childSessionKey,
|
|
877
|
-
spawnMode: entry.spawnMode,
|
|
878
|
-
onError: (error) => params.warn("sessions.delete failed during subagent cleanup", {
|
|
879
|
-
error: buildSafeLifecycleErrorMeta(error),
|
|
880
|
-
runId: maskRunId(runId),
|
|
881
|
-
childSessionKey: maskSessionKey(entry.childSessionKey)
|
|
882
|
-
})
|
|
883
|
-
});
|
|
884
|
-
await finalizeSubagentCleanup(runId, entry.cleanup, true, {
|
|
885
|
-
skipAnnounce: true,
|
|
886
|
-
skipDeliveryStatus: true
|
|
887
|
-
});
|
|
888
|
-
})().catch((err) => {
|
|
889
|
-
defaultRuntime.log(`[warn] subagent cleanup finalize failed (${runId}): ${String(err)}`);
|
|
890
|
-
const current = params.runs.get(runId);
|
|
891
|
-
if (!current || current.cleanupCompletedAt) return;
|
|
892
|
-
current.cleanupHandled = false;
|
|
893
|
-
params.persist();
|
|
894
|
-
});
|
|
895
|
-
return true;
|
|
896
|
-
}
|
|
897
|
-
const pendingPayload = loadPendingFinalDeliveryPayload(entry);
|
|
898
|
-
const requesterOrigin = normalizeDeliveryContext(pendingPayload.requesterOrigin);
|
|
899
|
-
let latestDeliveryError = entry.lastAnnounceDeliveryError;
|
|
900
|
-
const finalizeAnnounceCleanup = async (didAnnounce) => {
|
|
901
|
-
const shouldCreditPriorDelivery = !didAnnounce && await hasPriorRequesterDeliveryMirror(entry);
|
|
902
|
-
if (shouldCreditPriorDelivery) latestDeliveryError = void 0;
|
|
903
|
-
if (!didAnnounce && latestDeliveryError) entry.lastAnnounceDeliveryError = latestDeliveryError;
|
|
904
|
-
finalizeSubagentCleanup(runId, entry.cleanup, didAnnounce || shouldCreditPriorDelivery).catch((err) => {
|
|
905
|
-
defaultRuntime.log(`[warn] subagent cleanup finalize failed (${runId}): ${String(err)}`);
|
|
906
|
-
const current = params.runs.get(runId);
|
|
907
|
-
if (!current || current.cleanupCompletedAt) return;
|
|
908
|
-
current.cleanupHandled = false;
|
|
909
|
-
params.persist();
|
|
910
|
-
});
|
|
911
|
-
};
|
|
912
|
-
params.runSubagentAnnounceFlow({
|
|
913
|
-
childSessionKey: pendingPayload.childSessionKey,
|
|
914
|
-
childRunId: pendingPayload.childRunId,
|
|
915
|
-
requesterSessionKey: pendingPayload.requesterSessionKey,
|
|
916
|
-
requesterOrigin,
|
|
917
|
-
requesterDisplayKey: pendingPayload.requesterDisplayKey,
|
|
918
|
-
task: pendingPayload.task,
|
|
919
|
-
timeoutMs: params.subagentAnnounceTimeoutMs,
|
|
920
|
-
cleanup: entry.cleanup,
|
|
921
|
-
roundOneReply: pendingPayload.frozenResultText ?? void 0,
|
|
922
|
-
fallbackReply: pendingPayload.fallbackFrozenResultText ?? void 0,
|
|
923
|
-
waitForCompletion: false,
|
|
924
|
-
startedAt: pendingPayload.startedAt,
|
|
925
|
-
endedAt: pendingPayload.endedAt,
|
|
926
|
-
label: pendingPayload.label,
|
|
927
|
-
outcome: pendingPayload.outcome,
|
|
928
|
-
spawnMode: pendingPayload.spawnMode,
|
|
929
|
-
expectsCompletionMessage: pendingPayload.expectsCompletionMessage,
|
|
930
|
-
wakeOnDescendantSettle: pendingPayload.wakeOnDescendantSettle === true,
|
|
931
|
-
onDeliveryResult: (delivery) => {
|
|
932
|
-
recordAnnounceDeliveryResult(entry, delivery);
|
|
933
|
-
if (delivery.delivered) {
|
|
934
|
-
if (entry.lastAnnounceDeliveryError !== void 0) {
|
|
935
|
-
entry.lastAnnounceDeliveryError = void 0;
|
|
936
|
-
params.persist();
|
|
937
|
-
}
|
|
938
|
-
latestDeliveryError = void 0;
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
if (delivery.path === "none") entry.lastAnnounceDropReason = "sink_unavailable";
|
|
942
|
-
latestDeliveryError = formatAnnounceDeliveryError(delivery);
|
|
943
|
-
if (entry.lastAnnounceDeliveryError !== latestDeliveryError) {
|
|
944
|
-
entry.lastAnnounceDeliveryError = latestDeliveryError;
|
|
945
|
-
params.persist();
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}).then((didAnnounce) => {
|
|
949
|
-
finalizeAnnounceCleanup(didAnnounce);
|
|
950
|
-
}).catch((error) => {
|
|
951
|
-
defaultRuntime.log(`[warn] Subagent announce flow failed during cleanup for run ${runId}: ${String(error)}`);
|
|
952
|
-
finalizeAnnounceCleanup(false);
|
|
953
|
-
});
|
|
954
|
-
return true;
|
|
955
|
-
};
|
|
956
|
-
const completeSubagentRun = async (completeParams) => {
|
|
957
|
-
params.clearPendingLifecycleError(completeParams.runId);
|
|
958
|
-
const entry = params.runs.get(completeParams.runId);
|
|
959
|
-
if (!entry) return;
|
|
960
|
-
let mutated = false;
|
|
961
|
-
if (completeParams.reason === "subagent-complete" && entry.suppressAnnounceReason === "killed" && (entry.cleanupHandled || typeof entry.cleanupCompletedAt === "number")) {
|
|
962
|
-
entry.suppressAnnounceReason = void 0;
|
|
963
|
-
entry.cleanupHandled = false;
|
|
964
|
-
entry.cleanupCompletedAt = void 0;
|
|
965
|
-
entry.completionAnnouncedAt = void 0;
|
|
966
|
-
mutated = true;
|
|
967
|
-
}
|
|
968
|
-
const endedAt = typeof completeParams.endedAt === "number" ? completeParams.endedAt : Date.now();
|
|
969
|
-
if (entry.endedAt !== endedAt) {
|
|
970
|
-
entry.endedAt = endedAt;
|
|
971
|
-
mutated = true;
|
|
972
|
-
}
|
|
973
|
-
const outcome = withSubagentOutcomeTiming(completeParams.outcome, {
|
|
974
|
-
startedAt: entry.startedAt,
|
|
975
|
-
endedAt
|
|
976
|
-
});
|
|
977
|
-
if (shouldUpdateRunOutcome(entry.outcome, outcome)) {
|
|
978
|
-
entry.outcome = outcome;
|
|
979
|
-
mutated = true;
|
|
980
|
-
}
|
|
981
|
-
if (entry.endedReason !== completeParams.reason) {
|
|
982
|
-
entry.endedReason = completeParams.reason;
|
|
983
|
-
mutated = true;
|
|
984
|
-
}
|
|
985
|
-
if (entry.pauseReason !== void 0) {
|
|
986
|
-
entry.pauseReason = void 0;
|
|
987
|
-
mutated = true;
|
|
988
|
-
}
|
|
989
|
-
if (await freezeRunResultAtCompletion(entry, outcome)) mutated = true;
|
|
990
|
-
if (mutated) params.persist();
|
|
991
|
-
safeFinalizeSubagentTaskRun({
|
|
992
|
-
entry,
|
|
993
|
-
outcome
|
|
994
|
-
});
|
|
995
|
-
try {
|
|
996
|
-
await persistSubagentSessionTiming(entry);
|
|
997
|
-
} catch (err) {
|
|
998
|
-
params.warn("failed to persist subagent session timing", {
|
|
999
|
-
err,
|
|
1000
|
-
runId: entry.runId,
|
|
1001
|
-
childSessionKey: entry.childSessionKey
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
const suppressedForSteerRestart = params.suppressAnnounceForSteerRestart(entry);
|
|
1005
|
-
if (mutated && !suppressedForSteerRestart) emitSessionLifecycleEvent({
|
|
1006
|
-
sessionKey: entry.childSessionKey,
|
|
1007
|
-
reason: "subagent-status",
|
|
1008
|
-
parentSessionKey: entry.requesterSessionKey,
|
|
1009
|
-
label: entry.label
|
|
1010
|
-
});
|
|
1011
|
-
const shouldEmitEndedHook = !suppressedForSteerRestart && params.shouldEmitEndedHookForRun({
|
|
1012
|
-
entry,
|
|
1013
|
-
reason: completeParams.reason
|
|
1014
|
-
});
|
|
1015
|
-
if (!(shouldEmitEndedHook && completeParams.triggerCleanup && entry.expectsCompletionMessage === true && !suppressedForSteerRestart) && shouldEmitEndedHook) await params.emitSubagentEndedHookForRun({
|
|
1016
|
-
entry,
|
|
1017
|
-
reason: completeParams.reason,
|
|
1018
|
-
sendFarewell: completeParams.sendFarewell,
|
|
1019
|
-
accountId: completeParams.accountId
|
|
1020
|
-
});
|
|
1021
|
-
if (!completeParams.triggerCleanup || suppressedForSteerRestart) return;
|
|
1022
|
-
try {
|
|
1023
|
-
await (params.cleanupBrowserSessionsForLifecycleEnd ?? await loadCleanupBrowserSessionsForLifecycleEnd$1())({
|
|
1024
|
-
sessionKeys: [entry.childSessionKey],
|
|
1025
|
-
onWarn: (msg) => params.warn(msg, { runId: entry.runId })
|
|
1026
|
-
});
|
|
1027
|
-
} catch (error) {
|
|
1028
|
-
params.warn("failed to cleanup browser sessions for completed subagent", {
|
|
1029
|
-
error: buildSafeLifecycleErrorMeta(error),
|
|
1030
|
-
runId: maskRunId(completeParams.runId),
|
|
1031
|
-
childSessionKey: maskSessionKey(entry.childSessionKey)
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
try {
|
|
1035
|
-
await retireRunModeBundleMcpRuntime({
|
|
1036
|
-
runId: completeParams.runId,
|
|
1037
|
-
entry,
|
|
1038
|
-
reason: "subagent-run-complete"
|
|
1039
|
-
});
|
|
1040
|
-
} catch (error) {
|
|
1041
|
-
params.warn("failed to retire subagent bundle MCP runtime after completion", {
|
|
1042
|
-
error: buildSafeLifecycleErrorMeta(error),
|
|
1043
|
-
runId: maskRunId(completeParams.runId),
|
|
1044
|
-
childSessionKey: maskSessionKey(entry.childSessionKey)
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
startSubagentAnnounceCleanupFlow(completeParams.runId, entry);
|
|
1048
|
-
};
|
|
1049
|
-
return {
|
|
1050
|
-
clearScheduledResumeTimers,
|
|
1051
|
-
completeCleanupBookkeeping,
|
|
1052
|
-
completeSubagentRun,
|
|
1053
|
-
finalizeResumedAnnounceGiveUp,
|
|
1054
|
-
refreshFrozenResultFromSession,
|
|
1055
|
-
startSubagentAnnounceCleanupFlow
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
//#endregion
|
|
1059
|
-
//#region src/agents/subagent-registry-run-manager.ts
|
|
1060
|
-
const log$1 = createSubsystemLogger("agents/subagent-registry");
|
|
1061
|
-
const RECOVERABLE_WAIT_RETRY_DELAY_MS = process.env.DAOCORE_TEST_FAST === "1" ? 25 : 5e3;
|
|
1062
|
-
function shouldDeleteAttachments(entry) {
|
|
1063
|
-
return entry.cleanup === "delete" || !entry.retainAttachmentsOnKeep;
|
|
1064
|
-
}
|
|
1065
|
-
function markSubagentRunPausedAfterYield(params) {
|
|
1066
|
-
const { entry } = params;
|
|
1067
|
-
let mutated = false;
|
|
1068
|
-
if (typeof params.startedAt === "number" && entry.startedAt !== params.startedAt) {
|
|
1069
|
-
entry.startedAt = params.startedAt;
|
|
1070
|
-
if (typeof entry.sessionStartedAt !== "number") entry.sessionStartedAt = params.startedAt;
|
|
1071
|
-
mutated = true;
|
|
1072
|
-
}
|
|
1073
|
-
const endedAt = typeof params.endedAt === "number" ? params.endedAt : params.now ?? Date.now();
|
|
1074
|
-
if (entry.endedAt !== endedAt) {
|
|
1075
|
-
entry.endedAt = endedAt;
|
|
1076
|
-
mutated = true;
|
|
1077
|
-
}
|
|
1078
|
-
if (entry.pauseReason !== "sessions_yield") {
|
|
1079
|
-
entry.pauseReason = "sessions_yield";
|
|
1080
|
-
mutated = true;
|
|
1081
|
-
}
|
|
1082
|
-
if (entry.outcome !== void 0) {
|
|
1083
|
-
entry.outcome = void 0;
|
|
1084
|
-
mutated = true;
|
|
1085
|
-
}
|
|
1086
|
-
if (entry.endedReason !== void 0) {
|
|
1087
|
-
entry.endedReason = void 0;
|
|
1088
|
-
mutated = true;
|
|
1089
|
-
}
|
|
1090
|
-
if (entry.cleanupHandled === true) {
|
|
1091
|
-
entry.cleanupHandled = false;
|
|
1092
|
-
mutated = true;
|
|
1093
|
-
}
|
|
1094
|
-
if (entry.frozenResultText !== void 0) {
|
|
1095
|
-
entry.frozenResultText = void 0;
|
|
1096
|
-
entry.frozenResultCapturedAt = void 0;
|
|
1097
|
-
mutated = true;
|
|
1098
|
-
}
|
|
1099
|
-
return mutated;
|
|
1100
|
-
}
|
|
1101
|
-
function createSubagentRunManager(params) {
|
|
1102
|
-
const waitForSubagentCompletion = async (runId, waitTimeoutMs, expectedEntry) => {
|
|
1103
|
-
let completionForRetry;
|
|
1104
|
-
const scheduleWaitRetry = (entry, reason, error) => {
|
|
1105
|
-
params.scheduleOrphanRecovery({ delayMs: 1e3 });
|
|
1106
|
-
const scheduledEntry = entry;
|
|
1107
|
-
setTimeout(() => {
|
|
1108
|
-
const current = params.runs.get(runId);
|
|
1109
|
-
if (!current || current !== scheduledEntry || typeof current.endedAt === "number") return;
|
|
1110
|
-
waitForSubagentCompletion(runId, waitTimeoutMs, scheduledEntry);
|
|
1111
|
-
}, RECOVERABLE_WAIT_RETRY_DELAY_MS).unref?.();
|
|
1112
|
-
log$1.info(reason, {
|
|
1113
|
-
runId,
|
|
1114
|
-
childSessionKey: entry.childSessionKey,
|
|
1115
|
-
...error ? { error } : {}
|
|
1116
|
-
});
|
|
1117
|
-
};
|
|
1118
|
-
try {
|
|
1119
|
-
const wait = await waitForAgentRun({
|
|
1120
|
-
runId,
|
|
1121
|
-
timeoutMs: Math.max(1, Math.floor(waitTimeoutMs)),
|
|
1122
|
-
callGateway: params.callGateway
|
|
1123
|
-
});
|
|
1124
|
-
const entry = params.runs.get(runId);
|
|
1125
|
-
if (!entry || expectedEntry && entry !== expectedEntry) return;
|
|
1126
|
-
if (wait.status === "pending") return;
|
|
1127
|
-
const waitBlocked = isBlockedLivenessState(wait.livenessState);
|
|
1128
|
-
if (wait.yielded === true && !waitBlocked) {
|
|
1129
|
-
if (markSubagentRunPausedAfterYield({
|
|
1130
|
-
entry,
|
|
1131
|
-
startedAt: wait.startedAt,
|
|
1132
|
-
endedAt: wait.endedAt
|
|
1133
|
-
})) params.persist();
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
const waitStatus = waitBlocked ? "error" : wait.status;
|
|
1137
|
-
if (waitStatus === "error" && isRecoverableAgentWaitError(wait.error)) {
|
|
1138
|
-
scheduleWaitRetry(entry, "subagent wait interrupted; scheduling recovery", wait.error);
|
|
1139
|
-
return;
|
|
1140
|
-
}
|
|
1141
|
-
if (waitStatus === "timeout") {
|
|
1142
|
-
const isTerminalWaitTimeout = typeof wait.endedAt === "number" || typeof wait.stopReason === "string" || typeof wait.livenessState === "string";
|
|
1143
|
-
const completion = params.resolveSubagentSessionCompletion({
|
|
1144
|
-
childSessionKey: entry.childSessionKey,
|
|
1145
|
-
fallbackEndedAt: typeof wait.endedAt === "number" ? wait.endedAt : Date.now(),
|
|
1146
|
-
notBeforeMs: entry.startedAt ?? entry.createdAt
|
|
1147
|
-
});
|
|
1148
|
-
if (completion) {
|
|
1149
|
-
completionForRetry = {
|
|
1150
|
-
runId,
|
|
1151
|
-
endedAt: completion.endedAt,
|
|
1152
|
-
outcome: completion.outcome,
|
|
1153
|
-
reason: completion.reason,
|
|
1154
|
-
sendFarewell: true,
|
|
1155
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1156
|
-
triggerCleanup: true
|
|
1157
|
-
};
|
|
1158
|
-
await params.completeSubagentRun(completionForRetry);
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
if (isTerminalWaitTimeout) {
|
|
1162
|
-
completionForRetry = {
|
|
1163
|
-
runId,
|
|
1164
|
-
endedAt: wait.endedAt,
|
|
1165
|
-
outcome: { status: "timeout" },
|
|
1166
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE,
|
|
1167
|
-
sendFarewell: true,
|
|
1168
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1169
|
-
triggerCleanup: true
|
|
1170
|
-
};
|
|
1171
|
-
await params.completeSubagentRun(completionForRetry);
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
scheduleWaitRetry(entry, "subagent wait timed out; deferring terminal state until session reconciliation");
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
let mutated = false;
|
|
1178
|
-
if (typeof wait.startedAt === "number") {
|
|
1179
|
-
entry.startedAt = wait.startedAt;
|
|
1180
|
-
if (typeof entry.sessionStartedAt !== "number") entry.sessionStartedAt = wait.startedAt;
|
|
1181
|
-
mutated = true;
|
|
1182
|
-
}
|
|
1183
|
-
if (typeof wait.endedAt === "number") {
|
|
1184
|
-
entry.endedAt = wait.endedAt;
|
|
1185
|
-
mutated = true;
|
|
1186
|
-
}
|
|
1187
|
-
if (!entry.endedAt) {
|
|
1188
|
-
entry.endedAt = Date.now();
|
|
1189
|
-
mutated = true;
|
|
1190
|
-
}
|
|
1191
|
-
const rawWaitError = typeof wait.error === "string" ? wait.error : void 0;
|
|
1192
|
-
const waitError = waitBlocked ? formatBlockedLivenessError(rawWaitError) : rawWaitError;
|
|
1193
|
-
const outcome = withSubagentOutcomeTiming(waitStatus === "error" ? {
|
|
1194
|
-
status: "error",
|
|
1195
|
-
error: waitError
|
|
1196
|
-
} : { status: "ok" }, {
|
|
1197
|
-
startedAt: entry.startedAt,
|
|
1198
|
-
endedAt: entry.endedAt
|
|
1199
|
-
});
|
|
1200
|
-
if (shouldUpdateRunOutcome(entry.outcome, outcome)) {
|
|
1201
|
-
entry.outcome = outcome;
|
|
1202
|
-
mutated = true;
|
|
1203
|
-
}
|
|
1204
|
-
if (mutated) params.persist();
|
|
1205
|
-
completionForRetry = {
|
|
1206
|
-
runId,
|
|
1207
|
-
endedAt: entry.endedAt,
|
|
1208
|
-
outcome,
|
|
1209
|
-
reason: waitStatus === "error" ? SUBAGENT_ENDED_REASON_ERROR : SUBAGENT_ENDED_REASON_COMPLETE,
|
|
1210
|
-
sendFarewell: true,
|
|
1211
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1212
|
-
triggerCleanup: true
|
|
1213
|
-
};
|
|
1214
|
-
await params.completeSubagentRun(completionForRetry);
|
|
1215
|
-
} catch (error) {
|
|
1216
|
-
const current = params.runs.get(runId);
|
|
1217
|
-
log$1.warn("failed to complete subagent run; retrying completion", {
|
|
1218
|
-
runId,
|
|
1219
|
-
childSessionKey: current?.childSessionKey ?? expectedEntry?.childSessionKey,
|
|
1220
|
-
error
|
|
1221
|
-
});
|
|
1222
|
-
if (current && typeof current.endedAt === "number" && !current.cleanupCompletedAt && current.pauseReason !== "sessions_yield") {
|
|
1223
|
-
if (completionForRetry) try {
|
|
1224
|
-
await params.completeSubagentRun(completionForRetry);
|
|
1225
|
-
return;
|
|
1226
|
-
} catch (retryError) {
|
|
1227
|
-
log$1.warn("failed to complete subagent run after retry; retrying ended cleanup", {
|
|
1228
|
-
runId,
|
|
1229
|
-
childSessionKey: current.childSessionKey,
|
|
1230
|
-
error: retryError
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
current.cleanupHandled = false;
|
|
1234
|
-
params.resumedRuns.delete(runId);
|
|
1235
|
-
params.resumeSubagentRun(runId);
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
};
|
|
1239
|
-
const markSubagentRunForSteerRestart = (runId) => {
|
|
1240
|
-
const key = runId.trim();
|
|
1241
|
-
if (!key) return false;
|
|
1242
|
-
const entry = params.runs.get(key);
|
|
1243
|
-
if (!entry) return false;
|
|
1244
|
-
if (entry.suppressAnnounceReason === "steer-restart") return true;
|
|
1245
|
-
entry.suppressAnnounceReason = "steer-restart";
|
|
1246
|
-
params.persist();
|
|
1247
|
-
return true;
|
|
1248
|
-
};
|
|
1249
|
-
const clearSubagentRunSteerRestart = (runId) => {
|
|
1250
|
-
const key = runId.trim();
|
|
1251
|
-
if (!key) return false;
|
|
1252
|
-
const entry = params.runs.get(key);
|
|
1253
|
-
if (!entry) return false;
|
|
1254
|
-
if (entry.suppressAnnounceReason !== "steer-restart") return true;
|
|
1255
|
-
entry.suppressAnnounceReason = void 0;
|
|
1256
|
-
params.persist();
|
|
1257
|
-
params.resumedRuns.delete(key);
|
|
1258
|
-
if (typeof entry.endedAt === "number" && !entry.cleanupCompletedAt) params.resumeSubagentRun(key);
|
|
1259
|
-
return true;
|
|
1260
|
-
};
|
|
1261
|
-
const replaceSubagentRunAfterSteer = (replaceParams) => {
|
|
1262
|
-
const previousRunId = replaceParams.previousRunId.trim();
|
|
1263
|
-
const nextRunId = replaceParams.nextRunId.trim();
|
|
1264
|
-
if (!previousRunId || !nextRunId) return false;
|
|
1265
|
-
const source = params.runs.get(previousRunId) ?? replaceParams.fallback;
|
|
1266
|
-
if (!source) return false;
|
|
1267
|
-
if (previousRunId !== nextRunId) {
|
|
1268
|
-
params.clearPendingLifecycleError(previousRunId);
|
|
1269
|
-
if (shouldDeleteAttachments(source)) safeRemoveAttachmentsDir(source);
|
|
1270
|
-
params.runs.delete(previousRunId);
|
|
1271
|
-
params.resumedRuns.delete(previousRunId);
|
|
1272
|
-
}
|
|
1273
|
-
const now = Date.now();
|
|
1274
|
-
const cfg = params.getRuntimeConfig();
|
|
1275
|
-
const archiveAfterMs = resolveArchiveAfterMs(cfg);
|
|
1276
|
-
const spawnMode = source.spawnMode === "session" ? "session" : "run";
|
|
1277
|
-
const archiveAtMs = spawnMode === "session" || source.cleanup === "keep" ? void 0 : archiveAfterMs ? now + archiveAfterMs : void 0;
|
|
1278
|
-
const runTimeoutSeconds = replaceParams.runTimeoutSeconds ?? source.runTimeoutSeconds ?? 0;
|
|
1279
|
-
const waitTimeoutMs = params.resolveSubagentWaitTimeoutMs(cfg, runTimeoutSeconds);
|
|
1280
|
-
const preserveFrozenResultFallback = replaceParams.preserveFrozenResultFallback === true;
|
|
1281
|
-
const sessionStartedAt = getSubagentSessionStartedAt(source) ?? now;
|
|
1282
|
-
const accumulatedRuntimeMs = getSubagentSessionRuntimeMs(source, typeof source.endedAt === "number" ? source.endedAt : now) ?? 0;
|
|
1283
|
-
const next = {
|
|
1284
|
-
...source,
|
|
1285
|
-
runId: nextRunId,
|
|
1286
|
-
createdAt: now,
|
|
1287
|
-
startedAt: now,
|
|
1288
|
-
sessionStartedAt,
|
|
1289
|
-
accumulatedRuntimeMs,
|
|
1290
|
-
endedAt: void 0,
|
|
1291
|
-
endedReason: void 0,
|
|
1292
|
-
pauseReason: void 0,
|
|
1293
|
-
endedHookEmittedAt: void 0,
|
|
1294
|
-
wakeOnDescendantSettle: void 0,
|
|
1295
|
-
outcome: void 0,
|
|
1296
|
-
frozenResultText: void 0,
|
|
1297
|
-
frozenResultCapturedAt: void 0,
|
|
1298
|
-
fallbackFrozenResultText: preserveFrozenResultFallback ? source.frozenResultText : void 0,
|
|
1299
|
-
fallbackFrozenResultCapturedAt: preserveFrozenResultFallback ? source.frozenResultCapturedAt : void 0,
|
|
1300
|
-
cleanupCompletedAt: void 0,
|
|
1301
|
-
cleanupHandled: false,
|
|
1302
|
-
completionEnqueuedAt: void 0,
|
|
1303
|
-
completionDeliveredAt: void 0,
|
|
1304
|
-
completionAnnouncedAt: void 0,
|
|
1305
|
-
lastAnnounceDropReason: void 0,
|
|
1306
|
-
suppressAnnounceReason: void 0,
|
|
1307
|
-
announceRetryCount: void 0,
|
|
1308
|
-
lastAnnounceRetryAt: void 0,
|
|
1309
|
-
lastAnnounceDeliveryError: void 0,
|
|
1310
|
-
pendingFinalDelivery: void 0,
|
|
1311
|
-
pendingFinalDeliveryCreatedAt: void 0,
|
|
1312
|
-
pendingFinalDeliveryLastAttemptAt: void 0,
|
|
1313
|
-
pendingFinalDeliveryAttemptCount: void 0,
|
|
1314
|
-
pendingFinalDeliveryLastError: void 0,
|
|
1315
|
-
pendingFinalDeliveryPayload: void 0,
|
|
1316
|
-
deliverySuspendedAt: void 0,
|
|
1317
|
-
deliverySuspendedReason: void 0,
|
|
1318
|
-
deliveryDiscardedAt: void 0,
|
|
1319
|
-
deliveryDiscardReason: void 0,
|
|
1320
|
-
deliveryDiscardedPayloadSummary: void 0,
|
|
1321
|
-
spawnMode,
|
|
1322
|
-
archiveAtMs,
|
|
1323
|
-
runTimeoutSeconds
|
|
1324
|
-
};
|
|
1325
|
-
params.runs.set(nextRunId, next);
|
|
1326
|
-
params.ensureListener();
|
|
1327
|
-
params.persist();
|
|
1328
|
-
params.startSweeper();
|
|
1329
|
-
waitForSubagentCompletion(nextRunId, waitTimeoutMs, next);
|
|
1330
|
-
return true;
|
|
1331
|
-
};
|
|
1332
|
-
const registerSubagentRun = (registerParams) => {
|
|
1333
|
-
const runId = registerParams.runId.trim();
|
|
1334
|
-
const childSessionKey = registerParams.childSessionKey.trim();
|
|
1335
|
-
const requesterSessionKey = registerParams.requesterSessionKey.trim();
|
|
1336
|
-
const controllerSessionKey = registerParams.controllerSessionKey?.trim() || requesterSessionKey;
|
|
1337
|
-
if (!runId || !childSessionKey || !requesterSessionKey) return;
|
|
1338
|
-
const now = Date.now();
|
|
1339
|
-
const cfg = params.getRuntimeConfig();
|
|
1340
|
-
const archiveAfterMs = resolveArchiveAfterMs(cfg);
|
|
1341
|
-
const spawnMode = registerParams.spawnMode === "session" ? "session" : "run";
|
|
1342
|
-
const archiveAtMs = spawnMode === "session" || registerParams.cleanup === "keep" ? void 0 : archiveAfterMs ? now + archiveAfterMs : void 0;
|
|
1343
|
-
const runTimeoutSeconds = registerParams.runTimeoutSeconds ?? 0;
|
|
1344
|
-
const waitTimeoutMs = params.resolveSubagentWaitTimeoutMs(cfg, runTimeoutSeconds);
|
|
1345
|
-
const requesterOrigin = normalizeDeliveryContext(registerParams.requesterOrigin);
|
|
1346
|
-
const entry = {
|
|
1347
|
-
runId,
|
|
1348
|
-
childSessionKey,
|
|
1349
|
-
controllerSessionKey,
|
|
1350
|
-
requesterSessionKey,
|
|
1351
|
-
requesterOrigin,
|
|
1352
|
-
requesterDisplayKey: registerParams.requesterDisplayKey,
|
|
1353
|
-
task: registerParams.task,
|
|
1354
|
-
taskName: registerParams.taskName,
|
|
1355
|
-
cleanup: registerParams.cleanup,
|
|
1356
|
-
expectsCompletionMessage: registerParams.expectsCompletionMessage,
|
|
1357
|
-
spawnMode,
|
|
1358
|
-
label: registerParams.label,
|
|
1359
|
-
model: registerParams.model,
|
|
1360
|
-
agentDir: registerParams.agentDir,
|
|
1361
|
-
workspaceDir: registerParams.workspaceDir,
|
|
1362
|
-
runTimeoutSeconds,
|
|
1363
|
-
createdAt: now,
|
|
1364
|
-
startedAt: now,
|
|
1365
|
-
sessionStartedAt: now,
|
|
1366
|
-
accumulatedRuntimeMs: 0,
|
|
1367
|
-
archiveAtMs,
|
|
1368
|
-
cleanupHandled: false,
|
|
1369
|
-
completionAnnouncedAt: void 0,
|
|
1370
|
-
wakeOnDescendantSettle: void 0,
|
|
1371
|
-
attachmentsDir: registerParams.attachmentsDir,
|
|
1372
|
-
attachmentsRootDir: registerParams.attachmentsRootDir,
|
|
1373
|
-
retainAttachmentsOnKeep: registerParams.retainAttachmentsOnKeep
|
|
1374
|
-
};
|
|
1375
|
-
params.runs.set(runId, entry);
|
|
1376
|
-
try {
|
|
1377
|
-
params.persistOrThrow();
|
|
1378
|
-
} catch (error) {
|
|
1379
|
-
params.runs.delete(runId);
|
|
1380
|
-
throw error;
|
|
1381
|
-
}
|
|
1382
|
-
try {
|
|
1383
|
-
createRunningTaskRun({
|
|
1384
|
-
runtime: "subagent",
|
|
1385
|
-
sourceId: runId,
|
|
1386
|
-
ownerKey: requesterSessionKey,
|
|
1387
|
-
scopeKind: "session",
|
|
1388
|
-
requesterOrigin,
|
|
1389
|
-
childSessionKey,
|
|
1390
|
-
runId,
|
|
1391
|
-
label: registerParams.label,
|
|
1392
|
-
task: registerParams.task,
|
|
1393
|
-
deliveryStatus: registerParams.expectsCompletionMessage === false ? "not_applicable" : "pending",
|
|
1394
|
-
startedAt: now,
|
|
1395
|
-
lastEventAt: now
|
|
1396
|
-
});
|
|
1397
|
-
} catch (error) {
|
|
1398
|
-
log$1.warn("Failed to create background task for subagent run", {
|
|
1399
|
-
runId: registerParams.runId,
|
|
1400
|
-
error
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
params.ensureListener();
|
|
1404
|
-
params.persist();
|
|
1405
|
-
params.startSweeper();
|
|
1406
|
-
waitForSubagentCompletion(runId, waitTimeoutMs, entry);
|
|
1407
|
-
};
|
|
1408
|
-
const releaseSubagentRun = (runId) => {
|
|
1409
|
-
params.clearPendingLifecycleError(runId);
|
|
1410
|
-
const entry = params.runs.get(runId);
|
|
1411
|
-
if (entry) {
|
|
1412
|
-
if (shouldDeleteAttachments(entry)) safeRemoveAttachmentsDir(entry);
|
|
1413
|
-
params.notifyContextEngineSubagentEnded({
|
|
1414
|
-
childSessionKey: entry.childSessionKey,
|
|
1415
|
-
reason: "released",
|
|
1416
|
-
agentDir: entry.agentDir,
|
|
1417
|
-
workspaceDir: entry.workspaceDir
|
|
1418
|
-
});
|
|
1419
|
-
}
|
|
1420
|
-
if (params.runs.delete(runId)) params.persist();
|
|
1421
|
-
if (params.runs.size === 0) params.stopSweeper();
|
|
1422
|
-
};
|
|
1423
|
-
const markSubagentRunTerminated = (markParams) => {
|
|
1424
|
-
const runIds = /* @__PURE__ */ new Set();
|
|
1425
|
-
if (typeof markParams.runId === "string" && markParams.runId.trim()) runIds.add(markParams.runId.trim());
|
|
1426
|
-
if (typeof markParams.childSessionKey === "string" && markParams.childSessionKey.trim()) {
|
|
1427
|
-
for (const [runId, entry] of params.runs.entries()) if (entry.childSessionKey === markParams.childSessionKey.trim()) runIds.add(runId);
|
|
1428
|
-
}
|
|
1429
|
-
if (runIds.size === 0) return 0;
|
|
1430
|
-
const now = Date.now();
|
|
1431
|
-
const reason = markParams.reason?.trim() || "killed";
|
|
1432
|
-
let updated = 0;
|
|
1433
|
-
const entriesByChildSessionKey = /* @__PURE__ */ new Map();
|
|
1434
|
-
for (const runId of runIds) {
|
|
1435
|
-
params.clearPendingLifecycleError(runId);
|
|
1436
|
-
const entry = params.runs.get(runId);
|
|
1437
|
-
if (!entry) continue;
|
|
1438
|
-
if (typeof entry.endedAt === "number") continue;
|
|
1439
|
-
entry.endedAt = now;
|
|
1440
|
-
entry.outcome = withSubagentOutcomeTiming({
|
|
1441
|
-
status: "error",
|
|
1442
|
-
error: reason
|
|
1443
|
-
}, {
|
|
1444
|
-
startedAt: entry.startedAt,
|
|
1445
|
-
endedAt: now
|
|
1446
|
-
});
|
|
1447
|
-
entry.endedReason = SUBAGENT_ENDED_REASON_KILLED;
|
|
1448
|
-
entry.cleanupHandled = true;
|
|
1449
|
-
entry.cleanupCompletedAt = now;
|
|
1450
|
-
entry.suppressAnnounceReason = "killed";
|
|
1451
|
-
if (!entriesByChildSessionKey.has(entry.childSessionKey)) entriesByChildSessionKey.set(entry.childSessionKey, entry);
|
|
1452
|
-
updated += 1;
|
|
1453
|
-
}
|
|
1454
|
-
if (updated > 0) {
|
|
1455
|
-
params.persist();
|
|
1456
|
-
for (const entry of entriesByChildSessionKey.values()) {
|
|
1457
|
-
const emitEndedHook = () => emitSubagentEndedHookOnce({
|
|
1458
|
-
entry,
|
|
1459
|
-
reason: SUBAGENT_ENDED_REASON_KILLED,
|
|
1460
|
-
sendFarewell: true,
|
|
1461
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1462
|
-
outcome: SUBAGENT_ENDED_OUTCOME_KILLED,
|
|
1463
|
-
error: reason,
|
|
1464
|
-
inFlightRunIds: params.endedHookInFlightRunIds,
|
|
1465
|
-
persist: () => params.persist()
|
|
1466
|
-
});
|
|
1467
|
-
persistSubagentSessionTiming(entry).catch((err) => {
|
|
1468
|
-
log$1.warn("failed to persist killed subagent session timing", {
|
|
1469
|
-
err,
|
|
1470
|
-
runId: entry.runId,
|
|
1471
|
-
childSessionKey: entry.childSessionKey
|
|
1472
|
-
});
|
|
1473
|
-
});
|
|
1474
|
-
if (shouldDeleteAttachments(entry)) safeRemoveAttachmentsDir(entry);
|
|
1475
|
-
params.completeCleanupBookkeeping({
|
|
1476
|
-
runId: entry.runId,
|
|
1477
|
-
entry,
|
|
1478
|
-
cleanup: entry.cleanup,
|
|
1479
|
-
completedAt: now
|
|
1480
|
-
});
|
|
1481
|
-
if (getGlobalHookRunner()) {
|
|
1482
|
-
emitEndedHook().catch(() => {});
|
|
1483
|
-
continue;
|
|
1484
|
-
}
|
|
1485
|
-
const cfg = params.getRuntimeConfig();
|
|
1486
|
-
Promise.resolve(params.ensureRuntimePluginsLoaded({
|
|
1487
|
-
config: cfg,
|
|
1488
|
-
workspaceDir: entry.workspaceDir,
|
|
1489
|
-
allowGatewaySubagentBinding: true
|
|
1490
|
-
})).then(emitEndedHook).catch(() => {});
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
return updated;
|
|
1494
|
-
};
|
|
1495
|
-
return {
|
|
1496
|
-
clearSubagentRunSteerRestart,
|
|
1497
|
-
markSubagentRunForSteerRestart,
|
|
1498
|
-
markSubagentRunTerminated,
|
|
1499
|
-
registerSubagentRun,
|
|
1500
|
-
releaseSubagentRun,
|
|
1501
|
-
replaceSubagentRunAfterSteer,
|
|
1502
|
-
waitForSubagentCompletion
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
//#endregion
|
|
1506
|
-
//#region src/agents/subagent-session-reconciliation.ts
|
|
1507
|
-
function finiteTimestamp(value) {
|
|
1508
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
1509
|
-
}
|
|
1510
|
-
function terminalSessionTimestamp(sessionEntry) {
|
|
1511
|
-
return finiteTimestamp(sessionEntry?.endedAt) ?? finiteTimestamp(sessionEntry?.updatedAt);
|
|
1512
|
-
}
|
|
1513
|
-
function isFreshForRun(sessionEntry, notBeforeMs) {
|
|
1514
|
-
if (notBeforeMs === void 0) return true;
|
|
1515
|
-
const terminalAt = terminalSessionTimestamp(sessionEntry);
|
|
1516
|
-
return terminalAt !== void 0 && terminalAt >= notBeforeMs;
|
|
1517
|
-
}
|
|
1518
|
-
function findSessionEntryByKey(store, sessionKey) {
|
|
1519
|
-
const direct = store[sessionKey];
|
|
1520
|
-
if (direct) return direct;
|
|
1521
|
-
const normalized = sessionKey.trim().toLowerCase();
|
|
1522
|
-
for (const [key, entry] of Object.entries(store)) if (key.trim().toLowerCase() === normalized) return entry;
|
|
1523
|
-
}
|
|
1524
|
-
function loadSubagentSessionEntry(params) {
|
|
1525
|
-
const key = params.childSessionKey.trim();
|
|
1526
|
-
if (!key) return;
|
|
1527
|
-
const agentId = resolveAgentIdFromSessionKey(key);
|
|
1528
|
-
const storePath = resolveStorePath((params.cfg ?? getRuntimeConfig()).session?.store, { agentId });
|
|
1529
|
-
let store = params.storeCache?.get(storePath);
|
|
1530
|
-
if (!store) {
|
|
1531
|
-
store = loadSessionStore(storePath);
|
|
1532
|
-
params.storeCache?.set(storePath, store);
|
|
1533
|
-
}
|
|
1534
|
-
return findSessionEntryByKey(store, key);
|
|
1535
|
-
}
|
|
1536
|
-
function resolveCompletionFromSessionEntry(sessionEntry, fallbackEndedAt, opts) {
|
|
1537
|
-
const status = sessionEntry?.status;
|
|
1538
|
-
const endedAt = finiteTimestamp(sessionEntry?.endedAt) ?? finiteTimestamp(sessionEntry?.updatedAt) ?? fallbackEndedAt;
|
|
1539
|
-
if (status === "done") {
|
|
1540
|
-
if (!isFreshForRun(sessionEntry, opts?.notBeforeMs)) return null;
|
|
1541
|
-
return {
|
|
1542
|
-
endedAt,
|
|
1543
|
-
outcome: { status: "ok" },
|
|
1544
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
if (status === "timeout") {
|
|
1548
|
-
if (!isFreshForRun(sessionEntry, opts?.notBeforeMs)) return null;
|
|
1549
|
-
return {
|
|
1550
|
-
endedAt,
|
|
1551
|
-
outcome: { status: "timeout" },
|
|
1552
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
if (status === "failed") {
|
|
1556
|
-
if (!isFreshForRun(sessionEntry, opts?.notBeforeMs)) return null;
|
|
1557
|
-
return {
|
|
1558
|
-
endedAt,
|
|
1559
|
-
outcome: {
|
|
1560
|
-
status: "error",
|
|
1561
|
-
error: "session completed before registry settled"
|
|
1562
|
-
},
|
|
1563
|
-
reason: SUBAGENT_ENDED_REASON_ERROR
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
|
-
if (status === "killed") {
|
|
1567
|
-
if (!isFreshForRun(sessionEntry, opts?.notBeforeMs)) return null;
|
|
1568
|
-
return {
|
|
1569
|
-
endedAt,
|
|
1570
|
-
outcome: {
|
|
1571
|
-
status: "error",
|
|
1572
|
-
error: "subagent run terminated"
|
|
1573
|
-
},
|
|
1574
|
-
reason: SUBAGENT_ENDED_REASON_KILLED
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
if (status !== "running" && typeof sessionEntry?.endedAt === "number") {
|
|
1578
|
-
if (!isFreshForRun(sessionEntry, opts?.notBeforeMs)) return null;
|
|
1579
|
-
return {
|
|
1580
|
-
endedAt,
|
|
1581
|
-
outcome: { status: "ok" },
|
|
1582
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
return null;
|
|
1586
|
-
}
|
|
1587
|
-
function resolveSubagentSessionCompletion(params) {
|
|
1588
|
-
return resolveCompletionFromSessionEntry(loadSubagentSessionEntry({
|
|
1589
|
-
childSessionKey: params.childSessionKey,
|
|
1590
|
-
storeCache: params.storeCache,
|
|
1591
|
-
cfg: params.cfg
|
|
1592
|
-
}), params.fallbackEndedAt, { notBeforeMs: params.notBeforeMs });
|
|
1593
|
-
}
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region src/agents/subagent-registry-maintenance.ts
|
|
1596
|
-
function isCleanupCompleteForMaintenance(entry) {
|
|
1597
|
-
return typeof entry.cleanupCompletedAt === "number";
|
|
1598
|
-
}
|
|
1599
|
-
function isActiveForMaintenance(entry) {
|
|
1600
|
-
return typeof entry.endedAt !== "number";
|
|
1601
|
-
}
|
|
1602
|
-
function isPendingFinalDeliveryForMaintenance(entry) {
|
|
1603
|
-
return entry.pendingFinalDelivery === true;
|
|
1604
|
-
}
|
|
1605
|
-
function isAwaitingCompletionAnnounceForMaintenance(entry) {
|
|
1606
|
-
return entry.expectsCompletionMessage === true && typeof entry.completionAnnouncedAt !== "number";
|
|
1607
|
-
}
|
|
1608
|
-
function shouldPreserveForMaintenance(entry) {
|
|
1609
|
-
if (isCleanupCompleteForMaintenance(entry)) return false;
|
|
1610
|
-
if (isActiveForMaintenance(entry)) return true;
|
|
1611
|
-
return isAwaitingCompletionAnnounceForMaintenance(entry) || isPendingFinalDeliveryForMaintenance(entry);
|
|
1612
|
-
}
|
|
1613
|
-
function listSessionMaintenanceProtectedSubagentSessionKeys() {
|
|
1614
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1615
|
-
for (const entry of getSubagentRunsSnapshotForRead(subagentRuns).values()) {
|
|
1616
|
-
if (!shouldPreserveForMaintenance(entry)) continue;
|
|
1617
|
-
const childSessionKey = entry.childSessionKey.trim();
|
|
1618
|
-
if (childSessionKey) keys.add(childSessionKey);
|
|
1619
|
-
}
|
|
1620
|
-
return [...keys];
|
|
1621
|
-
}
|
|
1622
|
-
registerSessionMaintenancePreserveKeysProvider(listSessionMaintenanceProtectedSubagentSessionKeys);
|
|
1623
|
-
//#endregion
|
|
1624
|
-
//#region src/agents/subagent-registry.ts
|
|
1625
|
-
const log = createSubsystemLogger("agents/subagent-registry");
|
|
1626
|
-
const subagentAnnounceLoader = createLazyImportLoader(() => import("./subagent-announce-hatA_PZ2.js"));
|
|
1627
|
-
const browserCleanupLoader = createLazyImportLoader(() => import("./browser-lifecycle-cleanup-C9X09Vrg.js"));
|
|
1628
|
-
async function loadSubagentAnnounceModule() {
|
|
1629
|
-
return await subagentAnnounceLoader.load();
|
|
1630
|
-
}
|
|
1631
|
-
async function loadCleanupBrowserSessionsForLifecycleEnd() {
|
|
1632
|
-
return (await browserCleanupLoader.load()).cleanupBrowserSessionsForLifecycleEnd;
|
|
1633
|
-
}
|
|
1634
|
-
let subagentRegistryDeps = {
|
|
1635
|
-
callGateway,
|
|
1636
|
-
captureSubagentCompletionReply: async (sessionKey, options) => (await loadSubagentAnnounceModule()).captureSubagentCompletionReply(sessionKey, options),
|
|
1637
|
-
cleanupBrowserSessionsForLifecycleEnd: async (params) => (await loadCleanupBrowserSessionsForLifecycleEnd())(params),
|
|
1638
|
-
getSubagentRunsSnapshotForRead,
|
|
1639
|
-
getRuntimeConfig,
|
|
1640
|
-
onAgentEvent,
|
|
1641
|
-
persistSubagentRunsToDisk,
|
|
1642
|
-
persistSubagentRunsToDiskOrThrow,
|
|
1643
|
-
resolveAgentTimeoutMs,
|
|
1644
|
-
restoreSubagentRunsFromDisk,
|
|
1645
|
-
runSubagentAnnounceFlow: async (params) => (await loadSubagentAnnounceModule()).runSubagentAnnounceFlow(params)
|
|
1646
|
-
};
|
|
1647
|
-
const SUBAGENT_REGISTRY_RUNTIME_SPEC = ["./subagent-registry.runtime", ".js"];
|
|
1648
|
-
const contextEngineInitLoader = createLazyPromiseLoader(() => importRuntimeModule(import.meta.url, SUBAGENT_REGISTRY_RUNTIME_SPEC));
|
|
1649
|
-
const contextEngineRegistryLoader = createLazyPromiseLoader(() => importRuntimeModule(import.meta.url, SUBAGENT_REGISTRY_RUNTIME_SPEC));
|
|
1650
|
-
const runtimePluginsLoader = createLazyPromiseLoader(() => importRuntimeModule(import.meta.url, SUBAGENT_REGISTRY_RUNTIME_SPEC));
|
|
1651
|
-
let sweeper = null;
|
|
1652
|
-
const resumeRetryTimers = /* @__PURE__ */ new Set();
|
|
1653
|
-
let sweepInProgress = false;
|
|
1654
|
-
let listenerStarted = false;
|
|
1655
|
-
let restoreAttempted = false;
|
|
1656
|
-
const ORPHAN_RECOVERY_DEBOUNCE_MS = 1e3;
|
|
1657
|
-
let lastOrphanRecoveryScheduleAt = 0;
|
|
1658
|
-
const SUBAGENT_ANNOUNCE_TIMEOUT_MS = 12e4;
|
|
1659
|
-
/**
|
|
1660
|
-
* Embedded runs can emit transient lifecycle `error` events while provider/model
|
|
1661
|
-
* retry is still in progress. Defer terminal error cleanup briefly so a
|
|
1662
|
-
* subsequent lifecycle `start` / `end` can cancel premature failure announces.
|
|
1663
|
-
*/
|
|
1664
|
-
const LIFECYCLE_ERROR_RETRY_GRACE_MS = 15e3;
|
|
1665
|
-
/**
|
|
1666
|
-
* Embedded runs can also surface an intermediate lifecycle `end` with
|
|
1667
|
-
* `aborted=true` just before the runtime automatically retries the same run.
|
|
1668
|
-
* Give that timeout a short grace window so the parent does not get a stale
|
|
1669
|
-
* `timed out` completion right before the eventual success.
|
|
1670
|
-
*/
|
|
1671
|
-
const LIFECYCLE_TIMEOUT_RETRY_GRACE_MS = 15e3;
|
|
1672
|
-
/** Absolute TTL for session-mode runs after cleanup completes (no archiveAtMs). */
|
|
1673
|
-
const SESSION_RUN_TTL_MS = 5 * 6e4;
|
|
1674
|
-
/** Absolute TTL for orphaned pendingLifecycleError / pendingLifecycleTimeout entries. */
|
|
1675
|
-
const PENDING_LIFECYCLE_TERMINAL_TTL_MS = 5 * 6e4;
|
|
1676
|
-
/** Grace period before treating a "running" subagent without a live run context as stale. */
|
|
1677
|
-
const STALE_ACTIVE_SUBAGENT_GRACE_MS = process.env.DAOCORE_TEST_FAST === "1" ? 1e3 : 6e4;
|
|
1678
|
-
const SUSPENDED_DELIVERY_CRON_EXPIRY_MS = 120 * 6e4;
|
|
1679
|
-
const SUSPENDED_DELIVERY_SUBAGENT_EXPIRY_MS = 360 * 6e4;
|
|
1680
|
-
const SUSPENDED_DELIVERY_INTERACTIVE_EXPIRY_MS = 1440 * 6e4;
|
|
1681
|
-
const SUSPENDED_DELIVERY_SOFT_CAP = 25;
|
|
1682
|
-
const SUSPENDED_DELIVERY_HARD_CAP = 50;
|
|
1683
|
-
const SUSPENDED_DELIVERY_PRESSURE_TARGET = 10;
|
|
1684
|
-
function loadContextEngineInitModule() {
|
|
1685
|
-
return contextEngineInitLoader.load();
|
|
1686
|
-
}
|
|
1687
|
-
function loadContextEngineRegistryModule() {
|
|
1688
|
-
return contextEngineRegistryLoader.load();
|
|
1689
|
-
}
|
|
1690
|
-
function loadRuntimePluginsModule() {
|
|
1691
|
-
return runtimePluginsLoader.load();
|
|
1692
|
-
}
|
|
1693
|
-
async function ensureSubagentRegistryPluginRuntimeLoaded(params) {
|
|
1694
|
-
const ensureRuntimePluginsLoaded = subagentRegistryDeps.ensureRuntimePluginsLoaded;
|
|
1695
|
-
if (ensureRuntimePluginsLoaded) {
|
|
1696
|
-
ensureRuntimePluginsLoaded(params);
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
(await loadRuntimePluginsModule()).ensureRuntimePluginsLoaded(params);
|
|
1700
|
-
}
|
|
1701
|
-
async function resolveSubagentRegistryContextEngine(cfg, options) {
|
|
1702
|
-
const initModule = await loadContextEngineInitModule();
|
|
1703
|
-
const registryModule = await loadContextEngineRegistryModule();
|
|
1704
|
-
const ensureContextEnginesInitialized = subagentRegistryDeps.ensureContextEnginesInitialized ?? initModule.ensureContextEnginesInitialized;
|
|
1705
|
-
const resolveContextEngine = subagentRegistryDeps.resolveContextEngine ?? registryModule.resolveContextEngine;
|
|
1706
|
-
ensureContextEnginesInitialized();
|
|
1707
|
-
return await resolveContextEngine(cfg, options);
|
|
1708
|
-
}
|
|
1709
|
-
function persistSubagentRuns() {
|
|
1710
|
-
subagentRegistryDeps.persistSubagentRunsToDisk(subagentRuns);
|
|
1711
|
-
}
|
|
1712
|
-
function persistSubagentRunsOrThrow() {
|
|
1713
|
-
subagentRegistryDeps.persistSubagentRunsToDiskOrThrow(subagentRuns);
|
|
1714
|
-
}
|
|
1715
|
-
function scheduleSubagentOrphanRecovery(params) {
|
|
1716
|
-
const now = Date.now();
|
|
1717
|
-
if (now - lastOrphanRecoveryScheduleAt < ORPHAN_RECOVERY_DEBOUNCE_MS) return;
|
|
1718
|
-
lastOrphanRecoveryScheduleAt = now;
|
|
1719
|
-
import("./subagent-orphan-recovery-Bq9zvX3L.js").then(({ scheduleOrphanRecovery }) => {
|
|
1720
|
-
scheduleOrphanRecovery({
|
|
1721
|
-
getActiveRuns: () => subagentRuns,
|
|
1722
|
-
delayMs: params?.delayMs,
|
|
1723
|
-
maxRetries: params?.maxRetries
|
|
1724
|
-
});
|
|
1725
|
-
}, () => {});
|
|
1726
|
-
}
|
|
1727
|
-
const resumedRuns = /* @__PURE__ */ new Set();
|
|
1728
|
-
const endedHookInFlightRunIds = /* @__PURE__ */ new Set();
|
|
1729
|
-
const pendingLifecycleErrorByRunId = /* @__PURE__ */ new Map();
|
|
1730
|
-
const pendingLifecycleTimeoutByRunId = /* @__PURE__ */ new Map();
|
|
1731
|
-
function clearPendingLifecycleError(runId) {
|
|
1732
|
-
const pending = pendingLifecycleErrorByRunId.get(runId);
|
|
1733
|
-
if (!pending) return;
|
|
1734
|
-
clearTimeout(pending.timer);
|
|
1735
|
-
pendingLifecycleErrorByRunId.delete(runId);
|
|
1736
|
-
}
|
|
1737
|
-
function clearPendingLifecycleTimeout(runId) {
|
|
1738
|
-
const pending = pendingLifecycleTimeoutByRunId.get(runId);
|
|
1739
|
-
if (!pending) return;
|
|
1740
|
-
clearTimeout(pending.timer);
|
|
1741
|
-
pendingLifecycleTimeoutByRunId.delete(runId);
|
|
1742
|
-
}
|
|
1743
|
-
function schedulePendingLifecycleError(params) {
|
|
1744
|
-
clearPendingLifecycleTimeout(params.runId);
|
|
1745
|
-
clearPendingLifecycleError(params.runId);
|
|
1746
|
-
const timer = setTimeout(() => {
|
|
1747
|
-
const pending = pendingLifecycleErrorByRunId.get(params.runId);
|
|
1748
|
-
if (!pending || pending.timer !== timer) return;
|
|
1749
|
-
pendingLifecycleErrorByRunId.delete(params.runId);
|
|
1750
|
-
const entry = subagentRuns.get(params.runId);
|
|
1751
|
-
if (!entry) return;
|
|
1752
|
-
if (entry.endedReason === "subagent-complete" || entry.outcome?.status === "ok") return;
|
|
1753
|
-
completeSubagentRun({
|
|
1754
|
-
runId: params.runId,
|
|
1755
|
-
endedAt: pending.endedAt,
|
|
1756
|
-
outcome: {
|
|
1757
|
-
status: "error",
|
|
1758
|
-
error: pending.error
|
|
1759
|
-
},
|
|
1760
|
-
reason: SUBAGENT_ENDED_REASON_ERROR,
|
|
1761
|
-
sendFarewell: true,
|
|
1762
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1763
|
-
triggerCleanup: true
|
|
1764
|
-
});
|
|
1765
|
-
}, LIFECYCLE_ERROR_RETRY_GRACE_MS);
|
|
1766
|
-
timer.unref?.();
|
|
1767
|
-
pendingLifecycleErrorByRunId.set(params.runId, {
|
|
1768
|
-
timer,
|
|
1769
|
-
endedAt: params.endedAt,
|
|
1770
|
-
error: params.error
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
function schedulePendingLifecycleTimeout(params) {
|
|
1774
|
-
clearPendingLifecycleError(params.runId);
|
|
1775
|
-
clearPendingLifecycleTimeout(params.runId);
|
|
1776
|
-
const timer = setTimeout(() => {
|
|
1777
|
-
const pending = pendingLifecycleTimeoutByRunId.get(params.runId);
|
|
1778
|
-
if (!pending || pending.timer !== timer) return;
|
|
1779
|
-
pendingLifecycleTimeoutByRunId.delete(params.runId);
|
|
1780
|
-
const entry = subagentRuns.get(params.runId);
|
|
1781
|
-
if (!entry) return;
|
|
1782
|
-
if (entry.outcome?.status === "ok") return;
|
|
1783
|
-
completeSubagentRun({
|
|
1784
|
-
runId: params.runId,
|
|
1785
|
-
endedAt: pending.endedAt,
|
|
1786
|
-
outcome: { status: "timeout" },
|
|
1787
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE,
|
|
1788
|
-
sendFarewell: true,
|
|
1789
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
1790
|
-
triggerCleanup: true
|
|
1791
|
-
});
|
|
1792
|
-
}, LIFECYCLE_TIMEOUT_RETRY_GRACE_MS);
|
|
1793
|
-
timer.unref?.();
|
|
1794
|
-
pendingLifecycleTimeoutByRunId.set(params.runId, {
|
|
1795
|
-
timer,
|
|
1796
|
-
endedAt: params.endedAt
|
|
1797
|
-
});
|
|
1798
|
-
}
|
|
1799
|
-
async function notifyContextEngineSubagentEnded(params) {
|
|
1800
|
-
try {
|
|
1801
|
-
const cfg = subagentRegistryDeps.getRuntimeConfig();
|
|
1802
|
-
await ensureSubagentRegistryPluginRuntimeLoaded({
|
|
1803
|
-
config: cfg,
|
|
1804
|
-
workspaceDir: params.workspaceDir,
|
|
1805
|
-
allowGatewaySubagentBinding: true
|
|
1806
|
-
});
|
|
1807
|
-
const engine = await resolveSubagentRegistryContextEngine(cfg, {
|
|
1808
|
-
agentDir: params.agentDir,
|
|
1809
|
-
workspaceDir: params.workspaceDir
|
|
1810
|
-
});
|
|
1811
|
-
if (!engine.onSubagentEnded) return;
|
|
1812
|
-
await engine.onSubagentEnded(params);
|
|
1813
|
-
} catch (err) {
|
|
1814
|
-
log.warn("context-engine onSubagentEnded failed (best-effort)", { err });
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
function suppressAnnounceForSteerRestart(entry) {
|
|
1818
|
-
return entry?.suppressAnnounceReason === "steer-restart";
|
|
1819
|
-
}
|
|
1820
|
-
function shouldKeepThreadBindingAfterRun(params) {
|
|
1821
|
-
if (params.reason === "subagent-killed") return false;
|
|
1822
|
-
return params.entry.spawnMode === "session";
|
|
1823
|
-
}
|
|
1824
|
-
function shouldEmitEndedHookForRun(params) {
|
|
1825
|
-
return !shouldKeepThreadBindingAfterRun(params);
|
|
1826
|
-
}
|
|
1827
|
-
async function emitSubagentEndedHookForRun(params) {
|
|
1828
|
-
if (params.entry.endedHookEmittedAt) return;
|
|
1829
|
-
await ensureSubagentRegistryPluginRuntimeLoaded({
|
|
1830
|
-
config: subagentRegistryDeps.getRuntimeConfig(),
|
|
1831
|
-
workspaceDir: params.entry.workspaceDir,
|
|
1832
|
-
allowGatewaySubagentBinding: true
|
|
1833
|
-
});
|
|
1834
|
-
const reason = params.reason ?? params.entry.endedReason ?? "subagent-complete";
|
|
1835
|
-
const outcome = resolveLifecycleOutcomeFromRunOutcome(params.entry.outcome);
|
|
1836
|
-
const error = params.entry.outcome?.status === "error" ? params.entry.outcome.error : void 0;
|
|
1837
|
-
await emitSubagentEndedHookOnce({
|
|
1838
|
-
entry: params.entry,
|
|
1839
|
-
reason,
|
|
1840
|
-
sendFarewell: params.sendFarewell,
|
|
1841
|
-
accountId: params.accountId ?? params.entry.requesterOrigin?.accountId,
|
|
1842
|
-
outcome,
|
|
1843
|
-
error,
|
|
1844
|
-
inFlightRunIds: endedHookInFlightRunIds,
|
|
1845
|
-
persist: persistSubagentRuns
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
const { clearScheduledResumeTimers, completeCleanupBookkeeping, completeSubagentRun, finalizeResumedAnnounceGiveUp, refreshFrozenResultFromSession, startSubagentAnnounceCleanupFlow } = createSubagentRegistryLifecycleController({
|
|
1849
|
-
runs: subagentRuns,
|
|
1850
|
-
resumedRuns,
|
|
1851
|
-
subagentAnnounceTimeoutMs: SUBAGENT_ANNOUNCE_TIMEOUT_MS,
|
|
1852
|
-
persist: persistSubagentRuns,
|
|
1853
|
-
clearPendingLifecycleError,
|
|
1854
|
-
countPendingDescendantRuns,
|
|
1855
|
-
suppressAnnounceForSteerRestart,
|
|
1856
|
-
shouldEmitEndedHookForRun,
|
|
1857
|
-
emitSubagentEndedHookForRun,
|
|
1858
|
-
notifyContextEngineSubagentEnded,
|
|
1859
|
-
resumeSubagentRun,
|
|
1860
|
-
callGateway: (request) => subagentRegistryDeps.callGateway(request),
|
|
1861
|
-
captureSubagentCompletionReply: (sessionKey, options) => subagentRegistryDeps.captureSubagentCompletionReply(sessionKey, options),
|
|
1862
|
-
cleanupBrowserSessionsForLifecycleEnd: (args) => subagentRegistryDeps.cleanupBrowserSessionsForLifecycleEnd(args),
|
|
1863
|
-
runSubagentAnnounceFlow: (params) => subagentRegistryDeps.runSubagentAnnounceFlow(params),
|
|
1864
|
-
warn: (message, meta) => log.warn(message, meta)
|
|
1865
|
-
});
|
|
1866
|
-
function resumeSubagentRun(runId) {
|
|
1867
|
-
if (!runId || resumedRuns.has(runId)) return;
|
|
1868
|
-
const entry = subagentRuns.get(runId);
|
|
1869
|
-
if (!entry) return;
|
|
1870
|
-
if (entry.cleanupCompletedAt) return;
|
|
1871
|
-
if (typeof entry.endedAt === "number" && entry.pendingFinalDelivery === true && typeof entry.deliverySuspendedAt === "number") return;
|
|
1872
|
-
if (entry.pauseReason === "sessions_yield") return;
|
|
1873
|
-
if ((entry.announceRetryCount ?? 0) >= 3) {
|
|
1874
|
-
finalizeResumedAnnounceGiveUp({
|
|
1875
|
-
runId,
|
|
1876
|
-
entry,
|
|
1877
|
-
reason: "retry-limit"
|
|
1878
|
-
});
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
if (entry.expectsCompletionMessage !== true && typeof entry.endedAt === "number" && Date.now() - entry.endedAt > 3e5) {
|
|
1882
|
-
finalizeResumedAnnounceGiveUp({
|
|
1883
|
-
runId,
|
|
1884
|
-
entry,
|
|
1885
|
-
reason: "expiry"
|
|
1886
|
-
});
|
|
1887
|
-
return;
|
|
1888
|
-
}
|
|
1889
|
-
const now = Date.now();
|
|
1890
|
-
const delayMs = resolveAnnounceRetryDelayMs(entry.announceRetryCount ?? 0);
|
|
1891
|
-
const earliestRetryAt = (entry.lastAnnounceRetryAt ?? 0) + delayMs;
|
|
1892
|
-
if (entry.expectsCompletionMessage === true && entry.lastAnnounceRetryAt && now < earliestRetryAt) {
|
|
1893
|
-
const waitMs = Math.max(1, earliestRetryAt - now);
|
|
1894
|
-
const scheduledEntry = entry;
|
|
1895
|
-
const timer = setTimeout(() => {
|
|
1896
|
-
resumeRetryTimers.delete(timer);
|
|
1897
|
-
if (subagentRuns.get(runId) !== scheduledEntry) return;
|
|
1898
|
-
resumedRuns.delete(runId);
|
|
1899
|
-
resumeSubagentRun(runId);
|
|
1900
|
-
}, waitMs);
|
|
1901
|
-
timer.unref?.();
|
|
1902
|
-
resumeRetryTimers.add(timer);
|
|
1903
|
-
resumedRuns.add(runId);
|
|
1904
|
-
return;
|
|
1905
|
-
}
|
|
1906
|
-
if (typeof entry.endedAt === "number" && entry.endedAt > 0) {
|
|
1907
|
-
const orphanReason = resolveSubagentRunOrphanReason({ entry });
|
|
1908
|
-
if (orphanReason) {
|
|
1909
|
-
if (reconcileOrphanedRun({
|
|
1910
|
-
runId,
|
|
1911
|
-
entry,
|
|
1912
|
-
reason: orphanReason,
|
|
1913
|
-
source: "resume",
|
|
1914
|
-
runs: subagentRuns,
|
|
1915
|
-
resumedRuns
|
|
1916
|
-
})) persistSubagentRuns();
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
if (suppressAnnounceForSteerRestart(entry)) {
|
|
1920
|
-
resumedRuns.add(runId);
|
|
1921
|
-
return;
|
|
1922
|
-
}
|
|
1923
|
-
if (!startSubagentAnnounceCleanupFlow(runId, entry)) return;
|
|
1924
|
-
resumedRuns.add(runId);
|
|
1925
|
-
return;
|
|
1926
|
-
}
|
|
1927
|
-
const waitTimeoutMs = resolveSubagentWaitTimeoutMs(subagentRegistryDeps.getRuntimeConfig(), entry.runTimeoutSeconds);
|
|
1928
|
-
subagentRunManager.waitForSubagentCompletion(runId, waitTimeoutMs, entry);
|
|
1929
|
-
resumedRuns.add(runId);
|
|
1930
|
-
}
|
|
1931
|
-
function restoreSubagentRunsOnce() {
|
|
1932
|
-
if (restoreAttempted) return;
|
|
1933
|
-
restoreAttempted = true;
|
|
1934
|
-
try {
|
|
1935
|
-
if (subagentRegistryDeps.restoreSubagentRunsFromDisk({
|
|
1936
|
-
runs: subagentRuns,
|
|
1937
|
-
mergeOnly: true
|
|
1938
|
-
}) === 0) return;
|
|
1939
|
-
if (reconcileOrphanedRestoredRuns({
|
|
1940
|
-
runs: subagentRuns,
|
|
1941
|
-
resumedRuns
|
|
1942
|
-
})) persistSubagentRuns();
|
|
1943
|
-
if (subagentRuns.size === 0) return;
|
|
1944
|
-
ensureListener();
|
|
1945
|
-
startSweeper();
|
|
1946
|
-
for (const runId of subagentRuns.keys()) resumeSubagentRun(runId);
|
|
1947
|
-
scheduleSubagentOrphanRecovery();
|
|
1948
|
-
} catch {}
|
|
1949
|
-
}
|
|
1950
|
-
function resolveSubagentWaitTimeoutMs(cfg, runTimeoutSeconds) {
|
|
1951
|
-
return subagentRegistryDeps.resolveAgentTimeoutMs({
|
|
1952
|
-
cfg,
|
|
1953
|
-
overrideSeconds: runTimeoutSeconds ?? 0
|
|
1954
|
-
});
|
|
1955
|
-
}
|
|
1956
|
-
function startSweeper() {
|
|
1957
|
-
if (sweeper) return;
|
|
1958
|
-
sweeper = setInterval(() => {
|
|
1959
|
-
if (sweepInProgress) return;
|
|
1960
|
-
sweepSubagentRuns();
|
|
1961
|
-
}, 6e4);
|
|
1962
|
-
sweeper.unref?.();
|
|
1963
|
-
}
|
|
1964
|
-
function stopSweeper() {
|
|
1965
|
-
if (!sweeper) return;
|
|
1966
|
-
clearInterval(sweeper);
|
|
1967
|
-
sweeper = null;
|
|
1968
|
-
}
|
|
1969
|
-
function isSuspendedPendingFinalDelivery(entry) {
|
|
1970
|
-
return typeof entry.endedAt === "number" && entry.pendingFinalDelivery === true && typeof entry.deliverySuspendedAt === "number";
|
|
1971
|
-
}
|
|
1972
|
-
function resolveSuspendedDeliveryExpiryMs(entry) {
|
|
1973
|
-
const requester = entry.requesterSessionKey;
|
|
1974
|
-
if (requester.includes(":cron:")) return SUSPENDED_DELIVERY_CRON_EXPIRY_MS;
|
|
1975
|
-
if (requester.includes(":subagent:")) return SUSPENDED_DELIVERY_SUBAGENT_EXPIRY_MS;
|
|
1976
|
-
return SUSPENDED_DELIVERY_INTERACTIVE_EXPIRY_MS;
|
|
1977
|
-
}
|
|
1978
|
-
async function discardSuspendedPendingFinalDelivery(runId, entry, now, reason) {
|
|
1979
|
-
const payload = entry.pendingFinalDeliveryPayload;
|
|
1980
|
-
entry.deliveryDiscardedAt = now;
|
|
1981
|
-
entry.deliveryDiscardReason = reason;
|
|
1982
|
-
entry.deliveryDiscardedPayloadSummary = {
|
|
1983
|
-
requesterSessionKey: payload?.requesterSessionKey ?? entry.requesterSessionKey,
|
|
1984
|
-
childSessionKey: payload?.childSessionKey ?? entry.childSessionKey,
|
|
1985
|
-
childRunId: payload?.childRunId ?? entry.runId,
|
|
1986
|
-
endedAt: payload?.endedAt ?? entry.endedAt,
|
|
1987
|
-
status: payload?.outcome?.status ?? entry.outcome?.status,
|
|
1988
|
-
lastError: entry.lastAnnounceDeliveryError ?? entry.pendingFinalDeliveryLastError ?? null
|
|
1989
|
-
};
|
|
1990
|
-
entry.pendingFinalDelivery = void 0;
|
|
1991
|
-
entry.pendingFinalDeliveryCreatedAt = void 0;
|
|
1992
|
-
entry.pendingFinalDeliveryLastAttemptAt = void 0;
|
|
1993
|
-
entry.pendingFinalDeliveryAttemptCount = void 0;
|
|
1994
|
-
entry.pendingFinalDeliveryLastError = void 0;
|
|
1995
|
-
entry.pendingFinalDeliveryPayload = void 0;
|
|
1996
|
-
entry.deliverySuspendedAt = void 0;
|
|
1997
|
-
entry.deliverySuspendedReason = void 0;
|
|
1998
|
-
entry.wakeOnDescendantSettle = void 0;
|
|
1999
|
-
entry.fallbackFrozenResultText = void 0;
|
|
2000
|
-
entry.fallbackFrozenResultCapturedAt = void 0;
|
|
2001
|
-
entry.cleanupHandled = true;
|
|
2002
|
-
entry.completionAnnouncedAt = void 0;
|
|
2003
|
-
resumedRuns.delete(runId);
|
|
2004
|
-
clearPendingLifecycleError(runId);
|
|
2005
|
-
clearPendingLifecycleTimeout(runId);
|
|
2006
|
-
log.warn("subagent suspended delivery discarded", {
|
|
2007
|
-
reason,
|
|
2008
|
-
runId: entry.runId,
|
|
2009
|
-
childSessionKey: entry.childSessionKey,
|
|
2010
|
-
requesterSessionKey: entry.requesterSessionKey
|
|
2011
|
-
});
|
|
2012
|
-
if (entry.cleanup === "delete" || !entry.retainAttachmentsOnKeep) await safeRemoveAttachmentsDir(entry);
|
|
2013
|
-
const completionReason = entry.endedReason ?? "subagent-complete";
|
|
2014
|
-
completeCleanupBookkeeping({
|
|
2015
|
-
runId,
|
|
2016
|
-
entry,
|
|
2017
|
-
cleanup: entry.cleanup,
|
|
2018
|
-
completedAt: now
|
|
2019
|
-
});
|
|
2020
|
-
if (entry.expectsCompletionMessage === true && shouldEmitEndedHookForRun({
|
|
2021
|
-
entry,
|
|
2022
|
-
reason: completionReason
|
|
2023
|
-
})) await emitSubagentEndedHookForRun({
|
|
2024
|
-
entry,
|
|
2025
|
-
reason: completionReason,
|
|
2026
|
-
sendFarewell: true
|
|
2027
|
-
});
|
|
2028
|
-
}
|
|
2029
|
-
async function sweepSubagentRuns() {
|
|
2030
|
-
if (sweepInProgress) return;
|
|
2031
|
-
sweepInProgress = true;
|
|
2032
|
-
try {
|
|
2033
|
-
const now = Date.now();
|
|
2034
|
-
const storeCache = /* @__PURE__ */ new Map();
|
|
2035
|
-
let mutated = false;
|
|
2036
|
-
const suspendedEntries = [...subagentRuns.entries()].filter(([, entry]) => isSuspendedPendingFinalDelivery(entry));
|
|
2037
|
-
const pressureDiscardRunIds = /* @__PURE__ */ new Set();
|
|
2038
|
-
if (suspendedEntries.length > SUSPENDED_DELIVERY_HARD_CAP) {
|
|
2039
|
-
const pressureCount = Math.max(0, suspendedEntries.length - SUSPENDED_DELIVERY_PRESSURE_TARGET);
|
|
2040
|
-
for (const [runId] of suspendedEntries.toSorted((a, b) => (a[1].deliverySuspendedAt ?? 0) - (b[1].deliverySuspendedAt ?? 0)).slice(0, pressureCount)) pressureDiscardRunIds.add(runId);
|
|
2041
|
-
log.warn("subagent suspended delivery backlog exceeded pressure cap", {
|
|
2042
|
-
suspendedCount: suspendedEntries.length,
|
|
2043
|
-
softCap: SUSPENDED_DELIVERY_SOFT_CAP,
|
|
2044
|
-
hardCap: SUSPENDED_DELIVERY_HARD_CAP,
|
|
2045
|
-
pressureTarget: SUSPENDED_DELIVERY_PRESSURE_TARGET,
|
|
2046
|
-
pressureDiscardCount: pressureDiscardRunIds.size
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
for (const [runId, entry] of subagentRuns.entries()) {
|
|
2050
|
-
if (isSuspendedPendingFinalDelivery(entry)) {
|
|
2051
|
-
const expired = now - (entry.deliverySuspendedAt ?? now) >= resolveSuspendedDeliveryExpiryMs(entry);
|
|
2052
|
-
if (expired || pressureDiscardRunIds.has(runId)) {
|
|
2053
|
-
await discardSuspendedPendingFinalDelivery(runId, entry, now, expired ? "expired" : "pressure-pruned");
|
|
2054
|
-
mutated = true;
|
|
2055
|
-
}
|
|
2056
|
-
continue;
|
|
2057
|
-
}
|
|
2058
|
-
if (typeof entry.endedAt !== "number") {
|
|
2059
|
-
const hasLiveRunContext = Boolean(getAgentRunContext(runId));
|
|
2060
|
-
const activeAgeMs = now - (entry.startedAt ?? entry.createdAt);
|
|
2061
|
-
if (!hasLiveRunContext && activeAgeMs >= STALE_ACTIVE_SUBAGENT_GRACE_MS) {
|
|
2062
|
-
const orphanReason = resolveSubagentRunOrphanReason({
|
|
2063
|
-
entry,
|
|
2064
|
-
storeCache
|
|
2065
|
-
});
|
|
2066
|
-
if (orphanReason) {
|
|
2067
|
-
if (reconcileOrphanedRun({
|
|
2068
|
-
runId,
|
|
2069
|
-
entry,
|
|
2070
|
-
reason: orphanReason,
|
|
2071
|
-
source: "resume",
|
|
2072
|
-
runs: subagentRuns,
|
|
2073
|
-
resumedRuns
|
|
2074
|
-
})) mutated = true;
|
|
2075
|
-
continue;
|
|
2076
|
-
}
|
|
2077
|
-
const sessionEntry = loadSubagentSessionEntry({
|
|
2078
|
-
childSessionKey: entry.childSessionKey,
|
|
2079
|
-
storeCache
|
|
2080
|
-
});
|
|
2081
|
-
const completion = resolveCompletionFromSessionEntry(sessionEntry, now, { notBeforeMs: entry.startedAt ?? entry.createdAt });
|
|
2082
|
-
if (completion) {
|
|
2083
|
-
await completeSubagentRun({
|
|
2084
|
-
runId,
|
|
2085
|
-
endedAt: completion.endedAt,
|
|
2086
|
-
outcome: completion.outcome,
|
|
2087
|
-
reason: completion.reason,
|
|
2088
|
-
sendFarewell: true,
|
|
2089
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
2090
|
-
triggerCleanup: true
|
|
2091
|
-
});
|
|
2092
|
-
continue;
|
|
2093
|
-
}
|
|
2094
|
-
if (sessionEntry?.abortedLastRun === true) {
|
|
2095
|
-
scheduleSubagentOrphanRecovery({ delayMs: 1e3 });
|
|
2096
|
-
continue;
|
|
2097
|
-
}
|
|
2098
|
-
await completeSubagentRun({
|
|
2099
|
-
runId,
|
|
2100
|
-
endedAt: now,
|
|
2101
|
-
outcome: {
|
|
2102
|
-
status: "error",
|
|
2103
|
-
error: "subagent run lost active execution context"
|
|
2104
|
-
},
|
|
2105
|
-
reason: SUBAGENT_ENDED_REASON_ERROR,
|
|
2106
|
-
sendFarewell: true,
|
|
2107
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
2108
|
-
triggerCleanup: true
|
|
2109
|
-
});
|
|
2110
|
-
continue;
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
if (!entry.archiveAtMs && entry.cleanup === "keep" && entry.spawnMode !== "session") continue;
|
|
2114
|
-
if (!entry.archiveAtMs) {
|
|
2115
|
-
if (typeof entry.cleanupCompletedAt === "number" && now - entry.cleanupCompletedAt > SESSION_RUN_TTL_MS) {
|
|
2116
|
-
clearPendingLifecycleError(runId);
|
|
2117
|
-
notifyContextEngineSubagentEnded({
|
|
2118
|
-
childSessionKey: entry.childSessionKey,
|
|
2119
|
-
reason: "swept",
|
|
2120
|
-
agentDir: entry.agentDir,
|
|
2121
|
-
workspaceDir: entry.workspaceDir
|
|
2122
|
-
});
|
|
2123
|
-
subagentRuns.delete(runId);
|
|
2124
|
-
mutated = true;
|
|
2125
|
-
if (!entry.retainAttachmentsOnKeep) await safeRemoveAttachmentsDir(entry);
|
|
2126
|
-
}
|
|
2127
|
-
continue;
|
|
2128
|
-
}
|
|
2129
|
-
if (entry.archiveAtMs > now) continue;
|
|
2130
|
-
clearPendingLifecycleError(runId);
|
|
2131
|
-
try {
|
|
2132
|
-
await subagentRegistryDeps.callGateway({
|
|
2133
|
-
method: "sessions.delete",
|
|
2134
|
-
params: {
|
|
2135
|
-
key: entry.childSessionKey,
|
|
2136
|
-
deleteTranscript: true,
|
|
2137
|
-
emitLifecycleHooks: false
|
|
2138
|
-
},
|
|
2139
|
-
timeoutMs: 1e4
|
|
2140
|
-
});
|
|
2141
|
-
} catch (err) {
|
|
2142
|
-
log.warn("sessions.delete failed during subagent sweep; keeping run for retry", {
|
|
2143
|
-
runId,
|
|
2144
|
-
childSessionKey: entry.childSessionKey,
|
|
2145
|
-
err
|
|
2146
|
-
});
|
|
2147
|
-
continue;
|
|
2148
|
-
}
|
|
2149
|
-
subagentRuns.delete(runId);
|
|
2150
|
-
mutated = true;
|
|
2151
|
-
await safeRemoveAttachmentsDir(entry);
|
|
2152
|
-
notifyContextEngineSubagentEnded({
|
|
2153
|
-
childSessionKey: entry.childSessionKey,
|
|
2154
|
-
reason: "swept",
|
|
2155
|
-
agentDir: entry.agentDir,
|
|
2156
|
-
workspaceDir: entry.workspaceDir
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
for (const [runId, pending] of pendingLifecycleErrorByRunId.entries()) if (now - pending.endedAt > PENDING_LIFECYCLE_TERMINAL_TTL_MS) clearPendingLifecycleError(runId);
|
|
2160
|
-
for (const [runId, pending] of pendingLifecycleTimeoutByRunId.entries()) if (now - pending.endedAt > PENDING_LIFECYCLE_TERMINAL_TTL_MS) clearPendingLifecycleTimeout(runId);
|
|
2161
|
-
if (mutated) persistSubagentRuns();
|
|
2162
|
-
if (subagentRuns.size === 0) stopSweeper();
|
|
2163
|
-
} finally {
|
|
2164
|
-
sweepInProgress = false;
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
function ensureListener() {
|
|
2168
|
-
if (listenerStarted) return;
|
|
2169
|
-
listenerStarted = true;
|
|
2170
|
-
subagentRegistryDeps.onAgentEvent((evt) => {
|
|
2171
|
-
(async () => {
|
|
2172
|
-
if (!evt || evt.stream !== "lifecycle") return;
|
|
2173
|
-
const phase = evt.data?.phase;
|
|
2174
|
-
const entry = subagentRuns.get(evt.runId);
|
|
2175
|
-
if (!entry) {
|
|
2176
|
-
if (phase === "end" && typeof evt.sessionKey === "string") await refreshFrozenResultFromSession(evt.sessionKey);
|
|
2177
|
-
return;
|
|
2178
|
-
}
|
|
2179
|
-
if (phase === "start") {
|
|
2180
|
-
clearPendingLifecycleError(evt.runId);
|
|
2181
|
-
clearPendingLifecycleTimeout(evt.runId);
|
|
2182
|
-
const startedAt = typeof evt.data?.startedAt === "number" ? evt.data.startedAt : void 0;
|
|
2183
|
-
if (startedAt) {
|
|
2184
|
-
entry.startedAt = startedAt;
|
|
2185
|
-
if (typeof entry.sessionStartedAt !== "number") entry.sessionStartedAt = startedAt;
|
|
2186
|
-
persistSubagentRuns();
|
|
2187
|
-
}
|
|
2188
|
-
return;
|
|
2189
|
-
}
|
|
2190
|
-
if (phase !== "end" && phase !== "error") return;
|
|
2191
|
-
const endedAt = typeof evt.data?.endedAt === "number" ? evt.data.endedAt : Date.now();
|
|
2192
|
-
const error = typeof evt.data?.error === "string" ? evt.data.error : void 0;
|
|
2193
|
-
const livenessState = typeof evt.data?.livenessState === "string" ? evt.data.livenessState : void 0;
|
|
2194
|
-
if (phase === "error") {
|
|
2195
|
-
schedulePendingLifecycleError({
|
|
2196
|
-
runId: evt.runId,
|
|
2197
|
-
endedAt,
|
|
2198
|
-
error
|
|
2199
|
-
});
|
|
2200
|
-
return;
|
|
2201
|
-
}
|
|
2202
|
-
if (isBlockedLivenessState(livenessState)) {
|
|
2203
|
-
clearPendingLifecycleError(evt.runId);
|
|
2204
|
-
clearPendingLifecycleTimeout(evt.runId);
|
|
2205
|
-
await completeSubagentRun({
|
|
2206
|
-
runId: evt.runId,
|
|
2207
|
-
endedAt,
|
|
2208
|
-
outcome: {
|
|
2209
|
-
status: "error",
|
|
2210
|
-
error: formatBlockedLivenessError(error)
|
|
2211
|
-
},
|
|
2212
|
-
reason: SUBAGENT_ENDED_REASON_ERROR,
|
|
2213
|
-
sendFarewell: true,
|
|
2214
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
2215
|
-
triggerCleanup: true
|
|
2216
|
-
});
|
|
2217
|
-
return;
|
|
2218
|
-
}
|
|
2219
|
-
if (evt.data?.aborted) {
|
|
2220
|
-
schedulePendingLifecycleTimeout({
|
|
2221
|
-
runId: evt.runId,
|
|
2222
|
-
endedAt
|
|
2223
|
-
});
|
|
2224
|
-
return;
|
|
2225
|
-
}
|
|
2226
|
-
if (evt.data?.yielded === true) {
|
|
2227
|
-
if (markSubagentRunPausedAfterYield({
|
|
2228
|
-
entry,
|
|
2229
|
-
endedAt,
|
|
2230
|
-
startedAt: typeof evt.data?.startedAt === "number" ? evt.data.startedAt : entry.startedAt
|
|
2231
|
-
})) persistSubagentRuns();
|
|
2232
|
-
return;
|
|
2233
|
-
}
|
|
2234
|
-
clearPendingLifecycleError(evt.runId);
|
|
2235
|
-
clearPendingLifecycleTimeout(evt.runId);
|
|
2236
|
-
await completeSubagentRun({
|
|
2237
|
-
runId: evt.runId,
|
|
2238
|
-
endedAt,
|
|
2239
|
-
outcome: { status: "ok" },
|
|
2240
|
-
reason: SUBAGENT_ENDED_REASON_COMPLETE,
|
|
2241
|
-
sendFarewell: true,
|
|
2242
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
2243
|
-
triggerCleanup: true
|
|
2244
|
-
});
|
|
2245
|
-
})();
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
const subagentRunManager = createSubagentRunManager({
|
|
2249
|
-
runs: subagentRuns,
|
|
2250
|
-
resumedRuns,
|
|
2251
|
-
endedHookInFlightRunIds,
|
|
2252
|
-
persist: persistSubagentRuns,
|
|
2253
|
-
persistOrThrow: persistSubagentRunsOrThrow,
|
|
2254
|
-
callGateway: (request) => subagentRegistryDeps.callGateway(request),
|
|
2255
|
-
getRuntimeConfig: () => subagentRegistryDeps.getRuntimeConfig(),
|
|
2256
|
-
ensureRuntimePluginsLoaded: (args) => ensureSubagentRegistryPluginRuntimeLoaded(args),
|
|
2257
|
-
ensureListener,
|
|
2258
|
-
startSweeper,
|
|
2259
|
-
stopSweeper,
|
|
2260
|
-
resumeSubagentRun,
|
|
2261
|
-
clearPendingLifecycleError,
|
|
2262
|
-
resolveSubagentWaitTimeoutMs,
|
|
2263
|
-
scheduleOrphanRecovery: (args) => scheduleSubagentOrphanRecovery(args),
|
|
2264
|
-
resolveSubagentSessionCompletion,
|
|
2265
|
-
notifyContextEngineSubagentEnded,
|
|
2266
|
-
completeCleanupBookkeeping,
|
|
2267
|
-
completeSubagentRun
|
|
2268
|
-
});
|
|
2269
|
-
configureSubagentRegistrySteerRuntime({
|
|
2270
|
-
replaceSubagentRunAfterSteer: (params) => subagentRunManager.replaceSubagentRunAfterSteer(params),
|
|
2271
|
-
finalizeInterruptedSubagentRun: async (params) => await finalizeInterruptedSubagentRun(params)
|
|
2272
|
-
});
|
|
2273
|
-
function markSubagentRunForSteerRestart(runId) {
|
|
2274
|
-
return subagentRunManager.markSubagentRunForSteerRestart(runId);
|
|
2275
|
-
}
|
|
2276
|
-
function clearSubagentRunSteerRestart(runId) {
|
|
2277
|
-
return subagentRunManager.clearSubagentRunSteerRestart(runId);
|
|
2278
|
-
}
|
|
2279
|
-
function replaceSubagentRunAfterSteer(params) {
|
|
2280
|
-
return subagentRunManager.replaceSubagentRunAfterSteer(params);
|
|
2281
|
-
}
|
|
2282
|
-
function registerSubagentRun(params) {
|
|
2283
|
-
subagentRunManager.registerSubagentRun(params);
|
|
2284
|
-
}
|
|
2285
|
-
async function finalizeInterruptedSubagentRun(params) {
|
|
2286
|
-
const runIds = /* @__PURE__ */ new Set();
|
|
2287
|
-
if (typeof params.runId === "string" && params.runId.trim()) runIds.add(params.runId.trim());
|
|
2288
|
-
if (typeof params.childSessionKey === "string" && params.childSessionKey.trim()) {
|
|
2289
|
-
const childSessionKey = params.childSessionKey.trim();
|
|
2290
|
-
for (const [runId, entry] of subagentRuns.entries()) if (entry.childSessionKey === childSessionKey) runIds.add(runId);
|
|
2291
|
-
}
|
|
2292
|
-
if (runIds.size === 0) return 0;
|
|
2293
|
-
const endedAt = typeof params.endedAt === "number" && Number.isFinite(params.endedAt) ? params.endedAt : Date.now();
|
|
2294
|
-
let updated = 0;
|
|
2295
|
-
for (const runId of runIds) {
|
|
2296
|
-
clearPendingLifecycleError(runId);
|
|
2297
|
-
clearPendingLifecycleTimeout(runId);
|
|
2298
|
-
const entry = subagentRuns.get(runId);
|
|
2299
|
-
if (!entry || typeof entry.cleanupCompletedAt === "number") continue;
|
|
2300
|
-
await completeSubagentRun({
|
|
2301
|
-
runId,
|
|
2302
|
-
endedAt,
|
|
2303
|
-
outcome: {
|
|
2304
|
-
status: "error",
|
|
2305
|
-
error: params.error
|
|
2306
|
-
},
|
|
2307
|
-
reason: SUBAGENT_ENDED_REASON_ERROR,
|
|
2308
|
-
sendFarewell: true,
|
|
2309
|
-
accountId: entry.requesterOrigin?.accountId,
|
|
2310
|
-
triggerCleanup: true
|
|
2311
|
-
});
|
|
2312
|
-
updated += 1;
|
|
2313
|
-
}
|
|
2314
|
-
return updated;
|
|
2315
|
-
}
|
|
2316
|
-
function markSubagentRunTerminated(params) {
|
|
2317
|
-
return subagentRunManager.markSubagentRunTerminated(params);
|
|
2318
|
-
}
|
|
2319
|
-
function listSubagentRunsForController(controllerSessionKey) {
|
|
2320
|
-
return listRunsForControllerFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), controllerSessionKey);
|
|
2321
|
-
}
|
|
2322
|
-
function countActiveRunsForSession(requesterSessionKey) {
|
|
2323
|
-
return countActiveRunsForSessionFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), requesterSessionKey);
|
|
2324
|
-
}
|
|
2325
|
-
function countActiveDescendantRuns(rootSessionKey) {
|
|
2326
|
-
return countActiveDescendantRunsFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), rootSessionKey);
|
|
2327
|
-
}
|
|
2328
|
-
function countPendingDescendantRuns(rootSessionKey) {
|
|
2329
|
-
return countPendingDescendantRunsFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), rootSessionKey);
|
|
2330
|
-
}
|
|
2331
|
-
function listDescendantRunsForRequester(rootSessionKey) {
|
|
2332
|
-
return listDescendantRunsForRequesterFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), rootSessionKey);
|
|
2333
|
-
}
|
|
2334
|
-
function getSubagentRunByChildSessionKey(childSessionKey) {
|
|
2335
|
-
return getSubagentRunByChildSessionKeyFromRuns(subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns), childSessionKey);
|
|
2336
|
-
}
|
|
2337
|
-
function getLatestSubagentRunByChildSessionKey(childSessionKey) {
|
|
2338
|
-
const key = childSessionKey.trim();
|
|
2339
|
-
if (!key) return null;
|
|
2340
|
-
let latest = null;
|
|
2341
|
-
for (const entry of subagentRegistryDeps.getSubagentRunsSnapshotForRead(subagentRuns).values()) {
|
|
2342
|
-
if (entry.childSessionKey !== key) continue;
|
|
2343
|
-
if (!latest || entry.createdAt > latest.createdAt) latest = entry;
|
|
2344
|
-
}
|
|
2345
|
-
return latest;
|
|
2346
|
-
}
|
|
2347
|
-
function initSubagentRegistry() {
|
|
2348
|
-
restoreSubagentRunsOnce();
|
|
2349
|
-
}
|
|
2350
|
-
//#endregion
|
|
2351
|
-
export { finalizeInterruptedSubagentRun as a, initSubagentRegistry as c, markSubagentRunForSteerRestart as d, markSubagentRunTerminated as f, listSessionMaintenanceProtectedSubagentSessionKeys as g, scheduleSubagentOrphanRecovery as h, countPendingDescendantRuns as i, listDescendantRunsForRequester as l, replaceSubagentRunAfterSteer as m, countActiveDescendantRuns as n, getLatestSubagentRunByChildSessionKey as o, registerSubagentRun as p, countActiveRunsForSession as r, getSubagentRunByChildSessionKey as s, clearSubagentRunSteerRestart as t, listSubagentRunsForController as u };
|