@gaodefa/daocore 2026.5.25 → 2026.5.26
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-By0wxKlI.js +277 -0
- package/dist/abort.runtime-C7zfjxBp.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/account-inspect-DTeLlJz-.js +173 -0
- package/dist/accounts-B776XBaL.js +119 -0
- package/dist/accounts-CLyZILFF.js +107 -0
- package/dist/accounts-DiXgq14W.js +107 -0
- package/dist/accounts-iTlRLYN8.js +2 -0
- package/dist/acp/control-plane/manager.d.ts +2 -1
- package/dist/acp-runtime-D9YQyGax.js +26 -0
- package/dist/acp-spawn-CWciV70C.js +1275 -0
- package/dist/acp-spawn-DjaS4O_V.js +2 -0
- package/dist/acp-stateful-target-driver-ByvGCj_i.js +89 -0
- package/dist/action-kill-DXeOA6YH.js +33 -0
- package/dist/action-runtime-BjQnG6qb.js +469 -0
- package/dist/action-runtime-api-a73ODsYk.js +2 -0
- package/dist/action-send-B_F3xwIu.js +39 -0
- package/dist/action-spawn-BFiW7gZJ.js +47 -0
- package/dist/actions-Bi7eE2I6.js +161 -0
- package/dist/actions.runtime-DmtbCLld.js +5 -0
- package/dist/agent-BOI4AdYK.js +3 -0
- package/dist/agent-DQPyDWP5.js +2 -0
- package/dist/agent-command-ClCxEw82.js +1367 -0
- package/dist/agent-command-DKqx29vm.d.ts +105 -0
- package/dist/agent-components.runtime-C5wxy4D_.js +10 -0
- package/dist/agent-components.runtime.js +1 -1
- package/dist/agent-harness-BsBVO7nU.d.ts +146 -0
- package/dist/agent-harness-runtime-CkdXIMHI.js +180 -0
- package/dist/agent-harness-runtime-KHFO733B.d.ts +691 -0
- package/dist/agent-harness-task-runtime-CDtn5RjX.js +140 -0
- package/dist/agent-runner-execution-lXW8y0i2.js +1713 -0
- package/dist/agent-runner-utils-OdM9hLGt.js +266 -0
- package/dist/agent-runner.runtime-fZnfhCJI.js +3455 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-Dp0RDnX1.js +229 -0
- package/dist/agent-via-gateway-vsBf3nqZ.js +463 -0
- package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
- package/dist/agents.commands.add-C94vGOFH.js +304 -0
- package/dist/agents.commands.delete-D-p2NL4v.js +128 -0
- package/dist/api-BZ2QC7WM.js +2 -0
- package/dist/api-BmYK5Dge.js +6 -0
- package/dist/api-CGdlHCIH.js +3 -0
- package/dist/api-CGjlsXii.js +134 -0
- package/dist/api-DGqp6wZo.js +2 -0
- package/dist/api-DKpE-zdY.js +639 -0
- package/dist/api-DNyivJXK.d.ts +52 -0
- package/dist/apply-GK4z5lYw.js +54 -0
- package/dist/apply-_yxsBkiR.js +41 -0
- package/dist/approval-handler.runtime-C7d9p3DG.js +130 -0
- package/dist/assistant-B-h25aRy.js +291 -0
- package/dist/attachment-normalize-DWZ4Nrn-.js +225 -0
- package/dist/attempt-execution-BY9C1EOu.js +558 -0
- package/dist/attempt-execution.runtime-SR7eolDa.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt-execution.shared-h6uYmkJz.js +38 -0
- package/dist/attempt.prompt-helpers-COc5m_TZ.js +475 -0
- package/dist/attempt.tool-run-context-CAtfgOqC.js +2094 -0
- package/dist/auth-BdkNYTYU.js +541 -0
- package/dist/banner-0TOO6XHd.js +397 -0
- package/dist/banner-DTHug6Ey.js +2 -0
- package/dist/binding-routing-BJ_A83Nl.js +113 -0
- package/dist/binding-targets-D5dmPh4R.js +121 -0
- package/dist/bot-DX1uG3P-.js +7894 -0
- package/dist/bot-deps-BpaYejaN.js +2 -0
- package/dist/bot-deps-CKFDy5y3.js +747 -0
- package/dist/bot-message-context.runtime-BKOeRg34.js +7 -0
- package/dist/bot-message-context.runtime.js +1 -1
- package/dist/bot-message-context.session.runtime-xgZdFv6P.js +12 -0
- package/dist/bot-message-context.session.runtime.js +1 -1
- package/dist/bot-native-commands.delivery.runtime-DDMQrRfJ.js +4 -0
- package/dist/bot-native-commands.delivery.runtime.js +1 -1
- package/dist/bot-native-commands.runtime-CVVvUz0h.js +13 -0
- package/dist/bot-native-commands.runtime.js +1 -1
- package/dist/bridge-server-37OWsDZc.js +113 -0
- package/dist/browser-cli-BC_6aZJV.js +2 -0
- package/dist/browser-cli-Dg1ipmgf.js +230 -0
- package/dist/browser-cli-actions-input-B0QuzzSW.js +473 -0
- package/dist/browser-cli-actions-observe-C246bas5.js +81 -0
- package/dist/browser-cli-debug-F64e_v4B.js +137 -0
- package/dist/browser-cli-inspect-Srn6eWjO.js +104 -0
- package/dist/browser-cli-manage-CaZ97-Me.js +443 -0
- package/dist/browser-cli-resize-CUR20fvZ.js +26 -0
- package/dist/browser-cli-shared-BhphnFVo.js +50 -0
- package/dist/browser-cli-state-CzaNXNWF.js +337 -0
- package/dist/browser-control-auth-DTY0Wx2B.js +2 -0
- package/dist/browser-profiles-BDGPPDJ7.js +2 -0
- package/dist/browser-runtime-aqBKI8Oi.js +384 -0
- package/dist/build-CG7aTzO9.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-vrKpzJVf.d.ts +3163 -0
- package/dist/call-Za47o1YZ.d.ts +43 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-BhF26gVm.js +1782 -0
- package/dist/channel-5RHqx1Ge.d.ts +26 -0
- package/dist/channel-5_XS0Mss.js +508 -0
- package/dist/channel-7L-vyWOO.js +362 -0
- package/dist/channel-B07xPK0L.d.ts +114 -0
- package/dist/channel-B9b-GX-e.d.ts +14 -0
- package/dist/channel-BBWX_bA0.d.ts +7 -0
- package/dist/channel-BVxTyJ0I.js +376 -0
- package/dist/channel-BWIsr1r-.js +808 -0
- package/dist/channel-Ba0p4xM-.js +1134 -0
- package/dist/channel-Bi2nTop1.js +481 -0
- package/dist/channel-Bj29iFgF.js +740 -0
- package/dist/channel-Bl8tKAuG.d.ts +427 -0
- package/dist/channel-Bqy7BYGm.d.ts +28 -0
- package/dist/channel-BvzHMdKo.d.ts +8 -0
- package/dist/channel-C6G6-tH6.js +562 -0
- package/dist/channel-CBhuuq-_.js +2126 -0
- package/dist/channel-CMmVpcnl.js +867 -0
- package/dist/channel-COc7idAe.js +653 -0
- package/dist/channel-CcsuLAYt.d.ts +49 -0
- package/dist/channel-CjfuHhSU.js +1556 -0
- package/dist/channel-Cquy73C-.js +1249 -0
- package/dist/channel-Cu7Jxm_X.d.ts +104 -0
- package/dist/channel-CzvuskEn.js +955 -0
- package/dist/channel-D6u-243v.js +1777 -0
- package/dist/channel-DId5JNlc.d.ts +47 -0
- package/dist/channel-DR8PbP31.js +238 -0
- package/dist/channel-DUYRu5km.d.ts +7 -0
- package/dist/channel-DUZ0s98I.js +1496 -0
- package/dist/channel-DXelghSl.d.ts +8 -0
- package/dist/channel-FhfE8D-t.d.ts +6 -0
- package/dist/channel-PEX_yYEO.d.ts +64 -0
- package/dist/channel-aWqPl-K4.d.ts +106 -0
- package/dist/channel-actions.runtime-BzEqt_Va.js +265 -0
- package/dist/channel-actions.runtime.js +1 -1
- package/dist/channel-cSdO0kAq.d.ts +8 -0
- package/dist/channel-core-ClgodQav.d.ts +6 -0
- package/dist/channel-core-DDZnTvT6.js +5 -0
- package/dist/channel-entry-contract-Bzkb_oJX.d.ts +112 -0
- package/dist/channel-inbound-C2wLEE7Q.js +80 -0
- package/dist/channel-lifecycle-DCTZ2J_8.d.ts +126 -0
- package/dist/channel-pairing-pKisqGWj.d.ts +58 -0
- package/dist/channel-plugin-runtime-B8AWkA0i.js +998 -0
- package/dist/channel-plugin-runtime-ntEeH9SC.d.ts +7 -0
- package/dist/channel-runtime-CciKN6E5.js +408 -0
- package/dist/channel-za2kUUnL.d.ts +12 -0
- package/dist/channel.runtime-BQN8Bkb0.js +254 -0
- package/dist/channel.runtime-BXeGEvv7.js +21009 -0
- package/dist/channel.runtime-C40ILulM.js +1008 -0
- package/dist/channel.runtime-CJ2DSojv.js +733 -0
- package/dist/channel.runtime-CUaygROD.js +652 -0
- package/dist/channel.runtime-CcCbJhDb.js +88 -0
- package/dist/channel.runtime-DJbKu9D3.js +4 -0
- package/dist/channel.runtime-DgRuSo5T.js +109 -0
- package/dist/channel.runtime-tRXUD2p2.js +2528 -0
- package/dist/channel.setup-3aVku-g-.js +1098 -0
- package/dist/channel.setup-Cau-V9UT.d.ts +7 -0
- package/dist/channel.setup-DT7Z9egu.js +343 -0
- package/dist/channel.setup-DhlkGTJV.js +10 -0
- package/dist/channel.setup-P5V7jWHY.d.ts +6 -0
- package/dist/channel.setup-x333W0eZ.d.ts +8 -0
- package/dist/chat-D3LWYymW.js +2666 -0
- package/dist/chrome--ATU1T0X.js +1503 -0
- package/dist/cli/run-main.js +9 -9
- package/dist/cli-D8hIXnS1.js +1341 -0
- package/dist/cli-backend-C1JA33SE.d.ts +5 -0
- package/dist/cli-backend-D8WmqNqJ.d.ts +5 -0
- package/dist/cli-compaction-jmi3u2HG.js +347 -0
- package/dist/cli-daS2Mzjd.d.ts +20 -0
- package/dist/cli-metadata-Cy9MEdPv.js +22 -0
- package/dist/cli-runner-DuT8oeZF.js +540 -0
- package/dist/cli-runner-DvKgnkCL.js +2 -0
- package/dist/cli-runner.runtime-B-aD16MD.js +4 -0
- package/dist/cli-runner.runtime-DofcKX1U.js +3 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-BFZytJBA.d.ts +20 -0
- package/dist/cli-startup-metadata.json +13 -13
- package/dist/client-B5IcAlfB.js +650 -0
- package/dist/client-adapter-CXA67h2E.js +897 -0
- package/dist/client-factory-aY6TuKfQ.js +9 -0
- package/dist/command-auth-DS9XgXEG.js +135 -0
- package/dist/command-execution-startup-DQOLt5Sz.js +87 -0
- package/dist/command-handlers-DqxF-IM9.js +1609 -0
- package/dist/command-registry-BSVx1oOc.js +4 -0
- package/dist/command-registry-CsPIOiQ3.js +9 -0
- package/dist/command-registry-core-Bzu5ff5F.js +110 -0
- package/dist/command-status.runtime-MKsizBC-.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-B6Y6rqal.d.ts +113 -0
- package/dist/commands-acp-ClJofWty.js +74 -0
- package/dist/commands-compact.runtime-7VqYX4tS.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-handlers.runtime-Dfqf_Oyp.js +6154 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-status-CRaEj9Vf.js +16 -0
- package/dist/commands-status-uDaqCP2F.js +3 -0
- package/dist/commands-status.runtime-uDaqCP2F.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-BaYcGLtc.js +2 -0
- package/dist/commands-subagents-control.runtime-C4xMpLed.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-C3lzz7wW.js +162 -0
- package/dist/commands-system-prompt-DpiW5FkQ.js +2 -0
- package/dist/commands.runtime-l4fGcB5c.js +176 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/compact-Dq0mi-y_.js +480 -0
- package/dist/compact-voJdoXm-.js +1141 -0
- package/dist/compact.runtime-BNLPSDQQ.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-qHUelvvd.js +315 -0
- package/dist/computer-use-dP3FCUtq.js +367 -0
- package/dist/config-BDGPPDJ7.js +2 -0
- package/dist/config-Dg3sgjXu.js +373 -0
- package/dist/config-cli-INHPnZOG.js +1633 -0
- package/dist/config-mutations-CAgnXnDt.js +159 -0
- package/dist/config-schema-BkkovNaj.d.ts +20 -0
- package/dist/configure-M1VU0h9O.js +3 -0
- package/dist/configure.commands-CM8RXyn3.js +1251 -0
- package/dist/configure.commands-PvOJd4nu.js +2 -0
- package/dist/context-engine-host-compat-D7I7Q63Z.js +288 -0
- package/dist/context-engine-host-compat-DGHUiQUV.js +2 -0
- package/dist/context-engine-lifecycle-Zsi-S6qy.js +1274 -0
- package/dist/contracts-testkit-Ch7UfUw6.d.ts +145 -0
- package/dist/control-auth-BKUTwIvH.js +114 -0
- package/dist/control-service-CKUzEAa0.js +145 -0
- package/dist/control-ui/assets/agents-CUjpwxUf.js +1008 -0
- package/dist/control-ui/assets/channel-config-extras-Dd4z5RQ8.js +2 -0
- package/dist/control-ui/assets/channels-554ojNKp.js +367 -0
- package/dist/control-ui/assets/cron-BAd2PXq5.js +1013 -0
- package/dist/control-ui/assets/debug-BGCb3cT4.js +97 -0
- package/dist/control-ui/assets/index-BXico1DI.js +7370 -0
- package/dist/control-ui/assets/instances-EkBPy6m3.js +57 -0
- package/dist/control-ui/assets/logs-zcOeZekZ.js +74 -0
- package/dist/control-ui/assets/nodes-BymRwDa6.js +436 -0
- package/dist/control-ui/assets/sessions-C_oSuy7x.js +399 -0
- package/dist/control-ui/assets/skills-BVjEetcV.js +314 -0
- package/dist/control-ui/assets/skills-shared-weS2ZYM5.js +11 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/conversation-binding-runtime-rXAYUZyM.js +4 -0
- package/dist/conversation-runtime-CV0pSg81.js +31 -0
- package/dist/core-BV0irASW.js +282 -0
- package/dist/core-DIjsbXou.d.ts +224 -0
- package/dist/core-api-CyhjZVzn.js +5 -0
- package/dist/core-api-YdHGjff8.js +2 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-n5FVHIW5.js +55 -0
- package/dist/daocore-runtime-DhfJoXrT.d.ts +151 -0
- package/dist/daocore-tools-CXDZ1Xhe.js +11727 -0
- package/dist/dashboard-CeQV6L1K.js +263 -0
- package/dist/delivery-D7LfafSk.js +1002 -0
- package/dist/dev-BSY4rs1s.js +97 -0
- package/dist/dialogue-DWFnjTiN.js +37 -0
- package/dist/dir-fetch-tool-BnlEyfZh.js +565 -0
- package/dist/dir-list-tool-Blhg_vTH.js +100 -0
- package/dist/direct-dm-DJPIaf5J.js +64 -0
- package/dist/directive-handling.fast-lane-DGV6PZYZ.js +68 -0
- package/dist/directive-handling.impl-CTDwclQa.js +818 -0
- package/dist/directive-handling.impl-_zI0_GsT.js +2 -0
- package/dist/directive-handling.model-selection-C8lG4FHQ.js +122 -0
- package/dist/directive-handling.persist.runtime-CmLb1evR.js +263 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/dispatch-DvZRbIrc.js +1640 -0
- package/dist/dispatch-acp-transcript.runtime-PehNIsnR.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-Dg8ft-Ve.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/doctor-DJFM3lrT.js +6 -0
- package/dist/doctor-_ob4EiVf.js +2 -0
- package/dist/doctor-config-flow-D6iEk-en.js +1741 -0
- package/dist/doctor-core-checks-CCfWWL1-.js +573 -0
- package/dist/doctor-core-checks-CqkHUVcZ.js +2 -0
- package/dist/doctor-health-CrNPft4G.js +65 -0
- package/dist/doctor-health-contributions-Bwu5M_GQ.js +696 -0
- package/dist/doctor-lint-B2Wb_jEn.js +94 -0
- package/dist/doctor-prompter-cXq7RExi.js +58 -0
- package/dist/doctor-state-integrity-DfYyVFbQ.js +1231 -0
- package/dist/dynamic-tools-CbHsYkuk.js +486 -0
- package/dist/embedded-backend-IYuqoxzv.js +579 -0
- package/dist/embedded-gateway-stub.runtime-BjJ_93Pp.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-provider-B50jxKn8.d.ts +65 -0
- package/dist/embedding-provider-DOktf4gm.d.ts +21 -0
- package/dist/embedding-provider-DZOjws8e.d.ts +16 -0
- package/dist/entry.d.ts +1 -1
- package/dist/entry.js +1 -1
- package/dist/exec-approvals-VjIKwFog.js +149 -0
- package/dist/extensionAPI.js +1 -1
- package/dist/extensions/active-memory/index.d.ts +1 -1
- package/dist/extensions/active-memory/index.js +1 -1
- package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/alibaba/index.d.ts +1 -1
- package/dist/extensions/anthropic/api.d.ts +3 -3
- package/dist/extensions/anthropic/cli-backend-api.d.ts +2 -2
- package/dist/extensions/anthropic/cli-backend.d.ts +1 -1
- package/dist/extensions/anthropic/cli-migration.d.ts +1 -1
- package/dist/extensions/anthropic/cli-shared.d.ts +1 -1
- package/dist/extensions/anthropic/contract-api.d.ts +1 -1
- package/dist/extensions/anthropic/index.d.ts +1 -1
- package/dist/extensions/anthropic/provider-contract-api.d.ts +1 -1
- package/dist/extensions/anthropic/provider-discovery.d.ts +1 -1
- package/dist/extensions/anthropic/provider-policy-api.d.ts +1 -1
- package/dist/extensions/anthropic/register.runtime.d.ts +1 -1
- package/dist/extensions/anthropic/replay-policy.d.ts +1 -1
- package/dist/extensions/anthropic/setup-api.d.ts +1 -1
- package/dist/extensions/anthropic/stream-wrappers.d.ts +1 -1
- package/dist/extensions/anthropic/test-api.d.ts +2 -2
- package/dist/extensions/arcee/index.d.ts +1 -1
- package/dist/extensions/azure-speech/index.d.ts +1 -1
- package/dist/extensions/azure-speech/speech-provider.d.ts +1 -1
- package/dist/extensions/bonjour/index.d.ts +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-config.js +4 -4
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +2 -2
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/cli-metadata.d.ts +1 -1
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.d.ts +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.d.ts +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.d.ts +2 -2
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.d.ts +3 -3
- package/dist/extensions/browser/runtime-api.js +13 -13
- package/dist/extensions/browser/setup-api.d.ts +1 -1
- package/dist/extensions/byteplus/index.d.ts +1 -1
- package/dist/extensions/byteplus/provider-discovery.d.ts +1 -1
- package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
- package/dist/extensions/canvas/index.d.ts +1 -1
- package/dist/extensions/canvas/index.js +1 -1
- package/dist/extensions/canvas/runtime-api.d.ts +2 -2
- package/dist/extensions/canvas/setup-api.d.ts +1 -1
- package/dist/extensions/cerebras/index.d.ts +1 -1
- package/dist/extensions/chutes/index.d.ts +1 -1
- package/dist/extensions/clickclack/api.d.ts +2 -2
- package/dist/extensions/clickclack/api.js +2 -2
- package/dist/extensions/clickclack/channel-plugin-api.d.ts +1 -1
- package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
- package/dist/extensions/clickclack/index.d.ts +2 -2
- package/dist/extensions/clickclack/runtime-api.d.ts +2 -2
- package/dist/extensions/clickclack/runtime-api.js +2 -2
- package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
- package/dist/extensions/cloudflare-ai-gateway/stream-wrappers.d.ts +1 -1
- package/dist/extensions/comfy/index.d.ts +1 -1
- package/dist/extensions/copilot-proxy/index.d.ts +1 -1
- package/dist/extensions/copilot-proxy/runtime-api.d.ts +2 -2
- package/dist/extensions/deepgram/index.d.ts +1 -1
- package/dist/extensions/deepgram/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/deepgram/test-api.d.ts +1 -1
- package/dist/extensions/deepinfra/api.d.ts +2 -2
- package/dist/extensions/deepinfra/embedding-provider.d.ts +1 -1
- package/dist/extensions/deepinfra/index.d.ts +1 -1
- package/dist/extensions/deepinfra/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/deepinfra/speech-provider.d.ts +1 -1
- package/dist/extensions/deepseek/api.d.ts +1 -1
- package/dist/extensions/deepseek/index.d.ts +1 -1
- package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
- package/dist/extensions/deepseek/provider-policy-api.d.ts +1 -1
- package/dist/extensions/deepseek/stream.d.ts +1 -1
- package/dist/extensions/deepseek/thinking.d.ts +1 -1
- package/dist/extensions/device-pair/api.d.ts +3 -3
- package/dist/extensions/device-pair/api.js +1 -1
- package/dist/extensions/device-pair/index.d.ts +1 -1
- package/dist/extensions/device-pair/notify.d.ts +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/document-extract/index.d.ts +1 -1
- package/dist/extensions/duckduckgo/index.d.ts +1 -1
- package/dist/extensions/elevenlabs/index.d.ts +1 -1
- package/dist/extensions/elevenlabs/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/elevenlabs/setup-api.d.ts +1 -1
- package/dist/extensions/elevenlabs/speech-provider.d.ts +1 -1
- package/dist/extensions/elevenlabs/test-api.d.ts +2 -2
- package/dist/extensions/exa/index.d.ts +1 -1
- package/dist/extensions/fal/index.d.ts +1 -1
- package/dist/extensions/fal/provider-contract-api.d.ts +1 -1
- package/dist/extensions/fal/provider-registration.d.ts +1 -1
- package/dist/extensions/file-transfer/index.d.ts +1 -1
- package/dist/extensions/file-transfer/index.js +4 -4
- package/dist/extensions/firecrawl/index.d.ts +1 -1
- package/dist/extensions/fireworks/index.d.ts +1 -1
- package/dist/extensions/fireworks/provider-policy-api.d.ts +1 -1
- package/dist/extensions/fireworks/stream.d.ts +1 -1
- package/dist/extensions/fireworks/thinking-policy.d.ts +1 -1
- package/dist/extensions/github-copilot/embeddings.d.ts +1 -1
- package/dist/extensions/github-copilot/index.d.ts +1 -1
- package/dist/extensions/github-copilot/models.d.ts +1 -1
- package/dist/extensions/github-copilot/register.runtime.d.ts +2 -2
- package/dist/extensions/github-copilot/stream.d.ts +1 -1
- package/dist/extensions/google/api.d.ts +5 -5
- package/dist/extensions/google/cli-backend.d.ts +1 -1
- package/dist/extensions/google/embedding-batch.d.ts +1 -1
- package/dist/extensions/google/embedding-provider.d.ts +1 -1
- package/dist/extensions/google/gemini-cli-provider.d.ts +1 -1
- package/dist/extensions/google/index.d.ts +1 -1
- package/dist/extensions/google/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/google/provider-contract-api.d.ts +1 -1
- package/dist/extensions/google/provider-hooks.d.ts +2 -2
- package/dist/extensions/google/provider-models.d.ts +1 -1
- package/dist/extensions/google/provider-policy-api.d.ts +1 -1
- package/dist/extensions/google/provider-policy.d.ts +1 -1
- package/dist/extensions/google/provider-registration.d.ts +1 -1
- package/dist/extensions/google/realtime-voice-provider.d.ts +1 -1
- package/dist/extensions/google/runtime-api.d.ts +3 -3
- package/dist/extensions/google/setup-api.d.ts +1 -1
- package/dist/extensions/google/speech-provider.d.ts +1 -1
- package/dist/extensions/google/test-api.d.ts +2 -2
- package/dist/extensions/google/thinking-api.d.ts +1 -1
- package/dist/extensions/google/thinking.d.ts +1 -1
- package/dist/extensions/google/transport-stream.d.ts +1 -1
- package/dist/extensions/gradium/index.d.ts +1 -1
- package/dist/extensions/gradium/speech-provider.d.ts +1 -1
- package/dist/extensions/groq/index.d.ts +1 -1
- package/dist/extensions/huggingface/index.d.ts +1 -1
- package/dist/extensions/image-generation-core/api.d.ts +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 +4 -4
- 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 +9 -9
- package/dist/extensions/mattermost/runtime-api.js +2 -2
- package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
- package/dist/extensions/mattermost/slash-route-api.d.ts +1 -1
- package/dist/extensions/mattermost/slash-route-api.js +1 -1
- package/dist/extensions/memory-core/api.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/memory-core/index.d.ts +1 -1
- package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
- package/dist/extensions/memory-core/runtime-api.d.ts +2 -2
- package/dist/extensions/memory-wiki/api.d.ts +3 -3
- package/dist/extensions/memory-wiki/cli-metadata.d.ts +1 -1
- package/dist/extensions/memory-wiki/index.d.ts +1 -1
- package/dist/extensions/memory-wiki/setup-api.d.ts +1 -1
- package/dist/extensions/microsoft/index.d.ts +1 -1
- package/dist/extensions/microsoft/speech-provider.d.ts +1 -1
- package/dist/extensions/microsoft/test-api.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/auth.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/cli.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/index.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/onboard.d.ts +3 -3
- package/dist/extensions/microsoft-foundry/provider.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/runtime.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.d.ts +1 -1
- package/dist/extensions/microsoft-foundry/shared.d.ts +1 -1
- package/dist/extensions/migrate-claude/apply.d.ts +1 -1
- package/dist/extensions/migrate-claude/apply.js +1 -1
- package/dist/extensions/migrate-claude/config.d.ts +1 -1
- package/dist/extensions/migrate-claude/helpers.d.ts +1 -1
- package/dist/extensions/migrate-claude/index.d.ts +1 -1
- package/dist/extensions/migrate-claude/index.js +1 -1
- package/dist/extensions/migrate-claude/memory.d.ts +2 -2
- package/dist/extensions/migrate-claude/plan.d.ts +1 -1
- package/dist/extensions/migrate-claude/plan.js +1 -1
- package/dist/extensions/migrate-claude/provider.d.ts +1 -1
- package/dist/extensions/migrate-claude/provider.js +1 -1
- package/dist/extensions/migrate-claude/skills.d.ts +2 -2
- package/dist/extensions/migrate-claude/targets.d.ts +1 -1
- package/dist/extensions/migrate-claude/targets.js +1 -1
- package/dist/extensions/migrate-hermes/apply.d.ts +1 -1
- package/dist/extensions/migrate-hermes/apply.js +1 -1
- package/dist/extensions/migrate-hermes/config.d.ts +1 -1
- package/dist/extensions/migrate-hermes/helpers.d.ts +1 -1
- package/dist/extensions/migrate-hermes/index.d.ts +1 -1
- package/dist/extensions/migrate-hermes/index.js +1 -1
- package/dist/extensions/migrate-hermes/items.d.ts +1 -1
- package/dist/extensions/migrate-hermes/model.d.ts +1 -1
- package/dist/extensions/migrate-hermes/model.js +1 -1
- package/dist/extensions/migrate-hermes/plan.d.ts +1 -1
- package/dist/extensions/migrate-hermes/plan.js +1 -1
- package/dist/extensions/migrate-hermes/provider.d.ts +1 -1
- package/dist/extensions/migrate-hermes/provider.js +1 -1
- package/dist/extensions/migrate-hermes/secrets.d.ts +2 -2
- package/dist/extensions/migrate-hermes/secrets.js +1 -1
- package/dist/extensions/migrate-hermes/skills.d.ts +2 -2
- package/dist/extensions/migrate-hermes/targets.d.ts +1 -1
- package/dist/extensions/migrate-hermes/targets.js +1 -1
- package/dist/extensions/minimax/index.d.ts +1 -1
- package/dist/extensions/minimax/provider-contract-api.d.ts +1 -1
- package/dist/extensions/minimax/provider-registration.d.ts +1 -1
- package/dist/extensions/minimax/speech-provider.d.ts +1 -1
- package/dist/extensions/mistral/embedding-provider.d.ts +1 -1
- package/dist/extensions/mistral/index.d.ts +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/mistral/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/mistral/test-api.d.ts +1 -1
- package/dist/extensions/moonshot/index.d.ts +1 -1
- package/dist/extensions/moonshot/provider-contract-api.d.ts +1 -1
- package/dist/extensions/moonshot/provider-discovery.d.ts +1 -1
- package/dist/extensions/nvidia/index.d.ts +1 -1
- package/dist/extensions/oc-path/cli-metadata.d.ts +1 -1
- package/dist/extensions/oc-path/cli-registration.d.ts +1 -1
- package/dist/extensions/oc-path/index.d.ts +1 -1
- package/dist/extensions/ollama/api.d.ts +1 -1
- package/dist/extensions/ollama/index.d.ts +1 -1
- package/dist/extensions/ollama/provider-discovery.d.ts +1 -1
- package/dist/extensions/ollama/provider-policy-api.d.ts +1 -1
- package/dist/extensions/ollama/runtime-api.d.ts +1 -1
- package/dist/extensions/open-prose/index.d.ts +1 -1
- package/dist/extensions/open-prose/runtime-api.d.ts +2 -2
- package/dist/extensions/openai/api.d.ts +4 -4
- package/dist/extensions/openai/embedding-batch.d.ts +1 -1
- package/dist/extensions/openai/embedding-provider.d.ts +1 -1
- package/dist/extensions/openai/index.d.ts +1 -1
- package/dist/extensions/openai/memory-embedding-adapter.d.ts +1 -1
- package/dist/extensions/openai/openai-codex-oauth.runtime.d.ts +1 -1
- package/dist/extensions/openai/openai-codex-provider.d.ts +1 -1
- package/dist/extensions/openai/openai-provider.d.ts +1 -1
- package/dist/extensions/openai/prompt-overlay.d.ts +1 -1
- package/dist/extensions/openai/provider-contract-api.d.ts +1 -1
- package/dist/extensions/openai/provider-policy-api.d.ts +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.d.ts +1 -1
- package/dist/extensions/openai/realtime-voice-provider.d.ts +1 -1
- package/dist/extensions/openai/register.runtime.d.ts +6 -6
- package/dist/extensions/openai/replay-policy.d.ts +1 -1
- package/dist/extensions/openai/setup-api.d.ts +1 -1
- package/dist/extensions/openai/shared.d.ts +3 -3
- package/dist/extensions/openai/speech-provider.d.ts +1 -1
- package/dist/extensions/openai/test-api.d.ts +3 -3
- package/dist/extensions/openai/thinking-policy.d.ts +1 -1
- package/dist/extensions/openai/transport-policy.d.ts +1 -1
- package/dist/extensions/opencode/index.d.ts +1 -1
- package/dist/extensions/opencode/provider-policy-api.d.ts +1 -1
- package/dist/extensions/opencode-go/index.d.ts +1 -1
- package/dist/extensions/opencode-go/provider-catalog.d.ts +1 -1
- package/dist/extensions/opencode-go/stream.d.ts +1 -1
- package/dist/extensions/openrouter/api.d.ts +1 -1
- package/dist/extensions/openrouter/index.d.ts +1 -1
- package/dist/extensions/openrouter/provider-contract-api.d.ts +1 -1
- package/dist/extensions/openrouter/provider-policy-api.d.ts +1 -1
- package/dist/extensions/openrouter/speech-provider.d.ts +1 -1
- package/dist/extensions/openrouter/stream.d.ts +1 -1
- package/dist/extensions/openrouter/test-api.d.ts +1 -1
- package/dist/extensions/openrouter/thinking-policy.d.ts +1 -1
- package/dist/extensions/openrouter/video-generation-provider.d.ts +1 -1
- package/dist/extensions/openrouter/video-model-catalog.d.ts +1 -1
- package/dist/extensions/perplexity/index.d.ts +1 -1
- package/dist/extensions/phone-control/index.d.ts +1 -1
- package/dist/extensions/phone-control/runtime-api.d.ts +2 -2
- package/dist/extensions/policy/api.js +1 -1
- package/dist/extensions/policy/index.d.ts +1 -1
- package/dist/extensions/policy/index.js +2 -2
- package/dist/extensions/qianfan/index.d.ts +1 -1
- package/dist/extensions/qwen/api.d.ts +1 -1
- package/dist/extensions/qwen/index.d.ts +1 -1
- package/dist/extensions/qwen/stream.d.ts +1 -1
- package/dist/extensions/runway/index.d.ts +1 -1
- package/dist/extensions/searxng/index.d.ts +1 -1
- package/dist/extensions/senseaudio/index.d.ts +1 -1
- package/dist/extensions/sglang/index.d.ts +1 -1
- package/dist/extensions/signal/api.d.ts +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 +7 -7
- 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 +4 -4
- 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 +4 -4
- 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-smMykVXl.js +124 -0
- package/dist/file-write-tool-yEYLZ2hU.js +127 -0
- package/dist/format-DyREJP5V.js +1145 -0
- package/dist/gateway/protocol/index.d.ts +1 -1
- package/dist/gateway-cli-D4yhwJa8.js +435 -0
- package/dist/gateway-method-runtime-B8AOnwqD.js +21 -0
- package/dist/gateway-runtime-BqKz92h9.d.ts +163 -0
- package/dist/gemini-cli-provider-wUxyeRzT.d.ts +6 -0
- package/dist/get-reply-Co-_Qlr-.js +4689 -0
- package/dist/get-reply-from-config.runtime-BcbRKxzJ.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/graph-users-CF7Dlee2.js +1419 -0
- package/dist/group-access-BTU-w5S5.js +112 -0
- package/dist/group-keys-B_lbVBmI.d.ts +17 -0
- package/dist/handle-action.guild-admin-DS29y_6h.js +288 -0
- package/dist/harness-d9YmZWA3.js +61 -0
- package/dist/health-Cov1Kryj.js +4 -0
- package/dist/heartbeat-runner-B2wo_xDj.js +5 -0
- package/dist/heartbeat-runner.runtime-DrHZD-P2.js +4 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/help-BgDd1atJ.js +136 -0
- package/dist/hook-runtime-UU80d5qW.d.ts +108 -0
- package/dist/hooks-CgXKCJSD.js +534 -0
- package/dist/http-registry-CBDAGRJy.d.ts +23 -0
- package/dist/image-generation-runtime-BFOnMPYD.d.ts +21 -0
- package/dist/inbound-direct-dm-runtime-DjOHl6c_.js +2 -0
- package/dist/inbound-reply-dispatch-BCTiM2jm.js +148 -0
- package/dist/index-D7Vsu6c4.d.ts +3971 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/init-CreYGHpp.js +59 -0
- package/dist/inline-buttons-C94TOhmL.js +40 -0
- package/dist/interactive-dispatch-AIMj_vt7.d.ts +143 -0
- package/dist/interactive-dispatch-Bh_T3uZG.d.ts +56 -0
- package/dist/internal-events-B6D5bqsn.js +90 -0
- package/dist/isolated-agent-9faqxl7c.js +1118 -0
- package/dist/isolated-agent-CaY4uTcE.js +2 -0
- package/dist/lifecycle-pTz4liUn.js +571 -0
- package/dist/list.probe-B8pt-DOd.js +449 -0
- package/dist/list.status-command-Wgmt361J.js +789 -0
- package/dist/llm-slug-generator-Do4oXnXl.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/loader-BFBzvUK_.d.ts +142 -0
- package/dist/local-dispatch.runtime-7keeuHHm.js +9 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/manager-D058VQAp.d.ts +10 -0
- package/dist/manager-DerRaxsV.d.ts +356 -0
- package/dist/manager.core-DKeUsAcV.d.ts +198 -0
- package/dist/manager.runtime-B3nVh8Nl.js +2714 -0
- package/dist/manager.runtime.js +1 -1
- package/dist/markdown-to-line-CZLeX0SL.js +811 -0
- package/dist/mcp-http-LaAmzBev.js +2 -0
- package/dist/mcp-http-M4GjuKFd.js +555 -0
- package/dist/media-understanding-provider-DLA6VsQZ.js +339 -0
- package/dist/memory-core-host-engine-storage-MF-67Z8w.d.ts +54 -0
- package/dist/memory-embedding-adapter-CEwgurWU.d.ts +5 -0
- package/dist/message-actions-Dlv-B5yk.js +145 -0
- package/dist/message-handler-2HSbEoAi.js +384 -0
- package/dist/message-handler-XiApv_iS.js +1715 -0
- package/dist/message-handler.preflight-CN-g4nxs.js +1125 -0
- package/dist/message-handler.process-BzVq3Lq_.js +1484 -0
- package/dist/migration-BXmTbRk9.d.ts +45 -0
- package/dist/model-Ci5kQ7PA.d.ts +33 -0
- package/dist/model-Sqz99RFi.js +74 -0
- package/dist/model-selection-Bh9QtqlJ.js +272 -0
- package/dist/models-C_dD1FNN.js +2 -0
- package/dist/models-CtpB-fi2.js +104 -0
- package/dist/models-Cxa7r3rl.d.ts +24 -0
- package/dist/models-cli-I2sJE5tg.js +256 -0
- package/dist/monitor-B4J6Kn4-.js +60 -0
- package/dist/monitor-BIFxJ3Ql.js +2788 -0
- package/dist/monitor-BTkcXHvw.js +834 -0
- package/dist/monitor-BX7Encm5.js +1657 -0
- package/dist/monitor-CZsJ4D3J.js +4377 -0
- package/dist/monitor-CvKt9k7P.js +2 -0
- package/dist/monitor-Dy9phiVJ.js +1370 -0
- package/dist/monitor-auth-CjtJPc9C.js +179 -0
- package/dist/monitor-jQpVHEky.js +715 -0
- package/dist/monitor-polling.runtime-Li4-3e2G.js +883 -0
- package/dist/monitor-polling.runtime.js +1 -1
- package/dist/monitor-webhook.runtime-CQ2kN5ya.js +387 -0
- package/dist/monitor-webhook.runtime.js +1 -1
- package/dist/monitor.account-CFdazLEm.js +5233 -0
- package/dist/monitor.runtime-B774iFU_.js +2 -0
- package/dist/monitor.runtime.js +1 -1
- package/dist/monitor.webhook-NNrWA5P9.js +180 -0
- package/dist/node-cli-sessions-Ct-6bGab.js +1228 -0
- package/dist/onboard-DEUA1HCQ.js +733 -0
- package/dist/onboard-helpers-Cupkjkec.js +251 -0
- package/dist/onboard-helpers-D1Pvowo1.js +6 -0
- package/dist/onboard-remote-BN_7wNqG.js +2 -0
- package/dist/onboard-remote-BqYAK5dF.js +212 -0
- package/dist/onboard-skills-BM40qOkc.js +160 -0
- package/dist/onboard-skills-rSLgDOzB.js +2 -0
- package/dist/openai-codex-provider-Fo-TKiyf.d.ts +5 -0
- package/dist/openai-http-BRnxRJ_y.js +824 -0
- package/dist/openai-provider-BqDrspuV.d.ts +5 -0
- package/dist/openresponses-http-Dg3OL0qA.js +1173 -0
- package/dist/operations-jvr0A8cu.js +805 -0
- package/dist/outbound-adapter-BJej9JpO.js +543 -0
- package/dist/outbound-session-route-D3QVwFKr.js +45 -0
- package/dist/outbound.runtime-gdOoPtOh.js +2 -0
- package/dist/outbound.runtime.js +1 -1
- package/dist/pairing-store-C-WQTUHq.d.ts +87 -0
- package/dist/pi-embedded-CwD_xrGP.js +3796 -0
- package/dist/pi-embedded-DL6l8KBl.js +4 -0
- package/dist/pi-embedded.runtime-DyGCj24d.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools-BzbgexEG.js +2413 -0
- package/dist/plan-HWBV2Rhq.js +112 -0
- package/dist/plan-iN77JYw-.js +81 -0
- package/dist/plugin-BbOOGgCS.d.ts +17 -0
- package/dist/plugin-CbNvjum_.js +12396 -0
- package/dist/plugin-app-cache-key-CHpwYM0e.js +46 -0
- package/dist/plugin-enabled-DjbDhNRG.js +233 -0
- package/dist/plugin-entry-B3_M6paP.d.ts +47 -0
- package/dist/plugin-registration-BM_Iko3e.js +88 -0
- package/dist/plugin-runtime-QzTPitsy.d.ts +117 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
- package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
- package/dist/plugin-sdk/agent-harness.js +7 -7
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +2 -2
- package/dist/plugin-sdk/channel-test-helpers.js +1 -1
- package/dist/plugin-sdk/command-auth.js +1 -1
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/health.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/mattermost.js +1 -1
- package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
- package/dist/plugin-sdk/provider-test-contracts.js +4 -4
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/testing.js +2 -2
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-service-CVyMm03C.js +1229 -0
- package/dist/plugin-service-bHD8oLfO.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-B2lTxn8H.js +680 -0
- package/dist/policy-Bp9GYcSZ.js +138 -0
- package/dist/prepare.runtime-CxhQeo9l.js +732 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-FVRS7Mcs.js +392 -0
- package/dist/probe-BRLc43oX.js +47 -0
- package/dist/probe-C1eD9yG7.js +2204 -0
- package/dist/probe-C1giMJtz.js +682 -0
- package/dist/probe-rIUNPFef.js +2 -0
- package/dist/program-DfIqBXRH.js +131 -0
- package/dist/prompt-overlay-Bq3sUpDV.d.ts +23 -0
- package/dist/provider-BCxvG42s.js +152 -0
- package/dist/provider-BHPMcHk-.js +32 -0
- package/dist/provider-CIAQ8D7q.js +32 -0
- package/dist/provider-api-key-auth-BsEQw2pm.d.ts +27 -0
- package/dist/provider-auth-result-B204hPXB.d.ts +21 -0
- package/dist/provider-catalog-runtime-Dcyw8skT.d.ts +23 -0
- package/dist/provider-catalog-shared-qfgsIQS-.d.ts +62 -0
- package/dist/provider-dispatcher-DyJDef6y.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-hook-runtime-NiAPyKFa.d.ts +61 -0
- package/dist/provider-j7cYms68.js +8735 -0
- package/dist/provider-model-shared-BwE02tDa.d.ts +143 -0
- package/dist/provider-models-hfm5XTTN.d.ts +12 -0
- package/dist/provider-policy-BB7uTrIp.d.ts +30 -0
- package/dist/provider-registration-DEjYSu9M.d.ts +6 -0
- package/dist/provider-registry-D5hn-VAM.d.ts +8 -0
- package/dist/provider-registry-DHIsMEbc.d.ts +8 -0
- package/dist/provider-registry-VyHjmzoh.d.ts +30 -0
- package/dist/provider-runtime-CdtuIOgf.d.ts +359 -0
- package/dist/provider-self-hosted-setup-xR0Nsu7L.d.ts +74 -0
- package/dist/provider-session.runtime-CmNY15Mr.js +9 -0
- package/dist/provider-session.runtime.js +1 -1
- package/dist/provider-stream-CxVko1CO.d.ts +140 -0
- package/dist/provider-stream-shared-BxFPKFGe.d.ts +128 -0
- package/dist/provider.runtime-DJO3dwrX.js +2 -0
- package/dist/provider.runtime.js +1 -1
- package/dist/providers.runtime-CJOUbS2S.d.ts +25 -0
- package/dist/public-surface-loader-CgBnme5n.js +114 -0
- package/dist/pw-ai-UeRWGzcL.js +3029 -0
- package/dist/pw-role-snapshot-BtlutwlO.js +333 -0
- package/dist/reaction-level-DWOV-qJM.js +19 -0
- package/dist/reaction-runtime-api-5ZiPcbGJ.js +116 -0
- package/dist/realtime-transcription-CZadifvk.d.ts +43 -0
- package/dist/realtime-transcription-provider-BF9HxM3d.d.ts +5 -0
- package/dist/realtime-transcription-provider-Bcj92hEI.d.ts +32 -0
- package/dist/realtime-transcription-provider-DKZ9iHkc.d.ts +28 -0
- package/dist/realtime-transcription-provider-DcsAmQEp.js +205 -0
- package/dist/realtime-transcription-provider-DhjVTTqb.d.ts +37 -0
- package/dist/realtime-voice-B2W34yTP.d.ts +333 -0
- package/dist/realtime-voice-provider-CgNNrGwQ.d.ts +5 -0
- package/dist/register-Dga1nJRL.js +2178 -0
- package/dist/register.agent-VIgyZLKG.js +156 -0
- package/dist/register.configure-C21zJ4Qb.js +16 -0
- package/dist/register.crestodian-Bam6mUXr.js +24 -0
- package/dist/register.maintenance-D9E-Hh90.js +83 -0
- package/dist/register.onboard-BnUcaZsb.js +113 -0
- package/dist/register.runtime-BdRAp4xz.js +54 -0
- package/dist/register.runtime-D3abILg7.d.ts +6 -0
- package/dist/register.setup-Bq-9IQdV.js +40 -0
- package/dist/register.subclis-DubBtg8Z.js +31 -0
- package/dist/register.subclis-H_qmmDFx.js +3 -0
- package/dist/register.subclis-core-fg3DalSH.js +273 -0
- package/dist/registry-CPtiHUu_.d.ts +91 -0
- package/dist/registry-types-XtFJDNYl.d.ts +392 -0
- package/dist/repair-sequencing-Dn0sDvBE.js +640 -0
- package/dist/reply-delivery-DZGfRh-W.js +196 -0
- package/dist/reply-runtime-BdCPL-OF.js +11 -0
- package/dist/reply-runtime-DuaOZ9MH.d.ts +34 -0
- package/dist/reply.runtime-BcbRKxzJ.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/request-Ca681Kt1.js +54 -0
- package/dist/resolve-allowlist-DWjCzDq1.js +220 -0
- package/dist/result-fallback-classifier-BWIh0wzc.js +79 -0
- package/dist/root-help-8a3TWleF.js +43 -0
- package/dist/route-BsWREv6-.js +469 -0
- package/dist/route-resolution-D8FyF30I.js +274 -0
- package/dist/routes-BxkaJuyM.js +3602 -0
- package/dist/routes-DdwFgSv9.js +2 -0
- package/dist/run-attempt-Ca7HP1Nd.js +7704 -0
- package/dist/run-command-JwrnqCIB.js +2 -0
- package/dist/run-command-wWvfXyIf.js +23 -0
- package/dist/run-embedded.runtime-0QIAc8PG.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-LhD-S0h_.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-prKMVvM2.js +1162 -0
- package/dist/run-subagent-registry.runtime-C07jSlV2.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runtime-3PDZU_1b.d.ts +17 -0
- package/dist/runtime-7Xhj2T8S.js +6179 -0
- package/dist/runtime-CXUwJU3q.js +438 -0
- package/dist/runtime-DeQypuDs.js +1287 -0
- package/dist/runtime-api-0djTIsuz.js +13 -0
- package/dist/runtime-api-9CEihqK3.d.ts +3151 -0
- package/dist/runtime-api-Bz1h0p3i.js +17 -0
- package/dist/runtime-api-CLcJZKu2.js +13 -0
- package/dist/runtime-api-Ce7axAAW.js +24 -0
- package/dist/runtime-api-CoAsju8a.js +4 -0
- package/dist/runtime-api-DEuynhDr.js +3 -0
- package/dist/runtime-api-oZFIOS9l.js +21 -0
- package/dist/runtime-api.actions-Blt2bAHw.d.ts +23 -0
- package/dist/runtime-api.actions-DWLRlSej.js +3 -0
- package/dist/runtime-api.monitor-DtXB3_sf.js +6 -0
- package/dist/runtime-api.send-BU586hbs.js +4 -0
- package/dist/runtime-api.send-BygcWA7R.d.ts +38 -0
- package/dist/runtime-api.threads-Djhr5AJy.js +2 -0
- package/dist/runtime-channel-BIgBTs_X.js +2 -0
- package/dist/runtime-channel-CsUTBjYU.js +150 -0
- package/dist/runtime-embedded-pi.runtime-Rszd_KCt.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-taskflow-s80xQc2H.d.ts +435 -0
- package/dist/sanitize-outbound-2umQeW_U.js +127 -0
- package/dist/sdk-setup-tools-TiaNam05.js +8 -0
- package/dist/secrets-BmyFSkt-.js +113 -0
- package/dist/secrets-cli-DPAwFvtH.js +149 -0
- package/dist/security-audit-BR9FBcLD.js +122 -0
- package/dist/security-audit-RKut1lWG.js +118 -0
- package/dist/security-audit.runtime-Pe7YbS9P.js +2 -0
- package/dist/security-audit.runtime.js +1 -1
- package/dist/selection-Cqhmjpyl.js +16157 -0
- package/dist/selection-xFFMaq92.js +3 -0
- package/dist/send-BDHagrwl.js +1631 -0
- package/dist/send-BETlETJ5.d.ts +231 -0
- package/dist/send-BV_O_Ljd.js +192 -0
- package/dist/send-CpcmWYrM.d.ts +104 -0
- package/dist/send-W-DVyil6.js +2 -0
- package/dist/send-jUp2-szO.js +143 -0
- package/dist/send.components-BR_yPtKv.js +500 -0
- package/dist/send.components-CK7UbpRP.js +2 -0
- package/dist/send.runtime-DHLfdHbS.js +2 -0
- package/dist/send.runtime.js +1 -1
- package/dist/send.types-D_3tsfSL.d.ts +159 -0
- package/dist/server-DRcdRu6J.js +73 -0
- package/dist/server-Ddv-oAKv.js +24 -0
- package/dist/server-close.runtime.d.ts +1 -1
- package/dist/server-close.runtime.js +1 -1
- package/dist/server-context-9rW0Cvdw.js +2 -0
- package/dist/server-context-uRD5N8_D.js +955 -0
- package/dist/server-cron-BClEPtbv.js +2 -0
- package/dist/server-cron-CNGar45o.js +2989 -0
- package/dist/server-methods-CAMhJf7g.js +16494 -0
- package/dist/server-node-events-DW5DoAxk.js +596 -0
- package/dist/server-plugin-bootstrap-CqX4dDcN.js +70 -0
- package/dist/server-plugins-BIhs3eCz.js +432 -0
- package/dist/server-reload-handlers-54HSfSr7.js +714 -0
- package/dist/server-restart-sentinel-C47-O08k.js +747 -0
- package/dist/server-restart-sentinel-Cx-3Rzl0.js +2 -0
- package/dist/server-runtime-services-D-SWzUww.js +267 -0
- package/dist/server-runtime-services-D0GOFPFq.js +2 -0
- package/dist/server-startup-plugins-C8pzVvkb.js +113 -0
- package/dist/server-startup-post-attach-2xoGJJts.js +716 -0
- package/dist/server-ws-runtime-Dywo6GC-.js +349 -0
- package/dist/server.impl-xK22fZyJ.js +2586 -0
- package/dist/service-Ci8roOZn.js +1446 -0
- package/dist/session-binding-BsdbGBhb.js +219 -0
- package/dist/session-binding-D42jROcb.js +2 -0
- package/dist/session-kill-http-kU4rUj1_.js +121 -0
- package/dist/session-reset-service-DkCGElAA.js +625 -0
- package/dist/session-route-hmQSEijy.js +93 -0
- package/dist/session-status.runtime-Dsz-54he.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-CYJIkiW8.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-YfQve--K.js +521 -0
- package/dist/sessions-history-http-DeuZSSGj.js +430 -0
- package/dist/sessions.runtime-wAccC8Lk.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-B8caUFIZ.js +586 -0
- package/dist/setup-CgHGdMpV.js +2 -0
- package/dist/setup-api-Uew7qBry.js +29 -0
- package/dist/setup-core-BP_fjsmA.js +174 -0
- package/dist/setup-onboard-configure-help-fast-path-ykLp2JqU.js +64 -0
- package/dist/setup-surface-BgEGrdZ3.js +320 -0
- package/dist/setup-surface-BvSqsFEu.js +221 -0
- package/dist/setup-surface-CHzMJ7_T.js +405 -0
- package/dist/setup-surface-DYm3Xvgt.js +288 -0
- package/dist/setup.finalize-BgLIjblM.js +582 -0
- package/dist/setup.gateway-config-BBguRpIc.js +281 -0
- package/dist/setup.migration-import-BY06brv-.js +200 -0
- package/dist/setup.migration-import-Igj5NMey.js +2 -0
- package/dist/shared-client-GL2KQ2Eu.js +2 -0
- package/dist/shared-client-Mc7bTBoQ.js +629 -0
- package/dist/shared-moi7PK0C.js +121 -0
- package/dist/shared-rlOyTpAw.d.ts +115 -0
- package/dist/side-question-BEHswpGw.js +683 -0
- package/dist/simple-completion-runtime-CsXJkjY5.d.ts +73 -0
- package/dist/skill-tool-dispatch.runtime-O5uXeees.js +143 -0
- package/dist/skill-tool-dispatch.runtime.js +1 -1
- package/dist/slash-state-BAYUTcHl.js +2166 -0
- package/dist/speech-BAP4NgqI.d.ts +47 -0
- package/dist/speech-core-DZmhKq_b.d.ts +36 -0
- package/dist/speech-provider-22oDk8Tz.js +184 -0
- package/dist/speech-provider-79S_bTlE.d.ts +8 -0
- package/dist/speech-provider-BYJna1nq.d.ts +5 -0
- package/dist/speech-provider-BvKhsuyg.d.ts +5 -0
- package/dist/speech-provider-CdVIHtT6.d.ts +5 -0
- package/dist/speech-provider-OiRKJFwo.d.ts +8 -0
- package/dist/speech-provider-xUDd1kmD.d.ts +34 -0
- package/dist/src-C8wkJgE6.js +4256 -0
- package/dist/startup-context-BhLJufFU.js +313 -0
- package/dist/status-C20LHDLA.js +73 -0
- package/dist/status-message-CmzgS8zM.js +484 -0
- package/dist/status-message.runtime-iG6qi7wn.js +6 -0
- package/dist/status-message.runtime.js +1 -1
- package/dist/status-subagents.runtime-D49P_RIr.js +18 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-BI7Q1z4U.js +296 -0
- package/dist/status.runtime-RQes0TI5.js +2 -0
- package/dist/sticker-cache-Dh4joqan.js +206 -0
- package/dist/sticker-vision.runtime-5SRgpo_k.js +17 -0
- package/dist/sticker-vision.runtime.js +1 -1
- package/dist/stream-BrMwI7HV.d.ts +10 -0
- package/dist/stream-Bx_akKgo.d.ts +16 -0
- package/dist/stream-D094UIVI.d.ts +5 -0
- package/dist/stream-D5DoOmTT.d.ts +19 -0
- package/dist/stream-Tt9cSOCl.d.ts +120 -0
- package/dist/stream-wrappers-CUkNtyZK.d.ts +21 -0
- package/dist/subagent-announce-BEPlkjCS.js +354 -0
- package/dist/subagent-announce-delivery-jcxPIfNG.js +958 -0
- package/dist/subagent-control-DdMWVJXs.js +508 -0
- package/dist/subagent-hooks-BsTVb6ur.js +2 -0
- package/dist/subagent-hooks-CBlMBrss.js +2 -0
- package/dist/subagent-hooks-Ch5oDUxb.js +116 -0
- package/dist/subagent-hooks-DmUeAwY3.js +146 -0
- package/dist/subagent-hooks-PNuPbYEl.js +2 -0
- package/dist/subagent-hooks-api-BQ051dF0.js +23 -0
- package/dist/subagent-hooks-api-DcVS0aJZ.js +22 -0
- package/dist/subagent-hooks-api-Dlbc5Mtd.js +23 -0
- package/dist/subagent-hooks-dwsegI07.js +230 -0
- package/dist/subagent-orphan-recovery-Cl_y6Poi.js +352 -0
- package/dist/subagent-registry-BVVgDSdq.d.ts +1 -0
- package/dist/subagent-registry-BosUdBW6.js +2351 -0
- package/dist/subagent-registry-Bxd6vaAO.js +3 -0
- package/dist/subagent-registry-read-BVVgDSdq.d.ts +1 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-session-cleanup-Bd6d93qi.js +525 -0
- package/dist/subagent-spawn-ViO3XAR1.js +1164 -0
- package/dist/target-id-Bje_v2Ax.js +107 -0
- package/dist/targets-9q_q5M9n.d.ts +10 -0
- package/dist/targets-C4byiOgQ.js +19 -0
- package/dist/targets-J0MVE-dD.js +44 -0
- package/dist/targets-ZMEvyNa8.js +19 -0
- package/dist/targets-qBcfKetP.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/testing-Dk757Ggg.js +267 -0
- package/dist/thinking-policy-DO6T8IfK.d.ts +5 -0
- package/dist/thread-bindings-CYrmTzFY.js +232 -0
- package/dist/thread-bindings-Cf7fkXxk.js +571 -0
- package/dist/thread-bindings-DI6LNGbW.js +8 -0
- package/dist/thread-bindings-DdmuKtVD.js +228 -0
- package/dist/thread-bindings.discord-api-C01V3kFk.js +187 -0
- package/dist/thread-bindings.manager--WOGVrL-.js +2 -0
- package/dist/thread-bindings.manager-HzjqZNiL.js +536 -0
- package/dist/thread-lifecycle-CJKTxWnQ.js +1614 -0
- package/dist/token-D-FQ8AQz.js +134 -0
- package/dist/tool-DTCfs0DU.js +139 -0
- package/dist/tool-actions.runtime-Cb3iA3Os.js +534 -0
- package/dist/tool-actions.runtime.js +1 -1
- package/dist/tool-plugin-CbbLM31f.d.ts +77 -0
- package/dist/tool-resolution-CbqzNutV.js +149 -0
- package/dist/tool-split-bLqMPHTZ.d.ts +19 -0
- package/dist/tools-effective-inventory-BsAax-ML.js +204 -0
- package/dist/tools-invoke-http-DAqZxikd.js +67 -0
- package/dist/tools-invoke-shared-CsVRemTL.js +200 -0
- package/dist/transport-stream-DOXZsjVL.d.ts +42 -0
- package/dist/tts-Ckj6MJNr.js +66 -0
- package/dist/tui-CwwCXMCq.js +2 -0
- package/dist/tui-DpJn3v2D.js +4709 -0
- package/dist/tui-backend-DQ9wF5es.js +256 -0
- package/dist/tui-cli-k3AYPBn3.js +37 -0
- package/dist/types--0xYmMG9.d.ts +786 -0
- package/dist/types-CMDl9l_P2.d.ts +3650 -0
- package/dist/types.public-DvhPzYJi.d.ts +70 -0
- package/dist/update-cli-DB5Doqld.js +3664 -0
- package/dist/video-generation-runtime-CTQN-4SI.d.ts +21 -0
- package/dist/video-model-catalog-CTyt4dXa.d.ts +16 -0
- package/dist/vision-tools-Dp0JrLRi.js +1409 -0
- package/dist/web-search-B0yvxuiq.js +62 -0
- package/dist/web-search-provider.runtime-B-cNT-5J.js +2 -0
- package/dist/web-search-provider.runtime-HhmIlk_Z.js +328 -0
- package/dist/web-search-provider.runtime.js +1 -1
- package/dist/webhook-targets-3u4hOqRl.d.ts +99 -0
- package/dist/xai-oauth-cZGjnEjh.js +479 -0
- package/dist/xai-user-agent-DA8le6vP.js +32 -0
- package/dist/zod-schema.core-i5HaY1T4.d.ts +166 -0
- package/package.json +1 -1
- package/dist/abort-CvuLeqr1.js +0 -277
- package/dist/abort.runtime-DNoavlKn.js +0 -2
- package/dist/account-inspect-ByX21U_z.js +0 -173
- package/dist/accounts-B0sjdn0w.js +0 -119
- package/dist/accounts-BF_AfTED.js +0 -107
- package/dist/accounts-DX1c8NKM.js +0 -107
- package/dist/accounts-EA2GGTep.js +0 -2
- package/dist/acp-runtime-BC8oA7xM.js +0 -26
- package/dist/acp-spawn-CPYDCZ95.js +0 -2
- package/dist/acp-spawn-Cqi47GCL.js +0 -1275
- package/dist/acp-stateful-target-driver-CcWMRAQ2.js +0 -89
- package/dist/action-kill-CZrPfOIS.js +0 -33
- package/dist/action-runtime-DuhVKLRJ.js +0 -469
- package/dist/action-runtime-api-BKaUWi7b.js +0 -2
- package/dist/action-send-_NpIHMwj.js +0 -39
- package/dist/action-spawn-Dymn4rUo.js +0 -47
- package/dist/actions-Bk_WaEAa.js +0 -161
- package/dist/actions.runtime-Hh7HYOlJ.js +0 -5
- package/dist/agent-CQzGVmy1.js +0 -2
- package/dist/agent-ClmYyW81.js +0 -3
- package/dist/agent-command-D5KxwCVS.d.ts +0 -141
- package/dist/agent-command-DbU2fo-p.js +0 -1367
- package/dist/agent-components.runtime-BpXJmJXk.js +0 -10
- package/dist/agent-harness-D8c6PLE_.d.ts +0 -146
- package/dist/agent-harness-runtime-AHXS4Jj3.d.ts +0 -691
- package/dist/agent-harness-runtime-TzbK9YTz.js +0 -180
- package/dist/agent-harness-task-runtime-CZWJEsKk.js +0 -140
- package/dist/agent-runner-execution-CmHT78Vr.js +0 -1713
- package/dist/agent-runner-utils-B0i1PW18.js +0 -266
- package/dist/agent-runner.runtime-B6Ah_MlB.js +0 -3455
- package/dist/agent-runtime-BOMioAX6.js +0 -229
- package/dist/agent-via-gateway-DfxQCPit.js +0 -463
- package/dist/agents.commands.add-CszEBxoJ.js +0 -304
- package/dist/agents.commands.delete-ulnJ7RH9.js +0 -128
- package/dist/api-6SmEQDkK.js +0 -134
- package/dist/api-B7QdoMF5.js +0 -2
- package/dist/api-BBgby6ck.js +0 -639
- package/dist/api-DwKV-xfM.d.ts +0 -52
- package/dist/api-RfjCqA7Y.js +0 -6
- package/dist/api-VDkFlOiv.js +0 -2
- package/dist/api-We4xoZFr.js +0 -3
- package/dist/apply-Cgtzilem.js +0 -41
- package/dist/apply-Csp3U8cA.js +0 -54
- package/dist/approval-handler.runtime-aQaSBbpF.js +0 -130
- package/dist/assistant-UMyirSUH.js +0 -291
- package/dist/attachment-normalize-BupK-_Ox.js +0 -225
- package/dist/attempt-execution-oLlyFjHk.js +0 -558
- package/dist/attempt-execution.runtime-Cq8RE0x_.js +0 -3
- package/dist/attempt-execution.shared-DyBzUJGB.js +0 -38
- package/dist/attempt.prompt-helpers-CVBP6t5J.js +0 -475
- package/dist/attempt.tool-run-context-UU1BUUC9.js +0 -2094
- package/dist/auth-BDaK_y-g.js +0 -541
- package/dist/banner-VbID973v.js +0 -2
- package/dist/banner-W77piyz6.js +0 -397
- package/dist/binding-routing-DahKvjr3.js +0 -113
- package/dist/binding-targets-C3mqUdUT.js +0 -121
- package/dist/bot-DonUKEuy.js +0 -7894
- package/dist/bot-deps-CroXwZeM.js +0 -747
- package/dist/bot-deps-DKoy3x0l.js +0 -2
- package/dist/bot-message-context.runtime-BI_zyqDu.js +0 -7
- package/dist/bot-message-context.session.runtime-Cpy2H9Ez.js +0 -12
- package/dist/bot-native-commands.delivery.runtime-CsHg3h1O.js +0 -4
- package/dist/bot-native-commands.runtime-rmoBpwZY.js +0 -13
- package/dist/bridge-server-BmDNWgHD.js +0 -113
- package/dist/browser-cli-BQLwmLw3.js +0 -2
- package/dist/browser-cli-CHHIN-of.js +0 -230
- package/dist/browser-cli-actions-input-DBZ7uwag.js +0 -473
- package/dist/browser-cli-actions-observe-BdH2-WTk.js +0 -81
- package/dist/browser-cli-debug-C82Apbgb.js +0 -137
- package/dist/browser-cli-inspect-CrO1qca7.js +0 -104
- package/dist/browser-cli-manage-Dgm1IUZT.js +0 -443
- package/dist/browser-cli-resize-DqgMr3DY.js +0 -26
- package/dist/browser-cli-shared-BTnXMCKA.js +0 -50
- package/dist/browser-cli-state-DT3bVOtg.js +0 -337
- package/dist/browser-control-auth-BRwKCt45.js +0 -2
- package/dist/browser-profiles-DhGtxK9v.js +0 -2
- package/dist/browser-runtime-BL6b-qtr.js +0 -384
- package/dist/build-33AnG55F.js +0 -257
- package/dist/bundled-channel-config-schema-4eXcH-RE.d.ts +0 -3163
- package/dist/call-dct8amtn.d.ts +0 -43
- package/dist/capability-cli-D-KoVyyP.js +0 -1782
- package/dist/channel-0tgrzPag.js +0 -867
- package/dist/channel-4g20sJKJ.d.ts +0 -104
- package/dist/channel-6tG8jWsw.d.ts +0 -8
- package/dist/channel-7OEbQ8xS.d.ts +0 -6
- package/dist/channel-7rVapSdN.d.ts +0 -8
- package/dist/channel-B1fZN0iI.d.ts +0 -427
- package/dist/channel-B5Q7fRiN.js +0 -1134
- package/dist/channel-BEg_0h_C.d.ts +0 -12
- package/dist/channel-BNp1J_eZ.js +0 -376
- package/dist/channel-BP6RWm-M.d.ts +0 -47
- package/dist/channel-BRjqrJfj.d.ts +0 -49
- package/dist/channel-BUoyH_tP.d.ts +0 -114
- package/dist/channel-BVBG4Tmn.d.ts +0 -28
- package/dist/channel-Bap23sAx.js +0 -481
- package/dist/channel-BhZ7x0SB.d.ts +0 -26
- package/dist/channel-Bxod9CjX.js +0 -508
- package/dist/channel-C6LASGjS.js +0 -808
- package/dist/channel-COWZEKCw.js +0 -1249
- package/dist/channel-CRAIreZ3.js +0 -238
- package/dist/channel-CVY2hnJh.js +0 -1556
- package/dist/channel-CgKdh_Jd.d.ts +0 -106
- package/dist/channel-Cxo62btA.js +0 -1496
- package/dist/channel-D5SzoyWI.js +0 -562
- package/dist/channel-DE4vIsYF.d.ts +0 -64
- package/dist/channel-DOdRHxJg.js +0 -1777
- package/dist/channel-DZygtXdy.js +0 -362
- package/dist/channel-DfhOnM71.d.ts +0 -7
- package/dist/channel-DhZiptRe.d.ts +0 -8
- package/dist/channel-DqPZviVV.js +0 -2126
- package/dist/channel-Dssy3NQA.js +0 -740
- package/dist/channel-actions.runtime-CDaMC9SV.js +0 -265
- package/dist/channel-buMY8xZQ.d.ts +0 -7
- package/dist/channel-core-CBhC_PNR.js +0 -5
- package/dist/channel-core-x9b94azO.d.ts +0 -6
- package/dist/channel-cvGHll3-.js +0 -955
- package/dist/channel-entry-contract-BfZdcgTS.d.ts +0 -112
- package/dist/channel-inbound-CNdyzYlz.js +0 -80
- package/dist/channel-l8amaSI9.js +0 -653
- package/dist/channel-lifecycle-DCl2GbRW.d.ts +0 -125
- package/dist/channel-pairing-BRqfYy30.d.ts +0 -58
- package/dist/channel-plugin-runtime-CvcVGjj4.js +0 -998
- package/dist/channel-plugin-runtime-D5n9A86n.d.ts +0 -7
- package/dist/channel-runtime-BAbg8Dcv.js +0 -408
- package/dist/channel-sWtDTVwd.d.ts +0 -14
- package/dist/channel.runtime-9o-iF8zm.js +0 -2528
- package/dist/channel.runtime-BotO7RD0.js +0 -21009
- package/dist/channel.runtime-BrDb4cP8.js +0 -88
- package/dist/channel.runtime-C1cLfrDt.js +0 -254
- package/dist/channel.runtime-CTM3VO2E.js +0 -4
- package/dist/channel.runtime-CnodqvCJ.js +0 -733
- package/dist/channel.runtime-Dmr8503H.js +0 -1008
- package/dist/channel.runtime-DqzR3Gd9.js +0 -109
- package/dist/channel.runtime-LOf0PHu_.js +0 -652
- package/dist/channel.setup-1leD5F5B.js +0 -343
- package/dist/channel.setup-D9UyWhXM.js +0 -1098
- package/dist/channel.setup-DkVld-9Z.d.ts +0 -7
- package/dist/channel.setup-DxT4prSl.d.ts +0 -8
- package/dist/channel.setup-IHNFkdUD.js +0 -10
- package/dist/channel.setup-YwXqilBB.d.ts +0 -6
- package/dist/chat-DrycI6KH.js +0 -2666
- package/dist/chrome-CgGY9FsG.js +0 -1503
- package/dist/cli-backend-B3aNoTD4.d.ts +0 -5
- package/dist/cli-backend-BVUFOLXj.d.ts +0 -5
- package/dist/cli-compaction-DPmSHZx7.js +0 -347
- package/dist/cli-metadata-eFfCoGmY.js +0 -22
- package/dist/cli-nmYmL8lb.js +0 -1341
- package/dist/cli-runner-BTOYShgV.js +0 -2
- package/dist/cli-runner-DgXAxJVr.js +0 -540
- package/dist/cli-runner.runtime-BeMsKcaS.js +0 -4
- package/dist/cli-runner.runtime-DMD8X8-h.js +0 -3
- package/dist/cli-shared-BAuePn3e.d.ts +0 -20
- package/dist/cli-v6XF4hHd.d.ts +0 -20
- package/dist/client-CKLZqMCW.js +0 -650
- package/dist/client-adapter-B_0W-6Fx.js +0 -897
- package/dist/client-factory-CdMLQFeA.js +0 -9
- package/dist/command-auth-BxYfnQzs.js +0 -135
- package/dist/command-execution-startup-CiV5yFW1.js +0 -87
- package/dist/command-handlers-BAWROGlt.js +0 -1609
- package/dist/command-registry-BqTMebZr.js +0 -4
- package/dist/command-registry-C2Y8GeJl.js +0 -9
- package/dist/command-registry-core-Bi-d0-WH.js +0 -110
- package/dist/command-status.runtime-BSXHZzOq.js +0 -90
- package/dist/commands-Z6AfrJar.d.ts +0 -113
- package/dist/commands-acp-BYWOkjAx.js +0 -74
- package/dist/commands-compact.runtime-Cyb7Pu12.js +0 -10
- package/dist/commands-handlers.runtime-DdJ20XTn.js +0 -6154
- package/dist/commands-status-6uhiUw13.js +0 -3
- package/dist/commands-status-BJ5AnkOG.js +0 -16
- package/dist/commands-status.runtime-6uhiUw13.js +0 -3
- package/dist/commands-subagents-control.runtime-DZrrLjSk.js +0 -2
- package/dist/commands-subagents-control.runtime-_R3XgUpp.js +0 -3
- package/dist/commands-system-prompt-CHGtJPnx.js +0 -162
- package/dist/commands-system-prompt-CM23NlDu.js +0 -2
- package/dist/commands.runtime-DUEbtHG1.js +0 -176
- package/dist/compact-BA6lVtLj.js +0 -480
- package/dist/compact-BfC-utPW.js +0 -1141
- package/dist/compact.runtime-BRL2wCqh.js +0 -12
- package/dist/completion-cli-CYKoLZLl.js +0 -315
- package/dist/computer-use-BWgYktaW.js +0 -367
- package/dist/config-B_HanwOV.js +0 -373
- package/dist/config-DhGtxK9v.js +0 -2
- package/dist/config-cli-CI5UtWr-.js +0 -1633
- package/dist/config-mutations-D2GtlLMA.js +0 -159
- package/dist/config-schema-BKOfHz23.d.ts +0 -20
- package/dist/configure-CuPwIiwW.js +0 -3
- package/dist/configure.commands-BWpwrafi.js +0 -1251
- package/dist/configure.commands-qzipmoDP.js +0 -2
- package/dist/context-engine-host-compat-D246ZMR2.js +0 -2
- package/dist/context-engine-host-compat-KMl-oqCw.js +0 -288
- package/dist/context-engine-lifecycle-DvEDHkQz.js +0 -1274
- package/dist/contracts-testkit-Ym3exIK5.d.ts +0 -145
- package/dist/control-auth-B_RiUaHt.js +0 -114
- package/dist/control-service-DcQFx6_O.js +0 -145
- package/dist/control-ui/assets/agents-Bc8cIfWF.js +0 -1008
- package/dist/control-ui/assets/channel-config-extras-DQru4ECs.js +0 -2
- package/dist/control-ui/assets/channels-BfncerPV.js +0 -367
- package/dist/control-ui/assets/cron-DHLcga_r.js +0 -1013
- package/dist/control-ui/assets/debug-DprDzDn1.js +0 -97
- package/dist/control-ui/assets/index-XTZKpkBL.js +0 -7370
- package/dist/control-ui/assets/instances-D1_lOT13.js +0 -57
- package/dist/control-ui/assets/logs-DINx8syb.js +0 -74
- package/dist/control-ui/assets/nodes-BH4XOUmD.js +0 -436
- package/dist/control-ui/assets/sessions-D5Xt25SY.js +0 -399
- package/dist/control-ui/assets/skills-BmayrBHY.js +0 -314
- package/dist/control-ui/assets/skills-shared-CHaYSJ_s.js +0 -11
- package/dist/conversation-binding-runtime-_jhzwiiC.js +0 -4
- package/dist/conversation-runtime-F5kCN0Sj.js +0 -31
- package/dist/core-BpeKfqbI.d.ts +0 -224
- package/dist/core-DE71gncT.js +0 -282
- package/dist/core-api-B4L5WkKc.js +0 -5
- package/dist/core-api-Q9oM19yY.js +0 -2
- package/dist/crestodian-DLpxYmzP.js +0 -55
- package/dist/daocore-runtime-BnYtDbMC.d.ts +0 -151
- package/dist/daocore-tools-wNTIZIO3.js +0 -11727
- package/dist/dashboard-SHmcCcnT.js +0 -263
- package/dist/delivery-BA4di5Tw.js +0 -1002
- package/dist/dev-Cr2Dhgoc.js +0 -97
- package/dist/dialogue-xI4qAuLY.js +0 -37
- package/dist/dir-fetch-tool-6d4yElM4.js +0 -565
- package/dist/dir-list-tool-D2k-hax6.js +0 -100
- package/dist/direct-dm-eGyFHTug.js +0 -64
- package/dist/directive-handling.fast-lane-Ci1l6GN_.js +0 -68
- package/dist/directive-handling.impl-Co3i_YQ4.js +0 -818
- package/dist/directive-handling.impl-DHKC0TrU.js +0 -2
- package/dist/directive-handling.model-selection-bv5KrHOw.js +0 -122
- package/dist/directive-handling.persist.runtime-CPLg-YHh.js +0 -263
- package/dist/dispatch-CdvERWY-.js +0 -1640
- package/dist/dispatch-acp-transcript.runtime-BhQo1XEg.js +0 -40
- package/dist/dispatch-acp.runtime-Dtiu2EgE.js +0 -18
- package/dist/doctor-BzsPHvLP.js +0 -2
- package/dist/doctor-Cg4FWB15.js +0 -6
- package/dist/doctor-config-flow-SYjHcyu4.js +0 -1741
- package/dist/doctor-core-checks-75amkN-e.js +0 -2
- package/dist/doctor-core-checks-B1fu7KDm.js +0 -573
- package/dist/doctor-health-contributions-BMdJKStr.js +0 -696
- package/dist/doctor-health-vLyDQqfq.js +0 -65
- package/dist/doctor-lint-DfvFyBgL.js +0 -94
- package/dist/doctor-prompter-C-dTuOnw.js +0 -58
- package/dist/doctor-state-integrity-Cv-ECLuv.js +0 -1231
- package/dist/dynamic-tools-BG8ijDFH.js +0 -486
- package/dist/embedded-backend-bRfALCWz.js +0 -579
- package/dist/embedded-gateway-stub.runtime-CAh3IhtZ.js +0 -12
- package/dist/embedding-provider-B7kg9IhC.d.ts +0 -16
- package/dist/embedding-provider-jB1zjkZy.d.ts +0 -65
- package/dist/embedding-provider-sea2CddJ.d.ts +0 -21
- package/dist/exec-approvals-BBa28Sct.js +0 -149
- package/dist/file-fetch-tool-DRIsI7eQ.js +0 -124
- package/dist/file-write-tool-vTMh7eW6.js +0 -127
- package/dist/format-nrhTS41q.js +0 -1145
- package/dist/gateway-cli-CCgw11Ik.js +0 -435
- package/dist/gateway-method-runtime-BNAVGCC_.js +0 -21
- package/dist/gateway-runtime-DGdJumdK.d.ts +0 -163
- package/dist/gemini-cli-provider-Bbpd5lx5.d.ts +0 -6
- package/dist/get-reply-DGFCqKen.js +0 -4689
- package/dist/get-reply-from-config.runtime-l7NTyCh5.js +0 -2
- package/dist/graph-users-CGpakgek.js +0 -1419
- package/dist/group-access-D095jQ78.js +0 -112
- package/dist/group-keys-DnxWQtll.d.ts +0 -17
- package/dist/handle-action.guild-admin-B3pALmMq.js +0 -288
- package/dist/harness-Bs-sPbOD.js +0 -61
- package/dist/health-4gWMIKHu.js +0 -4
- package/dist/heartbeat-runner-Sky_Rjw7.js +0 -5
- package/dist/heartbeat-runner.runtime-CRZ-NbrW.js +0 -4
- package/dist/help-B68Ov4LD.js +0 -136
- package/dist/hook-runtime-Cm73yH0T.d.ts +0 -107
- package/dist/hooks-DWSdYas_.js +0 -534
- package/dist/http-registry-CHKiFHCC.d.ts +0 -23
- package/dist/image-generation-runtime-p-dfXZTf.d.ts +0 -21
- package/dist/inbound-direct-dm-runtime-5z3W9Oqn.js +0 -2
- package/dist/inbound-reply-dispatch-D7NeeFC1.js +0 -148
- package/dist/index-CKAHTIU4.d.ts +0 -3971
- package/dist/init-BXF3o80o.js +0 -59
- package/dist/inline-buttons-DsHwKEVU.js +0 -40
- package/dist/interactive-dispatch-BsKWomnh.d.ts +0 -143
- package/dist/interactive-dispatch-CItEYOu3.d.ts +0 -56
- package/dist/internal-events-TAN9dPEj.js +0 -90
- package/dist/isolated-agent-CTrVGI6q.js +0 -2
- package/dist/isolated-agent-DPyibJ8B.js +0 -1118
- package/dist/lifecycle-BwTg0Djv.js +0 -571
- package/dist/list.probe-BpM4PKu7.js +0 -449
- package/dist/list.status-command-BbcloYBd.js +0 -789
- package/dist/llm-slug-generator-UG7Bhj_y.js +0 -78
- package/dist/loader-D6z2PEKl.d.ts +0 -142
- package/dist/local-dispatch.runtime-CU6Y-BDa.js +0 -9
- package/dist/manager-C3AVKMSl.d.ts +0 -356
- package/dist/manager-CSN9j9hh.d.ts +0 -205
- package/dist/manager.runtime-Da5LiiaQ.js +0 -2714
- package/dist/markdown-to-line-BnESmsY4.js +0 -811
- package/dist/mcp-http-C38KS7On.js +0 -2
- package/dist/mcp-http-CcGhAZcF.js +0 -555
- package/dist/media-understanding-provider-BCz5dVl6.js +0 -339
- package/dist/memory-core-host-engine-storage-sWQlfr8J.d.ts +0 -54
- package/dist/memory-embedding-adapter-BrGY0ecB.d.ts +0 -5
- package/dist/message-actions-CQURSOZH.js +0 -145
- package/dist/message-handler-C2U3bt-X.js +0 -1715
- package/dist/message-handler-CwZfuHhP.js +0 -384
- package/dist/message-handler.preflight-Cosa3kg0.js +0 -1125
- package/dist/message-handler.process-BlKFMYXw.js +0 -1484
- package/dist/migration-hAtbc95i.d.ts +0 -45
- package/dist/model-B8M2deNL.js +0 -74
- package/dist/model-Ck-vNyGd.d.ts +0 -33
- package/dist/model-selection-v2wQWgsT.js +0 -272
- package/dist/models-B7IiQBWY.js +0 -104
- package/dist/models-CnWFsPX6.d.ts +0 -24
- package/dist/models-DMNzBNgt.js +0 -2
- package/dist/models-cli-CQaOg02d.js +0 -256
- package/dist/monitor-Bd9kOezJ.js +0 -1370
- package/dist/monitor-Cy6D6MyS.js +0 -715
- package/dist/monitor-DStY23C4.js +0 -834
- package/dist/monitor-DnF8eltK.js +0 -1657
- package/dist/monitor-DrFJ63I1.js +0 -4377
- package/dist/monitor-J8jOsDaJ.js +0 -60
- package/dist/monitor-auth-DKkbt_CR.js +0 -179
- package/dist/monitor-jp3H9Ri_.js +0 -2
- package/dist/monitor-polling.runtime-DPCAacPc.js +0 -883
- package/dist/monitor-tBNmyf1s.js +0 -2788
- package/dist/monitor-webhook.runtime-BnjEsLRS.js +0 -387
- package/dist/monitor.account-Gh8FuMEq.js +0 -5233
- package/dist/monitor.runtime-Bdh6dxyq.js +0 -2
- package/dist/monitor.webhook-BosT2ylg.js +0 -180
- package/dist/node-cli-sessions-B0_DtIxz.js +0 -1228
- package/dist/onboard-CiTp3HuT.js +0 -733
- package/dist/onboard-helpers-6NgX4RkW.js +0 -251
- package/dist/onboard-helpers-BwxJT_0T.js +0 -6
- package/dist/onboard-remote-CNCFouj7.js +0 -212
- package/dist/onboard-remote-DXzWgH_H.js +0 -2
- package/dist/onboard-skills-Dx58zrXg.js +0 -160
- package/dist/onboard-skills-qaynAMqw.js +0 -2
- package/dist/openai-codex-provider-Bj9cyh4I.d.ts +0 -5
- package/dist/openai-http-Dp0cp01u.js +0 -824
- package/dist/openai-provider-Dm3YkkWf.d.ts +0 -5
- package/dist/openresponses-http-acbxr5UW.js +0 -1173
- package/dist/operations-BZVuEl9E.js +0 -805
- package/dist/outbound-adapter-BKGzT1Rl.js +0 -543
- package/dist/outbound-session-route-mWVuRF9I.js +0 -45
- package/dist/outbound.runtime-BTjY78St.js +0 -2
- package/dist/pairing-challenge-DD0D0sfM.d.ts +0 -87
- package/dist/pi-embedded-CFP2IrYS.js +0 -3796
- package/dist/pi-embedded-D8caT0Nm.js +0 -4
- package/dist/pi-embedded.runtime-eBik36nq.js +0 -4
- package/dist/pi-tools-DOiFN8QJ.js +0 -2413
- package/dist/plan-Cq2-YWkv.js +0 -112
- package/dist/plan-DZacZ3Zv.js +0 -81
- package/dist/plugin-BcNkVMQf.d.ts +0 -17
- package/dist/plugin-app-cache-key-CBK84hKp.js +0 -46
- package/dist/plugin-enabled-CMfz3hfi.js +0 -233
- package/dist/plugin-entry-BS5QKDoz.d.ts +0 -47
- package/dist/plugin-k9ChkvvX.js +0 -12396
- package/dist/plugin-registration-DzPoDboh.js +0 -88
- package/dist/plugin-runtime-BNGhLQ-_.d.ts +0 -117
- package/dist/plugin-service-BynKHNHj.d.ts +0 -24
- package/dist/plugin-service-Ckp9CgP5.js +0 -1229
- package/dist/policy-CBa8yH5k.js +0 -680
- package/dist/policy-Dlam-IbU.js +0 -138
- package/dist/prepare.runtime-B8h04--2.js +0 -732
- package/dist/preview-warnings-DPDK9HPk.js +0 -392
- package/dist/probe-Bts3wK7l.js +0 -682
- package/dist/probe-ByHrOECy.js +0 -47
- package/dist/probe-CXqCx5yV.js +0 -2204
- package/dist/probe-fhhJ0LMx.js +0 -2
- package/dist/program-DfNLP_PI.js +0 -131
- package/dist/prompt-overlay-qKGGXVs-.d.ts +0 -23
- package/dist/provider-CeG5mirD.js +0 -8735
- package/dist/provider-D_TXf9b1.js +0 -152
- package/dist/provider-Fb0fhEC5.js +0 -32
- package/dist/provider-api-key-auth-BIph5btg.d.ts +0 -27
- package/dist/provider-auth-result-BFvMZrH6.d.ts +0 -21
- package/dist/provider-catalog-runtime-Du74RUel.d.ts +0 -23
- package/dist/provider-catalog-shared-B3nN3sf2.d.ts +0 -62
- package/dist/provider-dispatcher-DQ0FP7Oj.js +0 -22
- package/dist/provider-hook-runtime-CRpS8VJ_.d.ts +0 -61
- package/dist/provider-model-shared-GrPEK3SY.d.ts +0 -143
- package/dist/provider-models-iUJVn9QI.d.ts +0 -12
- package/dist/provider-policy-DliVEM__.d.ts +0 -30
- package/dist/provider-registration-BxzmE1yB.d.ts +0 -6
- package/dist/provider-registry-B4AQXjYK.d.ts +0 -8
- package/dist/provider-registry-BHyB46kI.d.ts +0 -30
- package/dist/provider-registry-CnfpUSqh.d.ts +0 -8
- package/dist/provider-runtime-D3j0VBbF.d.ts +0 -359
- package/dist/provider-self-hosted-setup-_11XAmRH.d.ts +0 -74
- package/dist/provider-session.runtime-CIMJ-7ay.js +0 -9
- package/dist/provider-stream-mWxYXsAm.d.ts +0 -140
- package/dist/provider-stream-shared-QayId-fm.d.ts +0 -128
- package/dist/provider-xNaUQ5Lv.js +0 -32
- package/dist/provider.runtime-CGsYbZGk.js +0 -2
- package/dist/providers.runtime-fmZQlSRt.d.ts +0 -25
- package/dist/public-surface-loader-CuVkM64A.js +0 -114
- package/dist/pw-ai-BDGftH9e.js +0 -3029
- package/dist/pw-role-snapshot-C_P091Iv.js +0 -333
- package/dist/reaction-level-DKxiNfWB.js +0 -19
- package/dist/reaction-runtime-api-TY4aPHui.js +0 -116
- package/dist/realtime-transcription-CmRx7wX7.d.ts +0 -43
- package/dist/realtime-transcription-provider-BNca2pAl.js +0 -205
- package/dist/realtime-transcription-provider-Csl2NRiB.d.ts +0 -5
- package/dist/realtime-transcription-provider-CtUTdTS4.d.ts +0 -37
- package/dist/realtime-transcription-provider-DKd69ns6.d.ts +0 -28
- package/dist/realtime-transcription-provider-DPj1VZIg.d.ts +0 -32
- package/dist/realtime-voice-CVgV9cqF.d.ts +0 -333
- package/dist/realtime-voice-provider-CmtxwZon.d.ts +0 -5
- package/dist/register-DLjqO2vR.js +0 -2178
- package/dist/register.agent-FV7a6yzo.js +0 -156
- package/dist/register.configure-DrkSyKW3.js +0 -16
- package/dist/register.crestodian-CQGAa8z2.js +0 -24
- package/dist/register.maintenance-tocHfiS3.js +0 -83
- package/dist/register.onboard-BomHnBGE.js +0 -113
- package/dist/register.runtime-6AmV3Vgs.js +0 -54
- package/dist/register.runtime-CSz0gVBB.d.ts +0 -6
- package/dist/register.setup-ENYtNAA5.js +0 -40
- package/dist/register.subclis-BC6TefAM.js +0 -31
- package/dist/register.subclis-DZdEZgSS.js +0 -3
- package/dist/register.subclis-core-C-EfowrU.js +0 -273
- package/dist/registry-VitXYFE8.d.ts +0 -91
- package/dist/registry-types-C4eAzEgQ.d.ts +0 -392
- package/dist/repair-sequencing-l8dFaytn.js +0 -640
- package/dist/reply-delivery-DdeUWVuk.js +0 -196
- package/dist/reply-runtime-Bd91JEZL.js +0 -11
- package/dist/reply.runtime-l7NTyCh5.js +0 -2
- package/dist/request-BY_4UukN.js +0 -54
- package/dist/resolve-allowlist-C4lmxl4V.js +0 -220
- package/dist/result-fallback-classifier-XORMMp30.js +0 -79
- package/dist/root-help-CTW0Wyrf.js +0 -43
- package/dist/route-dOf1WMkJ.js +0 -469
- package/dist/route-resolution-BddNYZEI.js +0 -274
- package/dist/routes-D0xw72Lf.js +0 -3602
- package/dist/routes-TXSPQFWS.js +0 -2
- package/dist/run-DpvUuaWB.js +0 -1162
- package/dist/run-attempt-Bet0PiSc.js +0 -7704
- package/dist/run-command-C5vMVqMt.js +0 -23
- package/dist/run-command-pNDd7NqP.js +0 -2
- package/dist/run-embedded.runtime-CBZV6YWj.js +0 -4
- package/dist/run-execution-cli.runtime-DTQLV8tA.js +0 -4
- package/dist/run-subagent-registry.runtime-DJCvSdhY.js +0 -2
- package/dist/runtime-CNXeG8vX.js +0 -1287
- package/dist/runtime-DEOSWxv9.js +0 -438
- package/dist/runtime-DbTiSX85.d.ts +0 -17
- package/dist/runtime-api-BCM7T4WV.js +0 -17
- package/dist/runtime-api-BTnMvj8L.js +0 -13
- package/dist/runtime-api-By6LEySM.js +0 -3
- package/dist/runtime-api-Cd0b5LPQ.js +0 -4
- package/dist/runtime-api-CtuDiikz.js +0 -21
- package/dist/runtime-api-DjySILXC.js +0 -13
- package/dist/runtime-api-XJTq_pyQ.js +0 -24
- package/dist/runtime-api-k3v6Q0lb2.d.ts +0 -3151
- package/dist/runtime-api.actions-BmsSg8Ai.js +0 -3
- package/dist/runtime-api.actions-C2-n4QQ5.d.ts +0 -23
- package/dist/runtime-api.monitor-DSk7Pd5H.js +0 -6
- package/dist/runtime-api.send-D3sPncy9.js +0 -4
- package/dist/runtime-api.send-t0FX9tXf.d.ts +0 -38
- package/dist/runtime-api.threads-BK9cB4L1.js +0 -2
- package/dist/runtime-channel--Wjr2ePx.js +0 -150
- package/dist/runtime-channel-WdTa9hHZ.js +0 -2
- package/dist/runtime-embedded-pi.runtime-BNYBvaxo.js +0 -2
- package/dist/runtime-r3jS5wSq.js +0 -6179
- package/dist/runtime-taskflow-DMBY6o56.d.ts +0 -435
- package/dist/sanitize-outbound-D6IBCCpn.js +0 -127
- package/dist/sdk-setup-tools-DcDrd8tW.js +0 -8
- package/dist/secrets-OV1uTwRt.js +0 -113
- package/dist/secrets-cli-llC7t41S.js +0 -149
- package/dist/security-audit-BM_fypcl.js +0 -118
- package/dist/security-audit-CQ2yKgF8.js +0 -122
- package/dist/security-audit.runtime-CRgJUegH.js +0 -2
- package/dist/selection-DkJ7MaPC.js +0 -16157
- package/dist/selection-LeUiOSn0.js +0 -3
- package/dist/send-B5TXXeBz.d.ts +0 -231
- package/dist/send-C0ZHzB6o.js +0 -1631
- package/dist/send-CXL3cM-w.js +0 -192
- package/dist/send-CuDA29HM.js +0 -2
- package/dist/send-D7qhwK7Z.js +0 -143
- package/dist/send-DEMaBWpw.d.ts +0 -105
- package/dist/send.components-BNeg1zrc.js +0 -2
- package/dist/send.components-DwRyC_Hc.js +0 -500
- package/dist/send.runtime-DBIUdxpO.js +0 -2
- package/dist/send.types-DywwIqYK.d.ts +0 -160
- package/dist/server-DGcm6Swr.js +0 -24
- package/dist/server-DPvleC-x.js +0 -73
- package/dist/server-context-BWBM4f-_.js +0 -955
- package/dist/server-context-CFgwcLlu.js +0 -2
- package/dist/server-cron-C1kChsjw.js +0 -2989
- package/dist/server-cron-CS1EP5Li.js +0 -2
- package/dist/server-methods-BcIlC8iD.js +0 -16494
- package/dist/server-node-events-BAZCvZOy.js +0 -596
- package/dist/server-plugin-bootstrap-cQUi21Uu.js +0 -70
- package/dist/server-plugins-BRFre223.js +0 -432
- package/dist/server-reload-handlers-DfcsAX-5.js +0 -714
- package/dist/server-restart-sentinel-CFX5zQkM.js +0 -747
- package/dist/server-restart-sentinel-DUvs77Q0.js +0 -2
- package/dist/server-runtime-services-0vm5XmvV.js +0 -2
- package/dist/server-runtime-services-CLz_vkLy.js +0 -267
- package/dist/server-startup-plugins-CPXqqIRV.js +0 -113
- package/dist/server-startup-post-attach-BkNe1Z6g.js +0 -716
- package/dist/server-ws-runtime-rcJeRHFO.js +0 -349
- package/dist/server.impl-a6knQ-N8.js +0 -2586
- package/dist/service-H-BcELwS.js +0 -1446
- package/dist/session-binding-BQliaqL7.js +0 -2
- package/dist/session-binding-DPvZil_F.js +0 -219
- package/dist/session-kill-http-DJMipluP.js +0 -121
- package/dist/session-reset-service-Dn9FU5wA.js +0 -625
- package/dist/session-route-JLWNmJxD.js +0 -93
- package/dist/session-status.runtime-D0OptHcW.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BUmf1vNS.js +0 -2
- package/dist/session-tab-registry-CoBvJVRj.js +0 -521
- package/dist/sessions-history-http-B8CkLDAn.js +0 -430
- package/dist/sessions.runtime-DbNqS_Gy.js +0 -2
- package/dist/setup-CTZUUn1s.js +0 -586
- package/dist/setup-D6fXOEjD.js +0 -2
- package/dist/setup-api-DLPEXHCv.js +0 -29
- package/dist/setup-core-DLXb29jm.js +0 -174
- package/dist/setup-onboard-configure-help-fast-path-CrcZmKPI.js +0 -64
- package/dist/setup-surface--Cct-rCt.js +0 -288
- package/dist/setup-surface-CW8YN207.js +0 -320
- package/dist/setup-surface-DIxcfqD0.js +0 -221
- package/dist/setup-surface-IJ6kmKgi.js +0 -405
- package/dist/setup.finalize-gWpWnCCk.js +0 -582
- package/dist/setup.gateway-config-D_DaSfpW.js +0 -281
- package/dist/setup.migration-import-CYZjCkle.js +0 -2
- package/dist/setup.migration-import-CZJU4scH.js +0 -200
- package/dist/shared-Bp_Fgv6B.js +0 -121
- package/dist/shared-CLqPY0yv.d.ts +0 -115
- package/dist/shared-client-OQdg8NGC.js +0 -629
- package/dist/shared-client-dk1ICVBm.js +0 -2
- package/dist/side-question-CbhRW3UI.js +0 -683
- package/dist/simple-completion-runtime-XIF65b47.d.ts +0 -73
- package/dist/skill-tool-dispatch.runtime-EcycYnWE.js +0 -143
- package/dist/slash-state-BoX6WwB5.js +0 -2166
- package/dist/speech-CvkJG5Mt.d.ts +0 -47
- package/dist/speech-core-MG83lB3i.d.ts +0 -36
- package/dist/speech-provider-1EN9hT-3.d.ts +0 -8
- package/dist/speech-provider-67ebyEcs.js +0 -184
- package/dist/speech-provider-B6tb45De.d.ts +0 -5
- package/dist/speech-provider-C74wAyBX.d.ts +0 -5
- package/dist/speech-provider-CYJoZZpj.d.ts +0 -8
- package/dist/speech-provider-DavEMdKC.d.ts +0 -34
- package/dist/speech-provider-DvFtveg6.d.ts +0 -5
- package/dist/src-CbfOifft.js +0 -4256
- package/dist/startup-context-YF24NARp.js +0 -313
- package/dist/status-message-CcrZdfCO.js +0 -484
- package/dist/status-message.runtime-Cptt1EPV.js +0 -6
- package/dist/status-subagents.runtime-v2eijc4R.js +0 -18
- package/dist/status-text-BWwar3Yc.js +0 -296
- package/dist/status-tn3uQDY7.js +0 -73
- package/dist/status.runtime-BFjTHLiQ.js +0 -2
- package/dist/sticker-cache-Cs7LV_3a.js +0 -206
- package/dist/sticker-vision.runtime-CyPMpoCs.js +0 -17
- package/dist/stream-1rWKMSqV.d.ts +0 -16
- package/dist/stream-Bk9TnoRV.d.ts +0 -10
- package/dist/stream-DZeY9rhs.d.ts +0 -120
- package/dist/stream-DgCoKjcL.d.ts +0 -19
- package/dist/stream-exnufPSG.d.ts +0 -5
- package/dist/stream-wrappers-D2EuY1tP.d.ts +0 -21
- package/dist/subagent-announce-CRjGGxSB.js +0 -354
- package/dist/subagent-announce-delivery-CbfRRdwt.js +0 -958
- package/dist/subagent-control-VTsWynTB.js +0 -508
- package/dist/subagent-hooks-BB__aHul.js +0 -2
- package/dist/subagent-hooks-Cb5fJ2H0.js +0 -146
- package/dist/subagent-hooks-CwVBMhp_.js +0 -2
- package/dist/subagent-hooks-Cx9_GAMF.js +0 -116
- package/dist/subagent-hooks-DOJhvTDx.js +0 -230
- package/dist/subagent-hooks-DUMqhB3r.js +0 -2
- package/dist/subagent-hooks-api-BDGmCxB2.js +0 -22
- package/dist/subagent-hooks-api-CcTdPqP1.js +0 -23
- package/dist/subagent-hooks-api-D18tQta6.js +0 -23
- package/dist/subagent-orphan-recovery-6bNIX25Q.js +0 -352
- package/dist/subagent-registry-DokIxoQ6.js +0 -2351
- package/dist/subagent-registry-tlyJE0hN.js +0 -3
- package/dist/subagent-session-cleanup-BWHQ6rcm.js +0 -525
- package/dist/subagent-spawn-BUdUAwoc.js +0 -1164
- package/dist/target-id-CI1U3MSO.js +0 -107
- package/dist/targets-CbBORUXB.d.ts +0 -10
- package/dist/targets-CgmlXrhv.js +0 -44
- package/dist/targets-D-jSrLUN.js +0 -19
- package/dist/targets-DPDu8x6v.js +0 -19
- package/dist/targets-D_fXvxrg.d.ts +0 -10
- package/dist/testing-D-48HuIK.js +0 -267
- package/dist/thinking-policy-CY16OlCs.d.ts +0 -5
- package/dist/thread-bindings-B9J0nGG7.js +0 -232
- package/dist/thread-bindings-BByWvFZq.js +0 -8
- package/dist/thread-bindings-Cxjm2mLg.js +0 -571
- package/dist/thread-bindings-DQWmglaO.js +0 -228
- package/dist/thread-bindings.discord-api-DWWDvMgL.js +0 -187
- package/dist/thread-bindings.manager-CQW6bNs5.js +0 -2
- package/dist/thread-bindings.manager-DpBYBs9s.js +0 -536
- package/dist/thread-lifecycle-PpB8gTx1.js +0 -1614
- package/dist/token-CBy6YYM_.js +0 -134
- package/dist/tool-BCHcwX9p.js +0 -139
- package/dist/tool-actions.runtime-Cwxr2NmB.js +0 -534
- package/dist/tool-plugin-DHZYdwyJ.d.ts +0 -77
- package/dist/tool-resolution-DQpf531V.js +0 -149
- package/dist/tool-split-ClZW5eN5.d.ts +0 -19
- package/dist/tools-effective-inventory-BHxeIAri.js +0 -204
- package/dist/tools-invoke-http-Bv2LES5Q.js +0 -67
- package/dist/tools-invoke-shared-Cf_ifab9.js +0 -200
- package/dist/transport-stream-D_pZ9Qwv.d.ts +0 -42
- package/dist/tts-CjTcF0YS.js +0 -66
- package/dist/tui-D3_WpyGV.js +0 -2
- package/dist/tui-Y8IezK6P.js +0 -4709
- package/dist/tui-backend-BIJbrfDK.js +0 -256
- package/dist/tui-cli-YVLQJGLU.js +0 -37
- package/dist/types-CnKegQ41.d.ts +0 -786
- package/dist/types-Dyry5PA_2.d.ts +0 -3650
- package/dist/types.public-AUFnQi6j.d.ts +0 -70
- package/dist/update-cli-B7MOXy4Y.js +0 -3664
- package/dist/video-generation-runtime-Cc8klYNS.d.ts +0 -21
- package/dist/video-model-catalog-XG42YlJS.d.ts +0 -16
- package/dist/vision-tools-kEwnV2UO.js +0 -1409
- package/dist/web-search-DH1W_lfx.js +0 -62
- package/dist/web-search-provider.runtime-BX9TezsY.js +0 -328
- package/dist/web-search-provider.runtime-BhRjYeyp.js +0 -2
- package/dist/webhook-targets--wGRjxMd.d.ts +0 -99
- package/dist/xai-oauth-BZQ--94U.js +0 -479
- package/dist/xai-user-agent-SpZaKTGR.js +0 -32
- package/dist/zod-schema.core-BhLPa6BF.d.ts +0 -166
- /package/dist/{accounts-CqgATPC-2.d.ts → accounts-CqgATPC-.d.ts} +0 -0
- /package/dist/{acp-runtime-backend-DU5R8SXu.js → acp-runtime-backend-DHyoMnZY.js} +0 -0
- /package/dist/{channel-actions-Ce2Sna1a.js → channel-actions-B5OPAiNK.js} +0 -0
- /package/dist/{command-status-runtime-Cj5vB8lc.js → command-status-runtime-BqQvv1BR.js} +0 -0
- /package/dist/{delegate-BeKeQwNR.js → delegate-B1QIF1j8.js} +0 -0
- /package/dist/{dispatch-acp-DXlzEM_A.js → dispatch-acp-Ch9ZmM4b.js} +0 -0
- /package/dist/{heartbeat-runner-Dncw_0KS.js → heartbeat-runner-BkgH94IS.js} +0 -0
- /package/dist/{library-6cU4n1-c.js → library-DP1oARlw.js} +0 -0
- /package/dist/{run-executor.runtime-DjwaphFT.js → run-executor.runtime-Czk4Lxkj.js} +0 -0
- /package/dist/{video-generation-core-BVVgDSdq.d.ts → server-plugins-BVVgDSdq.d.ts} +0 -0
- /package/dist/{shared-BE5PSFeb.js → shared-SiM6kZAE.js} +0 -0
- /package/dist/{model-ref-mtPT-mlX.d.ts → video-generation-core-mtPT-mlX.d.ts} +0 -0
|
@@ -0,0 +1,2351 @@
|
|
|
1
|
+
import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DyL154ka.js";
|
|
2
|
+
import { c as readErrorName, i as formatErrorMessage } from "./errors-DCgU20d6.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-BSF8x4GW.js";
|
|
7
|
+
import { t as createSubsystemLogger } from "./subsystem-CK3I9R1L.js";
|
|
8
|
+
import { i as getRuntimeConfig } from "./io-CcynUC5m.js";
|
|
9
|
+
import "./config-D3mxUrDI.js";
|
|
10
|
+
import { r as callGateway } from "./call-CWafXuDK.js";
|
|
11
|
+
import { t as getGlobalHookRunner } from "./hook-runner-global-DfvRzdbT.js";
|
|
12
|
+
import { c as getAgentRunContext, l as onAgentEvent } from "./agent-events-Cfj53GyA.js";
|
|
13
|
+
import { o as normalizeDeliveryContext } from "./delivery-context.shared-BP9Iy2G-.js";
|
|
14
|
+
import { u as resolveStorePath } from "./paths-8MFrTNIB.js";
|
|
15
|
+
import { c as registerSessionMaintenancePreserveKeysProvider, t as loadSessionStore } from "./store-load-BIBESNhm.js";
|
|
16
|
+
import { u as updateSessionStore } from "./store-BMkMyEnW.js";
|
|
17
|
+
import "./sessions-CevgdiMi.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-vaVUN-4P.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-58hKSNVD.js";
|
|
23
|
+
import { c as retireSessionMcpRuntimeForSessionKey } from "./pi-bundle-mcp-runtime-DpUWOkOe.js";
|
|
24
|
+
import "./pi-bundle-mcp-tools-DbNUbe56.js";
|
|
25
|
+
import { i as waitForAgentRun, l as formatBlockedLivenessError, t as isRecoverableAgentWaitError, u as isBlockedLivenessState } from "./run-wait-BNxzmlGR.js";
|
|
26
|
+
import { d as withSubagentOutcomeTiming, t as deleteSubagentSessionForCleanup } from "./subagent-session-cleanup-Bd6d93qi.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-CtTuQSAu.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-BEPlkjCS.js"));
|
|
1627
|
+
const browserCleanupLoader = createLazyImportLoader(() => import("./browser-lifecycle-cleanup-CtTuQSAu.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-Cl_y6Poi.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 };
|