@gaodefa/daocore 2026.5.85 → 2026.5.87
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-DF_NBB7k.js +277 -0
- package/dist/abort.runtime-D4MkvEhQ.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/account-inspect-BgTcq2xK.js +173 -0
- package/dist/accounts-B4A5OwEA.js +119 -0
- package/dist/accounts-BkS1Fh-0.js +107 -0
- package/dist/accounts-DF7-7Smq.js +107 -0
- package/dist/accounts-UL1OgSV7.js +2 -0
- package/dist/acp/control-plane/manager.d.ts +2 -1
- package/dist/acp-runtime-Cx2ACvcD.js +26 -0
- package/dist/acp-spawn-BGd_lmtE.js +2 -0
- package/dist/acp-spawn-BV0aSrgH.js +1275 -0
- package/dist/acp-stateful-target-driver-BZXAtm9O.js +89 -0
- package/dist/action-kill-CrabJ-6-.js +33 -0
- package/dist/action-runtime-BWOfmJe3.js +469 -0
- package/dist/action-runtime-api-Fr0Pcsql.js +2 -0
- package/dist/action-send-Cpl-x8ro.js +39 -0
- package/dist/action-spawn-DceGvU1M.js +47 -0
- package/dist/actions-Dx4zHx1-.js +161 -0
- package/dist/actions.runtime-CXgc7_sE.js +5 -0
- package/dist/agent-6f80KcUH.js +2 -0
- package/dist/agent-B2kAd5xV.js +3 -0
- package/dist/agent-command-DQ1XgXqe.d.ts +105 -0
- package/dist/agent-command-DwGwELK0.js +1367 -0
- package/dist/agent-components.runtime-DJYuGMFi.js +10 -0
- package/dist/agent-components.runtime.js +1 -1
- package/dist/agent-harness-Dya8_zFH.d.ts +146 -0
- package/dist/agent-harness-runtime-B18Zw6Rz.d.ts +691 -0
- package/dist/agent-harness-runtime-D_wIHJVe.js +180 -0
- package/dist/agent-harness-task-runtime-ol_ltjHi.js +140 -0
- package/dist/agent-runner-execution-D5wMRx5h.js +1713 -0
- package/dist/agent-runner-utils-CLCfaT2K.js +266 -0
- package/dist/agent-runner.runtime-Igsb-Us4.js +3455 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-tAPmASEK.js +229 -0
- package/dist/agent-via-gateway-CmOOhHWf.js +463 -0
- package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
- package/dist/api-BGUYfA7u.js +639 -0
- package/dist/api-Bb3jRMVp.js +3 -0
- package/dist/api-CDGKNega.js +6 -0
- package/dist/api-D-TLdpx5.js +2 -0
- package/dist/api-DXDbFZ7W.js +134 -0
- package/dist/api-DYuUdqrI.d.ts +52 -0
- package/dist/api-o2EhTZRZ.js +2 -0
- package/dist/apply-BWXKR0_1.js +41 -0
- package/dist/apply-C3i3NucS.js +54 -0
- package/dist/approval-handler.runtime-DhzHxhOa.js +130 -0
- package/dist/assistant-SXZqrOD4.js +291 -0
- package/dist/attachment-normalize-DobdGk6t.js +225 -0
- package/dist/attempt-execution-BOV_h0-N.js +558 -0
- package/dist/attempt-execution.runtime-CXlw2E2H.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt-execution.shared-BUNB-ofJ.js +38 -0
- package/dist/attempt.prompt-helpers-DfgNBTYi.js +475 -0
- package/dist/attempt.tool-run-context-DdadqfC-.js +2094 -0
- package/dist/binding-routing-BYWsTgH4.js +113 -0
- package/dist/binding-targets-CDxkaXRY.js +121 -0
- package/dist/bot-BMJcaPAi.js +7894 -0
- package/dist/bot-deps-CNg_Zt2P.js +2 -0
- package/dist/bot-deps-FZotnMZO.js +747 -0
- package/dist/bot-message-context.runtime-C_OEKOE-.js +7 -0
- package/dist/bot-message-context.runtime.js +1 -1
- package/dist/bot-message-context.session.runtime-VbbwvU7y.js +12 -0
- package/dist/bot-message-context.session.runtime.js +1 -1
- package/dist/bot-native-commands.delivery.runtime-CuquGLAx.js +4 -0
- package/dist/bot-native-commands.delivery.runtime.js +1 -1
- package/dist/bot-native-commands.runtime-DtYCPjvW.js +13 -0
- package/dist/bot-native-commands.runtime.js +1 -1
- package/dist/bridge-server-B4pS54jd.js +113 -0
- package/dist/browser-cli-BHUdFJIS.js +230 -0
- package/dist/browser-cli-BWWH1Csp.js +2 -0
- package/dist/browser-cli-actions-input-1hfL1q3f.js +473 -0
- package/dist/browser-cli-actions-observe-Ctdz-Ocl.js +81 -0
- package/dist/browser-cli-debug-D4yOgAhy.js +137 -0
- package/dist/browser-cli-inspect-D6c28uLw.js +104 -0
- package/dist/browser-cli-manage-DoCDoOsO.js +443 -0
- package/dist/browser-cli-resize-Dgb5KdMO.js +26 -0
- package/dist/browser-cli-shared-C1LIiQyl.js +50 -0
- package/dist/browser-cli-state-CwIDB8-B.js +337 -0
- package/dist/browser-control-auth-COjZjE3L.js +2 -0
- package/dist/browser-profiles-D085C5gN.js +2 -0
- package/dist/browser-runtime-CKIOtwI9.js +384 -0
- package/dist/build-DHK6vRrC.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/bundled-channel-config-schema-BsHcx3wh.d.ts +3163 -0
- package/dist/call-D8ev9OI5.d.ts +43 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-DRrPaB5q.js +1782 -0
- package/dist/channel-29833Q7U.d.ts +8 -0
- package/dist/channel-B0gFm2e0.d.ts +49 -0
- package/dist/channel-B4huj9Kp.js +362 -0
- package/dist/channel-B4wQxeHH.d.ts +14 -0
- package/dist/channel-BLs4RYYL.js +1777 -0
- package/dist/channel-BS3cqj-Z.d.ts +6 -0
- package/dist/channel-BU5YCSFs.d.ts +427 -0
- package/dist/channel-BXg8HDz6.d.ts +7 -0
- package/dist/channel-B_rnZ7-_.d.ts +26 -0
- package/dist/channel-BnSrEvQt.js +238 -0
- package/dist/channel-BuEQnzVg.js +1556 -0
- package/dist/channel-BvlX4grI.d.ts +106 -0
- package/dist/channel-C75uc-F0.d.ts +12 -0
- package/dist/channel-CMIcwlip.js +955 -0
- package/dist/channel-CTTRs_4Q.js +376 -0
- package/dist/channel-Ceh4DhGf.js +808 -0
- package/dist/channel-Cg78poCb.d.ts +7 -0
- package/dist/channel-CtVWvTxM.d.ts +8 -0
- package/dist/channel-CxzIiRo0.js +740 -0
- package/dist/channel-D3sCmweW.d.ts +64 -0
- package/dist/channel-DBe2Xwn9.js +1249 -0
- package/dist/channel-DOB2mltt.js +867 -0
- package/dist/channel-DU9qt3dX.js +481 -0
- package/dist/channel-DWCzQ-Po.js +562 -0
- package/dist/channel-Dha12xQd.js +2126 -0
- package/dist/channel-EAYFx_aX.d.ts +47 -0
- package/dist/channel-VJIcMa-M.js +508 -0
- package/dist/channel-WPOWimOu.js +1134 -0
- package/dist/channel-actions.runtime-bqHQHH3X.js +265 -0
- package/dist/channel-actions.runtime.js +1 -1
- package/dist/channel-core-DsmamxDL.d.ts +6 -0
- package/dist/channel-core-m0EI5nTB.js +5 -0
- package/dist/channel-entry-contract-DwsX3A32.d.ts +112 -0
- package/dist/channel-ez59JAzr.d.ts +114 -0
- package/dist/channel-inbound-hFEolyVo.js +80 -0
- package/dist/channel-l10cAz1Q.js +1496 -0
- package/dist/channel-lifecycle-BXdiTu_h.d.ts +126 -0
- package/dist/channel-oeyyvfIC.d.ts +104 -0
- package/dist/channel-pairing-qPwn6FAN.d.ts +58 -0
- package/dist/channel-plugin-runtime-BMtJ1Wgj.js +998 -0
- package/dist/channel-plugin-runtime-Cm532MRz.d.ts +7 -0
- package/dist/channel-runtime-TLiTFcI9.js +408 -0
- package/dist/channel-ryumzsaN.d.ts +28 -0
- package/dist/channel-uLv7YV-J.js +653 -0
- package/dist/channel-zfDQdZSM.d.ts +8 -0
- package/dist/channel.runtime-3Aev2p4z.js +88 -0
- package/dist/channel.runtime-BBoj-2rR.js +2528 -0
- package/dist/channel.runtime-BHW11124.js +254 -0
- package/dist/channel.runtime-BO5IrBIY.js +652 -0
- package/dist/channel.runtime-C8L4S2Y3.js +109 -0
- package/dist/channel.runtime-D55LFe_S.js +21009 -0
- package/dist/channel.runtime-DUVRcCkd.js +1008 -0
- package/dist/channel.runtime-eAjrNDCs.js +733 -0
- package/dist/channel.runtime-ek9gTQao.js +4 -0
- package/dist/channel.setup-BKCOmQ1R.d.ts +6 -0
- package/dist/channel.setup-C4kFVZ9n.js +1098 -0
- package/dist/channel.setup-CG4h40nr.js +10 -0
- package/dist/channel.setup-CIy_GOHl.d.ts +8 -0
- package/dist/channel.setup-DLoH7iov.d.ts +7 -0
- package/dist/channel.setup-t6GC0j9y.js +343 -0
- package/dist/chat-u7qZ4sNv.js +2666 -0
- package/dist/chrome-CcpklbxU.js +1503 -0
- package/dist/cli/run-main.js +5 -5
- package/dist/cli-DfMcB-YB.d.ts +20 -0
- package/dist/cli-DuN9_yOX.js +1341 -0
- package/dist/cli-backend-C3cY7GNo.d.ts +5 -0
- package/dist/cli-backend-Dq6pWbMI.d.ts +5 -0
- package/dist/cli-compaction-_t3h1d1Y.js +347 -0
- package/dist/cli-metadata-CuQDanWu.js +22 -0
- package/dist/cli-runner-BICDg94b.js +2 -0
- package/dist/cli-runner-CeaLhAdU.js +540 -0
- package/dist/cli-runner.runtime-Ckyx1-nO.js +4 -0
- package/dist/cli-runner.runtime-ZsfkXp6T.js +3 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-CLlJpRmc.d.ts +20 -0
- package/dist/cli-startup-metadata.json +8 -8
- package/dist/client-UnpX4vLL.js +650 -0
- package/dist/client-adapter-DXOFyLda.js +897 -0
- package/dist/client-factory-DvI4dWav.js +9 -0
- package/dist/command-auth--55vYozU.js +135 -0
- package/dist/command-handlers-luOY52Zj.js +1609 -0
- package/dist/command-registry-2ZPFOxQD.js +4 -0
- package/dist/command-registry-BnlVL4Z5.js +9 -0
- package/dist/command-registry-core-CY3_nsXj.js +110 -0
- package/dist/command-status.runtime-DlWcbk6f.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-9rlXSaBn.d.ts +113 -0
- package/dist/commands-acp-1GcD7q5q.js +74 -0
- package/dist/commands-compact.runtime-DO9NBGsY.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-handlers.runtime-CS9oLcTy.js +6154 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-status-B-VHaYH5.js +3 -0
- package/dist/commands-status-CD4lbvZe.js +16 -0
- package/dist/commands-status.runtime-B-VHaYH5.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-BW2wSGGB.js +2 -0
- package/dist/commands-subagents-control.runtime-DayCbQBi.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-Bu0-zdQV.js +162 -0
- package/dist/commands-system-prompt-DqzUrExG.js +2 -0
- package/dist/commands.runtime-Bi618hLG.js +176 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/compact-D6RF2ao-.js +480 -0
- package/dist/compact-DOHvJc9C.js +1141 -0
- package/dist/compact.runtime-BMV69fdx.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-CKorRumh.js +315 -0
- package/dist/computer-use-QDwH-PSW.js +367 -0
- package/dist/config-D085C5gN.js +2 -0
- package/dist/config-kivtFwCd.js +373 -0
- package/dist/config-mutations-BEpZ3rYv.js +159 -0
- package/dist/config-schema-Bwgooc-v.d.ts +20 -0
- package/dist/config-schema-lIvqvlbL.d.ts +34 -0
- package/dist/context-engine-host-compat-BXoUGeB_.js +2 -0
- package/dist/context-engine-host-compat-CcCmD5o9.js +288 -0
- package/dist/context-engine-lifecycle-CwtbthA3.js +1274 -0
- package/dist/contracts-testkit-DC7MJzfa.d.ts +145 -0
- package/dist/control-auth-wsG-pObJ.js +114 -0
- package/dist/control-service-DoSyDuPZ.js +145 -0
- package/dist/conversation-binding-runtime-vZQ351Yx.js +4 -0
- package/dist/conversation-runtime-DZztdc11.js +31 -0
- package/dist/core-CcQCE1PE.js +282 -0
- package/dist/core-api-Cn9nxEQY.js +5 -0
- package/dist/core-api-DJttT99e.js +2 -0
- package/dist/core-loprAG73.d.ts +224 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-B77mGOnM.js +55 -0
- package/dist/daocore-runtime-B-rzUpKx.d.ts +151 -0
- package/dist/daocore-tools-B2AoPxwu.js +11727 -0
- package/dist/delivery-DrO-hbmH.js +1002 -0
- package/dist/dialogue-xd9pIoHO.js +37 -0
- package/dist/dir-fetch-tool-CMJ9Pt6u.js +565 -0
- package/dist/dir-list-tool-BrTrO97I.js +100 -0
- package/dist/direct-dm-Dbxrg-M8.js +64 -0
- package/dist/directive-handling.fast-lane-Cm6q7myY.js +68 -0
- package/dist/directive-handling.impl-BW2_4S2v.js +818 -0
- package/dist/directive-handling.impl-DkMvyjSy.js +2 -0
- package/dist/directive-handling.model-selection-BBc-JgRD.js +122 -0
- package/dist/directive-handling.persist.runtime-ByZk594V.js +263 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/dispatch-acp-transcript.runtime-t6_JeKwA.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-yf6pNdiB.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dispatch-rpGfQmzk.js +1640 -0
- package/dist/doctor-Ce9osVgH.js +6 -0
- package/dist/doctor-Dl4rkbw8.js +2 -0
- package/dist/doctor-config-flow-IokiMPZL.js +1741 -0
- package/dist/doctor-core-checks-DPugZhrT.js +2 -0
- package/dist/doctor-core-checks-DTM0dPXV.js +573 -0
- package/dist/doctor-health-D9BF5XjZ.js +65 -0
- package/dist/doctor-health-contributions-CeAx5c5L.js +696 -0
- package/dist/doctor-lint-B3Ya8mmD.js +94 -0
- package/dist/doctor-state-integrity-B5aQjl2y.js +1231 -0
- package/dist/doctor-update-CGkyLrKv.js +58 -0
- package/dist/doctor-update-fix-CQ8qVhBX.js +107 -0
- package/dist/dynamic-tools-DZebai0O.js +486 -0
- package/dist/embedded-backend-BS79InDg.js +579 -0
- package/dist/embedded-gateway-stub.runtime-CsTs2-an.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-provider-BKIXHvGl.d.ts +16 -0
- package/dist/embedding-provider-ZDZfzTLK.d.ts +65 -0
- package/dist/embedding-provider-uqWqn4wW.d.ts +21 -0
- package/dist/entry.d.ts +1 -1
- package/dist/exec-approvals-DSGilgX_.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/doctor-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/browser/test-support.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/doctor-contract-api.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 +4 -4
- 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 +5 -5
- 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 +10 -10
- 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/qwen-dashscope/index.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 +3 -3
- 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 +8 -8
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- 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 +2 -2
- 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-QFQ7QZQ9.js +124 -0
- package/dist/file-write-tool-znIJ5MOE.js +127 -0
- package/dist/format-B3nq4sfa.js +1145 -0
- package/dist/gateway/protocol/index.d.ts +1 -1
- package/dist/gateway-cli-D5nQafQi.js +435 -0
- package/dist/gateway-method-runtime-BXmOAMxN.js +21 -0
- package/dist/gateway-runtime-BRfyNjsE.d.ts +163 -0
- package/dist/gemini-cli-provider-2RAshvHZ.d.ts +6 -0
- package/dist/get-reply-DZK53szF.js +4689 -0
- package/dist/get-reply-from-config.runtime-Kx4GwLAA.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/graph-users-CNpoBMLI.js +1419 -0
- package/dist/group-access-B-lpiIoP.js +112 -0
- package/dist/handle-action.guild-admin-D7AInszH.js +288 -0
- package/dist/harness-BPTKe2TG.js +61 -0
- package/dist/health-BkXVkm2H.js +4 -0
- package/dist/heartbeat-runner-Dbddl21A.js +5 -0
- package/dist/heartbeat-runner.runtime-CDmb7D-Q.js +4 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/hook-runtime-BBONf8H3.d.ts +108 -0
- package/dist/hooks-90WH7Tva.js +534 -0
- package/dist/http-registry-DydRvucX.d.ts +23 -0
- package/dist/image-generation-runtime-CYSxJAy2.d.ts +21 -0
- package/dist/inbound-direct-dm-runtime-bXneq4t0.js +2 -0
- package/dist/inbound-reply-dispatch-BVzOSvZX.js +148 -0
- package/dist/index-BFhfE749.d.ts +3971 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/init-DWgLcXq7.js +59 -0
- package/dist/inline-buttons-DtcEDZIV.js +40 -0
- package/dist/interactive-dispatch-CNUK2pZt.d.ts +56 -0
- package/dist/interactive-dispatch-DuuOPzwD.d.ts +143 -0
- package/dist/internal-events-D3SdlwzM.js +90 -0
- package/dist/isolated-agent-B9qCvLC4.js +1118 -0
- package/dist/isolated-agent-DaBWyrzI.js +2 -0
- package/dist/lifecycle-CfcTMzLT.js +571 -0
- package/dist/list.probe-aXBUfusA.js +449 -0
- package/dist/list.status-command-xrFMny0R.js +789 -0
- package/dist/llm-slug-generator-D5FE5osT.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/loader-BKopCdPY.d.ts +142 -0
- package/dist/local-dispatch.runtime-0dOK_rcW.js +9 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/manager-BrS--u6G.d.ts +356 -0
- package/dist/manager-DWN3qo90.d.ts +10 -0
- package/dist/manager.core-BRd2_lqA.d.ts +198 -0
- package/dist/manager.runtime-pUdntZ2i.js +2714 -0
- package/dist/manager.runtime.js +1 -1
- package/dist/markdown-to-line-Cv0Gm132.js +811 -0
- package/dist/mcp-http-CaliRokB.js +555 -0
- package/dist/mcp-http-Dgcmuypw.js +2 -0
- package/dist/media-understanding-provider-Cu7iRaWL.js +339 -0
- package/dist/memory-core-host-engine-storage-DsNomsw4.d.ts +54 -0
- package/dist/memory-embedding-adapter-Ba-UYpWr.d.ts +5 -0
- package/dist/message-actions-BBiWyHuJ.js +145 -0
- package/dist/message-handler-VnxCCjy7.js +384 -0
- package/dist/message-handler-dNRhdkX3.js +1715 -0
- package/dist/message-handler.preflight-CREgYCNj.js +1125 -0
- package/dist/message-handler.process-DN93vvas.js +1484 -0
- package/dist/migration-DOuQeJ7P.d.ts +45 -0
- package/dist/model-Bp-W7fVB.js +74 -0
- package/dist/model-eEpAu59T.d.ts +33 -0
- package/dist/model-selection-CXTwfi0m.js +272 -0
- package/dist/models-BF1vdgHr.js +2 -0
- package/dist/models-DepHj1G3.d.ts +24 -0
- package/dist/models-DvbokHz4.js +104 -0
- package/dist/models-cli-B_zT7frv.js +256 -0
- package/dist/monitor-BoW4qfGV.js +834 -0
- package/dist/monitor-Bs8KSKu7.js +60 -0
- package/dist/monitor-DHgHadUx.js +1370 -0
- package/dist/monitor-DX7Ya0rb.js +715 -0
- package/dist/monitor-DlzBuqhN.js +2788 -0
- package/dist/monitor-DnzcdtYh.js +1657 -0
- package/dist/monitor-DwwFCaSy.js +4377 -0
- package/dist/monitor-auth-BRF9yj8s.js +179 -0
- package/dist/monitor-m5zwJU51.js +2 -0
- package/dist/monitor-polling.runtime-DXMM7v9c.js +883 -0
- package/dist/monitor-polling.runtime.js +1 -1
- package/dist/monitor-webhook.runtime-vNDAo7Yq.js +387 -0
- package/dist/monitor-webhook.runtime.js +1 -1
- package/dist/monitor.account-DT1JC2fm.js +5233 -0
- package/dist/monitor.runtime-BUw4UbJN.js +2 -0
- package/dist/monitor.runtime.js +1 -1
- package/dist/monitor.webhook-IBx7ZFi4.js +180 -0
- package/dist/node-cli-sessions-BJW0oB3s.js +1228 -0
- package/dist/openai-codex-provider-LwMbKOK1.d.ts +5 -0
- package/dist/openai-http-BX-DFq23.js +824 -0
- package/dist/openai-provider-F0nEHs4l.d.ts +5 -0
- package/dist/openresponses-http-BN6ztKxO.js +1173 -0
- package/dist/operations-DmaD-gxv.js +805 -0
- package/dist/outbound-adapter-v9Q4K2Bl.js +543 -0
- package/dist/outbound-session-route-BxhErAps.js +45 -0
- package/dist/outbound.runtime-ClUOK-Ir.js +2 -0
- package/dist/outbound.runtime.js +1 -1
- package/dist/pairing-store-Cfy_zHzi.d.ts +87 -0
- package/dist/pi-embedded-CG0u988w.js +4 -0
- package/dist/pi-embedded-D7UoOQFj.js +3796 -0
- package/dist/pi-embedded.runtime-CKNVJdm9.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools-DP7eGHq-.js +2413 -0
- package/dist/plan-BD5JNOvV.js +81 -0
- package/dist/plan-BSDlELnX.js +112 -0
- package/dist/plugin-4bygXnMD.js +12396 -0
- package/dist/plugin-BW5kVZrl.d.ts +17 -0
- package/dist/plugin-app-cache-key-BfaJYLXl.js +46 -0
- package/dist/plugin-enabled-44kWBMek.js +233 -0
- package/dist/plugin-entry-oVFfOYI7.d.ts +47 -0
- package/dist/plugin-registration-DoD5ARyg.js +88 -0
- package/dist/plugin-runtime-Bx8TuYU5.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/src/commands/doctor.types.d.ts +0 -1
- package/dist/plugin-sdk/src/compat/legacy-names.d.ts +1 -1
- package/dist/plugin-sdk/src/plugins/manifest.d.ts +1 -1
- package/dist/plugin-sdk/testing.js +2 -2
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-service-CJqwjPRa.js +1229 -0
- package/dist/plugin-service-W6IMgQjk.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-C2YDmnm2.js +138 -0
- package/dist/policy-CYBwtJmM.js +680 -0
- package/dist/prepare.runtime-B9SQyzSp.js +732 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-DkMoGKdo.js +392 -0
- package/dist/probe-BYucGf4s.js +682 -0
- package/dist/probe-D8YoJ89r.js +2204 -0
- package/dist/probe-DKinNcah.js +47 -0
- package/dist/probe-DSYRrw81.js +2 -0
- package/dist/program-MtNU1_sG.js +131 -0
- package/dist/prompt-overlay-CaXYKmjI.d.ts +23 -0
- package/dist/provider-26ZZeAkw.js +32 -0
- package/dist/provider-BtNK1WFZ.js +8735 -0
- package/dist/provider-CfJzlnOm.js +32 -0
- package/dist/provider-Dl-E4_a8.js +152 -0
- package/dist/provider-api-key-auth-DOu4GJBt.d.ts +27 -0
- package/dist/provider-auth-result-CO9yqIJ_.d.ts +21 -0
- package/dist/provider-catalog-runtime-f_87intf.d.ts +23 -0
- package/dist/provider-catalog-shared-CXZnqdym.d.ts +62 -0
- package/dist/provider-dispatcher-CAaa54DQ.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-hook-runtime-o2J0hqhZ.d.ts +61 -0
- package/dist/provider-model-shared-CsZtXE0W.d.ts +143 -0
- package/dist/provider-models-BbjvK4gF.d.ts +12 -0
- package/dist/provider-policy-BwZykYqb.d.ts +30 -0
- package/dist/provider-registration-CytP1d9Y.d.ts +6 -0
- package/dist/provider-registry-Ct1dA5S3.d.ts +8 -0
- package/dist/provider-registry-DgEFqiK2.d.ts +30 -0
- package/dist/provider-registry-Dilmwbu_.d.ts +8 -0
- package/dist/provider-runtime-ChO01VYW.d.ts +359 -0
- package/dist/provider-self-hosted-setup-DCeKR5ZH.d.ts +74 -0
- package/dist/provider-session.runtime-DDMGL25I.js +9 -0
- package/dist/provider-session.runtime.js +1 -1
- package/dist/provider-stream-CrWY0s8C.d.ts +140 -0
- package/dist/provider-stream-shared-CgnrFxMf.d.ts +128 -0
- package/dist/provider.runtime-CUdlREry.js +2 -0
- package/dist/provider.runtime.js +1 -1
- package/dist/providers.runtime-CiX4UePR.d.ts +25 -0
- package/dist/public-surface-loader-iYUvHxzC.js +114 -0
- package/dist/pw-ai-DQjpZTSa.js +3029 -0
- package/dist/pw-role-snapshot-DgavoGdC.js +333 -0
- package/dist/reaction-level-uiCaLj0m.js +19 -0
- package/dist/reaction-runtime-api-ErmZKqXv.js +116 -0
- package/dist/realtime-transcription-abdbHd8R.d.ts +43 -0
- package/dist/realtime-transcription-provider-CPK7XYp9.d.ts +5 -0
- package/dist/realtime-transcription-provider-DC2AscwX.d.ts +32 -0
- package/dist/realtime-transcription-provider-Dg5t03mY.d.ts +28 -0
- package/dist/realtime-transcription-provider-UesXbEwy.d.ts +37 -0
- package/dist/realtime-transcription-provider-tLRMgcYk.js +205 -0
- package/dist/realtime-voice-D1aiUBBt.d.ts +333 -0
- package/dist/realtime-voice-provider-D5DZsLRA.d.ts +5 -0
- package/dist/register-DxldPhbz.js +2178 -0
- package/dist/register.agent-B9171wFk.js +156 -0
- package/dist/register.crestodian-plvra03q.js +24 -0
- package/dist/register.maintenance-BLH-PhXR.js +105 -0
- package/dist/register.runtime-CAW8ORTZ.d.ts +6 -0
- package/dist/register.runtime-CnuNQn65.js +54 -0
- package/dist/register.subclis-C9TqTF1g.js +3 -0
- package/dist/register.subclis-core-B4RLAWNE.js +273 -0
- package/dist/register.subclis-zvycA0fS.js +31 -0
- package/dist/registry-paAkM8At.d.ts +91 -0
- package/dist/registry-types-DSJvRhBP.d.ts +392 -0
- package/dist/repair-sequencing-3Q95ftKn.js +640 -0
- package/dist/reply-delivery-BYtyofYM.js +196 -0
- package/dist/reply-runtime-DUv2dRp3.d.ts +34 -0
- package/dist/reply-runtime-P6EiRGYz.js +11 -0
- package/dist/reply.runtime-Kx4GwLAA.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/request-B8_J1Hk5.js +54 -0
- package/dist/resolve-allowlist-BHhr7pGG.js +220 -0
- package/dist/result-fallback-classifier-v1BgnJLN.js +79 -0
- package/dist/route-Dl0ZJvrW.js +469 -0
- package/dist/route-resolution-mVRyzqn_.js +274 -0
- package/dist/routes-B8uiTXHO.js +3602 -0
- package/dist/routes-Bjw1nWyB.js +2 -0
- package/dist/run-attempt-DKRsY7Xs.js +7704 -0
- package/dist/run-command-Bs2y31Ew.js +2 -0
- package/dist/run-command-CBDF_cGB.js +23 -0
- package/dist/run-embedded.runtime-2GWQN_Qf.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-BEXMdwL2.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-rMTtvEMF.js +1163 -0
- package/dist/run-subagent-registry.runtime-CBmgh09W.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runtime-D21vC5Bd.d.ts +17 -0
- package/dist/runtime-DFBt4ZZw.js +1287 -0
- package/dist/runtime-DQV1yYF5.js +6179 -0
- package/dist/runtime-api-B6S-7TVS.js +3 -0
- package/dist/runtime-api-BLV9PO47.js +24 -0
- package/dist/runtime-api-BX1AvShq.js +17 -0
- package/dist/runtime-api-BnN22IWf.js +13 -0
- package/dist/runtime-api-BsmZgGnI.js +21 -0
- package/dist/runtime-api-CJ6x4Uuu.js +13 -0
- package/dist/runtime-api-DTdQMFV-.d.ts +3151 -0
- package/dist/runtime-api-DXCKXAYu.js +4 -0
- package/dist/runtime-api.actions-C9Jtoruo.js +3 -0
- package/dist/runtime-api.actions-CClxRuYx.d.ts +23 -0
- package/dist/runtime-api.monitor-slWfxEgT.js +6 -0
- package/dist/runtime-api.send-D_auPJG_.js +4 -0
- package/dist/runtime-api.send-wXeDllRu.d.ts +38 -0
- package/dist/runtime-api.threads-BWzc1vrN.js +2 -0
- package/dist/runtime-channel-BOnbxldg.js +2 -0
- package/dist/runtime-channel-Dh45Bl_Q.js +150 -0
- package/dist/runtime-doctor-DVYwKwIT.d.ts +47 -0
- package/dist/runtime-embedded-pi.runtime-BVjCGIqB.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-hYOWxRKE.js +438 -0
- package/dist/runtime-taskflow-BYZsMg1i.d.ts +435 -0
- package/dist/sanitize-outbound-CP-twYgG.js +127 -0
- package/dist/sdk-setup-tools-Cfh-ATXD.js +8 -0
- package/dist/secrets-DcQ7WBB-.js +113 -0
- package/dist/security-audit-CwMh7ULQ.js +118 -0
- package/dist/security-audit-yRC5cfp1.js +122 -0
- package/dist/security-audit.runtime-COitYvaV.js +2 -0
- package/dist/security-audit.runtime.js +1 -1
- package/dist/selection-C_swgArS.js +3 -0
- package/dist/selection-Cud_xC6-.js +16157 -0
- package/dist/send-BXTj6QIe.js +143 -0
- package/dist/send-Be-rQ3Py.js +1631 -0
- package/dist/send-D95RJNJM.d.ts +104 -0
- package/dist/send-DZ4YhPHH.d.ts +231 -0
- package/dist/send-DrSo2pTm.js +192 -0
- package/dist/send-un_jKNYG.js +2 -0
- package/dist/send.components-C0ugXCvj.js +500 -0
- package/dist/send.components-CaHcQCve.js +2 -0
- package/dist/send.runtime-CcGjdPIe.js +2 -0
- package/dist/send.runtime.js +1 -1
- package/dist/send.types-_f4omMzG.d.ts +159 -0
- package/dist/server-Belw8J0P.js +24 -0
- package/dist/server-CbbbWl0g.js +73 -0
- package/dist/server-close.runtime.d.ts +1 -1
- package/dist/server-close.runtime.js +1 -1
- package/dist/server-context-D5PPz4pG.js +955 -0
- package/dist/server-context-DfiZrO39.js +2 -0
- package/dist/server-cron-B4uqojsc.js +2989 -0
- package/dist/server-cron-D5ofhC2R.js +2 -0
- package/dist/server-methods-BtrFcSCY.js +16499 -0
- package/dist/server-node-events-B7f6W47S.js +596 -0
- package/dist/server-plugin-bootstrap-CldF7ied.js +70 -0
- package/dist/server-plugins-BVVgDSdq.d.ts +1 -0
- package/dist/server-plugins-BkRL48_Y.js +432 -0
- package/dist/server-reload-handlers-CmD463eg.js +714 -0
- package/dist/server-restart-sentinel-1-GltJOW.js +2 -0
- package/dist/server-restart-sentinel-BAc6ad7u.js +747 -0
- package/dist/server-runtime-services-DdDWPwwJ.js +2 -0
- package/dist/server-runtime-services-q4vtzdgR.js +267 -0
- package/dist/server-startup-plugins-RDIvIW1b.js +113 -0
- package/dist/server-startup-post-attach-B-Bcz1b8.js +716 -0
- package/dist/server-ws-runtime-ClfNa1gj.js +349 -0
- package/dist/server.impl-5A5eWz1g.js +2587 -0
- package/dist/service-BIi_LAz_.js +1446 -0
- package/dist/session-binding-DxgaaGZ8.js +219 -0
- package/dist/session-binding-SoSof-ir.js +2 -0
- package/dist/session-kill-http-CpA7WXXP.js +121 -0
- package/dist/session-reset-service-MBceWYbr.js +625 -0
- package/dist/session-route-SMerc1ZF.js +93 -0
- package/dist/session-status.runtime-C1MOnm-1.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-Cca41-p8.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-BL8A9tMR.js +521 -0
- package/dist/sessions-history-http-Cb21uPHU.js +430 -0
- package/dist/sessions.runtime-ClHkmNrd.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-api-CwKuO7ZG.js +29 -0
- package/dist/setup-core-C8_XbMIV.js +174 -0
- package/dist/setup-surface-B3m7rAoM.js +405 -0
- package/dist/setup-surface-BstaBVou.js +320 -0
- package/dist/setup-surface-C5L8UmIu.js +221 -0
- package/dist/setup-surface-DwijXcOh.js +288 -0
- package/dist/shared-DdLk0hA6.d.ts +115 -0
- package/dist/shared-DemthgnG.js +121 -0
- package/dist/shared-client-CLvetNfK.js +2 -0
- package/dist/shared-client-CR88Qth4.js +629 -0
- package/dist/side-question-BKRlgFVG.js +683 -0
- package/dist/simple-completion-runtime-D3vYpwbZ.d.ts +73 -0
- package/dist/skill-tool-dispatch.runtime-Bsz4SNiK.js +143 -0
- package/dist/skill-tool-dispatch.runtime.js +1 -1
- package/dist/slash-state-Cbb2tkH9.js +2166 -0
- package/dist/speech-Cf7RmLix.d.ts +47 -0
- package/dist/speech-core-BWd27MY5.d.ts +36 -0
- package/dist/speech-provider-Csdu9pW1.d.ts +5 -0
- package/dist/speech-provider-D4v4Jv2s.d.ts +34 -0
- package/dist/speech-provider-Dj7nG9do.d.ts +5 -0
- package/dist/speech-provider-DnyUKHSU.d.ts +5 -0
- package/dist/speech-provider-MoJPg1gB.d.ts +8 -0
- package/dist/speech-provider-hT52upCX.d.ts +8 -0
- package/dist/speech-provider-hqhi426N.js +184 -0
- package/dist/src-wxYdKry6.js +4256 -0
- package/dist/startup-context-CidK9XK8.js +313 -0
- package/dist/status-subagents.runtime-DgYNfrbK.js +18 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-w43pGoDJ.js +296 -0
- package/dist/sticker-cache-BdIkkDGC.js +206 -0
- package/dist/sticker-vision.runtime-bmccn4BW.js +17 -0
- package/dist/sticker-vision.runtime.js +1 -1
- package/dist/stream-BVr9Y5Fk.d.ts +19 -0
- package/dist/stream-C5ugQLbM.d.ts +10 -0
- package/dist/stream-CDDV9-Wq.d.ts +5 -0
- package/dist/stream-D3ZhJVM7.d.ts +16 -0
- package/dist/stream-Dhh55ncO.d.ts +120 -0
- package/dist/stream-wrappers-PZu4IPG2.d.ts +21 -0
- package/dist/subagent-announce-Cig5R7bU.js +354 -0
- package/dist/subagent-announce-delivery-DElem-jW.js +958 -0
- package/dist/subagent-control-Dx1qbt2M.js +508 -0
- package/dist/subagent-hooks-03ne_B1P.js +2 -0
- package/dist/subagent-hooks-BW4tdl1N.js +116 -0
- package/dist/subagent-hooks-BdADgqQH.js +2 -0
- package/dist/subagent-hooks-D5ZUfS0C.js +146 -0
- package/dist/subagent-hooks-DKEWsBSa.js +230 -0
- package/dist/subagent-hooks-api-BNJpIv9Q.js +23 -0
- package/dist/subagent-hooks-api-BXE-a9iQ.js +22 -0
- package/dist/subagent-hooks-api-w7wOpXSR.js +23 -0
- package/dist/subagent-hooks-kf263oYw.js +2 -0
- package/dist/subagent-orphan-recovery-TGLIuI1K.js +352 -0
- package/dist/subagent-registry-BVVgDSdq.d.ts +1 -0
- package/dist/subagent-registry-Bai39rEv.js +3 -0
- package/dist/subagent-registry-read-BVVgDSdq.d.ts +1 -0
- package/dist/subagent-registry-vgjMT_I1.js +2351 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-session-cleanup-PEEQtuLS.js +525 -0
- package/dist/subagent-spawn-2TTDQg5Y.js +1164 -0
- package/dist/target-id-BgSzF2Lk.js +107 -0
- package/dist/targets-Bd9-WGJt.js +19 -0
- package/dist/targets-CdiGPFGr.d.ts +10 -0
- package/dist/targets-DxKwMzNB.js +44 -0
- package/dist/targets-DzdYRUSR.js +19 -0
- package/dist/targets-ZJ1ZRt5L.d.ts +10 -0
- package/dist/task-registry-control.runtime.d.ts +1 -1
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/telegram/token.js +1 -1
- package/dist/test-fixtures-xgg7UsEw.d.ts +27 -0
- package/dist/test-support-BVVgDSdq.d.ts +1 -0
- package/dist/testing-B6jLjq4r.js +267 -0
- package/dist/thinking-policy-CAsew9b-.d.ts +5 -0
- package/dist/thread-bindings-BumrOVO8.js +571 -0
- package/dist/thread-bindings-C4yc8CZT.js +228 -0
- package/dist/thread-bindings-Dkeit03N.js +8 -0
- package/dist/thread-bindings-FVOv7g2T.js +232 -0
- package/dist/thread-bindings.discord-api-D83vw86t.js +187 -0
- package/dist/thread-bindings.manager-DEqfX4rc.js +2 -0
- package/dist/thread-bindings.manager-LOMmQ1pN.js +536 -0
- package/dist/thread-lifecycle-CGFgul5c.js +1614 -0
- package/dist/token-CoB7XxKt.js +134 -0
- package/dist/tool-CIfIAkxV.js +139 -0
- package/dist/tool-actions.runtime-BrVxKuRd.js +534 -0
- package/dist/tool-actions.runtime.js +1 -1
- package/dist/tool-plugin-B18esZUX.d.ts +77 -0
- package/dist/tool-resolution-BWdOXsX0.js +149 -0
- package/dist/tool-split-_O9ZqSIU.d.ts +19 -0
- package/dist/tools-effective-inventory-CW8_FJBN.js +204 -0
- package/dist/tools-invoke-http-CYJCHpxL.js +67 -0
- package/dist/tools-invoke-shared-SnaEXvuz.js +200 -0
- package/dist/transport-stream-Piw1coFu.d.ts +42 -0
- package/dist/tts-5p3qPz-P.js +66 -0
- package/dist/tui-BYTSFA_c.js +4709 -0
- package/dist/tui-LOGspKbe.js +2 -0
- package/dist/tui-backend-C8nbqNLo.js +256 -0
- package/dist/tui-cli-C91LywYY.js +37 -0
- package/dist/typed-cases-v8PtmO3g.d.ts +68 -0
- package/dist/types--mFsqUEV.d.ts +786 -0
- package/dist/types-CcjGrBF52.d.ts +3650 -0
- package/dist/types.public-rJrhXChy.d.ts +70 -0
- package/dist/update-cli-DZuYe1aX.js +3665 -0
- package/dist/update-global-ucSOAIga.js +606 -0
- package/dist/update-runner-2pS-KlSn.js +1798 -0
- package/dist/video-generation-runtime-CA2LiNwu.d.ts +21 -0
- package/dist/video-model-catalog-BJ9GJKrw.d.ts +16 -0
- package/dist/vision-tools-mJMJD3Yw.js +1409 -0
- package/dist/web-search-BZgc3DQT.js +62 -0
- package/dist/web-search-provider.runtime-BgoF9yna.js +328 -0
- package/dist/web-search-provider.runtime-D1lmfAbp.js +2 -0
- package/dist/web-search-provider.runtime.js +1 -1
- package/dist/webhook-targets-B_syT8-q.d.ts +99 -0
- package/dist/xai-oauth-B-LPhpsk.js +479 -0
- package/dist/xai-user-agent-B0F4Hyt5.js +32 -0
- package/dist/zod-schema.core-Bwbyyd_y.d.ts +166 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/abort-BtS5AfJG.js +0 -277
- package/dist/abort.runtime-D211494J.js +0 -2
- package/dist/account-inspect-BqAxH1Q_.js +0 -173
- package/dist/accounts-2VYKksau.js +0 -107
- package/dist/accounts-B6aVCtty.js +0 -119
- package/dist/accounts-CE6mvWMC.js +0 -2
- package/dist/accounts-eprn8x0M.js +0 -107
- package/dist/acp-runtime-C_0NA0CS.js +0 -26
- package/dist/acp-spawn-CTmucfK5.js +0 -2
- package/dist/acp-spawn-DcTgPZQB.js +0 -1275
- package/dist/acp-stateful-target-driver-DVWNxIEX.js +0 -89
- package/dist/action-kill-C6NRFglx.js +0 -33
- package/dist/action-runtime-BaKOu7uV.js +0 -469
- package/dist/action-runtime-api-QC43ZgvC.js +0 -2
- package/dist/action-send-B790BH2g.js +0 -39
- package/dist/action-spawn-Dgf97JGp.js +0 -47
- package/dist/actions-DhY0Hqxd.js +0 -161
- package/dist/actions.runtime-BfdjoY4f.js +0 -5
- package/dist/agent-C1VC8waN.js +0 -3
- package/dist/agent-DuLat04d.js +0 -2
- package/dist/agent-command-BQ2JuYpP.js +0 -1367
- package/dist/agent-command-COFQwKxZ.d.ts +0 -141
- package/dist/agent-components.runtime-BskyK1iq.js +0 -10
- package/dist/agent-harness-WlBoSv-g.d.ts +0 -146
- package/dist/agent-harness-runtime-CsWVHhWd.d.ts +0 -691
- package/dist/agent-harness-runtime-l4d66klL.js +0 -180
- package/dist/agent-harness-task-runtime-D5vhG7mw.js +0 -140
- package/dist/agent-runner-execution-DKJ7YE9g.js +0 -1713
- package/dist/agent-runner-utils-BOJEvwHI.js +0 -266
- package/dist/agent-runner.runtime-BAC7XlZX.js +0 -3455
- package/dist/agent-runtime-D8J3kngS.js +0 -229
- package/dist/agent-via-gateway-BPZeOgET.js +0 -463
- package/dist/api-2J3KsQlI.js +0 -2
- package/dist/api-BNZFdrOx.js +0 -639
- package/dist/api-CQY8p5l4.js +0 -134
- package/dist/api-CdIYfiOh.js +0 -3
- package/dist/api-D5uGvU4G.d.ts +0 -52
- package/dist/api-DaLfnqrr.js +0 -2
- package/dist/api-DzpDMEqm.js +0 -6
- package/dist/apply-DTkOJDSZ.js +0 -54
- package/dist/apply-DY6Ov6qF.js +0 -41
- package/dist/approval-handler.runtime-9W6kSKLn.js +0 -130
- package/dist/assistant-D338eQWk.js +0 -291
- package/dist/attachment-normalize-BaGndElX.js +0 -225
- package/dist/attempt-execution-aOkjnMht.js +0 -558
- package/dist/attempt-execution.runtime-lKPuGjsg.js +0 -3
- package/dist/attempt-execution.shared-lwEBnvQR.js +0 -38
- package/dist/attempt.prompt-helpers-BVDwNazv.js +0 -475
- package/dist/attempt.tool-run-context-DXgP_TxW.js +0 -2094
- package/dist/binding-routing-CA-u9MaB.js +0 -113
- package/dist/binding-targets-SGf9XyYl.js +0 -121
- package/dist/bot-C0uHsCiq.js +0 -7894
- package/dist/bot-deps-CfqgukPx.js +0 -747
- package/dist/bot-deps-D0dGR0Um.js +0 -2
- package/dist/bot-message-context.runtime-aqONyuCb.js +0 -7
- package/dist/bot-message-context.session.runtime-CYJpmbne.js +0 -12
- package/dist/bot-native-commands.delivery.runtime-DjCvDhXo.js +0 -4
- package/dist/bot-native-commands.runtime-CNDOgqnt.js +0 -13
- package/dist/bridge-server-DX39VTjh.js +0 -113
- package/dist/browser-cli-BM0neIBN.js +0 -2
- package/dist/browser-cli-TjkCzsOd.js +0 -230
- package/dist/browser-cli-actions-input-Crdngwmz.js +0 -473
- package/dist/browser-cli-actions-observe-CR0DTzDP.js +0 -81
- package/dist/browser-cli-debug-CC9OYHxx.js +0 -137
- package/dist/browser-cli-inspect-DVWu-CO3.js +0 -104
- package/dist/browser-cli-manage-BfSgA18U.js +0 -443
- package/dist/browser-cli-resize-ddNFsnFm.js +0 -26
- package/dist/browser-cli-shared-B_5TDXXY.js +0 -50
- package/dist/browser-cli-state-CnLWkvHn.js +0 -337
- package/dist/browser-control-auth-1gcUHgnp.js +0 -2
- package/dist/browser-profiles-BkIb0hYP.js +0 -2
- package/dist/browser-runtime-RQ9H-pQ2.js +0 -384
- package/dist/build-C3ote3YU.js +0 -257
- package/dist/bundled-channel-config-schema-4eXcH-RE.d.ts +0 -3163
- package/dist/call-DY6_VEa_.d.ts +0 -43
- package/dist/capability-cli-D2fTtzuV.js +0 -1782
- package/dist/channel-B0dtLI6U.d.ts +0 -49
- package/dist/channel-B2MLRCOm.d.ts +0 -106
- package/dist/channel-B4XBSqBl.d.ts +0 -7
- package/dist/channel-BC3xWers.js +0 -808
- package/dist/channel-BJFPY0Kt.js +0 -376
- package/dist/channel-BMVs8cLm.js +0 -740
- package/dist/channel-BNmekEHv.js +0 -508
- package/dist/channel-BnPanYUC.js +0 -562
- package/dist/channel-BompXOlb.js +0 -1134
- package/dist/channel-Bq3wyp3c.d.ts +0 -8
- package/dist/channel-BwdtLWWj.js +0 -1556
- package/dist/channel-C1AEDysJ.d.ts +0 -47
- package/dist/channel-CEH1dfVt.d.ts +0 -12
- package/dist/channel-CQJHudhH.d.ts +0 -114
- package/dist/channel-CUu3R9QU.d.ts +0 -14
- package/dist/channel-CaugIi5d.js +0 -481
- package/dist/channel-CsdkcuzU.d.ts +0 -7
- package/dist/channel-D-QJ4LSf.d.ts +0 -28
- package/dist/channel-D07QdL-Z.d.ts +0 -8
- package/dist/channel-D1AKh1-N.d.ts +0 -6
- package/dist/channel-D7LE0yXG.js +0 -653
- package/dist/channel-DBucF-mL.js +0 -1496
- package/dist/channel-DC98b13r.js +0 -238
- package/dist/channel-DECcAIqn.d.ts +0 -104
- package/dist/channel-DGWSLAgs.js +0 -1249
- package/dist/channel-DHk6PKNy.js +0 -362
- package/dist/channel-DZW76PDC.d.ts +0 -8
- package/dist/channel-Dqyy2G9y.js +0 -955
- package/dist/channel-DwSP9REc.d.ts +0 -64
- package/dist/channel-LKyGksmz.d.ts +0 -26
- package/dist/channel-Z-wTsii5.js +0 -1777
- package/dist/channel-_B9ZXRPx.js +0 -867
- package/dist/channel-actions.runtime-C3lWtJBL.js +0 -265
- package/dist/channel-cGJKLfJe.d.ts +0 -427
- package/dist/channel-core-B3Xqnnjw.js +0 -5
- package/dist/channel-core-DshTARNf.d.ts +0 -6
- package/dist/channel-entry-contract-DpdwxgOw.d.ts +0 -112
- package/dist/channel-inbound-BnUDIbdQ.js +0 -80
- package/dist/channel-lifecycle-C4NrMjdz.d.ts +0 -125
- package/dist/channel-pairing-ndZVB-VX.d.ts +0 -58
- package/dist/channel-plugin-runtime-CFKbI6Pu.js +0 -998
- package/dist/channel-plugin-runtime-CS0_tyOZ.d.ts +0 -7
- package/dist/channel-runtime-BLFYOC-l.js +0 -408
- package/dist/channel-yBZ1hu-c.js +0 -2126
- package/dist/channel.runtime-BMBFwVOB.js +0 -1008
- package/dist/channel.runtime-BPaTa_4p.js +0 -4
- package/dist/channel.runtime-BiOmO6NR.js +0 -254
- package/dist/channel.runtime-BmwN1CYk.js +0 -652
- package/dist/channel.runtime-C5JA3DOQ.js +0 -21009
- package/dist/channel.runtime-CWmegcjl.js +0 -109
- package/dist/channel.runtime-DDs1y218.js +0 -733
- package/dist/channel.runtime-DJMJ7DxI.js +0 -88
- package/dist/channel.runtime-Dr7_P-K2.js +0 -2528
- package/dist/channel.setup-B03MiH5Q.d.ts +0 -6
- package/dist/channel.setup-BRhsffda.js +0 -10
- package/dist/channel.setup-ByuZMttY.d.ts +0 -8
- package/dist/channel.setup-C74nA6R0.js +0 -343
- package/dist/channel.setup-CIlbvWjW.d.ts +0 -7
- package/dist/channel.setup-RbyDP1dD.js +0 -1098
- package/dist/chat-CGdonziw.js +0 -2666
- package/dist/chrome-BbE0579R.js +0 -1503
- package/dist/cli-CJkC6ybf.js +0 -1341
- package/dist/cli-backend-Dg9IEgrP.d.ts +0 -5
- package/dist/cli-backend-DwmYGZX7.d.ts +0 -5
- package/dist/cli-compaction-D7zwr6if.js +0 -347
- package/dist/cli-metadata-gL02qQsZ.js +0 -22
- package/dist/cli-pk6gIQfi.d.ts +0 -20
- package/dist/cli-runner-DTqOC0Ap.js +0 -540
- package/dist/cli-runner-DX7wbmT5.js +0 -2
- package/dist/cli-runner.runtime-CMFns61M.js +0 -4
- package/dist/cli-runner.runtime-DH0Kp9FZ.js +0 -3
- package/dist/cli-shared-C_4_xNC-.d.ts +0 -20
- package/dist/client-B763Tol6.js +0 -650
- package/dist/client-adapter-WxKxH6x-.js +0 -897
- package/dist/client-factory-00sxHiJF.js +0 -9
- package/dist/command-auth-CXYQ5Z0j.js +0 -135
- package/dist/command-handlers-D1Ac0Dkj.js +0 -1609
- package/dist/command-registry-D2dsDDz5.js +0 -9
- package/dist/command-registry-Dih3NQG-.js +0 -4
- package/dist/command-registry-core-CjXOyB2J.js +0 -110
- package/dist/command-status.runtime-B0-uERwh.js +0 -90
- package/dist/commands-CLbV1tFt.d.ts +0 -113
- package/dist/commands-acp-pD2JpUSj.js +0 -74
- package/dist/commands-compact.runtime-V-TcIs65.js +0 -10
- package/dist/commands-handlers.runtime-5M-A0jiA.js +0 -6154
- package/dist/commands-status-Bm4dG6pI.js +0 -3
- package/dist/commands-status-qm4EnRyE.js +0 -16
- package/dist/commands-status.runtime-Bm4dG6pI.js +0 -3
- package/dist/commands-subagents-control.runtime-DI46smsH.js +0 -2
- package/dist/commands-subagents-control.runtime-rWDaFqzc.js +0 -3
- package/dist/commands-system-prompt-B4F4MOEY.js +0 -162
- package/dist/commands-system-prompt-jk5Mc_DP.js +0 -2
- package/dist/commands.runtime-Bc23O5Mi.js +0 -176
- package/dist/compact-CtN0DOvK.js +0 -480
- package/dist/compact-D1ChSGOh.js +0 -1141
- package/dist/compact.runtime-C7If8t90.js +0 -12
- package/dist/completion-cli-gXouR92c.js +0 -315
- package/dist/computer-use-CdO4BAyI.js +0 -367
- package/dist/config-BkIb0hYP.js +0 -2
- package/dist/config-dmYhst2s.js +0 -373
- package/dist/config-mutations-D2ETKy_j.js +0 -159
- package/dist/config-schema-BwKcspTI.d.ts +0 -20
- package/dist/config-schema-Dx48Ud8L.d.ts +0 -34
- package/dist/context-engine-host-compat-DgNqJwdY.js +0 -288
- package/dist/context-engine-host-compat-OWTQLkIP.js +0 -2
- package/dist/context-engine-lifecycle-CGVL8HdA.js +0 -1274
- package/dist/contracts-testkit-CzhusazO.d.ts +0 -145
- package/dist/control-auth-BFMiW_62.js +0 -114
- package/dist/control-service-D7r7Quub.js +0 -145
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/agents-DHLE0HFl.js +0 -1008
- package/dist/control-ui/assets/ar-DmY3OKJ7.js +0 -2
- package/dist/control-ui/assets/channel-config-extras-CxFOBh-V.js +0 -2
- package/dist/control-ui/assets/channels-C6FcgeKY.js +0 -367
- package/dist/control-ui/assets/cron-SXiWM7mY.js +0 -1013
- package/dist/control-ui/assets/de-nNWCMyC9.js +0 -2
- package/dist/control-ui/assets/debug-B0jMeZzd.js +0 -97
- package/dist/control-ui/assets/es-BcdhLNdf.js +0 -2
- package/dist/control-ui/assets/fa-DbS2z7VZ.js +0 -2
- package/dist/control-ui/assets/fr-CBqvw0rY.js +0 -2
- package/dist/control-ui/assets/id-DXES9f6X.js +0 -2
- package/dist/control-ui/assets/index-BimYwq-S.css +0 -1
- package/dist/control-ui/assets/index-DL8I3w4m.js +0 -7373
- package/dist/control-ui/assets/instances-CzcXlcf6.js +0 -57
- package/dist/control-ui/assets/it-DpT4ZVOU.js +0 -2
- package/dist/control-ui/assets/ja-JP-D8RXA_04.js +0 -2
- package/dist/control-ui/assets/ko-5en8VO8w.js +0 -2
- package/dist/control-ui/assets/logs-UowLBcx5.js +0 -74
- package/dist/control-ui/assets/nl-Bb10QoRg.js +0 -2
- package/dist/control-ui/assets/nodes-elwKg1C7.js +0 -436
- package/dist/control-ui/assets/pl-Y8UIOEIm.js +0 -2
- package/dist/control-ui/assets/preview-BBw3vauN.js +0 -2
- package/dist/control-ui/assets/pt-BR-DDsy5M68.js +0 -2
- package/dist/control-ui/assets/push-subscription-TTvs1whj.js +0 -2
- package/dist/control-ui/assets/sessions-zRBKS883.js +0 -399
- package/dist/control-ui/assets/skills-Bdaz7HoH.js +0 -314
- package/dist/control-ui/assets/skills-shared-DMTrs8i3.js +0 -11
- package/dist/control-ui/assets/th-D_2DtFn6.js +0 -2
- package/dist/control-ui/assets/tr-DBsYZTmE.js +0 -2
- package/dist/control-ui/assets/uk-BUxHBc05.js +0 -2
- package/dist/control-ui/assets/vi-B67Eos5b.js +0 -2
- package/dist/control-ui/assets/zh-CN-1-UH_6gQ.js +0 -2
- package/dist/control-ui/assets/zh-TW-CA4YEnf2.js +0 -2
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon-512.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +0 -12
- package/dist/control-ui/index.html +0 -322
- package/dist/control-ui/manifest.webmanifest +0 -40
- package/dist/control-ui/sw.js +0 -133
- package/dist/conversation-binding-runtime-BW_4K8cX.js +0 -4
- package/dist/conversation-runtime-oIeuYAld.js +0 -31
- package/dist/core-B7zb6eoz.d.ts +0 -224
- package/dist/core-Cqwgrdgs.js +0 -282
- package/dist/core-api-DI9CNhVz.js +0 -2
- package/dist/core-api-Dcj6myhZ.js +0 -5
- package/dist/crestodian-DVM5VVBT.js +0 -55
- package/dist/daocore-runtime-DogaiqPT.d.ts +0 -151
- package/dist/daocore-tools-bO6317PZ.js +0 -11727
- package/dist/delivery-BCvDWVt-.js +0 -1002
- package/dist/dialogue-D7jagbT_.js +0 -37
- package/dist/dir-fetch-tool-BT5EPw-5.js +0 -565
- package/dist/dir-list-tool-H_efDjDq.js +0 -100
- package/dist/direct-dm-D0B-QMik.js +0 -64
- package/dist/directive-handling.fast-lane-DsGCtBC-.js +0 -68
- package/dist/directive-handling.impl-C-1mgd9g.js +0 -2
- package/dist/directive-handling.impl-DumICYAp.js +0 -818
- package/dist/directive-handling.model-selection-BJZn2fo_.js +0 -122
- package/dist/directive-handling.persist.runtime-D62V2_9_.js +0 -263
- package/dist/dispatch-CnOOlfPn.js +0 -1640
- package/dist/dispatch-acp-transcript.runtime-DV_7Zl9P.js +0 -40
- package/dist/dispatch-acp.runtime-ATTViG-t.js +0 -18
- package/dist/doctor-8vhWy3Dw.js +0 -2
- package/dist/doctor-CKYTXvU7.js +0 -6
- package/dist/doctor-config-flow-B0Ilj0MM.js +0 -1741
- package/dist/doctor-core-checks-B0DeLp7M.js +0 -2
- package/dist/doctor-core-checks-NFFEe2qP.js +0 -573
- package/dist/doctor-health-BQDkMVRf.js +0 -65
- package/dist/doctor-health-contributions-BTtoe4Zy.js +0 -696
- package/dist/doctor-lint-CtjiT5S1.js +0 -94
- package/dist/doctor-state-integrity-C1p_aTX_.js +0 -1231
- package/dist/doctor-update-Dzr9Vt00.js +0 -58
- package/dist/doctor-update-fix-Dw80wTUs.js +0 -107
- package/dist/dynamic-tools-Cb1BxOUV.js +0 -486
- package/dist/embedded-backend-DIv3GabL.js +0 -579
- package/dist/embedded-gateway-stub.runtime-DqgU4q-g.js +0 -12
- package/dist/embedding-provider-B82QlZsy.d.ts +0 -21
- package/dist/embedding-provider-Cmb3dgUf.d.ts +0 -65
- package/dist/embedding-provider-w7EJz-DO.d.ts +0 -16
- package/dist/exec-approvals-ClOFMgg8.js +0 -149
- package/dist/file-fetch-tool-CIe7NhYV.js +0 -124
- package/dist/file-write-tool-DBpMRVuc.js +0 -127
- package/dist/format-DwlQcHW-.js +0 -1145
- package/dist/gateway-cli-B-RpSgut.js +0 -435
- package/dist/gateway-method-runtime-BblhHt-0.js +0 -21
- package/dist/gateway-runtime-BcWCu-QH.d.ts +0 -163
- package/dist/gemini-cli-provider-DtyOwxHA.d.ts +0 -6
- package/dist/get-reply-HRNSgWtJ.js +0 -4689
- package/dist/get-reply-from-config.runtime-D_IjyVEy.js +0 -2
- package/dist/graph-users-xOkVRyWa.js +0 -1419
- package/dist/group-access-5rOw40mA.js +0 -112
- package/dist/handle-action.guild-admin-3izRlfhG.js +0 -288
- package/dist/harness-DSATBx4q.js +0 -61
- package/dist/health-gXf5LPQE.js +0 -4
- package/dist/heartbeat-runner-BAl6rYJ4.js +0 -5
- package/dist/heartbeat-runner.runtime-BwR4hXGN.js +0 -4
- package/dist/hook-runtime-Cms52qXe.d.ts +0 -107
- package/dist/hooks-Ds30xkRl.js +0 -534
- package/dist/http-registry-D3Cdok5J.d.ts +0 -23
- package/dist/image-generation-runtime-DhYgou3B.d.ts +0 -21
- package/dist/inbound-direct-dm-runtime-VLA3Sl_Y.js +0 -2
- package/dist/inbound-reply-dispatch-B1Yv-_Ol.js +0 -148
- package/dist/index-ChRAMnH9.d.ts +0 -3971
- package/dist/init-C94m6gc5.js +0 -59
- package/dist/inline-buttons-B48KLvRY.js +0 -40
- package/dist/interactive-dispatch-B-NLdr77.d.ts +0 -56
- package/dist/interactive-dispatch-B66zssEF.d.ts +0 -143
- package/dist/internal-events-DH1wKI3W.js +0 -90
- package/dist/isolated-agent-BHtpDjQ3.js +0 -1118
- package/dist/isolated-agent-CQ8xLCdA.js +0 -2
- package/dist/lifecycle-J2_rGItq.js +0 -571
- package/dist/list.probe-CQkRrePt.js +0 -449
- package/dist/list.status-command-Dh4C_nmX.js +0 -789
- package/dist/llm-slug-generator-CuTyqyw9.js +0 -78
- package/dist/loader-Ben-RYnp.d.ts +0 -142
- package/dist/local-dispatch.runtime-DMFlGKN5.js +0 -9
- package/dist/manager-BDWyUfHJ.d.ts +0 -356
- package/dist/manager-CuzV3XAs.d.ts +0 -205
- package/dist/manager.runtime-ChEFeq5B.js +0 -2714
- package/dist/markdown-to-line-BXszL2cy.js +0 -811
- package/dist/mcp-http-BfLRPB10.js +0 -555
- package/dist/mcp-http-C4jMPkoA.js +0 -2
- package/dist/media-understanding-provider-By_IYDJy.js +0 -339
- package/dist/memory-core-host-engine-storage-BAq5Rf51.d.ts +0 -54
- package/dist/memory-embedding-adapter-Cv87QsD0.d.ts +0 -5
- package/dist/message-actions-CnGb9RhR.js +0 -145
- package/dist/message-handler-BczaNv3J.js +0 -384
- package/dist/message-handler-txIHUJJr.js +0 -1715
- package/dist/message-handler.preflight-DQ_XIRJD.js +0 -1125
- package/dist/message-handler.process-DW_BauDK.js +0 -1484
- package/dist/migration-BOkhOT4K.d.ts +0 -45
- package/dist/model-B4s-pIp8.d.ts +0 -33
- package/dist/model-CzeDtlL2.js +0 -74
- package/dist/model-selection-DISTEWT3.js +0 -272
- package/dist/models-6NYWdsJM.d.ts +0 -24
- package/dist/models-Cs632hpM.js +0 -104
- package/dist/models-DFdDefW_.js +0 -2
- package/dist/models-cli-CEJaAepl.js +0 -256
- package/dist/monitor-1sdwxltF.js +0 -2788
- package/dist/monitor-B3satZZM.js +0 -2
- package/dist/monitor-BjTf4-1k.js +0 -715
- package/dist/monitor-Blfd3oxm.js +0 -1370
- package/dist/monitor-CTBBctRZ.js +0 -60
- package/dist/monitor-DMs9Fc-I.js +0 -4377
- package/dist/monitor-Jaf6yIPY.js +0 -1657
- package/dist/monitor-QlSkTI6D.js +0 -834
- package/dist/monitor-auth-C1tksIdC.js +0 -179
- package/dist/monitor-polling.runtime-BfiQ9WKu.js +0 -883
- package/dist/monitor-webhook.runtime-DaN0Z6_6.js +0 -387
- package/dist/monitor.account-DXs-I96r.js +0 -5233
- package/dist/monitor.runtime-CfhDXAnn.js +0 -2
- package/dist/monitor.webhook-Dh2yCA0H.js +0 -180
- package/dist/node-cli-sessions-BRSHPLpR.js +0 -1228
- package/dist/openai-codex-provider-CByFL0Au.d.ts +0 -5
- package/dist/openai-http-CJKcPRWW.js +0 -824
- package/dist/openai-provider-DbEgHbfx.d.ts +0 -5
- package/dist/openresponses-http-BhyRvqJ0.js +0 -1173
- package/dist/operations-CL7dqxSs.js +0 -805
- package/dist/outbound-adapter-BzLFym-i.js +0 -543
- package/dist/outbound-session-route-do6mbRaF.js +0 -45
- package/dist/outbound.runtime-ClwB5soC.js +0 -2
- package/dist/pairing-challenge-EwSQYSud.d.ts +0 -87
- package/dist/pi-embedded-BtyxupRo.js +0 -3796
- package/dist/pi-embedded-DC6txKUX.js +0 -4
- package/dist/pi-embedded.runtime-CLGqbc8E.js +0 -4
- package/dist/pi-tools-BNtGWzuL.js +0 -2413
- package/dist/plan-BKvy4WrJ.js +0 -81
- package/dist/plan-DwVlQpE1.js +0 -112
- package/dist/plugin-BehbkTVr.d.ts +0 -17
- package/dist/plugin-CY0rEF7s.js +0 -12396
- package/dist/plugin-app-cache-key-DNUt0H7R.js +0 -46
- package/dist/plugin-enabled-Cyd8634I.js +0 -233
- package/dist/plugin-entry-feg_rkHL.d.ts +0 -47
- package/dist/plugin-registration-B_-ymgPg.js +0 -88
- package/dist/plugin-runtime-paqzXBLJ.d.ts +0 -117
- package/dist/plugin-sdk/scripts/lib/plugin-sdk-doc-metadata.d.ts +0 -107
- package/dist/plugin-service-C0JwHvDr.d.ts +0 -24
- package/dist/plugin-service-Dxx-FdeS.js +0 -1229
- package/dist/policy-BXjjr3b_.js +0 -138
- package/dist/policy-cKo9Yeux.js +0 -680
- package/dist/prepare.runtime-DKbtJNij.js +0 -732
- package/dist/preview-warnings-B_dB0-nc.js +0 -392
- package/dist/probe-D02PTGyD.js +0 -47
- package/dist/probe-DywFeNCV.js +0 -682
- package/dist/probe-f3qP15_E.js +0 -2204
- package/dist/probe-sSNH7OtW.js +0 -2
- package/dist/program-CI-yGmHj.js +0 -131
- package/dist/prompt-overlay-qLjnjnSK.d.ts +0 -23
- package/dist/provider-0MTK_A59.js +0 -32
- package/dist/provider-Bqz_XGo0.js +0 -8735
- package/dist/provider-DguV0rAM.js +0 -32
- package/dist/provider-Vf0kCR9H.js +0 -152
- package/dist/provider-api-key-auth-CB8Tllmv.d.ts +0 -27
- package/dist/provider-auth-result-Xze96yVn.d.ts +0 -21
- package/dist/provider-catalog-runtime-Bo88wUpB.d.ts +0 -23
- package/dist/provider-catalog-shared-rq7-Hkyg.d.ts +0 -62
- package/dist/provider-dispatcher-DYgMXESe.js +0 -22
- package/dist/provider-hook-runtime-bhgA4zLg.d.ts +0 -61
- package/dist/provider-model-shared-Bv_vhH6i.d.ts +0 -143
- package/dist/provider-models-DzbXgGDD.d.ts +0 -12
- package/dist/provider-policy-Cx2IwhQ-.d.ts +0 -30
- package/dist/provider-registration-D4DJp8vF.d.ts +0 -6
- package/dist/provider-registry-BQ5DzWBt.d.ts +0 -8
- package/dist/provider-registry-BrtezAkH.d.ts +0 -30
- package/dist/provider-registry-DG571X-9.d.ts +0 -8
- package/dist/provider-runtime-BJlV-8wH.d.ts +0 -359
- package/dist/provider-self-hosted-setup-C5mGtzPJ.d.ts +0 -74
- package/dist/provider-session.runtime-DPLsI_az.js +0 -9
- package/dist/provider-stream-D-MYyujL.d.ts +0 -140
- package/dist/provider-stream-shared-B6pQNRl4.d.ts +0 -128
- package/dist/provider.runtime-Dqb234pz.js +0 -2
- package/dist/providers.runtime-B9kfx6q8.d.ts +0 -25
- package/dist/public-surface-loader-BFaumhij.js +0 -114
- package/dist/pw-ai-G5xV3oAx.js +0 -3029
- package/dist/pw-role-snapshot-Dx3HJBHP.js +0 -333
- package/dist/reaction-level-cwg9IPV-.js +0 -19
- package/dist/reaction-runtime-api-BO5tonA_.js +0 -116
- package/dist/realtime-transcription-CAC89bnc.d.ts +0 -43
- package/dist/realtime-transcription-provider-BPUt8lMk.js +0 -205
- package/dist/realtime-transcription-provider-ChYQDNhv.d.ts +0 -5
- package/dist/realtime-transcription-provider-DTYtMlJi.d.ts +0 -28
- package/dist/realtime-transcription-provider-DirKeOjA.d.ts +0 -32
- package/dist/realtime-transcription-provider-QHEXWhCJ.d.ts +0 -37
- package/dist/realtime-voice-Bm0GBqnc.d.ts +0 -333
- package/dist/realtime-voice-provider-NcUDkuN4.d.ts +0 -5
- package/dist/register-hPi-PJ7K.js +0 -2178
- package/dist/register.agent-C17wwmyB.js +0 -156
- package/dist/register.crestodian-BgN2eNeU.js +0 -24
- package/dist/register.maintenance-CZV43uUT.js +0 -105
- package/dist/register.runtime-B6KhmuJw.js +0 -54
- package/dist/register.runtime-CXLFfKiU.d.ts +0 -6
- package/dist/register.subclis-By70wsLN.js +0 -31
- package/dist/register.subclis-D_XDgsMy.js +0 -3
- package/dist/register.subclis-core-CYi-wxpA.js +0 -273
- package/dist/registry-DXBS27qE.d.ts +0 -91
- package/dist/registry-types-DlO771W4.d.ts +0 -392
- package/dist/repair-sequencing-ze6dXKp3.js +0 -640
- package/dist/reply-delivery-BRsL-nIn.js +0 -196
- package/dist/reply-runtime-hB7p7Uov.js +0 -11
- package/dist/reply.runtime-D_IjyVEy.js +0 -2
- package/dist/request-C6QBV_dA.js +0 -54
- package/dist/resolve-allowlist-zmvmVPzW.js +0 -220
- package/dist/result-fallback-classifier-hWTcOYyH.js +0 -79
- package/dist/route-BMCrq1SN.js +0 -469
- package/dist/route-resolution-nWgSniti.js +0 -274
- package/dist/routes-BXyfYxi-.js +0 -2
- package/dist/routes-CpMZFxzv.js +0 -3602
- package/dist/run-Bzp1cq1J.js +0 -1163
- package/dist/run-attempt-DMj1Q3oE.js +0 -7704
- package/dist/run-command-CbDBts53.js +0 -23
- package/dist/run-command-CrJ2mrht.js +0 -2
- package/dist/run-embedded.runtime-sD3O3k2K.js +0 -4
- package/dist/run-execution-cli.runtime-CG1zNse6.js +0 -4
- package/dist/run-subagent-registry.runtime-CGzIerQZ.js +0 -2
- package/dist/runtime-B0ZKPxxL.js +0 -6179
- package/dist/runtime-C3k-ZByi.d.ts +0 -17
- package/dist/runtime-Dh-KFKJv.js +0 -1287
- package/dist/runtime-api-9Xxm9K2E.js +0 -21
- package/dist/runtime-api-C2252PQ4.js +0 -4
- package/dist/runtime-api-C7ToEUFX2.d.ts +0 -3151
- package/dist/runtime-api-Cl3W6JLB.js +0 -13
- package/dist/runtime-api-CwyQGzrm.js +0 -24
- package/dist/runtime-api-DQVZQ82e.js +0 -17
- package/dist/runtime-api-Ksdts3J7.js +0 -13
- package/dist/runtime-api-lHayJI0f.js +0 -3
- package/dist/runtime-api.actions-CHH4JoFd.js +0 -3
- package/dist/runtime-api.actions-CzDO06T7.d.ts +0 -23
- package/dist/runtime-api.monitor-CuAnxOiA.js +0 -6
- package/dist/runtime-api.send-C5Ndv4Sb.js +0 -4
- package/dist/runtime-api.send-C_MjuzGA.d.ts +0 -38
- package/dist/runtime-api.threads-Car1xuWI.js +0 -2
- package/dist/runtime-channel-PhHAbE3P.js +0 -2
- package/dist/runtime-channel-ehNPdqhp.js +0 -150
- package/dist/runtime-doctor-_yVIDUi3.d.ts +0 -48
- package/dist/runtime-embedded-pi.runtime-BExQEON7.js +0 -2
- package/dist/runtime-l-x1mIPp.js +0 -438
- package/dist/runtime-taskflow-PDIujF9q.d.ts +0 -435
- package/dist/sanitize-outbound-CINW3wBb.js +0 -127
- package/dist/sdk-setup-tools-DotzY-Ff.js +0 -8
- package/dist/secrets-BdWCp_pg.js +0 -113
- package/dist/security-audit-BMS02wuX.js +0 -122
- package/dist/security-audit-BXupNbYa.js +0 -118
- package/dist/security-audit.runtime-CONAKFRk.js +0 -2
- package/dist/selection-8iOGMBPh.js +0 -16157
- package/dist/selection-D9-GNcGp.js +0 -3
- package/dist/send-BsqMC7vV.js +0 -143
- package/dist/send-CTDEXMPp.d.ts +0 -231
- package/dist/send-ChUpwNpF.js +0 -2
- package/dist/send-D92kiCYa.js +0 -192
- package/dist/send-DaFuA5cD.d.ts +0 -105
- package/dist/send-LSm52k6p.js +0 -1631
- package/dist/send.components-D_1vDkKM.js +0 -2
- package/dist/send.components-Scs0rrDy.js +0 -500
- package/dist/send.runtime-BJbljin6.js +0 -2
- package/dist/send.types-DU1uiiR9.d.ts +0 -160
- package/dist/server-BQ9wTpKB.js +0 -73
- package/dist/server-CHWh_XGy.js +0 -24
- package/dist/server-context-D42gG6GT.js +0 -2
- package/dist/server-context-oRlMLKPz.js +0 -955
- package/dist/server-cron-BpLzGXmi.js +0 -2
- package/dist/server-cron-DFsVLz6k.js +0 -2989
- package/dist/server-methods-CVgaE49L.js +0 -16499
- package/dist/server-node-events-DmaGt81F.js +0 -596
- package/dist/server-plugin-bootstrap-ypOUJ438.js +0 -70
- package/dist/server-plugins-BZZxcYFZ.js +0 -432
- package/dist/server-reload-handlers-Ccu2KW5E.js +0 -714
- package/dist/server-restart-sentinel-Bud1fPG5.js +0 -2
- package/dist/server-restart-sentinel-C4oYiDTT.js +0 -747
- package/dist/server-runtime-services-BAlijw2O.js +0 -267
- package/dist/server-runtime-services-BY8y-CAk.js +0 -2
- package/dist/server-startup-plugins-utvxpVCl.js +0 -113
- package/dist/server-startup-post-attach-C09QVu1D.js +0 -716
- package/dist/server-ws-runtime-hgZQmILO.js +0 -349
- package/dist/server.impl-btEzW7aF.js +0 -2587
- package/dist/service-DYvUSJDx.js +0 -1446
- package/dist/session-binding-Smi9h573.js +0 -219
- package/dist/session-binding-vAzR408o.js +0 -2
- package/dist/session-kill-http-HXI6hUDG.js +0 -121
- package/dist/session-reset-service-CdqhH7XS.js +0 -625
- package/dist/session-route-DX9HyYoG.js +0 -93
- package/dist/session-status.runtime-B7dGtknj.js +0 -2
- package/dist/session-subagent-reactivation.runtime-Dn-wvdjM.js +0 -2
- package/dist/session-tab-registry-UN4VZE8a.js +0 -521
- package/dist/sessions-history-http--Dgcvhb0.js +0 -430
- package/dist/sessions.runtime-LnYxeKSP.js +0 -2
- package/dist/setup-api-BfO7Ctmd.js +0 -29
- package/dist/setup-core-DlCsv-9q.js +0 -174
- package/dist/setup-surface-BDXmLycW.js +0 -221
- package/dist/setup-surface-Bi-pZtB0.js +0 -405
- package/dist/setup-surface-Bk9MdZ9I.js +0 -288
- package/dist/setup-surface-m649hpou.js +0 -320
- package/dist/shared-DwXuhcIz.js +0 -121
- package/dist/shared-client-Cj3X4R8q.js +0 -2
- package/dist/shared-client-D02xLLJg.js +0 -629
- package/dist/shared-eYKaB8rP.d.ts +0 -115
- package/dist/side-question-DbsrGTKR.js +0 -683
- package/dist/simple-completion-runtime-D3SeEaWT.d.ts +0 -73
- package/dist/skill-tool-dispatch.runtime-CswUeFQB.js +0 -143
- package/dist/slash-state-Br7bOIIy.js +0 -2166
- package/dist/speech-Dbhvhbdq.d.ts +0 -47
- package/dist/speech-core-8X_D3HLF.d.ts +0 -36
- package/dist/speech-provider-BHcOkoLn.js +0 -184
- package/dist/speech-provider-BYm63_co.d.ts +0 -8
- package/dist/speech-provider-BtJxZzKb.d.ts +0 -8
- package/dist/speech-provider-CbneUhtJ.d.ts +0 -5
- package/dist/speech-provider-DOAvAvlS.d.ts +0 -5
- package/dist/speech-provider-DdfnOmrC.d.ts +0 -5
- package/dist/speech-provider-ptNkD7Yf.d.ts +0 -34
- package/dist/src-DcIZ_w7l.js +0 -4256
- package/dist/startup-context-BU3ZwnPZ.js +0 -313
- package/dist/status-subagents.runtime-U9cVRB6A.js +0 -18
- package/dist/status-text-DlZ-OoHI.js +0 -296
- package/dist/sticker-cache-BfgCFMo_.js +0 -206
- package/dist/sticker-vision.runtime-DYSdlJUC.js +0 -17
- package/dist/stream-BHkpDd1i.d.ts +0 -10
- package/dist/stream-C6huJP_D.d.ts +0 -5
- package/dist/stream-D4Pmcj3t.d.ts +0 -16
- package/dist/stream-DpSe6hAE.d.ts +0 -19
- package/dist/stream-DrRUuJ8m.d.ts +0 -120
- package/dist/stream-wrappers-DLxwmPDI.d.ts +0 -21
- package/dist/subagent-announce-BntptirO.js +0 -354
- package/dist/subagent-announce-delivery-6GUsisag.js +0 -958
- package/dist/subagent-control-C7DSvkWz.js +0 -508
- package/dist/subagent-hooks-4aumktTW.js +0 -2
- package/dist/subagent-hooks-COUrrxEC.js +0 -2
- package/dist/subagent-hooks-DUGDXbSM.js +0 -146
- package/dist/subagent-hooks-DjDgoKjj.js +0 -230
- package/dist/subagent-hooks-DjvL3k1b.js +0 -2
- package/dist/subagent-hooks-api-BxfHMA2E.js +0 -22
- package/dist/subagent-hooks-api-Cn7QkuFW.js +0 -23
- package/dist/subagent-hooks-api-_lgvYj20.js +0 -23
- package/dist/subagent-hooks-gWxlJnmo.js +0 -116
- package/dist/subagent-orphan-recovery-CcAPcsDk.js +0 -352
- package/dist/subagent-registry-BsYF1Amv.js +0 -3
- package/dist/subagent-registry-LC_Gic13.js +0 -2351
- package/dist/subagent-session-cleanup-6AY_7hyu.js +0 -525
- package/dist/subagent-spawn-C2IO1E1i.js +0 -1164
- package/dist/target-id-By34AE0b.js +0 -107
- package/dist/targets-B40DzW6Y.js +0 -44
- package/dist/targets-BttGNxRs.js +0 -19
- package/dist/targets-C6bpLZdS.js +0 -19
- package/dist/targets-CZhlhiDN.d.ts +0 -10
- package/dist/targets-HPytm6Z8.d.ts +0 -10
- package/dist/test-fixtures-HY6a4nTW.d.ts +0 -26
- package/dist/testing-BzZIozrH.js +0 -267
- package/dist/thinking-policy-wJH8MNPa.d.ts +0 -5
- package/dist/thread-bindings-CBiuE4G4.js +0 -228
- package/dist/thread-bindings-CTJq5UHl.js +0 -232
- package/dist/thread-bindings-bN9Ad5r9.js +0 -571
- package/dist/thread-bindings-kXHwWthg.js +0 -8
- package/dist/thread-bindings.discord-api-C8jkPA0w.js +0 -187
- package/dist/thread-bindings.manager-BsFmjrbx.js +0 -536
- package/dist/thread-bindings.manager-DfJgNAl6.js +0 -2
- package/dist/thread-lifecycle-gR5OSLzh.js +0 -1614
- package/dist/token-B2FhcBoz.js +0 -134
- package/dist/tool-47nHlaiR.js +0 -139
- package/dist/tool-actions.runtime-DwQ1lVPo.js +0 -534
- package/dist/tool-plugin-CmXn59FQ.d.ts +0 -77
- package/dist/tool-resolution-DQej_E5w.js +0 -149
- package/dist/tool-split-CaXOLBeI.d.ts +0 -19
- package/dist/tools-effective-inventory-CyXaSANM.js +0 -204
- package/dist/tools-invoke-http-yo3HU4V6.js +0 -67
- package/dist/tools-invoke-shared-LpV_xD9g.js +0 -200
- package/dist/transport-stream-lU_hAKuv.d.ts +0 -42
- package/dist/tts-E7ULNzl4.js +0 -66
- package/dist/tui-B-wyN6wJ.js +0 -4709
- package/dist/tui-CdI6yMis.js +0 -2
- package/dist/tui-backend-CXej-4Er.js +0 -256
- package/dist/tui-cli-wboa0AnA.js +0 -37
- package/dist/typed-cases-BYRVKA1F.d.ts +0 -68
- package/dist/types-CD1xwSld.d.ts +0 -786
- package/dist/types-Zj4Bq9h-2.d.ts +0 -3650
- package/dist/types.public-B0VjJLe9.d.ts +0 -70
- package/dist/update-cli-CGUsDh2T.js +0 -3665
- package/dist/update-global-BbP9IhEf.js +0 -601
- package/dist/update-runner-B54rgAmr.js +0 -1798
- package/dist/video-generation-runtime-DsFG7djU.d.ts +0 -21
- package/dist/video-model-catalog-CfhC-Mol.d.ts +0 -16
- package/dist/vision-tools-wacIK5vr.js +0 -1409
- package/dist/web-search-AMwc61Dr.js +0 -62
- package/dist/web-search-provider.runtime-CNG2uQTF.js +0 -2
- package/dist/web-search-provider.runtime-oBaJtm_S.js +0 -328
- package/dist/webhook-targets-DqetRJVn.d.ts +0 -99
- package/dist/xai-oauth-DOqf2jTO.js +0 -479
- package/dist/xai-user-agent-Dk71wEWd.js +0 -32
- package/dist/zod-schema.core-BhLPa6BF.d.ts +0 -166
- /package/dist/{acp-runtime-backend-4DfhM5M9.js → acp-runtime-backend-CxP454w8.js} +0 -0
- /package/dist/{channel-actions-CYB0u2id.js → channel-actions-AudMk4Yk.js} +0 -0
- /package/dist/{command-status-runtime-CPIRzAU6.js → command-status-runtime-BWRWzQv1.js} +0 -0
- /package/dist/{delegate-DpQ2iXjn.js → delegate-CLZeP48P.js} +0 -0
- /package/dist/{dispatch-acp-Bdp6i1Mz.js → dispatch-acp-BK0Zh3_p.js} +0 -0
- /package/dist/{heartbeat-runner-Cx01gr5N.js → heartbeat-runner-BouutzYV.js} +0 -0
- /package/dist/{library-BSsSuIcq.js → library-C-O719bG.js} +0 -0
- /package/dist/{models-D6WT5XG8.d.ts → models-D6WT5XG82.d.ts} +0 -0
- /package/dist/{run-executor.runtime-DwZVL5h6.js → run-executor.runtime-DF1Wol1i.js} +0 -0
- /package/dist/{shared-DJ7fJ5uN.js → shared-BqbJdmuE.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-DO9V-hwC.js";
|
|
8
|
-
import { i as getRuntimeConfig } from "./io-BAMe9xIp.js";
|
|
9
|
-
import "./config-D3DfZ5wH.js";
|
|
10
|
-
import { r as callGateway } from "./call-6bPvafaM.js";
|
|
11
|
-
import { t as getGlobalHookRunner } from "./hook-runner-global-LaQbBuC_.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-CM8N9kY-.js";
|
|
16
|
-
import { u as updateSessionStore } from "./store-DCv52kkG.js";
|
|
17
|
-
import "./sessions-8VUoFdFd.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-CGC5xCDG.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-CZdP7tUD.js";
|
|
24
|
-
import "./pi-bundle-mcp-tools-CbdQPWo1.js";
|
|
25
|
-
import { i as waitForAgentRun, l as formatBlockedLivenessError, t as isRecoverableAgentWaitError, u as isBlockedLivenessState } from "./run-wait-Bix44iTH.js";
|
|
26
|
-
import { d as withSubagentOutcomeTiming, t as deleteSubagentSessionForCleanup } from "./subagent-session-cleanup-6AY_7hyu.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-BntptirO.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-CcAPcsDk.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 };
|