fengming 0.3.8 → 0.3.9
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/CHANGELOG.md +8 -0
- package/dist/abort-CCR8oZyg.js +277 -0
- package/dist/abort.runtime-eqx84NZa.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/acp-spawn-BcDyvaXh.js +2 -0
- package/dist/acp-spawn-CCtSel-_.js +1286 -0
- package/dist/acp-stateful-target-driver-B3pCvuOV.js +89 -0
- package/dist/active-tool-schema-warnings-Cf-5q5WU.js +105 -0
- package/dist/active-tool-schema-warnings-Dzt3XE-y.js +2 -0
- package/dist/agent-1M2dVE2G.js +2 -0
- package/dist/agent-DLDIbUT4.js +1825 -0
- package/dist/agent-DZi6j3o6.js +3 -0
- package/dist/agent-command-ppfDBwET.js +1435 -0
- package/dist/agent-harness-runtime-C0bo62eY.d.ts +913 -0
- package/dist/agent-harness-runtime-RkTGiliR.js +207 -0
- package/dist/agent-runner-utils-B4YeVAO_.js +267 -0
- package/dist/agent-runner.runtime-T_3tlZN1.js +3784 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-CloshyK-.d.ts +207 -0
- package/dist/agent-runtime-DZsmp1xr.js +199 -0
- package/dist/agent-tools-CET9usCz.js +2506 -0
- package/dist/agent-via-gateway-CZ0X0YkM.js +486 -0
- package/dist/agent-wait-dedupe-I81_F2tr.js +180 -0
- package/dist/agents/embedded-agent-runner/run/runtime-context-prompt.d.ts +1 -1
- package/dist/agents/embedded-agent-runner/tool-split.d.ts +1 -1
- package/dist/agents/model-catalog.runtime.d.ts +1 -1
- package/dist/api-BDB5xHYj.js +3 -0
- package/dist/api-BH7bfI5d.js +6 -0
- package/dist/api-BxJNXitd.js +2 -0
- package/dist/approval-client-helpers-CfQA9Jzh.d.ts +78 -0
- package/dist/approval-native-helpers-B2zyhxWc.d.ts +241 -0
- package/dist/approval-renderers-CMqSXyvm.d.ts +39 -0
- package/dist/assistant-Cu_Mzzgu.js +291 -0
- package/dist/attachment-normalize-Bb3v5iCC.js +213 -0
- package/dist/attempt-execution-BskbAq5I.js +584 -0
- package/dist/attempt-execution.runtime-BuT1wpNS.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt.prompt-helpers-ByKj-vQ7.js +543 -0
- package/dist/auto-reply/reply/commands-crestodian.d.ts +1 -1
- package/dist/binding-routing-EGRNvRC4.js +113 -0
- package/dist/binding-targets-B9vYS8n6.js +121 -0
- package/dist/bridge-server-DG9YtKQe.js +113 -0
- package/dist/browser-cli-B0Ou-Nbm.js +2 -0
- package/dist/browser-cli-GF25gL6M.js +230 -0
- package/dist/browser-cli-actions-input-CuER6RVe.js +522 -0
- package/dist/browser-cli-actions-observe-Dq-Zz_FA.js +81 -0
- package/dist/browser-cli-debug-7hvb49S1.js +137 -0
- package/dist/browser-cli-inspect-WU5KeWOK.js +117 -0
- package/dist/browser-cli-manage-B9D9BvSe.js +446 -0
- package/dist/browser-cli-resize-BUOusOPb.js +32 -0
- package/dist/browser-cli-shared-DmpSN-Qi.js +69 -0
- package/dist/browser-cli-state-D_YxTqRw.js +371 -0
- package/dist/browser-control-auth-Cqd1n9FA.js +2 -0
- package/dist/browser-profiles-9tQ05wYh.js +2 -0
- package/dist/browser-runtime-Bbzumoha.js +389 -0
- package/dist/build-CBXuT2K1.js +261 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/bundled-channel-config-schema-DpdKMATU.d.ts +3168 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-CiVGX7ut.js +1809 -0
- package/dist/channel-BIVwHq7P.js +2309 -0
- package/dist/channel-CiA2FVdL.d.ts +427 -0
- package/dist/channel-core-Cj9JTqeu.js +5 -0
- package/dist/channel-core-DjVpcH1C.d.ts +6 -0
- package/dist/channel-entry-contract-Bs_54m1D.d.ts +114 -0
- package/dist/channel-inbound-CdUdeQRa.js +121 -0
- package/dist/channel-inbound-iGiqx6CS.d.ts +97 -0
- package/dist/channel-message-C3QPaDUk.js +12 -0
- package/dist/channel-message-CXDjxb2U.d.ts +9 -0
- package/dist/channel-outbound-ofvvmMSK.d.ts +325 -0
- package/dist/channel-pairing-DKscOV1K.d.ts +58 -0
- package/dist/channel.runtime-VW6PW_ez.js +697 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/chat-CFkQepUQ.js +3 -0
- package/dist/chat-Czh_tXM0.js +2940 -0
- package/dist/chrome-B2cq8YyH.js +1517 -0
- package/dist/cli/run-main.js +5 -5
- package/dist/cli-compaction-Dxv4nt7R.js +363 -0
- package/dist/cli-runner-CimXSTVs.js +2 -0
- package/dist/cli-runner-orCzE1Sr.js +597 -0
- package/dist/cli-runner.runtime-CsW0dXJW.js +3 -0
- package/dist/cli-runner.runtime-DgPrc1do.js +4 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-startup-metadata.json +10 -12
- package/dist/command-registry-C5ooX6PF.js +4 -0
- package/dist/command-registry-DMB-HKIk.js +9 -0
- package/dist/command-registry-core-B2w_XWvn.js +114 -0
- package/dist/command-status.runtime-Bdy3Dkar.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-compact.runtime-Bk2jTQo6.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-handlers.runtime-Csw1og0U.js +6327 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-mRqmLIVz.d.ts +117 -0
- package/dist/commands-status-Dgrj_ubK.js +3 -0
- package/dist/commands-status-s32HJOpD.js +16 -0
- package/dist/commands-status.runtime-Dgrj_ubK.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-C_hnOO9l.js +2 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-CQV742Cc.js +2 -0
- package/dist/commands-system-prompt-DTfsKwK1.js +161 -0
- package/dist/commands-types-MXHhrssO.d.ts +132 -0
- package/dist/commands.runtime-akiVK67l.js +175 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/compact-U6ZhvPtD.js +1165 -0
- package/dist/compact.runtime-36E5vKsC.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-Bf4mEw2W.js +393 -0
- package/dist/config-BJJhHN9E.js +374 -0
- package/dist/config-mutations-swLu-j_p.js +161 -0
- package/dist/config-schema-Tjner6bM.d.ts +20 -0
- package/dist/context-engine-host-compat-6fkn_daV.js +280 -0
- package/dist/context-engine-host-compat-DtAZC1bS.js +2 -0
- package/dist/context-engine-lifecycle-R__Idxi1.js +627 -0
- package/dist/control-auth-DnkI94_D.js +114 -0
- package/dist/control-service-BBsamNjq.js +40 -0
- package/dist/control-service-BGpHj7RL.js +3 -0
- package/dist/control-ui/assets/activity-B2W-IeAT.js +124 -0
- package/dist/control-ui/assets/agents-mRUyNVCz.js +1030 -0
- package/dist/control-ui/assets/channels-8QHOqBnt.js +120 -0
- package/dist/control-ui/assets/cron-H3unP_mO.js +1016 -0
- package/dist/control-ui/assets/debug-CxLsQ9vH.js +97 -0
- package/dist/control-ui/assets/index-jtIYT0Eh.js +7214 -0
- package/dist/control-ui/assets/instances-B1JQeCRb.js +57 -0
- package/dist/control-ui/assets/nodes-RGOmq_1l.js +444 -0
- package/dist/control-ui/assets/sessions-C2O-Jgpg.js +425 -0
- package/dist/control-ui/assets/skills-jyJOYA4I.js +362 -0
- package/dist/control-ui/assets/workboard-uM_kK8cQ.js +402 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/conversation-runtime-DDekWU-U.js +31 -0
- package/dist/core-Bpk-qSJH.js +284 -0
- package/dist/core-Chrz4oRB.d.ts +223 -0
- package/dist/core-api-DSpUKNVW.js +2 -0
- package/dist/core-api-hLsW03Wo.js +5 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.d.ts +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-C0x7JjF-.js +55 -0
- package/dist/delegate-BArFIZ4B.d.ts +30 -0
- package/dist/deliver-BnVp3VbL.d.ts +111 -0
- package/dist/delivery-queue-BFOASdf5.d.ts +161 -0
- package/dist/delivery-queue-runtime-BFfc8AEs.d.ts +9 -0
- package/dist/dialogue-No0NvYX7.js +37 -0
- package/dist/direct-dm-C-h88JJH.d.ts +79 -0
- package/dist/directive-handling.fast-lane-DTyDKhZb.js +70 -0
- package/dist/directive-handling.impl-DMReM6tu.js +2 -0
- package/dist/directive-handling.impl-DzPouhV-.js +823 -0
- package/dist/directive-handling.model-selection-BjwTBAZJ.js +122 -0
- package/dist/directive-handling.persist.runtime-D_O1okkR.js +274 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/dispatch-Dtl-oRuN.js +2057 -0
- package/dist/dispatch-acp-transcript.runtime-M4y0Dq74.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-B8uCIKZS.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dispatcher-DslvaRcj.js +106 -0
- package/dist/doctor-config-flow-LU2C94af.js +1819 -0
- package/dist/doctor-core-checks-BqcjExIZ.js +666 -0
- package/dist/doctor-core-checks-Diuk8l0N.js +2 -0
- package/dist/doctor-core-checks.runtime-DbS-kMZN.js +278 -0
- package/dist/doctor-core-checks.runtime.js +1 -1
- package/dist/doctor-health-BdqHwfYE.js +65 -0
- package/dist/doctor-health-contributions-DLLTVnll.js +874 -0
- package/dist/doctor-lint-PZqkVMWf.js +95 -0
- package/dist/doctor-mRfJMSb5.js +6 -0
- package/dist/doctor-state-integrity-Cdlm-peH.js +1257 -0
- package/dist/draft-stream-controls-B7uLonbw.d.ts +159 -0
- package/dist/embedded-agent-CEpOPW6X.js +4 -0
- package/dist/embedded-agent-CNINO_M-.d.ts +5 -0
- package/dist/embedded-agent-DxwzoZkp.js +4074 -0
- package/dist/embedded-agent.runtime-DDbhA85-.js +4 -0
- package/dist/embedded-agent.runtime.js +1 -1
- package/dist/embedded-backend-ChaKCepC.js +1581 -0
- package/dist/embedded-gateway-stub.runtime-e_ZxGhcW.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/entry.d.ts +1 -1
- package/dist/extensionAPI.d.ts +2 -2
- package/dist/extensionAPI.js +1 -1
- package/dist/extensions/active-memory/index.d.ts +1 -1
- package/dist/extensions/active-memory/index.js +1 -1
- package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/bonjour/index.d.ts +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-config.js +4 -4
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +2 -2
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +12 -12
- package/dist/extensions/browser/cli-metadata.d.ts +1 -1
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.d.ts +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.d.ts +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.d.ts +2 -2
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.d.ts +3 -3
- package/dist/extensions/browser/runtime-api.js +14 -14
- package/dist/extensions/browser/setup-api.d.ts +1 -1
- package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
- package/dist/extensions/canvas/index.d.ts +1 -1
- package/dist/extensions/canvas/index.js +1 -1
- package/dist/extensions/canvas/setup-api.d.ts +1 -1
- package/dist/extensions/deepseek/api.d.ts +1 -1
- package/dist/extensions/deepseek/index.d.ts +1 -1
- package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
- package/dist/extensions/deepseek/stream.d.ts +1 -1
- package/dist/extensions/device-pair/api.d.ts +4 -4
- package/dist/extensions/device-pair/api.js +1 -1
- package/dist/extensions/device-pair/index.d.ts +1 -1
- package/dist/extensions/device-pair/notify.d.ts +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.d.ts +1 -1
- package/dist/extensions/memory-core/api.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/memory-core/index.d.ts +1 -1
- package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
- package/dist/extensions/memory-core/runtime-api.d.ts +3 -3
- package/dist/extensions/skill-workshop/api.d.ts +2 -2
- package/dist/extensions/skill-workshop/api.js +1 -1
- package/dist/extensions/skill-workshop/index.d.ts +1 -1
- package/dist/extensions/skill-workshop/index.js +2 -2
- package/dist/extensions/tavily/index.d.ts +1 -1
- package/dist/extensions/tavily/web-search-contract-api.d.ts +1 -1
- package/dist/extensions/tavily/web-search-provider.d.ts +1 -1
- package/dist/extensions/thread-ownership/api.d.ts +2 -2
- package/dist/extensions/thread-ownership/index.d.ts +1 -1
- package/dist/extensions/webhooks/api.d.ts +2 -2
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.d.ts +1 -1
- package/dist/extensions/webhooks/index.js +1 -1
- package/dist/extensions/webhooks/runtime-api.d.ts +1 -1
- package/dist/extensions/workboard/api.d.ts +2 -2
- package/dist/extensions/workboard/index.d.ts +1 -1
- package/dist/extensions/workboard/index.js +1 -1
- package/dist/extensions/workboard/runtime-api.d.ts +1 -1
- package/dist/fengming-runtime-CtRd5677.d.ts +153 -0
- package/dist/fengming-tools-DBLsJfsf.js +12221 -0
- package/dist/gateway/protocol/index.d.ts +1 -1
- package/dist/gateway-cli-BgDV2HF9.js +443 -0
- package/dist/gateway-method-runtime-d9oN_XO9.js +21 -0
- package/dist/get-reply-CEMtvaTJ.js +5198 -0
- package/dist/get-reply-from-config.runtime-CE8zmX7o.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/heartbeat-runner-H8SmaKmJ.js +5 -0
- package/dist/heartbeat-runner.runtime-6hUaxEbl.js +3 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/hooks-DkEvkwzS.js +536 -0
- package/dist/host-compat-DeAq3dnI.d.ts +21 -0
- package/dist/http-registry-BDoApjTY.d.ts +23 -0
- package/dist/inbound-reply-dispatch-CIYP2OPo.d.ts +156 -0
- package/dist/inbound-reply-dispatch-geHu6oUK.js +147 -0
- package/dist/inbound-reply-dispatch-vwW5Hl-_.js +2 -0
- package/dist/index-DhOQs6M_.d.ts +1497 -0
- package/dist/index.js +1 -1
- package/dist/init-DpE_6dG4.js +59 -0
- package/dist/interactive-Cb_1f91G.d.ts +26 -0
- package/dist/isolated-agent-B_upYOOM.js +2 -0
- package/dist/isolated-agent-KH9uwWhw.js +1097 -0
- package/dist/kernel-BHnBXnm2.d.ts +241 -0
- package/dist/lifecycle-BmZwopzF.js +570 -0
- package/dist/list.probe-5kzWm9Jk.js +451 -0
- package/dist/list.probe-9zBcGGQ4.js +2 -0
- package/dist/list.status-command-DY2ifqp1.js +815 -0
- package/dist/llm-slug-generator-Bmx0I84M.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/loader-BVz75gSb.d.ts +142 -0
- package/dist/local-dispatch.runtime-CX3IOY1E.js +10 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/manager-BXGg8bfG.d.ts +409 -0
- package/dist/mcp-http-B1lnh67s.js +2 -0
- package/dist/mcp-http-CamghE-W.js +583 -0
- package/dist/media-runtime-DpykroJR.d.ts +261 -0
- package/dist/memory-core-host-engine-embeddings-N2dX5P40.d.ts +324 -0
- package/dist/memory-core-host-engine-storage-WQfkQMer.d.ts +54 -0
- package/dist/message-handler-Ca_pqGVS.js +1806 -0
- package/dist/model-catalog-BBMLIjhq.d.ts +88 -0
- package/dist/model-selection-Cq82FXLy.js +352 -0
- package/dist/models-cli-Dm_393dw.js +257 -0
- package/dist/monitor-d0eyE2k0.js +60 -0
- package/dist/monitor.account-vLQ3bKHu.js +5382 -0
- package/dist/nodes-Bunvrb33.js +1483 -0
- package/dist/nodes-edNlxb2I.js +3 -0
- package/dist/nodes-pending-DEIwVh9v.js +211 -0
- package/dist/openai-compat-errors-CvWEoG98.js +136 -0
- package/dist/openai-http-Bskdv4Tv.js +836 -0
- package/dist/openresponses-http-DxdgCxFU.js +1175 -0
- package/dist/operations-Z85LFqsT.js +805 -0
- package/dist/outbound.types-DVkbsxo8.d.ts +291 -0
- package/dist/plugin-enabled-fvhTpvYS.js +232 -0
- package/dist/plugin-entry-CunlVUw6.d.ts +47 -0
- package/dist/plugin-registration-9ovnK_Tk.js +97 -0
- package/dist/plugin-runtime-DH2ZM9P5.d.ts +117 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +1 -1
- package/dist/plugin-sdk/agent-harness-runtime.js +5 -5
- package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
- package/dist/plugin-sdk/agent-harness.js +6 -6
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/bundled-channel-config-schema-Dfn3b8sF.d.ts +3169 -0
- package/dist/plugin-sdk/bundled-channel-config-schema.d.ts +1 -1
- package/dist/plugin-sdk/channel-config-schema-legacy.d.ts +1 -1
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-envelope.js +1 -1
- package/dist/plugin-sdk/channel-inbound-roots.js +1 -1
- package/dist/plugin-sdk/channel-inbound.js +2 -2
- package/dist/plugin-sdk/channel-location.js +1 -1
- package/dist/plugin-sdk/channel-message-runtime.js +3 -3
- package/dist/plugin-sdk/channel-message.js +2 -2
- package/dist/plugin-sdk/channel-runtime.js +0 -1
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/config-schema.d.ts +4 -4
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/discord.d.ts +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/health.js +1 -1
- package/dist/plugin-sdk/hook-runtime.js +0 -1
- package/dist/plugin-sdk/inbound-reply-dispatch.js +2 -2
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +3 -1
- package/dist/plugin-sdk/provider-auth-api-key.js +0 -1
- package/dist/plugin-sdk/provider-stream-family.js +0 -1
- package/dist/plugin-sdk/provider-usage.js +649 -1
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/video-generation.js +206 -1
- package/dist/plugin-service-BdZxoKBZ.js +1249 -0
- package/dist/plugin-service-quTl5hT0.d.ts +24 -0
- package/dist/plugins/build-smoke-entry.d.ts +2 -2
- package/dist/plugins/loader.d.ts +1 -1
- package/dist/plugins/provider-discovery.runtime.d.ts +1 -1
- package/dist/plugins/provider-runtime.runtime.d.ts +1 -1
- package/dist/plugins/runtime/index.d.ts +1 -1
- package/dist/plugins/runtime/index.js +4 -4
- package/dist/plugins/tools.d.ts +1 -1
- package/dist/prepare.runtime-DFvkUqBZ.js +798 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-CGzc8ccG.js +618 -0
- package/dist/program-D19g2jaa.js +131 -0
- package/dist/provider-api-key-auth-B8GgTfo8.d.ts +27 -0
- package/dist/provider-auth-result-Diw-woMA.d.ts +21 -0
- package/dist/provider-catalog-shared-hMvzzDgL.d.ts +62 -0
- package/dist/provider-dispatcher-DCTc4lG_.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-model-shared-BUCh3uCL.d.ts +143 -0
- package/dist/provider-registry-BIokPlxa.d.ts +8 -0
- package/dist/provider-registry-CyUOXHG-.d.ts +8 -0
- package/dist/provider-registry-i--H79Ao.d.ts +29 -0
- package/dist/provider-self-hosted-setup-BF8UR8wg.d.ts +74 -0
- package/dist/provider-stream-NF0XJnar.d.ts +139 -0
- package/dist/provider-stream-shared-DLwDaYed.d.ts +132 -0
- package/dist/provider-web-search-contract-fields-D61Vl5Kl.d.ts +25 -0
- package/dist/pw-ai-DYR-D7xR.js +3064 -0
- package/dist/register.agent-DwW0mQPk.js +152 -0
- package/dist/register.crestodian-BhIukKDA.js +24 -0
- package/dist/register.maintenance-DWHlvztJ.js +85 -0
- package/dist/register.subclis-Bsvdh8RI.js +3 -0
- package/dist/register.subclis-DVk0HU4k.js +31 -0
- package/dist/register.subclis-core-BK7nVvl6.js +278 -0
- package/dist/registry-hscEPAcC.d.ts +8 -0
- package/dist/registry-types-Ce-n1tuw.d.ts +392 -0
- package/dist/repair-sequencing-0-qGNSUO.js +652 -0
- package/dist/reply-payload-mCw4ZND6.d.ts +200 -0
- package/dist/reply-turn-admission-DMWNadoS.js +2056 -0
- package/dist/reply.runtime-CE8zmX7o.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/result-fallback-classifier-BZmv2ACy.js +98 -0
- package/dist/route-qQ-jYpFa.js +475 -0
- package/dist/routes-dTCmw98g.js +2 -0
- package/dist/routes-r8DRKa83.js +3701 -0
- package/dist/run-BgH7EPGH.js +1162 -0
- package/dist/run-command-DCsM-BVh.js +23 -0
- package/dist/run-command-I2ib4dwS.js +2 -0
- package/dist/run-context-CWaKUKKJ.js +66 -0
- package/dist/run-embedded.runtime-CBnDBWN0.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-DlYXI-lw.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime-DwepGrmB.js +330 -0
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-subagent-registry.runtime-CeVpoIhj.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runtime-D2ee-rNh.js +436 -0
- package/dist/runtime-api-B99ZlkNt.d.ts +5 -0
- package/dist/runtime-api-Cta2L_Yo.js +12 -0
- package/dist/runtime-channel-LKOkML3M.js +2 -0
- package/dist/runtime-channel-UtWvrTZ5.js +148 -0
- package/dist/runtime-embedded-agent.runtime-9O2Idzyb.js +2 -0
- package/dist/runtime-embedded-agent.runtime.js +1 -1
- package/dist/runtime-forwarders-DjI8RFL5.d.ts +39 -0
- package/dist/sdk-setup-tools-B-X04pa6.js +8 -0
- package/dist/selection-B02h8Old.js +3 -0
- package/dist/selection-DEPvzrW2.js +18365 -0
- package/dist/server-CMYi8gDo.js +24 -0
- package/dist/server-Cx07rsiY.js +72 -0
- package/dist/server-close.runtime.js +1 -1
- package/dist/server-context-BIemGRt4.js +2 -0
- package/dist/server-context-CB_an9iy.js +955 -0
- package/dist/server-cron-BeyuBUjb.js +3173 -0
- package/dist/server-cron-CV7KkVeB.js +2 -0
- package/dist/server-methods-C7EnpOhB.js +497 -0
- package/dist/server-node-events-DMMzZciN.js +597 -0
- package/dist/server-plugin-bootstrap-O6MzvzL8.js +71 -0
- package/dist/server-plugins-Dwnaz9kX.js +435 -0
- package/dist/server-reload-handlers-C-6TyPvI.js +719 -0
- package/dist/server-restart-sentinel-Dc35eYgk.js +700 -0
- package/dist/server-runtime-services-DCs-gqh_.js +3 -0
- package/dist/server-runtime-services-DF2fzzVd.js +147 -0
- package/dist/server-startup-plugins-t-YeYibm.js +127 -0
- package/dist/server-startup-post-attach-CiEki-DC.js +793 -0
- package/dist/server-ws-runtime-uaUpI-e8.js +374 -0
- package/dist/server.impl-MoHjSMr5.js +2622 -0
- package/dist/session-kill-http-CYCiQpt2.js +121 -0
- package/dist/session-reset-service-BYbADY57.js +651 -0
- package/dist/session-status.runtime-8NASbeO4.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-DGeNY2Rb.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-C2eElZrt.js +551 -0
- package/dist/sessions-DXAdVXIx.js +1917 -0
- package/dist/sessions-history-http-BwK7b8OH.js +432 -0
- package/dist/sessions-patch-BYC5gvY1.js +401 -0
- package/dist/sessions-resolve-C3ORcdmo.js +180 -0
- package/dist/sessions.runtime-BijldeSY.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/snapshot-urls-C5CfP3Co.js +317 -0
- package/dist/speech-core-wWkTZPpQ.d.ts +49 -0
- package/dist/standalone-CHrieUsw.js +42 -0
- package/dist/startup-context-CZfmG8-g.js +314 -0
- package/dist/status-subagents.runtime-D2XMebiS.js +32 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-JR7IPyzZ.js +301 -0
- package/dist/stream-BJgTkLEI.d.ts +5 -0
- package/dist/subagent-announce-B9cfs_KZ.js +353 -0
- package/dist/subagent-announce-delivery-CtmEvLTS.js +1369 -0
- package/dist/subagent-control-DVqLHi9O.js +492 -0
- package/dist/subagent-hooks-D251uSvy.js +230 -0
- package/dist/subagent-hooks-api-DvdMKxsC.js +23 -0
- package/dist/subagent-hooks-uLORYChc.js +2 -0
- package/dist/subagent-registry-BW2l_oYu.js +3 -0
- package/dist/subagent-registry-BxEMHuiN.js +2627 -0
- package/dist/subagent-registry.runtime.d.ts +1 -1
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-session-cleanup-BC5wV2qQ.js +390 -0
- package/dist/system-fvgHsr2x.js +111 -0
- package/dist/talk-DU0Sod_K.js +2454 -0
- package/dist/target-id-BR2xJIkd.js +107 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/thread-bindings-8XNu5U2p.js +228 -0
- package/dist/tool-Boeg0N5g.js +143 -0
- package/dist/tool-dispatch-BhLLaL2g.js +155 -0
- package/dist/tool-resolution-CzsLs-87.js +153 -0
- package/dist/tool-split-Bedy42Ms.d.ts +19 -0
- package/dist/tools-B6egHpE3.d.ts +38 -0
- package/dist/tools-effective-NXscxK8n.js +442 -0
- package/dist/tools-effective-inventory-NsGMUVo-.js +379 -0
- package/dist/tools-invoke-_sSu96Kq.js +51 -0
- package/dist/tools-invoke-http-BDhlRl-G.js +68 -0
- package/dist/tools-invoke-shared-BH-T9Bcg.js +200 -0
- package/dist/tts-runtime-C1wu3o15.d.ts +230 -0
- package/dist/tui-C733Qov0.js +2 -0
- package/dist/tui-DqbscVN5.js +3 -0
- package/dist/tui-backend-_Pn3Byj-.js +257 -0
- package/dist/tui-cli-CAiC39zd.js +40 -0
- package/dist/tui-ink-run-ChXEGj1h.js +7414 -0
- package/dist/tui-ink-run-D4mSfLHj.js +2 -0
- package/dist/types-BQw1qXGl.d.ts +7034 -0
- package/dist/types-BzMoU6-C.d.ts +111 -0
- package/dist/types-DltHmoCX.d.ts +393 -0
- package/dist/types.public-C_bVIMBl.d.ts +70 -0
- package/dist/web-fetch/runtime.d.ts +1 -1
- package/dist/webhook-targets-DW2jhddP.d.ts +99 -0
- package/dist/zod-schema.core-Cuz0lz6m.d.ts +166 -0
- package/npm-shrinkwrap.json +12861 -11889
- package/package.json +2 -5
- package/skills/batch/SKILL.md +118 -0
- package/skills/code-review/SKILL.md +107 -0
- package/skills/debug/SKILL.md +83 -0
- package/skills/loop/SKILL.md +118 -0
- package/skills/run/SKILL.md +79 -0
- package/skills/run-skill-generator/SKILL.md +179 -0
- package/skills/verify/SKILL.md +103 -0
- package/dist/abort-DGskei2p.js +0 -277
- package/dist/abort.runtime-Buq9IZxn.js +0 -2
- package/dist/acp-spawn-DC6IyYaB.js +0 -1286
- package/dist/acp-spawn-Diqb3nel.js +0 -2
- package/dist/acp-stateful-target-driver-Clhe_L8v.js +0 -89
- package/dist/active-tool-schema-warnings-BRhKkyvt.js +0 -2
- package/dist/active-tool-schema-warnings-C6N0-ce6.js +0 -105
- package/dist/agent-C5lhsEZJ.js +0 -2
- package/dist/agent-WEb757bl.js +0 -1825
- package/dist/agent-command-iLD_nsVY.js +0 -1435
- package/dist/agent-core-BeDN8Ns5.d.ts +0 -13
- package/dist/agent-harness-runtime-C89_Q-bW.d.ts +0 -913
- package/dist/agent-harness-runtime-Dfn5rik2.js +0 -207
- package/dist/agent-runner-utils-DNiuuo43.js +0 -267
- package/dist/agent-runner.runtime-CFF_qJ5V.js +0 -3784
- package/dist/agent-runtime-BkMtWXxn.js +0 -199
- package/dist/agent-runtime-HufMO_YR.d.ts +0 -207
- package/dist/agent-tools-HmaDv4ot.js +0 -2506
- package/dist/agent-via-gateway-CZQG8RYL.js +0 -486
- package/dist/agent-wait-dedupe-C3xQk2Ww.js +0 -180
- package/dist/agent-z1cs3c7n.js +0 -3
- package/dist/api-B4IMKjSe.js +0 -3
- package/dist/api-BwSbBWI8.js +0 -3
- package/dist/api-CE9In9m4.js +0 -5
- package/dist/api-ClPvYNGa.js +0 -32
- package/dist/api-CntBCaZf.js +0 -3
- package/dist/api-DBZBwTsn.js +0 -6
- package/dist/api-OCPwGOvK.js +0 -2
- package/dist/api-yYhEo7gK.js +0 -4
- package/dist/approval-client-helpers-CfdQ3-vv.d.ts +0 -78
- package/dist/approval-native-helpers-DSHPksK4.d.ts +0 -241
- package/dist/approval-renderers-BfEfwk44.d.ts +0 -39
- package/dist/assistant-v5fdOYu7.js +0 -291
- package/dist/attachment-normalize-BHAbLiL2.js +0 -213
- package/dist/attempt-execution-5w9WYbaJ.js +0 -584
- package/dist/attempt-execution.runtime-DnhOWGzr.js +0 -3
- package/dist/attempt.prompt-helpers-C4M4erF7.js +0 -543
- package/dist/binding-routing-Dpes-QF1.js +0 -113
- package/dist/binding-targets-B6H5Pd-A.js +0 -121
- package/dist/bridge-server-BCpxCRm_.js +0 -113
- package/dist/browser-cli-DMhXHopl.js +0 -230
- package/dist/browser-cli-Dy_VugK0.js +0 -2
- package/dist/browser-cli-actions-input-WMP7_lm6.js +0 -522
- package/dist/browser-cli-actions-observe-DQWAWhwU.js +0 -81
- package/dist/browser-cli-debug-CaT2ZKAx.js +0 -137
- package/dist/browser-cli-inspect-DU-LUXq1.js +0 -117
- package/dist/browser-cli-manage-DAuogqIh.js +0 -446
- package/dist/browser-cli-resize-Cz5uO_aR.js +0 -32
- package/dist/browser-cli-shared-CjPZcG3j.js +0 -69
- package/dist/browser-cli-state-CC3l77-K.js +0 -371
- package/dist/browser-control-auth-ELccIUZy.js +0 -2
- package/dist/browser-profiles-Cuy4ia6_.js +0 -2
- package/dist/browser-runtime-De-iUfME.js +0 -389
- package/dist/build-DEF8Per9.js +0 -261
- package/dist/bundled-channel-config-schema-Bte--ZlY.d.ts +0 -3168
- package/dist/capability-cli-Bydel4E7.js +0 -1809
- package/dist/channel-6SGL4R5P.js +0 -2309
- package/dist/channel-D3Q3b8J-.d.ts +0 -427
- package/dist/channel-core-Bj71kAB5.d.ts +0 -6
- package/dist/channel-core-DMvyWnHg.js +0 -5
- package/dist/channel-entry-contract-zYxRmEdf.d.ts +0 -114
- package/dist/channel-inbound-DVJzBcJ8.d.ts +0 -97
- package/dist/channel-inbound-DlCa7eJe.js +0 -121
- package/dist/channel-message-CyPGMMFB.js +0 -12
- package/dist/channel-message-Czl4cdoA.d.ts +0 -9
- package/dist/channel-outbound-BNbhmruA.d.ts +0 -325
- package/dist/channel-pairing-BiS-tSvl.d.ts +0 -58
- package/dist/channel-runtime-D8hntg7H.js +0 -7
- package/dist/channel.runtime-DxErReJR.js +0 -697
- package/dist/chat-BLA8ORQI.js +0 -3
- package/dist/chat-DWRXkuvU.js +0 -2940
- package/dist/chrome-DPwFYi-g.js +0 -1517
- package/dist/cli-compaction-YZpssARf.js +0 -363
- package/dist/cli-runner-D2OAqxu3.js +0 -597
- package/dist/cli-runner-DO4SORQf.js +0 -2
- package/dist/cli-runner.runtime-CNSIpbeT.js +0 -4
- package/dist/cli-runner.runtime-DAOYvpVQ.js +0 -3
- package/dist/command-registry-DpD0fb8D.js +0 -4
- package/dist/command-registry-core-Cl3tLG8G.js +0 -114
- package/dist/command-registry-nbP7c8RT.js +0 -9
- package/dist/command-status.runtime-BBuXTkq0.js +0 -90
- package/dist/commands-CR8MVvlD.d.ts +0 -117
- package/dist/commands-compact.runtime-BoafIjjg.js +0 -10
- package/dist/commands-handlers.runtime-D9jViG_x.js +0 -6327
- package/dist/commands-status-BqqJ7PVq.js +0 -16
- package/dist/commands-status-CMd41Vxf.js +0 -3
- package/dist/commands-status.runtime-CMd41Vxf.js +0 -3
- package/dist/commands-subagents-control.runtime-CU4I3A_n.js +0 -2
- package/dist/commands-system-prompt-CTtu1D3-.js +0 -2
- package/dist/commands-system-prompt-xswhORdM.js +0 -161
- package/dist/commands-types-B67CsqXf.d.ts +0 -132
- package/dist/commands.runtime-BUFhkrjQ.js +0 -175
- package/dist/compact-Dz_WvRkQ.js +0 -1165
- package/dist/compact.runtime-n-AKErni.js +0 -12
- package/dist/completion-cli-DJYs_L4_.js +0 -393
- package/dist/config-CFMbHJb0.js +0 -374
- package/dist/config-mutations-DCAloTKR.js +0 -161
- package/dist/config-schema-Drw1zrnG.d.ts +0 -20
- package/dist/context-engine-host-compat-4mNm1HCE.js +0 -2
- package/dist/context-engine-host-compat-BzJ7fUIn.js +0 -280
- package/dist/context-engine-lifecycle-V4PNQp6k.js +0 -627
- package/dist/control-auth-DG_cw-aN.js +0 -114
- package/dist/control-service-CurYipgK.js +0 -3
- package/dist/control-service-VyncoV7j.js +0 -40
- package/dist/control-ui/assets/activity-D5Plhlo-.js +0 -124
- package/dist/control-ui/assets/agents-Chcdfe1E.js +0 -1030
- package/dist/control-ui/assets/channels-BEtB4H37.js +0 -120
- package/dist/control-ui/assets/cron-CZyPkxSU.js +0 -1016
- package/dist/control-ui/assets/debug-DvM8iG47.js +0 -97
- package/dist/control-ui/assets/index-Rmpgh0f1.js +0 -7214
- package/dist/control-ui/assets/instances-yTC_uu60.js +0 -57
- package/dist/control-ui/assets/nodes-vbAxVHIH.js +0 -444
- package/dist/control-ui/assets/sessions-DOviHme5.js +0 -425
- package/dist/control-ui/assets/skills-Bfp5HEGW.js +0 -362
- package/dist/control-ui/assets/workboard-5sU2kHsV.js +0 -402
- package/dist/conversation-runtime-DgaABwHh.js +0 -31
- package/dist/core-BeBXdneV.js +0 -284
- package/dist/core-Chqb7X6l.d.ts +0 -223
- package/dist/core-api-BlK0FgBM.js +0 -2
- package/dist/core-api-pAvYk716.js +0 -5
- package/dist/crestodian-FeGTBqO1.js +0 -55
- package/dist/delegate-BjIjSU_E.d.ts +0 -30
- package/dist/deliver-CvtWN4Ey.d.ts +0 -111
- package/dist/delivery-queue-CQ-cj3KG.d.ts +0 -161
- package/dist/delivery-queue-runtime-ut7MG04m.d.ts +0 -9
- package/dist/detect-BjXPyrwn.js +0 -115
- package/dist/detect-C1xeIemQ.d.ts +0 -16
- package/dist/dialogue-BowVYhEC.js +0 -37
- package/dist/direct-dm-DoZZHpA0.d.ts +0 -79
- package/dist/directive-handling.fast-lane-hnmQ_CvD.js +0 -70
- package/dist/directive-handling.impl-Cai-CFS1.js +0 -2
- package/dist/directive-handling.impl-DY84qIfU.js +0 -823
- package/dist/directive-handling.model-selection-DASssLFQ.js +0 -122
- package/dist/directive-handling.persist.runtime-BY7tJUs2.js +0 -274
- package/dist/dispatch-D5iG5A8j.js +0 -2057
- package/dist/dispatch-acp-transcript.runtime-D3r16hbD.js +0 -40
- package/dist/dispatch-acp.runtime-CAIau5qX.js +0 -18
- package/dist/dispatcher-7-d2gw3J.js +0 -106
- package/dist/doctor-DD5YEMmf.js +0 -6
- package/dist/doctor-config-flow-CdlLHJmX.js +0 -1819
- package/dist/doctor-core-checks-6MP99TQG.js +0 -666
- package/dist/doctor-core-checks-Dm_o576z.js +0 -2
- package/dist/doctor-core-checks.runtime-B2qbKATd.js +0 -278
- package/dist/doctor-health-BKrhOv1v.js +0 -65
- package/dist/doctor-health-contributions-bIBLmw69.js +0 -874
- package/dist/doctor-lint-aOLOWli4.js +0 -95
- package/dist/doctor-state-integrity-23NQNNuo.js +0 -1257
- package/dist/draft-stream-controls-Bk1GVJ1l.d.ts +0 -159
- package/dist/embedded-agent-BeK8FhZr.d.ts +0 -5
- package/dist/embedded-agent-CNp_y7jW.js +0 -4074
- package/dist/embedded-agent-NEmNlXDR.js +0 -4
- package/dist/embedded-agent.runtime-hEby8P2s.js +0 -4
- package/dist/embedded-backend-BdbgfpBP.js +0 -1581
- package/dist/embedded-gateway-stub.runtime-ySZUA3Gy.js +0 -12
- package/dist/extensions/alibaba/fengming.plugin.json +0 -47
- package/dist/extensions/alibaba/index.d.ts +0 -12
- package/dist/extensions/alibaba/index.js +0 -13
- package/dist/extensions/alibaba/package.json +0 -15
- package/dist/extensions/alibaba/video-generation-provider.d.ts +0 -6
- package/dist/extensions/alibaba/video-generation-provider.js +0 -2
- package/dist/extensions/baichuan/fengming.plugin.json +0 -69
- package/dist/extensions/baichuan/index.d.ts +0 -11
- package/dist/extensions/baichuan/index.js +0 -45
- package/dist/extensions/baichuan/models.d.ts +0 -7
- package/dist/extensions/baichuan/models.js +0 -2
- package/dist/extensions/baichuan/onboard.d.ts +0 -5
- package/dist/extensions/baichuan/onboard.js +0 -2
- package/dist/extensions/baichuan/package.json +0 -15
- package/dist/extensions/baichuan/provider-catalog.d.ts +0 -2
- package/dist/extensions/baichuan/provider-catalog.js +0 -2
- package/dist/extensions/baichuan/provider-discovery.d.ts +0 -2
- package/dist/extensions/baichuan/provider-discovery.js +0 -5
- package/dist/extensions/byteplus/api.d.ts +0 -3
- package/dist/extensions/byteplus/api.js +0 -3
- package/dist/extensions/byteplus/fengming.plugin.json +0 -196
- package/dist/extensions/byteplus/index.d.ts +0 -12
- package/dist/extensions/byteplus/index.js +0 -85
- package/dist/extensions/byteplus/models.d.ts +0 -2
- package/dist/extensions/byteplus/models.js +0 -2
- package/dist/extensions/byteplus/package.json +0 -15
- package/dist/extensions/byteplus/provider-catalog.d.ts +0 -2
- package/dist/extensions/byteplus/provider-catalog.js +0 -2
- package/dist/extensions/byteplus/provider-discovery.d.ts +0 -5
- package/dist/extensions/byteplus/provider-discovery.js +0 -23
- package/dist/extensions/byteplus/video-generation-provider.d.ts +0 -6
- package/dist/extensions/byteplus/video-generation-provider.js +0 -2
- package/dist/extensions/longcat/fengming.plugin.json +0 -84
- package/dist/extensions/longcat/index.d.ts +0 -11
- package/dist/extensions/longcat/index.js +0 -45
- package/dist/extensions/longcat/models.d.ts +0 -7
- package/dist/extensions/longcat/models.js +0 -2
- package/dist/extensions/longcat/onboard.d.ts +0 -5
- package/dist/extensions/longcat/onboard.js +0 -2
- package/dist/extensions/longcat/package.json +0 -15
- package/dist/extensions/longcat/provider-catalog.d.ts +0 -2
- package/dist/extensions/longcat/provider-catalog.js +0 -2
- package/dist/extensions/longcat/provider-discovery.d.ts +0 -2
- package/dist/extensions/longcat/provider-discovery.js +0 -5
- package/dist/extensions/minimax/api.d.ts +0 -5
- package/dist/extensions/minimax/api.js +0 -6
- package/dist/extensions/minimax/fengming.plugin.json +0 -206
- package/dist/extensions/minimax/image-generation-provider.d.ts +0 -6
- package/dist/extensions/minimax/image-generation-provider.js +0 -2
- package/dist/extensions/minimax/index.d.ts +0 -12
- package/dist/extensions/minimax/index.js +0 -29
- package/dist/extensions/minimax/media-understanding-provider.d.ts +0 -6
- package/dist/extensions/minimax/media-understanding-provider.js +0 -2
- package/dist/extensions/minimax/model-definitions.d.ts +0 -2
- package/dist/extensions/minimax/model-definitions.js +0 -2
- package/dist/extensions/minimax/music-generation-provider.d.ts +0 -6
- package/dist/extensions/minimax/music-generation-provider.js +0 -2
- package/dist/extensions/minimax/oauth.d.ts +0 -2
- package/dist/extensions/minimax/oauth.js +0 -2
- package/dist/extensions/minimax/oauth.runtime.d.ts +0 -2
- package/dist/extensions/minimax/oauth.runtime.js +0 -2
- package/dist/extensions/minimax/onboard.d.ts +0 -2
- package/dist/extensions/minimax/onboard.js +0 -2
- package/dist/extensions/minimax/package.json +0 -15
- package/dist/extensions/minimax/provider-catalog.d.ts +0 -2
- package/dist/extensions/minimax/provider-catalog.js +0 -2
- package/dist/extensions/minimax/provider-contract-api.d.ts +0 -6
- package/dist/extensions/minimax/provider-contract-api.js +0 -77
- package/dist/extensions/minimax/provider-discovery.d.ts +0 -5
- package/dist/extensions/minimax/provider-discovery.js +0 -23
- package/dist/extensions/minimax/provider-models.d.ts +0 -2
- package/dist/extensions/minimax/provider-models.js +0 -2
- package/dist/extensions/minimax/provider-registration.d.ts +0 -7
- package/dist/extensions/minimax/provider-registration.js +0 -2
- package/dist/extensions/minimax/speech-provider.d.ts +0 -5
- package/dist/extensions/minimax/speech-provider.js +0 -2
- package/dist/extensions/minimax/tts.d.ts +0 -20
- package/dist/extensions/minimax/tts.js +0 -2
- package/dist/extensions/minimax/video-generation-provider.d.ts +0 -7
- package/dist/extensions/minimax/video-generation-provider.js +0 -2
- package/dist/extensions/minimax/web-search-contract-api.d.ts +0 -5
- package/dist/extensions/minimax/web-search-contract-api.js +0 -31
- package/dist/extensions/minimax/web-search-provider.d.ts +0 -5
- package/dist/extensions/minimax/web-search-provider.js +0 -2
- package/dist/extensions/moonshot/api.d.ts +0 -3
- package/dist/extensions/moonshot/api.js +0 -4
- package/dist/extensions/moonshot/fengming.plugin.json +0 -250
- package/dist/extensions/moonshot/index.d.ts +0 -11
- package/dist/extensions/moonshot/index.js +0 -70
- package/dist/extensions/moonshot/media-understanding-provider.d.ts +0 -6
- package/dist/extensions/moonshot/media-understanding-provider.js +0 -2
- package/dist/extensions/moonshot/onboard.d.ts +0 -2
- package/dist/extensions/moonshot/onboard.js +0 -2
- package/dist/extensions/moonshot/package.json +0 -15
- package/dist/extensions/moonshot/provider-catalog.d.ts +0 -2
- package/dist/extensions/moonshot/provider-catalog.js +0 -2
- package/dist/extensions/moonshot/provider-contract-api.d.ts +0 -5
- package/dist/extensions/moonshot/provider-contract-api.js +0 -27
- package/dist/extensions/moonshot/provider-discovery.d.ts +0 -5
- package/dist/extensions/moonshot/provider-discovery.js +0 -15
- package/dist/extensions/moonshot/web-search-contract-api.d.ts +0 -5
- package/dist/extensions/moonshot/web-search-contract-api.js +0 -29
- package/dist/extensions/moonshot/web-search-provider.d.ts +0 -5
- package/dist/extensions/moonshot/web-search-provider.js +0 -2
- package/dist/extensions/qianfan/api.d.ts +0 -3
- package/dist/extensions/qianfan/api.js +0 -3
- package/dist/extensions/qianfan/fengming.plugin.json +0 -89
- package/dist/extensions/qianfan/index.d.ts +0 -11
- package/dist/extensions/qianfan/index.js +0 -26
- package/dist/extensions/qianfan/onboard.d.ts +0 -2
- package/dist/extensions/qianfan/onboard.js +0 -2
- package/dist/extensions/qianfan/package.json +0 -15
- package/dist/extensions/qianfan/provider-catalog.d.ts +0 -2
- package/dist/extensions/qianfan/provider-catalog.js +0 -2
- package/dist/extensions/qwen/api.d.ts +0 -4
- package/dist/extensions/qwen/api.js +0 -5
- package/dist/extensions/qwen/fengming.plugin.json +0 -389
- package/dist/extensions/qwen/index.d.ts +0 -11
- package/dist/extensions/qwen/index.js +0 -202
- package/dist/extensions/qwen/media-understanding-provider.d.ts +0 -6
- package/dist/extensions/qwen/media-understanding-provider.js +0 -2
- package/dist/extensions/qwen/model-definitions.d.ts +0 -2
- package/dist/extensions/qwen/model-definitions.js +0 -2
- package/dist/extensions/qwen/models.d.ts +0 -2
- package/dist/extensions/qwen/models.js +0 -2
- package/dist/extensions/qwen/onboard.d.ts +0 -21
- package/dist/extensions/qwen/onboard.js +0 -2
- package/dist/extensions/qwen/package.json +0 -15
- package/dist/extensions/qwen/provider-catalog.d.ts +0 -2
- package/dist/extensions/qwen/provider-catalog.js +0 -2
- package/dist/extensions/qwen/stream.d.ts +0 -2
- package/dist/extensions/qwen/stream.js +0 -2
- package/dist/extensions/qwen/video-generation-provider.d.ts +0 -6
- package/dist/extensions/qwen/video-generation-provider.js +0 -2
- package/dist/extensions/sensenova/fengming.plugin.json +0 -69
- package/dist/extensions/sensenova/index.d.ts +0 -11
- package/dist/extensions/sensenova/index.js +0 -45
- package/dist/extensions/sensenova/models.d.ts +0 -7
- package/dist/extensions/sensenova/models.js +0 -2
- package/dist/extensions/sensenova/onboard.d.ts +0 -5
- package/dist/extensions/sensenova/onboard.js +0 -2
- package/dist/extensions/sensenova/package.json +0 -15
- package/dist/extensions/sensenova/provider-catalog.d.ts +0 -2
- package/dist/extensions/sensenova/provider-catalog.js +0 -2
- package/dist/extensions/sensenova/provider-discovery.d.ts +0 -2
- package/dist/extensions/sensenova/provider-discovery.js +0 -5
- package/dist/extensions/stepfun/fengming.plugin.json +0 -162
- package/dist/extensions/stepfun/index.d.ts +0 -12
- package/dist/extensions/stepfun/index.js +0 -165
- package/dist/extensions/stepfun/onboard.d.ts +0 -7
- package/dist/extensions/stepfun/onboard.js +0 -2
- package/dist/extensions/stepfun/package.json +0 -15
- package/dist/extensions/stepfun/provider-catalog.d.ts +0 -14
- package/dist/extensions/stepfun/provider-catalog.js +0 -2
- package/dist/extensions/tencent/api.d.ts +0 -3
- package/dist/extensions/tencent/api.js +0 -4
- package/dist/extensions/tencent/fengming.plugin.json +0 -105
- package/dist/extensions/tencent/index.d.ts +0 -12
- package/dist/extensions/tencent/index.js +0 -62
- package/dist/extensions/tencent/models.d.ts +0 -2
- package/dist/extensions/tencent/models.js +0 -2
- package/dist/extensions/tencent/onboard.d.ts +0 -6
- package/dist/extensions/tencent/onboard.js +0 -2
- package/dist/extensions/tencent/package.json +0 -15
- package/dist/extensions/tencent/provider-catalog.d.ts +0 -2
- package/dist/extensions/tencent/provider-catalog.js +0 -2
- package/dist/extensions/tencent/provider-discovery.d.ts +0 -5
- package/dist/extensions/tencent/provider-discovery.js +0 -14
- package/dist/extensions/tiangong/fengming.plugin.json +0 -69
- package/dist/extensions/tiangong/index.d.ts +0 -11
- package/dist/extensions/tiangong/index.js +0 -45
- package/dist/extensions/tiangong/models.d.ts +0 -7
- package/dist/extensions/tiangong/models.js +0 -2
- package/dist/extensions/tiangong/onboard.d.ts +0 -5
- package/dist/extensions/tiangong/onboard.js +0 -2
- package/dist/extensions/tiangong/package.json +0 -15
- package/dist/extensions/tiangong/provider-catalog.d.ts +0 -2
- package/dist/extensions/tiangong/provider-catalog.js +0 -2
- package/dist/extensions/tiangong/provider-discovery.d.ts +0 -2
- package/dist/extensions/tiangong/provider-discovery.js +0 -5
- package/dist/extensions/volcengine/api.d.ts +0 -12
- package/dist/extensions/volcengine/api.js +0 -4
- package/dist/extensions/volcengine/fengming.plugin.json +0 -263
- package/dist/extensions/volcengine/index.d.ts +0 -12
- package/dist/extensions/volcengine/index.js +0 -88
- package/dist/extensions/volcengine/models.d.ts +0 -2
- package/dist/extensions/volcengine/models.js +0 -2
- package/dist/extensions/volcengine/package.json +0 -15
- package/dist/extensions/volcengine/provider-catalog.d.ts +0 -2
- package/dist/extensions/volcengine/provider-catalog.js +0 -2
- package/dist/extensions/volcengine/provider-discovery.d.ts +0 -5
- package/dist/extensions/volcengine/provider-discovery.js +0 -23
- package/dist/extensions/volcengine/speech-provider.d.ts +0 -5
- package/dist/extensions/volcengine/speech-provider.js +0 -2
- package/dist/extensions/volcengine/tts.d.ts +0 -22
- package/dist/extensions/volcengine/tts.js +0 -2
- package/dist/extensions/weixin/fengming.plugin.json +0 -22
- package/dist/extensions/weixin/index.d.ts +0 -26
- package/dist/extensions/weixin/index.js +0 -862
- package/dist/extensions/weixin/package.json +0 -45
- package/dist/extensions/xiaomi/api.d.ts +0 -3
- package/dist/extensions/xiaomi/api.js +0 -3
- package/dist/extensions/xiaomi/fengming.plugin.json +0 -260
- package/dist/extensions/xiaomi/index.d.ts +0 -12
- package/dist/extensions/xiaomi/index.js +0 -284
- package/dist/extensions/xiaomi/onboard.d.ts +0 -2
- package/dist/extensions/xiaomi/onboard.js +0 -2
- package/dist/extensions/xiaomi/package.json +0 -15
- package/dist/extensions/xiaomi/provider-catalog.d.ts +0 -2
- package/dist/extensions/xiaomi/provider-catalog.js +0 -2
- package/dist/extensions/xiaomi/speech-provider.d.ts +0 -5
- package/dist/extensions/xiaomi/speech-provider.js +0 -2
- package/dist/extensions/xiaomi/stream.d.ts +0 -5
- package/dist/extensions/xiaomi/stream.js +0 -2
- package/dist/extensions/xiaomi/thinking.d.ts +0 -11
- package/dist/extensions/xiaomi/thinking.js +0 -2
- package/dist/extensions/xingchen/fengming.plugin.json +0 -69
- package/dist/extensions/xingchen/index.d.ts +0 -11
- package/dist/extensions/xingchen/index.js +0 -45
- package/dist/extensions/xingchen/models.d.ts +0 -7
- package/dist/extensions/xingchen/models.js +0 -2
- package/dist/extensions/xingchen/onboard.d.ts +0 -5
- package/dist/extensions/xingchen/onboard.js +0 -2
- package/dist/extensions/xingchen/package.json +0 -15
- package/dist/extensions/xingchen/provider-catalog.d.ts +0 -2
- package/dist/extensions/xingchen/provider-catalog.js +0 -2
- package/dist/extensions/xingchen/provider-discovery.d.ts +0 -2
- package/dist/extensions/xingchen/provider-discovery.js +0 -5
- package/dist/extensions/yi/fengming.plugin.json +0 -84
- package/dist/extensions/yi/index.d.ts +0 -11
- package/dist/extensions/yi/index.js +0 -45
- package/dist/extensions/yi/models.d.ts +0 -7
- package/dist/extensions/yi/models.js +0 -2
- package/dist/extensions/yi/onboard.d.ts +0 -5
- package/dist/extensions/yi/onboard.js +0 -2
- package/dist/extensions/yi/package.json +0 -15
- package/dist/extensions/yi/provider-catalog.d.ts +0 -2
- package/dist/extensions/yi/provider-catalog.js +0 -2
- package/dist/extensions/yi/provider-discovery.d.ts +0 -2
- package/dist/extensions/yi/provider-discovery.js +0 -5
- package/dist/extensions/zai/api.d.ts +0 -4
- package/dist/extensions/zai/api.js +0 -4
- package/dist/extensions/zai/detect.d.ts +0 -2
- package/dist/extensions/zai/detect.js +0 -2
- package/dist/extensions/zai/fengming.plugin.json +0 -377
- package/dist/extensions/zai/index.d.ts +0 -12
- package/dist/extensions/zai/index.js +0 -297
- package/dist/extensions/zai/media-understanding-provider.d.ts +0 -5
- package/dist/extensions/zai/media-understanding-provider.js +0 -2
- package/dist/extensions/zai/model-definitions.d.ts +0 -2
- package/dist/extensions/zai/model-definitions.js +0 -2
- package/dist/extensions/zai/onboard.d.ts +0 -2
- package/dist/extensions/zai/onboard.js +0 -2
- package/dist/extensions/zai/package.json +0 -15
- package/dist/extensions/zai/runtime-api.d.ts +0 -2
- package/dist/extensions/zai/runtime-api.js +0 -2
- package/dist/extensions/zhinao/fengming.plugin.json +0 -69
- package/dist/extensions/zhinao/index.d.ts +0 -11
- package/dist/extensions/zhinao/index.js +0 -45
- package/dist/extensions/zhinao/models.d.ts +0 -7
- package/dist/extensions/zhinao/models.js +0 -2
- package/dist/extensions/zhinao/onboard.d.ts +0 -5
- package/dist/extensions/zhinao/onboard.js +0 -2
- package/dist/extensions/zhinao/package.json +0 -15
- package/dist/extensions/zhinao/provider-catalog.d.ts +0 -2
- package/dist/extensions/zhinao/provider-catalog.js +0 -2
- package/dist/extensions/zhinao/provider-discovery.d.ts +0 -2
- package/dist/extensions/zhinao/provider-discovery.js +0 -5
- package/dist/fengming-runtime-0jdu_329.d.ts +0 -153
- package/dist/fengming-tools-gQkwsWYz.js +0 -12221
- package/dist/fengming.plugin-C-Kdi1_5.js +0 -130
- package/dist/fengming.plugin-CRPqMj85.js +0 -166
- package/dist/gateway-cli-BV1V43-D.js +0 -443
- package/dist/gateway-method-runtime-J2OPP_oH.js +0 -21
- package/dist/get-reply-BE8ZGJos.js +0 -5198
- package/dist/get-reply-from-config.runtime-C5wfxVI_.js +0 -2
- package/dist/heartbeat-runner-_0HlObMb.js +0 -5
- package/dist/heartbeat-runner.runtime-DvYz_4Z3.js +0 -3
- package/dist/hook-runtime-BH9moP5T.js +0 -4
- package/dist/hooks-icCwsmrQ.js +0 -536
- package/dist/host-compat-dfJvEfe7.d.ts +0 -21
- package/dist/http-registry-Buj7R-F_.d.ts +0 -23
- package/dist/image-generation-provider-hrRXkkGc.js +0 -152
- package/dist/inbound-reply-dispatch-5AYt56Yt.js +0 -147
- package/dist/inbound-reply-dispatch-B5weFW8i.js +0 -2
- package/dist/inbound-reply-dispatch-cJh4H31y.d.ts +0 -156
- package/dist/index-AZzJCgph.d.ts +0 -1497
- package/dist/infra-runtime-3_0R8nmO.js +0 -32
- package/dist/init-BnfkYG_k.js +0 -59
- package/dist/interactive-V8NfYsTW.d.ts +0 -26
- package/dist/isolated-agent-CgH7dfOj.js +0 -1097
- package/dist/isolated-agent-dBWkiw0a.js +0 -2
- package/dist/kernel-Ds2aqAJF.d.ts +0 -241
- package/dist/kimi-web-search-provider-QJT3Ftj3.js +0 -80
- package/dist/kimi-web-search-provider.runtime-Dj3SS4T5.js +0 -307
- package/dist/kimi-web-search-provider.runtime.js +0 -1
- package/dist/lib-Dg4yjNFQ.js +0 -871
- package/dist/lifecycle-B9k7QGsS.js +0 -570
- package/dist/list.probe-CbVHFNwf.js +0 -2
- package/dist/list.probe-CxiEBmyW.js +0 -451
- package/dist/list.status-command-DE-edGgB.js +0 -815
- package/dist/llm-slug-generator-DJgq9eFd.js +0 -78
- package/dist/loader-5AqYM9PC.d.ts +0 -142
- package/dist/local-dispatch.runtime-D3F4v51B.js +0 -10
- package/dist/manager-BWf1ks-Z.d.ts +0 -409
- package/dist/mcp-http-DU7Nsg4P.js +0 -583
- package/dist/mcp-http-iZCW6Cet.js +0 -2
- package/dist/media-runtime-DZ5RpQN7.d.ts +0 -261
- package/dist/media-understanding-DEdEyoQB.d.ts +0 -46
- package/dist/media-understanding-provider-4JHrQOUE.js +0 -70
- package/dist/media-understanding-provider-BV7O82XV.js +0 -29
- package/dist/media-understanding-provider-BlPRhYkx.js +0 -69
- package/dist/media-understanding-provider-BuX8eQLj.js +0 -13
- package/dist/memory-core-host-engine-embeddings-BDu5fx8E.d.ts +0 -324
- package/dist/memory-core-host-engine-storage-CdCuH-E2.d.ts +0 -54
- package/dist/message-handler-L6QLWNVP.js +0 -1806
- package/dist/minimax-web-search-provider-_gxeEOy8.js +0 -58
- package/dist/minimax-web-search-provider.runtime-BF4mGi6U.js +0 -148
- package/dist/minimax-web-search-provider.runtime.js +0 -1
- package/dist/model-catalog-DCnRkX8f.d.ts +0 -88
- package/dist/model-definitions-B2gY43hI.d.ts +0 -34
- package/dist/model-definitions-BLOyeH5h.js +0 -73
- package/dist/model-definitions-CoByf5mT.js +0 -243
- package/dist/model-definitions-WP3OmzbS.d.ts +0 -57
- package/dist/model-selection-DhTE6GZD.js +0 -352
- package/dist/models--iAR9QkZ.js +0 -175
- package/dist/models-8ImVEkvh.js +0 -36
- package/dist/models-BIDM8htk.js +0 -48
- package/dist/models-BRgRfrcS.js +0 -36
- package/dist/models-Bib5-APc.js +0 -67
- package/dist/models-Bl67zOoe.js +0 -36
- package/dist/models-BqDDYFE3.d.ts +0 -65
- package/dist/models-BtRQoRIu.js +0 -36
- package/dist/models-BvXmOXik.js +0 -48
- package/dist/models-C-sJciOD.d.ts +0 -9
- package/dist/models-COnXPdlL.js +0 -24
- package/dist/models-CXTmk-Da.d.ts +0 -8
- package/dist/models-Cz0C_8re.js +0 -36
- package/dist/models-DbwEIt-m.d.ts +0 -15
- package/dist/models-DgXkSADi.js +0 -30
- package/dist/models-cli-Bv3y3JgQ.js +0 -257
- package/dist/monitor-BiVOsbbN.js +0 -1024
- package/dist/monitor-BumfRp1t.js +0 -60
- package/dist/monitor.account-Cd6EwtuZ.js +0 -5382
- package/dist/music-generation-provider-ZdDMiC-c.js +0 -308
- package/dist/nodes-C0f8XgD5.js +0 -1483
- package/dist/nodes-Dk4vOgg9.js +0 -3
- package/dist/nodes-pending-Cjg09MXz.js +0 -211
- package/dist/oauth-BIO69Qw0.d.ts +0 -25
- package/dist/oauth-CnO10TN2.js +0 -207
- package/dist/onboard-B3BYT5k7.js +0 -34
- package/dist/onboard-BDMNV6RE.js +0 -23
- package/dist/onboard-B_WNNy5F.d.ts +0 -6
- package/dist/onboard-BbyMaErU.js +0 -69
- package/dist/onboard-BuYPNE6j2.js +0 -23
- package/dist/onboard-C394zMnM.d.ts +0 -11
- package/dist/onboard-CHn4oVbY.js +0 -24
- package/dist/onboard-CPpVbb0O.js +0 -73
- package/dist/onboard-CWDx7Crt.js +0 -23
- package/dist/onboard-CbzkwBzu.d.ts +0 -12
- package/dist/onboard-D099qUd0.js +0 -23
- package/dist/onboard-D7dbzfHc.js +0 -23
- package/dist/onboard-DB-x0nHF.js +0 -30
- package/dist/onboard-DFVrRnxJ.js +0 -23
- package/dist/onboard-DFiqoOc2.d.ts +0 -7
- package/dist/onboard-DJaMK3rr.d.ts +0 -6
- package/dist/onboard-DMdK8D_h.js +0 -67
- package/dist/onboard-J-KL-I6m.js +0 -48
- package/dist/onboard-MIBU-Rmv.js +0 -39
- package/dist/onboard-vmGylfFe.js +0 -23
- package/dist/openai-compat-errors-Dcr5Y8bF.js +0 -136
- package/dist/openai-http-CcqspzU6.js +0 -836
- package/dist/openresponses-http-BnyYYvUF.js +0 -1175
- package/dist/operations-H2Oq0KYz.js +0 -805
- package/dist/outbound.types-BhRehecY.d.ts +0 -291
- package/dist/plugin-enabled-CEIKWKrq.js +0 -232
- package/dist/plugin-entry-CTVRRaaA.d.ts +0 -47
- package/dist/plugin-registration-BTyO5Fwt.js +0 -97
- package/dist/plugin-runtime-_XF2N_UQ.d.ts +0 -117
- package/dist/plugin-sdk/bundled-channel-config-schema-BsOWCrJT.d.ts +0 -3169
- package/dist/plugin-service-B91jVlmZ.d.ts +0 -24
- package/dist/plugin-service-CtGwVz8V.js +0 -1249
- package/dist/prepare.runtime-9dlboph7.js +0 -798
- package/dist/preview-warnings-DJx4KJpC.js +0 -618
- package/dist/program-CWC-NBBB.js +0 -131
- package/dist/provider-api-key-auth-BmNcYRMl.d.ts +0 -27
- package/dist/provider-auth-api-key-CCaFiqY3.js +0 -5
- package/dist/provider-auth-result-D_E9dcVc.d.ts +0 -21
- package/dist/provider-catalog-5KZLmrDO.js +0 -11
- package/dist/provider-catalog-7P6AvDzS.js +0 -11
- package/dist/provider-catalog-B2gyTjTU.js +0 -88
- package/dist/provider-catalog-B3YBhe77.js +0 -17
- package/dist/provider-catalog-B7XEeuUm.js +0 -11
- package/dist/provider-catalog-BFGPRd9v.js +0 -17
- package/dist/provider-catalog-BLvkIMSk.d.ts +0 -6
- package/dist/provider-catalog-BPBL9mJf.d.ts +0 -5
- package/dist/provider-catalog-BRkZ6-HD.d.ts +0 -5
- package/dist/provider-catalog-Bfl_AoTZ.js +0 -142
- package/dist/provider-catalog-BpiHWHu1.js +0 -11
- package/dist/provider-catalog-C1qDLekT.d.ts +0 -5
- package/dist/provider-catalog-CKWNCfry.js +0 -11
- package/dist/provider-catalog-CUHB2pSt.d.ts +0 -7
- package/dist/provider-catalog-CWqN2j6J.d.ts +0 -5
- package/dist/provider-catalog-CZ8oYbx3.js +0 -11
- package/dist/provider-catalog-CcQ5-4ZW.d.ts +0 -6
- package/dist/provider-catalog-Cd16uZ0U.js +0 -20
- package/dist/provider-catalog-CpF2D0VK.js +0 -61
- package/dist/provider-catalog-CvXq36zW.d.ts +0 -5
- package/dist/provider-catalog-D2pgEME3.js +0 -48
- package/dist/provider-catalog-DPzcupEl.d.ts +0 -5
- package/dist/provider-catalog-DaeI606G.d.ts +0 -9
- package/dist/provider-catalog-DrOCtTb-.js +0 -11
- package/dist/provider-catalog-DwZ1J2Al.d.ts +0 -6
- package/dist/provider-catalog-Dy7IcHmS.js +0 -107
- package/dist/provider-catalog-TsZS52nq.d.ts +0 -10
- package/dist/provider-catalog-YqIFRCND.d.ts +0 -5
- package/dist/provider-catalog-Ywb5jRwG.d.ts +0 -5
- package/dist/provider-catalog-evknl1oN.js +0 -11
- package/dist/provider-catalog-l0hFpFO2.d.ts +0 -17
- package/dist/provider-catalog-shared-DsRBv0Tp.d.ts +0 -62
- package/dist/provider-dispatcher-BMy9mBJ1.js +0 -22
- package/dist/provider-model-shared-CPAfQBNs.d.ts +0 -143
- package/dist/provider-models-Diu65OcG.d.ts +0 -18
- package/dist/provider-models-LE7PlLYY.js +0 -22
- package/dist/provider-onboard-CpvXEmvz.d.ts +0 -91
- package/dist/provider-registration-DF-LkmNE.js +0 -235
- package/dist/provider-registry-D9cTPW1F.d.ts +0 -8
- package/dist/provider-registry-DI7gMKUP.d.ts +0 -8
- package/dist/provider-registry-DZtgZDkl.d.ts +0 -29
- package/dist/provider-self-hosted-setup-CoHvoyKm.d.ts +0 -74
- package/dist/provider-stream-BpXJr5Ap.d.ts +0 -139
- package/dist/provider-stream-family-Bj5aBD8w.js +0 -2
- package/dist/provider-stream-shared-BaUkhUHj.d.ts +0 -132
- package/dist/provider-usage-DFUhW2do.js +0 -651
- package/dist/provider-web-search-contract-fields-CkXzSsWu.d.ts +0 -25
- package/dist/pw-ai-9Q_dIq4B.js +0 -3064
- package/dist/register.agent-CbfrlzXB.js +0 -152
- package/dist/register.crestodian-CEg0rPfK.js +0 -24
- package/dist/register.maintenance-k9N8I4Wg.js +0 -85
- package/dist/register.subclis-CrXOeaS3.js +0 -3
- package/dist/register.subclis-DfKlni8N.js +0 -31
- package/dist/register.subclis-core-Bg4wbDsO.js +0 -278
- package/dist/registry-Bh3-P2HL.d.ts +0 -8
- package/dist/registry-types-BmEUS4d3.d.ts +0 -392
- package/dist/repair-sequencing-E4yViXG9.js +0 -652
- package/dist/reply-payload-S2mrc_Mh.d.ts +0 -200
- package/dist/reply-turn-admission-BBoPjmGB.js +0 -2056
- package/dist/reply.runtime-C5wfxVI_.js +0 -2
- package/dist/result-fallback-classifier-CX4iLD1G.js +0 -98
- package/dist/route-CifxcQZ1.js +0 -475
- package/dist/routes-B3XAOeWo.js +0 -2
- package/dist/routes-H185h3U-.js +0 -3701
- package/dist/run-CTJFbwbB.js +0 -1162
- package/dist/run-command-B7B53tYk.js +0 -23
- package/dist/run-command-BFuxRDxS.js +0 -2
- package/dist/run-context-C7im9ICg.js +0 -66
- package/dist/run-embedded.runtime-TljBTbzh.js +0 -4
- package/dist/run-execution-cli.runtime-Bt5zwx1W.js +0 -4
- package/dist/run-executor.runtime-hmbWX2Ct.js +0 -330
- package/dist/run-subagent-registry.runtime-B70X80nS.js +0 -2
- package/dist/runtime-DoKE0o7v.js +0 -436
- package/dist/runtime-api-Ca4Llbgf.js +0 -12
- package/dist/runtime-api-pa8xcEmg.d.ts +0 -5
- package/dist/runtime-channel-CFQ59svm.js +0 -148
- package/dist/runtime-channel-DRwCWGUx.js +0 -2
- package/dist/runtime-embedded-agent.runtime-DwmqKUVp.js +0 -2
- package/dist/runtime-forwarders-BMThPHg_.d.ts +0 -39
- package/dist/sdk-setup-tools-Cg_Tabrf.js +0 -8
- package/dist/selection-COhr7g82.js +0 -18365
- package/dist/selection-_G44EVqd.js +0 -3
- package/dist/send-media-BNc67G7I.js +0 -2072
- package/dist/server-5rR0RCpI.js +0 -24
- package/dist/server-context-BhiPROPA.js +0 -955
- package/dist/server-context-OShBAJZQ.js +0 -2
- package/dist/server-cron-Bkzb9edh.js +0 -3173
- package/dist/server-cron-DdR-ugiU.js +0 -2
- package/dist/server-lwtC1vaS.js +0 -72
- package/dist/server-methods-BY_ZqDFJ.js +0 -497
- package/dist/server-node-events-CLvE94AS.js +0 -597
- package/dist/server-plugin-bootstrap-cKOAH5GL.js +0 -71
- package/dist/server-plugins-CPpUykw5.js +0 -435
- package/dist/server-reload-handlers-uzt4VDZ-.js +0 -719
- package/dist/server-restart-sentinel-CpvV0t4O.js +0 -700
- package/dist/server-runtime-services-BhOHoerM.js +0 -147
- package/dist/server-runtime-services-D3Ig68nC.js +0 -3
- package/dist/server-startup-plugins-DslzKVHK.js +0 -127
- package/dist/server-startup-post-attach-DPFBTQez.js +0 -793
- package/dist/server-ws-runtime-D0zoWoiz.js +0 -374
- package/dist/server.impl-CzqLQ3qt.js +0 -2622
- package/dist/session-kill-http-D8JhwZVS.js +0 -121
- package/dist/session-reset-service-uoi7E4Xp.js +0 -651
- package/dist/session-status.runtime-CZK5IU8w.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BSO00-FY.js +0 -2
- package/dist/session-tab-registry-DM9U7e3o.js +0 -551
- package/dist/sessions-B-SkIoaa.js +0 -1917
- package/dist/sessions-history-http-DCiOG4FK.js +0 -432
- package/dist/sessions-patch-DlAAvQvB.js +0 -401
- package/dist/sessions-resolve-DfMXookg.js +0 -180
- package/dist/sessions.runtime-0V2YxKxB.js +0 -2
- package/dist/snapshot-urls-Ble1-NEW.js +0 -317
- package/dist/speech-core-Bk60ZS_y.d.ts +0 -49
- package/dist/speech-provider-DQO9eZd0.js +0 -233
- package/dist/speech-provider-DnBCla4V.js +0 -171
- package/dist/speech-provider-DyYHFxT5.js +0 -227
- package/dist/standalone-9EWfcxeO.js +0 -42
- package/dist/startup-context-nti4X0_w.js +0 -314
- package/dist/status-subagents.runtime-CPZb1EF1.js +0 -32
- package/dist/status-text-C1Hf37lF.js +0 -301
- package/dist/stream-9VBt1MDs.js +0 -26
- package/dist/stream-B_3P7v7P.js +0 -86
- package/dist/stream-CXsue2-v.d.ts +0 -9
- package/dist/stream-oNBFxfKt.d.ts +0 -5
- package/dist/subagent-announce-CPjQQLy8.js +0 -353
- package/dist/subagent-announce-delivery-B6iBOicL.js +0 -1369
- package/dist/subagent-control-DP72sk-l.js +0 -492
- package/dist/subagent-hooks-B1oUIYH3.js +0 -2
- package/dist/subagent-hooks-BkGj4_xI.js +0 -230
- package/dist/subagent-hooks-api-D2mulK3S.js +0 -23
- package/dist/subagent-registry-CEKAUB5h.js +0 -3
- package/dist/subagent-registry-OUVucPAn.js +0 -2627
- package/dist/subagent-session-cleanup-Bx8d3kw0.js +0 -390
- package/dist/system-CelaP2zI.js +0 -111
- package/dist/talk-DGOI3Lu3.js +0 -2454
- package/dist/target-id-BXRG7x9x.js +0 -107
- package/dist/thinking-B8V29FhB.js +0 -35
- package/dist/thread-bindings-DpVdEPZ0.js +0 -228
- package/dist/tool-DHzDpxE4.js +0 -143
- package/dist/tool-dispatch-ClP3Rc7g.js +0 -155
- package/dist/tool-resolution-CZcLod1d.js +0 -153
- package/dist/tool-split-BhiQ8676.d.ts +0 -19
- package/dist/tools-ZvSvbsCW.d.ts +0 -38
- package/dist/tools-effective-C2mHZT-A.js +0 -442
- package/dist/tools-effective-inventory-ctnM7hc6.js +0 -379
- package/dist/tools-invoke-Ci6Rux2s.js +0 -51
- package/dist/tools-invoke-http-CJflXcJk.js +0 -68
- package/dist/tools-invoke-shared-BLu_mJEX.js +0 -200
- package/dist/tts-B2rPJPij.js +0 -83
- package/dist/tts-Gp9FI3_n.js +0 -163
- package/dist/tts-runtime-DNi1HXPF.d.ts +0 -230
- package/dist/tui-BUhfQ9vD.js +0 -3
- package/dist/tui-BhH5mvLf.js +0 -2
- package/dist/tui-backend-C_4ajTHI.js +0 -257
- package/dist/tui-cli-BhWJ-QoB.js +0 -40
- package/dist/tui-ink-run-BTWbUQGb.js +0 -7414
- package/dist/tui-ink-run-DfTdivkh.js +0 -2
- package/dist/types-B4fW3r5y.d.ts +0 -111
- package/dist/types-DI62NfFe.d.ts +0 -7034
- package/dist/types-sAih_uQb.d.ts +0 -393
- package/dist/types.public-B3MKhuo2.d.ts +0 -70
- package/dist/video-generation-B9c6a5cw.js +0 -207
- package/dist/video-generation-BgJp7UIA.d.ts +0 -224
- package/dist/video-generation-provider-BjiVjf40.js +0 -325
- package/dist/video-generation-provider-CsnQJg_h.js +0 -297
- package/dist/video-generation-provider-DtU-ZPqP.js +0 -64
- package/dist/video-generation-provider-wZ0bzv0e.js +0 -77
- package/dist/webhook-targets-Cy8e7y3g.d.ts +0 -99
- package/dist/zod-schema.core-BGLctDlK.d.ts +0 -166
- package/skills/canvas/SKILL.md +0 -78
- package/skills/clawhub/SKILL.md +0 -77
- package/skills/coding-agent/SKILL.md +0 -143
- package/skills/diagram-maker/SKILL.md +0 -53
- package/skills/diagram-maker/references/excalidraw-patterns.md +0 -85
- package/skills/diagram-maker/references/svg-template.md +0 -112
- package/skills/gemini/SKILL.md +0 -47
- package/skills/gh-issues/SKILL.md +0 -213
- package/skills/gifgrep/SKILL.md +0 -85
- package/skills/github/SKILL.md +0 -84
- package/skills/healthcheck/SKILL.md +0 -105
- package/skills/mcporter/SKILL.md +0 -61
- package/skills/meme-maker/SKILL.md +0 -42
- package/skills/meme-maker/references/templates.json +0 -358
- package/skills/meme-maker/scripts/meme.mjs +0 -398
- package/skills/model-usage/SKILL.md +0 -71
- package/skills/model-usage/references/codexbar-cli.md +0 -33
- package/skills/model-usage/scripts/model_usage.py +0 -319
- package/skills/model-usage/scripts/test_model_usage.py +0 -40
- package/skills/nano-pdf/SKILL.md +0 -38
- package/skills/node-connect/SKILL.md +0 -143
- package/skills/node-inspect-debugger/SKILL.md +0 -85
- package/skills/openai-whisper/SKILL.md +0 -38
- package/skills/openai-whisper-api/SKILL.md +0 -71
- package/skills/openai-whisper-api/scripts/transcribe.sh +0 -154
- package/skills/oracle/SKILL.md +0 -126
- package/skills/pyproject.toml +0 -10
- package/skills/python-debugpy/SKILL.md +0 -73
- package/skills/sag/SKILL.md +0 -87
- package/skills/session-logs/SKILL.md +0 -151
- package/skills/sherpa-onnx-tts/SKILL.md +0 -109
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +0 -178
- package/skills/skill-creator/SKILL.md +0 -78
- package/skills/skill-creator/license.txt +0 -202
- package/skills/skill-creator/scripts/init_skill.py +0 -378
- package/skills/skill-creator/scripts/package_skill.py +0 -139
- package/skills/skill-creator/scripts/quick_validate.py +0 -169
- package/skills/skill-creator/scripts/test_package_skill.py +0 -161
- package/skills/skill-creator/scripts/test_quick_validate.py +0 -116
- package/skills/spike/SKILL.md +0 -51
- package/skills/summarize/SKILL.md +0 -87
- package/skills/taskflow/SKILL.md +0 -149
- package/skills/taskflow/examples/inbox-triage.lobster +0 -33
- package/skills/taskflow/examples/pr-intake.lobster +0 -32
- package/skills/taskflow-inbox-triage/SKILL.md +0 -119
- package/skills/video-frames/SKILL.md +0 -46
- package/skills/video-frames/scripts/frame.sh +0 -81
- package/skills/voice-call/SKILL.md +0 -45
- package/skills/weather/SKILL.md +0 -64
- /package/dist/{acp-runtime-backend-DbchQ02o.js → acp-runtime-backend-DZ1Lnt7f.js} +0 -0
- /package/dist/{delegate-k1aptKei.js → delegate-CwhxUdeb.js} +0 -0
- /package/dist/{dispatch-acp-CD4YxPpf.js → dispatch-acp-BP4I5ZQf.js} +0 -0
- /package/dist/{exec-approvals-ByWUCFQM.js → exec-approvals-ByWUCFQM2.js} +0 -0
- /package/dist/{heartbeat-runner-CM0UZxa_.js → heartbeat-runner-CL3alQ8-.js} +0 -0
- /package/dist/{index-B0VJdRJQ.d.ts → index-B0VJdRJQ2.d.ts} +0 -0
- /package/dist/{library-CQ71yATP.js → library-CiTr_aqC.js} +0 -0
- /package/dist/{run-session-state-DbDeH-q6.js → run-session-state-BOMUtBKZ.js} +0 -0
- /package/dist/{session-subagent-reactivation-Bj91A2ms.js → session-subagent-reactivation-CH0C2I6Y.js} +0 -0
- /package/dist/{types-C4HgagiY2.d.ts → types-C4HgagiY.d.ts} +0 -0
|
@@ -1,2056 +0,0 @@
|
|
|
1
|
-
import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, p as readStringValue, t as hasNonEmptyString } from "./string-coerce-DKw2K5wM.js";
|
|
2
|
-
import { t as sanitizeForLog } from "./ansi-BCVkJ8zW.js";
|
|
3
|
-
import { o as isRecord } from "./record-coerce-Btbek4uV.js";
|
|
4
|
-
import { i as formatErrorMessage } from "./errors-C_Wa6a5T.js";
|
|
5
|
-
import { n as defaultRuntime } from "./runtime-BkTkFkXs.js";
|
|
6
|
-
import { c as isDiagnosticsEnabled } from "./diagnostic-events-Bwqd0ZOT.js";
|
|
7
|
-
import { t as createSubsystemLogger } from "./subsystem-B7U-DPv3.js";
|
|
8
|
-
import { C as hasSessionAutoModelFallbackProvenance, i as markAutoFallbackPrimaryProbe, n as entryMatchesAutoFallbackPrimaryProbe, p as resolveAutoFallbackPrimaryProbe, t as clearAutoFallbackPrimaryProbeSelection } from "./agent-scope-EEbMCF2I.js";
|
|
9
|
-
import { r as logVerbose } from "./globals-BMM_rcFF.js";
|
|
10
|
-
import { o as resolveMessageChannel } from "./message-channel-normalize-CaOaCinb.js";
|
|
11
|
-
import { i as isMarkdownCapableMessageChannel, r as isInternalMessageChannel } from "./message-channel-DcN_7tYD.js";
|
|
12
|
-
import { u as resolveOpenAIRuntimeProvider } from "./openai-codex-routing-CJw0IxWE.js";
|
|
13
|
-
import { t as resolveAgentHarnessPolicy } from "./policy-vPn4fInM.js";
|
|
14
|
-
import { r as copyReplyPayloadMetadata, u as markReplyPayloadForSourceSuppressionDelivery } from "./reply-payload-DM17pxMC.js";
|
|
15
|
-
import { i as emitAgentEvent, l as onAgentEvent, u as registerAgentRunContext } from "./agent-events-Dl8p_DjC.js";
|
|
16
|
-
import { d as updateSessionStore } from "./store-DH20opqS.js";
|
|
17
|
-
import { n as resolveGroupSessionKey } from "./group-BhAqCyJo.js";
|
|
18
|
-
import "./sessions-CtMqsEs2.js";
|
|
19
|
-
import { x as resolveModelRefFromString } from "./model-selection-shared-vfQyPxy6.js";
|
|
20
|
-
import { t as isCliProvider } from "./model-selection-cli-XwuJvLiP.js";
|
|
21
|
-
import { l as resolvePersistedOverrideModelRef } from "./model-selection-C4gJ7iHA.js";
|
|
22
|
-
import { _ as isRateLimitErrorMessage, d as sanitizeUserFacingText, h as isOverloadedErrorMessage, i as formatRateLimitOrOverloadedErrorCopy, m as isBillingErrorMessage, t as BILLING_ERROR_USER_MESSAGE } from "./sanitize-user-facing-text-B7CiNPI8.js";
|
|
23
|
-
import { a as createReplyOperation, n as ReplyRunAlreadyActiveError, p as replyRunRegistry } from "./reply-run-registry-CE6ehUBj.js";
|
|
24
|
-
import { d as logSessionTurnCreated } from "./diagnostic-B66j5Hib.js";
|
|
25
|
-
import { a as isSilentReplyText, i as isSilentReplyPrefixText, n as SILENT_REPLY_TOKEN, o as startsWithSilentToken, s as stripLeadingSilentToken } from "./tokens-T0RrWCee.js";
|
|
26
|
-
import { c as shouldPreserveUserFacingSessionStateForInputProvenance } from "./input-provenance-DCrP7aPH.js";
|
|
27
|
-
import { o as resolveContextTokensForModel } from "./context-CTAhrepa.js";
|
|
28
|
-
import { n as GatewayDrainingError, t as CommandLaneClearedError } from "./command-queue-BdFPuMNt.js";
|
|
29
|
-
import { n as classifyOAuthRefreshFailure, t as buildOAuthRefreshFailureLoginCommand } from "./oauth-refresh-failure-DkNaCRng.js";
|
|
30
|
-
import { d as isContextOverflowError, g as isLikelyContextOverflowError, u as isCompactionFailureError, y as isTransientHttpError } from "./errors-DPv7El2C.js";
|
|
31
|
-
import { m as resolveSendableOutboundReplyParts, s as hasOutboundReplyContent } from "./reply-payload-swpu2tGD.js";
|
|
32
|
-
import { a as resolveCliRuntimeExecutionProvider } from "./model-runtime-aliases-CxJ0cPsU.js";
|
|
33
|
-
import "./selection-COhr7g82.js";
|
|
34
|
-
import { d as stripHeartbeatToken } from "./heartbeat-Bze-ZPrI.js";
|
|
35
|
-
import { i as isRenderablePayload, t as applyReplyTagsToPayload } from "./reply-payloads-BaKLJdO5.js";
|
|
36
|
-
import "./embedded-agent-helpers-DHtPkffx.js";
|
|
37
|
-
import { p as parseReplyDirectives } from "./payloads-DHTHYd7R.js";
|
|
38
|
-
import { f as LiveSessionModelSwitchError, o as runWithModelFallback, t as isFallbackSummaryError } from "./model-fallback-GPUPtVYe.js";
|
|
39
|
-
import { l as resolveBootstrapWarningSignaturesSeen } from "./bootstrap-budget-Bmy8FbCd.js";
|
|
40
|
-
import { h as isMessagingToolSendAction } from "./embedded-agent-subscribe.tools-3RGlIdnX.js";
|
|
41
|
-
import { n as clearCliSession, r as getCliSessionBinding } from "./cli-session-Cke9O9dE.js";
|
|
42
|
-
import { t as ensureSelectedAgentHarnessPlugin } from "./runtime-plugin-DjkEv91V.js";
|
|
43
|
-
import { t as runEmbeddedAgent } from "./embedded-agent-CNp_y7jW.js";
|
|
44
|
-
import { n as buildAgentRuntimeOutcomePlan } from "./build-DEF8Per9.js";
|
|
45
|
-
import { i as resolveSilentReplyPolicy, n as isReplyProfilerEnabled, r as resolveCurrentTurnImages } from "./reply-timing-tracker-DLRaKkVU.js";
|
|
46
|
-
import { c as resolveRunAuthProfile, o as resolveQueuedReplyRuntimeConfig, s as resolveModelFallbackOptions, t as buildEmbeddedRunExecutionParams } from "./agent-runner-utils-DNiuuo43.js";
|
|
47
|
-
import { n as runCliAgent } from "./cli-runner-D2OAqxu3.js";
|
|
48
|
-
import { n as HEARTBEAT_EXTERNAL_RUN_FAILURE_TEXT, t as GENERIC_EXTERNAL_RUN_FAILURE_TEXT } from "./agent-runner-failure-copy-CU6Vmacs.js";
|
|
49
|
-
import { n as resolveOriginMessageProvider } from "./origin-routing-CMrrA67a.js";
|
|
50
|
-
import { n as createBlockReplyContentKey } from "./block-reply-pipeline-DEN_gFMd.js";
|
|
51
|
-
import { t as createReplyMediaContext } from "./reply-media-paths.runtime-DYqLiKDF.js";
|
|
52
|
-
import crypto from "node:crypto";
|
|
53
|
-
//#region src/auto-reply/reply/agent-runner-cli-dispatch.ts
|
|
54
|
-
function shouldBridgeCliAssistantTextToReasoning(provider) {
|
|
55
|
-
return normalizeLowercaseStringOrEmpty(provider) === "claude-cli";
|
|
56
|
-
}
|
|
57
|
-
function createAgentEventBridge(params) {
|
|
58
|
-
const deliver = params.deliver;
|
|
59
|
-
if (!deliver) return {
|
|
60
|
-
unsubscribe: () => void 0,
|
|
61
|
-
drain: async () => void 0
|
|
62
|
-
};
|
|
63
|
-
let unsubscribed = false;
|
|
64
|
-
let delivery = Promise.resolve();
|
|
65
|
-
const rawUnsubscribe = onAgentEvent((evt) => {
|
|
66
|
-
if (evt.runId !== params.runId) return;
|
|
67
|
-
if (params.suppressed) return;
|
|
68
|
-
const payload = params.read(evt);
|
|
69
|
-
if (payload === void 0) return;
|
|
70
|
-
delivery = delivery.then(() => deliver(payload)).catch(() => void 0);
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
unsubscribe() {
|
|
74
|
-
if (unsubscribed) return;
|
|
75
|
-
unsubscribed = true;
|
|
76
|
-
rawUnsubscribe();
|
|
77
|
-
},
|
|
78
|
-
async drain() {
|
|
79
|
-
await delivery;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function createAssistantTextBridge(params) {
|
|
84
|
-
let lastText;
|
|
85
|
-
return createAgentEventBridge({
|
|
86
|
-
runId: params.runId,
|
|
87
|
-
suppressed: params.suppressed,
|
|
88
|
-
deliver: params.deliver,
|
|
89
|
-
read: (evt) => {
|
|
90
|
-
if (evt.stream !== "assistant") return;
|
|
91
|
-
const text = typeof evt.data.text === "string" ? evt.data.text : void 0;
|
|
92
|
-
if (text === void 0 || text === lastText) return;
|
|
93
|
-
lastText = text;
|
|
94
|
-
return text;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function keepCliSessionBindingOnlyWhenReused(params) {
|
|
99
|
-
const existingSessionId = normalizeOptionalString(params.existingSessionId);
|
|
100
|
-
const agentMeta = params.result.meta.agentMeta;
|
|
101
|
-
const returnedSessionId = normalizeOptionalString(agentMeta?.cliSessionBinding?.sessionId);
|
|
102
|
-
const shouldClearStoredSession = agentMeta?.clearCliSessionBinding === true;
|
|
103
|
-
if (agentMeta === void 0 || existingSessionId && returnedSessionId === existingSessionId) return params.result;
|
|
104
|
-
if (returnedSessionId || shouldClearStoredSession) params.onDroppedReplacement?.();
|
|
105
|
-
return {
|
|
106
|
-
...params.result,
|
|
107
|
-
meta: {
|
|
108
|
-
...params.result.meta,
|
|
109
|
-
agentMeta: {
|
|
110
|
-
...agentMeta,
|
|
111
|
-
sessionId: "",
|
|
112
|
-
cliSessionBinding: void 0,
|
|
113
|
-
clearCliSessionBinding: void 0
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
async function clearDroppedCliSessionBinding(params) {
|
|
119
|
-
const updatedAt = Date.now();
|
|
120
|
-
const clearEntry = (entry) => {
|
|
121
|
-
if (!entry) return;
|
|
122
|
-
clearCliSession(entry, params.provider);
|
|
123
|
-
entry.updatedAt = updatedAt;
|
|
124
|
-
};
|
|
125
|
-
clearEntry(params.activeSessionEntry);
|
|
126
|
-
clearEntry(params.sessionKey ? params.sessionStore?.[params.sessionKey] : void 0);
|
|
127
|
-
if (!params.storePath || !params.sessionKey) return;
|
|
128
|
-
await updateSessionStore(params.storePath, (store) => {
|
|
129
|
-
clearEntry(store[params.sessionKey]);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function createToolEventBridge(params) {
|
|
133
|
-
return createAgentEventBridge({
|
|
134
|
-
runId: params.runId,
|
|
135
|
-
suppressed: params.suppressed,
|
|
136
|
-
deliver: params.deliver,
|
|
137
|
-
read: (evt) => {
|
|
138
|
-
if (evt.stream !== "tool") return;
|
|
139
|
-
const phaseValue = evt.data.phase;
|
|
140
|
-
if (phaseValue !== "start" && phaseValue !== "update") return;
|
|
141
|
-
const phase = phaseValue === "start" ? "start" : "update";
|
|
142
|
-
return {
|
|
143
|
-
name: typeof evt.data.name === "string" ? evt.data.name : void 0,
|
|
144
|
-
phase,
|
|
145
|
-
args: isRecord(evt.data.args) ? evt.data.args : void 0
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
async function runCliAgentWithLifecycle(params) {
|
|
151
|
-
const startedAt = params.startedAt ?? Date.now();
|
|
152
|
-
const emitLifecycleStart = params.emitLifecycleStart ?? true;
|
|
153
|
-
const emitLifecycleTerminal = params.emitLifecycleTerminal ?? true;
|
|
154
|
-
params.onAgentRunStart?.();
|
|
155
|
-
if (emitLifecycleStart) emitAgentEvent({
|
|
156
|
-
runId: params.runId,
|
|
157
|
-
stream: "lifecycle",
|
|
158
|
-
data: {
|
|
159
|
-
phase: "start",
|
|
160
|
-
startedAt
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
const assistantBridge = createAssistantTextBridge({
|
|
164
|
-
runId: params.runId,
|
|
165
|
-
suppressed: params.suppressAssistantBridge,
|
|
166
|
-
deliver: params.onAssistantText
|
|
167
|
-
});
|
|
168
|
-
const reasoningBridge = createAssistantTextBridge({
|
|
169
|
-
runId: params.runId,
|
|
170
|
-
suppressed: params.suppressAssistantBridge,
|
|
171
|
-
deliver: shouldBridgeCliAssistantTextToReasoning(params.provider) ? params.onReasoningText : void 0
|
|
172
|
-
});
|
|
173
|
-
const toolBridge = createToolEventBridge({
|
|
174
|
-
runId: params.runId,
|
|
175
|
-
suppressed: params.suppressAssistantBridge,
|
|
176
|
-
deliver: params.onToolEvent
|
|
177
|
-
});
|
|
178
|
-
let lifecycleTerminalEmitted = false;
|
|
179
|
-
try {
|
|
180
|
-
const rawResult = await runCliAgent(params.runParams);
|
|
181
|
-
const result = params.transformResult?.(rawResult) ?? rawResult;
|
|
182
|
-
assistantBridge.unsubscribe();
|
|
183
|
-
reasoningBridge.unsubscribe();
|
|
184
|
-
toolBridge.unsubscribe();
|
|
185
|
-
await assistantBridge.drain();
|
|
186
|
-
await reasoningBridge.drain();
|
|
187
|
-
await toolBridge.drain();
|
|
188
|
-
const cliText = normalizeOptionalString(result.payloads?.[0]?.text);
|
|
189
|
-
if (cliText) emitAgentEvent({
|
|
190
|
-
runId: params.runId,
|
|
191
|
-
stream: "assistant",
|
|
192
|
-
data: { text: cliText }
|
|
193
|
-
});
|
|
194
|
-
if (emitLifecycleTerminal) {
|
|
195
|
-
emitAgentEvent({
|
|
196
|
-
runId: params.runId,
|
|
197
|
-
stream: "lifecycle",
|
|
198
|
-
data: {
|
|
199
|
-
phase: "end",
|
|
200
|
-
startedAt,
|
|
201
|
-
endedAt: Date.now()
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
lifecycleTerminalEmitted = true;
|
|
205
|
-
}
|
|
206
|
-
return result;
|
|
207
|
-
} catch (err) {
|
|
208
|
-
assistantBridge.unsubscribe();
|
|
209
|
-
reasoningBridge.unsubscribe();
|
|
210
|
-
toolBridge.unsubscribe();
|
|
211
|
-
await assistantBridge.drain();
|
|
212
|
-
await reasoningBridge.drain();
|
|
213
|
-
await toolBridge.drain();
|
|
214
|
-
await params.onErrorBeforeLifecycle?.(err);
|
|
215
|
-
if (emitLifecycleTerminal) {
|
|
216
|
-
emitAgentEvent({
|
|
217
|
-
runId: params.runId,
|
|
218
|
-
stream: "lifecycle",
|
|
219
|
-
data: {
|
|
220
|
-
phase: "error",
|
|
221
|
-
startedAt,
|
|
222
|
-
endedAt: Date.now(),
|
|
223
|
-
error: String(err)
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
lifecycleTerminalEmitted = true;
|
|
227
|
-
}
|
|
228
|
-
throw err;
|
|
229
|
-
} finally {
|
|
230
|
-
assistantBridge.unsubscribe();
|
|
231
|
-
reasoningBridge.unsubscribe();
|
|
232
|
-
toolBridge.unsubscribe();
|
|
233
|
-
if (emitLifecycleTerminal && !lifecycleTerminalEmitted) emitAgentEvent({
|
|
234
|
-
runId: params.runId,
|
|
235
|
-
stream: "lifecycle",
|
|
236
|
-
data: {
|
|
237
|
-
phase: "error",
|
|
238
|
-
startedAt,
|
|
239
|
-
endedAt: Date.now(),
|
|
240
|
-
error: "CLI run completed without lifecycle terminal event"
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/auto-reply/reply/provider-request-error-classifier.ts
|
|
247
|
-
const PROVIDER_CONVERSATION_STATE_ERROR_USER_MESSAGE = "⚠️ The model provider rejected the conversation state. Please try again, or use /new to start a fresh session.";
|
|
248
|
-
function classifyProviderRequestError(err) {
|
|
249
|
-
const technicalMessage = formatErrorMessage(err);
|
|
250
|
-
if (isProviderConversationStateErrorMessage(technicalMessage)) return {
|
|
251
|
-
code: "provider_conversation_state_error",
|
|
252
|
-
userMessage: PROVIDER_CONVERSATION_STATE_ERROR_USER_MESSAGE,
|
|
253
|
-
technicalMessage
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
function isProviderConversationStateErrorMessage(message) {
|
|
257
|
-
const lower = normalizeLowercaseStringOrEmpty(message);
|
|
258
|
-
return lower.includes("custom tool call output is missing") && lower.includes("call id") || lower.includes("toolresult") && lower.includes("tooluse") && lower.includes("exceeds the number") && lower.includes("previous turn") || lower.includes("function call turn comes immediately after") || lower.includes("incorrect role information") || lower.includes("roles must alternate");
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region src/auto-reply/reply/reply-delivery.ts
|
|
262
|
-
function normalizeReplyPayloadDirectives(params) {
|
|
263
|
-
const parseMode = params.parseMode ?? "always";
|
|
264
|
-
const silentToken = params.silentToken ?? "NO_REPLY";
|
|
265
|
-
const sourceText = params.payload.text ?? "";
|
|
266
|
-
const parsed = parseMode === "always" || parseMode === "auto" && (sourceText.includes("[[") || /media:/i.test(sourceText) || params.extractMarkdownImages === true && /!\[[^\]]*]\(/.test(sourceText) || sourceText.includes(silentToken)) ? parseReplyDirectives(sourceText, {
|
|
267
|
-
currentMessageId: params.currentMessageId,
|
|
268
|
-
silentToken,
|
|
269
|
-
extractMarkdownImages: params.extractMarkdownImages
|
|
270
|
-
}) : void 0;
|
|
271
|
-
let text = parsed ? parsed.text || void 0 : params.payload.text || void 0;
|
|
272
|
-
if (params.trimLeadingWhitespace && text) text = text.trimStart() || void 0;
|
|
273
|
-
const mediaUrls = params.payload.mediaUrls ?? parsed?.mediaUrls;
|
|
274
|
-
const mediaUrl = params.payload.mediaUrl ?? parsed?.mediaUrl ?? mediaUrls?.[0];
|
|
275
|
-
return {
|
|
276
|
-
payload: copyReplyPayloadMetadata(params.payload, {
|
|
277
|
-
...params.payload,
|
|
278
|
-
text,
|
|
279
|
-
mediaUrls,
|
|
280
|
-
mediaUrl,
|
|
281
|
-
replyToId: params.payload.replyToId ?? parsed?.replyToId,
|
|
282
|
-
replyToTag: params.payload.replyToTag || parsed?.replyToTag,
|
|
283
|
-
replyToCurrent: params.payload.replyToCurrent || parsed?.replyToCurrent,
|
|
284
|
-
audioAsVoice: Boolean(params.payload.audioAsVoice || parsed?.audioAsVoice)
|
|
285
|
-
}),
|
|
286
|
-
isSilent: parsed?.isSilent ?? false
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
async function sendDirectBlockReply(params) {
|
|
290
|
-
params.directlySentBlockKeys.add(createBlockReplyContentKey(params.trackingPayload));
|
|
291
|
-
await params.onBlockReply(params.payload);
|
|
292
|
-
}
|
|
293
|
-
function createBlockReplyDeliveryHandler(params) {
|
|
294
|
-
return async (payload) => {
|
|
295
|
-
const { text, skip } = params.normalizeStreamingText(payload);
|
|
296
|
-
if (skip && !hasOutboundReplyContent({
|
|
297
|
-
...payload,
|
|
298
|
-
text: void 0
|
|
299
|
-
})) return;
|
|
300
|
-
const implicitCurrentMessageAllowed = payload.replyToCurrent === true ? true : payload.replyToCurrent === false ? false : params.replyThreading?.implicitCurrentMessage !== "deny";
|
|
301
|
-
const taggedPayload = applyReplyTagsToPayload({
|
|
302
|
-
...payload,
|
|
303
|
-
text,
|
|
304
|
-
mediaUrl: payload.mediaUrl ?? payload.mediaUrls?.[0],
|
|
305
|
-
replyToId: payload.replyToId ?? (implicitCurrentMessageAllowed ? params.currentMessageId : void 0)
|
|
306
|
-
}, params.currentMessageId);
|
|
307
|
-
if (!isRenderablePayload(taggedPayload) && !payload.audioAsVoice) return;
|
|
308
|
-
const normalized = normalizeReplyPayloadDirectives({
|
|
309
|
-
payload: taggedPayload,
|
|
310
|
-
currentMessageId: params.currentMessageId,
|
|
311
|
-
silentToken: SILENT_REPLY_TOKEN,
|
|
312
|
-
trimLeadingWhitespace: true,
|
|
313
|
-
parseMode: "auto"
|
|
314
|
-
});
|
|
315
|
-
const mediaNormalizedPayload = params.normalizeMediaPaths ? await params.normalizeMediaPaths(normalized.payload) : normalized.payload;
|
|
316
|
-
if (normalized.isSilent) mediaNormalizedPayload.text = void 0;
|
|
317
|
-
const blockPayload = copyReplyPayloadMetadata(payload, params.applyReplyToMode(mediaNormalizedPayload));
|
|
318
|
-
const blockHasNonTextContent = hasOutboundReplyContent({
|
|
319
|
-
...blockPayload,
|
|
320
|
-
text: void 0
|
|
321
|
-
});
|
|
322
|
-
if (!blockPayload.text && !blockHasNonTextContent && !blockPayload.audioAsVoice) return;
|
|
323
|
-
if (normalized.isSilent && !blockHasNonTextContent) return;
|
|
324
|
-
if (blockPayload.text) params.typingSignals.signalTextDelta(blockPayload.text).catch((err) => {
|
|
325
|
-
logVerbose(`block reply typing signal failed: ${String(err)}`);
|
|
326
|
-
});
|
|
327
|
-
if (params.blockStreamingEnabled && params.blockReplyPipeline) params.blockReplyPipeline.enqueue(blockPayload);
|
|
328
|
-
else if (params.blockStreamingEnabled) await sendDirectBlockReply({
|
|
329
|
-
onBlockReply: params.onBlockReply,
|
|
330
|
-
directlySentBlockKeys: params.directlySentBlockKeys,
|
|
331
|
-
trackingPayload: blockPayload,
|
|
332
|
-
payload: blockPayload
|
|
333
|
-
});
|
|
334
|
-
else if (blockHasNonTextContent) await sendDirectBlockReply({
|
|
335
|
-
onBlockReply: params.onBlockReply,
|
|
336
|
-
directlySentBlockKeys: params.directlySentBlockKeys,
|
|
337
|
-
trackingPayload: blockPayload,
|
|
338
|
-
payload: blockPayload
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
const agentTurnTimingLog = createSubsystemLogger("auto-reply/agent-turn-timing");
|
|
343
|
-
const AGENT_TURN_TIMING_WARN_TOTAL_MS = 1e3;
|
|
344
|
-
const AGENT_TURN_TIMING_WARN_STAGE_MS = 500;
|
|
345
|
-
function createAgentTurnTimingTracker(options = {}) {
|
|
346
|
-
if (!options.profilerEnabled) return {
|
|
347
|
-
async measure(_name, run) {
|
|
348
|
-
return await run();
|
|
349
|
-
},
|
|
350
|
-
measureSync(_name, run) {
|
|
351
|
-
return run();
|
|
352
|
-
},
|
|
353
|
-
logIfSlow() {},
|
|
354
|
-
logMilestoneIfSlow() {}
|
|
355
|
-
};
|
|
356
|
-
const startedAt = Date.now();
|
|
357
|
-
let didLog = false;
|
|
358
|
-
const spans = [];
|
|
359
|
-
const toMs = (value) => Math.max(0, Math.round(value));
|
|
360
|
-
const record = (name, spanStartedAt) => {
|
|
361
|
-
spans.push({
|
|
362
|
-
name,
|
|
363
|
-
durationMs: toMs(Date.now() - spanStartedAt),
|
|
364
|
-
elapsedMs: toMs(Date.now() - startedAt)
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
const snapshot = () => ({
|
|
368
|
-
totalMs: toMs(Date.now() - startedAt),
|
|
369
|
-
spans: spans.slice()
|
|
370
|
-
});
|
|
371
|
-
const shouldLog = (summary) => summary.totalMs >= AGENT_TURN_TIMING_WARN_TOTAL_MS || summary.spans.some((span) => span.durationMs >= AGENT_TURN_TIMING_WARN_STAGE_MS);
|
|
372
|
-
const formatSpans = (summary) => summary.spans.length > 0 ? summary.spans.map((span) => `${span.name}:${span.durationMs}ms@${span.elapsedMs}ms`).join(",") : "none";
|
|
373
|
-
return {
|
|
374
|
-
async measure(name, run) {
|
|
375
|
-
const spanStartedAt = Date.now();
|
|
376
|
-
try {
|
|
377
|
-
return await run();
|
|
378
|
-
} finally {
|
|
379
|
-
record(name, spanStartedAt);
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
measureSync(name, run) {
|
|
383
|
-
const spanStartedAt = Date.now();
|
|
384
|
-
try {
|
|
385
|
-
return run();
|
|
386
|
-
} finally {
|
|
387
|
-
record(name, spanStartedAt);
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
logIfSlow(params) {
|
|
391
|
-
if (didLog) return;
|
|
392
|
-
const summary = snapshot();
|
|
393
|
-
if (!shouldLog(summary)) return;
|
|
394
|
-
didLog = true;
|
|
395
|
-
agentTurnTimingLog.warn(`agent turn timings runId=${params.runId} sessionId=${params.sessionId ?? "unknown"} sessionKey=${params.sessionKey ?? "unknown"} outcome=${params.outcome} totalMs=${summary.totalMs} stages=${formatSpans(summary)}${params.error ? ` error="${params.error}"` : ""}`, {
|
|
396
|
-
runId: params.runId,
|
|
397
|
-
sessionId: params.sessionId,
|
|
398
|
-
sessionKey: params.sessionKey,
|
|
399
|
-
outcome: params.outcome,
|
|
400
|
-
error: params.error,
|
|
401
|
-
totalMs: summary.totalMs,
|
|
402
|
-
spans: summary.spans
|
|
403
|
-
});
|
|
404
|
-
},
|
|
405
|
-
logMilestoneIfSlow(params) {
|
|
406
|
-
if (!options.profilerEnabled) return;
|
|
407
|
-
const summary = snapshot();
|
|
408
|
-
if (!shouldLog(summary)) return;
|
|
409
|
-
agentTurnTimingLog.warn(`agent turn milestone runId=${params.runId} sessionId=${params.sessionId ?? "unknown"} sessionKey=${params.sessionKey ?? "unknown"} milestone=${params.milestone} totalMs=${summary.totalMs} stages=${formatSpans(summary)}`, {
|
|
410
|
-
runId: params.runId,
|
|
411
|
-
sessionId: params.sessionId,
|
|
412
|
-
sessionKey: params.sessionKey,
|
|
413
|
-
milestone: params.milestone,
|
|
414
|
-
totalMs: summary.totalMs,
|
|
415
|
-
spans: summary.spans
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
function readApprovalScopeValue(value) {
|
|
421
|
-
return value === "turn" || value === "session" ? value : void 0;
|
|
422
|
-
}
|
|
423
|
-
const FALLBACK_SELECTION_STATE_KEYS = [
|
|
424
|
-
"providerOverride",
|
|
425
|
-
"modelOverride",
|
|
426
|
-
"modelOverrideSource",
|
|
427
|
-
"modelOverrideFallbackOriginProvider",
|
|
428
|
-
"modelOverrideFallbackOriginModel",
|
|
429
|
-
"authProfileOverride",
|
|
430
|
-
"authProfileOverrideSource",
|
|
431
|
-
"authProfileOverrideCompactionCount"
|
|
432
|
-
];
|
|
433
|
-
function setFallbackSelectionStateField(entry, key, value) {
|
|
434
|
-
switch (key) {
|
|
435
|
-
case "providerOverride":
|
|
436
|
-
if (entry.providerOverride !== value) {
|
|
437
|
-
entry.providerOverride = value;
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
return false;
|
|
441
|
-
case "modelOverride":
|
|
442
|
-
if (entry.modelOverride !== value) {
|
|
443
|
-
entry.modelOverride = value;
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
return false;
|
|
447
|
-
case "modelOverrideSource":
|
|
448
|
-
if (entry.modelOverrideSource !== value) {
|
|
449
|
-
entry.modelOverrideSource = value;
|
|
450
|
-
return true;
|
|
451
|
-
}
|
|
452
|
-
return false;
|
|
453
|
-
case "modelOverrideFallbackOriginProvider":
|
|
454
|
-
if (entry.modelOverrideFallbackOriginProvider !== value) {
|
|
455
|
-
entry.modelOverrideFallbackOriginProvider = value;
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
return false;
|
|
459
|
-
case "modelOverrideFallbackOriginModel":
|
|
460
|
-
if (entry.modelOverrideFallbackOriginModel !== value) {
|
|
461
|
-
entry.modelOverrideFallbackOriginModel = value;
|
|
462
|
-
return true;
|
|
463
|
-
}
|
|
464
|
-
return false;
|
|
465
|
-
case "authProfileOverride":
|
|
466
|
-
if (entry.authProfileOverride !== value) {
|
|
467
|
-
entry.authProfileOverride = value;
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
return false;
|
|
471
|
-
case "authProfileOverrideSource":
|
|
472
|
-
if (entry.authProfileOverrideSource !== value) {
|
|
473
|
-
entry.authProfileOverrideSource = value;
|
|
474
|
-
return true;
|
|
475
|
-
}
|
|
476
|
-
return false;
|
|
477
|
-
case "authProfileOverrideCompactionCount":
|
|
478
|
-
if (entry.authProfileOverrideCompactionCount !== value) {
|
|
479
|
-
entry.authProfileOverrideCompactionCount = value;
|
|
480
|
-
return true;
|
|
481
|
-
}
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
throw new Error("Unsupported fallback selection state key");
|
|
485
|
-
}
|
|
486
|
-
function snapshotFallbackSelectionState(entry) {
|
|
487
|
-
return {
|
|
488
|
-
providerOverride: entry.providerOverride,
|
|
489
|
-
modelOverride: entry.modelOverride,
|
|
490
|
-
modelOverrideSource: entry.modelOverrideSource,
|
|
491
|
-
modelOverrideFallbackOriginProvider: entry.modelOverrideFallbackOriginProvider,
|
|
492
|
-
modelOverrideFallbackOriginModel: entry.modelOverrideFallbackOriginModel,
|
|
493
|
-
authProfileOverride: entry.authProfileOverride,
|
|
494
|
-
authProfileOverrideSource: entry.authProfileOverrideSource,
|
|
495
|
-
authProfileOverrideCompactionCount: entry.authProfileOverrideCompactionCount
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
function buildFallbackSelectionState(params) {
|
|
499
|
-
return {
|
|
500
|
-
providerOverride: params.provider,
|
|
501
|
-
modelOverride: params.model,
|
|
502
|
-
modelOverrideSource: "auto",
|
|
503
|
-
modelOverrideFallbackOriginProvider: params.originProvider,
|
|
504
|
-
modelOverrideFallbackOriginModel: params.originModel,
|
|
505
|
-
authProfileOverride: params.authProfileId,
|
|
506
|
-
authProfileOverrideSource: params.authProfileId ? params.authProfileIdSource : void 0,
|
|
507
|
-
authProfileOverrideCompactionCount: void 0
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
function resolveFallbackSelectionOrigin(params) {
|
|
511
|
-
if (params.entry.modelOverrideSource === "auto" || params.entry.modelOverrideSource === void 0 && hasSessionAutoModelFallbackProvenance(params.entry)) {
|
|
512
|
-
const persistedOriginProvider = normalizeOptionalString(params.entry.modelOverrideFallbackOriginProvider);
|
|
513
|
-
const persistedOriginModel = normalizeOptionalString(params.entry.modelOverrideFallbackOriginModel);
|
|
514
|
-
if (persistedOriginProvider && persistedOriginModel) return {
|
|
515
|
-
provider: persistedOriginProvider,
|
|
516
|
-
model: persistedOriginModel
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
provider: params.run.provider,
|
|
521
|
-
model: params.run.model
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
function applyFallbackCandidateSelectionToEntry(params) {
|
|
525
|
-
if (!params.force && params.provider === params.run.provider && params.model === params.run.model) return { updated: false };
|
|
526
|
-
const scopedAuthProfile = resolveRunAuthProfile(params.run, params.provider);
|
|
527
|
-
const origin = params.origin ?? resolveFallbackSelectionOrigin({
|
|
528
|
-
entry: params.entry,
|
|
529
|
-
run: params.run
|
|
530
|
-
});
|
|
531
|
-
const nextState = buildFallbackSelectionState({
|
|
532
|
-
provider: params.provider,
|
|
533
|
-
model: params.model,
|
|
534
|
-
originProvider: origin.provider,
|
|
535
|
-
originModel: origin.model,
|
|
536
|
-
authProfileId: scopedAuthProfile.authProfileId,
|
|
537
|
-
authProfileIdSource: scopedAuthProfile.authProfileIdSource
|
|
538
|
-
});
|
|
539
|
-
return {
|
|
540
|
-
updated: applyFallbackSelectionState(params.entry, nextState, params.now),
|
|
541
|
-
nextState
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
function applyFallbackSelectionState(entry, nextState, now = Date.now()) {
|
|
545
|
-
let updated = false;
|
|
546
|
-
for (const key of FALLBACK_SELECTION_STATE_KEYS) {
|
|
547
|
-
const nextValue = nextState[key];
|
|
548
|
-
if (nextValue === void 0) {
|
|
549
|
-
if (Object.hasOwn(entry, key)) {
|
|
550
|
-
delete entry[key];
|
|
551
|
-
updated = true;
|
|
552
|
-
}
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
if (entry[key] !== nextValue) updated = setFallbackSelectionStateField(entry, key, nextValue) || updated;
|
|
556
|
-
}
|
|
557
|
-
if (updated) entry.updatedAt = now;
|
|
558
|
-
return updated;
|
|
559
|
-
}
|
|
560
|
-
function rollbackFallbackSelectionStateIfUnchanged(entry, expectedState, previousState, now = Date.now()) {
|
|
561
|
-
let updated = false;
|
|
562
|
-
for (const key of FALLBACK_SELECTION_STATE_KEYS) {
|
|
563
|
-
if (entry[key] !== expectedState[key]) continue;
|
|
564
|
-
const previousValue = previousState[key];
|
|
565
|
-
if (previousValue === void 0) {
|
|
566
|
-
if (Object.hasOwn(entry, key)) {
|
|
567
|
-
delete entry[key];
|
|
568
|
-
updated = true;
|
|
569
|
-
}
|
|
570
|
-
continue;
|
|
571
|
-
}
|
|
572
|
-
if (entry[key] !== previousValue) updated = setFallbackSelectionStateField(entry, key, previousValue) || updated;
|
|
573
|
-
}
|
|
574
|
-
if (updated) entry.updatedAt = now;
|
|
575
|
-
return updated;
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* Build a human-friendly rate-limit message from a FallbackSummaryError.
|
|
579
|
-
* Includes a countdown when the soonest cooldown expiry is known.
|
|
580
|
-
*/
|
|
581
|
-
function buildRateLimitCooldownMessage(err) {
|
|
582
|
-
const codexUsageLimitMessage = extractCodexUsageLimitErrorMessage(err);
|
|
583
|
-
if (codexUsageLimitMessage) return codexUsageLimitMessage;
|
|
584
|
-
if (isFallbackSummaryError(err) && hasBillingAttemptSummary(err)) return BILLING_ERROR_USER_MESSAGE;
|
|
585
|
-
if (isBillingErrorMessage(formatErrorMessage(err))) return BILLING_ERROR_USER_MESSAGE;
|
|
586
|
-
if (!isFallbackSummaryError(err)) return "⚠️ All models are temporarily rate-limited. Please try again in a few minutes.";
|
|
587
|
-
const expiry = err.soonestCooldownExpiry;
|
|
588
|
-
const now = Date.now();
|
|
589
|
-
if (typeof expiry === "number" && expiry > now) {
|
|
590
|
-
const secsLeft = Math.max(1, Math.ceil((expiry - now) / 1e3));
|
|
591
|
-
if (secsLeft <= 60) return `⚠️ Rate-limited — ready in ~${secsLeft}s. Please wait a moment.`;
|
|
592
|
-
return `⚠️ Rate-limited — ready in ~${Math.ceil(secsLeft / 60)} min. Please try again shortly.`;
|
|
593
|
-
}
|
|
594
|
-
return "⚠️ All models are temporarily rate-limited. Please try again in a few minutes.";
|
|
595
|
-
}
|
|
596
|
-
function extractCodexUsageLimitErrorMessage(err) {
|
|
597
|
-
if (isFallbackSummaryError(err)) {
|
|
598
|
-
for (const attempt of err.attempts) {
|
|
599
|
-
const message = extractCodexUsageLimitMessage(attempt.error);
|
|
600
|
-
if (message) return `⚠️ ${message}`;
|
|
601
|
-
}
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
const message = extractCodexUsageLimitMessage(formatErrorMessage(err));
|
|
605
|
-
return message ? `⚠️ ${message}` : void 0;
|
|
606
|
-
}
|
|
607
|
-
function extractCodexUsageLimitMessage(text) {
|
|
608
|
-
const markers = ["You've reached your Codex subscription usage limit.", "Codex usage limit reached."];
|
|
609
|
-
let markerIndex;
|
|
610
|
-
for (const marker of markers) {
|
|
611
|
-
const index = text.indexOf(marker);
|
|
612
|
-
if (index >= 0 && (markerIndex === void 0 || index < markerIndex)) markerIndex = index;
|
|
613
|
-
}
|
|
614
|
-
if (markerIndex === void 0) return;
|
|
615
|
-
const message = sanitizeUserFacingText(text.slice(markerIndex), { errorContext: true }).split(/\r?\n/u).map((line) => line.trim()).filter(Boolean).join(" ").trim();
|
|
616
|
-
if (!message) return;
|
|
617
|
-
return message.length > 500 ? `${message.slice(0, 497)}...` : message;
|
|
618
|
-
}
|
|
619
|
-
function isPureTransientRateLimitSummary(err) {
|
|
620
|
-
return isFallbackSummaryError(err) && err.attempts.length > 0 && err.attempts.every((attempt) => {
|
|
621
|
-
const reason = attempt.reason;
|
|
622
|
-
return reason === "rate_limit" || reason === "overloaded";
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
function hasBillingAttemptSummary(err) {
|
|
626
|
-
return isFallbackSummaryError(err) && err.attempts.length > 0 && err.attempts.some((attempt) => attempt.reason === "billing");
|
|
627
|
-
}
|
|
628
|
-
function collapseRepeatedFailureDetail(message) {
|
|
629
|
-
const parts = message.split(/\s+\|\s+/u).map((part) => part.trim()).filter(Boolean);
|
|
630
|
-
if (parts.length >= 2 && parts.every((part) => part === parts[0])) return parts[0];
|
|
631
|
-
return message.trim();
|
|
632
|
-
}
|
|
633
|
-
const SAFE_MISSING_API_KEY_PROVIDERS = new Set([
|
|
634
|
-
"anthropic",
|
|
635
|
-
"google",
|
|
636
|
-
"openai",
|
|
637
|
-
"openai-codex"
|
|
638
|
-
]);
|
|
639
|
-
const EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS = 900;
|
|
640
|
-
const AGENT_FAILED_BEFORE_REPLY_TEXT = "Agent failed before reply:";
|
|
641
|
-
function isNonDirectConversationContext(ctx) {
|
|
642
|
-
const chatType = normalizeLowercaseStringOrEmpty(ctx.ChatType);
|
|
643
|
-
return chatType === "group" || chatType === "channel";
|
|
644
|
-
}
|
|
645
|
-
function isVerboseFailureDetailEnabled(level) {
|
|
646
|
-
return level === "on" || level === "full";
|
|
647
|
-
}
|
|
648
|
-
function resolveExternalRunFailureTextForConversation(params) {
|
|
649
|
-
if (!isNonDirectConversationContext(params.sessionCtx)) return params.text;
|
|
650
|
-
if (!params.suppressInNonDirect && !params.isGenericRunnerFailure && !params.text.includes(AGENT_FAILED_BEFORE_REPLY_TEXT)) return params.text;
|
|
651
|
-
if (resolveSilentReplyPolicy({
|
|
652
|
-
cfg: params.cfg,
|
|
653
|
-
sessionKey: params.sessionCtx.SessionKey,
|
|
654
|
-
surface: params.sessionCtx.Surface ?? params.sessionCtx.Provider,
|
|
655
|
-
conversationType: "group"
|
|
656
|
-
}) === "disallow") return params.text;
|
|
657
|
-
return SILENT_REPLY_TOKEN;
|
|
658
|
-
}
|
|
659
|
-
const CLI_BACKEND_NO_OUTPUT_STALL_RE = /\bCLI produced no output for\s+(\d+)\s*s\s+and was terminated\b/iu;
|
|
660
|
-
const CLI_BACKEND_OVERALL_TIMEOUT_RE = /\bCLI exceeded timeout\s*\(\s*(\d+)\s*s\s*\)\s+and was terminated\b/iu;
|
|
661
|
-
const CLI_BACKEND_ROUTING_REF_BEFORE_ERROR_RE = /\b([\w.-]+\/[A-Za-z][\w.-]*)\s*:\s*CLI\b/iu;
|
|
662
|
-
const CODEX_APP_SERVER_CLIENT_CLOSED_BEFORE_REPLY_RE = /\bcodex app-server client closed before turn completed\b/iu;
|
|
663
|
-
const CODEX_APP_SERVER_TURN_COMPLETION_IDLE_TIMEOUT_RE = /\bcodex app-server turn idle timed out waiting for turn\/completed\b/iu;
|
|
664
|
-
function buildCodexAppServerFailureText(message) {
|
|
665
|
-
const normalizedMessage = collapseRepeatedFailureDetail(message);
|
|
666
|
-
if (CODEX_APP_SERVER_CLIENT_CLOSED_BEFORE_REPLY_RE.test(normalizedMessage)) return "⚠️ Codex app-server connection closed before this turn finished. FengMing retried once when the stdio turn was still replay-safe; please try again if this keeps happening.";
|
|
667
|
-
if (CODEX_APP_SERVER_TURN_COMPLETION_IDLE_TIMEOUT_RE.test(normalizedMessage)) return "⚠️ Codex app-server stopped before confirming turn completion. FengMing did not replay the turn automatically because it may still be active; try again, or use /new if the session stays stuck.";
|
|
668
|
-
return null;
|
|
669
|
-
}
|
|
670
|
-
function buildCliBackendTimeoutFailureText(message) {
|
|
671
|
-
const normalizedMessage = collapseRepeatedFailureDetail(message);
|
|
672
|
-
const stall = normalizedMessage.match(CLI_BACKEND_NO_OUTPUT_STALL_RE);
|
|
673
|
-
const overall = normalizedMessage.match(CLI_BACKEND_OVERALL_TIMEOUT_RE);
|
|
674
|
-
const seconds = (stall ?? overall)?.[1];
|
|
675
|
-
if (!seconds) return null;
|
|
676
|
-
const routedModelRef = normalizedMessage.match(CLI_BACKEND_ROUTING_REF_BEFORE_ERROR_RE)?.[1];
|
|
677
|
-
return `⚠️ CLI subprocess${routedModelRef ? ` (routing ${routedModelRef})` : ""}: timed out after ${seconds}s (${stall ? "no-output stall" : "overall CLI turn budget"}). The gateway may still be healthy. Try \`/new\`, a lighter model, or raise \`agents.defaults.timeoutSeconds\` and the watchdog \`noOutputTimeoutMs\` entries under \`cliBackends.<your-runtime>\`.`;
|
|
678
|
-
}
|
|
679
|
-
function buildMissingApiKeyFailureText(message) {
|
|
680
|
-
const normalizedMessage = collapseRepeatedFailureDetail(message);
|
|
681
|
-
const provider = normalizedMessage.match(/No API key found for provider "([^"]+)"/u)?.[1]?.trim().toLowerCase();
|
|
682
|
-
if (!provider) return null;
|
|
683
|
-
if (provider === "openai" && normalizedMessage.includes("OpenAI Codex OAuth")) return "⚠️ Missing API key for OpenAI on the gateway. Use `openai/gpt-5.5` with the Codex O认证配置, or set `OPENAI_API_KEY` for direct OpenAI API-key runs.";
|
|
684
|
-
if (provider === "openai-codex") return "⚠️ The session is pointing at a stale OpenAI Codex auth route. Run `fengming doctor --fix` to repair Codex model/session routes, restart the gateway if doctor asks, then try again. If doctor has nothing to repair or the error persists, re-auth with `fengming models auth login --provider openai` or run `fengming configure`.";
|
|
685
|
-
if (SAFE_MISSING_API_KEY_PROVIDERS.has(provider)) return `⚠️ Missing API key for provider "${provider}". Configure the gateway auth for that provider, then try again.`;
|
|
686
|
-
return "⚠️ Missing API key for the selected provider on the gateway. Configure provider auth, then try again.";
|
|
687
|
-
}
|
|
688
|
-
function formatForwardedExternalRunFailureText(message) {
|
|
689
|
-
const sanitized = sanitizeUserFacingText(message, { errorContext: true }).trim().replace(/^⚠️\s*/u, "").replace(/\s+/gu, " ");
|
|
690
|
-
if (!sanitized) return GENERIC_EXTERNAL_RUN_FAILURE_TEXT;
|
|
691
|
-
const detail = sanitized.length > EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS ? `${sanitized.slice(0, EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS - 1).trimEnd()}…` : sanitized;
|
|
692
|
-
return `⚠️ Agent failed before reply: ${detail}${/[.!?]$/u.test(detail) ? "" : "."} Please try again, or use /new to start a fresh session.`;
|
|
693
|
-
}
|
|
694
|
-
function buildExternalRunFailureReply(message, options) {
|
|
695
|
-
const normalizedMessage = collapseRepeatedFailureDetail(message);
|
|
696
|
-
const providerRequestError = classifyProviderRequestError(normalizedMessage);
|
|
697
|
-
if (providerRequestError) return {
|
|
698
|
-
text: providerRequestError.userMessage,
|
|
699
|
-
isGenericRunnerFailure: false
|
|
700
|
-
};
|
|
701
|
-
const missingApiKeyFailure = buildMissingApiKeyFailureText(normalizedMessage);
|
|
702
|
-
if (missingApiKeyFailure) return {
|
|
703
|
-
text: missingApiKeyFailure,
|
|
704
|
-
isGenericRunnerFailure: false
|
|
705
|
-
};
|
|
706
|
-
const oauthRefreshFailure = classifyOAuthRefreshFailure(normalizedMessage);
|
|
707
|
-
if (oauthRefreshFailure) {
|
|
708
|
-
const loginCommand = buildOAuthRefreshFailureLoginCommand(oauthRefreshFailure.provider);
|
|
709
|
-
if (oauthRefreshFailure.reason) return {
|
|
710
|
-
text: `⚠️ Model login expired on the gateway${oauthRefreshFailure.provider ? ` for ${oauthRefreshFailure.provider}` : ""}. Re-auth with \`${loginCommand}\`, then try again.`,
|
|
711
|
-
isGenericRunnerFailure: false
|
|
712
|
-
};
|
|
713
|
-
return {
|
|
714
|
-
text: `⚠️ Model login failed on the gateway${oauthRefreshFailure.provider ? ` for ${oauthRefreshFailure.provider}` : ""}. Please try again. If this keeps happening, re-auth with \`${loginCommand}\`.`,
|
|
715
|
-
isGenericRunnerFailure: false
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
if (options?.isHeartbeat) return {
|
|
719
|
-
text: HEARTBEAT_EXTERNAL_RUN_FAILURE_TEXT,
|
|
720
|
-
isGenericRunnerFailure: false
|
|
721
|
-
};
|
|
722
|
-
const cliBackendTimeoutFailure = buildCliBackendTimeoutFailureText(normalizedMessage);
|
|
723
|
-
if (cliBackendTimeoutFailure) return {
|
|
724
|
-
text: cliBackendTimeoutFailure,
|
|
725
|
-
isGenericRunnerFailure: false
|
|
726
|
-
};
|
|
727
|
-
const codexAppServerFailure = buildCodexAppServerFailureText(normalizedMessage);
|
|
728
|
-
if (codexAppServerFailure) return {
|
|
729
|
-
text: codexAppServerFailure,
|
|
730
|
-
isGenericRunnerFailure: false
|
|
731
|
-
};
|
|
732
|
-
return {
|
|
733
|
-
text: options?.includeDetails ? formatForwardedExternalRunFailureText(normalizedMessage) : GENERIC_EXTERNAL_RUN_FAILURE_TEXT,
|
|
734
|
-
isGenericRunnerFailure: true
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
function markAgentRunFailureReplyPayload(payload) {
|
|
738
|
-
return markReplyPayloadForSourceSuppressionDelivery(payload);
|
|
739
|
-
}
|
|
740
|
-
function buildKnownAgentRunFailureReplyPayload(params) {
|
|
741
|
-
const message = formatErrorMessage(params.err);
|
|
742
|
-
const isFallbackSummary = isFallbackSummaryError(params.err);
|
|
743
|
-
if (isFallbackSummary ? hasBillingAttemptSummary(params.err) : isBillingErrorMessage(message)) return markAgentRunFailureReplyPayload({ text: resolveExternalRunFailureTextForConversation({
|
|
744
|
-
text: BILLING_ERROR_USER_MESSAGE,
|
|
745
|
-
sessionCtx: params.sessionCtx,
|
|
746
|
-
isGenericRunnerFailure: false,
|
|
747
|
-
cfg: params.cfg
|
|
748
|
-
}) });
|
|
749
|
-
const isPureTransientSummary = isFallbackSummary ? isPureTransientRateLimitSummary(params.err) : false;
|
|
750
|
-
const isRateLimit = isFallbackSummary ? isPureTransientSummary : isRateLimitErrorMessage(message);
|
|
751
|
-
const rateLimitOrOverloadedCopy = !isFallbackSummary || isPureTransientSummary ? formatRateLimitOrOverloadedErrorCopy(message) : void 0;
|
|
752
|
-
if (isRateLimit && !isOverloadedErrorMessage(message)) return markAgentRunFailureReplyPayload({ text: resolveExternalRunFailureTextForConversation({
|
|
753
|
-
text: buildRateLimitCooldownMessage(params.err),
|
|
754
|
-
sessionCtx: params.sessionCtx,
|
|
755
|
-
isGenericRunnerFailure: false,
|
|
756
|
-
suppressInNonDirect: true,
|
|
757
|
-
cfg: params.cfg
|
|
758
|
-
}) });
|
|
759
|
-
if (rateLimitOrOverloadedCopy) return markAgentRunFailureReplyPayload({ text: resolveExternalRunFailureTextForConversation({
|
|
760
|
-
text: rateLimitOrOverloadedCopy,
|
|
761
|
-
sessionCtx: params.sessionCtx,
|
|
762
|
-
isGenericRunnerFailure: false,
|
|
763
|
-
suppressInNonDirect: true,
|
|
764
|
-
cfg: params.cfg
|
|
765
|
-
}) });
|
|
766
|
-
const externalRunFailureReply = buildExternalRunFailureReply(message, { includeDetails: isVerboseFailureDetailEnabled(params.resolvedVerboseLevel) });
|
|
767
|
-
if (externalRunFailureReply.isGenericRunnerFailure) return;
|
|
768
|
-
return markAgentRunFailureReplyPayload({ text: resolveExternalRunFailureTextForConversation({
|
|
769
|
-
text: externalRunFailureReply.text,
|
|
770
|
-
sessionCtx: params.sessionCtx,
|
|
771
|
-
isGenericRunnerFailure: false,
|
|
772
|
-
cfg: params.cfg
|
|
773
|
-
}) });
|
|
774
|
-
}
|
|
775
|
-
const DEFAULT_RESERVE_TOKENS_FLOOR = 2e4;
|
|
776
|
-
function computeContextAwareReserveTokensFloor(contextWindow) {
|
|
777
|
-
if (typeof contextWindow !== "number" || contextWindow <= 0) return DEFAULT_RESERVE_TOKENS_FLOOR;
|
|
778
|
-
if (contextWindow >= 1e6) return 1e5;
|
|
779
|
-
if (contextWindow >= 2e5) return 5e4;
|
|
780
|
-
if (contextWindow >= 1e5) return 35e3;
|
|
781
|
-
return DEFAULT_RESERVE_TOKENS_FLOOR;
|
|
782
|
-
}
|
|
783
|
-
function resolveContextWindowForCompactionHint(params) {
|
|
784
|
-
let modelWindow;
|
|
785
|
-
const entryProvider = params.activeSessionEntry?.modelProvider;
|
|
786
|
-
const entryModel = params.activeSessionEntry?.model;
|
|
787
|
-
const runtimeProvider = params.runtimeProvider ?? entryProvider;
|
|
788
|
-
const runtimeModel = params.runtimeModel ?? entryModel;
|
|
789
|
-
const hasExplicitRuntimeRef = Boolean(params.runtimeProvider && params.runtimeModel);
|
|
790
|
-
if (runtimeProvider && runtimeModel) {
|
|
791
|
-
const resolved = resolveContextTokensForModel({
|
|
792
|
-
cfg: params.cfg,
|
|
793
|
-
provider: runtimeProvider,
|
|
794
|
-
model: runtimeModel,
|
|
795
|
-
allowAsyncLoad: false
|
|
796
|
-
});
|
|
797
|
-
if (typeof resolved === "number" && resolved > 0) modelWindow = resolved;
|
|
798
|
-
}
|
|
799
|
-
const sessionWindow = normalizePositiveContextTokens(params.activeSessionEntry?.contextTokens);
|
|
800
|
-
const sessionMatchesRuntimeRef = runtimeProvider === entryProvider && runtimeModel === entryModel;
|
|
801
|
-
const trustedSessionWindow = !hasExplicitRuntimeRef || sessionMatchesRuntimeRef ? sessionWindow : void 0;
|
|
802
|
-
if (modelWindow === void 0 && sessionMatchesRuntimeRef && sessionWindow !== void 0) modelWindow = sessionWindow;
|
|
803
|
-
if (modelWindow === void 0 && !hasExplicitRuntimeRef && params.primaryProvider && params.primaryModel) {
|
|
804
|
-
const resolved = resolveContextTokensForModel({
|
|
805
|
-
cfg: params.cfg,
|
|
806
|
-
provider: params.primaryProvider,
|
|
807
|
-
model: params.primaryModel,
|
|
808
|
-
allowAsyncLoad: false
|
|
809
|
-
});
|
|
810
|
-
if (typeof resolved === "number" && resolved > 0) modelWindow = resolved;
|
|
811
|
-
}
|
|
812
|
-
const contextWindow = modelWindow ?? trustedSessionWindow;
|
|
813
|
-
const agentCap = resolveAgentContextTokensForHint({
|
|
814
|
-
cfg: params.cfg,
|
|
815
|
-
agentId: params.agentId
|
|
816
|
-
});
|
|
817
|
-
if (agentCap !== void 0 && contextWindow !== void 0) return Math.min(agentCap, contextWindow);
|
|
818
|
-
return agentCap ?? contextWindow;
|
|
819
|
-
}
|
|
820
|
-
function buildContextOverflowResetHint(contextWindowTokens) {
|
|
821
|
-
return `
|
|
822
|
-
|
|
823
|
-
To prevent this, increase your compaction buffer by setting \`agents.defaults.compaction.reserveTokensFloor\` to ${computeContextAwareReserveTokensFloor(contextWindowTokens)} or higher in your config.`;
|
|
824
|
-
}
|
|
825
|
-
function resolveAgentHeartbeatModelRaw(params) {
|
|
826
|
-
const defaultModel = normalizeOptionalString(params.cfg.agents?.defaults?.heartbeat?.model);
|
|
827
|
-
const agentId = normalizeLowercaseStringOrEmpty(params.agentId);
|
|
828
|
-
return (agentId ? normalizeOptionalString(params.cfg.agents?.list?.find((entry) => normalizeLowercaseStringOrEmpty(entry?.id) === agentId)?.heartbeat?.model) : void 0) ?? defaultModel;
|
|
829
|
-
}
|
|
830
|
-
function normalizeModelRefForCompare(ref) {
|
|
831
|
-
if (!ref) return;
|
|
832
|
-
const provider = normalizeLowercaseStringOrEmpty(ref.provider);
|
|
833
|
-
const model = normalizeLowercaseStringOrEmpty(ref.model);
|
|
834
|
-
return provider && model ? {
|
|
835
|
-
provider,
|
|
836
|
-
model
|
|
837
|
-
} : void 0;
|
|
838
|
-
}
|
|
839
|
-
function modelRefsEqual(left, right) {
|
|
840
|
-
const normalizedLeft = normalizeModelRefForCompare(left);
|
|
841
|
-
const normalizedRight = normalizeModelRefForCompare(right);
|
|
842
|
-
if (!normalizedLeft || !normalizedRight) return false;
|
|
843
|
-
return normalizedLeft.provider === normalizedRight.provider && normalizedLeft.model === normalizedRight.model;
|
|
844
|
-
}
|
|
845
|
-
function formatContextWindowLabel(tokens) {
|
|
846
|
-
if (tokens >= 1e6) return `${Math.round(tokens / 1e6 * 10) / 10}M`;
|
|
847
|
-
return `${Math.round(tokens / 1024)}k`;
|
|
848
|
-
}
|
|
849
|
-
function normalizePositiveContextTokens(value) {
|
|
850
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
851
|
-
return Math.floor(value);
|
|
852
|
-
}
|
|
853
|
-
function resolveAgentContextTokensForHint(params) {
|
|
854
|
-
const defaultContextTokens = normalizePositiveContextTokens(params.cfg.agents?.defaults?.contextTokens);
|
|
855
|
-
const agentId = normalizeLowercaseStringOrEmpty(params.agentId);
|
|
856
|
-
return (agentId ? normalizePositiveContextTokens(params.cfg.agents?.list?.find((entry) => normalizeLowercaseStringOrEmpty(entry?.id) === agentId)?.contextTokens) : void 0) ?? defaultContextTokens;
|
|
857
|
-
}
|
|
858
|
-
function resolveContextWindowForHint(params) {
|
|
859
|
-
const sessionContextTokens = normalizePositiveContextTokens(params.activeSessionEntry?.contextTokens);
|
|
860
|
-
const contextTokens = resolveContextTokensForModel({
|
|
861
|
-
cfg: params.cfg,
|
|
862
|
-
provider: params.ref.provider,
|
|
863
|
-
model: params.ref.model,
|
|
864
|
-
allowAsyncLoad: false
|
|
865
|
-
}) ?? sessionContextTokens;
|
|
866
|
-
if (contextTokens === void 0) return;
|
|
867
|
-
const agentContextTokens = resolveAgentContextTokensForHint({
|
|
868
|
-
cfg: params.cfg,
|
|
869
|
-
agentId: params.agentId
|
|
870
|
-
});
|
|
871
|
-
return agentContextTokens !== void 0 ? Math.min(agentContextTokens, contextTokens) : contextTokens;
|
|
872
|
-
}
|
|
873
|
-
function resolveHeartbeatBleedHint(params) {
|
|
874
|
-
const primaryProvider = normalizeOptionalString(params.primaryProvider);
|
|
875
|
-
const primaryModel = normalizeOptionalString(params.primaryModel);
|
|
876
|
-
if (!primaryProvider || !primaryModel) return;
|
|
877
|
-
const runtimeProvider = normalizeOptionalString(params.activeSessionEntry?.modelProvider);
|
|
878
|
-
const runtimeModel = normalizeOptionalString(params.activeSessionEntry?.model);
|
|
879
|
-
if (!runtimeProvider || !runtimeModel) return;
|
|
880
|
-
const primaryRef = {
|
|
881
|
-
provider: primaryProvider,
|
|
882
|
-
model: primaryModel
|
|
883
|
-
};
|
|
884
|
-
const runtimeRef = {
|
|
885
|
-
provider: runtimeProvider,
|
|
886
|
-
model: runtimeModel
|
|
887
|
-
};
|
|
888
|
-
if (modelRefsEqual(primaryRef, runtimeRef)) return;
|
|
889
|
-
const heartbeatModelRaw = resolveAgentHeartbeatModelRaw({
|
|
890
|
-
cfg: params.cfg,
|
|
891
|
-
agentId: params.agentId
|
|
892
|
-
});
|
|
893
|
-
if (!modelRefsEqual(runtimeRef, heartbeatModelRaw ? resolveModelRefFromString({
|
|
894
|
-
cfg: params.cfg,
|
|
895
|
-
raw: heartbeatModelRaw,
|
|
896
|
-
defaultProvider: primaryProvider
|
|
897
|
-
})?.ref : void 0)) return;
|
|
898
|
-
const runtimeWindow = resolveContextWindowForHint({
|
|
899
|
-
cfg: params.cfg,
|
|
900
|
-
agentId: params.agentId,
|
|
901
|
-
ref: runtimeRef,
|
|
902
|
-
activeSessionEntry: params.activeSessionEntry
|
|
903
|
-
});
|
|
904
|
-
const primaryWindow = resolveContextWindowForHint({
|
|
905
|
-
cfg: params.cfg,
|
|
906
|
-
agentId: params.agentId,
|
|
907
|
-
ref: primaryRef
|
|
908
|
-
});
|
|
909
|
-
if (typeof runtimeWindow === "number" && typeof primaryWindow === "number" && runtimeWindow >= primaryWindow) return;
|
|
910
|
-
return `\n\nThe previous heartbeat turn left this session on ${runtimeProvider}/${runtimeModel}${typeof runtimeWindow === "number" && runtimeWindow > 0 ? ` (${formatContextWindowLabel(runtimeWindow)} context)` : ""} instead of ${primaryProvider}/${primaryModel}. This matches the configured \`heartbeat.model\`, so the overflow is likely heartbeat model bleed rather than a compaction-buffer problem. Set \`heartbeat.isolatedSession: true\`, enable \`heartbeat.lightContext: true\`, or use a heartbeat model with a larger context window.`;
|
|
911
|
-
}
|
|
912
|
-
function buildContextOverflowRecoveryText(params) {
|
|
913
|
-
const prefix = params.preserveSessionMapping ? "⚠️ Auto-compaction could not recover this turn. I kept this conversation mapped to the current session. Please try again, use /compact, or use /new to start a fresh session." : params.duringCompaction ? "⚠️ Context limit exceeded during compaction. I've reset our conversation to start fresh - please try again." : "⚠️ Context limit exceeded. I've reset our conversation to start fresh - please try again.";
|
|
914
|
-
const primaryContextWindow = resolveContextWindowForCompactionHint({
|
|
915
|
-
cfg: params.cfg,
|
|
916
|
-
primaryProvider: params.primaryProvider,
|
|
917
|
-
primaryModel: params.primaryModel,
|
|
918
|
-
runtimeProvider: params.runtimeProvider,
|
|
919
|
-
runtimeModel: params.runtimeModel,
|
|
920
|
-
agentId: params.agentId,
|
|
921
|
-
activeSessionEntry: params.activeSessionEntry
|
|
922
|
-
});
|
|
923
|
-
return prefix + ((!params.runtimeProvider || !params.runtimeModel || params.runtimeProvider === params.activeSessionEntry?.modelProvider && params.runtimeModel === params.activeSessionEntry?.model ? resolveHeartbeatBleedHint({
|
|
924
|
-
cfg: params.cfg,
|
|
925
|
-
agentId: params.agentId,
|
|
926
|
-
primaryProvider: params.primaryProvider,
|
|
927
|
-
primaryModel: params.primaryModel,
|
|
928
|
-
activeSessionEntry: params.activeSessionEntry
|
|
929
|
-
}) : void 0) ?? buildContextOverflowResetHint(primaryContextWindow));
|
|
930
|
-
}
|
|
931
|
-
function buildRestartLifecycleReplyText() {
|
|
932
|
-
return "⚠️ Gateway is restarting. Please wait a few seconds and try again.";
|
|
933
|
-
}
|
|
934
|
-
function resolveRestartLifecycleError(err) {
|
|
935
|
-
const pending = [err];
|
|
936
|
-
const seen = /* @__PURE__ */ new Set();
|
|
937
|
-
let pendingIndex = 0;
|
|
938
|
-
while (pendingIndex < pending.length) {
|
|
939
|
-
const candidate = pending[pendingIndex++];
|
|
940
|
-
if (!candidate || seen.has(candidate)) continue;
|
|
941
|
-
seen.add(candidate);
|
|
942
|
-
if (candidate instanceof GatewayDrainingError || candidate instanceof CommandLaneClearedError) return candidate;
|
|
943
|
-
if (isFallbackSummaryError(candidate)) for (const attempt of candidate.attempts) pending.push(attempt.error);
|
|
944
|
-
if (candidate instanceof Error && "cause" in candidate) pending.push(candidate.cause);
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
function isReplyOperationUserAbort(replyOperation) {
|
|
948
|
-
return replyOperation?.result?.kind === "aborted" && replyOperation.result.code === "aborted_by_user";
|
|
949
|
-
}
|
|
950
|
-
function isReplyOperationRestartAbort(replyOperation) {
|
|
951
|
-
return replyOperation?.result?.kind === "aborted" && replyOperation.result.code === "aborted_for_restart";
|
|
952
|
-
}
|
|
953
|
-
function createEmbeddedLifecycleTerminalBackstop(params) {
|
|
954
|
-
let terminalEmitted = false;
|
|
955
|
-
let startedAt;
|
|
956
|
-
const note = (evt) => {
|
|
957
|
-
if (evt.stream !== "lifecycle") return;
|
|
958
|
-
const phase = readStringValue(evt.data.phase);
|
|
959
|
-
if (phase === "start" && typeof evt.data.startedAt === "number") startedAt = evt.data.startedAt;
|
|
960
|
-
if (phase === "end" || phase === "error") terminalEmitted = true;
|
|
961
|
-
};
|
|
962
|
-
const emit = (phase, resultOrError) => {
|
|
963
|
-
if (terminalEmitted) return;
|
|
964
|
-
terminalEmitted = true;
|
|
965
|
-
const data = {
|
|
966
|
-
phase,
|
|
967
|
-
endedAt: Date.now(),
|
|
968
|
-
...startedAt !== void 0 ? { startedAt } : {}
|
|
969
|
-
};
|
|
970
|
-
if (phase === "error") data.error = formatErrorMessage(resultOrError);
|
|
971
|
-
else {
|
|
972
|
-
const meta = resultOrError && typeof resultOrError === "object" && "meta" in resultOrError ? resultOrError.meta : void 0;
|
|
973
|
-
if (meta?.aborted === true) data.aborted = true;
|
|
974
|
-
const stopReason = readStringValue(meta?.stopReason);
|
|
975
|
-
if (stopReason) data.stopReason = stopReason;
|
|
976
|
-
const livenessState = readStringValue(meta?.livenessState);
|
|
977
|
-
if (livenessState) data.livenessState = livenessState;
|
|
978
|
-
if (meta?.replayInvalid === true) data.replayInvalid = true;
|
|
979
|
-
}
|
|
980
|
-
emitAgentEvent({
|
|
981
|
-
runId: params.runId,
|
|
982
|
-
...params.sessionKey ? { sessionKey: params.sessionKey } : {},
|
|
983
|
-
stream: "lifecycle",
|
|
984
|
-
data
|
|
985
|
-
});
|
|
986
|
-
};
|
|
987
|
-
return {
|
|
988
|
-
emit,
|
|
989
|
-
note
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
function emitModelFallbackStepLifecycle(params) {
|
|
993
|
-
emitAgentEvent({
|
|
994
|
-
runId: params.runId,
|
|
995
|
-
...params.sessionKey ? { sessionKey: params.sessionKey } : {},
|
|
996
|
-
stream: "lifecycle",
|
|
997
|
-
data: {
|
|
998
|
-
phase: "fallback_step",
|
|
999
|
-
...params.step
|
|
1000
|
-
}
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
function resolveSessionRuntimeOverrideForProvider(params) {
|
|
1004
|
-
const provider = normalizeLowercaseStringOrEmpty(params.provider);
|
|
1005
|
-
const runtime = normalizeLowercaseStringOrEmpty(params.entry?.agentRuntimeOverride);
|
|
1006
|
-
if (!runtime || runtime === "auto" || runtime === "default") return;
|
|
1007
|
-
if (provider === "openai" && runtime === "codex") return "codex";
|
|
1008
|
-
}
|
|
1009
|
-
function resolveRunAfterAutoFallbackPrimaryProbeRecheck(params) {
|
|
1010
|
-
const probe = params.run.autoFallbackPrimaryProbe;
|
|
1011
|
-
if (!probe || !params.sessionKey) return params.run;
|
|
1012
|
-
if (!params.entry) return params.run;
|
|
1013
|
-
const resolveEntrySelectionRun = () => {
|
|
1014
|
-
const entryRef = resolvePersistedOverrideModelRef({
|
|
1015
|
-
defaultProvider: params.run.provider,
|
|
1016
|
-
overrideProvider: params.entry?.providerOverride,
|
|
1017
|
-
overrideModel: params.entry?.modelOverride
|
|
1018
|
-
});
|
|
1019
|
-
const hasEntryModelOverride = Boolean(entryRef);
|
|
1020
|
-
const authProfileId = normalizeOptionalString(params.entry?.authProfileOverride);
|
|
1021
|
-
const fallbackRun = {
|
|
1022
|
-
...params.run,
|
|
1023
|
-
provider: entryRef?.provider ?? params.run.provider,
|
|
1024
|
-
model: entryRef?.model ?? params.run.model,
|
|
1025
|
-
autoFallbackPrimaryProbe: void 0
|
|
1026
|
-
};
|
|
1027
|
-
if (hasEntryModelOverride) {
|
|
1028
|
-
fallbackRun.hasSessionModelOverride = true;
|
|
1029
|
-
fallbackRun.hasAutoFallbackProvenance = hasSessionAutoModelFallbackProvenance(params.entry) || void 0;
|
|
1030
|
-
} else {
|
|
1031
|
-
delete fallbackRun.hasSessionModelOverride;
|
|
1032
|
-
delete fallbackRun.hasAutoFallbackProvenance;
|
|
1033
|
-
}
|
|
1034
|
-
if (hasEntryModelOverride && params.entry?.modelOverrideSource) fallbackRun.modelOverrideSource = params.entry.modelOverrideSource;
|
|
1035
|
-
else delete fallbackRun.modelOverrideSource;
|
|
1036
|
-
if (hasEntryModelOverride && authProfileId) {
|
|
1037
|
-
fallbackRun.authProfileId = authProfileId;
|
|
1038
|
-
if (params.entry?.authProfileOverrideSource) fallbackRun.authProfileIdSource = params.entry.authProfileOverrideSource;
|
|
1039
|
-
else delete fallbackRun.authProfileIdSource;
|
|
1040
|
-
} else if (hasEntryModelOverride) {
|
|
1041
|
-
delete fallbackRun.authProfileId;
|
|
1042
|
-
delete fallbackRun.authProfileIdSource;
|
|
1043
|
-
}
|
|
1044
|
-
return fallbackRun;
|
|
1045
|
-
};
|
|
1046
|
-
const refreshedProbe = resolveAutoFallbackPrimaryProbe({
|
|
1047
|
-
entry: params.entry,
|
|
1048
|
-
sessionKey: params.sessionKey,
|
|
1049
|
-
primaryProvider: probe.provider,
|
|
1050
|
-
primaryModel: probe.model
|
|
1051
|
-
});
|
|
1052
|
-
if (!refreshedProbe) return resolveEntrySelectionRun();
|
|
1053
|
-
return {
|
|
1054
|
-
...params.run,
|
|
1055
|
-
provider: refreshedProbe.provider,
|
|
1056
|
-
model: refreshedProbe.model,
|
|
1057
|
-
autoFallbackPrimaryProbe: refreshedProbe
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
async function runAgentTurnWithFallback(params) {
|
|
1061
|
-
const TRANSIENT_HTTP_RETRY_DELAY_MS = 2500;
|
|
1062
|
-
let didLogHeartbeatStrip = false;
|
|
1063
|
-
let autoCompactionCount = 0;
|
|
1064
|
-
const directlySentBlockKeys = /* @__PURE__ */ new Set();
|
|
1065
|
-
let runnableRun = resolveRunAfterAutoFallbackPrimaryProbeRecheck({
|
|
1066
|
-
run: params.followupRun.run,
|
|
1067
|
-
entry: params.activeSessionStore?.[params.sessionKey ?? ""] ?? params.getActiveSessionEntry(),
|
|
1068
|
-
sessionKey: params.sessionKey
|
|
1069
|
-
});
|
|
1070
|
-
if (runnableRun !== params.followupRun.run) params.followupRun.run = runnableRun;
|
|
1071
|
-
const runtimeConfig = resolveQueuedReplyRuntimeConfig(runnableRun.config);
|
|
1072
|
-
let effectiveRun = runtimeConfig === runnableRun.config ? runnableRun : {
|
|
1073
|
-
...runnableRun,
|
|
1074
|
-
config: runtimeConfig
|
|
1075
|
-
};
|
|
1076
|
-
const preserveUserFacingSessionState = shouldPreserveUserFacingSessionStateForInputProvenance(effectiveRun.inputProvenance);
|
|
1077
|
-
const resolveRunForFallbackCandidate = (provider, model) => {
|
|
1078
|
-
const probe = effectiveRun.autoFallbackPrimaryProbe;
|
|
1079
|
-
const isPrimaryProbeCandidate = probe && provider === probe.provider && model === probe.model;
|
|
1080
|
-
if (probe && provider === probe.fallbackProvider && !isPrimaryProbeCandidate && probe.fallbackAuthProfileId) {
|
|
1081
|
-
const candidateRun = {
|
|
1082
|
-
...effectiveRun,
|
|
1083
|
-
provider,
|
|
1084
|
-
model,
|
|
1085
|
-
authProfileId: probe.fallbackAuthProfileId
|
|
1086
|
-
};
|
|
1087
|
-
if (probe.fallbackAuthProfileIdSource) candidateRun.authProfileIdSource = probe.fallbackAuthProfileIdSource;
|
|
1088
|
-
else delete candidateRun.authProfileIdSource;
|
|
1089
|
-
return candidateRun;
|
|
1090
|
-
}
|
|
1091
|
-
return effectiveRun;
|
|
1092
|
-
};
|
|
1093
|
-
const applyLiveModelSwitchToRun = (run, err) => {
|
|
1094
|
-
run.provider = err.provider;
|
|
1095
|
-
run.model = err.model;
|
|
1096
|
-
run.authProfileId = err.authProfileId;
|
|
1097
|
-
run.authProfileIdSource = err.authProfileId ? err.authProfileIdSource : void 0;
|
|
1098
|
-
run.autoFallbackPrimaryProbe = void 0;
|
|
1099
|
-
};
|
|
1100
|
-
const runId = params.opts?.runId ?? crypto.randomUUID();
|
|
1101
|
-
const agentTurnTiming = createAgentTurnTimingTracker({ profilerEnabled: isReplyProfilerEnabled({ config: runtimeConfig }) });
|
|
1102
|
-
if (isDiagnosticsEnabled(runtimeConfig)) logSessionTurnCreated({
|
|
1103
|
-
runId,
|
|
1104
|
-
sessionKey: params.sessionKey,
|
|
1105
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1106
|
-
agentId: params.followupRun.run.agentId,
|
|
1107
|
-
channel: params.followupRun.run.messageProvider ?? params.sessionCtx.Surface ?? params.sessionCtx.Provider,
|
|
1108
|
-
trigger: params.isHeartbeat ? "heartbeat" : "user"
|
|
1109
|
-
});
|
|
1110
|
-
const replyMediaContext = params.replyMediaContext ?? agentTurnTiming.measureSync("reply_media_context", () => createReplyMediaContext({
|
|
1111
|
-
cfg: runtimeConfig,
|
|
1112
|
-
sessionKey: params.sessionKey,
|
|
1113
|
-
workspaceDir: params.followupRun.run.workspaceDir,
|
|
1114
|
-
messageProvider: params.followupRun.run.messageProvider,
|
|
1115
|
-
accountId: params.followupRun.originatingAccountId ?? params.followupRun.run.agentAccountId,
|
|
1116
|
-
groupId: params.followupRun.run.groupId,
|
|
1117
|
-
groupChannel: params.followupRun.run.groupChannel,
|
|
1118
|
-
groupSpace: params.followupRun.run.groupSpace,
|
|
1119
|
-
requesterSenderId: params.followupRun.run.senderId,
|
|
1120
|
-
requesterSenderName: params.followupRun.run.senderName,
|
|
1121
|
-
requesterSenderUsername: params.followupRun.run.senderUsername,
|
|
1122
|
-
requesterSenderE164: params.followupRun.run.senderE164
|
|
1123
|
-
}));
|
|
1124
|
-
const currentTurnImages = await agentTurnTiming.measure("current_turn_images", () => resolveCurrentTurnImages({
|
|
1125
|
-
ctx: params.sessionCtx,
|
|
1126
|
-
cfg: runtimeConfig,
|
|
1127
|
-
images: params.followupRun.images ?? params.opts?.images,
|
|
1128
|
-
imageOrder: params.followupRun.imageOrder ?? params.opts?.imageOrder
|
|
1129
|
-
}));
|
|
1130
|
-
let didNotifyAgentRunStart = false;
|
|
1131
|
-
const notifyAgentRunStart = () => {
|
|
1132
|
-
if (didNotifyAgentRunStart) return;
|
|
1133
|
-
didNotifyAgentRunStart = true;
|
|
1134
|
-
params.opts?.onAgentRunStart?.(runId);
|
|
1135
|
-
};
|
|
1136
|
-
const currentMessageId = params.sessionCtx.MessageSidFull ?? params.sessionCtx.MessageSid;
|
|
1137
|
-
const shouldNotifyUserAboutCompaction = runtimeConfig?.agents?.defaults?.compaction?.notifyUser === true;
|
|
1138
|
-
const sendCompactionNotice = async (phase) => {
|
|
1139
|
-
if (!params.opts?.onBlockReply) return;
|
|
1140
|
-
const text = phase === "start" ? "🧹 Compacting context..." : phase === "end" ? "🧹 Compaction complete" : "🧹 Compaction incomplete";
|
|
1141
|
-
const noticePayload = params.applyReplyToMode({
|
|
1142
|
-
text,
|
|
1143
|
-
replyToId: currentMessageId,
|
|
1144
|
-
replyToCurrent: true,
|
|
1145
|
-
isCompactionNotice: true
|
|
1146
|
-
});
|
|
1147
|
-
try {
|
|
1148
|
-
await params.opts.onBlockReply(noticePayload);
|
|
1149
|
-
} catch (err) {
|
|
1150
|
-
logVerbose(`compaction ${phase} notice delivery failed (non-fatal): ${String(err)}`);
|
|
1151
|
-
}
|
|
1152
|
-
};
|
|
1153
|
-
const readCompactionHookMessages = (value) => {
|
|
1154
|
-
if (!Array.isArray(value)) return [];
|
|
1155
|
-
return value.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
1156
|
-
};
|
|
1157
|
-
const sendCompactionHookMessages = async (messages) => {
|
|
1158
|
-
if (!params.opts?.onBlockReply || messages.length === 0) return;
|
|
1159
|
-
const noticePayload = params.applyReplyToMode({
|
|
1160
|
-
text: messages.join("\n\n"),
|
|
1161
|
-
replyToId: currentMessageId,
|
|
1162
|
-
replyToCurrent: true,
|
|
1163
|
-
isCompactionNotice: true
|
|
1164
|
-
});
|
|
1165
|
-
try {
|
|
1166
|
-
await params.opts.onBlockReply(noticePayload);
|
|
1167
|
-
} catch (err) {
|
|
1168
|
-
logVerbose(`compaction hook notice delivery failed (non-fatal): ${String(err)}`);
|
|
1169
|
-
}
|
|
1170
|
-
};
|
|
1171
|
-
const shouldSurfaceToControlUi = isInternalMessageChannel(params.followupRun.run.messageProvider ?? params.sessionCtx.Surface ?? params.sessionCtx.Provider);
|
|
1172
|
-
if (params.sessionKey) registerAgentRunContext(runId, {
|
|
1173
|
-
sessionKey: params.sessionKey,
|
|
1174
|
-
verboseLevel: params.resolvedVerboseLevel,
|
|
1175
|
-
isHeartbeat: params.isHeartbeat,
|
|
1176
|
-
isControlUiVisible: shouldSurfaceToControlUi
|
|
1177
|
-
});
|
|
1178
|
-
let runResult;
|
|
1179
|
-
let fallbackProvider = params.followupRun.run.provider;
|
|
1180
|
-
let fallbackModel = params.followupRun.run.model;
|
|
1181
|
-
let attemptedRuntimeProvider = fallbackProvider;
|
|
1182
|
-
let attemptedRuntimeModel = fallbackModel;
|
|
1183
|
-
let fallbackAttempts = [];
|
|
1184
|
-
let didRetryTransientHttpError = false;
|
|
1185
|
-
let liveModelSwitchRetries = 0;
|
|
1186
|
-
let bootstrapPromptWarningSignaturesSeen = resolveBootstrapWarningSignaturesSeen(params.getActiveSessionEntry()?.systemPromptReport);
|
|
1187
|
-
let pendingFallbackCandidateRollback;
|
|
1188
|
-
const clearPendingFallbackRollback = (rollback) => {
|
|
1189
|
-
if (!rollback || pendingFallbackCandidateRollback?.rollback === rollback) pendingFallbackCandidateRollback = void 0;
|
|
1190
|
-
};
|
|
1191
|
-
const rollbackClassifiedFallbackCandidateSelection = async (provider, model) => {
|
|
1192
|
-
const pending = pendingFallbackCandidateRollback;
|
|
1193
|
-
if (!pending || pending.provider !== provider || pending.model !== model) return;
|
|
1194
|
-
pendingFallbackCandidateRollback = void 0;
|
|
1195
|
-
try {
|
|
1196
|
-
await pending.rollback();
|
|
1197
|
-
} catch (rollbackError) {
|
|
1198
|
-
logVerbose(`failed to roll back classified fallback candidate selection (non-fatal): ${String(rollbackError)}`);
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
const persistFallbackCandidateSelection = async (provider, model, candidateRun) => {
|
|
1202
|
-
if (!params.sessionKey || !params.activeSessionStore || preserveUserFacingSessionState || provider === effectiveRun.provider && model === effectiveRun.model) return;
|
|
1203
|
-
const activeSessionEntry = params.activeSessionStore[params.sessionKey] ?? params.getActiveSessionEntry();
|
|
1204
|
-
if (!activeSessionEntry) return;
|
|
1205
|
-
if (activeSessionEntry.modelOverrideSource === "user" || activeSessionEntry.modelOverrideSource === void 0 && Boolean(normalizeOptionalString(activeSessionEntry.modelOverride)) && !hasSessionAutoModelFallbackProvenance(activeSessionEntry)) return;
|
|
1206
|
-
const previousState = snapshotFallbackSelectionState(activeSessionEntry);
|
|
1207
|
-
const applied = applyFallbackCandidateSelectionToEntry({
|
|
1208
|
-
entry: activeSessionEntry,
|
|
1209
|
-
run: candidateRun !== effectiveRun && effectiveRun.autoFallbackPrimaryProbe ? {
|
|
1210
|
-
...candidateRun,
|
|
1211
|
-
provider: candidateRun.provider,
|
|
1212
|
-
model: effectiveRun.model
|
|
1213
|
-
} : candidateRun,
|
|
1214
|
-
provider: resolveOpenAIRuntimeProvider({
|
|
1215
|
-
provider,
|
|
1216
|
-
config: runtimeConfig,
|
|
1217
|
-
workspaceDir: params.followupRun.run.workspaceDir
|
|
1218
|
-
}),
|
|
1219
|
-
model,
|
|
1220
|
-
force: candidateRun !== effectiveRun && Boolean(effectiveRun.autoFallbackPrimaryProbe),
|
|
1221
|
-
...effectiveRun.autoFallbackPrimaryProbe ? { origin: {
|
|
1222
|
-
provider: effectiveRun.autoFallbackPrimaryProbe.provider,
|
|
1223
|
-
model: effectiveRun.autoFallbackPrimaryProbe.model
|
|
1224
|
-
} } : {}
|
|
1225
|
-
});
|
|
1226
|
-
const nextState = applied.nextState;
|
|
1227
|
-
if (!applied.updated || !nextState) return;
|
|
1228
|
-
params.activeSessionStore[params.sessionKey] = activeSessionEntry;
|
|
1229
|
-
try {
|
|
1230
|
-
if (params.storePath) await updateSessionStore(params.storePath, (store) => {
|
|
1231
|
-
const persistedEntry = store[params.sessionKey];
|
|
1232
|
-
if (!persistedEntry) return;
|
|
1233
|
-
applyFallbackSelectionState(persistedEntry, nextState);
|
|
1234
|
-
store[params.sessionKey] = persistedEntry;
|
|
1235
|
-
});
|
|
1236
|
-
} catch (error) {
|
|
1237
|
-
rollbackFallbackSelectionStateIfUnchanged(activeSessionEntry, nextState, previousState);
|
|
1238
|
-
params.activeSessionStore[params.sessionKey] = activeSessionEntry;
|
|
1239
|
-
throw error;
|
|
1240
|
-
}
|
|
1241
|
-
return async () => {
|
|
1242
|
-
if (rollbackFallbackSelectionStateIfUnchanged(activeSessionEntry, nextState, previousState)) params.activeSessionStore[params.sessionKey] = activeSessionEntry;
|
|
1243
|
-
if (!params.storePath) return;
|
|
1244
|
-
await updateSessionStore(params.storePath, (store) => {
|
|
1245
|
-
const persistedEntry = store[params.sessionKey];
|
|
1246
|
-
if (!persistedEntry) return;
|
|
1247
|
-
if (rollbackFallbackSelectionStateIfUnchanged(persistedEntry, nextState, previousState)) store[params.sessionKey] = persistedEntry;
|
|
1248
|
-
});
|
|
1249
|
-
};
|
|
1250
|
-
};
|
|
1251
|
-
const clearRecoveredAutoFallbackPrimaryProbe = async (paramsForClear) => {
|
|
1252
|
-
if (preserveUserFacingSessionState) return;
|
|
1253
|
-
const probe = effectiveRun.autoFallbackPrimaryProbe;
|
|
1254
|
-
if (!probe) return;
|
|
1255
|
-
if (paramsForClear.provider !== probe.provider || paramsForClear.model !== probe.model) return;
|
|
1256
|
-
if (!params.sessionKey || !params.activeSessionStore) return;
|
|
1257
|
-
const activeSessionEntry = params.activeSessionStore[params.sessionKey] ?? params.getActiveSessionEntry();
|
|
1258
|
-
if (!activeSessionEntry) return;
|
|
1259
|
-
if (!entryMatchesAutoFallbackPrimaryProbe(activeSessionEntry, probe)) return;
|
|
1260
|
-
clearAutoFallbackPrimaryProbeSelection(activeSessionEntry);
|
|
1261
|
-
params.activeSessionStore[params.sessionKey] = activeSessionEntry;
|
|
1262
|
-
if (!params.storePath) return;
|
|
1263
|
-
await updateSessionStore(params.storePath, (store) => {
|
|
1264
|
-
const persistedEntry = store[params.sessionKey];
|
|
1265
|
-
if (!persistedEntry) return;
|
|
1266
|
-
if (!entryMatchesAutoFallbackPrimaryProbe(persistedEntry, probe)) return;
|
|
1267
|
-
clearAutoFallbackPrimaryProbeSelection(persistedEntry);
|
|
1268
|
-
store[params.sessionKey] = persistedEntry;
|
|
1269
|
-
});
|
|
1270
|
-
};
|
|
1271
|
-
while (true) try {
|
|
1272
|
-
const normalizeStreamingText = (payload) => {
|
|
1273
|
-
let text = payload.text;
|
|
1274
|
-
const reply = resolveSendableOutboundReplyParts(payload);
|
|
1275
|
-
if (params.followupRun.run.silentExpected) return { skip: true };
|
|
1276
|
-
if (!params.isHeartbeat && text?.includes("HEARTBEAT_OK")) {
|
|
1277
|
-
const stripped = stripHeartbeatToken(text, { mode: "message" });
|
|
1278
|
-
if (stripped.didStrip && !didLogHeartbeatStrip) {
|
|
1279
|
-
didLogHeartbeatStrip = true;
|
|
1280
|
-
logVerbose("Stripped stray HEARTBEAT_OK token from reply");
|
|
1281
|
-
}
|
|
1282
|
-
if (stripped.shouldSkip && !reply.hasMedia) return { skip: true };
|
|
1283
|
-
text = stripped.text;
|
|
1284
|
-
}
|
|
1285
|
-
if (isSilentReplyText(text, "NO_REPLY")) return { skip: true };
|
|
1286
|
-
if (isSilentReplyPrefixText(text, "NO_REPLY") || isSilentReplyPrefixText(text, "HEARTBEAT_OK")) return { skip: true };
|
|
1287
|
-
if (text && startsWithSilentToken(text, "NO_REPLY")) text = stripLeadingSilentToken(text, SILENT_REPLY_TOKEN);
|
|
1288
|
-
if (!text) {
|
|
1289
|
-
if (reply.hasMedia) return {
|
|
1290
|
-
text: void 0,
|
|
1291
|
-
skip: false
|
|
1292
|
-
};
|
|
1293
|
-
return { skip: true };
|
|
1294
|
-
}
|
|
1295
|
-
const sanitized = sanitizeUserFacingText(text, { errorContext: Boolean(payload.isError) });
|
|
1296
|
-
if (!sanitized.trim()) return { skip: true };
|
|
1297
|
-
return {
|
|
1298
|
-
text: sanitized,
|
|
1299
|
-
skip: false
|
|
1300
|
-
};
|
|
1301
|
-
};
|
|
1302
|
-
const handlePartialForTyping = async (payload) => {
|
|
1303
|
-
if (isSilentReplyPrefixText(payload.text, "NO_REPLY")) return;
|
|
1304
|
-
const { text, skip } = normalizeStreamingText(payload);
|
|
1305
|
-
if (skip || !text) return;
|
|
1306
|
-
await params.typingSignals.signalTextDelta(text);
|
|
1307
|
-
return text;
|
|
1308
|
-
};
|
|
1309
|
-
const blockReplyPipeline = params.blockReplyPipeline;
|
|
1310
|
-
const blockReplyHandler = params.opts?.onBlockReply ? createBlockReplyDeliveryHandler({
|
|
1311
|
-
onBlockReply: params.opts.onBlockReply,
|
|
1312
|
-
currentMessageId: params.sessionCtx.MessageSidFull ?? params.sessionCtx.MessageSid,
|
|
1313
|
-
replyThreading: params.replyThreading,
|
|
1314
|
-
normalizeStreamingText,
|
|
1315
|
-
applyReplyToMode: params.applyReplyToMode,
|
|
1316
|
-
normalizeMediaPaths: replyMediaContext.normalizePayload,
|
|
1317
|
-
typingSignals: params.typingSignals,
|
|
1318
|
-
blockStreamingEnabled: params.blockStreamingEnabled,
|
|
1319
|
-
blockReplyPipeline,
|
|
1320
|
-
directlySentBlockKeys
|
|
1321
|
-
}) : void 0;
|
|
1322
|
-
let messageToolOnlyDeliveryCompleted = false;
|
|
1323
|
-
const messageToolOnlyDeliveryToolCallIds = /* @__PURE__ */ new Set();
|
|
1324
|
-
const sourceRepliesAreToolOnly = params.followupRun.run.sourceReplyDeliveryMode === "message_tool_only";
|
|
1325
|
-
const shouldSuppressProgressAfterMessageToolDelivery = () => sourceRepliesAreToolOnly && messageToolOnlyDeliveryCompleted;
|
|
1326
|
-
const onToolResult = params.opts?.onToolResult;
|
|
1327
|
-
const outcomePlan = buildAgentRuntimeOutcomePlan();
|
|
1328
|
-
const runLane = "main";
|
|
1329
|
-
const runAbortSignal = params.replyOperation?.abortSignal ?? params.opts?.abortSignal;
|
|
1330
|
-
let queuedUserMessagePersistedAcrossFallback = false;
|
|
1331
|
-
let assistantErrorPersistedAcrossFallback = false;
|
|
1332
|
-
const userTurnTranscriptRecorder = params.followupRun.userTurnTranscriptRecorder ?? params.opts?.userTurnTranscriptRecorder;
|
|
1333
|
-
const notifyUserMessagePersisted = () => {
|
|
1334
|
-
queuedUserMessagePersistedAcrossFallback = true;
|
|
1335
|
-
};
|
|
1336
|
-
agentTurnTiming.logMilestoneIfSlow({
|
|
1337
|
-
runId,
|
|
1338
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1339
|
-
sessionKey: params.sessionKey,
|
|
1340
|
-
milestone: "before_model_fallback"
|
|
1341
|
-
});
|
|
1342
|
-
const fallbackResult = await agentTurnTiming.measure("model_fallback", () => runWithModelFallback({
|
|
1343
|
-
...resolveModelFallbackOptions(effectiveRun, runtimeConfig),
|
|
1344
|
-
runId,
|
|
1345
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1346
|
-
lane: runLane,
|
|
1347
|
-
abortSignal: runAbortSignal,
|
|
1348
|
-
resolveAgentHarnessRuntimeOverride: (provider) => resolveSessionRuntimeOverrideForProvider({
|
|
1349
|
-
provider,
|
|
1350
|
-
entry: params.getActiveSessionEntry()
|
|
1351
|
-
}),
|
|
1352
|
-
prepareAgentHarnessRuntime: async ({ provider, model, agentHarnessRuntimeOverride }) => {
|
|
1353
|
-
await agentTurnTiming.measure("fallback_prepare_harness", () => ensureSelectedAgentHarnessPlugin({
|
|
1354
|
-
config: runtimeConfig,
|
|
1355
|
-
provider,
|
|
1356
|
-
modelId: model,
|
|
1357
|
-
agentId: params.followupRun.run.agentId,
|
|
1358
|
-
sessionKey: params.followupRun.run.runtimePolicySessionKey ?? params.sessionKey,
|
|
1359
|
-
agentHarnessRuntimeOverride,
|
|
1360
|
-
workspaceDir: params.followupRun.run.workspaceDir
|
|
1361
|
-
}));
|
|
1362
|
-
},
|
|
1363
|
-
onFallbackStep: (step) => {
|
|
1364
|
-
emitModelFallbackStepLifecycle({
|
|
1365
|
-
runId,
|
|
1366
|
-
sessionKey: params.sessionKey,
|
|
1367
|
-
step
|
|
1368
|
-
});
|
|
1369
|
-
},
|
|
1370
|
-
classifyResult: async ({ result, provider, model }) => {
|
|
1371
|
-
const classification = outcomePlan.classifyRunResult({
|
|
1372
|
-
result,
|
|
1373
|
-
provider,
|
|
1374
|
-
model,
|
|
1375
|
-
hasDirectlySentBlockReply: directlySentBlockKeys.size > 0,
|
|
1376
|
-
hasBlockReplyPipelineOutput: Boolean(blockReplyPipeline?.hasBuffered() || blockReplyPipeline?.didStream())
|
|
1377
|
-
});
|
|
1378
|
-
if (classification) await rollbackClassifiedFallbackCandidateSelection(provider, model);
|
|
1379
|
-
return classification;
|
|
1380
|
-
},
|
|
1381
|
-
run: async (provider, model, runOptions) => {
|
|
1382
|
-
attemptedRuntimeProvider = provider;
|
|
1383
|
-
attemptedRuntimeModel = model;
|
|
1384
|
-
const suppressQueuedUserPersistenceForCandidate = (params.followupRun.run.suppressNextUserMessagePersistence ?? false) || queuedUserMessagePersistedAcrossFallback;
|
|
1385
|
-
const suppressAssistantErrorPersistenceForCandidate = assistantErrorPersistedAcrossFallback;
|
|
1386
|
-
const candidateRun = resolveRunForFallbackCandidate(provider, model);
|
|
1387
|
-
const activeProbe = effectiveRun.autoFallbackPrimaryProbe;
|
|
1388
|
-
if (activeProbe && provider === activeProbe.provider && model === activeProbe.model) markAutoFallbackPrimaryProbe({
|
|
1389
|
-
probe: activeProbe,
|
|
1390
|
-
sessionKey: params.sessionKey
|
|
1391
|
-
});
|
|
1392
|
-
params.opts?.onModelSelected?.({
|
|
1393
|
-
provider,
|
|
1394
|
-
model,
|
|
1395
|
-
thinkLevel: params.followupRun.run.thinkLevel
|
|
1396
|
-
});
|
|
1397
|
-
let rollbackFallbackCandidateSelection;
|
|
1398
|
-
try {
|
|
1399
|
-
rollbackFallbackCandidateSelection = await agentTurnTiming.measure("fallback_persist_selection", () => persistFallbackCandidateSelection(provider, model, candidateRun));
|
|
1400
|
-
if (rollbackFallbackCandidateSelection) pendingFallbackCandidateRollback = {
|
|
1401
|
-
provider,
|
|
1402
|
-
model,
|
|
1403
|
-
rollback: rollbackFallbackCandidateSelection
|
|
1404
|
-
};
|
|
1405
|
-
} catch (error) {
|
|
1406
|
-
logVerbose(`failed to persist fallback candidate selection (non-fatal): ${String(error)}`);
|
|
1407
|
-
}
|
|
1408
|
-
const { sessionRuntimeOverride, cliExecutionProvider } = agentTurnTiming.measureSync("fallback_resolve_runtime", () => {
|
|
1409
|
-
const resolvedSessionRuntimeOverride = resolveSessionRuntimeOverrideForProvider({
|
|
1410
|
-
provider,
|
|
1411
|
-
entry: params.getActiveSessionEntry()
|
|
1412
|
-
});
|
|
1413
|
-
const resolvedSelectedAuthProfile = resolveRunAuthProfile(candidateRun, provider, { config: runtimeConfig });
|
|
1414
|
-
return {
|
|
1415
|
-
sessionRuntimeOverride: resolvedSessionRuntimeOverride,
|
|
1416
|
-
cliExecutionProvider: (resolvedSessionRuntimeOverride && isCliProvider(resolvedSessionRuntimeOverride, runtimeConfig) ? resolvedSessionRuntimeOverride : void 0) ?? resolveCliRuntimeExecutionProvider({
|
|
1417
|
-
provider,
|
|
1418
|
-
cfg: runtimeConfig,
|
|
1419
|
-
agentId: params.followupRun.run.agentId,
|
|
1420
|
-
modelId: model,
|
|
1421
|
-
authProfileId: resolvedSelectedAuthProfile.authProfileId
|
|
1422
|
-
}) ?? provider
|
|
1423
|
-
};
|
|
1424
|
-
});
|
|
1425
|
-
if (isCliProvider(cliExecutionProvider, runtimeConfig)) {
|
|
1426
|
-
const cliSessionBinding = getCliSessionBinding(params.getActiveSessionEntry(), cliExecutionProvider);
|
|
1427
|
-
const authProfile = resolveRunAuthProfile(candidateRun, cliExecutionProvider, { config: runtimeConfig });
|
|
1428
|
-
let droppedCliSessionReplacement = false;
|
|
1429
|
-
const hookMessageProvider = resolveOriginMessageProvider({
|
|
1430
|
-
originatingChannel: params.followupRun.originatingChannel,
|
|
1431
|
-
provider: params.sessionCtx.Provider
|
|
1432
|
-
});
|
|
1433
|
-
const cliCurrentThreadId = params.followupRun.originatingThreadId ?? params.sessionCtx.MessageThreadId;
|
|
1434
|
-
const cliCurrentMessageId = params.sessionCtx.InputProvenance?.kind === "internal_system" && params.sessionCtx.InputProvenance.sourceTool === "restart-sentinel" ? params.sessionCtx.ReplyToId : params.sessionCtx.MessageSidFull ?? params.sessionCtx.MessageSid;
|
|
1435
|
-
const result = await agentTurnTiming.measure("cli_run", () => runCliAgentWithLifecycle({
|
|
1436
|
-
runId,
|
|
1437
|
-
provider: cliExecutionProvider,
|
|
1438
|
-
onAgentRunStart: notifyAgentRunStart,
|
|
1439
|
-
suppressAssistantBridge: params.followupRun.run.silentExpected,
|
|
1440
|
-
onAssistantText: async (text) => {
|
|
1441
|
-
const textForTyping = await handlePartialForTyping({ text });
|
|
1442
|
-
if (textForTyping === void 0 || !params.opts?.onPartialReply) return;
|
|
1443
|
-
await params.opts.onPartialReply({ text: textForTyping });
|
|
1444
|
-
},
|
|
1445
|
-
onReasoningText: async (text) => {
|
|
1446
|
-
await params.opts?.onReasoningStream?.({ text });
|
|
1447
|
-
},
|
|
1448
|
-
onToolEvent: async ({ name, phase, args }) => {
|
|
1449
|
-
await Promise.all([params.typingSignals.signalToolStart(), params.opts?.onToolStart?.({
|
|
1450
|
-
name,
|
|
1451
|
-
phase,
|
|
1452
|
-
args,
|
|
1453
|
-
detailMode: params.toolProgressDetail
|
|
1454
|
-
})]);
|
|
1455
|
-
},
|
|
1456
|
-
onErrorBeforeLifecycle: async () => {
|
|
1457
|
-
if (!rollbackFallbackCandidateSelection) return;
|
|
1458
|
-
try {
|
|
1459
|
-
await rollbackFallbackCandidateSelection();
|
|
1460
|
-
clearPendingFallbackRollback(rollbackFallbackCandidateSelection);
|
|
1461
|
-
} catch (rollbackError) {
|
|
1462
|
-
logVerbose(`failed to roll back fallback candidate selection (non-fatal): ${String(rollbackError)}`);
|
|
1463
|
-
}
|
|
1464
|
-
},
|
|
1465
|
-
transformResult: params.followupRun.currentInboundEventKind === "room_event" ? (result) => keepCliSessionBindingOnlyWhenReused({
|
|
1466
|
-
result,
|
|
1467
|
-
existingSessionId: cliSessionBinding?.sessionId,
|
|
1468
|
-
onDroppedReplacement: () => {
|
|
1469
|
-
droppedCliSessionReplacement = true;
|
|
1470
|
-
}
|
|
1471
|
-
}) : void 0,
|
|
1472
|
-
runParams: {
|
|
1473
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1474
|
-
sessionKey: params.sessionKey,
|
|
1475
|
-
agentId: params.followupRun.run.agentId,
|
|
1476
|
-
trigger: params.isHeartbeat ? "heartbeat" : "user",
|
|
1477
|
-
sessionFile: params.followupRun.run.sessionFile,
|
|
1478
|
-
workspaceDir: params.followupRun.run.workspaceDir,
|
|
1479
|
-
cwd: params.followupRun.run.cwd,
|
|
1480
|
-
config: runtimeConfig,
|
|
1481
|
-
prompt: params.commandBody,
|
|
1482
|
-
transcriptPrompt: params.transcriptCommandBody,
|
|
1483
|
-
suppressNextUserMessagePersistence: suppressQueuedUserPersistenceForCandidate,
|
|
1484
|
-
userTurnTranscriptRecorder,
|
|
1485
|
-
onUserMessagePersisted: notifyUserMessagePersisted,
|
|
1486
|
-
currentInboundEventKind: params.followupRun.currentInboundEventKind,
|
|
1487
|
-
currentInboundContext: params.followupRun.currentInboundContext,
|
|
1488
|
-
inputProvenance: params.followupRun.run.inputProvenance,
|
|
1489
|
-
provider: cliExecutionProvider,
|
|
1490
|
-
model,
|
|
1491
|
-
thinkLevel: params.followupRun.run.thinkLevel,
|
|
1492
|
-
timeoutMs: params.followupRun.run.timeoutMs,
|
|
1493
|
-
runId,
|
|
1494
|
-
lane: runLane,
|
|
1495
|
-
extraSystemPrompt: params.followupRun.run.extraSystemPrompt,
|
|
1496
|
-
sourceReplyDeliveryMode: params.followupRun.run.sourceReplyDeliveryMode,
|
|
1497
|
-
silentReplyPromptMode: params.followupRun.run.silentReplyPromptMode,
|
|
1498
|
-
extraSystemPromptStatic: params.followupRun.run.extraSystemPromptStatic,
|
|
1499
|
-
ownerNumbers: params.followupRun.run.ownerNumbers,
|
|
1500
|
-
cliSessionId: cliSessionBinding?.sessionId,
|
|
1501
|
-
cliSessionBinding,
|
|
1502
|
-
authProfileId: authProfile.authProfileId,
|
|
1503
|
-
bootstrapPromptWarningSignaturesSeen,
|
|
1504
|
-
bootstrapPromptWarningSignature: bootstrapPromptWarningSignaturesSeen[bootstrapPromptWarningSignaturesSeen.length - 1],
|
|
1505
|
-
images: currentTurnImages.images,
|
|
1506
|
-
imageOrder: currentTurnImages.imageOrder,
|
|
1507
|
-
skillsSnapshot: params.followupRun.run.skillsSnapshot,
|
|
1508
|
-
messageChannel: params.followupRun.originatingChannel ?? void 0,
|
|
1509
|
-
messageProvider: hookMessageProvider,
|
|
1510
|
-
currentChannelId: params.followupRun.originatingTo ?? params.sessionCtx.OriginatingTo ?? params.sessionCtx.To,
|
|
1511
|
-
currentThreadTs: cliCurrentThreadId != null ? String(cliCurrentThreadId) : void 0,
|
|
1512
|
-
currentMessageId: cliCurrentMessageId,
|
|
1513
|
-
agentAccountId: params.followupRun.run.agentAccountId,
|
|
1514
|
-
senderIsOwner: params.followupRun.run.senderIsOwner,
|
|
1515
|
-
disableTools: params.opts?.disableTools,
|
|
1516
|
-
abortSignal: runAbortSignal,
|
|
1517
|
-
replyOperation: params.replyOperation
|
|
1518
|
-
}
|
|
1519
|
-
}));
|
|
1520
|
-
if (droppedCliSessionReplacement) await clearDroppedCliSessionBinding({
|
|
1521
|
-
provider: cliExecutionProvider,
|
|
1522
|
-
sessionKey: params.sessionKey,
|
|
1523
|
-
sessionStore: params.activeSessionStore,
|
|
1524
|
-
storePath: params.storePath,
|
|
1525
|
-
activeSessionEntry: params.getActiveSessionEntry()
|
|
1526
|
-
});
|
|
1527
|
-
bootstrapPromptWarningSignaturesSeen = resolveBootstrapWarningSignaturesSeen(result.meta?.systemPromptReport);
|
|
1528
|
-
return result;
|
|
1529
|
-
}
|
|
1530
|
-
const { embeddedContext, senderContext, runBaseParams } = buildEmbeddedRunExecutionParams({
|
|
1531
|
-
run: candidateRun,
|
|
1532
|
-
sessionCtx: params.sessionCtx,
|
|
1533
|
-
hasRepliedRef: params.opts?.hasRepliedRef,
|
|
1534
|
-
provider,
|
|
1535
|
-
runId,
|
|
1536
|
-
allowTransientCooldownProbe: runOptions?.allowTransientCooldownProbe,
|
|
1537
|
-
model
|
|
1538
|
-
});
|
|
1539
|
-
const agentHarnessPolicy = sessionRuntimeOverride ? {
|
|
1540
|
-
runtime: sessionRuntimeOverride,
|
|
1541
|
-
runtimeSource: "model"
|
|
1542
|
-
} : resolveAgentHarnessPolicy({
|
|
1543
|
-
provider,
|
|
1544
|
-
modelId: model,
|
|
1545
|
-
config: runtimeConfig,
|
|
1546
|
-
agentId: params.followupRun.run.agentId,
|
|
1547
|
-
sessionKey: params.followupRun.run.runtimePolicySessionKey ?? params.sessionKey
|
|
1548
|
-
});
|
|
1549
|
-
const embeddedRunProvider = resolveOpenAIRuntimeProvider({
|
|
1550
|
-
provider,
|
|
1551
|
-
harnessRuntime: agentHarnessPolicy.runtime,
|
|
1552
|
-
authProfileProvider: runBaseParams.authProfileId?.split(":", 1)[0],
|
|
1553
|
-
authProfileId: runBaseParams.authProfileId,
|
|
1554
|
-
config: runtimeConfig,
|
|
1555
|
-
workspaceDir: params.followupRun.run.workspaceDir
|
|
1556
|
-
});
|
|
1557
|
-
const embeddedRunHarnessOverride = sessionRuntimeOverride ?? (agentHarnessPolicy.runtime === "fengming" && embeddedRunProvider !== provider ? "fengming" : void 0);
|
|
1558
|
-
return (async () => {
|
|
1559
|
-
let attemptCompactionCount = 0;
|
|
1560
|
-
const lifecycleBackstop = createEmbeddedLifecycleTerminalBackstop({
|
|
1561
|
-
runId,
|
|
1562
|
-
sessionKey: params.sessionKey
|
|
1563
|
-
});
|
|
1564
|
-
try {
|
|
1565
|
-
agentTurnTiming.logMilestoneIfSlow({
|
|
1566
|
-
runId,
|
|
1567
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1568
|
-
sessionKey: params.sessionKey,
|
|
1569
|
-
milestone: "before_embedded_run"
|
|
1570
|
-
});
|
|
1571
|
-
const result = await agentTurnTiming.measure("embedded_run", () => runEmbeddedAgent({
|
|
1572
|
-
...embeddedContext,
|
|
1573
|
-
allowGatewaySubagentBinding: true,
|
|
1574
|
-
trigger: params.isHeartbeat ? "heartbeat" : "user",
|
|
1575
|
-
groupId: resolveGroupSessionKey(params.sessionCtx)?.id,
|
|
1576
|
-
groupChannel: normalizeOptionalString(params.sessionCtx.GroupChannel) ?? normalizeOptionalString(params.sessionCtx.GroupSubject),
|
|
1577
|
-
groupSpace: normalizeOptionalString(params.sessionCtx.GroupSpace),
|
|
1578
|
-
...senderContext,
|
|
1579
|
-
...runBaseParams,
|
|
1580
|
-
provider: embeddedRunProvider,
|
|
1581
|
-
agentHarnessId: embeddedRunHarnessOverride,
|
|
1582
|
-
agentHarnessRuntimeOverride: embeddedRunHarnessOverride,
|
|
1583
|
-
sandboxSessionKey: params.runtimePolicySessionKey,
|
|
1584
|
-
prompt: params.commandBody,
|
|
1585
|
-
transcriptPrompt: params.transcriptCommandBody,
|
|
1586
|
-
userTurnTranscriptRecorder,
|
|
1587
|
-
currentInboundEventKind: params.followupRun.currentInboundEventKind,
|
|
1588
|
-
currentInboundContext: params.followupRun.currentInboundContext,
|
|
1589
|
-
extraSystemPrompt: params.followupRun.run.extraSystemPrompt,
|
|
1590
|
-
sourceReplyDeliveryMode: params.followupRun.run.sourceReplyDeliveryMode,
|
|
1591
|
-
forceMessageTool: params.followupRun.run.sourceReplyDeliveryMode === "message_tool_only",
|
|
1592
|
-
silentReplyPromptMode: params.followupRun.run.silentReplyPromptMode,
|
|
1593
|
-
suppressNextUserMessagePersistence: suppressQueuedUserPersistenceForCandidate,
|
|
1594
|
-
onUserMessagePersisted: notifyUserMessagePersisted,
|
|
1595
|
-
suppressTranscriptOnlyAssistantPersistence: params.followupRun.run.suppressTranscriptOnlyAssistantPersistence,
|
|
1596
|
-
suppressAssistantErrorPersistence: suppressAssistantErrorPersistenceForCandidate,
|
|
1597
|
-
onAssistantErrorMessagePersisted: () => {
|
|
1598
|
-
assistantErrorPersistedAcrossFallback = true;
|
|
1599
|
-
},
|
|
1600
|
-
toolResultFormat: (() => {
|
|
1601
|
-
const channel = resolveMessageChannel(params.sessionCtx.Surface, params.sessionCtx.Provider);
|
|
1602
|
-
if (!channel) return "markdown";
|
|
1603
|
-
return isMarkdownCapableMessageChannel(channel) ? "markdown" : "plain";
|
|
1604
|
-
})(),
|
|
1605
|
-
toolProgressDetail: params.toolProgressDetail,
|
|
1606
|
-
suppressToolErrorWarnings: params.opts?.shouldSuppressToolErrorWarnings ?? params.opts?.suppressToolErrorWarnings,
|
|
1607
|
-
disableTools: params.opts?.disableTools,
|
|
1608
|
-
enableHeartbeatTool: params.opts?.enableHeartbeatTool,
|
|
1609
|
-
forceHeartbeatTool: params.opts?.forceHeartbeatTool,
|
|
1610
|
-
bootstrapContextMode: params.opts?.bootstrapContextMode,
|
|
1611
|
-
bootstrapContextRunKind: params.opts?.isHeartbeat ? "heartbeat" : "default",
|
|
1612
|
-
images: currentTurnImages.images,
|
|
1613
|
-
imageOrder: currentTurnImages.imageOrder,
|
|
1614
|
-
abortSignal: runAbortSignal,
|
|
1615
|
-
replyOperation: params.replyOperation,
|
|
1616
|
-
blockReplyBreak: params.resolvedBlockStreamingBreak,
|
|
1617
|
-
blockReplyChunking: params.blockReplyChunking,
|
|
1618
|
-
onPartialReply: async (payload) => {
|
|
1619
|
-
const textForTyping = await handlePartialForTyping(payload);
|
|
1620
|
-
if (!params.opts?.onPartialReply || textForTyping === void 0) return;
|
|
1621
|
-
await params.opts.onPartialReply({
|
|
1622
|
-
text: textForTyping,
|
|
1623
|
-
mediaUrls: payload.mediaUrls
|
|
1624
|
-
});
|
|
1625
|
-
},
|
|
1626
|
-
onAssistantMessageStart: async () => {
|
|
1627
|
-
await params.typingSignals.signalMessageStart();
|
|
1628
|
-
await params.opts?.onAssistantMessageStart?.();
|
|
1629
|
-
},
|
|
1630
|
-
onReasoningStream: params.typingSignals.shouldStartOnReasoning || params.opts?.onReasoningStream ? async (payload) => {
|
|
1631
|
-
if (params.followupRun.run.silentExpected) return;
|
|
1632
|
-
await params.typingSignals.signalReasoningDelta();
|
|
1633
|
-
await params.opts?.onReasoningStream?.({
|
|
1634
|
-
text: payload.text,
|
|
1635
|
-
mediaUrls: payload.mediaUrls,
|
|
1636
|
-
isReasoningSnapshot: payload.isReasoningSnapshot
|
|
1637
|
-
});
|
|
1638
|
-
} : void 0,
|
|
1639
|
-
onReasoningEnd: params.opts?.onReasoningEnd,
|
|
1640
|
-
onAgentEvent: async (evt) => {
|
|
1641
|
-
lifecycleBackstop.note(evt);
|
|
1642
|
-
const hasLifecyclePhase = evt.stream === "lifecycle" && typeof evt.data.phase === "string";
|
|
1643
|
-
if (evt.stream !== "lifecycle" || hasLifecyclePhase) notifyAgentRunStart();
|
|
1644
|
-
if (evt.stream === "tool") {
|
|
1645
|
-
const phase = readStringValue(evt.data.phase) ?? "";
|
|
1646
|
-
const name = readStringValue(evt.data.name);
|
|
1647
|
-
const toolCallId = readStringValue(evt.data.toolCallId) ?? "";
|
|
1648
|
-
const args = evt.data.args && typeof evt.data.args === "object" ? evt.data.args : void 0;
|
|
1649
|
-
if (sourceRepliesAreToolOnly && toolCallId && name && (phase === "start" || phase === "update") && args && isMessagingToolSendAction(name, args)) messageToolOnlyDeliveryToolCallIds.add(toolCallId);
|
|
1650
|
-
if (shouldSuppressProgressAfterMessageToolDelivery()) return;
|
|
1651
|
-
if (phase === "start" || phase === "update") {
|
|
1652
|
-
const toolStartProgressPromise = params.opts?.onToolStart?.({
|
|
1653
|
-
itemId: readStringValue(evt.data.itemId),
|
|
1654
|
-
toolCallId: readStringValue(evt.data.toolCallId),
|
|
1655
|
-
name,
|
|
1656
|
-
phase,
|
|
1657
|
-
args,
|
|
1658
|
-
detailMode: params.toolProgressDetail
|
|
1659
|
-
});
|
|
1660
|
-
await Promise.all([params.typingSignals.signalToolStart(), toolStartProgressPromise]);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
const suppressItemChannelProgress = evt.stream === "item" && evt.data.suppressChannelProgress === true && Boolean(params.opts?.onToolStart);
|
|
1664
|
-
const itemPhase = evt.stream === "item" ? readStringValue(evt.data.phase) : "";
|
|
1665
|
-
const itemName = evt.stream === "item" ? readStringValue(evt.data.name) : "";
|
|
1666
|
-
const itemStatus = evt.stream === "item" ? readStringValue(evt.data.status) : "";
|
|
1667
|
-
const itemToolCallId = evt.stream === "item" ? readStringValue(evt.data.toolCallId) ?? "" : "";
|
|
1668
|
-
const completedMessageToolDelivery = sourceRepliesAreToolOnly && itemPhase === "end" && itemStatus === "completed" && itemToolCallId.length > 0 && messageToolOnlyDeliveryToolCallIds.has(itemToolCallId);
|
|
1669
|
-
const suppressProgressAfterMessageToolDelivery = shouldSuppressProgressAfterMessageToolDelivery();
|
|
1670
|
-
if (completedMessageToolDelivery) {
|
|
1671
|
-
messageToolOnlyDeliveryToolCallIds.delete(itemToolCallId);
|
|
1672
|
-
messageToolOnlyDeliveryCompleted = true;
|
|
1673
|
-
}
|
|
1674
|
-
if (evt.stream === "item" && !suppressItemChannelProgress && (!suppressProgressAfterMessageToolDelivery || completedMessageToolDelivery)) await params.opts?.onItemEvent?.({
|
|
1675
|
-
itemId: readStringValue(evt.data.itemId),
|
|
1676
|
-
kind: readStringValue(evt.data.kind),
|
|
1677
|
-
title: readStringValue(evt.data.title),
|
|
1678
|
-
name: itemName,
|
|
1679
|
-
phase: itemPhase,
|
|
1680
|
-
status: itemStatus,
|
|
1681
|
-
summary: readStringValue(evt.data.summary),
|
|
1682
|
-
progressText: readStringValue(evt.data.progressText),
|
|
1683
|
-
meta: readStringValue(evt.data.meta),
|
|
1684
|
-
approvalId: readStringValue(evt.data.approvalId),
|
|
1685
|
-
approvalSlug: readStringValue(evt.data.approvalSlug)
|
|
1686
|
-
});
|
|
1687
|
-
if (evt.stream === "plan" && !shouldSuppressProgressAfterMessageToolDelivery()) await params.opts?.onPlanUpdate?.({
|
|
1688
|
-
phase: readStringValue(evt.data.phase),
|
|
1689
|
-
title: readStringValue(evt.data.title),
|
|
1690
|
-
explanation: readStringValue(evt.data.explanation),
|
|
1691
|
-
steps: Array.isArray(evt.data.steps) ? evt.data.steps.filter((step) => typeof step === "string") : void 0,
|
|
1692
|
-
source: readStringValue(evt.data.source)
|
|
1693
|
-
});
|
|
1694
|
-
if (evt.stream === "approval" && !shouldSuppressProgressAfterMessageToolDelivery()) await params.opts?.onApprovalEvent?.({
|
|
1695
|
-
phase: readStringValue(evt.data.phase),
|
|
1696
|
-
kind: readStringValue(evt.data.kind),
|
|
1697
|
-
status: readStringValue(evt.data.status),
|
|
1698
|
-
title: readStringValue(evt.data.title),
|
|
1699
|
-
itemId: readStringValue(evt.data.itemId),
|
|
1700
|
-
toolCallId: readStringValue(evt.data.toolCallId),
|
|
1701
|
-
approvalId: readStringValue(evt.data.approvalId),
|
|
1702
|
-
approvalSlug: readStringValue(evt.data.approvalSlug),
|
|
1703
|
-
command: readStringValue(evt.data.command),
|
|
1704
|
-
host: readStringValue(evt.data.host),
|
|
1705
|
-
reason: readStringValue(evt.data.reason),
|
|
1706
|
-
scope: readApprovalScopeValue(evt.data.scope),
|
|
1707
|
-
message: readStringValue(evt.data.message)
|
|
1708
|
-
});
|
|
1709
|
-
if (evt.stream === "command_output" && !shouldSuppressProgressAfterMessageToolDelivery()) await params.opts?.onCommandOutput?.({
|
|
1710
|
-
itemId: readStringValue(evt.data.itemId),
|
|
1711
|
-
phase: readStringValue(evt.data.phase),
|
|
1712
|
-
title: readStringValue(evt.data.title),
|
|
1713
|
-
toolCallId: readStringValue(evt.data.toolCallId),
|
|
1714
|
-
name: readStringValue(evt.data.name),
|
|
1715
|
-
output: readStringValue(evt.data.output),
|
|
1716
|
-
status: readStringValue(evt.data.status),
|
|
1717
|
-
exitCode: typeof evt.data.exitCode === "number" || evt.data.exitCode === null ? evt.data.exitCode : void 0,
|
|
1718
|
-
durationMs: typeof evt.data.durationMs === "number" ? evt.data.durationMs : void 0,
|
|
1719
|
-
cwd: readStringValue(evt.data.cwd)
|
|
1720
|
-
});
|
|
1721
|
-
if (evt.stream === "patch" && !shouldSuppressProgressAfterMessageToolDelivery()) await params.opts?.onPatchSummary?.({
|
|
1722
|
-
itemId: readStringValue(evt.data.itemId),
|
|
1723
|
-
phase: readStringValue(evt.data.phase),
|
|
1724
|
-
title: readStringValue(evt.data.title),
|
|
1725
|
-
toolCallId: readStringValue(evt.data.toolCallId),
|
|
1726
|
-
name: readStringValue(evt.data.name),
|
|
1727
|
-
added: Array.isArray(evt.data.added) ? evt.data.added.filter((entry) => typeof entry === "string") : void 0,
|
|
1728
|
-
modified: Array.isArray(evt.data.modified) ? evt.data.modified.filter((entry) => typeof entry === "string") : void 0,
|
|
1729
|
-
deleted: Array.isArray(evt.data.deleted) ? evt.data.deleted.filter((entry) => typeof entry === "string") : void 0,
|
|
1730
|
-
summary: readStringValue(evt.data.summary)
|
|
1731
|
-
});
|
|
1732
|
-
if (evt.stream === "compaction") {
|
|
1733
|
-
const phase = readStringValue(evt.data.phase) ?? "";
|
|
1734
|
-
const hookMessages = readCompactionHookMessages(evt.data.messages);
|
|
1735
|
-
if (phase === "start") {
|
|
1736
|
-
if (params.opts?.onCompactionStart) await params.opts.onCompactionStart();
|
|
1737
|
-
if (hookMessages.length > 0) await sendCompactionHookMessages(hookMessages);
|
|
1738
|
-
else if (shouldNotifyUserAboutCompaction) await sendCompactionNotice("start");
|
|
1739
|
-
}
|
|
1740
|
-
if (phase === "end") {
|
|
1741
|
-
if (evt.data?.completed === true) {
|
|
1742
|
-
attemptCompactionCount += 1;
|
|
1743
|
-
if (params.opts?.onCompactionEnd) await params.opts.onCompactionEnd();
|
|
1744
|
-
if (hookMessages.length > 0) await sendCompactionHookMessages(hookMessages);
|
|
1745
|
-
else if (shouldNotifyUserAboutCompaction) await sendCompactionNotice("end");
|
|
1746
|
-
} else if (hookMessages.length > 0) await sendCompactionHookMessages(hookMessages);
|
|
1747
|
-
else if (shouldNotifyUserAboutCompaction) await sendCompactionNotice("incomplete");
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
},
|
|
1751
|
-
onBlockReply: blockReplyHandler,
|
|
1752
|
-
onBlockReplyFlush: params.blockStreamingEnabled && blockReplyPipeline ? async () => {
|
|
1753
|
-
await blockReplyPipeline.flush({ force: true });
|
|
1754
|
-
} : void 0,
|
|
1755
|
-
shouldEmitToolResult: params.shouldEmitToolResult,
|
|
1756
|
-
shouldEmitToolOutput: params.shouldEmitToolOutput,
|
|
1757
|
-
bootstrapPromptWarningSignaturesSeen,
|
|
1758
|
-
bootstrapPromptWarningSignature: bootstrapPromptWarningSignaturesSeen[bootstrapPromptWarningSignaturesSeen.length - 1],
|
|
1759
|
-
onToolResult: onToolResult ? (() => {
|
|
1760
|
-
let toolResultChain = Promise.resolve();
|
|
1761
|
-
return (payload) => {
|
|
1762
|
-
toolResultChain = toolResultChain.then(async () => {
|
|
1763
|
-
const { text, skip } = normalizeStreamingText(payload);
|
|
1764
|
-
if (skip) return;
|
|
1765
|
-
if (text !== void 0) await params.typingSignals.signalTextDelta(text);
|
|
1766
|
-
await onToolResult({
|
|
1767
|
-
...payload,
|
|
1768
|
-
text
|
|
1769
|
-
});
|
|
1770
|
-
}).catch((err) => {
|
|
1771
|
-
logVerbose(`tool result delivery failed: ${String(err)}`);
|
|
1772
|
-
});
|
|
1773
|
-
const task = toolResultChain.finally(() => {
|
|
1774
|
-
params.pendingToolTasks.delete(task);
|
|
1775
|
-
});
|
|
1776
|
-
params.pendingToolTasks.add(task);
|
|
1777
|
-
};
|
|
1778
|
-
})() : void 0
|
|
1779
|
-
}));
|
|
1780
|
-
bootstrapPromptWarningSignaturesSeen = resolveBootstrapWarningSignaturesSeen(result.meta?.systemPromptReport);
|
|
1781
|
-
lifecycleBackstop.emit("end", result);
|
|
1782
|
-
const resultCompactionCount = Math.max(0, result.meta?.agentMeta?.compactionCount ?? 0);
|
|
1783
|
-
attemptCompactionCount = Math.max(attemptCompactionCount, resultCompactionCount);
|
|
1784
|
-
return result;
|
|
1785
|
-
} catch (err) {
|
|
1786
|
-
if (rollbackFallbackCandidateSelection) try {
|
|
1787
|
-
await rollbackFallbackCandidateSelection();
|
|
1788
|
-
clearPendingFallbackRollback(rollbackFallbackCandidateSelection);
|
|
1789
|
-
} catch (rollbackError) {
|
|
1790
|
-
logVerbose(`failed to roll back fallback candidate selection (non-fatal): ${String(rollbackError)}`);
|
|
1791
|
-
}
|
|
1792
|
-
lifecycleBackstop.emit("error", err);
|
|
1793
|
-
throw err;
|
|
1794
|
-
} finally {
|
|
1795
|
-
autoCompactionCount += attemptCompactionCount;
|
|
1796
|
-
}
|
|
1797
|
-
})();
|
|
1798
|
-
}
|
|
1799
|
-
}));
|
|
1800
|
-
agentTurnTiming.logIfSlow({
|
|
1801
|
-
runId,
|
|
1802
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1803
|
-
sessionKey: params.sessionKey,
|
|
1804
|
-
outcome: "completed"
|
|
1805
|
-
});
|
|
1806
|
-
runResult = fallbackResult.result;
|
|
1807
|
-
fallbackProvider = fallbackResult.provider;
|
|
1808
|
-
fallbackModel = fallbackResult.model;
|
|
1809
|
-
fallbackAttempts = Array.isArray(fallbackResult.attempts) ? fallbackResult.attempts.map((attempt) => ({
|
|
1810
|
-
provider: attempt.provider,
|
|
1811
|
-
model: attempt.model,
|
|
1812
|
-
error: attempt.error,
|
|
1813
|
-
reason: attempt.reason || void 0,
|
|
1814
|
-
status: typeof attempt.status === "number" ? attempt.status : void 0,
|
|
1815
|
-
code: attempt.code || void 0
|
|
1816
|
-
})) : [];
|
|
1817
|
-
await clearRecoveredAutoFallbackPrimaryProbe({
|
|
1818
|
-
provider: fallbackProvider,
|
|
1819
|
-
model: fallbackModel
|
|
1820
|
-
});
|
|
1821
|
-
const embeddedError = runResult.meta?.error;
|
|
1822
|
-
if (embeddedError && isContextOverflowError(embeddedError.message)) {
|
|
1823
|
-
defaultRuntime.error(`Auto-compaction failed (${embeddedError.message}). Preserving existing session mapping for ${params.sessionKey ?? params.followupRun.run.sessionId}.`);
|
|
1824
|
-
params.replyOperation?.fail("run_failed", embeddedError);
|
|
1825
|
-
return {
|
|
1826
|
-
kind: "final",
|
|
1827
|
-
payload: markAgentRunFailureReplyPayload({ text: buildContextOverflowRecoveryText({
|
|
1828
|
-
preserveSessionMapping: true,
|
|
1829
|
-
cfg: runtimeConfig,
|
|
1830
|
-
agentId: params.followupRun.run.agentId,
|
|
1831
|
-
primaryProvider: params.followupRun.run.provider,
|
|
1832
|
-
primaryModel: params.followupRun.run.model,
|
|
1833
|
-
runtimeProvider: attemptedRuntimeProvider,
|
|
1834
|
-
runtimeModel: attemptedRuntimeModel,
|
|
1835
|
-
activeSessionEntry: params.getActiveSessionEntry()
|
|
1836
|
-
}) })
|
|
1837
|
-
};
|
|
1838
|
-
}
|
|
1839
|
-
if (embeddedError?.kind === "role_ordering") {
|
|
1840
|
-
const providerRequestError = classifyProviderRequestError(embeddedError);
|
|
1841
|
-
params.replyOperation?.fail("run_failed", embeddedError);
|
|
1842
|
-
const embeddedErrorText = formatErrorMessage(embeddedError).replace(/\.\s*$/, "");
|
|
1843
|
-
return {
|
|
1844
|
-
kind: "final",
|
|
1845
|
-
payload: markAgentRunFailureReplyPayload({ text: shouldSurfaceToControlUi ? `⚠️ Agent failed before reply: ${embeddedErrorText}.\nLogs: fengming logs --follow` : providerRequestError?.userMessage ?? "⚠️ The model provider rejected the conversation state. Please try again, or use /new to start a fresh session." })
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
break;
|
|
1849
|
-
} catch (err) {
|
|
1850
|
-
if (err instanceof LiveSessionModelSwitchError) {
|
|
1851
|
-
liveModelSwitchRetries += 1;
|
|
1852
|
-
if (liveModelSwitchRetries > 2) {
|
|
1853
|
-
defaultRuntime.error(`Live model switch failed after 2 retries (${sanitizeForLog(err.provider)}/${sanitizeForLog(err.model)}). The requested model may be unavailable.`);
|
|
1854
|
-
const switchErrorText = shouldSurfaceToControlUi ? "⚠️ Agent failed before reply: model switch could not be completed. The requested model may be temporarily unavailable.\nLogs: fengming logs --follow" : isVerboseFailureDetailEnabled(params.resolvedVerboseLevel) ? "⚠️ Agent failed before reply: model switch could not be completed. The requested model may be temporarily unavailable. Please try again shortly." : "⚠️ Model switch could not be completed. The requested model may be temporarily unavailable. Please try again shortly.";
|
|
1855
|
-
params.replyOperation?.fail("run_failed", err);
|
|
1856
|
-
return {
|
|
1857
|
-
kind: "final",
|
|
1858
|
-
payload: markAgentRunFailureReplyPayload({ text: resolveExternalRunFailureTextForConversation({
|
|
1859
|
-
text: switchErrorText,
|
|
1860
|
-
sessionCtx: params.sessionCtx,
|
|
1861
|
-
isGenericRunnerFailure: !shouldSurfaceToControlUi,
|
|
1862
|
-
cfg: params.followupRun.run.config
|
|
1863
|
-
}) })
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
applyLiveModelSwitchToRun(params.followupRun.run, err);
|
|
1867
|
-
if (runnableRun !== params.followupRun.run) applyLiveModelSwitchToRun(runnableRun, err);
|
|
1868
|
-
if (effectiveRun !== runnableRun && effectiveRun !== params.followupRun.run) applyLiveModelSwitchToRun(effectiveRun, err);
|
|
1869
|
-
fallbackProvider = err.provider;
|
|
1870
|
-
fallbackModel = err.model;
|
|
1871
|
-
continue;
|
|
1872
|
-
}
|
|
1873
|
-
const message = formatErrorMessage(err);
|
|
1874
|
-
agentTurnTiming.logIfSlow({
|
|
1875
|
-
runId,
|
|
1876
|
-
sessionId: params.followupRun.run.sessionId,
|
|
1877
|
-
sessionKey: params.sessionKey,
|
|
1878
|
-
outcome: "error",
|
|
1879
|
-
error: message
|
|
1880
|
-
});
|
|
1881
|
-
const isBilling = isFallbackSummaryError(err) ? hasBillingAttemptSummary(err) : isBillingErrorMessage(message);
|
|
1882
|
-
const isContextOverflow = !isBilling && isLikelyContextOverflowError(message);
|
|
1883
|
-
const isCompactionFailure = !isBilling && isCompactionFailureError(message);
|
|
1884
|
-
const providerRequestError = !isBilling && !shouldSurfaceToControlUi ? classifyProviderRequestError(err) : void 0;
|
|
1885
|
-
const isTransientHttp = isTransientHttpError(message);
|
|
1886
|
-
if (isReplyOperationRestartAbort(params.replyOperation)) return {
|
|
1887
|
-
kind: "final",
|
|
1888
|
-
payload: markAgentRunFailureReplyPayload({ text: buildRestartLifecycleReplyText() })
|
|
1889
|
-
};
|
|
1890
|
-
if (isReplyOperationUserAbort(params.replyOperation)) return {
|
|
1891
|
-
kind: "final",
|
|
1892
|
-
payload: { text: SILENT_REPLY_TOKEN }
|
|
1893
|
-
};
|
|
1894
|
-
const restartLifecycleError = resolveRestartLifecycleError(err);
|
|
1895
|
-
if (restartLifecycleError instanceof GatewayDrainingError) {
|
|
1896
|
-
params.replyOperation?.fail("gateway_draining", restartLifecycleError);
|
|
1897
|
-
return {
|
|
1898
|
-
kind: "final",
|
|
1899
|
-
payload: markAgentRunFailureReplyPayload({ text: buildRestartLifecycleReplyText() })
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1902
|
-
if (restartLifecycleError instanceof CommandLaneClearedError) {
|
|
1903
|
-
params.replyOperation?.fail("command_lane_cleared", restartLifecycleError);
|
|
1904
|
-
return {
|
|
1905
|
-
kind: "final",
|
|
1906
|
-
payload: markAgentRunFailureReplyPayload({ text: buildRestartLifecycleReplyText() })
|
|
1907
|
-
};
|
|
1908
|
-
}
|
|
1909
|
-
if (isCompactionFailure) {
|
|
1910
|
-
defaultRuntime.error(`Auto-compaction failed (${message}). Preserving existing session mapping for ${params.sessionKey ?? params.followupRun.run.sessionId}.`);
|
|
1911
|
-
params.replyOperation?.fail("run_failed", err);
|
|
1912
|
-
return {
|
|
1913
|
-
kind: "final",
|
|
1914
|
-
payload: markAgentRunFailureReplyPayload({ text: buildContextOverflowRecoveryText({
|
|
1915
|
-
duringCompaction: true,
|
|
1916
|
-
preserveSessionMapping: true,
|
|
1917
|
-
cfg: runtimeConfig,
|
|
1918
|
-
agentId: params.followupRun.run.agentId,
|
|
1919
|
-
primaryProvider: params.followupRun.run.provider,
|
|
1920
|
-
primaryModel: params.followupRun.run.model,
|
|
1921
|
-
runtimeProvider: attemptedRuntimeProvider,
|
|
1922
|
-
runtimeModel: attemptedRuntimeModel,
|
|
1923
|
-
activeSessionEntry: params.getActiveSessionEntry()
|
|
1924
|
-
}) })
|
|
1925
|
-
};
|
|
1926
|
-
}
|
|
1927
|
-
if (providerRequestError) {
|
|
1928
|
-
params.replyOperation?.fail("run_failed", err);
|
|
1929
|
-
return {
|
|
1930
|
-
kind: "final",
|
|
1931
|
-
payload: markAgentRunFailureReplyPayload({ text: providerRequestError.userMessage })
|
|
1932
|
-
};
|
|
1933
|
-
}
|
|
1934
|
-
if (isTransientHttp && !didRetryTransientHttpError) {
|
|
1935
|
-
didRetryTransientHttpError = true;
|
|
1936
|
-
defaultRuntime.error(`Transient HTTP provider error before reply (${message}). Retrying once in ${TRANSIENT_HTTP_RETRY_DELAY_MS}ms.`);
|
|
1937
|
-
await new Promise((resolve) => {
|
|
1938
|
-
setTimeout(resolve, TRANSIENT_HTTP_RETRY_DELAY_MS);
|
|
1939
|
-
});
|
|
1940
|
-
continue;
|
|
1941
|
-
}
|
|
1942
|
-
defaultRuntime.error(`Embedded agent failed before reply: ${message}`);
|
|
1943
|
-
const isFallbackSummary = isFallbackSummaryError(err);
|
|
1944
|
-
const isPureTransientSummary = isFallbackSummary ? isPureTransientRateLimitSummary(err) : false;
|
|
1945
|
-
const isRateLimit = isFallbackSummary ? isPureTransientSummary : isRateLimitErrorMessage(message);
|
|
1946
|
-
const rateLimitOrOverloadedCopy = !isFallbackSummary || isPureTransientSummary ? formatRateLimitOrOverloadedErrorCopy(message) : void 0;
|
|
1947
|
-
const trimmedMessage = (isTransientHttp ? sanitizeUserFacingText(message, { errorContext: true }) : message).replace(/\.\s*$/, "");
|
|
1948
|
-
const externalRunFailureReply = !isBilling && !(isRateLimit && !isOverloadedErrorMessage(message)) && !rateLimitOrOverloadedCopy && !isContextOverflow && !shouldSurfaceToControlUi ? buildExternalRunFailureReply(message, {
|
|
1949
|
-
includeDetails: isVerboseFailureDetailEnabled(params.resolvedVerboseLevel),
|
|
1950
|
-
isHeartbeat: params.isHeartbeat
|
|
1951
|
-
}) : void 0;
|
|
1952
|
-
const genericFallbackText = params.isHeartbeat ? HEARTBEAT_EXTERNAL_RUN_FAILURE_TEXT : GENERIC_EXTERNAL_RUN_FAILURE_TEXT;
|
|
1953
|
-
const userVisibleFallbackText = resolveExternalRunFailureTextForConversation({
|
|
1954
|
-
text: isBilling ? BILLING_ERROR_USER_MESSAGE : isRateLimit && !isOverloadedErrorMessage(message) ? buildRateLimitCooldownMessage(err) : rateLimitOrOverloadedCopy ? rateLimitOrOverloadedCopy : isContextOverflow ? "⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model." : shouldSurfaceToControlUi ? `⚠️ Agent failed before reply: ${trimmedMessage}.\nLogs: fengming logs --follow` : externalRunFailureReply?.text ?? genericFallbackText,
|
|
1955
|
-
sessionCtx: params.sessionCtx,
|
|
1956
|
-
isGenericRunnerFailure: externalRunFailureReply?.isGenericRunnerFailure ?? false,
|
|
1957
|
-
suppressInNonDirect: Boolean(isRateLimit || rateLimitOrOverloadedCopy),
|
|
1958
|
-
cfg: params.followupRun.run.config
|
|
1959
|
-
});
|
|
1960
|
-
params.replyOperation?.fail("run_failed", err);
|
|
1961
|
-
return {
|
|
1962
|
-
kind: "final",
|
|
1963
|
-
payload: markAgentRunFailureReplyPayload({ text: userVisibleFallbackText })
|
|
1964
|
-
};
|
|
1965
|
-
}
|
|
1966
|
-
const finalEmbeddedError = runResult?.meta?.error;
|
|
1967
|
-
const hasPayloadText = runResult?.payloads?.some((p) => normalizeOptionalString(p.text));
|
|
1968
|
-
if (finalEmbeddedError && !hasPayloadText) {
|
|
1969
|
-
if (isContextOverflowError(finalEmbeddedError.message ?? "")) {
|
|
1970
|
-
params.replyOperation?.fail("run_failed", finalEmbeddedError);
|
|
1971
|
-
return {
|
|
1972
|
-
kind: "final",
|
|
1973
|
-
payload: markAgentRunFailureReplyPayload({ text: "⚠️ Context overflow — this conversation is too large for the model. Use /new to start a fresh session." })
|
|
1974
|
-
};
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
if (runResult) {
|
|
1978
|
-
if (!runResult.payloads?.some((p) => !p.isError && !p.isReasoning && hasOutboundReplyContent(p, { trimText: true }))) {
|
|
1979
|
-
const metaErrorMsg = finalEmbeddedError?.message ?? "";
|
|
1980
|
-
const rawErrorPayloadText = runResult.payloads?.find((p) => p.isError && hasNonEmptyString(p.text) && !p.text.startsWith("⚠️"))?.text ?? "";
|
|
1981
|
-
const errorCandidate = metaErrorMsg || rawErrorPayloadText;
|
|
1982
|
-
const formattedErrorCandidate = errorCandidate ? formatRateLimitOrOverloadedErrorCopy(errorCandidate) : void 0;
|
|
1983
|
-
if (formattedErrorCandidate) runResult.payloads = [markAgentRunFailureReplyPayload({
|
|
1984
|
-
text: resolveExternalRunFailureTextForConversation({
|
|
1985
|
-
text: formattedErrorCandidate,
|
|
1986
|
-
sessionCtx: params.sessionCtx,
|
|
1987
|
-
isGenericRunnerFailure: false,
|
|
1988
|
-
suppressInNonDirect: true,
|
|
1989
|
-
cfg: params.followupRun.run.config
|
|
1990
|
-
}),
|
|
1991
|
-
isError: true
|
|
1992
|
-
})];
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
return {
|
|
1996
|
-
kind: "success",
|
|
1997
|
-
runId,
|
|
1998
|
-
runResult,
|
|
1999
|
-
fallbackProvider,
|
|
2000
|
-
fallbackModel,
|
|
2001
|
-
fallbackAttempts,
|
|
2002
|
-
didLogHeartbeatStrip,
|
|
2003
|
-
autoCompactionCount,
|
|
2004
|
-
directlySentBlockKeys: directlySentBlockKeys.size > 0 ? directlySentBlockKeys : void 0
|
|
2005
|
-
};
|
|
2006
|
-
}
|
|
2007
|
-
//#endregion
|
|
2008
|
-
//#region src/auto-reply/reply/reply-turn-admission.ts
|
|
2009
|
-
function isAbortSignalAborted(signal) {
|
|
2010
|
-
return signal?.aborted === true;
|
|
2011
|
-
}
|
|
2012
|
-
async function admitReplyTurn(params) {
|
|
2013
|
-
let sessionId = params.sessionId;
|
|
2014
|
-
while (true) {
|
|
2015
|
-
if (isAbortSignalAborted(params.upstreamAbortSignal)) return {
|
|
2016
|
-
status: "skipped",
|
|
2017
|
-
reason: "aborted"
|
|
2018
|
-
};
|
|
2019
|
-
try {
|
|
2020
|
-
return {
|
|
2021
|
-
status: "owned",
|
|
2022
|
-
operation: createReplyOperation({
|
|
2023
|
-
sessionKey: params.sessionKey,
|
|
2024
|
-
sessionId,
|
|
2025
|
-
resetTriggered: params.resetTriggered,
|
|
2026
|
-
upstreamAbortSignal: params.upstreamAbortSignal
|
|
2027
|
-
})
|
|
2028
|
-
};
|
|
2029
|
-
} catch (error) {
|
|
2030
|
-
if (!(error instanceof ReplyRunAlreadyActiveError)) throw error;
|
|
2031
|
-
const activeOperation = replyRunRegistry.get(params.sessionKey);
|
|
2032
|
-
if (params.kind === "heartbeat" || params.kind === "control_abort") return {
|
|
2033
|
-
status: "skipped",
|
|
2034
|
-
reason: "active-run",
|
|
2035
|
-
activeOperation
|
|
2036
|
-
};
|
|
2037
|
-
if (params.waitForActive === false) return {
|
|
2038
|
-
status: "skipped",
|
|
2039
|
-
reason: "active-run",
|
|
2040
|
-
activeOperation
|
|
2041
|
-
};
|
|
2042
|
-
const waitTimeoutMs = params.waitTimeoutMs ?? (params.kind === "queued_followup" ? 15e3 : void 0);
|
|
2043
|
-
if (!await replyRunRegistry.waitForIdle(params.sessionKey, waitTimeoutMs, { signal: params.upstreamAbortSignal })) return {
|
|
2044
|
-
status: "skipped",
|
|
2045
|
-
reason: isAbortSignalAborted(params.upstreamAbortSignal) ? "aborted" : "active-run",
|
|
2046
|
-
activeOperation
|
|
2047
|
-
};
|
|
2048
|
-
if (activeOperation) sessionId = activeOperation.sessionId;
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
function resolveReplyTurnKind(opts) {
|
|
2053
|
-
return opts?.isHeartbeat === true ? "heartbeat" : "visible";
|
|
2054
|
-
}
|
|
2055
|
-
//#endregion
|
|
2056
|
-
export { resolveSessionRuntimeOverrideForProvider as a, clearDroppedCliSessionBinding as c, resolveRunAfterAutoFallbackPrimaryProbeRecheck as i, keepCliSessionBindingOnlyWhenReused as l, resolveReplyTurnKind as n, runAgentTurnWithFallback as o, buildKnownAgentRunFailureReplyPayload as r, normalizeReplyPayloadDirectives as s, admitReplyTurn as t, runCliAgentWithLifecycle as u };
|