kaijibot 2026.8.21 → 2026.8.29
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/.buildstamp +1 -1
- package/dist/abort-cutoff.runtime-CvjKPRCc.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort-oydh5Lhz.js +202 -0
- package/dist/abort.runtime-CRdzW7xT.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/acp-cli-BHDaxHbu.js +2171 -0
- package/dist/acp-spawn-DxOz0xfY.js +1024 -0
- package/dist/acp-stateful-target-driver-KEFKE9Xp.js +88 -0
- package/dist/action-agents-Bx5S-ZYL.js +67 -0
- package/dist/action-focus-DGURwLDo.js +124 -0
- package/dist/action-help-7ey3e-V9.js +7 -0
- package/dist/action-info-C-s3lTKU.js +58 -0
- package/dist/action-kill-C8NE3VV1.js +33 -0
- package/dist/action-list-cwGVroWS.js +21 -0
- package/dist/action-log-DT-bRM9X.js +30 -0
- package/dist/action-send-aPSA7hXi.js +39 -0
- package/dist/action-spawn-C_rE09kV.js +46 -0
- package/dist/action-unfocus-CU1WRop0.js +28 -0
- package/dist/agent-DHoWKPhG.js +2 -0
- package/dist/agent-command-C85CZnB2.js +1479 -0
- package/dist/agent-runner-utils-fBrjJUeq.js +202 -0
- package/dist/agent-runner.runtime-BqeiZ4EM.js +2825 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agents/auth-profiles.runtime.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents/models-config.runtime.js +1 -1
- package/dist/agents/pi-model-discovery-runtime.js +1 -1
- package/dist/agents-CLRmtsGT.js +5 -0
- package/dist/agents-CpAbdgb5.js +887 -0
- package/dist/anthropic-vertex-stream-C-dr7gew.js +5666 -0
- package/dist/api-BdhUf3WJ.js +2 -0
- package/dist/api-BmEJb46d.js +5 -0
- package/dist/api-C-d6hJ6R.js +3 -0
- package/dist/api-CWzMTsre.js +35 -0
- package/dist/api-CspIEuoI.js +4 -0
- package/dist/api-DWfH8UCU.js +19 -0
- package/dist/api-Y8trG2YC.js +2 -0
- package/dist/api-fZ1Mwhb9.js +2 -0
- package/dist/api-inKLxoen.js +45 -0
- package/dist/api-plrtNPKq.js +2 -0
- package/dist/apply-Bfh6a5Gd.js +493 -0
- package/dist/apply.runtime-9wUnQpcn.js +2 -0
- package/dist/apply.runtime-BOvle-IJ.js +166 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/approval-client-helpers-Ss4gUaso.js +82 -0
- package/dist/approval-gateway-resolver-D6xh0K2G.js +58 -0
- package/dist/approval-gateway-runtime-CffF6RIQ.js +2 -0
- package/dist/approval-handler-runtime-p9BmT1Xf.js +439 -0
- package/dist/approval-native-runtime-DN73OHKf.js +709 -0
- package/dist/approval-renderers-CITEnajR.js +64 -0
- package/dist/asr-DhijEuKe.js +196 -0
- package/dist/audit-BM_BshdA.js +885 -0
- package/dist/audit-extra.async-Cvm-ViC4.js +847 -0
- package/dist/audit.deep.runtime-Ccabqd1Y.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-BNrDSb24.js +859 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-BKUEHsrE.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-Dt8gUUJi.js +181 -0
- package/dist/auth-choice-B7p3GCLx.js +71 -0
- package/dist/auth-choice-C_fDkWzu.js +3 -0
- package/dist/auth-choice-aZGUR7iI.js +353 -0
- package/dist/auth-choice-options-BxgjFsFO.js +104 -0
- package/dist/auth-choice-prompt-B-P39mib.js +2 -0
- package/dist/auth-choice-prompt-Dp7Vptqj.js +36 -0
- package/dist/auth-choice.plugin-providers.runtime-BJqmauZz.js +11 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auth-health-CPclIUZ3.js +165 -0
- package/dist/auth-profiles-P49vCUs4.js +438 -0
- package/dist/auth-profiles.runtime-pIuc_0v-.js +7 -0
- package/dist/auth-profiles.runtime.js +1 -1
- package/dist/auto-recall-Dm-J3oEj.js +78 -0
- package/dist/backup-create-DcO0pYFy.js +391 -0
- package/dist/banner-CIw8Yepm.js +2 -0
- package/dist/banner-w4GNKrs6.js +281 -0
- package/dist/binding-routing-BPc8aHaH.js +50 -0
- package/dist/binding-targets-BgrFPSR_.js +99 -0
- package/dist/bridge-server-Cu0xkN0E.js +103 -0
- package/dist/browser-config-runtime-3QVJiqnP.js +6 -0
- package/dist/browser-control-auth-BkunTzw7.js +120 -0
- package/dist/browser-node-runtime-BusKdg2E.js +12 -0
- package/dist/browser-profiles-BocOxjqC.js +170 -0
- package/dist/browser-runtime-D3goJLF9.js +377 -0
- package/dist/browser-setup-tools-j-IDYASL.js +12 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +4 -4
- package/dist/bundled/session-memory/handler.js +2 -2
- package/dist/call-CMDK9Mqx.js +2 -0
- package/dist/call-Cisydyym.js +495 -0
- package/dist/call.runtime-CJUaD_Ck.js +2 -0
- package/dist/call.runtime.js +1 -1
- package/dist/capability-cli-DiozBqD0.js +1357 -0
- package/dist/catalog-provider-D5mzbnCM.js +40 -0
- package/dist/cdp.helpers-BqVqEY02.js +372 -0
- package/dist/channel-core-XiZJKMdn.js +5 -0
- package/dist/channel-summary-BHojSrOd.js +139 -0
- package/dist/channel-summary-CzjCL-4-.js +2 -0
- package/dist/channel.runtime-aniwgXor.js +399 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-cli-Y-Wnalvd.js +248 -0
- package/dist/channels-uiGUmLk2.js +1147 -0
- package/dist/chat-i1lw_GS7.js +213 -0
- package/dist/chrome-BcU0ZvUn.js +1080 -0
- package/dist/chrome.executables-Dp0Lkjmz.js +550 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-BGB7qdp3.js +191 -0
- package/dist/cli-BtTS8CKF.js +2 -0
- package/dist/cli-CQX3q4Fm.js +57 -0
- package/dist/cli-ZLAF588A.js +154 -0
- package/dist/cli-auth-seam-D-Qci5-b.js +14 -0
- package/dist/cli-backend-DxaeTZ8N.js +66 -0
- package/dist/cli-g4KJW_UT.js +2 -0
- package/dist/cli-migration-B2SFdY0j.js +127 -0
- package/dist/cli-runner-BVQt0v1D.js +1662 -0
- package/dist/cli-runner.runtime-BAMS4uW0.js +3 -0
- package/dist/cli-runner.runtime-H3alxbDK.js +2 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-BaJRfEqD.js +142 -0
- package/dist/cli-startup-metadata.json +2 -2
- package/dist/cli.runtime-CQ1qvGdJ.js +819 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/client-bootstrap-BE7PiMJr.js +28 -0
- package/dist/codex-native-web-search-TdFXLTHZ.js +2 -0
- package/dist/codex-native-web-search-dKQT4ZPV.js +156 -0
- package/dist/collector-BXDPP4rJ.js +2 -0
- package/dist/collector-CT3qBEYi.js +424 -0
- package/dist/command-auth-DWJeLGyD.js +75 -0
- package/dist/command-config-resolution-BfTLOZxI.js +23 -0
- package/dist/command-config-resolution-GV0h_B0u.js +2 -0
- package/dist/command-execution-startup-oMdUg9Py.js +269 -0
- package/dist/command-format-CZ8oMoC9.js +2 -0
- package/dist/command-queue-BlORGS1M.js +260 -0
- package/dist/command-registry-Btc2eVOe.js +3 -0
- package/dist/command-registry-xNH71zVG.js +113 -0
- package/dist/command-secret-gateway-Cnjliq_k.js +528 -0
- package/dist/commands-acp-Bdd13J_G.js +1017 -0
- package/dist/commands-compact.runtime-yJyp-ut6.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-Ca3exd9B.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-C8y-XQKy.js +3762 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-C4z_O60i.js +306 -0
- package/dist/commands-reset-hooks-0RFpUGBC.js +129 -0
- package/dist/commands-status-sybj_ri9.js +223 -0
- package/dist/commands-status.runtime-DYFjfk2h.js +2 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-Cpc3gG_N.js +2 -0
- package/dist/commands-subagents-control.runtime-DxYylY9i.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands.runtime-B7K8rL1c.js +103 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/comment-shared-BCggDOtV.js +40 -0
- package/dist/compact-lqt6mZJz.js +11324 -0
- package/dist/compact.runtime-BM2mdK3C.js +7 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-CkGZkKuo.js +468 -0
- package/dist/completion-cli-CuWswpSF.js +2 -0
- package/dist/config-BZb7_jO5.js +166 -0
- package/dist/config-C2M27bOw.js +8 -0
- package/dist/config-D_fICGrQ.js +53 -0
- package/dist/config-cli-5iJ3ONwl.js +948 -0
- package/dist/config-defaults-XFEo6I7v.js +163 -0
- package/dist/config-guard-wGGj2x7b.js +94 -0
- package/dist/config-runtime-xwO8vvQP.js +14 -0
- package/dist/config-validation-tPbNhbrH.js +279 -0
- package/dist/configure-BNlqzTPI.js +2 -0
- package/dist/configure-C34mJxny.js +1162 -0
- package/dist/connection-auth-ClCO21bT.js +30 -0
- package/dist/context-CJMC7SyI.js +249 -0
- package/dist/context-CWC_tVM8.js +2 -0
- package/dist/context-writer-DNkMBOu9.js +290 -0
- package/dist/control-auth-DUZs9D8n.js +122 -0
- package/dist/control-ui/assets/agents-HENIRhRj.js +767 -0
- package/dist/control-ui/assets/anthropic-DlOZcqqy.js +40 -0
- package/dist/control-ui/assets/azure-openai-responses-BmSDwKAQ.js +2 -0
- package/dist/control-ui/assets/cron-B2CJajqc.js +744 -0
- package/dist/control-ui/assets/dialogues-DmWmdbMF.js +83 -0
- package/dist/control-ui/assets/history-CP7LOJan.js +71 -0
- package/dist/control-ui/assets/index-BsGBtIKy.css +1 -0
- package/dist/control-ui/assets/index-BtNFbQhY.js +2686 -0
- package/dist/control-ui/assets/mistral-CYEJ-E7G.js +72 -0
- package/dist/control-ui/assets/openai-codex-responses-BnLjDxo3.js +8 -0
- package/dist/control-ui/assets/openai-completions-D46D4eD2.js +6 -0
- package/dist/control-ui/assets/openai-responses-CNVWXuC0.js +2 -0
- package/dist/control-ui/assets/openai-responses-shared-ByeOE-gc.js +13 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/conversation-id-DlazDTmW.js +140 -0
- package/dist/conversation-runtime-DT_Kt-1e.js +31 -0
- package/dist/core-CDevM2NU.js +210 -0
- package/dist/cron-cli-CTGN3Kum.js +637 -0
- package/dist/curator-BM2jeaou.js +600 -0
- package/dist/curator-_QLWjb7r.js +2 -0
- package/dist/daemon-cli-BLe7aLfJ.js +476 -0
- package/dist/daemon-install-BneaHOcs.js +70 -0
- package/dist/delegate-DjZBGLcI.js +61 -0
- package/dist/deliver-BvUx9v-a.js +3 -0
- package/dist/deliver-DQbRPHSb.js +782 -0
- package/dist/deliver-runtime-ERlRZAW4.js +2 -0
- package/dist/delivery-outbound.runtime-Bi6Lu4JP.js +6 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-B4kCxhnW.js +2 -0
- package/dist/delivery-queue-DDHwRyN-.js +372 -0
- package/dist/deps-DZQeVHSD.js +60 -0
- package/dist/devices-cli-CFSjN2KZ.js +336 -0
- package/dist/diagnostic-Bh12mVkv.js +311 -0
- package/dist/direct-dm-B6ygwMl8.js +139 -0
- package/dist/directive-handling.fast-lane-CjPxeQQ2.js +64 -0
- package/dist/directive-handling.fast-lane-DtY_Rzhu.js +2 -0
- package/dist/directive-handling.impl-DHH_ngCz.js +659 -0
- package/dist/directive-handling.impl-D_BUzYTB.js +2 -0
- package/dist/directive-handling.parse-COyCTXvI.js +376 -0
- package/dist/directive-handling.persist-CgxhTMmz.js +139 -0
- package/dist/directive-handling.persist.runtime-4pppF2CM.js +2 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directive-handling.shared-BuNzwbwp.js +159 -0
- package/dist/directory-cli-gWQfdmFR.js +240 -0
- package/dist/dispatch-CS6YwhWT.js +1126 -0
- package/dist/dispatch-acp-CHwiKXlb.js +969 -0
- package/dist/dispatch-acp-manager.runtime-kJDHLlOT.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-CCYs6Ack.js +3 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-session.runtime-DdkuSkq8.js +2 -0
- package/dist/dispatch-acp-session.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-D8sMZufW.js +19 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dns-cli-C4uepTJE.js +193 -0
- package/dist/docs-cli-DWzfteG6.js +156 -0
- package/dist/doctor-completion-Fy70rfGZ.js +90 -0
- package/dist/doctor-config-preflight-BIf8igIW.js +148 -0
- package/dist/doctor-config-preflight-BiJSPUPg.js +2 -0
- package/dist/doctor-state-migrations-BbfPLoLz.js +2 -0
- package/dist/doctor-state-migrations-DFQets45.js +3 -0
- package/dist/drive-Bo8IgJdV.js +718 -0
- package/dist/embedding-provider-DUT_HxYD.js +26 -0
- package/dist/embedding-provider-DjVEIg-4.js +33 -0
- package/dist/embedding-provider-TKNNnQ3m.js +129 -0
- package/dist/engine-DfRE1gmI.js +82 -0
- package/dist/engine-embeddings-BN4uJOv0.js +1489 -0
- package/dist/entry-capabilities-BhpTqh0w.js +89 -0
- package/dist/entry.js +2 -2
- package/dist/env-overrides-Dn5yy0l4.js +347 -0
- package/dist/env-overrides.runtime-DdD841Km.js +7 -0
- package/dist/env-overrides.runtime.js +1 -1
- package/dist/exec-approval-forwarder.runtime-CV81fvQh.js +3 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approval-reply-C_NfihTE.js +292 -0
- package/dist/exec-approvals-cli-DKOFcUAn.js +485 -0
- package/dist/exec-defaults-Cs1FwIKH.js +1440 -0
- package/dist/extensionAPI.js +4 -4
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/anthropic/api.js +2 -2
- package/dist/extensions/anthropic/cli-auth-seam.js +1 -1
- package/dist/extensions/anthropic/cli-backend-api.js +2 -2
- package/dist/extensions/anthropic/cli-backend.js +1 -1
- package/dist/extensions/anthropic/cli-migration.js +1 -1
- package/dist/extensions/anthropic/cli-shared.js +1 -1
- package/dist/extensions/anthropic/config-defaults.js +1 -1
- package/dist/extensions/anthropic/contract-api.js +1 -1
- package/dist/extensions/anthropic/index.js +1 -1
- package/dist/extensions/anthropic/media-understanding-provider.js +1 -1
- package/dist/extensions/anthropic/provider-policy-api.js +1 -1
- package/dist/extensions/anthropic/register.runtime.js +1 -1
- package/dist/extensions/anthropic/setup-api.js +1 -1
- package/dist/extensions/anthropic/stream-wrappers.js +1 -1
- package/dist/extensions/anthropic/test-api.js +3 -3
- package/dist/extensions/anthropic-vertex/api.js +3 -3
- package/dist/extensions/anthropic-vertex/index.js +2 -2
- package/dist/extensions/anthropic-vertex/provider-catalog.js +1 -1
- package/dist/extensions/anthropic-vertex/region.js +1 -1
- package/dist/extensions/anthropic-vertex/setup-api.js +1 -1
- package/dist/extensions/arcee/index.js +2 -2
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-cdp.js +1 -1
- package/dist/extensions/browser/browser-config.js +3 -3
- package/dist/extensions/browser/browser-control-auth.js +1 -1
- package/dist/extensions/browser/browser-doctor.js +4 -4
- package/dist/extensions/browser/browser-host-inspection.js +1 -1
- package/dist/extensions/browser/browser-maintenance.js +2 -2
- package/dist/extensions/browser/browser-profiles.js +1 -1
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +3 -3
- package/dist/extensions/browser/runtime-api.js +12 -12
- package/dist/extensions/browser/setup-api.js +2 -2
- package/dist/extensions/browser/test-support.js +1 -1
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/cerebras/index.js +1 -1
- package/dist/extensions/chutes/api.js +3 -3
- package/dist/extensions/chutes/index.js +7 -7
- package/dist/extensions/chutes/models.js +1 -1
- package/dist/extensions/chutes/onboard.js +2 -2
- package/dist/extensions/chutes/provider-catalog.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/index.js +6 -6
- package/dist/extensions/deepinfra/api.js +3 -3
- package/dist/extensions/deepinfra/embedding-provider.js +1 -1
- package/dist/extensions/deepinfra/index.js +4 -4
- package/dist/extensions/deepinfra/media-understanding-provider.js +1 -1
- package/dist/extensions/deepinfra/memory-embedding-adapter.js +1 -1
- package/dist/extensions/deepinfra/video-generation-provider.js +1 -1
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/index.js +5 -5
- package/dist/extensions/device-pair/notify.js +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/diffs/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/diffs/index.js +1 -1
- package/dist/extensions/diffs/node_modules/.package-lock.json +6 -6
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/cjs/deserialize.js +12 -2
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/cjs/serialize.js +5 -1
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/esm/deserialize.js +12 -2
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/esm/serialize.js +5 -1
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/package.json +1 -1
- package/dist/extensions/diffs/node_modules/@ungap/structured-clone/structured-json.js +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/format/email.mjs +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/format/idna/idn-hostname.mjs +21 -1
- package/dist/extensions/diffs/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/dist/extensions/diffs/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/dist/extensions/diffs/node_modules/typebox/package.json +1 -1
- package/dist/extensions/exa/index.js +1 -1
- package/dist/extensions/feishu/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/feishu/api.js +16 -16
- package/dist/extensions/feishu/contract-api.js +2 -2
- package/dist/extensions/feishu/node_modules/.package-lock.json +12 -12
- package/dist/extensions/feishu/node_modules/@types/node/README.md +1 -1
- package/dist/extensions/feishu/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/dist/extensions/feishu/node_modules/@types/node/crypto.d.ts +2 -4
- package/dist/extensions/feishu/node_modules/@types/node/dgram.d.ts +119 -4
- package/dist/extensions/feishu/node_modules/@types/node/fs/promises.d.ts +61 -65
- package/dist/extensions/feishu/node_modules/@types/node/fs.d.ts +86 -76
- package/dist/extensions/feishu/node_modules/@types/node/http.d.ts +17 -1
- package/dist/extensions/feishu/node_modules/@types/node/http2.d.ts +12 -4
- package/dist/extensions/feishu/node_modules/@types/node/index.d.ts +1 -0
- package/dist/extensions/feishu/node_modules/@types/node/inspector.d.ts +2 -1
- package/dist/extensions/feishu/node_modules/@types/node/net.d.ts +108 -16
- package/dist/extensions/feishu/node_modules/@types/node/package.json +2 -2
- package/dist/extensions/feishu/node_modules/@types/node/process.d.ts +52 -0
- package/dist/extensions/feishu/node_modules/@types/node/quic.d.ts +246 -38
- package/dist/extensions/feishu/node_modules/@types/node/sqlite.d.ts +6 -2
- package/dist/extensions/feishu/node_modules/@types/node/stream/iter.d.ts +4 -4
- package/dist/extensions/feishu/node_modules/@types/node/test.d.ts +36 -0
- package/dist/extensions/feishu/node_modules/@types/node/tls.d.ts +24 -0
- package/dist/extensions/feishu/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/dist/extensions/feishu/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/dist/extensions/feishu/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/dist/extensions/feishu/node_modules/@types/node/tty.d.ts +4 -3
- package/dist/extensions/feishu/node_modules/@types/node/vfs.d.ts +210 -0
- package/dist/extensions/feishu/node_modules/@types/node/vm.d.ts +1 -1
- package/dist/extensions/feishu/node_modules/axios/CHANGELOG.md +62 -0
- package/dist/extensions/feishu/node_modules/axios/README.md +233 -5
- package/dist/extensions/feishu/node_modules/axios/dist/axios.js +387 -89
- package/dist/extensions/feishu/node_modules/axios/dist/axios.min.js +3 -3
- package/dist/extensions/feishu/node_modules/axios/dist/browser/axios.cjs +458 -98
- package/dist/extensions/feishu/node_modules/axios/dist/esm/axios.js +458 -98
- package/dist/extensions/feishu/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/dist/extensions/feishu/node_modules/axios/dist/node/axios.cjs +568 -116
- package/dist/extensions/feishu/node_modules/axios/index.d.cts +4 -0
- package/dist/extensions/feishu/node_modules/axios/index.d.ts +4 -0
- package/dist/extensions/feishu/node_modules/axios/lib/adapters/fetch.js +64 -11
- package/dist/extensions/feishu/node_modules/axios/lib/adapters/http.js +134 -50
- package/dist/extensions/feishu/node_modules/axios/lib/adapters/xhr.js +52 -3
- package/dist/extensions/feishu/node_modules/axios/lib/core/Axios.js +19 -14
- package/dist/extensions/feishu/node_modules/axios/lib/core/InterceptorManager.js +107 -8
- package/dist/extensions/feishu/node_modules/axios/lib/core/buildFullPath.js +1 -13
- package/dist/extensions/feishu/node_modules/axios/lib/core/dispatchRequest.js +8 -2
- package/dist/extensions/feishu/node_modules/axios/lib/core/mergeConfig.js +1 -1
- package/dist/extensions/feishu/node_modules/axios/lib/core/methodList.js +17 -0
- package/dist/extensions/feishu/node_modules/axios/lib/defaults/index.js +2 -1
- package/dist/extensions/feishu/node_modules/axios/lib/env/data.js +1 -1
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/Http2Sessions.js +2 -0
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/fromDataURI.js +5 -4
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/resolveConfig.js +4 -2
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/shouldBypassProxy.js +182 -6
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/dist/extensions/feishu/node_modules/axios/lib/helpers/toFormData.js +14 -21
- package/dist/extensions/feishu/node_modules/axios/lib/utils.js +134 -13
- package/dist/extensions/feishu/node_modules/axios/package.json +1 -1
- package/dist/extensions/feishu/node_modules/protobufjs/dist/light/protobuf.js +59 -6
- package/dist/extensions/feishu/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/dist/extensions/feishu/node_modules/protobufjs/dist/minimal/protobuf.js +22 -2
- package/dist/extensions/feishu/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/dist/extensions/feishu/node_modules/protobufjs/dist/protobuf.js +59 -6
- package/dist/extensions/feishu/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/dist/extensions/feishu/node_modules/protobufjs/package.json +1 -1
- package/dist/extensions/feishu/node_modules/protobufjs/src/decoder.js +32 -3
- package/dist/extensions/feishu/node_modules/protobufjs/src/reader.js +20 -0
- package/dist/extensions/feishu/node_modules/protobufjs/src/wrappers.js +5 -1
- package/dist/extensions/feishu/node_modules/typebox/build/format/email.mjs +1 -1
- package/dist/extensions/feishu/node_modules/typebox/build/format/idna/idn-hostname.mjs +21 -1
- package/dist/extensions/feishu/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/dist/extensions/feishu/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/dist/extensions/feishu/node_modules/typebox/package.json +1 -1
- package/dist/extensions/feishu/runtime-api.js +2 -2
- package/dist/extensions/feishu/security-contract-api.js +1 -1
- package/dist/extensions/feishu/session-key-api.js +1 -1
- package/dist/extensions/feishu/setup-api.js +1 -1
- package/dist/extensions/fireworks/index.js +1 -1
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/index.js +6 -6
- package/dist/extensions/github-copilot/login.js +1 -1
- package/dist/extensions/github-copilot/models-defaults.js +1 -1
- package/dist/extensions/github-copilot/models.js +1 -1
- package/dist/extensions/github-copilot/register.runtime.js +4 -4
- package/dist/extensions/github-copilot/replay-policy.js +1 -1
- package/dist/extensions/google/api.js +1 -1
- package/dist/extensions/google/gemini-cli-provider.js +1 -1
- package/dist/extensions/google/image-generation-provider.js +1 -1
- package/dist/extensions/google/index.js +5 -5
- package/dist/extensions/google/media-understanding-provider.js +1 -1
- package/dist/extensions/google/music-generation-provider.js +1 -1
- package/dist/extensions/google/oauth-token-shared.js +1 -1
- package/dist/extensions/google/oauth.credentials.js +1 -1
- package/dist/extensions/google/oauth.flow.js +1 -1
- package/dist/extensions/google/oauth.js +2 -2
- package/dist/extensions/google/oauth.runtime.js +1 -1
- package/dist/extensions/google/oauth.settings.js +1 -1
- package/dist/extensions/google/oauth.token.js +1 -1
- package/dist/extensions/google/provider-models.js +1 -1
- package/dist/extensions/google/provider-registration.js +1 -1
- package/dist/extensions/google/runtime-api.js +2 -2
- package/dist/extensions/google/test-api.js +2 -2
- package/dist/extensions/google/video-generation-provider.js +1 -1
- package/dist/extensions/google/web-search-provider.js +1 -1
- package/dist/extensions/groq/index.js +1 -1
- package/dist/extensions/groq/media-understanding-provider.js +1 -1
- package/dist/extensions/groq/test-api.js +1 -1
- package/dist/extensions/huggingface/api.js +3 -3
- package/dist/extensions/huggingface/index.js +3 -3
- package/dist/extensions/huggingface/models.js +1 -1
- package/dist/extensions/huggingface/onboard.js +1 -1
- package/dist/extensions/huggingface/provider-catalog.js +2 -2
- package/dist/extensions/image-generation-core/api.js +2 -2
- package/dist/extensions/image-generation-core/runtime-api.js +2 -2
- package/dist/extensions/kilocode/api.js +2 -2
- package/dist/extensions/kilocode/index.js +6 -6
- package/dist/extensions/kilocode/onboard.js +2 -2
- package/dist/extensions/kilocode/provider-catalog.js +1 -1
- package/dist/extensions/kilocode/provider-models.js +1 -1
- package/dist/extensions/kilocode/shared.js +1 -1
- package/dist/extensions/kimi-coding/index.js +3 -3
- package/dist/extensions/kindle-portal/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/kindle-portal/node_modules/.package-lock.json +3 -3
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/email.mjs +1 -1
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/idna/idn-hostname.mjs +21 -1
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/dist/extensions/kindle-portal/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/dist/extensions/kindle-portal/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/dist/extensions/kindle-portal/node_modules/typebox/package.json +1 -1
- package/dist/extensions/knowledge-wiki/index.js +2 -2
- package/dist/extensions/litellm/index.js +1 -1
- package/dist/extensions/llm-task/index.js +1 -1
- package/dist/extensions/lmstudio/api.js +6 -6
- package/dist/extensions/lmstudio/index.js +2 -2
- package/dist/extensions/lmstudio/runtime-api.js +1 -1
- package/dist/extensions/media-understanding-core/runtime-api.js +2 -2
- package/dist/extensions/memory-core/cli-metadata.js +2 -2
- package/dist/extensions/memory-core/index.js +12 -12
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +5 -5
- package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
- package/dist/extensions/memory-lancedb/index.js +1 -1
- package/dist/extensions/microsoft/index.js +1 -1
- package/dist/extensions/microsoft/speech-provider.js +1 -1
- package/dist/extensions/microsoft/test-api.js +1 -1
- package/dist/extensions/microsoft/tts.js +1 -1
- package/dist/extensions/microsoft-foundry/auth.js +1 -1
- package/dist/extensions/microsoft-foundry/cli.js +1 -1
- package/dist/extensions/microsoft-foundry/index.js +1 -1
- package/dist/extensions/microsoft-foundry/onboard.js +2 -2
- package/dist/extensions/microsoft-foundry/provider.js +1 -1
- package/dist/extensions/microsoft-foundry/runtime.js +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
- package/dist/extensions/microsoft-foundry/shared.js +1 -1
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/test-api.js +2 -2
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/mistral/embedding-provider.js +1 -1
- package/dist/extensions/mistral/index.js +2 -2
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.js +3 -3
- package/dist/extensions/mistral/test-api.js +1 -1
- package/dist/extensions/moonshot/index.js +5 -5
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/test-api.js +2 -2
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/nvidia/index.js +1 -1
- package/dist/extensions/ollama/api.js +3 -3
- package/dist/extensions/ollama/index.js +6 -6
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/ollama/web-search-provider.js +1 -1
- package/dist/extensions/openai/api.js +3 -3
- package/dist/extensions/openai/image-generation-provider.js +1 -1
- package/dist/extensions/openai/index.js +9 -9
- package/dist/extensions/openai/media-understanding-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
- package/dist/extensions/openai/openai-codex-cli-auth.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-shared.js +1 -1
- package/dist/extensions/openai/openai-provider.js +1 -1
- package/dist/extensions/openai/prompt-overlay.js +1 -1
- package/dist/extensions/openai/realtime-provider-shared.js +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/openai/realtime-voice-provider.js +1 -1
- package/dist/extensions/openai/register.runtime.js +8 -8
- package/dist/extensions/openai/shared.js +1 -1
- package/dist/extensions/openai/speech-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +5 -5
- package/dist/extensions/openai/transport-policy.js +1 -1
- package/dist/extensions/openai/video-generation-provider.js +1 -1
- package/dist/extensions/opencode/index.js +3 -3
- package/dist/extensions/opencode-go/index.js +2 -2
- package/dist/extensions/openrouter/api.js +2 -2
- package/dist/extensions/openrouter/image-generation-provider.js +1 -1
- package/dist/extensions/openrouter/index.js +6 -6
- package/dist/extensions/openrouter/media-understanding-provider.js +1 -1
- package/dist/extensions/openrouter/music-generation-provider.js +1 -1
- package/dist/extensions/openrouter/test-api.js +3 -3
- package/dist/extensions/openrouter/video-generation-provider.js +1 -1
- package/dist/extensions/openshell/index.js +4 -4
- package/dist/extensions/qianfan/index.js +1 -1
- package/dist/extensions/qwen/index.js +3 -3
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/test-api.js +2 -2
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/runway/index.js +1 -1
- package/dist/extensions/runway/video-generation-provider.js +1 -1
- package/dist/extensions/sglang/api.js +2 -2
- package/dist/extensions/sglang/index.js +2 -2
- package/dist/extensions/sglang/models.js +1 -1
- package/dist/extensions/sherpa-speech/asr.js +1 -1
- package/dist/extensions/sherpa-speech/engine.js +1 -1
- package/dist/extensions/sherpa-speech/index.js +1 -1
- package/dist/extensions/speech-core/api.js +2 -2
- package/dist/extensions/speech-core/runtime-api.js +4 -4
- package/dist/extensions/stepfun/index.js +2 -2
- package/dist/extensions/talk-voice/index.js +3 -3
- package/dist/extensions/tavily/index.js +1 -1
- package/dist/extensions/together/index.js +1 -1
- package/dist/extensions/together/video-generation-provider.js +1 -1
- package/dist/extensions/venice/api.js +3 -3
- package/dist/extensions/venice/index.js +5 -5
- package/dist/extensions/venice/models.js +1 -1
- package/dist/extensions/venice/onboard.js +2 -2
- package/dist/extensions/venice/provider-catalog.js +1 -1
- package/dist/extensions/vercel-ai-gateway/index.js +1 -1
- package/dist/extensions/vllm/api.js +2 -2
- package/dist/extensions/vllm/index.js +2 -2
- package/dist/extensions/vllm/models.js +1 -1
- package/dist/extensions/vllm/register.runtime.js +2 -2
- package/dist/extensions/volcengine/index.js +2 -2
- package/dist/extensions/vydra/image-generation-provider.js +1 -1
- package/dist/extensions/vydra/index.js +5 -5
- package/dist/extensions/vydra/shared.js +1 -1
- package/dist/extensions/vydra/speech-provider.js +1 -1
- package/dist/extensions/vydra/video-generation-provider.js +1 -1
- package/dist/extensions/webhooks/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +3 -3
- package/dist/extensions/webhooks/runtime-api.js +1 -1
- package/dist/extensions/wechat/api.js +3 -3
- package/dist/extensions/xai/api.js +5 -5
- package/dist/extensions/xai/code-execution.js +3 -3
- package/dist/extensions/xai/index.js +9 -9
- package/dist/extensions/xai/model-definitions.js +1 -1
- package/dist/extensions/xai/onboard.js +1 -1
- package/dist/extensions/xai/provider-catalog.js +1 -1
- package/dist/extensions/xai/provider-models.js +1 -1
- package/dist/extensions/xai/setup-api.js +1 -1
- package/dist/extensions/xai/video-generation-provider.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/x-search.js +3 -3
- package/dist/extensions/xiaomi/index.js +1 -1
- package/dist/extensions/zai/index.js +5 -5
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zai/test-api.js +1 -1
- package/dist/extra-params-CEZLNZPM.js +295 -0
- package/dist/format-P9xNDyfD.js +245 -0
- package/dist/fragment-collector-D6OalgG0.js +189 -0
- package/dist/gateway-cli-Bfl1SRvS.js +1532 -0
- package/dist/gateway-install-token-6z725yP4.js +284 -0
- package/dist/gateway-rpc-BIq75xob.js +14 -0
- package/dist/gateway-rpc.runtime-qaUC59kw.js +23 -0
- package/dist/gateway-rpc.runtime.js +1 -1
- package/dist/gemini-cli-provider-DapCuX8Q.js +106 -0
- package/dist/gemini-web-search-provider-qckYFHgT.js +167 -0
- package/dist/get-reply-from-config.runtime-Cxp-IFCe.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/gmail-setup-utils-Cc3pRzTO.js +422 -0
- package/dist/health-3b-YI19K.js +579 -0
- package/dist/health-MLtfjMov.js +2 -0
- package/dist/heartbeat-runner-Bn5_NCaE.js +1365 -0
- package/dist/heartbeat-runner-CLxBx0e9.js +4 -0
- package/dist/heartbeat-runner.runtime-B6RlKYc2.js +2 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/help-ktSd2tag.js +76 -0
- package/dist/hooks-cli-IZb2tmWn.js +364 -0
- package/dist/image-C3lHN8WH.js +152 -0
- package/dist/image-generation-core-Csa-tOLR.js +17 -0
- package/dist/image-generation-core.auth.runtime-DWfzUU3N.js +2 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-Bq81bEDF.js +94 -0
- package/dist/image-generation-provider-D9rV0jKg.js +280 -0
- package/dist/image-generation-provider-DLxx1bzz.js +130 -0
- package/dist/image-generation-provider-DtYtLZ5X.js +136 -0
- package/dist/image-generation-provider-DxkBVWXc.js +163 -0
- package/dist/image-generation-runtime-BSjvNi3e.js +2 -0
- package/dist/image-runtime-DiMm78ho.js +7 -0
- package/dist/inbound-reply-dispatch-CIawaoIo.js +73 -0
- package/dist/inbound.runtime-CRF3jMe0.js +3 -0
- package/dist/inbound.runtime-DTPuWSKr.js +4 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/infra-runtime-D3jjt6RI.js +25 -0
- package/dist/ingest-DZbARiPc.js +2 -0
- package/dist/ingest-gzQEKaUE.js +842 -0
- package/dist/io-NwOu0Lqq.js +7188 -0
- package/dist/io-p7f7Dzgz.js +5 -0
- package/dist/kaijibot-tools-DIght9Qs.js +9434 -0
- package/dist/kaijibot-tools.runtime-CoJzzzuq.js +2 -0
- package/dist/kaijibot-tools.runtime.js +1 -1
- package/dist/kimi-web-search-provider-Ccz-6FOv.js +308 -0
- package/dist/library-BAkHHC7d.js +45 -0
- package/dist/lifecycle-DPisznBr.js +51 -0
- package/dist/lifecycle-core-DHpL48zF.js +422 -0
- package/dist/list.runtime-BivtGTp4.js +12 -0
- package/dist/list.runtime-DGC3Tgsn.js +9 -0
- package/dist/list.runtime.js +1 -1
- package/dist/llm-engine-CJ4a8si7.js +2 -0
- package/dist/llm-engine-JflSw21y.js +1792 -0
- package/dist/llm-extractor-f_T1e84b.js +445 -0
- package/dist/llm-slug-generator.js +2 -2
- package/dist/load-context-BgiRixkE.js +51 -0
- package/dist/logging-BmlPHvHz.js +13 -0
- package/dist/logging-i6p97HMj.js +2 -0
- package/dist/login-BCtkm5rk.js +108 -0
- package/dist/logs-cli-ObIjoAas.js +264 -0
- package/dist/logs-cli.runtime-BFjo2k4n.js +2 -0
- package/dist/logs-cli.runtime.js +1 -1
- package/dist/manager-BKQsr8XG.js +2049 -0
- package/dist/manager-YA9gsC3-.js +3314 -0
- package/dist/mcp/plugin-tools-serve.js +3 -3
- package/dist/mcp-cli-4snhlJll.js +733 -0
- package/dist/mcp-config-BorcRx6O.js +115 -0
- package/dist/media-runtime-C8aW96zz.js +312 -0
- package/dist/media-understanding-provider-3Ttl6hmp.js +18 -0
- package/dist/media-understanding-provider-BGTcMbZI.js +13 -0
- package/dist/media-understanding-provider-BWZtBNix.js +30 -0
- package/dist/media-understanding-provider-CLJBFDyf.js +123 -0
- package/dist/media-understanding-provider-CZ0oRDnO.js +69 -0
- package/dist/media-understanding-provider-CfBvdveE.js +112 -0
- package/dist/media-understanding-provider-D6Ei6zjV.js +18 -0
- package/dist/media-understanding-provider-DEbLZtur.js +37 -0
- package/dist/media-understanding-provider-DysTPulI.js +14 -0
- package/dist/media-understanding-provider-guIrycoj.js +21 -0
- package/dist/media-understanding-provider-sqqt3Zo1.js +67 -0
- package/dist/media-understanding-runtime-CR8E8lqS.js +2 -0
- package/dist/media-understanding-zIdRKTHF.js +83 -0
- package/dist/memory-CEPz51C1.js +242 -0
- package/dist/memory-Dz9LyrwM.js +3 -0
- package/dist/memory-core-host-engine-embeddings-D_hioQXv.js +2 -0
- package/dist/memory-core-host-engine-foundation-1Abnrvzg.js +11 -0
- package/dist/memory-core-host-runtime-cli-CPpWR4jD.js +9 -0
- package/dist/memory-core-host-runtime-core-QOAE1eXJ.js +8 -0
- package/dist/memory-embedding-adapter-CJMHQ4fD.js +33 -0
- package/dist/memory-host-search.runtime-CCL0QyRa.js +2 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-index-BaKGqStn.js +2 -0
- package/dist/memory-index-Dq16t3Le.js +514 -0
- package/dist/memory-runtime-Cr2ycPVC.js +2 -0
- package/dist/memory-runtime-DuWAywa6.js +26 -0
- package/dist/message-B59-6tOr.js +223 -0
- package/dist/message-action-runner-CD2L-ZBQ.js +2 -0
- package/dist/message-action-runner-y-EYEp0n.js +1628 -0
- package/dist/message.config.runtime-NCa2v5Ci.js +3 -0
- package/dist/message.config.runtime.js +1 -1
- package/dist/message.gateway.runtime-Ba2cmeG0.js +2 -0
- package/dist/message.gateway.runtime.js +1 -1
- package/dist/metadata-registry-loader-BAAhCgIz.js +2 -0
- package/dist/metadata-registry-loader-D7YsnsL7.js +15 -0
- package/dist/minimax-vlm-CRQ1qjBy.js +183 -0
- package/dist/minimax-web-search-provider-CBq2_5UU.js +165 -0
- package/dist/mmr-CqmAMXIW.js +146 -0
- package/dist/model-NNxPja4R.js +630 -0
- package/dist/model-auth-BCNvl8s6.js +427 -0
- package/dist/model-auth-label-B0iZbvPM.js +45 -0
- package/dist/model-catalog-CDC0RDIQ.js +204 -0
- package/dist/model-definitions-YQ1lzfH1.js +258 -0
- package/dist/model-discovery-live.runtime-CFR_70lW.js +446 -0
- package/dist/model-discovery-live.runtime.js +1 -1
- package/dist/model-picker-CYGRTUlg.js +500 -0
- package/dist/model-picker-ucRyNr9a.js +3 -0
- package/dist/model-picker.runtime-BLIC1v4k.js +15 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-selection-BNkt6VsY.js +381 -0
- package/dist/model-suppression-BLpblK4C.js +28 -0
- package/dist/model-suppression.runtime-CzgXh3-Q.js +7 -0
- package/dist/model-suppression.runtime.js +1 -1
- package/dist/models-BUxoFu33.js +47 -0
- package/dist/models-Ch34kBry.js +18 -0
- package/dist/models-CxT1_oJh.js +157 -0
- package/dist/models-D4gmkPz-.js +2 -0
- package/dist/models-DUS7kA8D.js +2584 -0
- package/dist/models-DdsCg0Z3.js +18 -0
- package/dist/models-cli-BGRqz0Hw.js +198 -0
- package/dist/models-config-C91hdcPk.js +900 -0
- package/dist/models-config.providers.secrets-CAQfFlJs.js +299 -0
- package/dist/models-jeG3zz29.js +555 -0
- package/dist/models-uX_1Gq3N.js +760 -0
- package/dist/models.fetch-CBAxXkYq.js +518 -0
- package/dist/monitor-BFKCdzLJ.js +4435 -0
- package/dist/monitor-Ddg6EzcR.js +1023 -0
- package/dist/music-generation-provider-CEN-hiuw.js +238 -0
- package/dist/music-generation-provider-D3eEV7AI.js +142 -0
- package/dist/music-generation-provider-azGX0awZ.js +169 -0
- package/dist/node-cli-DiZrvwCr.js +2374 -0
- package/dist/nodes-cli-CHIEN-F1.js +1046 -0
- package/dist/nodes-utils-DsRDUdkI.js +196 -0
- package/dist/notify-DBYcJXxh.js +305 -0
- package/dist/oauth-BH1NzJxX.js +57 -0
- package/dist/oauth-oo4i0YoK.js +152 -0
- package/dist/oauth-token-shared-DQSx2gNJ.js +28 -0
- package/dist/oauth.credentials-Bry_dis_.js +165 -0
- package/dist/oauth.flow-BHm8lbRc.js +122 -0
- package/dist/oauth.settings-BEQZQI_l.js +44 -0
- package/dist/oauth.token-CrxxQ__U.js +43 -0
- package/dist/onboard-7nVuWCbc.js +25 -0
- package/dist/onboard-BR4C6q_p.js +25 -0
- package/dist/onboard-CdxRLmEw2.js +58 -0
- package/dist/onboard-ClstIj39.js +29 -0
- package/dist/onboard-DCvok686.js +25 -0
- package/dist/onboard-DQL7hoUg.js +621 -0
- package/dist/onboard-RcjANnyK.js +312 -0
- package/dist/onboard-custom-fYFKqRC8.js +647 -0
- package/dist/onboard-custom-sjMgP57O.js +2 -0
- package/dist/onboard-helpers-DptwxvqO.js +223 -0
- package/dist/onboard-helpers-hUiLSHkd.js +5 -0
- package/dist/onboard-remote-BLFcjcH2.js +2 -0
- package/dist/onboard-remote-D21HhC2v.js +193 -0
- package/dist/onboard-search-D-BZAp6B.js +324 -0
- package/dist/onboard-skills-B90sl6kA.js +134 -0
- package/dist/onboard-skills-DBZJuUNt.js +2 -0
- package/dist/openai-codex-auth-identity-DJ-yiC5N.js +45 -0
- package/dist/openai-codex-cli-auth-BdZB_Fn0.js +57 -0
- package/dist/openai-codex-provider-D23flY_z.js +299 -0
- package/dist/openai-codex-shared-7LLW54Av.js +6 -0
- package/dist/openai-provider-xmL-RBDi.js +283 -0
- package/dist/openai-transport-stream-M1bujvhd.js +1632 -0
- package/dist/operator-approvals-client-DNHRZj38.js +68 -0
- package/dist/order-DFWeiLxK.js +794 -0
- package/dist/pair-command-approve-B7OK0jeZ.js +34 -0
- package/dist/pairing-cli-WXk-duET.js +118 -0
- package/dist/persistent-bindings.lifecycle-jyYneAcf.js +94 -0
- package/dist/pi-bundle-mcp-tools-CX0SFgbF.js +709 -0
- package/dist/pi-embedded-D-SwWv_N.js +6 -0
- package/dist/pi-embedded-runner-DV6kNYZT.js +8350 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-DAY2Idkx.js +23 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
- package/dist/pi-embedded-vPoHjY1s.js +2 -0
- package/dist/pi-embedded.runtime-B4_BgrLm.js +5 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-model-discovery-eCOzFFEF.js +232 -0
- package/dist/pi-tools.before-tool-call.runtime-DxhFk59d.js +354 -0
- package/dist/pi-tools.before-tool-call.runtime.js +1 -1
- package/dist/plugin-enabled-CHyNN_TN.js +71 -0
- package/dist/plugin-install-config-policy-AxFoCFZw.js +137 -0
- package/dist/plugin-registration-DNzK0hY5.js +23 -0
- package/dist/plugin-registry-CtFzpQUT.js +3 -0
- package/dist/plugin-registry-loader-2DtlC05M.js +22 -0
- package/dist/plugin-registry-rGAVZ04A.js +2 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +3 -3
- package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
- package/dist/plugin-sdk/agent-runtime.js +9 -9
- package/dist/plugin-sdk/approval-client-runtime.js +2 -2
- package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
- package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
- package/dist/plugin-sdk/approval-reply-runtime.js +2 -2
- package/dist/plugin-sdk/approval-runtime.js +4 -4
- package/dist/plugin-sdk/browser-config-runtime.js +2 -2
- package/dist/plugin-sdk/browser-config.js +2 -2
- package/dist/plugin-sdk/browser-control-auth.js +1 -1
- package/dist/plugin-sdk/browser-node-runtime.js +3 -3
- package/dist/plugin-sdk/browser-profiles.js +1 -1
- package/dist/plugin-sdk/browser-setup-tools.js +2 -2
- package/dist/plugin-sdk/browser-support.js +7 -7
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +3 -3
- package/dist/plugin-sdk/command-auth.js +4 -4
- package/dist/plugin-sdk/compat.js +2 -2
- package/dist/plugin-sdk/config-mutation.js +4 -4
- package/dist/plugin-sdk/config-runtime.js +6 -6
- package/dist/plugin-sdk/config-schema.js +1 -1
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +4 -4
- package/dist/plugin-sdk/core.js +3 -3
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/gateway-runtime.js +1 -1
- package/dist/plugin-sdk/generate-text.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +2 -2
- package/dist/plugin-sdk/image-generation-runtime.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/infra-runtime.js +4 -4
- package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +5 -5
- package/dist/plugin-sdk/media-understanding-runtime.js +2 -2
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +3 -3
- package/dist/plugin-sdk/memory-core.js +5 -5
- package/dist/plugin-sdk/memory-host-core.js +3 -3
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/plugin-test-runtime.js +3 -3
- package/dist/plugin-sdk/provider-auth-api-key.js +4 -4
- package/dist/plugin-sdk/provider-auth.js +7 -7
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-setup.js +2 -2
- package/dist/plugin-sdk/provider-stream-family.js +3 -3
- package/dist/plugin-sdk/provider-stream.js +2 -2
- package/dist/plugin-sdk/provider-test-contracts.js +2 -2
- package/dist/plugin-sdk/provider-transport-runtime.js +1 -1
- package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
- package/dist/plugin-sdk/reply-runtime.js +7 -7
- package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/sandbox.js +2 -2
- package/dist/plugin-sdk/self-hosted-provider-setup.js +1 -1
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/simple-completion-runtime.js +1 -1
- package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
- package/dist/plugin-sdk/speech-core.js +1 -1
- package/dist/plugin-sdk/src/cognitive/feedback/collector.d.ts +21 -0
- package/dist/plugin-sdk/src/cognitive/persona/lifecycle.d.ts +3 -6
- package/dist/plugin-sdk/src/cognitive/types.d.ts +14 -0
- package/dist/plugin-sdk/src/config/types.cognitive.d.ts +2 -0
- package/dist/plugin-sdk/src/config/zod-schema.cognitive.d.ts +2 -0
- package/dist/plugin-sdk/src/config/zod-schema.d.ts +1 -0
- package/dist/plugin-sdk/testing.js +5 -5
- package/dist/plugin-sdk/text-runtime.js +2 -2
- package/dist/plugin-sdk/video-generation-core.js +1 -1
- package/dist/plugin-sdk/video-generation-runtime.js +1 -1
- package/dist/plugin-service-ByhemcPW.js +2494 -0
- package/dist/plugins/provider-discovery.runtime.js +1 -1
- package/dist/plugins/provider-runtime.runtime.js +1 -1
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-Bsu-vzeD.js +576 -0
- package/dist/plugins-command-helpers-DHYkcqua.js +117 -0
- package/dist/plugins-install-persist-C8eGd_C5.js +121 -0
- package/dist/plugins-update-command-3xt3Uqf8.js +1009 -0
- package/dist/policy-CFE2PMMh.js +172 -0
- package/dist/preemptive-compaction-DBfSd-op.js +430 -0
- package/dist/proactive-scheduler-CsHZHnLk.js +1535 -0
- package/dist/probe-CWzUPp-f.js +426 -0
- package/dist/probe-QRfkrTQp.js +54 -0
- package/dist/probe-auth-DG3q8vB9.js +69 -0
- package/dist/probe-auth-GBOKLPAd.js +3 -0
- package/dist/profiles-CBddrdQK.js +117 -0
- package/dist/program-NfZ-fQSf.js +111 -0
- package/dist/prompt-overlay-CTwbv1jO.js +72 -0
- package/dist/prompt-select-styled-D7z26jOB.js +5305 -0
- package/dist/provider-B_TyrVqo.js +70 -0
- package/dist/provider-api-key-auth-DsEmjrKm.js +113 -0
- package/dist/provider-api-key-auth.runtime-DnU922Pm.js +14 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-B0NxCABI.js +36 -0
- package/dist/provider-auth-api-key-BRkYGkki.js +5 -0
- package/dist/provider-auth-choice-BU5MwS9n.js +134 -0
- package/dist/provider-auth-choice-preference-BjTvWslj.js +62 -0
- package/dist/provider-auth-choice.runtime-B8ZRr0Ji.js +2 -0
- package/dist/provider-auth-choice.runtime-DIN9GqRk.js +14 -0
- package/dist/provider-auth-choice.runtime.js +1 -1
- package/dist/provider-auth-guidance-BmbcHSR7.js +34 -0
- package/dist/provider-auth-helpers-BHAUl4Gr.js +168 -0
- package/dist/provider-catalog-BL8_CAyj.js +11 -0
- package/dist/provider-catalog-BRtoWqwn.js +11 -0
- package/dist/provider-catalog-BeddZRA_.js +12 -0
- package/dist/provider-catalog-Dl5yMnFQ.js +17 -0
- package/dist/provider-catalog-Doxz6-g3.js +56 -0
- package/dist/provider-catalog-nJImUuqB.js +26 -0
- package/dist/provider-dispatcher-5MWNj1cU.js +22 -0
- package/dist/provider-entry-B01Usrgw.js +97 -0
- package/dist/provider-flow-DgiCMoEf.js +66 -0
- package/dist/provider-models-CjNZS5bS.js +35 -0
- package/dist/provider-models-KjFLrk3V.js +119 -0
- package/dist/provider-models-vPWkBVJC.js +116 -0
- package/dist/provider-registration-BKyn4HAU.js +238 -0
- package/dist/provider-registration-Dtxvk5CC.js +57 -0
- package/dist/provider-runtime-DOtN11v9.js +2 -0
- package/dist/provider-runtime-DSAVX2DR.js +366 -0
- package/dist/provider-runtime.runtime-kKhVhqLz.js +26 -0
- package/dist/provider-runtime.runtime.js +1 -1
- package/dist/provider-self-hosted-setup-l_z2VcmU.js +249 -0
- package/dist/provider-setup-Bf_9tp4f.js +2 -0
- package/dist/provider-stream-BdikYSRa.js +285 -0
- package/dist/provider-stream-family-DSm3KbQw.js +2 -0
- package/dist/provider-usage-BGu0-R4j.js +289 -0
- package/dist/provider-usage-lgVGEKOt.js +3 -0
- package/dist/provider-wizard-BLwU3k7w.js +166 -0
- package/dist/providers.runtime-C0Xkoksw.js +125 -0
- package/dist/providers.runtime.js +1 -1
- package/dist/proxy-stream-wrappers-CIRRoMpa.js +480 -0
- package/dist/push-apns-DN3ZNQab.js +1061 -0
- package/dist/pw-ai-Ld88tf39.js +2268 -0
- package/dist/qmd-manager-kG_qjIil.js +1799 -0
- package/dist/qr-cli-CsNdevN-.js +359 -0
- package/dist/qr-image-ClomasxW.js +2 -0
- package/dist/queue-fniCZ6ND.js +636 -0
- package/dist/realtime-provider-shared-B2y3nIjr.js +21 -0
- package/dist/realtime-transcription-provider-BYeb_Pdh.js +180 -0
- package/dist/realtime-voice-provider-Cs5kAI5o.js +342 -0
- package/dist/record-shared-vbhlkLLm.js +10 -0
- package/dist/refresh-DgMFD0Y0.js +115 -0
- package/dist/region-BOx9--Jp.js +74 -0
- package/dist/register.agent-D_D6OLOs.js +241 -0
- package/dist/register.backup-PaaKiScO.js +234 -0
- package/dist/register.configure-ByfqqSmj.js +15 -0
- package/dist/register.maintenance-DHP5Hi3e.js +443 -0
- package/dist/register.message-DCzLrhHI.js +601 -0
- package/dist/register.onboard-C3XVikL8.js +83 -0
- package/dist/register.runtime-Br9LK2gh.js +81 -0
- package/dist/register.runtime-CgbjcVmK.js +343 -0
- package/dist/register.runtime.js +1 -1
- package/dist/register.setup-DVykiPXv.js +104 -0
- package/dist/register.status-health-sessions-cOzG_7Nf.js +1211 -0
- package/dist/register.subclis-LdyYwzr7.js +232 -0
- package/dist/register.subclis-OWj7LZOR.js +3 -0
- package/dist/repair-DUb-NpH_.js +112 -0
- package/dist/replay-policy-8aUdDKqI.js +8 -0
- package/dist/reply-Xl-LGWx9.js +3523 -0
- package/dist/reply.runtime-DOj7KtNv.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-b0jc4sM3.js +280 -0
- package/dist/restart-CReI1iMn.js +454 -0
- package/dist/root-help-DOYfXVGX.js +44 -0
- package/dist/route-reply-Bsd_X1hM.js +141 -0
- package/dist/route-reply.runtime-0EDNxcfO.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/rpc-C4VoC6lx.js +61 -0
- package/dist/rpc.runtime-CrjwpfEG.js +21 -0
- package/dist/rpc.runtime.js +1 -1
- package/dist/run-main-DK-D5F3f.js +453 -0
- package/dist/run-wait-KirpkWGm.js +118 -0
- package/dist/runner-C9pcnHzR.js +1497 -0
- package/dist/runs-Djzm6zWd.js +495 -0
- package/dist/runtime-6nDEFb75.js +72 -0
- package/dist/runtime-7-RqyV6x.js +107 -0
- package/dist/runtime-Bw9f54EP.js +355 -0
- package/dist/runtime-CAESWN5P.js +725 -0
- package/dist/runtime-CrAHjeUY.js +2 -0
- package/dist/runtime-D2tXO42J2.js +242 -0
- package/dist/runtime-DOWgnTkX.js +191 -0
- package/dist/runtime-DObmMc6X.js +253 -0
- package/dist/runtime-DoFRWRgY.js +9 -0
- package/dist/runtime-api-BpPa5PZ4.js +12 -0
- package/dist/runtime-api-CjjNrjOu2.js +2 -0
- package/dist/runtime-api-D7fKSLcI.js +3 -0
- package/dist/runtime-embedded-pi.runtime-BMPEoO0x.js +3 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-internal-CedDfUad.js +2 -0
- package/dist/runtime-model-auth.runtime-Cgx5HiVv.js +39 -0
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-oxFh0OA-.js +2 -0
- package/dist/runtime-plugins-cyYSAIUC.js +69 -0
- package/dist/runtime-prepare.runtime-C1hoi3Pj.js +80 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-CXi4BTPW.js +21 -0
- package/dist/runtime-r3Ke_KuH.js +200 -0
- package/dist/runtime-registry-loader-471RbKgH.js +2 -0
- package/dist/runtime-registry-loader-Dov85dVR.js +58 -0
- package/dist/runtime-schema-DUetufoV.js +28395 -0
- package/dist/runtime-shared-BGttaPX3.js +249 -0
- package/dist/runtime-taskflow-BBc9FyfD.js +250 -0
- package/dist/runtime-web-channel-plugin-Dyt-ZWxm.js +215 -0
- package/dist/runtime-web-tools-CXeVnAOE.js +1467 -0
- package/dist/runtime-web-tools-fallback.runtime-B5P96RjD.js +9 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/sandbox-B7Mdkad9.js +2586 -0
- package/dist/sandbox-Bkj7NfH_.js +4 -0
- package/dist/sandbox-cli-BMrDh7ip.js +447 -0
- package/dist/secrets-cli-CDO_S3rr.js +2114 -0
- package/dist/security-audit-D4tdLi7R.js +34 -0
- package/dist/security-cli-BtMEiNIM.js +486 -0
- package/dist/semantic-dedup-BGgf2SFR.js +95 -0
- package/dist/send-CxqF8rl4.js +993 -0
- package/dist/send-media-Dcmyu6Y-.js +2123 -0
- package/dist/server-CaXqmTFP.js +13 -0
- package/dist/server-D0ZKpih4.js +77 -0
- package/dist/server-context-BekzVd0R.js +4164 -0
- package/dist/server-methods-BCeJH-Fr.js +11937 -0
- package/dist/server-middleware-FqXPNqqT.js +110 -0
- package/dist/server-node-events-BXJobTDM.js +451 -0
- package/dist/server.impl-CKDBAm1X.js +19766 -0
- package/dist/session-C-0F1BlP.js +48 -0
- package/dist/session-conversation-Ckza03tl.js +27 -0
- package/dist/session-cost-usage-Dnbtqvv7.js +648 -0
- package/dist/session-cost-usage-iTVG22AO.js +2 -0
- package/dist/session-file-CiJXAZP4.js +44 -0
- package/dist/session-key-6G1LpIon.js +65 -0
- package/dist/session-meta-knhthO95.js +109 -0
- package/dist/session-override-CGqy8cfR.js +103 -0
- package/dist/session-reset-model.runtime-DpNzWHUe.js +120 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-6NPnzaso.js +474 -0
- package/dist/session-subagent-reactivation.runtime-BCeway2I.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-system-events-BifSkL6x.js +63 -0
- package/dist/session-tab-registry-DR0gRhet.js +553 -0
- package/dist/session-updates-CHOc_4vH.js +234 -0
- package/dist/session-updates.runtime-DsHKjhyM.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-GLg54NBi.js +930 -0
- package/dist/sessions-BxOkBx-e.js +45 -0
- package/dist/sessions-C6oolVsU.js +231 -0
- package/dist/sessions-D6_b32XT.js +2 -0
- package/dist/sessions.runtime-Bi4et4J1.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-CslW2MtR.js +505 -0
- package/dist/setup-DwqTuGTp.js +329 -0
- package/dist/setup-surface-Ore2Ehcn.js +586 -0
- package/dist/setup.finalize-Wq93dYFU.js +436 -0
- package/dist/setup.gateway-config-DteoOy8F.js +246 -0
- package/dist/shared-CLjMam2L.js +36 -0
- package/dist/shared-DGIkRU6J.js +218 -0
- package/dist/shared-DUnO9yTD.js +175 -0
- package/dist/shared-DeBJWig-.js +137 -0
- package/dist/shared-igYZ1cFQ.js +224 -0
- package/dist/shared-runtime-cWVnVIl5.js +7 -0
- package/dist/short-term-promotion-BhxerFzv.js +1631 -0
- package/dist/simple-completion-runtime-Bv1VtWSA.js +131 -0
- package/dist/simple-completion-transport-CLqa5Iyl.js +32 -0
- package/dist/skill-commands-D02-U6zf.js +82 -0
- package/dist/skill-commands.runtime-J2XiyESs.js +2 -0
- package/dist/skill-commands.runtime.js +1 -1
- package/dist/skills-BI8fjdW_.js +4 -0
- package/dist/skills-C6n71k5r.js +1075 -0
- package/dist/skills-cli-zp3lOjti.js +382 -0
- package/dist/skills-install-DlqA6nec.js +822 -0
- package/dist/skills-status-B57B5p12.js +170 -0
- package/dist/skills-status-DSk7-Gbk.js +2 -0
- package/dist/soul-cli-D_VMWljI.js +110 -0
- package/dist/speech-core-5C9NDTWw.js +126 -0
- package/dist/speech-provider-5npDU3CX.js +103 -0
- package/dist/speech-provider-BQ4WhohP.js +182 -0
- package/dist/speech-provider-BgLqt9Ul.js +184 -0
- package/dist/speech-provider-DAxRZc2f.js +167 -0
- package/dist/stage-sandbox-media.runtime-CFdAVxo8.js +230 -0
- package/dist/stage-sandbox-media.runtime.js +1 -1
- package/dist/standalone-generate-BG6TQ0jK.js +217 -0
- package/dist/standalone-generate-CgZQCsuI.js +2 -0
- package/dist/startup-auth-CKh--SuD.js +151 -0
- package/dist/state-migrations-CN7oRMHd.js +823 -0
- package/dist/status-BAqccuUp.js +278 -0
- package/dist/status-BaSW-xxu.js +2 -0
- package/dist/status-CJpxvQmZ.js +500 -0
- package/dist/status-D-UHaHvI.js +399 -0
- package/dist/status-DggLTQr0.js +3 -0
- package/dist/status-KOZpSuVN.js +2 -0
- package/dist/status-TqK4AoMQ.js +473 -0
- package/dist/status-all-cwk3DGiJ.js +495 -0
- package/dist/status-json-CiuEzsaR.js +14 -0
- package/dist/status-json-command-sAasGH5G.js +92 -0
- package/dist/status-runtime-shared-DTGujn3T.js +271 -0
- package/dist/status.command.text-runtime-CugrZfYj.js +15 -0
- package/dist/status.gateway-connection.runtime-kuu5mcJa.js +2 -0
- package/dist/status.gateway-connection.runtime.js +1 -1
- package/dist/status.gateway-probe-DNRjTzrV.js +16 -0
- package/dist/status.scan-DYlemegM.js +62 -0
- package/dist/status.scan-overview-CUrJYmgc.js +395 -0
- package/dist/status.scan.deps.runtime-CvmH94mX.js +18 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json--vXBXh8v.js +2 -0
- package/dist/status.scan.fast-json-B-pkKP5g.js +128 -0
- package/dist/status.scan.runtime-BRjuY3QE.js +417 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.summary-Bo-OmzfE.js +209 -0
- package/dist/status.summary-Bu3ZM6Co.js +2 -0
- package/dist/store-BCDEVRXR.js +1112 -0
- package/dist/store-C6poa5Og.js +1075 -0
- package/dist/store-DxQRR8Va.js +424 -0
- package/dist/store.runtime-D6t_wvEo.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-CxAFhAae.js +649 -0
- package/dist/stream-wrappers-BALQapyz.js +144 -0
- package/dist/subagent-announce.registry.runtime-CXVmS4_2.js +3 -0
- package/dist/subagent-announce.registry.runtime.js +1 -1
- package/dist/subagent-control-BFaUO5Rg.js +485 -0
- package/dist/subagent-followup.runtime-9Gmh8O_s.js +68 -0
- package/dist/subagent-followup.runtime.js +1 -1
- package/dist/subagent-list-BPsxOWK_.js +168 -0
- package/dist/subagent-orphan-recovery-CaHOkovt.js +214 -0
- package/dist/subagent-registry-Bq6lqR6P.js +2889 -0
- package/dist/subagent-registry-runtime-uCulOUrX.js +2 -0
- package/dist/subagent-registry.runtime-CECbHZpy.js +3 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-spawn-fyzcNnrQ.js +782 -0
- package/dist/subagents-format-DXuyOMu-.js +629 -0
- package/dist/system-cli-_jfrKryu.js +60 -0
- package/dist/targets-DKzJlbu6.js +595 -0
- package/dist/task-executor-DgYvvOLW.js +350 -0
- package/dist/task-owner-access-CMssttgc.js +48 -0
- package/dist/task-registry-control.runtime-BS73ZjL4.js +3 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/task-registry-delivery-runtime-BMfszrF8.js +2 -0
- package/dist/task-registry-delivery-runtime-D_Ocdg0_.js +3 -0
- package/dist/task-registry-mrk7vw-b.js +2346 -0
- package/dist/task-registry.maintenance-Bq3ZMKN3.js +425 -0
- package/dist/task-registry.maintenance-CXSWJocW.js +2 -0
- package/dist/testing-q13vie3Q.js +441 -0
- package/dist/text-report-CUwo5L1k.js +587 -0
- package/dist/text-runtime-B3UrMt6T.js +313 -0
- package/dist/thread-bindings-B0KBAhDo.js +223 -0
- package/dist/tool-auth-shared-BwlRX_zo.js +53 -0
- package/dist/tool-config-shared-CThVi2Zv.js +19 -0
- package/dist/tool-schema-runtime-CiqxCMkH.js +1892 -0
- package/dist/tools-BUzk9uUn.js +110 -0
- package/dist/tools-effective-inventory-BYOAo-n_.js +152 -0
- package/dist/tools.runtime-D6GnPvuW.js +4 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/transcript-kBzFcvfJ.js +233 -0
- package/dist/transcript.runtime-X5nUWG5J.js +2 -0
- package/dist/transcript.runtime.js +1 -1
- package/dist/transport-policy-qrbV7LdB.js +75 -0
- package/dist/tts-BW2-rTjx.js +31 -0
- package/dist/tui-Cnxy7MIi.js +4018 -0
- package/dist/tui-cli-COdAidhT.js +31 -0
- package/dist/update-cli-BtoVpbqh.js +1779 -0
- package/dist/update-runner-BY92EdE9.js +1492 -0
- package/dist/usage-format-CPx6tGPA.js +2 -0
- package/dist/usage-format-CpsXzXcG.js +507 -0
- package/dist/video-generation-provider-BAQ2E65z.js +171 -0
- package/dist/video-generation-provider-CCsVq0-G.js +263 -0
- package/dist/video-generation-provider-CPHXFGar.js +246 -0
- package/dist/video-generation-provider-DRMOwtTj.js +104 -0
- package/dist/video-generation-provider-DohNwNos.js +181 -0
- package/dist/video-generation-provider-DsIqJI0e.js +227 -0
- package/dist/video-generation-provider-Kg01Dy_G.js +233 -0
- package/dist/video-generation-provider-Z-xZjApd.js +240 -0
- package/dist/video-generation-provider-kfoZ8epM.js +64 -0
- package/dist/video-generation-provider-wgwFq2Wr.js +77 -0
- package/dist/web-fetch-providers.runtime-YHUYJGZL.js +33 -0
- package/dist/web-fetch-providers.runtime.js +1 -1
- package/dist/web-search-C0DUuJkz.js +221 -0
- package/dist/web-search-provider-BVISR8ti.js +155 -0
- package/dist/web-search-providers.runtime-BxK0HVx5.js +206 -0
- package/dist/web-search-providers.runtime.js +1 -1
- package/dist/webhooks-cli-CNvp2Osa.js +321 -0
- package/dist/x-search-shared-uvKOvvdl.js +109 -0
- package/dist/zod-schema-CgftpN_n.js +1401 -0
- package/docs/concepts/cognitive-overview.md +27 -12
- package/package.json +2 -1
- package/dist/abort-BA4i4CO6.js +0 -202
- package/dist/abort-cutoff.runtime-140Dy9Z_.js +0 -20
- package/dist/abort.runtime-D2xd_Jxq.js +0 -2
- package/dist/acp-cli-lUerPOt4.js +0 -2171
- package/dist/acp-spawn-CKu5HWZd.js +0 -1024
- package/dist/acp-stateful-target-driver-DNcDMame.js +0 -88
- package/dist/action-agents-bNO5zlxQ.js +0 -67
- package/dist/action-focus-BQH1yzA9.js +0 -124
- package/dist/action-help-Copk6G3d.js +0 -7
- package/dist/action-info-BUV_zoSU.js +0 -58
- package/dist/action-kill-BMDz9l_U.js +0 -33
- package/dist/action-list-CxkulhYF.js +0 -21
- package/dist/action-log-D0K9-YCV.js +0 -30
- package/dist/action-send-B8ggJVwC.js +0 -39
- package/dist/action-spawn-D9kSXA_K.js +0 -46
- package/dist/action-unfocus-bI4VBonB.js +0 -28
- package/dist/agent-CdxQT19_.js +0 -2
- package/dist/agent-command-Bu_cXSEL.js +0 -1479
- package/dist/agent-runner-utils--p6HAP6k.js +0 -202
- package/dist/agent-runner.runtime-BossnlL1.js +0 -2825
- package/dist/agents-DA2-qNUI.js +0 -887
- package/dist/agents-DaKVGj9F.js +0 -5
- package/dist/anthropic-vertex-stream-CrF-fPgb.js +0 -5666
- package/dist/api-BPByI3-X.js +0 -2
- package/dist/api-BRJq6Aya.js +0 -2
- package/dist/api-BpAm-eRQ.js +0 -2
- package/dist/api-BvFPt7b2.js +0 -19
- package/dist/api-CSOm-O9I.js +0 -5
- package/dist/api-ChQfiSmG.js +0 -4
- package/dist/api-CqBQhm6r.js +0 -2
- package/dist/api-D7qSjVDS.js +0 -3
- package/dist/api-DbRoXBTn.js +0 -45
- package/dist/api-_HshnS5J.js +0 -35
- package/dist/apply-G86rau7x.js +0 -493
- package/dist/apply.runtime-BoYc09wu.js +0 -166
- package/dist/apply.runtime-Dmh02lO-.js +0 -2
- package/dist/approval-client-helpers-cyaJyAMz.js +0 -82
- package/dist/approval-gateway-resolver-bdX78er-.js +0 -58
- package/dist/approval-gateway-runtime-CJm68vrp.js +0 -2
- package/dist/approval-handler-runtime-CT08B2_a.js +0 -439
- package/dist/approval-native-runtime-CN4meUkM.js +0 -709
- package/dist/approval-renderers-CnmO8wke.js +0 -64
- package/dist/asr-Cz-FH-3c.js +0 -196
- package/dist/audit-Cbfv4nmn.js +0 -885
- package/dist/audit-extra.async-DQv_s9K0.js +0 -847
- package/dist/audit.deep.runtime-CAPtrWg1.js +0 -2
- package/dist/audit.nondeep.runtime-HUJ6INiD.js +0 -859
- package/dist/audit.runtime-CAKbHyXK.js +0 -7
- package/dist/auth-CRAwpkC_.js +0 -181
- package/dist/auth-choice-Bhps2D29.js +0 -3
- package/dist/auth-choice-kMIs0xTd.js +0 -71
- package/dist/auth-choice-options-Bx_XsiW-.js +0 -104
- package/dist/auth-choice-prompt-B-koxVGL.js +0 -2
- package/dist/auth-choice-prompt-DytHsI5U.js +0 -36
- package/dist/auth-choice-vRXPONqL.js +0 -353
- package/dist/auth-choice.plugin-providers.runtime-BNfpK_sp.js +0 -11
- package/dist/auth-health-BAxUQXZE.js +0 -165
- package/dist/auth-profiles-YXfmeEhu.js +0 -438
- package/dist/auth-profiles.runtime-CNNciZQU.js +0 -7
- package/dist/auto-recall-CsrNcQNa.js +0 -78
- package/dist/backup-create-DuIPhK_s.js +0 -391
- package/dist/banner-Bb9u_-IS.js +0 -2
- package/dist/banner-BkHTsqFt.js +0 -281
- package/dist/binding-routing-C6_mrNEN.js +0 -50
- package/dist/binding-targets-Cq2e7wRT.js +0 -99
- package/dist/bridge-server-Co3awCAM.js +0 -103
- package/dist/browser-config-runtime-BtkKPBMj.js +0 -6
- package/dist/browser-control-auth-Bqu1lakr.js +0 -120
- package/dist/browser-node-runtime-D8xut4fJ.js +0 -12
- package/dist/browser-profiles-gPG14SPk.js +0 -170
- package/dist/browser-runtime-BBkGI01q.js +0 -377
- package/dist/browser-setup-tools-CD_s48fd.js +0 -12
- package/dist/call-CiUZqjsN.js +0 -2
- package/dist/call-k_nZXTJ3.js +0 -495
- package/dist/call.runtime-CZI7yxSF.js +0 -2
- package/dist/capability-cli-CIm_YhHH.js +0 -1357
- package/dist/catalog-provider-Ch4CMHLl.js +0 -40
- package/dist/cdp.helpers-BVl3YwYe.js +0 -372
- package/dist/channel-core-BB7pTANC.js +0 -5
- package/dist/channel-summary-TxoZjGPA.js +0 -139
- package/dist/channel-summary-dKkFDRbe.js +0 -2
- package/dist/channel.runtime-2WY9MkoH.js +0 -399
- package/dist/channels-D66hRVnR.js +0 -1147
- package/dist/channels-cli-0DjAVaKh.js +0 -248
- package/dist/chat-Fv3LkEfF.js +0 -213
- package/dist/chrome-CEE9kYYR.js +0 -1080
- package/dist/chrome.executables-Dp7W-RgV.js +0 -550
- package/dist/cli-BsNkLoFI.js +0 -57
- package/dist/cli-DQH9X5IE.js +0 -2
- package/dist/cli-DW_ou4hw.js +0 -2
- package/dist/cli-DuoVlLKx.js +0 -154
- package/dist/cli-QG03g_im.js +0 -191
- package/dist/cli-auth-seam-BrijKBRQ.js +0 -14
- package/dist/cli-backend-CIs4F7ip.js +0 -66
- package/dist/cli-migration-CVktTGRI.js +0 -127
- package/dist/cli-runner-12iECISR.js +0 -1662
- package/dist/cli-runner.runtime-C5noDuQ-.js +0 -3
- package/dist/cli-runner.runtime-YrAg_h19.js +0 -2
- package/dist/cli-shared-BUW2okV2.js +0 -142
- package/dist/cli.runtime-Bhxt80sB.js +0 -819
- package/dist/client-bootstrap-BWo-ZK_j.js +0 -28
- package/dist/codex-native-web-search-C6s55zGf.js +0 -2
- package/dist/codex-native-web-search-Cxf1u7R-.js +0 -156
- package/dist/collector-CRTTihSY.js +0 -349
- package/dist/collector-tJxrYXuY.js +0 -2
- package/dist/command-auth-Dlrd5CYD.js +0 -75
- package/dist/command-config-resolution-B8pxzh3W.js +0 -2
- package/dist/command-config-resolution-BXSCDJTh.js +0 -23
- package/dist/command-execution-startup-DYXpKpvc.js +0 -269
- package/dist/command-format-JYoGhCek.js +0 -2
- package/dist/command-queue-CmX7XAL1.js +0 -260
- package/dist/command-registry-BF51N12E.js +0 -3
- package/dist/command-registry-BqpfCBbW.js +0 -113
- package/dist/command-secret-gateway-DuuctECr.js +0 -528
- package/dist/commands-acp-DiLJUV45.js +0 -1017
- package/dist/commands-compact.runtime-BOM8PsWH.js +0 -10
- package/dist/commands-core.runtime-CH_aGeT-.js +0 -2
- package/dist/commands-handlers.runtime-Ca6xoeW5.js +0 -3762
- package/dist/commands-models-CRURuXR-.js +0 -306
- package/dist/commands-reset-hooks-D3RzsOIn.js +0 -129
- package/dist/commands-status-Cufj4x2j.js +0 -223
- package/dist/commands-status.runtime-C8Nz4Glk.js +0 -2
- package/dist/commands-subagents-control.runtime-DjhcmoRT.js +0 -3
- package/dist/commands-subagents-control.runtime-s_DYQWfW.js +0 -2
- package/dist/commands.runtime-ChfYOBeV.js +0 -103
- package/dist/comment-shared-DFEZzqhH.js +0 -40
- package/dist/compact-DEsHFhEL.js +0 -11324
- package/dist/compact.runtime-BzLFUSmk.js +0 -7
- package/dist/completion-cli-CiWtzUFQ.js +0 -2
- package/dist/completion-cli-h3zgpXGM.js +0 -468
- package/dist/config-B3cxNRyw.js +0 -8
- package/dist/config-Bd1PtH4x.js +0 -166
- package/dist/config-DuLfQQvE.js +0 -53
- package/dist/config-cli-BiEmyiRa.js +0 -948
- package/dist/config-defaults-Bw9wwyo1.js +0 -163
- package/dist/config-guard-BGGjXg_Y.js +0 -94
- package/dist/config-runtime-Bvdi0W59.js +0 -14
- package/dist/config-validation-BDeuMlc1.js +0 -279
- package/dist/configure-CUSDnrHs.js +0 -2
- package/dist/configure-FDqT3i_9.js +0 -1162
- package/dist/connection-auth-7izNv08V.js +0 -30
- package/dist/context-B2wCjR9D.js +0 -249
- package/dist/context-n8ANhlMJ.js +0 -2
- package/dist/context-writer-COhxMkVz.js +0 -290
- package/dist/control-auth-Csa4b5CR.js +0 -122
- package/dist/control-ui/assets/agents-CYCtph5J.js +0 -767
- package/dist/control-ui/assets/anthropic-B66S-tt5.js +0 -40
- package/dist/control-ui/assets/azure-openai-responses-CRJyPvrW.js +0 -2
- package/dist/control-ui/assets/cron-DPaLQLTR.js +0 -744
- package/dist/control-ui/assets/dialogues-DPJy1B4C.js +0 -83
- package/dist/control-ui/assets/history-CT3DjMa7.js +0 -71
- package/dist/control-ui/assets/index-Ci2oc-eJ.css +0 -1
- package/dist/control-ui/assets/index-Ua-cFlP6.js +0 -2686
- package/dist/control-ui/assets/mistral-DWkPN1WM.js +0 -72
- package/dist/control-ui/assets/openai-codex-responses-CSJ_tbUW.js +0 -8
- package/dist/control-ui/assets/openai-completions-QUhkmdlC.js +0 -6
- package/dist/control-ui/assets/openai-responses-CjthZA3L.js +0 -2
- package/dist/control-ui/assets/openai-responses-shared-tozh4HQx.js +0 -13
- package/dist/conversation-id-d7KXWjzV.js +0 -140
- package/dist/conversation-runtime-D-YmpVS2.js +0 -31
- package/dist/core-8TPCsNB-.js +0 -210
- package/dist/cron-cli-C5ok2iVK.js +0 -637
- package/dist/curator-9KwCnpXG.js +0 -598
- package/dist/curator-t_jLT3Ie.js +0 -2
- package/dist/daemon-cli-Cr_y38yv.js +0 -476
- package/dist/daemon-install-CrhzPiZ-.js +0 -70
- package/dist/delegate-r3VqUt34.js +0 -61
- package/dist/deliver-Cuu36rnv.js +0 -3
- package/dist/deliver-SAyi_F0e.js +0 -782
- package/dist/deliver-runtime-DKv9J6QE.js +0 -2
- package/dist/delivery-outbound.runtime-DDoInTnF.js +0 -6
- package/dist/delivery-queue-CWi3kUit.js +0 -372
- package/dist/delivery-queue-ecSu6ZNL.js +0 -2
- package/dist/deps-BIU2SScd.js +0 -60
- package/dist/devices-cli-BUAuMOOj.js +0 -336
- package/dist/diagnostic-BLwuJXPT.js +0 -311
- package/dist/direct-dm-D_7_vKGq.js +0 -139
- package/dist/directive-handling.fast-lane-C91i_iZm.js +0 -2
- package/dist/directive-handling.fast-lane-F7l0XNwG.js +0 -64
- package/dist/directive-handling.impl-8RAWZiZE.js +0 -659
- package/dist/directive-handling.impl-BxAIWFS-.js +0 -2
- package/dist/directive-handling.parse-B3O0CfXY.js +0 -376
- package/dist/directive-handling.persist-QXt7GHcD.js +0 -139
- package/dist/directive-handling.persist.runtime-CPPm2qYQ.js +0 -2
- package/dist/directive-handling.shared-C5ywsGJd.js +0 -159
- package/dist/directory-cli-D9v1dSPr.js +0 -240
- package/dist/dispatch-DoyBs65s.js +0 -1126
- package/dist/dispatch-acp-Dz8rU6t9.js +0 -969
- package/dist/dispatch-acp-manager.runtime-tPUGDjl3.js +0 -3
- package/dist/dispatch-acp-media.runtime-rwYN3ewY.js +0 -3
- package/dist/dispatch-acp-session.runtime-C9nyGih8.js +0 -2
- package/dist/dispatch-acp.runtime-Co-JFuKU.js +0 -19
- package/dist/dns-cli-BRVJtnve.js +0 -193
- package/dist/docs-cli-DvJd--iI.js +0 -156
- package/dist/doctor-completion-C46W5KI7.js +0 -90
- package/dist/doctor-config-preflight-B_UDrFsE.js +0 -148
- package/dist/doctor-config-preflight-DtvhOeuT.js +0 -2
- package/dist/doctor-state-migrations-Cd3yfnI1.js +0 -2
- package/dist/doctor-state-migrations-D3qorqjy.js +0 -3
- package/dist/drive-C2mxxJx5.js +0 -718
- package/dist/embedding-provider-C5S1sxvR.js +0 -129
- package/dist/embedding-provider-CNDA2uD3.js +0 -26
- package/dist/embedding-provider-CdVS1B85.js +0 -33
- package/dist/engine-CKgZ1obQ.js +0 -82
- package/dist/engine-embeddings-Bt1bTxtw.js +0 -1489
- package/dist/entry-capabilities-DrciJZn1.js +0 -89
- package/dist/env-overrides-DTd6EBBV.js +0 -347
- package/dist/env-overrides.runtime-Dxy8Shg7.js +0 -7
- package/dist/exec-approval-forwarder.runtime-Dpa8Gi_P.js +0 -3
- package/dist/exec-approval-reply-BaUWuhD6.js +0 -292
- package/dist/exec-approvals-cli-BuOJPaPp.js +0 -485
- package/dist/exec-defaults-B5egc-6t.js +0 -1440
- package/dist/extra-params-Bfdm7Piq.js +0 -295
- package/dist/format-KzNAm6y6.js +0 -245
- package/dist/fragment-collector-DEW1fwlc.js +0 -189
- package/dist/gateway-cli-CWHsIpm8.js +0 -1532
- package/dist/gateway-install-token-CcpoWcqs.js +0 -284
- package/dist/gateway-rpc-Do_3fQSm.js +0 -14
- package/dist/gateway-rpc.runtime-C4kzyrJj.js +0 -23
- package/dist/gemini-cli-provider-YULRMcs8.js +0 -106
- package/dist/gemini-web-search-provider-D_QJZMM3.js +0 -167
- package/dist/get-reply-from-config.runtime-BpdriKtr.js +0 -2
- package/dist/gmail-setup-utils-D_e1q-h_.js +0 -422
- package/dist/health-B5YmS_bW.js +0 -2
- package/dist/health-CQ4zXQ-2.js +0 -579
- package/dist/heartbeat-runner--rVDmB2Z.js +0 -1365
- package/dist/heartbeat-runner-CwtXIPI-.js +0 -4
- package/dist/heartbeat-runner.runtime-D_5UeAsX.js +0 -2
- package/dist/help-CAj5xloH.js +0 -76
- package/dist/hooks-cli-BGDBJqzt.js +0 -364
- package/dist/image-DiK7kcmJ.js +0 -152
- package/dist/image-generation-core-Cwutmg_V.js +0 -17
- package/dist/image-generation-core.auth.runtime-DA7XD5V2.js +0 -2
- package/dist/image-generation-provider-B-0SxnvJ.js +0 -280
- package/dist/image-generation-provider-B-UW3NU_.js +0 -94
- package/dist/image-generation-provider-BR1_oIU4.js +0 -130
- package/dist/image-generation-provider-CnGMLnE9.js +0 -163
- package/dist/image-generation-provider-DHvw6TSJ.js +0 -136
- package/dist/image-generation-runtime-DCWf9P6F.js +0 -2
- package/dist/image-runtime-DGNzvqkb.js +0 -7
- package/dist/inbound-reply-dispatch-DgEqNffL.js +0 -73
- package/dist/inbound.runtime-CloYEZJO.js +0 -4
- package/dist/inbound.runtime-DLbKJWOY.js +0 -3
- package/dist/infra-runtime-DE-Vi3Dn.js +0 -25
- package/dist/ingest-DbZJju1a.js +0 -842
- package/dist/ingest-Dyj9M3ZM.js +0 -2
- package/dist/io-Bz-M35LC.js +0 -7184
- package/dist/io-DacBLjh1.js +0 -5
- package/dist/kaijibot-tools-Df_9YJcO.js +0 -9434
- package/dist/kaijibot-tools.runtime-CZId-V1O.js +0 -2
- package/dist/kimi-web-search-provider-DunVVASJ.js +0 -308
- package/dist/library-BqMFzJMy.js +0 -45
- package/dist/lifecycle-core-DD_IXtH-.js +0 -422
- package/dist/lifecycle-lZ5BtT_X.js +0 -57
- package/dist/list.runtime-DU0ctAjd.js +0 -12
- package/dist/list.runtime-DXWlaAJq.js +0 -9
- package/dist/llm-engine-CMR9RxLA.js +0 -1792
- package/dist/llm-engine-VKRjaGY_.js +0 -2
- package/dist/llm-extractor-BCPvoWmb.js +0 -445
- package/dist/load-context-DV3B4twI.js +0 -51
- package/dist/logging-BMNGvpuz.js +0 -13
- package/dist/logging-CN3VAZ70.js +0 -2
- package/dist/login-Dex1JqnY.js +0 -108
- package/dist/logs-cli-BZFJyrsk.js +0 -264
- package/dist/logs-cli.runtime-bBS2Sbi6.js +0 -2
- package/dist/manager-BmS2ofc4.js +0 -2049
- package/dist/manager-CabVEPeE.js +0 -3314
- package/dist/mcp-cli-DGrmbpsu.js +0 -733
- package/dist/mcp-config-CY_3tJVi.js +0 -115
- package/dist/media-runtime-CAa8uHqv.js +0 -312
- package/dist/media-understanding-D_VRj6xY.js +0 -83
- package/dist/media-understanding-provider-B9Jfjq6L.js +0 -13
- package/dist/media-understanding-provider-BWksuEBw.js +0 -30
- package/dist/media-understanding-provider-Bhtq5Kpe.js +0 -14
- package/dist/media-understanding-provider-BzsmDAMk.js +0 -67
- package/dist/media-understanding-provider-C6_6yxvP.js +0 -123
- package/dist/media-understanding-provider-CdRlAb9s.js +0 -18
- package/dist/media-understanding-provider-D5m-2RW8.js +0 -21
- package/dist/media-understanding-provider-PmVmfI6p.js +0 -112
- package/dist/media-understanding-provider-cmLTPd8x.js +0 -18
- package/dist/media-understanding-provider-nPxfFv8l.js +0 -37
- package/dist/media-understanding-provider-yp9gxov6.js +0 -69
- package/dist/media-understanding-runtime-Bu7m-lVs.js +0 -2
- package/dist/memory-5jlpYBqx.js +0 -242
- package/dist/memory-BFKl6oSn.js +0 -3
- package/dist/memory-core-host-engine-embeddings-p06288xV.js +0 -2
- package/dist/memory-core-host-engine-foundation-DHbdNLgZ.js +0 -11
- package/dist/memory-core-host-runtime-cli-BnvAiNzO.js +0 -9
- package/dist/memory-core-host-runtime-core-CnVg69Uw.js +0 -8
- package/dist/memory-embedding-adapter-Cux48Bvk.js +0 -33
- package/dist/memory-host-search.runtime-D6ORyqHq.js +0 -2
- package/dist/memory-index-DSbV_yD0.js +0 -2
- package/dist/memory-index-EFkCRTeh.js +0 -514
- package/dist/memory-runtime-BKqNwQ9X.js +0 -2
- package/dist/memory-runtime-Cn41W0bC.js +0 -26
- package/dist/message-CMCdNyAT.js +0 -223
- package/dist/message-action-runner-CG2CcWaS.js +0 -1628
- package/dist/message-action-runner-DUZQ7nmt.js +0 -2
- package/dist/message.config.runtime-B3ztIjsr.js +0 -3
- package/dist/message.gateway.runtime-COLMRCv4.js +0 -2
- package/dist/metadata-registry-loader-BSyFpHop.js +0 -15
- package/dist/metadata-registry-loader-Ci3mcmNV.js +0 -2
- package/dist/minimax-vlm-D1DbVSjC.js +0 -183
- package/dist/minimax-web-search-provider-BzgvahXM.js +0 -165
- package/dist/mmr-Clamw4uq.js +0 -146
- package/dist/model-CJIbRRp9.js +0 -630
- package/dist/model-auth-BQpkMtoP.js +0 -427
- package/dist/model-auth-label-dLSkL9EI.js +0 -45
- package/dist/model-catalog-DgqowW_L.js +0 -204
- package/dist/model-definitions-BOTIDDWJ.js +0 -258
- package/dist/model-discovery-live.runtime-D2J8zvfK.js +0 -419
- package/dist/model-picker-B4SuA28P.js +0 -3
- package/dist/model-picker-buwrc8kM.js +0 -500
- package/dist/model-picker.runtime-DXgS2Rab.js +0 -15
- package/dist/model-selection-CBuo2hSg.js +0 -381
- package/dist/model-suppression-CthTVW_x.js +0 -28
- package/dist/model-suppression.runtime-R-qnGNBa.js +0 -7
- package/dist/models-B3UnmjRf.js +0 -18
- package/dist/models-BucP8NI1.js +0 -760
- package/dist/models-C3w7hz3K.js +0 -18
- package/dist/models-C4-eAnR7.js +0 -157
- package/dist/models-DMLYOe4h.js +0 -2
- package/dist/models-DNNfkS3j.js +0 -2584
- package/dist/models-DkiHZi9S.js +0 -47
- package/dist/models-OhM18fW_.js +0 -555
- package/dist/models-cli-CfvtZXPd.js +0 -198
- package/dist/models-config-BLMZzgfx.js +0 -900
- package/dist/models-config.providers.secrets-rjdH8T5l.js +0 -299
- package/dist/models.fetch-D1o7sMO8.js +0 -518
- package/dist/monitor-CJdL31iS.js +0 -4435
- package/dist/monitor-DB732mUY.js +0 -1023
- package/dist/music-generation-provider-BrUTQBmG.js +0 -169
- package/dist/music-generation-provider-D6aYWSSm.js +0 -238
- package/dist/music-generation-provider-dpX_Oiuw.js +0 -142
- package/dist/node-cli-BSrC37hh.js +0 -2374
- package/dist/nodes-cli-uwgDIsqv.js +0 -1046
- package/dist/nodes-utils-ChvZvxK1.js +0 -196
- package/dist/notify-C9-q0Rdu.js +0 -305
- package/dist/oauth-CVAbqwnx.js +0 -152
- package/dist/oauth-RbN-L8pg.js +0 -57
- package/dist/oauth-token-shared-CCzflFLG.js +0 -28
- package/dist/oauth.credentials-BeCOUsTe.js +0 -165
- package/dist/oauth.flow-C2PFyq_h.js +0 -122
- package/dist/oauth.settings-CBmYrmAk.js +0 -44
- package/dist/oauth.token-DSow_5Ie.js +0 -43
- package/dist/onboard-B-ZJptUZ.js +0 -25
- package/dist/onboard-Beu-mw_-.js +0 -29
- package/dist/onboard-BzUrcgZ5.js +0 -25
- package/dist/onboard-CPuf8esc.js +0 -25
- package/dist/onboard-CTfex1XR2.js +0 -58
- package/dist/onboard-D-ccZlbM.js +0 -312
- package/dist/onboard-DHXNhsF7.js +0 -621
- package/dist/onboard-custom-9KIp_ybR.js +0 -647
- package/dist/onboard-custom-CbXUFVN6.js +0 -2
- package/dist/onboard-helpers-BFknCN7m.js +0 -223
- package/dist/onboard-helpers-DSJ_xWpL.js +0 -5
- package/dist/onboard-remote-C28pAu4b.js +0 -193
- package/dist/onboard-remote-DQxyE18D.js +0 -2
- package/dist/onboard-search-CPHGVmos.js +0 -324
- package/dist/onboard-skills-B642NK1o.js +0 -2
- package/dist/onboard-skills-CI4B6Kx5.js +0 -134
- package/dist/openai-codex-auth-identity-PqpqYz4a.js +0 -45
- package/dist/openai-codex-cli-auth-cFTkwXjR.js +0 -57
- package/dist/openai-codex-provider-DjUpM_l9.js +0 -299
- package/dist/openai-codex-shared-o0pq7UkS.js +0 -6
- package/dist/openai-provider-ChZN4Q0c.js +0 -283
- package/dist/openai-transport-stream-DXBBlxJ9.js +0 -1632
- package/dist/operator-approvals-client-RJESCyw4.js +0 -68
- package/dist/order-D863tCt-.js +0 -794
- package/dist/pair-command-approve-5Jr6xo-1.js +0 -34
- package/dist/pairing-cli-BF3jieZo.js +0 -118
- package/dist/persistent-bindings.lifecycle-CjXEQUMz.js +0 -94
- package/dist/pi-bundle-mcp-tools-DPVGNVRw.js +0 -709
- package/dist/pi-embedded-Cp3OIZy9.js +0 -2
- package/dist/pi-embedded-DJN2vlNF.js +0 -6
- package/dist/pi-embedded-runner-DXHhhGRS.js +0 -8348
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-D1jUEg-R.js +0 -23
- package/dist/pi-embedded.runtime-DQPfEvkF.js +0 -5
- package/dist/pi-model-discovery-B9q9ykaA.js +0 -232
- package/dist/pi-tools.before-tool-call.runtime-vGvkJ6V9.js +0 -354
- package/dist/plugin-enabled-CMdiRqJS.js +0 -71
- package/dist/plugin-install-config-policy-32D2JJMl.js +0 -137
- package/dist/plugin-registration-BhPJI7wp.js +0 -23
- package/dist/plugin-registry-Bo4RF_Fn.js +0 -2
- package/dist/plugin-registry-C4M8QkVh.js +0 -3
- package/dist/plugin-registry-loader-ZzUapRh3.js +0 -22
- package/dist/plugin-service-31XQtuZr.js +0 -2494
- package/dist/plugins-cli-20A8dYUN.js +0 -576
- package/dist/plugins-command-helpers-C3Qls10N.js +0 -117
- package/dist/plugins-install-persist-DEr-zA4G.js +0 -121
- package/dist/plugins-update-command-D0Iv4BPb.js +0 -1009
- package/dist/policy-BEVsx7jw.js +0 -172
- package/dist/preemptive-compaction-DlRJt7Zq.js +0 -430
- package/dist/proactive-scheduler-B3w5rW0h.js +0 -1444
- package/dist/probe-CCTEVLB2.js +0 -54
- package/dist/probe-DcSW0ngD.js +0 -426
- package/dist/probe-auth-C7DjgU_m.js +0 -69
- package/dist/probe-auth-Cfwc8qaj.js +0 -3
- package/dist/profiles-BYudUysD.js +0 -117
- package/dist/program-E_Dt_QTp.js +0 -111
- package/dist/prompt-overlay-DsEnjhTn.js +0 -72
- package/dist/prompt-select-styled-Dtw90p2J.js +0 -5305
- package/dist/provider-api-key-auth-CerNsquw.js +0 -113
- package/dist/provider-api-key-auth.runtime-B0BpFkRm.js +0 -14
- package/dist/provider-auth-DwgUXcgu.js +0 -36
- package/dist/provider-auth-api-key-BQfXwqgU.js +0 -5
- package/dist/provider-auth-choice-BKxMQwxd.js +0 -134
- package/dist/provider-auth-choice-preference-DeDdHlsY.js +0 -62
- package/dist/provider-auth-choice.runtime-BJxc73Ex.js +0 -2
- package/dist/provider-auth-choice.runtime-DBcrr0Ab.js +0 -14
- package/dist/provider-auth-guidance-Cqo9An-I.js +0 -34
- package/dist/provider-auth-helpers-r9kVb6L3.js +0 -168
- package/dist/provider-catalog-CjNAbR9b.js +0 -12
- package/dist/provider-catalog-CpTP4D3p.js +0 -56
- package/dist/provider-catalog-D1iJW59q.js +0 -11
- package/dist/provider-catalog-Dc48HHhB.js +0 -11
- package/dist/provider-catalog-jKq2UIeG.js +0 -17
- package/dist/provider-catalog-pmlFBXYr.js +0 -26
- package/dist/provider-dispatcher-Dl07uV70.js +0 -22
- package/dist/provider-entry-DkwXZuZY.js +0 -97
- package/dist/provider-flow-CmI4jkWV.js +0 -66
- package/dist/provider-iVtrs6XY.js +0 -70
- package/dist/provider-models-BXMZj2p1.js +0 -119
- package/dist/provider-models-Bq_MZ0xR.js +0 -35
- package/dist/provider-models-CsUYkHTw.js +0 -116
- package/dist/provider-registration-DkqLtXSj.js +0 -57
- package/dist/provider-registration-vrLHkywc.js +0 -238
- package/dist/provider-runtime-C_ebc-4l.js +0 -2
- package/dist/provider-runtime-Czioyn5w.js +0 -366
- package/dist/provider-runtime.runtime-lPuF4lqy.js +0 -26
- package/dist/provider-self-hosted-setup-Bjk91HZ7.js +0 -249
- package/dist/provider-setup-hUbxRciz.js +0 -2
- package/dist/provider-stream-DTbeHqKf.js +0 -285
- package/dist/provider-stream-family-Cz7SHqeS.js +0 -2
- package/dist/provider-usage-4x0im5xP.js +0 -3
- package/dist/provider-usage-CdkW3Bkb.js +0 -289
- package/dist/provider-wizard-BPkIa2bk.js +0 -166
- package/dist/providers.runtime-CawuCJXc.js +0 -125
- package/dist/proxy-stream-wrappers-BcJuaE24.js +0 -480
- package/dist/push-apns-CO3sqbX3.js +0 -1061
- package/dist/pw-ai-DEf5tZLp.js +0 -2268
- package/dist/qmd-manager-CrqmeTuY.js +0 -1799
- package/dist/qr-cli-g_Pkqstu.js +0 -359
- package/dist/qr-image-DcG1bUox.js +0 -2
- package/dist/queue-BveCZpTb.js +0 -636
- package/dist/realtime-provider-shared-BIili3oc.js +0 -21
- package/dist/realtime-transcription-provider-DqEHy_Jr.js +0 -180
- package/dist/realtime-voice-provider-Dau1KlKK.js +0 -342
- package/dist/record-shared-CC55xbFE.js +0 -10
- package/dist/refresh-BXJ80ji4.js +0 -115
- package/dist/region-CPFmncMW.js +0 -74
- package/dist/register.agent-D5el253o.js +0 -241
- package/dist/register.backup-CBhoChp-.js +0 -234
- package/dist/register.configure-DeqUaelp.js +0 -15
- package/dist/register.maintenance-Dv5x9ZE6.js +0 -443
- package/dist/register.message-e2Pbh8A_.js +0 -601
- package/dist/register.onboard-COuTKpAw.js +0 -83
- package/dist/register.runtime-BjOIl4eF.js +0 -81
- package/dist/register.runtime-BzJ6RkQN.js +0 -343
- package/dist/register.setup-DQYY7K4K.js +0 -104
- package/dist/register.status-health-sessions-CXNGQh_O.js +0 -1211
- package/dist/register.subclis-B6uy_ogx.js +0 -232
- package/dist/register.subclis-Cmdrfiej.js +0 -3
- package/dist/repair-C8v1vNU-.js +0 -112
- package/dist/replay-policy-C6igC4nS.js +0 -8
- package/dist/reply-Bd8ShNWW.js +0 -3523
- package/dist/reply.runtime-ByKwE5dg.js +0 -2
- package/dist/resolve-CSTOvc_c.js +0 -280
- package/dist/restart-C0QhPXk1.js +0 -454
- package/dist/root-help-D2vz4lbV.js +0 -44
- package/dist/route-reply-CXZFXlfK.js +0 -141
- package/dist/route-reply.runtime-BK8V9NEg.js +0 -2
- package/dist/rpc-f0OkPaI1.js +0 -61
- package/dist/rpc.runtime-BQ78T_pB.js +0 -21
- package/dist/run-main-CkwrrhfI.js +0 -453
- package/dist/run-wait-B4pXPLkF.js +0 -118
- package/dist/runner-BSA9M_M9.js +0 -1497
- package/dist/runs-CEDW87Fd.js +0 -495
- package/dist/runtime-C18YgW822.js +0 -242
- package/dist/runtime-C3OJQ1Xd.js +0 -200
- package/dist/runtime-CDNVtwVk.js +0 -72
- package/dist/runtime-CMNHfJtF.js +0 -725
- package/dist/runtime-C_o_otMV.js +0 -355
- package/dist/runtime-CiJWy5Ce.js +0 -9
- package/dist/runtime-D8bLKXLh.js +0 -253
- package/dist/runtime-DM4z9RVx.js +0 -2
- package/dist/runtime-Di50Fr1z.js +0 -191
- package/dist/runtime-W3qG5LHM.js +0 -2
- package/dist/runtime-api-Bx7nlc4w.js +0 -12
- package/dist/runtime-api-DCNC_FTy2.js +0 -2
- package/dist/runtime-api-_Z8MjR0l.js +0 -3
- package/dist/runtime-embedded-pi.runtime-Cv0MW9ps.js +0 -3
- package/dist/runtime-internal-DclGtT-e.js +0 -2
- package/dist/runtime-model-auth.runtime-Bjl23_fr.js +0 -39
- package/dist/runtime-oEwr_zQb.js +0 -107
- package/dist/runtime-plugins-CwWhqXLJ.js +0 -69
- package/dist/runtime-prepare.runtime-Bi-YD5R-.js +0 -80
- package/dist/runtime-provider-CSEDbSxr.js +0 -21
- package/dist/runtime-registry-loader-CbbaZCXY.js +0 -58
- package/dist/runtime-registry-loader-kqiMFCUa.js +0 -2
- package/dist/runtime-schema-CDuvvU7B.js +0 -28383
- package/dist/runtime-shared-BxJFDFe6.js +0 -249
- package/dist/runtime-taskflow-RwpXng2l.js +0 -250
- package/dist/runtime-web-channel-plugin-Bw74Ar_q.js +0 -215
- package/dist/runtime-web-tools-CEaAGeYr.js +0 -1467
- package/dist/runtime-web-tools-fallback.runtime-DU8Hp_QZ.js +0 -9
- package/dist/sandbox-BC2XUWcW.js +0 -4
- package/dist/sandbox-cli-ain0MYTB.js +0 -447
- package/dist/sandbox-epLgxWBQ.js +0 -2586
- package/dist/secrets-cli-iLwRZbRt.js +0 -2114
- package/dist/security-audit-DfrokBuq.js +0 -34
- package/dist/security-cli-BqsMM550.js +0 -486
- package/dist/semantic-dedup-BBpIPaSV.js +0 -95
- package/dist/send-C5LHdZqP.js +0 -993
- package/dist/send-media-Df0E2Z_m.js +0 -2123
- package/dist/server-2CD2yd73.js +0 -13
- package/dist/server-B44RMlVT.js +0 -77
- package/dist/server-context-SulhWpXY.js +0 -4164
- package/dist/server-methods-BPzzX5VC.js +0 -11937
- package/dist/server-middleware-WQzQIrD4.js +0 -110
- package/dist/server-node-events-Ug_Atc7G.js +0 -451
- package/dist/server.impl-InfVdwPj.js +0 -19765
- package/dist/session-B5RmIL21.js +0 -48
- package/dist/session-conversation-CFty7VTc.js +0 -27
- package/dist/session-cost-usage-CckjvorH.js +0 -2
- package/dist/session-cost-usage-DMRjhi4B.js +0 -648
- package/dist/session-file-DGJqy_ea.js +0 -44
- package/dist/session-key-D-jBcxEp.js +0 -65
- package/dist/session-meta-BijZlLS3.js +0 -109
- package/dist/session-override-1YQHEAlz.js +0 -103
- package/dist/session-reset-model.runtime-CEWrfXLr.js +0 -120
- package/dist/session-reset-service-Dphtb16d.js +0 -474
- package/dist/session-subagent-reactivation.runtime-CF4aqSpn.js +0 -2
- package/dist/session-system-events-BSVIh760.js +0 -63
- package/dist/session-tab-registry-DG9SGi0I.js +0 -553
- package/dist/session-updates-BRFvmIoC.js +0 -234
- package/dist/session-updates.runtime-CiHARWGr.js +0 -2
- package/dist/session-utils-Cai4P9ih.js +0 -930
- package/dist/sessions-BTcXDmCA.js +0 -2
- package/dist/sessions-CyYVTseV.js +0 -45
- package/dist/sessions-Fb0ep3uj.js +0 -231
- package/dist/sessions.runtime-BGyynSR4.js +0 -2
- package/dist/setup-CjEjg8Ci.js +0 -505
- package/dist/setup-D-ypxGnK.js +0 -329
- package/dist/setup-surface-QaubzT60.js +0 -586
- package/dist/setup.finalize-B3MWkUF9.js +0 -436
- package/dist/setup.gateway-config-BdK0tA_r.js +0 -246
- package/dist/shared-0JcWj8-R.js +0 -224
- package/dist/shared-BOd3OCF0.js +0 -36
- package/dist/shared-DICWV0-6.js +0 -218
- package/dist/shared-DiGX-JK8.js +0 -137
- package/dist/shared-DktX3NHd.js +0 -175
- package/dist/shared-runtime-BltNIfGY.js +0 -7
- package/dist/short-term-promotion-CT1zdD1r.js +0 -1631
- package/dist/simple-completion-runtime-CZyp8rJ3.js +0 -131
- package/dist/simple-completion-transport-BWyoXghG.js +0 -32
- package/dist/skill-commands-BC_2IdwF.js +0 -82
- package/dist/skill-commands.runtime-BP6BnOeq.js +0 -2
- package/dist/skills-BQX1AsbM.js +0 -4
- package/dist/skills-D7XPR8N-.js +0 -1075
- package/dist/skills-cli-CxmgxC7X.js +0 -382
- package/dist/skills-install-CHUWYiLs.js +0 -822
- package/dist/skills-status-DRTnP8E3.js +0 -170
- package/dist/skills-status-v28wm8HD.js +0 -2
- package/dist/soul-cli-B1-3BHbA.js +0 -110
- package/dist/speech-core-aXx4I3sB.js +0 -126
- package/dist/speech-provider-BTBQ5VOv.js +0 -103
- package/dist/speech-provider-BciszvJf.js +0 -184
- package/dist/speech-provider-BoQDEC_Y.js +0 -167
- package/dist/speech-provider-C-wTEx8k.js +0 -182
- package/dist/stage-sandbox-media.runtime-DhlTQjXA.js +0 -230
- package/dist/standalone-generate-BRvNW_O7.js +0 -2
- package/dist/standalone-generate-CDfZss4x.js +0 -217
- package/dist/startup-auth-B5V0AaIU.js +0 -151
- package/dist/state-migrations-BNib6l8O.js +0 -823
- package/dist/status-8clcfnN0.js +0 -473
- package/dist/status-C9YBVOov.js +0 -278
- package/dist/status-CNcOKUs2.js +0 -500
- package/dist/status-D1l9Tu3s.js +0 -399
- package/dist/status-DKth_wbp.js +0 -2
- package/dist/status-P3bvFirO.js +0 -3
- package/dist/status-TmH9qSMG.js +0 -2
- package/dist/status-all-BeyVXDNT.js +0 -495
- package/dist/status-json-Cj42CVZZ.js +0 -14
- package/dist/status-json-command-DWk5RiyN.js +0 -92
- package/dist/status-runtime-shared-orzti3tZ.js +0 -271
- package/dist/status.command.text-runtime-B-tNLc3T.js +0 -15
- package/dist/status.gateway-connection.runtime-BrkaJ2f5.js +0 -2
- package/dist/status.gateway-probe-BwuiZk1h.js +0 -16
- package/dist/status.scan-DegSjLE2.js +0 -62
- package/dist/status.scan-overview-CrSELCru.js +0 -395
- package/dist/status.scan.deps.runtime-DrUvBz4e.js +0 -18
- package/dist/status.scan.fast-json-Bm5lN6IK.js +0 -2
- package/dist/status.scan.fast-json-Ch2Zw813.js +0 -128
- package/dist/status.scan.runtime-D-LvzBYN.js +0 -417
- package/dist/status.summary-OB-43Bvk.js +0 -2
- package/dist/status.summary-gJukahkb.js +0 -209
- package/dist/store-D5JODeba.js +0 -421
- package/dist/store-D_vXZ7m9.js +0 -1112
- package/dist/store-yc7MvXdd.js +0 -1075
- package/dist/store.runtime-6eaZtPq6.js +0 -2
- package/dist/stream-BgcqyefI.js +0 -649
- package/dist/stream-wrappers-B7-5gN0i.js +0 -144
- package/dist/subagent-announce.registry.runtime-R2bop0gW.js +0 -3
- package/dist/subagent-control-UyMtkJwo.js +0 -485
- package/dist/subagent-followup.runtime-bTK0TymS.js +0 -68
- package/dist/subagent-list-c0JKZR0g.js +0 -168
- package/dist/subagent-orphan-recovery-CSEzwva5.js +0 -214
- package/dist/subagent-registry-Be219RP1.js +0 -2889
- package/dist/subagent-registry-runtime-Dk57Y91p.js +0 -2
- package/dist/subagent-registry.runtime-D6h_BK2i.js +0 -3
- package/dist/subagent-spawn-BeyYZuFf.js +0 -782
- package/dist/subagents-format-ZcZBg1Vh.js +0 -629
- package/dist/system-cli-_3czEwa7.js +0 -60
- package/dist/targets-CXrDP8_l.js +0 -595
- package/dist/task-executor-DNUNtRg8.js +0 -350
- package/dist/task-owner-access--E5Vkg9U.js +0 -48
- package/dist/task-registry-COE-B6MO.js +0 -2346
- package/dist/task-registry-control.runtime-BzsTfRw1.js +0 -3
- package/dist/task-registry-delivery-runtime-Cv6xz8KP.js +0 -2
- package/dist/task-registry-delivery-runtime-DSfcd2LA.js +0 -3
- package/dist/task-registry.maintenance-Bhd9abl9.js +0 -2
- package/dist/task-registry.maintenance-W3lTkY0l.js +0 -425
- package/dist/testing-CQ_-oCQB.js +0 -441
- package/dist/text-report-BgqWDKJR.js +0 -587
- package/dist/text-runtime-asv4kIxS.js +0 -313
- package/dist/thread-bindings-BCRWofo_.js +0 -223
- package/dist/tool-auth-shared-BWZwTobX.js +0 -53
- package/dist/tool-config-shared-BleK697I.js +0 -19
- package/dist/tool-schema-runtime-DZsW_KR4.js +0 -1892
- package/dist/tools-C7lv9rSD.js +0 -110
- package/dist/tools-effective-inventory-SB9JwX-y.js +0 -152
- package/dist/tools.runtime-J5rhfXQp.js +0 -4
- package/dist/transcript-DxWx6dVc.js +0 -233
- package/dist/transcript.runtime-CmBnobSv.js +0 -2
- package/dist/transport-policy-BGfaKNz0.js +0 -75
- package/dist/tts-C1GyTLOi.js +0 -31
- package/dist/tui-Cqdp1x16.js +0 -4018
- package/dist/tui-cli-BC4O3H6r.js +0 -31
- package/dist/update-cli-BzaCTuax.js +0 -1779
- package/dist/update-runner-Cvxezvhf.js +0 -1492
- package/dist/usage-format-DQTT4pqY.js +0 -507
- package/dist/usage-format-sR4xu0xw.js +0 -2
- package/dist/video-generation-provider-7YR4_ldd.js +0 -171
- package/dist/video-generation-provider-AlAZkYIW.js +0 -181
- package/dist/video-generation-provider-BEqi4pUJ.js +0 -104
- package/dist/video-generation-provider-CraaZaR7.js +0 -77
- package/dist/video-generation-provider-CuvO2Hzh.js +0 -246
- package/dist/video-generation-provider-D-t16ACe.js +0 -240
- package/dist/video-generation-provider-DeowxvLt.js +0 -233
- package/dist/video-generation-provider-HbOZ3qzI.js +0 -227
- package/dist/video-generation-provider-_apx1yFE.js +0 -263
- package/dist/video-generation-provider-bvpb6cdV.js +0 -64
- package/dist/web-fetch-providers.runtime-m66rypbB.js +0 -33
- package/dist/web-search-DSDz1iyf.js +0 -221
- package/dist/web-search-provider-DnYRRBVM.js +0 -155
- package/dist/web-search-providers.runtime-Cv56XIGr.js +0 -206
- package/dist/webhooks-cli-DQ_JTSNA.js +0 -321
- package/dist/x-search-shared-DKPdPR5_.js +0 -109
- package/dist/zod-schema-B7jQiHXQ.js +0 -1400
|
@@ -1,2346 +0,0 @@
|
|
|
1
|
-
import { s as normalizeOptionalString } from "./string-coerce-xZwG7Dq8.js";
|
|
2
|
-
import { _ as resolveStateDir } from "./paths-VemGA5Ob.js";
|
|
3
|
-
import { r as formatErrorMessage } from "./errors-Ez4cKI2Y.js";
|
|
4
|
-
import { r as isDeliverableMessageChannel } from "./message-channel-DOJZxe6w.js";
|
|
5
|
-
import { t as createSubsystemLogger } from "./subsystem-BikUf0BS.js";
|
|
6
|
-
import { t as installProcessWarningFilter } from "./warning-filter-xGZ8S22z.js";
|
|
7
|
-
import { s as parseAgentSessionKey } from "./session-key-utils-DEfwsZM6.js";
|
|
8
|
-
import { a as normalizeDeliveryContext } from "./delivery-context-CVz9fgJB.js";
|
|
9
|
-
import { n as requestHeartbeatNow } from "./heartbeat-wake-DL3yhijT.js";
|
|
10
|
-
import { i as enqueueSystemEvent } from "./system-events-Yd4M0_kC.js";
|
|
11
|
-
import { l as onAgentEvent } from "./agent-events-DScaTZPE.js";
|
|
12
|
-
import { a as sanitizeTaskStatusText, i as formatTaskStatusTitleText } from "./task-status-DDGIH7lj.js";
|
|
13
|
-
import { createRequire } from "node:module";
|
|
14
|
-
import { chmodSync, existsSync, mkdirSync } from "node:fs";
|
|
15
|
-
import os from "node:os";
|
|
16
|
-
import path from "node:path";
|
|
17
|
-
import crypto from "node:crypto";
|
|
18
|
-
//#region src/tasks/task-executor-policy.ts
|
|
19
|
-
function isTerminalTaskStatus(status) {
|
|
20
|
-
return status === "succeeded" || status === "failed" || status === "timed_out" || status === "cancelled" || status === "lost";
|
|
21
|
-
}
|
|
22
|
-
function resolveTaskDisplayTitle(task) {
|
|
23
|
-
return formatTaskStatusTitleText(task.label?.trim() || (task.runtime === "acp" ? "ACP background task" : task.runtime === "subagent" ? "Subagent task" : task.task.trim() || "Background task"));
|
|
24
|
-
}
|
|
25
|
-
function resolveTaskRunLabel(task) {
|
|
26
|
-
return task.runId ? ` (run ${task.runId.slice(0, 8)})` : "";
|
|
27
|
-
}
|
|
28
|
-
function formatTaskTerminalMessage(task) {
|
|
29
|
-
const title = resolveTaskDisplayTitle(task);
|
|
30
|
-
const runLabel = resolveTaskRunLabel(task);
|
|
31
|
-
const summary = sanitizeTaskStatusText(task.terminalSummary, { errorContext: task.status !== "succeeded" || task.terminalOutcome === "blocked" });
|
|
32
|
-
if (task.status === "succeeded") {
|
|
33
|
-
if (task.terminalOutcome === "blocked") return summary ? `Background task blocked: ${title}${runLabel}. ${summary}` : `Background task blocked: ${title}${runLabel}.`;
|
|
34
|
-
return summary ? `Background task done: ${title}${runLabel}. ${summary}` : `Background task done: ${title}${runLabel}.`;
|
|
35
|
-
}
|
|
36
|
-
if (task.status === "timed_out") return `Background task timed out: ${title}${runLabel}.`;
|
|
37
|
-
if (task.status === "lost") {
|
|
38
|
-
const error = sanitizeTaskStatusText(task.error, { errorContext: true });
|
|
39
|
-
const fallbackSummary = sanitizeTaskStatusText(task.terminalSummary, { errorContext: true });
|
|
40
|
-
return `Background task lost: ${title}${runLabel}. ${error || fallbackSummary || "Backing session disappeared."}`;
|
|
41
|
-
}
|
|
42
|
-
if (task.status === "cancelled") return `Background task cancelled: ${title}${runLabel}.`;
|
|
43
|
-
const error = sanitizeTaskStatusText(task.error, { errorContext: true });
|
|
44
|
-
const fallbackSummary = sanitizeTaskStatusText(task.terminalSummary, { errorContext: true });
|
|
45
|
-
return error ? `Background task failed: ${title}${runLabel}. ${error}` : fallbackSummary ? `Background task failed: ${title}${runLabel}. ${fallbackSummary}` : `Background task failed: ${title}${runLabel}.`;
|
|
46
|
-
}
|
|
47
|
-
function formatTaskBlockedFollowupMessage(task) {
|
|
48
|
-
if (task.status !== "succeeded" || task.terminalOutcome !== "blocked") return null;
|
|
49
|
-
return `Task needs follow-up: ${resolveTaskDisplayTitle(task)}${resolveTaskRunLabel(task)}. ${sanitizeTaskStatusText(task.terminalSummary, { errorContext: true }) || "Task is blocked and needs follow-up."}`;
|
|
50
|
-
}
|
|
51
|
-
function formatTaskStateChangeMessage(task, event) {
|
|
52
|
-
const title = resolveTaskDisplayTitle(task);
|
|
53
|
-
if (event.kind === "running") return `Background task started: ${title}.`;
|
|
54
|
-
if (event.kind === "progress") {
|
|
55
|
-
const summary = sanitizeTaskStatusText(event.summary);
|
|
56
|
-
return summary ? `Background task update: ${title}. ${summary}` : null;
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
function shouldAutoDeliverTaskTerminalUpdate(task) {
|
|
61
|
-
if (task.notifyPolicy === "silent") return false;
|
|
62
|
-
if (task.runtime === "subagent" && task.status !== "cancelled") return false;
|
|
63
|
-
if (!isTerminalTaskStatus(task.status)) return false;
|
|
64
|
-
return task.deliveryStatus === "pending";
|
|
65
|
-
}
|
|
66
|
-
function shouldAutoDeliverTaskStateChange(task) {
|
|
67
|
-
return task.notifyPolicy === "state_changes" && task.deliveryStatus === "pending" && !isTerminalTaskStatus(task.status);
|
|
68
|
-
}
|
|
69
|
-
function shouldSuppressDuplicateTerminalDelivery(params) {
|
|
70
|
-
if (params.task.runtime !== "acp" || !params.task.runId?.trim()) return false;
|
|
71
|
-
return Boolean(params.preferredTaskId && params.preferredTaskId !== params.task.taskId);
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/infra/node-sqlite.ts
|
|
75
|
-
const require = createRequire(import.meta.url);
|
|
76
|
-
function requireNodeSqlite() {
|
|
77
|
-
installProcessWarningFilter();
|
|
78
|
-
try {
|
|
79
|
-
return require("node:sqlite");
|
|
80
|
-
} catch (err) {
|
|
81
|
-
const message = formatErrorMessage(err);
|
|
82
|
-
throw new Error(`SQLite support is unavailable in this Node runtime (missing node:sqlite). ${message}`, { cause: err });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/tasks/task-registry.paths.ts
|
|
87
|
-
function resolveTaskStateDir(env = process.env) {
|
|
88
|
-
if (env.KAIJIBOT_STATE_DIR?.trim()) return resolveStateDir(env);
|
|
89
|
-
if (env.VITEST || env.NODE_ENV === "test") return path.join(os.tmpdir(), "kaijibot-test-state", String(process.pid));
|
|
90
|
-
return resolveStateDir(env);
|
|
91
|
-
}
|
|
92
|
-
function resolveTaskRegistryDir(env = process.env) {
|
|
93
|
-
return path.join(resolveTaskStateDir(env), "tasks");
|
|
94
|
-
}
|
|
95
|
-
function resolveTaskRegistrySqlitePath(env = process.env) {
|
|
96
|
-
return path.join(resolveTaskRegistryDir(env), "runs.sqlite");
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/tasks/task-flow-registry.paths.ts
|
|
100
|
-
function resolveTaskFlowRegistryDir(env = process.env) {
|
|
101
|
-
return path.join(resolveTaskStateDir(env), "flows");
|
|
102
|
-
}
|
|
103
|
-
function resolveTaskFlowRegistrySqlitePath(env = process.env) {
|
|
104
|
-
return path.join(resolveTaskFlowRegistryDir(env), "registry.sqlite");
|
|
105
|
-
}
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region src/tasks/task-flow-registry.store.sqlite.ts
|
|
108
|
-
let cachedDatabase$1 = null;
|
|
109
|
-
const FLOW_REGISTRY_DIR_MODE = 448;
|
|
110
|
-
const FLOW_REGISTRY_FILE_MODE = 384;
|
|
111
|
-
const FLOW_REGISTRY_SIDECAR_SUFFIXES = [
|
|
112
|
-
"",
|
|
113
|
-
"-shm",
|
|
114
|
-
"-wal"
|
|
115
|
-
];
|
|
116
|
-
function normalizeNumber$1(value) {
|
|
117
|
-
if (typeof value === "bigint") return Number(value);
|
|
118
|
-
return typeof value === "number" ? value : void 0;
|
|
119
|
-
}
|
|
120
|
-
function serializeJson$1(value) {
|
|
121
|
-
return value === void 0 ? null : JSON.stringify(value);
|
|
122
|
-
}
|
|
123
|
-
function parseJsonValue$1(raw) {
|
|
124
|
-
if (!raw?.trim()) return;
|
|
125
|
-
try {
|
|
126
|
-
return JSON.parse(raw);
|
|
127
|
-
} catch {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function rowToSyncMode(row) {
|
|
132
|
-
if (row.sync_mode === "task_mirrored" || row.sync_mode === "managed") return row.sync_mode;
|
|
133
|
-
return row.shape === "single_task" ? "task_mirrored" : "managed";
|
|
134
|
-
}
|
|
135
|
-
function rowToFlowRecord(row) {
|
|
136
|
-
const endedAt = normalizeNumber$1(row.ended_at);
|
|
137
|
-
const cancelRequestedAt = normalizeNumber$1(row.cancel_requested_at);
|
|
138
|
-
const requesterOrigin = parseJsonValue$1(row.requester_origin_json);
|
|
139
|
-
const stateJson = parseJsonValue$1(row.state_json);
|
|
140
|
-
const waitJson = parseJsonValue$1(row.wait_json);
|
|
141
|
-
return {
|
|
142
|
-
flowId: row.flow_id,
|
|
143
|
-
syncMode: rowToSyncMode(row),
|
|
144
|
-
ownerKey: row.owner_key,
|
|
145
|
-
...requesterOrigin ? { requesterOrigin } : {},
|
|
146
|
-
...row.controller_id ? { controllerId: row.controller_id } : {},
|
|
147
|
-
revision: normalizeNumber$1(row.revision) ?? 0,
|
|
148
|
-
status: row.status,
|
|
149
|
-
notifyPolicy: row.notify_policy,
|
|
150
|
-
goal: row.goal,
|
|
151
|
-
...row.current_step ? { currentStep: row.current_step } : {},
|
|
152
|
-
...row.blocked_task_id ? { blockedTaskId: row.blocked_task_id } : {},
|
|
153
|
-
...row.blocked_summary ? { blockedSummary: row.blocked_summary } : {},
|
|
154
|
-
...stateJson !== void 0 ? { stateJson } : {},
|
|
155
|
-
...waitJson !== void 0 ? { waitJson } : {},
|
|
156
|
-
...cancelRequestedAt != null ? { cancelRequestedAt } : {},
|
|
157
|
-
createdAt: normalizeNumber$1(row.created_at) ?? 0,
|
|
158
|
-
updatedAt: normalizeNumber$1(row.updated_at) ?? 0,
|
|
159
|
-
...endedAt != null ? { endedAt } : {}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function bindFlowRecord(record) {
|
|
163
|
-
return {
|
|
164
|
-
flow_id: record.flowId,
|
|
165
|
-
sync_mode: record.syncMode,
|
|
166
|
-
owner_key: record.ownerKey,
|
|
167
|
-
requester_origin_json: serializeJson$1(record.requesterOrigin),
|
|
168
|
-
controller_id: record.controllerId ?? null,
|
|
169
|
-
revision: record.revision,
|
|
170
|
-
status: record.status,
|
|
171
|
-
notify_policy: record.notifyPolicy,
|
|
172
|
-
goal: record.goal,
|
|
173
|
-
current_step: record.currentStep ?? null,
|
|
174
|
-
blocked_task_id: record.blockedTaskId ?? null,
|
|
175
|
-
blocked_summary: record.blockedSummary ?? null,
|
|
176
|
-
state_json: serializeJson$1(record.stateJson),
|
|
177
|
-
wait_json: serializeJson$1(record.waitJson),
|
|
178
|
-
cancel_requested_at: record.cancelRequestedAt ?? null,
|
|
179
|
-
created_at: record.createdAt,
|
|
180
|
-
updated_at: record.updatedAt,
|
|
181
|
-
ended_at: record.endedAt ?? null
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function createStatements$1(db) {
|
|
185
|
-
return {
|
|
186
|
-
selectAll: db.prepare(`
|
|
187
|
-
SELECT
|
|
188
|
-
flow_id,
|
|
189
|
-
sync_mode,
|
|
190
|
-
shape,
|
|
191
|
-
owner_key,
|
|
192
|
-
requester_origin_json,
|
|
193
|
-
controller_id,
|
|
194
|
-
revision,
|
|
195
|
-
status,
|
|
196
|
-
notify_policy,
|
|
197
|
-
goal,
|
|
198
|
-
current_step,
|
|
199
|
-
blocked_task_id,
|
|
200
|
-
blocked_summary,
|
|
201
|
-
state_json,
|
|
202
|
-
wait_json,
|
|
203
|
-
cancel_requested_at,
|
|
204
|
-
created_at,
|
|
205
|
-
updated_at,
|
|
206
|
-
ended_at
|
|
207
|
-
FROM flow_runs
|
|
208
|
-
ORDER BY created_at ASC, flow_id ASC
|
|
209
|
-
`),
|
|
210
|
-
upsertRow: db.prepare(`
|
|
211
|
-
INSERT INTO flow_runs (
|
|
212
|
-
flow_id,
|
|
213
|
-
sync_mode,
|
|
214
|
-
owner_key,
|
|
215
|
-
requester_origin_json,
|
|
216
|
-
controller_id,
|
|
217
|
-
revision,
|
|
218
|
-
status,
|
|
219
|
-
notify_policy,
|
|
220
|
-
goal,
|
|
221
|
-
current_step,
|
|
222
|
-
blocked_task_id,
|
|
223
|
-
blocked_summary,
|
|
224
|
-
state_json,
|
|
225
|
-
wait_json,
|
|
226
|
-
cancel_requested_at,
|
|
227
|
-
created_at,
|
|
228
|
-
updated_at,
|
|
229
|
-
ended_at
|
|
230
|
-
) VALUES (
|
|
231
|
-
@flow_id,
|
|
232
|
-
@sync_mode,
|
|
233
|
-
@owner_key,
|
|
234
|
-
@requester_origin_json,
|
|
235
|
-
@controller_id,
|
|
236
|
-
@revision,
|
|
237
|
-
@status,
|
|
238
|
-
@notify_policy,
|
|
239
|
-
@goal,
|
|
240
|
-
@current_step,
|
|
241
|
-
@blocked_task_id,
|
|
242
|
-
@blocked_summary,
|
|
243
|
-
@state_json,
|
|
244
|
-
@wait_json,
|
|
245
|
-
@cancel_requested_at,
|
|
246
|
-
@created_at,
|
|
247
|
-
@updated_at,
|
|
248
|
-
@ended_at
|
|
249
|
-
)
|
|
250
|
-
ON CONFLICT(flow_id) DO UPDATE SET
|
|
251
|
-
sync_mode = excluded.sync_mode,
|
|
252
|
-
owner_key = excluded.owner_key,
|
|
253
|
-
requester_origin_json = excluded.requester_origin_json,
|
|
254
|
-
controller_id = excluded.controller_id,
|
|
255
|
-
revision = excluded.revision,
|
|
256
|
-
status = excluded.status,
|
|
257
|
-
notify_policy = excluded.notify_policy,
|
|
258
|
-
goal = excluded.goal,
|
|
259
|
-
current_step = excluded.current_step,
|
|
260
|
-
blocked_task_id = excluded.blocked_task_id,
|
|
261
|
-
blocked_summary = excluded.blocked_summary,
|
|
262
|
-
state_json = excluded.state_json,
|
|
263
|
-
wait_json = excluded.wait_json,
|
|
264
|
-
cancel_requested_at = excluded.cancel_requested_at,
|
|
265
|
-
created_at = excluded.created_at,
|
|
266
|
-
updated_at = excluded.updated_at,
|
|
267
|
-
ended_at = excluded.ended_at
|
|
268
|
-
`),
|
|
269
|
-
deleteRow: db.prepare(`DELETE FROM flow_runs WHERE flow_id = ?`),
|
|
270
|
-
clearRows: db.prepare(`DELETE FROM flow_runs`)
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function hasFlowRunsColumn(db, columnName) {
|
|
274
|
-
return db.prepare(`PRAGMA table_info(flow_runs)`).all().some((row) => row.name === columnName);
|
|
275
|
-
}
|
|
276
|
-
function ensureSchema$1(db) {
|
|
277
|
-
db.exec(`
|
|
278
|
-
CREATE TABLE IF NOT EXISTS flow_runs (
|
|
279
|
-
flow_id TEXT PRIMARY KEY,
|
|
280
|
-
shape TEXT,
|
|
281
|
-
sync_mode TEXT NOT NULL DEFAULT 'managed',
|
|
282
|
-
owner_key TEXT NOT NULL,
|
|
283
|
-
requester_origin_json TEXT,
|
|
284
|
-
controller_id TEXT,
|
|
285
|
-
revision INTEGER NOT NULL DEFAULT 0,
|
|
286
|
-
status TEXT NOT NULL,
|
|
287
|
-
notify_policy TEXT NOT NULL,
|
|
288
|
-
goal TEXT NOT NULL,
|
|
289
|
-
current_step TEXT,
|
|
290
|
-
blocked_task_id TEXT,
|
|
291
|
-
blocked_summary TEXT,
|
|
292
|
-
state_json TEXT,
|
|
293
|
-
wait_json TEXT,
|
|
294
|
-
cancel_requested_at INTEGER,
|
|
295
|
-
created_at INTEGER NOT NULL,
|
|
296
|
-
updated_at INTEGER NOT NULL,
|
|
297
|
-
ended_at INTEGER
|
|
298
|
-
);
|
|
299
|
-
`);
|
|
300
|
-
if (!hasFlowRunsColumn(db, "owner_key") && hasFlowRunsColumn(db, "owner_session_key")) {
|
|
301
|
-
db.exec(`ALTER TABLE flow_runs ADD COLUMN owner_key TEXT;`);
|
|
302
|
-
db.exec(`
|
|
303
|
-
UPDATE flow_runs
|
|
304
|
-
SET owner_key = owner_session_key
|
|
305
|
-
WHERE owner_key IS NULL
|
|
306
|
-
`);
|
|
307
|
-
}
|
|
308
|
-
if (!hasFlowRunsColumn(db, "shape")) db.exec(`ALTER TABLE flow_runs ADD COLUMN shape TEXT;`);
|
|
309
|
-
if (!hasFlowRunsColumn(db, "sync_mode")) {
|
|
310
|
-
db.exec(`ALTER TABLE flow_runs ADD COLUMN sync_mode TEXT;`);
|
|
311
|
-
if (hasFlowRunsColumn(db, "shape")) db.exec(`
|
|
312
|
-
UPDATE flow_runs
|
|
313
|
-
SET sync_mode = CASE
|
|
314
|
-
WHEN shape = 'single_task' THEN 'task_mirrored'
|
|
315
|
-
ELSE 'managed'
|
|
316
|
-
END
|
|
317
|
-
WHERE sync_mode IS NULL
|
|
318
|
-
`);
|
|
319
|
-
else db.exec(`
|
|
320
|
-
UPDATE flow_runs
|
|
321
|
-
SET sync_mode = 'managed'
|
|
322
|
-
WHERE sync_mode IS NULL
|
|
323
|
-
`);
|
|
324
|
-
}
|
|
325
|
-
if (!hasFlowRunsColumn(db, "controller_id")) db.exec(`ALTER TABLE flow_runs ADD COLUMN controller_id TEXT;`);
|
|
326
|
-
db.exec(`
|
|
327
|
-
UPDATE flow_runs
|
|
328
|
-
SET controller_id = 'core/legacy-restored'
|
|
329
|
-
WHERE sync_mode = 'managed'
|
|
330
|
-
AND (controller_id IS NULL OR trim(controller_id) = '')
|
|
331
|
-
`);
|
|
332
|
-
if (!hasFlowRunsColumn(db, "revision")) {
|
|
333
|
-
db.exec(`ALTER TABLE flow_runs ADD COLUMN revision INTEGER;`);
|
|
334
|
-
db.exec(`
|
|
335
|
-
UPDATE flow_runs
|
|
336
|
-
SET revision = 0
|
|
337
|
-
WHERE revision IS NULL
|
|
338
|
-
`);
|
|
339
|
-
}
|
|
340
|
-
if (!hasFlowRunsColumn(db, "blocked_task_id")) db.exec(`ALTER TABLE flow_runs ADD COLUMN blocked_task_id TEXT;`);
|
|
341
|
-
if (!hasFlowRunsColumn(db, "blocked_summary")) db.exec(`ALTER TABLE flow_runs ADD COLUMN blocked_summary TEXT;`);
|
|
342
|
-
if (!hasFlowRunsColumn(db, "state_json")) db.exec(`ALTER TABLE flow_runs ADD COLUMN state_json TEXT;`);
|
|
343
|
-
if (!hasFlowRunsColumn(db, "wait_json")) db.exec(`ALTER TABLE flow_runs ADD COLUMN wait_json TEXT;`);
|
|
344
|
-
if (!hasFlowRunsColumn(db, "cancel_requested_at")) db.exec(`ALTER TABLE flow_runs ADD COLUMN cancel_requested_at INTEGER;`);
|
|
345
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_flow_runs_status ON flow_runs(status);`);
|
|
346
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_flow_runs_owner_key ON flow_runs(owner_key);`);
|
|
347
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_flow_runs_updated_at ON flow_runs(updated_at);`);
|
|
348
|
-
}
|
|
349
|
-
function ensureFlowRegistryPermissions(pathname) {
|
|
350
|
-
const dir = resolveTaskFlowRegistryDir(process.env);
|
|
351
|
-
mkdirSync(dir, {
|
|
352
|
-
recursive: true,
|
|
353
|
-
mode: FLOW_REGISTRY_DIR_MODE
|
|
354
|
-
});
|
|
355
|
-
chmodSync(dir, FLOW_REGISTRY_DIR_MODE);
|
|
356
|
-
for (const suffix of FLOW_REGISTRY_SIDECAR_SUFFIXES) {
|
|
357
|
-
const candidate = `${pathname}${suffix}`;
|
|
358
|
-
if (!existsSync(candidate)) continue;
|
|
359
|
-
chmodSync(candidate, FLOW_REGISTRY_FILE_MODE);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function openFlowRegistryDatabase() {
|
|
363
|
-
const pathname = resolveTaskFlowRegistrySqlitePath(process.env);
|
|
364
|
-
if (cachedDatabase$1 && cachedDatabase$1.path === pathname) return cachedDatabase$1;
|
|
365
|
-
if (cachedDatabase$1) {
|
|
366
|
-
cachedDatabase$1.db.close();
|
|
367
|
-
cachedDatabase$1 = null;
|
|
368
|
-
}
|
|
369
|
-
ensureFlowRegistryPermissions(pathname);
|
|
370
|
-
const { DatabaseSync } = requireNodeSqlite();
|
|
371
|
-
const db = new DatabaseSync(pathname);
|
|
372
|
-
db.exec(`PRAGMA journal_mode = WAL;`);
|
|
373
|
-
db.exec(`PRAGMA synchronous = NORMAL;`);
|
|
374
|
-
db.exec(`PRAGMA busy_timeout = 5000;`);
|
|
375
|
-
ensureSchema$1(db);
|
|
376
|
-
ensureFlowRegistryPermissions(pathname);
|
|
377
|
-
cachedDatabase$1 = {
|
|
378
|
-
db,
|
|
379
|
-
path: pathname,
|
|
380
|
-
statements: createStatements$1(db)
|
|
381
|
-
};
|
|
382
|
-
return cachedDatabase$1;
|
|
383
|
-
}
|
|
384
|
-
function withWriteTransaction$1(write) {
|
|
385
|
-
const { db, path, statements } = openFlowRegistryDatabase();
|
|
386
|
-
db.exec("BEGIN IMMEDIATE");
|
|
387
|
-
try {
|
|
388
|
-
write(statements);
|
|
389
|
-
db.exec("COMMIT");
|
|
390
|
-
ensureFlowRegistryPermissions(path);
|
|
391
|
-
} catch (error) {
|
|
392
|
-
db.exec("ROLLBACK");
|
|
393
|
-
throw error;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function loadTaskFlowRegistryStateFromSqlite() {
|
|
397
|
-
const { statements } = openFlowRegistryDatabase();
|
|
398
|
-
const rows = statements.selectAll.all();
|
|
399
|
-
return { flows: new Map(rows.map((row) => [row.flow_id, rowToFlowRecord(row)])) };
|
|
400
|
-
}
|
|
401
|
-
function saveTaskFlowRegistryStateToSqlite(snapshot) {
|
|
402
|
-
withWriteTransaction$1((statements) => {
|
|
403
|
-
statements.clearRows.run();
|
|
404
|
-
for (const flow of snapshot.flows.values()) statements.upsertRow.run(bindFlowRecord(flow));
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
function upsertTaskFlowRegistryRecordToSqlite(flow) {
|
|
408
|
-
const store = openFlowRegistryDatabase();
|
|
409
|
-
store.statements.upsertRow.run(bindFlowRecord(flow));
|
|
410
|
-
ensureFlowRegistryPermissions(store.path);
|
|
411
|
-
}
|
|
412
|
-
function deleteTaskFlowRegistryRecordFromSqlite(flowId) {
|
|
413
|
-
const store = openFlowRegistryDatabase();
|
|
414
|
-
store.statements.deleteRow.run(flowId);
|
|
415
|
-
ensureFlowRegistryPermissions(store.path);
|
|
416
|
-
}
|
|
417
|
-
function closeTaskFlowRegistrySqliteStore() {
|
|
418
|
-
if (!cachedDatabase$1) return;
|
|
419
|
-
cachedDatabase$1.db.close();
|
|
420
|
-
cachedDatabase$1 = null;
|
|
421
|
-
}
|
|
422
|
-
let configuredFlowRegistryStore = {
|
|
423
|
-
loadSnapshot: loadTaskFlowRegistryStateFromSqlite,
|
|
424
|
-
saveSnapshot: saveTaskFlowRegistryStateToSqlite,
|
|
425
|
-
upsertFlow: upsertTaskFlowRegistryRecordToSqlite,
|
|
426
|
-
deleteFlow: deleteTaskFlowRegistryRecordFromSqlite,
|
|
427
|
-
close: closeTaskFlowRegistrySqliteStore
|
|
428
|
-
};
|
|
429
|
-
let configuredFlowRegistryObservers = null;
|
|
430
|
-
function getTaskFlowRegistryStore() {
|
|
431
|
-
return configuredFlowRegistryStore;
|
|
432
|
-
}
|
|
433
|
-
function getTaskFlowRegistryObservers() {
|
|
434
|
-
return configuredFlowRegistryObservers;
|
|
435
|
-
}
|
|
436
|
-
//#endregion
|
|
437
|
-
//#region src/tasks/task-flow-registry.ts
|
|
438
|
-
const log$1 = createSubsystemLogger("tasks/task-flow-registry");
|
|
439
|
-
const flows = /* @__PURE__ */ new Map();
|
|
440
|
-
let restoreAttempted$1 = false;
|
|
441
|
-
let restoreFailureMessage = null;
|
|
442
|
-
function cloneStructuredValue(value) {
|
|
443
|
-
if (value === void 0) return;
|
|
444
|
-
return structuredClone(value);
|
|
445
|
-
}
|
|
446
|
-
function cloneFlowRecord(record) {
|
|
447
|
-
return {
|
|
448
|
-
...record,
|
|
449
|
-
...record.requesterOrigin ? { requesterOrigin: cloneStructuredValue(record.requesterOrigin) } : {},
|
|
450
|
-
...record.stateJson !== void 0 ? { stateJson: cloneStructuredValue(record.stateJson) } : {},
|
|
451
|
-
...record.waitJson !== void 0 ? { waitJson: cloneStructuredValue(record.waitJson) } : {}
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
function normalizeRestoredFlowRecord(record) {
|
|
455
|
-
const syncMode = record.syncMode === "task_mirrored" ? "task_mirrored" : "managed";
|
|
456
|
-
const controllerId = syncMode === "managed" ? normalizeOptionalString(record.controllerId) ?? "core/legacy-restored" : void 0;
|
|
457
|
-
return {
|
|
458
|
-
...record,
|
|
459
|
-
syncMode,
|
|
460
|
-
ownerKey: assertFlowOwnerKey(record.ownerKey),
|
|
461
|
-
...record.requesterOrigin ? { requesterOrigin: cloneStructuredValue(record.requesterOrigin) } : {},
|
|
462
|
-
...controllerId ? { controllerId } : {},
|
|
463
|
-
currentStep: normalizeOptionalString(record.currentStep),
|
|
464
|
-
blockedTaskId: normalizeOptionalString(record.blockedTaskId),
|
|
465
|
-
blockedSummary: normalizeOptionalString(record.blockedSummary),
|
|
466
|
-
...record.stateJson !== void 0 ? { stateJson: cloneStructuredValue(record.stateJson) } : {},
|
|
467
|
-
...record.waitJson !== void 0 ? { waitJson: cloneStructuredValue(record.waitJson) } : {},
|
|
468
|
-
revision: Math.max(0, record.revision),
|
|
469
|
-
cancelRequestedAt: record.cancelRequestedAt ?? void 0,
|
|
470
|
-
endedAt: record.endedAt ?? void 0
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
function snapshotFlowRecords(source) {
|
|
474
|
-
return [...source.values()].map((record) => cloneFlowRecord(record));
|
|
475
|
-
}
|
|
476
|
-
function emitFlowRegistryObserverEvent(createEvent) {
|
|
477
|
-
const observers = getTaskFlowRegistryObservers();
|
|
478
|
-
if (!observers?.onEvent) return;
|
|
479
|
-
try {
|
|
480
|
-
observers.onEvent(createEvent());
|
|
481
|
-
} catch {}
|
|
482
|
-
}
|
|
483
|
-
function ensureNotifyPolicy$1(notifyPolicy) {
|
|
484
|
-
return notifyPolicy ?? "done_only";
|
|
485
|
-
}
|
|
486
|
-
function normalizeJsonBlob(value) {
|
|
487
|
-
return value === void 0 ? void 0 : cloneStructuredValue(value);
|
|
488
|
-
}
|
|
489
|
-
function assertFlowOwnerKey(ownerKey) {
|
|
490
|
-
const normalized = normalizeOptionalString(ownerKey);
|
|
491
|
-
if (!normalized) throw new Error("Flow ownerKey is required.");
|
|
492
|
-
return normalized;
|
|
493
|
-
}
|
|
494
|
-
function assertControllerId(controllerId) {
|
|
495
|
-
const normalized = normalizeOptionalString(controllerId);
|
|
496
|
-
if (!normalized) throw new Error("Managed flow controllerId is required.");
|
|
497
|
-
return normalized;
|
|
498
|
-
}
|
|
499
|
-
function resolveFlowBlockedSummary(task) {
|
|
500
|
-
if (task.status !== "succeeded" || task.terminalOutcome !== "blocked") return;
|
|
501
|
-
return normalizeOptionalString(task.terminalSummary) ?? normalizeOptionalString(task.progressSummary);
|
|
502
|
-
}
|
|
503
|
-
function deriveTaskFlowStatusFromTask(task) {
|
|
504
|
-
if (task.status === "queued") return "queued";
|
|
505
|
-
if (task.status === "running") return "running";
|
|
506
|
-
if (task.status === "succeeded") return task.terminalOutcome === "blocked" ? "blocked" : "succeeded";
|
|
507
|
-
if (task.status === "cancelled") return "cancelled";
|
|
508
|
-
if (task.status === "lost") return "lost";
|
|
509
|
-
return "failed";
|
|
510
|
-
}
|
|
511
|
-
function ensureFlowRegistryReady() {
|
|
512
|
-
if (restoreAttempted$1) return;
|
|
513
|
-
restoreAttempted$1 = true;
|
|
514
|
-
try {
|
|
515
|
-
const restored = getTaskFlowRegistryStore().loadSnapshot();
|
|
516
|
-
flows.clear();
|
|
517
|
-
for (const [flowId, flow] of restored.flows) flows.set(flowId, normalizeRestoredFlowRecord(flow));
|
|
518
|
-
restoreFailureMessage = null;
|
|
519
|
-
} catch (error) {
|
|
520
|
-
flows.clear();
|
|
521
|
-
restoreFailureMessage = formatErrorMessage(error);
|
|
522
|
-
log$1.warn("Failed to restore task-flow registry", { error });
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
emitFlowRegistryObserverEvent(() => ({
|
|
526
|
-
kind: "restored",
|
|
527
|
-
flows: snapshotFlowRecords(flows)
|
|
528
|
-
}));
|
|
529
|
-
}
|
|
530
|
-
function getTaskFlowRegistryRestoreFailure() {
|
|
531
|
-
ensureFlowRegistryReady();
|
|
532
|
-
return restoreFailureMessage;
|
|
533
|
-
}
|
|
534
|
-
function persistFlowRegistry() {
|
|
535
|
-
getTaskFlowRegistryStore().saveSnapshot({ flows: new Map(snapshotFlowRecords(flows).map((flow) => [flow.flowId, flow])) });
|
|
536
|
-
}
|
|
537
|
-
function persistFlowUpsert(flow) {
|
|
538
|
-
const store = getTaskFlowRegistryStore();
|
|
539
|
-
if (store.upsertFlow) {
|
|
540
|
-
store.upsertFlow(cloneFlowRecord(flow));
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
persistFlowRegistry();
|
|
544
|
-
}
|
|
545
|
-
function persistFlowDelete(flowId) {
|
|
546
|
-
const store = getTaskFlowRegistryStore();
|
|
547
|
-
if (store.deleteFlow) {
|
|
548
|
-
store.deleteFlow(flowId);
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
persistFlowRegistry();
|
|
552
|
-
}
|
|
553
|
-
function buildFlowRecord(params) {
|
|
554
|
-
const now = params.createdAt ?? Date.now();
|
|
555
|
-
const syncMode = params.syncMode ?? "managed";
|
|
556
|
-
const controllerId = syncMode === "managed" ? assertControllerId(params.controllerId) : void 0;
|
|
557
|
-
return {
|
|
558
|
-
flowId: crypto.randomUUID(),
|
|
559
|
-
syncMode,
|
|
560
|
-
ownerKey: assertFlowOwnerKey(params.ownerKey),
|
|
561
|
-
...params.requesterOrigin ? { requesterOrigin: cloneStructuredValue(params.requesterOrigin) } : {},
|
|
562
|
-
...controllerId ? { controllerId } : {},
|
|
563
|
-
revision: Math.max(0, params.revision ?? 0),
|
|
564
|
-
status: params.status ?? "queued",
|
|
565
|
-
notifyPolicy: ensureNotifyPolicy$1(params.notifyPolicy),
|
|
566
|
-
goal: params.goal,
|
|
567
|
-
currentStep: normalizeOptionalString(params.currentStep),
|
|
568
|
-
blockedTaskId: normalizeOptionalString(params.blockedTaskId),
|
|
569
|
-
blockedSummary: normalizeOptionalString(params.blockedSummary),
|
|
570
|
-
...normalizeJsonBlob(params.stateJson) !== void 0 ? { stateJson: normalizeJsonBlob(params.stateJson) } : {},
|
|
571
|
-
...normalizeJsonBlob(params.waitJson) !== void 0 ? { waitJson: normalizeJsonBlob(params.waitJson) } : {},
|
|
572
|
-
...params.cancelRequestedAt != null ? { cancelRequestedAt: params.cancelRequestedAt } : {},
|
|
573
|
-
createdAt: now,
|
|
574
|
-
updatedAt: params.updatedAt ?? now,
|
|
575
|
-
...params.endedAt != null ? { endedAt: params.endedAt } : {}
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
function applyFlowPatch(current, patch) {
|
|
579
|
-
const controllerId = patch.controllerId === void 0 ? current.controllerId : normalizeOptionalString(patch.controllerId);
|
|
580
|
-
if (current.syncMode === "managed") assertControllerId(controllerId);
|
|
581
|
-
return {
|
|
582
|
-
...current,
|
|
583
|
-
...patch.status ? { status: patch.status } : {},
|
|
584
|
-
...patch.notifyPolicy ? { notifyPolicy: patch.notifyPolicy } : {},
|
|
585
|
-
...patch.goal ? { goal: patch.goal } : {},
|
|
586
|
-
controllerId,
|
|
587
|
-
currentStep: patch.currentStep === void 0 ? current.currentStep : normalizeOptionalString(patch.currentStep),
|
|
588
|
-
blockedTaskId: patch.blockedTaskId === void 0 ? current.blockedTaskId : normalizeOptionalString(patch.blockedTaskId),
|
|
589
|
-
blockedSummary: patch.blockedSummary === void 0 ? current.blockedSummary : normalizeOptionalString(patch.blockedSummary),
|
|
590
|
-
stateJson: patch.stateJson === void 0 ? current.stateJson : normalizeJsonBlob(patch.stateJson),
|
|
591
|
-
waitJson: patch.waitJson === void 0 ? current.waitJson : normalizeJsonBlob(patch.waitJson),
|
|
592
|
-
cancelRequestedAt: patch.cancelRequestedAt === void 0 ? current.cancelRequestedAt : patch.cancelRequestedAt ?? void 0,
|
|
593
|
-
revision: current.revision + 1,
|
|
594
|
-
updatedAt: patch.updatedAt ?? Date.now(),
|
|
595
|
-
endedAt: patch.endedAt === void 0 ? current.endedAt : patch.endedAt ?? void 0
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
function writeFlowRecord(next, previous) {
|
|
599
|
-
flows.set(next.flowId, next);
|
|
600
|
-
persistFlowUpsert(next);
|
|
601
|
-
emitFlowRegistryObserverEvent(() => ({
|
|
602
|
-
kind: "upserted",
|
|
603
|
-
flow: cloneFlowRecord(next),
|
|
604
|
-
...previous ? { previous: cloneFlowRecord(previous) } : {}
|
|
605
|
-
}));
|
|
606
|
-
return cloneFlowRecord(next);
|
|
607
|
-
}
|
|
608
|
-
function createFlowRecord(params) {
|
|
609
|
-
ensureFlowRegistryReady();
|
|
610
|
-
return writeFlowRecord(buildFlowRecord(params));
|
|
611
|
-
}
|
|
612
|
-
function createManagedTaskFlow(params) {
|
|
613
|
-
return createFlowRecord({
|
|
614
|
-
...params,
|
|
615
|
-
syncMode: "managed",
|
|
616
|
-
controllerId: assertControllerId(params.controllerId)
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
function createTaskFlowForTask(params) {
|
|
620
|
-
const terminalFlowStatus = deriveTaskFlowStatusFromTask(params.task);
|
|
621
|
-
const endedAt = terminalFlowStatus === "succeeded" || terminalFlowStatus === "blocked" || terminalFlowStatus === "failed" || terminalFlowStatus === "cancelled" || terminalFlowStatus === "lost" ? params.task.endedAt ?? params.task.lastEventAt ?? params.task.createdAt : void 0;
|
|
622
|
-
return createFlowRecord({
|
|
623
|
-
syncMode: "task_mirrored",
|
|
624
|
-
ownerKey: params.task.ownerKey,
|
|
625
|
-
requesterOrigin: params.requesterOrigin,
|
|
626
|
-
status: terminalFlowStatus,
|
|
627
|
-
notifyPolicy: params.task.notifyPolicy,
|
|
628
|
-
goal: normalizeOptionalString(params.task.label) ?? (params.task.task.trim() || "Background task"),
|
|
629
|
-
blockedTaskId: terminalFlowStatus === "blocked" ? normalizeOptionalString(params.task.taskId) : void 0,
|
|
630
|
-
blockedSummary: resolveFlowBlockedSummary(params.task),
|
|
631
|
-
createdAt: params.task.createdAt,
|
|
632
|
-
updatedAt: params.task.lastEventAt ?? params.task.createdAt,
|
|
633
|
-
...endedAt !== void 0 ? { endedAt } : {}
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
function updateFlowRecordByIdUnchecked(flowId, patch) {
|
|
637
|
-
ensureFlowRegistryReady();
|
|
638
|
-
const current = flows.get(flowId);
|
|
639
|
-
if (!current) return null;
|
|
640
|
-
return writeFlowRecord(applyFlowPatch(current, patch), current);
|
|
641
|
-
}
|
|
642
|
-
function updateFlowRecordByIdExpectedRevision(params) {
|
|
643
|
-
ensureFlowRegistryReady();
|
|
644
|
-
const current = flows.get(params.flowId);
|
|
645
|
-
if (!current) return {
|
|
646
|
-
applied: false,
|
|
647
|
-
reason: "not_found"
|
|
648
|
-
};
|
|
649
|
-
if (current.revision !== params.expectedRevision) return {
|
|
650
|
-
applied: false,
|
|
651
|
-
reason: "revision_conflict",
|
|
652
|
-
current: cloneFlowRecord(current)
|
|
653
|
-
};
|
|
654
|
-
return {
|
|
655
|
-
applied: true,
|
|
656
|
-
flow: writeFlowRecord(applyFlowPatch(current, params.patch), current)
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
function setFlowWaiting(params) {
|
|
660
|
-
return updateFlowRecordByIdExpectedRevision({
|
|
661
|
-
flowId: params.flowId,
|
|
662
|
-
expectedRevision: params.expectedRevision,
|
|
663
|
-
patch: {
|
|
664
|
-
status: normalizeOptionalString(params.blockedTaskId) || normalizeOptionalString(params.blockedSummary) ? "blocked" : "waiting",
|
|
665
|
-
currentStep: params.currentStep,
|
|
666
|
-
stateJson: params.stateJson,
|
|
667
|
-
waitJson: params.waitJson,
|
|
668
|
-
blockedTaskId: params.blockedTaskId,
|
|
669
|
-
blockedSummary: params.blockedSummary,
|
|
670
|
-
endedAt: null,
|
|
671
|
-
updatedAt: params.updatedAt
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
function resumeFlow(params) {
|
|
676
|
-
return updateFlowRecordByIdExpectedRevision({
|
|
677
|
-
flowId: params.flowId,
|
|
678
|
-
expectedRevision: params.expectedRevision,
|
|
679
|
-
patch: {
|
|
680
|
-
status: params.status ?? "queued",
|
|
681
|
-
currentStep: params.currentStep,
|
|
682
|
-
stateJson: params.stateJson,
|
|
683
|
-
waitJson: null,
|
|
684
|
-
blockedTaskId: null,
|
|
685
|
-
blockedSummary: null,
|
|
686
|
-
endedAt: null,
|
|
687
|
-
updatedAt: params.updatedAt
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
function finishFlow(params) {
|
|
692
|
-
const endedAt = params.endedAt ?? params.updatedAt ?? Date.now();
|
|
693
|
-
return updateFlowRecordByIdExpectedRevision({
|
|
694
|
-
flowId: params.flowId,
|
|
695
|
-
expectedRevision: params.expectedRevision,
|
|
696
|
-
patch: {
|
|
697
|
-
status: "succeeded",
|
|
698
|
-
currentStep: params.currentStep,
|
|
699
|
-
stateJson: params.stateJson,
|
|
700
|
-
waitJson: null,
|
|
701
|
-
blockedTaskId: null,
|
|
702
|
-
blockedSummary: null,
|
|
703
|
-
endedAt,
|
|
704
|
-
updatedAt: params.updatedAt ?? endedAt
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
function failFlow(params) {
|
|
709
|
-
const endedAt = params.endedAt ?? params.updatedAt ?? Date.now();
|
|
710
|
-
return updateFlowRecordByIdExpectedRevision({
|
|
711
|
-
flowId: params.flowId,
|
|
712
|
-
expectedRevision: params.expectedRevision,
|
|
713
|
-
patch: {
|
|
714
|
-
status: "failed",
|
|
715
|
-
currentStep: params.currentStep,
|
|
716
|
-
stateJson: params.stateJson,
|
|
717
|
-
waitJson: null,
|
|
718
|
-
blockedTaskId: params.blockedTaskId,
|
|
719
|
-
blockedSummary: params.blockedSummary,
|
|
720
|
-
endedAt,
|
|
721
|
-
updatedAt: params.updatedAt ?? endedAt
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
function requestFlowCancel(params) {
|
|
726
|
-
return updateFlowRecordByIdExpectedRevision({
|
|
727
|
-
flowId: params.flowId,
|
|
728
|
-
expectedRevision: params.expectedRevision,
|
|
729
|
-
patch: {
|
|
730
|
-
cancelRequestedAt: params.cancelRequestedAt ?? params.updatedAt ?? Date.now(),
|
|
731
|
-
updatedAt: params.updatedAt
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
function syncFlowFromTask(task) {
|
|
736
|
-
const flowId = task.parentFlowId?.trim();
|
|
737
|
-
if (!flowId) return null;
|
|
738
|
-
const flow = getTaskFlowById(flowId);
|
|
739
|
-
if (!flow) return null;
|
|
740
|
-
if (flow.syncMode !== "task_mirrored") return flow;
|
|
741
|
-
const terminalFlowStatus = deriveTaskFlowStatusFromTask(task);
|
|
742
|
-
const isTerminal = terminalFlowStatus === "succeeded" || terminalFlowStatus === "blocked" || terminalFlowStatus === "failed" || terminalFlowStatus === "cancelled" || terminalFlowStatus === "lost";
|
|
743
|
-
return updateFlowRecordByIdUnchecked(flowId, {
|
|
744
|
-
status: terminalFlowStatus,
|
|
745
|
-
notifyPolicy: task.notifyPolicy,
|
|
746
|
-
goal: normalizeOptionalString(task.label) ?? (task.task.trim() || "Background task"),
|
|
747
|
-
blockedTaskId: terminalFlowStatus === "blocked" ? task.taskId.trim() || null : null,
|
|
748
|
-
blockedSummary: terminalFlowStatus === "blocked" ? resolveFlowBlockedSummary(task) ?? null : null,
|
|
749
|
-
waitJson: null,
|
|
750
|
-
updatedAt: task.lastEventAt ?? Date.now(),
|
|
751
|
-
...isTerminal ? { endedAt: task.endedAt ?? task.lastEventAt ?? Date.now() } : { endedAt: null }
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
function getTaskFlowById(flowId) {
|
|
755
|
-
ensureFlowRegistryReady();
|
|
756
|
-
const flow = flows.get(flowId);
|
|
757
|
-
return flow ? cloneFlowRecord(flow) : void 0;
|
|
758
|
-
}
|
|
759
|
-
function listTaskFlowsForOwnerKey(ownerKey) {
|
|
760
|
-
ensureFlowRegistryReady();
|
|
761
|
-
const normalizedOwnerKey = ownerKey.trim();
|
|
762
|
-
if (!normalizedOwnerKey) return [];
|
|
763
|
-
return [...flows.values()].filter((flow) => flow.ownerKey.trim() === normalizedOwnerKey).map((flow) => cloneFlowRecord(flow)).toSorted((left, right) => right.createdAt - left.createdAt);
|
|
764
|
-
}
|
|
765
|
-
function findLatestTaskFlowForOwnerKey(ownerKey) {
|
|
766
|
-
const flow = listTaskFlowsForOwnerKey(ownerKey)[0];
|
|
767
|
-
return flow ? cloneFlowRecord(flow) : void 0;
|
|
768
|
-
}
|
|
769
|
-
function resolveTaskFlowForLookupToken(token) {
|
|
770
|
-
const lookup = token.trim();
|
|
771
|
-
if (!lookup) return;
|
|
772
|
-
return getTaskFlowById(lookup) ?? findLatestTaskFlowForOwnerKey(lookup);
|
|
773
|
-
}
|
|
774
|
-
function listTaskFlowRecords() {
|
|
775
|
-
ensureFlowRegistryReady();
|
|
776
|
-
return [...flows.values()].map((flow) => cloneFlowRecord(flow)).toSorted((left, right) => right.createdAt - left.createdAt);
|
|
777
|
-
}
|
|
778
|
-
function deleteTaskFlowRecordById(flowId) {
|
|
779
|
-
ensureFlowRegistryReady();
|
|
780
|
-
const current = flows.get(flowId);
|
|
781
|
-
if (!current) return false;
|
|
782
|
-
flows.delete(flowId);
|
|
783
|
-
persistFlowDelete(flowId);
|
|
784
|
-
emitFlowRegistryObserverEvent(() => ({
|
|
785
|
-
kind: "deleted",
|
|
786
|
-
flowId,
|
|
787
|
-
previous: cloneFlowRecord(current)
|
|
788
|
-
}));
|
|
789
|
-
return true;
|
|
790
|
-
}
|
|
791
|
-
//#endregion
|
|
792
|
-
//#region src/tasks/task-registry.store.sqlite.ts
|
|
793
|
-
let cachedDatabase = null;
|
|
794
|
-
const TASK_REGISTRY_DIR_MODE = 448;
|
|
795
|
-
const TASK_REGISTRY_FILE_MODE = 384;
|
|
796
|
-
const TASK_REGISTRY_SIDECAR_SUFFIXES = [
|
|
797
|
-
"",
|
|
798
|
-
"-shm",
|
|
799
|
-
"-wal"
|
|
800
|
-
];
|
|
801
|
-
function normalizeNumber(value) {
|
|
802
|
-
if (typeof value === "bigint") return Number(value);
|
|
803
|
-
return typeof value === "number" ? value : void 0;
|
|
804
|
-
}
|
|
805
|
-
function serializeJson(value) {
|
|
806
|
-
return value == null ? null : JSON.stringify(value);
|
|
807
|
-
}
|
|
808
|
-
function parseJsonValue(raw) {
|
|
809
|
-
if (!raw?.trim()) return;
|
|
810
|
-
try {
|
|
811
|
-
return JSON.parse(raw);
|
|
812
|
-
} catch {
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
function rowToTaskRecord(row) {
|
|
817
|
-
const startedAt = normalizeNumber(row.started_at);
|
|
818
|
-
const endedAt = normalizeNumber(row.ended_at);
|
|
819
|
-
const lastEventAt = normalizeNumber(row.last_event_at);
|
|
820
|
-
const cleanupAfter = normalizeNumber(row.cleanup_after);
|
|
821
|
-
return {
|
|
822
|
-
taskId: row.task_id,
|
|
823
|
-
runtime: row.runtime,
|
|
824
|
-
...row.source_id ? { sourceId: row.source_id } : {},
|
|
825
|
-
requesterSessionKey: row.scope_kind === "system" ? "" : row.owner_key,
|
|
826
|
-
ownerKey: row.owner_key,
|
|
827
|
-
scopeKind: row.scope_kind,
|
|
828
|
-
...row.child_session_key ? { childSessionKey: row.child_session_key } : {},
|
|
829
|
-
...row.parent_flow_id ? { parentFlowId: row.parent_flow_id } : {},
|
|
830
|
-
...row.parent_task_id ? { parentTaskId: row.parent_task_id } : {},
|
|
831
|
-
...row.agent_id ? { agentId: row.agent_id } : {},
|
|
832
|
-
...row.run_id ? { runId: row.run_id } : {},
|
|
833
|
-
...row.label ? { label: row.label } : {},
|
|
834
|
-
task: row.task,
|
|
835
|
-
status: row.status,
|
|
836
|
-
deliveryStatus: row.delivery_status,
|
|
837
|
-
notifyPolicy: row.notify_policy,
|
|
838
|
-
createdAt: normalizeNumber(row.created_at) ?? 0,
|
|
839
|
-
...startedAt != null ? { startedAt } : {},
|
|
840
|
-
...endedAt != null ? { endedAt } : {},
|
|
841
|
-
...lastEventAt != null ? { lastEventAt } : {},
|
|
842
|
-
...cleanupAfter != null ? { cleanupAfter } : {},
|
|
843
|
-
...row.error ? { error: row.error } : {},
|
|
844
|
-
...row.progress_summary ? { progressSummary: row.progress_summary } : {},
|
|
845
|
-
...row.terminal_summary ? { terminalSummary: row.terminal_summary } : {},
|
|
846
|
-
...row.terminal_outcome ? { terminalOutcome: row.terminal_outcome } : {}
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
function rowToTaskDeliveryState(row) {
|
|
850
|
-
const requesterOrigin = parseJsonValue(row.requester_origin_json);
|
|
851
|
-
const lastNotifiedEventAt = normalizeNumber(row.last_notified_event_at);
|
|
852
|
-
return {
|
|
853
|
-
taskId: row.task_id,
|
|
854
|
-
...requesterOrigin ? { requesterOrigin } : {},
|
|
855
|
-
...lastNotifiedEventAt != null ? { lastNotifiedEventAt } : {}
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
function bindTaskRecordBase(record) {
|
|
859
|
-
return {
|
|
860
|
-
task_id: record.taskId,
|
|
861
|
-
runtime: record.runtime,
|
|
862
|
-
source_id: record.sourceId ?? null,
|
|
863
|
-
owner_key: record.ownerKey,
|
|
864
|
-
scope_kind: record.scopeKind,
|
|
865
|
-
child_session_key: record.childSessionKey ?? null,
|
|
866
|
-
parent_flow_id: record.parentFlowId ?? null,
|
|
867
|
-
parent_task_id: record.parentTaskId ?? null,
|
|
868
|
-
agent_id: record.agentId ?? null,
|
|
869
|
-
run_id: record.runId ?? null,
|
|
870
|
-
label: record.label ?? null,
|
|
871
|
-
task: record.task,
|
|
872
|
-
status: record.status,
|
|
873
|
-
delivery_status: record.deliveryStatus,
|
|
874
|
-
notify_policy: record.notifyPolicy,
|
|
875
|
-
created_at: record.createdAt,
|
|
876
|
-
started_at: record.startedAt ?? null,
|
|
877
|
-
ended_at: record.endedAt ?? null,
|
|
878
|
-
last_event_at: record.lastEventAt ?? null,
|
|
879
|
-
cleanup_after: record.cleanupAfter ?? null,
|
|
880
|
-
error: record.error ?? null,
|
|
881
|
-
progress_summary: record.progressSummary ?? null,
|
|
882
|
-
terminal_summary: record.terminalSummary ?? null,
|
|
883
|
-
terminal_outcome: record.terminalOutcome ?? null
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
function bindTaskRecord(record, legacyRequesterSessionColumn) {
|
|
887
|
-
if (!legacyRequesterSessionColumn) return bindTaskRecordBase(record);
|
|
888
|
-
return {
|
|
889
|
-
...bindTaskRecordBase(record),
|
|
890
|
-
requester_session_key: record.scopeKind === "system" ? "" : record.requesterSessionKey
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
function bindTaskDeliveryState(state) {
|
|
894
|
-
return {
|
|
895
|
-
task_id: state.taskId,
|
|
896
|
-
requester_origin_json: serializeJson(state.requesterOrigin),
|
|
897
|
-
last_notified_event_at: state.lastNotifiedEventAt ?? null
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
function createStatements(db) {
|
|
901
|
-
const legacyRequesterSessionColumn = hasTaskRunsColumn(db, "requester_session_key");
|
|
902
|
-
const upsertLegacyRequesterColumns = legacyRequesterSessionColumn ? `
|
|
903
|
-
requester_session_key,
|
|
904
|
-
` : "";
|
|
905
|
-
const upsertLegacyRequesterValues = legacyRequesterSessionColumn ? `
|
|
906
|
-
@requester_session_key,
|
|
907
|
-
` : "";
|
|
908
|
-
return {
|
|
909
|
-
legacyRequesterSessionColumn,
|
|
910
|
-
selectAll: db.prepare(`
|
|
911
|
-
SELECT
|
|
912
|
-
task_id,
|
|
913
|
-
runtime,
|
|
914
|
-
source_id,
|
|
915
|
-
owner_key,
|
|
916
|
-
scope_kind,
|
|
917
|
-
child_session_key,
|
|
918
|
-
parent_flow_id,
|
|
919
|
-
parent_task_id,
|
|
920
|
-
agent_id,
|
|
921
|
-
run_id,
|
|
922
|
-
label,
|
|
923
|
-
task,
|
|
924
|
-
status,
|
|
925
|
-
delivery_status,
|
|
926
|
-
notify_policy,
|
|
927
|
-
created_at,
|
|
928
|
-
started_at,
|
|
929
|
-
ended_at,
|
|
930
|
-
last_event_at,
|
|
931
|
-
cleanup_after,
|
|
932
|
-
error,
|
|
933
|
-
progress_summary,
|
|
934
|
-
terminal_summary,
|
|
935
|
-
terminal_outcome
|
|
936
|
-
FROM task_runs
|
|
937
|
-
ORDER BY created_at ASC, task_id ASC
|
|
938
|
-
`),
|
|
939
|
-
selectAllDeliveryStates: db.prepare(`
|
|
940
|
-
SELECT
|
|
941
|
-
task_id,
|
|
942
|
-
requester_origin_json,
|
|
943
|
-
last_notified_event_at
|
|
944
|
-
FROM task_delivery_state
|
|
945
|
-
ORDER BY task_id ASC
|
|
946
|
-
`),
|
|
947
|
-
upsertRow: db.prepare(`
|
|
948
|
-
INSERT INTO task_runs (
|
|
949
|
-
task_id,
|
|
950
|
-
runtime,
|
|
951
|
-
source_id,
|
|
952
|
-
${upsertLegacyRequesterColumns} owner_key,
|
|
953
|
-
scope_kind,
|
|
954
|
-
child_session_key,
|
|
955
|
-
parent_flow_id,
|
|
956
|
-
parent_task_id,
|
|
957
|
-
agent_id,
|
|
958
|
-
run_id,
|
|
959
|
-
label,
|
|
960
|
-
task,
|
|
961
|
-
status,
|
|
962
|
-
delivery_status,
|
|
963
|
-
notify_policy,
|
|
964
|
-
created_at,
|
|
965
|
-
started_at,
|
|
966
|
-
ended_at,
|
|
967
|
-
last_event_at,
|
|
968
|
-
cleanup_after,
|
|
969
|
-
error,
|
|
970
|
-
progress_summary,
|
|
971
|
-
terminal_summary,
|
|
972
|
-
terminal_outcome
|
|
973
|
-
) VALUES (
|
|
974
|
-
@task_id,
|
|
975
|
-
@runtime,
|
|
976
|
-
@source_id,
|
|
977
|
-
${upsertLegacyRequesterValues} @owner_key,
|
|
978
|
-
@scope_kind,
|
|
979
|
-
@child_session_key,
|
|
980
|
-
@parent_flow_id,
|
|
981
|
-
@parent_task_id,
|
|
982
|
-
@agent_id,
|
|
983
|
-
@run_id,
|
|
984
|
-
@label,
|
|
985
|
-
@task,
|
|
986
|
-
@status,
|
|
987
|
-
@delivery_status,
|
|
988
|
-
@notify_policy,
|
|
989
|
-
@created_at,
|
|
990
|
-
@started_at,
|
|
991
|
-
@ended_at,
|
|
992
|
-
@last_event_at,
|
|
993
|
-
@cleanup_after,
|
|
994
|
-
@error,
|
|
995
|
-
@progress_summary,
|
|
996
|
-
@terminal_summary,
|
|
997
|
-
@terminal_outcome
|
|
998
|
-
)
|
|
999
|
-
ON CONFLICT(task_id) DO UPDATE SET
|
|
1000
|
-
runtime = excluded.runtime,
|
|
1001
|
-
source_id = excluded.source_id,
|
|
1002
|
-
owner_key = excluded.owner_key,
|
|
1003
|
-
scope_kind = excluded.scope_kind,
|
|
1004
|
-
child_session_key = excluded.child_session_key,
|
|
1005
|
-
parent_flow_id = excluded.parent_flow_id,
|
|
1006
|
-
parent_task_id = excluded.parent_task_id,
|
|
1007
|
-
agent_id = excluded.agent_id,
|
|
1008
|
-
run_id = excluded.run_id,
|
|
1009
|
-
label = excluded.label,
|
|
1010
|
-
task = excluded.task,
|
|
1011
|
-
status = excluded.status,
|
|
1012
|
-
delivery_status = excluded.delivery_status,
|
|
1013
|
-
notify_policy = excluded.notify_policy,
|
|
1014
|
-
created_at = excluded.created_at,
|
|
1015
|
-
started_at = excluded.started_at,
|
|
1016
|
-
ended_at = excluded.ended_at,
|
|
1017
|
-
last_event_at = excluded.last_event_at,
|
|
1018
|
-
cleanup_after = excluded.cleanup_after,
|
|
1019
|
-
error = excluded.error,
|
|
1020
|
-
progress_summary = excluded.progress_summary,
|
|
1021
|
-
terminal_summary = excluded.terminal_summary,
|
|
1022
|
-
terminal_outcome = excluded.terminal_outcome
|
|
1023
|
-
`),
|
|
1024
|
-
replaceDeliveryState: db.prepare(`
|
|
1025
|
-
INSERT OR REPLACE INTO task_delivery_state (
|
|
1026
|
-
task_id,
|
|
1027
|
-
requester_origin_json,
|
|
1028
|
-
last_notified_event_at
|
|
1029
|
-
) VALUES (
|
|
1030
|
-
@task_id,
|
|
1031
|
-
@requester_origin_json,
|
|
1032
|
-
@last_notified_event_at
|
|
1033
|
-
)
|
|
1034
|
-
`),
|
|
1035
|
-
deleteRow: db.prepare(`DELETE FROM task_runs WHERE task_id = ?`),
|
|
1036
|
-
deleteDeliveryState: db.prepare(`DELETE FROM task_delivery_state WHERE task_id = ?`),
|
|
1037
|
-
clearRows: db.prepare(`DELETE FROM task_runs`),
|
|
1038
|
-
clearDeliveryStates: db.prepare(`DELETE FROM task_delivery_state`)
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
function hasTaskRunsColumn(db, columnName) {
|
|
1042
|
-
return db.prepare(`PRAGMA table_info(task_runs)`).all().some((row) => row.name === columnName);
|
|
1043
|
-
}
|
|
1044
|
-
function migrateLegacyOwnerColumns(db) {
|
|
1045
|
-
if (!hasTaskRunsColumn(db, "owner_key")) db.exec(`ALTER TABLE task_runs ADD COLUMN owner_key TEXT;`);
|
|
1046
|
-
if (!hasTaskRunsColumn(db, "scope_kind")) db.exec(`ALTER TABLE task_runs ADD COLUMN scope_kind TEXT NOT NULL DEFAULT 'session';`);
|
|
1047
|
-
if (hasTaskRunsColumn(db, "requester_session_key")) db.exec(`
|
|
1048
|
-
UPDATE task_runs
|
|
1049
|
-
SET owner_key = requester_session_key
|
|
1050
|
-
WHERE owner_key IS NULL
|
|
1051
|
-
`);
|
|
1052
|
-
db.exec(`
|
|
1053
|
-
UPDATE task_runs
|
|
1054
|
-
SET owner_key = CASE
|
|
1055
|
-
WHEN trim(COALESCE(owner_key, '')) <> '' THEN trim(owner_key)
|
|
1056
|
-
ELSE 'system:' || runtime || ':' || COALESCE(NULLIF(source_id, ''), task_id)
|
|
1057
|
-
END
|
|
1058
|
-
`);
|
|
1059
|
-
db.exec(`
|
|
1060
|
-
UPDATE task_runs
|
|
1061
|
-
SET scope_kind = CASE
|
|
1062
|
-
WHEN scope_kind = 'system' THEN 'system'
|
|
1063
|
-
WHEN owner_key LIKE 'system:%' THEN 'system'
|
|
1064
|
-
ELSE 'session'
|
|
1065
|
-
END
|
|
1066
|
-
`);
|
|
1067
|
-
}
|
|
1068
|
-
function ensureSchema(db) {
|
|
1069
|
-
db.exec(`
|
|
1070
|
-
CREATE TABLE IF NOT EXISTS task_runs (
|
|
1071
|
-
task_id TEXT PRIMARY KEY,
|
|
1072
|
-
runtime TEXT NOT NULL,
|
|
1073
|
-
source_id TEXT,
|
|
1074
|
-
owner_key TEXT NOT NULL,
|
|
1075
|
-
scope_kind TEXT NOT NULL,
|
|
1076
|
-
child_session_key TEXT,
|
|
1077
|
-
parent_flow_id TEXT,
|
|
1078
|
-
parent_task_id TEXT,
|
|
1079
|
-
agent_id TEXT,
|
|
1080
|
-
run_id TEXT,
|
|
1081
|
-
label TEXT,
|
|
1082
|
-
task TEXT NOT NULL,
|
|
1083
|
-
status TEXT NOT NULL,
|
|
1084
|
-
delivery_status TEXT NOT NULL,
|
|
1085
|
-
notify_policy TEXT NOT NULL,
|
|
1086
|
-
created_at INTEGER NOT NULL,
|
|
1087
|
-
started_at INTEGER,
|
|
1088
|
-
ended_at INTEGER,
|
|
1089
|
-
last_event_at INTEGER,
|
|
1090
|
-
cleanup_after INTEGER,
|
|
1091
|
-
error TEXT,
|
|
1092
|
-
progress_summary TEXT,
|
|
1093
|
-
terminal_summary TEXT,
|
|
1094
|
-
terminal_outcome TEXT
|
|
1095
|
-
);
|
|
1096
|
-
`);
|
|
1097
|
-
migrateLegacyOwnerColumns(db);
|
|
1098
|
-
if (!hasTaskRunsColumn(db, "parent_flow_id")) db.exec(`ALTER TABLE task_runs ADD COLUMN parent_flow_id TEXT;`);
|
|
1099
|
-
db.exec(`
|
|
1100
|
-
CREATE TABLE IF NOT EXISTS task_delivery_state (
|
|
1101
|
-
task_id TEXT PRIMARY KEY,
|
|
1102
|
-
requester_origin_json TEXT,
|
|
1103
|
-
last_notified_event_at INTEGER
|
|
1104
|
-
);
|
|
1105
|
-
`);
|
|
1106
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_run_id ON task_runs(run_id);`);
|
|
1107
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_status ON task_runs(status);`);
|
|
1108
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_runtime_status ON task_runs(runtime, status);`);
|
|
1109
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_cleanup_after ON task_runs(cleanup_after);`);
|
|
1110
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_last_event_at ON task_runs(last_event_at);`);
|
|
1111
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_owner_key ON task_runs(owner_key);`);
|
|
1112
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_parent_flow_id ON task_runs(parent_flow_id);`);
|
|
1113
|
-
db.exec(`CREATE INDEX IF NOT EXISTS idx_task_runs_child_session_key ON task_runs(child_session_key);`);
|
|
1114
|
-
}
|
|
1115
|
-
function ensureTaskRegistryPermissions(pathname) {
|
|
1116
|
-
const dir = resolveTaskRegistryDir(process.env);
|
|
1117
|
-
mkdirSync(dir, {
|
|
1118
|
-
recursive: true,
|
|
1119
|
-
mode: TASK_REGISTRY_DIR_MODE
|
|
1120
|
-
});
|
|
1121
|
-
chmodSync(dir, TASK_REGISTRY_DIR_MODE);
|
|
1122
|
-
for (const suffix of TASK_REGISTRY_SIDECAR_SUFFIXES) {
|
|
1123
|
-
const candidate = `${pathname}${suffix}`;
|
|
1124
|
-
if (!existsSync(candidate)) continue;
|
|
1125
|
-
chmodSync(candidate, TASK_REGISTRY_FILE_MODE);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
function openTaskRegistryDatabase() {
|
|
1129
|
-
const pathname = resolveTaskRegistrySqlitePath(process.env);
|
|
1130
|
-
if (cachedDatabase && cachedDatabase.path === pathname) return cachedDatabase;
|
|
1131
|
-
if (cachedDatabase) {
|
|
1132
|
-
cachedDatabase.db.close();
|
|
1133
|
-
cachedDatabase = null;
|
|
1134
|
-
}
|
|
1135
|
-
ensureTaskRegistryPermissions(pathname);
|
|
1136
|
-
const { DatabaseSync } = requireNodeSqlite();
|
|
1137
|
-
const db = new DatabaseSync(pathname);
|
|
1138
|
-
db.exec(`PRAGMA journal_mode = WAL;`);
|
|
1139
|
-
db.exec(`PRAGMA synchronous = NORMAL;`);
|
|
1140
|
-
db.exec(`PRAGMA busy_timeout = 5000;`);
|
|
1141
|
-
ensureSchema(db);
|
|
1142
|
-
ensureTaskRegistryPermissions(pathname);
|
|
1143
|
-
cachedDatabase = {
|
|
1144
|
-
db,
|
|
1145
|
-
path: pathname,
|
|
1146
|
-
statements: createStatements(db)
|
|
1147
|
-
};
|
|
1148
|
-
return cachedDatabase;
|
|
1149
|
-
}
|
|
1150
|
-
function withWriteTransaction(write) {
|
|
1151
|
-
const { db, path, statements } = openTaskRegistryDatabase();
|
|
1152
|
-
db.exec("BEGIN IMMEDIATE");
|
|
1153
|
-
try {
|
|
1154
|
-
write(statements);
|
|
1155
|
-
db.exec("COMMIT");
|
|
1156
|
-
ensureTaskRegistryPermissions(path);
|
|
1157
|
-
} catch (error) {
|
|
1158
|
-
db.exec("ROLLBACK");
|
|
1159
|
-
throw error;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
function loadTaskRegistryStateFromSqlite() {
|
|
1163
|
-
const { statements } = openTaskRegistryDatabase();
|
|
1164
|
-
const taskRows = statements.selectAll.all();
|
|
1165
|
-
const deliveryRows = statements.selectAllDeliveryStates.all();
|
|
1166
|
-
return {
|
|
1167
|
-
tasks: new Map(taskRows.map((row) => [row.task_id, rowToTaskRecord(row)])),
|
|
1168
|
-
deliveryStates: new Map(deliveryRows.map((row) => [row.task_id, rowToTaskDeliveryState(row)]))
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
function saveTaskRegistryStateToSqlite(snapshot) {
|
|
1172
|
-
withWriteTransaction((statements) => {
|
|
1173
|
-
statements.clearDeliveryStates.run();
|
|
1174
|
-
statements.clearRows.run();
|
|
1175
|
-
for (const task of snapshot.tasks.values()) statements.upsertRow.run(bindTaskRecord(task, statements.legacyRequesterSessionColumn));
|
|
1176
|
-
for (const state of snapshot.deliveryStates.values()) statements.replaceDeliveryState.run(bindTaskDeliveryState(state));
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
function upsertTaskRegistryRecordToSqlite(task) {
|
|
1180
|
-
const store = openTaskRegistryDatabase();
|
|
1181
|
-
store.statements.upsertRow.run(bindTaskRecord(task, store.statements.legacyRequesterSessionColumn));
|
|
1182
|
-
}
|
|
1183
|
-
function upsertTaskWithDeliveryStateToSqlite(params) {
|
|
1184
|
-
withWriteTransaction((statements) => {
|
|
1185
|
-
statements.upsertRow.run(bindTaskRecord(params.task, statements.legacyRequesterSessionColumn));
|
|
1186
|
-
if (params.deliveryState) statements.replaceDeliveryState.run(bindTaskDeliveryState(params.deliveryState));
|
|
1187
|
-
else statements.deleteDeliveryState.run(params.task.taskId);
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
function deleteTaskRegistryRecordFromSqlite(taskId) {
|
|
1191
|
-
const store = openTaskRegistryDatabase();
|
|
1192
|
-
store.statements.deleteRow.run(taskId);
|
|
1193
|
-
store.statements.deleteDeliveryState.run(taskId);
|
|
1194
|
-
}
|
|
1195
|
-
function deleteTaskAndDeliveryStateFromSqlite(taskId) {
|
|
1196
|
-
withWriteTransaction((statements) => {
|
|
1197
|
-
statements.deleteRow.run(taskId);
|
|
1198
|
-
statements.deleteDeliveryState.run(taskId);
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
function upsertTaskDeliveryStateToSqlite(state) {
|
|
1202
|
-
openTaskRegistryDatabase().statements.replaceDeliveryState.run(bindTaskDeliveryState(state));
|
|
1203
|
-
}
|
|
1204
|
-
function deleteTaskDeliveryStateFromSqlite(taskId) {
|
|
1205
|
-
openTaskRegistryDatabase().statements.deleteDeliveryState.run(taskId);
|
|
1206
|
-
}
|
|
1207
|
-
function closeTaskRegistrySqliteStore() {
|
|
1208
|
-
if (!cachedDatabase) return;
|
|
1209
|
-
cachedDatabase.db.close();
|
|
1210
|
-
cachedDatabase = null;
|
|
1211
|
-
}
|
|
1212
|
-
let configuredTaskRegistryStore = {
|
|
1213
|
-
loadSnapshot: loadTaskRegistryStateFromSqlite,
|
|
1214
|
-
saveSnapshot: saveTaskRegistryStateToSqlite,
|
|
1215
|
-
upsertTaskWithDeliveryState: upsertTaskWithDeliveryStateToSqlite,
|
|
1216
|
-
upsertTask: upsertTaskRegistryRecordToSqlite,
|
|
1217
|
-
deleteTaskWithDeliveryState: deleteTaskAndDeliveryStateFromSqlite,
|
|
1218
|
-
deleteTask: deleteTaskRegistryRecordFromSqlite,
|
|
1219
|
-
upsertDeliveryState: upsertTaskDeliveryStateToSqlite,
|
|
1220
|
-
deleteDeliveryState: deleteTaskDeliveryStateFromSqlite,
|
|
1221
|
-
close: closeTaskRegistrySqliteStore
|
|
1222
|
-
};
|
|
1223
|
-
let configuredTaskRegistryObservers = null;
|
|
1224
|
-
function getTaskRegistryStore() {
|
|
1225
|
-
return configuredTaskRegistryStore;
|
|
1226
|
-
}
|
|
1227
|
-
function getTaskRegistryObservers() {
|
|
1228
|
-
return configuredTaskRegistryObservers;
|
|
1229
|
-
}
|
|
1230
|
-
//#endregion
|
|
1231
|
-
//#region src/tasks/task-registry.ts
|
|
1232
|
-
const log = createSubsystemLogger("tasks/registry");
|
|
1233
|
-
const DEFAULT_TASK_RETENTION_MS = 10080 * 6e4;
|
|
1234
|
-
const tasks = /* @__PURE__ */ new Map();
|
|
1235
|
-
const taskDeliveryStates = /* @__PURE__ */ new Map();
|
|
1236
|
-
const taskIdsByRunId = /* @__PURE__ */ new Map();
|
|
1237
|
-
const taskIdsByOwnerKey = /* @__PURE__ */ new Map();
|
|
1238
|
-
const taskIdsByParentFlowId = /* @__PURE__ */ new Map();
|
|
1239
|
-
const taskIdsByRelatedSessionKey = /* @__PURE__ */ new Map();
|
|
1240
|
-
const tasksWithPendingDelivery = /* @__PURE__ */ new Set();
|
|
1241
|
-
let listenerStarted = false;
|
|
1242
|
-
let restoreAttempted = false;
|
|
1243
|
-
const TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY = Symbol.for("kaijibot.taskRegistry.deliveryRuntimeOverride");
|
|
1244
|
-
let deliveryRuntimePromise = null;
|
|
1245
|
-
let controlRuntimePromise = null;
|
|
1246
|
-
var ParentFlowLinkError = class extends Error {
|
|
1247
|
-
constructor(code, message, details) {
|
|
1248
|
-
super(message);
|
|
1249
|
-
this.code = code;
|
|
1250
|
-
this.details = details;
|
|
1251
|
-
this.name = "ParentFlowLinkError";
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
function isParentFlowLinkError(error) {
|
|
1255
|
-
return error instanceof ParentFlowLinkError;
|
|
1256
|
-
}
|
|
1257
|
-
function isActiveTaskStatus(status) {
|
|
1258
|
-
return status === "queued" || status === "running";
|
|
1259
|
-
}
|
|
1260
|
-
function isTerminalFlowStatus(status) {
|
|
1261
|
-
return status === "succeeded" || status === "failed" || status === "cancelled" || status === "lost";
|
|
1262
|
-
}
|
|
1263
|
-
function assertTaskOwner(params) {
|
|
1264
|
-
if (!params.ownerKey.trim() && params.scopeKind !== "system") throw new Error("Task ownerKey is required.");
|
|
1265
|
-
}
|
|
1266
|
-
function assertParentFlowLinkAllowed(params) {
|
|
1267
|
-
const flowId = params.parentFlowId?.trim();
|
|
1268
|
-
if (!flowId) return;
|
|
1269
|
-
if (params.scopeKind !== "session") throw new ParentFlowLinkError("scope_kind_not_session", "Only session-scoped tasks can link to flows.", { flowId });
|
|
1270
|
-
const flow = getTaskFlowById(flowId);
|
|
1271
|
-
if (!flow) throw new ParentFlowLinkError("parent_flow_not_found", `Parent flow not found: ${flowId}`, { flowId });
|
|
1272
|
-
if (normalizeOptionalString(flow.ownerKey) !== normalizeOptionalString(params.ownerKey)) throw new ParentFlowLinkError("owner_key_mismatch", "Task ownerKey must match parent flow ownerKey.", { flowId });
|
|
1273
|
-
if (flow.cancelRequestedAt != null) throw new ParentFlowLinkError("cancel_requested", "Parent flow cancellation has already been requested.", {
|
|
1274
|
-
flowId,
|
|
1275
|
-
status: flow.status
|
|
1276
|
-
});
|
|
1277
|
-
if (isTerminalFlowStatus(flow.status)) throw new ParentFlowLinkError("terminal", `Parent flow is already ${flow.status}.`, {
|
|
1278
|
-
flowId,
|
|
1279
|
-
status: flow.status
|
|
1280
|
-
});
|
|
1281
|
-
}
|
|
1282
|
-
function cloneTaskRecord(record) {
|
|
1283
|
-
return { ...record };
|
|
1284
|
-
}
|
|
1285
|
-
function cloneTaskDeliveryState(state) {
|
|
1286
|
-
return {
|
|
1287
|
-
...state,
|
|
1288
|
-
...state.requesterOrigin ? { requesterOrigin: { ...state.requesterOrigin } } : {}
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
function snapshotTaskRecords(source) {
|
|
1292
|
-
return [...source.values()].map((record) => cloneTaskRecord(record));
|
|
1293
|
-
}
|
|
1294
|
-
function emitTaskRegistryObserverEvent(createEvent) {
|
|
1295
|
-
const observers = getTaskRegistryObservers();
|
|
1296
|
-
if (!observers?.onEvent) return;
|
|
1297
|
-
try {
|
|
1298
|
-
observers.onEvent(createEvent());
|
|
1299
|
-
} catch (error) {
|
|
1300
|
-
log.warn("Task registry observer failed", {
|
|
1301
|
-
event: "task-registry",
|
|
1302
|
-
error
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
function persistTaskUpsert(task) {
|
|
1307
|
-
const store = getTaskRegistryStore();
|
|
1308
|
-
const deliveryState = taskDeliveryStates.get(task.taskId);
|
|
1309
|
-
if (store.upsertTaskWithDeliveryState) {
|
|
1310
|
-
store.upsertTaskWithDeliveryState({
|
|
1311
|
-
task,
|
|
1312
|
-
...deliveryState ? { deliveryState } : {}
|
|
1313
|
-
});
|
|
1314
|
-
return;
|
|
1315
|
-
}
|
|
1316
|
-
if (store.upsertTask) {
|
|
1317
|
-
store.upsertTask(task);
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
store.saveSnapshot({
|
|
1321
|
-
tasks,
|
|
1322
|
-
deliveryStates: taskDeliveryStates
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
|
-
function persistTaskDelete(taskId) {
|
|
1326
|
-
const store = getTaskRegistryStore();
|
|
1327
|
-
if (store.deleteTaskWithDeliveryState) {
|
|
1328
|
-
store.deleteTaskWithDeliveryState(taskId);
|
|
1329
|
-
return;
|
|
1330
|
-
}
|
|
1331
|
-
if (store.deleteTask) {
|
|
1332
|
-
store.deleteTask(taskId);
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
store.saveSnapshot({
|
|
1336
|
-
tasks,
|
|
1337
|
-
deliveryStates: taskDeliveryStates
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
function persistTaskDeliveryStateUpsert(state) {
|
|
1341
|
-
const store = getTaskRegistryStore();
|
|
1342
|
-
if (store.upsertDeliveryState) {
|
|
1343
|
-
store.upsertDeliveryState(state);
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1346
|
-
store.saveSnapshot({
|
|
1347
|
-
tasks,
|
|
1348
|
-
deliveryStates: taskDeliveryStates
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
function persistTaskDeliveryStateDelete(taskId) {
|
|
1352
|
-
const store = getTaskRegistryStore();
|
|
1353
|
-
if (store.deleteDeliveryState) {
|
|
1354
|
-
store.deleteDeliveryState(taskId);
|
|
1355
|
-
return;
|
|
1356
|
-
}
|
|
1357
|
-
store.saveSnapshot({
|
|
1358
|
-
tasks,
|
|
1359
|
-
deliveryStates: taskDeliveryStates
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
function ensureDeliveryStatus(params) {
|
|
1363
|
-
if (params.scopeKind === "system") return "not_applicable";
|
|
1364
|
-
return params.ownerKey.trim() ? "pending" : "parent_missing";
|
|
1365
|
-
}
|
|
1366
|
-
function ensureNotifyPolicy(params) {
|
|
1367
|
-
if (params.notifyPolicy) return params.notifyPolicy;
|
|
1368
|
-
return (params.deliveryStatus ?? ensureDeliveryStatus({
|
|
1369
|
-
ownerKey: params.ownerKey,
|
|
1370
|
-
scopeKind: params.scopeKind
|
|
1371
|
-
})) === "not_applicable" ? "silent" : "done_only";
|
|
1372
|
-
}
|
|
1373
|
-
function resolveTaskScopeKind(params) {
|
|
1374
|
-
if (params.scopeKind) return params.scopeKind;
|
|
1375
|
-
return params.requesterSessionKey.trim() ? "session" : "system";
|
|
1376
|
-
}
|
|
1377
|
-
function resolveTaskRequesterSessionKey(params) {
|
|
1378
|
-
const requesterSessionKey = params.requesterSessionKey?.trim();
|
|
1379
|
-
if (requesterSessionKey) return requesterSessionKey;
|
|
1380
|
-
if (params.scopeKind === "system") return "";
|
|
1381
|
-
return params.ownerKey?.trim() ?? "";
|
|
1382
|
-
}
|
|
1383
|
-
function resolveTaskOwnerKey(params) {
|
|
1384
|
-
return params.ownerKey?.trim() || params.requesterSessionKey.trim();
|
|
1385
|
-
}
|
|
1386
|
-
function normalizeTaskSummary(value) {
|
|
1387
|
-
return value?.replace(/\s+/g, " ").trim() || void 0;
|
|
1388
|
-
}
|
|
1389
|
-
function normalizeTaskStatus(value) {
|
|
1390
|
-
return value === "running" || value === "queued" || value === "succeeded" || value === "failed" || value === "timed_out" || value === "cancelled" || value === "lost" ? value : "queued";
|
|
1391
|
-
}
|
|
1392
|
-
function normalizeTaskTerminalOutcome(value) {
|
|
1393
|
-
return value === "succeeded" || value === "blocked" ? value : void 0;
|
|
1394
|
-
}
|
|
1395
|
-
function resolveTaskTerminalOutcome(params) {
|
|
1396
|
-
const normalized = normalizeTaskTerminalOutcome(params.terminalOutcome);
|
|
1397
|
-
if (normalized) return normalized;
|
|
1398
|
-
return params.status === "succeeded" ? "succeeded" : void 0;
|
|
1399
|
-
}
|
|
1400
|
-
function appendTaskEvent(event) {
|
|
1401
|
-
const summary = normalizeTaskSummary(event.summary);
|
|
1402
|
-
return {
|
|
1403
|
-
at: event.at,
|
|
1404
|
-
kind: event.kind,
|
|
1405
|
-
...summary ? { summary } : {}
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
function loadTaskRegistryDeliveryRuntime() {
|
|
1409
|
-
const deliveryRuntimeOverride = globalThis[TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY];
|
|
1410
|
-
if (deliveryRuntimeOverride) return Promise.resolve(deliveryRuntimeOverride);
|
|
1411
|
-
deliveryRuntimePromise ??= import("./task-registry-delivery-runtime-DSfcd2LA.js");
|
|
1412
|
-
return deliveryRuntimePromise;
|
|
1413
|
-
}
|
|
1414
|
-
function loadTaskRegistryControlRuntime() {
|
|
1415
|
-
controlRuntimePromise ??= import("./task-registry-control.runtime-BzsTfRw1.js");
|
|
1416
|
-
return controlRuntimePromise;
|
|
1417
|
-
}
|
|
1418
|
-
function addRunIdIndex(taskId, runId) {
|
|
1419
|
-
const trimmed = runId?.trim();
|
|
1420
|
-
if (!trimmed) return;
|
|
1421
|
-
let ids = taskIdsByRunId.get(trimmed);
|
|
1422
|
-
if (!ids) {
|
|
1423
|
-
ids = /* @__PURE__ */ new Set();
|
|
1424
|
-
taskIdsByRunId.set(trimmed, ids);
|
|
1425
|
-
}
|
|
1426
|
-
ids.add(taskId);
|
|
1427
|
-
}
|
|
1428
|
-
function addIndexedKey(index, key, taskId) {
|
|
1429
|
-
let ids = index.get(key);
|
|
1430
|
-
if (!ids) {
|
|
1431
|
-
ids = /* @__PURE__ */ new Set();
|
|
1432
|
-
index.set(key, ids);
|
|
1433
|
-
}
|
|
1434
|
-
ids.add(taskId);
|
|
1435
|
-
}
|
|
1436
|
-
function deleteIndexedKey(index, key, taskId) {
|
|
1437
|
-
const ids = index.get(key);
|
|
1438
|
-
if (!ids) return;
|
|
1439
|
-
ids.delete(taskId);
|
|
1440
|
-
if (ids.size === 0) index.delete(key);
|
|
1441
|
-
}
|
|
1442
|
-
function getTaskRelatedSessionIndexKeys(task) {
|
|
1443
|
-
return [...new Set([normalizeOptionalString(task.ownerKey), normalizeOptionalString(task.childSessionKey)].filter(Boolean))];
|
|
1444
|
-
}
|
|
1445
|
-
function addOwnerKeyIndex(taskId, task) {
|
|
1446
|
-
const key = normalizeOptionalString(task.ownerKey);
|
|
1447
|
-
if (!key) return;
|
|
1448
|
-
addIndexedKey(taskIdsByOwnerKey, key, taskId);
|
|
1449
|
-
}
|
|
1450
|
-
function deleteOwnerKeyIndex(taskId, task) {
|
|
1451
|
-
const key = normalizeOptionalString(task.ownerKey);
|
|
1452
|
-
if (!key) return;
|
|
1453
|
-
deleteIndexedKey(taskIdsByOwnerKey, key, taskId);
|
|
1454
|
-
}
|
|
1455
|
-
function addParentFlowIdIndex(taskId, task) {
|
|
1456
|
-
const key = task.parentFlowId?.trim();
|
|
1457
|
-
if (!key) return;
|
|
1458
|
-
addIndexedKey(taskIdsByParentFlowId, key, taskId);
|
|
1459
|
-
}
|
|
1460
|
-
function deleteParentFlowIdIndex(taskId, task) {
|
|
1461
|
-
const key = task.parentFlowId?.trim();
|
|
1462
|
-
if (!key) return;
|
|
1463
|
-
deleteIndexedKey(taskIdsByParentFlowId, key, taskId);
|
|
1464
|
-
}
|
|
1465
|
-
function addRelatedSessionKeyIndex(taskId, task) {
|
|
1466
|
-
for (const sessionKey of getTaskRelatedSessionIndexKeys(task)) addIndexedKey(taskIdsByRelatedSessionKey, sessionKey, taskId);
|
|
1467
|
-
}
|
|
1468
|
-
function deleteRelatedSessionKeyIndex(taskId, task) {
|
|
1469
|
-
for (const sessionKey of getTaskRelatedSessionIndexKeys(task)) deleteIndexedKey(taskIdsByRelatedSessionKey, sessionKey, taskId);
|
|
1470
|
-
}
|
|
1471
|
-
function rebuildRunIdIndex() {
|
|
1472
|
-
taskIdsByRunId.clear();
|
|
1473
|
-
for (const [taskId, task] of tasks.entries()) addRunIdIndex(taskId, task.runId);
|
|
1474
|
-
}
|
|
1475
|
-
function rebuildOwnerKeyIndex() {
|
|
1476
|
-
taskIdsByOwnerKey.clear();
|
|
1477
|
-
for (const [taskId, task] of tasks.entries()) addOwnerKeyIndex(taskId, task);
|
|
1478
|
-
}
|
|
1479
|
-
function rebuildParentFlowIdIndex() {
|
|
1480
|
-
taskIdsByParentFlowId.clear();
|
|
1481
|
-
for (const [taskId, task] of tasks.entries()) addParentFlowIdIndex(taskId, task);
|
|
1482
|
-
}
|
|
1483
|
-
function rebuildRelatedSessionKeyIndex() {
|
|
1484
|
-
taskIdsByRelatedSessionKey.clear();
|
|
1485
|
-
for (const [taskId, task] of tasks.entries()) addRelatedSessionKeyIndex(taskId, task);
|
|
1486
|
-
}
|
|
1487
|
-
function getTasksByRunId(runId) {
|
|
1488
|
-
const ids = taskIdsByRunId.get(runId.trim());
|
|
1489
|
-
if (!ids || ids.size === 0) return [];
|
|
1490
|
-
return [...ids].map((taskId) => tasks.get(taskId)).filter((task) => Boolean(task));
|
|
1491
|
-
}
|
|
1492
|
-
function taskRunScopeKey(task) {
|
|
1493
|
-
return [
|
|
1494
|
-
task.runtime,
|
|
1495
|
-
task.scopeKind,
|
|
1496
|
-
normalizeOptionalString(task.ownerKey) ?? "",
|
|
1497
|
-
normalizeOptionalString(task.childSessionKey) ?? ""
|
|
1498
|
-
].join("\0");
|
|
1499
|
-
}
|
|
1500
|
-
function getTasksByRunScope(params) {
|
|
1501
|
-
const matches = getTasksByRunId(params.runId).filter((task) => !params.runtime || task.runtime === params.runtime);
|
|
1502
|
-
const sessionKey = normalizeOptionalString(params.sessionKey);
|
|
1503
|
-
if (sessionKey) {
|
|
1504
|
-
const childMatches = matches.filter((task) => normalizeOptionalString(task.childSessionKey) === sessionKey);
|
|
1505
|
-
if (childMatches.length > 0) return childMatches;
|
|
1506
|
-
return matches.filter((task) => task.scopeKind === "session" && normalizeOptionalString(task.ownerKey) === sessionKey);
|
|
1507
|
-
}
|
|
1508
|
-
return new Set(matches.map((task) => taskRunScopeKey(task))).size <= 1 ? matches : [];
|
|
1509
|
-
}
|
|
1510
|
-
function getPeerTasksForDelivery(task) {
|
|
1511
|
-
if (!task.runId?.trim()) return [];
|
|
1512
|
-
return getTasksByRunId(task.runId).filter((candidate) => candidate.runtime === task.runtime && candidate.scopeKind === task.scopeKind && (normalizeOptionalString(candidate.ownerKey) ?? "") === (normalizeOptionalString(task.ownerKey) ?? "") && (normalizeOptionalString(candidate.childSessionKey) ?? "") === (normalizeOptionalString(task.childSessionKey) ?? ""));
|
|
1513
|
-
}
|
|
1514
|
-
function taskLookupPriority(task) {
|
|
1515
|
-
return task.runtime === "cli" ? 1 : 0;
|
|
1516
|
-
}
|
|
1517
|
-
function pickPreferredRunIdTask(matches) {
|
|
1518
|
-
return [...matches].toSorted((left, right) => {
|
|
1519
|
-
const priorityDiff = taskLookupPriority(left) - taskLookupPriority(right);
|
|
1520
|
-
if (priorityDiff !== 0) return priorityDiff;
|
|
1521
|
-
return left.createdAt - right.createdAt;
|
|
1522
|
-
})[0];
|
|
1523
|
-
}
|
|
1524
|
-
function compareTasksNewestFirst(left, right) {
|
|
1525
|
-
const createdAtDiff = right.createdAt - left.createdAt;
|
|
1526
|
-
if (createdAtDiff !== 0) return createdAtDiff;
|
|
1527
|
-
return (right.insertionIndex ?? 0) - (left.insertionIndex ?? 0);
|
|
1528
|
-
}
|
|
1529
|
-
function findExistingTaskForCreate(params) {
|
|
1530
|
-
const runId = params.runId?.trim();
|
|
1531
|
-
const runScopeMatches = runId ? getTasksByRunId(runId).filter((task) => task.runtime === params.runtime && task.scopeKind === params.scopeKind && (normalizeOptionalString(task.ownerKey) ?? "") === (normalizeOptionalString(params.ownerKey) ?? "") && (normalizeOptionalString(task.childSessionKey) ?? "") === (normalizeOptionalString(params.childSessionKey) ?? "") && (normalizeOptionalString(task.parentFlowId) ?? "") === (normalizeOptionalString(params.parentFlowId) ?? "")) : [];
|
|
1532
|
-
const exact = runId ? runScopeMatches.find((task) => (normalizeOptionalString(task.label) ?? "") === (normalizeOptionalString(params.label) ?? "") && (normalizeOptionalString(task.task) ?? "") === (normalizeOptionalString(params.task) ?? "")) : void 0;
|
|
1533
|
-
if (exact) return exact;
|
|
1534
|
-
if (!runId || params.runtime !== "acp") return;
|
|
1535
|
-
if (runScopeMatches.length === 0) return;
|
|
1536
|
-
return pickPreferredRunIdTask(runScopeMatches);
|
|
1537
|
-
}
|
|
1538
|
-
function mergeExistingTaskForCreate(existing, params) {
|
|
1539
|
-
const patch = {};
|
|
1540
|
-
const requesterOrigin = normalizeDeliveryContext(params.requesterOrigin);
|
|
1541
|
-
const currentDeliveryState = taskDeliveryStates.get(existing.taskId);
|
|
1542
|
-
if (requesterOrigin && !currentDeliveryState?.requesterOrigin) upsertTaskDeliveryState({
|
|
1543
|
-
taskId: existing.taskId,
|
|
1544
|
-
requesterOrigin,
|
|
1545
|
-
lastNotifiedEventAt: currentDeliveryState?.lastNotifiedEventAt
|
|
1546
|
-
});
|
|
1547
|
-
if (params.sourceId?.trim() && !existing.sourceId?.trim()) patch.sourceId = params.sourceId.trim();
|
|
1548
|
-
if (params.taskKind?.trim() && !existing.taskKind?.trim()) patch.taskKind = params.taskKind.trim();
|
|
1549
|
-
if (params.parentFlowId?.trim() && !existing.parentFlowId?.trim()) {
|
|
1550
|
-
assertParentFlowLinkAllowed({
|
|
1551
|
-
ownerKey: existing.ownerKey,
|
|
1552
|
-
scopeKind: existing.scopeKind,
|
|
1553
|
-
parentFlowId: params.parentFlowId
|
|
1554
|
-
});
|
|
1555
|
-
patch.parentFlowId = params.parentFlowId.trim();
|
|
1556
|
-
}
|
|
1557
|
-
if (params.parentTaskId?.trim() && !existing.parentTaskId?.trim()) patch.parentTaskId = params.parentTaskId.trim();
|
|
1558
|
-
if (params.agentId?.trim() && !existing.agentId?.trim()) patch.agentId = params.agentId.trim();
|
|
1559
|
-
const nextLabel = params.label?.trim();
|
|
1560
|
-
if (params.preferMetadata) {
|
|
1561
|
-
if (nextLabel && (normalizeOptionalString(existing.label) ?? "") !== nextLabel) patch.label = nextLabel;
|
|
1562
|
-
const nextTask = params.task.trim();
|
|
1563
|
-
if (nextTask && (normalizeOptionalString(existing.task) ?? "") !== nextTask) patch.task = nextTask;
|
|
1564
|
-
} else if (nextLabel && !existing.label?.trim()) patch.label = nextLabel;
|
|
1565
|
-
if (params.deliveryStatus === "pending" && existing.deliveryStatus !== "delivered") patch.deliveryStatus = "pending";
|
|
1566
|
-
const notifyPolicy = ensureNotifyPolicy({
|
|
1567
|
-
notifyPolicy: params.notifyPolicy,
|
|
1568
|
-
deliveryStatus: params.deliveryStatus,
|
|
1569
|
-
ownerKey: existing.ownerKey,
|
|
1570
|
-
scopeKind: existing.scopeKind
|
|
1571
|
-
});
|
|
1572
|
-
if (notifyPolicy !== existing.notifyPolicy && existing.notifyPolicy === "silent") patch.notifyPolicy = notifyPolicy;
|
|
1573
|
-
if (Object.keys(patch).length === 0) return cloneTaskRecord(existing);
|
|
1574
|
-
return updateTask(existing.taskId, patch) ?? cloneTaskRecord(existing);
|
|
1575
|
-
}
|
|
1576
|
-
function taskTerminalDeliveryIdempotencyKey(task) {
|
|
1577
|
-
const outcome = task.status === "succeeded" ? task.terminalOutcome ?? "default" : "default";
|
|
1578
|
-
return `task-terminal:${task.taskId}:${task.status}:${outcome}`;
|
|
1579
|
-
}
|
|
1580
|
-
function resolveTaskStateChangeIdempotencyKey(params) {
|
|
1581
|
-
if (params.owner.flowId) return `flow-event:${params.owner.flowId}:${params.task.taskId}:${params.latestEvent.at}:${params.latestEvent.kind}`;
|
|
1582
|
-
return `task-event:${params.task.taskId}:${params.latestEvent.at}:${params.latestEvent.kind}`;
|
|
1583
|
-
}
|
|
1584
|
-
function resolveTaskTerminalIdempotencyKey(task) {
|
|
1585
|
-
const owner = resolveTaskDeliveryOwner(task);
|
|
1586
|
-
if (owner.flowId) {
|
|
1587
|
-
const outcome = task.status === "succeeded" ? task.terminalOutcome ?? "default" : "default";
|
|
1588
|
-
return `flow-terminal:${owner.flowId}:${task.taskId}:${task.status}:${outcome}`;
|
|
1589
|
-
}
|
|
1590
|
-
return taskTerminalDeliveryIdempotencyKey(task);
|
|
1591
|
-
}
|
|
1592
|
-
function getLinkedFlowForDelivery(task) {
|
|
1593
|
-
const flowId = task.parentFlowId?.trim();
|
|
1594
|
-
if (!flowId || task.scopeKind !== "session") return;
|
|
1595
|
-
const flow = getTaskFlowById(flowId);
|
|
1596
|
-
if (!flow) return;
|
|
1597
|
-
if (normalizeOptionalString(flow.ownerKey) !== normalizeOptionalString(task.ownerKey)) return;
|
|
1598
|
-
return flow;
|
|
1599
|
-
}
|
|
1600
|
-
function resolveTaskDeliveryOwner(task) {
|
|
1601
|
-
const flow = getLinkedFlowForDelivery(task);
|
|
1602
|
-
if (flow) return {
|
|
1603
|
-
sessionKey: flow.ownerKey.trim(),
|
|
1604
|
-
requesterOrigin: normalizeDeliveryContext(flow.requesterOrigin ?? taskDeliveryStates.get(task.taskId)?.requesterOrigin),
|
|
1605
|
-
flowId: flow.flowId
|
|
1606
|
-
};
|
|
1607
|
-
if (task.scopeKind !== "session") return {};
|
|
1608
|
-
return {
|
|
1609
|
-
sessionKey: task.ownerKey.trim(),
|
|
1610
|
-
requesterOrigin: normalizeDeliveryContext(taskDeliveryStates.get(task.taskId)?.requesterOrigin)
|
|
1611
|
-
};
|
|
1612
|
-
}
|
|
1613
|
-
function syncManagedFlowCancellationFromTask(task) {
|
|
1614
|
-
const flowId = task.parentFlowId?.trim();
|
|
1615
|
-
if (!flowId) return;
|
|
1616
|
-
let flow = getTaskFlowById(flowId);
|
|
1617
|
-
if (!flow || flow.syncMode !== "managed" || flow.cancelRequestedAt == null || isTerminalFlowStatus(flow.status)) return;
|
|
1618
|
-
if (listTasksForFlowId(flowId).some((candidate) => isActiveTaskStatus(candidate.status))) return;
|
|
1619
|
-
const endedAt = task.endedAt ?? task.lastEventAt ?? Date.now();
|
|
1620
|
-
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
1621
|
-
const result = updateFlowRecordByIdExpectedRevision({
|
|
1622
|
-
flowId,
|
|
1623
|
-
expectedRevision: flow.revision,
|
|
1624
|
-
patch: {
|
|
1625
|
-
status: "cancelled",
|
|
1626
|
-
blockedTaskId: null,
|
|
1627
|
-
blockedSummary: null,
|
|
1628
|
-
waitJson: null,
|
|
1629
|
-
endedAt,
|
|
1630
|
-
updatedAt: endedAt
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
if (result.applied || result.reason === "not_found") return;
|
|
1634
|
-
flow = result.current;
|
|
1635
|
-
if (!flow || flow.syncMode !== "managed" || flow.cancelRequestedAt == null || isTerminalFlowStatus(flow.status)) return;
|
|
1636
|
-
if (listTasksForFlowId(flowId).some((candidate) => isActiveTaskStatus(candidate.status))) return;
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
function restoreTaskRegistryOnce() {
|
|
1640
|
-
if (restoreAttempted) return;
|
|
1641
|
-
restoreAttempted = true;
|
|
1642
|
-
try {
|
|
1643
|
-
const restored = getTaskRegistryStore().loadSnapshot();
|
|
1644
|
-
if (restored.tasks.size === 0 && restored.deliveryStates.size === 0) return;
|
|
1645
|
-
for (const [taskId, task] of restored.tasks.entries()) tasks.set(taskId, task);
|
|
1646
|
-
for (const [taskId, state] of restored.deliveryStates.entries()) taskDeliveryStates.set(taskId, state);
|
|
1647
|
-
rebuildRunIdIndex();
|
|
1648
|
-
rebuildOwnerKeyIndex();
|
|
1649
|
-
rebuildParentFlowIdIndex();
|
|
1650
|
-
rebuildRelatedSessionKeyIndex();
|
|
1651
|
-
emitTaskRegistryObserverEvent(() => ({
|
|
1652
|
-
kind: "restored",
|
|
1653
|
-
tasks: snapshotTaskRecords(tasks)
|
|
1654
|
-
}));
|
|
1655
|
-
} catch (error) {
|
|
1656
|
-
log.warn("Failed to restore task registry", { error });
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
function ensureTaskRegistryReady() {
|
|
1660
|
-
restoreTaskRegistryOnce();
|
|
1661
|
-
ensureListener();
|
|
1662
|
-
}
|
|
1663
|
-
function updateTask(taskId, patch) {
|
|
1664
|
-
const current = tasks.get(taskId);
|
|
1665
|
-
if (!current) return null;
|
|
1666
|
-
const next = {
|
|
1667
|
-
...current,
|
|
1668
|
-
...patch
|
|
1669
|
-
};
|
|
1670
|
-
if (isTerminalTaskStatus(next.status) && typeof next.cleanupAfter !== "number") next.cleanupAfter = (next.endedAt ?? next.lastEventAt ?? Date.now()) + DEFAULT_TASK_RETENTION_MS;
|
|
1671
|
-
const sessionIndexChanged = normalizeOptionalString(current.ownerKey) !== normalizeOptionalString(next.ownerKey) || normalizeOptionalString(current.childSessionKey) !== normalizeOptionalString(next.childSessionKey);
|
|
1672
|
-
const parentFlowIndexChanged = current.parentFlowId?.trim() !== next.parentFlowId?.trim();
|
|
1673
|
-
tasks.set(taskId, next);
|
|
1674
|
-
if (patch.runId && patch.runId !== current.runId) rebuildRunIdIndex();
|
|
1675
|
-
if (sessionIndexChanged) {
|
|
1676
|
-
deleteOwnerKeyIndex(taskId, current);
|
|
1677
|
-
addOwnerKeyIndex(taskId, next);
|
|
1678
|
-
deleteRelatedSessionKeyIndex(taskId, current);
|
|
1679
|
-
addRelatedSessionKeyIndex(taskId, next);
|
|
1680
|
-
}
|
|
1681
|
-
if (parentFlowIndexChanged) {
|
|
1682
|
-
deleteParentFlowIdIndex(taskId, current);
|
|
1683
|
-
addParentFlowIdIndex(taskId, next);
|
|
1684
|
-
}
|
|
1685
|
-
persistTaskUpsert(next);
|
|
1686
|
-
try {
|
|
1687
|
-
syncFlowFromTask(next);
|
|
1688
|
-
} catch (error) {
|
|
1689
|
-
log.warn("Failed to sync parent flow from task update", {
|
|
1690
|
-
taskId,
|
|
1691
|
-
flowId: next.parentFlowId,
|
|
1692
|
-
error
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
try {
|
|
1696
|
-
syncManagedFlowCancellationFromTask(next);
|
|
1697
|
-
} catch (error) {
|
|
1698
|
-
log.warn("Failed to finalize managed flow cancellation from task update", {
|
|
1699
|
-
taskId,
|
|
1700
|
-
flowId: next.parentFlowId,
|
|
1701
|
-
error
|
|
1702
|
-
});
|
|
1703
|
-
}
|
|
1704
|
-
emitTaskRegistryObserverEvent(() => ({
|
|
1705
|
-
kind: "upserted",
|
|
1706
|
-
task: cloneTaskRecord(next),
|
|
1707
|
-
previous: cloneTaskRecord(current)
|
|
1708
|
-
}));
|
|
1709
|
-
return cloneTaskRecord(next);
|
|
1710
|
-
}
|
|
1711
|
-
function upsertTaskDeliveryState(state) {
|
|
1712
|
-
const current = taskDeliveryStates.get(state.taskId);
|
|
1713
|
-
const next = {
|
|
1714
|
-
taskId: state.taskId,
|
|
1715
|
-
...state.requesterOrigin ? { requesterOrigin: normalizeDeliveryContext(state.requesterOrigin) } : {},
|
|
1716
|
-
...state.lastNotifiedEventAt != null ? { lastNotifiedEventAt: state.lastNotifiedEventAt } : {}
|
|
1717
|
-
};
|
|
1718
|
-
if (!next.requesterOrigin && typeof next.lastNotifiedEventAt !== "number" && !current) return cloneTaskDeliveryState({ taskId: state.taskId });
|
|
1719
|
-
taskDeliveryStates.set(state.taskId, next);
|
|
1720
|
-
persistTaskDeliveryStateUpsert(next);
|
|
1721
|
-
return cloneTaskDeliveryState(next);
|
|
1722
|
-
}
|
|
1723
|
-
function getTaskDeliveryState(taskId) {
|
|
1724
|
-
const state = taskDeliveryStates.get(taskId);
|
|
1725
|
-
return state ? cloneTaskDeliveryState(state) : void 0;
|
|
1726
|
-
}
|
|
1727
|
-
function canDeliverTaskToRequesterOrigin(task) {
|
|
1728
|
-
const origin = resolveTaskDeliveryOwner(task).requesterOrigin;
|
|
1729
|
-
const channel = origin?.channel?.trim();
|
|
1730
|
-
const to = origin?.to?.trim();
|
|
1731
|
-
return Boolean(channel && to && isDeliverableMessageChannel(channel));
|
|
1732
|
-
}
|
|
1733
|
-
function resolveMissingOwnerDeliveryStatus(task) {
|
|
1734
|
-
return task.scopeKind === "system" ? "not_applicable" : "parent_missing";
|
|
1735
|
-
}
|
|
1736
|
-
function queueTaskSystemEvent(task, text) {
|
|
1737
|
-
const owner = resolveTaskDeliveryOwner(task);
|
|
1738
|
-
const ownerKey = owner.sessionKey?.trim();
|
|
1739
|
-
if (!ownerKey) return false;
|
|
1740
|
-
enqueueSystemEvent(text, {
|
|
1741
|
-
sessionKey: ownerKey,
|
|
1742
|
-
contextKey: `task:${task.taskId}`,
|
|
1743
|
-
deliveryContext: owner.requesterOrigin
|
|
1744
|
-
});
|
|
1745
|
-
requestHeartbeatNow({
|
|
1746
|
-
reason: "background-task",
|
|
1747
|
-
sessionKey: ownerKey
|
|
1748
|
-
});
|
|
1749
|
-
return true;
|
|
1750
|
-
}
|
|
1751
|
-
function queueBlockedTaskFollowup(task) {
|
|
1752
|
-
const followupText = formatTaskBlockedFollowupMessage(task);
|
|
1753
|
-
if (!followupText) return false;
|
|
1754
|
-
const owner = resolveTaskDeliveryOwner(task);
|
|
1755
|
-
const ownerKey = owner.sessionKey?.trim();
|
|
1756
|
-
if (!ownerKey) return false;
|
|
1757
|
-
enqueueSystemEvent(followupText, {
|
|
1758
|
-
sessionKey: ownerKey,
|
|
1759
|
-
contextKey: `task:${task.taskId}:blocked-followup`,
|
|
1760
|
-
deliveryContext: owner.requesterOrigin
|
|
1761
|
-
});
|
|
1762
|
-
requestHeartbeatNow({
|
|
1763
|
-
reason: "background-task-blocked",
|
|
1764
|
-
sessionKey: ownerKey
|
|
1765
|
-
});
|
|
1766
|
-
return true;
|
|
1767
|
-
}
|
|
1768
|
-
async function maybeDeliverTaskTerminalUpdate(taskId) {
|
|
1769
|
-
ensureTaskRegistryReady();
|
|
1770
|
-
const current = tasks.get(taskId);
|
|
1771
|
-
if (!current || !shouldAutoDeliverTaskTerminalUpdate(current)) return current ? cloneTaskRecord(current) : null;
|
|
1772
|
-
if (tasksWithPendingDelivery.has(taskId)) return cloneTaskRecord(current);
|
|
1773
|
-
tasksWithPendingDelivery.add(taskId);
|
|
1774
|
-
try {
|
|
1775
|
-
const latest = tasks.get(taskId);
|
|
1776
|
-
if (!latest || !shouldAutoDeliverTaskTerminalUpdate(latest)) return latest ? cloneTaskRecord(latest) : null;
|
|
1777
|
-
if (shouldSuppressDuplicateTerminalDelivery({
|
|
1778
|
-
task: latest,
|
|
1779
|
-
preferredTaskId: (latest.runId ? pickPreferredRunIdTask(getPeerTasksForDelivery(latest)) : void 0)?.taskId
|
|
1780
|
-
})) return updateTask(taskId, {
|
|
1781
|
-
deliveryStatus: "not_applicable",
|
|
1782
|
-
lastEventAt: Date.now()
|
|
1783
|
-
});
|
|
1784
|
-
const owner = resolveTaskDeliveryOwner(latest);
|
|
1785
|
-
const ownerSessionKey = owner.sessionKey?.trim();
|
|
1786
|
-
if (!ownerSessionKey) return updateTask(taskId, {
|
|
1787
|
-
deliveryStatus: resolveMissingOwnerDeliveryStatus(latest),
|
|
1788
|
-
lastEventAt: Date.now()
|
|
1789
|
-
});
|
|
1790
|
-
const eventText = formatTaskTerminalMessage(latest);
|
|
1791
|
-
if (!canDeliverTaskToRequesterOrigin(latest)) try {
|
|
1792
|
-
queueTaskSystemEvent(latest, eventText);
|
|
1793
|
-
if (latest.terminalOutcome === "blocked") queueBlockedTaskFollowup(latest);
|
|
1794
|
-
return updateTask(taskId, {
|
|
1795
|
-
deliveryStatus: "session_queued",
|
|
1796
|
-
lastEventAt: Date.now()
|
|
1797
|
-
});
|
|
1798
|
-
} catch (error) {
|
|
1799
|
-
log.warn("Failed to queue background task session delivery", {
|
|
1800
|
-
taskId,
|
|
1801
|
-
ownerKey: latest.ownerKey,
|
|
1802
|
-
error
|
|
1803
|
-
});
|
|
1804
|
-
return updateTask(taskId, {
|
|
1805
|
-
deliveryStatus: "failed",
|
|
1806
|
-
lastEventAt: Date.now()
|
|
1807
|
-
});
|
|
1808
|
-
}
|
|
1809
|
-
try {
|
|
1810
|
-
const { sendMessage } = await loadTaskRegistryDeliveryRuntime();
|
|
1811
|
-
const requesterAgentId = parseAgentSessionKey(ownerSessionKey)?.agentId;
|
|
1812
|
-
const idempotencyKey = resolveTaskTerminalIdempotencyKey(latest);
|
|
1813
|
-
await sendMessage({
|
|
1814
|
-
channel: owner.requesterOrigin?.channel,
|
|
1815
|
-
to: owner.requesterOrigin?.to ?? "",
|
|
1816
|
-
accountId: owner.requesterOrigin?.accountId,
|
|
1817
|
-
threadId: owner.requesterOrigin?.threadId,
|
|
1818
|
-
content: eventText,
|
|
1819
|
-
agentId: requesterAgentId,
|
|
1820
|
-
idempotencyKey,
|
|
1821
|
-
mirror: {
|
|
1822
|
-
sessionKey: ownerSessionKey,
|
|
1823
|
-
agentId: requesterAgentId,
|
|
1824
|
-
idempotencyKey
|
|
1825
|
-
}
|
|
1826
|
-
});
|
|
1827
|
-
if (latest.terminalOutcome === "blocked") queueBlockedTaskFollowup(latest);
|
|
1828
|
-
return updateTask(taskId, {
|
|
1829
|
-
deliveryStatus: "delivered",
|
|
1830
|
-
lastEventAt: Date.now()
|
|
1831
|
-
});
|
|
1832
|
-
} catch (error) {
|
|
1833
|
-
log.warn("Failed to deliver background task update", {
|
|
1834
|
-
taskId,
|
|
1835
|
-
ownerKey: ownerSessionKey,
|
|
1836
|
-
requesterOrigin: owner.requesterOrigin,
|
|
1837
|
-
error
|
|
1838
|
-
});
|
|
1839
|
-
try {
|
|
1840
|
-
queueTaskSystemEvent(latest, eventText);
|
|
1841
|
-
if (latest.terminalOutcome === "blocked") queueBlockedTaskFollowup(latest);
|
|
1842
|
-
} catch (fallbackError) {
|
|
1843
|
-
log.warn("Failed to queue background task fallback event", {
|
|
1844
|
-
taskId,
|
|
1845
|
-
ownerKey: latest.ownerKey,
|
|
1846
|
-
error: fallbackError
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
return updateTask(taskId, {
|
|
1850
|
-
deliveryStatus: "failed",
|
|
1851
|
-
lastEventAt: Date.now()
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
|
-
} finally {
|
|
1855
|
-
tasksWithPendingDelivery.delete(taskId);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
async function maybeDeliverTaskStateChangeUpdate(taskId, latestEvent) {
|
|
1859
|
-
ensureTaskRegistryReady();
|
|
1860
|
-
const current = tasks.get(taskId);
|
|
1861
|
-
if (!current || !shouldAutoDeliverTaskStateChange(current)) return current ? cloneTaskRecord(current) : null;
|
|
1862
|
-
const deliveryState = getTaskDeliveryState(taskId);
|
|
1863
|
-
if (!latestEvent || (deliveryState?.lastNotifiedEventAt ?? 0) >= latestEvent.at) return cloneTaskRecord(current);
|
|
1864
|
-
const eventText = formatTaskStateChangeMessage(current, latestEvent);
|
|
1865
|
-
if (!eventText) return cloneTaskRecord(current);
|
|
1866
|
-
try {
|
|
1867
|
-
const owner = resolveTaskDeliveryOwner(current);
|
|
1868
|
-
const ownerSessionKey = owner.sessionKey?.trim();
|
|
1869
|
-
if (!ownerSessionKey) return updateTask(taskId, {
|
|
1870
|
-
deliveryStatus: resolveMissingOwnerDeliveryStatus(current),
|
|
1871
|
-
lastEventAt: Date.now()
|
|
1872
|
-
});
|
|
1873
|
-
if (!canDeliverTaskToRequesterOrigin(current)) {
|
|
1874
|
-
queueTaskSystemEvent(current, eventText);
|
|
1875
|
-
upsertTaskDeliveryState({
|
|
1876
|
-
taskId,
|
|
1877
|
-
requesterOrigin: deliveryState?.requesterOrigin,
|
|
1878
|
-
lastNotifiedEventAt: latestEvent.at
|
|
1879
|
-
});
|
|
1880
|
-
return updateTask(taskId, { lastEventAt: Date.now() });
|
|
1881
|
-
}
|
|
1882
|
-
const { sendMessage } = await loadTaskRegistryDeliveryRuntime();
|
|
1883
|
-
const requesterAgentId = parseAgentSessionKey(ownerSessionKey)?.agentId;
|
|
1884
|
-
const idempotencyKey = resolveTaskStateChangeIdempotencyKey({
|
|
1885
|
-
task: current,
|
|
1886
|
-
latestEvent,
|
|
1887
|
-
owner
|
|
1888
|
-
});
|
|
1889
|
-
await sendMessage({
|
|
1890
|
-
channel: owner.requesterOrigin?.channel,
|
|
1891
|
-
to: owner.requesterOrigin?.to ?? "",
|
|
1892
|
-
accountId: owner.requesterOrigin?.accountId,
|
|
1893
|
-
threadId: owner.requesterOrigin?.threadId,
|
|
1894
|
-
content: eventText,
|
|
1895
|
-
agentId: requesterAgentId,
|
|
1896
|
-
idempotencyKey,
|
|
1897
|
-
mirror: {
|
|
1898
|
-
sessionKey: ownerSessionKey,
|
|
1899
|
-
agentId: requesterAgentId,
|
|
1900
|
-
idempotencyKey
|
|
1901
|
-
}
|
|
1902
|
-
});
|
|
1903
|
-
upsertTaskDeliveryState({
|
|
1904
|
-
taskId,
|
|
1905
|
-
requesterOrigin: deliveryState?.requesterOrigin,
|
|
1906
|
-
lastNotifiedEventAt: latestEvent.at
|
|
1907
|
-
});
|
|
1908
|
-
return updateTask(taskId, { lastEventAt: Date.now() });
|
|
1909
|
-
} catch (error) {
|
|
1910
|
-
log.warn("Failed to deliver background task state change", {
|
|
1911
|
-
taskId,
|
|
1912
|
-
ownerKey: current.ownerKey,
|
|
1913
|
-
error
|
|
1914
|
-
});
|
|
1915
|
-
return cloneTaskRecord(current);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
function setTaskCleanupAfterById(params) {
|
|
1919
|
-
ensureTaskRegistryReady();
|
|
1920
|
-
return updateTask(params.taskId, { cleanupAfter: params.cleanupAfter });
|
|
1921
|
-
}
|
|
1922
|
-
function markTaskLostById(params) {
|
|
1923
|
-
ensureTaskRegistryReady();
|
|
1924
|
-
return updateTask(params.taskId, {
|
|
1925
|
-
status: "lost",
|
|
1926
|
-
endedAt: params.endedAt,
|
|
1927
|
-
lastEventAt: params.lastEventAt ?? params.endedAt,
|
|
1928
|
-
...params.error !== void 0 ? { error: params.error } : {},
|
|
1929
|
-
...params.cleanupAfter !== void 0 ? { cleanupAfter: params.cleanupAfter } : {}
|
|
1930
|
-
});
|
|
1931
|
-
}
|
|
1932
|
-
function updateTasksByRunId(params) {
|
|
1933
|
-
const matches = getTasksByRunScope(params);
|
|
1934
|
-
if (matches.length === 0) return [];
|
|
1935
|
-
const updated = [];
|
|
1936
|
-
for (const match of matches) {
|
|
1937
|
-
const task = updateTask(match.taskId, params.patch);
|
|
1938
|
-
if (task) updated.push(task);
|
|
1939
|
-
}
|
|
1940
|
-
return updated;
|
|
1941
|
-
}
|
|
1942
|
-
function ensureListener() {
|
|
1943
|
-
if (listenerStarted) return;
|
|
1944
|
-
listenerStarted = true;
|
|
1945
|
-
onAgentEvent((evt) => {
|
|
1946
|
-
restoreTaskRegistryOnce();
|
|
1947
|
-
const scopedTasks = getTasksByRunScope({
|
|
1948
|
-
runId: evt.runId,
|
|
1949
|
-
sessionKey: evt.sessionKey
|
|
1950
|
-
});
|
|
1951
|
-
if (scopedTasks.length === 0) return;
|
|
1952
|
-
const now = evt.ts || Date.now();
|
|
1953
|
-
for (const current of scopedTasks) {
|
|
1954
|
-
if (isTerminalTaskStatus(current.status)) continue;
|
|
1955
|
-
const patch = { lastEventAt: now };
|
|
1956
|
-
if (evt.stream === "lifecycle") {
|
|
1957
|
-
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : void 0;
|
|
1958
|
-
const startedAt = typeof evt.data?.startedAt === "number" ? evt.data.startedAt : current.startedAt;
|
|
1959
|
-
const endedAt = typeof evt.data?.endedAt === "number" ? evt.data.endedAt : void 0;
|
|
1960
|
-
if (startedAt) patch.startedAt = startedAt;
|
|
1961
|
-
if (phase === "start") patch.status = "running";
|
|
1962
|
-
else if (phase === "end") {
|
|
1963
|
-
patch.status = evt.data?.aborted === true ? "timed_out" : "succeeded";
|
|
1964
|
-
patch.endedAt = endedAt ?? now;
|
|
1965
|
-
} else if (phase === "error") {
|
|
1966
|
-
patch.status = "failed";
|
|
1967
|
-
patch.endedAt = endedAt ?? now;
|
|
1968
|
-
patch.error = typeof evt.data?.error === "string" ? evt.data.error : current.error;
|
|
1969
|
-
}
|
|
1970
|
-
} else if (evt.stream === "error") patch.error = typeof evt.data?.error === "string" ? evt.data.error : current.error;
|
|
1971
|
-
const stateChangeEvent = patch.status && patch.status !== current.status ? appendTaskEvent({
|
|
1972
|
-
at: now,
|
|
1973
|
-
kind: patch.status,
|
|
1974
|
-
summary: patch.status === "failed" ? patch.error ?? current.error : patch.status === "succeeded" ? current.terminalSummary : void 0
|
|
1975
|
-
}) : void 0;
|
|
1976
|
-
if (updateTask(current.taskId, patch)) {
|
|
1977
|
-
maybeDeliverTaskStateChangeUpdate(current.taskId, stateChangeEvent);
|
|
1978
|
-
maybeDeliverTaskTerminalUpdate(current.taskId);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
}
|
|
1983
|
-
function createTaskRecord(params) {
|
|
1984
|
-
ensureTaskRegistryReady();
|
|
1985
|
-
const requesterSessionKey = resolveTaskRequesterSessionKey(params);
|
|
1986
|
-
const scopeKind = resolveTaskScopeKind({
|
|
1987
|
-
scopeKind: params.scopeKind,
|
|
1988
|
-
requesterSessionKey
|
|
1989
|
-
});
|
|
1990
|
-
const ownerKey = resolveTaskOwnerKey({
|
|
1991
|
-
requesterSessionKey,
|
|
1992
|
-
ownerKey: params.ownerKey
|
|
1993
|
-
});
|
|
1994
|
-
assertTaskOwner({
|
|
1995
|
-
ownerKey,
|
|
1996
|
-
scopeKind
|
|
1997
|
-
});
|
|
1998
|
-
assertParentFlowLinkAllowed({
|
|
1999
|
-
ownerKey,
|
|
2000
|
-
scopeKind,
|
|
2001
|
-
parentFlowId: params.parentFlowId
|
|
2002
|
-
});
|
|
2003
|
-
const existing = findExistingTaskForCreate({
|
|
2004
|
-
runtime: params.runtime,
|
|
2005
|
-
ownerKey,
|
|
2006
|
-
scopeKind,
|
|
2007
|
-
childSessionKey: params.childSessionKey,
|
|
2008
|
-
parentFlowId: params.parentFlowId,
|
|
2009
|
-
runId: params.runId,
|
|
2010
|
-
label: params.label,
|
|
2011
|
-
task: params.task
|
|
2012
|
-
});
|
|
2013
|
-
if (existing) return mergeExistingTaskForCreate(existing, params);
|
|
2014
|
-
const now = Date.now();
|
|
2015
|
-
const taskId = crypto.randomUUID();
|
|
2016
|
-
const status = normalizeTaskStatus(params.status);
|
|
2017
|
-
const deliveryStatus = params.deliveryStatus ?? ensureDeliveryStatus({
|
|
2018
|
-
ownerKey,
|
|
2019
|
-
scopeKind
|
|
2020
|
-
});
|
|
2021
|
-
const notifyPolicy = ensureNotifyPolicy({
|
|
2022
|
-
notifyPolicy: params.notifyPolicy,
|
|
2023
|
-
deliveryStatus,
|
|
2024
|
-
ownerKey,
|
|
2025
|
-
scopeKind
|
|
2026
|
-
});
|
|
2027
|
-
const lastEventAt = params.lastEventAt ?? params.startedAt ?? now;
|
|
2028
|
-
const record = {
|
|
2029
|
-
taskId,
|
|
2030
|
-
runtime: params.runtime,
|
|
2031
|
-
taskKind: normalizeOptionalString(params.taskKind),
|
|
2032
|
-
sourceId: normalizeOptionalString(params.sourceId),
|
|
2033
|
-
requesterSessionKey,
|
|
2034
|
-
ownerKey,
|
|
2035
|
-
scopeKind,
|
|
2036
|
-
childSessionKey: params.childSessionKey,
|
|
2037
|
-
parentFlowId: normalizeOptionalString(params.parentFlowId),
|
|
2038
|
-
parentTaskId: normalizeOptionalString(params.parentTaskId),
|
|
2039
|
-
agentId: normalizeOptionalString(params.agentId),
|
|
2040
|
-
runId: normalizeOptionalString(params.runId),
|
|
2041
|
-
label: normalizeOptionalString(params.label),
|
|
2042
|
-
task: params.task,
|
|
2043
|
-
status,
|
|
2044
|
-
deliveryStatus,
|
|
2045
|
-
notifyPolicy,
|
|
2046
|
-
createdAt: now,
|
|
2047
|
-
startedAt: params.startedAt,
|
|
2048
|
-
lastEventAt,
|
|
2049
|
-
cleanupAfter: params.cleanupAfter,
|
|
2050
|
-
progressSummary: normalizeTaskSummary(params.progressSummary),
|
|
2051
|
-
terminalSummary: normalizeTaskSummary(params.terminalSummary),
|
|
2052
|
-
terminalOutcome: resolveTaskTerminalOutcome({
|
|
2053
|
-
status,
|
|
2054
|
-
terminalOutcome: params.terminalOutcome
|
|
2055
|
-
})
|
|
2056
|
-
};
|
|
2057
|
-
if (isTerminalTaskStatus(record.status) && typeof record.cleanupAfter !== "number") record.cleanupAfter = (record.endedAt ?? record.lastEventAt ?? record.createdAt) + DEFAULT_TASK_RETENTION_MS;
|
|
2058
|
-
tasks.set(taskId, record);
|
|
2059
|
-
upsertTaskDeliveryState({
|
|
2060
|
-
taskId,
|
|
2061
|
-
requesterOrigin: normalizeDeliveryContext(params.requesterOrigin)
|
|
2062
|
-
});
|
|
2063
|
-
addRunIdIndex(taskId, record.runId);
|
|
2064
|
-
addOwnerKeyIndex(taskId, record);
|
|
2065
|
-
addParentFlowIdIndex(taskId, record);
|
|
2066
|
-
addRelatedSessionKeyIndex(taskId, record);
|
|
2067
|
-
persistTaskUpsert(record);
|
|
2068
|
-
try {
|
|
2069
|
-
syncFlowFromTask(record);
|
|
2070
|
-
} catch (error) {
|
|
2071
|
-
log.warn("Failed to sync parent flow from task create", {
|
|
2072
|
-
taskId: record.taskId,
|
|
2073
|
-
flowId: record.parentFlowId,
|
|
2074
|
-
error
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
emitTaskRegistryObserverEvent(() => ({
|
|
2078
|
-
kind: "upserted",
|
|
2079
|
-
task: cloneTaskRecord(record)
|
|
2080
|
-
}));
|
|
2081
|
-
if (isTerminalTaskStatus(record.status)) maybeDeliverTaskTerminalUpdate(taskId);
|
|
2082
|
-
return cloneTaskRecord(record);
|
|
2083
|
-
}
|
|
2084
|
-
function updateTaskStateByRunId(params) {
|
|
2085
|
-
ensureTaskRegistryReady();
|
|
2086
|
-
const matches = getTasksByRunScope(params);
|
|
2087
|
-
if (matches.length === 0) return [];
|
|
2088
|
-
const updated = [];
|
|
2089
|
-
for (const current of matches) {
|
|
2090
|
-
const patch = {};
|
|
2091
|
-
const nextStatus = params.status ? normalizeTaskStatus(params.status) : current.status;
|
|
2092
|
-
const eventAt = params.lastEventAt ?? params.endedAt ?? Date.now();
|
|
2093
|
-
if (params.status) patch.status = normalizeTaskStatus(params.status);
|
|
2094
|
-
if (params.startedAt != null) patch.startedAt = params.startedAt;
|
|
2095
|
-
if (params.endedAt != null) patch.endedAt = params.endedAt;
|
|
2096
|
-
if (params.lastEventAt != null) patch.lastEventAt = params.lastEventAt;
|
|
2097
|
-
if (params.error !== void 0) patch.error = params.error;
|
|
2098
|
-
if (params.progressSummary !== void 0) patch.progressSummary = normalizeTaskSummary(params.progressSummary);
|
|
2099
|
-
if (params.terminalSummary !== void 0) patch.terminalSummary = normalizeTaskSummary(params.terminalSummary);
|
|
2100
|
-
if (params.terminalOutcome !== void 0) patch.terminalOutcome = resolveTaskTerminalOutcome({
|
|
2101
|
-
status: nextStatus,
|
|
2102
|
-
terminalOutcome: params.terminalOutcome
|
|
2103
|
-
});
|
|
2104
|
-
const eventSummary = normalizeTaskSummary(params.eventSummary) ?? (nextStatus === "failed" ? normalizeTaskSummary(params.error ?? current.error) : nextStatus === "succeeded" ? normalizeTaskSummary(params.terminalSummary ?? current.terminalSummary) : void 0);
|
|
2105
|
-
const nextEvent = params.status && params.status !== current.status || Boolean(normalizeTaskSummary(params.eventSummary)) ? appendTaskEvent({
|
|
2106
|
-
at: eventAt,
|
|
2107
|
-
kind: params.status && normalizeTaskStatus(params.status) !== current.status ? normalizeTaskStatus(params.status) : "progress",
|
|
2108
|
-
summary: eventSummary
|
|
2109
|
-
}) : void 0;
|
|
2110
|
-
const task = updateTask(current.taskId, patch);
|
|
2111
|
-
if (task) {
|
|
2112
|
-
updated.push(task);
|
|
2113
|
-
maybeDeliverTaskStateChangeUpdate(task.taskId, nextEvent);
|
|
2114
|
-
maybeDeliverTaskTerminalUpdate(task.taskId);
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
return updated;
|
|
2118
|
-
}
|
|
2119
|
-
function updateTaskDeliveryByRunId(params) {
|
|
2120
|
-
ensureTaskRegistryReady();
|
|
2121
|
-
return updateTasksByRunId({
|
|
2122
|
-
runId: params.runId,
|
|
2123
|
-
runtime: params.runtime,
|
|
2124
|
-
sessionKey: params.sessionKey,
|
|
2125
|
-
patch: { deliveryStatus: params.deliveryStatus }
|
|
2126
|
-
});
|
|
2127
|
-
}
|
|
2128
|
-
function markTaskRunningByRunId(params) {
|
|
2129
|
-
return updateTaskStateByRunId({
|
|
2130
|
-
runId: params.runId,
|
|
2131
|
-
runtime: params.runtime,
|
|
2132
|
-
sessionKey: params.sessionKey,
|
|
2133
|
-
status: "running",
|
|
2134
|
-
startedAt: params.startedAt,
|
|
2135
|
-
lastEventAt: params.lastEventAt,
|
|
2136
|
-
progressSummary: params.progressSummary,
|
|
2137
|
-
eventSummary: params.eventSummary
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
function recordTaskProgressByRunId(params) {
|
|
2141
|
-
return updateTaskStateByRunId({
|
|
2142
|
-
runId: params.runId,
|
|
2143
|
-
runtime: params.runtime,
|
|
2144
|
-
sessionKey: params.sessionKey,
|
|
2145
|
-
lastEventAt: params.lastEventAt,
|
|
2146
|
-
progressSummary: params.progressSummary,
|
|
2147
|
-
eventSummary: params.eventSummary
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
function markTaskTerminalByRunId(params) {
|
|
2151
|
-
return updateTaskStateByRunId({
|
|
2152
|
-
runId: params.runId,
|
|
2153
|
-
runtime: params.runtime,
|
|
2154
|
-
sessionKey: params.sessionKey,
|
|
2155
|
-
status: params.status,
|
|
2156
|
-
startedAt: params.startedAt,
|
|
2157
|
-
endedAt: params.endedAt,
|
|
2158
|
-
lastEventAt: params.lastEventAt,
|
|
2159
|
-
error: params.error,
|
|
2160
|
-
progressSummary: params.progressSummary,
|
|
2161
|
-
terminalSummary: params.terminalSummary,
|
|
2162
|
-
terminalOutcome: params.terminalOutcome
|
|
2163
|
-
});
|
|
2164
|
-
}
|
|
2165
|
-
function setTaskRunDeliveryStatusByRunId(params) {
|
|
2166
|
-
return updateTaskDeliveryByRunId(params);
|
|
2167
|
-
}
|
|
2168
|
-
function updateTaskNotifyPolicyById(params) {
|
|
2169
|
-
ensureTaskRegistryReady();
|
|
2170
|
-
return updateTask(params.taskId, {
|
|
2171
|
-
notifyPolicy: params.notifyPolicy,
|
|
2172
|
-
lastEventAt: Date.now()
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
function linkTaskToFlowById(params) {
|
|
2176
|
-
ensureTaskRegistryReady();
|
|
2177
|
-
const flowId = params.flowId.trim();
|
|
2178
|
-
if (!flowId) return null;
|
|
2179
|
-
const current = tasks.get(params.taskId);
|
|
2180
|
-
if (!current) return null;
|
|
2181
|
-
if (current.parentFlowId?.trim()) return cloneTaskRecord(current);
|
|
2182
|
-
assertParentFlowLinkAllowed({
|
|
2183
|
-
ownerKey: current.ownerKey,
|
|
2184
|
-
scopeKind: current.scopeKind,
|
|
2185
|
-
parentFlowId: flowId
|
|
2186
|
-
});
|
|
2187
|
-
return updateTask(params.taskId, { parentFlowId: flowId });
|
|
2188
|
-
}
|
|
2189
|
-
async function cancelTaskById(params) {
|
|
2190
|
-
ensureTaskRegistryReady();
|
|
2191
|
-
const task = tasks.get(params.taskId.trim());
|
|
2192
|
-
if (!task) return {
|
|
2193
|
-
found: false,
|
|
2194
|
-
cancelled: false,
|
|
2195
|
-
reason: "Task not found."
|
|
2196
|
-
};
|
|
2197
|
-
if (task.status === "succeeded" || task.status === "failed" || task.status === "timed_out" || task.status === "lost" || task.status === "cancelled") return {
|
|
2198
|
-
found: true,
|
|
2199
|
-
cancelled: false,
|
|
2200
|
-
reason: "Task is already terminal.",
|
|
2201
|
-
task: cloneTaskRecord(task)
|
|
2202
|
-
};
|
|
2203
|
-
const childSessionKey = task.childSessionKey?.trim();
|
|
2204
|
-
try {
|
|
2205
|
-
if (task.runtime !== "cli") {
|
|
2206
|
-
if (!childSessionKey) return {
|
|
2207
|
-
found: true,
|
|
2208
|
-
cancelled: false,
|
|
2209
|
-
reason: "Task has no cancellable child session.",
|
|
2210
|
-
task: cloneTaskRecord(task)
|
|
2211
|
-
};
|
|
2212
|
-
if (task.runtime === "acp") {
|
|
2213
|
-
const { getAcpSessionManager } = await loadTaskRegistryControlRuntime();
|
|
2214
|
-
await getAcpSessionManager().cancelSession({
|
|
2215
|
-
cfg: params.cfg,
|
|
2216
|
-
sessionKey: childSessionKey,
|
|
2217
|
-
reason: "task-cancel"
|
|
2218
|
-
});
|
|
2219
|
-
} else if (task.runtime === "subagent") {
|
|
2220
|
-
const { killSubagentRunAdmin } = await loadTaskRegistryControlRuntime();
|
|
2221
|
-
const result = await killSubagentRunAdmin({
|
|
2222
|
-
cfg: params.cfg,
|
|
2223
|
-
sessionKey: childSessionKey
|
|
2224
|
-
});
|
|
2225
|
-
if (!result.found || !result.killed) return {
|
|
2226
|
-
found: true,
|
|
2227
|
-
cancelled: false,
|
|
2228
|
-
reason: result.found ? "Subagent was not running." : "Subagent task not found.",
|
|
2229
|
-
task: cloneTaskRecord(task)
|
|
2230
|
-
};
|
|
2231
|
-
} else return {
|
|
2232
|
-
found: true,
|
|
2233
|
-
cancelled: false,
|
|
2234
|
-
reason: "Task runtime does not support cancellation yet.",
|
|
2235
|
-
task: cloneTaskRecord(task)
|
|
2236
|
-
};
|
|
2237
|
-
}
|
|
2238
|
-
const updated = updateTask(task.taskId, {
|
|
2239
|
-
status: "cancelled",
|
|
2240
|
-
endedAt: Date.now(),
|
|
2241
|
-
lastEventAt: Date.now(),
|
|
2242
|
-
error: "Cancelled by operator."
|
|
2243
|
-
});
|
|
2244
|
-
if (updated) maybeDeliverTaskTerminalUpdate(updated.taskId);
|
|
2245
|
-
return {
|
|
2246
|
-
found: true,
|
|
2247
|
-
cancelled: true,
|
|
2248
|
-
task: updated ?? cloneTaskRecord(task)
|
|
2249
|
-
};
|
|
2250
|
-
} catch (error) {
|
|
2251
|
-
return {
|
|
2252
|
-
found: true,
|
|
2253
|
-
cancelled: false,
|
|
2254
|
-
reason: formatErrorMessage(error),
|
|
2255
|
-
task: cloneTaskRecord(task)
|
|
2256
|
-
};
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
function listTaskRecords() {
|
|
2260
|
-
ensureTaskRegistryReady();
|
|
2261
|
-
return [...tasks.values()].map((task, insertionIndex) => ({
|
|
2262
|
-
...cloneTaskRecord(task),
|
|
2263
|
-
insertionIndex
|
|
2264
|
-
})).toSorted(compareTasksNewestFirst).map(({ insertionIndex: _, ...task }) => task);
|
|
2265
|
-
}
|
|
2266
|
-
function getTaskById(taskId) {
|
|
2267
|
-
ensureTaskRegistryReady();
|
|
2268
|
-
const task = tasks.get(taskId.trim());
|
|
2269
|
-
return task ? cloneTaskRecord(task) : void 0;
|
|
2270
|
-
}
|
|
2271
|
-
function findTaskByRunId(runId) {
|
|
2272
|
-
ensureTaskRegistryReady();
|
|
2273
|
-
const task = pickPreferredRunIdTask(getTasksByRunId(runId));
|
|
2274
|
-
return task ? cloneTaskRecord(task) : void 0;
|
|
2275
|
-
}
|
|
2276
|
-
function listTasksFromIndex(index, key) {
|
|
2277
|
-
const ids = index.get(key);
|
|
2278
|
-
if (!ids || ids.size === 0) return [];
|
|
2279
|
-
return [...ids].map((taskId, insertionIndex) => {
|
|
2280
|
-
const task = tasks.get(taskId);
|
|
2281
|
-
return task ? {
|
|
2282
|
-
...cloneTaskRecord(task),
|
|
2283
|
-
insertionIndex
|
|
2284
|
-
} : null;
|
|
2285
|
-
}).filter((task) => Boolean(task)).toSorted(compareTasksNewestFirst).map(({ insertionIndex: _, ...task }) => task);
|
|
2286
|
-
}
|
|
2287
|
-
function listTasksForSessionKey(sessionKey) {
|
|
2288
|
-
ensureTaskRegistryReady();
|
|
2289
|
-
const key = normalizeOptionalString(sessionKey);
|
|
2290
|
-
if (!key) return [];
|
|
2291
|
-
return listTasksFromIndex(taskIdsByRelatedSessionKey, key);
|
|
2292
|
-
}
|
|
2293
|
-
function listTasksForAgentId(agentId) {
|
|
2294
|
-
ensureTaskRegistryReady();
|
|
2295
|
-
const lookup = agentId.trim();
|
|
2296
|
-
if (!lookup) return [];
|
|
2297
|
-
return snapshotTaskRecords(tasks).filter((task) => task.agentId?.trim() === lookup).toSorted(compareTasksNewestFirst);
|
|
2298
|
-
}
|
|
2299
|
-
function listTasksForOwnerKey(ownerKey) {
|
|
2300
|
-
ensureTaskRegistryReady();
|
|
2301
|
-
const key = normalizeOptionalString(ownerKey);
|
|
2302
|
-
if (!key) return [];
|
|
2303
|
-
return listTasksFromIndex(taskIdsByOwnerKey, key);
|
|
2304
|
-
}
|
|
2305
|
-
function listTasksForFlowId(flowId) {
|
|
2306
|
-
ensureTaskRegistryReady();
|
|
2307
|
-
const key = flowId.trim();
|
|
2308
|
-
if (!key) return [];
|
|
2309
|
-
return listTasksFromIndex(taskIdsByParentFlowId, key);
|
|
2310
|
-
}
|
|
2311
|
-
function findLatestTaskForRelatedSessionKey(sessionKey) {
|
|
2312
|
-
const task = listTasksForRelatedSessionKey(sessionKey)[0];
|
|
2313
|
-
return task ? cloneTaskRecord(task) : void 0;
|
|
2314
|
-
}
|
|
2315
|
-
function listTasksForRelatedSessionKey(sessionKey) {
|
|
2316
|
-
ensureTaskRegistryReady();
|
|
2317
|
-
const key = normalizeOptionalString(sessionKey);
|
|
2318
|
-
if (!key) return [];
|
|
2319
|
-
return listTasksFromIndex(taskIdsByRelatedSessionKey, key);
|
|
2320
|
-
}
|
|
2321
|
-
function resolveTaskForLookupToken(token) {
|
|
2322
|
-
const lookup = token.trim();
|
|
2323
|
-
if (!lookup) return;
|
|
2324
|
-
return getTaskById(lookup) ?? findTaskByRunId(lookup) ?? findLatestTaskForRelatedSessionKey(lookup);
|
|
2325
|
-
}
|
|
2326
|
-
function deleteTaskRecordById(taskId) {
|
|
2327
|
-
ensureTaskRegistryReady();
|
|
2328
|
-
const current = tasks.get(taskId);
|
|
2329
|
-
if (!current) return false;
|
|
2330
|
-
deleteOwnerKeyIndex(taskId, current);
|
|
2331
|
-
deleteParentFlowIdIndex(taskId, current);
|
|
2332
|
-
deleteRelatedSessionKeyIndex(taskId, current);
|
|
2333
|
-
tasks.delete(taskId);
|
|
2334
|
-
taskDeliveryStates.delete(taskId);
|
|
2335
|
-
rebuildRunIdIndex();
|
|
2336
|
-
persistTaskDelete(taskId);
|
|
2337
|
-
persistTaskDeliveryStateDelete(taskId);
|
|
2338
|
-
emitTaskRegistryObserverEvent(() => ({
|
|
2339
|
-
kind: "deleted",
|
|
2340
|
-
taskId: current.taskId,
|
|
2341
|
-
previous: cloneTaskRecord(current)
|
|
2342
|
-
}));
|
|
2343
|
-
return true;
|
|
2344
|
-
}
|
|
2345
|
-
//#endregion
|
|
2346
|
-
export { getTaskFlowById as A, updateTaskNotifyPolicyById as C, failFlow as D, deleteTaskFlowRecordById as E, resolveTaskFlowForLookupToken as F, resumeFlow as I, setFlowWaiting as L, listTaskFlowRecords as M, listTaskFlowsForOwnerKey as N, findLatestTaskFlowForOwnerKey as O, requestFlowCancel as P, updateFlowRecordByIdExpectedRevision as R, setTaskRunDeliveryStatusByRunId as S, createTaskFlowForTask as T, markTaskTerminalByRunId as _, findTaskByRunId as a, resolveTaskForLookupToken as b, linkTaskToFlowById as c, listTasksForFlowId as d, listTasksForOwnerKey as f, markTaskRunningByRunId as g, markTaskLostById as h, ensureTaskRegistryReady as i, getTaskFlowRegistryRestoreFailure as j, finishFlow as k, listTaskRecords as l, listTasksForSessionKey as m, createTaskRecord as n, getTaskById as o, listTasksForRelatedSessionKey as p, deleteTaskRecordById as r, isParentFlowLinkError as s, cancelTaskById as t, listTasksForAgentId as u, maybeDeliverTaskTerminalUpdate as v, createManagedTaskFlow as w, setTaskCleanupAfterById as x, recordTaskProgressByRunId as y };
|