fengming 0.3.3 → 0.3.5
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 +3 -3
- package/dist/abort-CjCDVBbH.js +277 -0
- package/dist/abort.runtime-DxJ8129J.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/accounts-Cyn0sm_v.js +423 -0
- package/dist/accounts-DzcLKcN5.js +2 -0
- package/dist/acp/control-plane/manager.js +1 -1
- package/dist/acp-spawn-4lfz_3K9.js +1286 -0
- package/dist/acp-spawn-BCUjuO6L.js +2 -0
- package/dist/acp-stateful-target-driver-Bv99uwEA.js +89 -0
- package/dist/action-info-CP-p6RHS.js +75 -0
- package/dist/active-runtime-registry-DjKe53a5.js +62 -0
- package/dist/active-tool-schema-warnings-p7CqUnu1.js +105 -0
- package/dist/active-tool-schema-warnings-pGI92yka.js +2 -0
- package/dist/agent-B77yluip.js +1825 -0
- package/dist/agent-BooUvZnR.js +2 -0
- package/dist/agent-bundle-lsp-runtime-3ieSgTgo.js +389 -0
- package/dist/agent-bundle-lsp-runtime-CkJ0XJK7.js +2 -0
- package/dist/agent-bundle-mcp-materialize-BH-esGZL.js +124 -0
- package/dist/agent-bundle-mcp-tools-DkixTTnL.js +3 -0
- package/dist/agent-command-BJKcnQy6.js +1435 -0
- package/dist/agent-delivery-CEfe_Zzt.js +117 -0
- package/dist/agent-harness-runtime-R_Ae6o9C.js +207 -0
- package/dist/agent-kWSaRcQt.js +3 -0
- package/dist/agent-model-discovery-C49swEgd.js +238 -0
- package/dist/agent-model-discovery-DZbixJQs.js +3 -0
- package/dist/agent-runner-utils-BChpi9Ec.js +267 -0
- package/dist/agent-runner.runtime-3LOdt215.js +3784 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-3jsv8b7Y.js +199 -0
- package/dist/agent-runtime-label-uoFI4ovH.js +30 -0
- package/dist/agent-runtime-metadata-BhFt6kLt.js +53 -0
- package/dist/agent-tool-result-middleware-loader-BxYJNC1i.js +55 -0
- package/dist/agent-tools-COLEG7aL.js +2506 -0
- package/dist/agent-tools.before-tool-call--rMZI5Rd.js +1274 -0
- package/dist/agent-tools.before-tool-call-CbX2sfP4.js +2 -0
- package/dist/agent-via-gateway-DfKij3De.js +486 -0
- package/dist/agent-wait-dedupe-BAUSJotw.js +180 -0
- package/dist/agents/agent-bundle-mcp-materialize.js +1 -1
- package/dist/agents/auth-profiles.runtime.js +1 -1
- package/dist/agents/compaction-planning.worker.js +1 -1
- package/dist/agents/embedded-agent-runner/effective-tool-policy.js +1 -1
- package/dist/agents/embedded-agent-runner/tool-split.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents/model-provider-auth.worker.js +3 -3
- package/dist/agents/models-config.runtime.js +1 -1
- package/dist/agents-CZSNDJWD.js +632 -0
- package/dist/agents.command-shared-DgbjfH23.js +16 -0
- package/dist/agents.commands.add-DknGM1oz.js +304 -0
- package/dist/agents.commands.bind-DDVI0yDe.js +265 -0
- package/dist/agents.commands.delete-Dv4RHEhc.js +128 -0
- package/dist/agents.commands.identity-BSZbc1QR.js +143 -0
- package/dist/agents.commands.list-CA0OTw59.js +235 -0
- package/dist/aliases-EY1GbfwT.js +97 -0
- package/dist/api-CY0oKcRz.js +3 -0
- package/dist/api-DgjY0gIl.js +6 -0
- package/dist/api-VyMyAYze.js +2 -0
- package/dist/api-key-rotation-DxPKIdmC.js +167 -0
- package/dist/app-registration-BBDxCbFo.js +194 -0
- package/dist/apply-DMYy7tc3.js +544 -0
- package/dist/apply-Dd0n97MD.js +2 -0
- package/dist/apply-bHIT1nMp.js +416 -0
- package/dist/apply-g8x7Z83S.js +510 -0
- package/dist/apply-nnbx9TaB.js +2 -0
- package/dist/approval-native-helpers-CjaYvOaZ.js +398 -0
- package/dist/artifacts-B55YR-uA.js +368 -0
- package/dist/assistant-hJaOgfKl.js +291 -0
- package/dist/attachment-normalize-COsastJx.js +213 -0
- package/dist/attempt-execution-fDWDWcWe.js +584 -0
- package/dist/attempt-execution.helpers-Cze5xPim.js +969 -0
- package/dist/attempt-execution.runtime-B1iCG6LN.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt.prompt-helpers-CkBYHBBo.js +543 -0
- package/dist/attempt.tool-run-context-DzfRK5pV.js +1240 -0
- package/dist/audio-preflight.runtime-rjWd9uyk.js +7 -0
- package/dist/audio-preflight.runtime.js +1 -1
- package/dist/audit-DgFtNg3U.js +1108 -0
- package/dist/audit-L8EC3WhV.js +477 -0
- package/dist/audit.nondeep.runtime-D0sQ6bO2.js +1416 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CiG82F31.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-CzPdsZVM.js +567 -0
- package/dist/auth-choice-BNzS9QBI.js +3 -0
- package/dist/auth-choice-Cwr5kgcD.js +110 -0
- package/dist/auth-choice-DW9qPpMS.js +400 -0
- package/dist/auth-choice.apply.api-providers-C68tOdqj.js +34 -0
- package/dist/auth-choice.apply.api-providers-DSRK0gYo.js +2 -0
- package/dist/auth-choice.plugin-providers.runtime-BJ9VyO1C.js +11 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auth-health-BanKwsTW.js +219 -0
- package/dist/auth-list-Dq8obVno.js +115 -0
- package/dist/auth-order-VXqoAroP.js +105 -0
- package/dist/auth-profiles-6VFEdgC-.js +73 -0
- package/dist/auth-profiles-a0M4JYYg.js +14 -0
- package/dist/backend-config-COaTdVnN.js +259 -0
- package/dist/bash-tools-BMAquSiM.js +3 -0
- package/dist/bash-tools-DLiUXfaS.js +3497 -0
- package/dist/binding-routing-Bwvdx_7S.js +113 -0
- package/dist/binding-targets-Z_d0mK_1.js +121 -0
- package/dist/bootstrap-files-CoCV_zqu.js +202 -0
- package/dist/bootstrap-files-_T3VoTrV.js +3 -0
- package/dist/bridge-server-BIaNurGa.js +113 -0
- package/dist/browser-cli-D4wL8NU9.js +230 -0
- package/dist/browser-cli-actions-input-z40PGiYI.js +522 -0
- package/dist/browser-cli-actions-observe-C4TeyNke.js +81 -0
- package/dist/browser-cli-debug-Dv0gH-c8.js +137 -0
- package/dist/browser-cli-inspect-BUXeITYc.js +117 -0
- package/dist/browser-cli-manage-qMb3Yw5Y.js +446 -0
- package/dist/browser-cli-resize-CZWnGwGz.js +32 -0
- package/dist/browser-cli-shared-BpinhvE3.js +69 -0
- package/dist/browser-cli-state-CBbKqqgP.js +371 -0
- package/dist/browser-cli-uI5GGX51.js +2 -0
- package/dist/browser-control-auth-CFPJXdN_.js +2 -0
- package/dist/browser-profiles-D4ni3t4J.js +2 -0
- package/dist/browser-runtime-Dm5D_PLf.js +389 -0
- package/dist/browser-tool.schema-Bek02ox5.js +132 -0
- package/dist/btw-command-DdrwvCK4.js +18 -0
- package/dist/build-DkEeJ9sO.js +261 -0
- package/dist/build-info.json +2 -2
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/bundled-channel-config-schema-BeowdkHi.d.ts +3168 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-DTRuKZJC.js +1809 -0
- package/dist/capability-provider-runtime-Cpp-Jq9g.js +346 -0
- package/dist/cdp.helpers-GfQkB-B5.js +637 -0
- package/dist/channel-BRehZ4Cg.js +2309 -0
- package/dist/channel-actions-hdQKe_se.js +46 -0
- package/dist/channel-bootstrap.runtime-BzjlNG_j.js +38 -0
- package/dist/channel-bootstrap.runtime-CmNNVl40.js +2 -0
- package/dist/channel-bootstrap.runtime.js +1 -1
- package/dist/channel-core-BLcWqSk-.js +5 -0
- package/dist/channel-inbound-pR1B7HTU.js +121 -0
- package/dist/channel-message-W0VurpjH.js +12 -0
- package/dist/channel-outbound-DO4HI6E_.js +436 -0
- package/dist/channel-plugin-resolution-CLA7S5_A.js +2 -0
- package/dist/channel-plugin-resolution-DzwVj01h.js +135 -0
- package/dist/channel-resolution-DOPyiG4k.js +46 -0
- package/dist/channel-selection-kwoWZDQ3.js +171 -0
- package/dist/channel-selection.runtime-LiDliif9.js +2 -0
- package/dist/channel-selection.runtime.js +1 -1
- package/dist/channel.runtime-DDt3PayH.js +697 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-CKJd4eUz.js +1004 -0
- package/dist/channels-cli-DLAPi8pX.js +331 -0
- package/dist/chat-6WsYrS9m.js +3 -0
- package/dist/chat-DpsCEXAx.js +2940 -0
- package/dist/chrome-BWHc9vYG.js +1517 -0
- package/dist/chrome-mcp-BGKgR8A_.js +2 -0
- package/dist/chrome-mcp-Bg5D5PDc.js +864 -0
- package/dist/claude-live-session-BLCZnv-A.js +2 -0
- package/dist/claude-live-session-CGnB64D6.js +1338 -0
- package/dist/clawbot-cli-ynXzgp8B.js +9 -0
- package/dist/cli/daemon-cli.js +3 -3
- package/dist/cli/gateway-lifecycle.runtime.js +4 -4
- package/dist/cli/run-main.js +12 -12
- package/dist/cli-B4Ttnj0P.js +2 -0
- package/dist/cli-BjVgdamH.js +2 -0
- package/dist/cli-CNqBrHLU.js +293 -0
- package/dist/cli-backends.runtime-DoxtCrow.js +7 -0
- package/dist/cli-backends.runtime.js +1 -1
- package/dist/cli-compaction-BCuLbs75.js +363 -0
- package/dist/cli-mthNIkji.js +141 -0
- package/dist/cli-registry-loader-B2sNTdgY.js +2 -0
- package/dist/cli-registry-loader-Dz9YFrjw.js +193 -0
- package/dist/cli-runner-C9t-9-Io.js +597 -0
- package/dist/cli-runner-D21qMGk7.js +2 -0
- package/dist/cli-runner.runtime-BNqbJFgu.js +3 -0
- package/dist/cli-runner.runtime-Dv50IEvH.js +4 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-session-jBtClYfT.js +119 -0
- package/dist/cli-startup-metadata.json +9 -9
- package/dist/cli.runtime-CGBzSGAG.js +1276 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/codex-native-web-search-B3C-srtm.js +20 -0
- package/dist/codex-native-web-search-B7xh2Xcb.js +4 -0
- package/dist/codex-native-web-search-core-CrwANQg5.js +106 -0
- package/dist/command-auth-Dz_pdczs.js +135 -0
- package/dist/command-config-resolution-XCA63Yv8.js +25 -0
- package/dist/command-config-resolution-xtKMDTG9.js +2 -0
- package/dist/command-config-resolution.runtime-xtKMDTG9.js +2 -0
- package/dist/command-config-resolution.runtime.js +1 -1
- package/dist/command-execution-startup-CasEqEXh.js +90 -0
- package/dist/command-primitives-runtime-DC9gtSI3.js +3 -0
- package/dist/command-registry-BQnMdca9.js +9 -0
- package/dist/command-registry-core-hx2t1jQP.js +114 -0
- package/dist/command-registry-rbKA-L_8.js +4 -0
- package/dist/command-secret-gateway-7oveYQCx.js +589 -0
- package/dist/command-secret-targets-B7M1Us_C.js +2 -0
- package/dist/command-status-builders-DrSoZhiI.js +147 -0
- package/dist/command-status.runtime-By0071-y.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands/status.summary.runtime.js +3 -3
- package/dist/commands-B1MnUj5-.js +161 -0
- package/dist/commands-compact.runtime-DELj3JaW.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-Zw0grrkC.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-BCl_ZHJZ.js +6327 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-Uurm-0C3.js +448 -0
- package/dist/commands-registry-Bo1AeDcq.js +195 -0
- package/dist/commands-registry.runtime-C9DBHyhh.js +4 -0
- package/dist/commands-registry.runtime.js +1 -1
- package/dist/commands-status-BoAXH-wg.js +16 -0
- package/dist/commands-status-CNALMTN9.js +3 -0
- package/dist/commands-status.runtime-CNALMTN9.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-Dl4IuTzV.js +2 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-BPzpLmUp.js +2 -0
- package/dist/commands-system-prompt-DCOZSNh5.js +161 -0
- package/dist/commands.runtime-bfCLM0Sg.js +175 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/common-CoOYhmSg.js +286 -0
- package/dist/compact-yqaUOESq.js +1165 -0
- package/dist/compact.runtime-Y91AFZVE.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/compaction-planning-DVnykwzd.js +202 -0
- package/dist/completion-cli-BJjq_g_B.js +393 -0
- package/dist/config-CsmSEaNn.js +374 -0
- package/dist/config-CtNXZ0iy.js +610 -0
- package/dist/config-cli-CNpIVdqp.js +1703 -0
- package/dist/config-mutation-B-SErGM0.js +5 -0
- package/dist/config-mutations-Bu3ahkX8.js +161 -0
- package/dist/config-utils-Bv0Nisds.js +141 -0
- package/dist/config-validation-DitvTYD8.js +33 -0
- package/dist/configure-CdjbRKTg.js +771 -0
- package/dist/configure-Cvi-5ml4.js +3 -0
- package/dist/configure.commands-BJii4733.js +1253 -0
- package/dist/configure.commands-tJzVFJ0o.js +2 -0
- package/dist/context-D1N9oPds.js +2 -0
- package/dist/context-XMtJ9b3v.js +248 -0
- package/dist/context-engine-host-compat-3QznbSaW.js +280 -0
- package/dist/context-engine-host-compat-DquSpnKD.js +2 -0
- package/dist/context-engine-lifecycle-Bqdhy9JU.js +627 -0
- package/dist/control-auth-CMW_9jmY.js +114 -0
- package/dist/control-service-D-r3k91q.js +40 -0
- package/dist/control-service-uIPYrp9F.js +3 -0
- package/dist/control-ui/assets/activity-DgMhyllD.js +124 -0
- package/dist/control-ui/assets/agents-CsRhxO2O.js +1030 -0
- package/dist/control-ui/assets/channels-Dq8bzpMg.js +120 -0
- package/dist/control-ui/assets/cron-Dk5bqYwg.js +1016 -0
- package/dist/control-ui/assets/debug-CNIwFEQO.js +97 -0
- package/dist/control-ui/assets/index-CV2NsPlu.js +7214 -0
- package/dist/control-ui/assets/instances-DLr0iEvT.js +57 -0
- package/dist/control-ui/assets/nodes-D3JEksjl.js +444 -0
- package/dist/control-ui/assets/sessions-nbXWGlHZ.js +425 -0
- package/dist/control-ui/assets/skills-tBOi8OBq.js +362 -0
- package/dist/control-ui/assets/workboard-ClTo7wmK.js +402 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/control-ui-AkRMsk9S.js +750 -0
- package/dist/conversation-label-generator-DHtcgSBn.js +72 -0
- package/dist/conversation-runtime-BEgHW4ta.js +31 -0
- package/dist/core-Bslrvfnp.js +284 -0
- package/dist/core-api-BOlUb7G8.js +5 -0
- package/dist/core-api-CiBoGa2I.js +2 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-mXnyuHx9.js +55 -0
- package/dist/cron-PbdpyFrD.js +453 -0
- package/dist/daemon-install-C-d4dFvn.js +66 -0
- package/dist/daemon-install-auth-profiles-store.runtime-CvE2EVVo.js +2 -0
- package/dist/daemon-install-auth-profiles-store.runtime.js +1 -1
- package/dist/dashboard-Ey5dnvMI.js +263 -0
- package/dist/defaults-CsRAv-qE.js +130 -0
- package/dist/defaults-DHZBSNHC.js +3 -0
- package/dist/defaults.constants-CR4S_tvw.js +76 -0
- package/dist/deliver-BkuuFBlm.js +1399 -0
- package/dist/deliver-P4upyes7.js +3 -0
- package/dist/deliver-runtime-CjnLI_nC.js +2 -0
- package/dist/delivery-outbound.runtime-fcJ-M8qj.js +7 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-BqgHvNlY.js +863 -0
- package/dist/delivery-queue-CfsRscJb.js +2 -0
- package/dist/delivery-queue-runtime-D0PKG1Bv.js +16 -0
- package/dist/delivery-target.runtime-C5e8d0WH.js +45 -0
- package/dist/delivery-target.runtime.js +1 -1
- package/dist/delivery.runtime-2Ut8xM3P.js +470 -0
- package/dist/delivery.runtime.js +1 -1
- package/dist/detached-task-runtime-OOZBqRy-.js +86 -0
- package/dist/diagnostics-zf6WQ2h7.js +168 -0
- package/dist/dialogue-C8IOya-l.js +37 -0
- package/dist/direct-dm-wPF-KfNb.js +81 -0
- package/dist/directive-handling.defaults-C-1lmFYo.js +22 -0
- package/dist/directive-handling.fast-lane-DENPMtYI.js +70 -0
- package/dist/directive-handling.impl-C1p5t3qA.js +2 -0
- package/dist/directive-handling.impl-DOo2Sa7C.js +823 -0
- package/dist/directive-handling.model-selection-6gC-fr_g.js +122 -0
- package/dist/directive-handling.persist.runtime-CuhUd2kW.js +274 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directives-BIKSyN8C.js +319 -0
- package/dist/directory-cli-DZ0PU0Rv.js +239 -0
- package/dist/dispatch-DQLImAqt.js +2057 -0
- package/dist/dispatch-acp-DzyX7wsq.js +1102 -0
- package/dist/dispatch-acp-manager.runtime-CoAfs4O1.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-7uUP_jr9.js +4 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-transcript.runtime-BUlmV_h0.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp-tts.runtime-ChBnVkNt.js +3 -0
- package/dist/dispatch-acp-tts.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DAexFaBu.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dispatcher-D3IQEbf9.js +106 -0
- package/dist/doctor-BSqEqfb6.js +760 -0
- package/dist/doctor-auth-flat-profiles-BIZ4wsYP.js +2 -0
- package/dist/doctor-auth-flat-profiles-DXtD5LfC.js +516 -0
- package/dist/doctor-auth-legacy-oauth-DwFbRYTP.js +48 -0
- package/dist/doctor-auth-oauth-sidecar-6I3FEJbi.js +2 -0
- package/dist/doctor-auth-oauth-sidecar-BSC3rnDM.js +177 -0
- package/dist/doctor-auth-tVGsUiM6.js +216 -0
- package/dist/doctor-bootstrap-size-B0q6bdkO.js +57 -0
- package/dist/doctor-claude-cli-Bn79OuBT.js +150 -0
- package/dist/doctor-config-flow-CCwocXpV.js +1819 -0
- package/dist/doctor-core-checks-D7-1l8jy.js +666 -0
- package/dist/doctor-core-checks-eM8FNi8B.js +2 -0
- package/dist/doctor-core-checks.runtime-Dc03aeoU.js +278 -0
- package/dist/doctor-core-checks.runtime.js +1 -1
- package/dist/doctor-gRYfpEbB.js +6 -0
- package/dist/doctor-gateway-daemon-flow-KTnHAdeV.js +349 -0
- package/dist/doctor-gateway-services-BByDQtjY.js +465 -0
- package/dist/doctor-health-CnoM718z.js +65 -0
- package/dist/doctor-health-contributions-flVKMQwr.js +874 -0
- package/dist/doctor-lint-BBm6gtBa.js +95 -0
- package/dist/doctor-memory-search-DjHVDCGo.js +407 -0
- package/dist/doctor-state-integrity-Bgw25cz1.js +1257 -0
- package/dist/doctor-tool-result-cap-advice-B8wTpiTO.js +27 -0
- package/dist/doctor-workspace-status-DcjeJIpT.js +76 -0
- package/dist/dreaming-BE4t8DVf.js +523 -0
- package/dist/dreaming-command-DWm1lB-Z.js +101 -0
- package/dist/dreaming-narrative-8DM-OMrm.js +721 -0
- package/dist/dreaming-narrative-CcFfheQI.js +2 -0
- package/dist/dreaming-phases-CqOhhTdZ.js +2 -0
- package/dist/dreaming-phases-D9eT6Kk0.js +1162 -0
- package/dist/drive-D2M5B7-2.js +899 -0
- package/dist/echo-transcript-B-wl5MoX.js +52 -0
- package/dist/effective-tool-policy-Cx8mC5aA.js +89 -0
- package/dist/embedded-agent-BTvtoOe_.js +4 -0
- package/dist/embedded-agent-CGmSKuNM.js +4074 -0
- package/dist/embedded-agent-helpers-CboIPx57.js +6 -0
- package/dist/embedded-agent-helpers-cw0InMDZ.js +1037 -0
- package/dist/embedded-agent.runtime-Bfe4bjyF.js +4 -0
- package/dist/embedded-agent.runtime.js +1 -1
- package/dist/embedded-backend-D-EshN85.js +744 -0
- package/dist/embedded-gateway-stub.runtime-Cx9qs0KV.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-provider-runtime-DaXfsUPo.js +86 -0
- package/dist/embedding-providers-CdU99clu.js +2 -0
- package/dist/embeddings-http-BQnlTr-1.js +222 -0
- package/dist/engine-qmd-5jbjGywA.js +708 -0
- package/dist/engine-storage-CfAgwoDp.js +203 -0
- package/dist/entry.js +1 -1
- package/dist/errors-C0AUxo3P.js +2 -0
- package/dist/exec-approval-forwarder.runtime-BvR47p5Z.js +4 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approval-session-target-CCqYgaVa.js +177 -0
- package/dist/exec-auto-reviewer-BfJaNkNy.js +2 -0
- package/dist/exec-auto-reviewer-Dqx7I88Z.js +241 -0
- package/dist/execute.runtime-Qb6Z75sG.js +579 -0
- package/dist/execute.runtime.js +1 -1
- package/dist/extensionAPI.js +2 -2
- package/dist/extensions/active-memory/index.js +3 -3
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/baichuan/index.js +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-cdp.js +1 -1
- package/dist/extensions/browser/browser-config.js +5 -5
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +3 -3
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +3 -3
- package/dist/extensions/browser/browser-runtime-api.js +14 -14
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.js +16 -16
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/canvas/index.js +3 -3
- package/dist/extensions/canvas/runtime-api.js +2 -2
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/longcat/index.js +1 -1
- package/dist/extensions/memory-core/api.js +3 -3
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/memory-core/cli.js +2 -2
- package/dist/extensions/memory-core/index.js +11 -11
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +6 -6
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/moonshot/index.js +5 -5
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/qianfan/index.js +1 -1
- package/dist/extensions/qwen/index.js +5 -5
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/sensenova/index.js +1 -1
- package/dist/extensions/skill-workshop/api.js +2 -2
- package/dist/extensions/skill-workshop/index.js +4 -4
- package/dist/extensions/stepfun/index.js +2 -2
- package/dist/extensions/tavily/index.js +1 -1
- package/dist/extensions/tavily/web-search-provider.js +1 -1
- package/dist/extensions/tencent/index.js +2 -2
- package/dist/extensions/tiangong/index.js +1 -1
- package/dist/extensions/volcengine/index.js +3 -3
- package/dist/extensions/volcengine/speech-provider.js +1 -1
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +1 -1
- package/dist/extensions/weixin/index.js +7 -7
- package/dist/extensions/workboard/index.js +2 -2
- package/dist/extensions/xiaomi/index.js +4 -4
- package/dist/extensions/xiaomi/speech-provider.js +1 -1
- package/dist/extensions/xingchen/index.js +1 -1
- package/dist/extensions/yi/index.js +1 -1
- package/dist/extensions/zai/index.js +4 -4
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zhinao/index.js +1 -1
- package/dist/external-cli-auth-selection-CM_aOUJw.js +113 -0
- package/dist/extra-params-Bm1eLWN9.js +615 -0
- package/dist/fallback-notice-state-v1kyWACv.js +15 -0
- package/dist/fallbacks-CDllk2g1.js +31 -0
- package/dist/fallbacks-shared-DdMKEmAC.js +116 -0
- package/dist/fengming-runtime-DSv30J04.js +33 -0
- package/dist/fengming-runtime-config-BE-DquuY.js +2 -0
- package/dist/fengming-runtime-memory-BE-DquuY.js +2 -0
- package/dist/fengming-runtime-session-BE-DquuY.js +2 -0
- package/dist/fengming-tools-DHb-ZeDC.js +12221 -0
- package/dist/flows-Cz3y10A9.js +189 -0
- package/dist/fs-utils-D05rps7O.js +9 -0
- package/dist/gateway-DTi2D7ZS.js +133 -0
- package/dist/gateway-cli-DT2fL2fX.js +443 -0
- package/dist/gateway-install-token-CJhAycOA.js +136 -0
- package/dist/gateway-method-runtime-BuiYTDQk.js +21 -0
- package/dist/gateway-runtime-C5_cVlSW.js +23 -0
- package/dist/get-reply-Cz-dUrWm.js +5198 -0
- package/dist/get-reply-from-config.runtime-BC1HT67i.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/github-copilot-token-09lxV3kH.js +2 -0
- package/dist/health-CmihbcqN.js +621 -0
- package/dist/health-D8L37hBZ.js +111 -0
- package/dist/health-DU7I9RrJ.js +3 -0
- package/dist/health-state-QZ2E6xGQ.js +106 -0
- package/dist/heartbeat-runner-Bz5PMzEI.js +1930 -0
- package/dist/heartbeat-runner-DfqqQ_8w.js +5 -0
- package/dist/heartbeat-runner.runtime-8BshUhoS.js +3 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/helpers-Bkq4POdX.js +406 -0
- package/dist/hook-helpers-nmDwt3Fa.js +44 -0
- package/dist/hooks-9FOcRqfu.js +536 -0
- package/dist/hooks-cli-CrQelcwo.js +465 -0
- package/dist/http-endpoint-helpers-BD5u6YsT.js +37 -0
- package/dist/http-utils-RcKuBJ0I.js +98 -0
- package/dist/image-DwNoypK2.js +385 -0
- package/dist/image-fallbacks-BUyDnmUX.js +31 -0
- package/dist/image-generation-core.auth.runtime-CA8miEMh.js +2 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-DXMW5EmB.js +152 -0
- package/dist/image-runtime-D5QpNNzz.js +9 -0
- package/dist/image-tool.helpers-6vGxo1Y0.js +150 -0
- package/dist/images-BGWLzQEJ.js +416 -0
- package/dist/images-Db4UB3JG.js +2 -0
- package/dist/inbound-reply-dispatch-DRF6ZmQg.js +2 -0
- package/dist/inbound-reply-dispatch-RAKLqow4.js +147 -0
- package/dist/index.js +1 -1
- package/dist/infra-runtime-BFrpRc_V.js +32 -0
- package/dist/init-sR7bCS9D.js +59 -0
- package/dist/install-BzdJbOUx.js +262 -0
- package/dist/install.runtime-Zye6pbZ6.js +2 -0
- package/dist/internal-DL_vFx8C.js +399 -0
- package/dist/isolated-agent-Qif8Llbt.js +2 -0
- package/dist/isolated-agent-aqEjxqs-.js +1097 -0
- package/dist/kernel-B-i4c2IK.js +979 -0
- package/dist/kernel-DYDJ_hLb.js +3 -0
- package/dist/kimi-web-search-provider.runtime-95HAkvHY.js +307 -0
- package/dist/kimi-web-search-provider.runtime.js +1 -1
- package/dist/library-CZVbE5hF.js +45 -0
- package/dist/lifecycle-C8M3YLbT.js +2 -0
- package/dist/lifecycle-CPDNQnUN.js +570 -0
- package/dist/lifecycle-DpuP7n3J.js +355 -0
- package/dist/lifecycle.runtime-C8M3YLbT.js +2 -0
- package/dist/lifecycle.runtime.js +1 -1
- package/dist/link-understanding/apply.runtime.js +3 -3
- package/dist/list-B_ALwpPl.js +2 -0
- package/dist/list-Bda_GYFy.js +207 -0
- package/dist/list.list-command-W9OGfAIU.js +429 -0
- package/dist/list.model-row-LV4AaX0H.js +39 -0
- package/dist/list.probe-CrZm6BH2.js +451 -0
- package/dist/list.probe-Dfdmb8bC.js +2 -0
- package/dist/list.provider-catalog-7T1jKk0n.js +211 -0
- package/dist/list.provider-catalog-DjGyZVEj.js +2 -0
- package/dist/list.registry-load-DkCS8JZQ.js +152 -0
- package/dist/list.row-sources-B1vjo_Y9.js +474 -0
- package/dist/list.source-plan-C9Sa6zRK.js +81 -0
- package/dist/list.status-command-9daSZZDm.js +815 -0
- package/dist/live-model-switch-Dy-UFUMS.js +119 -0
- package/dist/llm-slug-generator-DEmh5-_1.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/load-config-CvQpC8k6.js +27 -0
- package/dist/load-context-_qSHpZ5S.js +82 -0
- package/dist/loader-CntMt07B.js +7008 -0
- package/dist/local-dispatch.runtime-BSN_gqNS.js +10 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/main-session-restart-recovery-Db7366lt.js +2 -0
- package/dist/main-session-restart-recovery-n87NTooQ.js +389 -0
- package/dist/managed-image-attachments-BTBBHlKl.js +2 -0
- package/dist/managed-image-attachments-C6_V1yX0.js +616 -0
- package/dist/manager-CKrWxjV6.js +3737 -0
- package/dist/manager-Dvb1FVnx.js +2314 -0
- package/dist/mcp/plugin-tools-serve.js +2 -2
- package/dist/mcp-http-CSoGXOa_.js +583 -0
- package/dist/mcp-http-D4ieDB3W.js +2 -0
- package/dist/media-runtime-GeQTQkkK.js +391 -0
- package/dist/media-services-CWbIUZDe.js +416 -0
- package/dist/media-understanding/apply.runtime.js +1 -1
- package/dist/media-understanding-DXc2BD2L.js +87 -0
- package/dist/media-understanding-provider-BkdUiVWU.js +70 -0
- package/dist/media-understanding-provider-BlgmLViW.js +13 -0
- package/dist/media-understanding-provider-C9P2VjkC.js +29 -0
- package/dist/media-understanding-provider-CJlbgAvl.js +69 -0
- package/dist/memory-CnC2jM1l.js +437 -0
- package/dist/memory-core-host-engine-embeddings-Dy9vN-Ce.js +667 -0
- package/dist/memory-core-host-engine-foundation-C-pGGQnm.js +15 -0
- package/dist/memory-core-host-engine-qmd-DLJDON9w.js +2 -0
- package/dist/memory-core-host-engine-storage-Bzf-C8XE.js +2 -0
- package/dist/memory-core-host-runtime-cli-_LWA6G3x.js +10 -0
- package/dist/memory-core-host-runtime-core-CromkNBr.js +12 -0
- package/dist/memory-core-host-runtime-files-DpbviC1b.js +4 -0
- package/dist/memory-embedding-provider-runtime-CaVVaYC5.js +36 -0
- package/dist/memory-host-core-B5dWHwBF.js +78 -0
- package/dist/memory-host-search.runtime-DqlCFac1.js +2 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-runtime-BCeeWb1G.js +2 -0
- package/dist/memory-runtime-pR9KGin0.js +57 -0
- package/dist/memory-search-CpDEEY2Q.js +235 -0
- package/dist/message-BeGCG-D8.js +284 -0
- package/dist/message-YGMOyqP5.js +2 -0
- package/dist/message-action-runner-ByMT3_eb.js +1922 -0
- package/dist/message-action-runner-VXmKO_W7.js +2 -0
- package/dist/message-handler-MZ0DMbCx.js +1806 -0
- package/dist/metadata-registry-loader-BH9D1UOx.js +2 -0
- package/dist/metadata-registry-loader-BK1cHCas.js +22 -0
- package/dist/migrate-BA6w0hd3.js +2 -0
- package/dist/migrate-BGuQC-1W.js +458 -0
- package/dist/migration-provider-runtime-BBdDegWG.js +2 -0
- package/dist/migration-provider-runtime-C5WUjrQz.js +68 -0
- package/dist/minimax-web-search-provider.runtime-suVFk3Zx.js +148 -0
- package/dist/minimax-web-search-provider.runtime.js +1 -1
- package/dist/model-BJZXR9dq.js +1302 -0
- package/dist/model-BL7xlN5h.js +2 -0
- package/dist/model-auth-C-6dYVob.js +6 -0
- package/dist/model-auth-DJz7R41W.js +705 -0
- package/dist/model-auth-label-DKNXktIu.js +67 -0
- package/dist/model-catalog-BjiK5rtT.js +3 -0
- package/dist/model-catalog-DM1CTjkW.js +434 -0
- package/dist/model-catalog-visibility-DEJZG0In.js +76 -0
- package/dist/model-config.helpers-BKcUeE_P.js +95 -0
- package/dist/model-context-tokens-5y_PQELY.js +572 -0
- package/dist/model-fallback-BDdBR053.js +1288 -0
- package/dist/model-fallback-auth.runtime-pcWfkIUF.js +5 -0
- package/dist/model-fallback-auth.runtime.js +1 -1
- package/dist/model-picker-Bpvp4_N4.js +1135 -0
- package/dist/model-picker-DWPPtq6d.js +3 -0
- package/dist/model-picker-visibility-BtdqVF80.js +22 -0
- package/dist/model-picker.runtime-CYlqts2z.js +48 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-pricing-cache-BmmncDqL.js +856 -0
- package/dist/model-pricing-cache-CEwRyWw2.js +3 -0
- package/dist/model-pricing-cache-state-B8Aspp85.js +83 -0
- package/dist/model-provider-auth-B3KXoKkE.js +2 -0
- package/dist/model-provider-auth-Bo_8T7of.js +375 -0
- package/dist/model-runtime-aliases-Br-ZlhrL.js +133 -0
- package/dist/model-selection-D5-ERakL.js +254 -0
- package/dist/model-selection-DrzgktRu.js +7 -0
- package/dist/model-selection-ibwsPgIw.js +352 -0
- package/dist/model-selection.runtime-BRkOZejt.js +7 -0
- package/dist/model-selection.runtime.js +1 -1
- package/dist/models-RPAH3ZBn.js +57 -0
- package/dist/models-auth-status-Cwu9OXU8.js +280 -0
- package/dist/models-cli-CrYkSUoa.js +257 -0
- package/dist/models-config-Ayzj9gDz.js +1189 -0
- package/dist/models-config-BFcjB7nN.js +2 -0
- package/dist/models-config.providers.secrets-CCRUW7gL.js +2 -0
- package/dist/models-config.providers.secrets-DdX_XSRo.js +382 -0
- package/dist/models-http-jLFnelH7.js +88 -0
- package/dist/monitor-CqWICrjO.js +60 -0
- package/dist/monitor-DwccYPfp.js +1024 -0
- package/dist/monitor.account-e9EVttpP.js +5382 -0
- package/dist/music-generation-provider-Dfc--R-x.js +308 -0
- package/dist/native-hook-relay-Cioqiqv8.js +1378 -0
- package/dist/native-hook-relay-DRwJIspI.js +19 -0
- package/dist/node-cli-CrG3LH9J.js +2806 -0
- package/dist/node-command-policy-CkBTEmhl.js +295 -0
- package/dist/nodes-BxrWFA09.js +1483 -0
- package/dist/nodes-DFPTGZjc.js +3 -0
- package/dist/nodes-cli-Czwyt6r1.js +960 -0
- package/dist/nodes-pending-B_4QHyB2.js +211 -0
- package/dist/nodes-utils-c4k31OaG.js +85 -0
- package/dist/oauth-BXncC0JP.js +852 -0
- package/dist/oauth-Ba1O2vqP.js +207 -0
- package/dist/oauth-CGQkfxbJ.js +746 -0
- package/dist/onboard-I5tQlVm6.js +768 -0
- package/dist/onboard-channels-BleKfB1D.js +2 -0
- package/dist/onboard-channels-jVaUjGYX.js +1534 -0
- package/dist/onboard-custom-BR_5oqUr.js +3 -0
- package/dist/onboard-custom-Ss0DThuP.js +280 -0
- package/dist/onboard-custom-config-B-knjQm7.js +422 -0
- package/dist/onboard-search-BsIztGYF.js +412 -0
- package/dist/openai-compat-errors-UkLkk8Q9.js +136 -0
- package/dist/openai-http-mTQB44gu.js +836 -0
- package/dist/openai-transport-stream-CZSs3SIi.js +3427 -0
- package/dist/openresponses-http-BA1Shmj-.js +1175 -0
- package/dist/operations-DhgPih1F.js +805 -0
- package/dist/order-CaXafMPG.js +218 -0
- package/dist/outbound-attachment-BAp7DXDc.js +19 -0
- package/dist/param-readers-De-m2SoB.js +2 -0
- package/dist/payloads-Dg9aAEOC.js +256 -0
- package/dist/persistent-bindings.lifecycle-BkLOz501.js +2 -0
- package/dist/persistent-bindings.lifecycle-e2MLbBCo.js +85 -0
- package/dist/plugin-enabled-CGSENjXc.js +232 -0
- package/dist/plugin-install-BI9_bsVT.js +118 -0
- package/dist/plugin-install-an4V2iXO.js +2 -0
- package/dist/plugin-install-config-policy-C66Nss3D.js +169 -0
- package/dist/plugin-registration-DMerQktl.js +97 -0
- package/dist/plugin-registry-BZfdCw65.js +3 -0
- package/dist/plugin-registry-I1fegSdK.js +2 -0
- package/dist/plugin-runtime-B3XMLJka.js +102 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-config-primitives.d.ts +1 -1
- package/dist/plugin-sdk/agent-harness-runtime.js +16 -16
- package/dist/plugin-sdk/agent-harness-task-runtime.js +4 -4
- package/dist/plugin-sdk/agent-harness.js +17 -17
- package/dist/plugin-sdk/agent-runtime.js +17 -17
- package/dist/plugin-sdk/agent-sessions.js +1 -1
- package/dist/plugin-sdk/approval-native-runtime.js +2 -2
- package/dist/plugin-sdk/approval-reaction-runtime.js +1 -1
- package/dist/plugin-sdk/approval-runtime.js +2 -2
- package/dist/plugin-sdk/bundled-channel-config-schema-BsOWCrJT.d.ts +3169 -0
- package/dist/plugin-sdk/bundled-channel-config-schema.d.ts +3 -3
- package/dist/plugin-sdk/channel-actions.js +2 -2
- package/dist/plugin-sdk/channel-config-primitives.d.ts +2 -2
- package/dist/plugin-sdk/channel-config-schema-legacy.d.ts +3 -3
- package/dist/plugin-sdk/channel-config-schema.d.ts +2 -2
- package/dist/plugin-sdk/channel-core.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 +4 -4
- package/dist/plugin-sdk/channel-location.js +1 -1
- package/dist/plugin-sdk/channel-message-runtime.js +5 -5
- package/dist/plugin-sdk/channel-message.js +5 -5
- package/dist/plugin-sdk/channel-outbound.js +2 -2
- package/dist/plugin-sdk/channel-plugin-common.d.ts +1 -1
- package/dist/plugin-sdk/channel-reply-options-runtime.js +1 -1
- package/dist/plugin-sdk/command-auth-native.js +2 -2
- package/dist/plugin-sdk/command-auth.js +4 -4
- package/dist/plugin-sdk/command-primitives-runtime.js +2 -2
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/command-status.js +1 -1
- package/dist/plugin-sdk/compat.d.ts +2 -2
- package/dist/plugin-sdk/compat.js +2 -2
- package/dist/plugin-sdk/config-mutation.js +2 -2
- package/dist/plugin-sdk/config-runtime.js +1 -1
- package/dist/plugin-sdk/config-schema-DUddICQM.d.ts +33 -0
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.d.ts +1 -1
- package/dist/plugin-sdk/core.js +3 -3
- package/dist/plugin-sdk/delivery-queue-runtime.js +1 -1
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/discord.d.ts +2 -2
- package/dist/plugin-sdk/embedding-providers.js +2 -2
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/gateway-runtime.js +2 -2
- package/dist/plugin-sdk/health.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +3 -3
- package/dist/plugin-sdk/image-generation-runtime.js +1 -1
- package/dist/plugin-sdk/image-generation.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +3 -3
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +3 -3
- package/dist/plugin-sdk/mattermost.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +7 -7
- package/dist/plugin-sdk/media-understanding-runtime.js +1 -1
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +4 -4
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-storage.js +6 -6
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +3 -3
- package/dist/plugin-sdk/memory-core-host-runtime-files.js +4 -4
- package/dist/plugin-sdk/memory-core.js +3 -3
- package/dist/plugin-sdk/memory-host-core.js +3 -3
- package/dist/plugin-sdk/memory-host-files.js +4 -4
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/music-generation-core.js +1 -1
- package/dist/plugin-sdk/native-command-registry.js +1 -1
- package/dist/plugin-sdk/outbound-media.js +2 -2
- package/dist/plugin-sdk/outbound-runtime.js +3 -3
- package/dist/plugin-sdk/param-readers.js +2 -2
- package/dist/plugin-sdk/plugin-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth-api-key.js +4 -4
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth.js +6 -6
- package/dist/plugin-sdk/provider-catalog-runtime.js +2 -2
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-setup.js +1 -1
- package/dist/plugin-sdk/provider-stream-family.js +3 -3
- package/dist/plugin-sdk/provider-stream.js +2 -2
- package/dist/plugin-sdk/provider-transport-runtime.js +1 -1
- package/dist/plugin-sdk/provider-web-fetch.js +2 -2
- package/dist/plugin-sdk/provider-web-search.js +4 -4
- package/dist/plugin-sdk/realtime-bootstrap-context.js +2 -2
- package/dist/plugin-sdk/realtime-transcription.js +1 -1
- package/dist/plugin-sdk/realtime-voice.js +2 -2
- package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
- package/dist/plugin-sdk/reply-runtime.js +6 -6
- package/dist/plugin-sdk/runtime-secret-resolution.js +2 -2
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/self-hosted-provider-setup.js +1 -1
- package/dist/plugin-sdk/simple-completion-runtime.js +1 -1
- package/dist/plugin-sdk/speech-core.js +2 -2
- package/dist/plugin-sdk/speech.js +1 -1
- package/dist/plugin-sdk/tool-plugin.js +1 -1
- package/dist/plugin-sdk/transcripts.js +1 -1
- package/dist/plugin-sdk/tts-runtime.d.ts +1 -1
- package/dist/plugin-sdk/tts-runtime.js +1 -1
- package/dist/plugin-sdk/video-generation-core.js +2 -2
- package/dist/plugin-sdk/video-generation-runtime.js +1 -1
- package/dist/plugin-sdk/web-media.js +3 -3
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-sdk/zod-schema.core-B4_b2R5K.d.ts +166 -0
- package/dist/plugin-service-2XF6Lu_a.js +1249 -0
- package/dist/plugins/build-smoke-entry.js +2 -2
- package/dist/plugins/loader.js +1 -1
- package/dist/plugins/provider-discovery.runtime.js +1 -1
- package/dist/plugins/provider-runtime.runtime.js +1 -1
- package/dist/plugins/runtime/index.js +21 -21
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins-authoring-command-CCX6tJwd.js +304 -0
- package/dist/plugins-cli-HX8nTV2h.js +63 -0
- package/dist/plugins-cli.runtime-BYn4VsLP.js +339 -0
- package/dist/plugins-cli.runtime.js +1 -1
- package/dist/plugins-command-helpers-ByuW-yNj.js +2 -0
- package/dist/plugins-command-helpers-DaaxGnCD.js +164 -0
- package/dist/plugins-inspect-command-C9NDk23X.js +248 -0
- package/dist/plugins-install-command-B0NfUxeA.js +993 -0
- package/dist/plugins-install-command-BmuScfLI.js +2 -0
- package/dist/plugins-install-persist-CfwO876P.js +252 -0
- package/dist/plugins-list-command-Bx8X908n.js +184 -0
- package/dist/plugins-uninstall-command-p6h44-Ft.js +118 -0
- package/dist/postinstall-inventory.json +862 -862
- package/dist/prepare.runtime-8DdQ4k9k.js +798 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/presentation-card-DeAf3jYW.js +164 -0
- package/dist/preview-warnings-BF7nlTo8.js +618 -0
- package/dist/profiles-DUhMLnqX.js +194 -0
- package/dist/program-C7f_U7fr.js +131 -0
- package/dist/provider-adapters-CWLwE9KS.js +104 -0
- package/dist/provider-api-key-auth-CshQbUPZ.js +117 -0
- package/dist/provider-api-key-auth.runtime-B64jPCKn.js +14 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-D-I3YLSn.js +281 -0
- package/dist/provider-auth-api-key-Bub0Rjak.js +5 -0
- package/dist/provider-auth-choice-DpNAEScm.js +311 -0
- package/dist/provider-auth-choice-helpers-Bof937LW.js +210 -0
- package/dist/provider-auth-choice.runtime-B3spikLY.js +18 -0
- package/dist/provider-auth-choice.runtime-vVgz7FKq.js +2 -0
- package/dist/provider-auth-choice.runtime.js +1 -1
- package/dist/provider-auth-guidance-DcCL0Q2U.js +2 -0
- package/dist/provider-auth-guidance-rWRMN4Jn.js +34 -0
- package/dist/provider-auth-helpers-Cp8L-Xha.js +177 -0
- package/dist/provider-auth-login.runtime-BJUzc4iH.js +156 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-auth-runtime-DmcWtzbb.js +186 -0
- package/dist/provider-discovery-JyAJi97k.js +95 -0
- package/dist/provider-discovery.runtime-D_0WTYr8.js +290 -0
- package/dist/provider-discovery.runtime.js +1 -1
- package/dist/provider-dispatcher-C8Jt94Xl.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-entry-By0ggZuI.js +134 -0
- package/dist/provider-hook-runtime-B8AUbQxf.js +255 -0
- package/dist/provider-openai-codex-oauth-C9Mmnt7d.js +2 -0
- package/dist/provider-openai-codex-oauth-CH5Jg1vk.js +44 -0
- package/dist/provider-registration-C1zvaHQP.js +235 -0
- package/dist/provider-registry-B9diJyLv.js +31 -0
- package/dist/provider-registry-BXSxmPGA.js +61 -0
- package/dist/provider-registry-CoE-sxbq.js +61 -0
- package/dist/provider-registry-DLth_GdI.js +61 -0
- package/dist/provider-registry-J4LRd5Rg.js +36 -0
- package/dist/provider-runtime-B4cw16pt.js +3 -0
- package/dist/provider-runtime-DNNbfwOK.js +386 -0
- package/dist/provider-runtime.runtime-98mAe_ni.js +26 -0
- package/dist/provider-runtime.runtime.js +1 -1
- package/dist/provider-self-hosted-setup-Dysv2Kwt.js +373 -0
- package/dist/provider-stream-BLaC8bqO.js +1084 -0
- package/dist/provider-stream-Caa5YOx2.js +313 -0
- package/dist/provider-stream-family-CvvfxLyP.js +2 -0
- package/dist/provider-usage-CVNosTP3.js +71 -0
- package/dist/provider-usage-D2NudXbO.js +4 -0
- package/dist/provider-usage.load-DG6R3lkG.js +357 -0
- package/dist/provider-web-search-DmgTaxRU.js +58 -0
- package/dist/provider-wizard-Cw-5H3tX.js +125 -0
- package/dist/providers.runtime-DF0T9lFz.js +240 -0
- package/dist/providers.runtime-oM9Vn1wr.js +2 -0
- package/dist/providers.runtime.js +1 -1
- package/dist/proxy-BxGnVyJu.js +662 -0
- package/dist/public-artifacts-BMP9hZfh.js +7 -0
- package/dist/pw-ai-CD52qfYo.js +3064 -0
- package/dist/qmd-manager-BYbvU4YC.js +2040 -0
- package/dist/qr-cli-Btz2ZdO3.js +2 -0
- package/dist/qr-cli-eyTRwMm2.js +371 -0
- package/dist/qr-image-BCwiO6tL.js +2 -0
- package/dist/queue-CJRoTOBi.js +923 -0
- package/dist/read-file-ogB-HjbK.js +183 -0
- package/dist/register-service-commands-D_gQ3b6_.js +77 -0
- package/dist/register.agent-DXQLn-r0.js +152 -0
- package/dist/register.configure-FavQPGce.js +16 -0
- package/dist/register.crestodian-Cbfmnl6h.js +24 -0
- package/dist/register.maintenance-B8xODEMU.js +85 -0
- package/dist/register.message-B8PYgZ-j.js +404 -0
- package/dist/register.migrate-CieoN8zZ.js +106 -0
- package/dist/register.onboard-BqWDIDKH.js +115 -0
- package/dist/register.setup-CgeTBW4T.js +40 -0
- package/dist/register.status-health-sessions-C99aHa5h.js +293 -0
- package/dist/register.subclis-79SvyMFt.js +31 -0
- package/dist/register.subclis-CXrO8_TO.js +3 -0
- package/dist/register.subclis-core-GoXV1yMG.js +273 -0
- package/dist/rem-harness-laL5luQa.js +649 -0
- package/dist/repair-sequencing-DGY2mBg6.js +652 -0
- package/dist/reply-media-paths.runtime-BeWVPkgy.js +2 -0
- package/dist/reply-media-paths.runtime-rzAV_Kee.js +154 -0
- package/dist/reply-media-paths.runtime.js +1 -1
- package/dist/reply-payloads-D_JHMviC.js +79 -0
- package/dist/reply-payloads-dedupe-B9GGGaL-.js +176 -0
- package/dist/reply-payloads-dedupe.runtime--C3jHs9y.js +2 -0
- package/dist/reply-payloads-dedupe.runtime.js +1 -1
- package/dist/reply-timing-tracker-DPjlETUb.js +205 -0
- package/dist/reply-turn-admission-DdfIwcMK.js +2056 -0
- package/dist/reply.runtime-BC1HT67i.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/reset-preserved-selection-Czd80hug.js +45 -0
- package/dist/resolve-COJFlAZT.js +106 -0
- package/dist/restart-B9GMMIZt.js +121 -0
- package/dist/result-fallback-classifier-By0Z6b8r.js +98 -0
- package/dist/root-help-Bp0kGaUZ.js +43 -0
- package/dist/route-CgG9Z7OI.js +475 -0
- package/dist/route-reply-D9_9oRg1.js +174 -0
- package/dist/route-reply.runtime-BwNl3h2m.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/routes-Cz2NHUV4.js +2 -0
- package/dist/routes-DMo6Eacc.js +3701 -0
- package/dist/run-SFRSThMI.js +1162 -0
- package/dist/run-auth-profile.runtime-BxLM8m_2.js +2 -0
- package/dist/run-auth-profile.runtime.js +1 -1
- package/dist/run-command-Cd5iN7eN.js +2 -0
- package/dist/run-command-ah46O06U.js +23 -0
- package/dist/run-context-DGCQJldA.js +66 -0
- package/dist/run-context.runtime-CSBHDAd5.js +2 -0
- package/dist/run-context.runtime.js +1 -1
- package/dist/run-delivery.runtime-C9xoiZ3h.js +762 -0
- package/dist/run-delivery.runtime.js +1 -1
- package/dist/run-embedded.runtime-D8bz5vfV.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-BAa8KPn7.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime-CNnemqSa.js +330 -0
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-model-catalog.runtime-Dh7EghXr.js +2 -0
- package/dist/run-model-catalog.runtime.js +1 -1
- package/dist/run-session-state-cMlTFwT_.js +159 -0
- package/dist/run-subagent-registry.runtime-BgQU86-E.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runner-B3YXRJOB.js +704 -0
- package/dist/runner.entries-DMTKpRDP.js +1485 -0
- package/dist/runtime-BHReFHE2.js +2 -0
- package/dist/runtime-BiQZ6Usw.js +615 -0
- package/dist/runtime-CAeriu2O.js +10 -0
- package/dist/runtime-CAnCRCX3.js +224 -0
- package/dist/runtime-CV_2NqSY.js +300 -0
- package/dist/runtime-CmpnvXo3.js +245 -0
- package/dist/runtime-D2fci1Ey.js +2 -0
- package/dist/runtime-DAsYmYeA.js +3 -0
- package/dist/runtime-DeA45VKG.js +210 -0
- package/dist/runtime-DvkZ8tHI.js +436 -0
- package/dist/runtime-DxVUR2Xg.js +2 -0
- package/dist/runtime-api-B88le0UE.js +12 -0
- package/dist/runtime-channel-AubRWvnH.js +2 -0
- package/dist/runtime-channel-DdclSuEu.js +148 -0
- package/dist/runtime-config-collectors-DukTj2va.js +525 -0
- package/dist/runtime-embedded-agent.runtime-BpLweeFv.js +2 -0
- package/dist/runtime-embedded-agent.runtime.js +1 -1
- package/dist/runtime-internal-CaoUylZw.js +2 -0
- package/dist/runtime-llm.runtime-DlpqGc7S.js +307 -0
- package/dist/runtime-llm.runtime.js +1 -1
- package/dist/runtime-model-auth.runtime-CLAaWzxY.js +46 -0
- package/dist/runtime-model-auth.runtime-DxVvqRTd.js +2 -0
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-options-TTtN01-I.js +275 -0
- package/dist/runtime-plugin-ClqxJSbp.js +92 -0
- package/dist/runtime-plugins-Bq01wLXP.js +32 -0
- package/dist/runtime-plugins.runtime-cwCvl1TR.js +2 -0
- package/dist/runtime-plugins.runtime.js +1 -1
- package/dist/runtime-prepare.runtime-Cz_hV_k5.js +81 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-QCJq90av.js +24 -0
- package/dist/runtime-provider-Wllc3jC6.js +2 -0
- package/dist/runtime-registry-loader-BM1mQBJr.js +2 -0
- package/dist/runtime-registry-loader-DzhYCt4s.js +117 -0
- package/dist/runtime-shared-BfqOW-Vb.js +365 -0
- package/dist/runtime-web-channel-plugin-BcVPgD14.js +204 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/scan-ldbaD8jq.js +573 -0
- package/dist/sdk-security-runtime-Bxhq2O1G.js +86 -0
- package/dist/sdk-setup-tools-CsQM9pF0.js +8 -0
- package/dist/secrets-cli-DbpIf4-z.js +150 -0
- package/dist/security-cli-BK4Xpa6h.js +520 -0
- package/dist/selection-BXKik6Ps.js +3 -0
- package/dist/selection-D4O3gK3Q.js +18365 -0
- package/dist/send-DaoGIay5.js +1222 -0
- package/dist/send-DzNjJGJX.js +178 -0
- package/dist/send-f5w9krNS.js +711 -0
- package/dist/send-media-cOciBxcg.js +2072 -0
- package/dist/send-result-DMFwBuOl.js +141 -0
- package/dist/server-BoC1mxZ-.js +24 -0
- package/dist/server-DZnI6w5k.js +72 -0
- package/dist/server-aux-handlers-BwRdYdub.js +1347 -0
- package/dist/server-chat-Q95f4ywD.js +827 -0
- package/dist/server-close.runtime.js +3 -3
- package/dist/server-context-CnXNaarB.js +2 -0
- package/dist/server-context-DRBebo7Y.js +955 -0
- package/dist/server-cron-C0o0ZvqF.js +3173 -0
- package/dist/server-cron-CLeBvurR.js +2 -0
- package/dist/server-maintenance-CqHfTnFD.js +152 -0
- package/dist/server-methods-BmlBQJMD.js +497 -0
- package/dist/server-middleware-DJhnR6jl.js +122 -0
- package/dist/server-model-catalog-CoSSk_Gy.js +2 -0
- package/dist/server-model-catalog-D32oDTQp.js +73 -0
- package/dist/server-node-events-DX9a4etQ.js +597 -0
- package/dist/server-plugin-bootstrap-Vco-EpxY.js +71 -0
- package/dist/server-plugins-WBX2fZRp.js +435 -0
- package/dist/server-reload-handlers-DGJLH8bg.js +719 -0
- package/dist/server-restart-sentinel-Bvon7f8K.js +700 -0
- package/dist/server-runtime-services-BNcH4vhR.js +3 -0
- package/dist/server-runtime-services-BjcQG5y7.js +147 -0
- package/dist/server-runtime-subscriptions-W39HeyoT.js +67 -0
- package/dist/server-session-events-CO73dMU-.js +244 -0
- package/dist/server-session-key-D8V67lDk.js +2 -0
- package/dist/server-session-key-v-KYSmRS.js +75 -0
- package/dist/server-startup-config-u54lUdWN.js +305 -0
- package/dist/server-startup-early-Cy5kArJG.js +87 -0
- package/dist/server-startup-memory-DvINFAYn.js +72 -0
- package/dist/server-startup-plugins-CerpbOSQ.js +127 -0
- package/dist/server-startup-post-attach-COUCwhNa.js +793 -0
- package/dist/server-ws-runtime-BfznAnbI.js +374 -0
- package/dist/server.impl-dQXccj0z.js +2622 -0
- package/dist/session-cost-usage-Bs5yIOBH.js +1600 -0
- package/dist/session-kill-http-DVleb3RW.js +121 -0
- package/dist/session-log-runtime-OG7J4j9m.js +1258 -0
- package/dist/session-override-LIWl5a9T.js +134 -0
- package/dist/session-reset-model.runtime-BpnTi4sa.js +144 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-HA07zS8L.js +651 -0
- package/dist/session-status.runtime-D6_clH8l.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-store-Cj4Rh6qc.js +273 -0
- package/dist/session-store.runtime-DSCxACdZ.js +4 -0
- package/dist/session-store.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-CcwaHAxg.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-C-9uI2Wi.js +551 -0
- package/dist/session-utils-BRtPESA4.js +1508 -0
- package/dist/sessions-Beltl3Ra.js +1917 -0
- package/dist/sessions-DR-X-j8D.js +316 -0
- package/dist/sessions-cleanup-CR1CFcJb.js +165 -0
- package/dist/sessions-history-http-CjyHWYEv.js +432 -0
- package/dist/sessions-patch-peSeltuF.js +401 -0
- package/dist/sessions-resolve-D9ULr95s.js +180 -0
- package/dist/sessions-table-Da6bua9d.js +161 -0
- package/dist/sessions-uKpnhod0.js +12736 -0
- package/dist/sessions.runtime-C1mVNaU3.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/set-DVj21EuB.js +31 -0
- package/dist/set-image-JChDCaAP.js +17 -0
- package/dist/setup-5I-zpID3.js +614 -0
- package/dist/setup-CjtY6cli.js +2 -0
- package/dist/setup-onboard-configure-help-fast-path-C5GcSuXb.js +64 -0
- package/dist/setup.finalize-Bf10PNbl.js +586 -0
- package/dist/setup.gateway-config-EH5Rvwzy.js +281 -0
- package/dist/setup.migration-import-CoeV4Kc1.js +200 -0
- package/dist/setup.migration-import-DFFGw4DI.js +2 -0
- package/dist/setup.post-install-migration-DcQmWTE7.js +128 -0
- package/dist/shared-BFSJZ6B3.js +212 -0
- package/dist/shared-CVM-dYkO.js +5 -0
- package/dist/shared-fvgcmCsj.js +71 -0
- package/dist/simple-completion-runtime-C_TXe4M1.js +2 -0
- package/dist/simple-completion-runtime-DREq-fcF.js +206 -0
- package/dist/simple-completion-transport-DtD1fEvJ.js +83 -0
- package/dist/snapshot-urls-B-wkwDI9.js +317 -0
- package/dist/speech-core-KQg6oKcR.js +119 -0
- package/dist/speech-provider-DfyLYitQ.js +171 -0
- package/dist/speech-provider-oDvTumNW.js +227 -0
- package/dist/speech-provider-yL-TQ3Em.js +233 -0
- package/dist/stale-oauth-profile-shadows-CW11VYMM.js +2 -0
- package/dist/stale-oauth-profile-shadows-DFl6Lyf1.js +186 -0
- package/dist/standalone-runtime-registry-loader-BiponY-y.js +59 -0
- package/dist/startup-context-PVXYM-X3.js +314 -0
- package/dist/status-BA_0z83w.js +249 -0
- package/dist/status-Bc7BGlRt.js +2 -0
- package/dist/status-BwPWg9eQ.js +3 -0
- package/dist/status-CLQ66eml.js +4 -0
- package/dist/status-Ci2gChtY.js +466 -0
- package/dist/status-CmtBWJEE.js +2 -0
- package/dist/status-DdnMnPNs.js +73 -0
- package/dist/status-all-BpTvkYrt.js +573 -0
- package/dist/status-json-CizozZCr.js +15 -0
- package/dist/status-json-command-FzKa2t6O.js +84 -0
- package/dist/status-message-BHbnxwmt.js +495 -0
- package/dist/status-message.runtime-Df5WBBAk.js +6 -0
- package/dist/status-message.runtime.js +1 -1
- package/dist/status-queue.runtime-CXnZV4Bj.js +2 -0
- package/dist/status-queue.runtime.js +1 -1
- package/dist/status-runtime-shared-D3Hz8WZ_.js +289 -0
- package/dist/status-subagents.runtime-PoDdwwaw.js +32 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-DNxXSCuI.js +301 -0
- package/dist/status.command-C_e9GcMg.js +2 -0
- package/dist/status.command-DjVKDmt_.js +425 -0
- package/dist/status.command.text-runtime-BeHlqL8b.js +15 -0
- package/dist/status.runtime-h--fx9HY.js +2 -0
- package/dist/status.scan-WyR8TeJz.js +72 -0
- package/dist/status.scan-overview-CMzUAQMQ.js +460 -0
- package/dist/status.scan.deps.runtime-1JTrdyHk.js +19 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json-D2jw1wKO.js +163 -0
- package/dist/status.scan.fast-json-DbN1KxJT.js +2 -0
- package/dist/status.summary-6ZijZM1g.js +2 -0
- package/dist/status.summary-CiCsChO-.js +276 -0
- package/dist/store-CdBPITcg.js +2302 -0
- package/dist/store-D0l2NCdn.js +3 -0
- package/dist/stored-model-override-HEgnFh6b.js +79 -0
- package/dist/subagent-announce-BUv_kA1W.js +353 -0
- package/dist/subagent-announce-delivery-Ci2Y_p--.js +1369 -0
- package/dist/subagent-control-BM3vNgsQ.js +492 -0
- package/dist/subagent-control.runtime-Df3pVQL9.js +3 -0
- package/dist/subagent-control.runtime.js +1 -1
- package/dist/subagent-hooks-CN2fLez2.js +2 -0
- package/dist/subagent-hooks-CeOmTJBf.js +230 -0
- package/dist/subagent-hooks-api-Cfe4DAT9.js +23 -0
- package/dist/subagent-registry-B9RPAXUs.js +2627 -0
- package/dist/subagent-registry-C7tedtVB.js +3 -0
- package/dist/subagent-registry.runtime.js +2 -2
- package/dist/subagent-session-cleanup-y0ijZ-LQ.js +390 -0
- package/dist/system-DVtrOGbV.js +111 -0
- package/dist/system-prompt-config-BVmrcmmr.js +918 -0
- package/dist/talk-CrdgqTCl.js +2454 -0
- package/dist/target-id-CrUyi-Uq.js +107 -0
- package/dist/targets-KZ2ezPwx.js +267 -0
- package/dist/targets.runtime-iZ8KdQ1C.js +2 -0
- package/dist/targets.runtime.js +1 -1
- package/dist/task-executor-893pMqzn.js +349 -0
- package/dist/task-owner-access-DC7MKz3n.js +74 -0
- package/dist/task-registry-control.runtime.js +2 -2
- package/dist/task-registry-delivery-runtime-YGMOyqP5.js +2 -0
- package/dist/task-registry-uaYJfgXF.js +2362 -0
- package/dist/task-registry.maintenance-Dx0m2NYh.js +2 -0
- package/dist/task-registry.maintenance-gApg-XOt.js +764 -0
- package/dist/task-status-access-CFhD_ieY.js +18 -0
- package/dist/tasks-B_Qoz38D.js +153 -0
- package/dist/tasks-DtV85zJT.js +548 -0
- package/dist/tasks-audit-system-Con3yYnm.js +210 -0
- package/dist/tasks-json-BM3pauZl.js +73 -0
- package/dist/tavily-web-search-provider.runtime-Cmyyc5kX.js +112 -0
- package/dist/tavily-web-search-provider.runtime.js +1 -1
- package/dist/text-report-CKxmVmt5.js +695 -0
- package/dist/text-transforms.runtime-DVwVsBRS.js +113 -0
- package/dist/text-transforms.runtime.js +1 -1
- package/dist/thread-bindings-B6UEVp9q.js +228 -0
- package/dist/tool-KOZc7TIF.js +143 -0
- package/dist/tool-dispatch-Ca4z2GEr.js +155 -0
- package/dist/tool-images-CzDwHeDR.js +247 -0
- package/dist/tool-plugin-BvQBJ2gU.js +93 -0
- package/dist/tool-resolution-Ddxl6tjh.js +153 -0
- package/dist/tool-result-truncation-BSKuIhd5.js +498 -0
- package/dist/tool-schema-nB27q-vb.js +40 -0
- package/dist/tool-schema-projection-COrMarLR.js +215 -0
- package/dist/tool-split-BjPHBFrv.js +323 -0
- package/dist/tools-CV40BWkc.js +901 -0
- package/dist/tools-catalog-5stC7W2V.js +156 -0
- package/dist/tools-effective-BVjqz2FV.js +442 -0
- package/dist/tools-effective-inventory-esPY5jRB.js +379 -0
- package/dist/tools-invoke-Czk_NM9G.js +51 -0
- package/dist/tools-invoke-http-D7PbsODz.js +68 -0
- package/dist/tools-invoke-shared-CzrEn0Dm.js +200 -0
- package/dist/tools-rSjgf61B.js +579 -0
- package/dist/tools.runtime-DiChCSGI.js +5 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/transcript-rewrite-4IQefjvK.js +688 -0
- package/dist/transcripts-tool-BXTS8tE5.js +2 -0
- package/dist/transcripts-tool-CeWGgz5k.js +656 -0
- package/dist/tts-BS8EeM8p.js +2 -0
- package/dist/tts-BlTZjsaE.js +194 -0
- package/dist/tts-runtime-BfRdJDyY.js +1337 -0
- package/dist/tts-vRSvSw-t.js +3 -0
- package/dist/tts.runtime-ChBnVkNt.js +3 -0
- package/dist/tts.runtime-CmVCUbzq.js +2 -0
- package/dist/tts.runtime.js +1 -1
- package/dist/tui-BoQVBgWB.js +4860 -0
- package/dist/tui-DBYK9BeQ.js +2 -0
- package/dist/tui-backend-X0NI7rAv.js +256 -0
- package/dist/tui-cli-BpUtjV38.js +40 -0
- package/dist/typing-policy-CBwyAQh4.js +199 -0
- package/dist/usage-Bl-tgGx-.js +623 -0
- package/dist/usage-Cj_ektBl.js +1113 -0
- package/dist/usage-format-DWO9ckX3.js +394 -0
- package/dist/usage-format-DnCIXsqG.js +2 -0
- package/dist/video-generation-provider-B7ib4AeI.js +297 -0
- package/dist/video-generation-provider-CXQ6fqJx.js +64 -0
- package/dist/video-generation-provider-DXjl05T6.js +325 -0
- package/dist/video-generation-provider-Db8h71jA.js +77 -0
- package/dist/web-fetch/runtime.js +1 -1
- package/dist/web-fetch-providers.runtime-DhPkYjgB.js +41 -0
- package/dist/web-fetch-providers.runtime.js +1 -1
- package/dist/web-guarded-fetch-BdsVyvDS.js +58 -0
- package/dist/web-guarded-fetch-CJR3JCwT.js +2 -0
- package/dist/web-media-BzzQJAwk.js +4 -0
- package/dist/web-media-DViZjNBa.js +2 -0
- package/dist/web-media-inHawfBU.js +651 -0
- package/dist/web-provider-runtime-shared-Cc08Lt9p.js +142 -0
- package/dist/web-search-provider-common-CtbtmUL-.js +252 -0
- package/dist/web-search-providers.runtime-B7x_cRVn.js +41 -0
- package/dist/web-search-providers.runtime.js +1 -1
- package/package.json +1 -1
- package/dist/abort-CR0u3VsG.js +0 -277
- package/dist/abort.runtime-CXUxanGg.js +0 -2
- package/dist/accounts-BxBaquAf.js +0 -423
- package/dist/accounts-vQjpoqEe.js +0 -2
- package/dist/acp-spawn-2elSoS0E.js +0 -1286
- package/dist/acp-spawn-DtKOHNO1.js +0 -2
- package/dist/acp-stateful-target-driver-BqeA5j0h.js +0 -89
- package/dist/action-info-B8NotHFw.js +0 -75
- package/dist/active-runtime-registry-BO9mpPuB.js +0 -62
- package/dist/active-tool-schema-warnings-C8vGj5FX.js +0 -105
- package/dist/active-tool-schema-warnings-CVeFJuWI.js +0 -2
- package/dist/agent-BgEaDMdp.js +0 -1825
- package/dist/agent-_V5GbziF.js +0 -2
- package/dist/agent-bundle-lsp-runtime-0jBcDEHh.js +0 -389
- package/dist/agent-bundle-lsp-runtime-CQ6dZLs_.js +0 -2
- package/dist/agent-bundle-mcp-materialize-Cu6JqMzC.js +0 -124
- package/dist/agent-bundle-mcp-tools-BGL827cn.js +0 -3
- package/dist/agent-command-CMJdGr16.js +0 -1435
- package/dist/agent-delivery-DMu1MOeq.js +0 -117
- package/dist/agent-harness-runtime-BKSW2E1O.js +0 -207
- package/dist/agent-model-discovery-Cu4YL31r.js +0 -3
- package/dist/agent-model-discovery-DdmVtkZo.js +0 -238
- package/dist/agent-runner-utils-DXNDhwkI.js +0 -267
- package/dist/agent-runner.runtime-Cym4Odfd.js +0 -3784
- package/dist/agent-runtime-BkbhevY3.js +0 -199
- package/dist/agent-runtime-label-DNP06p76.js +0 -30
- package/dist/agent-runtime-metadata-JaTKc7mA.js +0 -53
- package/dist/agent-tool-result-middleware-loader-FbZE0Qpk.js +0 -55
- package/dist/agent-tools-Nwh8BlKX.js +0 -2506
- package/dist/agent-tools.before-tool-call-BwY-FYFl.js +0 -1274
- package/dist/agent-tools.before-tool-call-DwUmYhE3.js +0 -2
- package/dist/agent-u5NDWrw9.js +0 -3
- package/dist/agent-via-gateway-DMtOMwZa.js +0 -486
- package/dist/agent-wait-dedupe-CLuKbI_7.js +0 -180
- package/dist/agents-CiW7UEuB.js +0 -632
- package/dist/agents.command-shared-CXGSQscb.js +0 -16
- package/dist/agents.commands.add-BYBrZDXD.js +0 -304
- package/dist/agents.commands.bind-nfg3AlVc.js +0 -265
- package/dist/agents.commands.delete-pRj6vIrn.js +0 -128
- package/dist/agents.commands.identity-Ci2PnDDl.js +0 -143
- package/dist/agents.commands.list-Crj3BmqB.js +0 -235
- package/dist/aliases-BFspFx3-.js +0 -97
- package/dist/api-BiXhdPle.js +0 -3
- package/dist/api-Cptkjys5.js +0 -6
- package/dist/api-D3vT4ZVi.js +0 -2
- package/dist/api-key-rotation-CQgW8LEx.js +0 -167
- package/dist/app-registration-YW276fZC.js +0 -194
- package/dist/apply-BRxKrOiK.js +0 -510
- package/dist/apply-D0fWCa-U.js +0 -2
- package/dist/apply-DIR8y0ZA.js +0 -2
- package/dist/apply-DNUIV0Lt.js +0 -416
- package/dist/apply-Dux9jI7f.js +0 -544
- package/dist/approval-native-helpers-BMT-5X47.js +0 -398
- package/dist/artifacts-CTrtIv9T.js +0 -368
- package/dist/assistant-ClfI8Kho.js +0 -291
- package/dist/attachment-normalize-DAW86mZY.js +0 -213
- package/dist/attempt-execution-DTi2UfET.js +0 -584
- package/dist/attempt-execution.helpers-DrX0QToi.js +0 -969
- package/dist/attempt-execution.runtime-BCmAxwGy.js +0 -3
- package/dist/attempt.prompt-helpers-BE6kGRtT.js +0 -543
- package/dist/attempt.tool-run-context-J9O2yjbV.js +0 -1240
- package/dist/audio-preflight.runtime-D3GXVYBI.js +0 -7
- package/dist/audit-5T20D-xm.js +0 -1108
- package/dist/audit-CWuV5GlP.js +0 -477
- package/dist/audit.nondeep.runtime-DeYwRDYj.js +0 -1416
- package/dist/audit.runtime-rUlvK4Rb.js +0 -7
- package/dist/auth-DunUSatn.js +0 -567
- package/dist/auth-choice--eBzca8Y.js +0 -3
- package/dist/auth-choice-DJ9jsFUq.js +0 -400
- package/dist/auth-choice-_pLkIdVh.js +0 -110
- package/dist/auth-choice.apply.api-providers-CALcopRP.js +0 -2
- package/dist/auth-choice.apply.api-providers-Dzzm1snk.js +0 -34
- package/dist/auth-choice.plugin-providers.runtime-BHKTeZZc.js +0 -11
- package/dist/auth-health-Cs4OjiF2.js +0 -219
- package/dist/auth-list-bwJ4QDs0.js +0 -115
- package/dist/auth-order-BoHN3Dc_.js +0 -105
- package/dist/auth-profiles-BOLncVgy.js +0 -73
- package/dist/auth-profiles-BiQRkULt.js +0 -14
- package/dist/backend-config-B5yga5ay.js +0 -259
- package/dist/bash-tools-BWvldguc.js +0 -3
- package/dist/bash-tools-DEAAO5np.js +0 -3497
- package/dist/binding-routing-BbtHmU_l.js +0 -113
- package/dist/binding-targets-DSNv3-QA.js +0 -121
- package/dist/bootstrap-files-DD8V2dLe.js +0 -202
- package/dist/bootstrap-files-_6u1uJW2.js +0 -3
- package/dist/bridge-server-v1-XPnAZ.js +0 -113
- package/dist/browser-cli-CnpuO4KR.js +0 -230
- package/dist/browser-cli-DPbIn8SK.js +0 -2
- package/dist/browser-cli-actions-input-DoGR6LI-.js +0 -522
- package/dist/browser-cli-actions-observe-CYMpgmtF.js +0 -81
- package/dist/browser-cli-debug-ChJjSq-h.js +0 -137
- package/dist/browser-cli-inspect-Bbci-WPG.js +0 -117
- package/dist/browser-cli-manage-Bnscjb7b.js +0 -446
- package/dist/browser-cli-resize-D1MJdvZI.js +0 -32
- package/dist/browser-cli-shared-BCQwqz51.js +0 -69
- package/dist/browser-cli-state-BWkPsvUg.js +0 -371
- package/dist/browser-control-auth-CEP_ExeC.js +0 -2
- package/dist/browser-profiles-SvnqnHVN.js +0 -2
- package/dist/browser-runtime-0mRxjFpp.js +0 -389
- package/dist/browser-tool.schema--CLR3nDv.js +0 -132
- package/dist/btw-command-DV6HfrRV.js +0 -18
- package/dist/build-DiRmljCi.js +0 -261
- package/dist/bundled-channel-config-schema-DpdKMATU.d.ts +0 -3168
- package/dist/capability-cli-ATfwTYFe.js +0 -1809
- package/dist/capability-provider-runtime-l3nnLGvn.js +0 -346
- package/dist/cdp.helpers-IIuc0KGS.js +0 -637
- package/dist/channel-CzTD2ouI.js +0 -2309
- package/dist/channel-actions-B5Yk5Axf.js +0 -46
- package/dist/channel-bootstrap.runtime-C9F-Pq1o.js +0 -38
- package/dist/channel-bootstrap.runtime-TPyY5Ngv.js +0 -2
- package/dist/channel-core-XMZJ-ZGF.js +0 -5
- package/dist/channel-inbound-DvqkKmiH.js +0 -121
- package/dist/channel-message-CnJ4vUyt.js +0 -12
- package/dist/channel-outbound-BhefGAqY.js +0 -436
- package/dist/channel-plugin-resolution-BiaJ8aRa.js +0 -2
- package/dist/channel-plugin-resolution-D_CxkMVc.js +0 -135
- package/dist/channel-resolution-DzI28gIM.js +0 -46
- package/dist/channel-selection-CLFO4-eQ.js +0 -171
- package/dist/channel-selection.runtime-Beb2-bMH.js +0 -2
- package/dist/channel.runtime-By5T5eGw.js +0 -697
- package/dist/channels-BrRY9Mag.js +0 -1004
- package/dist/channels-cli-CF--e2RU.js +0 -331
- package/dist/chat-BTMPilpx.js +0 -2940
- package/dist/chat-DnC7XCWK.js +0 -3
- package/dist/chrome-C3_dN9jE.js +0 -1517
- package/dist/chrome-mcp-5jjDHIgn.js +0 -864
- package/dist/chrome-mcp-DFAa-WzK.js +0 -2
- package/dist/claude-live-session-BUPeOzLE.js +0 -1338
- package/dist/claude-live-session-Bprgmr1-.js +0 -2
- package/dist/clawbot-cli-5UVkLT1Y.js +0 -9
- package/dist/cli-6a6sMEUB.js +0 -2
- package/dist/cli-COCN9B5e.js +0 -2
- package/dist/cli-CpI4dBXy.js +0 -141
- package/dist/cli-YLx-ekdH.js +0 -293
- package/dist/cli-backends.runtime-CsBjr7ag.js +0 -7
- package/dist/cli-compaction-Bh0oMwUa.js +0 -363
- package/dist/cli-registry-loader-DDbaAJgY.js +0 -2
- package/dist/cli-registry-loader-xc2Ah8S4.js +0 -193
- package/dist/cli-runner-BfSrIn-9.js +0 -597
- package/dist/cli-runner-D_FAjNbR.js +0 -2
- package/dist/cli-runner.runtime-BJetQDu1.js +0 -3
- package/dist/cli-runner.runtime-BKJQkc7C.js +0 -4
- package/dist/cli-session-Cy3IeH0g.js +0 -119
- package/dist/cli.runtime-BpOz0s3N.js +0 -1276
- package/dist/codex-native-web-search-BDtKRV3F.js +0 -4
- package/dist/codex-native-web-search-C0TrfoMX.js +0 -20
- package/dist/codex-native-web-search-core-CzlK1GfN.js +0 -106
- package/dist/command-auth-CFnvdYX2.js +0 -135
- package/dist/command-config-resolution-B_86rG8v.js +0 -2
- package/dist/command-config-resolution-BbadcA2M.js +0 -25
- package/dist/command-config-resolution.runtime-B_86rG8v.js +0 -2
- package/dist/command-execution-startup-Rrwwdg_5.js +0 -90
- package/dist/command-primitives-runtime-C9bTt5IV.js +0 -3
- package/dist/command-registry-CbpdQKmu.js +0 -9
- package/dist/command-registry-Dw-XC_Zk.js +0 -4
- package/dist/command-registry-core-rvEDki6p.js +0 -114
- package/dist/command-secret-gateway-BX6BIiFn.js +0 -589
- package/dist/command-secret-targets-DCzlTkb5.js +0 -2
- package/dist/command-status-builders-DIsZN9aY.js +0 -147
- package/dist/command-status.runtime-C2x4yMRd.js +0 -90
- package/dist/commands-FYCxWqIx.js +0 -161
- package/dist/commands-compact.runtime-BTMQfx1k.js +0 -10
- package/dist/commands-core.runtime-CuNLz2wm.js +0 -2
- package/dist/commands-handlers.runtime-DyNuPOmY.js +0 -6327
- package/dist/commands-models-s7BRmLQh.js +0 -448
- package/dist/commands-registry-BxEq-3UJ.js +0 -195
- package/dist/commands-registry.runtime-CbXW33S_.js +0 -4
- package/dist/commands-status-BRJMba4h.js +0 -16
- package/dist/commands-status-DCXEwlSF.js +0 -3
- package/dist/commands-status.runtime-DCXEwlSF.js +0 -3
- package/dist/commands-subagents-control.runtime-CduLQJFD.js +0 -2
- package/dist/commands-system-prompt-B3LD8CDs.js +0 -161
- package/dist/commands-system-prompt-DPsXTqOQ.js +0 -2
- package/dist/commands.runtime-3sVz8Qgo.js +0 -175
- package/dist/common-CZvBLb3w.js +0 -286
- package/dist/compact-DxU_9XEc.js +0 -1165
- package/dist/compact.runtime-CqQTypVl.js +0 -12
- package/dist/compaction-planning-DArTi9SN.js +0 -202
- package/dist/completion-cli-CiKl5HhI.js +0 -393
- package/dist/config--yllOaSC.js +0 -374
- package/dist/config-Yt5UcD91.js +0 -610
- package/dist/config-cli-BeXS3R6k.js +0 -1703
- package/dist/config-mutation-cQeWhUqy.js +0 -5
- package/dist/config-mutations-Cg04LH_S.js +0 -161
- package/dist/config-utils-Dhq_UKMC.js +0 -141
- package/dist/config-validation-BANohTKD.js +0 -33
- package/dist/configure-CWxhlx9G.js +0 -771
- package/dist/configure-Jejkc6dn.js +0 -3
- package/dist/configure.commands-BYy1bz8G.js +0 -2
- package/dist/configure.commands-C3hDvZse.js +0 -1253
- package/dist/context-DptQ59DZ.js +0 -248
- package/dist/context-_ZshNBhD.js +0 -2
- package/dist/context-engine-host-compat-C_eflvRw.js +0 -2
- package/dist/context-engine-host-compat-s15Pu845.js +0 -280
- package/dist/context-engine-lifecycle-COHFLnj4.js +0 -627
- package/dist/control-auth-CQJpLoIb.js +0 -114
- package/dist/control-service-BFSgA0Py.js +0 -40
- package/dist/control-service-D7GZv-GS.js +0 -3
- package/dist/control-ui/assets/activity-B7yRLbf3.js +0 -124
- package/dist/control-ui/assets/agents-E-3DAkaW.js +0 -1030
- package/dist/control-ui/assets/channels-D0c7A9OX.js +0 -120
- package/dist/control-ui/assets/cron-B54j2Vmo.js +0 -1016
- package/dist/control-ui/assets/debug-CRcGYNA9.js +0 -97
- package/dist/control-ui/assets/index-bZJJ7U8q.js +0 -7214
- package/dist/control-ui/assets/instances-RcBeqNzx.js +0 -57
- package/dist/control-ui/assets/nodes-BoWRh42t.js +0 -444
- package/dist/control-ui/assets/sessions-BmRQ932H.js +0 -425
- package/dist/control-ui/assets/skills-BDn45kHZ.js +0 -362
- package/dist/control-ui/assets/workboard-BwbcNuC5.js +0 -402
- package/dist/control-ui-ChfTPXZo.js +0 -750
- package/dist/conversation-label-generator-CTfnInQF.js +0 -72
- package/dist/conversation-runtime-B7oAN9Tq.js +0 -31
- package/dist/core-api-CBD0dvTQ.js +0 -5
- package/dist/core-api-ClCm_yM8.js +0 -2
- package/dist/core-wuoxL08a.js +0 -284
- package/dist/crestodian--iYeGB8u.js +0 -55
- package/dist/cron-D2SzQyqo.js +0 -453
- package/dist/daemon-install-B6CAkU3V.js +0 -66
- package/dist/daemon-install-auth-profiles-store.runtime-Cpt5LSD6.js +0 -2
- package/dist/dashboard-ChYOQjM2.js +0 -263
- package/dist/defaults-CCopehWw.js +0 -130
- package/dist/defaults-H4kBp17N.js +0 -3
- package/dist/defaults.constants-CjB9HP6f.js +0 -76
- package/dist/deliver-BzPhWO_F.js +0 -3
- package/dist/deliver-DGyKH3Qi.js +0 -1399
- package/dist/deliver-runtime-Ca2kcQoZ.js +0 -2
- package/dist/delivery-outbound.runtime-D7ycPxY-.js +0 -7
- package/dist/delivery-queue-CnLv30ko.js +0 -863
- package/dist/delivery-queue-CuaDjNMh.js +0 -2
- package/dist/delivery-queue-runtime-DO2vqOIJ.js +0 -16
- package/dist/delivery-target.runtime-QcBVk_j8.js +0 -45
- package/dist/delivery.runtime-L09v4tys.js +0 -470
- package/dist/detached-task-runtime-BqU7YXYT.js +0 -86
- package/dist/diagnostics-T-Hk_Qzi.js +0 -168
- package/dist/dialogue-C0VnTMMn.js +0 -37
- package/dist/direct-dm-BWn67tDD.js +0 -81
- package/dist/directive-handling.defaults-DO6Snm4_.js +0 -22
- package/dist/directive-handling.fast-lane-BemYRfPn.js +0 -70
- package/dist/directive-handling.impl-BMVh1pMh.js +0 -823
- package/dist/directive-handling.impl-vr4MsYbt.js +0 -2
- package/dist/directive-handling.model-selection-DegP9exp.js +0 -122
- package/dist/directive-handling.persist.runtime-BUdU6_zm.js +0 -274
- package/dist/directives-1xk_ZcMf.js +0 -319
- package/dist/directory-cli-D83WEjEG.js +0 -239
- package/dist/dispatch-Ck2tvRYH.js +0 -2057
- package/dist/dispatch-acp-GdaHNdvf.js +0 -1102
- package/dist/dispatch-acp-manager.runtime-BGSrJqrW.js +0 -3
- package/dist/dispatch-acp-media.runtime-DQ8dYQh8.js +0 -4
- package/dist/dispatch-acp-transcript.runtime-CsJZGhnu.js +0 -40
- package/dist/dispatch-acp-tts.runtime-Bo-QxKgx.js +0 -3
- package/dist/dispatch-acp.runtime-C_u7sGcQ.js +0 -18
- package/dist/dispatcher-GtuYO6Ni.js +0 -106
- package/dist/doctor-B2qP9g8d.js +0 -760
- package/dist/doctor-D9wCez5t.js +0 -6
- package/dist/doctor-auth-XnseqtS7.js +0 -216
- package/dist/doctor-auth-flat-profiles-B6cL-TiJ.js +0 -516
- package/dist/doctor-auth-flat-profiles-Birb7qIk.js +0 -2
- package/dist/doctor-auth-legacy-oauth-CXO3OtyG.js +0 -48
- package/dist/doctor-auth-oauth-sidecar-BSgQPbcS.js +0 -177
- package/dist/doctor-auth-oauth-sidecar-CzzyNwxc.js +0 -2
- package/dist/doctor-bootstrap-size-BlVcO5D6.js +0 -57
- package/dist/doctor-claude-cli-_MTVnCQ-.js +0 -150
- package/dist/doctor-config-flow-0kxzjUjK.js +0 -1819
- package/dist/doctor-core-checks-C_g9REOd.js +0 -666
- package/dist/doctor-core-checks-CahzmM1L.js +0 -2
- package/dist/doctor-core-checks.runtime-Bi_oTiTZ.js +0 -278
- package/dist/doctor-gateway-daemon-flow-UAIWsI9w.js +0 -349
- package/dist/doctor-gateway-services-BiMEGiw_.js +0 -465
- package/dist/doctor-health-C69GVfMl.js +0 -65
- package/dist/doctor-health-contributions-Bz19QhI4.js +0 -874
- package/dist/doctor-lint-BVW4E6Qf.js +0 -95
- package/dist/doctor-memory-search-D2PWzDCY.js +0 -407
- package/dist/doctor-state-integrity-DuJIszQj.js +0 -1257
- package/dist/doctor-tool-result-cap-advice-Dpn4zNH3.js +0 -27
- package/dist/doctor-workspace-status-nW9TcIWi.js +0 -76
- package/dist/dreaming-CcOWzGN5.js +0 -523
- package/dist/dreaming-command-sxm3FQGb.js +0 -101
- package/dist/dreaming-narrative-BSRwiUPL.js +0 -2
- package/dist/dreaming-narrative-BskwmYdC.js +0 -721
- package/dist/dreaming-phases-BuHjGyPw.js +0 -2
- package/dist/dreaming-phases-ChVT8Ovk.js +0 -1162
- package/dist/drive-C_u5W4ln.js +0 -899
- package/dist/echo-transcript-tnZWH4EO.js +0 -52
- package/dist/effective-tool-policy-CeHdL2D7.js +0 -89
- package/dist/embedded-agent-CGULn3lb.js +0 -4
- package/dist/embedded-agent-DZTa1YiK.js +0 -4074
- package/dist/embedded-agent-helpers-B65K9o55.js +0 -6
- package/dist/embedded-agent-helpers-BPXCvWBb.js +0 -1037
- package/dist/embedded-agent.runtime-TfBgXcUV.js +0 -4
- package/dist/embedded-backend-BAaFwayA.js +0 -744
- package/dist/embedded-gateway-stub.runtime-CNyrjvgT.js +0 -12
- package/dist/embedding-provider-runtime-EnkHdROJ.js +0 -86
- package/dist/embedding-providers-CDkDb0kv.js +0 -2
- package/dist/embeddings-http-ClIu4_mP.js +0 -222
- package/dist/engine-qmd-DZRiT9i4.js +0 -708
- package/dist/engine-storage-BEqlN8TR.js +0 -203
- package/dist/errors-Co8auIlv.js +0 -2
- package/dist/exec-approval-forwarder.runtime-C7QvfWQ6.js +0 -4
- package/dist/exec-approval-session-target-ChuH1nXL.js +0 -177
- package/dist/exec-auto-reviewer-Bm7380HF.js +0 -2
- package/dist/exec-auto-reviewer-BrrdGleK.js +0 -241
- package/dist/execute.runtime-B-8jUqDB.js +0 -579
- package/dist/external-cli-auth-selection-0BxmRUps.js +0 -113
- package/dist/extra-params-BgyvpEpv.js +0 -615
- package/dist/fallback-notice-state-BXk_kRWM.js +0 -15
- package/dist/fallbacks-CPdVRP81.js +0 -31
- package/dist/fallbacks-shared-CSGf1oaf.js +0 -116
- package/dist/fengming-runtime-NUA51sEw.js +0 -33
- package/dist/fengming-runtime-config-CIZ-SHPt.js +0 -2
- package/dist/fengming-runtime-memory-CIZ-SHPt.js +0 -2
- package/dist/fengming-runtime-session-CIZ-SHPt.js +0 -2
- package/dist/fengming-tools-MvRSt0JA.js +0 -12221
- package/dist/flows-BocRit8D.js +0 -189
- package/dist/fs-utils-DSXeBcjj.js +0 -9
- package/dist/gateway-BCrUxrVw.js +0 -133
- package/dist/gateway-cli-B8bXBd_L.js +0 -443
- package/dist/gateway-install-token-pngTMc-f.js +0 -136
- package/dist/gateway-method-runtime-ueZTz7WH.js +0 -21
- package/dist/gateway-runtime-DbsoThML.js +0 -23
- package/dist/get-reply-DUuaxcBz.js +0 -5198
- package/dist/get-reply-from-config.runtime-B4Dgs3Hg.js +0 -2
- package/dist/github-copilot-token-7AfRRF7J.js +0 -2
- package/dist/health-7Yq5zpoZ.js +0 -3
- package/dist/health-DlZqxm2f.js +0 -621
- package/dist/health-DxesUuur.js +0 -111
- package/dist/health-state-BMG8kOby.js +0 -106
- package/dist/heartbeat-runner-Bq7A_Cjm.js +0 -5
- package/dist/heartbeat-runner-DVwbVyft.js +0 -1930
- package/dist/heartbeat-runner.runtime-DQ2NPXMD.js +0 -3
- package/dist/helpers-PCu2RivJ.js +0 -406
- package/dist/hook-helpers-DLEnCRO7.js +0 -44
- package/dist/hooks-Bv-otcl7.js +0 -536
- package/dist/hooks-cli-C5ve0nzF.js +0 -465
- package/dist/http-endpoint-helpers-w2SagsQz.js +0 -37
- package/dist/http-utils-CVvn0ZA-.js +0 -98
- package/dist/image-BeixBis4.js +0 -385
- package/dist/image-fallbacks-CPbmIMn9.js +0 -31
- package/dist/image-generation-core.auth.runtime-Co38iRxQ.js +0 -2
- package/dist/image-generation-provider-BA4Ar91S.js +0 -152
- package/dist/image-runtime-7ZsfioS1.js +0 -9
- package/dist/image-tool.helpers-upjA3ksB.js +0 -150
- package/dist/images-ChLi1Uog.js +0 -2
- package/dist/images-nB0XAnTa.js +0 -416
- package/dist/inbound-reply-dispatch-DglobJ8j.js +0 -2
- package/dist/inbound-reply-dispatch-QKOgNx-m.js +0 -147
- package/dist/infra-runtime-CGD3RE_2.js +0 -32
- package/dist/init-poVZDCAM.js +0 -59
- package/dist/install-Dn9oPGmU.js +0 -262
- package/dist/install.runtime-D5sllsjl.js +0 -2
- package/dist/internal-CnOL_Roa.js +0 -399
- package/dist/isolated-agent-CNw6E3F0.js +0 -1097
- package/dist/isolated-agent-DjkHhEyR.js +0 -2
- package/dist/kernel-B5Y5IQ-A.js +0 -3
- package/dist/kernel-CMuO4VJy.js +0 -979
- package/dist/kimi-web-search-provider.runtime-V4m_MHsk.js +0 -307
- package/dist/library-B-1EZjtY.js +0 -45
- package/dist/lifecycle-B-5gEZ7O.js +0 -570
- package/dist/lifecycle-Bzh5Jo09.js +0 -2
- package/dist/lifecycle-DvbcJYMl.js +0 -355
- package/dist/lifecycle.runtime-Bzh5Jo09.js +0 -2
- package/dist/list-B4xSHRdU.js +0 -2
- package/dist/list-BnhZHpxx.js +0 -207
- package/dist/list.list-command-DAz-Ws_6.js +0 -429
- package/dist/list.model-row-DtdX9KDu.js +0 -39
- package/dist/list.probe-CY6lxq51.js +0 -2
- package/dist/list.probe-DPuE1GOH.js +0 -451
- package/dist/list.provider-catalog-BHc9WXI6.js +0 -211
- package/dist/list.provider-catalog-CFbrroys.js +0 -2
- package/dist/list.registry-load-C1_sr3gb.js +0 -152
- package/dist/list.row-sources-BMtHc9oi.js +0 -474
- package/dist/list.source-plan-Dth72qPP.js +0 -81
- package/dist/list.status-command-BXCnEq8Q.js +0 -815
- package/dist/live-model-switch-Dxav22vq.js +0 -119
- package/dist/llm-slug-generator-6o8RXL11.js +0 -78
- package/dist/load-config-EF3n0Dyo.js +0 -27
- package/dist/load-context-CI_ogQt_.js +0 -82
- package/dist/loader-DtwEzpp-.js +0 -7008
- package/dist/local-dispatch.runtime-21liE3rA.js +0 -10
- package/dist/main-session-restart-recovery-D1g62iJ5.js +0 -2
- package/dist/main-session-restart-recovery-v2I9CEXi.js +0 -389
- package/dist/managed-image-attachments-BEl5qfCT.js +0 -616
- package/dist/managed-image-attachments-D5KqX2Qy.js +0 -2
- package/dist/manager-DZc3xiNq.js +0 -2314
- package/dist/manager-Vf3vLTGe.js +0 -3737
- package/dist/mcp-http-BaJoPKF9.js +0 -583
- package/dist/mcp-http-CpEaJIGJ.js +0 -2
- package/dist/media-runtime-DtP_Ff8m.js +0 -391
- package/dist/media-services-CXYbyIIp.js +0 -416
- package/dist/media-understanding-DvTIsIyr.js +0 -87
- package/dist/media-understanding-provider-DBBAvuwG.js +0 -13
- package/dist/media-understanding-provider-DOf_uZrx.js +0 -70
- package/dist/media-understanding-provider-DdRfNh9h.js +0 -69
- package/dist/media-understanding-provider-mqpQDt8V.js +0 -29
- package/dist/memory-BNk25Hi6.js +0 -437
- package/dist/memory-core-host-engine-embeddings-XsK5xS70.js +0 -667
- package/dist/memory-core-host-engine-foundation-BYkoOLXl.js +0 -15
- package/dist/memory-core-host-engine-qmd-0JuUCKCK.js +0 -2
- package/dist/memory-core-host-engine-storage-MCFGjDwW.js +0 -2
- package/dist/memory-core-host-runtime-cli-fVGH65E8.js +0 -10
- package/dist/memory-core-host-runtime-core-JtXIAdlM.js +0 -12
- package/dist/memory-core-host-runtime-files-BGw_ypoN.js +0 -4
- package/dist/memory-embedding-provider-runtime-3UBzs4sx.js +0 -36
- package/dist/memory-host-core-Y_O5V-mu.js +0 -78
- package/dist/memory-host-search.runtime-B4TzyvmR.js +0 -2
- package/dist/memory-runtime-9kEPAeKV.js +0 -2
- package/dist/memory-runtime-BU4t85uu.js +0 -57
- package/dist/memory-search-CVX--mSz.js +0 -235
- package/dist/message-BVXoNpWP.js +0 -284
- package/dist/message-HaiKqj0A.js +0 -2
- package/dist/message-action-runner-Chwzn02r.js +0 -2
- package/dist/message-action-runner-tEEliptt.js +0 -1922
- package/dist/message-handler-CHDS_NF-.js +0 -1806
- package/dist/metadata-registry-loader-Croa1pgR.js +0 -22
- package/dist/metadata-registry-loader-w0p86vis.js +0 -2
- package/dist/migrate-CPCZJ4H5.js +0 -2
- package/dist/migrate-CUj6m6Cx.js +0 -458
- package/dist/migration-provider-runtime-4r4WGtf2.js +0 -2
- package/dist/migration-provider-runtime-TxrH_mM7.js +0 -68
- package/dist/minimax-web-search-provider.runtime-Dr2GJiWj.js +0 -148
- package/dist/model-BQSouNOa.js +0 -2
- package/dist/model-CAk0bcuO.js +0 -1302
- package/dist/model-auth-BF7w9Fiv.js +0 -705
- package/dist/model-auth-label-r729wcPk.js +0 -67
- package/dist/model-auth-us8b_D5d.js +0 -6
- package/dist/model-catalog-BGykBGxx.js +0 -434
- package/dist/model-catalog-BVXrqFbI.js +0 -3
- package/dist/model-catalog-visibility-Bsup46vy.js +0 -76
- package/dist/model-config.helpers-wzD1EEfE.js +0 -95
- package/dist/model-context-tokens-DrIU9eJc.js +0 -572
- package/dist/model-fallback-GySPjr3J.js +0 -1288
- package/dist/model-fallback-auth.runtime-Dg_Jmguu.js +0 -5
- package/dist/model-picker-BI6jXOjt.js +0 -3
- package/dist/model-picker-DYyJHhfH.js +0 -1135
- package/dist/model-picker-visibility-D_IMZfxd.js +0 -22
- package/dist/model-picker.runtime-B70kQMyc.js +0 -48
- package/dist/model-pricing-cache-CSpUDzSt.js +0 -856
- package/dist/model-pricing-cache-dkPwTUVJ.js +0 -3
- package/dist/model-pricing-cache-state-C6shoEWy.js +0 -83
- package/dist/model-provider-auth-BfZHbTaj.js +0 -2
- package/dist/model-provider-auth-CPCBWvqL.js +0 -375
- package/dist/model-runtime-aliases-DUzusc9_.js +0 -133
- package/dist/model-selection-8UzO5mgF.js +0 -254
- package/dist/model-selection-Cb7azWw1.js +0 -7
- package/dist/model-selection-jDYEo0WI.js +0 -352
- package/dist/model-selection.runtime-D_yHZLbs.js +0 -7
- package/dist/models-BxA2IU3W.js +0 -57
- package/dist/models-auth-status-yG7yyRcv.js +0 -280
- package/dist/models-cli-DUt4uiMH.js +0 -257
- package/dist/models-config-B5bkuh6A.js +0 -1189
- package/dist/models-config-Xj8vG_x2.js +0 -2
- package/dist/models-config.providers.secrets-DNBB440Z.js +0 -2
- package/dist/models-config.providers.secrets-DNIQlBSE.js +0 -382
- package/dist/models-http-DMILRsry.js +0 -88
- package/dist/monitor-7tD_FE_5.js +0 -60
- package/dist/monitor-HjEwlqJs.js +0 -1024
- package/dist/monitor.account-D0F9tnWD.js +0 -5382
- package/dist/music-generation-provider-3ykPaUwR.js +0 -308
- package/dist/native-hook-relay-BJKHIhWd.js +0 -1378
- package/dist/native-hook-relay-V8Kappw1.js +0 -19
- package/dist/node-cli-BLVyQ93e.js +0 -2806
- package/dist/node-command-policy-B0ezpI_O.js +0 -295
- package/dist/nodes-DnWH_15m.js +0 -3
- package/dist/nodes-RkB4ZmP6.js +0 -1483
- package/dist/nodes-cli-upwPs91b.js +0 -960
- package/dist/nodes-pending--sojaxpI.js +0 -211
- package/dist/nodes-utils-Yks_uDZK.js +0 -85
- package/dist/oauth-CQN2efEy.js +0 -207
- package/dist/oauth-DApi3OI9.js +0 -746
- package/dist/oauth-DkUWBub2.js +0 -852
- package/dist/onboard-CiQSBSrz.js +0 -768
- package/dist/onboard-channels-DaWYXiLv.js +0 -1534
- package/dist/onboard-channels-DnwM2_IL.js +0 -2
- package/dist/onboard-custom-BQPckD0V.js +0 -3
- package/dist/onboard-custom-config-BmbThk2-.js +0 -422
- package/dist/onboard-custom-xInFj1Rs.js +0 -280
- package/dist/onboard-search-DSfmthe5.js +0 -412
- package/dist/openai-compat-errors-VR4SN1MV.js +0 -136
- package/dist/openai-http-DV95ynPi.js +0 -836
- package/dist/openai-transport-stream-BwpzqR-b.js +0 -3427
- package/dist/openresponses-http-DPchx8IC.js +0 -1175
- package/dist/operations-f9R8j-r9.js +0 -805
- package/dist/order-BQx8mNGZ.js +0 -218
- package/dist/outbound-attachment-C4yojK6p.js +0 -19
- package/dist/param-readers-BIXyd5la.js +0 -2
- package/dist/payloads-DrY1bKyF.js +0 -256
- package/dist/persistent-bindings.lifecycle-BiPN7luW.js +0 -85
- package/dist/persistent-bindings.lifecycle-X3wfan2Z.js +0 -2
- package/dist/plugin-enabled-CqsBObeO.js +0 -232
- package/dist/plugin-install-CfB1_kpX.js +0 -118
- package/dist/plugin-install-DzMraXHH.js +0 -2
- package/dist/plugin-install-config-policy-BD_elPNg.js +0 -169
- package/dist/plugin-registration-Dy58ncPf.js +0 -97
- package/dist/plugin-registry-BlmODeop.js +0 -3
- package/dist/plugin-registry-k5OK18l5.js +0 -2
- package/dist/plugin-runtime-B3t53CKr.js +0 -102
- package/dist/plugin-sdk/bundled-channel-config-schema-C3pWWvwG.d.ts +0 -3169
- package/dist/plugin-sdk/config-schema-D7cABQ6o.d.ts +0 -33
- package/dist/plugin-sdk/zod-schema.core-CwBNqcXp.d.ts +0 -166
- package/dist/plugin-service-sKF4gWFm.js +0 -1249
- package/dist/plugins-authoring-command-I72k2cuv.js +0 -304
- package/dist/plugins-cli-DMQRbPsU.js +0 -63
- package/dist/plugins-cli.runtime-CvDuKFJj.js +0 -339
- package/dist/plugins-command-helpers-C5WMM4bk.js +0 -164
- package/dist/plugins-command-helpers-DDt_pMQ4.js +0 -2
- package/dist/plugins-inspect-command-ka7Hpld3.js +0 -248
- package/dist/plugins-install-command-BHSgof-_.js +0 -2
- package/dist/plugins-install-command-t5caX9q_.js +0 -993
- package/dist/plugins-install-persist-Bah1m3x7.js +0 -252
- package/dist/plugins-list-command-BXLWwXHM.js +0 -184
- package/dist/plugins-uninstall-command-C_3m6CrW.js +0 -118
- package/dist/prepare.runtime-COZaHg5E.js +0 -798
- package/dist/presentation-card-CciJv4ru.js +0 -164
- package/dist/preview-warnings-L4VuEOyB.js +0 -618
- package/dist/profiles-CM2xoUYX.js +0 -194
- package/dist/program-B-4C7bC-.js +0 -131
- package/dist/provider-adapters-Eh8mS2Fd.js +0 -104
- package/dist/provider-api-key-auth-DTh2cbmS.js +0 -117
- package/dist/provider-api-key-auth.runtime-DrTYYfxK.js +0 -14
- package/dist/provider-auth-Bnaijzmv.js +0 -281
- package/dist/provider-auth-api-key-CNP8o5E7.js +0 -5
- package/dist/provider-auth-choice-Devw4sQf.js +0 -311
- package/dist/provider-auth-choice-helpers-DmVudRp6.js +0 -210
- package/dist/provider-auth-choice.runtime-C337IQ3W.js +0 -2
- package/dist/provider-auth-choice.runtime-DqGYalFo.js +0 -18
- package/dist/provider-auth-guidance-Bk4WV6Lg.js +0 -2
- package/dist/provider-auth-guidance-C7NCKuKn.js +0 -34
- package/dist/provider-auth-helpers-r7mC8I5l.js +0 -177
- package/dist/provider-auth-login.runtime-BFJgAAS6.js +0 -156
- package/dist/provider-auth-runtime-BiLPGiMW.js +0 -186
- package/dist/provider-discovery-uxRmAIf_.js +0 -95
- package/dist/provider-discovery.runtime-mwbSivDS.js +0 -290
- package/dist/provider-dispatcher-CtKWj3r-.js +0 -22
- package/dist/provider-entry-DjACqdrB.js +0 -134
- package/dist/provider-hook-runtime-CpJsM7Dk.js +0 -255
- package/dist/provider-openai-codex-oauth-DWGmVUYg.js +0 -2
- package/dist/provider-openai-codex-oauth-ctxd00JW.js +0 -44
- package/dist/provider-registration-l8EX4voM.js +0 -235
- package/dist/provider-registry-BgIQXJle.js +0 -31
- package/dist/provider-registry-CVuzobHN.js +0 -36
- package/dist/provider-registry-DmdDbSQs.js +0 -61
- package/dist/provider-registry-LqtLqheu.js +0 -61
- package/dist/provider-registry-pTYVjODc.js +0 -61
- package/dist/provider-runtime-BQZSuC9l.js +0 -3
- package/dist/provider-runtime-D9Q-7VuO.js +0 -386
- package/dist/provider-runtime.runtime-C6YZ8YI0.js +0 -26
- package/dist/provider-self-hosted-setup-BIAD2ISe.js +0 -373
- package/dist/provider-stream-DScdaoRo.js +0 -313
- package/dist/provider-stream-PE0IxmpZ.js +0 -1084
- package/dist/provider-stream-family-S2fhlydZ.js +0 -2
- package/dist/provider-usage-DVKHMF6l.js +0 -4
- package/dist/provider-usage-EEjx1av0.js +0 -71
- package/dist/provider-usage.load-Cu11xbrw.js +0 -357
- package/dist/provider-web-search-Dbk7MO-1.js +0 -58
- package/dist/provider-wizard-DS2Xb2eu.js +0 -125
- package/dist/providers.runtime-BPhGcupv.js +0 -240
- package/dist/providers.runtime-DoylK-ht.js +0 -2
- package/dist/proxy-BxacG0p3.js +0 -662
- package/dist/public-artifacts-Dq3y7bBv.js +0 -7
- package/dist/pw-ai-DlSSqerW.js +0 -3064
- package/dist/qmd-manager-B_SG-ejE.js +0 -2040
- package/dist/qr-cli-CT-sE_j9.js +0 -2
- package/dist/qr-cli-DPlDCXJQ.js +0 -371
- package/dist/qr-image--VmmvuDB.js +0 -2
- package/dist/queue-Be2Y7PcO.js +0 -923
- package/dist/read-file-hhemkDfq.js +0 -183
- package/dist/register-service-commands-CeVpCQU3.js +0 -77
- package/dist/register.agent-JLsb-giw.js +0 -152
- package/dist/register.configure-CP0Q-ost.js +0 -16
- package/dist/register.crestodian-CBXyXEix.js +0 -24
- package/dist/register.maintenance-DGIPQ2Vo.js +0 -85
- package/dist/register.message-BBQwz0Ld.js +0 -404
- package/dist/register.migrate-CkgNlvLD.js +0 -106
- package/dist/register.onboard-CS9gRK0c.js +0 -115
- package/dist/register.setup-DhqDOer9.js +0 -40
- package/dist/register.status-health-sessions-CiwQN_lw.js +0 -293
- package/dist/register.subclis-86Md7P0P.js +0 -3
- package/dist/register.subclis-CTVI8zvZ.js +0 -31
- package/dist/register.subclis-core-Cy4AnRCu.js +0 -273
- package/dist/rem-harness-vSsq3HiK.js +0 -649
- package/dist/repair-sequencing-SHADYdcA.js +0 -652
- package/dist/reply-media-paths.runtime-Bf5nxPuP.js +0 -154
- package/dist/reply-media-paths.runtime-sLsMpKGO.js +0 -2
- package/dist/reply-payloads-CJ3w8rSA.js +0 -79
- package/dist/reply-payloads-dedupe-DDFXWCVR.js +0 -176
- package/dist/reply-payloads-dedupe.runtime-DbXPzKmG.js +0 -2
- package/dist/reply-timing-tracker-DjVIBsVb.js +0 -205
- package/dist/reply-turn-admission-nEW5QbY5.js +0 -2056
- package/dist/reply.runtime-B4Dgs3Hg.js +0 -2
- package/dist/reset-preserved-selection-CVD1yeVC.js +0 -45
- package/dist/resolve-DidlinMh.js +0 -106
- package/dist/restart-DzTrO95c.js +0 -121
- package/dist/result-fallback-classifier-BqsFUDvP.js +0 -98
- package/dist/root-help-QGs0dCCN.js +0 -43
- package/dist/route-B3R-uzFG.js +0 -475
- package/dist/route-reply-CdfhgIoY.js +0 -174
- package/dist/route-reply.runtime-DwuU2WjH.js +0 -2
- package/dist/routes-ChXmJocl.js +0 -3701
- package/dist/routes-D-ZF4AdA.js +0 -2
- package/dist/run-ClmVDTET.js +0 -1162
- package/dist/run-auth-profile.runtime-CTxrwz0y.js +0 -2
- package/dist/run-command-CqZJQ0Im.js +0 -2
- package/dist/run-command-GClW75NL.js +0 -23
- package/dist/run-context-BOdGeRg5.js +0 -66
- package/dist/run-context.runtime-CwuKVYPj.js +0 -2
- package/dist/run-delivery.runtime-BQ39dm34.js +0 -762
- package/dist/run-embedded.runtime-e1K4Bt1_.js +0 -4
- package/dist/run-execution-cli.runtime-Cjrgt4cV.js +0 -4
- package/dist/run-executor.runtime-C2JE6JGb.js +0 -330
- package/dist/run-model-catalog.runtime-DkrLKopr.js +0 -2
- package/dist/run-session-state-C5YdQs7o.js +0 -159
- package/dist/run-subagent-registry.runtime-Dl_lXi6y.js +0 -2
- package/dist/runner-CNGHdaIg.js +0 -704
- package/dist/runner.entries-dckPkeld.js +0 -1485
- package/dist/runtime-9LxcVCyw.js +0 -615
- package/dist/runtime-BCOtBS5G.js +0 -3
- package/dist/runtime-C-pgjoJr.js +0 -210
- package/dist/runtime-CyF0vJXG.js +0 -10
- package/dist/runtime-D-7lMvGV.js +0 -2
- package/dist/runtime-D17OmF9G.js +0 -224
- package/dist/runtime-D6SweufG.js +0 -245
- package/dist/runtime-DVAM7AFd.js +0 -2
- package/dist/runtime-DX2ClrP-.js +0 -436
- package/dist/runtime-FOOWuiYX.js +0 -300
- package/dist/runtime-api-B0F0JsV1.js +0 -12
- package/dist/runtime-cREKSBYC.js +0 -2
- package/dist/runtime-channel-BmD4hoCR.js +0 -148
- package/dist/runtime-channel-BsebQSPL.js +0 -2
- package/dist/runtime-config-collectors-BjYeQ0Tk.js +0 -525
- package/dist/runtime-embedded-agent.runtime-A4r23Bn8.js +0 -2
- package/dist/runtime-internal-DkV-EMTK.js +0 -2
- package/dist/runtime-llm.runtime-BQKNnuRc.js +0 -307
- package/dist/runtime-model-auth.runtime-BbGqHVM5.js +0 -2
- package/dist/runtime-model-auth.runtime-rtJH4LBB.js +0 -46
- package/dist/runtime-options-B0EGb1Wq.js +0 -275
- package/dist/runtime-plugin-Bdqm44bH.js +0 -92
- package/dist/runtime-plugins-rZk1eAK_.js +0 -32
- package/dist/runtime-plugins.runtime-DApiYzny.js +0 -2
- package/dist/runtime-prepare.runtime-DWxvnbyY.js +0 -81
- package/dist/runtime-provider-B0slPjtk.js +0 -2
- package/dist/runtime-provider-DLgupOKt.js +0 -24
- package/dist/runtime-registry-loader-Cf2HuMjd.js +0 -2
- package/dist/runtime-registry-loader-DLzDrA7e.js +0 -117
- package/dist/runtime-shared-Bg-OiD4u.js +0 -365
- package/dist/runtime-web-channel-plugin-DrMjRaqi.js +0 -204
- package/dist/scan-DA7Oqxuv.js +0 -573
- package/dist/sdk-security-runtime-WjOaCbga.js +0 -86
- package/dist/sdk-setup-tools-DaYT6_jD.js +0 -8
- package/dist/secrets-cli-fJQ0geWO.js +0 -150
- package/dist/security-cli-CJMwGp8U.js +0 -520
- package/dist/selection-BNwLQzqJ.js +0 -3
- package/dist/selection-Cj-l80pO.js +0 -18365
- package/dist/send-DstYcrDW.js +0 -711
- package/dist/send-aTxtLkJm.js +0 -178
- package/dist/send-media-Bl2ryo6a.js +0 -2072
- package/dist/send-qwDMMnM6.js +0 -1222
- package/dist/send-result-BWRKr16H.js +0 -141
- package/dist/server-CMtA1S09.js +0 -24
- package/dist/server-DIRaYiiH.js +0 -72
- package/dist/server-aux-handlers-BRO-9-Jf.js +0 -1347
- package/dist/server-chat-0J_ke0ph.js +0 -827
- package/dist/server-context-DWOSX34k.js +0 -2
- package/dist/server-context-R7MFLFdI.js +0 -955
- package/dist/server-cron-2FuFg2j8.js +0 -2
- package/dist/server-cron-ChPAVQtg.js +0 -3173
- package/dist/server-maintenance-ZvS7Id6T.js +0 -152
- package/dist/server-methods-DSbhPK3k.js +0 -497
- package/dist/server-middleware-CYxFU-e5.js +0 -122
- package/dist/server-model-catalog-B22UhmRr.js +0 -73
- package/dist/server-model-catalog-BJIHPP3P.js +0 -2
- package/dist/server-node-events-tNWJnXQM.js +0 -597
- package/dist/server-plugin-bootstrap-Ccu97zi8.js +0 -71
- package/dist/server-plugins-ByXwKPnj.js +0 -435
- package/dist/server-reload-handlers-ConGiT9Q.js +0 -719
- package/dist/server-restart-sentinel-mPHo61LL.js +0 -700
- package/dist/server-runtime-services-BR1icaUW.js +0 -3
- package/dist/server-runtime-services-Bx8n34dj.js +0 -147
- package/dist/server-runtime-subscriptions-CZklTkRG.js +0 -67
- package/dist/server-session-events-DxdiZYM2.js +0 -244
- package/dist/server-session-key-CYvLslFO.js +0 -75
- package/dist/server-session-key-D9GQut81.js +0 -2
- package/dist/server-startup-config-Byb0vR8j.js +0 -305
- package/dist/server-startup-early-a65fHTQS.js +0 -87
- package/dist/server-startup-memory-ClwzC9jX.js +0 -72
- package/dist/server-startup-plugins-CaBj0Nt2.js +0 -127
- package/dist/server-startup-post-attach-B7TcxkmO.js +0 -793
- package/dist/server-ws-runtime-Cxk_CqMr.js +0 -374
- package/dist/server.impl-CQ6dnx43.js +0 -2622
- package/dist/session-cost-usage-GsYDNvka.js +0 -1600
- package/dist/session-kill-http-CKkxZhhd.js +0 -121
- package/dist/session-log-runtime-Bwc2Oijk.js +0 -1258
- package/dist/session-override-CWbKiXiC.js +0 -134
- package/dist/session-reset-model.runtime-CDFMjwWA.js +0 -144
- package/dist/session-reset-service-SE0aK4cw.js +0 -651
- package/dist/session-status.runtime-Df89I7Fk.js +0 -2
- package/dist/session-store-RkvjJPMQ.js +0 -273
- package/dist/session-store.runtime-C7P5asx7.js +0 -4
- package/dist/session-subagent-reactivation.runtime-BhGUZG1Z.js +0 -2
- package/dist/session-tab-registry-9rSuQ0Yz.js +0 -551
- package/dist/session-utils-De8TIM0h.js +0 -1508
- package/dist/sessions-6b9a00Tl.js +0 -1917
- package/dist/sessions-CEPHczjC.js +0 -316
- package/dist/sessions-CEojHc8b.js +0 -12736
- package/dist/sessions-cleanup-BkG7_sq9.js +0 -165
- package/dist/sessions-history-http-BjJEfjJa.js +0 -432
- package/dist/sessions-patch-PwG5sknc.js +0 -401
- package/dist/sessions-resolve-CSIrd_fi.js +0 -180
- package/dist/sessions-table-8CbU7jXa.js +0 -161
- package/dist/sessions.runtime-BYHMD0M7.js +0 -2
- package/dist/set-BJDpe28W.js +0 -31
- package/dist/set-image-CwTFx7PX.js +0 -17
- package/dist/setup-B6LmeIms.js +0 -614
- package/dist/setup-B_zxHfYu.js +0 -2
- package/dist/setup-onboard-configure-help-fast-path-Bck3SKEH.js +0 -64
- package/dist/setup.finalize-CmLYX-Rf.js +0 -586
- package/dist/setup.gateway-config-H_89Msro.js +0 -281
- package/dist/setup.migration-import-DVzyUjX6.js +0 -2
- package/dist/setup.migration-import-DmJpqoqf.js +0 -200
- package/dist/setup.post-install-migration-WPFWKXXg.js +0 -128
- package/dist/shared-CUhu8NTs.js +0 -5
- package/dist/shared-D-BN2JhY.js +0 -71
- package/dist/shared-ES8nDIcn.js +0 -212
- package/dist/simple-completion-runtime-BGZkWvKr.js +0 -206
- package/dist/simple-completion-runtime-CM_IISYW.js +0 -2
- package/dist/simple-completion-transport-Bo0u9dhp.js +0 -83
- package/dist/snapshot-urls-C1KjRQD5.js +0 -317
- package/dist/speech-core-Bas7e4h0.js +0 -119
- package/dist/speech-provider-BonJQv5S.js +0 -227
- package/dist/speech-provider-CwdKQmDv.js +0 -171
- package/dist/speech-provider-DcQRnYhZ.js +0 -233
- package/dist/stale-oauth-profile-shadows-C3aeAWfv.js +0 -186
- package/dist/stale-oauth-profile-shadows-m5rb8dPc.js +0 -2
- package/dist/standalone-runtime-registry-loader-B9n2LBKC.js +0 -59
- package/dist/startup-context-DY7C4riM.js +0 -314
- package/dist/status-6EPKat7p.js +0 -73
- package/dist/status-C6Fa7Dsf.js +0 -2
- package/dist/status-CNnxDQlM.js +0 -4
- package/dist/status-D2Scvbc0.js +0 -3
- package/dist/status-Ducanro3.js +0 -2
- package/dist/status-_XX_6QVA.js +0 -466
- package/dist/status-all-BP1u6vou.js +0 -573
- package/dist/status-json-DPlOJ_ue.js +0 -15
- package/dist/status-json-command-BT7EwVKj.js +0 -84
- package/dist/status-message-Dzr9-MX-.js +0 -495
- package/dist/status-message.runtime-DFezIt1d.js +0 -6
- package/dist/status-prBlcUV5.js +0 -249
- package/dist/status-queue.runtime-C1bmg2rl.js +0 -2
- package/dist/status-runtime-shared-RjKIPEQ0.js +0 -289
- package/dist/status-subagents.runtime-tsCCe4Ny.js +0 -32
- package/dist/status-text-Bkeyg8Bf.js +0 -301
- package/dist/status.command-D06_4ATq.js +0 -425
- package/dist/status.command-dDEZM84a.js +0 -2
- package/dist/status.command.text-runtime-WH9tP7yg.js +0 -15
- package/dist/status.runtime-B76GaBIR.js +0 -2
- package/dist/status.scan-Bc6clx0F.js +0 -72
- package/dist/status.scan-overview-v_-AaFhC.js +0 -460
- package/dist/status.scan.deps.runtime-BkH1HAb4.js +0 -19
- package/dist/status.scan.fast-json-CrlfKKI3.js +0 -2
- package/dist/status.scan.fast-json-D8v6zfP8.js +0 -163
- package/dist/status.summary-DBhvgOPr.js +0 -276
- package/dist/status.summary-hQV0PKFO.js +0 -2
- package/dist/store-BClomp_4.js +0 -3
- package/dist/store-BHqDPtNw.js +0 -2302
- package/dist/stored-model-override-vm4CtQWX.js +0 -79
- package/dist/subagent-announce-D244Q4w2.js +0 -353
- package/dist/subagent-announce-delivery-qKZfF7Bs.js +0 -1369
- package/dist/subagent-control-c87mVGUE.js +0 -492
- package/dist/subagent-control.runtime-DfQtIsDb.js +0 -3
- package/dist/subagent-hooks-B_UW5Len.js +0 -2
- package/dist/subagent-hooks-CYvFWt_r.js +0 -230
- package/dist/subagent-hooks-api-DZgaJf19.js +0 -23
- package/dist/subagent-registry-BlcoCggo.js +0 -2627
- package/dist/subagent-registry-CuObhNeO.js +0 -3
- package/dist/subagent-session-cleanup-hFF8Z34s.js +0 -390
- package/dist/system-CN_Knfqq.js +0 -111
- package/dist/system-prompt-config-BmZlhYK9.js +0 -918
- package/dist/talk-DrjGczYs.js +0 -2454
- package/dist/target-id-BNpbyWkq.js +0 -107
- package/dist/targets-CQcGo6u4.js +0 -267
- package/dist/targets.runtime-DwcxNI-x.js +0 -2
- package/dist/task-executor-CZg-qt4u.js +0 -349
- package/dist/task-owner-access-Duem5jjb.js +0 -74
- package/dist/task-registry-Cw8pc3Ry.js +0 -2362
- package/dist/task-registry-delivery-runtime-HaiKqj0A.js +0 -2
- package/dist/task-registry.maintenance-BLv3wpK9.js +0 -764
- package/dist/task-registry.maintenance-CvlIcxE-.js +0 -2
- package/dist/task-status-access-C5nDJSI4.js +0 -18
- package/dist/tasks-D3CfEAlq.js +0 -548
- package/dist/tasks-WKnE5fvr.js +0 -153
- package/dist/tasks-audit-system-okJjcOjU.js +0 -210
- package/dist/tasks-json-C-iUgWNu.js +0 -73
- package/dist/tavily-web-search-provider.runtime-jpagljrA.js +0 -112
- package/dist/text-report-BTsF3Pv3.js +0 -695
- package/dist/text-transforms.runtime-CgH_pbcQ.js +0 -113
- package/dist/thread-bindings-BWxpUE9U.js +0 -228
- package/dist/tool-DhJbbm91.js +0 -143
- package/dist/tool-dispatch-CpFUfblu.js +0 -155
- package/dist/tool-images-C-tFlXjE.js +0 -247
- package/dist/tool-plugin-3NejWxZW.js +0 -93
- package/dist/tool-resolution-oW8Cbamd.js +0 -153
- package/dist/tool-result-truncation-CWFGf7Eu.js +0 -498
- package/dist/tool-schema-CMtc7PdZ.js +0 -40
- package/dist/tool-schema-projection-DJRPEEvY.js +0 -215
- package/dist/tool-split-E4RdK5jS.js +0 -323
- package/dist/tools-BAl3JiNw.js +0 -901
- package/dist/tools-DC8tCPxR.js +0 -579
- package/dist/tools-catalog-Dzv9zaBD.js +0 -156
- package/dist/tools-effective-CGvzyIL2.js +0 -442
- package/dist/tools-effective-inventory-GI5N5Q9v.js +0 -379
- package/dist/tools-invoke-CU2U0hNH.js +0 -51
- package/dist/tools-invoke-http-8s3FiUy4.js +0 -68
- package/dist/tools-invoke-shared-DIETrEY7.js +0 -200
- package/dist/tools.runtime-Bnm8CI7w.js +0 -5
- package/dist/transcript-rewrite-Buv2ITw4.js +0 -688
- package/dist/transcripts-tool-BCFlLCFd.js +0 -2
- package/dist/transcripts-tool-CWgNd0Uw.js +0 -656
- package/dist/tts-Aguo4zC5.js +0 -3
- package/dist/tts-Bf77cURn.js +0 -2
- package/dist/tts-DnADOKOP.js +0 -194
- package/dist/tts-runtime-MBSH-nOM.js +0 -1337
- package/dist/tts.runtime-B-NR9osE.js +0 -2
- package/dist/tts.runtime-Bo-QxKgx.js +0 -3
- package/dist/tui-B0CdNmCz.js +0 -4860
- package/dist/tui-ByRcXM3Z.js +0 -2
- package/dist/tui-backend-C52BUoZI.js +0 -256
- package/dist/tui-cli-BQHpZ4n0.js +0 -40
- package/dist/typing-policy-XspVOezC.js +0 -199
- package/dist/usage-BOYwzimH.js +0 -1113
- package/dist/usage-BSmLrVWB.js +0 -623
- package/dist/usage-format-CfzICmvv.js +0 -2
- package/dist/usage-format-DPJKCPic.js +0 -394
- package/dist/video-generation-provider-CdCTztQ7.js +0 -77
- package/dist/video-generation-provider-MUUshUzz.js +0 -325
- package/dist/video-generation-provider-XmzzTa6e.js +0 -297
- package/dist/video-generation-provider-weiQUJE5.js +0 -64
- package/dist/web-fetch-providers.runtime-tD9zqAS2.js +0 -41
- package/dist/web-guarded-fetch-CyhQZ1yD.js +0 -2
- package/dist/web-guarded-fetch-DIXHI-yJ.js +0 -58
- package/dist/web-media-BPnTMYE5.js +0 -4
- package/dist/web-media-DV_tCQiQ.js +0 -2
- package/dist/web-media-DYydVGCK.js +0 -651
- package/dist/web-provider-runtime-shared-h3M6Bqyg.js +0 -142
- package/dist/web-search-provider-common-CEYWuDcp.js +0 -252
- package/dist/web-search-providers.runtime-YrayP296.js +0 -41
- /package/dist/{acp-runtime-backend-CHZtaM6t.js → acp-runtime-backend-B83JR5Zf.js} +0 -0
- /package/dist/{agent-turn-attachments-BYCRK86s.js → agent-turn-attachments-D5uJijuK.js} +0 -0
- /package/dist/{auth-install-policy-t46tJ8jV.js → auth-install-policy-BIpdwrZ9.js} +0 -0
- /package/dist/{cli-backends-BHXnrVN_.js → cli-backends-79CCRQ2a.js} +0 -0
- /package/dist/{command-secret-targets-DZ0J2Wm3.js → command-secret-targets-BOJlcBil.js} +0 -0
- /package/dist/{commands-DWp49Exc.js → commands-Dw9hwmVt.js} +0 -0
- /package/dist/{commands-reset-hooks-MMq2dvff.js → commands-reset-hooks-epArfNOY.js} +0 -0
- /package/dist/{delegate-Dkj_5OvH.js → delegate-Bw8NQXVr.js} +0 -0
- /package/dist/{jobs-BGELIHcx.js → jobs-BIOTaq7l.js} +0 -0
- /package/dist/{kimi-web-search-provider-4PlMYsPx.js → kimi-web-search-provider-Bzg_DiXO.js} +0 -0
- /package/dist/{memory-host-search-Ds9GiNpf.js → memory-host-search-Dph0Mq-v.js} +0 -0
- /package/dist/{minimax-web-search-provider-d5gTJUNg.js → minimax-web-search-provider-CETxDkkI.js} +0 -0
- /package/dist/{model-selection-cli-CO6BHPiL.js → model-selection-cli-DizUvxeY.js} +0 -0
- /package/dist/{provider-auth-choice-preference-f7Us6TQL.js → provider-auth-choice-preference-uJn1811S.js} +0 -0
- /package/dist/{runtime-wfO9bV5y.js → runtime-BEVbpIgZ.js} +0 -0
- /package/dist/{runtime-web-tools-B6vr1LZs.js → runtime-web-tools-Bf0aEe-F.js} +0 -0
- /package/dist/{runtime-web-tools-fallback.runtime-Crs7KfH5.js → runtime-web-tools-fallback.runtime-DU6rTj6l.js} +0 -0
- /package/dist/{session-subagent-reactivation-H5Rdwkyy.js → session-subagent-reactivation-Bb5SCi9J.js} +0 -0
- /package/dist/{tavily-web-search-provider-DbdIzpMv.js → tavily-web-search-provider-CIEhV60D.js} +0 -0
package/dist/chat-BTMPilpx.js
DELETED
|
@@ -1,2940 +0,0 @@
|
|
|
1
|
-
import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DKw2K5wM.js";
|
|
2
|
-
import { a as asFiniteNumber } from "./number-coercion-D1aDmIZp.js";
|
|
3
|
-
import { i as asOptionalRecord } from "./record-coerce-Btbek4uV.js";
|
|
4
|
-
import { a as formatUncaughtError, i as formatErrorMessage } from "./errors-5ePGD43N.js";
|
|
5
|
-
import { _ as uniqueStrings } from "./string-normalization-B8G0vlWE.js";
|
|
6
|
-
import { S as safeFileURLToPath, v as assertNoWindowsNetworkPath } from "./fs-safe-CR_om3kX.js";
|
|
7
|
-
import { r as openLocalFileSafely } from "./secure-temp-dir-BvCzS-gM.js";
|
|
8
|
-
import { _ as resolveSessionAgentId } from "./agent-scope-DYvAPpmY.js";
|
|
9
|
-
import { c as parseAgentSessionKey } from "./session-key-utils-CdfsDYvz.js";
|
|
10
|
-
import { h as scopeLegacySessionKeyToAgent, l as normalizeAgentId } from "./session-key-CJf5_zWs.js";
|
|
11
|
-
import { c as resolveDefaultAgentId, n as listAgentIds, o as resolveAgentWorkspaceDir } from "./agent-scope-config-BFfPgg3b.js";
|
|
12
|
-
import { c as measureDiagnosticsTimelineSpan, l as measureDiagnosticsTimelineSpanSync } from "./plugin-metadata-snapshot-DeNMzywg.js";
|
|
13
|
-
import { r as resolveProviderIdForAuth } from "./provider-auth-aliases-C1s6dq0f.js";
|
|
14
|
-
import { a as hasGatewayClientCap, i as GATEWAY_CLIENT_NAMES, r as GATEWAY_CLIENT_MODES, t as GATEWAY_CLIENT_CAPS } from "./client-info-D6_UASoA.js";
|
|
15
|
-
import { C as validateChatSendParams, Ri as ErrorCodes, S as validateChatInjectParams, t as formatValidationErrors, x as validateChatHistoryParams, y as validateChatAbortParams, zi as errorShape } from "./src-B1Y482-m.js";
|
|
16
|
-
import { i as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-core-rOsWksPZ.js";
|
|
17
|
-
import { i as normalizeMessageChannel } from "./message-channel-normalize-CaOaCinb.js";
|
|
18
|
-
import { a as isOperatorUiClient, n as isGatewayCliClient, o as isWebchatClient } from "./message-channel-DcN_7tYD.js";
|
|
19
|
-
import { t as ADMIN_SCOPE } from "./operator-scopes-DGvgHuOd.js";
|
|
20
|
-
import "./method-scopes-CTk-6mpm.js";
|
|
21
|
-
import { a as getReplyPayloadTtsSupplement, c as isReplyPayloadTtsSupplement, i as getReplyPayloadMetadata, n as buildTtsSupplementMediaPayload } from "./reply-payload-DM17pxMC.js";
|
|
22
|
-
import "./local-file-access-CF5H6Z2a.js";
|
|
23
|
-
import { t as isPassThroughRemoteMediaSource } from "./media-source-url-B2V2UVFP.js";
|
|
24
|
-
import { i as resolveSessionStoreKey } from "./session-store-key-C5RVfgko.js";
|
|
25
|
-
import { n as deliveryContextFromSession } from "./delivery-context.shared-CHlZnq4E.js";
|
|
26
|
-
import { i as resolveSessionFilePath } from "./paths-C79m3Aob.js";
|
|
27
|
-
import { o as isAudioFileName } from "./mime-TnUOZVhx.js";
|
|
28
|
-
import "./sessions-Cs11K_1i.js";
|
|
29
|
-
import { o as resolveMirroredTranscriptText, s as appendSessionTranscriptMessage } from "./transcript-B07Cf07z.js";
|
|
30
|
-
import { t as emitSessionTranscriptUpdate } from "./transcript-events-CX3wuAgS.js";
|
|
31
|
-
import "./transcript-jsonl-LFU2CQ2E.js";
|
|
32
|
-
import { r as resolveAgentTimeoutMs } from "./task-completion-contract-BqW0VJsk.js";
|
|
33
|
-
import { h as stripEnvelopeFromMessage, i as readRecentSessionMessagesAsync, m as readSessionTranscriptIndex, n as capArrayByJsonBytes, x as jsonUtf8Bytes } from "./session-utils.fs-D-Ly08WB.js";
|
|
34
|
-
import { s as normalizeInputProvenance } from "./input-provenance-DCrP7aPH.js";
|
|
35
|
-
import { i as stripInlineDirectiveTagsForDisplay, n as sanitizeReplyDirectiveId } from "./directive-tags-DBD-mk-0.js";
|
|
36
|
-
import { c as loadSessionEntry, d as resolveDeletedAgentIdFromSessionKey, h as resolveGatewaySessionThinkingDefault, p as resolveGatewayModelSupportsImages, v as resolveSessionModelRef } from "./session-utils-De8TIM0h.js";
|
|
37
|
-
import { n as getSessionBindingService } from "./session-binding-service-BjjMIxQb.js";
|
|
38
|
-
import { m as resolveSendableOutboundReplyParts } from "./reply-payload-swpu2tGD.js";
|
|
39
|
-
import { t as dispatchInboundMessage } from "./dispatch-Ck2tvRYH.js";
|
|
40
|
-
import { ot as createUserTurnTranscriptRecorder } from "./selection-Cj-l80pO.js";
|
|
41
|
-
import { n as estimateBase64DecodedBytes } from "./base64-D03BM6T6.js";
|
|
42
|
-
import { i as deleteMediaBuffer, t as MEDIA_MAX_BYTES, u as saveMediaBuffer } from "./store-DhTe6QLE.js";
|
|
43
|
-
import { r as getAgentScopedMediaLocalRoots, t as appendLocalMediaParentRoots } from "./local-roots-BK0kFmQd.js";
|
|
44
|
-
import { n as assertLocalMediaAllowed, t as LocalMediaAccessError } from "./local-media-access-6RpTVFHz.js";
|
|
45
|
-
import { i as normalizeReplyPayloadsForDelivery } from "./payloads-DrY1bKyF.js";
|
|
46
|
-
import { a as ensureSandboxWorkspaceForSession } from "./sandbox-BkjHaRc1.js";
|
|
47
|
-
import { t as rewriteTranscriptEntriesInSessionFile } from "./transcript-rewrite-Buv2ITw4.js";
|
|
48
|
-
import { u as isPluginOwnedSessionBindingRecord } from "./conversation-binding-Bxc6eFMK.js";
|
|
49
|
-
import { n as resolveSendPolicy } from "./send-policy-cLIJehRZ.js";
|
|
50
|
-
import { s as augmentChatHistoryWithCliSessionImports } from "./attempt-execution.helpers-DrX0QToi.js";
|
|
51
|
-
import { n as createReplyMediaPathNormalizer } from "./reply-media-paths.runtime-Bf5nxPuP.js";
|
|
52
|
-
import { t as createReplyDispatcher } from "./reply-dispatcher-BT0Jq3lw.js";
|
|
53
|
-
import { i as registerChatAbortController, o as updateChatRunProvider, r as isChatStopCommandText, t as abortChatRunById } from "./chat-abort-ERoHIOYh.js";
|
|
54
|
-
import { t as createChannelReplyPipeline } from "./reply-pipeline-D_bQfNzv.js";
|
|
55
|
-
import { n as runAgentHarnessBeforeMessageWriteHook } from "./hook-helpers-DLEnCRO7.js";
|
|
56
|
-
import "./channel-outbound-BhefGAqY.js";
|
|
57
|
-
import { t as logLargePayload } from "./diagnostic-payload-BP1TpHgP.js";
|
|
58
|
-
import { c as getMaxChatHistoryMessagesBytes } from "./server-constants-BGwLM6XN.js";
|
|
59
|
-
import { t as formatForLog } from "./ws-log-tuDbcNZH.js";
|
|
60
|
-
import { n as isSuppressedControlReplyText } from "./control-reply-text-dCt9wdi8.js";
|
|
61
|
-
import { a as projectRecentChatDisplayMessages, n as isToolHistoryBlockType, o as resolveEffectiveChatHistoryMaxChars, r as projectChatDisplayMessage } from "./chat-display-projection-DCLQ90zy.js";
|
|
62
|
-
import { t as stageSandboxMedia } from "./stage-sandbox-media-BHLOnKVh.js";
|
|
63
|
-
import { a as resolveChatAttachmentMaxBytes, i as parseMessageWithAttachments, n as MediaOffloadError, r as UnsupportedAttachmentError, t as normalizeRpcAttachmentsToChatAttachments } from "./attachment-normalize-DAW86mZY.js";
|
|
64
|
-
import { i as createManagedOutgoingImageBlocks, n as attachManagedOutgoingImagesToMessage, r as cleanupManagedOutgoingImageRecords } from "./managed-image-attachments-BEl5qfCT.js";
|
|
65
|
-
import { n as timestampOptsFromConfig, t as injectTimestamp } from "./agent-timestamp-ClgiA1GA.js";
|
|
66
|
-
import { n as setGatewayDedupeEntry } from "./agent-wait-dedupe-CLuKbI_7.js";
|
|
67
|
-
import fs from "node:fs";
|
|
68
|
-
import path from "node:path";
|
|
69
|
-
import { createHash } from "node:crypto";
|
|
70
|
-
//#region src/chat/canvas-render.ts
|
|
71
|
-
function tryParseJsonRecord(value) {
|
|
72
|
-
if (typeof value !== "string") return;
|
|
73
|
-
try {
|
|
74
|
-
return asOptionalRecord(JSON.parse(value));
|
|
75
|
-
} catch {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function getRecordStringField(record, key) {
|
|
80
|
-
const value = record?.[key];
|
|
81
|
-
return typeof value === "string" && value.trim() ? value : void 0;
|
|
82
|
-
}
|
|
83
|
-
function getRecordNumberField(record, key) {
|
|
84
|
-
const value = record?.[key];
|
|
85
|
-
return asFiniteNumber(value);
|
|
86
|
-
}
|
|
87
|
-
function getNestedRecord(record, key) {
|
|
88
|
-
const value = record?.[key];
|
|
89
|
-
return asOptionalRecord(value);
|
|
90
|
-
}
|
|
91
|
-
function normalizeSurface(value) {
|
|
92
|
-
return value === "assistant_message" ? value : void 0;
|
|
93
|
-
}
|
|
94
|
-
function normalizePreferredHeight(value) {
|
|
95
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 160 ? Math.min(Math.trunc(value), 1200) : void 0;
|
|
96
|
-
}
|
|
97
|
-
function coerceCanvasPreview(record) {
|
|
98
|
-
if (!record) return;
|
|
99
|
-
if (getRecordStringField(record, "kind")?.trim().toLowerCase() !== "canvas") return;
|
|
100
|
-
const presentation = getNestedRecord(record, "presentation");
|
|
101
|
-
const view = getNestedRecord(record, "view");
|
|
102
|
-
const source = getNestedRecord(record, "source");
|
|
103
|
-
const requestedSurface = getRecordStringField(presentation, "target") ?? getRecordStringField(record, "target");
|
|
104
|
-
const surface = requestedSurface ? normalizeSurface(requestedSurface) : "assistant_message";
|
|
105
|
-
if (!surface) return;
|
|
106
|
-
const title = getRecordStringField(presentation, "title") ?? getRecordStringField(view, "title");
|
|
107
|
-
const preferredHeight = normalizePreferredHeight(getRecordNumberField(presentation, "preferred_height") ?? getRecordNumberField(presentation, "preferredHeight") ?? getRecordNumberField(view, "preferred_height") ?? getRecordNumberField(view, "preferredHeight"));
|
|
108
|
-
const className = getRecordStringField(presentation, "class_name") ?? getRecordStringField(presentation, "className");
|
|
109
|
-
const style = getRecordStringField(presentation, "style");
|
|
110
|
-
const viewUrl = getRecordStringField(view, "url") ?? getRecordStringField(view, "entryUrl");
|
|
111
|
-
const viewId = getRecordStringField(view, "id") ?? getRecordStringField(view, "docId");
|
|
112
|
-
if (viewUrl) return {
|
|
113
|
-
kind: "canvas",
|
|
114
|
-
surface,
|
|
115
|
-
render: "url",
|
|
116
|
-
url: viewUrl,
|
|
117
|
-
...viewId ? { viewId } : {},
|
|
118
|
-
...title ? { title } : {},
|
|
119
|
-
...preferredHeight ? { preferredHeight } : {},
|
|
120
|
-
...className ? { className } : {},
|
|
121
|
-
...style ? { style } : {}
|
|
122
|
-
};
|
|
123
|
-
if (getRecordStringField(source, "type")?.trim().toLowerCase() === "url") {
|
|
124
|
-
const url = getRecordStringField(source, "url");
|
|
125
|
-
if (!url) return;
|
|
126
|
-
return {
|
|
127
|
-
kind: "canvas",
|
|
128
|
-
surface,
|
|
129
|
-
render: "url",
|
|
130
|
-
url,
|
|
131
|
-
...title ? { title } : {},
|
|
132
|
-
...preferredHeight ? { preferredHeight } : {},
|
|
133
|
-
...className ? { className } : {},
|
|
134
|
-
...style ? { style } : {}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function extractCanvasFromText(outputText, _toolName) {
|
|
139
|
-
return coerceCanvasPreview(tryParseJsonRecord(outputText));
|
|
140
|
-
}
|
|
141
|
-
//#endregion
|
|
142
|
-
//#region src/gateway/server-methods/chat-reply-media.ts
|
|
143
|
-
function isDataUrlMedia(mediaUrl) {
|
|
144
|
-
return mediaUrl.trim().toLowerCase().startsWith("data:");
|
|
145
|
-
}
|
|
146
|
-
function shouldPreserveDisplayMediaUrl(payload, mediaUrl) {
|
|
147
|
-
if (isDataUrlMedia(mediaUrl)) return true;
|
|
148
|
-
if (!isAudioFileName(mediaUrl)) return false;
|
|
149
|
-
if (isPassThroughRemoteMediaSource(mediaUrl)) return true;
|
|
150
|
-
return payload.trustedLocalMedia === true;
|
|
151
|
-
}
|
|
152
|
-
async function normalizeWebchatReplyMediaPathsForDisplay(params) {
|
|
153
|
-
if (params.payloads.length === 0) return params.payloads;
|
|
154
|
-
const workspaceDir = params.workspaceDir ?? resolveAgentWorkspaceDir(params.cfg, params.agentId);
|
|
155
|
-
if (!workspaceDir) return params.payloads;
|
|
156
|
-
const normalizeMediaPaths = createReplyMediaPathNormalizer({
|
|
157
|
-
cfg: params.cfg,
|
|
158
|
-
sessionKey: params.sessionKey,
|
|
159
|
-
agentId: params.agentId,
|
|
160
|
-
workspaceDir,
|
|
161
|
-
accountId: params.accountId
|
|
162
|
-
});
|
|
163
|
-
const normalized = [];
|
|
164
|
-
for (const payload of params.payloads) {
|
|
165
|
-
if (payload.sensitiveMedia === true) {
|
|
166
|
-
normalized.push(payload);
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
const mediaUrls = resolveSendableOutboundReplyParts(payload).mediaUrls;
|
|
170
|
-
if (!mediaUrls.some((mediaUrl) => shouldPreserveDisplayMediaUrl(payload, mediaUrl))) {
|
|
171
|
-
normalized.push(await normalizeMediaPaths(payload));
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
if (!mediaUrls.some((mediaUrl) => !shouldPreserveDisplayMediaUrl(payload, mediaUrl))) {
|
|
175
|
-
normalized.push(payload);
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
const mergedMediaUrls = [];
|
|
179
|
-
let text = payload.text;
|
|
180
|
-
for (const mediaUrl of mediaUrls) {
|
|
181
|
-
if (shouldPreserveDisplayMediaUrl(payload, mediaUrl)) {
|
|
182
|
-
mergedMediaUrls.push(mediaUrl);
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
const normalizedMediaUrls = resolveSendableOutboundReplyParts(await normalizeMediaPaths({
|
|
186
|
-
...payload,
|
|
187
|
-
mediaUrl,
|
|
188
|
-
mediaUrls: [mediaUrl]
|
|
189
|
-
})).mediaUrls;
|
|
190
|
-
if (normalizedMediaUrls.length === 0) continue;
|
|
191
|
-
mergedMediaUrls.push(...normalizedMediaUrls);
|
|
192
|
-
}
|
|
193
|
-
normalized.push({
|
|
194
|
-
...payload,
|
|
195
|
-
text,
|
|
196
|
-
mediaUrl: mergedMediaUrls[0],
|
|
197
|
-
mediaUrls: mergedMediaUrls
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return normalized;
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region src/gateway/server-methods/chat-transcript-inject.ts
|
|
204
|
-
function resolveInjectedAssistantContent(params) {
|
|
205
|
-
const labelPrefix = params.label ? `[${params.label}]\n\n` : "";
|
|
206
|
-
if (params.content && params.content.length > 0) {
|
|
207
|
-
if (!labelPrefix) return params.content;
|
|
208
|
-
const first = params.content[0];
|
|
209
|
-
if (first && typeof first === "object" && first.type === "text" && typeof first.text === "string") return [{
|
|
210
|
-
...first,
|
|
211
|
-
text: `${labelPrefix}${first.text}`
|
|
212
|
-
}, ...params.content.slice(1)];
|
|
213
|
-
return [{
|
|
214
|
-
type: "text",
|
|
215
|
-
text: labelPrefix.trim()
|
|
216
|
-
}, ...params.content];
|
|
217
|
-
}
|
|
218
|
-
return [{
|
|
219
|
-
type: "text",
|
|
220
|
-
text: `${labelPrefix}${params.message}`
|
|
221
|
-
}];
|
|
222
|
-
}
|
|
223
|
-
async function appendInjectedAssistantMessageToTranscript(params) {
|
|
224
|
-
const now = params.now ?? Date.now();
|
|
225
|
-
const messageBody = {
|
|
226
|
-
role: "assistant",
|
|
227
|
-
content: resolveInjectedAssistantContent({
|
|
228
|
-
message: params.message,
|
|
229
|
-
label: params.label,
|
|
230
|
-
content: params.content
|
|
231
|
-
}),
|
|
232
|
-
timestamp: now,
|
|
233
|
-
stopReason: "stop",
|
|
234
|
-
usage: {
|
|
235
|
-
input: 0,
|
|
236
|
-
output: 0,
|
|
237
|
-
cacheRead: 0,
|
|
238
|
-
cacheWrite: 0,
|
|
239
|
-
totalTokens: 0,
|
|
240
|
-
cost: {
|
|
241
|
-
input: 0,
|
|
242
|
-
output: 0,
|
|
243
|
-
cacheRead: 0,
|
|
244
|
-
cacheWrite: 0,
|
|
245
|
-
total: 0
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
api: "openai-responses",
|
|
249
|
-
provider: "fengming",
|
|
250
|
-
model: "gateway-injected",
|
|
251
|
-
...params.idempotencyKey ? { idempotencyKey: params.idempotencyKey } : {},
|
|
252
|
-
...params.ttsSupplement ? { fengmingTtsSupplement: params.ttsSupplement } : {},
|
|
253
|
-
...params.abortMeta ? { fengmingAbort: {
|
|
254
|
-
aborted: true,
|
|
255
|
-
origin: params.abortMeta.origin,
|
|
256
|
-
runId: params.abortMeta.runId
|
|
257
|
-
} } : {}
|
|
258
|
-
};
|
|
259
|
-
try {
|
|
260
|
-
const { messageId, message: appendedMessage } = await appendSessionTranscriptMessage({
|
|
261
|
-
transcriptPath: params.transcriptPath,
|
|
262
|
-
message: messageBody,
|
|
263
|
-
now,
|
|
264
|
-
useRawWhenLinear: true,
|
|
265
|
-
config: params.config
|
|
266
|
-
});
|
|
267
|
-
emitSessionTranscriptUpdate({
|
|
268
|
-
sessionFile: params.transcriptPath,
|
|
269
|
-
...params.sessionKey ? { sessionKey: params.sessionKey } : {},
|
|
270
|
-
...params.agentId ? { agentId: params.agentId } : {},
|
|
271
|
-
message: appendedMessage,
|
|
272
|
-
messageId
|
|
273
|
-
});
|
|
274
|
-
return {
|
|
275
|
-
ok: true,
|
|
276
|
-
messageId,
|
|
277
|
-
message: appendedMessage
|
|
278
|
-
};
|
|
279
|
-
} catch (err) {
|
|
280
|
-
return {
|
|
281
|
-
ok: false,
|
|
282
|
-
error: formatErrorMessage(err)
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region src/gateway/server-methods/chat-webchat-media.ts
|
|
288
|
-
/** Cap local audio files exposed through assistant media. */
|
|
289
|
-
const MAX_WEBCHAT_AUDIO_BYTES = 15 * 1024 * 1024;
|
|
290
|
-
const MAX_WEBCHAT_IMAGE_DATA_URL_CHARS = 2e6;
|
|
291
|
-
const MAX_WEBCHAT_IMAGE_DATA_BYTES = 15e5;
|
|
292
|
-
const ALLOWED_WEBCHAT_DATA_IMAGE_MEDIA_TYPES = new Set([
|
|
293
|
-
"image/apng",
|
|
294
|
-
"image/avif",
|
|
295
|
-
"image/bmp",
|
|
296
|
-
"image/gif",
|
|
297
|
-
"image/jpeg",
|
|
298
|
-
"image/png",
|
|
299
|
-
"image/webp"
|
|
300
|
-
]);
|
|
301
|
-
const MIME_BY_EXT = {
|
|
302
|
-
".aac": "audio/aac",
|
|
303
|
-
".m4a": "audio/mp4",
|
|
304
|
-
".mp3": "audio/mpeg",
|
|
305
|
-
".oga": "audio/ogg",
|
|
306
|
-
".ogg": "audio/ogg",
|
|
307
|
-
".opus": "audio/opus",
|
|
308
|
-
".wav": "audio/wav",
|
|
309
|
-
".webm": "audio/webm"
|
|
310
|
-
};
|
|
311
|
-
/** Map `mediaUrl` strings to an absolute filesystem path for local embedding (plain paths or `file:` URLs). */
|
|
312
|
-
function resolveLocalMediaPathForEmbedding(raw) {
|
|
313
|
-
const trimmed = raw.trim();
|
|
314
|
-
if (!trimmed) return null;
|
|
315
|
-
if (/^data:/i.test(trimmed)) return null;
|
|
316
|
-
if (/^https?:/i.test(trimmed)) return null;
|
|
317
|
-
if (trimmed.startsWith("file:")) try {
|
|
318
|
-
const p = safeFileURLToPath(trimmed);
|
|
319
|
-
if (!path.isAbsolute(p)) return null;
|
|
320
|
-
return p;
|
|
321
|
-
} catch {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
if (!path.isAbsolute(trimmed)) return null;
|
|
325
|
-
try {
|
|
326
|
-
assertNoWindowsNetworkPath(trimmed, "Local media path");
|
|
327
|
-
} catch {
|
|
328
|
-
return null;
|
|
329
|
-
}
|
|
330
|
-
return trimmed;
|
|
331
|
-
}
|
|
332
|
-
async function readLocalAudioContentBlockForEmbedding(payload, raw, options) {
|
|
333
|
-
if (payload.trustedLocalMedia !== true) return null;
|
|
334
|
-
const resolved = resolveLocalMediaPathForEmbedding(raw);
|
|
335
|
-
if (!resolved) return null;
|
|
336
|
-
if (!isAudioFileName(resolved)) return null;
|
|
337
|
-
let opened;
|
|
338
|
-
try {
|
|
339
|
-
await assertLocalMediaAllowed(resolved, options?.localRoots);
|
|
340
|
-
opened = await openLocalFileSafely({ filePath: resolved });
|
|
341
|
-
await assertLocalMediaAllowed(opened.realPath, options?.localRoots);
|
|
342
|
-
if (opened.stat.size > MAX_WEBCHAT_AUDIO_BYTES) return null;
|
|
343
|
-
return {
|
|
344
|
-
path: opened.realPath,
|
|
345
|
-
block: {
|
|
346
|
-
type: "attachment",
|
|
347
|
-
attachment: {
|
|
348
|
-
url: opened.realPath,
|
|
349
|
-
kind: "audio",
|
|
350
|
-
label: path.basename(opened.realPath),
|
|
351
|
-
mimeType: mimeTypeForPath(opened.realPath),
|
|
352
|
-
...payload.audioAsVoice === true ? { isVoiceNote: true } : {}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
} catch (err) {
|
|
357
|
-
if (err instanceof LocalMediaAccessError) options?.onLocalAudioAccessDenied?.(err);
|
|
358
|
-
return null;
|
|
359
|
-
} finally {
|
|
360
|
-
await opened?.handle.close().catch(() => {});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function mimeTypeForPath(filePath) {
|
|
364
|
-
return MIME_BY_EXT[normalizeLowercaseStringOrEmpty(path.extname(filePath))] ?? "audio/mpeg";
|
|
365
|
-
}
|
|
366
|
-
function isBase64DataPayload(value) {
|
|
367
|
-
if (value.length === 0) return false;
|
|
368
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
369
|
-
const code = value.charCodeAt(index);
|
|
370
|
-
if (!(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47 || code === 61) && !(code === 9 || code === 10 || code === 11 || code === 12 || code === 13 || code === 32)) return false;
|
|
371
|
-
}
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
function resolveEmbeddableImageUrl(url) {
|
|
375
|
-
const trimmed = url.trim();
|
|
376
|
-
if (!trimmed) return null;
|
|
377
|
-
if (trimmed.length > MAX_WEBCHAT_IMAGE_DATA_URL_CHARS) return null;
|
|
378
|
-
const commaIndex = trimmed.indexOf(",");
|
|
379
|
-
if (commaIndex < 0) return null;
|
|
380
|
-
const metadata = trimmed.slice(0, commaIndex);
|
|
381
|
-
const match = /^data:(image\/[a-z0-9.+-]+);base64$/i.exec(metadata);
|
|
382
|
-
const base64Data = trimmed.slice(commaIndex + 1);
|
|
383
|
-
if (!match || !isBase64DataPayload(base64Data)) return null;
|
|
384
|
-
const mediaType = normalizeLowercaseStringOrEmpty(match[1]);
|
|
385
|
-
if (!ALLOWED_WEBCHAT_DATA_IMAGE_MEDIA_TYPES.has(mediaType)) return null;
|
|
386
|
-
if (estimateBase64DecodedBytes(base64Data) > MAX_WEBCHAT_IMAGE_DATA_BYTES) return null;
|
|
387
|
-
return trimmed;
|
|
388
|
-
}
|
|
389
|
-
function resolveReplyDirectivePrefix(payload) {
|
|
390
|
-
const replyToId = sanitizeReplyDirectiveId(payload.replyToId);
|
|
391
|
-
if (replyToId) return `[[reply_to:${replyToId}]]`;
|
|
392
|
-
if (payload.replyToCurrent) return "[[reply_to_current]]";
|
|
393
|
-
return "";
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Build Control UI / transcript `content` blocks for local TTS (or other) audio files
|
|
397
|
-
* referenced by slash-command / agent replies when the webchat path only had text aggregation.
|
|
398
|
-
*/
|
|
399
|
-
async function buildWebchatAudioContentBlocksFromReplyPayloads(payloads, options) {
|
|
400
|
-
const seen = /* @__PURE__ */ new Set();
|
|
401
|
-
const blocks = [];
|
|
402
|
-
for (const payload of payloads) {
|
|
403
|
-
if (payload.isReasoning === true) continue;
|
|
404
|
-
const parts = resolveSendableOutboundReplyParts(payload);
|
|
405
|
-
for (const raw of parts.mediaUrls) {
|
|
406
|
-
const url = raw.trim();
|
|
407
|
-
if (!url) continue;
|
|
408
|
-
const audio = await readLocalAudioContentBlockForEmbedding(payload, url, options);
|
|
409
|
-
if (!audio || seen.has(audio.path)) continue;
|
|
410
|
-
seen.add(audio.path);
|
|
411
|
-
blocks.push(audio.block);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return blocks;
|
|
415
|
-
}
|
|
416
|
-
async function buildWebchatAssistantMessageFromReplyPayloads(payloads, options) {
|
|
417
|
-
const content = [];
|
|
418
|
-
const transcriptTextParts = [];
|
|
419
|
-
const seenAudio = /* @__PURE__ */ new Set();
|
|
420
|
-
const seenImages = /* @__PURE__ */ new Set();
|
|
421
|
-
let hasAudio = false;
|
|
422
|
-
let hasImage = false;
|
|
423
|
-
for (const payload of payloads) {
|
|
424
|
-
if (payload.isReasoning === true) continue;
|
|
425
|
-
const visibleText = payload.text?.trim();
|
|
426
|
-
const text = visibleText && !isSuppressedControlReplyText(visibleText) ? visibleText : void 0;
|
|
427
|
-
const replyDirectivePrefix = resolveReplyDirectivePrefix(payload);
|
|
428
|
-
let payloadHasAudio = false;
|
|
429
|
-
let payloadHasImage = false;
|
|
430
|
-
const payloadMediaBlocks = [];
|
|
431
|
-
const parts = resolveSendableOutboundReplyParts(payload);
|
|
432
|
-
for (const raw of parts.mediaUrls) {
|
|
433
|
-
const url = raw.trim();
|
|
434
|
-
if (!url) continue;
|
|
435
|
-
const audio = await readLocalAudioContentBlockForEmbedding(payload, url, options);
|
|
436
|
-
if (audio) {
|
|
437
|
-
if (seenAudio.has(audio.path)) continue;
|
|
438
|
-
seenAudio.add(audio.path);
|
|
439
|
-
payloadMediaBlocks.push(audio.block);
|
|
440
|
-
hasAudio = true;
|
|
441
|
-
payloadHasAudio = true;
|
|
442
|
-
continue;
|
|
443
|
-
}
|
|
444
|
-
const imageUrl = resolveEmbeddableImageUrl(url);
|
|
445
|
-
if (!imageUrl || seenImages.has(imageUrl)) continue;
|
|
446
|
-
seenImages.add(imageUrl);
|
|
447
|
-
payloadMediaBlocks.push({
|
|
448
|
-
type: "input_image",
|
|
449
|
-
image_url: imageUrl
|
|
450
|
-
});
|
|
451
|
-
hasImage = true;
|
|
452
|
-
payloadHasImage = true;
|
|
453
|
-
}
|
|
454
|
-
const syntheticText = payloadMediaBlocks.length > 0 && (!text || replyDirectivePrefix) && transcriptTextParts.length === 0 ? payloadHasAudio && payloadHasImage ? "Media reply" : payloadHasAudio ? "Audio reply" : "Image reply" : void 0;
|
|
455
|
-
const blockText = text ?? syntheticText;
|
|
456
|
-
if (blockText) {
|
|
457
|
-
const fullText = replyDirectivePrefix ? `${replyDirectivePrefix}${blockText}` : blockText;
|
|
458
|
-
transcriptTextParts.push(fullText);
|
|
459
|
-
content.push({
|
|
460
|
-
type: "text",
|
|
461
|
-
text: fullText
|
|
462
|
-
});
|
|
463
|
-
} else if (replyDirectivePrefix) {
|
|
464
|
-
transcriptTextParts.push(replyDirectivePrefix);
|
|
465
|
-
content.push({
|
|
466
|
-
type: "text",
|
|
467
|
-
text: replyDirectivePrefix
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
content.push(...payloadMediaBlocks);
|
|
471
|
-
}
|
|
472
|
-
if (!hasAudio && !hasImage) return null;
|
|
473
|
-
const transcriptText = transcriptTextParts.join("\n\n").trim() || (hasAudio && hasImage ? "Media reply" : hasAudio ? "Audio reply" : "Image reply");
|
|
474
|
-
if (transcriptTextParts.length === 0) content.unshift({
|
|
475
|
-
type: "text",
|
|
476
|
-
text: transcriptText
|
|
477
|
-
});
|
|
478
|
-
return {
|
|
479
|
-
content,
|
|
480
|
-
transcriptText
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
//#endregion
|
|
484
|
-
//#region src/gateway/server-methods/chat.ts
|
|
485
|
-
function normalizeUnknownText(value) {
|
|
486
|
-
return typeof value === "string" ? normalizeOptionalText(value) : void 0;
|
|
487
|
-
}
|
|
488
|
-
/** True when a reply payload carries at least one media reference (mediaUrl or mediaUrls). */
|
|
489
|
-
function isMediaBearingPayload(payload) {
|
|
490
|
-
if (payload.isReasoning === true) return false;
|
|
491
|
-
if (payload.mediaUrl?.trim()) return true;
|
|
492
|
-
if (payload.mediaUrls?.some((url) => url.trim())) return true;
|
|
493
|
-
return false;
|
|
494
|
-
}
|
|
495
|
-
function stripVisibleTextFromTtsSupplement(payload) {
|
|
496
|
-
return isReplyPayloadTtsSupplement(payload) ? buildTtsSupplementMediaPayload(payload) : payload;
|
|
497
|
-
}
|
|
498
|
-
function resolveTtsSupplementMarkerText(text) {
|
|
499
|
-
const trimmed = text.trim();
|
|
500
|
-
const projected = projectChatDisplayMessage({
|
|
501
|
-
role: "assistant",
|
|
502
|
-
content: [{
|
|
503
|
-
type: "text",
|
|
504
|
-
text: trimmed
|
|
505
|
-
}]
|
|
506
|
-
}, { maxChars: Number.MAX_SAFE_INTEGER });
|
|
507
|
-
return extractAssistantDisplayTextFromContent(Array.isArray(projected?.content) ? projected.content : void 0) ?? (typeof projected?.text === "string" ? projected.text.trim() : void 0) ?? trimmed;
|
|
508
|
-
}
|
|
509
|
-
function buildTtsSupplementTranscriptMarker(payload) {
|
|
510
|
-
const supplement = getReplyPayloadTtsSupplement(payload);
|
|
511
|
-
if (!supplement) return;
|
|
512
|
-
const visibleText = resolveTtsSupplementMarkerText(payload.text?.trim() || supplement.spokenText.trim());
|
|
513
|
-
return { textSha256: createHash("sha256").update(visibleText).digest("hex") };
|
|
514
|
-
}
|
|
515
|
-
function buildMediaOnlyTtsSupplementTranscriptMarker(payload) {
|
|
516
|
-
if (payload.text?.trim()) return;
|
|
517
|
-
return buildTtsSupplementTranscriptMarker(payload);
|
|
518
|
-
}
|
|
519
|
-
async function buildWebchatAssistantMediaMessage(payloads, options) {
|
|
520
|
-
return buildWebchatAssistantMessageFromReplyPayloads(payloads, {
|
|
521
|
-
localRoots: options?.localRoots,
|
|
522
|
-
onLocalAudioAccessDenied: (err) => {
|
|
523
|
-
options?.onLocalAudioAccessDenied?.(formatForLog(err));
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
const CHAT_HISTORY_MAX_SINGLE_MESSAGE_BYTES = 128 * 1024;
|
|
528
|
-
const CHAT_HISTORY_OVERSIZED_PLACEHOLDER = "[chat.history omitted: message too large]";
|
|
529
|
-
const MANAGED_OUTGOING_IMAGE_PATH_PREFIX = "/api/chat/media/outgoing/";
|
|
530
|
-
let chatHistoryPlaceholderEmitCount = 0;
|
|
531
|
-
const chatHistoryManagedImageCleanupState = /* @__PURE__ */ new Map();
|
|
532
|
-
const CHANNEL_AGNOSTIC_SESSION_SCOPES = new Set([
|
|
533
|
-
"main",
|
|
534
|
-
"direct",
|
|
535
|
-
"dm",
|
|
536
|
-
"group",
|
|
537
|
-
"channel",
|
|
538
|
-
"cron",
|
|
539
|
-
"run",
|
|
540
|
-
"subagent",
|
|
541
|
-
"acp",
|
|
542
|
-
"thread",
|
|
543
|
-
"topic"
|
|
544
|
-
]);
|
|
545
|
-
const CHANNEL_SCOPED_SESSION_SHAPES = new Set([
|
|
546
|
-
"direct",
|
|
547
|
-
"dm",
|
|
548
|
-
"group",
|
|
549
|
-
"channel"
|
|
550
|
-
]);
|
|
551
|
-
const ACTIVE_CHAT_SEND_DEDUPE_PREFIX = "chat:active-send";
|
|
552
|
-
function resolveActiveChatSendRunId(value) {
|
|
553
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
554
|
-
const runId = value.runId;
|
|
555
|
-
return typeof runId === "string" && runId.trim() ? runId : null;
|
|
556
|
-
}
|
|
557
|
-
function buildActiveChatSendDedupeKey(params) {
|
|
558
|
-
const message = params.message.trim();
|
|
559
|
-
if (!message || message.startsWith("/") || params.attachmentCount > 0 || params.explicitDeliverRoute || normalizeMessageChannel(params.originatingChannel) !== "webchat") return null;
|
|
560
|
-
return `${ACTIVE_CHAT_SEND_DEDUPE_PREFIX}:${createHash("sha256").update(JSON.stringify([params.sessionKey, message])).digest("hex").slice(0, 32)}`;
|
|
561
|
-
}
|
|
562
|
-
function validateChatSelectedAgent(params) {
|
|
563
|
-
const agentId = params.agentId ? normalizeAgentId(params.agentId) : void 0;
|
|
564
|
-
if (!agentId) return { ok: true };
|
|
565
|
-
if (!listAgentIds(params.cfg).includes(agentId)) return {
|
|
566
|
-
ok: false,
|
|
567
|
-
error: `Unknown agent id "${params.agentId}"`
|
|
568
|
-
};
|
|
569
|
-
const requestedSessionKey = params.requestedSessionKey.trim();
|
|
570
|
-
const parsed = parseAgentSessionKey(requestedSessionKey);
|
|
571
|
-
if (parsed && normalizeAgentId(parsed.agentId) !== agentId) return {
|
|
572
|
-
ok: false,
|
|
573
|
-
error: `agentId "${params.agentId}" does not match session key "${params.requestedSessionKey}"`
|
|
574
|
-
};
|
|
575
|
-
if (requestedSessionKey.toLowerCase() === "global") return {
|
|
576
|
-
ok: true,
|
|
577
|
-
agentId
|
|
578
|
-
};
|
|
579
|
-
if (resolveSessionStoreKey({
|
|
580
|
-
cfg: params.cfg,
|
|
581
|
-
sessionKey: requestedSessionKey
|
|
582
|
-
}) === "global") return {
|
|
583
|
-
ok: true,
|
|
584
|
-
agentId
|
|
585
|
-
};
|
|
586
|
-
if (!parsed || normalizeAgentId(parsed.agentId) !== agentId) return {
|
|
587
|
-
ok: false,
|
|
588
|
-
error: `agentId "${params.agentId}" does not match session key "${params.requestedSessionKey}"`
|
|
589
|
-
};
|
|
590
|
-
return {
|
|
591
|
-
ok: true,
|
|
592
|
-
agentId
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
function resolveRequestedChatAgentId(params) {
|
|
596
|
-
const explicitAgentId = normalizeOptionalText(params.agentId);
|
|
597
|
-
if (explicitAgentId) return normalizeAgentId(explicitAgentId);
|
|
598
|
-
if (!params.cfg) return;
|
|
599
|
-
const parsed = parseAgentSessionKey(params.requestedSessionKey.trim());
|
|
600
|
-
if (!parsed?.agentId || resolveSessionStoreKey({
|
|
601
|
-
cfg: params.cfg,
|
|
602
|
-
sessionKey: params.requestedSessionKey
|
|
603
|
-
}) !== "global") return;
|
|
604
|
-
return normalizeAgentId(parsed.agentId);
|
|
605
|
-
}
|
|
606
|
-
function resolveChatSendActiveScopeKey(params) {
|
|
607
|
-
if (params.sessionKey !== "global" || !params.agentId) return params.sessionKey;
|
|
608
|
-
return scopeLegacySessionKeyToAgent({
|
|
609
|
-
agentId: params.agentId,
|
|
610
|
-
sessionKey: params.sessionKey,
|
|
611
|
-
mainKey: params.mainKey
|
|
612
|
-
}) ?? params.sessionKey;
|
|
613
|
-
}
|
|
614
|
-
function formatAttachmentFailureForLog(err) {
|
|
615
|
-
const primary = formatUncaughtError(err);
|
|
616
|
-
const cause = err instanceof Error ? err.cause : void 0;
|
|
617
|
-
if (cause === void 0) return primary;
|
|
618
|
-
const causeText = formatUncaughtError(cause);
|
|
619
|
-
if (!causeText || causeText === primary) return primary;
|
|
620
|
-
return `${primary}\nCaused by: ${causeText}`;
|
|
621
|
-
}
|
|
622
|
-
function logAttachmentFailure(logGateway, label, err) {
|
|
623
|
-
logGateway.error(label, {
|
|
624
|
-
error: formatAttachmentFailureForLog(err),
|
|
625
|
-
consoleMessage: `${label}: ${formatForLog(err)}`
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
function buildTranscriptReplyText(payloads) {
|
|
629
|
-
return payloads.map((payload) => {
|
|
630
|
-
if (payload.isReasoning === true) return "";
|
|
631
|
-
const parts = resolveSendableOutboundReplyParts(payload);
|
|
632
|
-
const lines = [];
|
|
633
|
-
const replyToId = sanitizeReplyDirectiveId(payload.replyToId);
|
|
634
|
-
if (replyToId) lines.push(`[[reply_to:${replyToId}]]`);
|
|
635
|
-
else if (payload.replyToCurrent) lines.push("[[reply_to_current]]");
|
|
636
|
-
const text = payload.text?.trim();
|
|
637
|
-
if (text && !isSuppressedControlReplyText(text)) lines.push(text);
|
|
638
|
-
for (const mediaUrl of parts.mediaUrls) {
|
|
639
|
-
if (payload.sensitiveMedia === true) continue;
|
|
640
|
-
const trimmed = mediaUrl.trim();
|
|
641
|
-
if (trimmed) lines.push(`MEDIA:${trimmed}`);
|
|
642
|
-
}
|
|
643
|
-
if (payload.audioAsVoice && parts.mediaUrls.some((mediaUrl) => isAudioFileName(mediaUrl))) lines.push("[[audio_as_voice]]");
|
|
644
|
-
return lines.join("\n").trim();
|
|
645
|
-
}).filter(Boolean).join("\n\n").trim();
|
|
646
|
-
}
|
|
647
|
-
function hasSensitiveMediaPayload(payloads) {
|
|
648
|
-
return payloads.some((payload) => payload.sensitiveMedia === true && isMediaBearingPayload(payload));
|
|
649
|
-
}
|
|
650
|
-
function sanitizeAssistantDisplayText(value) {
|
|
651
|
-
if (!value) return;
|
|
652
|
-
const withoutEnvelope = stripEnvelopeFromMessage(value);
|
|
653
|
-
return stripInlineDirectiveTagsForDisplay(typeof withoutEnvelope === "string" ? withoutEnvelope : value).text.trim() || void 0;
|
|
654
|
-
}
|
|
655
|
-
function extractAssistantDisplayTextFromContent(content) {
|
|
656
|
-
if (!Array.isArray(content) || content.length === 0) return;
|
|
657
|
-
const parts = content.map((block) => {
|
|
658
|
-
if (block?.type !== "text" || typeof block.text !== "string") return "";
|
|
659
|
-
return block.text.trim();
|
|
660
|
-
}).filter(Boolean);
|
|
661
|
-
return parts.length > 0 ? parts.join("\n\n") : void 0;
|
|
662
|
-
}
|
|
663
|
-
async function buildAssistantDisplayContentFromReplyPayloads(params) {
|
|
664
|
-
const rawTextPayloadCount = params.payloads.filter((payload) => payload.isReasoning !== true && typeof payload.text === "string" && payload.text.trim().length > 0).length;
|
|
665
|
-
const normalized = normalizeReplyPayloadsForDelivery(params.payloads);
|
|
666
|
-
if (normalized.length === 0) return rawTextPayloadCount > 0 ? [{
|
|
667
|
-
type: "text",
|
|
668
|
-
text: ""
|
|
669
|
-
}] : void 0;
|
|
670
|
-
const content = [];
|
|
671
|
-
let strippedTextPayloadCount = 0;
|
|
672
|
-
for (const payload of normalized) {
|
|
673
|
-
const text = sanitizeAssistantDisplayText(payload.text);
|
|
674
|
-
if (text) content.push({
|
|
675
|
-
type: "text",
|
|
676
|
-
text
|
|
677
|
-
});
|
|
678
|
-
else if (typeof payload.text === "string" && payload.text.trim().length > 0) strippedTextPayloadCount += 1;
|
|
679
|
-
if (params.includeSensitiveMedia === false && payload.sensitiveMedia === true) continue;
|
|
680
|
-
const audioBlocks = await buildWebchatAudioContentBlocksFromReplyPayloads([payload], {
|
|
681
|
-
localRoots: Array.isArray(params.managedImageLocalRoots) ? params.managedImageLocalRoots : void 0,
|
|
682
|
-
onLocalAudioAccessDenied: (err) => {
|
|
683
|
-
params.onLocalAudioAccessDenied?.(formatForLog(err));
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
content.push(...audioBlocks);
|
|
687
|
-
const mediaUrls = Array.from(new Set([...Array.isArray(payload.mediaUrls) ? payload.mediaUrls : [], ...typeof payload.mediaUrl === "string" ? [payload.mediaUrl] : []]));
|
|
688
|
-
const imageBlocks = await createManagedOutgoingImageBlocks({
|
|
689
|
-
sessionKey: params.sessionKey,
|
|
690
|
-
...params.sessionKey === "global" && params.agentId ? { agentId: params.agentId } : {},
|
|
691
|
-
mediaUrls,
|
|
692
|
-
localRoots: params.managedImageLocalRoots,
|
|
693
|
-
continueOnPrepareError: true,
|
|
694
|
-
onPrepareError: (error) => {
|
|
695
|
-
params.onManagedImagePrepareError?.(error.message);
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
if (imageBlocks.length > 0) content.push(...imageBlocks);
|
|
699
|
-
}
|
|
700
|
-
if (content.length > 0) return content;
|
|
701
|
-
return strippedTextPayloadCount > 0 ? [{
|
|
702
|
-
type: "text",
|
|
703
|
-
text: ""
|
|
704
|
-
}] : void 0;
|
|
705
|
-
}
|
|
706
|
-
function replaceAssistantContentTextBlocks(content, transcriptMediaMessage) {
|
|
707
|
-
const transcriptTextBlocks = (transcriptMediaMessage?.content ?? []).filter((block) => Boolean(block) && typeof block === "object" && block.type === "text" && typeof block.text === "string");
|
|
708
|
-
if (transcriptTextBlocks.length === 0) return content ? [...content] : void 0;
|
|
709
|
-
if (!content || content.length === 0) return [...transcriptTextBlocks];
|
|
710
|
-
const merged = [];
|
|
711
|
-
let transcriptTextIndex = 0;
|
|
712
|
-
for (const block of content) {
|
|
713
|
-
if (block?.type === "text" && typeof block.text === "string" && transcriptTextIndex < transcriptTextBlocks.length) {
|
|
714
|
-
merged.push(transcriptTextBlocks[transcriptTextIndex++]);
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
merged.push(block);
|
|
718
|
-
}
|
|
719
|
-
if (transcriptTextIndex < transcriptTextBlocks.length) merged.unshift(...transcriptTextBlocks.slice(transcriptTextIndex));
|
|
720
|
-
return merged;
|
|
721
|
-
}
|
|
722
|
-
function isManagedOutgoingImageUrl(value) {
|
|
723
|
-
if (typeof value !== "string" || !value.trim()) return false;
|
|
724
|
-
try {
|
|
725
|
-
return new URL(value, "http://localhost").pathname.startsWith(MANAGED_OUTGOING_IMAGE_PATH_PREFIX);
|
|
726
|
-
} catch {
|
|
727
|
-
return false;
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
function stripManagedOutgoingAssistantContentBlocks(content) {
|
|
731
|
-
if (!content || content.length === 0) return;
|
|
732
|
-
const filtered = content.filter((block) => {
|
|
733
|
-
if (block?.type !== "image") return true;
|
|
734
|
-
return !(isManagedOutgoingImageUrl(block.url) || isManagedOutgoingImageUrl(block.openUrl));
|
|
735
|
-
});
|
|
736
|
-
return filtered.length > 0 ? filtered : void 0;
|
|
737
|
-
}
|
|
738
|
-
function extractAssistantDisplayText(content) {
|
|
739
|
-
if (!content || content.length === 0) return;
|
|
740
|
-
return content.map((block) => block?.type === "text" && typeof block.text === "string" ? block.text : "").filter(Boolean).join("\n\n").trim() || void 0;
|
|
741
|
-
}
|
|
742
|
-
function hasAssistantDisplayMediaContent(content) {
|
|
743
|
-
return Boolean(content?.some((block) => block?.type !== "text"));
|
|
744
|
-
}
|
|
745
|
-
function hasManagedOutgoingAssistantContent(content) {
|
|
746
|
-
return Boolean(content?.some((block) => block?.type === "image" && (isManagedOutgoingImageUrl(block.url) || isManagedOutgoingImageUrl(block.openUrl))));
|
|
747
|
-
}
|
|
748
|
-
function scheduleChatHistoryManagedImageCleanup(params) {
|
|
749
|
-
const cleanupKey = params.sessionKey === "global" && params.agentId ? `agent:${params.agentId}:global` : params.sessionKey;
|
|
750
|
-
if (chatHistoryManagedImageCleanupState.has(cleanupKey)) return;
|
|
751
|
-
const pending = cleanupManagedOutgoingImageRecords({
|
|
752
|
-
sessionKey: params.sessionKey,
|
|
753
|
-
...params.sessionKey === "global" && params.agentId ? { agentId: params.agentId } : {}
|
|
754
|
-
}).then(() => void 0).catch((error) => {
|
|
755
|
-
params.context.logGateway.debug(`chat.history managed image cleanup skipped sessionKey=${JSON.stringify(params.sessionKey)} error=${formatForLog(error)}`);
|
|
756
|
-
}).finally(() => {
|
|
757
|
-
if (chatHistoryManagedImageCleanupState.get(cleanupKey) === pending) chatHistoryManagedImageCleanupState.delete(cleanupKey);
|
|
758
|
-
});
|
|
759
|
-
chatHistoryManagedImageCleanupState.set(cleanupKey, pending);
|
|
760
|
-
}
|
|
761
|
-
function resolveChatSendOriginatingRoute(params) {
|
|
762
|
-
if (params.explicitOrigin?.originatingChannel && params.explicitOrigin.originatingTo) return {
|
|
763
|
-
originatingChannel: params.explicitOrigin.originatingChannel,
|
|
764
|
-
originatingTo: params.explicitOrigin.originatingTo,
|
|
765
|
-
...params.explicitOrigin.accountId ? { accountId: params.explicitOrigin.accountId } : {},
|
|
766
|
-
...params.explicitOrigin.messageThreadId ? { messageThreadId: params.explicitOrigin.messageThreadId } : {},
|
|
767
|
-
explicitDeliverRoute: params.deliver === true
|
|
768
|
-
};
|
|
769
|
-
if (!(params.deliver === true)) return {
|
|
770
|
-
originatingChannel: INTERNAL_MESSAGE_CHANNEL,
|
|
771
|
-
explicitDeliverRoute: false
|
|
772
|
-
};
|
|
773
|
-
const sessionDeliveryContext = deliveryContextFromSession(params.entry);
|
|
774
|
-
const routeChannelCandidate = normalizeMessageChannel(sessionDeliveryContext?.channel ?? params.entry?.lastChannel ?? params.entry?.origin?.provider);
|
|
775
|
-
const routeToCandidate = sessionDeliveryContext?.to ?? params.entry?.lastTo;
|
|
776
|
-
const routeAccountIdCandidate = sessionDeliveryContext?.accountId ?? params.entry?.lastAccountId ?? params.entry?.origin?.accountId ?? void 0;
|
|
777
|
-
const routeThreadIdCandidate = sessionDeliveryContext?.threadId ?? params.entry?.lastThreadId ?? params.entry?.origin?.threadId;
|
|
778
|
-
if (params.sessionKey.length > 512) return {
|
|
779
|
-
originatingChannel: INTERNAL_MESSAGE_CHANNEL,
|
|
780
|
-
explicitDeliverRoute: false
|
|
781
|
-
};
|
|
782
|
-
const sessionScopeParts = (parseAgentSessionKey(params.sessionKey)?.rest ?? params.sessionKey).split(":", 3).filter(Boolean);
|
|
783
|
-
const sessionScopeHead = sessionScopeParts[0];
|
|
784
|
-
const sessionChannelHint = normalizeMessageChannel(sessionScopeHead);
|
|
785
|
-
const normalizedSessionScopeHead = (sessionScopeHead ?? "").trim().toLowerCase();
|
|
786
|
-
const sessionPeerShapeCandidates = [sessionScopeParts[1], sessionScopeParts[2]].map((part) => (part ?? "").trim().toLowerCase()).filter(Boolean);
|
|
787
|
-
const isChannelAgnosticSessionScope = CHANNEL_AGNOSTIC_SESSION_SCOPES.has(normalizedSessionScopeHead);
|
|
788
|
-
const isChannelScopedSession = sessionPeerShapeCandidates.some((part) => CHANNEL_SCOPED_SESSION_SHAPES.has(part));
|
|
789
|
-
const hasLegacyChannelPeerShape = !isChannelScopedSession && typeof sessionScopeParts[1] === "string" && sessionChannelHint === routeChannelCandidate;
|
|
790
|
-
const isFromWebchatClient = isWebchatClient(params.client);
|
|
791
|
-
const isFromGatewayCliClient = isGatewayCliClient(params.client);
|
|
792
|
-
const hasClientMetadata = typeof params.client?.mode === "string" && params.client.mode.trim().length > 0 || typeof params.client?.id === "string" && params.client.id.trim().length > 0;
|
|
793
|
-
const configuredMainKey = (params.mainKey ?? "main").trim().toLowerCase();
|
|
794
|
-
const canInheritConfiguredMainRoute = normalizedSessionScopeHead.length > 0 && normalizedSessionScopeHead === configuredMainKey && params.hasConnectedClient && (isFromGatewayCliClient || !hasClientMetadata);
|
|
795
|
-
if (!(Boolean(!isFromWebchatClient && sessionChannelHint && sessionChannelHint !== "webchat" && (!isChannelAgnosticSessionScope && (isChannelScopedSession || hasLegacyChannelPeerShape) || canInheritConfiguredMainRoute)) && routeChannelCandidate && routeChannelCandidate !== "webchat" && typeof routeToCandidate === "string" && routeToCandidate.trim().length > 0)) return {
|
|
796
|
-
originatingChannel: INTERNAL_MESSAGE_CHANNEL,
|
|
797
|
-
explicitDeliverRoute: false
|
|
798
|
-
};
|
|
799
|
-
return {
|
|
800
|
-
originatingChannel: routeChannelCandidate,
|
|
801
|
-
originatingTo: routeToCandidate,
|
|
802
|
-
accountId: routeAccountIdCandidate,
|
|
803
|
-
messageThreadId: routeThreadIdCandidate,
|
|
804
|
-
explicitDeliverRoute: true
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
function isAcpSessionKey(sessionKey) {
|
|
808
|
-
return Boolean(sessionKey?.split(":").includes("acp"));
|
|
809
|
-
}
|
|
810
|
-
function explicitOriginTargetsAcpSession(origin) {
|
|
811
|
-
if (!origin?.originatingChannel || !origin.originatingTo || !origin.accountId) return false;
|
|
812
|
-
const channel = normalizeMessageChannel(origin.originatingChannel);
|
|
813
|
-
if (!channel || channel === "webchat") return false;
|
|
814
|
-
return isAcpSessionKey(getSessionBindingService().resolveByConversation({
|
|
815
|
-
channel,
|
|
816
|
-
accountId: origin.accountId,
|
|
817
|
-
conversationId: origin.originatingTo
|
|
818
|
-
})?.targetSessionKey);
|
|
819
|
-
}
|
|
820
|
-
function explicitOriginTargetsPluginBinding(origin) {
|
|
821
|
-
if (!origin?.originatingChannel || !origin.originatingTo || !origin.accountId) return false;
|
|
822
|
-
const channel = normalizeMessageChannel(origin.originatingChannel);
|
|
823
|
-
if (!channel || channel === "webchat") return false;
|
|
824
|
-
return isPluginOwnedSessionBindingRecord(getSessionBindingService().resolveByConversation({
|
|
825
|
-
channel,
|
|
826
|
-
accountId: origin.accountId,
|
|
827
|
-
conversationId: origin.originatingTo
|
|
828
|
-
}));
|
|
829
|
-
}
|
|
830
|
-
function stripDisallowedChatControlChars(message) {
|
|
831
|
-
let output = "";
|
|
832
|
-
for (const char of message) {
|
|
833
|
-
const code = char.charCodeAt(0);
|
|
834
|
-
if (code === 9 || code === 10 || code === 13 || code >= 32 && code !== 127) output += char;
|
|
835
|
-
}
|
|
836
|
-
return output;
|
|
837
|
-
}
|
|
838
|
-
function sanitizeChatSendMessageInput(message) {
|
|
839
|
-
const normalized = message.normalize("NFC");
|
|
840
|
-
if (normalized.includes("\0")) return {
|
|
841
|
-
ok: false,
|
|
842
|
-
error: "message must not contain null bytes"
|
|
843
|
-
};
|
|
844
|
-
return {
|
|
845
|
-
ok: true,
|
|
846
|
-
message: stripDisallowedChatControlChars(normalized)
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
function normalizeOptionalChatSystemReceipt(value) {
|
|
850
|
-
if (value == null) return { ok: true };
|
|
851
|
-
if (typeof value !== "string") return {
|
|
852
|
-
ok: false,
|
|
853
|
-
error: "systemProvenanceReceipt must be a string"
|
|
854
|
-
};
|
|
855
|
-
const sanitized = sanitizeChatSendMessageInput(value);
|
|
856
|
-
if (!sanitized.ok) return sanitized;
|
|
857
|
-
return {
|
|
858
|
-
ok: true,
|
|
859
|
-
receipt: sanitized.message.trim() || void 0
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
function isAcpBridgeClient(client) {
|
|
863
|
-
const info = client?.connect?.client;
|
|
864
|
-
return info?.id === GATEWAY_CLIENT_NAMES.CLI && info?.mode === GATEWAY_CLIENT_MODES.CLI && info?.displayName === "ACP" && info?.version === "acp";
|
|
865
|
-
}
|
|
866
|
-
function canInjectSystemProvenance(client) {
|
|
867
|
-
return (Array.isArray(client?.connect?.scopes) ? client.connect.scopes : []).includes(ADMIN_SCOPE);
|
|
868
|
-
}
|
|
869
|
-
async function persistChatSendImages(params) {
|
|
870
|
-
if (params.images.length === 0 && params.offloadedRefs.length === 0 || isAcpBridgeClient(params.client)) return [];
|
|
871
|
-
const inlineSaved = [];
|
|
872
|
-
for (const img of params.images) try {
|
|
873
|
-
inlineSaved.push(await saveMediaBuffer(Buffer.from(img.data, "base64"), img.mimeType, "inbound"));
|
|
874
|
-
} catch (err) {
|
|
875
|
-
params.logGateway.warn(`chat.send: failed to persist inbound image (${img.mimeType}): ${formatForLog(err)}`);
|
|
876
|
-
}
|
|
877
|
-
const imageOffloadedSaved = [];
|
|
878
|
-
const nonImageOffloadedSaved = [];
|
|
879
|
-
for (const ref of params.offloadedRefs) {
|
|
880
|
-
const entry = {
|
|
881
|
-
id: ref.id,
|
|
882
|
-
path: ref.path,
|
|
883
|
-
size: 0,
|
|
884
|
-
contentType: ref.mimeType
|
|
885
|
-
};
|
|
886
|
-
if (ref.mimeType.startsWith("image/")) imageOffloadedSaved.push(entry);
|
|
887
|
-
else nonImageOffloadedSaved.push(entry);
|
|
888
|
-
}
|
|
889
|
-
if (params.imageOrder.length === 0) return [
|
|
890
|
-
...inlineSaved,
|
|
891
|
-
...imageOffloadedSaved,
|
|
892
|
-
...nonImageOffloadedSaved
|
|
893
|
-
];
|
|
894
|
-
const saved = [];
|
|
895
|
-
let inlineIndex = 0;
|
|
896
|
-
let offloadedIndex = 0;
|
|
897
|
-
for (const entry of params.imageOrder) {
|
|
898
|
-
if (entry === "inline") {
|
|
899
|
-
const inline = inlineSaved[inlineIndex++];
|
|
900
|
-
if (inline) saved.push(inline);
|
|
901
|
-
continue;
|
|
902
|
-
}
|
|
903
|
-
const offloaded = imageOffloadedSaved[offloadedIndex++];
|
|
904
|
-
if (offloaded) saved.push(offloaded);
|
|
905
|
-
}
|
|
906
|
-
for (; inlineIndex < inlineSaved.length; inlineIndex++) {
|
|
907
|
-
const inline = inlineSaved[inlineIndex];
|
|
908
|
-
if (inline) saved.push(inline);
|
|
909
|
-
}
|
|
910
|
-
for (; offloadedIndex < imageOffloadedSaved.length; offloadedIndex++) {
|
|
911
|
-
const offloaded = imageOffloadedSaved[offloadedIndex];
|
|
912
|
-
if (offloaded) saved.push(offloaded);
|
|
913
|
-
}
|
|
914
|
-
for (const offloaded of nonImageOffloadedSaved) saved.push(offloaded);
|
|
915
|
-
return saved;
|
|
916
|
-
}
|
|
917
|
-
function stripTrailingOffloadedMediaMarkers(message, refs) {
|
|
918
|
-
if (refs.length === 0) return message;
|
|
919
|
-
const removableRefs = new Set(refs.map((ref) => ref.mediaRef));
|
|
920
|
-
const lines = message.split(/\r?\n/);
|
|
921
|
-
while (lines.length > 0) {
|
|
922
|
-
const last = lines[lines.length - 1]?.trim() ?? "";
|
|
923
|
-
const match = /^\[media attached:\s*(media:\/\/inbound\/[^\]\s]+)\]$/.exec(last);
|
|
924
|
-
if (!match?.[1] || !removableRefs.delete(match[1])) break;
|
|
925
|
-
lines.pop();
|
|
926
|
-
}
|
|
927
|
-
return lines.join("\n").trimEnd();
|
|
928
|
-
}
|
|
929
|
-
async function prestageMediaPathOffloads(params) {
|
|
930
|
-
const mediaPathRefs = params.offloadedRefs.filter((ref) => params.includeImageRefs || !ref.mimeType.startsWith("image/"));
|
|
931
|
-
if (mediaPathRefs.length === 0) return {
|
|
932
|
-
paths: [],
|
|
933
|
-
types: []
|
|
934
|
-
};
|
|
935
|
-
try {
|
|
936
|
-
const workspaceDir = resolveAgentWorkspaceDir(params.cfg, params.agentId);
|
|
937
|
-
const sandbox = await ensureSandboxWorkspaceForSession({
|
|
938
|
-
config: params.cfg,
|
|
939
|
-
sessionKey: params.sessionKey,
|
|
940
|
-
workspaceDir
|
|
941
|
-
});
|
|
942
|
-
if (!sandbox) return {
|
|
943
|
-
paths: mediaPathRefs.map((ref) => ref.path),
|
|
944
|
-
types: mediaPathRefs.map((ref) => ref.mimeType)
|
|
945
|
-
};
|
|
946
|
-
const oversizedForSandbox = mediaPathRefs.filter((ref) => ref.sizeBytes > MEDIA_MAX_BYTES);
|
|
947
|
-
if (oversizedForSandbox.length > 0) throw new UnsupportedAttachmentError("non-image-too-large-for-sandbox", `attachments exceed sandbox staging limit (${MEDIA_MAX_BYTES} bytes): ${oversizedForSandbox.map((ref) => `${ref.label} (${ref.sizeBytes} bytes)`).join(", ")}`);
|
|
948
|
-
const stagingCtx = {
|
|
949
|
-
MediaPath: mediaPathRefs[0].path,
|
|
950
|
-
MediaPaths: mediaPathRefs.map((ref) => ref.path),
|
|
951
|
-
MediaType: mediaPathRefs[0].mimeType,
|
|
952
|
-
MediaTypes: mediaPathRefs.map((ref) => ref.mimeType)
|
|
953
|
-
};
|
|
954
|
-
const stagedSources = (await stageSandboxMedia({
|
|
955
|
-
ctx: stagingCtx,
|
|
956
|
-
sessionCtx: stagingCtx,
|
|
957
|
-
cfg: params.cfg,
|
|
958
|
-
sessionKey: params.sessionKey,
|
|
959
|
-
workspaceDir
|
|
960
|
-
})).staged;
|
|
961
|
-
const missing = mediaPathRefs.filter((ref) => !stagedSources.has(ref.path));
|
|
962
|
-
if (missing.length > 0) throw new Error(`attachment staging incomplete: ${stagedSources.size}/${mediaPathRefs.length} paths staged into sandbox workspace (missing: ${missing.map((ref) => ref.path).join(", ")})`);
|
|
963
|
-
return {
|
|
964
|
-
paths: stagingCtx.MediaPaths ?? [],
|
|
965
|
-
types: stagingCtx.MediaTypes ?? mediaPathRefs.map((ref) => ref.mimeType),
|
|
966
|
-
workspaceDir: sandbox.workspaceDir
|
|
967
|
-
};
|
|
968
|
-
} catch (err) {
|
|
969
|
-
await Promise.allSettled(params.offloadedRefs.map((ref) => deleteMediaBuffer(ref.id, "inbound")));
|
|
970
|
-
if (err instanceof MediaOffloadError) throw err;
|
|
971
|
-
if (err instanceof UnsupportedAttachmentError) throw err;
|
|
972
|
-
throw new MediaOffloadError(`[Gateway Error] Failed to stage attachments into agent workspace: ${formatErrorMessage(err)}`, { cause: err });
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
function resolveChatSendManagedMediaFields(savedImages) {
|
|
976
|
-
const mediaPaths = savedImages.map((entry) => entry.path);
|
|
977
|
-
if (mediaPaths.length === 0) return {};
|
|
978
|
-
const mediaTypes = savedImages.map((entry) => entry.contentType ?? "application/octet-stream");
|
|
979
|
-
return {
|
|
980
|
-
MediaPath: mediaPaths[0],
|
|
981
|
-
MediaPaths: mediaPaths,
|
|
982
|
-
MediaType: mediaTypes[0],
|
|
983
|
-
MediaTypes: mediaTypes
|
|
984
|
-
};
|
|
985
|
-
}
|
|
986
|
-
function applyChatSendManagedMediaFields(ctx, fields) {
|
|
987
|
-
if (!ctx.MediaStaged) {
|
|
988
|
-
Object.assign(ctx, fields);
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
if (ctx.MediaPath === void 0 && fields.MediaPath !== void 0) ctx.MediaPath = fields.MediaPath;
|
|
992
|
-
if (ctx.MediaPaths === void 0 && fields.MediaPaths !== void 0) ctx.MediaPaths = fields.MediaPaths;
|
|
993
|
-
if (ctx.MediaType === void 0 && fields.MediaType !== void 0) ctx.MediaType = fields.MediaType;
|
|
994
|
-
if (ctx.MediaTypes === void 0 && fields.MediaTypes !== void 0) ctx.MediaTypes = fields.MediaTypes;
|
|
995
|
-
}
|
|
996
|
-
function buildChatSendUserTurnMedia(savedMedia) {
|
|
997
|
-
return savedMedia.map((entry) => ({
|
|
998
|
-
path: entry.path,
|
|
999
|
-
contentType: entry.contentType
|
|
1000
|
-
}));
|
|
1001
|
-
}
|
|
1002
|
-
function extractChatHistoryBlockText(message) {
|
|
1003
|
-
if (!message || typeof message !== "object") return;
|
|
1004
|
-
const entry = message;
|
|
1005
|
-
if (typeof entry.content === "string") return entry.content;
|
|
1006
|
-
if (typeof entry.text === "string") return entry.text;
|
|
1007
|
-
if (!Array.isArray(entry.content)) return;
|
|
1008
|
-
const textParts = entry.content.map((block) => {
|
|
1009
|
-
if (!block || typeof block !== "object") return;
|
|
1010
|
-
const typed = block;
|
|
1011
|
-
return typeof typed.text === "string" ? typed.text : void 0;
|
|
1012
|
-
}).filter((value) => typeof value === "string");
|
|
1013
|
-
return textParts.length > 0 ? textParts.join("\n") : void 0;
|
|
1014
|
-
}
|
|
1015
|
-
function appendCanvasBlockToAssistantHistoryMessage(params) {
|
|
1016
|
-
const preview = params.preview;
|
|
1017
|
-
if (!preview || !params.message || typeof params.message !== "object") return params.message;
|
|
1018
|
-
const entry = params.message;
|
|
1019
|
-
const baseContent = Array.isArray(entry.content) ? [...entry.content] : typeof entry.content === "string" ? [{
|
|
1020
|
-
type: "text",
|
|
1021
|
-
text: entry.content
|
|
1022
|
-
}] : typeof entry.text === "string" ? [{
|
|
1023
|
-
type: "text",
|
|
1024
|
-
text: entry.text
|
|
1025
|
-
}] : [];
|
|
1026
|
-
if (!baseContent.some((block) => {
|
|
1027
|
-
if (!block || typeof block !== "object") return false;
|
|
1028
|
-
const typed = block;
|
|
1029
|
-
return typed.type === "canvas" && typed.preview && typeof typed.preview === "object" && (typed.preview.viewId && typed.preview.viewId === preview.viewId || typed.preview.url && typed.preview.url === preview.url);
|
|
1030
|
-
})) baseContent.push({
|
|
1031
|
-
type: "canvas",
|
|
1032
|
-
preview,
|
|
1033
|
-
rawText: params.rawText
|
|
1034
|
-
});
|
|
1035
|
-
return {
|
|
1036
|
-
...entry,
|
|
1037
|
-
content: baseContent
|
|
1038
|
-
};
|
|
1039
|
-
}
|
|
1040
|
-
function messageContainsToolHistoryContent(message) {
|
|
1041
|
-
if (!message || typeof message !== "object") return false;
|
|
1042
|
-
const entry = message;
|
|
1043
|
-
if (typeof entry.toolCallId === "string" || typeof entry.tool_call_id === "string" || typeof entry.toolName === "string" || typeof entry.tool_name === "string") return true;
|
|
1044
|
-
if (!Array.isArray(entry.content)) return false;
|
|
1045
|
-
return entry.content.some((block) => {
|
|
1046
|
-
if (!block || typeof block !== "object") return false;
|
|
1047
|
-
return isToolHistoryBlockType(block.type);
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
function augmentChatHistoryWithCanvasBlocks(messages) {
|
|
1051
|
-
if (messages.length === 0) return messages;
|
|
1052
|
-
const next = [...messages];
|
|
1053
|
-
let changed = false;
|
|
1054
|
-
let lastAssistantIndex = -1;
|
|
1055
|
-
let lastRenderableAssistantIndex = -1;
|
|
1056
|
-
const pending = [];
|
|
1057
|
-
for (let index = 0; index < next.length; index++) {
|
|
1058
|
-
const message = next[index];
|
|
1059
|
-
if (!message || typeof message !== "object") continue;
|
|
1060
|
-
const entry = message;
|
|
1061
|
-
if ((typeof entry.role === "string" ? entry.role.toLowerCase() : "") === "assistant") {
|
|
1062
|
-
lastAssistantIndex = index;
|
|
1063
|
-
if (!messageContainsToolHistoryContent(entry)) {
|
|
1064
|
-
lastRenderableAssistantIndex = index;
|
|
1065
|
-
if (pending.length > 0) {
|
|
1066
|
-
let target = next[index];
|
|
1067
|
-
for (const item of pending) target = appendCanvasBlockToAssistantHistoryMessage({
|
|
1068
|
-
message: target,
|
|
1069
|
-
preview: item.preview,
|
|
1070
|
-
rawText: item.rawText
|
|
1071
|
-
});
|
|
1072
|
-
next[index] = target;
|
|
1073
|
-
pending.length = 0;
|
|
1074
|
-
changed = true;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
continue;
|
|
1078
|
-
}
|
|
1079
|
-
if (!messageContainsToolHistoryContent(entry)) continue;
|
|
1080
|
-
const toolName = typeof entry.toolName === "string" ? entry.toolName : typeof entry.tool_name === "string" ? entry.tool_name : void 0;
|
|
1081
|
-
const text = extractChatHistoryBlockText(entry);
|
|
1082
|
-
const preview = extractCanvasFromText(text, toolName);
|
|
1083
|
-
if (!preview) continue;
|
|
1084
|
-
pending.push({
|
|
1085
|
-
preview,
|
|
1086
|
-
rawText: text ?? null
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
if (pending.length > 0) {
|
|
1090
|
-
const targetIndex = lastRenderableAssistantIndex >= 0 ? lastRenderableAssistantIndex : lastAssistantIndex;
|
|
1091
|
-
if (targetIndex >= 0) {
|
|
1092
|
-
let target = next[targetIndex];
|
|
1093
|
-
for (const item of pending) target = appendCanvasBlockToAssistantHistoryMessage({
|
|
1094
|
-
message: target,
|
|
1095
|
-
preview: item.preview,
|
|
1096
|
-
rawText: item.rawText
|
|
1097
|
-
});
|
|
1098
|
-
next[targetIndex] = target;
|
|
1099
|
-
changed = true;
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
return changed ? next : messages;
|
|
1103
|
-
}
|
|
1104
|
-
function buildOversizedHistoryPlaceholder(message) {
|
|
1105
|
-
return {
|
|
1106
|
-
role: message && typeof message === "object" && typeof message.role === "string" ? message.role : "assistant",
|
|
1107
|
-
timestamp: message && typeof message === "object" && typeof message.timestamp === "number" ? message.timestamp : Date.now(),
|
|
1108
|
-
content: [{
|
|
1109
|
-
type: "text",
|
|
1110
|
-
text: CHAT_HISTORY_OVERSIZED_PLACEHOLDER
|
|
1111
|
-
}],
|
|
1112
|
-
__fengming: {
|
|
1113
|
-
truncated: true,
|
|
1114
|
-
reason: "oversized"
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
function replaceOversizedChatHistoryMessages(params) {
|
|
1119
|
-
const { messages, maxSingleMessageBytes } = params;
|
|
1120
|
-
if (messages.length === 0) return {
|
|
1121
|
-
messages,
|
|
1122
|
-
replacedCount: 0
|
|
1123
|
-
};
|
|
1124
|
-
let replacedCount = 0;
|
|
1125
|
-
const next = messages.map((message) => {
|
|
1126
|
-
if (jsonUtf8Bytes(message) <= maxSingleMessageBytes) return message;
|
|
1127
|
-
replacedCount += 1;
|
|
1128
|
-
return buildOversizedHistoryPlaceholder(message);
|
|
1129
|
-
});
|
|
1130
|
-
return {
|
|
1131
|
-
messages: replacedCount > 0 ? next : messages,
|
|
1132
|
-
replacedCount
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
function enforceChatHistoryFinalBudget(params) {
|
|
1136
|
-
const { messages, maxBytes } = params;
|
|
1137
|
-
if (messages.length === 0) return {
|
|
1138
|
-
messages,
|
|
1139
|
-
placeholderCount: 0
|
|
1140
|
-
};
|
|
1141
|
-
if (jsonUtf8Bytes(messages) <= maxBytes) return {
|
|
1142
|
-
messages,
|
|
1143
|
-
placeholderCount: 0
|
|
1144
|
-
};
|
|
1145
|
-
const last = messages.at(-1);
|
|
1146
|
-
if (last && jsonUtf8Bytes([last]) <= maxBytes) return {
|
|
1147
|
-
messages: [last],
|
|
1148
|
-
placeholderCount: 0
|
|
1149
|
-
};
|
|
1150
|
-
const placeholder = buildOversizedHistoryPlaceholder(last);
|
|
1151
|
-
if (jsonUtf8Bytes([placeholder]) <= maxBytes) return {
|
|
1152
|
-
messages: [placeholder],
|
|
1153
|
-
placeholderCount: 1
|
|
1154
|
-
};
|
|
1155
|
-
return {
|
|
1156
|
-
messages: [],
|
|
1157
|
-
placeholderCount: 0
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
function resolveTranscriptPath(params) {
|
|
1161
|
-
const { sessionId, storePath, sessionFile, agentId } = params;
|
|
1162
|
-
if (!storePath && !sessionFile) return null;
|
|
1163
|
-
try {
|
|
1164
|
-
const sessionsDir = storePath ? path.dirname(storePath) : void 0;
|
|
1165
|
-
return resolveSessionFilePath(sessionId, sessionFile ? { sessionFile } : void 0, sessionsDir || agentId ? {
|
|
1166
|
-
sessionsDir,
|
|
1167
|
-
agentId
|
|
1168
|
-
} : void 0);
|
|
1169
|
-
} catch {
|
|
1170
|
-
return null;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
function ensureTranscriptFile(params) {
|
|
1174
|
-
if (fs.existsSync(params.transcriptPath)) return { ok: true };
|
|
1175
|
-
try {
|
|
1176
|
-
fs.mkdirSync(path.dirname(params.transcriptPath), { recursive: true });
|
|
1177
|
-
const header = {
|
|
1178
|
-
type: "session",
|
|
1179
|
-
version: 3,
|
|
1180
|
-
id: params.sessionId,
|
|
1181
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1182
|
-
cwd: process.cwd()
|
|
1183
|
-
};
|
|
1184
|
-
fs.writeFileSync(params.transcriptPath, `${JSON.stringify(header)}\n`, {
|
|
1185
|
-
encoding: "utf-8",
|
|
1186
|
-
mode: 384
|
|
1187
|
-
});
|
|
1188
|
-
return { ok: true };
|
|
1189
|
-
} catch (err) {
|
|
1190
|
-
return {
|
|
1191
|
-
ok: false,
|
|
1192
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
async function findAssistantTranscriptMessageByIdempotencyKey(transcriptPath, idempotencyKey) {
|
|
1197
|
-
const trimmedIdempotencyKey = idempotencyKey.trim();
|
|
1198
|
-
if (!trimmedIdempotencyKey) return null;
|
|
1199
|
-
const target = (await readSessionTranscriptIndex(transcriptPath))?.entries.toReversed().find((entry) => {
|
|
1200
|
-
const message = entry.record.message;
|
|
1201
|
-
return message?.role === "assistant" && message.idempotencyKey === trimmedIdempotencyKey;
|
|
1202
|
-
});
|
|
1203
|
-
const message = target?.record.message;
|
|
1204
|
-
if (!target || !message) return null;
|
|
1205
|
-
return {
|
|
1206
|
-
messageId: target.id ?? trimmedIdempotencyKey,
|
|
1207
|
-
message
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
async function findSourceReplyTranscriptMirrorByIdempotencyKey(transcriptPath, idempotencyKey) {
|
|
1211
|
-
const found = await findAssistantTranscriptMessageByIdempotencyKey(transcriptPath, idempotencyKey);
|
|
1212
|
-
if (found?.message.provider !== "fengming" || found.message.model !== "delivery-mirror") return null;
|
|
1213
|
-
return found;
|
|
1214
|
-
}
|
|
1215
|
-
function extractAssistantTranscriptText(message) {
|
|
1216
|
-
const content = message.content;
|
|
1217
|
-
if (!Array.isArray(content)) return;
|
|
1218
|
-
return content.map((block) => block && typeof block === "object" && block.type === "text" && typeof block.text === "string" ? block.text.trim() ?? "" : "").filter(Boolean).join("\n").trim() || void 0;
|
|
1219
|
-
}
|
|
1220
|
-
async function findSourceReplyTranscriptMirrorByMetadata(params) {
|
|
1221
|
-
const byIdempotencyKey = await findSourceReplyTranscriptMirrorByIdempotencyKey(params.transcriptPath, params.idempotencyKey);
|
|
1222
|
-
if (byIdempotencyKey) return byIdempotencyKey;
|
|
1223
|
-
const expectedText = resolveMirroredTranscriptText({
|
|
1224
|
-
text: params.metadata?.text,
|
|
1225
|
-
mediaUrls: params.metadata?.mediaUrls
|
|
1226
|
-
});
|
|
1227
|
-
if (!expectedText) return null;
|
|
1228
|
-
const target = (await readSessionTranscriptIndex(params.transcriptPath))?.entries.toReversed().find((entry) => {
|
|
1229
|
-
const message = entry.record.message;
|
|
1230
|
-
return typeof entry.id === "string" && entry.id.trim().length > 0 && message?.role === "assistant" && message.provider === "fengming" && message.model === "delivery-mirror" && extractAssistantTranscriptText(message) === expectedText;
|
|
1231
|
-
});
|
|
1232
|
-
const message = target?.record.message;
|
|
1233
|
-
if (!target?.id || !message) return null;
|
|
1234
|
-
return {
|
|
1235
|
-
messageId: target.id,
|
|
1236
|
-
message
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
async function appendAssistantTranscriptMessage(params) {
|
|
1240
|
-
const transcriptPath = resolveTranscriptPath({
|
|
1241
|
-
sessionId: params.sessionId,
|
|
1242
|
-
storePath: params.storePath,
|
|
1243
|
-
sessionFile: params.sessionFile,
|
|
1244
|
-
agentId: params.agentId
|
|
1245
|
-
});
|
|
1246
|
-
if (!transcriptPath) return {
|
|
1247
|
-
ok: false,
|
|
1248
|
-
error: "transcript path not resolved"
|
|
1249
|
-
};
|
|
1250
|
-
if (!fs.existsSync(transcriptPath)) {
|
|
1251
|
-
if (!params.createIfMissing) return {
|
|
1252
|
-
ok: false,
|
|
1253
|
-
error: "transcript file not found"
|
|
1254
|
-
};
|
|
1255
|
-
const ensured = ensureTranscriptFile({
|
|
1256
|
-
transcriptPath,
|
|
1257
|
-
sessionId: params.sessionId
|
|
1258
|
-
});
|
|
1259
|
-
if (!ensured.ok) return {
|
|
1260
|
-
ok: false,
|
|
1261
|
-
error: ensured.error ?? "failed to create transcript file"
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
if (params.idempotencyKey) {
|
|
1265
|
-
const existing = await findAssistantTranscriptMessageByIdempotencyKey(transcriptPath, params.idempotencyKey);
|
|
1266
|
-
if (existing) return {
|
|
1267
|
-
ok: true,
|
|
1268
|
-
messageId: existing.messageId,
|
|
1269
|
-
message: existing.message
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
return await appendInjectedAssistantMessageToTranscript({
|
|
1273
|
-
transcriptPath,
|
|
1274
|
-
sessionKey: params.sessionKey,
|
|
1275
|
-
...params.agentId ? { agentId: params.agentId } : {},
|
|
1276
|
-
message: params.message,
|
|
1277
|
-
label: params.label,
|
|
1278
|
-
content: params.content,
|
|
1279
|
-
idempotencyKey: params.idempotencyKey,
|
|
1280
|
-
abortMeta: params.abortMeta,
|
|
1281
|
-
ttsSupplement: params.ttsSupplement,
|
|
1282
|
-
config: params.cfg
|
|
1283
|
-
});
|
|
1284
|
-
}
|
|
1285
|
-
function collectSessionAbortPartials(params) {
|
|
1286
|
-
const out = [];
|
|
1287
|
-
for (const [runId, active] of params.chatAbortControllers) {
|
|
1288
|
-
if (!params.runIds.has(runId)) continue;
|
|
1289
|
-
const text = params.chatRunBuffers.get(runId);
|
|
1290
|
-
if (!text || !text.trim()) continue;
|
|
1291
|
-
out.push({
|
|
1292
|
-
runId,
|
|
1293
|
-
sessionId: active.sessionId,
|
|
1294
|
-
agentId: active.agentId,
|
|
1295
|
-
text,
|
|
1296
|
-
abortOrigin: params.abortOrigin
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
return out;
|
|
1300
|
-
}
|
|
1301
|
-
async function persistAbortedPartials(params) {
|
|
1302
|
-
if (params.snapshots.length === 0) return;
|
|
1303
|
-
for (const snapshot of params.snapshots) {
|
|
1304
|
-
const sessionLoadOptions = params.sessionKey === "global" && snapshot.agentId ? { agentId: snapshot.agentId } : void 0;
|
|
1305
|
-
const { cfg, storePath, entry } = loadSessionEntry(params.sessionKey, sessionLoadOptions);
|
|
1306
|
-
const sessionId = entry?.sessionId ?? snapshot.sessionId ?? snapshot.runId;
|
|
1307
|
-
const appended = await appendAssistantTranscriptMessage({
|
|
1308
|
-
sessionKey: params.sessionKey,
|
|
1309
|
-
message: snapshot.text,
|
|
1310
|
-
sessionId,
|
|
1311
|
-
storePath,
|
|
1312
|
-
sessionFile: entry?.sessionFile,
|
|
1313
|
-
...snapshot.agentId ? { agentId: snapshot.agentId } : {},
|
|
1314
|
-
createIfMissing: true,
|
|
1315
|
-
idempotencyKey: `${snapshot.runId}:assistant`,
|
|
1316
|
-
cfg,
|
|
1317
|
-
abortMeta: {
|
|
1318
|
-
aborted: true,
|
|
1319
|
-
origin: snapshot.abortOrigin,
|
|
1320
|
-
runId: snapshot.runId
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
if (!appended.ok) params.context.logGateway.warn(`chat.abort transcript append failed: ${appended.error ?? "unknown error"}`);
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
function createChatAbortOps(context) {
|
|
1327
|
-
return {
|
|
1328
|
-
chatAbortControllers: context.chatAbortControllers,
|
|
1329
|
-
chatRunBuffers: context.chatRunBuffers,
|
|
1330
|
-
chatAbortedRuns: context.chatAbortedRuns,
|
|
1331
|
-
clearChatRunState: context.clearChatRunState,
|
|
1332
|
-
removeChatRun: context.removeChatRun,
|
|
1333
|
-
agentRunSeq: context.agentRunSeq,
|
|
1334
|
-
getRuntimeConfig: context.getRuntimeConfig,
|
|
1335
|
-
broadcast: context.broadcast,
|
|
1336
|
-
nodeSendToSession: context.nodeSendToSession
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1339
|
-
function normalizeOptionalText(value) {
|
|
1340
|
-
return value?.trim() || void 0;
|
|
1341
|
-
}
|
|
1342
|
-
function normalizeExplicitChatSendOrigin(params) {
|
|
1343
|
-
const originatingChannel = normalizeOptionalText(params.originatingChannel);
|
|
1344
|
-
const originatingTo = normalizeOptionalText(params.originatingTo);
|
|
1345
|
-
const accountId = normalizeOptionalText(params.accountId);
|
|
1346
|
-
const messageThreadId = normalizeOptionalText(params.messageThreadId);
|
|
1347
|
-
if (!Boolean(originatingChannel || originatingTo || accountId || messageThreadId)) return { ok: true };
|
|
1348
|
-
const normalizedChannel = normalizeMessageChannel(originatingChannel);
|
|
1349
|
-
if (!normalizedChannel) return {
|
|
1350
|
-
ok: false,
|
|
1351
|
-
error: "originatingChannel is required when using originating route fields"
|
|
1352
|
-
};
|
|
1353
|
-
if (!originatingTo) return {
|
|
1354
|
-
ok: false,
|
|
1355
|
-
error: "originatingTo is required when using originating route fields"
|
|
1356
|
-
};
|
|
1357
|
-
return {
|
|
1358
|
-
ok: true,
|
|
1359
|
-
value: {
|
|
1360
|
-
originatingChannel: normalizedChannel,
|
|
1361
|
-
originatingTo,
|
|
1362
|
-
...accountId ? { accountId } : {},
|
|
1363
|
-
...messageThreadId ? { messageThreadId } : {}
|
|
1364
|
-
}
|
|
1365
|
-
};
|
|
1366
|
-
}
|
|
1367
|
-
function resolveChatAbortRequester(client) {
|
|
1368
|
-
const scopes = Array.isArray(client?.connect?.scopes) ? client.connect.scopes : [];
|
|
1369
|
-
return {
|
|
1370
|
-
connId: normalizeOptionalText(client?.connId),
|
|
1371
|
-
deviceId: normalizeOptionalText(client?.connect?.device?.id),
|
|
1372
|
-
isAdmin: scopes.includes(ADMIN_SCOPE)
|
|
1373
|
-
};
|
|
1374
|
-
}
|
|
1375
|
-
function canRequesterAbortChatRun(entry, requester) {
|
|
1376
|
-
if (requester.isAdmin) return true;
|
|
1377
|
-
const ownerDeviceId = normalizeOptionalText(entry.ownerDeviceId);
|
|
1378
|
-
const ownerConnId = normalizeOptionalText(entry.ownerConnId);
|
|
1379
|
-
if (!ownerDeviceId && !ownerConnId) return true;
|
|
1380
|
-
if (ownerDeviceId && requester.deviceId && ownerDeviceId === requester.deviceId) return true;
|
|
1381
|
-
if (ownerConnId && requester.connId && ownerConnId === requester.connId) return true;
|
|
1382
|
-
return false;
|
|
1383
|
-
}
|
|
1384
|
-
function canRequesterAbortChatRunWithoutSessionMatch(entry, requester) {
|
|
1385
|
-
if (requester.isAdmin) return true;
|
|
1386
|
-
const ownerDeviceId = normalizeOptionalText(entry.ownerDeviceId);
|
|
1387
|
-
const ownerConnId = normalizeOptionalText(entry.ownerConnId);
|
|
1388
|
-
return Boolean(ownerDeviceId && requester.deviceId && ownerDeviceId === requester.deviceId || ownerConnId && requester.connId && ownerConnId === requester.connId);
|
|
1389
|
-
}
|
|
1390
|
-
function readPreRegisteredAgentDedupePayloadForSession(params) {
|
|
1391
|
-
if (!params.entry?.ok) return;
|
|
1392
|
-
const payload = params.entry.payload;
|
|
1393
|
-
if (payload?.status !== "accepted") return;
|
|
1394
|
-
const payloadRunId = normalizeUnknownText(payload.runId);
|
|
1395
|
-
if (payloadRunId && payloadRunId !== params.runId) return;
|
|
1396
|
-
if (normalizeUnknownText(payload.sessionKey) !== params.sessionKey) return;
|
|
1397
|
-
const agentId = normalizeOptionalText(params.agentId)?.toLowerCase();
|
|
1398
|
-
if (agentId) {
|
|
1399
|
-
const parsed = parseAgentSessionKey(params.sessionKey);
|
|
1400
|
-
const sessionAgentId = params.sessionKey === "global" ? resolveStoredGlobalRunAgentId(normalizeUnknownText(payload.agentId), params.defaultAgentId) : parsed?.agentId ? normalizeAgentId(parsed.agentId) : void 0;
|
|
1401
|
-
if (sessionAgentId && sessionAgentId !== agentId) return;
|
|
1402
|
-
}
|
|
1403
|
-
return payload;
|
|
1404
|
-
}
|
|
1405
|
-
function readPreRegisteredAgentRun(params) {
|
|
1406
|
-
if (!params.key.startsWith("agent:") || !params.entry?.ok) return;
|
|
1407
|
-
const payload = params.entry.payload;
|
|
1408
|
-
if (payload?.status !== "accepted") return;
|
|
1409
|
-
const runId = normalizeUnknownText(payload.runId) ?? normalizeOptionalText(params.key.slice(6));
|
|
1410
|
-
const sessionKey = normalizeUnknownText(payload.sessionKey);
|
|
1411
|
-
if (!runId || !sessionKey) return;
|
|
1412
|
-
return {
|
|
1413
|
-
runId,
|
|
1414
|
-
sessionKey,
|
|
1415
|
-
payload
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
function canRequesterAbortPreRegisteredAgentRun(payload, requester) {
|
|
1419
|
-
return canRequesterAbortChatRun({
|
|
1420
|
-
controller: new AbortController(),
|
|
1421
|
-
sessionId: "",
|
|
1422
|
-
sessionKey: normalizeUnknownText(payload.sessionKey) ?? "",
|
|
1423
|
-
startedAtMs: 0,
|
|
1424
|
-
expiresAtMs: 0,
|
|
1425
|
-
ownerConnId: normalizeUnknownText(payload.ownerConnId),
|
|
1426
|
-
ownerDeviceId: normalizeUnknownText(payload.ownerDeviceId),
|
|
1427
|
-
kind: "agent"
|
|
1428
|
-
}, requester);
|
|
1429
|
-
}
|
|
1430
|
-
function resolvePreRegisteredAgentDedupeKeys(payload, runId) {
|
|
1431
|
-
const keys = [`agent:${runId}`];
|
|
1432
|
-
const payloadKeys = Array.isArray(payload.dedupeKeys) ? payload.dedupeKeys : [];
|
|
1433
|
-
for (const key of payloadKeys) {
|
|
1434
|
-
const normalized = normalizeUnknownText(key);
|
|
1435
|
-
if (normalized?.startsWith("agent:")) keys.push(normalized);
|
|
1436
|
-
}
|
|
1437
|
-
return uniqueStrings(keys);
|
|
1438
|
-
}
|
|
1439
|
-
function resolveStoredGlobalRunAgentId(agentId, defaultAgentId) {
|
|
1440
|
-
return normalizeOptionalText(agentId)?.toLowerCase() ?? defaultAgentId.toLowerCase();
|
|
1441
|
-
}
|
|
1442
|
-
function writePreRegisteredAgentAbort(params) {
|
|
1443
|
-
const endedAt = params.endedAt ?? Date.now();
|
|
1444
|
-
const payloadAgentId = normalizeUnknownText(params.payload.agentId);
|
|
1445
|
-
for (const key of resolvePreRegisteredAgentDedupeKeys(params.payload, params.runId)) setGatewayDedupeEntry({
|
|
1446
|
-
dedupe: params.context.dedupe,
|
|
1447
|
-
key,
|
|
1448
|
-
entry: {
|
|
1449
|
-
ts: endedAt,
|
|
1450
|
-
ok: true,
|
|
1451
|
-
payload: {
|
|
1452
|
-
runId: params.runId,
|
|
1453
|
-
sessionKey: params.sessionKey,
|
|
1454
|
-
...payloadAgentId ? { agentId: payloadAgentId } : {},
|
|
1455
|
-
status: "timeout",
|
|
1456
|
-
summary: "aborted",
|
|
1457
|
-
stopReason: params.stopReason,
|
|
1458
|
-
endedAt
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
function resolveAuthorizedPreRegisteredAgentRunsForSessionKeys(params) {
|
|
1464
|
-
const sessionKeys = new Set(Array.from(params.sessionKeys, (sessionKey) => normalizeOptionalText(sessionKey)).filter((sessionKey) => Boolean(sessionKey)));
|
|
1465
|
-
const authorizedByRunId = /* @__PURE__ */ new Map();
|
|
1466
|
-
let matchedSessionRuns = 0;
|
|
1467
|
-
for (const [key, entry] of params.context.dedupe) {
|
|
1468
|
-
const run = readPreRegisteredAgentRun({
|
|
1469
|
-
key,
|
|
1470
|
-
entry
|
|
1471
|
-
});
|
|
1472
|
-
if (!run || !sessionKeys.has(run.sessionKey)) continue;
|
|
1473
|
-
if (params.context.chatAbortControllers.has(run.runId)) continue;
|
|
1474
|
-
const agentId = normalizeOptionalText(params.agentId)?.toLowerCase();
|
|
1475
|
-
if (agentId && run.sessionKey === "global" && resolveStoredGlobalRunAgentId(normalizeUnknownText(run.payload.agentId), params.defaultAgentId) !== agentId) continue;
|
|
1476
|
-
matchedSessionRuns += 1;
|
|
1477
|
-
if (canRequesterAbortPreRegisteredAgentRun(run.payload, params.requester)) authorizedByRunId.set(run.runId, run);
|
|
1478
|
-
}
|
|
1479
|
-
return {
|
|
1480
|
-
matchedSessionRuns,
|
|
1481
|
-
authorizedRuns: [...authorizedByRunId.values()]
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
function resolveAuthorizedRunsForSessionKeys(params) {
|
|
1485
|
-
const sessionKeys = new Set(Array.from(params.sessionKeys, (sessionKey) => normalizeOptionalText(sessionKey)).filter((sessionKey) => Boolean(sessionKey)));
|
|
1486
|
-
const sessionIds = new Set(Array.from(params.sessionIds ?? [], (sessionId) => normalizeOptionalText(sessionId)).filter((sessionId) => Boolean(sessionId)));
|
|
1487
|
-
const agentId = normalizeOptionalText(params.agentId)?.toLowerCase();
|
|
1488
|
-
const authorizedRuns = [];
|
|
1489
|
-
let matchedSessionRuns = 0;
|
|
1490
|
-
for (const [runId, active] of params.chatAbortControllers) {
|
|
1491
|
-
if (!sessionKeys.has(active.sessionKey) && !sessionIds.has(active.sessionId)) continue;
|
|
1492
|
-
if (agentId && active.sessionKey === "global" && resolveStoredGlobalRunAgentId(active.agentId, params.defaultAgentId) !== agentId) continue;
|
|
1493
|
-
matchedSessionRuns += 1;
|
|
1494
|
-
if (canRequesterAbortChatRun(active, params.requester)) authorizedRuns.push({
|
|
1495
|
-
runId,
|
|
1496
|
-
sessionKey: active.sessionKey
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
return {
|
|
1500
|
-
matchedSessionRuns,
|
|
1501
|
-
authorizedRuns
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1504
|
-
async function abortChatRunsForSessionKeyWithPartials(params) {
|
|
1505
|
-
const sessionKeys = [params.sessionKey, ...params.sessionKeyAliases ?? []];
|
|
1506
|
-
const { matchedSessionRuns, authorizedRuns } = resolveAuthorizedRunsForSessionKeys({
|
|
1507
|
-
chatAbortControllers: params.context.chatAbortControllers,
|
|
1508
|
-
sessionKeys,
|
|
1509
|
-
sessionIds: [params.sessionId],
|
|
1510
|
-
agentId: params.agentId,
|
|
1511
|
-
defaultAgentId: params.defaultAgentId,
|
|
1512
|
-
requester: params.requester
|
|
1513
|
-
});
|
|
1514
|
-
const { matchedSessionRuns: matchedPendingAgentRuns, authorizedRuns: authorizedPendingAgentRuns } = resolveAuthorizedPreRegisteredAgentRunsForSessionKeys({
|
|
1515
|
-
context: params.context,
|
|
1516
|
-
sessionKeys,
|
|
1517
|
-
agentId: params.agentId,
|
|
1518
|
-
defaultAgentId: params.defaultAgentId,
|
|
1519
|
-
requester: params.requester
|
|
1520
|
-
});
|
|
1521
|
-
if (authorizedRuns.length === 0 && authorizedPendingAgentRuns.length === 0) return {
|
|
1522
|
-
aborted: false,
|
|
1523
|
-
runIds: [],
|
|
1524
|
-
unauthorized: matchedSessionRuns > 0 || matchedPendingAgentRuns > 0
|
|
1525
|
-
};
|
|
1526
|
-
const authorizedRunIdSet = new Set(authorizedRuns.map((run) => run.runId));
|
|
1527
|
-
const snapshots = collectSessionAbortPartials({
|
|
1528
|
-
chatAbortControllers: params.context.chatAbortControllers,
|
|
1529
|
-
chatRunBuffers: params.context.chatRunBuffers,
|
|
1530
|
-
runIds: authorizedRunIdSet,
|
|
1531
|
-
abortOrigin: params.abortOrigin
|
|
1532
|
-
});
|
|
1533
|
-
const runIds = [];
|
|
1534
|
-
for (const { runId, sessionKey } of authorizedRuns) if (abortChatRunById(params.ops, {
|
|
1535
|
-
runId,
|
|
1536
|
-
sessionKey,
|
|
1537
|
-
stopReason: params.stopReason
|
|
1538
|
-
}).aborted) runIds.push(runId);
|
|
1539
|
-
const endedAt = Date.now();
|
|
1540
|
-
const stopReason = params.stopReason ?? "rpc";
|
|
1541
|
-
for (const { runId, sessionKey, payload } of authorizedPendingAgentRuns) {
|
|
1542
|
-
writePreRegisteredAgentAbort({
|
|
1543
|
-
context: params.context,
|
|
1544
|
-
runId,
|
|
1545
|
-
sessionKey,
|
|
1546
|
-
payload,
|
|
1547
|
-
stopReason,
|
|
1548
|
-
endedAt
|
|
1549
|
-
});
|
|
1550
|
-
runIds.push(runId);
|
|
1551
|
-
}
|
|
1552
|
-
const res = {
|
|
1553
|
-
aborted: runIds.length > 0,
|
|
1554
|
-
runIds,
|
|
1555
|
-
unauthorized: false
|
|
1556
|
-
};
|
|
1557
|
-
if (res.aborted) await persistAbortedPartials({
|
|
1558
|
-
context: params.context,
|
|
1559
|
-
sessionKey: params.persistSessionKey ?? params.sessionKey,
|
|
1560
|
-
snapshots
|
|
1561
|
-
});
|
|
1562
|
-
return res;
|
|
1563
|
-
}
|
|
1564
|
-
function nextChatSeq(context, runId) {
|
|
1565
|
-
const next = (context.agentRunSeq.get(runId) ?? 0) + 1;
|
|
1566
|
-
context.agentRunSeq.set(runId, next);
|
|
1567
|
-
return next;
|
|
1568
|
-
}
|
|
1569
|
-
function broadcastChatFinal(params) {
|
|
1570
|
-
const seq = nextChatSeq({ agentRunSeq: params.context.agentRunSeq }, params.runId);
|
|
1571
|
-
const payloadAgentId = params.sessionKey === "global" ? params.agentId : void 0;
|
|
1572
|
-
const payload = {
|
|
1573
|
-
runId: params.runId,
|
|
1574
|
-
sessionKey: params.sessionKey,
|
|
1575
|
-
...payloadAgentId ? { agentId: payloadAgentId } : {},
|
|
1576
|
-
seq,
|
|
1577
|
-
state: "final",
|
|
1578
|
-
message: projectChatDisplayMessage(params.message)
|
|
1579
|
-
};
|
|
1580
|
-
params.context.broadcast("chat", payload);
|
|
1581
|
-
sendGlobalAwareNodeChatPayload({
|
|
1582
|
-
context: params.context,
|
|
1583
|
-
sessionKey: params.sessionKey,
|
|
1584
|
-
agentId: payloadAgentId,
|
|
1585
|
-
event: "chat",
|
|
1586
|
-
payload
|
|
1587
|
-
});
|
|
1588
|
-
params.context.agentRunSeq.delete(params.runId);
|
|
1589
|
-
}
|
|
1590
|
-
function isBtwReplyPayload(payload) {
|
|
1591
|
-
return typeof payload?.btw?.question === "string" && payload.btw.question.trim().length > 0 && typeof payload.text === "string" && payload.text.trim().length > 0;
|
|
1592
|
-
}
|
|
1593
|
-
function broadcastSideResult(params) {
|
|
1594
|
-
const seq = nextChatSeq({ agentRunSeq: params.context.agentRunSeq }, params.payload.runId);
|
|
1595
|
-
const payloadAgentId = params.payload.sessionKey === "global" ? params.payload.agentId : void 0;
|
|
1596
|
-
const payload = {
|
|
1597
|
-
...params.payload,
|
|
1598
|
-
...payloadAgentId ? { agentId: payloadAgentId } : {},
|
|
1599
|
-
seq
|
|
1600
|
-
};
|
|
1601
|
-
params.context.broadcast("chat.side_result", payload);
|
|
1602
|
-
sendGlobalAwareNodeChatPayload({
|
|
1603
|
-
context: params.context,
|
|
1604
|
-
sessionKey: params.payload.sessionKey,
|
|
1605
|
-
agentId: payloadAgentId,
|
|
1606
|
-
event: "chat.side_result",
|
|
1607
|
-
payload
|
|
1608
|
-
});
|
|
1609
|
-
}
|
|
1610
|
-
function broadcastChatError(params) {
|
|
1611
|
-
const seq = nextChatSeq({ agentRunSeq: params.context.agentRunSeq }, params.runId);
|
|
1612
|
-
const payloadAgentId = params.sessionKey === "global" ? params.agentId : void 0;
|
|
1613
|
-
const errorText = params.errorMessage?.trim();
|
|
1614
|
-
const payload = {
|
|
1615
|
-
runId: params.runId,
|
|
1616
|
-
sessionKey: params.sessionKey,
|
|
1617
|
-
...payloadAgentId ? { agentId: payloadAgentId } : {},
|
|
1618
|
-
seq,
|
|
1619
|
-
state: "error",
|
|
1620
|
-
errorMessage: params.errorMessage,
|
|
1621
|
-
...errorText ? { message: {
|
|
1622
|
-
role: "assistant",
|
|
1623
|
-
content: [{
|
|
1624
|
-
type: "text",
|
|
1625
|
-
text: errorText.startsWith("⚠️") || errorText.startsWith("Error:") ? errorText : `Error: ${errorText}`
|
|
1626
|
-
}],
|
|
1627
|
-
timestamp: Date.now()
|
|
1628
|
-
} } : {}
|
|
1629
|
-
};
|
|
1630
|
-
params.context.broadcast("chat", payload);
|
|
1631
|
-
sendGlobalAwareNodeChatPayload({
|
|
1632
|
-
context: params.context,
|
|
1633
|
-
sessionKey: params.sessionKey,
|
|
1634
|
-
agentId: payloadAgentId,
|
|
1635
|
-
event: "chat",
|
|
1636
|
-
payload
|
|
1637
|
-
});
|
|
1638
|
-
params.context.agentRunSeq.delete(params.runId);
|
|
1639
|
-
}
|
|
1640
|
-
function sendGlobalAwareNodeChatPayload(params) {
|
|
1641
|
-
const deliveryKeys = resolveGlobalAwareNodeChatDeliveryKeys({
|
|
1642
|
-
cfg: params.context.getRuntimeConfig?.() ?? {},
|
|
1643
|
-
sessionKey: params.sessionKey,
|
|
1644
|
-
agentId: params.agentId
|
|
1645
|
-
});
|
|
1646
|
-
for (const deliveryKey of deliveryKeys) params.context.nodeSendToSession(deliveryKey, params.event, params.payload);
|
|
1647
|
-
}
|
|
1648
|
-
function resolveGlobalAwareNodeChatDeliveryKeys(params) {
|
|
1649
|
-
if (params.sessionKey !== "global") return [params.sessionKey];
|
|
1650
|
-
const defaultAgentId = resolveDefaultAgentId(params.cfg);
|
|
1651
|
-
const scopedAgentId = params.agentId ?? defaultAgentId;
|
|
1652
|
-
const keys = [`agent:${scopedAgentId}:global`];
|
|
1653
|
-
if (scopedAgentId === defaultAgentId) keys.push("global");
|
|
1654
|
-
return keys;
|
|
1655
|
-
}
|
|
1656
|
-
function isSourceReplyTranscriptMirrorPayload(payload) {
|
|
1657
|
-
return Boolean(payload && getReplyPayloadMetadata(payload)?.sourceReplyTranscriptMirror);
|
|
1658
|
-
}
|
|
1659
|
-
function readChatHistoryRecordTimestampMs(message) {
|
|
1660
|
-
const value = asOptionalRecord(asOptionalRecord(message)?.["__fengming"])?.recordTimestampMs;
|
|
1661
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1662
|
-
const timestamp = asOptionalRecord(message)?.timestamp;
|
|
1663
|
-
return typeof timestamp === "number" && Number.isFinite(timestamp) ? timestamp : void 0;
|
|
1664
|
-
}
|
|
1665
|
-
function isSubagentAnnounceInterSessionUserChatHistoryMessage(message) {
|
|
1666
|
-
const record = asOptionalRecord(message);
|
|
1667
|
-
if (!record || record.role !== "user") return false;
|
|
1668
|
-
const provenance = normalizeInputProvenance(record.provenance);
|
|
1669
|
-
if (provenance?.kind === "inter_session" && provenance.sourceTool === "subagent_announce") return true;
|
|
1670
|
-
const text = extractChatHistoryBlockText(record);
|
|
1671
|
-
return typeof text === "string" && text.includes("[Inter-session message]") && text.includes("sourceTool=subagent_announce");
|
|
1672
|
-
}
|
|
1673
|
-
function isChatHistoryAssistantMessage(message) {
|
|
1674
|
-
return asOptionalRecord(message)?.role === "assistant";
|
|
1675
|
-
}
|
|
1676
|
-
function dropPreSessionStartAnnouncePairs(messages, sessionStartedAt) {
|
|
1677
|
-
if (sessionStartedAt === void 0 || messages.length === 0) return messages;
|
|
1678
|
-
let changed = false;
|
|
1679
|
-
const kept = [];
|
|
1680
|
-
for (let i = 0; i < messages.length; i++) {
|
|
1681
|
-
const current = messages[i];
|
|
1682
|
-
if (isSubagentAnnounceInterSessionUserChatHistoryMessage(current)) {
|
|
1683
|
-
const ts = readChatHistoryRecordTimestampMs(current);
|
|
1684
|
-
if (typeof ts === "number" && ts < sessionStartedAt) {
|
|
1685
|
-
const next = messages[i + 1];
|
|
1686
|
-
const nextTs = readChatHistoryRecordTimestampMs(next);
|
|
1687
|
-
if (isChatHistoryAssistantMessage(next) && typeof nextTs === "number" && nextTs < sessionStartedAt) i++;
|
|
1688
|
-
changed = true;
|
|
1689
|
-
continue;
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
kept.push(current);
|
|
1693
|
-
}
|
|
1694
|
-
return changed ? kept : messages;
|
|
1695
|
-
}
|
|
1696
|
-
function dropLocalHistoryOverreadContextMessage(messages, contextMessage) {
|
|
1697
|
-
if (contextMessage === void 0) return messages;
|
|
1698
|
-
const index = messages.indexOf(contextMessage);
|
|
1699
|
-
if (index < 0) return messages;
|
|
1700
|
-
return [...messages.slice(0, index), ...messages.slice(index + 1)];
|
|
1701
|
-
}
|
|
1702
|
-
const chatHandlers = {
|
|
1703
|
-
"chat.history": async ({ params, respond, context }) => {
|
|
1704
|
-
if (!validateChatHistoryParams(params)) {
|
|
1705
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `invalid chat.history params: ${formatValidationErrors(validateChatHistoryParams.errors)}`));
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
const { sessionKey, limit, maxChars } = params;
|
|
1709
|
-
const agentIdOverride = normalizeOptionalText(params.agentId);
|
|
1710
|
-
const requestedAgentId = resolveRequestedChatAgentId({
|
|
1711
|
-
cfg: context.getRuntimeConfig?.(),
|
|
1712
|
-
requestedSessionKey: sessionKey,
|
|
1713
|
-
agentId: agentIdOverride
|
|
1714
|
-
});
|
|
1715
|
-
const { cfg, storePath, entry } = loadSessionEntry(sessionKey, requestedAgentId ? { agentId: requestedAgentId } : void 0);
|
|
1716
|
-
const selectedAgent = validateChatSelectedAgent({
|
|
1717
|
-
cfg,
|
|
1718
|
-
requestedSessionKey: sessionKey,
|
|
1719
|
-
agentId: requestedAgentId
|
|
1720
|
-
});
|
|
1721
|
-
if (!selectedAgent.ok) {
|
|
1722
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, selectedAgent.error));
|
|
1723
|
-
return;
|
|
1724
|
-
}
|
|
1725
|
-
const sessionId = entry?.sessionId;
|
|
1726
|
-
const sessionAgentId = resolveSessionAgentId({
|
|
1727
|
-
sessionKey,
|
|
1728
|
-
config: cfg,
|
|
1729
|
-
agentId: selectedAgent.agentId
|
|
1730
|
-
});
|
|
1731
|
-
const resolvedSessionModel = resolveSessionModelRef(cfg, entry, sessionAgentId);
|
|
1732
|
-
const max = Math.min(1e3, typeof limit === "number" ? limit : 200);
|
|
1733
|
-
const localReadMax = max > 0 ? max + 1 : 0;
|
|
1734
|
-
const maxHistoryBytes = getMaxChatHistoryMessagesBytes();
|
|
1735
|
-
const localMessages = sessionId && storePath ? await readRecentSessionMessagesAsync(sessionId, storePath, entry?.sessionFile, {
|
|
1736
|
-
maxMessages: localReadMax,
|
|
1737
|
-
maxBytes: Math.max(maxHistoryBytes * 2, 1024 * 1024)
|
|
1738
|
-
}) : [];
|
|
1739
|
-
const overreadContextMessage = localMessages.length > max ? localMessages[0] : void 0;
|
|
1740
|
-
const localMessagesWithBoundaryFilter = dropLocalHistoryOverreadContextMessage(dropPreSessionStartAnnouncePairs(localMessages, typeof entry?.sessionStartedAt === "number" ? entry.sessionStartedAt : void 0), overreadContextMessage);
|
|
1741
|
-
const normalized = augmentChatHistoryWithCanvasBlocks(projectRecentChatDisplayMessages(dropPreSessionStartAnnouncePairs(augmentChatHistoryWithCliSessionImports({
|
|
1742
|
-
entry,
|
|
1743
|
-
provider: resolvedSessionModel.provider,
|
|
1744
|
-
localMessages: localMessagesWithBoundaryFilter
|
|
1745
|
-
}), typeof entry?.sessionStartedAt === "number" ? entry.sessionStartedAt : void 0), {
|
|
1746
|
-
maxChars: resolveEffectiveChatHistoryMaxChars(cfg, maxChars),
|
|
1747
|
-
maxMessages: max
|
|
1748
|
-
}));
|
|
1749
|
-
const replaced = replaceOversizedChatHistoryMessages({
|
|
1750
|
-
messages: normalized,
|
|
1751
|
-
maxSingleMessageBytes: Math.min(CHAT_HISTORY_MAX_SINGLE_MESSAGE_BYTES, maxHistoryBytes)
|
|
1752
|
-
});
|
|
1753
|
-
scheduleChatHistoryManagedImageCleanup({
|
|
1754
|
-
sessionKey,
|
|
1755
|
-
...selectedAgent.agentId ? { agentId: selectedAgent.agentId } : {},
|
|
1756
|
-
context
|
|
1757
|
-
});
|
|
1758
|
-
const capped = capArrayByJsonBytes(replaced.messages, maxHistoryBytes).items;
|
|
1759
|
-
const bounded = enforceChatHistoryFinalBudget({
|
|
1760
|
-
messages: capped,
|
|
1761
|
-
maxBytes: maxHistoryBytes
|
|
1762
|
-
});
|
|
1763
|
-
const placeholderCount = replaced.replacedCount + bounded.placeholderCount;
|
|
1764
|
-
if (placeholderCount > 0) {
|
|
1765
|
-
chatHistoryPlaceholderEmitCount += placeholderCount;
|
|
1766
|
-
logLargePayload({
|
|
1767
|
-
surface: "gateway.chat.history",
|
|
1768
|
-
action: "truncated",
|
|
1769
|
-
bytes: jsonUtf8Bytes(normalized),
|
|
1770
|
-
limitBytes: maxHistoryBytes,
|
|
1771
|
-
count: placeholderCount,
|
|
1772
|
-
reason: "chat_history_budget"
|
|
1773
|
-
});
|
|
1774
|
-
context.logGateway.debug(`chat.history omitted oversized payloads placeholders=${placeholderCount} total=${chatHistoryPlaceholderEmitCount}`);
|
|
1775
|
-
}
|
|
1776
|
-
let thinkingLevel = entry?.thinkingLevel;
|
|
1777
|
-
if (!thinkingLevel) thinkingLevel = resolveGatewaySessionThinkingDefault({
|
|
1778
|
-
cfg,
|
|
1779
|
-
agentId: sessionAgentId,
|
|
1780
|
-
provider: resolvedSessionModel.provider,
|
|
1781
|
-
model: resolvedSessionModel.model
|
|
1782
|
-
});
|
|
1783
|
-
const verboseLevel = entry?.verboseLevel ?? cfg.agents?.defaults?.verboseDefault;
|
|
1784
|
-
respond(true, {
|
|
1785
|
-
sessionKey,
|
|
1786
|
-
sessionId,
|
|
1787
|
-
messages: bounded.messages,
|
|
1788
|
-
thinkingLevel,
|
|
1789
|
-
fastMode: entry?.fastMode,
|
|
1790
|
-
verboseLevel
|
|
1791
|
-
});
|
|
1792
|
-
},
|
|
1793
|
-
"chat.abort": async ({ params, respond, context, client }) => {
|
|
1794
|
-
if (!validateChatAbortParams(params)) {
|
|
1795
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `invalid chat.abort params: ${formatValidationErrors(validateChatAbortParams.errors)}`));
|
|
1796
|
-
return;
|
|
1797
|
-
}
|
|
1798
|
-
const { sessionKey: rawSessionKey, runId } = params;
|
|
1799
|
-
const agentIdOverride = normalizeOptionalText(params.agentId);
|
|
1800
|
-
const abortCfg = context.getRuntimeConfig();
|
|
1801
|
-
const defaultAgentId = resolveDefaultAgentId(abortCfg);
|
|
1802
|
-
const parsedAbortSessionKey = parseAgentSessionKey(rawSessionKey);
|
|
1803
|
-
const abortSessionResolvesGlobal = resolveSessionStoreKey({
|
|
1804
|
-
cfg: abortCfg,
|
|
1805
|
-
sessionKey: rawSessionKey
|
|
1806
|
-
}) === "global";
|
|
1807
|
-
const inferredGlobalAgentId = !agentIdOverride && parsedAbortSessionKey && abortSessionResolvesGlobal ? normalizeAgentId(parsedAbortSessionKey.agentId) : void 0;
|
|
1808
|
-
const abortAgentId = agentIdOverride ?? inferredGlobalAgentId ?? (abortSessionResolvesGlobal ? defaultAgentId : void 0);
|
|
1809
|
-
if (agentIdOverride && parsedAbortSessionKey && normalizeAgentId(parsedAbortSessionKey.agentId) !== normalizeAgentId(agentIdOverride)) {
|
|
1810
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `agentId "${agentIdOverride}" does not match session key "${rawSessionKey}"`));
|
|
1811
|
-
return;
|
|
1812
|
-
}
|
|
1813
|
-
const canonicalAbortSessionKey = abortAgentId && abortSessionResolvesGlobal ? "global" : rawSessionKey;
|
|
1814
|
-
const ops = createChatAbortOps(context);
|
|
1815
|
-
const requester = resolveChatAbortRequester(client);
|
|
1816
|
-
if (!runId) {
|
|
1817
|
-
const res = await abortChatRunsForSessionKeyWithPartials({
|
|
1818
|
-
context,
|
|
1819
|
-
ops,
|
|
1820
|
-
sessionKey: canonicalAbortSessionKey,
|
|
1821
|
-
sessionKeyAliases: canonicalAbortSessionKey === rawSessionKey ? void 0 : [rawSessionKey],
|
|
1822
|
-
agentId: abortAgentId,
|
|
1823
|
-
defaultAgentId,
|
|
1824
|
-
abortOrigin: "rpc",
|
|
1825
|
-
stopReason: "rpc",
|
|
1826
|
-
requester
|
|
1827
|
-
});
|
|
1828
|
-
if (res.unauthorized) {
|
|
1829
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "unauthorized"));
|
|
1830
|
-
return;
|
|
1831
|
-
}
|
|
1832
|
-
respond(true, {
|
|
1833
|
-
ok: true,
|
|
1834
|
-
aborted: res.aborted,
|
|
1835
|
-
runIds: res.runIds
|
|
1836
|
-
});
|
|
1837
|
-
return;
|
|
1838
|
-
}
|
|
1839
|
-
const normalizedAgentIdOverride = abortAgentId?.toLowerCase();
|
|
1840
|
-
const active = context.chatAbortControllers.get(runId);
|
|
1841
|
-
if (!active) {
|
|
1842
|
-
const pendingAgentEntry = context.dedupe.get(`agent:${runId}`);
|
|
1843
|
-
const pendingAgentMatch = (() => {
|
|
1844
|
-
const canonicalMatch = readPreRegisteredAgentDedupePayloadForSession({
|
|
1845
|
-
entry: pendingAgentEntry,
|
|
1846
|
-
runId,
|
|
1847
|
-
sessionKey: canonicalAbortSessionKey,
|
|
1848
|
-
agentId: abortAgentId,
|
|
1849
|
-
defaultAgentId
|
|
1850
|
-
});
|
|
1851
|
-
if (canonicalMatch) return {
|
|
1852
|
-
sessionKey: canonicalAbortSessionKey,
|
|
1853
|
-
payload: canonicalMatch
|
|
1854
|
-
};
|
|
1855
|
-
if (rawSessionKey === canonicalAbortSessionKey) return;
|
|
1856
|
-
const aliasMatch = readPreRegisteredAgentDedupePayloadForSession({
|
|
1857
|
-
entry: pendingAgentEntry,
|
|
1858
|
-
runId,
|
|
1859
|
-
sessionKey: rawSessionKey,
|
|
1860
|
-
agentId: abortAgentId,
|
|
1861
|
-
defaultAgentId
|
|
1862
|
-
});
|
|
1863
|
-
return aliasMatch ? {
|
|
1864
|
-
sessionKey: rawSessionKey,
|
|
1865
|
-
payload: aliasMatch
|
|
1866
|
-
} : void 0;
|
|
1867
|
-
})();
|
|
1868
|
-
if (pendingAgentMatch) {
|
|
1869
|
-
const pendingAgentPayload = pendingAgentMatch.payload;
|
|
1870
|
-
if (!canRequesterAbortPreRegisteredAgentRun(pendingAgentPayload, requester)) {
|
|
1871
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "unauthorized"));
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
writePreRegisteredAgentAbort({
|
|
1875
|
-
context,
|
|
1876
|
-
runId,
|
|
1877
|
-
sessionKey: pendingAgentMatch.sessionKey,
|
|
1878
|
-
payload: pendingAgentPayload,
|
|
1879
|
-
stopReason: "rpc"
|
|
1880
|
-
});
|
|
1881
|
-
respond(true, {
|
|
1882
|
-
ok: true,
|
|
1883
|
-
aborted: true,
|
|
1884
|
-
runIds: [runId]
|
|
1885
|
-
});
|
|
1886
|
-
return;
|
|
1887
|
-
}
|
|
1888
|
-
respond(true, {
|
|
1889
|
-
ok: true,
|
|
1890
|
-
aborted: false,
|
|
1891
|
-
runIds: []
|
|
1892
|
-
});
|
|
1893
|
-
return;
|
|
1894
|
-
}
|
|
1895
|
-
if (!new Set([rawSessionKey, canonicalAbortSessionKey]).has(active.sessionKey) && !canRequesterAbortChatRunWithoutSessionMatch(active, requester)) {
|
|
1896
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "runId does not match sessionKey"));
|
|
1897
|
-
return;
|
|
1898
|
-
}
|
|
1899
|
-
if (normalizedAgentIdOverride && active.sessionKey === "global" && resolveStoredGlobalRunAgentId(active.agentId, defaultAgentId) !== normalizedAgentIdOverride) {
|
|
1900
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "runId does not match agentId"));
|
|
1901
|
-
return;
|
|
1902
|
-
}
|
|
1903
|
-
if (!canRequesterAbortChatRun(active, requester)) {
|
|
1904
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "unauthorized"));
|
|
1905
|
-
return;
|
|
1906
|
-
}
|
|
1907
|
-
const partialText = context.chatRunBuffers.get(runId);
|
|
1908
|
-
const res = abortChatRunById(ops, {
|
|
1909
|
-
runId,
|
|
1910
|
-
sessionKey: active.sessionKey,
|
|
1911
|
-
stopReason: "rpc"
|
|
1912
|
-
});
|
|
1913
|
-
if (res.aborted && partialText && partialText.trim()) await persistAbortedPartials({
|
|
1914
|
-
context,
|
|
1915
|
-
sessionKey: active.sessionKey,
|
|
1916
|
-
snapshots: [{
|
|
1917
|
-
runId,
|
|
1918
|
-
sessionId: active.sessionId,
|
|
1919
|
-
agentId: active.agentId,
|
|
1920
|
-
text: partialText,
|
|
1921
|
-
abortOrigin: "rpc"
|
|
1922
|
-
}]
|
|
1923
|
-
});
|
|
1924
|
-
respond(true, {
|
|
1925
|
-
ok: true,
|
|
1926
|
-
aborted: res.aborted,
|
|
1927
|
-
runIds: res.aborted ? [runId] : []
|
|
1928
|
-
});
|
|
1929
|
-
},
|
|
1930
|
-
"chat.send": async ({ params, respond, context, client }) => {
|
|
1931
|
-
if (!validateChatSendParams(params)) {
|
|
1932
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `invalid chat.send params: ${formatValidationErrors(validateChatSendParams.errors)}`));
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
|
-
const p = params;
|
|
1936
|
-
const explicitOriginResult = normalizeExplicitChatSendOrigin({
|
|
1937
|
-
originatingChannel: p.originatingChannel,
|
|
1938
|
-
originatingTo: p.originatingTo,
|
|
1939
|
-
accountId: p.originatingAccountId,
|
|
1940
|
-
messageThreadId: p.originatingThreadId
|
|
1941
|
-
});
|
|
1942
|
-
if (!explicitOriginResult.ok) {
|
|
1943
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, explicitOriginResult.error));
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
|
-
if ((p.systemInputProvenance || p.systemProvenanceReceipt || explicitOriginResult.value) && !canInjectSystemProvenance(client)) {
|
|
1947
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, p.systemInputProvenance || p.systemProvenanceReceipt ? "system provenance fields require admin scope" : "originating route fields require admin scope"));
|
|
1948
|
-
return;
|
|
1949
|
-
}
|
|
1950
|
-
const sanitizedMessageResult = sanitizeChatSendMessageInput(p.message);
|
|
1951
|
-
if (!sanitizedMessageResult.ok) {
|
|
1952
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, sanitizedMessageResult.error));
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
const systemReceiptResult = normalizeOptionalChatSystemReceipt(p.systemProvenanceReceipt);
|
|
1956
|
-
if (!systemReceiptResult.ok) {
|
|
1957
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, systemReceiptResult.error));
|
|
1958
|
-
return;
|
|
1959
|
-
}
|
|
1960
|
-
const inboundMessage = sanitizedMessageResult.message;
|
|
1961
|
-
const systemInputProvenance = normalizeInputProvenance(p.systemInputProvenance);
|
|
1962
|
-
const systemProvenanceReceipt = systemReceiptResult.receipt;
|
|
1963
|
-
const stopCommand = isChatStopCommandText(inboundMessage);
|
|
1964
|
-
const normalizedAttachments = normalizeRpcAttachmentsToChatAttachments(p.attachments);
|
|
1965
|
-
const rawMessage = inboundMessage.trim();
|
|
1966
|
-
if (!rawMessage && normalizedAttachments.length === 0) {
|
|
1967
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "message or attachment required"));
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
const rawSessionKey = p.sessionKey;
|
|
1971
|
-
const agentIdOverride = normalizeOptionalText(p.agentId);
|
|
1972
|
-
const requestedAgentId = resolveRequestedChatAgentId({
|
|
1973
|
-
cfg: context.getRuntimeConfig?.(),
|
|
1974
|
-
requestedSessionKey: rawSessionKey,
|
|
1975
|
-
agentId: agentIdOverride
|
|
1976
|
-
});
|
|
1977
|
-
const sessionLoadOptions = requestedAgentId ? { agentId: requestedAgentId } : void 0;
|
|
1978
|
-
const { cfg, entry, canonicalKey: sessionKey } = measureDiagnosticsTimelineSpanSync("gateway.chat_send.load_session", () => loadSessionEntry(rawSessionKey, sessionLoadOptions), {
|
|
1979
|
-
phase: "agent-turn",
|
|
1980
|
-
attributes: {
|
|
1981
|
-
hasAttachments: normalizedAttachments.length > 0,
|
|
1982
|
-
hasExplicitOrigin: explicitOriginResult.value !== void 0
|
|
1983
|
-
}
|
|
1984
|
-
});
|
|
1985
|
-
const selectedAgent = validateChatSelectedAgent({
|
|
1986
|
-
cfg,
|
|
1987
|
-
requestedSessionKey: rawSessionKey,
|
|
1988
|
-
agentId: requestedAgentId
|
|
1989
|
-
});
|
|
1990
|
-
if (!selectedAgent.ok) {
|
|
1991
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, selectedAgent.error));
|
|
1992
|
-
return;
|
|
1993
|
-
}
|
|
1994
|
-
const requestedSessionId = normalizeOptionalText(p.sessionId);
|
|
1995
|
-
const backingSessionId = entry?.sessionId ?? requestedSessionId;
|
|
1996
|
-
const deletedAgentId = resolveDeletedAgentIdFromSessionKey(cfg, sessionKey);
|
|
1997
|
-
if (deletedAgentId !== null) {
|
|
1998
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `Agent "${deletedAgentId}" no longer exists in configuration`));
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
const agentId = resolveSessionAgentId({
|
|
2002
|
-
sessionKey,
|
|
2003
|
-
config: cfg,
|
|
2004
|
-
agentId: selectedAgent.agentId
|
|
2005
|
-
});
|
|
2006
|
-
const activeRunScopeKey = resolveChatSendActiveScopeKey({
|
|
2007
|
-
sessionKey,
|
|
2008
|
-
agentId: selectedAgent.agentId,
|
|
2009
|
-
mainKey: cfg.session?.mainKey
|
|
2010
|
-
});
|
|
2011
|
-
const resolvedSessionModel = resolveSessionModelRef(cfg, entry, agentId);
|
|
2012
|
-
const resolvedSessionAuthProvider = resolveProviderIdForAuth(resolvedSessionModel.provider, { config: cfg });
|
|
2013
|
-
let parsedMessage = inboundMessage;
|
|
2014
|
-
let parsedImages = [];
|
|
2015
|
-
let imageOrder = [];
|
|
2016
|
-
let offloadedRefs = [];
|
|
2017
|
-
let mediaPathOffloadPaths = [];
|
|
2018
|
-
let mediaPathOffloadTypes = [];
|
|
2019
|
-
let mediaPathOffloadWorkspaceDir;
|
|
2020
|
-
const timeoutMs = resolveAgentTimeoutMs({
|
|
2021
|
-
cfg,
|
|
2022
|
-
overrideMs: p.timeoutMs
|
|
2023
|
-
});
|
|
2024
|
-
const now = Date.now();
|
|
2025
|
-
const clientRunId = p.idempotencyKey;
|
|
2026
|
-
if (resolveSendPolicy({
|
|
2027
|
-
cfg,
|
|
2028
|
-
entry,
|
|
2029
|
-
sessionKey,
|
|
2030
|
-
channel: entry?.channel,
|
|
2031
|
-
chatType: entry?.chatType
|
|
2032
|
-
}) === "deny") {
|
|
2033
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "send blocked by session policy"));
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
if (stopCommand) {
|
|
2037
|
-
const defaultAgentId = resolveDefaultAgentId(cfg);
|
|
2038
|
-
const stopAgentId = sessionKey === "global" ? selectedAgent.agentId ?? defaultAgentId : selectedAgent.agentId;
|
|
2039
|
-
const res = await abortChatRunsForSessionKeyWithPartials({
|
|
2040
|
-
context,
|
|
2041
|
-
ops: createChatAbortOps(context),
|
|
2042
|
-
sessionKey: rawSessionKey,
|
|
2043
|
-
sessionKeyAliases: sessionKey === rawSessionKey ? void 0 : [sessionKey],
|
|
2044
|
-
agentId: stopAgentId,
|
|
2045
|
-
sessionId: entry?.sessionId,
|
|
2046
|
-
persistSessionKey: sessionKey,
|
|
2047
|
-
defaultAgentId,
|
|
2048
|
-
abortOrigin: "stop-command",
|
|
2049
|
-
stopReason: "stop",
|
|
2050
|
-
requester: resolveChatAbortRequester(client)
|
|
2051
|
-
});
|
|
2052
|
-
if (res.unauthorized) {
|
|
2053
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "unauthorized"));
|
|
2054
|
-
return;
|
|
2055
|
-
}
|
|
2056
|
-
respond(true, {
|
|
2057
|
-
ok: true,
|
|
2058
|
-
aborted: res.aborted,
|
|
2059
|
-
runIds: res.runIds
|
|
2060
|
-
});
|
|
2061
|
-
return;
|
|
2062
|
-
}
|
|
2063
|
-
const cached = context.dedupe.get(`chat:${clientRunId}`);
|
|
2064
|
-
if (cached) {
|
|
2065
|
-
respond(cached.ok, cached.payload, cached.error, { cached: true });
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
if (context.chatAbortControllers.get(clientRunId)) {
|
|
2069
|
-
respond(true, {
|
|
2070
|
-
runId: clientRunId,
|
|
2071
|
-
status: "in_flight"
|
|
2072
|
-
}, void 0, {
|
|
2073
|
-
cached: true,
|
|
2074
|
-
runId: clientRunId
|
|
2075
|
-
});
|
|
2076
|
-
return;
|
|
2077
|
-
}
|
|
2078
|
-
const clientInfo = client?.connect?.client;
|
|
2079
|
-
const originatingRoute = resolveChatSendOriginatingRoute({
|
|
2080
|
-
client: clientInfo,
|
|
2081
|
-
deliver: p.deliver,
|
|
2082
|
-
entry,
|
|
2083
|
-
explicitOrigin: explicitOriginResult.value,
|
|
2084
|
-
hasConnectedClient: client?.connect !== void 0,
|
|
2085
|
-
mainKey: cfg.session?.mainKey,
|
|
2086
|
-
sessionKey
|
|
2087
|
-
});
|
|
2088
|
-
const activeChatSendDedupeKey = buildActiveChatSendDedupeKey({
|
|
2089
|
-
attachmentCount: normalizedAttachments.length,
|
|
2090
|
-
explicitDeliverRoute: originatingRoute.explicitDeliverRoute,
|
|
2091
|
-
message: rawMessage,
|
|
2092
|
-
originatingChannel: originatingRoute.originatingChannel,
|
|
2093
|
-
sessionKey: activeRunScopeKey
|
|
2094
|
-
});
|
|
2095
|
-
if (activeChatSendDedupeKey) {
|
|
2096
|
-
const activeRunId = resolveActiveChatSendRunId(context.dedupe.get(activeChatSendDedupeKey)?.payload);
|
|
2097
|
-
if (activeRunId && context.chatAbortControllers.has(activeRunId)) {
|
|
2098
|
-
respond(true, {
|
|
2099
|
-
runId: activeRunId,
|
|
2100
|
-
status: "in_flight"
|
|
2101
|
-
}, void 0, {
|
|
2102
|
-
cached: true,
|
|
2103
|
-
runId: activeRunId
|
|
2104
|
-
});
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
const explicitOriginTargetsPlugin = explicitOriginTargetsPluginBinding(explicitOriginResult.value);
|
|
2109
|
-
if (normalizedAttachments.length > 0) try {
|
|
2110
|
-
await measureDiagnosticsTimelineSpan("gateway.chat_send.prepare_attachments", async () => {
|
|
2111
|
-
const supportsSessionModelImages = await resolveGatewayModelSupportsImages({
|
|
2112
|
-
loadGatewayModelCatalog: context.loadGatewayModelCatalog,
|
|
2113
|
-
provider: resolvedSessionModel.provider,
|
|
2114
|
-
model: resolvedSessionModel.model
|
|
2115
|
-
});
|
|
2116
|
-
const explicitOriginSupportsInlineImages = explicitOriginTargetsAcpSession(explicitOriginResult.value) || explicitOriginTargetsPlugin;
|
|
2117
|
-
const supportsImages = supportsSessionModelImages || explicitOriginSupportsInlineImages;
|
|
2118
|
-
const routeImageOffloadsAsMediaPaths = !supportsImages;
|
|
2119
|
-
const parsed = await parseMessageWithAttachments(inboundMessage, normalizedAttachments, {
|
|
2120
|
-
maxBytes: resolveChatAttachmentMaxBytes(cfg),
|
|
2121
|
-
log: context.logGateway,
|
|
2122
|
-
supportsImages,
|
|
2123
|
-
acceptNonImage: true
|
|
2124
|
-
});
|
|
2125
|
-
parsedMessage = stripTrailingOffloadedMediaMarkers(parsed.message, routeImageOffloadsAsMediaPaths ? parsed.offloadedRefs.filter((ref) => ref.mimeType.startsWith("image/")) : []);
|
|
2126
|
-
parsedImages = parsed.images;
|
|
2127
|
-
imageOrder = routeImageOffloadsAsMediaPaths ? [] : parsed.imageOrder;
|
|
2128
|
-
offloadedRefs = parsed.offloadedRefs;
|
|
2129
|
-
({paths: mediaPathOffloadPaths, types: mediaPathOffloadTypes, workspaceDir: mediaPathOffloadWorkspaceDir} = await prestageMediaPathOffloads({
|
|
2130
|
-
offloadedRefs,
|
|
2131
|
-
includeImageRefs: routeImageOffloadsAsMediaPaths,
|
|
2132
|
-
cfg,
|
|
2133
|
-
sessionKey,
|
|
2134
|
-
agentId
|
|
2135
|
-
}));
|
|
2136
|
-
}, {
|
|
2137
|
-
phase: "agent-turn",
|
|
2138
|
-
config: cfg,
|
|
2139
|
-
attributes: {
|
|
2140
|
-
attachmentCount: normalizedAttachments.length,
|
|
2141
|
-
hasExplicitOrigin: explicitOriginResult.value !== void 0
|
|
2142
|
-
}
|
|
2143
|
-
});
|
|
2144
|
-
} catch (err) {
|
|
2145
|
-
logAttachmentFailure(context.logGateway, "chat.send attachment parse/stage failed", err);
|
|
2146
|
-
respond(false, void 0, errorShape(err instanceof MediaOffloadError ? ErrorCodes.UNAVAILABLE : ErrorCodes.INVALID_REQUEST, String(err)));
|
|
2147
|
-
return;
|
|
2148
|
-
}
|
|
2149
|
-
try {
|
|
2150
|
-
const activeRunAbort = registerChatAbortController({
|
|
2151
|
-
chatAbortControllers: context.chatAbortControllers,
|
|
2152
|
-
runId: clientRunId,
|
|
2153
|
-
sessionId: backingSessionId ?? clientRunId,
|
|
2154
|
-
sessionKey,
|
|
2155
|
-
agentId: selectedAgent.agentId,
|
|
2156
|
-
timeoutMs,
|
|
2157
|
-
now,
|
|
2158
|
-
ownerConnId: normalizeOptionalText(client?.connId),
|
|
2159
|
-
ownerDeviceId: normalizeOptionalText(client?.connect?.device?.id),
|
|
2160
|
-
providerId: resolvedSessionModel.provider,
|
|
2161
|
-
authProviderId: resolvedSessionAuthProvider,
|
|
2162
|
-
kind: "chat-send"
|
|
2163
|
-
});
|
|
2164
|
-
if (!activeRunAbort.registered) {
|
|
2165
|
-
respond(true, {
|
|
2166
|
-
runId: clientRunId,
|
|
2167
|
-
status: "in_flight"
|
|
2168
|
-
}, void 0, {
|
|
2169
|
-
cached: true,
|
|
2170
|
-
runId: clientRunId
|
|
2171
|
-
});
|
|
2172
|
-
return;
|
|
2173
|
-
}
|
|
2174
|
-
if (activeChatSendDedupeKey) context.dedupe.set(activeChatSendDedupeKey, {
|
|
2175
|
-
ts: now,
|
|
2176
|
-
ok: true,
|
|
2177
|
-
payload: { runId: clientRunId }
|
|
2178
|
-
});
|
|
2179
|
-
context.addChatRun(clientRunId, {
|
|
2180
|
-
sessionKey,
|
|
2181
|
-
agentId: selectedAgent.agentId,
|
|
2182
|
-
clientRunId
|
|
2183
|
-
});
|
|
2184
|
-
respond(true, {
|
|
2185
|
-
runId: clientRunId,
|
|
2186
|
-
status: "started"
|
|
2187
|
-
}, void 0, { runId: clientRunId });
|
|
2188
|
-
const persistedImagesPromise = persistChatSendImages({
|
|
2189
|
-
images: parsedImages,
|
|
2190
|
-
imageOrder,
|
|
2191
|
-
offloadedRefs,
|
|
2192
|
-
client,
|
|
2193
|
-
logGateway: context.logGateway
|
|
2194
|
-
});
|
|
2195
|
-
let persistedMediaForTranscript;
|
|
2196
|
-
const getPersistedMediaForTranscript = async () => {
|
|
2197
|
-
if (!persistedMediaForTranscript) persistedMediaForTranscript = await persistedImagesPromise;
|
|
2198
|
-
return persistedMediaForTranscript;
|
|
2199
|
-
};
|
|
2200
|
-
const preparedUserTurnMediaPromise = normalizedAttachments.length > 0 ? getPersistedMediaForTranscript() : Promise.resolve([]);
|
|
2201
|
-
const userTurnMediaPromise = preparedUserTurnMediaPromise.then(buildChatSendUserTurnMedia);
|
|
2202
|
-
const baseUserTurnInput = {
|
|
2203
|
-
text: rawMessage,
|
|
2204
|
-
timestamp: now,
|
|
2205
|
-
idempotencyKey: `${clientRunId}:user`,
|
|
2206
|
-
...systemInputProvenance ? { provenance: systemInputProvenance } : {}
|
|
2207
|
-
};
|
|
2208
|
-
const userTurnInputPromise = userTurnMediaPromise.then((media) => ({
|
|
2209
|
-
...baseUserTurnInput,
|
|
2210
|
-
...media.length > 0 ? {
|
|
2211
|
-
media,
|
|
2212
|
-
mediaOnlyText: "[User sent media without caption]"
|
|
2213
|
-
} : {}
|
|
2214
|
-
}));
|
|
2215
|
-
const pluginBoundMediaFieldsPromise = explicitOriginTargetsPlugin && parsedImages.length > 0 ? preparedUserTurnMediaPromise.then(resolveChatSendManagedMediaFields) : Promise.resolve({});
|
|
2216
|
-
const trimmedMessage = parsedMessage.trim();
|
|
2217
|
-
const commandBody = Boolean(p.thinking && trimmedMessage && !trimmedMessage.startsWith("/")) ? `/think ${p.thinking} ${parsedMessage}` : parsedMessage;
|
|
2218
|
-
const commandSource = trimmedMessage.startsWith("/") ? "text" : void 0;
|
|
2219
|
-
const messageForAgent = systemProvenanceReceipt ? [systemProvenanceReceipt, parsedMessage].filter(Boolean).join("\n\n") : parsedMessage;
|
|
2220
|
-
const { originatingChannel, originatingTo, accountId, messageThreadId, explicitDeliverRoute } = originatingRoute;
|
|
2221
|
-
const ctx = {
|
|
2222
|
-
Body: messageForAgent,
|
|
2223
|
-
BodyForAgent: injectTimestamp(messageForAgent, timestampOptsFromConfig(cfg)),
|
|
2224
|
-
BodyForCommands: commandBody,
|
|
2225
|
-
RawBody: parsedMessage,
|
|
2226
|
-
CommandBody: commandBody,
|
|
2227
|
-
InputProvenance: systemInputProvenance,
|
|
2228
|
-
SessionKey: sessionKey,
|
|
2229
|
-
AgentId: agentId,
|
|
2230
|
-
Provider: INTERNAL_MESSAGE_CHANNEL,
|
|
2231
|
-
Surface: INTERNAL_MESSAGE_CHANNEL,
|
|
2232
|
-
OriginatingChannel: originatingChannel,
|
|
2233
|
-
OriginatingTo: originatingTo,
|
|
2234
|
-
ExplicitDeliverRoute: explicitDeliverRoute,
|
|
2235
|
-
AccountId: accountId,
|
|
2236
|
-
MessageThreadId: messageThreadId,
|
|
2237
|
-
ChatType: "direct",
|
|
2238
|
-
...commandSource ? { CommandSource: commandSource } : {},
|
|
2239
|
-
CommandAuthorized: true,
|
|
2240
|
-
CommandTurn: commandSource ? {
|
|
2241
|
-
kind: "text-slash",
|
|
2242
|
-
source: commandSource,
|
|
2243
|
-
authorized: true,
|
|
2244
|
-
body: commandBody
|
|
2245
|
-
} : {
|
|
2246
|
-
kind: "normal",
|
|
2247
|
-
source: "message",
|
|
2248
|
-
authorized: false,
|
|
2249
|
-
body: commandBody
|
|
2250
|
-
},
|
|
2251
|
-
MessageSid: clientRunId,
|
|
2252
|
-
...!isOperatorUiClient(clientInfo) ? {
|
|
2253
|
-
SenderId: clientInfo?.id,
|
|
2254
|
-
SenderName: clientInfo?.displayName,
|
|
2255
|
-
SenderUsername: clientInfo?.displayName
|
|
2256
|
-
} : {},
|
|
2257
|
-
GatewayClientScopes: client?.connect?.scopes ?? []
|
|
2258
|
-
};
|
|
2259
|
-
if (mediaPathOffloadPaths.length > 0) {
|
|
2260
|
-
ctx.MediaPath = mediaPathOffloadPaths[0];
|
|
2261
|
-
ctx.MediaPaths = mediaPathOffloadPaths;
|
|
2262
|
-
ctx.MediaType = mediaPathOffloadTypes[0];
|
|
2263
|
-
ctx.MediaTypes = mediaPathOffloadTypes;
|
|
2264
|
-
ctx.MediaWorkspaceDir = mediaPathOffloadWorkspaceDir;
|
|
2265
|
-
ctx.MediaStaged = true;
|
|
2266
|
-
}
|
|
2267
|
-
const replyOptionImages = mediaPathOffloadTypes.some((type) => type.startsWith("image/")) ? void 0 : parsedImages.length > 0 ? parsedImages : void 0;
|
|
2268
|
-
const { onModelSelected, ...replyPipeline } = createChannelReplyPipeline({
|
|
2269
|
-
cfg,
|
|
2270
|
-
agentId,
|
|
2271
|
-
channel: INTERNAL_MESSAGE_CHANNEL
|
|
2272
|
-
});
|
|
2273
|
-
const chatSendTraceAttributes = {
|
|
2274
|
-
hasAttachments: normalizedAttachments.length > 0,
|
|
2275
|
-
hasExplicitOrigin: explicitOriginResult.value !== void 0,
|
|
2276
|
-
hasConnectedClient: client?.connect !== void 0
|
|
2277
|
-
};
|
|
2278
|
-
const deliveredReplies = [];
|
|
2279
|
-
let appendedWebchatAgentMedia = false;
|
|
2280
|
-
let agentRunStarted = false;
|
|
2281
|
-
const userTurnRecorder = createUserTurnTranscriptRecorder({
|
|
2282
|
-
input: baseUserTurnInput,
|
|
2283
|
-
resolveInput: () => userTurnInputPromise,
|
|
2284
|
-
target: () => {
|
|
2285
|
-
const { storePath: latestStorePath, entry: latestEntry } = loadSessionEntry(sessionKey, sessionLoadOptions);
|
|
2286
|
-
const resolvedSessionId = latestEntry?.sessionId ?? backingSessionId;
|
|
2287
|
-
if (!resolvedSessionId) return;
|
|
2288
|
-
return {
|
|
2289
|
-
sessionId: resolvedSessionId,
|
|
2290
|
-
sessionKey,
|
|
2291
|
-
sessionEntry: latestEntry ?? entry,
|
|
2292
|
-
storePath: latestStorePath,
|
|
2293
|
-
agentId,
|
|
2294
|
-
config: cfg
|
|
2295
|
-
};
|
|
2296
|
-
},
|
|
2297
|
-
errorContext: "gateway chat user turn transcript",
|
|
2298
|
-
beforeMessageWrite: runAgentHarnessBeforeMessageWriteHook,
|
|
2299
|
-
onPersistenceError: (error) => {
|
|
2300
|
-
context.logGateway.warn(`gateway user transcript persistence failed: ${formatForLog(error)}`);
|
|
2301
|
-
}
|
|
2302
|
-
});
|
|
2303
|
-
const persistGatewayUserTurnTranscript = async () => {
|
|
2304
|
-
await measureDiagnosticsTimelineSpan("gateway.chat_send.persist_user_transcript", async () => {
|
|
2305
|
-
await userTurnRecorder.persistFallback();
|
|
2306
|
-
}, {
|
|
2307
|
-
phase: "agent-turn",
|
|
2308
|
-
config: cfg,
|
|
2309
|
-
attributes: chatSendTraceAttributes
|
|
2310
|
-
});
|
|
2311
|
-
};
|
|
2312
|
-
const persistGatewayUserTurnTranscriptBestEffort = async () => {
|
|
2313
|
-
await persistGatewayUserTurnTranscript().catch(() => void 0);
|
|
2314
|
-
};
|
|
2315
|
-
const appendWebchatAgentMediaTranscriptIfNeeded = async (payload) => {
|
|
2316
|
-
if (!agentRunStarted || appendedWebchatAgentMedia || !isMediaBearingPayload(payload)) return;
|
|
2317
|
-
if (isSourceReplyTranscriptMirrorPayload(payload)) return;
|
|
2318
|
-
const ttsSupplementMarker = buildTtsSupplementTranscriptMarker(payload);
|
|
2319
|
-
const [transcriptPayload] = await normalizeWebchatReplyMediaPathsForDisplay({
|
|
2320
|
-
cfg,
|
|
2321
|
-
sessionKey,
|
|
2322
|
-
agentId,
|
|
2323
|
-
accountId,
|
|
2324
|
-
payloads: [stripVisibleTextFromTtsSupplement(payload)]
|
|
2325
|
-
});
|
|
2326
|
-
if (!transcriptPayload) return;
|
|
2327
|
-
const { storePath: latestStorePath, entry: latestEntry } = loadSessionEntry(sessionKey, sessionLoadOptions);
|
|
2328
|
-
const sessionId = latestEntry?.sessionId ?? backingSessionId ?? clientRunId;
|
|
2329
|
-
const resolvedTranscriptPath = resolveTranscriptPath({
|
|
2330
|
-
sessionId,
|
|
2331
|
-
storePath: latestStorePath,
|
|
2332
|
-
sessionFile: latestEntry?.sessionFile ?? entry?.sessionFile,
|
|
2333
|
-
agentId
|
|
2334
|
-
});
|
|
2335
|
-
const mediaLocalRoots = appendLocalMediaParentRoots(getAgentScopedMediaLocalRoots(cfg, agentId), resolvedTranscriptPath ? [resolvedTranscriptPath] : void 0);
|
|
2336
|
-
const assistantContent = await buildAssistantDisplayContentFromReplyPayloads({
|
|
2337
|
-
sessionKey,
|
|
2338
|
-
agentId,
|
|
2339
|
-
payloads: [transcriptPayload],
|
|
2340
|
-
managedImageLocalRoots: mediaLocalRoots,
|
|
2341
|
-
includeSensitiveMedia: transcriptPayload.sensitiveMedia !== true,
|
|
2342
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2343
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2344
|
-
},
|
|
2345
|
-
onManagedImagePrepareError: (message) => {
|
|
2346
|
-
context.logGateway.warn(`webchat image embedding skipped attachment: ${message}`);
|
|
2347
|
-
}
|
|
2348
|
-
});
|
|
2349
|
-
const mediaMessage = await buildWebchatAssistantMediaMessage([transcriptPayload], {
|
|
2350
|
-
localRoots: mediaLocalRoots,
|
|
2351
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2352
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2353
|
-
}
|
|
2354
|
-
});
|
|
2355
|
-
const persistedAssistantContent = replaceAssistantContentTextBlocks(assistantContent, mediaMessage);
|
|
2356
|
-
const persistedContentForAppend = hasAssistantDisplayMediaContent(persistedAssistantContent) ? persistedAssistantContent : void 0;
|
|
2357
|
-
if (!persistedContentForAppend?.length) return;
|
|
2358
|
-
const transcriptReply = mediaMessage?.transcriptText ?? extractAssistantDisplayTextFromContent(assistantContent) ?? buildTranscriptReplyText([transcriptPayload]);
|
|
2359
|
-
if (!transcriptReply && !persistedAssistantContent?.length && !assistantContent?.length) return;
|
|
2360
|
-
const appended = await appendAssistantTranscriptMessage({
|
|
2361
|
-
sessionKey,
|
|
2362
|
-
message: transcriptReply,
|
|
2363
|
-
...persistedContentForAppend?.length ? { content: persistedContentForAppend } : {},
|
|
2364
|
-
sessionId,
|
|
2365
|
-
storePath: latestStorePath,
|
|
2366
|
-
sessionFile: latestEntry?.sessionFile,
|
|
2367
|
-
agentId,
|
|
2368
|
-
createIfMissing: true,
|
|
2369
|
-
idempotencyKey: `${clientRunId}:assistant-media`,
|
|
2370
|
-
ttsSupplement: ttsSupplementMarker,
|
|
2371
|
-
cfg
|
|
2372
|
-
});
|
|
2373
|
-
if (appended.ok) {
|
|
2374
|
-
if (appended.messageId && assistantContent?.length) await attachManagedOutgoingImagesToMessage({
|
|
2375
|
-
messageId: appended.messageId,
|
|
2376
|
-
blocks: assistantContent
|
|
2377
|
-
});
|
|
2378
|
-
appendedWebchatAgentMedia = true;
|
|
2379
|
-
return;
|
|
2380
|
-
}
|
|
2381
|
-
context.logGateway.warn(`webchat transcript append failed for media reply: ${appended.error ?? "unknown error"}`);
|
|
2382
|
-
};
|
|
2383
|
-
const dispatcher = createReplyDispatcher({
|
|
2384
|
-
...replyPipeline,
|
|
2385
|
-
onError: (err) => {
|
|
2386
|
-
context.logGateway.warn(`webchat dispatch failed: ${formatForLog(err)}`);
|
|
2387
|
-
},
|
|
2388
|
-
deliver: async (payload, info) => {
|
|
2389
|
-
if (getReplyPayloadMetadata(payload)?.beforeAgentRunBlocked === true) userTurnRecorder.markBlocked();
|
|
2390
|
-
switch (info.kind) {
|
|
2391
|
-
case "block":
|
|
2392
|
-
case "final":
|
|
2393
|
-
deliveredReplies.push({
|
|
2394
|
-
payload,
|
|
2395
|
-
kind: info.kind
|
|
2396
|
-
});
|
|
2397
|
-
await appendWebchatAgentMediaTranscriptIfNeeded(payload);
|
|
2398
|
-
break;
|
|
2399
|
-
case "tool":
|
|
2400
|
-
if (isMediaBearingPayload(payload)) deliveredReplies.push({
|
|
2401
|
-
payload: {
|
|
2402
|
-
...payload,
|
|
2403
|
-
text: void 0
|
|
2404
|
-
},
|
|
2405
|
-
kind: "final"
|
|
2406
|
-
});
|
|
2407
|
-
break;
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
});
|
|
2411
|
-
measureDiagnosticsTimelineSpan("gateway.chat_send.dispatch_inbound", async () => {
|
|
2412
|
-
applyChatSendManagedMediaFields(ctx, await pluginBoundMediaFieldsPromise);
|
|
2413
|
-
const dispatchResult = await dispatchInboundMessage({
|
|
2414
|
-
ctx,
|
|
2415
|
-
cfg,
|
|
2416
|
-
dispatcher,
|
|
2417
|
-
replyOptions: {
|
|
2418
|
-
runId: clientRunId,
|
|
2419
|
-
abortSignal: activeRunAbort.controller.signal,
|
|
2420
|
-
images: replyOptionImages,
|
|
2421
|
-
imageOrder: imageOrder.length > 0 ? imageOrder : void 0,
|
|
2422
|
-
thinkingLevelOverride: p.thinking,
|
|
2423
|
-
fastModeOverride: p.fastMode,
|
|
2424
|
-
userTurnTranscriptRecorder: userTurnRecorder,
|
|
2425
|
-
onAgentRunStart: (runId) => {
|
|
2426
|
-
agentRunStarted = true;
|
|
2427
|
-
const connId = typeof client?.connId === "string" ? client.connId : void 0;
|
|
2428
|
-
const wantsToolEvents = hasGatewayClientCap(client?.connect?.caps, GATEWAY_CLIENT_CAPS.TOOL_EVENTS);
|
|
2429
|
-
if (connId && wantsToolEvents) {
|
|
2430
|
-
context.registerToolEventRecipient(runId, connId);
|
|
2431
|
-
const defaultAgentId = resolveDefaultAgentId(cfg);
|
|
2432
|
-
const selectedGlobalAgentId = sessionKey === "global" ? selectedAgent.agentId ?? defaultAgentId : void 0;
|
|
2433
|
-
for (const [activeRunId, active] of context.chatAbortControllers) {
|
|
2434
|
-
const activeGlobalAgentId = active.sessionKey === "global" ? active.agentId ?? defaultAgentId : void 0;
|
|
2435
|
-
const sameSelectedGlobalAgent = sessionKey === "global" && selectedGlobalAgentId !== void 0 && activeGlobalAgentId === selectedGlobalAgentId;
|
|
2436
|
-
const sameSession = active.sessionKey === sessionKey && (sessionKey !== "global" || sameSelectedGlobalAgent);
|
|
2437
|
-
if (activeRunId !== runId && sameSession) context.registerToolEventRecipient(activeRunId, connId);
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
},
|
|
2441
|
-
onModelSelected: (modelSelection) => {
|
|
2442
|
-
updateChatRunProvider(context.chatAbortControllers, {
|
|
2443
|
-
runId: clientRunId,
|
|
2444
|
-
providerId: modelSelection.provider,
|
|
2445
|
-
authProviderId: resolveProviderIdForAuth(modelSelection.provider, { config: cfg })
|
|
2446
|
-
});
|
|
2447
|
-
onModelSelected(modelSelection);
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
});
|
|
2451
|
-
if (dispatchResult.beforeAgentRunBlocked === true) userTurnRecorder.markBlocked();
|
|
2452
|
-
return dispatchResult;
|
|
2453
|
-
}, {
|
|
2454
|
-
phase: "agent-turn",
|
|
2455
|
-
config: cfg,
|
|
2456
|
-
attributes: chatSendTraceAttributes
|
|
2457
|
-
}).then(async () => {
|
|
2458
|
-
await measureDiagnosticsTimelineSpan("gateway.chat_send.post_dispatch", async () => {
|
|
2459
|
-
const returnedAgentErrorPayloads = agentRunStarted ? deliveredReplies.map((entry) => entry.payload).filter((payload) => payload.isError) : [];
|
|
2460
|
-
const returnedAgentErrorMessage = returnedAgentErrorPayloads.map((payload) => payload.text?.trim()).filter((text) => Boolean(text)).join(" | ") || void 0;
|
|
2461
|
-
if (agentRunStarted && returnedAgentErrorPayloads.length > 0 && !userTurnRecorder.hasPersisted() && !userTurnRecorder.isBlocked()) await persistGatewayUserTurnTranscriptBestEffort();
|
|
2462
|
-
if (agentRunStarted && returnedAgentErrorPayloads.length === 0 && !userTurnRecorder.hasPersisted() && !userTurnRecorder.isBlocked() && userTurnRecorder.hasRuntimePersistencePending()) await persistGatewayUserTurnTranscriptBestEffort();
|
|
2463
|
-
let broadcastedSourceReplyFinal = false;
|
|
2464
|
-
if (!agentRunStarted) {
|
|
2465
|
-
const btwReplies = deliveredReplies.map((entry) => entry.payload).filter(isBtwReplyPayload);
|
|
2466
|
-
const btwText = btwReplies.map((payload) => payload.text.trim()).filter(Boolean).join("\n\n").trim();
|
|
2467
|
-
if (btwReplies.length > 0 && btwText) {
|
|
2468
|
-
broadcastSideResult({
|
|
2469
|
-
context,
|
|
2470
|
-
payload: {
|
|
2471
|
-
kind: "btw",
|
|
2472
|
-
runId: clientRunId,
|
|
2473
|
-
sessionKey,
|
|
2474
|
-
...sessionKey === "global" && agentId ? { agentId } : {},
|
|
2475
|
-
question: btwReplies[0].btw.question.trim(),
|
|
2476
|
-
text: btwText,
|
|
2477
|
-
isError: btwReplies.some((payload) => payload.isError),
|
|
2478
|
-
ts: Date.now()
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
broadcastChatFinal({
|
|
2482
|
-
context,
|
|
2483
|
-
runId: clientRunId,
|
|
2484
|
-
sessionKey,
|
|
2485
|
-
agentId
|
|
2486
|
-
});
|
|
2487
|
-
} else {
|
|
2488
|
-
await persistGatewayUserTurnTranscriptBestEffort();
|
|
2489
|
-
const finalPayloads = await normalizeWebchatReplyMediaPathsForDisplay({
|
|
2490
|
-
cfg,
|
|
2491
|
-
sessionKey,
|
|
2492
|
-
agentId,
|
|
2493
|
-
accountId,
|
|
2494
|
-
payloads: appendedWebchatAgentMedia ? [] : deliveredReplies.filter((entry) => entry.kind === "final").map((entry) => entry.payload)
|
|
2495
|
-
});
|
|
2496
|
-
const { storePath: latestStorePath, entry: latestEntry } = loadSessionEntry(sessionKey, sessionLoadOptions);
|
|
2497
|
-
const sessionId = latestEntry?.sessionId ?? backingSessionId ?? clientRunId;
|
|
2498
|
-
const resolvedTranscriptPath = resolveTranscriptPath({
|
|
2499
|
-
sessionId,
|
|
2500
|
-
storePath: latestStorePath,
|
|
2501
|
-
sessionFile: latestEntry?.sessionFile ?? entry?.sessionFile,
|
|
2502
|
-
agentId
|
|
2503
|
-
});
|
|
2504
|
-
const mediaLocalRoots = appendLocalMediaParentRoots(getAgentScopedMediaLocalRoots(cfg, agentId), resolvedTranscriptPath ? [resolvedTranscriptPath] : void 0);
|
|
2505
|
-
const assistantContent = await buildAssistantDisplayContentFromReplyPayloads({
|
|
2506
|
-
sessionKey,
|
|
2507
|
-
agentId,
|
|
2508
|
-
payloads: finalPayloads,
|
|
2509
|
-
managedImageLocalRoots: mediaLocalRoots,
|
|
2510
|
-
includeSensitiveMedia: false,
|
|
2511
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2512
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2513
|
-
},
|
|
2514
|
-
onManagedImagePrepareError: (message) => {
|
|
2515
|
-
context.logGateway.warn(`webchat image embedding skipped attachment: ${message}`);
|
|
2516
|
-
}
|
|
2517
|
-
});
|
|
2518
|
-
const mediaMessage = await buildWebchatAssistantMediaMessage(finalPayloads, {
|
|
2519
|
-
localRoots: mediaLocalRoots,
|
|
2520
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2521
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2522
|
-
}
|
|
2523
|
-
});
|
|
2524
|
-
const hasSensitiveMedia = hasSensitiveMediaPayload(finalPayloads);
|
|
2525
|
-
const ttsSupplementMarker = finalPayloads.map((payload) => buildMediaOnlyTtsSupplementTranscriptMarker(payload)).find((marker) => Boolean(marker));
|
|
2526
|
-
const persistedAssistantContent = replaceAssistantContentTextBlocks(hasSensitiveMedia ? await buildAssistantDisplayContentFromReplyPayloads({
|
|
2527
|
-
sessionKey,
|
|
2528
|
-
agentId,
|
|
2529
|
-
payloads: finalPayloads,
|
|
2530
|
-
managedImageLocalRoots: mediaLocalRoots,
|
|
2531
|
-
includeSensitiveMedia: false,
|
|
2532
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2533
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2534
|
-
},
|
|
2535
|
-
onManagedImagePrepareError: (message) => {
|
|
2536
|
-
context.logGateway.warn(`webchat image embedding skipped attachment: ${message}`);
|
|
2537
|
-
}
|
|
2538
|
-
}) : assistantContent, mediaMessage);
|
|
2539
|
-
const persistedContentForAppend = hasAssistantDisplayMediaContent(persistedAssistantContent) ? persistedAssistantContent : void 0;
|
|
2540
|
-
const broadcastAssistantContent = hasAssistantDisplayMediaContent(assistantContent) ? assistantContent : hasAssistantDisplayMediaContent(mediaMessage?.content) ? mediaMessage?.content : assistantContent;
|
|
2541
|
-
const displayReply = extractAssistantDisplayTextFromContent(assistantContent) ?? buildTranscriptReplyText(finalPayloads);
|
|
2542
|
-
const transcriptReply = mediaMessage?.transcriptText || buildTranscriptReplyText(finalPayloads) || displayReply;
|
|
2543
|
-
let message;
|
|
2544
|
-
if (transcriptReply || persistedContentForAppend?.length || assistantContent?.length) {
|
|
2545
|
-
const appended = await appendAssistantTranscriptMessage({
|
|
2546
|
-
sessionKey,
|
|
2547
|
-
message: transcriptReply,
|
|
2548
|
-
...persistedContentForAppend?.length ? { content: persistedContentForAppend } : {},
|
|
2549
|
-
sessionId,
|
|
2550
|
-
storePath: latestStorePath,
|
|
2551
|
-
sessionFile: latestEntry?.sessionFile,
|
|
2552
|
-
agentId,
|
|
2553
|
-
createIfMissing: true,
|
|
2554
|
-
idempotencyKey: clientRunId,
|
|
2555
|
-
ttsSupplement: ttsSupplementMarker,
|
|
2556
|
-
cfg
|
|
2557
|
-
});
|
|
2558
|
-
if (appended.ok) {
|
|
2559
|
-
if (appended.messageId && assistantContent?.length) await attachManagedOutgoingImagesToMessage({
|
|
2560
|
-
messageId: appended.messageId,
|
|
2561
|
-
blocks: assistantContent
|
|
2562
|
-
});
|
|
2563
|
-
message = broadcastAssistantContent?.length ? {
|
|
2564
|
-
...appended.message,
|
|
2565
|
-
content: broadcastAssistantContent
|
|
2566
|
-
} : appended.message;
|
|
2567
|
-
} else {
|
|
2568
|
-
context.logGateway.warn(`webchat transcript append failed: ${appended.error ?? "unknown error"}`);
|
|
2569
|
-
const fallbackAssistantContent = stripManagedOutgoingAssistantContentBlocks(persistedAssistantContent) ?? stripManagedOutgoingAssistantContentBlocks(assistantContent);
|
|
2570
|
-
const fallbackText = extractAssistantDisplayText(fallbackAssistantContent) ?? displayReply;
|
|
2571
|
-
const now = Date.now();
|
|
2572
|
-
message = {
|
|
2573
|
-
role: "assistant",
|
|
2574
|
-
...fallbackAssistantContent?.length ? { content: fallbackAssistantContent } : fallbackText ? { content: [{
|
|
2575
|
-
type: "text",
|
|
2576
|
-
text: fallbackText
|
|
2577
|
-
}] } : {},
|
|
2578
|
-
...fallbackText ? { text: fallbackText } : {},
|
|
2579
|
-
timestamp: now,
|
|
2580
|
-
...ttsSupplementMarker ? { fengmingTtsSupplement: ttsSupplementMarker } : {},
|
|
2581
|
-
stopReason: "stop",
|
|
2582
|
-
usage: {
|
|
2583
|
-
input: 0,
|
|
2584
|
-
output: 0,
|
|
2585
|
-
totalTokens: 0
|
|
2586
|
-
}
|
|
2587
|
-
};
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
broadcastChatFinal({
|
|
2591
|
-
context,
|
|
2592
|
-
runId: clientRunId,
|
|
2593
|
-
sessionKey,
|
|
2594
|
-
agentId,
|
|
2595
|
-
message
|
|
2596
|
-
});
|
|
2597
|
-
}
|
|
2598
|
-
} else {
|
|
2599
|
-
const sourceReplyPayloads = deliveredReplies.filter((entry) => entry.kind === "final").map((entry) => entry.payload).filter(isSourceReplyTranscriptMirrorPayload);
|
|
2600
|
-
if (sourceReplyPayloads.length > 0) {
|
|
2601
|
-
const finalPayloads = await normalizeWebchatReplyMediaPathsForDisplay({
|
|
2602
|
-
cfg,
|
|
2603
|
-
sessionKey,
|
|
2604
|
-
agentId,
|
|
2605
|
-
accountId,
|
|
2606
|
-
payloads: sourceReplyPayloads
|
|
2607
|
-
});
|
|
2608
|
-
const { storePath: latestStorePath, entry: latestEntry } = loadSessionEntry(sessionKey, sessionLoadOptions);
|
|
2609
|
-
const resolvedTranscriptPath = resolveTranscriptPath({
|
|
2610
|
-
sessionId: latestEntry?.sessionId ?? backingSessionId ?? clientRunId,
|
|
2611
|
-
storePath: latestStorePath,
|
|
2612
|
-
sessionFile: latestEntry?.sessionFile ?? entry?.sessionFile,
|
|
2613
|
-
agentId
|
|
2614
|
-
});
|
|
2615
|
-
const mediaLocalRoots = appendLocalMediaParentRoots(getAgentScopedMediaLocalRoots(cfg, agentId), resolvedTranscriptPath ? [resolvedTranscriptPath] : void 0);
|
|
2616
|
-
const buildReplyAssistantContent = async (payloads) => await buildAssistantDisplayContentFromReplyPayloads({
|
|
2617
|
-
sessionKey,
|
|
2618
|
-
agentId,
|
|
2619
|
-
payloads,
|
|
2620
|
-
managedImageLocalRoots: mediaLocalRoots,
|
|
2621
|
-
includeSensitiveMedia: false,
|
|
2622
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2623
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2624
|
-
},
|
|
2625
|
-
onManagedImagePrepareError: (message) => {
|
|
2626
|
-
context.logGateway.warn(`webchat image embedding skipped attachment: ${message}`);
|
|
2627
|
-
}
|
|
2628
|
-
});
|
|
2629
|
-
const buildReplyMediaMessage = async (payloads) => await buildWebchatAssistantMediaMessage(payloads, {
|
|
2630
|
-
localRoots: mediaLocalRoots,
|
|
2631
|
-
onLocalAudioAccessDenied: (message) => {
|
|
2632
|
-
context.logGateway.warn(`webchat audio embedding denied local path: ${message}`);
|
|
2633
|
-
}
|
|
2634
|
-
});
|
|
2635
|
-
const combinedAssistantContent = sourceReplyPayloads.length === 1 ? await buildReplyAssistantContent(finalPayloads) : void 0;
|
|
2636
|
-
const combinedMediaMessage = sourceReplyPayloads.length === 1 ? await buildReplyMediaMessage(finalPayloads) : void 0;
|
|
2637
|
-
const sourceReplyContentStates = [];
|
|
2638
|
-
const sourceReplyBroadcastContent = [];
|
|
2639
|
-
for (const [replyIndex] of sourceReplyPayloads.entries()) {
|
|
2640
|
-
const finalPayload = finalPayloads[replyIndex];
|
|
2641
|
-
if (!finalPayload) continue;
|
|
2642
|
-
const replyAssistantContent = sourceReplyPayloads.length === 1 ? combinedAssistantContent : await buildReplyAssistantContent([finalPayload]);
|
|
2643
|
-
const replyMediaMessage = sourceReplyPayloads.length === 1 ? combinedMediaMessage : await buildReplyMediaMessage([finalPayload]);
|
|
2644
|
-
const replyBroadcastContent = hasAssistantDisplayMediaContent(replyAssistantContent) ? replyAssistantContent : hasAssistantDisplayMediaContent(replyMediaMessage?.content) ? replyMediaMessage?.content : replyAssistantContent;
|
|
2645
|
-
const persistedContent = replaceAssistantContentTextBlocks(replyAssistantContent, replyMediaMessage ?? null);
|
|
2646
|
-
const state = {
|
|
2647
|
-
broadcastContent: replyBroadcastContent ? [...replyBroadcastContent] : [],
|
|
2648
|
-
persistedContent: persistedContent ? [...persistedContent] : [],
|
|
2649
|
-
hasManagedOutgoingContent: hasManagedOutgoingAssistantContent(persistedContent),
|
|
2650
|
-
backedManagedOutgoingContent: false
|
|
2651
|
-
};
|
|
2652
|
-
sourceReplyContentStates[replyIndex] = state;
|
|
2653
|
-
if (state.broadcastContent.length > 0) sourceReplyBroadcastContent.push(...state.broadcastContent);
|
|
2654
|
-
}
|
|
2655
|
-
const displayReply = extractAssistantDisplayTextFromContent(sourceReplyBroadcastContent) ?? buildTranscriptReplyText(finalPayloads);
|
|
2656
|
-
if (sourceReplyBroadcastContent.length || displayReply) {
|
|
2657
|
-
const sourceReplyPersistenceRequests = [];
|
|
2658
|
-
for (const [replyIndex, sourceReplyPayload] of sourceReplyPayloads.entries()) {
|
|
2659
|
-
const state = sourceReplyContentStates[replyIndex];
|
|
2660
|
-
if (!state || !hasAssistantDisplayMediaContent(state.persistedContent)) continue;
|
|
2661
|
-
const mirrorMetadata = getReplyPayloadMetadata(sourceReplyPayload)?.sourceReplyTranscriptMirror;
|
|
2662
|
-
const mirrorIdempotencyKey = mirrorMetadata?.idempotencyKey;
|
|
2663
|
-
if (typeof mirrorIdempotencyKey !== "string" || mirrorIdempotencyKey.trim().length === 0) continue;
|
|
2664
|
-
if (!state.hasManagedOutgoingContent) state.backedManagedOutgoingContent = true;
|
|
2665
|
-
sourceReplyPersistenceRequests.push({
|
|
2666
|
-
idempotencyKey: mirrorIdempotencyKey,
|
|
2667
|
-
metadata: mirrorMetadata,
|
|
2668
|
-
state
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
const attachSourceReplyManagedImages = async (params) => {
|
|
2672
|
-
if (!params.request.state.hasManagedOutgoingContent) {
|
|
2673
|
-
params.request.state.backedManagedOutgoingContent = true;
|
|
2674
|
-
return;
|
|
2675
|
-
}
|
|
2676
|
-
if (!params.messageId) return;
|
|
2677
|
-
await attachManagedOutgoingImagesToMessage({
|
|
2678
|
-
messageId: params.messageId,
|
|
2679
|
-
blocks: params.request.state.persistedContent
|
|
2680
|
-
});
|
|
2681
|
-
params.request.state.backedManagedOutgoingContent = true;
|
|
2682
|
-
};
|
|
2683
|
-
if (resolvedTranscriptPath && sourceReplyPersistenceRequests.length > 0) {
|
|
2684
|
-
const allowedSourceReplyMirrorIds = /* @__PURE__ */ new Set();
|
|
2685
|
-
for (const [replyIndex, sourceReplyPayload] of sourceReplyPayloads.entries()) {
|
|
2686
|
-
if (!sourceReplyContentStates[replyIndex]) continue;
|
|
2687
|
-
const mirrorIdempotencyKey = getReplyPayloadMetadata(sourceReplyPayload)?.sourceReplyTranscriptMirror?.idempotencyKey;
|
|
2688
|
-
const mirrorMetadata = getReplyPayloadMetadata(sourceReplyPayload)?.sourceReplyTranscriptMirror;
|
|
2689
|
-
if (typeof mirrorIdempotencyKey !== "string" || mirrorIdempotencyKey.trim().length === 0 || !mirrorMetadata) continue;
|
|
2690
|
-
const target = await findSourceReplyTranscriptMirrorByMetadata({
|
|
2691
|
-
transcriptPath: resolvedTranscriptPath,
|
|
2692
|
-
idempotencyKey: mirrorIdempotencyKey,
|
|
2693
|
-
metadata: mirrorMetadata
|
|
2694
|
-
});
|
|
2695
|
-
if (target) allowedSourceReplyMirrorIds.add(target.messageId);
|
|
2696
|
-
}
|
|
2697
|
-
const rewriteTargets = [];
|
|
2698
|
-
for (const request of sourceReplyPersistenceRequests) {
|
|
2699
|
-
const target = await findSourceReplyTranscriptMirrorByMetadata({
|
|
2700
|
-
transcriptPath: resolvedTranscriptPath,
|
|
2701
|
-
idempotencyKey: request.idempotencyKey,
|
|
2702
|
-
metadata: request.metadata
|
|
2703
|
-
});
|
|
2704
|
-
if (target) rewriteTargets.push({
|
|
2705
|
-
request,
|
|
2706
|
-
...target
|
|
2707
|
-
});
|
|
2708
|
-
}
|
|
2709
|
-
if (rewriteTargets.length > 0) {
|
|
2710
|
-
const rewriteTargetIds = new Set(rewriteTargets.map((target) => target.messageId));
|
|
2711
|
-
const rewriteIndex = await readSessionTranscriptIndex(resolvedTranscriptPath);
|
|
2712
|
-
const firstRewriteEntryIndex = rewriteIndex?.entries.findIndex((entry) => typeof entry.id === "string" && rewriteTargetIds.has(entry.id)) ?? -1;
|
|
2713
|
-
if (firstRewriteEntryIndex >= 0 && rewriteIndex?.entries.slice(firstRewriteEntryIndex).every((entry) => typeof entry.id !== "string" || allowedSourceReplyMirrorIds.has(entry.id)) === true) {
|
|
2714
|
-
if ((await rewriteTranscriptEntriesInSessionFile({
|
|
2715
|
-
sessionFile: resolvedTranscriptPath,
|
|
2716
|
-
sessionKey,
|
|
2717
|
-
agentId,
|
|
2718
|
-
config: cfg,
|
|
2719
|
-
request: {
|
|
2720
|
-
allowedRewriteSuffixEntryIds: [...allowedSourceReplyMirrorIds],
|
|
2721
|
-
replacements: rewriteTargets.map((target) => ({
|
|
2722
|
-
entryId: target.messageId,
|
|
2723
|
-
message: {
|
|
2724
|
-
...target.message,
|
|
2725
|
-
idempotencyKey: target.request.idempotencyKey,
|
|
2726
|
-
content: target.request.state.persistedContent
|
|
2727
|
-
}
|
|
2728
|
-
}))
|
|
2729
|
-
}
|
|
2730
|
-
})).changed) for (const target of rewriteTargets) await attachSourceReplyManagedImages({
|
|
2731
|
-
messageId: (await findSourceReplyTranscriptMirrorByIdempotencyKey(resolvedTranscriptPath, target.request.idempotencyKey))?.messageId,
|
|
2732
|
-
request: target.request
|
|
2733
|
-
});
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
}
|
|
2737
|
-
const sourceReplyContent = sourceReplyContentStates.flatMap((state) => {
|
|
2738
|
-
if (state.hasManagedOutgoingContent && !state.backedManagedOutgoingContent) {
|
|
2739
|
-
const stripped = stripManagedOutgoingAssistantContentBlocks(state.broadcastContent);
|
|
2740
|
-
return stripped?.length ? stripped : [{
|
|
2741
|
-
type: "text",
|
|
2742
|
-
text: "Media reply could not be displayed."
|
|
2743
|
-
}];
|
|
2744
|
-
}
|
|
2745
|
-
return state.broadcastContent;
|
|
2746
|
-
}).filter((block) => Boolean(block));
|
|
2747
|
-
const sourceReplyText = extractAssistantDisplayTextFromContent(sourceReplyContent) ?? (sourceReplyContent.length === 0 ? displayReply : void 0);
|
|
2748
|
-
const now = Date.now();
|
|
2749
|
-
broadcastChatFinal({
|
|
2750
|
-
context,
|
|
2751
|
-
runId: clientRunId,
|
|
2752
|
-
sessionKey,
|
|
2753
|
-
agentId,
|
|
2754
|
-
message: {
|
|
2755
|
-
role: "assistant",
|
|
2756
|
-
...sourceReplyContent?.length ? { content: sourceReplyContent } : sourceReplyText ? { content: [{
|
|
2757
|
-
type: "text",
|
|
2758
|
-
text: sourceReplyText
|
|
2759
|
-
}] } : {},
|
|
2760
|
-
...sourceReplyText ? { text: sourceReplyText } : {},
|
|
2761
|
-
timestamp: now,
|
|
2762
|
-
stopReason: "stop",
|
|
2763
|
-
usage: {
|
|
2764
|
-
input: 0,
|
|
2765
|
-
output: 0,
|
|
2766
|
-
totalTokens: 0
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
});
|
|
2770
|
-
broadcastedSourceReplyFinal = true;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
const shouldBroadcastAgentError = returnedAgentErrorPayloads.length > 0 && !broadcastedSourceReplyFinal;
|
|
2775
|
-
if (shouldBroadcastAgentError) broadcastChatError({
|
|
2776
|
-
context,
|
|
2777
|
-
runId: clientRunId,
|
|
2778
|
-
sessionKey,
|
|
2779
|
-
agentId,
|
|
2780
|
-
errorMessage: returnedAgentErrorMessage
|
|
2781
|
-
});
|
|
2782
|
-
if (!context.chatAbortedRuns.has(clientRunId)) {
|
|
2783
|
-
const returnedAgentError = shouldBroadcastAgentError ? errorShape(ErrorCodes.UNAVAILABLE, returnedAgentErrorMessage ?? "agent returned an error payload") : void 0;
|
|
2784
|
-
setGatewayDedupeEntry({
|
|
2785
|
-
dedupe: context.dedupe,
|
|
2786
|
-
key: `chat:${clientRunId}`,
|
|
2787
|
-
entry: {
|
|
2788
|
-
ts: Date.now(),
|
|
2789
|
-
ok: !shouldBroadcastAgentError,
|
|
2790
|
-
payload: shouldBroadcastAgentError ? {
|
|
2791
|
-
runId: clientRunId,
|
|
2792
|
-
status: "error",
|
|
2793
|
-
summary: returnedAgentErrorMessage ?? "agent returned an error payload"
|
|
2794
|
-
} : {
|
|
2795
|
-
runId: clientRunId,
|
|
2796
|
-
status: "ok"
|
|
2797
|
-
},
|
|
2798
|
-
...returnedAgentError ? { error: returnedAgentError } : {}
|
|
2799
|
-
}
|
|
2800
|
-
});
|
|
2801
|
-
}
|
|
2802
|
-
}, {
|
|
2803
|
-
phase: "agent-turn",
|
|
2804
|
-
config: cfg,
|
|
2805
|
-
attributes: chatSendTraceAttributes
|
|
2806
|
-
});
|
|
2807
|
-
}).catch(async (err) => {
|
|
2808
|
-
await (userTurnRecorder.hasPersisted() || userTurnRecorder.isBlocked() ? Promise.resolve() : persistGatewayUserTurnTranscript()).catch((transcriptErr) => {
|
|
2809
|
-
context.logGateway.warn(`webchat user transcript update failed after error: ${formatForLog(transcriptErr)}`);
|
|
2810
|
-
});
|
|
2811
|
-
const error = errorShape(ErrorCodes.UNAVAILABLE, String(err));
|
|
2812
|
-
setGatewayDedupeEntry({
|
|
2813
|
-
dedupe: context.dedupe,
|
|
2814
|
-
key: `chat:${clientRunId}`,
|
|
2815
|
-
entry: {
|
|
2816
|
-
ts: Date.now(),
|
|
2817
|
-
ok: false,
|
|
2818
|
-
payload: {
|
|
2819
|
-
runId: clientRunId,
|
|
2820
|
-
status: "error",
|
|
2821
|
-
summary: String(err)
|
|
2822
|
-
},
|
|
2823
|
-
error
|
|
2824
|
-
}
|
|
2825
|
-
});
|
|
2826
|
-
broadcastChatError({
|
|
2827
|
-
context,
|
|
2828
|
-
runId: clientRunId,
|
|
2829
|
-
sessionKey,
|
|
2830
|
-
agentId,
|
|
2831
|
-
errorMessage: String(err)
|
|
2832
|
-
});
|
|
2833
|
-
}).finally(() => {
|
|
2834
|
-
activeRunAbort.cleanup();
|
|
2835
|
-
context.removeChatRun(clientRunId, clientRunId, sessionKey);
|
|
2836
|
-
});
|
|
2837
|
-
} catch (err) {
|
|
2838
|
-
context.chatAbortControllers.delete(clientRunId);
|
|
2839
|
-
context.removeChatRun(clientRunId, clientRunId, sessionKey);
|
|
2840
|
-
const error = errorShape(ErrorCodes.UNAVAILABLE, String(err));
|
|
2841
|
-
const payload = {
|
|
2842
|
-
runId: clientRunId,
|
|
2843
|
-
status: "error",
|
|
2844
|
-
summary: String(err)
|
|
2845
|
-
};
|
|
2846
|
-
setGatewayDedupeEntry({
|
|
2847
|
-
dedupe: context.dedupe,
|
|
2848
|
-
key: `chat:${clientRunId}`,
|
|
2849
|
-
entry: {
|
|
2850
|
-
ts: Date.now(),
|
|
2851
|
-
ok: false,
|
|
2852
|
-
payload,
|
|
2853
|
-
error
|
|
2854
|
-
}
|
|
2855
|
-
});
|
|
2856
|
-
respond(false, payload, error, {
|
|
2857
|
-
runId: clientRunId,
|
|
2858
|
-
error: formatForLog(err)
|
|
2859
|
-
});
|
|
2860
|
-
broadcastChatError({
|
|
2861
|
-
context,
|
|
2862
|
-
runId: clientRunId,
|
|
2863
|
-
sessionKey,
|
|
2864
|
-
agentId,
|
|
2865
|
-
errorMessage: String(err)
|
|
2866
|
-
});
|
|
2867
|
-
}
|
|
2868
|
-
},
|
|
2869
|
-
"chat.inject": async ({ params, respond, context }) => {
|
|
2870
|
-
if (!validateChatInjectParams(params)) {
|
|
2871
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `invalid chat.inject params: ${formatValidationErrors(validateChatInjectParams.errors)}`));
|
|
2872
|
-
return;
|
|
2873
|
-
}
|
|
2874
|
-
const p = params;
|
|
2875
|
-
const rawSessionKey = p.sessionKey;
|
|
2876
|
-
const requestedAgentId = resolveRequestedChatAgentId({
|
|
2877
|
-
cfg: context.getRuntimeConfig?.(),
|
|
2878
|
-
requestedSessionKey: rawSessionKey,
|
|
2879
|
-
agentId: p.agentId
|
|
2880
|
-
});
|
|
2881
|
-
const { cfg, storePath, entry, canonicalKey: sessionKey } = loadSessionEntry(rawSessionKey, requestedAgentId ? { agentId: requestedAgentId } : void 0);
|
|
2882
|
-
const selectedAgent = validateChatSelectedAgent({
|
|
2883
|
-
cfg,
|
|
2884
|
-
requestedSessionKey: rawSessionKey,
|
|
2885
|
-
agentId: requestedAgentId
|
|
2886
|
-
});
|
|
2887
|
-
if (!selectedAgent.ok) {
|
|
2888
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, selectedAgent.error));
|
|
2889
|
-
return;
|
|
2890
|
-
}
|
|
2891
|
-
const sessionId = entry?.sessionId;
|
|
2892
|
-
if (!sessionId || !storePath) {
|
|
2893
|
-
respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "session not found"));
|
|
2894
|
-
return;
|
|
2895
|
-
}
|
|
2896
|
-
const agentId = resolveSessionAgentId({
|
|
2897
|
-
sessionKey,
|
|
2898
|
-
config: cfg,
|
|
2899
|
-
agentId: selectedAgent.agentId
|
|
2900
|
-
});
|
|
2901
|
-
const appended = await appendAssistantTranscriptMessage({
|
|
2902
|
-
sessionKey,
|
|
2903
|
-
message: p.message,
|
|
2904
|
-
label: p.label,
|
|
2905
|
-
sessionId,
|
|
2906
|
-
storePath,
|
|
2907
|
-
sessionFile: entry?.sessionFile,
|
|
2908
|
-
agentId,
|
|
2909
|
-
createIfMissing: true,
|
|
2910
|
-
cfg
|
|
2911
|
-
});
|
|
2912
|
-
if (!appended.ok || !appended.messageId || !appended.message) {
|
|
2913
|
-
respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, `failed to write transcript: ${appended.error ?? "unknown error"}`));
|
|
2914
|
-
return;
|
|
2915
|
-
}
|
|
2916
|
-
const message = projectChatDisplayMessage(appended.message, { maxChars: resolveEffectiveChatHistoryMaxChars(cfg) });
|
|
2917
|
-
const chatPayload = {
|
|
2918
|
-
runId: `inject-${appended.messageId}`,
|
|
2919
|
-
sessionKey,
|
|
2920
|
-
...sessionKey === "global" && agentId ? { agentId } : {},
|
|
2921
|
-
seq: 0,
|
|
2922
|
-
state: "final",
|
|
2923
|
-
message
|
|
2924
|
-
};
|
|
2925
|
-
context.broadcast("chat", chatPayload);
|
|
2926
|
-
sendGlobalAwareNodeChatPayload({
|
|
2927
|
-
context,
|
|
2928
|
-
sessionKey,
|
|
2929
|
-
agentId,
|
|
2930
|
-
event: "chat",
|
|
2931
|
-
payload: chatPayload
|
|
2932
|
-
});
|
|
2933
|
-
respond(true, {
|
|
2934
|
-
ok: true,
|
|
2935
|
-
messageId: appended.messageId
|
|
2936
|
-
});
|
|
2937
|
-
}
|
|
2938
|
-
};
|
|
2939
|
-
//#endregion
|
|
2940
|
-
export { dropPreSessionStartAnnouncePairs as a, sanitizeChatSendMessageInput as c, chatHandlers as i, augmentChatHistoryWithCanvasBlocks as n, enforceChatHistoryFinalBudget as o, buildOversizedHistoryPlaceholder as r, replaceOversizedChatHistoryMessages as s, CHAT_HISTORY_MAX_SINGLE_MESSAGE_BYTES as t };
|