@pixelzx/genesis 2026.5.5-1 → 2026.5.5-2
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 +2 -0
- package/dist/.buildstamp +1 -1
- package/dist/abort-BHSttDhY.js +201 -0
- package/dist/abort-cutoff.runtime-DCJWSVCk.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort.runtime-VJ9lFsZS.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/accounts-BNvagEOQ.js +104 -0
- package/dist/accounts-CJJT0vS7.js +43 -0
- package/dist/accounts-CM2Ko2xl.js +365 -0
- package/dist/accounts-CPIuzenz.js +107 -0
- package/dist/accounts-Co4cbVCU.js +66 -0
- package/dist/accounts-r08DQWhZ.js +2 -0
- package/dist/accounts.runtime-V3yFS1uD.js +2 -0
- package/dist/accounts.runtime.js +1 -1
- package/dist/acp-cli-i0L-eRs9.js +2193 -0
- package/dist/acp-spawn-CHzVLe9q.js +1093 -0
- package/dist/acp-spawn-CqvxDuBq.js +2 -0
- package/dist/acp-stateful-target-driver-CWRLc_NP.js +89 -0
- package/dist/action-agents-SNCscX_-.js +67 -0
- package/dist/action-focus-B2s0PF2E.js +132 -0
- package/dist/action-help-CXKbyaZ7.js +7 -0
- package/dist/action-info-B3IDKxWu.js +101 -0
- package/dist/action-kill-idGvCNhT.js +33 -0
- package/dist/action-list-Di7gO3qL.js +21 -0
- package/dist/action-log-BCsz-gFi.js +30 -0
- package/dist/action-send-DLsdZnVc.js +39 -0
- package/dist/action-spawn-DhKEOdL0.js +47 -0
- package/dist/action-unfocus-Dh7ti5UP.js +29 -0
- package/dist/actions.runtime-BPf03SN3.js +18 -0
- package/dist/actions.runtime-CJg_lweh.js +5 -0
- package/dist/actions.runtime.js +1 -1
- package/dist/agent-C3PLvvws.js +2 -0
- package/dist/agent-command-UroeNrV4.js +874 -0
- package/dist/agent-harness-runtime-MXvI9FlJ.js +144 -0
- package/dist/agent-runner-utils-CaVgLZrf.js +239 -0
- package/dist/agent-runner.runtime-Csqm3m09.js +3455 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-B9nUYDUz.js +18 -0
- package/dist/agents/auth-profiles.runtime.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents/models-config.runtime.js +1 -1
- package/dist/agents/pi-model-discovery-runtime.js +1 -1
- package/dist/agents-BP4p-1q2.js +5 -0
- package/dist/agents-CDiXfrfc.js +953 -0
- package/dist/agents.command-shared-ZsmaTJk8.js +40 -0
- package/dist/aliases-BBCtCq2A.js +96 -0
- package/dist/aliases-DrFtFq1p.js +2 -0
- package/dist/api-2tC9XD4P.js +4 -0
- package/dist/api-BH0oEwR1.js +5 -0
- package/dist/api-BHhDAMrX.js +2 -0
- package/dist/api-CGlGNVyu2.js +2 -0
- package/dist/api-CK3xj--e.js +48 -0
- package/dist/api-CQ1kMo4j.js +3 -0
- package/dist/api-D-4gHdrl.js +139 -0
- package/dist/api-DE6RYTxv.js +3 -0
- package/dist/api-DEwetAD22.js +2 -0
- package/dist/apply-CKkto_0W.js +508 -0
- package/dist/apply.runtime-Bby76mns.js +166 -0
- package/dist/apply.runtime-xFS-XMxA.js +2 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/approval-client-helpers-Dn1zaJjB.js +82 -0
- package/dist/approval-handler-runtime-BEl3ua8-.js +439 -0
- package/dist/approval-native-helpers-SV1NXo3R.js +33 -0
- package/dist/approval-native-runtime-ghjYGufu.js +729 -0
- package/dist/approval-renderers-BFN4GCN1.js +64 -0
- package/dist/attempt-execution.runtime-PCTFYqLh.js +509 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt-execution.shared-BVGg4jtm.js +22 -0
- package/dist/attempt.prompt-helpers-CkWEozQ2.js +221 -0
- package/dist/attempt.tool-run-context-DbqVgXFk.js +933 -0
- package/dist/audit-Lb1yNEwg.js +939 -0
- package/dist/audit-extra.async-CxQj_A5s.js +971 -0
- package/dist/audit-membership-runtime-Fh49slzK.js +550 -0
- package/dist/audit.deep.runtime-COBioB9E.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-Bk_5xOjT.js +880 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-DOnixKE_.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-BrlJ7NM9.js +2 -0
- package/dist/auth-C7wPgZbo.js +56 -0
- package/dist/auth-CJoP7Yst.js +383 -0
- package/dist/auth-DLWZd54x.js +177 -0
- package/dist/auth-choice-DZdnIn4M.js +3 -0
- package/dist/auth-choice-DtSIi1lM.js +354 -0
- package/dist/auth-choice-dBaHPiBQ.js +88 -0
- package/dist/auth-choice-options-C0mgcUc9.js +97 -0
- package/dist/auth-choice-prompt-Crln8JIf.js +2 -0
- package/dist/auth-choice-prompt-DhSxj7wM.js +37 -0
- package/dist/auth-choice.apply.api-providers-DBPXmiaM.js +2 -0
- package/dist/auth-choice.apply.api-providers-TO_ZIWX7.js +34 -0
- package/dist/auth-choice.plugin-providers.runtime-CRMLXING.js +11 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auth-health-DvPWpSkl.js +183 -0
- package/dist/auth-install-policy-BpHrj1L-.js +195 -0
- package/dist/auth-order-D0KFgBib.js +96 -0
- package/dist/auth-order-_xlUHzCg.js +2 -0
- package/dist/auth-profiles-qkJp8etH.js +679 -0
- package/dist/backup-create-DgVJHnfc.js +395 -0
- package/dist/banner-0afXR3gC.js +2 -0
- package/dist/banner-D-k2EM3C.js +336 -0
- package/dist/base-url-N7e93gGu.js +15 -0
- package/dist/bash-tools-BEVEHCl9.js +2824 -0
- package/dist/bash-tools-DJ0D8Wr5.js +3 -0
- package/dist/binding-routing-IfKqPcfO.js +85 -0
- package/dist/binding-targets-2huR0hTX.js +121 -0
- package/dist/bluebubbles-C4fAEm2A.js +77 -0
- package/dist/brave-web-search-provider-DkkbSBBP.js +111 -0
- package/dist/brave-web-search-provider.runtime-AjyyvF6E.js +229 -0
- package/dist/brave-web-search-provider.runtime.js +1 -1
- package/dist/brave-web-search-provider.shared-Bk59J40Z.js +174 -0
- package/dist/bridge-auth-registry-j9Nf_eKW.js +23 -0
- package/dist/bridge-server-D8Y8Fzdz.js +113 -0
- package/dist/browser-config-runtime-DYHwPrae.js +7 -0
- package/dist/browser-control-auth-Q6UpVLEj.js +2 -0
- package/dist/browser-node-runtime-C9KvsOyx.js +12 -0
- package/dist/browser-profiles-DFcwiMEf.js +2 -0
- package/dist/browser-runtime-sbZ3hKg6.js +387 -0
- package/dist/browser-setup-tools-CP4BkZ9z.js +13 -0
- package/dist/build-DzHX2LrH.js +550 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +5 -5
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/call-ORivR4Db.js +331 -0
- package/dist/call-qzfm6lro.js +3 -0
- package/dist/call-status-DMAmF1AO.js +33 -0
- package/dist/call.runtime-BkzJe07B.js +2 -0
- package/dist/call.runtime.js +1 -1
- package/dist/capability-cli-BDCvm93o.js +1401 -0
- package/dist/card-command-VrZ5VEMb.js +241 -0
- package/dist/catalog-provider-iymLG3Kz.js +40 -0
- package/dist/catchup-CjZa2PrP.js +300 -0
- package/dist/channel-B3UAL9Pk.js +840 -0
- package/dist/channel-B5L9LJBF.js +453 -0
- package/dist/channel-BGXl6A-E.js +297 -0
- package/dist/channel-BNUblayu.js +1320 -0
- package/dist/channel-Bej-TN7f.js +491 -0
- package/dist/channel-BzOKSC4e.js +350 -0
- package/dist/channel-CY2xEOzR.js +1802 -0
- package/dist/channel-D2kKLWUA.js +226 -0
- package/dist/channel-DcjCe46M.js +1100 -0
- package/dist/channel-GqA96nmt.js +595 -0
- package/dist/channel-YI2aIJFQ.js +1174 -0
- package/dist/channel-add-wizard-CTUaSVvE.js +125 -0
- package/dist/channel-add-wizard-DeODDpiD.js +2 -0
- package/dist/channel-core-DqPUhmTt.js +5 -0
- package/dist/channel-inbound-CzgMd2Xi.js +31 -0
- package/dist/channel-plugin-runtime-DI5uUbxx.js +771 -0
- package/dist/channel-runtime-BJqKQitD.js +425 -0
- package/dist/channel-summary-BMmi0p_s.js +2 -0
- package/dist/channel-summary-BvSCERUz.js +129 -0
- package/dist/channel.runtime-BBn9mgbB.js +89 -0
- package/dist/channel.runtime-Bhj1b9gQ.js +34702 -0
- package/dist/channel.runtime-BozvCkMo.js +26 -0
- package/dist/channel.runtime-BzOVx90Z.js +576 -0
- package/dist/channel.runtime-CQkLKWlq.js +109 -0
- package/dist/channel.runtime-D8qT4A1x.js +4 -0
- package/dist/channel.runtime-DjK9Re1w.js +2364 -0
- package/dist/channel.runtime-tWwM8hFw.js +430 -0
- package/dist/channel.runtime-xIH29E7O.js +67 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channel.setup-gaiRZ-r8.js +10 -0
- package/dist/channels-BXIl3hBo.js +733 -0
- package/dist/channels-cli-CrmBqaul.js +268 -0
- package/dist/chat-C42usv-F.js +2758 -0
- package/dist/chrome-CgLTMlX5.js +1181 -0
- package/dist/chrome-mcp-0zQTzU3A.js +2 -0
- package/dist/chrome-mcp-BjiLGZmi.js +600 -0
- package/dist/chrome.executables-CoZsfQLC.js +541 -0
- package/dist/clawbot-cli-BGYO_ymZ.js +9 -0
- package/dist/clawhub-Dz5KDje-.js +400 -0
- package/dist/clawhub-LPw6cLUe.js +300 -0
- package/dist/cli/daemon-cli.js +4 -4
- package/dist/cli-BbD25CFK.js +2 -0
- package/dist/cli-CUAjdQ7v.js +683 -0
- package/dist/cli-CYD4Wfcq.js +219 -0
- package/dist/cli-Cp2qY3Xp.js +154 -0
- package/dist/cli-D-6ycHAw.js +72 -0
- package/dist/cli-D8SnjKKR.js +3726 -0
- package/dist/cli-DX4CK-bw.js +2 -0
- package/dist/cli-Dyu4jU8j.js +2 -0
- package/dist/cli-runner-C5_PBTxm.js +286 -0
- package/dist/cli-runner.runtime-DE7RpQ27.js +3 -0
- package/dist/cli-runner.runtime-ueVMICzY.js +4 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-startup-metadata.json +2 -2
- package/dist/cli.runtime-DSO8Vfrh.js +1261 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/client-BKro32pr.js +138 -0
- package/dist/codex-native-web-search-Bu1J52-W.js +113 -0
- package/dist/codex-native-web-search-Deyt8mj0.js +3 -0
- package/dist/combined-store-gateway-DT2C-8GW.js +163 -0
- package/dist/command-auth-CvFUTCCJ.js +76 -0
- package/dist/command-config-resolution-BnW1XGnW.js +23 -0
- package/dist/command-config-resolution-BrlfYyiN.js +2 -0
- package/dist/command-config-resolution.runtime-DYMr8J0t.js +2 -0
- package/dist/command-config-resolution.runtime.js +1 -1
- package/dist/command-execution-startup-BlHlyCgU.js +305 -0
- package/dist/command-registry-Bi9thw1b.js +9 -0
- package/dist/command-registry-D__zH4Fg.js +4 -0
- package/dist/command-registry-core-DQoNFQZT.js +101 -0
- package/dist/command-secret-gateway-B27Zpgo9.js +528 -0
- package/dist/command-status.runtime-fERQMzeI.js +87 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-acp-BmORmf3-.js +77 -0
- package/dist/commands-compact.runtime-BUaXIw-I.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-2OrgNeAA.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-BxbkeuTc.js +4597 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-BAneNjrI.js +327 -0
- package/dist/commands-reset-hooks-BkEMNl84.js +133 -0
- package/dist/commands-status-4OW5sqmg.js +16 -0
- package/dist/commands-status.runtime-Cl7nJp_7.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-BR4qBGkk.js +2 -0
- package/dist/commands-subagents-control.runtime-C8ufgKPI.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-BsimvjJt.js +158 -0
- package/dist/commands-system-prompt-CKrY0h7P.js +2 -0
- package/dist/commands.runtime-BHsDdaEU.js +166 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/compact-BHYLQst3.js +1118 -0
- package/dist/compact.runtime-7-tZRdgw.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-1sAiSIYc.js +328 -0
- package/dist/config-3He3LWHw.js +5 -0
- package/dist/config-BZ3FuFjH.js +251 -0
- package/dist/config-DDoTcXdn.js +9 -0
- package/dist/config-api-q218x1pm.js +2 -0
- package/dist/config-cli-B_dNq5hD.js +1078 -0
- package/dist/config-compat-2ov7ryzQ.js +126 -0
- package/dist/config-compat-k8n8hPxr.js +130 -0
- package/dist/config-guard-8hQGGUl4.js +96 -0
- package/dist/config-runtime-CiIsBMuo.js +32 -0
- package/dist/config-validation-BeKCV2p-.js +30 -0
- package/dist/configure-BOvmX2NJ.js +2 -0
- package/dist/configure-DR9NYN9e.js +1245 -0
- package/dist/connect-options-DlmPTyhG.js +699 -0
- package/dist/context-D3NokKLx.js +2 -0
- package/dist/context-rtkuRtGt.js +278 -0
- package/dist/control-auth-C_zNiV10.js +125 -0
- package/dist/control-service-B1TL51jf.js +156 -0
- package/dist/control-ui-CIhsZ2Nb.js +688 -0
- package/dist/conversation-id-B3lLiTfF.js +235 -0
- package/dist/conversation-id-DORmTZm_.js +38 -0
- package/dist/conversation-label-generator-CNvvC18B.js +56 -0
- package/dist/conversation-runtime-DDxZZZXE.js +31 -0
- package/dist/core-DbPzffGG.js +275 -0
- package/dist/create-5kvABMhw.js +80 -0
- package/dist/cron-cli-AoH4jhFt.js +713 -0
- package/dist/daemon-cli-BOJdM3wT.js +12 -0
- package/dist/daemon-install-D8HPES4u.js +64 -0
- package/dist/daemon-install-auth-profiles-store.runtime-DWg8FeUH.js +2 -0
- package/dist/daemon-install-auth-profiles-store.runtime.js +1 -1
- package/dist/daemon-install-plan.shared-WG_DYWei.js +287 -0
- package/dist/ddg-client-BnD8tAM2.js +147 -0
- package/dist/ddg-search-provider-CNeCrvl0.js +54 -0
- package/dist/delegate-Dmdda3kT.js +64 -0
- package/dist/deliver-CEuqmKKH.js +747 -0
- package/dist/deliver-Cndvxi9P.js +3 -0
- package/dist/deliver-runtime-BvDWmZrW.js +2 -0
- package/dist/delivery-outbound.runtime-BQeyIAOJ.js +6 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery.runtime-Ci0ToUzj.js +253 -0
- package/dist/delivery.runtime.js +1 -1
- package/dist/deps-CFCIpuzV.js +2 -0
- package/dist/deps-D3gqpOra.js +73 -0
- package/dist/detached-task-runtime-BB5az34R.js +73 -0
- package/dist/devices-cli-Cy9DF-DP.js +496 -0
- package/dist/diagnostic-CC9CPVio.js +400 -0
- package/dist/diagnostic-support-export-CufM12zj.js +533 -0
- package/dist/diagnostics-CTE0TWR1.js +154 -0
- package/dist/direct-dm-9jzadx9u.js +64 -0
- package/dist/directive-handling.fast-lane-C6uvW96M.js +66 -0
- package/dist/directive-handling.impl-BTuNitCK.js +2 -0
- package/dist/directive-handling.impl-DIeSI-ux.js +703 -0
- package/dist/directive-handling.model-selection-Cq8JhQdI.js +114 -0
- package/dist/directive-handling.persist.runtime-DrUu8zaW.js +215 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directory-cli-DNMdDpqd.js +240 -0
- package/dist/dispatch-DU7cqfv6.js +1131 -0
- package/dist/dispatch-acp-Cu_nUtKg.js +981 -0
- package/dist/dispatch-acp-manager.runtime-8MOQ5BRn.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-DqSdScnW.js +4 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-session.runtime-B-AG2-VC.js +2 -0
- package/dist/dispatch-acp-session.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DatcHNJq.js +19 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dns-cli-z20808Yz.js +192 -0
- package/dist/doctor-auth-CqdmPgiK.js +172 -0
- package/dist/doctor-auth-legacy-oauth-C2ojfRvc.js +2 -0
- package/dist/doctor-auth-legacy-oauth-CcveIbUh.js +48 -0
- package/dist/doctor-claude-cli-B6pnkFEn.js +147 -0
- package/dist/doctor-config-analysis-B_xkK9eg.js +94 -0
- package/dist/doctor-config-flow-D9W_glLc.js +417 -0
- package/dist/doctor-config-preflight-BAZTh5MZ.js +2 -0
- package/dist/doctor-config-preflight-Bui2U29x.js +63 -0
- package/dist/doctor-contract-DgJ867-C.js +26 -0
- package/dist/doctor-device-pairing-Qm-r7mwu.js +307 -0
- package/dist/doctor-gateway-daemon-flow-BN2uGhFJ.js +250 -0
- package/dist/doctor-gateway-health-CD7Vzth9.js +60 -0
- package/dist/doctor-gateway-services-CIypZgv_.js +316 -0
- package/dist/doctor-health-ByjG3620.js +59 -0
- package/dist/doctor-health-contributions-CxNByg_i.js +486 -0
- package/dist/doctor-memory-search-C25cUVoI.js +371 -0
- package/dist/doctor-sandbox-CNi6l2wR.js +194 -0
- package/dist/doctor-session-locks-CYaHscyv.js +52 -0
- package/dist/doctor-state-integrity-jbbt8OVU.js +609 -0
- package/dist/doctor-state-migrations-DgYUKVNF.js +2 -0
- package/dist/doctor-update-r4fBiE_r.js +58 -0
- package/dist/doctor-workspace-status-DL2fRPoT.js +75 -0
- package/dist/dreaming-CCctNgkQ.js +1574 -0
- package/dist/dreaming-narrative-BPtXKc2-.js +595 -0
- package/dist/dreaming-shared-B7vlQ1yu.js +21 -0
- package/dist/embedded-gateway-stub.runtime-Hi36BeCq.js +9 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-batch-BU4JjG1y.js +161 -0
- package/dist/embedding-batch-DOZ1gHYu.js +191 -0
- package/dist/embedding-provider-BI2BRW8e.js +64 -0
- package/dist/embedding-provider-Bb3l6tny.js +33 -0
- package/dist/embedding-provider-Cjyi9qRs.js +118 -0
- package/dist/embedding-provider-D-IE5LZN.js +38 -0
- package/dist/embeddings-eOJvLToU.js +215 -0
- package/dist/embeddings-http-BDz5OXZk.js +205 -0
- package/dist/engine-embeddings-CxNSH_in.js +458 -0
- package/dist/engine-qmd-BSGZVwOC.js +551 -0
- package/dist/entry.js +2 -2
- package/dist/exa-web-search-provider-DMHM6_vZ.js +80 -0
- package/dist/exa-web-search-provider.runtime-5amTdDMt.js +2 -0
- package/dist/exa-web-search-provider.runtime-DOeJpDGm.js +302 -0
- package/dist/exa-web-search-provider.runtime.js +1 -1
- package/dist/exec-approval-forwarder.runtime-ToZ9QUrR.js +3 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approval-reply-CErKkY_w.js +2 -0
- package/dist/exec-approval-reply-CwnSisXg.js +296 -0
- package/dist/exec-approval-session-target-BcyDQz_G.js +176 -0
- package/dist/exec-approvals-cli-DyslUWtQ.js +498 -0
- package/dist/exec-policy-cli-F3L_mLPh.js +298 -0
- package/dist/extensionAPI.js +4 -4
- package/dist/extensions/active-memory/index.js +3 -3
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/arcee/index.js +2 -2
- package/dist/extensions/bluebubbles/api.js +3 -3
- package/dist/extensions/bluebubbles/channel-plugin-api.js +1 -1
- package/dist/extensions/brave/index.js +1 -1
- package/dist/extensions/brave/test-api.js +1 -1
- package/dist/extensions/brave/web-search-provider.js +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-config.js +4 -4
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +5 -5
- package/dist/extensions/browser/browser-host-inspection.js +1 -1
- package/dist/extensions/browser/browser-maintenance.js +2 -2
- package/dist/extensions/browser/browser-profiles.js +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +14 -14
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +3 -3
- package/dist/extensions/browser/runtime-api.js +15 -15
- package/dist/extensions/browser/setup-api.js +2 -2
- package/dist/extensions/browser/test-support.js +1 -1
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/chutes/api.js +3 -3
- package/dist/extensions/chutes/index.js +7 -7
- package/dist/extensions/chutes/models.js +1 -1
- package/dist/extensions/chutes/onboard.js +2 -2
- package/dist/extensions/chutes/provider-catalog.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/index.js +7 -7
- package/dist/extensions/comfy/image-generation-provider.js +2 -2
- package/dist/extensions/comfy/index.js +5 -5
- package/dist/extensions/comfy/music-generation-provider.js +1 -1
- package/dist/extensions/comfy/test-helpers.js +1 -1
- package/dist/extensions/comfy/video-generation-provider.js +2 -2
- package/dist/extensions/comfy/workflow-runtime.js +1 -1
- package/dist/extensions/deepgram/index.js +1 -1
- package/dist/extensions/deepgram/realtime-transcription-provider.js +1 -1
- package/dist/extensions/deepgram/test-api.js +1 -1
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/index.js +5 -5
- package/dist/extensions/device-pair/notify.js +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/duckduckgo/index.js +1 -1
- package/dist/extensions/duckduckgo/web-search-provider.js +1 -1
- package/dist/extensions/elevenlabs/config-compat.js +1 -1
- package/dist/extensions/elevenlabs/contract-api.js +2 -2
- package/dist/extensions/elevenlabs/doctor-contract.js +2 -2
- package/dist/extensions/elevenlabs/index.js +2 -2
- package/dist/extensions/elevenlabs/realtime-transcription-provider.js +1 -1
- package/dist/extensions/elevenlabs/setup-api.js +1 -1
- package/dist/extensions/elevenlabs/speech-provider.js +1 -1
- package/dist/extensions/elevenlabs/test-api.js +2 -2
- package/dist/extensions/exa/index.js +1 -1
- package/dist/extensions/exa/test-api.js +1 -1
- package/dist/extensions/exa/web-search-provider.js +1 -1
- package/dist/extensions/fal/image-generation-provider.js +1 -1
- package/dist/extensions/fal/index.js +3 -3
- package/dist/extensions/fal/provider-registration.js +1 -1
- package/dist/extensions/fal/test-api.js +2 -2
- package/dist/extensions/fal/video-generation-provider.js +1 -1
- package/dist/extensions/firecrawl/api.js +1 -1
- package/dist/extensions/fireworks/index.js +1 -1
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/auth.js +1 -1
- package/dist/extensions/github-copilot/embeddings.js +1 -1
- package/dist/extensions/github-copilot/index.js +8 -8
- package/dist/extensions/github-copilot/login.js +1 -1
- package/dist/extensions/github-copilot/models-defaults.js +1 -1
- package/dist/extensions/github-copilot/models.js +1 -1
- package/dist/extensions/github-copilot/register.runtime.js +3 -3
- package/dist/extensions/github-copilot/replay-policy.js +1 -1
- package/dist/extensions/google-meet/index.js +5 -5
- package/dist/extensions/groq/index.js +1 -1
- package/dist/extensions/groq/media-understanding-provider.js +1 -1
- package/dist/extensions/groq/test-api.js +1 -1
- package/dist/extensions/huggingface/api.js +3 -3
- package/dist/extensions/huggingface/index.js +3 -3
- package/dist/extensions/huggingface/models.js +1 -1
- package/dist/extensions/huggingface/onboard.js +1 -1
- package/dist/extensions/huggingface/provider-catalog.js +2 -2
- package/dist/extensions/image-generation-core/api.js +3 -3
- package/dist/extensions/image-generation-core/runtime-api.js +2 -2
- package/dist/extensions/imessage/api.js +5 -5
- package/dist/extensions/imessage/channel-plugin-api.js +1 -1
- package/dist/extensions/imessage/contract-api.js +2 -2
- package/dist/extensions/imessage/media-contract-api.js +2 -2
- package/dist/extensions/imessage/runtime-api.js +5 -5
- package/dist/extensions/imessage/test-api.js +2 -2
- package/dist/extensions/irc/api.js +2 -2
- package/dist/extensions/irc/channel-plugin-api.js +1 -1
- package/dist/extensions/kilocode/api.js +2 -2
- package/dist/extensions/kilocode/index.js +6 -6
- package/dist/extensions/kilocode/onboard.js +2 -2
- package/dist/extensions/kilocode/provider-catalog.js +1 -1
- package/dist/extensions/kilocode/provider-models.js +1 -1
- package/dist/extensions/kilocode/shared.js +1 -1
- package/dist/extensions/kimi-coding/index.js +4 -4
- package/dist/extensions/kimi-coding/stream.js +1 -1
- package/dist/extensions/line/api.js +2 -2
- package/dist/extensions/line/channel-plugin-api.js +1 -1
- package/dist/extensions/line/contract-api.js +1 -1
- package/dist/extensions/line/index.js +1 -1
- package/dist/extensions/line/runtime-api.js +7 -7
- package/dist/extensions/line/setup-api.js +1 -1
- package/dist/extensions/litellm/index.js +1 -1
- package/dist/extensions/llm-task/index.js +1 -1
- package/dist/extensions/lmstudio/api.js +7 -7
- package/dist/extensions/lmstudio/index.js +3 -3
- package/dist/extensions/lmstudio/memory-embedding-adapter.js +1 -1
- package/dist/extensions/lmstudio/runtime-api.js +1 -1
- package/dist/extensions/lobster/runtime-api.js +1 -1
- package/dist/extensions/mattermost/api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
- package/dist/extensions/mattermost/policy-api.js +1 -1
- package/dist/extensions/mattermost/runtime-api.js +8 -8
- package/dist/extensions/mattermost/slash-route-api.js +1 -1
- package/dist/extensions/media-understanding-core/runtime-api.js +2 -2
- package/dist/extensions/memory-core/api.js +1 -1
- package/dist/extensions/memory-core/cli-metadata.js +2 -2
- package/dist/extensions/memory-core/index.js +12 -12
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +7 -7
- package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
- package/dist/extensions/memory-lancedb/index.js +2 -2
- package/dist/extensions/memory-wiki/cli-metadata.js +1 -1
- package/dist/extensions/memory-wiki/index.js +1 -1
- package/dist/extensions/microsoft/index.js +1 -1
- package/dist/extensions/microsoft/speech-provider.js +1 -1
- package/dist/extensions/microsoft/test-api.js +1 -1
- package/dist/extensions/microsoft/tts.js +1 -1
- package/dist/extensions/microsoft-foundry/auth.js +1 -1
- package/dist/extensions/microsoft-foundry/cli.js +1 -1
- package/dist/extensions/microsoft-foundry/index.js +1 -1
- package/dist/extensions/microsoft-foundry/onboard.js +2 -2
- package/dist/extensions/microsoft-foundry/provider.js +1 -1
- package/dist/extensions/microsoft-foundry/runtime.js +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
- package/dist/extensions/microsoft-foundry/shared.js +1 -1
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/test-api.js +5 -5
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/mistral/embedding-provider.js +1 -1
- package/dist/extensions/mistral/index.js +5 -5
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.js +1 -1
- package/dist/extensions/mistral/provider-compat.js +1 -1
- package/dist/extensions/mistral/realtime-transcription-provider.js +1 -1
- package/dist/extensions/mistral/test-api.js +2 -2
- package/dist/extensions/moonshot/index.js +5 -5
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/test-api.js +2 -2
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/msteams/api.js +1 -1
- package/dist/extensions/msteams/channel-plugin-api.js +1 -1
- package/dist/extensions/msteams/runtime-api.js +4 -4
- package/dist/extensions/msteams/test-api.js +1 -1
- package/dist/extensions/nextcloud-talk/api.js +1 -1
- package/dist/extensions/nextcloud-talk/channel-plugin-api.js +1 -1
- package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
- package/dist/extensions/nvidia/index.js +1 -1
- package/dist/extensions/ollama/api.js +3 -3
- package/dist/extensions/ollama/index.js +10 -10
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/ollama/web-search-provider.js +1 -1
- package/dist/extensions/openai/api.js +4 -4
- package/dist/extensions/openai/base-url.js +1 -1
- package/dist/extensions/openai/embedding-batch.js +1 -1
- package/dist/extensions/openai/embedding-provider.js +1 -1
- package/dist/extensions/openai/image-generation-provider.js +1 -1
- package/dist/extensions/openai/index.js +10 -10
- package/dist/extensions/openai/media-understanding-provider.js +1 -1
- package/dist/extensions/openai/memory-embedding-adapter.js +1 -1
- package/dist/extensions/openai/native-web-search.js +1 -1
- package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
- package/dist/extensions/openai/openai-codex-device-code.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-shared.js +1 -1
- package/dist/extensions/openai/openai-provider.js +1 -1
- package/dist/extensions/openai/realtime-provider-shared.js +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/openai/realtime-voice-provider.js +1 -1
- package/dist/extensions/openai/register.runtime.js +7 -7
- package/dist/extensions/openai/shared.js +1 -1
- package/dist/extensions/openai/speech-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +6 -6
- package/dist/extensions/openai/transport-policy.js +1 -1
- package/dist/extensions/openai/video-generation-provider.js +1 -1
- package/dist/extensions/opencode/index.js +3 -3
- package/dist/extensions/opencode/media-understanding-provider.js +1 -1
- package/dist/extensions/opencode-go/index.js +2 -2
- package/dist/extensions/opencode-go/media-understanding-provider.js +1 -1
- package/dist/extensions/openrouter/api.js +2 -2
- package/dist/extensions/openrouter/image-generation-provider.js +1 -1
- package/dist/extensions/openrouter/index.js +8 -8
- package/dist/extensions/openrouter/media-understanding-provider.js +1 -1
- package/dist/extensions/openrouter/register.runtime.js +7 -7
- package/dist/extensions/openrouter/speech-provider.js +1 -1
- package/dist/extensions/openrouter/stream.js +1 -1
- package/dist/extensions/openrouter/test-api.js +3 -3
- package/dist/extensions/openshell/index.js +4 -4
- package/dist/extensions/perplexity/index.js +1 -1
- package/dist/extensions/perplexity/test-api.js +1 -1
- package/dist/extensions/perplexity/web-search-provider.js +1 -1
- package/dist/extensions/phone-control/index.js +1 -1
- package/dist/extensions/qianfan/index.js +1 -1
- package/dist/extensions/qwen/index.js +3 -3
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/test-api.js +2 -2
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/runway/index.js +1 -1
- package/dist/extensions/runway/video-generation-provider.js +1 -1
- package/dist/extensions/sglang/api.js +2 -2
- package/dist/extensions/sglang/index.js +2 -2
- package/dist/extensions/sglang/models.js +1 -1
- package/dist/extensions/signal/api.js +11 -11
- package/dist/extensions/signal/channel-plugin-api.js +1 -1
- package/dist/extensions/signal/contract-api.js +2 -2
- package/dist/extensions/signal/reaction-runtime-api.js +1 -1
- package/dist/extensions/signal/runtime-api.js +13 -13
- package/dist/extensions/skill-workshop/api.js +1 -1
- package/dist/extensions/skill-workshop/index.js +2 -2
- package/dist/extensions/speech-core/api.js +2 -2
- package/dist/extensions/speech-core/runtime-api.js +4 -4
- package/dist/extensions/stepfun/index.js +3 -3
- package/dist/extensions/synology-chat/api.js +1 -1
- package/dist/extensions/synology-chat/channel-plugin-api.js +1 -1
- package/dist/extensions/synthetic/index.js +1 -1
- package/dist/extensions/talk-voice/index.js +3 -3
- package/dist/extensions/tavily/index.js +2 -2
- package/dist/extensions/tavily/web-search-provider.js +1 -1
- package/dist/extensions/tencent/index.js +2 -2
- package/dist/extensions/thread-ownership/index.js +2 -2
- package/dist/extensions/tlon/api.js +2 -2
- package/dist/extensions/tlon/channel-plugin-api.js +1 -1
- package/dist/extensions/tlon/runtime-api.js +1 -1
- package/dist/extensions/tlon/setup-api.js +2 -2
- package/dist/extensions/tlon/test-api.js +1 -1
- package/dist/extensions/together/index.js +2 -2
- package/dist/extensions/together/video-generation-provider.js +1 -1
- package/dist/extensions/twitch/api.js +1 -1
- package/dist/extensions/twitch/channel-plugin-api.js +1 -1
- package/dist/extensions/twitch/setup-plugin-api.js +1 -1
- package/dist/extensions/venice/api.js +3 -3
- package/dist/extensions/venice/index.js +5 -5
- package/dist/extensions/venice/models.js +1 -1
- package/dist/extensions/venice/onboard.js +2 -2
- package/dist/extensions/venice/provider-catalog.js +1 -1
- package/dist/extensions/vercel-ai-gateway/index.js +1 -1
- package/dist/extensions/video-generation-core/api.js +2 -2
- package/dist/extensions/video-generation-core/runtime-api.js +2 -2
- package/dist/extensions/vllm/api.js +2 -2
- package/dist/extensions/vllm/index.js +2 -2
- package/dist/extensions/vllm/models.js +1 -1
- package/dist/extensions/vllm/register.runtime.js +2 -2
- package/dist/extensions/voice-call/index.js +3 -3
- package/dist/extensions/voice-call/runtime-entry.js +1 -1
- package/dist/extensions/voice-call/setup-api.js +2 -2
- package/dist/extensions/volcengine/index.js +2 -2
- package/dist/extensions/voyage/embedding-batch.js +1 -1
- package/dist/extensions/voyage/embedding-provider.js +1 -1
- package/dist/extensions/voyage/index.js +1 -1
- package/dist/extensions/voyage/memory-embedding-adapter.js +1 -1
- package/dist/extensions/vydra/image-generation-provider.js +1 -1
- package/dist/extensions/vydra/index.js +5 -5
- package/dist/extensions/vydra/shared.js +1 -1
- package/dist/extensions/vydra/speech-provider.js +1 -1
- package/dist/extensions/vydra/video-generation-provider.js +1 -1
- package/dist/extensions/xai/api.js +6 -6
- package/dist/extensions/xai/code-execution.js +3 -3
- package/dist/extensions/xai/image-generation-provider.js +1 -1
- package/dist/extensions/xai/index.js +13 -13
- package/dist/extensions/xai/model-definitions.js +1 -1
- package/dist/extensions/xai/onboard.js +1 -1
- package/dist/extensions/xai/provider-catalog.js +1 -1
- package/dist/extensions/xai/provider-models.js +1 -1
- package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/xai/setup-api.js +1 -1
- package/dist/extensions/xai/speech-provider.js +1 -1
- package/dist/extensions/xai/stt.js +1 -1
- package/dist/extensions/xai/test-api.js +1 -1
- package/dist/extensions/xai/tts.js +2 -2
- package/dist/extensions/xai/video-generation-provider.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/x-search.js +4 -4
- package/dist/extensions/xiaomi/index.js +1 -1
- package/dist/extensions/zai/api.js +1 -1
- package/dist/extensions/zai/index.js +9 -9
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zai/onboard.js +1 -1
- package/dist/extensions/zai/test-api.js +1 -1
- package/dist/extensions/zalo/api.js +3 -3
- package/dist/extensions/zalo/channel-plugin-api.js +1 -1
- package/dist/extensions/zalo/runtime-api.js +2 -2
- package/dist/extensions/zalo/setup-api.js +2 -2
- package/dist/extensions/zalouser/api.js +4 -4
- package/dist/extensions/zalouser/channel-plugin-api.js +1 -1
- package/dist/extensions/zalouser/runtime-api.js +9 -9
- package/dist/extensions/zalouser/setup-plugin-api.js +1 -1
- package/dist/extensions/zalouser/test-api.js +4 -4
- package/dist/extra-params-DXOULv19.js +388 -0
- package/dist/fallbacks-B3xZC-ms.js +2 -0
- package/dist/fallbacks-CWDz-tSa.js +31 -0
- package/dist/fallbacks-shared-BlZBjxHL.js +111 -0
- package/dist/format-DQi1munp.js +245 -0
- package/dist/format-Dv6HmuyW.js +176 -0
- package/dist/gateway-NYBkUx5r.js +115 -0
- package/dist/gateway-cli-E5gYA0U1.js +1325 -0
- package/dist/gateway-install-token-CBRkr0l1.js +141 -0
- package/dist/gateway-rpc-BrG5Lkfm.js +14 -0
- package/dist/gateway-rpc.runtime-BrTGchr9.js +23 -0
- package/dist/gateway-rpc.runtime.js +1 -1
- package/dist/gateway-status-B6ol1agz.js +584 -0
- package/dist/genesis-tools-D_ah3Zek.js +8999 -0
- package/dist/genesis-tools.runtime-Cy7aTWEN.js +2 -0
- package/dist/genesis-tools.runtime.js +1 -1
- package/dist/get-reply-BvVkxYum.js +3879 -0
- package/dist/get-reply-from-config.runtime-DR3yiK1R.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/gmail-setup-utils-CViEwpXs.js +430 -0
- package/dist/gmail-watcher-lifecycle-5JNDL-Qn.js +2 -0
- package/dist/gmail-watcher-lifecycle-CbLbP5wf.js +191 -0
- package/dist/graph-users-yBNugoFz.js +1337 -0
- package/dist/guarded-json-api-BGsPLvM1.js +594 -0
- package/dist/health-D_wk2s7j.js +3 -0
- package/dist/health-MRnjOx-_.js +469 -0
- package/dist/heartbeat-runner-NuhhYnxs.js +5 -0
- package/dist/heartbeat-runner-Y4NeUV3L.js +1292 -0
- package/dist/heartbeat-runner.runtime-eGfKtcpP.js +4 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/help-B-jwXS97.js +81 -0
- package/dist/hooks-cli-CtfN2vc-.js +433 -0
- package/dist/http-endpoint-helpers-CY0P-_y2.js +41 -0
- package/dist/http-headers-BQgW7fC2.js +11 -0
- package/dist/http-utils-Da8hOLty.js +924 -0
- package/dist/identity-PVMitPyT.js +140 -0
- package/dist/image-fallbacks-CgeDMYZo.js +2 -0
- package/dist/image-fallbacks-CzQ85Eo8.js +31 -0
- package/dist/image-flYicC8O.js +272 -0
- package/dist/image-generation-core-ByCwGM7N.js +18 -0
- package/dist/image-generation-core.auth.runtime-BoHVcjuF.js +2 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-AZDQCts4.js +228 -0
- package/dist/image-generation-provider-BWIWrjvD.js +137 -0
- package/dist/image-generation-provider-Bq7iOzlf.js +529 -0
- package/dist/image-generation-provider-Bv5-fwPX.js +95 -0
- package/dist/image-generation-provider-CGSTJ4hP.js +63 -0
- package/dist/image-generation-provider-Cllhe0AP.js +274 -0
- package/dist/image-generation-provider-Cs4wRp50.js +157 -0
- package/dist/image-generation-runtime-xstqpFrd.js +2 -0
- package/dist/image-runtime-CaiLu4CB.js +9 -0
- package/dist/inbound-reply-dispatch-jVlLaSqn.js +73 -0
- package/dist/inbound.runtime-B-GWbA14.js +4 -0
- package/dist/inbound.runtime-ZW0e3dff.js +3 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/infra-runtime-D2Pqjk-r.js +39 -0
- package/dist/init-D_MTYqrw.js +59 -0
- package/dist/install-X7wgrwQ1.js +190 -0
- package/dist/install-signal-cli-BGP-9Zvn.js +202 -0
- package/dist/install.runtime-C4wO4Nr9.js +2 -0
- package/dist/install.runtime.js +1 -1
- package/dist/io-C8-NJ1hW.js +5 -0
- package/dist/io-DNd8mbjy.js +19290 -0
- package/dist/jobs-tgmPyzoA.js +734 -0
- package/dist/kimi-web-search-provider-BP8Sm_zW.js +80 -0
- package/dist/kimi-web-search-provider.runtime-BiS2hZd_.js +2 -0
- package/dist/kimi-web-search-provider.runtime-hPogdlIf.js +261 -0
- package/dist/kimi-web-search-provider.runtime.js +1 -1
- package/dist/legacy-tools-by-sender-C2fBnMkv.js +2 -0
- package/dist/legacy-tools-by-sender-PrWN1Kpn.js +95 -0
- package/dist/library-DIykYIWD.js +45 -0
- package/dist/lifecycle-BNuFzffC.js +571 -0
- package/dist/lifecycle-IWN9qlwo.js +229 -0
- package/dist/lifecycle-core-CFv5qkS8.js +422 -0
- package/dist/lifecycle.runtime-9oo2JCI2.js +2 -0
- package/dist/lifecycle.runtime.js +1 -1
- package/dist/list-BZ3mMSpA.js +2 -0
- package/dist/list-CzQs_k0U.js +131 -0
- package/dist/list-CzTJTFOH.js +1201 -0
- package/dist/list-qDXsgKhB.js +2 -0
- package/dist/list.probe-EOZR6ueo.js +419 -0
- package/dist/list.runtime-Cx-ix6ts.js +11 -0
- package/dist/list.runtime-zIkM6USX.js +159 -0
- package/dist/list.runtime.js +1 -1
- package/dist/live-model-switch-CgHU4tVW.js +336 -0
- package/dist/llm-slug-generator-DzWIx0nh.js +79 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/load-config-C_8uUnXU.js +35 -0
- package/dist/load-context-Bzz0kkeb.js +56 -0
- package/dist/local-dispatch.runtime-DLd10Xb1.js +8 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/logging-CZpl4hS4.js +2 -0
- package/dist/logging-ct4GyQVj.js +13 -0
- package/dist/login-DyL8eVfP.js +108 -0
- package/dist/logs-cli-mnOTmC9R.js +265 -0
- package/dist/logs-cli.runtime-BvP3aise.js +2 -0
- package/dist/logs-cli.runtime.js +1 -1
- package/dist/main-session-restart-recovery-D7Vxmu7e.js +206 -0
- package/dist/managed-image-attachments-BB5u0Zq8.js +2 -0
- package/dist/managed-image-attachments-BeRGNdL9.js +635 -0
- package/dist/manager-BhNWV4EC.js +2 -0
- package/dist/manager-CbZ9ncZs.js +2057 -0
- package/dist/manager-ChyGVMLU.js +3114 -0
- package/dist/markdown-to-line-DyB8w7ef.js +790 -0
- package/dist/mcp/plugin-tools-serve.js +4 -4
- package/dist/mcp-cli-CWzLBrDF.js +725 -0
- package/dist/mcp-config-CDKA6_LY.js +115 -0
- package/dist/mcp-http-1jD7LE0a.js +529 -0
- package/dist/media-contract-BLCEEI6I.js +49 -0
- package/dist/media-contract-api-CosBQX2V.js +2 -0
- package/dist/media-runtime-D2xH8y9Y.js +329 -0
- package/dist/media-understanding-B2qGioD4.js +85 -0
- package/dist/media-understanding-provider-BKieNTVy.js +13 -0
- package/dist/media-understanding-provider-Bp_FPuBe.js +12 -0
- package/dist/media-understanding-provider-BpxYGf2K.js +21 -0
- package/dist/media-understanding-provider-CGjB0jWY.js +69 -0
- package/dist/media-understanding-provider-CSCR1DOo.js +12 -0
- package/dist/media-understanding-provider-Cdopdt7A.js +85 -0
- package/dist/media-understanding-provider-Cv77beub.js +37 -0
- package/dist/media-understanding-provider-Cvr1QElU.js +18 -0
- package/dist/media-understanding-provider-DRMnI7Om.js +28 -0
- package/dist/media-understanding-provider-DorcYzVO.js +18 -0
- package/dist/media-understanding-runtime-CtocCbLl.js +2 -0
- package/dist/memory-24Kp99di.js +342 -0
- package/dist/memory-core-host-engine-embeddings-j3l9VHMa.js +2 -0
- package/dist/memory-core-host-engine-foundation-C5L_o_kv.js +11 -0
- package/dist/memory-core-host-engine-qmd-BjRQxINV.js +2 -0
- package/dist/memory-core-host-runtime-cli-P80xoEfr.js +9 -0
- package/dist/memory-core-host-runtime-core-CCiyGJ4d.js +8 -0
- package/dist/memory-embedding-adapter-DHCNhMQQ.js +32 -0
- package/dist/memory-embedding-adapter-DPMNJ50b.js +123 -0
- package/dist/memory-embedding-adapter-PANdmah2.js +50 -0
- package/dist/memory-embedding-adapter-gyNKuuJg.js +55 -0
- package/dist/memory-host-core-BLJfQ7tv.js +2 -0
- package/dist/memory-host-search-CXYoKllg.js +12 -0
- package/dist/memory-host-search.runtime-BlSP4tRs.js +2 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-runtime-BR50X7bD.js +2 -0
- package/dist/memory-runtime-CsD3VOEo.js +26 -0
- package/dist/message-BAhd_1ud.js +232 -0
- package/dist/message-action-runner-CH2jjT21.js +1407 -0
- package/dist/message-action-runner-DW7z_bMx.js +2 -0
- package/dist/message-actions-BjBGSsJB.js +143 -0
- package/dist/message.config.runtime-sOiwk5jH.js +2 -0
- package/dist/message.config.runtime.js +1 -1
- package/dist/message.gateway.runtime-sUc85g7X.js +2 -0
- package/dist/message.gateway.runtime.js +1 -1
- package/dist/metadata-registry-loader-BO5ga4BG.js +2 -0
- package/dist/metadata-registry-loader-DXWKbRU1.js +16 -0
- package/dist/minimax-vlm-M6jWEPQW.js +233 -0
- package/dist/minimax-web-search-provider-D2OTaFur.js +53 -0
- package/dist/minimax-web-search-provider.runtime-DC6wIpv_.js +2 -0
- package/dist/minimax-web-search-provider.runtime-Drj1xU_u.js +140 -0
- package/dist/minimax-web-search-provider.runtime.js +1 -1
- package/dist/mock-yKTkxAIg.js +136 -0
- package/dist/model-Dox-u3UD.js +666 -0
- package/dist/model-DqVVHjXR.js +3 -0
- package/dist/model-auth-CDl8OFEJ.js +456 -0
- package/dist/model-auth-env-BawHgU1x.js +68 -0
- package/dist/model-auth-label-BM5SET4I.js +46 -0
- package/dist/model-catalog-1XlBrFEV.js +159 -0
- package/dist/model-catalog-S5TqfK9t.js +2 -0
- package/dist/model-definitions-epX5XXUF.js +260 -0
- package/dist/model-fallback-CmX4SjzE.js +827 -0
- package/dist/model-fallback-auth.runtime-Dz9zpmf4.js +4 -0
- package/dist/model-fallback-auth.runtime.js +1 -1
- package/dist/model-picker-B9B-lkWH.js +3 -0
- package/dist/model-picker-DbWIvwfd.js +554 -0
- package/dist/model-picker-visibility-DTdSdobf.js +13 -0
- package/dist/model-picker.runtime-fnHv9FZI.js +15 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-selection-DBvbuIS-.js +213 -0
- package/dist/model-suppression-DuBnrvXK.js +28 -0
- package/dist/model-suppression.runtime-_96p7psP.js +7 -0
- package/dist/model-suppression.runtime.js +1 -1
- package/dist/models-BStOaoOP.js +18 -0
- package/dist/models-BtIpPCk2.js +760 -0
- package/dist/models-CAqi2TQ-.js +47 -0
- package/dist/models-CVuV0GE0.js +157 -0
- package/dist/models-DFRkfhsN.js +569 -0
- package/dist/models-auth-status-D6lrM56M.js +201 -0
- package/dist/models-cli-CmnbAk2M.js +219 -0
- package/dist/models-config-DDM74chF.js +2 -0
- package/dist/models-config-DnicdxyQ.js +933 -0
- package/dist/models-config.providers.secrets-DIfmfODH.js +304 -0
- package/dist/models-http-n4zWGd1p.js +92 -0
- package/dist/models-nU-69lrH.js +18 -0
- package/dist/models.fetch-BANynh-l.js +518 -0
- package/dist/monitor-AyGe8vyk.js +1237 -0
- package/dist/monitor-DQuy2kx-.js +671 -0
- package/dist/monitor-DmtJiX5o.js +788 -0
- package/dist/monitor-GB8lcnal.js +1459 -0
- package/dist/monitor-IuVjATac.js +1661 -0
- package/dist/monitor-auth-rF7mr3Cm.js +207 -0
- package/dist/monitor-bnOvJyLN.js +2 -0
- package/dist/monitor-oHi8GwXc.js +295 -0
- package/dist/monitor-processing-B1ewr2qF.js +1974 -0
- package/dist/monitor.runtime-BrUD5_VN.js +2 -0
- package/dist/monitor.runtime.js +1 -1
- package/dist/monitor.webhook-BvJG6Xbh.js +180 -0
- package/dist/msteams-DUDRy3xt.js +35 -0
- package/dist/music-generation-provider-6ru_5Xe9.js +170 -0
- package/dist/music-generation-provider-CfDrN0vg.js +63 -0
- package/dist/mutate-atVXfhNp.js +116 -0
- package/dist/native-hook-relay-CTpTLgCA.js +519 -0
- package/dist/native-web-search-C6deWq6V.js +64 -0
- package/dist/nextcloud-talk-BH2uWRZ2.js +17 -0
- package/dist/node-cli-AWE1ZFfV.js +2506 -0
- package/dist/nodes-cli-B7IWCrYq.js +1046 -0
- package/dist/nodes-utils-Dg2hrC3z.js +84 -0
- package/dist/notify-bsxfkOWp.js +315 -0
- package/dist/oauth-BKY3WmDu.js +75 -0
- package/dist/oauth-BKZJiY9a.js +152 -0
- package/dist/oauth-D4AUTZ6P.js +2 -0
- package/dist/oauth-N3WLEMX0.js +139 -0
- package/dist/oauth.flow-C0eia8-I.js +45 -0
- package/dist/oauth.flow-DfN3z9Nf.js +3 -0
- package/dist/onboard-B2eZziXs.js +49 -0
- package/dist/onboard-BQaZtwIU.js +632 -0
- package/dist/onboard-CGOeDj-J.js +58 -0
- package/dist/onboard-DTP_mB9k.js +25 -0
- package/dist/onboard-DY6XCMjI.js +29 -0
- package/dist/onboard-YitR883F.js +25 -0
- package/dist/onboard-custom-BQtg1wQW.js +271 -0
- package/dist/onboard-custom-Bz-MYvTm.js +3 -0
- package/dist/onboard-ffMqs4Bf.js +316 -0
- package/dist/onboard-gP5XFNCO.js +25 -0
- package/dist/onboard-search-Hz02JQSQ.js +323 -0
- package/dist/openai-codex-auth-identity-H1dPXVzb.js +45 -0
- package/dist/openai-codex-device-code-DNVug9Q3.js +164 -0
- package/dist/openai-codex-provider-HYYOGyC5.js +464 -0
- package/dist/openai-codex-shared-C4b7n1WS.js +6 -0
- package/dist/openai-http-D_7Nk3iN.js +500 -0
- package/dist/openai-provider-C6QMbZeL.js +313 -0
- package/dist/opencode-DGmHIBEa.js +35 -0
- package/dist/openresponses-http-BITxvD4V.js +1128 -0
- package/dist/order-DZPHX4Ka.js +109 -0
- package/dist/outbound-media-B2QJEeDc.js +57 -0
- package/dist/outbound-runtime-DZyO1T_R.js +5 -0
- package/dist/outbound.runtime-C8_lBQcx.js +2 -0
- package/dist/outbound.runtime.js +1 -1
- package/dist/pair-command-approve-D3s1W5go.js +44 -0
- package/dist/pairing-cli-kZkl_DC7.js +117 -0
- package/dist/perplexity-web-search-provider-CzCigaqV.js +92 -0
- package/dist/perplexity-web-search-provider.runtime-B86YHY5f.js +324 -0
- package/dist/perplexity-web-search-provider.runtime-U6g1JO38.js +2 -0
- package/dist/perplexity-web-search-provider.runtime.js +1 -1
- package/dist/persistent-bindings.lifecycle-CCR6khHJ.js +85 -0
- package/dist/persistent-bindings.lifecycle-Dgoo5bpE.js +2 -0
- package/dist/pi-bundle-mcp-runtime-BYDTyW-h.js +2 -0
- package/dist/pi-bundle-mcp-runtime-DaIHhxDu.js +829 -0
- package/dist/pi-bundle-mcp-tools-Biz_skfK.js +108 -0
- package/dist/pi-embedded-C2l80M7j.js +4 -0
- package/dist/pi-embedded-DMHGJgoQ.js +2905 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-BRiX-RqX.js +23 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
- package/dist/pi-embedded.runtime-fA0EsIue.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-model-discovery-k8VUE5Tp.js +237 -0
- package/dist/pi-tool-definition-adapter-B4hSYdYX.js +217 -0
- package/dist/pi-tools-YCHBvJG0.js +1057 -0
- package/dist/pi-tools.before-tool-call-BsyruRs4.js +433 -0
- package/dist/pi-tools.before-tool-call-D1maRTbl.js +2 -0
- package/dist/pi-tools.before-tool-call.runtime-1acRmC9A.js +13 -0
- package/dist/pi-tools.before-tool-call.runtime.js +1 -1
- package/dist/plivo-D4do6QU0.js +394 -0
- package/dist/plugin-DmBZwzWQ.js +12195 -0
- package/dist/plugin-enabled-rr_Y1Kwh.js +140 -0
- package/dist/plugin-install-config-policy-ZN1F58XF.js +137 -0
- package/dist/plugin-registration-J1JWqMZg.js +23 -0
- package/dist/plugin-registry-7OvG7Tu6.js +3 -0
- package/dist/plugin-registry-BcYuO-i5.js +2 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +3 -3
- package/dist/plugin-sdk/agent-harness-runtime.js +9 -9
- package/dist/plugin-sdk/agent-harness.js +10 -10
- package/dist/plugin-sdk/agent-runtime.js +11 -11
- package/dist/plugin-sdk/approval-client-runtime.js +2 -2
- package/dist/plugin-sdk/approval-handler-runtime.js +1 -1
- package/dist/plugin-sdk/approval-native-runtime.js +2 -2
- package/dist/plugin-sdk/approval-reply-runtime.js +2 -2
- package/dist/plugin-sdk/approval-runtime.js +6 -6
- package/dist/plugin-sdk/bluebubbles.js +2 -2
- package/dist/plugin-sdk/browser-config-runtime.js +2 -2
- package/dist/plugin-sdk/browser-node-runtime.js +3 -3
- package/dist/plugin-sdk/browser-setup-tools.js +3 -3
- package/dist/plugin-sdk/browser-support.js +8 -8
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +3 -3
- package/dist/plugin-sdk/command-auth.js +2 -2
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/compat.js +3 -3
- package/dist/plugin-sdk/config-runtime.js +7 -7
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +4 -4
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +3 -3
- package/dist/plugin-sdk/image-generation-runtime.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +4 -4
- package/dist/plugin-sdk/irc.js +2 -2
- package/dist/plugin-sdk/matrix.js +1 -1
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +5 -5
- package/dist/plugin-sdk/media-understanding-runtime.js +2 -2
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +2 -2
- package/dist/plugin-sdk/memory-core.js +4 -4
- package/dist/plugin-sdk/memory-host-core.js +2 -2
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/msteams.js +3 -3
- package/dist/plugin-sdk/nextcloud-talk.js +2 -2
- package/dist/plugin-sdk/nostr.js +1 -1
- package/dist/plugin-sdk/opencode.js +1 -1
- package/dist/plugin-sdk/outbound-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth-api-key.js +5 -5
- package/dist/plugin-sdk/provider-auth-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth.js +8 -8
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-setup.js +2 -2
- package/dist/plugin-sdk/provider-stream-family.js +3 -3
- package/dist/plugin-sdk/provider-stream.js +2 -2
- package/dist/plugin-sdk/reply-dispatch-runtime.js +2 -2
- package/dist/plugin-sdk/reply-runtime.js +5 -5
- package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/sandbox.js +1 -1
- package/dist/plugin-sdk/self-hosted-provider-setup.js +1 -1
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/session-transcript-hit.js +2 -2
- package/dist/plugin-sdk/session-visibility.js +1 -1
- package/dist/plugin-sdk/simple-completion-runtime.js +1 -1
- package/dist/plugin-sdk/speech-core.js +1 -1
- package/dist/plugin-sdk/src/infra/semver-compare.d.ts +1 -0
- package/dist/plugin-sdk/testing.js +5 -5
- package/dist/plugin-sdk/text-runtime.js +2 -2
- package/dist/plugin-sdk/tlon.js +1 -1
- package/dist/plugin-sdk/video-generation-core.js +2 -2
- package/dist/plugin-sdk/video-generation-runtime.js +2 -2
- package/dist/plugin-sdk/zalo.js +1 -1
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-service-CPY8FSW2.js +2890 -0
- package/dist/plugins/provider-discovery.runtime.js +1 -1
- package/dist/plugins/provider-runtime.runtime.js +1 -1
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-xVUY8V-3.js +584 -0
- package/dist/plugins-command-helpers-oZG-T69i.js +107 -0
- package/dist/plugins-install-persist-Ccyj_thC.js +133 -0
- package/dist/plugins-update-command-D_q-p0ED.js +1057 -0
- package/dist/policy-DDUw681i.js +328 -0
- package/dist/postinstall-inventory.json +933 -933
- package/dist/prepare.runtime-BfnpyhHB.js +815 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-Cb65Drvj.js +120 -0
- package/dist/probe-B78ZATWo.js +243 -0
- package/dist/probe-CCdD6_vN.js +1443 -0
- package/dist/probe-Ctrcd_Q7.js +2205 -0
- package/dist/probe-D9IFIte1.js +2 -0
- package/dist/probe-DXMI0QlZ.js +74 -0
- package/dist/probe-Dy-moN-J.js +32 -0
- package/dist/probe-KtX2HjXM.js +45 -0
- package/dist/probe.runtime-CNJWHyTn.js +2 -0
- package/dist/probe.runtime.js +1 -1
- package/dist/profiles-C0gEr4Vt.js +111 -0
- package/dist/program-DxZA1yAX.js +111 -0
- package/dist/prompt-select-styled-CATG4Xp5.js +20 -0
- package/dist/provider-C7oJz1U0.js +70 -0
- package/dist/provider-api-key-auth-Dp8hp-Ml.js +114 -0
- package/dist/provider-api-key-auth.runtime-nb7eC5vo.js +14 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-Df3lSzr_.js +46 -0
- package/dist/provider-auth-api-key-CZA78Uou.js +5 -0
- package/dist/provider-auth-choice-DzrRJAic.js +228 -0
- package/dist/provider-auth-choice-preference-BDTIHERa.js +26 -0
- package/dist/provider-auth-choice.runtime-CVrNfUP0.js +14 -0
- package/dist/provider-auth-choice.runtime-DOC3zhP2.js +2 -0
- package/dist/provider-auth-choice.runtime.js +1 -1
- package/dist/provider-auth-guidance-CVpgabZ6.js +2 -0
- package/dist/provider-auth-guidance-CZ-VI4e5.js +34 -0
- package/dist/provider-auth-helpers-rNcrL2rf.js +173 -0
- package/dist/provider-auth-input-zpegYxxe.js +119 -0
- package/dist/provider-auth-runtime-spGhqq1R.js +149 -0
- package/dist/provider-catalog-B_612t69.js +26 -0
- package/dist/provider-catalog-Bo9KagTv.js +11 -0
- package/dist/provider-catalog-C4IkuJHX.js +12 -0
- package/dist/provider-catalog-CEHPmBtG.js +24 -0
- package/dist/provider-catalog-UJ8mWU0J.js +11 -0
- package/dist/provider-compat-CqDox4I4.js +37 -0
- package/dist/provider-discovery.runtime--0zGwmtf.js +118 -0
- package/dist/provider-discovery.runtime.js +1 -1
- package/dist/provider-dispatcher-BZp3Stzr.js +2 -0
- package/dist/provider-dispatcher-JJxN7BDL.js +22 -0
- package/dist/provider-entry-BzH2PNpN.js +106 -0
- package/dist/provider-flow-B_VNl-lk.js +147 -0
- package/dist/provider-model-defaults-PMGtjcr2.js +6 -0
- package/dist/provider-models-DBv9Enx4.js +119 -0
- package/dist/provider-models-Du3smcTu.js +35 -0
- package/dist/provider-registration-B3sbIgIZ.js +218 -0
- package/dist/provider-registration-B9ECEmSg.js +37 -0
- package/dist/provider-runtime-CE8zqYv8.js +472 -0
- package/dist/provider-runtime-CV5mC70X.js +2 -0
- package/dist/provider-runtime.runtime-B4Idxtd0.js +26 -0
- package/dist/provider-runtime.runtime.js +1 -1
- package/dist/provider-self-hosted-setup-Comuw-z3.js +251 -0
- package/dist/provider-setup-DnUcdtJq.js +2 -0
- package/dist/provider-stream-B8nU1r79.js +290 -0
- package/dist/provider-stream-DQRHM0a1.js +2174 -0
- package/dist/provider-stream-family-C4XL1sCH.js +2 -0
- package/dist/provider-usage-CNNFTSFt.js +4 -0
- package/dist/provider-usage-DkdPMGc6.js +71 -0
- package/dist/provider-usage.load-Ckz1tFpH.js +334 -0
- package/dist/provider-utils-BR35tIjk.js +49 -0
- package/dist/provider-wizard-_jfjTfSM.js +166 -0
- package/dist/providers.runtime-DHetxgM5.js +2 -0
- package/dist/providers.runtime-PiYTktu_.js +164 -0
- package/dist/providers.runtime.js +1 -1
- package/dist/proxy-stream-wrappers-CSbzc-1F.js +394 -0
- package/dist/prune-DlDJX10W.js +83 -0
- package/dist/pw-ai-CCPJq-CT.js +2511 -0
- package/dist/pw-role-snapshot-D65unjCD.js +380 -0
- package/dist/qmd-manager-BVXvoOqt.js +1921 -0
- package/dist/qr-cli-IMKzycXh.js +349 -0
- package/dist/qr-cli-W8X3Ha5T.js +2 -0
- package/dist/qr-image-BAPDnfbt.js +2 -0
- package/dist/queue-Rq1mceUG.js +409 -0
- package/dist/reaction-runtime-api-D7i4oMn9.js +116 -0
- package/dist/reactions-D9eRHeXM.js +998 -0
- package/dist/read-best-effort-config.runtime-CsH29elm.js +2 -0
- package/dist/read-best-effort-config.runtime.js +1 -1
- package/dist/read-capability-7xOdYqOo.js +412 -0
- package/dist/realtime-provider-shared-C2fZT5O_.js +37 -0
- package/dist/realtime-transcription-provider-CCX9jOLy.js +120 -0
- package/dist/realtime-transcription-provider-CqIc1zwy.js +184 -0
- package/dist/realtime-transcription-provider-CyI79CyM.js +183 -0
- package/dist/realtime-transcription-provider-CydzsmVb.js +172 -0
- package/dist/realtime-transcription-provider-D4PaV840.js +184 -0
- package/dist/realtime-voice-provider-DgL6WxN7.js +489 -0
- package/dist/record-shared-DxabpimX.js +10 -0
- package/dist/register-service-commands-D37K4_BJ.js +71 -0
- package/dist/register.agent-p1q6ZWSs.js +248 -0
- package/dist/register.backup-Bxvo3j_q.js +64 -0
- package/dist/register.configure-tgXCoIHv.js +15 -0
- package/dist/register.maintenance-BtBgu8zC.js +438 -0
- package/dist/register.message-B5msOUKt.js +329 -0
- package/dist/register.onboard-BO11PDUs.js +81 -0
- package/dist/register.runtime-D8XvwfoZ.js +81 -0
- package/dist/register.runtime.js +1 -1
- package/dist/register.setup-Ba19XSJi.js +150 -0
- package/dist/register.status-health-sessions-Bne0mmgw.js +1215 -0
- package/dist/register.subclis--mdYCZZM.js +3 -0
- package/dist/register.subclis-_kuyreQm.js +29 -0
- package/dist/register.subclis-core-UkVTqwB1.js +249 -0
- package/dist/register.wallet-aTazgPYX.js +159 -0
- package/dist/repair-sequencing-CjiQXU4z.js +145 -0
- package/dist/replay-policy-XaA2Foet.js +8 -0
- package/dist/reply-dispatch-runtime-DcxOLr7n.js +13 -0
- package/dist/reply-media-paths.runtime-CmS_Bnnf.js +2 -0
- package/dist/reply-media-paths.runtime-DCj1JhDR.js +146 -0
- package/dist/reply-media-paths.runtime.js +1 -1
- package/dist/reply-payload-transform-DmArXXXO.js +720 -0
- package/dist/reply-runtime-B4VQJnqi.js +11 -0
- package/dist/reply.runtime-B990ty9C.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-IXqG_vKU.js +259 -0
- package/dist/response-generator-DCxui-Yb.js +175 -0
- package/dist/restart-C-4J0cf2.js +490 -0
- package/dist/root-help-D9aeVXNr.js +44 -0
- package/dist/route-reply-q5jc2Nv9.js +162 -0
- package/dist/route-reply.runtime-Co8TnDf9.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/routes-BSmEgP46.js +2 -0
- package/dist/routes-Z67chkN5.js +3341 -0
- package/dist/rpc-CBQZvJME.js +61 -0
- package/dist/rpc-context-e__2PCau.js +17 -0
- package/dist/rpc.runtime-ClhNVRer.js +21 -0
- package/dist/rpc.runtime.js +1 -1
- package/dist/run-auth-profile.runtime-CMkCqc7k.js +2 -0
- package/dist/run-auth-profile.runtime.js +1 -1
- package/dist/run-context.runtime-DCgb3ETM.js +2 -0
- package/dist/run-context.runtime.js +1 -1
- package/dist/run-delivery.runtime-Bj566BTH.js +530 -0
- package/dist/run-delivery.runtime.js +1 -1
- package/dist/run-embedded.runtime-DuB-mQh2.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-Oy4FGfj5.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime-B7-lfFh3.js +277 -0
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-main-1Fvwazhp.js +516 -0
- package/dist/run-model-catalog.runtime-B7wlXnDF.js +2 -0
- package/dist/run-model-catalog.runtime.js +1 -1
- package/dist/run-subagent-registry.runtime-Bx9Wga3d.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/run-wait-C-VgbefQ.js +135 -0
- package/dist/runner-BKhQg4av.js +966 -0
- package/dist/runner.entries-Dbp1RZd9.js +604 -0
- package/dist/runs-DUTtPgDm.js +496 -0
- package/dist/runs-DWOm31T_.js +2 -0
- package/dist/runtime-B3upjFki.js +475 -0
- package/dist/runtime-B6k9iJRB.js +187 -0
- package/dist/runtime-BV7JmOaE.js +9 -0
- package/dist/runtime-BuEvshdw.js +94 -0
- package/dist/runtime-Bu_cc482.js +107 -0
- package/dist/runtime-CsaTxb99.js +187 -0
- package/dist/runtime-D7npxl4G.js +973 -0
- package/dist/runtime-DB1WNkhW.js +262 -0
- package/dist/runtime-Db_oJ87Z.js +2 -0
- package/dist/runtime-Dlvh7_uU.js +116 -0
- package/dist/runtime-DvzcF4-r.js +2 -0
- package/dist/runtime-NlpdlX79.js +72 -0
- package/dist/runtime-_-L5ftbu.js +269 -0
- package/dist/runtime-api-BkVIoPU9.js +4 -0
- package/dist/runtime-api-CdhgyHMB.js +9 -0
- package/dist/runtime-api-CmlBBCCY.js +9 -0
- package/dist/runtime-api-DnhXPE_z.js +14 -0
- package/dist/runtime-embedded-pi.runtime-DpKqDUrl.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-entry-CWugm0Uj.js +2769 -0
- package/dist/runtime-internal-Bu1n9i4P.js +2 -0
- package/dist/runtime-model-auth.runtime-B0HsFXG7.js +2 -0
- package/dist/runtime-model-auth.runtime-CwdDdKqY.js +45 -0
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-options-CN4g8VJE.js +275 -0
- package/dist/runtime-prepare.runtime-B3oyafQ4.js +80 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-Dcc5OeVJ.js +21 -0
- package/dist/runtime-registry-loader-B5mIkwhZ.js +85 -0
- package/dist/runtime-registry-loader-CGNT5-qz.js +2 -0
- package/dist/runtime-schema-Jjsquqvq.js +27780 -0
- package/dist/runtime-shared-BC82_Fzc.js +267 -0
- package/dist/runtime-web-channel-plugin-DQoEo6bK.js +203 -0
- package/dist/runtime-web-tools-BizCqA0v.js +1477 -0
- package/dist/runtime-web-tools-fallback.runtime-CYAGzwsD.js +9 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/sandbox-C95gEa17.js +3 -0
- package/dist/sandbox-DAnx9TYc.js +1156 -0
- package/dist/sandbox-cli-CPs_gL72.js +450 -0
- package/dist/scan-C8jthyct.js +523 -0
- package/dist/scan-DEd4q4aN.js +2 -0
- package/dist/secrets-cli-iBL8NBAq.js +2101 -0
- package/dist/security-cli-CzYBRa4n.js +486 -0
- package/dist/selection-BOalx5uy.js +2 -0
- package/dist/selection-BZFVKdFz.js +7736 -0
- package/dist/semver-compare-tPC_r5LW.js +64 -0
- package/dist/send-C4mKkkWW.js +156 -0
- package/dist/send-CMqcsAS2.js +534 -0
- package/dist/send-C_36w3lb.js +102 -0
- package/dist/send.runtime-vJT5TzDj.js +2 -0
- package/dist/send.runtime.js +1 -1
- package/dist/server-BTmWWR_9.js +13 -0
- package/dist/server-CBQVrNY0.js +77 -0
- package/dist/server-context-Dq2VA7I4.js +2 -0
- package/dist/server-context-O_WUP8OV.js +847 -0
- package/dist/server-middleware-BTovsGYd.js +120 -0
- package/dist/server-node-events-B8PLg0eQ.js +481 -0
- package/dist/server-plugin-bootstrap-ChIvqLMw.js +2 -0
- package/dist/server-plugin-bootstrap-Rbxd2g6a.js +11333 -0
- package/dist/server-restart-sentinel-BCd6AqrQ.js +697 -0
- package/dist/server-startup-memory-ClzqrFwF.js +32 -0
- package/dist/server.impl-CEOWGKN5.js +12735 -0
- package/dist/service-Dw-BzupJ.js +940 -0
- package/dist/session-DF38Qk5T.js +48 -0
- package/dist/session-cost-usage-CbaKFiYP.js +651 -0
- package/dist/session-envelope-SoEaHn7u.js +18 -0
- package/dist/session-key-BpQtNboQ.js +65 -0
- package/dist/session-kill-http-ChCr5CQ3.js +110 -0
- package/dist/session-meta-DHOj7FVp.js +109 -0
- package/dist/session-override-Cra7WfkP.js +106 -0
- package/dist/session-reset-model.runtime-CITOeORk.js +133 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-DsYIDYdh.js +471 -0
- package/dist/session-route-rem428sJ.js +93 -0
- package/dist/session-status.runtime-CFmGwoCm.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-store-DfVF72xW.js +126 -0
- package/dist/session-store.runtime-jJK2KnR6.js +2 -0
- package/dist/session-store.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-DLkpnURC.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-system-events-BS6g-vqa.js +63 -0
- package/dist/session-tab-registry-DWyzIez5.js +491 -0
- package/dist/session-transcript-hit-Mxv1sZGp.js +41 -0
- package/dist/session-updates-BdB1lGXz.js +236 -0
- package/dist/session-updates.runtime-6GlaYt-B.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-BPYVECh0.js +926 -0
- package/dist/session-visibility-CJocpWP0.js +147 -0
- package/dist/sessions--xDkaJeX.js +48 -0
- package/dist/sessions-D3RqoN9N.js +2 -0
- package/dist/sessions-DrFkAEV2.js +281 -0
- package/dist/sessions-c-R_ynJR.js +16 -0
- package/dist/sessions-helpers-CMf9gVTZ.js +304 -0
- package/dist/sessions-history-http-C5iZkW8x.js +383 -0
- package/dist/sessions-resolve-D1hmolC-.js +174 -0
- package/dist/sessions.runtime-DMPmzLE0.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/set-BraQD5KU.js +17 -0
- package/dist/set-DZUigywb.js +2 -0
- package/dist/set-image-C08k8cVg.js +2 -0
- package/dist/set-image-CsCPBHZC.js +17 -0
- package/dist/setup-D1ekkhVk.js +495 -0
- package/dist/setup-FPfOBbYL.js +421 -0
- package/dist/setup-api-DilgjV01.js +29 -0
- package/dist/setup-core-CAFnyY_a.js +393 -0
- package/dist/setup-core-CFAiauCt.js +171 -0
- package/dist/setup-core-RgJfQc-C.js +176 -0
- package/dist/setup-core-dF4To6Jd.js +184 -0
- package/dist/setup-surface-BpSH7F_m.js +351 -0
- package/dist/setup-surface-C0l9bHY3.js +286 -0
- package/dist/setup-surface-CfcFHZln.js +403 -0
- package/dist/setup-surface-CyDRXq_1.js +219 -0
- package/dist/setup-surface-DGJUq-2P.js +72 -0
- package/dist/setup-surface-DiYEprKG.js +3 -0
- package/dist/setup.finalize-JPqhcPh5.js +539 -0
- package/dist/shared-3gP_6DZV.js +76 -0
- package/dist/shared-C9fN-WCy.js +198 -0
- package/dist/shared-CZOgyBro.js +60 -0
- package/dist/shared-Cz9c46Aj.js +121 -0
- package/dist/shared-D7BxFCKU.js +217 -0
- package/dist/shared-DrgQbH3q.js +186 -0
- package/dist/shared-runtime-xz83dsyA.js +7 -0
- package/dist/shared-u-3RmeL1.js +135 -0
- package/dist/short-term-promotion-DCHcaW2F.js +1543 -0
- package/dist/simple-completion-runtime-CfFpRl7j.js +158 -0
- package/dist/simple-completion-transport-C1ooKj9X.js +33 -0
- package/dist/skills-clawhub-DxVmnVrv.js +275 -0
- package/dist/skills-cli-DCr7N_Sq.js +370 -0
- package/dist/slash-state-C7nXXf23.js +1911 -0
- package/dist/speech-core-CmPRP1zB.js +94 -0
- package/dist/speech-provider-CNOimJB2.js +209 -0
- package/dist/speech-provider-D9i0DEZ1.js +216 -0
- package/dist/speech-provider-DGbn1IrA.js +209 -0
- package/dist/speech-provider-DKyYgpwf.js +103 -0
- package/dist/speech-provider-eDG83bBp.js +184 -0
- package/dist/speech-provider-mKY_GAkS.js +170 -0
- package/dist/speech-provider-zoWs7x7l.js +395 -0
- package/dist/src-LnF0REtW.js +3974 -0
- package/dist/stage-sandbox-media.runtime-CErRBxI5.js +232 -0
- package/dist/stage-sandbox-media.runtime.js +1 -1
- package/dist/startup-auth-8XVCRzQi.js +180 -0
- package/dist/startup-context-CxTy7OzN.js +312 -0
- package/dist/state-migrations-CHc2Y8Pl.js +820 -0
- package/dist/status-4n9xL7HY.js +2 -0
- package/dist/status-B4kD5cCF.js +2 -0
- package/dist/status-CARBoVql.js +209 -0
- package/dist/status-COK71LP_.js +3 -0
- package/dist/status-ChOxNWSb.js +62 -0
- package/dist/status-DagNCfVv.js +323 -0
- package/dist/status-DxcqzXtf.js +397 -0
- package/dist/status-all-r7zyk41X.js +498 -0
- package/dist/status-f2DLmjOF.js +190 -0
- package/dist/status-json-C_wESP21.js +14 -0
- package/dist/status-json-command-C6w9ZAHp.js +84 -0
- package/dist/status-message-tZJ_0MsI.js +466 -0
- package/dist/status-message.runtime-KeyKW26h.js +6 -0
- package/dist/status-message.runtime.js +1 -1
- package/dist/status-queue.runtime-R5ZlyNdK.js +2 -0
- package/dist/status-queue.runtime.js +1 -1
- package/dist/status-runtime-shared-Bq_SUJpC.js +257 -0
- package/dist/status-subagents.runtime-03fp3eBE.js +18 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-CNvz374U.js +237 -0
- package/dist/status.command.text-runtime-C4-j2lqa.js +15 -0
- package/dist/status.gateway-connection.runtime-zjQmormq.js +2 -0
- package/dist/status.gateway-connection.runtime.js +1 -1
- package/dist/status.gather-BhjoJVEs.js +2 -0
- package/dist/status.gather-zdywRvBb.js +292 -0
- package/dist/status.runtime-CKd1Qzxg.js +2 -0
- package/dist/status.runtime-DB31ZRnK.js +2 -0
- package/dist/status.runtime.js +1 -1
- package/dist/status.scan-DjhdTOWP.js +65 -0
- package/dist/status.scan-overview-BYxTBsOw.js +379 -0
- package/dist/status.scan.deps.runtime-B7f3inzh.js +18 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json-Dz0JcORG.js +2 -0
- package/dist/status.scan.fast-json-FroEIZ9d.js +132 -0
- package/dist/status.scan.runtime-CtXWwjb8.js +409 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.summary-3UVa_X5B.js +214 -0
- package/dist/status.summary-BGzGsyZB.js +2 -0
- package/dist/status.update-CxsGc95A.js +79 -0
- package/dist/status.update-Czi5MNWC.js +2 -0
- package/dist/store-BdedeUHG.js +4 -0
- package/dist/store-CUSu4-Qr.js +910 -0
- package/dist/store-load-CUqchamJ.js +370 -0
- package/dist/store-zVJHt5-N.js +1235 -0
- package/dist/store.runtime-DEIs4Pal.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-BLThzHaS.js +134 -0
- package/dist/stream-BbTa3Gk4.js +27 -0
- package/dist/stream-CKjYSBQh.js +664 -0
- package/dist/stt-DM1vajYf.js +66 -0
- package/dist/subagent-announce-BvRFZ87M.js +351 -0
- package/dist/subagent-announce-delivery-QvuOM46S.js +726 -0
- package/dist/subagent-announce-output-fOtzkOiP.js +364 -0
- package/dist/subagent-capabilities-1ZqaiPST.js +251 -0
- package/dist/subagent-control-DwnzmG6T.js +506 -0
- package/dist/subagent-control.runtime-BNoZSftx.js +3 -0
- package/dist/subagent-control.runtime.js +1 -1
- package/dist/subagent-followup.runtime-DxR1eP_x.js +68 -0
- package/dist/subagent-followup.runtime.js +1 -1
- package/dist/subagent-list-w3yWfW9R.js +172 -0
- package/dist/subagent-orphan-recovery-CiBbDxX3.js +305 -0
- package/dist/subagent-registry-D5FrT_tn.js +3 -0
- package/dist/subagent-registry-DbPekx8d.js +1753 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-spawn-W-bTaU9l.js +1005 -0
- package/dist/system-cli-B443uVHG.js +59 -0
- package/dist/target-id-0_iIeBLg.js +107 -0
- package/dist/targets-3Lcm8HoL.js +67 -0
- package/dist/task-executor-B5e9_Hmt.js +360 -0
- package/dist/task-owner-access-CIEssJ78.js +74 -0
- package/dist/task-registry-M1bHrFvP.js +2366 -0
- package/dist/task-registry-delivery-runtime-CiHBC7sJ.js +3 -0
- package/dist/task-registry-delivery-runtime-M4O7ffju.js +2 -0
- package/dist/task-registry.maintenance-BURvMU0r.js +2 -0
- package/dist/task-registry.maintenance-CgrLoBqi.js +416 -0
- package/dist/tavily-client--ZxuZ8JY.js +193 -0
- package/dist/tavily-client-D3L2LtMF.js +2 -0
- package/dist/tavily-search-provider-gMJgCeVS.js +62 -0
- package/dist/telegram/audit.js +2 -2
- package/dist/telegram/token.js +2 -2
- package/dist/telnyx-UQXrfg_e.js +260 -0
- package/dist/testing-CRy_6-wt.js +575 -0
- package/dist/text-report-B3-4Dvfb.js +587 -0
- package/dist/text-runtime-B4pK_Jpd.js +290 -0
- package/dist/tool-auth-shared-B9CrADMc.js +90 -0
- package/dist/tool-config-shared-DrS6NohH.js +19 -0
- package/dist/tool-policy-pipeline-CC9_1Ta1.js +109 -0
- package/dist/tool-resolution-C52y5Qtc.js +90 -0
- package/dist/tool-schema-runtime-BCx7p6Ey.js +167 -0
- package/dist/tools-F4mE-OU0.js +113 -0
- package/dist/tools-effective-inventory-WlIlqM7G.js +152 -0
- package/dist/tools-invoke-http-B04Rc8tG.js +206 -0
- package/dist/tools.runtime-DV_PUXuD.js +4 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/transcript-Bu-SsK2V.js +312 -0
- package/dist/transcript-resolve.runtime-CnnOwtyU.js +2 -0
- package/dist/transcript-resolve.runtime.js +1 -1
- package/dist/transcript.runtime-DBVz9-zl.js +2 -0
- package/dist/transcript.runtime.js +1 -1
- package/dist/transport-policy-Byy3HifG.js +75 -0
- package/dist/trash-BV5Gcx3a.js +24 -0
- package/dist/tts-BmCzLLJ_.js +183 -0
- package/dist/tts-D4vxwDtE.js +64 -0
- package/dist/tui-cli-DMZ07qRK.js +4575 -0
- package/dist/twilio-CZsjakcE.js +609 -0
- package/dist/update-DSox1dVQ.js +1282 -0
- package/dist/update-check-CaPWrLU-.js +438 -0
- package/dist/update-cli-DeBm7b4g.js +1759 -0
- package/dist/update-runner-eQrUTjUC.js +1892 -0
- package/dist/update-startup-DgWKoqop.js +331 -0
- package/dist/update-startup-XA38a9KV.js +2 -0
- package/dist/upgrade-C9ke1SCc.js +1226 -0
- package/dist/usage-CLnhtd59.js +606 -0
- package/dist/usage-format-CaxDNPPm.js +2 -0
- package/dist/usage-format-CeDc5if9.js +703 -0
- package/dist/video-generation-core-CuFcXCvE.js +6 -0
- package/dist/video-generation-provider-B5_G-r4P.js +64 -0
- package/dist/video-generation-provider-BD7G-8X5.js +118 -0
- package/dist/video-generation-provider-CIIRQd3c.js +254 -0
- package/dist/video-generation-provider-CLCLvtWm.js +264 -0
- package/dist/video-generation-provider-CpPkkFNc.js +187 -0
- package/dist/video-generation-provider-CvmPMAXP.js +271 -0
- package/dist/video-generation-provider-D4l7Q8t7.js +78 -0
- package/dist/video-generation-provider-DNe73dVv.js +221 -0
- package/dist/video-generation-provider-M281XkUx.js +281 -0
- package/dist/video-generation-provider-Y9urhhT4.js +287 -0
- package/dist/video-generation-provider-iA6Vaqc_2.js +77 -0
- package/dist/video-generation-runtime-BfNI4qH8.js +2 -0
- package/dist/video-generation-task-status-I3jvAjUL.js +163 -0
- package/dist/voice-mapping-FtCIKOHQ.js +41 -0
- package/dist/wait-for-idle-before-flush-BZhF2ejZ.js +5986 -0
- package/dist/web-fetch-providers.runtime-DN6FBm7n.js +34 -0
- package/dist/web-fetch-providers.runtime.js +1 -1
- package/dist/web-provider-runtime-shared-C1Sy3sQI.js +180 -0
- package/dist/web-search-CgZ8TUj8.js +61 -0
- package/dist/web-search-provider-DL2LLOsz.js +163 -0
- package/dist/web-search-provider.runtime-B01EY78s.js +2 -0
- package/dist/web-search-provider.runtime-Bgwk3KBe.js +185 -0
- package/dist/web-search-provider.runtime.js +1 -1
- package/dist/web-search-providers.runtime-BFtJCprz.js +42 -0
- package/dist/web-search-providers.runtime.js +1 -1
- package/dist/webhook-shared-DMbP4pF5.js +12 -0
- package/dist/webhooks-cli-lrEfJsYQ.js +321 -0
- package/dist/wizard-models-CMKeAr_M.js +161 -0
- package/dist/workflow-runtime-hF0PG5ky.js +485 -0
- package/dist/x-search-config-CqjeeiPu.js +36 -0
- package/dist/x-search-shared-DomcrGQ_.js +75 -0
- package/dist/zalo-js-B0dhviG7.js +1157 -0
- package/package.json +1 -1
- package/dist/abort-ca8hDmJr.js +0 -201
- package/dist/abort-cutoff.runtime-vuCUcBP6.js +0 -20
- package/dist/abort.runtime-BrChEuUS.js +0 -2
- package/dist/accounts-B8y7HaWy.js +0 -66
- package/dist/accounts-BM62Jgez.js +0 -43
- package/dist/accounts-C1ECKXaw.js +0 -107
- package/dist/accounts-CNMAC2Vo.js +0 -365
- package/dist/accounts-DH8HU_Fu.js +0 -104
- package/dist/accounts-DWQpG06j.js +0 -2
- package/dist/accounts.runtime-DkGk9q3U.js +0 -2
- package/dist/acp-cli-BLpWVnc7.js +0 -2193
- package/dist/acp-spawn-D1p6b1gk.js +0 -2
- package/dist/acp-spawn-qoyl9NiU.js +0 -1093
- package/dist/acp-stateful-target-driver-NL9txhIM.js +0 -89
- package/dist/action-agents-C729fJ_P.js +0 -67
- package/dist/action-focus-53k9XP4K.js +0 -132
- package/dist/action-help-bIJZBYLz.js +0 -7
- package/dist/action-info-BBzvYFX_.js +0 -101
- package/dist/action-kill-C4fa3E9I.js +0 -33
- package/dist/action-list-BEiIbwP1.js +0 -21
- package/dist/action-log-Cq7RLW2T.js +0 -30
- package/dist/action-send-DyiHgRwh.js +0 -39
- package/dist/action-spawn-CEZfDvXU.js +0 -47
- package/dist/action-unfocus-CpAw3JOi.js +0 -29
- package/dist/actions.runtime-BKEwPyo7.js +0 -18
- package/dist/actions.runtime-Bp0UusIf.js +0 -5
- package/dist/agent-C2hwJefQ.js +0 -2
- package/dist/agent-command-BAAeGRql.js +0 -874
- package/dist/agent-harness-runtime-Czrx53YL.js +0 -144
- package/dist/agent-runner-utils-DzShckNa.js +0 -239
- package/dist/agent-runner.runtime-d_EtNxBK.js +0 -3455
- package/dist/agent-runtime-DNgz7AOP.js +0 -18
- package/dist/agents-DSV7R_Ys.js +0 -953
- package/dist/agents-DZP5tYDr.js +0 -5
- package/dist/agents.command-shared-CX0AI2SJ.js +0 -40
- package/dist/aliases-CZemdpTj.js +0 -2
- package/dist/aliases-KefnmoaT.js +0 -96
- package/dist/api-B87UL3DC.js +0 -2
- package/dist/api-BWN4PIiM.js +0 -4
- package/dist/api-CO05iXNH.js +0 -139
- package/dist/api-CVXzxdCp.js +0 -48
- package/dist/api-CyjlApHT.js +0 -3
- package/dist/api-D3Y0Edm_.js +0 -3
- package/dist/api-DArm1ECd.js +0 -5
- package/dist/api-DgHFv6c12.js +0 -2
- package/dist/api-qoDs2ceF2.js +0 -2
- package/dist/apply-DmW0sOwq.js +0 -508
- package/dist/apply.runtime-DR3dLbbu.js +0 -166
- package/dist/apply.runtime-DiBS7O9R.js +0 -2
- package/dist/approval-client-helpers-CLYckHzb.js +0 -82
- package/dist/approval-handler-runtime-BgRQnG4g.js +0 -439
- package/dist/approval-native-helpers-XhNhwe4W.js +0 -33
- package/dist/approval-native-runtime-DAsraihr.js +0 -729
- package/dist/approval-renderers-bwrFaldo.js +0 -64
- package/dist/attempt-execution.runtime-D_FGkDQz.js +0 -509
- package/dist/attempt-execution.shared-WN2pMInT.js +0 -22
- package/dist/attempt.prompt-helpers-CDzDUi1C.js +0 -221
- package/dist/attempt.tool-run-context-DitxaTPJ.js +0 -933
- package/dist/audit-extra.async-BCum5o_S.js +0 -971
- package/dist/audit-k5sVbkP5.js +0 -939
- package/dist/audit-membership-runtime-CF94r_hx.js +0 -550
- package/dist/audit.deep.runtime-De20ia-s.js +0 -2
- package/dist/audit.nondeep.runtime-D2m0GAmG.js +0 -880
- package/dist/audit.runtime-BVZs63pn.js +0 -7
- package/dist/auth-B6TDtKdZ.js +0 -177
- package/dist/auth-CfUOZJWq.js +0 -2
- package/dist/auth-DtQv6fQz.js +0 -56
- package/dist/auth-_9zCNYrQ.js +0 -383
- package/dist/auth-choice-B4-IWttU.js +0 -354
- package/dist/auth-choice-CqMHwtjq.js +0 -3
- package/dist/auth-choice-D1VRwrad.js +0 -88
- package/dist/auth-choice-options-CvEDY7-R.js +0 -97
- package/dist/auth-choice-prompt-1EriFNA8.js +0 -2
- package/dist/auth-choice-prompt-XcsSlY4m.js +0 -37
- package/dist/auth-choice.apply.api-providers-DA5zxSX2.js +0 -34
- package/dist/auth-choice.apply.api-providers-DoVm22Ln.js +0 -2
- package/dist/auth-choice.plugin-providers.runtime-R7dET-rk.js +0 -11
- package/dist/auth-health-DGNHS1hv.js +0 -183
- package/dist/auth-install-policy-kR4_sljC.js +0 -195
- package/dist/auth-order-C3zGI0s9.js +0 -96
- package/dist/auth-order-XQ9ZGPd9.js +0 -2
- package/dist/auth-profiles-Bn8y2hqR.js +0 -679
- package/dist/backup-create-ChqA8nu7.js +0 -395
- package/dist/banner-BwacLUaf.js +0 -2
- package/dist/banner-CFADygMU.js +0 -336
- package/dist/base-url-l_nyPQC0.js +0 -15
- package/dist/bash-tools-BBRtIa6j.js +0 -2824
- package/dist/bash-tools-BI0d1TdC.js +0 -3
- package/dist/binding-routing-Cvm5c1IV.js +0 -85
- package/dist/binding-targets-DSs4NXbd.js +0 -121
- package/dist/bluebubbles-5jDMT0b0.js +0 -77
- package/dist/brave-web-search-provider-BuSp_bii.js +0 -111
- package/dist/brave-web-search-provider.runtime-Dts_65-F.js +0 -229
- package/dist/brave-web-search-provider.shared-BSh8nzHC.js +0 -174
- package/dist/bridge-auth-registry-C5sNQKcj.js +0 -23
- package/dist/bridge-server-B6Hfjg1u.js +0 -113
- package/dist/browser-config-runtime-BKzd6AyE.js +0 -7
- package/dist/browser-control-auth-BbzwesFd.js +0 -2
- package/dist/browser-node-runtime-BDVW4WBK.js +0 -12
- package/dist/browser-profiles-BFgCMoPL.js +0 -2
- package/dist/browser-runtime-PsMSIYQ7.js +0 -387
- package/dist/browser-setup-tools-CFB52yQc.js +0 -13
- package/dist/build-TlobwpQW.js +0 -550
- package/dist/call-Bx8lENb2.js +0 -3
- package/dist/call-jYRpeAWm.js +0 -331
- package/dist/call-status-DB7m5q5K.js +0 -33
- package/dist/call.runtime-BRluUZbD.js +0 -2
- package/dist/capability-cli-B3u_GAig.js +0 -1401
- package/dist/card-command-Db-58QX1.js +0 -241
- package/dist/catalog-provider-DLdEsRxZ.js +0 -40
- package/dist/catchup-CtxTwzY8.js +0 -300
- package/dist/channel-BJKHBfnq.js +0 -491
- package/dist/channel-BNNnYzwK.js +0 -1100
- package/dist/channel-BXS-Hd8p.js +0 -226
- package/dist/channel-C4XWpowe.js +0 -1174
- package/dist/channel-CJQdQgPr.js +0 -840
- package/dist/channel-C_zWAu4D.js +0 -595
- package/dist/channel-CtGzrF-K.js +0 -1802
- package/dist/channel-O9DE4IIq.js +0 -350
- package/dist/channel-WHUOtJme.js +0 -297
- package/dist/channel-WoDWDxqx.js +0 -1320
- package/dist/channel-add-wizard-CW2kMHCQ.js +0 -2
- package/dist/channel-add-wizard-MPlDWR78.js +0 -125
- package/dist/channel-core-BJjq9SOq.js +0 -5
- package/dist/channel-inbound-DLs-YfUs.js +0 -31
- package/dist/channel-plugin-runtime-D5jtM0YK.js +0 -771
- package/dist/channel-runtime-4UjeDmDI.js +0 -425
- package/dist/channel-summary-D34JTfKA.js +0 -129
- package/dist/channel-summary-DN_PekkS.js +0 -2
- package/dist/channel-ys2FFqi1.js +0 -453
- package/dist/channel.runtime-B38Ky3R9.js +0 -109
- package/dist/channel.runtime-BMhrGM1i.js +0 -26
- package/dist/channel.runtime-Bl8WYZvF.js +0 -576
- package/dist/channel.runtime-CX2p8xgN.js +0 -67
- package/dist/channel.runtime-CrN1mC1m.js +0 -2364
- package/dist/channel.runtime-D3kAsCsR.js +0 -89
- package/dist/channel.runtime-DG-EUnSC.js +0 -4
- package/dist/channel.runtime-IfV1Md6p.js +0 -430
- package/dist/channel.runtime-w1tHjTOa.js +0 -34702
- package/dist/channel.setup-dXwiMlyi.js +0 -10
- package/dist/channels-DJZu0HEX.js +0 -733
- package/dist/channels-cli-DJMgmakk.js +0 -268
- package/dist/chat-DdKbu8CA.js +0 -2758
- package/dist/chrome-Cs0ME7FH.js +0 -1181
- package/dist/chrome-mcp-DkIFJETj.js +0 -2
- package/dist/chrome-mcp-DxhdLTiR.js +0 -600
- package/dist/chrome.executables-CfWpFyzT.js +0 -541
- package/dist/clawbot-cli-CnHERFYk.js +0 -9
- package/dist/clawhub-BtR3rMxw.js +0 -300
- package/dist/clawhub-oHDXDom4.js +0 -400
- package/dist/cli-Bt8TEQTY.js +0 -3726
- package/dist/cli-C0Ib5uEO.js +0 -683
- package/dist/cli-CN0o_7BK.js +0 -2
- package/dist/cli-CSNAd6Sz.js +0 -72
- package/dist/cli-DMPwqYqc.js +0 -219
- package/dist/cli-DaXzOAcN.js +0 -154
- package/dist/cli-O9WMyUsH.js +0 -2
- package/dist/cli-ctyAqh0j.js +0 -2
- package/dist/cli-runner-CNlk7xmx.js +0 -286
- package/dist/cli-runner.runtime-BK4sQk1m.js +0 -3
- package/dist/cli-runner.runtime-BT8ZZn-R.js +0 -4
- package/dist/cli.runtime-DU7swpBI.js +0 -1261
- package/dist/client-CQdcTPUf.js +0 -138
- package/dist/codex-native-web-search-BB3PWg7n.js +0 -3
- package/dist/codex-native-web-search-BLevwOtN.js +0 -113
- package/dist/combined-store-gateway-Cp7gSMlV.js +0 -163
- package/dist/command-auth-DkJWb2HE.js +0 -76
- package/dist/command-config-resolution-CIRWRfR8.js +0 -23
- package/dist/command-config-resolution-DYZWj6Zm.js +0 -2
- package/dist/command-config-resolution.runtime-CUtVJOf0.js +0 -2
- package/dist/command-execution-startup-DEsPsZEU.js +0 -305
- package/dist/command-registry-5QcI0D66.js +0 -4
- package/dist/command-registry-6nNAhDaE.js +0 -9
- package/dist/command-registry-core-B-Tfqu1R.js +0 -101
- package/dist/command-secret-gateway-BNnWdAlq.js +0 -528
- package/dist/command-status.runtime-CKgimR6Y.js +0 -87
- package/dist/commands-acp-DSm97O5v.js +0 -77
- package/dist/commands-compact.runtime-BXhP6WJ6.js +0 -10
- package/dist/commands-core.runtime-6efmBjL5.js +0 -2
- package/dist/commands-handlers.runtime-FzK-n0L8.js +0 -4597
- package/dist/commands-models-CYEA4oks.js +0 -327
- package/dist/commands-reset-hooks-BuIPeOLT.js +0 -133
- package/dist/commands-status-BQnB5OSX.js +0 -16
- package/dist/commands-status.runtime-B6GcfEDm.js +0 -3
- package/dist/commands-subagents-control.runtime-CByd528A.js +0 -2
- package/dist/commands-subagents-control.runtime-CqI4LMYa.js +0 -3
- package/dist/commands-system-prompt-BD_LeeZk.js +0 -2
- package/dist/commands-system-prompt-C2Md_Ia1.js +0 -158
- package/dist/commands.runtime-CwiPf7Cc.js +0 -166
- package/dist/compact-B_4bMVpw.js +0 -1118
- package/dist/compact.runtime-BhRqiBXG.js +0 -12
- package/dist/completion-cli-DPAWxu_A.js +0 -328
- package/dist/config-B3ZoZd5V.js +0 -5
- package/dist/config-D1ooXKCx.js +0 -9
- package/dist/config-DidVsRqm.js +0 -251
- package/dist/config-api-BRmW2LUx.js +0 -2
- package/dist/config-cli-Ibsfa8Bm.js +0 -1078
- package/dist/config-compat-B57zq89q.js +0 -130
- package/dist/config-compat-ixP32ZwJ.js +0 -126
- package/dist/config-guard-DnIVuR5d.js +0 -96
- package/dist/config-runtime-Dr1JoMKQ.js +0 -32
- package/dist/config-validation-COw3JcuF.js +0 -30
- package/dist/configure-BfQlIIk0.js +0 -1245
- package/dist/configure-DQ-DTcOJ.js +0 -2
- package/dist/connect-options-zqTIEl6K.js +0 -699
- package/dist/context-D5Ro5yCf.js +0 -278
- package/dist/context-g9ANkVhl.js +0 -2
- package/dist/control-auth-Bi8COEXI.js +0 -125
- package/dist/control-service-DkYQV-Tl.js +0 -156
- package/dist/control-ui-BA0iGAG9.js +0 -688
- package/dist/conversation-id-BLY9ffjm.js +0 -38
- package/dist/conversation-id-DVeOM5Jh.js +0 -235
- package/dist/conversation-label-generator-Cc-S8z9Q.js +0 -56
- package/dist/conversation-runtime-gJt7AAg2.js +0 -31
- package/dist/core-BtmNtOpS.js +0 -275
- package/dist/create-an7bnQv1.js +0 -80
- package/dist/cron-cli-CPG4lnt5.js +0 -713
- package/dist/daemon-cli-BXuqNS-3.js +0 -12
- package/dist/daemon-install-BHDgo9qp.js +0 -64
- package/dist/daemon-install-auth-profiles-store.runtime-DuRtWxoP.js +0 -2
- package/dist/daemon-install-plan.shared-BQxPrU7X.js +0 -266
- package/dist/ddg-client-CntWAh8N.js +0 -147
- package/dist/ddg-search-provider-BeZ9HYXK.js +0 -54
- package/dist/delegate-DyITI93V.js +0 -64
- package/dist/deliver-BUbBF0P-.js +0 -3
- package/dist/deliver-VYqGta5q.js +0 -747
- package/dist/deliver-runtime-LEUVCSBV.js +0 -2
- package/dist/delivery-outbound.runtime-DmSpBsJ2.js +0 -6
- package/dist/delivery.runtime-Dwii5usm.js +0 -253
- package/dist/deps-BMuC_6j0.js +0 -73
- package/dist/deps-CIN4SVhK.js +0 -2
- package/dist/detached-task-runtime-CTUQj84i.js +0 -73
- package/dist/devices-cli-B_M2eMJ1.js +0 -496
- package/dist/diagnostic-Ca7xQ_sl.js +0 -400
- package/dist/diagnostic-support-export-uKXdbhuH.js +0 -533
- package/dist/diagnostics-waSemGnZ.js +0 -154
- package/dist/direct-dm-CiSjkmkL.js +0 -64
- package/dist/directive-handling.fast-lane-BXAeEY49.js +0 -66
- package/dist/directive-handling.impl-Bz01SejL.js +0 -703
- package/dist/directive-handling.impl-CiFN7Cu1.js +0 -2
- package/dist/directive-handling.model-selection-DZzMOtyl.js +0 -114
- package/dist/directive-handling.persist.runtime-BzIB50Uy.js +0 -215
- package/dist/directory-cli-17h5XIsS.js +0 -240
- package/dist/dispatch-BnQSIx2G.js +0 -1131
- package/dist/dispatch-acp-CaNQyl2L.js +0 -981
- package/dist/dispatch-acp-manager.runtime-DJK1eHYX.js +0 -3
- package/dist/dispatch-acp-media.runtime-FDZi3hhw.js +0 -4
- package/dist/dispatch-acp-session.runtime-tA9m4L7t.js +0 -2
- package/dist/dispatch-acp.runtime-Bl5cvtX4.js +0 -19
- package/dist/dns-cli-QNL0F2Ri.js +0 -192
- package/dist/doctor-auth-BzeKJols.js +0 -172
- package/dist/doctor-auth-legacy-oauth-aZ9YjnlK.js +0 -2
- package/dist/doctor-auth-legacy-oauth-zNlHTB4O.js +0 -48
- package/dist/doctor-claude-cli-CxK8Pfom.js +0 -147
- package/dist/doctor-config-analysis-CT6ojUa2.js +0 -94
- package/dist/doctor-config-flow-DUCx5yjH.js +0 -417
- package/dist/doctor-config-preflight-C-cFOcPn.js +0 -63
- package/dist/doctor-config-preflight-Fm2wkSwd.js +0 -2
- package/dist/doctor-contract-DxFV42-h.js +0 -26
- package/dist/doctor-device-pairing-DBhEA-8G.js +0 -307
- package/dist/doctor-gateway-daemon-flow-Ds47Er3Y.js +0 -250
- package/dist/doctor-gateway-health-EWwTw5JR.js +0 -60
- package/dist/doctor-gateway-services-Cibvf3nR.js +0 -316
- package/dist/doctor-health-COiArVwj.js +0 -59
- package/dist/doctor-health-contributions-D58LIVdN.js +0 -486
- package/dist/doctor-memory-search-C-GTYsnB.js +0 -371
- package/dist/doctor-sandbox-D0hdfdpJ.js +0 -194
- package/dist/doctor-session-locks-CvM6ubaI.js +0 -56
- package/dist/doctor-state-integrity-CxrVC_nh.js +0 -589
- package/dist/doctor-state-migrations-DWChkFtX.js +0 -2
- package/dist/doctor-update-leN3aPnU.js +0 -58
- package/dist/doctor-workspace-status-CiEWZXrx.js +0 -75
- package/dist/dreaming-DFPenC85.js +0 -1574
- package/dist/dreaming-narrative-6A27_Gft.js +0 -595
- package/dist/dreaming-shared-BDD2oWhL.js +0 -21
- package/dist/embedded-gateway-stub.runtime-UVgfXZzk.js +0 -9
- package/dist/embedding-batch-7hvzwHHl.js +0 -191
- package/dist/embedding-batch-WKVjg_Bk.js +0 -161
- package/dist/embedding-provider-BJee-X_b.js +0 -64
- package/dist/embedding-provider-CTEUDSG2.js +0 -38
- package/dist/embedding-provider-CiLu78QS.js +0 -118
- package/dist/embedding-provider-ixUayU0N.js +0 -33
- package/dist/embeddings-http-C0fpcL_-.js +0 -205
- package/dist/embeddings-qvqBLfrg.js +0 -215
- package/dist/engine-embeddings-9_Ztlm7g.js +0 -458
- package/dist/engine-qmd-CceSLwoI.js +0 -551
- package/dist/exa-web-search-provider-BEY5IeZV.js +0 -80
- package/dist/exa-web-search-provider.runtime-BP0Bqh27.js +0 -302
- package/dist/exa-web-search-provider.runtime-CE2dSkq8.js +0 -2
- package/dist/exec-approval-forwarder.runtime-oBiamxIz.js +0 -3
- package/dist/exec-approval-reply-DEujRvhz.js +0 -2
- package/dist/exec-approval-reply-DJBZZafd.js +0 -296
- package/dist/exec-approval-session-target-C08JaU9I.js +0 -176
- package/dist/exec-approvals-cli-BIz6EjFc.js +0 -498
- package/dist/exec-policy-cli-CPwfn4OX.js +0 -298
- package/dist/extra-params--o3Bs_ba.js +0 -388
- package/dist/fallbacks-DX4YcmAx.js +0 -2
- package/dist/fallbacks-inTaaG-m.js +0 -31
- package/dist/fallbacks-shared-ow1la-U2.js +0 -111
- package/dist/format-CDtdyx29.js +0 -245
- package/dist/format-CNZYdk0T.js +0 -176
- package/dist/gateway-D4iWwu3_.js +0 -115
- package/dist/gateway-cli-8Nrhyv3_.js +0 -1325
- package/dist/gateway-install-token-Cvm6VMoq.js +0 -119
- package/dist/gateway-rpc-DnaZL20f.js +0 -14
- package/dist/gateway-rpc.runtime-CkhcOPe0.js +0 -23
- package/dist/gateway-status-B6eKLX3H.js +0 -584
- package/dist/genesis-tools-CvMcpUvH.js +0 -8999
- package/dist/genesis-tools.runtime-Ch3NDEDq.js +0 -2
- package/dist/get-reply-Cm39MCyU.js +0 -3879
- package/dist/get-reply-from-config.runtime-CSqCYatb.js +0 -2
- package/dist/gmail-setup-utils-D2pDgLCA.js +0 -430
- package/dist/gmail-watcher-lifecycle-BZgPito0.js +0 -2
- package/dist/gmail-watcher-lifecycle-dFjMERa7.js +0 -191
- package/dist/graph-users-BJxYqA3A.js +0 -1337
- package/dist/guarded-json-api-BhJR7l-7.js +0 -594
- package/dist/health-C14jIilQ.js +0 -469
- package/dist/health-C6yJSCMc.js +0 -3
- package/dist/heartbeat-runner-C6-gFnyC.js +0 -5
- package/dist/heartbeat-runner-yUYjgzIM.js +0 -1292
- package/dist/heartbeat-runner.runtime-DZzyrUNB.js +0 -4
- package/dist/help-DyqSh8kc.js +0 -81
- package/dist/hooks-cli-JdkXCE5M.js +0 -433
- package/dist/http-endpoint-helpers-TtZT-T3I.js +0 -41
- package/dist/http-headers-BRWJRzAN.js +0 -11
- package/dist/http-utils-C2hu7rtC.js +0 -924
- package/dist/identity-BQK1BAp-.js +0 -140
- package/dist/image-CQJOF-Zg.js +0 -272
- package/dist/image-fallbacks-BH9qLbBG.js +0 -31
- package/dist/image-fallbacks-DUOPO1ic.js +0 -2
- package/dist/image-generation-core-Dk3jOqwq.js +0 -18
- package/dist/image-generation-core.auth.runtime-BkPCNk6g.js +0 -2
- package/dist/image-generation-provider-B2Sotuek.js +0 -157
- package/dist/image-generation-provider-BjItC1ZB.js +0 -137
- package/dist/image-generation-provider-CAuX-Q7r.js +0 -63
- package/dist/image-generation-provider-CNnNFca5.js +0 -274
- package/dist/image-generation-provider-CW39t66x.js +0 -95
- package/dist/image-generation-provider-Cr8PAjS0.js +0 -529
- package/dist/image-generation-provider-fPdPfoPR.js +0 -228
- package/dist/image-generation-runtime-BjkgbLs7.js +0 -2
- package/dist/image-runtime-ZHzWcqxM.js +0 -9
- package/dist/inbound-reply-dispatch-DPf_IrbV.js +0 -73
- package/dist/inbound.runtime-DVqg8xZi.js +0 -4
- package/dist/inbound.runtime-DWu8LMdN.js +0 -3
- package/dist/infra-runtime-CLND6LJ0.js +0 -39
- package/dist/init-CzWob-9v.js +0 -59
- package/dist/install-BZaQGsDZ.js +0 -159
- package/dist/install-signal-cli-CE1vqFDm.js +0 -202
- package/dist/install.runtime-DOhM77gf.js +0 -2
- package/dist/io-h8M_Z0Lj.js +0 -19290
- package/dist/io-z2jIOtLk.js +0 -5
- package/dist/jobs-CNJYQgEn.js +0 -734
- package/dist/kimi-web-search-provider-B2uRzMJ7.js +0 -80
- package/dist/kimi-web-search-provider.runtime-2xk5W9Cs.js +0 -2
- package/dist/kimi-web-search-provider.runtime-RTe_38UX.js +0 -261
- package/dist/legacy-tools-by-sender-B04NdZPf.js +0 -95
- package/dist/legacy-tools-by-sender-CHP1JLBt.js +0 -2
- package/dist/library-C0a9Bz2M.js +0 -45
- package/dist/lifecycle-B_B_jt3r.js +0 -571
- package/dist/lifecycle-DuqKKZop.js +0 -229
- package/dist/lifecycle-core-BpdZi2zv.js +0 -422
- package/dist/lifecycle.runtime-CgDdABk8.js +0 -2
- package/dist/list-Bly8XeOF.js +0 -2
- package/dist/list-CHIiamt1.js +0 -131
- package/dist/list-u1v9z9iN.js +0 -1201
- package/dist/list-w7tUjpdY.js +0 -2
- package/dist/list.probe-kmHRFlrP.js +0 -419
- package/dist/list.runtime-CjSnff-c.js +0 -159
- package/dist/list.runtime-D1dElDsx.js +0 -11
- package/dist/live-model-switch-Dd-0E2l_.js +0 -336
- package/dist/llm-slug-generator-C3u6Ptgq.js +0 -79
- package/dist/load-config-CXvIGI7N.js +0 -35
- package/dist/load-context-avthPPkW.js +0 -56
- package/dist/local-dispatch.runtime-BUoo02tX.js +0 -8
- package/dist/logging-D5LEBy37.js +0 -13
- package/dist/logging-bfkJL7yT.js +0 -2
- package/dist/login-BKS5WGkP.js +0 -108
- package/dist/logs-cli-DBYJ2Aq-.js +0 -265
- package/dist/logs-cli.runtime-DQJPG_eL.js +0 -2
- package/dist/main-session-restart-recovery-CzfY6Cd8.js +0 -206
- package/dist/managed-image-attachments-BGPKA7Mn.js +0 -2
- package/dist/managed-image-attachments-CTrq9ym-.js +0 -635
- package/dist/manager-BYhRnRfB.js +0 -3114
- package/dist/manager-C_ZGa9x8.js +0 -2057
- package/dist/manager-DIHLRzYF.js +0 -2
- package/dist/markdown-to-line-CRbbXtJK.js +0 -790
- package/dist/mcp-cli-m4DjBDez.js +0 -725
- package/dist/mcp-config-CczNZytL.js +0 -115
- package/dist/mcp-http-b6UMoE_J.js +0 -529
- package/dist/media-contract-BgaJThuI.js +0 -49
- package/dist/media-contract-api-DzHEkFJ4.js +0 -2
- package/dist/media-runtime-B1GzwmDa.js +0 -329
- package/dist/media-understanding-XlANOKVy.js +0 -85
- package/dist/media-understanding-provider-BMR6G9bs.js +0 -13
- package/dist/media-understanding-provider-BeOpYnTw.js +0 -28
- package/dist/media-understanding-provider-BxHOSDHK.js +0 -18
- package/dist/media-understanding-provider-D1uimEOF.js +0 -37
- package/dist/media-understanding-provider-D2bhV5kG.js +0 -69
- package/dist/media-understanding-provider-Df4f_jEZ.js +0 -18
- package/dist/media-understanding-provider-DjTpl-f8.js +0 -85
- package/dist/media-understanding-provider-DmAZ22X7.js +0 -21
- package/dist/media-understanding-provider-DyfMlzNa.js +0 -12
- package/dist/media-understanding-provider-qrkRrB9V.js +0 -12
- package/dist/media-understanding-runtime-BHRvMVOL.js +0 -2
- package/dist/memory-CIDuBmaR.js +0 -342
- package/dist/memory-core-host-engine-embeddings-M-Gp1i52.js +0 -2
- package/dist/memory-core-host-engine-foundation-DasxnV_N.js +0 -11
- package/dist/memory-core-host-engine-qmd-Bf8cHYXG.js +0 -2
- package/dist/memory-core-host-runtime-cli-CquxELNj.js +0 -9
- package/dist/memory-core-host-runtime-core-CmuFU_k8.js +0 -8
- package/dist/memory-embedding-adapter-BMd68BpZ.js +0 -55
- package/dist/memory-embedding-adapter-CFbi6QHC.js +0 -50
- package/dist/memory-embedding-adapter-DEciIC1g.js +0 -123
- package/dist/memory-embedding-adapter-DnzOdoj-.js +0 -32
- package/dist/memory-host-core-CepAYJOC.js +0 -2
- package/dist/memory-host-search-ef4xiGhZ.js +0 -12
- package/dist/memory-host-search.runtime-DFl3cUHn.js +0 -2
- package/dist/memory-runtime-Bwq0Ofx-.js +0 -2
- package/dist/memory-runtime-Cj0UGN2J.js +0 -26
- package/dist/message-CmjuvIFf.js +0 -232
- package/dist/message-action-runner-CiY3rhqt.js +0 -1407
- package/dist/message-action-runner-Do4P0h5i.js +0 -2
- package/dist/message-actions-BYREqFJA.js +0 -143
- package/dist/message.config.runtime-8kkpPgDw.js +0 -2
- package/dist/message.gateway.runtime-gkoWzaYV.js +0 -2
- package/dist/metadata-registry-loader-DAu2cSL5.js +0 -16
- package/dist/metadata-registry-loader-GRi5Rm2Z.js +0 -2
- package/dist/minimax-vlm-DkZ09FrD.js +0 -233
- package/dist/minimax-web-search-provider--mirSuQz.js +0 -53
- package/dist/minimax-web-search-provider.runtime-BCJPoUln.js +0 -140
- package/dist/minimax-web-search-provider.runtime-Bg9lBTAr.js +0 -2
- package/dist/mock-BBELHoyy.js +0 -136
- package/dist/model-BEm0xMnp.js +0 -666
- package/dist/model-DDJPPR3F.js +0 -3
- package/dist/model-auth-C1Z9RsQ5.js +0 -456
- package/dist/model-auth-env-Dz5Pixvx.js +0 -68
- package/dist/model-auth-label-BAtXJxa0.js +0 -46
- package/dist/model-catalog-C3Ib1fYR.js +0 -2
- package/dist/model-catalog-DXtA4U6p.js +0 -159
- package/dist/model-definitions-B8q-8mef.js +0 -260
- package/dist/model-fallback-BSj7JGyo.js +0 -827
- package/dist/model-fallback-auth.runtime-Bb5Zkx_r.js +0 -4
- package/dist/model-picker-BTHkN0l4.js +0 -554
- package/dist/model-picker-C3HMFJxK.js +0 -3
- package/dist/model-picker-visibility-BL8rbGSy.js +0 -13
- package/dist/model-picker.runtime-DX0Lf0PG.js +0 -15
- package/dist/model-selection-Cc1fswUI.js +0 -213
- package/dist/model-suppression-DvaJBPSc.js +0 -28
- package/dist/model-suppression.runtime-JuLFgwjM.js +0 -7
- package/dist/models-BJgjZ5vN.js +0 -18
- package/dist/models-BS1WkKuU.js +0 -569
- package/dist/models-Bdl84ZEi.js +0 -760
- package/dist/models-DAWoIDFQ.js +0 -18
- package/dist/models-auth-status-B_Pcr0tl.js +0 -201
- package/dist/models-cli-C7_XNkjs.js +0 -219
- package/dist/models-config-CeSA-IsM.js +0 -2
- package/dist/models-config-DzJzRLUs.js +0 -933
- package/dist/models-config.providers.secrets-DACp_2kp.js +0 -304
- package/dist/models-ezJkixUd.js +0 -47
- package/dist/models-http-CtMnZc8I.js +0 -92
- package/dist/models-iki4v2pw.js +0 -157
- package/dist/models.fetch-DeidpNMb.js +0 -518
- package/dist/monitor-22LY8y6z.js +0 -788
- package/dist/monitor-BZdf_CEm.js +0 -1237
- package/dist/monitor-CTVDlTs2.js +0 -671
- package/dist/monitor-Cfv-KGAl.js +0 -1661
- package/dist/monitor-D_5ywEdZ.js +0 -295
- package/dist/monitor-DuA69-8E.js +0 -2
- package/dist/monitor-auth-BNDlfcw7.js +0 -207
- package/dist/monitor-cmWeDVxf.js +0 -1459
- package/dist/monitor-processing-D9Xcsagt.js +0 -1974
- package/dist/monitor.runtime-zWvcbNim.js +0 -2
- package/dist/monitor.webhook-BYWQa5lY.js +0 -180
- package/dist/msteams-n9HDT4O-.js +0 -35
- package/dist/music-generation-provider-BOf8FxsI.js +0 -170
- package/dist/music-generation-provider-DXjWrzeQ.js +0 -63
- package/dist/mutate-DCm-o6et.js +0 -116
- package/dist/native-hook-relay-CKyIfLOm.js +0 -519
- package/dist/native-web-search-CVg_cqdB.js +0 -64
- package/dist/nextcloud-talk-BuJVVP0J.js +0 -17
- package/dist/node-cli-BaWSEysu.js +0 -2506
- package/dist/nodes-cli-DZht7scn.js +0 -1046
- package/dist/nodes-utils-C6IKaTjm.js +0 -84
- package/dist/notify-v0zoiI-O.js +0 -315
- package/dist/oauth-B8tWMfTJ.js +0 -139
- package/dist/oauth-BmcwdgQf.js +0 -75
- package/dist/oauth-DDT-kHNB.js +0 -152
- package/dist/oauth-Gan0lup1.js +0 -2
- package/dist/oauth.flow-CNEwf0O5.js +0 -45
- package/dist/oauth.flow-CUZgJHCQ.js +0 -3
- package/dist/onboard-BN0A1x-N.js +0 -632
- package/dist/onboard-BxGE5zlS.js +0 -29
- package/dist/onboard-C4pAjamt.js +0 -49
- package/dist/onboard-Cu0Zb0tI.js +0 -25
- package/dist/onboard-DSrD9d76.js +0 -58
- package/dist/onboard-custom-D7-Whw_0.js +0 -271
- package/dist/onboard-custom-Skp24tPF.js +0 -3
- package/dist/onboard-g0Gns-rv.js +0 -25
- package/dist/onboard-search-XCG-N-tW.js +0 -323
- package/dist/onboard-uHe_WHnV.js +0 -25
- package/dist/onboard-vfG-wMNV.js +0 -316
- package/dist/openai-codex-auth-identity-BP8ajX50.js +0 -45
- package/dist/openai-codex-device-code-Cr2cbEdd.js +0 -164
- package/dist/openai-codex-provider-BehtHuQr.js +0 -464
- package/dist/openai-codex-shared-HFAofBwf.js +0 -6
- package/dist/openai-http-DwCqhEcX.js +0 -500
- package/dist/openai-provider-DsET7IpX.js +0 -313
- package/dist/opencode-Cb-WQKky.js +0 -35
- package/dist/openresponses-http-tJr67vC1.js +0 -1128
- package/dist/order-dgHk1PE1.js +0 -109
- package/dist/outbound-media-FIxE0Dv0.js +0 -57
- package/dist/outbound-runtime-UoL4JsL6.js +0 -5
- package/dist/outbound.runtime-nXA4k1xA.js +0 -2
- package/dist/pair-command-approve-G5y-rKn9.js +0 -44
- package/dist/pairing-cli-Cj31Dv4N.js +0 -117
- package/dist/perplexity-web-search-provider-B6x_ImjZ.js +0 -92
- package/dist/perplexity-web-search-provider.runtime-CXeIZv1r.js +0 -2
- package/dist/perplexity-web-search-provider.runtime-DnjYQskA.js +0 -324
- package/dist/persistent-bindings.lifecycle-C56aKBVc.js +0 -2
- package/dist/persistent-bindings.lifecycle-CfBqvz9L.js +0 -85
- package/dist/pi-bundle-mcp-runtime--MTfBo4Z.js +0 -829
- package/dist/pi-bundle-mcp-runtime-ean1aFxj.js +0 -2
- package/dist/pi-bundle-mcp-tools-BqjE32FZ.js +0 -108
- package/dist/pi-embedded-B1wvxHXL.js +0 -2905
- package/dist/pi-embedded-DmDb-oUB.js +0 -4
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-BoDN2GHw.js +0 -23
- package/dist/pi-embedded.runtime-D5xqw9Ko.js +0 -4
- package/dist/pi-model-discovery-CYZ5LuGU.js +0 -237
- package/dist/pi-tool-definition-adapter-CAxlo-Va.js +0 -217
- package/dist/pi-tools-C69yvznf.js +0 -1057
- package/dist/pi-tools.before-tool-call-BDeCmoAy.js +0 -2
- package/dist/pi-tools.before-tool-call-DG7VVNBn.js +0 -433
- package/dist/pi-tools.before-tool-call.runtime-GbZhbLH3.js +0 -13
- package/dist/plivo-DFM_olZN.js +0 -394
- package/dist/plugin-B9Ld0CUs.js +0 -12195
- package/dist/plugin-enabled-Cxce83s1.js +0 -140
- package/dist/plugin-install-config-policy-BimGg0f2.js +0 -137
- package/dist/plugin-registration-BxJi2XYk.js +0 -23
- package/dist/plugin-registry-D66gpl7-.js +0 -2
- package/dist/plugin-registry-dEPS2Zb9.js +0 -3
- package/dist/plugin-service-Cu0uMqDN.js +0 -2890
- package/dist/plugins-cli-UICpKNEZ.js +0 -584
- package/dist/plugins-command-helpers-ny7AVRZJ.js +0 -107
- package/dist/plugins-install-persist-CSPRiteo.js +0 -133
- package/dist/plugins-update-command-4Jece913.js +0 -1057
- package/dist/policy-DgfegT_Y.js +0 -328
- package/dist/prepare.runtime-C_sRmuFC.js +0 -815
- package/dist/preview-warnings-BSovEOvs.js +0 -120
- package/dist/probe-8vb_Ssot.js +0 -45
- package/dist/probe-B6zM3cMF.js +0 -74
- package/dist/probe-BjmKFiz1.js +0 -2205
- package/dist/probe-CbOoVumf.js +0 -2
- package/dist/probe-D6yFcZpK.js +0 -1443
- package/dist/probe-DtHuNHbp.js +0 -243
- package/dist/probe-XYiCUrVW.js +0 -32
- package/dist/probe.runtime-oasa8nRY.js +0 -2
- package/dist/profiles-t-GpZimP.js +0 -111
- package/dist/program-B7jIObA6.js +0 -111
- package/dist/prompt-select-styled-DvkSxDCm.js +0 -20
- package/dist/provider-DuH_nkk-.js +0 -70
- package/dist/provider-api-key-auth-BCbqFek0.js +0 -114
- package/dist/provider-api-key-auth.runtime-C0dB6QR5.js +0 -14
- package/dist/provider-auth-DlJTw0-4.js +0 -46
- package/dist/provider-auth-api-key-kFD2TSQI.js +0 -5
- package/dist/provider-auth-choice-7C46Z7_L.js +0 -228
- package/dist/provider-auth-choice-preference-g0W-1lIY.js +0 -26
- package/dist/provider-auth-choice.runtime-BMstkDeF.js +0 -14
- package/dist/provider-auth-choice.runtime-DBaJlbBQ.js +0 -2
- package/dist/provider-auth-guidance-CLhKt9_y.js +0 -2
- package/dist/provider-auth-guidance-DMjnCkYr.js +0 -34
- package/dist/provider-auth-helpers-g5J1YN29.js +0 -173
- package/dist/provider-auth-input-Cmt5ISWx.js +0 -119
- package/dist/provider-auth-runtime-C_of8BP-.js +0 -149
- package/dist/provider-catalog-Bva0AQ20.js +0 -24
- package/dist/provider-catalog-CDF5UffZ.js +0 -12
- package/dist/provider-catalog-CIZ7lwcD.js +0 -11
- package/dist/provider-catalog-WRqmEzqK.js +0 -26
- package/dist/provider-catalog-lrSBHdfM.js +0 -11
- package/dist/provider-compat-ia849gPL.js +0 -37
- package/dist/provider-discovery.runtime-CKPRNOu9.js +0 -118
- package/dist/provider-dispatcher-BIOPYzb9.js +0 -2
- package/dist/provider-dispatcher-CpwviX0O.js +0 -22
- package/dist/provider-entry-BZGcYiV-.js +0 -106
- package/dist/provider-flow-DNqq-LGA.js +0 -147
- package/dist/provider-model-defaults-M93SupwY.js +0 -6
- package/dist/provider-models-BvjP15o5.js +0 -35
- package/dist/provider-models-DzsmORvl.js +0 -119
- package/dist/provider-registration-BL1hjJNQ.js +0 -218
- package/dist/provider-registration-CKaw8a6k.js +0 -37
- package/dist/provider-runtime-C4mK2ZHM.js +0 -472
- package/dist/provider-runtime-C9Y0fX9M.js +0 -2
- package/dist/provider-runtime.runtime-C1zVPJ_2.js +0 -26
- package/dist/provider-self-hosted-setup-B_01kPQV.js +0 -251
- package/dist/provider-setup-BTm4FuW0.js +0 -2
- package/dist/provider-stream-BZwCdDk2.js +0 -290
- package/dist/provider-stream-D80mDtUQ.js +0 -2174
- package/dist/provider-stream-family-tKIQwQoP.js +0 -2
- package/dist/provider-usage-DZHssxuZ.js +0 -4
- package/dist/provider-usage-DtCUHOBT.js +0 -71
- package/dist/provider-usage.load-DfxOyIjr.js +0 -334
- package/dist/provider-utils-CDXJKXaV.js +0 -49
- package/dist/provider-wizard-FaPEKwkS.js +0 -166
- package/dist/providers.runtime-CNRwqmqP.js +0 -164
- package/dist/providers.runtime-D5WUUxG6.js +0 -2
- package/dist/proxy-stream-wrappers-Bne4sxnC.js +0 -394
- package/dist/prune-CObb_7Tm.js +0 -83
- package/dist/pw-ai-BXxjh18R.js +0 -2511
- package/dist/pw-role-snapshot-Bl3hTc-h.js +0 -380
- package/dist/qmd-manager-BUsmbNH2.js +0 -1921
- package/dist/qr-cli-CJXKCj0L.js +0 -2
- package/dist/qr-cli-kSU9X-N0.js +0 -349
- package/dist/qr-image-BGiWCT9D.js +0 -2
- package/dist/queue-C2h8xD0q.js +0 -409
- package/dist/reaction-runtime-api-3XFmruJA.js +0 -116
- package/dist/reactions-By-nqZC6.js +0 -998
- package/dist/read-best-effort-config.runtime-D8wqGyi-.js +0 -2
- package/dist/read-capability-iNDCfA71.js +0 -412
- package/dist/realtime-provider-shared-BUH18A9i.js +0 -37
- package/dist/realtime-transcription-provider-C8U5iIPd.js +0 -184
- package/dist/realtime-transcription-provider-Ct_urZH7.js +0 -172
- package/dist/realtime-transcription-provider-DWWihiYW.js +0 -184
- package/dist/realtime-transcription-provider-DixI6prO.js +0 -120
- package/dist/realtime-transcription-provider-LPnmN5fC.js +0 -183
- package/dist/realtime-voice-provider-CNHR_8Ip.js +0 -489
- package/dist/record-shared-B-W3jnOg.js +0 -10
- package/dist/register-service-commands-C4gdXE5G.js +0 -71
- package/dist/register.agent-CT6bSshW.js +0 -248
- package/dist/register.backup-DZZZkF5L.js +0 -64
- package/dist/register.configure-CImVXV1T.js +0 -15
- package/dist/register.maintenance-D5jC2Wav.js +0 -438
- package/dist/register.message-CT0eXmu4.js +0 -329
- package/dist/register.onboard-BiigO1vS.js +0 -81
- package/dist/register.runtime-CGAA56n8.js +0 -81
- package/dist/register.setup-BG-rXone.js +0 -150
- package/dist/register.status-health-sessions-CYuXd-5V.js +0 -1215
- package/dist/register.subclis-BaJ6m946.js +0 -29
- package/dist/register.subclis-D2lhCIAR.js +0 -3
- package/dist/register.subclis-core-BZs-HQ4k.js +0 -249
- package/dist/register.wallet-IC7GFGSz.js +0 -159
- package/dist/repair-sequencing-DAQWWg1Q.js +0 -145
- package/dist/replay-policy-SzJMVnli.js +0 -8
- package/dist/reply-dispatch-runtime-DjIuN_dr.js +0 -13
- package/dist/reply-media-paths.runtime-BwHwrFo5.js +0 -146
- package/dist/reply-media-paths.runtime-BzHN3Oug.js +0 -2
- package/dist/reply-payload-transform-DZTvoDh6.js +0 -720
- package/dist/reply-runtime-5TFidLR3.js +0 -11
- package/dist/reply.runtime-6d1e0INl.js +0 -2
- package/dist/resolve-CmlJ4Qe6.js +0 -259
- package/dist/response-generator-Bkk91EcQ.js +0 -175
- package/dist/restart-DXckXfpS.js +0 -490
- package/dist/root-help-DsdvAmaO.js +0 -44
- package/dist/route-reply-GewElVG6.js +0 -162
- package/dist/route-reply.runtime-CkHKAVic.js +0 -2
- package/dist/routes-BxtbmAAO.js +0 -2
- package/dist/routes-Dm0_DobO.js +0 -3341
- package/dist/rpc-2YP43H5U.js +0 -61
- package/dist/rpc-context-Cz5ff-4T.js +0 -17
- package/dist/rpc.runtime-CmH330Bk.js +0 -21
- package/dist/run-auth-profile.runtime-BN1_tgCB.js +0 -2
- package/dist/run-context.runtime-DiIMdE17.js +0 -2
- package/dist/run-delivery.runtime-qZIB76oE.js +0 -530
- package/dist/run-embedded.runtime-nHunVmCv.js +0 -4
- package/dist/run-execution-cli.runtime-CMT7La6D.js +0 -4
- package/dist/run-executor.runtime-BG6SDi3f.js +0 -277
- package/dist/run-main-C4yxwXlS.js +0 -516
- package/dist/run-model-catalog.runtime-BeDPla6j.js +0 -2
- package/dist/run-subagent-registry.runtime-D0RcqcJr.js +0 -2
- package/dist/run-wait--kou3jZ7.js +0 -135
- package/dist/runner-CJNyVFAv.js +0 -966
- package/dist/runner.entries-CDDEOL4i.js +0 -604
- package/dist/runs-BeROanhp.js +0 -496
- package/dist/runs-oFHUw3em.js +0 -2
- package/dist/runtime-B99WdxAw.js +0 -262
- package/dist/runtime-BBdZI0T9.js +0 -116
- package/dist/runtime-BMTh1o_4.js +0 -187
- package/dist/runtime-BuDSQWY3.js +0 -187
- package/dist/runtime-BvxkGJm2.js +0 -9
- package/dist/runtime-C7re7-b0.js +0 -2
- package/dist/runtime-CVeRX_h2.js +0 -72
- package/dist/runtime-DgQ5oUKq.js +0 -973
- package/dist/runtime-DhFt71Dh.js +0 -94
- package/dist/runtime-SBCw4GZx.js +0 -2
- package/dist/runtime-UhEn3-g2.js +0 -107
- package/dist/runtime-WH7zKxDh.js +0 -269
- package/dist/runtime-api-6SzMK-FZ.js +0 -4
- package/dist/runtime-api-BAMrcB-5.js +0 -9
- package/dist/runtime-api-DLSrxS5O.js +0 -9
- package/dist/runtime-api-DsPleWQg.js +0 -14
- package/dist/runtime-embedded-pi.runtime-eyjaJfAz.js +0 -2
- package/dist/runtime-entry-NIlaVaCh.js +0 -2769
- package/dist/runtime-internal-BTfGDlHi.js +0 -2
- package/dist/runtime-model-auth.runtime-BmCKx59j.js +0 -45
- package/dist/runtime-model-auth.runtime-CtfEmiHD.js +0 -2
- package/dist/runtime-options-B5_eZxMV.js +0 -275
- package/dist/runtime-prepare.runtime-CYL2KuLu.js +0 -80
- package/dist/runtime-provider-2DNb6s0A.js +0 -21
- package/dist/runtime-registry-loader-DR-J9mYJ.js +0 -2
- package/dist/runtime-registry-loader-oRtkux7P.js +0 -85
- package/dist/runtime-schema--IHLExJA.js +0 -27780
- package/dist/runtime-shared-ClxGZaGO.js +0 -267
- package/dist/runtime-tx7lDmPU.js +0 -475
- package/dist/runtime-web-channel-plugin-DSUY71Zm.js +0 -203
- package/dist/runtime-web-tools-B5m4pFEj.js +0 -1477
- package/dist/runtime-web-tools-fallback.runtime-CuzXsYDs.js +0 -9
- package/dist/sandbox-Bjg0J6uZ.js +0 -1156
- package/dist/sandbox-DyLgT2hb.js +0 -3
- package/dist/sandbox-cli-BLLA3tnd.js +0 -450
- package/dist/scan-D0fsxqed.js +0 -2
- package/dist/scan-DrjjN66Z.js +0 -523
- package/dist/secrets-cli-xKEQ4JhR.js +0 -2101
- package/dist/security-cli-B2rQ7-9U.js +0 -486
- package/dist/selection-DEAdLh1Q.js +0 -2
- package/dist/selection-zPPyzfBX.js +0 -7736
- package/dist/semver-compare-4WdZjB8E.js +0 -53
- package/dist/send-Buu-OT-I.js +0 -534
- package/dist/send-CYKfZTCJ.js +0 -156
- package/dist/send-Di1tRwJD.js +0 -102
- package/dist/send.runtime-Bw22DBkL.js +0 -2
- package/dist/server-CkhWy2iz.js +0 -77
- package/dist/server-DPbF4NLN.js +0 -13
- package/dist/server-context-C3fozX-C.js +0 -2
- package/dist/server-context-R_Yx4X7V.js +0 -847
- package/dist/server-middleware-K0bO4D5s.js +0 -120
- package/dist/server-node-events-CdZP3Kok.js +0 -481
- package/dist/server-plugin-bootstrap-C1Su6th-.js +0 -2
- package/dist/server-plugin-bootstrap-DV23MPGu.js +0 -11333
- package/dist/server-restart-sentinel-BWiOzljY.js +0 -697
- package/dist/server-startup-memory-DcY7vInd.js +0 -32
- package/dist/server.impl-DVM9pR9C.js +0 -12735
- package/dist/service-2moXf4Z3.js +0 -940
- package/dist/session-DgdrHsUH.js +0 -48
- package/dist/session-cost-usage-v7CmY-jl.js +0 -651
- package/dist/session-envelope-DdJGLsph.js +0 -18
- package/dist/session-key-CGM2lMjF.js +0 -65
- package/dist/session-kill-http-B_J1fJ4-.js +0 -110
- package/dist/session-meta-DNYXwb8Y.js +0 -109
- package/dist/session-override-CvWOXFPt.js +0 -106
- package/dist/session-reset-model.runtime-CSgYVD3U.js +0 -133
- package/dist/session-reset-service-DPgw70iw.js +0 -471
- package/dist/session-route-B0h6MEyB.js +0 -93
- package/dist/session-status.runtime-DCvgI1pG.js +0 -2
- package/dist/session-store-2T8PZlcn.js +0 -126
- package/dist/session-store.runtime-BvnkL0Mw.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BgsCnI-h.js +0 -2
- package/dist/session-system-events-Yvfgcmpd.js +0 -63
- package/dist/session-tab-registry-BoZsI5I6.js +0 -491
- package/dist/session-transcript-hit-CJ5Jj7sA.js +0 -41
- package/dist/session-updates-CUUxKrNv.js +0 -236
- package/dist/session-updates.runtime-Dl3SAkoT.js +0 -2
- package/dist/session-utils-BrGPE9ed.js +0 -926
- package/dist/session-visibility-CZjMA1SL.js +0 -147
- package/dist/sessions-BsnttWP_.js +0 -48
- package/dist/sessions-CZok7kda.js +0 -281
- package/dist/sessions-DnGJeOcI.js +0 -2
- package/dist/sessions-GSCHVTz5.js +0 -16
- package/dist/sessions-helpers-B3W7MdIb.js +0 -304
- package/dist/sessions-history-http-Bw5J6HQ-.js +0 -383
- package/dist/sessions-resolve-C-VZh_56.js +0 -174
- package/dist/sessions.runtime-cLuc67tJ.js +0 -2
- package/dist/set-5DGVoB6Q.js +0 -2
- package/dist/set-COJp56WQ.js +0 -17
- package/dist/set-image-CLKXLt5l.js +0 -2
- package/dist/set-image-Wy-bkC3Q.js +0 -17
- package/dist/setup-BG2J2HR-.js +0 -495
- package/dist/setup-CEO-WwxS.js +0 -421
- package/dist/setup-api-Culp0Usf.js +0 -29
- package/dist/setup-core-CaTBS6Tz.js +0 -171
- package/dist/setup-core-Dhwqz5ni.js +0 -184
- package/dist/setup-core-Zijy2DMv.js +0 -393
- package/dist/setup-core-youmXvW_.js +0 -176
- package/dist/setup-surface-BBqs2Jo2.js +0 -351
- package/dist/setup-surface-BKIPq1vY.js +0 -72
- package/dist/setup-surface-BeMn-9hU.js +0 -403
- package/dist/setup-surface-CUd-s0wh.js +0 -286
- package/dist/setup-surface-Czri_ht7.js +0 -3
- package/dist/setup-surface-DtscjAY3.js +0 -219
- package/dist/setup.finalize-BSCjEqxV.js +0 -539
- package/dist/shared-B3Pz1Xcr.js +0 -121
- package/dist/shared-Bc3x3THS.js +0 -76
- package/dist/shared-C2qh8ugk.js +0 -217
- package/dist/shared-CciCGYbs.js +0 -135
- package/dist/shared-CsIxMVr_.js +0 -186
- package/dist/shared-CxbLx0Ww.js +0 -198
- package/dist/shared-DicCIRvK.js +0 -60
- package/dist/shared-runtime-6_MnYe7Q.js +0 -7
- package/dist/short-term-promotion-BIzj922a.js +0 -1543
- package/dist/simple-completion-runtime-CGhlf0hZ.js +0 -158
- package/dist/simple-completion-transport-DewSxAwJ.js +0 -33
- package/dist/skills-clawhub-Dlv_j_Jg.js +0 -275
- package/dist/skills-cli-D0EdapwV.js +0 -370
- package/dist/slash-state-XfeMEeuI.js +0 -1911
- package/dist/speech-core-DvaF8h0I.js +0 -94
- package/dist/speech-provider-BQ98DhrM.js +0 -184
- package/dist/speech-provider-BrwlxrtZ.js +0 -395
- package/dist/speech-provider-CQLk4cH9.js +0 -170
- package/dist/speech-provider-CUinmhV6.js +0 -103
- package/dist/speech-provider-Cu9Q9-q6.js +0 -216
- package/dist/speech-provider-Dr8g2Zbc.js +0 -209
- package/dist/speech-provider-xHvRvcVe.js +0 -209
- package/dist/src-BiDxQvtV.js +0 -3974
- package/dist/stage-sandbox-media.runtime-UP-7985c.js +0 -232
- package/dist/startup-auth-DVAg6R78.js +0 -180
- package/dist/startup-context-CXQi-7YB.js +0 -312
- package/dist/state-migrations-Aoorw4v_.js +0 -820
- package/dist/status--hkh9cCZ.js +0 -209
- package/dist/status-B880ja1s.js +0 -3
- package/dist/status-BwSnS_wh.js +0 -397
- package/dist/status-Cra01dC_.js +0 -62
- package/dist/status-CuYSeMym.js +0 -2
- package/dist/status-DY0DlWlw.js +0 -190
- package/dist/status-DuZdkulz.js +0 -323
- package/dist/status-MT62_Jgw.js +0 -2
- package/dist/status-all-Dr3a4BAf.js +0 -498
- package/dist/status-json-CXeZPfDL.js +0 -14
- package/dist/status-json-command-JBCAP3wk.js +0 -84
- package/dist/status-message-D8KTfWqp.js +0 -466
- package/dist/status-message.runtime-i6HSwq0C.js +0 -6
- package/dist/status-queue.runtime-Dpqj1jlp.js +0 -2
- package/dist/status-runtime-shared-BeB5Gpc6.js +0 -257
- package/dist/status-subagents.runtime-B4UXD0lL.js +0 -18
- package/dist/status-text-myqmk4OL.js +0 -237
- package/dist/status.command.text-runtime-DxXvRSSp.js +0 -15
- package/dist/status.gateway-connection.runtime-B0Iwl2iZ.js +0 -2
- package/dist/status.gather-CRbfrtwi.js +0 -292
- package/dist/status.gather-DgGJqGIO.js +0 -2
- package/dist/status.runtime-B1fTpY0S.js +0 -2
- package/dist/status.runtime-Cbw0CFuM.js +0 -2
- package/dist/status.scan-C1aqDsy2.js +0 -65
- package/dist/status.scan-overview-BerlJz2l.js +0 -379
- package/dist/status.scan.deps.runtime-vyKPba81.js +0 -18
- package/dist/status.scan.fast-json-BXY82vu2.js +0 -2
- package/dist/status.scan.fast-json-DJqgEbzZ.js +0 -132
- package/dist/status.scan.runtime-nuf4UXm_.js +0 -409
- package/dist/status.summary-CCdLUph8.js +0 -214
- package/dist/status.summary-CHAn0_FS.js +0 -2
- package/dist/status.update-Brj2S4WO.js +0 -2
- package/dist/status.update-wHbH0vtL.js +0 -79
- package/dist/store-DPPUFKL4.js +0 -1235
- package/dist/store-DVf_1KBR.js +0 -4
- package/dist/store-DsNJP7a2.js +0 -910
- package/dist/store-load-DevCJoMp.js +0 -370
- package/dist/store.runtime-DXcFo-7e.js +0 -2
- package/dist/stream-CpdM0BB4.js +0 -27
- package/dist/stream-QnfgL1uu.js +0 -664
- package/dist/stream-Yw9oI1N9.js +0 -134
- package/dist/stt-BKJ7-W_H.js +0 -66
- package/dist/subagent-announce-D4jG75Ub.js +0 -351
- package/dist/subagent-announce-delivery-BkQYzDcy.js +0 -726
- package/dist/subagent-announce-output-C3pkuu-t.js +0 -364
- package/dist/subagent-capabilities-Dr9kqRXv.js +0 -251
- package/dist/subagent-control-DVVK8du2.js +0 -506
- package/dist/subagent-control.runtime-D20i92a8.js +0 -3
- package/dist/subagent-followup.runtime-CdeweG-S.js +0 -68
- package/dist/subagent-list-CPGmzGIr.js +0 -172
- package/dist/subagent-orphan-recovery-ZQanOHb4.js +0 -305
- package/dist/subagent-registry-BcPa3ho0.js +0 -3
- package/dist/subagent-registry-hJUso5eL.js +0 -1753
- package/dist/subagent-spawn-DTaeQc9q.js +0 -1005
- package/dist/system-cli-MQUV1Kt2.js +0 -59
- package/dist/target-id-DwGFlj0w.js +0 -107
- package/dist/targets-BPdSjnQH.js +0 -67
- package/dist/task-executor-B62Qzfi-.js +0 -360
- package/dist/task-owner-access-BBMrMOlN.js +0 -74
- package/dist/task-registry-BD-ew2bT.js +0 -2366
- package/dist/task-registry-delivery-runtime-B2WyGY0d.js +0 -3
- package/dist/task-registry-delivery-runtime-MFJszOHI.js +0 -2
- package/dist/task-registry.maintenance-0D2Yxl49.js +0 -416
- package/dist/task-registry.maintenance-OPlfB5W9.js +0 -2
- package/dist/tavily-client-C3xytQRs.js +0 -193
- package/dist/tavily-client-CZGbAgS5.js +0 -2
- package/dist/tavily-search-provider-D6KPby-f.js +0 -62
- package/dist/telnyx-dl-FWSZ7.js +0 -260
- package/dist/testing-DmxZ16UC.js +0 -575
- package/dist/text-report-DbwOAt-s.js +0 -587
- package/dist/text-runtime-7KpTTpVi.js +0 -290
- package/dist/tool-auth-shared-Bv6BKCi8.js +0 -90
- package/dist/tool-config-shared-DzQUOIuD.js +0 -19
- package/dist/tool-policy-pipeline-v9XxD-ex.js +0 -109
- package/dist/tool-resolution-vn72hwMo.js +0 -90
- package/dist/tool-schema-runtime-jV8YdQ9e.js +0 -167
- package/dist/tools-CqCuGTXf.js +0 -113
- package/dist/tools-effective-inventory-DII_pOSr.js +0 -152
- package/dist/tools-invoke-http-DdthGR52.js +0 -206
- package/dist/tools.runtime-B8up1LNG.js +0 -4
- package/dist/transcript-BEG6GDFF.js +0 -312
- package/dist/transcript-resolve.runtime-BiYkACEe.js +0 -2
- package/dist/transcript.runtime-MFREl0oG.js +0 -2
- package/dist/transport-policy-B0VagXph.js +0 -75
- package/dist/trash-Cngl97iU.js +0 -24
- package/dist/tts-Bp81AGLz.js +0 -183
- package/dist/tts-O3Lo0LND.js +0 -64
- package/dist/tui-cli-Bz51WCAi.js +0 -4575
- package/dist/twilio-CFtxsLCP.js +0 -609
- package/dist/update-CgkXd2kv.js +0 -1282
- package/dist/update-check-HnA0I2Da.js +0 -438
- package/dist/update-cli-BYxOEE8h.js +0 -1759
- package/dist/update-runner-Dghmpf13.js +0 -1892
- package/dist/update-startup-BbGRP2fd.js +0 -331
- package/dist/update-startup-CvNOEuOg.js +0 -2
- package/dist/upgrade-Dvj8K4WB.js +0 -1226
- package/dist/usage-format-B8I_58zr.js +0 -2
- package/dist/usage-format-Hc-FyvzW.js +0 -703
- package/dist/usage-q0pe5lMT.js +0 -606
- package/dist/video-generation-core-BlmpVj-F.js +0 -6
- package/dist/video-generation-provider-BTKjUEr6.js +0 -264
- package/dist/video-generation-provider-BsJaGSdY.js +0 -271
- package/dist/video-generation-provider-CRd5mS15.js +0 -187
- package/dist/video-generation-provider-D5Dt3o8N.js +0 -221
- package/dist/video-generation-provider-DAadtfjT2.js +0 -77
- package/dist/video-generation-provider-DEuIYj4Q.js +0 -118
- package/dist/video-generation-provider-I00zAw5a.js +0 -281
- package/dist/video-generation-provider-LsvxSeCH.js +0 -78
- package/dist/video-generation-provider-PjRFUZuF.js +0 -254
- package/dist/video-generation-provider-_lpEJ0sZ.js +0 -287
- package/dist/video-generation-provider-rYLsBGcx.js +0 -64
- package/dist/video-generation-runtime-C0HgCTTM.js +0 -2
- package/dist/video-generation-task-status-CHYB_IeZ.js +0 -163
- package/dist/voice-mapping-CqBur95r.js +0 -41
- package/dist/wait-for-idle-before-flush-DJMxeE2X.js +0 -5986
- package/dist/web-fetch-providers.runtime-DV5-20bl.js +0 -34
- package/dist/web-provider-runtime-shared-GwramnJ6.js +0 -180
- package/dist/web-search-DInuHnh4.js +0 -61
- package/dist/web-search-provider-BshM5HnM.js +0 -163
- package/dist/web-search-provider.runtime-BKjABarO.js +0 -2
- package/dist/web-search-provider.runtime-DcC48-4y.js +0 -185
- package/dist/web-search-providers.runtime-Ct-fiRLn.js +0 -42
- package/dist/webhook-shared-C5lP_giw.js +0 -12
- package/dist/webhooks-cli-VV9ptfcF.js +0 -321
- package/dist/wizard-models-BxP-rnuO.js +0 -161
- package/dist/workflow-runtime-BZbnyBLJ.js +0 -485
- package/dist/x-search-config-B5seJHNk.js +0 -36
- package/dist/x-search-shared-B3VKBF82.js +0 -75
- package/dist/zalo-js-XocMxKUr.js +0 -1157
package/dist/tui-cli-Bz51WCAi.js
DELETED
|
@@ -1,4575 +0,0 @@
|
|
|
1
|
-
import { i as formatErrorMessage } from "./errors-Jbvi20TW.js";
|
|
2
|
-
import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, s as normalizeOptionalLowercaseString } from "./string-coerce-C1IzJjqi.js";
|
|
3
|
-
import { h as loggingState } from "./logger-QwLssHIf.js";
|
|
4
|
-
import { n as defaultRuntime } from "./runtime-CQ7eH0le.js";
|
|
5
|
-
import { i as visibleWidth, r as stripAnsi$1 } from "./ansi-BZHMLcUk.js";
|
|
6
|
-
import { u as setConsoleSubsystemFilter } from "./subsystem-DTMy5YmO.js";
|
|
7
|
-
import { t as formatDocsLink } from "./links-DmsJCU7L.js";
|
|
8
|
-
import { r as theme$1 } from "./theme-BrRleVfL.js";
|
|
9
|
-
import { n as VERSION } from "./version-BoqlEm3e.js";
|
|
10
|
-
import { n as assertExplicitGatewayAuthModeWhenBothConfigured } from "./auth-mode-policy-BM9E_-zc.js";
|
|
11
|
-
import { a as isLoopbackHost } from "./net-AycWGi8-.js";
|
|
12
|
-
import { a as loadConfig } from "./io-h8M_Z0Lj.js";
|
|
13
|
-
import { o as parseAgentSessionKey } from "./session-key-utils-BT0y7mVK.js";
|
|
14
|
-
import { c as normalizeAgentId, l as normalizeMainKey, r as buildAgentMainSessionKey } from "./session-key-EpIbK3Oz.js";
|
|
15
|
-
import { r as DEFAULT_PROVIDER } from "./defaults-DM8yIn8C.js";
|
|
16
|
-
import { a as resolveAgentIdByWorkspacePath, p as resolveSessionAgentId, x as resolveDefaultAgentId } from "./agent-scope-CDjZLqNk.js";
|
|
17
|
-
import "./config-B3ZoZd5V.js";
|
|
18
|
-
import { n as GatewayClientRequestError, t as GatewayClient } from "./client-Vx7pseEY.js";
|
|
19
|
-
import { i as GATEWAY_CLIENT_NAMES, r as GATEWAY_CLIENT_MODES, t as GATEWAY_CLIENT_CAPS } from "./client-info-CfESmEX1.js";
|
|
20
|
-
import { r as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-core-CtbksRwN.js";
|
|
21
|
-
import "./message-channel-BbI8d0sw.js";
|
|
22
|
-
import "./protocol-C40iRm9c.js";
|
|
23
|
-
import { g as resolveResponseUsageMode, m as normalizeUsageDisplay, r as listThinkingLevelLabels, t as formatThinkingLevels } from "./thinking-CM0wvLlr.js";
|
|
24
|
-
import { p as resolveThinkingDefault, t as buildAllowedModelSet } from "./model-selection-BRmopwFB.js";
|
|
25
|
-
import { t as loadCombinedSessionStoreForGateway } from "./combined-store-gateway-Cp7gSMlV.js";
|
|
26
|
-
import { o as updateSessionStore } from "./store-DsNJP7a2.js";
|
|
27
|
-
import "./sessions-BsnttWP_.js";
|
|
28
|
-
import { l as onAgentEvent } from "./agent-events-CrZzR8Z1.js";
|
|
29
|
-
import { r as formatTokenCount } from "./usage-format-Hc-FyvzW.js";
|
|
30
|
-
import { c as stripEnvelopeFromMessages, i as readSessionMessages, n as capArrayByJsonBytes } from "./session-utils.fs-sxwRHULR.js";
|
|
31
|
-
import { r as extractAssistantVisibleText } from "./chat-message-content-f1D-O-pU.js";
|
|
32
|
-
import { i as stripInlineDirectiveTagsForDisplay } from "./directive-tags-Db1TRP8U.js";
|
|
33
|
-
import { r as stripLeadingInboundMetadata } from "./strip-inbound-meta-BpubGgAq.js";
|
|
34
|
-
import { a as loadSessionEntry, d as resolveGatewaySessionStoreTarget, n as listAgentsForGateway, o as migrateAndPruneGatewaySessionStoreKey, p as resolveSessionModelRef, r as listSessionsFromStore } from "./session-utils-BrGPE9ed.js";
|
|
35
|
-
import { a as isSilentReplyText, n as SILENT_REPLY_TOKEN } from "./tokens-Bq9TB3gs.js";
|
|
36
|
-
import { v as setEmbeddedMode } from "./genesis-tools-CvMcpUvH.js";
|
|
37
|
-
import "./pi-embedded-helpers-BhsTiD6Y.js";
|
|
38
|
-
import { D as formatRawAssistantErrorForUi, m as isAuthErrorMessage } from "./sanitize-user-facing-text-CL1kXS2D.js";
|
|
39
|
-
import { r as resolveToolDisplay, t as formatToolDetail } from "./tool-display-BWPMZ4Xm.js";
|
|
40
|
-
import { l as resolveExplicitGatewayAuth, n as buildGatewayConnectionDetails, s as ensureExplicitGatewayAuth } from "./call-jYRpeAWm.js";
|
|
41
|
-
import { t as parseTimeoutMs } from "./parse-timeout-DF24GSy6.js";
|
|
42
|
-
import { r as resolveSessionInfoModelSelection } from "./model-selection-display-BiU1dZp5.js";
|
|
43
|
-
import { n as listChatCommands, r as listChatCommandsForConfig } from "./commands-registry-list-eSZzx2TM.js";
|
|
44
|
-
import "./commands-registry-BUxuRHG0.js";
|
|
45
|
-
import { n as formatTimeAgo, t as formatRelativeTimestamp } from "./format-relative-uQtNNoGl.js";
|
|
46
|
-
import { t as normalizeGroupActivation } from "./group-activation-C_gTAl_1.js";
|
|
47
|
-
import { r as agentCommandFromIngress } from "./agent-command-BAAeGRql.js";
|
|
48
|
-
import { t as createDefaultDeps } from "./deps-BMuC_6j0.js";
|
|
49
|
-
import { _ as loadGatewayModelCatalog } from "./http-utils-C2hu7rtC.js";
|
|
50
|
-
import { T as augmentChatHistoryWithCliSessionImports, a as enforceChatHistoryFinalBudget, c as sanitizeChatHistoryMessages, o as replaceOversizedChatHistoryMessages, r as augmentChatHistoryWithCanvasBlocks, s as resolveEffectiveChatHistoryMaxChars, t as CHAT_HISTORY_MAX_SINGLE_MESSAGE_BYTES, w as getMaxChatHistoryMessagesBytes } from "./chat-DdKbu8CA.js";
|
|
51
|
-
import { n as timestampOptsFromConfig, t as injectTimestamp } from "./agent-timestamp-X705errr.js";
|
|
52
|
-
import { a as performGatewaySessionReset } from "./session-reset-service-DPgw70iw.js";
|
|
53
|
-
import { t as applySessionsPatchToStore } from "./sessions-patch-2sBcHc9a.js";
|
|
54
|
-
import { t as resolveGatewayInteractiveSurfaceAuth } from "./auth-surface-resolution-ur3TwQ2p.js";
|
|
55
|
-
import { n as TUI_SETUP_AUTH_SOURCE_ENV, t as TUI_SETUP_AUTH_SOURCE_CONFIG } from "./setup-launch-env-DcRVq6al.js";
|
|
56
|
-
import { fileURLToPath } from "node:url";
|
|
57
|
-
import { existsSync } from "node:fs";
|
|
58
|
-
import path from "node:path";
|
|
59
|
-
import { execFileSync, spawn } from "node:child_process";
|
|
60
|
-
import chalk from "chalk";
|
|
61
|
-
import { randomUUID } from "node:crypto";
|
|
62
|
-
import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, isKeyRelease, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
|
|
63
|
-
//#region src/tui/commands.ts
|
|
64
|
-
const VERBOSE_LEVELS = ["on", "off"];
|
|
65
|
-
const TRACE_LEVELS = ["on", "off"];
|
|
66
|
-
const FAST_LEVELS = [
|
|
67
|
-
"status",
|
|
68
|
-
"on",
|
|
69
|
-
"off"
|
|
70
|
-
];
|
|
71
|
-
const REASONING_LEVELS = ["on", "off"];
|
|
72
|
-
const ELEVATED_LEVELS = [
|
|
73
|
-
"on",
|
|
74
|
-
"off",
|
|
75
|
-
"ask",
|
|
76
|
-
"full"
|
|
77
|
-
];
|
|
78
|
-
const ACTIVATION_LEVELS = ["mention", "always"];
|
|
79
|
-
const USAGE_FOOTER_LEVELS = [
|
|
80
|
-
"off",
|
|
81
|
-
"tokens",
|
|
82
|
-
"full"
|
|
83
|
-
];
|
|
84
|
-
const COMMAND_ALIASES = {
|
|
85
|
-
elev: "elevated",
|
|
86
|
-
gwstatus: "gateway-status"
|
|
87
|
-
};
|
|
88
|
-
function createLevelCompletion(levels) {
|
|
89
|
-
return (prefix) => levels.filter((value) => value.startsWith(normalizeLowercaseStringOrEmpty(prefix))).map((value) => ({
|
|
90
|
-
value,
|
|
91
|
-
label: value
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
function parseCommand(input) {
|
|
95
|
-
const trimmed = input.replace(/^\//, "").trim();
|
|
96
|
-
if (!trimmed) return {
|
|
97
|
-
name: "",
|
|
98
|
-
args: ""
|
|
99
|
-
};
|
|
100
|
-
const [name, ...rest] = trimmed.split(/\s+/);
|
|
101
|
-
const normalized = normalizeLowercaseStringOrEmpty(name);
|
|
102
|
-
return {
|
|
103
|
-
name: COMMAND_ALIASES[normalized] ?? normalized,
|
|
104
|
-
args: rest.join(" ").trim()
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function getSlashCommands(options = {}) {
|
|
108
|
-
const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
|
|
109
|
-
const verboseCompletions = createLevelCompletion(VERBOSE_LEVELS);
|
|
110
|
-
const traceCompletions = createLevelCompletion(TRACE_LEVELS);
|
|
111
|
-
const fastCompletions = createLevelCompletion(FAST_LEVELS);
|
|
112
|
-
const reasoningCompletions = createLevelCompletion(REASONING_LEVELS);
|
|
113
|
-
const usageCompletions = createLevelCompletion(USAGE_FOOTER_LEVELS);
|
|
114
|
-
const elevatedCompletions = createLevelCompletion(ELEVATED_LEVELS);
|
|
115
|
-
const activationCompletions = createLevelCompletion(ACTIVATION_LEVELS);
|
|
116
|
-
const commands = [
|
|
117
|
-
{
|
|
118
|
-
name: "help",
|
|
119
|
-
description: "Show slash command help"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "gateway-status",
|
|
123
|
-
description: "Show gateway status summary"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: "gwstatus",
|
|
127
|
-
description: "Alias for /gateway-status"
|
|
128
|
-
},
|
|
129
|
-
...options.local ? [{
|
|
130
|
-
name: "auth",
|
|
131
|
-
description: "Run provider auth/login flow"
|
|
132
|
-
}] : [],
|
|
133
|
-
{
|
|
134
|
-
name: "agent",
|
|
135
|
-
description: "Switch agent (or open picker)"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "agents",
|
|
139
|
-
description: "Open agent picker"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "session",
|
|
143
|
-
description: "Switch session (or open picker)"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "sessions",
|
|
147
|
-
description: "Open session picker"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "model",
|
|
151
|
-
description: "Set model (or open picker)"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "models",
|
|
155
|
-
description: "Open model picker"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "think",
|
|
159
|
-
description: "Set thinking level",
|
|
160
|
-
getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(normalizeLowercaseStringOrEmpty(prefix))).map((value) => ({
|
|
161
|
-
value,
|
|
162
|
-
label: value
|
|
163
|
-
}))
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: "fast",
|
|
167
|
-
description: "Set fast mode on/off",
|
|
168
|
-
getArgumentCompletions: fastCompletions
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "verbose",
|
|
172
|
-
description: "Set verbose on/off",
|
|
173
|
-
getArgumentCompletions: verboseCompletions
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
name: "trace",
|
|
177
|
-
description: "Set trace on/off",
|
|
178
|
-
getArgumentCompletions: traceCompletions
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "reasoning",
|
|
182
|
-
description: "Set reasoning on/off",
|
|
183
|
-
getArgumentCompletions: reasoningCompletions
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "usage",
|
|
187
|
-
description: "Toggle per-response usage line",
|
|
188
|
-
getArgumentCompletions: usageCompletions
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "elevated",
|
|
192
|
-
description: "Set elevated on/off/ask/full",
|
|
193
|
-
getArgumentCompletions: elevatedCompletions
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: "elev",
|
|
197
|
-
description: "Alias for /elevated",
|
|
198
|
-
getArgumentCompletions: elevatedCompletions
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
name: "activation",
|
|
202
|
-
description: "Set group activation",
|
|
203
|
-
getArgumentCompletions: activationCompletions
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: "abort",
|
|
207
|
-
description: "Abort active run"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: "new",
|
|
211
|
-
description: "Reset the session"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: "reset",
|
|
215
|
-
description: "Reset the session"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "settings",
|
|
219
|
-
description: "Open settings"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: "exit",
|
|
223
|
-
description: "Exit the TUI"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
name: "quit",
|
|
227
|
-
description: "Exit the TUI"
|
|
228
|
-
}
|
|
229
|
-
];
|
|
230
|
-
const seen = new Set(commands.map((command) => command.name));
|
|
231
|
-
const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
|
|
232
|
-
for (const command of gatewayCommands) {
|
|
233
|
-
const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
|
|
234
|
-
for (const alias of aliases) {
|
|
235
|
-
const name = alias.replace(/^\//, "").trim();
|
|
236
|
-
if (!name || seen.has(name)) continue;
|
|
237
|
-
seen.add(name);
|
|
238
|
-
commands.push({
|
|
239
|
-
name,
|
|
240
|
-
description: command.description
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return commands;
|
|
245
|
-
}
|
|
246
|
-
function helpText(options = {}) {
|
|
247
|
-
const thinkLevels = formatThinkingLevels(options.provider, options.model, "|");
|
|
248
|
-
return [
|
|
249
|
-
"Slash commands:",
|
|
250
|
-
"/help",
|
|
251
|
-
"/commands",
|
|
252
|
-
"/status",
|
|
253
|
-
"/gateway-status",
|
|
254
|
-
"/gwstatus",
|
|
255
|
-
...options.local ? ["/auth [provider]"] : [],
|
|
256
|
-
"/agent <id> (or /agents)",
|
|
257
|
-
"/session <key> (or /sessions)",
|
|
258
|
-
"/model <provider/model> (or /models)",
|
|
259
|
-
`/think <${thinkLevels}>`,
|
|
260
|
-
"/fast <status|on|off>",
|
|
261
|
-
"/verbose <on|off>",
|
|
262
|
-
"/trace <on|off>",
|
|
263
|
-
"/reasoning <on|off>",
|
|
264
|
-
"/usage <off|tokens|full>",
|
|
265
|
-
"/elevated <on|off|ask|full>",
|
|
266
|
-
"/elev <on|off|ask|full>",
|
|
267
|
-
"/activation <mention|always>",
|
|
268
|
-
"/new or /reset",
|
|
269
|
-
"/abort",
|
|
270
|
-
"/settings",
|
|
271
|
-
"/exit"
|
|
272
|
-
].join("\n");
|
|
273
|
-
}
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/tui/theme/theme.ts
|
|
276
|
-
const DARK_TEXT = "#E8E3D5";
|
|
277
|
-
const LIGHT_TEXT = "#1E1E1E";
|
|
278
|
-
const XTERM_LEVELS = [
|
|
279
|
-
0,
|
|
280
|
-
95,
|
|
281
|
-
135,
|
|
282
|
-
175,
|
|
283
|
-
215,
|
|
284
|
-
255
|
|
285
|
-
];
|
|
286
|
-
function channelToSrgb(value) {
|
|
287
|
-
const normalized = value / 255;
|
|
288
|
-
return normalized <= .03928 ? normalized / 12.92 : ((normalized + .055) / 1.055) ** 2.4;
|
|
289
|
-
}
|
|
290
|
-
function relativeLuminanceRgb(r, g, b) {
|
|
291
|
-
const red = channelToSrgb(r);
|
|
292
|
-
const green = channelToSrgb(g);
|
|
293
|
-
const blue = channelToSrgb(b);
|
|
294
|
-
return .2126 * red + .7152 * green + .0722 * blue;
|
|
295
|
-
}
|
|
296
|
-
function relativeLuminanceHex(hex) {
|
|
297
|
-
return relativeLuminanceRgb(Number.parseInt(hex.slice(1, 3), 16), Number.parseInt(hex.slice(3, 5), 16), Number.parseInt(hex.slice(5, 7), 16));
|
|
298
|
-
}
|
|
299
|
-
function contrastRatio(background, foregroundHex) {
|
|
300
|
-
const foreground = relativeLuminanceHex(foregroundHex);
|
|
301
|
-
const lighter = Math.max(background, foreground);
|
|
302
|
-
const darker = Math.min(background, foreground);
|
|
303
|
-
return (lighter + .05) / (darker + .05);
|
|
304
|
-
}
|
|
305
|
-
function pickHigherContrastText(r, g, b) {
|
|
306
|
-
const background = relativeLuminanceRgb(r, g, b);
|
|
307
|
-
return contrastRatio(background, LIGHT_TEXT) >= contrastRatio(background, DARK_TEXT);
|
|
308
|
-
}
|
|
309
|
-
function isLightBackground() {
|
|
310
|
-
const explicit = normalizeOptionalLowercaseString(process.env.GENESIS_THEME);
|
|
311
|
-
if (explicit === "light") return true;
|
|
312
|
-
if (explicit === "dark") return false;
|
|
313
|
-
const colorfgbg = process.env.COLORFGBG;
|
|
314
|
-
if (colorfgbg && colorfgbg.length <= 64) {
|
|
315
|
-
const sep = colorfgbg.lastIndexOf(";");
|
|
316
|
-
const bg = Number.parseInt(sep >= 0 ? colorfgbg.slice(sep + 1) : colorfgbg, 10);
|
|
317
|
-
if (bg >= 0 && bg <= 255) {
|
|
318
|
-
if (bg <= 15) return bg === 7 || bg === 15;
|
|
319
|
-
if (bg >= 232) return bg >= 244;
|
|
320
|
-
const cubeIndex = bg - 16;
|
|
321
|
-
const bVal = XTERM_LEVELS[cubeIndex % 6];
|
|
322
|
-
const gVal = XTERM_LEVELS[Math.floor(cubeIndex / 6) % 6];
|
|
323
|
-
const rVal = XTERM_LEVELS[Math.floor(cubeIndex / 36)];
|
|
324
|
-
return pickHigherContrastText(rVal, gVal, bVal);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
const palette = isLightBackground() ? {
|
|
330
|
-
text: "#1E1E1E",
|
|
331
|
-
dim: "#5B6472",
|
|
332
|
-
accent: "#B45309",
|
|
333
|
-
accentSoft: "#C2410C",
|
|
334
|
-
border: "#5B6472",
|
|
335
|
-
userBg: "#F3F0E8",
|
|
336
|
-
userText: "#1E1E1E",
|
|
337
|
-
systemText: "#4B5563",
|
|
338
|
-
toolPendingBg: "#EFF6FF",
|
|
339
|
-
toolSuccessBg: "#ECFDF5",
|
|
340
|
-
toolErrorBg: "#FEF2F2",
|
|
341
|
-
toolTitle: "#B45309",
|
|
342
|
-
toolOutput: "#374151",
|
|
343
|
-
quote: "#1D4ED8",
|
|
344
|
-
quoteBorder: "#2563EB",
|
|
345
|
-
code: "#92400E",
|
|
346
|
-
codeBlock: "#F9FAFB",
|
|
347
|
-
codeBorder: "#92400E",
|
|
348
|
-
link: "#047857",
|
|
349
|
-
error: "#DC2626",
|
|
350
|
-
success: "#047857"
|
|
351
|
-
} : {
|
|
352
|
-
text: "#E8E3D5",
|
|
353
|
-
dim: "#7B7F87",
|
|
354
|
-
accent: "#F6C453",
|
|
355
|
-
accentSoft: "#F2A65A",
|
|
356
|
-
border: "#3C414B",
|
|
357
|
-
userBg: "#2B2F36",
|
|
358
|
-
userText: "#F3EEE0",
|
|
359
|
-
systemText: "#9BA3B2",
|
|
360
|
-
toolPendingBg: "#1F2A2F",
|
|
361
|
-
toolSuccessBg: "#1E2D23",
|
|
362
|
-
toolErrorBg: "#2F1F1F",
|
|
363
|
-
toolTitle: "#F6C453",
|
|
364
|
-
toolOutput: "#E1DACB",
|
|
365
|
-
quote: "#8CC8FF",
|
|
366
|
-
quoteBorder: "#3B4D6B",
|
|
367
|
-
code: "#F0C987",
|
|
368
|
-
codeBlock: "#1E232A",
|
|
369
|
-
codeBorder: "#343A45",
|
|
370
|
-
link: "#7DD3A5",
|
|
371
|
-
error: "#F97066",
|
|
372
|
-
success: "#7DD3A5"
|
|
373
|
-
};
|
|
374
|
-
const fg = (hex) => (text) => chalk.hex(hex)(text);
|
|
375
|
-
const bg = (hex) => (text) => chalk.bgHex(hex)(text);
|
|
376
|
-
/**
|
|
377
|
-
* Render code blocks with the theme code color without pulling a parser into the base TUI path.
|
|
378
|
-
* Returns an array of lines with ANSI escape codes.
|
|
379
|
-
*/
|
|
380
|
-
function highlightCode(code) {
|
|
381
|
-
return code.split("\n").map((line) => fg(palette.code)(line));
|
|
382
|
-
}
|
|
383
|
-
const theme = {
|
|
384
|
-
fg: fg(palette.text),
|
|
385
|
-
assistantText: (text) => text,
|
|
386
|
-
dim: fg(palette.dim),
|
|
387
|
-
accent: fg(palette.accent),
|
|
388
|
-
accentSoft: fg(palette.accentSoft),
|
|
389
|
-
success: fg(palette.success),
|
|
390
|
-
error: fg(palette.error),
|
|
391
|
-
header: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
392
|
-
system: fg(palette.systemText),
|
|
393
|
-
userBg: bg(palette.userBg),
|
|
394
|
-
userText: fg(palette.userText),
|
|
395
|
-
toolTitle: fg(palette.toolTitle),
|
|
396
|
-
toolOutput: fg(palette.toolOutput),
|
|
397
|
-
toolPendingBg: bg(palette.toolPendingBg),
|
|
398
|
-
toolSuccessBg: bg(palette.toolSuccessBg),
|
|
399
|
-
toolErrorBg: bg(palette.toolErrorBg),
|
|
400
|
-
border: fg(palette.border),
|
|
401
|
-
bold: (text) => chalk.bold(text),
|
|
402
|
-
italic: (text) => chalk.italic(text)
|
|
403
|
-
};
|
|
404
|
-
const markdownTheme = {
|
|
405
|
-
heading: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
406
|
-
link: (text) => fg(palette.link)(text),
|
|
407
|
-
linkUrl: (text) => chalk.dim(text),
|
|
408
|
-
code: (text) => fg(palette.code)(text),
|
|
409
|
-
codeBlock: (text) => fg(palette.code)(text),
|
|
410
|
-
codeBlockBorder: (text) => fg(palette.codeBorder)(text),
|
|
411
|
-
quote: (text) => fg(palette.quote)(text),
|
|
412
|
-
quoteBorder: (text) => fg(palette.quoteBorder)(text),
|
|
413
|
-
hr: (text) => fg(palette.border)(text),
|
|
414
|
-
listBullet: (text) => fg(palette.accentSoft)(text),
|
|
415
|
-
bold: (text) => chalk.bold(text),
|
|
416
|
-
italic: (text) => chalk.italic(text),
|
|
417
|
-
strikethrough: (text) => chalk.strikethrough(text),
|
|
418
|
-
underline: (text) => chalk.underline(text),
|
|
419
|
-
highlightCode
|
|
420
|
-
};
|
|
421
|
-
const baseSelectListTheme = {
|
|
422
|
-
selectedPrefix: (text) => fg(palette.accent)(text),
|
|
423
|
-
selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
424
|
-
description: (text) => fg(palette.dim)(text),
|
|
425
|
-
scrollInfo: (text) => fg(palette.dim)(text),
|
|
426
|
-
noMatch: (text) => fg(palette.dim)(text)
|
|
427
|
-
};
|
|
428
|
-
const selectListTheme = baseSelectListTheme;
|
|
429
|
-
const filterableSelectListTheme = {
|
|
430
|
-
...baseSelectListTheme,
|
|
431
|
-
filterLabel: (text) => fg(palette.dim)(text)
|
|
432
|
-
};
|
|
433
|
-
const settingsListTheme = {
|
|
434
|
-
label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
|
|
435
|
-
value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
|
|
436
|
-
description: (text) => fg(palette.systemText)(text),
|
|
437
|
-
cursor: fg(palette.accent)("→ "),
|
|
438
|
-
hint: (text) => fg(palette.dim)(text)
|
|
439
|
-
};
|
|
440
|
-
const editorTheme = {
|
|
441
|
-
borderColor: (text) => fg(palette.border)(text),
|
|
442
|
-
selectList: selectListTheme
|
|
443
|
-
};
|
|
444
|
-
const searchableSelectListTheme = {
|
|
445
|
-
...baseSelectListTheme,
|
|
446
|
-
searchPrompt: (text) => fg(palette.accentSoft)(text),
|
|
447
|
-
searchInput: (text) => fg(palette.text)(text),
|
|
448
|
-
matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
|
|
449
|
-
};
|
|
450
|
-
//#endregion
|
|
451
|
-
//#region src/tui/osc8-hyperlinks.ts
|
|
452
|
-
const SGR_PATTERN = "\\x1b\\[[0-9;]*m";
|
|
453
|
-
const OSC8_PATTERN = "\\x1b\\]8;;.*?(?:\\x07|\\x1b\\\\)";
|
|
454
|
-
const ANSI_RE = new RegExp(`${SGR_PATTERN}|${OSC8_PATTERN}`, "g");
|
|
455
|
-
const SGR_START_RE = new RegExp(`^${SGR_PATTERN}`);
|
|
456
|
-
const OSC8_START_RE = new RegExp(`^${OSC8_PATTERN}`);
|
|
457
|
-
/**
|
|
458
|
-
* Extract all unique URLs from raw markdown text.
|
|
459
|
-
* Finds both bare URLs and markdown link hrefs [text](url).
|
|
460
|
-
*/
|
|
461
|
-
function extractUrls(markdown) {
|
|
462
|
-
const urls = /* @__PURE__ */ new Set();
|
|
463
|
-
const mdLinkRe = /\[(?:[^\]]*)\]\(\s*<?(https?:\/\/[^)\s>]+)>?(?:\s+["'][^"']*["'])?\s*\)/g;
|
|
464
|
-
let m;
|
|
465
|
-
while ((m = mdLinkRe.exec(markdown)) !== null) urls.add(m[1]);
|
|
466
|
-
const stripped = markdown.replace(/\[(?:[^\]]*)\]\(\s*<?https?:\/\/[^)\s>]+>?(?:\s+["'][^"']*["'])?\s*\)/g, "");
|
|
467
|
-
const bareRe = /https?:\/\/[^\s)\]>]+/g;
|
|
468
|
-
while ((m = bareRe.exec(stripped)) !== null) urls.add(m[0]);
|
|
469
|
-
return [...urls];
|
|
470
|
-
}
|
|
471
|
-
/** Strip ANSI SGR and OSC 8 sequences to get visible text. */
|
|
472
|
-
function stripAnsi(input) {
|
|
473
|
-
return input.replace(ANSI_RE, "");
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Find URL ranges in a line's visible text, handling cross-line URL splits.
|
|
477
|
-
*/
|
|
478
|
-
function findUrlRanges(visibleText, knownUrls, pending) {
|
|
479
|
-
const ranges = [];
|
|
480
|
-
let newPending = null;
|
|
481
|
-
let searchFrom = 0;
|
|
482
|
-
if (pending) {
|
|
483
|
-
const remaining = pending.url.slice(pending.consumed);
|
|
484
|
-
const trimmed = visibleText.trimStart();
|
|
485
|
-
const leadingSpaces = visibleText.length - trimmed.length;
|
|
486
|
-
let matchLen = 0;
|
|
487
|
-
for (let j = 0; j < remaining.length && j < trimmed.length; j++) if (remaining[j] === trimmed[j]) matchLen++;
|
|
488
|
-
else break;
|
|
489
|
-
if (matchLen > 0) {
|
|
490
|
-
ranges.push({
|
|
491
|
-
start: leadingSpaces,
|
|
492
|
-
end: leadingSpaces + matchLen,
|
|
493
|
-
url: pending.url
|
|
494
|
-
});
|
|
495
|
-
searchFrom = leadingSpaces + matchLen;
|
|
496
|
-
if (pending.consumed + matchLen < pending.url.length) newPending = {
|
|
497
|
-
url: pending.url,
|
|
498
|
-
consumed: pending.consumed + matchLen
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
const urlRe = /https?:\/\/[^\s)\]>]+/g;
|
|
503
|
-
urlRe.lastIndex = searchFrom;
|
|
504
|
-
let match;
|
|
505
|
-
while ((match = urlRe.exec(visibleText)) !== null) {
|
|
506
|
-
const fragment = match[0];
|
|
507
|
-
const start = match.index;
|
|
508
|
-
let resolvedUrl = fragment;
|
|
509
|
-
let found = false;
|
|
510
|
-
for (const known of knownUrls) if (known === fragment) {
|
|
511
|
-
resolvedUrl = known;
|
|
512
|
-
found = true;
|
|
513
|
-
break;
|
|
514
|
-
}
|
|
515
|
-
if (!found) {
|
|
516
|
-
let bestLen = 0;
|
|
517
|
-
for (const known of knownUrls) if (known.startsWith(fragment) && known.length > bestLen) {
|
|
518
|
-
resolvedUrl = known;
|
|
519
|
-
bestLen = known.length;
|
|
520
|
-
found = true;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
if (!found) {
|
|
524
|
-
let bestLen = 0;
|
|
525
|
-
for (const known of knownUrls) if (fragment.startsWith(known) && known.length > bestLen) {
|
|
526
|
-
resolvedUrl = known;
|
|
527
|
-
bestLen = known.length;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
ranges.push({
|
|
531
|
-
start,
|
|
532
|
-
end: start + fragment.length,
|
|
533
|
-
url: resolvedUrl
|
|
534
|
-
});
|
|
535
|
-
if (resolvedUrl.length > fragment.length && resolvedUrl.startsWith(fragment)) newPending = {
|
|
536
|
-
url: resolvedUrl,
|
|
537
|
-
consumed: fragment.length
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
return {
|
|
541
|
-
ranges,
|
|
542
|
-
pending: newPending
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Apply OSC 8 hyperlink sequences to a line based on visible-text URL ranges.
|
|
547
|
-
* Walks through the raw string character by character, inserting OSC 8
|
|
548
|
-
* open/close sequences at URL range boundaries while preserving ANSI codes.
|
|
549
|
-
*/
|
|
550
|
-
function applyOsc8Ranges(line, ranges) {
|
|
551
|
-
if (ranges.length === 0) return line;
|
|
552
|
-
const urlAt = /* @__PURE__ */ new Map();
|
|
553
|
-
for (const r of ranges) for (let p = r.start; p < r.end; p++) urlAt.set(p, r.url);
|
|
554
|
-
let result = "";
|
|
555
|
-
let visiblePos = 0;
|
|
556
|
-
let activeUrl = null;
|
|
557
|
-
let i = 0;
|
|
558
|
-
while (i < line.length) {
|
|
559
|
-
if (line.charCodeAt(i) === 27) {
|
|
560
|
-
const sgr = line.slice(i).match(SGR_START_RE);
|
|
561
|
-
if (sgr) {
|
|
562
|
-
result += sgr[0];
|
|
563
|
-
i += sgr[0].length;
|
|
564
|
-
continue;
|
|
565
|
-
}
|
|
566
|
-
const osc = line.slice(i).match(OSC8_START_RE);
|
|
567
|
-
if (osc) {
|
|
568
|
-
result += osc[0];
|
|
569
|
-
i += osc[0].length;
|
|
570
|
-
continue;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
const targetUrl = urlAt.get(visiblePos) ?? null;
|
|
574
|
-
if (targetUrl !== activeUrl) {
|
|
575
|
-
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
576
|
-
if (targetUrl !== null) result += `\x1b]8;;${targetUrl}\x07`;
|
|
577
|
-
activeUrl = targetUrl;
|
|
578
|
-
}
|
|
579
|
-
result += line[i];
|
|
580
|
-
visiblePos++;
|
|
581
|
-
i++;
|
|
582
|
-
}
|
|
583
|
-
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
584
|
-
return result;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Add OSC 8 hyperlinks to rendered lines using a pre-extracted URL list.
|
|
588
|
-
*
|
|
589
|
-
* For each line, finds URL-like substrings in the visible text, matches them
|
|
590
|
-
* against known URLs, and wraps each fragment with OSC 8 escape sequences.
|
|
591
|
-
* Handles URLs broken across multiple lines by pi-tui's word wrapping.
|
|
592
|
-
*/
|
|
593
|
-
function addOsc8Hyperlinks(lines, urls) {
|
|
594
|
-
if (urls.length === 0) return lines;
|
|
595
|
-
let pending = null;
|
|
596
|
-
return lines.map((line) => {
|
|
597
|
-
const result = findUrlRanges(stripAnsi(line), urls, pending);
|
|
598
|
-
pending = result.pending;
|
|
599
|
-
return applyOsc8Ranges(line, result.ranges);
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
//#endregion
|
|
603
|
-
//#region src/tui/components/hyperlink-markdown.ts
|
|
604
|
-
/**
|
|
605
|
-
* Wrapper around pi-tui's Markdown component that adds OSC 8 terminal
|
|
606
|
-
* hyperlinks to rendered output, making URLs clickable even when broken
|
|
607
|
-
* across multiple lines by word wrapping.
|
|
608
|
-
*/
|
|
609
|
-
var HyperlinkMarkdown = class {
|
|
610
|
-
constructor(text, paddingX, paddingY, theme, options) {
|
|
611
|
-
this.inner = new Markdown(text, paddingX, paddingY, theme, options);
|
|
612
|
-
this.urls = extractUrls(text);
|
|
613
|
-
}
|
|
614
|
-
render(width) {
|
|
615
|
-
return addOsc8Hyperlinks(this.inner.render(width), this.urls);
|
|
616
|
-
}
|
|
617
|
-
setText(text) {
|
|
618
|
-
this.inner.setText(text);
|
|
619
|
-
this.urls = extractUrls(text);
|
|
620
|
-
}
|
|
621
|
-
invalidate() {
|
|
622
|
-
this.inner.invalidate();
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
//#endregion
|
|
626
|
-
//#region src/tui/components/assistant-message.ts
|
|
627
|
-
var AssistantMessageComponent = class extends Container {
|
|
628
|
-
constructor(text) {
|
|
629
|
-
super();
|
|
630
|
-
this.body = new HyperlinkMarkdown(text, 0, 0, markdownTheme, { color: (line) => theme.assistantText(line) });
|
|
631
|
-
this.addChild(new Spacer(1));
|
|
632
|
-
this.addChild(this.body);
|
|
633
|
-
}
|
|
634
|
-
setText(text) {
|
|
635
|
-
this.body.setText(text);
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
//#endregion
|
|
639
|
-
//#region src/tui/components/btw-inline-message.ts
|
|
640
|
-
var BtwInlineMessage = class extends Container {
|
|
641
|
-
constructor(params) {
|
|
642
|
-
super();
|
|
643
|
-
this.setResult(params);
|
|
644
|
-
}
|
|
645
|
-
setResult(params) {
|
|
646
|
-
this.clear();
|
|
647
|
-
this.addChild(new Spacer(1));
|
|
648
|
-
this.addChild(new Text(theme.header(`BTW: ${params.question}`), 1, 0));
|
|
649
|
-
if (params.isError) this.addChild(new Text(theme.error(params.text), 1, 0));
|
|
650
|
-
else this.addChild(new AssistantMessageComponent(params.text));
|
|
651
|
-
this.addChild(new Text(theme.dim("Press Enter or Esc to dismiss"), 1, 0));
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
//#endregion
|
|
655
|
-
//#region src/tui/tui-formatters.ts
|
|
656
|
-
const REPLACEMENT_CHAR_RE = /\uFFFD/g;
|
|
657
|
-
const MAX_TOKEN_CHARS = 32;
|
|
658
|
-
const LONG_TOKEN_RE = /\S{33,}/g;
|
|
659
|
-
const LONG_TOKEN_TEST_RE = /\S{33,}/;
|
|
660
|
-
const BINARY_LINE_REPLACEMENT_THRESHOLD = 12;
|
|
661
|
-
const URL_PREFIX_RE = /^(https?:\/\/|file:\/\/)/i;
|
|
662
|
-
const WINDOWS_DRIVE_RE = /^[a-zA-Z]:[\\/]/;
|
|
663
|
-
const FILE_LIKE_RE = /^[a-zA-Z0-9._-]+$/;
|
|
664
|
-
const EDGE_PUNCTUATION_RE = /^[`"'([{<]+|[`"')\]}>.,:;!?]+$/g;
|
|
665
|
-
const TOKENISH_MIN_LENGTH = 24;
|
|
666
|
-
const RTL_SCRIPT_RE = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;
|
|
667
|
-
const BIDI_CONTROL_RE = /[\u202a-\u202e\u2066-\u2069]/;
|
|
668
|
-
const RTL_ISOLATE_START = "";
|
|
669
|
-
const RTL_ISOLATE_END = "";
|
|
670
|
-
function hasControlChars(text) {
|
|
671
|
-
for (const char of text) {
|
|
672
|
-
const code = char.charCodeAt(0);
|
|
673
|
-
if (code <= 31 && code !== 9 && code !== 10 && code !== 13 || code >= 127 && code <= 159) return true;
|
|
674
|
-
}
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
function stripControlChars(text) {
|
|
678
|
-
if (!hasControlChars(text)) return text;
|
|
679
|
-
let sanitized = "";
|
|
680
|
-
for (const char of text) {
|
|
681
|
-
const code = char.charCodeAt(0);
|
|
682
|
-
if (!(code <= 31 && code !== 9 && code !== 10 && code !== 13) && !(code >= 127 && code <= 159)) sanitized += char;
|
|
683
|
-
}
|
|
684
|
-
return sanitized;
|
|
685
|
-
}
|
|
686
|
-
function chunkToken(token, maxChars) {
|
|
687
|
-
if (token.length <= maxChars) return [token];
|
|
688
|
-
const chunks = [];
|
|
689
|
-
for (let i = 0; i < token.length; i += maxChars) chunks.push(token.slice(i, i + maxChars));
|
|
690
|
-
return chunks;
|
|
691
|
-
}
|
|
692
|
-
function isCopySensitiveToken(token) {
|
|
693
|
-
const candidate = token.replace(EDGE_PUNCTUATION_RE, "") || token;
|
|
694
|
-
if (URL_PREFIX_RE.test(token)) return true;
|
|
695
|
-
if (token.startsWith("/") || token.startsWith("~/") || token.startsWith("./") || token.startsWith("../")) return true;
|
|
696
|
-
if (WINDOWS_DRIVE_RE.test(token) || token.startsWith("\\\\")) return true;
|
|
697
|
-
if (token.includes("/") || token.includes("\\")) return true;
|
|
698
|
-
if (token.includes("_") && FILE_LIKE_RE.test(token)) return true;
|
|
699
|
-
if (candidate.length >= TOKENISH_MIN_LENGTH && /[a-z]/i.test(candidate) && /\d/.test(candidate)) return true;
|
|
700
|
-
return false;
|
|
701
|
-
}
|
|
702
|
-
function normalizeLongTokenForDisplay(token) {
|
|
703
|
-
if (isCopySensitiveToken(token)) return token;
|
|
704
|
-
return chunkToken(token, MAX_TOKEN_CHARS).join(" ");
|
|
705
|
-
}
|
|
706
|
-
function redactBinaryLikeLine(line) {
|
|
707
|
-
const replacementCount = (line.match(REPLACEMENT_CHAR_RE) || []).length;
|
|
708
|
-
if (replacementCount >= BINARY_LINE_REPLACEMENT_THRESHOLD && replacementCount * 2 >= line.length) return "[binary data omitted]";
|
|
709
|
-
return line;
|
|
710
|
-
}
|
|
711
|
-
function isolateRtlLine(line) {
|
|
712
|
-
if (!RTL_SCRIPT_RE.test(line) || BIDI_CONTROL_RE.test(line)) return line;
|
|
713
|
-
return `${RTL_ISOLATE_START}${line}${RTL_ISOLATE_END}`;
|
|
714
|
-
}
|
|
715
|
-
function applyRtlIsolation(text) {
|
|
716
|
-
if (!RTL_SCRIPT_RE.test(text)) return text;
|
|
717
|
-
return text.split("\n").map((line) => isolateRtlLine(line)).join("\n");
|
|
718
|
-
}
|
|
719
|
-
function sanitizeRenderableText(text) {
|
|
720
|
-
if (!text) return text;
|
|
721
|
-
const hasAnsi = text.includes("\x1B");
|
|
722
|
-
const hasReplacementChars = text.includes("�");
|
|
723
|
-
const hasLongTokens = LONG_TOKEN_TEST_RE.test(text);
|
|
724
|
-
const hasControls = hasControlChars(text);
|
|
725
|
-
if (!hasAnsi && !hasReplacementChars && !hasLongTokens && !hasControls) return applyRtlIsolation(text);
|
|
726
|
-
const withoutAnsi = hasAnsi ? stripAnsi$1(text) : text;
|
|
727
|
-
const withoutControlChars = hasControls ? stripControlChars(withoutAnsi) : withoutAnsi;
|
|
728
|
-
const redacted = hasReplacementChars ? withoutControlChars.split("\n").map((line) => redactBinaryLikeLine(line)).join("\n") : withoutControlChars;
|
|
729
|
-
return applyRtlIsolation(LONG_TOKEN_TEST_RE.test(redacted) ? redacted.replace(LONG_TOKEN_RE, normalizeLongTokenForDisplay) : redacted);
|
|
730
|
-
}
|
|
731
|
-
function resolveFinalAssistantText(params) {
|
|
732
|
-
const finalText = params.finalText ?? "";
|
|
733
|
-
if (finalText.trim()) return finalText;
|
|
734
|
-
const streamedText = params.streamedText ?? "";
|
|
735
|
-
if (streamedText.trim()) return streamedText;
|
|
736
|
-
const errorMessage = params.errorMessage ?? "";
|
|
737
|
-
if (errorMessage.trim()) return formatRawAssistantErrorForUi(errorMessage);
|
|
738
|
-
return "(no output)";
|
|
739
|
-
}
|
|
740
|
-
function composeThinkingAndContent(params) {
|
|
741
|
-
const thinkingText = params.thinkingText?.trim() ?? "";
|
|
742
|
-
const contentText = params.contentText?.trim() ?? "";
|
|
743
|
-
const parts = [];
|
|
744
|
-
if (params.showThinking && thinkingText) parts.push(`[thinking]\n${thinkingText}`);
|
|
745
|
-
if (contentText) parts.push(contentText);
|
|
746
|
-
return parts.join("\n\n").trim();
|
|
747
|
-
}
|
|
748
|
-
function asMessageRecord(message) {
|
|
749
|
-
if (!message || typeof message !== "object") return;
|
|
750
|
-
return message;
|
|
751
|
-
}
|
|
752
|
-
function resolveMessageRecord(message) {
|
|
753
|
-
const record = asMessageRecord(message);
|
|
754
|
-
if (!record) return;
|
|
755
|
-
return {
|
|
756
|
-
record,
|
|
757
|
-
content: record.content
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
function formatAssistantErrorFromRecord(record) {
|
|
761
|
-
if ((typeof record.stopReason === "string" ? record.stopReason : "") !== "error") return "";
|
|
762
|
-
return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
|
|
763
|
-
}
|
|
764
|
-
function collectSanitizedBlockStrings(params) {
|
|
765
|
-
if (!Array.isArray(params.content)) return [];
|
|
766
|
-
const parts = [];
|
|
767
|
-
for (const block of params.content) {
|
|
768
|
-
if (!block || typeof block !== "object") continue;
|
|
769
|
-
const rec = block;
|
|
770
|
-
if (rec.type === params.blockType && typeof rec[params.valueKey] === "string") parts.push(sanitizeRenderableText(rec[params.valueKey]));
|
|
771
|
-
}
|
|
772
|
-
return parts;
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Extract ONLY thinking blocks from message content.
|
|
776
|
-
* Model-agnostic: returns empty string if no thinking blocks exist.
|
|
777
|
-
*/
|
|
778
|
-
function extractThinkingFromMessage(message) {
|
|
779
|
-
const resolved = resolveMessageRecord(message);
|
|
780
|
-
if (!resolved) return "";
|
|
781
|
-
const { content } = resolved;
|
|
782
|
-
if (typeof content === "string") return "";
|
|
783
|
-
return collectSanitizedBlockStrings({
|
|
784
|
-
content,
|
|
785
|
-
blockType: "thinking",
|
|
786
|
-
valueKey: "thinking"
|
|
787
|
-
}).join("\n").trim();
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Extract ONLY text content blocks from message (excludes thinking).
|
|
791
|
-
* Model-agnostic: works for any model with text content blocks.
|
|
792
|
-
*/
|
|
793
|
-
function extractContentFromMessage(message) {
|
|
794
|
-
const resolved = resolveMessageRecord(message);
|
|
795
|
-
if (!resolved) return "";
|
|
796
|
-
const { record, content } = resolved;
|
|
797
|
-
if (record.role === "assistant") {
|
|
798
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
799
|
-
if (Array.isArray(content)) return extractAssistantRenderableContent(record);
|
|
800
|
-
}
|
|
801
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
802
|
-
const parts = collectSanitizedBlockStrings({
|
|
803
|
-
content,
|
|
804
|
-
blockType: "text",
|
|
805
|
-
valueKey: "text"
|
|
806
|
-
});
|
|
807
|
-
if (parts.length > 0) return parts.join("\n").trim();
|
|
808
|
-
return formatAssistantErrorFromRecord(record);
|
|
809
|
-
}
|
|
810
|
-
function extractAssistantRenderableContent(record) {
|
|
811
|
-
const visible = sanitizeRenderableText(extractAssistantVisibleText(record) ?? "").trim();
|
|
812
|
-
if (visible) return visible;
|
|
813
|
-
return formatAssistantErrorFromRecord(record);
|
|
814
|
-
}
|
|
815
|
-
function extractTextBlocks(content, opts) {
|
|
816
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
817
|
-
if (!Array.isArray(content)) return "";
|
|
818
|
-
const textParts = collectSanitizedBlockStrings({
|
|
819
|
-
content,
|
|
820
|
-
blockType: "text",
|
|
821
|
-
valueKey: "text"
|
|
822
|
-
});
|
|
823
|
-
return composeThinkingAndContent({
|
|
824
|
-
thinkingText: (opts?.includeThinking === true ? collectSanitizedBlockStrings({
|
|
825
|
-
content,
|
|
826
|
-
blockType: "thinking",
|
|
827
|
-
valueKey: "thinking"
|
|
828
|
-
}) : []).join("\n").trim(),
|
|
829
|
-
contentText: textParts.join("\n").trim(),
|
|
830
|
-
showThinking: opts?.includeThinking ?? false
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
function extractTextFromMessage(message, opts) {
|
|
834
|
-
const record = asMessageRecord(message);
|
|
835
|
-
if (!record) return "";
|
|
836
|
-
if (record.role === "assistant") return composeThinkingAndContent({
|
|
837
|
-
thinkingText: extractThinkingFromMessage(record),
|
|
838
|
-
contentText: extractAssistantRenderableContent(record),
|
|
839
|
-
showThinking: opts?.includeThinking ?? false
|
|
840
|
-
});
|
|
841
|
-
const text = extractTextBlocks(record.content, opts);
|
|
842
|
-
if (text) {
|
|
843
|
-
if (record.role === "user" || record.command === true) return stripLeadingInboundMetadata(text);
|
|
844
|
-
return text;
|
|
845
|
-
}
|
|
846
|
-
const errorText = formatAssistantErrorFromRecord(record);
|
|
847
|
-
if (!errorText) return "";
|
|
848
|
-
return errorText;
|
|
849
|
-
}
|
|
850
|
-
function isCommandMessage(message) {
|
|
851
|
-
if (!message || typeof message !== "object") return false;
|
|
852
|
-
return message.command === true;
|
|
853
|
-
}
|
|
854
|
-
function formatTokens(total, context) {
|
|
855
|
-
if (total == null && context == null) return "tokens ?";
|
|
856
|
-
const totalLabel = total == null ? "?" : formatTokenCount(total);
|
|
857
|
-
if (context == null) return `tokens ${totalLabel}`;
|
|
858
|
-
const pct = typeof total === "number" && context > 0 ? Math.min(999, Math.round(total / context * 100)) : null;
|
|
859
|
-
return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
|
|
860
|
-
}
|
|
861
|
-
function formatContextUsageLine(params) {
|
|
862
|
-
const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
|
|
863
|
-
const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
|
|
864
|
-
const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
|
|
865
|
-
const extra = [typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null, pct !== null ? `${pct}%` : null].filter(Boolean).join(", ");
|
|
866
|
-
return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
|
|
867
|
-
}
|
|
868
|
-
function asString(value, fallback = "") {
|
|
869
|
-
if (typeof value === "string") return value;
|
|
870
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
871
|
-
return fallback;
|
|
872
|
-
}
|
|
873
|
-
//#endregion
|
|
874
|
-
//#region src/tui/components/tool-execution.ts
|
|
875
|
-
const PREVIEW_LINES = 12;
|
|
876
|
-
function formatArgs(toolName, args) {
|
|
877
|
-
const detail = formatToolDetail(resolveToolDisplay({
|
|
878
|
-
name: toolName,
|
|
879
|
-
args
|
|
880
|
-
}));
|
|
881
|
-
if (detail) return sanitizeRenderableText(detail);
|
|
882
|
-
if (!args || typeof args !== "object") return "";
|
|
883
|
-
try {
|
|
884
|
-
return sanitizeRenderableText(JSON.stringify(args));
|
|
885
|
-
} catch {
|
|
886
|
-
return "";
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
function extractText(result) {
|
|
890
|
-
if (!result?.content) return "";
|
|
891
|
-
const lines = [];
|
|
892
|
-
for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(sanitizeRenderableText(entry.text));
|
|
893
|
-
else if (entry.type === "image") {
|
|
894
|
-
const mime = entry.mimeType ?? "image";
|
|
895
|
-
const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
|
|
896
|
-
const omitted = entry.omitted ? " (omitted)" : "";
|
|
897
|
-
lines.push(`[${mime}${size}${omitted}]`);
|
|
898
|
-
}
|
|
899
|
-
return lines.join("\n").trim();
|
|
900
|
-
}
|
|
901
|
-
var ToolExecutionComponent = class extends Container {
|
|
902
|
-
constructor(toolName, args) {
|
|
903
|
-
super();
|
|
904
|
-
this.expanded = false;
|
|
905
|
-
this.isError = false;
|
|
906
|
-
this.isPartial = true;
|
|
907
|
-
this.toolName = toolName;
|
|
908
|
-
this.args = args;
|
|
909
|
-
this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
|
|
910
|
-
this.header = new Text("", 0, 0);
|
|
911
|
-
this.argsLine = new Text("", 0, 0);
|
|
912
|
-
this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
|
|
913
|
-
this.addChild(new Spacer(1));
|
|
914
|
-
this.addChild(this.box);
|
|
915
|
-
this.box.addChild(this.header);
|
|
916
|
-
this.box.addChild(this.argsLine);
|
|
917
|
-
this.box.addChild(this.output);
|
|
918
|
-
this.refresh();
|
|
919
|
-
}
|
|
920
|
-
setArgs(args) {
|
|
921
|
-
this.args = args;
|
|
922
|
-
this.refresh();
|
|
923
|
-
}
|
|
924
|
-
setExpanded(expanded) {
|
|
925
|
-
this.expanded = expanded;
|
|
926
|
-
this.refresh();
|
|
927
|
-
}
|
|
928
|
-
setResult(result, opts) {
|
|
929
|
-
this.result = result;
|
|
930
|
-
this.isPartial = false;
|
|
931
|
-
this.isError = Boolean(opts?.isError);
|
|
932
|
-
this.refresh();
|
|
933
|
-
}
|
|
934
|
-
setPartialResult(result) {
|
|
935
|
-
this.result = result;
|
|
936
|
-
this.isPartial = true;
|
|
937
|
-
this.refresh();
|
|
938
|
-
}
|
|
939
|
-
refresh() {
|
|
940
|
-
const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
|
|
941
|
-
this.box.setBgFn((line) => bg(line));
|
|
942
|
-
const display = resolveToolDisplay({
|
|
943
|
-
name: this.toolName,
|
|
944
|
-
args: this.args
|
|
945
|
-
});
|
|
946
|
-
const title = `${display.emoji} ${display.label}${this.isPartial ? " (running)" : ""}`;
|
|
947
|
-
this.header.setText(theme.toolTitle(theme.bold(title)));
|
|
948
|
-
const argLine = formatArgs(this.toolName, this.args);
|
|
949
|
-
this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
|
|
950
|
-
const text = extractText(this.result) || (this.isPartial ? "…" : "");
|
|
951
|
-
if (!this.expanded && text) {
|
|
952
|
-
const lines = text.split("\n");
|
|
953
|
-
const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
|
|
954
|
-
this.output.setText(preview);
|
|
955
|
-
} else this.output.setText(text);
|
|
956
|
-
}
|
|
957
|
-
};
|
|
958
|
-
//#endregion
|
|
959
|
-
//#region src/tui/components/markdown-message.ts
|
|
960
|
-
var MarkdownMessageComponent = class extends Container {
|
|
961
|
-
constructor(text, y, options) {
|
|
962
|
-
super();
|
|
963
|
-
this.body = new HyperlinkMarkdown(text, 0, y, markdownTheme, options);
|
|
964
|
-
this.addChild(new Spacer(1));
|
|
965
|
-
this.addChild(this.body);
|
|
966
|
-
}
|
|
967
|
-
setText(text) {
|
|
968
|
-
this.body.setText(text);
|
|
969
|
-
}
|
|
970
|
-
};
|
|
971
|
-
//#endregion
|
|
972
|
-
//#region src/tui/components/user-message.ts
|
|
973
|
-
var UserMessageComponent = class extends MarkdownMessageComponent {
|
|
974
|
-
constructor(text) {
|
|
975
|
-
super(text, 1, {
|
|
976
|
-
bgColor: (line) => theme.userBg(line),
|
|
977
|
-
color: (line) => theme.userText(line)
|
|
978
|
-
});
|
|
979
|
-
}
|
|
980
|
-
};
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/tui/components/chat-log.ts
|
|
983
|
-
const PENDING_HISTORY_CLOCK_SKEW_TOLERANCE_MS = 6e4;
|
|
984
|
-
var ChatLog = class extends Container {
|
|
985
|
-
constructor(maxComponents = 180) {
|
|
986
|
-
super();
|
|
987
|
-
this.toolById = /* @__PURE__ */ new Map();
|
|
988
|
-
this.streamingRuns = /* @__PURE__ */ new Map();
|
|
989
|
-
this.pendingUsers = /* @__PURE__ */ new Map();
|
|
990
|
-
this.btwMessage = null;
|
|
991
|
-
this.toolsExpanded = false;
|
|
992
|
-
this.maxComponents = Math.max(20, Math.floor(maxComponents));
|
|
993
|
-
}
|
|
994
|
-
dropComponentReferences(component) {
|
|
995
|
-
for (const [toolId, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(toolId);
|
|
996
|
-
for (const [runId, message] of this.streamingRuns.entries()) if (message === component) this.streamingRuns.delete(runId);
|
|
997
|
-
for (const [runId, entry] of this.pendingUsers.entries()) if (entry.component === component) this.pendingUsers.delete(runId);
|
|
998
|
-
if (this.btwMessage === component) this.btwMessage = null;
|
|
999
|
-
}
|
|
1000
|
-
pruneOverflow() {
|
|
1001
|
-
while (this.children.length > this.maxComponents) {
|
|
1002
|
-
const oldest = this.children[0];
|
|
1003
|
-
if (!oldest) return;
|
|
1004
|
-
this.removeChild(oldest);
|
|
1005
|
-
this.dropComponentReferences(oldest);
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
append(component) {
|
|
1009
|
-
this.addChild(component);
|
|
1010
|
-
this.pruneOverflow();
|
|
1011
|
-
}
|
|
1012
|
-
clearAll(opts) {
|
|
1013
|
-
this.clear();
|
|
1014
|
-
this.toolById.clear();
|
|
1015
|
-
this.streamingRuns.clear();
|
|
1016
|
-
this.btwMessage = null;
|
|
1017
|
-
if (!opts?.preservePendingUsers) this.pendingUsers.clear();
|
|
1018
|
-
}
|
|
1019
|
-
restorePendingUsers() {
|
|
1020
|
-
for (const entry of this.pendingUsers.values()) {
|
|
1021
|
-
if (this.children.includes(entry.component)) continue;
|
|
1022
|
-
this.append(entry.component);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
clearPendingUsers() {
|
|
1026
|
-
for (const entry of this.pendingUsers.values()) this.removeChild(entry.component);
|
|
1027
|
-
this.pendingUsers.clear();
|
|
1028
|
-
}
|
|
1029
|
-
createSystemMessage(text) {
|
|
1030
|
-
const entry = new Container();
|
|
1031
|
-
entry.addChild(new Spacer(1));
|
|
1032
|
-
entry.addChild(new Text(theme.system(text), 1, 0));
|
|
1033
|
-
return entry;
|
|
1034
|
-
}
|
|
1035
|
-
addSystem(text) {
|
|
1036
|
-
this.append(this.createSystemMessage(text));
|
|
1037
|
-
}
|
|
1038
|
-
addUser(text) {
|
|
1039
|
-
this.append(new UserMessageComponent(text));
|
|
1040
|
-
}
|
|
1041
|
-
addPendingUser(runId, text, createdAt = Date.now()) {
|
|
1042
|
-
const existing = this.pendingUsers.get(runId);
|
|
1043
|
-
if (existing) {
|
|
1044
|
-
existing.text = text;
|
|
1045
|
-
existing.createdAt = createdAt;
|
|
1046
|
-
existing.component.setText(text);
|
|
1047
|
-
return existing.component;
|
|
1048
|
-
}
|
|
1049
|
-
const component = new UserMessageComponent(text);
|
|
1050
|
-
this.pendingUsers.set(runId, {
|
|
1051
|
-
component,
|
|
1052
|
-
text,
|
|
1053
|
-
createdAt
|
|
1054
|
-
});
|
|
1055
|
-
this.append(component);
|
|
1056
|
-
return component;
|
|
1057
|
-
}
|
|
1058
|
-
commitPendingUser(runId) {
|
|
1059
|
-
return this.pendingUsers.delete(runId);
|
|
1060
|
-
}
|
|
1061
|
-
dropPendingUser(runId) {
|
|
1062
|
-
const existing = this.pendingUsers.get(runId);
|
|
1063
|
-
if (!existing) return false;
|
|
1064
|
-
this.removeChild(existing.component);
|
|
1065
|
-
this.pendingUsers.delete(runId);
|
|
1066
|
-
return true;
|
|
1067
|
-
}
|
|
1068
|
-
hasPendingUser(runId) {
|
|
1069
|
-
return this.pendingUsers.has(runId);
|
|
1070
|
-
}
|
|
1071
|
-
reconcilePendingUsers(historyUsers) {
|
|
1072
|
-
const normalizedHistory = historyUsers.map((entry) => ({
|
|
1073
|
-
text: entry.text.trim(),
|
|
1074
|
-
timestamp: typeof entry.timestamp === "number" ? entry.timestamp : null
|
|
1075
|
-
})).filter((entry) => entry.text.length > 0 && entry.timestamp !== null);
|
|
1076
|
-
const clearedRunIds = [];
|
|
1077
|
-
for (const [runId, entry] of this.pendingUsers.entries()) {
|
|
1078
|
-
const pendingText = entry.text.trim();
|
|
1079
|
-
if (!pendingText) continue;
|
|
1080
|
-
const matchIndex = normalizedHistory.findIndex((historyEntry) => historyEntry.text === pendingText && (historyEntry.timestamp ?? 0) >= entry.createdAt - PENDING_HISTORY_CLOCK_SKEW_TOLERANCE_MS);
|
|
1081
|
-
if (matchIndex === -1) continue;
|
|
1082
|
-
if (this.children.includes(entry.component)) this.removeChild(entry.component);
|
|
1083
|
-
this.pendingUsers.delete(runId);
|
|
1084
|
-
clearedRunIds.push(runId);
|
|
1085
|
-
normalizedHistory.splice(matchIndex, 1);
|
|
1086
|
-
}
|
|
1087
|
-
return clearedRunIds;
|
|
1088
|
-
}
|
|
1089
|
-
countPendingUsers() {
|
|
1090
|
-
return this.pendingUsers.size;
|
|
1091
|
-
}
|
|
1092
|
-
resolveRunId(runId) {
|
|
1093
|
-
return runId ?? "default";
|
|
1094
|
-
}
|
|
1095
|
-
startAssistant(text, runId) {
|
|
1096
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1097
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1098
|
-
if (existing) {
|
|
1099
|
-
existing.setText(text);
|
|
1100
|
-
return existing;
|
|
1101
|
-
}
|
|
1102
|
-
const component = new AssistantMessageComponent(text);
|
|
1103
|
-
this.streamingRuns.set(effectiveRunId, component);
|
|
1104
|
-
this.append(component);
|
|
1105
|
-
return component;
|
|
1106
|
-
}
|
|
1107
|
-
updateAssistant(text, runId) {
|
|
1108
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1109
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1110
|
-
if (!existing) {
|
|
1111
|
-
this.startAssistant(text, runId);
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
existing.setText(text);
|
|
1115
|
-
}
|
|
1116
|
-
finalizeAssistant(text, runId) {
|
|
1117
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1118
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1119
|
-
if (existing) {
|
|
1120
|
-
existing.setText(text);
|
|
1121
|
-
this.streamingRuns.delete(effectiveRunId);
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
this.append(new AssistantMessageComponent(text));
|
|
1125
|
-
}
|
|
1126
|
-
dropAssistant(runId) {
|
|
1127
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1128
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1129
|
-
if (!existing) return;
|
|
1130
|
-
this.removeChild(existing);
|
|
1131
|
-
this.streamingRuns.delete(effectiveRunId);
|
|
1132
|
-
}
|
|
1133
|
-
showBtw(params) {
|
|
1134
|
-
if (this.btwMessage) {
|
|
1135
|
-
this.btwMessage.setResult(params);
|
|
1136
|
-
if (this.children[this.children.length - 1] !== this.btwMessage) {
|
|
1137
|
-
this.removeChild(this.btwMessage);
|
|
1138
|
-
this.append(this.btwMessage);
|
|
1139
|
-
}
|
|
1140
|
-
return this.btwMessage;
|
|
1141
|
-
}
|
|
1142
|
-
const component = new BtwInlineMessage(params);
|
|
1143
|
-
this.btwMessage = component;
|
|
1144
|
-
this.append(component);
|
|
1145
|
-
return component;
|
|
1146
|
-
}
|
|
1147
|
-
dismissBtw() {
|
|
1148
|
-
if (!this.btwMessage) return;
|
|
1149
|
-
this.removeChild(this.btwMessage);
|
|
1150
|
-
this.btwMessage = null;
|
|
1151
|
-
}
|
|
1152
|
-
hasVisibleBtw() {
|
|
1153
|
-
return this.btwMessage !== null;
|
|
1154
|
-
}
|
|
1155
|
-
startTool(toolCallId, toolName, args) {
|
|
1156
|
-
const existing = this.toolById.get(toolCallId);
|
|
1157
|
-
if (existing) {
|
|
1158
|
-
existing.setArgs(args);
|
|
1159
|
-
return existing;
|
|
1160
|
-
}
|
|
1161
|
-
const component = new ToolExecutionComponent(toolName, args);
|
|
1162
|
-
component.setExpanded(this.toolsExpanded);
|
|
1163
|
-
this.toolById.set(toolCallId, component);
|
|
1164
|
-
this.append(component);
|
|
1165
|
-
return component;
|
|
1166
|
-
}
|
|
1167
|
-
updateToolArgs(toolCallId, args) {
|
|
1168
|
-
const existing = this.toolById.get(toolCallId);
|
|
1169
|
-
if (!existing) return;
|
|
1170
|
-
existing.setArgs(args);
|
|
1171
|
-
}
|
|
1172
|
-
updateToolResult(toolCallId, result, opts) {
|
|
1173
|
-
const existing = this.toolById.get(toolCallId);
|
|
1174
|
-
if (!existing) return;
|
|
1175
|
-
if (opts?.partial) {
|
|
1176
|
-
existing.setPartialResult(result);
|
|
1177
|
-
return;
|
|
1178
|
-
}
|
|
1179
|
-
existing.setResult(result, { isError: opts?.isError });
|
|
1180
|
-
}
|
|
1181
|
-
setToolsExpanded(expanded) {
|
|
1182
|
-
this.toolsExpanded = expanded;
|
|
1183
|
-
for (const tool of this.toolById.values()) tool.setExpanded(expanded);
|
|
1184
|
-
}
|
|
1185
|
-
};
|
|
1186
|
-
//#endregion
|
|
1187
|
-
//#region src/tui/components/custom-editor.ts
|
|
1188
|
-
var CustomEditor = class extends Editor {
|
|
1189
|
-
handleInput(data) {
|
|
1190
|
-
if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
|
|
1191
|
-
this.onAltEnter();
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
if (matchesKey(data, Key.alt("up")) && this.onAltUp) {
|
|
1195
|
-
this.onAltUp();
|
|
1196
|
-
return;
|
|
1197
|
-
}
|
|
1198
|
-
if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
|
|
1199
|
-
this.onCtrlL();
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
|
|
1203
|
-
this.onCtrlO();
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
|
|
1207
|
-
this.onCtrlP();
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
|
|
1211
|
-
this.onCtrlG();
|
|
1212
|
-
return;
|
|
1213
|
-
}
|
|
1214
|
-
if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
|
|
1215
|
-
this.onCtrlT();
|
|
1216
|
-
return;
|
|
1217
|
-
}
|
|
1218
|
-
if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
|
|
1219
|
-
this.onShiftTab();
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
|
|
1223
|
-
this.onEscape();
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
|
|
1227
|
-
this.onCtrlC();
|
|
1228
|
-
return;
|
|
1229
|
-
}
|
|
1230
|
-
if (matchesKey(data, Key.ctrl("d"))) {
|
|
1231
|
-
if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
super.handleInput(data);
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
//#endregion
|
|
1238
|
-
//#region src/tui/embedded-backend.ts
|
|
1239
|
-
const silentRuntime = {
|
|
1240
|
-
log: (..._args) => void 0,
|
|
1241
|
-
error: (..._args) => void 0,
|
|
1242
|
-
exit: (code) => {
|
|
1243
|
-
throw new Error(`embedded tui runtime exit ${String(code)}`);
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
function isSilentReplyLeadFragment(text) {
|
|
1247
|
-
const normalized = text.trim().toUpperCase();
|
|
1248
|
-
if (!normalized) return false;
|
|
1249
|
-
if (!/^[A-Z_]+$/.test(normalized)) return false;
|
|
1250
|
-
if (normalized === "NO_REPLY") return false;
|
|
1251
|
-
return SILENT_REPLY_TOKEN.startsWith(normalized);
|
|
1252
|
-
}
|
|
1253
|
-
function appendUniqueSuffix(base, suffix) {
|
|
1254
|
-
if (!suffix) return base;
|
|
1255
|
-
if (!base) return suffix;
|
|
1256
|
-
if (base.endsWith(suffix)) return base;
|
|
1257
|
-
const maxOverlap = Math.min(base.length, suffix.length);
|
|
1258
|
-
for (let overlap = maxOverlap; overlap > 0; overlap -= 1) if (base.slice(-overlap) === suffix.slice(0, overlap)) return base + suffix.slice(overlap);
|
|
1259
|
-
return base + suffix;
|
|
1260
|
-
}
|
|
1261
|
-
function resolveMergedAssistantText(params) {
|
|
1262
|
-
const previous = params.previousText;
|
|
1263
|
-
const next = params.nextText;
|
|
1264
|
-
const delta = params.nextDelta;
|
|
1265
|
-
if (!previous) return next || delta;
|
|
1266
|
-
if (next && next.startsWith(previous)) return next;
|
|
1267
|
-
if (delta) return appendUniqueSuffix(previous, delta);
|
|
1268
|
-
return appendUniqueSuffix(previous, next);
|
|
1269
|
-
}
|
|
1270
|
-
function resolveBtwQuestion(message) {
|
|
1271
|
-
const question = /^\/btw(?::|\s)+(.*)$/i.exec(message.trim())?.[1]?.trim();
|
|
1272
|
-
return question ? question : void 0;
|
|
1273
|
-
}
|
|
1274
|
-
function payloadText(parts) {
|
|
1275
|
-
if (!Array.isArray(parts)) return "";
|
|
1276
|
-
return parts.map((part) => {
|
|
1277
|
-
if (!part || typeof part !== "object") return "";
|
|
1278
|
-
const payload = part;
|
|
1279
|
-
return typeof payload.text === "string" ? payload.text.trim() : "";
|
|
1280
|
-
}).filter(Boolean).join("\n\n").trim();
|
|
1281
|
-
}
|
|
1282
|
-
function timeoutSecondsFromMs(timeoutMs) {
|
|
1283
|
-
if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs < 0) return;
|
|
1284
|
-
return String(Math.max(0, Math.ceil(timeoutMs / 1e3)));
|
|
1285
|
-
}
|
|
1286
|
-
var EmbeddedTuiBackend = class {
|
|
1287
|
-
constructor() {
|
|
1288
|
-
this.connection = { url: "local embedded" };
|
|
1289
|
-
this.deps = createDefaultDeps();
|
|
1290
|
-
this.runs = /* @__PURE__ */ new Map();
|
|
1291
|
-
this.seq = 0;
|
|
1292
|
-
}
|
|
1293
|
-
start() {
|
|
1294
|
-
if (this.unsubscribe) return;
|
|
1295
|
-
setEmbeddedMode(true);
|
|
1296
|
-
this.previousRuntimeLog = defaultRuntime.log;
|
|
1297
|
-
this.previousRuntimeError = defaultRuntime.error;
|
|
1298
|
-
defaultRuntime.log = silentRuntime.log;
|
|
1299
|
-
defaultRuntime.error = silentRuntime.error;
|
|
1300
|
-
this.unsubscribe = onAgentEvent((evt) => {
|
|
1301
|
-
this.handleAgentEvent(evt);
|
|
1302
|
-
});
|
|
1303
|
-
queueMicrotask(() => {
|
|
1304
|
-
this.onConnected?.();
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
stop() {
|
|
1308
|
-
this.unsubscribe?.();
|
|
1309
|
-
this.unsubscribe = void 0;
|
|
1310
|
-
for (const run of this.runs.values()) run.controller.abort();
|
|
1311
|
-
this.runs.clear();
|
|
1312
|
-
defaultRuntime.log = this.previousRuntimeLog ?? defaultRuntime.log;
|
|
1313
|
-
defaultRuntime.error = this.previousRuntimeError ?? defaultRuntime.error;
|
|
1314
|
-
this.previousRuntimeLog = void 0;
|
|
1315
|
-
this.previousRuntimeError = void 0;
|
|
1316
|
-
setEmbeddedMode(false);
|
|
1317
|
-
}
|
|
1318
|
-
async sendChat(opts) {
|
|
1319
|
-
const runId = opts.runId ?? randomUUID();
|
|
1320
|
-
const question = resolveBtwQuestion(opts.message);
|
|
1321
|
-
if (!question) this.abortSessionRuns(opts.sessionKey);
|
|
1322
|
-
const controller = new AbortController();
|
|
1323
|
-
this.runs.set(runId, {
|
|
1324
|
-
sessionKey: opts.sessionKey,
|
|
1325
|
-
controller,
|
|
1326
|
-
buffer: "",
|
|
1327
|
-
isBtw: Boolean(question),
|
|
1328
|
-
question,
|
|
1329
|
-
finalSent: false,
|
|
1330
|
-
registered: false
|
|
1331
|
-
});
|
|
1332
|
-
this.runTurn({
|
|
1333
|
-
runId,
|
|
1334
|
-
sessionKey: opts.sessionKey,
|
|
1335
|
-
message: opts.message,
|
|
1336
|
-
thinking: opts.thinking,
|
|
1337
|
-
deliver: opts.deliver,
|
|
1338
|
-
timeoutMs: opts.timeoutMs,
|
|
1339
|
-
controller
|
|
1340
|
-
});
|
|
1341
|
-
return { runId };
|
|
1342
|
-
}
|
|
1343
|
-
async abortChat(opts) {
|
|
1344
|
-
const run = this.runs.get(opts.runId);
|
|
1345
|
-
if (!run || run.sessionKey !== opts.sessionKey) return {
|
|
1346
|
-
ok: true,
|
|
1347
|
-
aborted: false
|
|
1348
|
-
};
|
|
1349
|
-
run.controller.abort();
|
|
1350
|
-
return {
|
|
1351
|
-
ok: true,
|
|
1352
|
-
aborted: true
|
|
1353
|
-
};
|
|
1354
|
-
}
|
|
1355
|
-
async loadHistory(opts) {
|
|
1356
|
-
const { cfg, storePath, entry } = loadSessionEntry(opts.sessionKey);
|
|
1357
|
-
const sessionId = entry?.sessionId;
|
|
1358
|
-
const resolvedSessionModel = resolveSessionModelRef(cfg, entry, resolveSessionAgentId({
|
|
1359
|
-
sessionKey: opts.sessionKey,
|
|
1360
|
-
config: cfg
|
|
1361
|
-
}));
|
|
1362
|
-
const localMessages = sessionId && storePath ? readSessionMessages(sessionId, storePath, entry?.sessionFile) : [];
|
|
1363
|
-
const rawMessages = augmentChatHistoryWithCliSessionImports({
|
|
1364
|
-
entry,
|
|
1365
|
-
provider: resolvedSessionModel.provider,
|
|
1366
|
-
localMessages
|
|
1367
|
-
});
|
|
1368
|
-
const max = Math.min(1e3, typeof opts.limit === "number" ? opts.limit : 200);
|
|
1369
|
-
const sliced = rawMessages.length > max ? rawMessages.slice(-max) : rawMessages;
|
|
1370
|
-
const effectiveMaxChars = resolveEffectiveChatHistoryMaxChars(cfg);
|
|
1371
|
-
const normalized = augmentChatHistoryWithCanvasBlocks(sanitizeChatHistoryMessages(stripEnvelopeFromMessages(sliced), effectiveMaxChars));
|
|
1372
|
-
const maxHistoryBytes = getMaxChatHistoryMessagesBytes();
|
|
1373
|
-
const capped = capArrayByJsonBytes(replaceOversizedChatHistoryMessages({
|
|
1374
|
-
messages: normalized,
|
|
1375
|
-
maxSingleMessageBytes: Math.min(CHAT_HISTORY_MAX_SINGLE_MESSAGE_BYTES, maxHistoryBytes)
|
|
1376
|
-
}).messages, maxHistoryBytes).items;
|
|
1377
|
-
const messages = enforceChatHistoryFinalBudget({
|
|
1378
|
-
messages: capped,
|
|
1379
|
-
maxBytes: maxHistoryBytes
|
|
1380
|
-
}).messages;
|
|
1381
|
-
let thinkingLevel = entry?.thinkingLevel;
|
|
1382
|
-
if (!thinkingLevel) {
|
|
1383
|
-
const catalog = await loadGatewayModelCatalog();
|
|
1384
|
-
thinkingLevel = resolveThinkingDefault({
|
|
1385
|
-
cfg,
|
|
1386
|
-
provider: resolvedSessionModel.provider,
|
|
1387
|
-
model: resolvedSessionModel.model,
|
|
1388
|
-
catalog
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
return {
|
|
1392
|
-
sessionKey: opts.sessionKey,
|
|
1393
|
-
sessionId,
|
|
1394
|
-
messages,
|
|
1395
|
-
thinkingLevel,
|
|
1396
|
-
fastMode: entry?.fastMode,
|
|
1397
|
-
verboseLevel: entry?.verboseLevel ?? cfg.agents?.defaults?.verboseDefault
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
async listSessions(opts) {
|
|
1401
|
-
const cfg = loadConfig();
|
|
1402
|
-
const { storePath, store } = loadCombinedSessionStoreForGateway(cfg);
|
|
1403
|
-
return listSessionsFromStore({
|
|
1404
|
-
cfg,
|
|
1405
|
-
storePath,
|
|
1406
|
-
store,
|
|
1407
|
-
opts: opts ?? {}
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
async listAgents() {
|
|
1411
|
-
return listAgentsForGateway(loadConfig());
|
|
1412
|
-
}
|
|
1413
|
-
async patchSession(opts) {
|
|
1414
|
-
const cfg = loadConfig();
|
|
1415
|
-
const target = resolveGatewaySessionStoreTarget({
|
|
1416
|
-
cfg,
|
|
1417
|
-
key: opts.key
|
|
1418
|
-
});
|
|
1419
|
-
const applied = await updateSessionStore(target.storePath, async (store) => {
|
|
1420
|
-
const { primaryKey } = migrateAndPruneGatewaySessionStoreKey({
|
|
1421
|
-
cfg,
|
|
1422
|
-
key: opts.key,
|
|
1423
|
-
store
|
|
1424
|
-
});
|
|
1425
|
-
return await applySessionsPatchToStore({
|
|
1426
|
-
cfg,
|
|
1427
|
-
store,
|
|
1428
|
-
storeKey: primaryKey,
|
|
1429
|
-
patch: opts,
|
|
1430
|
-
loadGatewayModelCatalog
|
|
1431
|
-
});
|
|
1432
|
-
});
|
|
1433
|
-
if (!applied.ok) throw new Error(applied.error.message);
|
|
1434
|
-
const agentId = resolveSessionAgentId({
|
|
1435
|
-
sessionKey: target.canonicalKey ?? opts.key,
|
|
1436
|
-
config: cfg
|
|
1437
|
-
});
|
|
1438
|
-
const resolved = resolveSessionModelRef(cfg, applied.entry, agentId);
|
|
1439
|
-
return {
|
|
1440
|
-
ok: true,
|
|
1441
|
-
path: target.storePath,
|
|
1442
|
-
key: target.canonicalKey ?? opts.key,
|
|
1443
|
-
entry: applied.entry,
|
|
1444
|
-
resolved: {
|
|
1445
|
-
modelProvider: resolved.provider,
|
|
1446
|
-
model: resolved.model
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
async resetSession(key, reason) {
|
|
1451
|
-
const result = await performGatewaySessionReset({
|
|
1452
|
-
key,
|
|
1453
|
-
reason: reason === "new" ? "new" : "reset",
|
|
1454
|
-
commandSource: "tui:embedded"
|
|
1455
|
-
});
|
|
1456
|
-
if (!result.ok) throw new Error(result.error.message);
|
|
1457
|
-
return {
|
|
1458
|
-
ok: true,
|
|
1459
|
-
key: result.key,
|
|
1460
|
-
entry: result.entry
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
async getGatewayStatus() {
|
|
1464
|
-
return `local embedded mode${this.runs.size > 0 ? ` (${String(this.runs.size)} active run${this.runs.size === 1 ? "" : "s"})` : ""}`;
|
|
1465
|
-
}
|
|
1466
|
-
async listModels() {
|
|
1467
|
-
const catalog = await loadGatewayModelCatalog();
|
|
1468
|
-
const { allowedCatalog } = buildAllowedModelSet({
|
|
1469
|
-
cfg: loadConfig(),
|
|
1470
|
-
catalog,
|
|
1471
|
-
defaultProvider: DEFAULT_PROVIDER
|
|
1472
|
-
});
|
|
1473
|
-
return (allowedCatalog.length > 0 ? allowedCatalog : catalog).map((entry) => ({
|
|
1474
|
-
id: entry.id,
|
|
1475
|
-
name: entry.name ?? entry.id,
|
|
1476
|
-
provider: entry.provider,
|
|
1477
|
-
contextWindow: entry.contextWindow,
|
|
1478
|
-
reasoning: entry.reasoning
|
|
1479
|
-
}));
|
|
1480
|
-
}
|
|
1481
|
-
abortSessionRuns(sessionKey) {
|
|
1482
|
-
for (const run of this.runs.values()) if (run.sessionKey === sessionKey && !run.isBtw) run.controller.abort();
|
|
1483
|
-
}
|
|
1484
|
-
nextSeq() {
|
|
1485
|
-
this.seq += 1;
|
|
1486
|
-
return this.seq;
|
|
1487
|
-
}
|
|
1488
|
-
emit(event, payload) {
|
|
1489
|
-
this.onEvent?.({
|
|
1490
|
-
event,
|
|
1491
|
-
payload,
|
|
1492
|
-
seq: this.nextSeq()
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
emitChatDelta(runId, run) {
|
|
1496
|
-
const text = run.buffer.trim();
|
|
1497
|
-
if (!text || isSilentReplyText(text, "NO_REPLY") || isSilentReplyLeadFragment(text)) return;
|
|
1498
|
-
run.registered = true;
|
|
1499
|
-
this.emit("chat", {
|
|
1500
|
-
runId,
|
|
1501
|
-
sessionKey: run.sessionKey,
|
|
1502
|
-
state: "delta",
|
|
1503
|
-
message: {
|
|
1504
|
-
role: "assistant",
|
|
1505
|
-
content: [{
|
|
1506
|
-
type: "text",
|
|
1507
|
-
text
|
|
1508
|
-
}],
|
|
1509
|
-
timestamp: Date.now()
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
emitChatFinal(runId, run, stopReason) {
|
|
1514
|
-
if (run.finalSent) return;
|
|
1515
|
-
run.finalSent = true;
|
|
1516
|
-
run.registered = true;
|
|
1517
|
-
const text = run.buffer.trim();
|
|
1518
|
-
const shouldIncludeMessage = Boolean(text) && !isSilentReplyText(text, "NO_REPLY") && !isSilentReplyLeadFragment(text);
|
|
1519
|
-
this.emit("chat", {
|
|
1520
|
-
runId,
|
|
1521
|
-
sessionKey: run.sessionKey,
|
|
1522
|
-
state: "final",
|
|
1523
|
-
...stopReason ? { stopReason } : {},
|
|
1524
|
-
...shouldIncludeMessage ? { message: {
|
|
1525
|
-
role: "assistant",
|
|
1526
|
-
content: [{
|
|
1527
|
-
type: "text",
|
|
1528
|
-
text
|
|
1529
|
-
}],
|
|
1530
|
-
timestamp: Date.now()
|
|
1531
|
-
} } : {}
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
emitChatAborted(runId, run) {
|
|
1535
|
-
if (run.finalSent) return;
|
|
1536
|
-
run.finalSent = true;
|
|
1537
|
-
run.registered = true;
|
|
1538
|
-
this.emit("chat", {
|
|
1539
|
-
runId,
|
|
1540
|
-
sessionKey: run.sessionKey,
|
|
1541
|
-
state: "aborted"
|
|
1542
|
-
});
|
|
1543
|
-
}
|
|
1544
|
-
emitChatError(runId, run, errorMessage) {
|
|
1545
|
-
if (run.finalSent) return;
|
|
1546
|
-
run.finalSent = true;
|
|
1547
|
-
run.registered = true;
|
|
1548
|
-
this.emit("chat", {
|
|
1549
|
-
runId,
|
|
1550
|
-
sessionKey: run.sessionKey,
|
|
1551
|
-
state: "error",
|
|
1552
|
-
...errorMessage ? { errorMessage } : {}
|
|
1553
|
-
});
|
|
1554
|
-
}
|
|
1555
|
-
ensureRunRegistered(runId, run) {
|
|
1556
|
-
if (run.registered || run.isBtw) return;
|
|
1557
|
-
run.registered = true;
|
|
1558
|
-
this.emit("chat", {
|
|
1559
|
-
runId,
|
|
1560
|
-
sessionKey: run.sessionKey,
|
|
1561
|
-
state: "delta",
|
|
1562
|
-
message: {
|
|
1563
|
-
role: "assistant",
|
|
1564
|
-
content: [{
|
|
1565
|
-
type: "text",
|
|
1566
|
-
text: ""
|
|
1567
|
-
}],
|
|
1568
|
-
timestamp: Date.now()
|
|
1569
|
-
}
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
async handleAgentEvent(evt) {
|
|
1573
|
-
const run = this.runs.get(evt.runId);
|
|
1574
|
-
if (!run) return;
|
|
1575
|
-
if (evt.stream !== "assistant") this.ensureRunRegistered(evt.runId, run);
|
|
1576
|
-
this.emit("agent", {
|
|
1577
|
-
runId: evt.runId,
|
|
1578
|
-
stream: evt.stream,
|
|
1579
|
-
data: evt.data
|
|
1580
|
-
});
|
|
1581
|
-
if (evt.stream === "assistant" && !run.isBtw && typeof evt.data?.text === "string") {
|
|
1582
|
-
const nextText = stripInlineDirectiveTagsForDisplay(evt.data.text).text;
|
|
1583
|
-
const nextDelta = typeof evt.data?.delta === "string" ? stripInlineDirectiveTagsForDisplay(evt.data.delta).text : "";
|
|
1584
|
-
run.buffer = resolveMergedAssistantText({
|
|
1585
|
-
previousText: run.buffer,
|
|
1586
|
-
nextText,
|
|
1587
|
-
nextDelta
|
|
1588
|
-
});
|
|
1589
|
-
this.emitChatDelta(evt.runId, run);
|
|
1590
|
-
return;
|
|
1591
|
-
}
|
|
1592
|
-
if (evt.stream !== "lifecycle") return;
|
|
1593
|
-
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
1594
|
-
const aborted = evt.data?.aborted === true || run.controller.signal.aborted;
|
|
1595
|
-
if (phase === "end") {
|
|
1596
|
-
if (aborted) {
|
|
1597
|
-
this.emitChatAborted(evt.runId, run);
|
|
1598
|
-
return;
|
|
1599
|
-
}
|
|
1600
|
-
if (!run.isBtw) {
|
|
1601
|
-
const stopReason = typeof evt.data?.stopReason === "string" ? evt.data.stopReason : void 0;
|
|
1602
|
-
this.emitChatFinal(evt.runId, run, stopReason);
|
|
1603
|
-
}
|
|
1604
|
-
return;
|
|
1605
|
-
}
|
|
1606
|
-
if (phase === "error") {
|
|
1607
|
-
if (aborted) {
|
|
1608
|
-
this.emitChatAborted(evt.runId, run);
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
const errorMessage = typeof evt.data?.error === "string" ? evt.data.error : void 0;
|
|
1612
|
-
this.emitChatError(evt.runId, run, errorMessage);
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
async runTurn(params) {
|
|
1616
|
-
try {
|
|
1617
|
-
const { cfg, canonicalKey, entry } = loadSessionEntry(params.sessionKey);
|
|
1618
|
-
const result = await agentCommandFromIngress({
|
|
1619
|
-
message: injectTimestamp(params.message, timestampOptsFromConfig(cfg)),
|
|
1620
|
-
sessionKey: canonicalKey,
|
|
1621
|
-
...entry?.sessionId ? { sessionId: entry.sessionId } : {},
|
|
1622
|
-
thinking: params.thinking,
|
|
1623
|
-
deliver: params.deliver,
|
|
1624
|
-
channel: INTERNAL_MESSAGE_CHANNEL,
|
|
1625
|
-
runContext: { messageChannel: INTERNAL_MESSAGE_CHANNEL },
|
|
1626
|
-
timeout: timeoutSecondsFromMs(params.timeoutMs),
|
|
1627
|
-
runId: params.runId,
|
|
1628
|
-
abortSignal: params.controller.signal,
|
|
1629
|
-
senderIsOwner: true,
|
|
1630
|
-
allowModelOverride: false
|
|
1631
|
-
}, silentRuntime, this.deps);
|
|
1632
|
-
const run = this.runs.get(params.runId);
|
|
1633
|
-
if (!run) return;
|
|
1634
|
-
if (run.isBtw) {
|
|
1635
|
-
const text = payloadText(result?.payloads);
|
|
1636
|
-
if (run.question && text) this.emit("chat.side_result", {
|
|
1637
|
-
kind: "btw",
|
|
1638
|
-
runId: params.runId,
|
|
1639
|
-
sessionKey: run.sessionKey,
|
|
1640
|
-
question: run.question,
|
|
1641
|
-
text
|
|
1642
|
-
});
|
|
1643
|
-
this.emitChatFinal(params.runId, run);
|
|
1644
|
-
return;
|
|
1645
|
-
}
|
|
1646
|
-
if (!run.finalSent) {
|
|
1647
|
-
const normalizedText = payloadText(result?.payloads);
|
|
1648
|
-
if (normalizedText && !run.buffer) run.buffer = normalizedText;
|
|
1649
|
-
this.emitChatFinal(params.runId, run);
|
|
1650
|
-
}
|
|
1651
|
-
} catch (error) {
|
|
1652
|
-
const run = this.runs.get(params.runId);
|
|
1653
|
-
if (!run) return;
|
|
1654
|
-
if (params.controller.signal.aborted) {
|
|
1655
|
-
this.emitChatAborted(params.runId, run);
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1659
|
-
this.emitChatError(params.runId, run, errorMessage);
|
|
1660
|
-
} finally {
|
|
1661
|
-
this.runs.delete(params.runId);
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
//#endregion
|
|
1666
|
-
//#region src/tui/gateway-chat.ts
|
|
1667
|
-
const STARTUP_CHAT_HISTORY_RETRY_TIMEOUT_MS = 6e4;
|
|
1668
|
-
const STARTUP_CHAT_HISTORY_DEFAULT_RETRY_MS = 500;
|
|
1669
|
-
const STARTUP_CHAT_HISTORY_MAX_RETRY_MS = 5e3;
|
|
1670
|
-
function throwGatewayAuthResolutionError(reason) {
|
|
1671
|
-
throw new Error([
|
|
1672
|
-
reason,
|
|
1673
|
-
"Fix: set GENESIS_GATEWAY_TOKEN/GENESIS_GATEWAY_PASSWORD, pass --token/--password,",
|
|
1674
|
-
"or resolve the configured secret provider for this credential."
|
|
1675
|
-
].join("\n"));
|
|
1676
|
-
}
|
|
1677
|
-
function isRetryableStartupUnavailable(err, method) {
|
|
1678
|
-
if (!(err instanceof GatewayClientRequestError)) return false;
|
|
1679
|
-
if (err.gatewayCode !== "UNAVAILABLE" || !err.retryable) return false;
|
|
1680
|
-
const details = err.details;
|
|
1681
|
-
if (!details || typeof details !== "object") return true;
|
|
1682
|
-
const detailMethod = details.method;
|
|
1683
|
-
return typeof detailMethod !== "string" || detailMethod === method;
|
|
1684
|
-
}
|
|
1685
|
-
function resolveStartupRetryDelayMs(err) {
|
|
1686
|
-
const retryAfterMs = typeof err.retryAfterMs === "number" ? err.retryAfterMs : STARTUP_CHAT_HISTORY_DEFAULT_RETRY_MS;
|
|
1687
|
-
return Math.min(Math.max(retryAfterMs, 100), STARTUP_CHAT_HISTORY_MAX_RETRY_MS);
|
|
1688
|
-
}
|
|
1689
|
-
function sleep(ms) {
|
|
1690
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1691
|
-
}
|
|
1692
|
-
var GatewayChatClient = class GatewayChatClient {
|
|
1693
|
-
constructor(connection) {
|
|
1694
|
-
this.connection = connection;
|
|
1695
|
-
this.readyPromise = new Promise((resolve) => {
|
|
1696
|
-
this.resolveReady = resolve;
|
|
1697
|
-
});
|
|
1698
|
-
this.client = new GatewayClient({
|
|
1699
|
-
url: connection.url,
|
|
1700
|
-
token: connection.token,
|
|
1701
|
-
password: connection.password,
|
|
1702
|
-
clientName: GATEWAY_CLIENT_NAMES.TUI,
|
|
1703
|
-
clientDisplayName: "genesis-tui",
|
|
1704
|
-
clientVersion: VERSION,
|
|
1705
|
-
platform: process.platform,
|
|
1706
|
-
mode: GATEWAY_CLIENT_MODES.UI,
|
|
1707
|
-
deviceIdentity: connection.allowInsecureLocalOperatorUi ? null : void 0,
|
|
1708
|
-
caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
|
|
1709
|
-
instanceId: randomUUID(),
|
|
1710
|
-
minProtocol: 4,
|
|
1711
|
-
maxProtocol: 4,
|
|
1712
|
-
onHelloOk: (hello) => {
|
|
1713
|
-
this.hello = hello;
|
|
1714
|
-
this.resolveReady?.();
|
|
1715
|
-
this.onConnected?.();
|
|
1716
|
-
},
|
|
1717
|
-
onEvent: (evt) => {
|
|
1718
|
-
this.onEvent?.({
|
|
1719
|
-
event: evt.event,
|
|
1720
|
-
payload: evt.payload,
|
|
1721
|
-
seq: evt.seq
|
|
1722
|
-
});
|
|
1723
|
-
},
|
|
1724
|
-
onClose: (_code, reason) => {
|
|
1725
|
-
this.readyPromise = new Promise((resolve) => {
|
|
1726
|
-
this.resolveReady = resolve;
|
|
1727
|
-
});
|
|
1728
|
-
this.onDisconnected?.(reason);
|
|
1729
|
-
},
|
|
1730
|
-
onGap: (info) => {
|
|
1731
|
-
this.onGap?.(info);
|
|
1732
|
-
}
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
static async connect(opts) {
|
|
1736
|
-
return new GatewayChatClient(await resolveGatewayConnection(opts));
|
|
1737
|
-
}
|
|
1738
|
-
start() {
|
|
1739
|
-
this.client.start();
|
|
1740
|
-
}
|
|
1741
|
-
stop() {
|
|
1742
|
-
this.client.stop();
|
|
1743
|
-
}
|
|
1744
|
-
async waitForReady() {
|
|
1745
|
-
await this.readyPromise;
|
|
1746
|
-
}
|
|
1747
|
-
async sendChat(opts) {
|
|
1748
|
-
const runId = opts.runId ?? randomUUID();
|
|
1749
|
-
await this.client.request("chat.send", {
|
|
1750
|
-
sessionKey: opts.sessionKey,
|
|
1751
|
-
message: opts.message,
|
|
1752
|
-
thinking: opts.thinking,
|
|
1753
|
-
deliver: opts.deliver,
|
|
1754
|
-
timeoutMs: opts.timeoutMs,
|
|
1755
|
-
idempotencyKey: runId
|
|
1756
|
-
});
|
|
1757
|
-
return { runId };
|
|
1758
|
-
}
|
|
1759
|
-
async abortChat(opts) {
|
|
1760
|
-
return await this.client.request("chat.abort", {
|
|
1761
|
-
sessionKey: opts.sessionKey,
|
|
1762
|
-
runId: opts.runId
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
async loadHistory(opts) {
|
|
1766
|
-
const startedAt = Date.now();
|
|
1767
|
-
for (;;) try {
|
|
1768
|
-
return await this.client.request("chat.history", {
|
|
1769
|
-
sessionKey: opts.sessionKey,
|
|
1770
|
-
limit: opts.limit
|
|
1771
|
-
});
|
|
1772
|
-
} catch (err) {
|
|
1773
|
-
if (Date.now() - startedAt < STARTUP_CHAT_HISTORY_RETRY_TIMEOUT_MS && isRetryableStartupUnavailable(err, "chat.history")) {
|
|
1774
|
-
await sleep(resolveStartupRetryDelayMs(err));
|
|
1775
|
-
continue;
|
|
1776
|
-
}
|
|
1777
|
-
throw err;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
async listSessions(opts) {
|
|
1781
|
-
return await this.client.request("sessions.list", {
|
|
1782
|
-
limit: opts?.limit,
|
|
1783
|
-
activeMinutes: opts?.activeMinutes,
|
|
1784
|
-
includeGlobal: opts?.includeGlobal,
|
|
1785
|
-
includeUnknown: opts?.includeUnknown,
|
|
1786
|
-
includeDerivedTitles: opts?.includeDerivedTitles,
|
|
1787
|
-
includeLastMessage: opts?.includeLastMessage,
|
|
1788
|
-
agentId: opts?.agentId
|
|
1789
|
-
});
|
|
1790
|
-
}
|
|
1791
|
-
async listAgents() {
|
|
1792
|
-
return await this.client.request("agents.list", {});
|
|
1793
|
-
}
|
|
1794
|
-
async patchSession(opts) {
|
|
1795
|
-
return await this.client.request("sessions.patch", opts);
|
|
1796
|
-
}
|
|
1797
|
-
async resetSession(key, reason) {
|
|
1798
|
-
return await this.client.request("sessions.reset", {
|
|
1799
|
-
key,
|
|
1800
|
-
...reason ? { reason } : {}
|
|
1801
|
-
});
|
|
1802
|
-
}
|
|
1803
|
-
async getGatewayStatus() {
|
|
1804
|
-
return await this.client.request("status");
|
|
1805
|
-
}
|
|
1806
|
-
async listModels() {
|
|
1807
|
-
const res = await this.client.request("models.list");
|
|
1808
|
-
return Array.isArray(res?.models) ? res.models : [];
|
|
1809
|
-
}
|
|
1810
|
-
};
|
|
1811
|
-
async function resolveGatewayConnection(opts) {
|
|
1812
|
-
const config = loadConfig();
|
|
1813
|
-
const env = process.env;
|
|
1814
|
-
const gatewayAuthMode = config.gateway?.auth?.mode;
|
|
1815
|
-
const isRemoteMode = config.gateway?.mode === "remote";
|
|
1816
|
-
const preferConfiguredAuth = env[TUI_SETUP_AUTH_SOURCE_ENV] === TUI_SETUP_AUTH_SOURCE_CONFIG;
|
|
1817
|
-
const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
|
|
1818
|
-
const explicitAuth = resolveExplicitGatewayAuth({
|
|
1819
|
-
token: opts.token,
|
|
1820
|
-
password: opts.password
|
|
1821
|
-
});
|
|
1822
|
-
ensureExplicitGatewayAuth({
|
|
1823
|
-
urlOverride,
|
|
1824
|
-
urlOverrideSource: "cli",
|
|
1825
|
-
explicitAuth,
|
|
1826
|
-
errorHint: "Fix: pass --token or --password when using --url."
|
|
1827
|
-
});
|
|
1828
|
-
const url = buildGatewayConnectionDetails({
|
|
1829
|
-
config,
|
|
1830
|
-
...urlOverride ? { url: urlOverride } : {}
|
|
1831
|
-
}).url;
|
|
1832
|
-
const allowInsecureLocalOperatorUi = (() => {
|
|
1833
|
-
if (config.gateway?.controlUi?.allowInsecureAuth !== true) return false;
|
|
1834
|
-
try {
|
|
1835
|
-
return isLoopbackHost(new URL(url).hostname);
|
|
1836
|
-
} catch {
|
|
1837
|
-
return false;
|
|
1838
|
-
}
|
|
1839
|
-
})();
|
|
1840
|
-
if (urlOverride) return {
|
|
1841
|
-
url,
|
|
1842
|
-
token: explicitAuth.token,
|
|
1843
|
-
password: explicitAuth.password,
|
|
1844
|
-
allowInsecureLocalOperatorUi
|
|
1845
|
-
};
|
|
1846
|
-
if (isRemoteMode) {
|
|
1847
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1848
|
-
config,
|
|
1849
|
-
env,
|
|
1850
|
-
explicitAuth,
|
|
1851
|
-
surface: "remote"
|
|
1852
|
-
});
|
|
1853
|
-
if (resolved.failureReason) throwGatewayAuthResolutionError(resolved.failureReason);
|
|
1854
|
-
return {
|
|
1855
|
-
url,
|
|
1856
|
-
token: resolved.token,
|
|
1857
|
-
password: resolved.password,
|
|
1858
|
-
allowInsecureLocalOperatorUi: false
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
if (gatewayAuthMode === "none" || gatewayAuthMode === "trusted-proxy") {
|
|
1862
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1863
|
-
config,
|
|
1864
|
-
env,
|
|
1865
|
-
explicitAuth,
|
|
1866
|
-
surface: "local"
|
|
1867
|
-
});
|
|
1868
|
-
return {
|
|
1869
|
-
url,
|
|
1870
|
-
token: resolved.token,
|
|
1871
|
-
password: resolved.password,
|
|
1872
|
-
allowInsecureLocalOperatorUi
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
try {
|
|
1876
|
-
assertExplicitGatewayAuthModeWhenBothConfigured(config);
|
|
1877
|
-
} catch (err) {
|
|
1878
|
-
throwGatewayAuthResolutionError(formatErrorMessage(err));
|
|
1879
|
-
}
|
|
1880
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1881
|
-
config,
|
|
1882
|
-
env,
|
|
1883
|
-
explicitAuth,
|
|
1884
|
-
suppressEnvAuthFallback: preferConfiguredAuth,
|
|
1885
|
-
surface: "local"
|
|
1886
|
-
});
|
|
1887
|
-
if (resolved.failureReason) throwGatewayAuthResolutionError(resolved.failureReason);
|
|
1888
|
-
return {
|
|
1889
|
-
url,
|
|
1890
|
-
token: resolved.token,
|
|
1891
|
-
password: resolved.password,
|
|
1892
|
-
allowInsecureLocalOperatorUi
|
|
1893
|
-
};
|
|
1894
|
-
}
|
|
1895
|
-
//#endregion
|
|
1896
|
-
//#region src/tui/components/fuzzy-filter.ts
|
|
1897
|
-
/**
|
|
1898
|
-
* Shared fuzzy filtering utilities for select list components.
|
|
1899
|
-
*/
|
|
1900
|
-
/**
|
|
1901
|
-
* Word boundary characters for matching.
|
|
1902
|
-
*/
|
|
1903
|
-
const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
|
|
1904
|
-
/**
|
|
1905
|
-
* Check if position is at a word boundary.
|
|
1906
|
-
*/
|
|
1907
|
-
function isWordBoundary(text, index) {
|
|
1908
|
-
return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
|
|
1909
|
-
}
|
|
1910
|
-
/**
|
|
1911
|
-
* Find index where query matches at a word boundary in text.
|
|
1912
|
-
* Returns null if no match.
|
|
1913
|
-
*/
|
|
1914
|
-
function findWordBoundaryIndex(text, query) {
|
|
1915
|
-
if (!query) return null;
|
|
1916
|
-
const textLower = normalizeLowercaseStringOrEmpty(text);
|
|
1917
|
-
const queryLower = normalizeLowercaseStringOrEmpty(query);
|
|
1918
|
-
const maxIndex = textLower.length - queryLower.length;
|
|
1919
|
-
if (maxIndex < 0) return null;
|
|
1920
|
-
for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
|
|
1921
|
-
return null;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
|
|
1925
|
-
* Returns score (lower = better) or null if no match.
|
|
1926
|
-
*/
|
|
1927
|
-
function fuzzyMatchLower(queryLower, textLower) {
|
|
1928
|
-
if (queryLower.length === 0) return 0;
|
|
1929
|
-
if (queryLower.length > textLower.length) return null;
|
|
1930
|
-
let queryIndex = 0;
|
|
1931
|
-
let score = 0;
|
|
1932
|
-
let lastMatchIndex = -1;
|
|
1933
|
-
let consecutiveMatches = 0;
|
|
1934
|
-
for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
|
|
1935
|
-
const isAtWordBoundary = isWordBoundary(textLower, i);
|
|
1936
|
-
if (lastMatchIndex === i - 1) {
|
|
1937
|
-
consecutiveMatches++;
|
|
1938
|
-
score -= consecutiveMatches * 5;
|
|
1939
|
-
} else {
|
|
1940
|
-
consecutiveMatches = 0;
|
|
1941
|
-
if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
|
|
1942
|
-
}
|
|
1943
|
-
if (isAtWordBoundary) score -= 10;
|
|
1944
|
-
score += i * .1;
|
|
1945
|
-
lastMatchIndex = i;
|
|
1946
|
-
queryIndex++;
|
|
1947
|
-
}
|
|
1948
|
-
return queryIndex < queryLower.length ? null : score;
|
|
1949
|
-
}
|
|
1950
|
-
/**
|
|
1951
|
-
* Filter items using pre-lowercased searchTextLower field.
|
|
1952
|
-
* Supports space-separated tokens (all must match).
|
|
1953
|
-
*/
|
|
1954
|
-
function fuzzyFilterLower(items, queryLower) {
|
|
1955
|
-
const trimmed = queryLower.trim();
|
|
1956
|
-
if (!trimmed) return items;
|
|
1957
|
-
const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
|
|
1958
|
-
if (tokens.length === 0) return items;
|
|
1959
|
-
const results = [];
|
|
1960
|
-
for (const item of items) {
|
|
1961
|
-
const text = item.searchTextLower ?? "";
|
|
1962
|
-
let totalScore = 0;
|
|
1963
|
-
let allMatch = true;
|
|
1964
|
-
for (const token of tokens) {
|
|
1965
|
-
const score = fuzzyMatchLower(token, text);
|
|
1966
|
-
if (score !== null) totalScore += score;
|
|
1967
|
-
else {
|
|
1968
|
-
allMatch = false;
|
|
1969
|
-
break;
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
if (allMatch) results.push({
|
|
1973
|
-
item,
|
|
1974
|
-
score: totalScore
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
results.sort((a, b) => a.score - b.score);
|
|
1978
|
-
return results.map((r) => r.item);
|
|
1979
|
-
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Prepare items for fuzzy filtering by pre-computing lowercase search text.
|
|
1982
|
-
*/
|
|
1983
|
-
function prepareSearchItems(items) {
|
|
1984
|
-
return items.map((item) => {
|
|
1985
|
-
const parts = [];
|
|
1986
|
-
if (item.label) parts.push(item.label);
|
|
1987
|
-
if (item.description) parts.push(item.description);
|
|
1988
|
-
if (item.searchText) parts.push(item.searchText);
|
|
1989
|
-
return {
|
|
1990
|
-
...item,
|
|
1991
|
-
searchTextLower: normalizeLowercaseStringOrEmpty(parts.join(" "))
|
|
1992
|
-
};
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
//#endregion
|
|
1996
|
-
//#region src/tui/components/filterable-select-list.ts
|
|
1997
|
-
/**
|
|
1998
|
-
* Combines text input filtering with a select list.
|
|
1999
|
-
* User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
|
|
2000
|
-
*/
|
|
2001
|
-
var FilterableSelectList = class {
|
|
2002
|
-
constructor(items, maxVisible, theme) {
|
|
2003
|
-
this.filterText = "";
|
|
2004
|
-
this.allItems = prepareSearchItems(items);
|
|
2005
|
-
this.maxVisible = maxVisible;
|
|
2006
|
-
this.theme = theme;
|
|
2007
|
-
this.input = new Input();
|
|
2008
|
-
this.selectList = new SelectList(this.allItems, maxVisible, theme);
|
|
2009
|
-
}
|
|
2010
|
-
applyFilter() {
|
|
2011
|
-
const queryLower = normalizeLowercaseStringOrEmpty(this.filterText);
|
|
2012
|
-
if (!queryLower.trim()) {
|
|
2013
|
-
this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
|
|
2014
|
-
return;
|
|
2015
|
-
}
|
|
2016
|
-
const filtered = fuzzyFilterLower(this.allItems, queryLower);
|
|
2017
|
-
this.selectList = new SelectList(filtered, this.maxVisible, this.theme);
|
|
2018
|
-
}
|
|
2019
|
-
invalidate() {
|
|
2020
|
-
this.input.invalidate();
|
|
2021
|
-
this.selectList.invalidate();
|
|
2022
|
-
}
|
|
2023
|
-
render(width) {
|
|
2024
|
-
const lines = [];
|
|
2025
|
-
const filterLabel = this.theme.filterLabel("Filter: ");
|
|
2026
|
-
const inputText = this.input.render(width - 8)[0] ?? "";
|
|
2027
|
-
lines.push(filterLabel + inputText);
|
|
2028
|
-
lines.push(chalk.dim("─".repeat(Math.max(0, width))));
|
|
2029
|
-
const listLines = this.selectList.render(width);
|
|
2030
|
-
lines.push(...listLines);
|
|
2031
|
-
return lines;
|
|
2032
|
-
}
|
|
2033
|
-
handleInput(keyData) {
|
|
2034
|
-
const allowVimNav = !this.filterText.trim();
|
|
2035
|
-
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
|
|
2036
|
-
this.selectList.handleInput("\x1B[A");
|
|
2037
|
-
return;
|
|
2038
|
-
}
|
|
2039
|
-
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
|
|
2040
|
-
this.selectList.handleInput("\x1B[B");
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
if (matchesKey(keyData, "enter")) {
|
|
2044
|
-
const selected = this.selectList.getSelectedItem();
|
|
2045
|
-
if (selected) this.onSelect?.(selected);
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
2049
|
-
if (this.filterText) {
|
|
2050
|
-
this.filterText = "";
|
|
2051
|
-
this.input.setValue("");
|
|
2052
|
-
this.applyFilter();
|
|
2053
|
-
} else this.onCancel?.();
|
|
2054
|
-
return;
|
|
2055
|
-
}
|
|
2056
|
-
const prevValue = this.input.getValue();
|
|
2057
|
-
this.input.handleInput(keyData);
|
|
2058
|
-
const newValue = this.input.getValue();
|
|
2059
|
-
if (newValue !== prevValue) {
|
|
2060
|
-
this.filterText = newValue;
|
|
2061
|
-
this.applyFilter();
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
getSelectedItem() {
|
|
2065
|
-
return this.selectList.getSelectedItem();
|
|
2066
|
-
}
|
|
2067
|
-
getFilterText() {
|
|
2068
|
-
return this.filterText;
|
|
2069
|
-
}
|
|
2070
|
-
};
|
|
2071
|
-
//#endregion
|
|
2072
|
-
//#region src/tui/components/searchable-select-list.ts
|
|
2073
|
-
const ANSI_SGR_REGEX = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
2074
|
-
/**
|
|
2075
|
-
* A select list with a search input at the top for fuzzy filtering.
|
|
2076
|
-
*/
|
|
2077
|
-
var SearchableSelectList = class SearchableSelectList {
|
|
2078
|
-
static {
|
|
2079
|
-
this.DESCRIPTION_LAYOUT_MIN_WIDTH = 40;
|
|
2080
|
-
}
|
|
2081
|
-
static {
|
|
2082
|
-
this.DESCRIPTION_MIN_WIDTH = 12;
|
|
2083
|
-
}
|
|
2084
|
-
static {
|
|
2085
|
-
this.DESCRIPTION_SPACING_WIDTH = 2;
|
|
2086
|
-
}
|
|
2087
|
-
static {
|
|
2088
|
-
this.RIGHT_MARGIN_WIDTH = 2;
|
|
2089
|
-
}
|
|
2090
|
-
constructor(items, maxVisible, theme) {
|
|
2091
|
-
this.selectedIndex = 0;
|
|
2092
|
-
this.regexCache = /* @__PURE__ */ new Map();
|
|
2093
|
-
this.compareByScore = (a, b) => {
|
|
2094
|
-
if (a.tier !== b.tier) return a.tier - b.tier;
|
|
2095
|
-
if (a.score !== b.score) return a.score - b.score;
|
|
2096
|
-
return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
|
|
2097
|
-
};
|
|
2098
|
-
this.items = items;
|
|
2099
|
-
this.filteredItems = items;
|
|
2100
|
-
this.maxVisible = maxVisible;
|
|
2101
|
-
this.theme = theme;
|
|
2102
|
-
this.searchInput = new Input();
|
|
2103
|
-
}
|
|
2104
|
-
getCachedRegex(pattern) {
|
|
2105
|
-
let regex = this.regexCache.get(pattern);
|
|
2106
|
-
if (!regex) {
|
|
2107
|
-
regex = new RegExp(this.escapeRegex(pattern), "gi");
|
|
2108
|
-
this.regexCache.set(pattern, regex);
|
|
2109
|
-
}
|
|
2110
|
-
return regex;
|
|
2111
|
-
}
|
|
2112
|
-
updateFilter() {
|
|
2113
|
-
const query = this.searchInput.getValue().trim();
|
|
2114
|
-
if (!query) this.filteredItems = this.items;
|
|
2115
|
-
else this.filteredItems = this.smartFilter(query);
|
|
2116
|
-
this.selectedIndex = 0;
|
|
2117
|
-
this.notifySelectionChange();
|
|
2118
|
-
}
|
|
2119
|
-
/**
|
|
2120
|
-
* Smart filtering that prioritizes:
|
|
2121
|
-
* 1. Exact substring match in label (highest priority)
|
|
2122
|
-
* 2. Word-boundary prefix match in label
|
|
2123
|
-
* 3. Exact substring in description
|
|
2124
|
-
* 4. Fuzzy match (lowest priority)
|
|
2125
|
-
*/
|
|
2126
|
-
smartFilter(query) {
|
|
2127
|
-
const q = normalizeLowercaseStringOrEmpty(query);
|
|
2128
|
-
const scoredItems = [];
|
|
2129
|
-
const fuzzyCandidates = [];
|
|
2130
|
-
for (const item of this.items) {
|
|
2131
|
-
const rawLabel = this.getItemLabel(item);
|
|
2132
|
-
const rawDesc = item.description ?? "";
|
|
2133
|
-
const label = normalizeLowercaseStringOrEmpty(stripAnsi$1(rawLabel));
|
|
2134
|
-
const desc = normalizeLowercaseStringOrEmpty(stripAnsi$1(rawDesc));
|
|
2135
|
-
const labelIndex = label.indexOf(q);
|
|
2136
|
-
if (labelIndex !== -1) {
|
|
2137
|
-
scoredItems.push({
|
|
2138
|
-
item,
|
|
2139
|
-
tier: 0,
|
|
2140
|
-
score: labelIndex
|
|
2141
|
-
});
|
|
2142
|
-
continue;
|
|
2143
|
-
}
|
|
2144
|
-
const wordBoundaryIndex = findWordBoundaryIndex(label, q);
|
|
2145
|
-
if (wordBoundaryIndex !== null) {
|
|
2146
|
-
scoredItems.push({
|
|
2147
|
-
item,
|
|
2148
|
-
tier: 1,
|
|
2149
|
-
score: wordBoundaryIndex
|
|
2150
|
-
});
|
|
2151
|
-
continue;
|
|
2152
|
-
}
|
|
2153
|
-
const descIndex = desc.indexOf(q);
|
|
2154
|
-
if (descIndex !== -1) {
|
|
2155
|
-
scoredItems.push({
|
|
2156
|
-
item,
|
|
2157
|
-
tier: 2,
|
|
2158
|
-
score: descIndex
|
|
2159
|
-
});
|
|
2160
|
-
continue;
|
|
2161
|
-
}
|
|
2162
|
-
const searchText = item.searchText ?? "";
|
|
2163
|
-
fuzzyCandidates.push({
|
|
2164
|
-
item,
|
|
2165
|
-
searchTextLower: normalizeLowercaseStringOrEmpty([
|
|
2166
|
-
rawLabel,
|
|
2167
|
-
rawDesc,
|
|
2168
|
-
searchText
|
|
2169
|
-
].map((value) => stripAnsi$1(value)).filter(Boolean).join(" "))
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
scoredItems.sort(this.compareByScore);
|
|
2173
|
-
const fuzzyMatches = fuzzyFilterLower(fuzzyCandidates, q);
|
|
2174
|
-
return [...scoredItems.map((s) => s.item), ...fuzzyMatches.map((entry) => entry.item)];
|
|
2175
|
-
}
|
|
2176
|
-
escapeRegex(str) {
|
|
2177
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2178
|
-
}
|
|
2179
|
-
getItemLabel(item) {
|
|
2180
|
-
return item.label || item.value;
|
|
2181
|
-
}
|
|
2182
|
-
splitAnsiParts(text) {
|
|
2183
|
-
const parts = [];
|
|
2184
|
-
ANSI_SGR_REGEX.lastIndex = 0;
|
|
2185
|
-
let lastIndex = 0;
|
|
2186
|
-
let match;
|
|
2187
|
-
while ((match = ANSI_SGR_REGEX.exec(text)) !== null) {
|
|
2188
|
-
if (match.index > lastIndex) parts.push({
|
|
2189
|
-
text: text.slice(lastIndex, match.index),
|
|
2190
|
-
isAnsi: false
|
|
2191
|
-
});
|
|
2192
|
-
parts.push({
|
|
2193
|
-
text: match[0],
|
|
2194
|
-
isAnsi: true
|
|
2195
|
-
});
|
|
2196
|
-
lastIndex = match.index + match[0].length;
|
|
2197
|
-
}
|
|
2198
|
-
if (lastIndex < text.length) parts.push({
|
|
2199
|
-
text: text.slice(lastIndex),
|
|
2200
|
-
isAnsi: false
|
|
2201
|
-
});
|
|
2202
|
-
return parts;
|
|
2203
|
-
}
|
|
2204
|
-
highlightMatch(text, query) {
|
|
2205
|
-
const tokens = query.trim().split(/\s+/).map((token) => normalizeLowercaseStringOrEmpty(token)).filter((token) => token.length > 0);
|
|
2206
|
-
if (tokens.length === 0) return text;
|
|
2207
|
-
const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
|
|
2208
|
-
let parts = this.splitAnsiParts(text);
|
|
2209
|
-
for (const token of uniqueTokens) {
|
|
2210
|
-
const regex = this.getCachedRegex(token);
|
|
2211
|
-
const nextParts = [];
|
|
2212
|
-
for (const part of parts) {
|
|
2213
|
-
if (part.isAnsi) {
|
|
2214
|
-
nextParts.push(part);
|
|
2215
|
-
continue;
|
|
2216
|
-
}
|
|
2217
|
-
regex.lastIndex = 0;
|
|
2218
|
-
const replaced = part.text.replace(regex, (match) => this.theme.matchHighlight(match));
|
|
2219
|
-
if (replaced === part.text) {
|
|
2220
|
-
nextParts.push(part);
|
|
2221
|
-
continue;
|
|
2222
|
-
}
|
|
2223
|
-
nextParts.push(...this.splitAnsiParts(replaced));
|
|
2224
|
-
}
|
|
2225
|
-
parts = nextParts;
|
|
2226
|
-
}
|
|
2227
|
-
return parts.map((part) => part.text).join("");
|
|
2228
|
-
}
|
|
2229
|
-
setSelectedIndex(index) {
|
|
2230
|
-
this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
|
|
2231
|
-
}
|
|
2232
|
-
invalidate() {
|
|
2233
|
-
this.searchInput.invalidate();
|
|
2234
|
-
}
|
|
2235
|
-
render(width) {
|
|
2236
|
-
const lines = [];
|
|
2237
|
-
const prompt = this.theme.searchPrompt("search: ");
|
|
2238
|
-
const inputWidth = Math.max(1, width - visibleWidth(prompt));
|
|
2239
|
-
const inputText = this.searchInput.render(inputWidth)[0] ?? "";
|
|
2240
|
-
lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
|
|
2241
|
-
lines.push("");
|
|
2242
|
-
const query = this.searchInput.getValue().trim();
|
|
2243
|
-
if (this.filteredItems.length === 0) {
|
|
2244
|
-
lines.push(this.theme.noMatch(" No matches"));
|
|
2245
|
-
return lines;
|
|
2246
|
-
}
|
|
2247
|
-
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
|
|
2248
|
-
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
2249
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
2250
|
-
const item = this.filteredItems[i];
|
|
2251
|
-
if (!item) continue;
|
|
2252
|
-
const isSelected = i === this.selectedIndex;
|
|
2253
|
-
lines.push(this.renderItemLine(item, isSelected, width, query));
|
|
2254
|
-
}
|
|
2255
|
-
if (this.filteredItems.length > this.maxVisible) {
|
|
2256
|
-
const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
|
|
2257
|
-
lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
|
|
2258
|
-
}
|
|
2259
|
-
return lines;
|
|
2260
|
-
}
|
|
2261
|
-
renderItemLine(item, isSelected, width, query) {
|
|
2262
|
-
const prefix = isSelected ? "→ " : " ";
|
|
2263
|
-
const prefixWidth = prefix.length;
|
|
2264
|
-
const displayValue = this.getItemLabel(item);
|
|
2265
|
-
const description = item.description;
|
|
2266
|
-
if (description) {
|
|
2267
|
-
const descriptionLayout = this.getDescriptionLayout(width, prefixWidth);
|
|
2268
|
-
if (descriptionLayout) {
|
|
2269
|
-
const truncatedValue = truncateToWidth(displayValue, descriptionLayout.maxValueWidth, "");
|
|
2270
|
-
const valueText = this.highlightMatch(truncatedValue, query);
|
|
2271
|
-
const usedByValue = visibleWidth(valueText);
|
|
2272
|
-
const descriptionWidth = descriptionLayout.availableWidth - usedByValue - descriptionLayout.spacingWidth;
|
|
2273
|
-
if (descriptionWidth >= SearchableSelectList.DESCRIPTION_MIN_WIDTH) {
|
|
2274
|
-
const spacing = " ".repeat(descriptionLayout.spacingWidth);
|
|
2275
|
-
const truncatedDesc = truncateToWidth(description, descriptionWidth, "");
|
|
2276
|
-
const highlightedDesc = this.highlightMatch(truncatedDesc, query);
|
|
2277
|
-
const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
|
|
2278
|
-
return isSelected ? this.theme.selectedText(line) : line;
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
|
|
2283
|
-
const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
|
|
2284
|
-
return isSelected ? this.theme.selectedText(line) : line;
|
|
2285
|
-
}
|
|
2286
|
-
getDescriptionLayout(width, prefixWidth) {
|
|
2287
|
-
if (width <= SearchableSelectList.DESCRIPTION_LAYOUT_MIN_WIDTH) return null;
|
|
2288
|
-
const availableWidth = Math.max(1, width - prefixWidth - SearchableSelectList.RIGHT_MARGIN_WIDTH);
|
|
2289
|
-
const maxValueWidth = availableWidth - SearchableSelectList.DESCRIPTION_MIN_WIDTH - SearchableSelectList.DESCRIPTION_SPACING_WIDTH;
|
|
2290
|
-
if (maxValueWidth < 1) return null;
|
|
2291
|
-
return {
|
|
2292
|
-
availableWidth,
|
|
2293
|
-
maxValueWidth,
|
|
2294
|
-
spacingWidth: SearchableSelectList.DESCRIPTION_SPACING_WIDTH
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
|
-
handleInput(keyData) {
|
|
2298
|
-
if (isKeyRelease(keyData)) return;
|
|
2299
|
-
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p")) {
|
|
2300
|
-
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
2301
|
-
this.notifySelectionChange();
|
|
2302
|
-
return;
|
|
2303
|
-
}
|
|
2304
|
-
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n")) {
|
|
2305
|
-
this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
|
|
2306
|
-
this.notifySelectionChange();
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
if (matchesKey(keyData, "enter")) {
|
|
2310
|
-
const item = this.filteredItems[this.selectedIndex];
|
|
2311
|
-
if (item && this.onSelect) this.onSelect(item);
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
2315
|
-
if (this.onCancel) this.onCancel();
|
|
2316
|
-
return;
|
|
2317
|
-
}
|
|
2318
|
-
const prevValue = this.searchInput.getValue();
|
|
2319
|
-
this.searchInput.handleInput(keyData);
|
|
2320
|
-
if (prevValue !== this.searchInput.getValue()) this.updateFilter();
|
|
2321
|
-
}
|
|
2322
|
-
notifySelectionChange() {
|
|
2323
|
-
const item = this.filteredItems[this.selectedIndex];
|
|
2324
|
-
if (item && this.onSelectionChange) this.onSelectionChange(item);
|
|
2325
|
-
}
|
|
2326
|
-
getSelectedItem() {
|
|
2327
|
-
return this.filteredItems[this.selectedIndex] ?? null;
|
|
2328
|
-
}
|
|
2329
|
-
};
|
|
2330
|
-
//#endregion
|
|
2331
|
-
//#region src/tui/components/selectors.ts
|
|
2332
|
-
function createSearchableSelectList(items, maxVisible = 7) {
|
|
2333
|
-
return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
|
|
2334
|
-
}
|
|
2335
|
-
function createFilterableSelectList(items, maxVisible = 7) {
|
|
2336
|
-
return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
|
|
2337
|
-
}
|
|
2338
|
-
function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
|
|
2339
|
-
return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
|
|
2340
|
-
}
|
|
2341
|
-
//#endregion
|
|
2342
|
-
//#region src/tui/tui-status-summary.ts
|
|
2343
|
-
function formatStatusSummary(summary) {
|
|
2344
|
-
const lines = [];
|
|
2345
|
-
lines.push("Gateway status");
|
|
2346
|
-
if (summary.runtimeVersion) lines.push(`Version: ${summary.runtimeVersion}`);
|
|
2347
|
-
if (!summary.linkChannel) lines.push("Link channel: unknown");
|
|
2348
|
-
else {
|
|
2349
|
-
const linkLabel = summary.linkChannel.label ?? "Link channel";
|
|
2350
|
-
const linked = summary.linkChannel.linked === true;
|
|
2351
|
-
const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})` : "";
|
|
2352
|
-
lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
|
|
2353
|
-
}
|
|
2354
|
-
const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
|
|
2355
|
-
if (providerSummary.length > 0) {
|
|
2356
|
-
lines.push("");
|
|
2357
|
-
lines.push("System:");
|
|
2358
|
-
for (const line of providerSummary) lines.push(` ${line}`);
|
|
2359
|
-
}
|
|
2360
|
-
const heartbeatAgents = summary.heartbeat?.agents ?? [];
|
|
2361
|
-
if (heartbeatAgents.length > 0) {
|
|
2362
|
-
const heartbeatParts = heartbeatAgents.map((agent) => {
|
|
2363
|
-
const agentId = agent.agentId ?? "unknown";
|
|
2364
|
-
if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
|
|
2365
|
-
return `${agent.every ?? "unknown"} (${agentId})`;
|
|
2366
|
-
});
|
|
2367
|
-
lines.push("");
|
|
2368
|
-
lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
|
|
2369
|
-
}
|
|
2370
|
-
const sessionPaths = summary.sessions?.paths ?? [];
|
|
2371
|
-
if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
|
|
2372
|
-
else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
|
|
2373
|
-
const defaults = summary.sessions?.defaults;
|
|
2374
|
-
const defaultModel = defaults?.model ?? "unknown";
|
|
2375
|
-
const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
|
|
2376
|
-
lines.push(`Default model: ${defaultModel}${defaultCtx}`);
|
|
2377
|
-
const sessionCount = summary.sessions?.count ?? 0;
|
|
2378
|
-
lines.push(`Active sessions: ${sessionCount}`);
|
|
2379
|
-
const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
|
|
2380
|
-
if (recent.length > 0) {
|
|
2381
|
-
lines.push("Recent sessions:");
|
|
2382
|
-
for (const entry of recent) {
|
|
2383
|
-
const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
|
|
2384
|
-
const model = entry.model ?? "unknown";
|
|
2385
|
-
const usage = formatContextUsageLine({
|
|
2386
|
-
total: entry.totalTokens ?? null,
|
|
2387
|
-
context: entry.contextTokens ?? null,
|
|
2388
|
-
remaining: entry.remainingTokens ?? null,
|
|
2389
|
-
percent: entry.percentUsed ?? null
|
|
2390
|
-
});
|
|
2391
|
-
const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
|
|
2392
|
-
lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
|
|
2396
|
-
if (queued.length > 0) {
|
|
2397
|
-
const preview = queued.slice(0, 3).join(" | ");
|
|
2398
|
-
lines.push(`Queued system events (${queued.length}): ${preview}`);
|
|
2399
|
-
}
|
|
2400
|
-
return lines;
|
|
2401
|
-
}
|
|
2402
|
-
//#endregion
|
|
2403
|
-
//#region src/tui/tui-command-handlers.ts
|
|
2404
|
-
function isBtwCommand(text) {
|
|
2405
|
-
return /^\/btw(?::|\s|$)/i.test(text.trim());
|
|
2406
|
-
}
|
|
2407
|
-
function createCommandHandlers(context) {
|
|
2408
|
-
const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalBtwRunId, forgetLocalRunId, forgetLocalBtwRunId, runAuthFlow, requestExit } = context;
|
|
2409
|
-
const setAgent = async (id) => {
|
|
2410
|
-
state.currentAgentId = normalizeAgentId(id);
|
|
2411
|
-
await setSession("");
|
|
2412
|
-
};
|
|
2413
|
-
const closeOverlayAndRender = () => {
|
|
2414
|
-
closeOverlay();
|
|
2415
|
-
tui.requestRender();
|
|
2416
|
-
};
|
|
2417
|
-
const openSelector = (selector, onSelect) => {
|
|
2418
|
-
selector.onSelect = (item) => {
|
|
2419
|
-
(async () => {
|
|
2420
|
-
await onSelect(item.value);
|
|
2421
|
-
closeOverlayAndRender();
|
|
2422
|
-
})();
|
|
2423
|
-
};
|
|
2424
|
-
selector.onCancel = closeOverlayAndRender;
|
|
2425
|
-
openOverlay(selector);
|
|
2426
|
-
tui.requestRender();
|
|
2427
|
-
};
|
|
2428
|
-
const openModelSelector = async () => {
|
|
2429
|
-
try {
|
|
2430
|
-
const models = await client.listModels();
|
|
2431
|
-
if (models.length === 0) {
|
|
2432
|
-
chatLog.addSystem("no models available");
|
|
2433
|
-
tui.requestRender();
|
|
2434
|
-
return;
|
|
2435
|
-
}
|
|
2436
|
-
openSelector(createSearchableSelectList(models.map((model) => ({
|
|
2437
|
-
value: `${model.provider}/${model.id}`,
|
|
2438
|
-
label: `${model.provider}/${model.id}`,
|
|
2439
|
-
description: model.name && model.name !== model.id ? model.name : ""
|
|
2440
|
-
})), 9), async (value) => {
|
|
2441
|
-
try {
|
|
2442
|
-
const result = await client.patchSession({
|
|
2443
|
-
key: state.currentSessionKey,
|
|
2444
|
-
model: value
|
|
2445
|
-
});
|
|
2446
|
-
chatLog.addSystem(`model set to ${value}`);
|
|
2447
|
-
applySessionInfoFromPatch(result);
|
|
2448
|
-
await refreshSessionInfo();
|
|
2449
|
-
} catch (err) {
|
|
2450
|
-
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2451
|
-
}
|
|
2452
|
-
});
|
|
2453
|
-
} catch (err) {
|
|
2454
|
-
chatLog.addSystem(`model list failed: ${String(err)}`);
|
|
2455
|
-
tui.requestRender();
|
|
2456
|
-
}
|
|
2457
|
-
};
|
|
2458
|
-
const openAgentSelector = async () => {
|
|
2459
|
-
await refreshAgents();
|
|
2460
|
-
if (state.agents.length === 0) {
|
|
2461
|
-
chatLog.addSystem("no agents found");
|
|
2462
|
-
tui.requestRender();
|
|
2463
|
-
return;
|
|
2464
|
-
}
|
|
2465
|
-
openSelector(createSearchableSelectList(state.agents.map((agent) => ({
|
|
2466
|
-
value: agent.id,
|
|
2467
|
-
label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
|
|
2468
|
-
description: agent.id === state.agentDefaultId ? "default" : ""
|
|
2469
|
-
})), 9), async (value) => {
|
|
2470
|
-
await setAgent(value);
|
|
2471
|
-
});
|
|
2472
|
-
};
|
|
2473
|
-
const openSessionSelector = async () => {
|
|
2474
|
-
try {
|
|
2475
|
-
openSelector(createFilterableSelectList((await client.listSessions({
|
|
2476
|
-
includeGlobal: false,
|
|
2477
|
-
includeUnknown: false,
|
|
2478
|
-
includeDerivedTitles: true,
|
|
2479
|
-
includeLastMessage: true,
|
|
2480
|
-
agentId: state.currentAgentId
|
|
2481
|
-
})).sessions.map((session) => {
|
|
2482
|
-
const title = session.derivedTitle ?? session.displayName;
|
|
2483
|
-
const formattedKey = formatSessionKey(session.key);
|
|
2484
|
-
const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
|
|
2485
|
-
const timePart = session.updatedAt ? formatRelativeTimestamp(session.updatedAt, {
|
|
2486
|
-
dateFallback: true,
|
|
2487
|
-
fallback: ""
|
|
2488
|
-
}) : "";
|
|
2489
|
-
const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
|
|
2490
|
-
const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
|
|
2491
|
-
return {
|
|
2492
|
-
value: session.key,
|
|
2493
|
-
label,
|
|
2494
|
-
description,
|
|
2495
|
-
searchText: [
|
|
2496
|
-
session.displayName,
|
|
2497
|
-
session.label,
|
|
2498
|
-
session.subject,
|
|
2499
|
-
session.sessionId,
|
|
2500
|
-
session.key,
|
|
2501
|
-
session.lastMessagePreview
|
|
2502
|
-
].filter(Boolean).join(" ")
|
|
2503
|
-
};
|
|
2504
|
-
}), 9), async (value) => {
|
|
2505
|
-
await setSession(value);
|
|
2506
|
-
});
|
|
2507
|
-
} catch (err) {
|
|
2508
|
-
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
2509
|
-
tui.requestRender();
|
|
2510
|
-
}
|
|
2511
|
-
};
|
|
2512
|
-
const openSettings = () => {
|
|
2513
|
-
openOverlay(createSettingsList([{
|
|
2514
|
-
id: "tools",
|
|
2515
|
-
label: "Tool output",
|
|
2516
|
-
currentValue: state.toolsExpanded ? "expanded" : "collapsed",
|
|
2517
|
-
values: ["collapsed", "expanded"]
|
|
2518
|
-
}, {
|
|
2519
|
-
id: "thinking",
|
|
2520
|
-
label: "Show thinking",
|
|
2521
|
-
currentValue: state.showThinking ? "on" : "off",
|
|
2522
|
-
values: ["off", "on"]
|
|
2523
|
-
}], (id, value) => {
|
|
2524
|
-
if (id === "tools") {
|
|
2525
|
-
state.toolsExpanded = value === "expanded";
|
|
2526
|
-
chatLog.setToolsExpanded(state.toolsExpanded);
|
|
2527
|
-
}
|
|
2528
|
-
if (id === "thinking") {
|
|
2529
|
-
state.showThinking = value === "on";
|
|
2530
|
-
loadHistory();
|
|
2531
|
-
}
|
|
2532
|
-
tui.requestRender();
|
|
2533
|
-
}, () => {
|
|
2534
|
-
closeOverlay();
|
|
2535
|
-
tui.requestRender();
|
|
2536
|
-
}));
|
|
2537
|
-
tui.requestRender();
|
|
2538
|
-
};
|
|
2539
|
-
const handleCommand = async (raw) => {
|
|
2540
|
-
const { name, args } = parseCommand(raw);
|
|
2541
|
-
if (!name) return;
|
|
2542
|
-
switch (name) {
|
|
2543
|
-
case "help":
|
|
2544
|
-
chatLog.addSystem(helpText({
|
|
2545
|
-
local: opts.local,
|
|
2546
|
-
provider: state.sessionInfo.modelProvider,
|
|
2547
|
-
model: state.sessionInfo.model
|
|
2548
|
-
}));
|
|
2549
|
-
break;
|
|
2550
|
-
case "auth": {
|
|
2551
|
-
if (!runAuthFlow) {
|
|
2552
|
-
chatLog.addSystem("auth login is only available in local embedded mode");
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
if (state.activeChatRunId || state.pendingOptimisticUserMessage) {
|
|
2556
|
-
chatLog.addSystem("abort the current run before /auth");
|
|
2557
|
-
break;
|
|
2558
|
-
}
|
|
2559
|
-
const provider = args.trim() || state.sessionInfo.modelProvider || void 0;
|
|
2560
|
-
chatLog.addSystem(provider ? `opening auth flow for ${provider}; TUI will resume when it exits` : "opening auth flow; TUI will resume when it exits");
|
|
2561
|
-
tui.requestRender();
|
|
2562
|
-
setActivityStatus("auth");
|
|
2563
|
-
try {
|
|
2564
|
-
const result = await runAuthFlow({ provider });
|
|
2565
|
-
await refreshSessionInfo();
|
|
2566
|
-
if (result.exitCode === 0 && !result.signal) {
|
|
2567
|
-
chatLog.addSystem(provider ? `auth flow finished for ${provider}` : "auth flow finished");
|
|
2568
|
-
setActivityStatus("idle");
|
|
2569
|
-
} else {
|
|
2570
|
-
const failureSuffix = result.signal ? ` (signal ${result.signal})` : typeof result.exitCode === "number" ? ` (exit ${String(result.exitCode)})` : "";
|
|
2571
|
-
chatLog.addSystem(`auth flow failed${failureSuffix}`);
|
|
2572
|
-
setActivityStatus("error");
|
|
2573
|
-
}
|
|
2574
|
-
} catch (err) {
|
|
2575
|
-
chatLog.addSystem(`auth flow failed: ${sanitizeRenderableText(String(err))}`);
|
|
2576
|
-
setActivityStatus("error");
|
|
2577
|
-
}
|
|
2578
|
-
break;
|
|
2579
|
-
}
|
|
2580
|
-
case "gateway-status":
|
|
2581
|
-
try {
|
|
2582
|
-
const status = await client.getGatewayStatus();
|
|
2583
|
-
if (typeof status === "string") {
|
|
2584
|
-
chatLog.addSystem(status);
|
|
2585
|
-
break;
|
|
2586
|
-
}
|
|
2587
|
-
if (status && typeof status === "object") {
|
|
2588
|
-
const lines = formatStatusSummary(status);
|
|
2589
|
-
for (const line of lines) chatLog.addSystem(line);
|
|
2590
|
-
break;
|
|
2591
|
-
}
|
|
2592
|
-
chatLog.addSystem("status: unknown response");
|
|
2593
|
-
} catch (err) {
|
|
2594
|
-
chatLog.addSystem(`status failed: ${String(err)}`);
|
|
2595
|
-
}
|
|
2596
|
-
break;
|
|
2597
|
-
case "agent":
|
|
2598
|
-
if (!args) await openAgentSelector();
|
|
2599
|
-
else await setAgent(args);
|
|
2600
|
-
break;
|
|
2601
|
-
case "agents":
|
|
2602
|
-
await openAgentSelector();
|
|
2603
|
-
break;
|
|
2604
|
-
case "session":
|
|
2605
|
-
if (!args) await openSessionSelector();
|
|
2606
|
-
else await setSession(args);
|
|
2607
|
-
break;
|
|
2608
|
-
case "sessions":
|
|
2609
|
-
await openSessionSelector();
|
|
2610
|
-
break;
|
|
2611
|
-
case "model":
|
|
2612
|
-
if (!args) await openModelSelector();
|
|
2613
|
-
else try {
|
|
2614
|
-
const result = await client.patchSession({
|
|
2615
|
-
key: state.currentSessionKey,
|
|
2616
|
-
model: args
|
|
2617
|
-
});
|
|
2618
|
-
chatLog.addSystem(`model set to ${args}`);
|
|
2619
|
-
applySessionInfoFromPatch(result);
|
|
2620
|
-
await refreshSessionInfo();
|
|
2621
|
-
} catch (err) {
|
|
2622
|
-
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2623
|
-
}
|
|
2624
|
-
break;
|
|
2625
|
-
case "models":
|
|
2626
|
-
await openModelSelector();
|
|
2627
|
-
break;
|
|
2628
|
-
case "think":
|
|
2629
|
-
if (!args) {
|
|
2630
|
-
const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
|
|
2631
|
-
chatLog.addSystem(`usage: /think <${levels}>`);
|
|
2632
|
-
break;
|
|
2633
|
-
}
|
|
2634
|
-
try {
|
|
2635
|
-
const result = await client.patchSession({
|
|
2636
|
-
key: state.currentSessionKey,
|
|
2637
|
-
thinkingLevel: args
|
|
2638
|
-
});
|
|
2639
|
-
chatLog.addSystem(`thinking set to ${args}`);
|
|
2640
|
-
applySessionInfoFromPatch(result);
|
|
2641
|
-
await refreshSessionInfo();
|
|
2642
|
-
} catch (err) {
|
|
2643
|
-
chatLog.addSystem(`think failed: ${String(err)}`);
|
|
2644
|
-
}
|
|
2645
|
-
break;
|
|
2646
|
-
case "verbose":
|
|
2647
|
-
if (!args) {
|
|
2648
|
-
chatLog.addSystem("usage: /verbose <on|off>");
|
|
2649
|
-
break;
|
|
2650
|
-
}
|
|
2651
|
-
try {
|
|
2652
|
-
const result = await client.patchSession({
|
|
2653
|
-
key: state.currentSessionKey,
|
|
2654
|
-
verboseLevel: args
|
|
2655
|
-
});
|
|
2656
|
-
chatLog.addSystem(`verbose set to ${args}`);
|
|
2657
|
-
applySessionInfoFromPatch(result);
|
|
2658
|
-
await loadHistory();
|
|
2659
|
-
} catch (err) {
|
|
2660
|
-
chatLog.addSystem(`verbose failed: ${String(err)}`);
|
|
2661
|
-
}
|
|
2662
|
-
break;
|
|
2663
|
-
case "trace":
|
|
2664
|
-
if (!args) {
|
|
2665
|
-
chatLog.addSystem("usage: /trace <on|off>");
|
|
2666
|
-
break;
|
|
2667
|
-
}
|
|
2668
|
-
try {
|
|
2669
|
-
const result = await client.patchSession({
|
|
2670
|
-
key: state.currentSessionKey,
|
|
2671
|
-
traceLevel: args
|
|
2672
|
-
});
|
|
2673
|
-
chatLog.addSystem(`trace set to ${args}`);
|
|
2674
|
-
applySessionInfoFromPatch(result);
|
|
2675
|
-
await loadHistory();
|
|
2676
|
-
} catch (err) {
|
|
2677
|
-
chatLog.addSystem(`trace failed: ${String(err)}`);
|
|
2678
|
-
}
|
|
2679
|
-
break;
|
|
2680
|
-
case "fast":
|
|
2681
|
-
if (!args || args === "status") {
|
|
2682
|
-
chatLog.addSystem(`fast mode: ${state.sessionInfo.fastMode ? "on" : "off"}`);
|
|
2683
|
-
break;
|
|
2684
|
-
}
|
|
2685
|
-
if (args !== "on" && args !== "off") {
|
|
2686
|
-
chatLog.addSystem("usage: /fast <status|on|off>");
|
|
2687
|
-
break;
|
|
2688
|
-
}
|
|
2689
|
-
try {
|
|
2690
|
-
const result = await client.patchSession({
|
|
2691
|
-
key: state.currentSessionKey,
|
|
2692
|
-
fastMode: args === "on"
|
|
2693
|
-
});
|
|
2694
|
-
chatLog.addSystem(`fast mode ${args === "on" ? "enabled" : "disabled"}`);
|
|
2695
|
-
applySessionInfoFromPatch(result);
|
|
2696
|
-
await refreshSessionInfo();
|
|
2697
|
-
} catch (err) {
|
|
2698
|
-
chatLog.addSystem(`fast failed: ${String(err)}`);
|
|
2699
|
-
}
|
|
2700
|
-
break;
|
|
2701
|
-
case "reasoning":
|
|
2702
|
-
if (!args) {
|
|
2703
|
-
chatLog.addSystem("usage: /reasoning <on|off>");
|
|
2704
|
-
break;
|
|
2705
|
-
}
|
|
2706
|
-
try {
|
|
2707
|
-
const result = await client.patchSession({
|
|
2708
|
-
key: state.currentSessionKey,
|
|
2709
|
-
reasoningLevel: args
|
|
2710
|
-
});
|
|
2711
|
-
chatLog.addSystem(`reasoning set to ${args}`);
|
|
2712
|
-
applySessionInfoFromPatch(result);
|
|
2713
|
-
await refreshSessionInfo();
|
|
2714
|
-
} catch (err) {
|
|
2715
|
-
chatLog.addSystem(`reasoning failed: ${String(err)}`);
|
|
2716
|
-
}
|
|
2717
|
-
break;
|
|
2718
|
-
case "usage": {
|
|
2719
|
-
const normalized = args ? normalizeUsageDisplay(args) : void 0;
|
|
2720
|
-
if (args && !normalized) {
|
|
2721
|
-
chatLog.addSystem("usage: /usage <off|tokens|full>");
|
|
2722
|
-
break;
|
|
2723
|
-
}
|
|
2724
|
-
const currentRaw = state.sessionInfo.responseUsage;
|
|
2725
|
-
const current = resolveResponseUsageMode(currentRaw);
|
|
2726
|
-
const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
|
|
2727
|
-
try {
|
|
2728
|
-
const result = await client.patchSession({
|
|
2729
|
-
key: state.currentSessionKey,
|
|
2730
|
-
responseUsage: next === "off" ? null : next
|
|
2731
|
-
});
|
|
2732
|
-
chatLog.addSystem(`usage footer: ${next}`);
|
|
2733
|
-
applySessionInfoFromPatch(result);
|
|
2734
|
-
await refreshSessionInfo();
|
|
2735
|
-
} catch (err) {
|
|
2736
|
-
chatLog.addSystem(`usage failed: ${String(err)}`);
|
|
2737
|
-
}
|
|
2738
|
-
break;
|
|
2739
|
-
}
|
|
2740
|
-
case "elevated":
|
|
2741
|
-
if (!args) {
|
|
2742
|
-
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2743
|
-
break;
|
|
2744
|
-
}
|
|
2745
|
-
if (![
|
|
2746
|
-
"on",
|
|
2747
|
-
"off",
|
|
2748
|
-
"ask",
|
|
2749
|
-
"full"
|
|
2750
|
-
].includes(args)) {
|
|
2751
|
-
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2752
|
-
break;
|
|
2753
|
-
}
|
|
2754
|
-
try {
|
|
2755
|
-
const result = await client.patchSession({
|
|
2756
|
-
key: state.currentSessionKey,
|
|
2757
|
-
elevatedLevel: args
|
|
2758
|
-
});
|
|
2759
|
-
chatLog.addSystem(`elevated set to ${args}`);
|
|
2760
|
-
applySessionInfoFromPatch(result);
|
|
2761
|
-
await refreshSessionInfo();
|
|
2762
|
-
} catch (err) {
|
|
2763
|
-
chatLog.addSystem(`elevated failed: ${String(err)}`);
|
|
2764
|
-
}
|
|
2765
|
-
break;
|
|
2766
|
-
case "activation": {
|
|
2767
|
-
if (!args) {
|
|
2768
|
-
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2769
|
-
break;
|
|
2770
|
-
}
|
|
2771
|
-
const activation = normalizeGroupActivation(args);
|
|
2772
|
-
if (!activation) {
|
|
2773
|
-
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2774
|
-
break;
|
|
2775
|
-
}
|
|
2776
|
-
try {
|
|
2777
|
-
const result = await client.patchSession({
|
|
2778
|
-
key: state.currentSessionKey,
|
|
2779
|
-
groupActivation: activation
|
|
2780
|
-
});
|
|
2781
|
-
chatLog.addSystem(`activation set to ${activation}`);
|
|
2782
|
-
applySessionInfoFromPatch(result);
|
|
2783
|
-
await refreshSessionInfo();
|
|
2784
|
-
} catch (err) {
|
|
2785
|
-
chatLog.addSystem(`activation failed: ${String(err)}`);
|
|
2786
|
-
}
|
|
2787
|
-
break;
|
|
2788
|
-
}
|
|
2789
|
-
case "new":
|
|
2790
|
-
try {
|
|
2791
|
-
state.sessionInfo.inputTokens = null;
|
|
2792
|
-
state.sessionInfo.outputTokens = null;
|
|
2793
|
-
state.sessionInfo.totalTokens = null;
|
|
2794
|
-
tui.requestRender();
|
|
2795
|
-
const uniqueKey = `tui-${randomUUID()}`;
|
|
2796
|
-
await setSession(uniqueKey);
|
|
2797
|
-
chatLog.addSystem(`new session: ${uniqueKey}`);
|
|
2798
|
-
} catch (err) {
|
|
2799
|
-
chatLog.addSystem(`new session failed: ${sanitizeRenderableText(String(err))}`);
|
|
2800
|
-
}
|
|
2801
|
-
break;
|
|
2802
|
-
case "reset":
|
|
2803
|
-
try {
|
|
2804
|
-
state.sessionInfo.inputTokens = null;
|
|
2805
|
-
state.sessionInfo.outputTokens = null;
|
|
2806
|
-
state.sessionInfo.totalTokens = null;
|
|
2807
|
-
tui.requestRender();
|
|
2808
|
-
await client.resetSession(state.currentSessionKey, name);
|
|
2809
|
-
chatLog.addSystem(`session ${state.currentSessionKey} reset`);
|
|
2810
|
-
await loadHistory();
|
|
2811
|
-
} catch (err) {
|
|
2812
|
-
chatLog.addSystem(`reset failed: ${sanitizeRenderableText(String(err))}`);
|
|
2813
|
-
}
|
|
2814
|
-
break;
|
|
2815
|
-
case "abort":
|
|
2816
|
-
await abortActive();
|
|
2817
|
-
break;
|
|
2818
|
-
case "settings":
|
|
2819
|
-
openSettings();
|
|
2820
|
-
break;
|
|
2821
|
-
case "exit":
|
|
2822
|
-
case "quit":
|
|
2823
|
-
requestExit();
|
|
2824
|
-
break;
|
|
2825
|
-
default:
|
|
2826
|
-
await sendMessage(raw);
|
|
2827
|
-
break;
|
|
2828
|
-
}
|
|
2829
|
-
tui.requestRender();
|
|
2830
|
-
};
|
|
2831
|
-
const sendMessage = async (text) => {
|
|
2832
|
-
if (!state.isConnected) {
|
|
2833
|
-
chatLog.addSystem(opts.local ? "local runtime not ready — message not sent" : "not connected to gateway — message not sent");
|
|
2834
|
-
setActivityStatus("disconnected");
|
|
2835
|
-
tui.requestRender();
|
|
2836
|
-
return;
|
|
2837
|
-
}
|
|
2838
|
-
const isBtw = isBtwCommand(text);
|
|
2839
|
-
const runId = randomUUID();
|
|
2840
|
-
try {
|
|
2841
|
-
if (!isBtw) {
|
|
2842
|
-
chatLog.addUser(text);
|
|
2843
|
-
state.pendingOptimisticUserMessage = true;
|
|
2844
|
-
setActivityStatus("sending");
|
|
2845
|
-
} else noteLocalBtwRunId?.(runId);
|
|
2846
|
-
tui.requestRender();
|
|
2847
|
-
await client.sendChat({
|
|
2848
|
-
sessionKey: state.currentSessionKey,
|
|
2849
|
-
message: text,
|
|
2850
|
-
thinking: opts.thinking,
|
|
2851
|
-
deliver: deliverDefault,
|
|
2852
|
-
timeoutMs: opts.timeoutMs,
|
|
2853
|
-
runId
|
|
2854
|
-
});
|
|
2855
|
-
if (!isBtw) {
|
|
2856
|
-
setActivityStatus("waiting");
|
|
2857
|
-
tui.requestRender();
|
|
2858
|
-
}
|
|
2859
|
-
} catch (err) {
|
|
2860
|
-
if (isBtw) forgetLocalBtwRunId?.(runId);
|
|
2861
|
-
if (!isBtw && state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
|
|
2862
|
-
if (!isBtw) {
|
|
2863
|
-
state.pendingOptimisticUserMessage = false;
|
|
2864
|
-
state.activeChatRunId = null;
|
|
2865
|
-
}
|
|
2866
|
-
chatLog.addSystem(`${isBtw ? "btw failed" : "send failed"}: ${String(err)}`);
|
|
2867
|
-
if (!isBtw) setActivityStatus("error");
|
|
2868
|
-
tui.requestRender();
|
|
2869
|
-
}
|
|
2870
|
-
};
|
|
2871
|
-
return {
|
|
2872
|
-
handleCommand,
|
|
2873
|
-
sendMessage,
|
|
2874
|
-
openModelSelector,
|
|
2875
|
-
openAgentSelector,
|
|
2876
|
-
openSessionSelector,
|
|
2877
|
-
openSettings,
|
|
2878
|
-
setAgent
|
|
2879
|
-
};
|
|
2880
|
-
}
|
|
2881
|
-
//#endregion
|
|
2882
|
-
//#region src/tui/tui-stream-assembler.ts
|
|
2883
|
-
function extractTextBlocksAndSignals(message) {
|
|
2884
|
-
if (!message || typeof message !== "object") return {
|
|
2885
|
-
textBlocks: [],
|
|
2886
|
-
sawNonTextContentBlocks: false
|
|
2887
|
-
};
|
|
2888
|
-
const content = message.content;
|
|
2889
|
-
if (typeof content === "string") {
|
|
2890
|
-
const text = content.trim();
|
|
2891
|
-
return {
|
|
2892
|
-
textBlocks: text ? [text] : [],
|
|
2893
|
-
sawNonTextContentBlocks: false
|
|
2894
|
-
};
|
|
2895
|
-
}
|
|
2896
|
-
if (!Array.isArray(content)) return {
|
|
2897
|
-
textBlocks: [],
|
|
2898
|
-
sawNonTextContentBlocks: false
|
|
2899
|
-
};
|
|
2900
|
-
const textBlocks = [];
|
|
2901
|
-
let sawNonTextContentBlocks = false;
|
|
2902
|
-
for (const block of content) {
|
|
2903
|
-
if (!block || typeof block !== "object") continue;
|
|
2904
|
-
const rec = block;
|
|
2905
|
-
if (rec.type === "text" && typeof rec.text === "string") {
|
|
2906
|
-
const text = rec.text.trim();
|
|
2907
|
-
if (text) textBlocks.push(text);
|
|
2908
|
-
continue;
|
|
2909
|
-
}
|
|
2910
|
-
if (typeof rec.type === "string" && rec.type !== "thinking") sawNonTextContentBlocks = true;
|
|
2911
|
-
}
|
|
2912
|
-
return {
|
|
2913
|
-
textBlocks,
|
|
2914
|
-
sawNonTextContentBlocks
|
|
2915
|
-
};
|
|
2916
|
-
}
|
|
2917
|
-
function isDroppedBoundaryTextBlockSubset(params) {
|
|
2918
|
-
const { streamedTextBlocks, finalTextBlocks } = params;
|
|
2919
|
-
if (finalTextBlocks.length === 0 || finalTextBlocks.length >= streamedTextBlocks.length) return false;
|
|
2920
|
-
if (finalTextBlocks.every((block, index) => streamedTextBlocks[index] === block)) return true;
|
|
2921
|
-
const suffixStart = streamedTextBlocks.length - finalTextBlocks.length;
|
|
2922
|
-
return finalTextBlocks.every((block, index) => streamedTextBlocks[suffixStart + index] === block);
|
|
2923
|
-
}
|
|
2924
|
-
function shouldPreserveBoundaryDroppedText(params) {
|
|
2925
|
-
if (params.boundaryDropMode === "off") return false;
|
|
2926
|
-
if (!(params.boundaryDropMode === "streamed-or-incoming" ? params.streamedSawNonTextContentBlocks || params.incomingSawNonTextContentBlocks : params.streamedSawNonTextContentBlocks)) return false;
|
|
2927
|
-
return isDroppedBoundaryTextBlockSubset({
|
|
2928
|
-
streamedTextBlocks: params.streamedTextBlocks,
|
|
2929
|
-
finalTextBlocks: params.nextContentBlocks
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
var TuiStreamAssembler = class {
|
|
2933
|
-
constructor() {
|
|
2934
|
-
this.runs = /* @__PURE__ */ new Map();
|
|
2935
|
-
}
|
|
2936
|
-
getOrCreateRun(runId) {
|
|
2937
|
-
let state = this.runs.get(runId);
|
|
2938
|
-
if (!state) {
|
|
2939
|
-
state = {
|
|
2940
|
-
thinkingText: "",
|
|
2941
|
-
contentText: "",
|
|
2942
|
-
contentBlocks: [],
|
|
2943
|
-
sawNonTextContentBlocks: false,
|
|
2944
|
-
displayText: ""
|
|
2945
|
-
};
|
|
2946
|
-
this.runs.set(runId, state);
|
|
2947
|
-
}
|
|
2948
|
-
return state;
|
|
2949
|
-
}
|
|
2950
|
-
updateRunState(state, message, showThinking, opts) {
|
|
2951
|
-
const thinkingText = extractThinkingFromMessage(message);
|
|
2952
|
-
const contentText = extractContentFromMessage(message);
|
|
2953
|
-
const { textBlocks, sawNonTextContentBlocks } = extractTextBlocksAndSignals(message);
|
|
2954
|
-
if (thinkingText) state.thinkingText = thinkingText;
|
|
2955
|
-
if (contentText) {
|
|
2956
|
-
const nextContentBlocks = textBlocks.length > 0 ? textBlocks : [contentText];
|
|
2957
|
-
if (!shouldPreserveBoundaryDroppedText({
|
|
2958
|
-
boundaryDropMode: opts?.boundaryDropMode ?? "off",
|
|
2959
|
-
streamedSawNonTextContentBlocks: state.sawNonTextContentBlocks,
|
|
2960
|
-
incomingSawNonTextContentBlocks: sawNonTextContentBlocks,
|
|
2961
|
-
streamedTextBlocks: state.contentBlocks,
|
|
2962
|
-
nextContentBlocks
|
|
2963
|
-
})) {
|
|
2964
|
-
state.contentText = contentText;
|
|
2965
|
-
state.contentBlocks = nextContentBlocks;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
if (sawNonTextContentBlocks) state.sawNonTextContentBlocks = true;
|
|
2969
|
-
state.displayText = composeThinkingAndContent({
|
|
2970
|
-
thinkingText: state.thinkingText,
|
|
2971
|
-
contentText: state.contentText,
|
|
2972
|
-
showThinking
|
|
2973
|
-
});
|
|
2974
|
-
}
|
|
2975
|
-
ingestDelta(runId, message, showThinking) {
|
|
2976
|
-
const state = this.getOrCreateRun(runId);
|
|
2977
|
-
const previousDisplayText = state.displayText;
|
|
2978
|
-
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-or-incoming" });
|
|
2979
|
-
if (!state.displayText || state.displayText === previousDisplayText) return null;
|
|
2980
|
-
return state.displayText;
|
|
2981
|
-
}
|
|
2982
|
-
finalize(runId, message, showThinking, errorMessage) {
|
|
2983
|
-
const state = this.getOrCreateRun(runId);
|
|
2984
|
-
const streamedDisplayText = state.displayText;
|
|
2985
|
-
const streamedTextBlocks = [...state.contentBlocks];
|
|
2986
|
-
const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks;
|
|
2987
|
-
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-only" });
|
|
2988
|
-
const finalComposed = state.displayText;
|
|
2989
|
-
const finalText = resolveFinalAssistantText({
|
|
2990
|
-
finalText: streamedSawNonTextContentBlocks && isDroppedBoundaryTextBlockSubset({
|
|
2991
|
-
streamedTextBlocks,
|
|
2992
|
-
finalTextBlocks: state.contentBlocks
|
|
2993
|
-
}) ? streamedDisplayText : finalComposed,
|
|
2994
|
-
streamedText: streamedDisplayText,
|
|
2995
|
-
errorMessage
|
|
2996
|
-
});
|
|
2997
|
-
this.runs.delete(runId);
|
|
2998
|
-
return finalText;
|
|
2999
|
-
}
|
|
3000
|
-
drop(runId) {
|
|
3001
|
-
this.runs.delete(runId);
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
//#endregion
|
|
3005
|
-
//#region src/tui/tui-event-handlers.ts
|
|
3006
|
-
const DEFAULT_STREAMING_WATCHDOG_MS = 3e4;
|
|
3007
|
-
function createEventHandlers(context) {
|
|
3008
|
-
const { chatLog, btw, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, noteLocalRunId, isLocalRunId, forgetLocalRunId, clearLocalRunIds, isLocalBtwRunId, forgetLocalBtwRunId, clearLocalBtwRunIds, localMode } = context;
|
|
3009
|
-
const finalizedRuns = /* @__PURE__ */ new Map();
|
|
3010
|
-
const sessionRuns = /* @__PURE__ */ new Map();
|
|
3011
|
-
let streamAssembler = new TuiStreamAssembler();
|
|
3012
|
-
let lastSessionKey = state.currentSessionKey;
|
|
3013
|
-
let pendingHistoryRefresh = false;
|
|
3014
|
-
const streamingWatchdogMs = typeof context.streamingWatchdogMs === "number" && Number.isFinite(context.streamingWatchdogMs) && context.streamingWatchdogMs >= 0 ? Math.floor(context.streamingWatchdogMs) : DEFAULT_STREAMING_WATCHDOG_MS;
|
|
3015
|
-
let streamingWatchdogTimer = null;
|
|
3016
|
-
let streamingWatchdogRunId = null;
|
|
3017
|
-
const clearStreamingWatchdog = () => {
|
|
3018
|
-
if (streamingWatchdogTimer) {
|
|
3019
|
-
clearTimeout(streamingWatchdogTimer);
|
|
3020
|
-
streamingWatchdogTimer = null;
|
|
3021
|
-
}
|
|
3022
|
-
streamingWatchdogRunId = null;
|
|
3023
|
-
};
|
|
3024
|
-
const armStreamingWatchdog = (runId) => {
|
|
3025
|
-
if (streamingWatchdogMs <= 0) return;
|
|
3026
|
-
if (streamingWatchdogTimer) clearTimeout(streamingWatchdogTimer);
|
|
3027
|
-
streamingWatchdogRunId = runId;
|
|
3028
|
-
streamingWatchdogTimer = setTimeout(() => {
|
|
3029
|
-
streamingWatchdogTimer = null;
|
|
3030
|
-
if (streamingWatchdogRunId !== runId || state.activeChatRunId !== runId) return;
|
|
3031
|
-
streamingWatchdogRunId = null;
|
|
3032
|
-
state.activeChatRunId = null;
|
|
3033
|
-
setActivityStatus("idle");
|
|
3034
|
-
chatLog.addSystem(`streaming watchdog: no stream updates for ${Math.round(streamingWatchdogMs / 1e3)}s; resetting status. The backend may have dropped this run silently — send a new message to resync.`);
|
|
3035
|
-
tui.requestRender();
|
|
3036
|
-
}, streamingWatchdogMs);
|
|
3037
|
-
const maybeUnref = streamingWatchdogTimer.unref;
|
|
3038
|
-
if (typeof maybeUnref === "function") maybeUnref.call(streamingWatchdogTimer);
|
|
3039
|
-
};
|
|
3040
|
-
const pruneRunMap = (runs) => {
|
|
3041
|
-
if (runs.size <= 200) return;
|
|
3042
|
-
const keepUntil = Date.now() - 600 * 1e3;
|
|
3043
|
-
for (const [key, ts] of runs) {
|
|
3044
|
-
if (runs.size <= 150) break;
|
|
3045
|
-
if (ts < keepUntil) runs.delete(key);
|
|
3046
|
-
}
|
|
3047
|
-
if (runs.size > 200) for (const key of runs.keys()) {
|
|
3048
|
-
runs.delete(key);
|
|
3049
|
-
if (runs.size <= 150) break;
|
|
3050
|
-
}
|
|
3051
|
-
};
|
|
3052
|
-
const syncSessionKey = () => {
|
|
3053
|
-
if (state.currentSessionKey === lastSessionKey) return;
|
|
3054
|
-
lastSessionKey = state.currentSessionKey;
|
|
3055
|
-
finalizedRuns.clear();
|
|
3056
|
-
sessionRuns.clear();
|
|
3057
|
-
streamAssembler = new TuiStreamAssembler();
|
|
3058
|
-
pendingHistoryRefresh = false;
|
|
3059
|
-
state.pendingOptimisticUserMessage = false;
|
|
3060
|
-
clearLocalRunIds?.();
|
|
3061
|
-
clearLocalBtwRunIds?.();
|
|
3062
|
-
btw.clear();
|
|
3063
|
-
clearStreamingWatchdog();
|
|
3064
|
-
};
|
|
3065
|
-
const flushPendingHistoryRefreshIfIdle = () => {
|
|
3066
|
-
if (!pendingHistoryRefresh || state.activeChatRunId) return;
|
|
3067
|
-
pendingHistoryRefresh = false;
|
|
3068
|
-
loadHistory?.();
|
|
3069
|
-
};
|
|
3070
|
-
const resolveAuthErrorHint = (errorMessage) => {
|
|
3071
|
-
if (!localMode || !isAuthErrorMessage(errorMessage)) return;
|
|
3072
|
-
const provider = state.sessionInfo.modelProvider?.trim();
|
|
3073
|
-
return provider ? `auth or provider access failed for ${provider}. Run /auth ${provider} to refresh credentials; if you already re-authed, switch models/providers because this account may still be blocked for inference.` : "auth or provider access failed for the current provider. Run /auth to refresh credentials; if you already re-authed, switch models/providers because this account may still be blocked for inference.";
|
|
3074
|
-
};
|
|
3075
|
-
const noteSessionRun = (runId) => {
|
|
3076
|
-
sessionRuns.set(runId, Date.now());
|
|
3077
|
-
pruneRunMap(sessionRuns);
|
|
3078
|
-
};
|
|
3079
|
-
const noteFinalizedRun = (runId) => {
|
|
3080
|
-
finalizedRuns.set(runId, Date.now());
|
|
3081
|
-
sessionRuns.delete(runId);
|
|
3082
|
-
streamAssembler.drop(runId);
|
|
3083
|
-
pruneRunMap(finalizedRuns);
|
|
3084
|
-
};
|
|
3085
|
-
const clearActiveRunIfMatch = (runId) => {
|
|
3086
|
-
if (state.activeChatRunId === runId) state.activeChatRunId = null;
|
|
3087
|
-
};
|
|
3088
|
-
const finalizeRun = (params) => {
|
|
3089
|
-
noteFinalizedRun(params.runId);
|
|
3090
|
-
clearActiveRunIfMatch(params.runId);
|
|
3091
|
-
flushPendingHistoryRefreshIfIdle();
|
|
3092
|
-
if (params.wasActiveRun) {
|
|
3093
|
-
setActivityStatus(params.status);
|
|
3094
|
-
clearStreamingWatchdog();
|
|
3095
|
-
} else if (streamingWatchdogRunId === params.runId) clearStreamingWatchdog();
|
|
3096
|
-
refreshSessionInfo?.();
|
|
3097
|
-
};
|
|
3098
|
-
const terminateRun = (params) => {
|
|
3099
|
-
streamAssembler.drop(params.runId);
|
|
3100
|
-
sessionRuns.delete(params.runId);
|
|
3101
|
-
clearActiveRunIfMatch(params.runId);
|
|
3102
|
-
flushPendingHistoryRefreshIfIdle();
|
|
3103
|
-
if (params.wasActiveRun) {
|
|
3104
|
-
setActivityStatus(params.status);
|
|
3105
|
-
clearStreamingWatchdog();
|
|
3106
|
-
} else if (streamingWatchdogRunId === params.runId) clearStreamingWatchdog();
|
|
3107
|
-
refreshSessionInfo?.();
|
|
3108
|
-
};
|
|
3109
|
-
const hasConcurrentActiveRun = (runId) => {
|
|
3110
|
-
const activeRunId = state.activeChatRunId;
|
|
3111
|
-
if (!activeRunId || activeRunId === runId) return false;
|
|
3112
|
-
return sessionRuns.has(activeRunId);
|
|
3113
|
-
};
|
|
3114
|
-
const maybeRefreshHistoryForRun = (runId, opts) => {
|
|
3115
|
-
if (isLocalRunId?.(runId) ?? false) {
|
|
3116
|
-
forgetLocalRunId?.(runId);
|
|
3117
|
-
if (!opts?.allowLocalWithoutDisplayableFinal) return;
|
|
3118
|
-
if (state.activeChatRunId && state.activeChatRunId !== runId) {
|
|
3119
|
-
pendingHistoryRefresh = true;
|
|
3120
|
-
return;
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
if (hasConcurrentActiveRun(runId)) return;
|
|
3124
|
-
pendingHistoryRefresh = false;
|
|
3125
|
-
loadHistory?.();
|
|
3126
|
-
};
|
|
3127
|
-
const isSameSessionKey = (left, right) => {
|
|
3128
|
-
const normalizedLeft = normalizeLowercaseStringOrEmpty(left);
|
|
3129
|
-
const normalizedRight = normalizeLowercaseStringOrEmpty(right);
|
|
3130
|
-
if (!normalizedLeft || !normalizedRight) return false;
|
|
3131
|
-
if (normalizedLeft === normalizedRight) return true;
|
|
3132
|
-
const parsedLeft = parseAgentSessionKey(normalizedLeft);
|
|
3133
|
-
const parsedRight = parseAgentSessionKey(normalizedRight);
|
|
3134
|
-
if (parsedLeft && parsedRight) return parsedLeft.agentId === parsedRight.agentId && parsedLeft.rest === parsedRight.rest;
|
|
3135
|
-
if (parsedLeft) return parsedLeft.rest === normalizedRight;
|
|
3136
|
-
if (parsedRight) return normalizedLeft === parsedRight.rest;
|
|
3137
|
-
return false;
|
|
3138
|
-
};
|
|
3139
|
-
const handleChatEvent = (payload) => {
|
|
3140
|
-
if (!payload || typeof payload !== "object") return;
|
|
3141
|
-
const evt = payload;
|
|
3142
|
-
syncSessionKey();
|
|
3143
|
-
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
3144
|
-
if (finalizedRuns.has(evt.runId)) {
|
|
3145
|
-
if (evt.state === "delta") return;
|
|
3146
|
-
if (evt.state === "final") return;
|
|
3147
|
-
}
|
|
3148
|
-
noteSessionRun(evt.runId);
|
|
3149
|
-
if (!state.activeChatRunId && !isLocalBtwRunId?.(evt.runId)) {
|
|
3150
|
-
state.activeChatRunId = evt.runId;
|
|
3151
|
-
if (state.pendingOptimisticUserMessage) {
|
|
3152
|
-
noteLocalRunId?.(evt.runId);
|
|
3153
|
-
state.pendingOptimisticUserMessage = false;
|
|
3154
|
-
}
|
|
3155
|
-
}
|
|
3156
|
-
if (evt.state === "delta") {
|
|
3157
|
-
setActivityStatus("streaming");
|
|
3158
|
-
if (state.activeChatRunId === evt.runId) armStreamingWatchdog(evt.runId);
|
|
3159
|
-
const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
|
|
3160
|
-
if (!displayText) return;
|
|
3161
|
-
chatLog.updateAssistant(displayText, evt.runId);
|
|
3162
|
-
}
|
|
3163
|
-
if (evt.state === "final") {
|
|
3164
|
-
const isLocalBtwRun = isLocalBtwRunId?.(evt.runId) ?? false;
|
|
3165
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
3166
|
-
if (!evt.message && isLocalBtwRun) {
|
|
3167
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
3168
|
-
noteFinalizedRun(evt.runId);
|
|
3169
|
-
tui.requestRender();
|
|
3170
|
-
return;
|
|
3171
|
-
}
|
|
3172
|
-
if (!evt.message) {
|
|
3173
|
-
maybeRefreshHistoryForRun(evt.runId, { allowLocalWithoutDisplayableFinal: true });
|
|
3174
|
-
chatLog.dropAssistant(evt.runId);
|
|
3175
|
-
finalizeRun({
|
|
3176
|
-
runId: evt.runId,
|
|
3177
|
-
wasActiveRun,
|
|
3178
|
-
status: "idle"
|
|
3179
|
-
});
|
|
3180
|
-
tui.requestRender();
|
|
3181
|
-
return;
|
|
3182
|
-
}
|
|
3183
|
-
if (isCommandMessage(evt.message)) {
|
|
3184
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
3185
|
-
const text = extractTextFromMessage(evt.message);
|
|
3186
|
-
if (text) chatLog.addSystem(text);
|
|
3187
|
-
finalizeRun({
|
|
3188
|
-
runId: evt.runId,
|
|
3189
|
-
wasActiveRun,
|
|
3190
|
-
status: "idle"
|
|
3191
|
-
});
|
|
3192
|
-
tui.requestRender();
|
|
3193
|
-
return;
|
|
3194
|
-
}
|
|
3195
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
3196
|
-
const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
|
|
3197
|
-
const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking, evt.errorMessage);
|
|
3198
|
-
if (finalText === "(no output)" && !isLocalRunId?.(evt.runId)) chatLog.dropAssistant(evt.runId);
|
|
3199
|
-
else chatLog.finalizeAssistant(finalText, evt.runId);
|
|
3200
|
-
finalizeRun({
|
|
3201
|
-
runId: evt.runId,
|
|
3202
|
-
wasActiveRun,
|
|
3203
|
-
status: stopReason === "error" ? "error" : "idle"
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
if (evt.state === "aborted") {
|
|
3207
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
3208
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
3209
|
-
chatLog.addSystem("run aborted");
|
|
3210
|
-
terminateRun({
|
|
3211
|
-
runId: evt.runId,
|
|
3212
|
-
wasActiveRun,
|
|
3213
|
-
status: "aborted"
|
|
3214
|
-
});
|
|
3215
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
3216
|
-
}
|
|
3217
|
-
if (evt.state === "error") {
|
|
3218
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
3219
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
3220
|
-
const errorMessage = evt.errorMessage ?? "unknown";
|
|
3221
|
-
chatLog.addSystem(resolveAuthErrorHint(errorMessage) ?? `run error: ${errorMessage}`);
|
|
3222
|
-
terminateRun({
|
|
3223
|
-
runId: evt.runId,
|
|
3224
|
-
wasActiveRun,
|
|
3225
|
-
status: "error"
|
|
3226
|
-
});
|
|
3227
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
3228
|
-
}
|
|
3229
|
-
tui.requestRender();
|
|
3230
|
-
};
|
|
3231
|
-
const handleAgentEvent = (payload) => {
|
|
3232
|
-
if (!payload || typeof payload !== "object") return;
|
|
3233
|
-
const evt = payload;
|
|
3234
|
-
syncSessionKey();
|
|
3235
|
-
const isActiveRun = evt.runId === state.activeChatRunId;
|
|
3236
|
-
if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
|
|
3237
|
-
if (evt.stream === "tool") {
|
|
3238
|
-
const verbose = state.sessionInfo.verboseLevel ?? "off";
|
|
3239
|
-
const allowToolEvents = verbose !== "off";
|
|
3240
|
-
const allowToolOutput = verbose === "full";
|
|
3241
|
-
if (!allowToolEvents) return;
|
|
3242
|
-
const data = evt.data ?? {};
|
|
3243
|
-
const phase = asString(data.phase, "");
|
|
3244
|
-
const toolCallId = asString(data.toolCallId, "");
|
|
3245
|
-
const toolName = asString(data.name, "tool");
|
|
3246
|
-
if (!toolCallId) return;
|
|
3247
|
-
if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
|
|
3248
|
-
else if (phase === "update") {
|
|
3249
|
-
if (!allowToolOutput) return;
|
|
3250
|
-
chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
|
|
3251
|
-
} else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
|
|
3252
|
-
else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
|
|
3253
|
-
tui.requestRender();
|
|
3254
|
-
return;
|
|
3255
|
-
}
|
|
3256
|
-
if (evt.stream === "lifecycle") {
|
|
3257
|
-
if (!isActiveRun) return;
|
|
3258
|
-
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
3259
|
-
if (phase === "start") setActivityStatus("running");
|
|
3260
|
-
if (phase === "end") setActivityStatus("idle");
|
|
3261
|
-
if (phase === "error") setActivityStatus("error");
|
|
3262
|
-
tui.requestRender();
|
|
3263
|
-
}
|
|
3264
|
-
};
|
|
3265
|
-
const handleBtwEvent = (payload) => {
|
|
3266
|
-
if (!payload || typeof payload !== "object") return;
|
|
3267
|
-
const evt = payload;
|
|
3268
|
-
syncSessionKey();
|
|
3269
|
-
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
3270
|
-
if (evt.kind !== "btw") return;
|
|
3271
|
-
const question = evt.question.trim();
|
|
3272
|
-
const text = evt.text.trim();
|
|
3273
|
-
if (!question || !text) return;
|
|
3274
|
-
btw.showResult({
|
|
3275
|
-
question,
|
|
3276
|
-
text,
|
|
3277
|
-
isError: evt.isError
|
|
3278
|
-
});
|
|
3279
|
-
tui.requestRender();
|
|
3280
|
-
};
|
|
3281
|
-
const dispose = () => {
|
|
3282
|
-
clearStreamingWatchdog();
|
|
3283
|
-
};
|
|
3284
|
-
return {
|
|
3285
|
-
handleChatEvent,
|
|
3286
|
-
handleAgentEvent,
|
|
3287
|
-
handleBtwEvent,
|
|
3288
|
-
dispose
|
|
3289
|
-
};
|
|
3290
|
-
}
|
|
3291
|
-
//#endregion
|
|
3292
|
-
//#region src/tui/tui-local-shell.ts
|
|
3293
|
-
function createLocalShellRunner(deps) {
|
|
3294
|
-
let localExecAsked = false;
|
|
3295
|
-
let localExecAllowed = false;
|
|
3296
|
-
const createSelector = deps.createSelector ?? createSearchableSelectList;
|
|
3297
|
-
const spawnCommand = deps.spawnCommand ?? spawn;
|
|
3298
|
-
const getCwd = deps.getCwd ?? (() => process.cwd());
|
|
3299
|
-
const env = deps.env ?? process.env;
|
|
3300
|
-
const maxChars = deps.maxOutputChars ?? 4e4;
|
|
3301
|
-
const ensureLocalExecAllowed = async () => {
|
|
3302
|
-
if (localExecAllowed) return true;
|
|
3303
|
-
if (localExecAsked) return false;
|
|
3304
|
-
localExecAsked = true;
|
|
3305
|
-
return await new Promise((resolve) => {
|
|
3306
|
-
deps.chatLog.addSystem("Allow local shell commands for this session?");
|
|
3307
|
-
deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
|
|
3308
|
-
deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
|
|
3309
|
-
const selector = createSelector([{
|
|
3310
|
-
value: "no",
|
|
3311
|
-
label: "No"
|
|
3312
|
-
}, {
|
|
3313
|
-
value: "yes",
|
|
3314
|
-
label: "Yes"
|
|
3315
|
-
}], 2);
|
|
3316
|
-
selector.onSelect = (item) => {
|
|
3317
|
-
deps.closeOverlay();
|
|
3318
|
-
if (item.value === "yes") {
|
|
3319
|
-
localExecAllowed = true;
|
|
3320
|
-
deps.chatLog.addSystem("local shell: enabled for this session");
|
|
3321
|
-
resolve(true);
|
|
3322
|
-
} else {
|
|
3323
|
-
deps.chatLog.addSystem("local shell: not enabled");
|
|
3324
|
-
resolve(false);
|
|
3325
|
-
}
|
|
3326
|
-
deps.tui.requestRender();
|
|
3327
|
-
};
|
|
3328
|
-
selector.onCancel = () => {
|
|
3329
|
-
deps.closeOverlay();
|
|
3330
|
-
deps.chatLog.addSystem("local shell: cancelled");
|
|
3331
|
-
deps.tui.requestRender();
|
|
3332
|
-
resolve(false);
|
|
3333
|
-
};
|
|
3334
|
-
deps.openOverlay(selector);
|
|
3335
|
-
deps.tui.requestRender();
|
|
3336
|
-
});
|
|
3337
|
-
};
|
|
3338
|
-
const runLocalShellLine = async (line) => {
|
|
3339
|
-
const cmd = line.slice(1);
|
|
3340
|
-
if (cmd === "") return;
|
|
3341
|
-
if (localExecAsked && !localExecAllowed) {
|
|
3342
|
-
deps.chatLog.addSystem("local shell: not enabled for this session");
|
|
3343
|
-
deps.tui.requestRender();
|
|
3344
|
-
return;
|
|
3345
|
-
}
|
|
3346
|
-
if (!await ensureLocalExecAllowed()) return;
|
|
3347
|
-
deps.chatLog.addSystem(`[local] $ ${cmd}`);
|
|
3348
|
-
deps.tui.requestRender();
|
|
3349
|
-
const appendWithCap = (text, chunk) => {
|
|
3350
|
-
const combined = text + chunk;
|
|
3351
|
-
return combined.length > maxChars ? combined.slice(-maxChars) : combined;
|
|
3352
|
-
};
|
|
3353
|
-
await new Promise((resolve) => {
|
|
3354
|
-
const child = spawnCommand(cmd, {
|
|
3355
|
-
shell: true,
|
|
3356
|
-
cwd: getCwd(),
|
|
3357
|
-
env: {
|
|
3358
|
-
...env,
|
|
3359
|
-
GENESIS_SHELL: "tui-local"
|
|
3360
|
-
}
|
|
3361
|
-
});
|
|
3362
|
-
let stdout = "";
|
|
3363
|
-
let stderr = "";
|
|
3364
|
-
child.stdout.on("data", (buf) => {
|
|
3365
|
-
stdout = appendWithCap(stdout, buf.toString("utf8"));
|
|
3366
|
-
});
|
|
3367
|
-
child.stderr.on("data", (buf) => {
|
|
3368
|
-
stderr = appendWithCap(stderr, buf.toString("utf8"));
|
|
3369
|
-
});
|
|
3370
|
-
child.on("close", (code, signal) => {
|
|
3371
|
-
const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
|
|
3372
|
-
if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
|
|
3373
|
-
deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${signal})` : ""}`);
|
|
3374
|
-
deps.tui.requestRender();
|
|
3375
|
-
resolve();
|
|
3376
|
-
});
|
|
3377
|
-
child.on("error", (err) => {
|
|
3378
|
-
deps.chatLog.addSystem(`[local] error: ${String(err)}`);
|
|
3379
|
-
deps.tui.requestRender();
|
|
3380
|
-
resolve();
|
|
3381
|
-
});
|
|
3382
|
-
});
|
|
3383
|
-
};
|
|
3384
|
-
return { runLocalShellLine };
|
|
3385
|
-
}
|
|
3386
|
-
//#endregion
|
|
3387
|
-
//#region src/tui/tui-overlays.ts
|
|
3388
|
-
function createOverlayHandlers(host, fallbackFocus) {
|
|
3389
|
-
const openOverlay = (component) => {
|
|
3390
|
-
host.showOverlay(component);
|
|
3391
|
-
};
|
|
3392
|
-
const closeOverlay = () => {
|
|
3393
|
-
if (host.hasOverlay()) {
|
|
3394
|
-
host.hideOverlay();
|
|
3395
|
-
return;
|
|
3396
|
-
}
|
|
3397
|
-
host.setFocus(fallbackFocus);
|
|
3398
|
-
};
|
|
3399
|
-
return {
|
|
3400
|
-
openOverlay,
|
|
3401
|
-
closeOverlay
|
|
3402
|
-
};
|
|
3403
|
-
}
|
|
3404
|
-
//#endregion
|
|
3405
|
-
//#region src/tui/tui-session-actions.ts
|
|
3406
|
-
function createSessionActions(context) {
|
|
3407
|
-
const { client, chatLog, btw, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
|
|
3408
|
-
let refreshSessionInfoPromise = Promise.resolve();
|
|
3409
|
-
let lastSessionDefaults = null;
|
|
3410
|
-
const applyAgentsResult = (result) => {
|
|
3411
|
-
state.agentDefaultId = normalizeAgentId(result.defaultId);
|
|
3412
|
-
state.sessionMainKey = normalizeMainKey(result.mainKey);
|
|
3413
|
-
state.sessionScope = result.scope ?? state.sessionScope;
|
|
3414
|
-
state.agents = result.agents.map((agent) => ({
|
|
3415
|
-
id: normalizeAgentId(agent.id),
|
|
3416
|
-
name: normalizeOptionalString(agent.name)
|
|
3417
|
-
}));
|
|
3418
|
-
agentNames.clear();
|
|
3419
|
-
for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
|
|
3420
|
-
if (!state.initialSessionApplied) {
|
|
3421
|
-
if (initialSessionAgentId) {
|
|
3422
|
-
if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
|
|
3423
|
-
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
3424
|
-
const nextSessionKey = resolveSessionKey(initialSessionInput);
|
|
3425
|
-
if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
|
|
3426
|
-
state.initialSessionApplied = true;
|
|
3427
|
-
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
3428
|
-
updateHeader();
|
|
3429
|
-
updateFooter();
|
|
3430
|
-
};
|
|
3431
|
-
const refreshAgents = async () => {
|
|
3432
|
-
try {
|
|
3433
|
-
applyAgentsResult(await client.listAgents());
|
|
3434
|
-
} catch (err) {
|
|
3435
|
-
chatLog.addSystem(`agents list failed: ${String(err)}`);
|
|
3436
|
-
}
|
|
3437
|
-
};
|
|
3438
|
-
const updateAgentFromSessionKey = (key) => {
|
|
3439
|
-
const parsed = parseAgentSessionKey(key);
|
|
3440
|
-
if (!parsed) return;
|
|
3441
|
-
const next = normalizeAgentId(parsed.agentId);
|
|
3442
|
-
if (next !== state.currentAgentId) state.currentAgentId = next;
|
|
3443
|
-
};
|
|
3444
|
-
const resolveModelSelection = (entry) => {
|
|
3445
|
-
return resolveSessionInfoModelSelection({
|
|
3446
|
-
currentProvider: state.sessionInfo.modelProvider,
|
|
3447
|
-
currentModel: state.sessionInfo.model,
|
|
3448
|
-
defaultProvider: lastSessionDefaults?.modelProvider,
|
|
3449
|
-
defaultModel: lastSessionDefaults?.model,
|
|
3450
|
-
entryProvider: entry?.modelProvider,
|
|
3451
|
-
entryModel: entry?.model,
|
|
3452
|
-
overrideProvider: entry?.providerOverride,
|
|
3453
|
-
overrideModel: entry?.modelOverride
|
|
3454
|
-
});
|
|
3455
|
-
};
|
|
3456
|
-
const applySessionInfo = (params) => {
|
|
3457
|
-
const entry = params.entry ?? void 0;
|
|
3458
|
-
const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
|
|
3459
|
-
const previousDefaults = lastSessionDefaults;
|
|
3460
|
-
const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
|
|
3461
|
-
if (params.defaults) lastSessionDefaults = params.defaults;
|
|
3462
|
-
const entryUpdatedAt = entry?.updatedAt ?? null;
|
|
3463
|
-
const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
|
|
3464
|
-
if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged) return;
|
|
3465
|
-
const next = { ...state.sessionInfo };
|
|
3466
|
-
if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
|
|
3467
|
-
if (entry?.fastMode !== void 0) next.fastMode = entry.fastMode;
|
|
3468
|
-
if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
|
|
3469
|
-
if (entry?.traceLevel !== void 0) next.traceLevel = entry.traceLevel;
|
|
3470
|
-
if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
|
|
3471
|
-
if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
|
|
3472
|
-
if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
|
|
3473
|
-
if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
|
|
3474
|
-
if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
|
|
3475
|
-
if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
|
|
3476
|
-
if (entry?.displayName !== void 0) next.displayName = entry.displayName;
|
|
3477
|
-
if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
|
|
3478
|
-
const selection = resolveModelSelection(entry);
|
|
3479
|
-
if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
|
|
3480
|
-
if (selection.model !== void 0) next.model = selection.model;
|
|
3481
|
-
state.sessionInfo = next;
|
|
3482
|
-
updateAutocompleteProvider();
|
|
3483
|
-
updateFooter();
|
|
3484
|
-
tui.requestRender();
|
|
3485
|
-
};
|
|
3486
|
-
const runRefreshSessionInfo = async () => {
|
|
3487
|
-
try {
|
|
3488
|
-
const resolveListAgentId = () => {
|
|
3489
|
-
if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
|
|
3490
|
-
const parsed = parseAgentSessionKey(state.currentSessionKey);
|
|
3491
|
-
return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
|
|
3492
|
-
};
|
|
3493
|
-
const listAgentId = resolveListAgentId();
|
|
3494
|
-
const result = await client.listSessions({
|
|
3495
|
-
includeGlobal: false,
|
|
3496
|
-
includeUnknown: false,
|
|
3497
|
-
agentId: listAgentId
|
|
3498
|
-
});
|
|
3499
|
-
const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
|
|
3500
|
-
const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
|
|
3501
|
-
const entry = result.sessions.find((row) => {
|
|
3502
|
-
if (row.key === state.currentSessionKey) return true;
|
|
3503
|
-
return normalizeMatchKey(row.key) === currentMatchKey;
|
|
3504
|
-
});
|
|
3505
|
-
if (entry?.key && entry.key !== state.currentSessionKey) {
|
|
3506
|
-
updateAgentFromSessionKey(entry.key);
|
|
3507
|
-
state.currentSessionKey = entry.key;
|
|
3508
|
-
updateHeader();
|
|
3509
|
-
}
|
|
3510
|
-
applySessionInfo({
|
|
3511
|
-
entry,
|
|
3512
|
-
defaults: result.defaults
|
|
3513
|
-
});
|
|
3514
|
-
} catch (err) {
|
|
3515
|
-
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
3516
|
-
}
|
|
3517
|
-
};
|
|
3518
|
-
const refreshSessionInfo = async () => {
|
|
3519
|
-
refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
|
|
3520
|
-
await refreshSessionInfoPromise;
|
|
3521
|
-
};
|
|
3522
|
-
const applySessionInfoFromPatch = (result) => {
|
|
3523
|
-
if (!result?.entry) return;
|
|
3524
|
-
if (result.key && result.key !== state.currentSessionKey) {
|
|
3525
|
-
updateAgentFromSessionKey(result.key);
|
|
3526
|
-
state.currentSessionKey = result.key;
|
|
3527
|
-
updateHeader();
|
|
3528
|
-
}
|
|
3529
|
-
const resolved = result.resolved;
|
|
3530
|
-
applySessionInfo({
|
|
3531
|
-
entry: resolved && (resolved.modelProvider || resolved.model) ? {
|
|
3532
|
-
...result.entry,
|
|
3533
|
-
modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
|
|
3534
|
-
model: resolved.model ?? result.entry.model
|
|
3535
|
-
} : result.entry,
|
|
3536
|
-
force: true
|
|
3537
|
-
});
|
|
3538
|
-
};
|
|
3539
|
-
const loadHistory = async () => {
|
|
3540
|
-
try {
|
|
3541
|
-
const record = await client.loadHistory({
|
|
3542
|
-
sessionKey: state.currentSessionKey,
|
|
3543
|
-
limit: opts.historyLimit ?? 200
|
|
3544
|
-
});
|
|
3545
|
-
state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
|
|
3546
|
-
state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
|
|
3547
|
-
state.sessionInfo.fastMode = record.fastMode ?? state.sessionInfo.fastMode;
|
|
3548
|
-
state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
|
|
3549
|
-
state.sessionInfo.traceLevel = record.traceLevel ?? state.sessionInfo.traceLevel;
|
|
3550
|
-
const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
|
|
3551
|
-
chatLog.clearAll();
|
|
3552
|
-
btw.clear();
|
|
3553
|
-
chatLog.addSystem(`session ${state.currentSessionKey}`);
|
|
3554
|
-
for (const entry of record.messages ?? []) {
|
|
3555
|
-
if (!entry || typeof entry !== "object") continue;
|
|
3556
|
-
const message = entry;
|
|
3557
|
-
if (isCommandMessage(message)) {
|
|
3558
|
-
const text = extractTextFromMessage(message);
|
|
3559
|
-
if (text) chatLog.addSystem(text);
|
|
3560
|
-
continue;
|
|
3561
|
-
}
|
|
3562
|
-
if (message.role === "user") {
|
|
3563
|
-
const text = extractTextFromMessage(message);
|
|
3564
|
-
if (text) chatLog.addUser(text);
|
|
3565
|
-
continue;
|
|
3566
|
-
}
|
|
3567
|
-
if (message.role === "assistant") {
|
|
3568
|
-
const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
|
|
3569
|
-
if (text) chatLog.finalizeAssistant(text);
|
|
3570
|
-
continue;
|
|
3571
|
-
}
|
|
3572
|
-
if (message.role === "toolResult") {
|
|
3573
|
-
if (!showTools) continue;
|
|
3574
|
-
const toolCallId = asString(message.toolCallId, "");
|
|
3575
|
-
const toolName = asString(message.toolName, "tool");
|
|
3576
|
-
chatLog.startTool(toolCallId, toolName, {}).setResult({
|
|
3577
|
-
content: Array.isArray(message.content) ? message.content : [],
|
|
3578
|
-
details: typeof message.details === "object" && message.details ? message.details : void 0
|
|
3579
|
-
}, { isError: Boolean(message.isError) });
|
|
3580
|
-
}
|
|
3581
|
-
}
|
|
3582
|
-
state.historyLoaded = true;
|
|
3583
|
-
} catch (err) {
|
|
3584
|
-
chatLog.addSystem(`history failed: ${String(err)}`);
|
|
3585
|
-
}
|
|
3586
|
-
await refreshSessionInfo();
|
|
3587
|
-
tui.requestRender();
|
|
3588
|
-
};
|
|
3589
|
-
const setSession = async (rawKey) => {
|
|
3590
|
-
const nextKey = resolveSessionKey(rawKey);
|
|
3591
|
-
updateAgentFromSessionKey(nextKey);
|
|
3592
|
-
state.currentSessionKey = nextKey;
|
|
3593
|
-
state.activeChatRunId = null;
|
|
3594
|
-
setActivityStatus("idle");
|
|
3595
|
-
state.currentSessionId = null;
|
|
3596
|
-
state.sessionInfo.updatedAt = null;
|
|
3597
|
-
state.historyLoaded = false;
|
|
3598
|
-
clearLocalRunIds?.();
|
|
3599
|
-
btw.clear();
|
|
3600
|
-
updateHeader();
|
|
3601
|
-
updateFooter();
|
|
3602
|
-
await loadHistory();
|
|
3603
|
-
};
|
|
3604
|
-
const abortActive = async () => {
|
|
3605
|
-
if (!state.activeChatRunId) {
|
|
3606
|
-
chatLog.addSystem("no active run");
|
|
3607
|
-
tui.requestRender();
|
|
3608
|
-
return;
|
|
3609
|
-
}
|
|
3610
|
-
try {
|
|
3611
|
-
await client.abortChat({
|
|
3612
|
-
sessionKey: state.currentSessionKey,
|
|
3613
|
-
runId: state.activeChatRunId
|
|
3614
|
-
});
|
|
3615
|
-
setActivityStatus("aborted");
|
|
3616
|
-
} catch (err) {
|
|
3617
|
-
chatLog.addSystem(`abort failed: ${String(err)}`);
|
|
3618
|
-
setActivityStatus("abort failed");
|
|
3619
|
-
}
|
|
3620
|
-
tui.requestRender();
|
|
3621
|
-
};
|
|
3622
|
-
return {
|
|
3623
|
-
applyAgentsResult,
|
|
3624
|
-
refreshAgents,
|
|
3625
|
-
refreshSessionInfo,
|
|
3626
|
-
applySessionInfoFromPatch,
|
|
3627
|
-
loadHistory,
|
|
3628
|
-
setSession,
|
|
3629
|
-
abortActive
|
|
3630
|
-
};
|
|
3631
|
-
}
|
|
3632
|
-
//#endregion
|
|
3633
|
-
//#region src/tui/tui-submit.ts
|
|
3634
|
-
function createEditorSubmitHandler(params) {
|
|
3635
|
-
return (text) => {
|
|
3636
|
-
const raw = text;
|
|
3637
|
-
const value = raw.trim();
|
|
3638
|
-
params.editor.setText("");
|
|
3639
|
-
if (!value) return;
|
|
3640
|
-
if (raw.startsWith("!") && raw !== "!") {
|
|
3641
|
-
params.editor.addToHistory(raw);
|
|
3642
|
-
params.handleBangLine(raw);
|
|
3643
|
-
return;
|
|
3644
|
-
}
|
|
3645
|
-
params.editor.addToHistory(value);
|
|
3646
|
-
if (value.startsWith("/")) {
|
|
3647
|
-
params.handleCommand(value);
|
|
3648
|
-
return;
|
|
3649
|
-
}
|
|
3650
|
-
params.sendMessage(value);
|
|
3651
|
-
};
|
|
3652
|
-
}
|
|
3653
|
-
function shouldEnableWindowsGitBashPasteFallback(params) {
|
|
3654
|
-
const platform = params?.platform ?? process.platform;
|
|
3655
|
-
const env = params?.env ?? process.env;
|
|
3656
|
-
const termProgram = normalizeLowercaseStringOrEmpty(env.TERM_PROGRAM);
|
|
3657
|
-
if (platform === "darwin") {
|
|
3658
|
-
if (termProgram.includes("iterm") || termProgram.includes("apple_terminal")) return true;
|
|
3659
|
-
return false;
|
|
3660
|
-
}
|
|
3661
|
-
if (platform !== "win32") return false;
|
|
3662
|
-
const msystem = (env.MSYSTEM ?? "").toUpperCase();
|
|
3663
|
-
const shell = env.SHELL ?? "";
|
|
3664
|
-
if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) return true;
|
|
3665
|
-
if (normalizeLowercaseStringOrEmpty(shell).includes("bash")) return true;
|
|
3666
|
-
return termProgram.includes("mintty");
|
|
3667
|
-
}
|
|
3668
|
-
function createSubmitBurstCoalescer(params) {
|
|
3669
|
-
const windowMs = Math.max(1, params.burstWindowMs ?? 50);
|
|
3670
|
-
const now = params.now ?? (() => Date.now());
|
|
3671
|
-
const setTimer = params.setTimer ?? setTimeout;
|
|
3672
|
-
const clearTimer = params.clearTimer ?? clearTimeout;
|
|
3673
|
-
let pending = null;
|
|
3674
|
-
let pendingAt = 0;
|
|
3675
|
-
let flushTimer = null;
|
|
3676
|
-
const clearFlushTimer = () => {
|
|
3677
|
-
if (!flushTimer) return;
|
|
3678
|
-
clearTimer(flushTimer);
|
|
3679
|
-
flushTimer = null;
|
|
3680
|
-
};
|
|
3681
|
-
const flushPending = () => {
|
|
3682
|
-
if (pending === null) return;
|
|
3683
|
-
const value = pending;
|
|
3684
|
-
pending = null;
|
|
3685
|
-
pendingAt = 0;
|
|
3686
|
-
clearFlushTimer();
|
|
3687
|
-
params.submit(value);
|
|
3688
|
-
};
|
|
3689
|
-
const scheduleFlush = () => {
|
|
3690
|
-
clearFlushTimer();
|
|
3691
|
-
flushTimer = setTimer(() => {
|
|
3692
|
-
flushPending();
|
|
3693
|
-
}, windowMs);
|
|
3694
|
-
};
|
|
3695
|
-
return (value) => {
|
|
3696
|
-
if (!params.enabled) {
|
|
3697
|
-
params.submit(value);
|
|
3698
|
-
return;
|
|
3699
|
-
}
|
|
3700
|
-
if (value.includes("\n")) {
|
|
3701
|
-
flushPending();
|
|
3702
|
-
params.submit(value);
|
|
3703
|
-
return;
|
|
3704
|
-
}
|
|
3705
|
-
const ts = now();
|
|
3706
|
-
if (pending === null) {
|
|
3707
|
-
pending = value;
|
|
3708
|
-
pendingAt = ts;
|
|
3709
|
-
scheduleFlush();
|
|
3710
|
-
return;
|
|
3711
|
-
}
|
|
3712
|
-
if (ts - pendingAt <= windowMs) {
|
|
3713
|
-
pending = `${pending}\n${value}`;
|
|
3714
|
-
pendingAt = ts;
|
|
3715
|
-
scheduleFlush();
|
|
3716
|
-
return;
|
|
3717
|
-
}
|
|
3718
|
-
flushPending();
|
|
3719
|
-
pending = value;
|
|
3720
|
-
pendingAt = ts;
|
|
3721
|
-
scheduleFlush();
|
|
3722
|
-
};
|
|
3723
|
-
}
|
|
3724
|
-
//#endregion
|
|
3725
|
-
//#region src/tui/tui-waiting.ts
|
|
3726
|
-
const defaultWaitingPhrases = [
|
|
3727
|
-
"flibbertigibbeting",
|
|
3728
|
-
"kerfuffling",
|
|
3729
|
-
"dillydallying",
|
|
3730
|
-
"twiddling thumbs",
|
|
3731
|
-
"noodling",
|
|
3732
|
-
"bamboozling",
|
|
3733
|
-
"moseying",
|
|
3734
|
-
"hobnobbing",
|
|
3735
|
-
"pondering",
|
|
3736
|
-
"conjuring"
|
|
3737
|
-
];
|
|
3738
|
-
function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
|
|
3739
|
-
return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
|
|
3740
|
-
}
|
|
3741
|
-
function shimmerText(theme, text, tick) {
|
|
3742
|
-
const width = 6;
|
|
3743
|
-
const hi = (ch) => theme.bold(theme.accentSoft(ch));
|
|
3744
|
-
const pos = tick % (text.length + width);
|
|
3745
|
-
const start = Math.max(0, pos - width);
|
|
3746
|
-
const end = Math.min(text.length - 1, pos);
|
|
3747
|
-
let out = "";
|
|
3748
|
-
for (let i = 0; i < text.length; i++) {
|
|
3749
|
-
const ch = text[i];
|
|
3750
|
-
out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
|
|
3751
|
-
}
|
|
3752
|
-
return out;
|
|
3753
|
-
}
|
|
3754
|
-
function buildWaitingStatusMessage(params) {
|
|
3755
|
-
const phrase = pickWaitingPhrase(params.tick, params.phrases);
|
|
3756
|
-
return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
|
|
3757
|
-
}
|
|
3758
|
-
//#endregion
|
|
3759
|
-
//#region src/tui/tui.ts
|
|
3760
|
-
const GENESIS_CLI_WRAPPER_PATH = fileURLToPath(new URL("../../genesis.mjs", import.meta.url));
|
|
3761
|
-
const GENESIS_RUN_NODE_SCRIPT_PATH = fileURLToPath(new URL("../../scripts/run-node.mjs", import.meta.url));
|
|
3762
|
-
const GENESIS_DIST_ENTRY_JS_PATH = fileURLToPath(new URL("../../dist/entry.js", import.meta.url));
|
|
3763
|
-
const GENESIS_DIST_ENTRY_MJS_PATH = fileURLToPath(new URL("../../dist/entry.mjs", import.meta.url));
|
|
3764
|
-
const OPENAI_CODEX_PROVIDER = "openai-codex";
|
|
3765
|
-
/** Resolve the absolute path to the `codex` CLI binary, or `null` if not installed. */
|
|
3766
|
-
function resolveCodexCliBin() {
|
|
3767
|
-
try {
|
|
3768
|
-
return execFileSync(process.platform === "win32" ? "where" : "which", ["codex"], { encoding: "utf8" }).trim().split(/\r?\n/)[0] || null;
|
|
3769
|
-
} catch {
|
|
3770
|
-
return null;
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
function resolveLocalAuthCliInvocation(params) {
|
|
3774
|
-
const hasDistEntry = params?.hasDistEntry ?? (existsSync(GENESIS_DIST_ENTRY_JS_PATH) || existsSync(GENESIS_DIST_ENTRY_MJS_PATH));
|
|
3775
|
-
const hasRunNodeScript = params?.hasRunNodeScript ?? existsSync(GENESIS_RUN_NODE_SCRIPT_PATH);
|
|
3776
|
-
const command = params?.execPath ?? process.execPath;
|
|
3777
|
-
const wrapperPath = params?.wrapperPath ?? GENESIS_CLI_WRAPPER_PATH;
|
|
3778
|
-
const runNodePath = params?.runNodePath ?? GENESIS_RUN_NODE_SCRIPT_PATH;
|
|
3779
|
-
return hasDistEntry || !hasRunNodeScript ? {
|
|
3780
|
-
command,
|
|
3781
|
-
args: [
|
|
3782
|
-
wrapperPath,
|
|
3783
|
-
"models",
|
|
3784
|
-
"auth",
|
|
3785
|
-
"login"
|
|
3786
|
-
]
|
|
3787
|
-
} : {
|
|
3788
|
-
command,
|
|
3789
|
-
args: [
|
|
3790
|
-
runNodePath,
|
|
3791
|
-
"models",
|
|
3792
|
-
"auth",
|
|
3793
|
-
"login"
|
|
3794
|
-
]
|
|
3795
|
-
};
|
|
3796
|
-
}
|
|
3797
|
-
function resolveLocalAuthSpawnOptions(params) {
|
|
3798
|
-
return (params.platform ?? process.platform) === "win32" && /\.(cmd|bat)$/iu.test(params.command.trim()) ? { shell: true } : {};
|
|
3799
|
-
}
|
|
3800
|
-
function resolveLocalAuthSpawnCwd(params) {
|
|
3801
|
-
const defaultCwd = params.defaultCwd ?? process.cwd();
|
|
3802
|
-
const entryArg = params.args[0]?.trim();
|
|
3803
|
-
if (!entryArg) return defaultCwd;
|
|
3804
|
-
const entryBase = path.basename(entryArg).toLowerCase();
|
|
3805
|
-
if (entryBase === "genesis.mjs") return path.dirname(entryArg);
|
|
3806
|
-
if (entryBase === "run-node.mjs") return path.dirname(path.dirname(entryArg));
|
|
3807
|
-
return defaultCwd;
|
|
3808
|
-
}
|
|
3809
|
-
function resolveTuiSessionKey(params) {
|
|
3810
|
-
const trimmed = (params.raw ?? "").trim();
|
|
3811
|
-
if (!trimmed) {
|
|
3812
|
-
if (params.sessionScope === "global") return "global";
|
|
3813
|
-
return buildAgentMainSessionKey({
|
|
3814
|
-
agentId: params.currentAgentId,
|
|
3815
|
-
mainKey: params.sessionMainKey
|
|
3816
|
-
});
|
|
3817
|
-
}
|
|
3818
|
-
if (trimmed === "global" || trimmed === "unknown") return trimmed;
|
|
3819
|
-
if (trimmed.startsWith("agent:")) return normalizeLowercaseStringOrEmpty(trimmed);
|
|
3820
|
-
return `agent:${params.currentAgentId}:${normalizeLowercaseStringOrEmpty(trimmed)}`;
|
|
3821
|
-
}
|
|
3822
|
-
function resolveInitialTuiAgentId(params) {
|
|
3823
|
-
const parsed = parseAgentSessionKey((params.initialSessionInput ?? "").trim());
|
|
3824
|
-
if (parsed?.agentId) return normalizeAgentId(parsed.agentId);
|
|
3825
|
-
const inferredFromWorkspace = resolveAgentIdByWorkspacePath(params.cfg, params.cwd ?? process.cwd());
|
|
3826
|
-
if (inferredFromWorkspace) return inferredFromWorkspace;
|
|
3827
|
-
return normalizeAgentId(params.fallbackAgentId);
|
|
3828
|
-
}
|
|
3829
|
-
function resolveGatewayDisconnectState(reason) {
|
|
3830
|
-
const reasonLabel = reason?.trim() ? reason.trim() : "closed";
|
|
3831
|
-
if (/pairing required/i.test(reasonLabel)) return {
|
|
3832
|
-
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3833
|
-
activityStatus: "pairing required: run genesis devices list",
|
|
3834
|
-
pairingHint: "Pairing required. Run `genesis devices list`, approve your request ID, then reconnect."
|
|
3835
|
-
};
|
|
3836
|
-
return {
|
|
3837
|
-
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3838
|
-
activityStatus: "idle"
|
|
3839
|
-
};
|
|
3840
|
-
}
|
|
3841
|
-
function createBackspaceDeduper(params) {
|
|
3842
|
-
const dedupeWindowMs = Math.max(0, Math.floor(params?.dedupeWindowMs ?? 8));
|
|
3843
|
-
const now = params?.now ?? (() => Date.now());
|
|
3844
|
-
let lastBackspaceAt = -1;
|
|
3845
|
-
return (data) => {
|
|
3846
|
-
if (!matchesKey(data, Key.backspace)) return data;
|
|
3847
|
-
const ts = now();
|
|
3848
|
-
if (lastBackspaceAt >= 0 && ts - lastBackspaceAt <= dedupeWindowMs) return "";
|
|
3849
|
-
lastBackspaceAt = ts;
|
|
3850
|
-
return data;
|
|
3851
|
-
};
|
|
3852
|
-
}
|
|
3853
|
-
function isIgnorableTuiStopError(error) {
|
|
3854
|
-
if (!error || typeof error !== "object") return false;
|
|
3855
|
-
const err = error;
|
|
3856
|
-
const code = typeof err.code === "string" ? err.code : "";
|
|
3857
|
-
const syscall = typeof err.syscall === "string" ? err.syscall : "";
|
|
3858
|
-
const message = typeof err.message === "string" ? err.message : "";
|
|
3859
|
-
if (code === "EBADF" && syscall === "setRawMode") return true;
|
|
3860
|
-
return /setRawMode/i.test(message) && /EBADF/i.test(message);
|
|
3861
|
-
}
|
|
3862
|
-
function stopTuiSafely(stop) {
|
|
3863
|
-
try {
|
|
3864
|
-
stop();
|
|
3865
|
-
} catch (error) {
|
|
3866
|
-
if (!isIgnorableTuiStopError(error)) throw error;
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
async function drainAndStopTuiSafely(tui) {
|
|
3870
|
-
if (typeof tui.terminal?.drainInput === "function") try {
|
|
3871
|
-
await tui.terminal.drainInput();
|
|
3872
|
-
} catch {}
|
|
3873
|
-
stopTuiSafely(() => tui.stop());
|
|
3874
|
-
}
|
|
3875
|
-
function resolveCtrlCAction(params) {
|
|
3876
|
-
const exitWindowMs = Math.max(1, Math.floor(params.exitWindowMs ?? 1e3));
|
|
3877
|
-
if (params.hasInput) return {
|
|
3878
|
-
action: "clear",
|
|
3879
|
-
nextLastCtrlCAt: params.now
|
|
3880
|
-
};
|
|
3881
|
-
if (params.now - params.lastCtrlCAt <= exitWindowMs) return {
|
|
3882
|
-
action: "exit",
|
|
3883
|
-
nextLastCtrlCAt: params.lastCtrlCAt
|
|
3884
|
-
};
|
|
3885
|
-
return {
|
|
3886
|
-
action: "warn",
|
|
3887
|
-
nextLastCtrlCAt: params.now
|
|
3888
|
-
};
|
|
3889
|
-
}
|
|
3890
|
-
async function runTui(opts) {
|
|
3891
|
-
const isLocalMode = opts.local === true;
|
|
3892
|
-
const config = loadConfig();
|
|
3893
|
-
const initialSessionInput = (opts.session ?? "").trim();
|
|
3894
|
-
let sessionScope = config.session?.scope ?? "per-sender";
|
|
3895
|
-
let sessionMainKey = normalizeMainKey(config.session?.mainKey);
|
|
3896
|
-
let agentDefaultId = resolveDefaultAgentId(config);
|
|
3897
|
-
let currentAgentId = resolveInitialTuiAgentId({
|
|
3898
|
-
cfg: config,
|
|
3899
|
-
fallbackAgentId: agentDefaultId,
|
|
3900
|
-
initialSessionInput,
|
|
3901
|
-
cwd: process.cwd()
|
|
3902
|
-
});
|
|
3903
|
-
let agents = [];
|
|
3904
|
-
const agentNames = /* @__PURE__ */ new Map();
|
|
3905
|
-
let currentSessionKey = "";
|
|
3906
|
-
let initialSessionApplied = false;
|
|
3907
|
-
let currentSessionId = null;
|
|
3908
|
-
let activeChatRunId = null;
|
|
3909
|
-
let pendingOptimisticUserMessage = false;
|
|
3910
|
-
let historyLoaded = false;
|
|
3911
|
-
let isConnected = false;
|
|
3912
|
-
let wasDisconnected = false;
|
|
3913
|
-
let toolsExpanded = false;
|
|
3914
|
-
let showThinking = false;
|
|
3915
|
-
let pairingHintShown = false;
|
|
3916
|
-
const localRunIds = /* @__PURE__ */ new Set();
|
|
3917
|
-
const localBtwRunIds = /* @__PURE__ */ new Set();
|
|
3918
|
-
const deliverDefault = opts.deliver ?? false;
|
|
3919
|
-
const autoMessage = opts.message?.trim();
|
|
3920
|
-
let autoMessageSent = false;
|
|
3921
|
-
let sessionInfo = {};
|
|
3922
|
-
let lastCtrlCAt = 0;
|
|
3923
|
-
let exitRequested = false;
|
|
3924
|
-
let activityStatus = "idle";
|
|
3925
|
-
let connectionStatus = isLocalMode ? "starting local runtime" : "connecting";
|
|
3926
|
-
let statusTimeout = null;
|
|
3927
|
-
let statusTimer = null;
|
|
3928
|
-
let statusStartedAt = null;
|
|
3929
|
-
let lastActivityStatus = activityStatus;
|
|
3930
|
-
const state = {
|
|
3931
|
-
get agentDefaultId() {
|
|
3932
|
-
return agentDefaultId;
|
|
3933
|
-
},
|
|
3934
|
-
set agentDefaultId(value) {
|
|
3935
|
-
agentDefaultId = value;
|
|
3936
|
-
},
|
|
3937
|
-
get sessionMainKey() {
|
|
3938
|
-
return sessionMainKey;
|
|
3939
|
-
},
|
|
3940
|
-
set sessionMainKey(value) {
|
|
3941
|
-
sessionMainKey = value;
|
|
3942
|
-
},
|
|
3943
|
-
get sessionScope() {
|
|
3944
|
-
return sessionScope;
|
|
3945
|
-
},
|
|
3946
|
-
set sessionScope(value) {
|
|
3947
|
-
sessionScope = value;
|
|
3948
|
-
},
|
|
3949
|
-
get agents() {
|
|
3950
|
-
return agents;
|
|
3951
|
-
},
|
|
3952
|
-
set agents(value) {
|
|
3953
|
-
agents = value;
|
|
3954
|
-
},
|
|
3955
|
-
get currentAgentId() {
|
|
3956
|
-
return currentAgentId;
|
|
3957
|
-
},
|
|
3958
|
-
set currentAgentId(value) {
|
|
3959
|
-
currentAgentId = value;
|
|
3960
|
-
},
|
|
3961
|
-
get currentSessionKey() {
|
|
3962
|
-
return currentSessionKey;
|
|
3963
|
-
},
|
|
3964
|
-
set currentSessionKey(value) {
|
|
3965
|
-
currentSessionKey = value;
|
|
3966
|
-
},
|
|
3967
|
-
get currentSessionId() {
|
|
3968
|
-
return currentSessionId;
|
|
3969
|
-
},
|
|
3970
|
-
set currentSessionId(value) {
|
|
3971
|
-
currentSessionId = value;
|
|
3972
|
-
},
|
|
3973
|
-
get activeChatRunId() {
|
|
3974
|
-
return activeChatRunId;
|
|
3975
|
-
},
|
|
3976
|
-
set activeChatRunId(value) {
|
|
3977
|
-
activeChatRunId = value;
|
|
3978
|
-
},
|
|
3979
|
-
get pendingOptimisticUserMessage() {
|
|
3980
|
-
return pendingOptimisticUserMessage;
|
|
3981
|
-
},
|
|
3982
|
-
set pendingOptimisticUserMessage(value) {
|
|
3983
|
-
pendingOptimisticUserMessage = value;
|
|
3984
|
-
},
|
|
3985
|
-
get historyLoaded() {
|
|
3986
|
-
return historyLoaded;
|
|
3987
|
-
},
|
|
3988
|
-
set historyLoaded(value) {
|
|
3989
|
-
historyLoaded = value;
|
|
3990
|
-
},
|
|
3991
|
-
get sessionInfo() {
|
|
3992
|
-
return sessionInfo;
|
|
3993
|
-
},
|
|
3994
|
-
set sessionInfo(value) {
|
|
3995
|
-
sessionInfo = value;
|
|
3996
|
-
},
|
|
3997
|
-
get initialSessionApplied() {
|
|
3998
|
-
return initialSessionApplied;
|
|
3999
|
-
},
|
|
4000
|
-
set initialSessionApplied(value) {
|
|
4001
|
-
initialSessionApplied = value;
|
|
4002
|
-
},
|
|
4003
|
-
get isConnected() {
|
|
4004
|
-
return isConnected;
|
|
4005
|
-
},
|
|
4006
|
-
set isConnected(value) {
|
|
4007
|
-
isConnected = value;
|
|
4008
|
-
},
|
|
4009
|
-
get autoMessageSent() {
|
|
4010
|
-
return autoMessageSent;
|
|
4011
|
-
},
|
|
4012
|
-
set autoMessageSent(value) {
|
|
4013
|
-
autoMessageSent = value;
|
|
4014
|
-
},
|
|
4015
|
-
get toolsExpanded() {
|
|
4016
|
-
return toolsExpanded;
|
|
4017
|
-
},
|
|
4018
|
-
set toolsExpanded(value) {
|
|
4019
|
-
toolsExpanded = value;
|
|
4020
|
-
},
|
|
4021
|
-
get showThinking() {
|
|
4022
|
-
return showThinking;
|
|
4023
|
-
},
|
|
4024
|
-
set showThinking(value) {
|
|
4025
|
-
showThinking = value;
|
|
4026
|
-
},
|
|
4027
|
-
get connectionStatus() {
|
|
4028
|
-
return connectionStatus;
|
|
4029
|
-
},
|
|
4030
|
-
set connectionStatus(value) {
|
|
4031
|
-
connectionStatus = value;
|
|
4032
|
-
},
|
|
4033
|
-
get activityStatus() {
|
|
4034
|
-
return activityStatus;
|
|
4035
|
-
},
|
|
4036
|
-
set activityStatus(value) {
|
|
4037
|
-
activityStatus = value;
|
|
4038
|
-
},
|
|
4039
|
-
get statusTimeout() {
|
|
4040
|
-
return statusTimeout;
|
|
4041
|
-
},
|
|
4042
|
-
set statusTimeout(value) {
|
|
4043
|
-
statusTimeout = value;
|
|
4044
|
-
},
|
|
4045
|
-
get lastCtrlCAt() {
|
|
4046
|
-
return lastCtrlCAt;
|
|
4047
|
-
},
|
|
4048
|
-
set lastCtrlCAt(value) {
|
|
4049
|
-
lastCtrlCAt = value;
|
|
4050
|
-
}
|
|
4051
|
-
};
|
|
4052
|
-
const noteLocalRunId = (runId) => {
|
|
4053
|
-
if (!runId) return;
|
|
4054
|
-
localRunIds.add(runId);
|
|
4055
|
-
if (localRunIds.size > 200) {
|
|
4056
|
-
const [first] = localRunIds;
|
|
4057
|
-
if (first) localRunIds.delete(first);
|
|
4058
|
-
}
|
|
4059
|
-
};
|
|
4060
|
-
const forgetLocalRunId = (runId) => {
|
|
4061
|
-
localRunIds.delete(runId);
|
|
4062
|
-
};
|
|
4063
|
-
const isLocalRunId = (runId) => localRunIds.has(runId);
|
|
4064
|
-
const clearLocalRunIds = () => {
|
|
4065
|
-
localRunIds.clear();
|
|
4066
|
-
};
|
|
4067
|
-
const noteLocalBtwRunId = (runId) => {
|
|
4068
|
-
if (!runId) return;
|
|
4069
|
-
localBtwRunIds.add(runId);
|
|
4070
|
-
if (localBtwRunIds.size > 200) {
|
|
4071
|
-
const [first] = localBtwRunIds;
|
|
4072
|
-
if (first) localBtwRunIds.delete(first);
|
|
4073
|
-
}
|
|
4074
|
-
};
|
|
4075
|
-
const forgetLocalBtwRunId = (runId) => {
|
|
4076
|
-
localBtwRunIds.delete(runId);
|
|
4077
|
-
};
|
|
4078
|
-
const isLocalBtwRunId = (runId) => localBtwRunIds.has(runId);
|
|
4079
|
-
const clearLocalBtwRunIds = () => {
|
|
4080
|
-
localBtwRunIds.clear();
|
|
4081
|
-
};
|
|
4082
|
-
const client = opts.local ? new EmbeddedTuiBackend() : await GatewayChatClient.connect({
|
|
4083
|
-
url: opts.url,
|
|
4084
|
-
token: opts.token,
|
|
4085
|
-
password: opts.password
|
|
4086
|
-
});
|
|
4087
|
-
const previousConsoleSubsystemFilter = isLocalMode ? loggingState.consoleSubsystemFilter ? [...loggingState.consoleSubsystemFilter] : null : null;
|
|
4088
|
-
if (isLocalMode) setConsoleSubsystemFilter(["__genesis_tui_quiet__"]);
|
|
4089
|
-
const tui = new TUI(new ProcessTerminal());
|
|
4090
|
-
const dedupeBackspace = createBackspaceDeduper();
|
|
4091
|
-
tui.addInputListener((data) => {
|
|
4092
|
-
const next = dedupeBackspace(data);
|
|
4093
|
-
if (next.length === 0) return { consume: true };
|
|
4094
|
-
return { data: next };
|
|
4095
|
-
});
|
|
4096
|
-
const header = new Text("", 1, 0);
|
|
4097
|
-
const statusContainer = new Container();
|
|
4098
|
-
const footer = new Text("", 1, 0);
|
|
4099
|
-
const chatLog = new ChatLog();
|
|
4100
|
-
const editor = new CustomEditor(tui, editorTheme);
|
|
4101
|
-
const root = new Container();
|
|
4102
|
-
root.addChild(header);
|
|
4103
|
-
root.addChild(chatLog);
|
|
4104
|
-
root.addChild(statusContainer);
|
|
4105
|
-
root.addChild(footer);
|
|
4106
|
-
root.addChild(editor);
|
|
4107
|
-
const updateAutocompleteProvider = () => {
|
|
4108
|
-
editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
|
|
4109
|
-
cfg: config,
|
|
4110
|
-
local: isLocalMode,
|
|
4111
|
-
provider: sessionInfo.modelProvider,
|
|
4112
|
-
model: sessionInfo.model
|
|
4113
|
-
}), process.cwd()));
|
|
4114
|
-
};
|
|
4115
|
-
tui.addChild(root);
|
|
4116
|
-
tui.setFocus(editor);
|
|
4117
|
-
const formatSessionKey = (key) => {
|
|
4118
|
-
if (key === "global" || key === "unknown") return key;
|
|
4119
|
-
return parseAgentSessionKey(key)?.rest ?? key;
|
|
4120
|
-
};
|
|
4121
|
-
const formatAgentLabel = (id) => {
|
|
4122
|
-
const name = agentNames.get(id);
|
|
4123
|
-
return name ? `${id} (${name})` : id;
|
|
4124
|
-
};
|
|
4125
|
-
const resolveSessionKey = (raw) => {
|
|
4126
|
-
return resolveTuiSessionKey({
|
|
4127
|
-
raw,
|
|
4128
|
-
sessionScope,
|
|
4129
|
-
currentAgentId,
|
|
4130
|
-
sessionMainKey
|
|
4131
|
-
});
|
|
4132
|
-
};
|
|
4133
|
-
currentSessionKey = resolveSessionKey(initialSessionInput);
|
|
4134
|
-
const updateHeader = () => {
|
|
4135
|
-
const sessionLabel = formatSessionKey(currentSessionKey);
|
|
4136
|
-
const agentLabel = formatAgentLabel(currentAgentId);
|
|
4137
|
-
header.setText(theme.header(`genesis tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
|
|
4138
|
-
};
|
|
4139
|
-
const busyStates = new Set([
|
|
4140
|
-
"sending",
|
|
4141
|
-
"waiting",
|
|
4142
|
-
"streaming",
|
|
4143
|
-
"running"
|
|
4144
|
-
]);
|
|
4145
|
-
let statusText = null;
|
|
4146
|
-
let statusLoader = null;
|
|
4147
|
-
const formatElapsed = (startMs) => {
|
|
4148
|
-
const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
|
|
4149
|
-
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
4150
|
-
return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
|
|
4151
|
-
};
|
|
4152
|
-
const ensureStatusText = () => {
|
|
4153
|
-
if (statusText) return;
|
|
4154
|
-
statusContainer.clear();
|
|
4155
|
-
statusLoader?.stop();
|
|
4156
|
-
statusLoader = null;
|
|
4157
|
-
statusText = new Text("", 1, 0);
|
|
4158
|
-
statusContainer.addChild(statusText);
|
|
4159
|
-
};
|
|
4160
|
-
const ensureStatusLoader = () => {
|
|
4161
|
-
if (statusLoader) return;
|
|
4162
|
-
statusContainer.clear();
|
|
4163
|
-
statusText = null;
|
|
4164
|
-
statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
|
|
4165
|
-
statusContainer.addChild(statusLoader);
|
|
4166
|
-
};
|
|
4167
|
-
let waitingTick = 0;
|
|
4168
|
-
let waitingTimer = null;
|
|
4169
|
-
let waitingPhrase = null;
|
|
4170
|
-
const updateBusyStatusMessage = () => {
|
|
4171
|
-
if (!statusLoader || !statusStartedAt) return;
|
|
4172
|
-
const elapsed = formatElapsed(statusStartedAt);
|
|
4173
|
-
if (activityStatus === "waiting") {
|
|
4174
|
-
waitingTick++;
|
|
4175
|
-
statusLoader.setMessage(buildWaitingStatusMessage({
|
|
4176
|
-
theme,
|
|
4177
|
-
tick: waitingTick,
|
|
4178
|
-
elapsed,
|
|
4179
|
-
connectionStatus,
|
|
4180
|
-
phrases: waitingPhrase ? [waitingPhrase] : void 0
|
|
4181
|
-
}));
|
|
4182
|
-
return;
|
|
4183
|
-
}
|
|
4184
|
-
statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
|
|
4185
|
-
};
|
|
4186
|
-
const startStatusTimer = () => {
|
|
4187
|
-
if (statusTimer) return;
|
|
4188
|
-
statusTimer = setInterval(() => {
|
|
4189
|
-
if (!busyStates.has(activityStatus)) return;
|
|
4190
|
-
updateBusyStatusMessage();
|
|
4191
|
-
}, 1e3);
|
|
4192
|
-
};
|
|
4193
|
-
const stopStatusTimer = () => {
|
|
4194
|
-
if (!statusTimer) return;
|
|
4195
|
-
clearInterval(statusTimer);
|
|
4196
|
-
statusTimer = null;
|
|
4197
|
-
};
|
|
4198
|
-
const startWaitingTimer = () => {
|
|
4199
|
-
if (waitingTimer) return;
|
|
4200
|
-
if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
|
|
4201
|
-
waitingTick = 0;
|
|
4202
|
-
waitingTimer = setInterval(() => {
|
|
4203
|
-
if (activityStatus !== "waiting") return;
|
|
4204
|
-
updateBusyStatusMessage();
|
|
4205
|
-
}, 120);
|
|
4206
|
-
};
|
|
4207
|
-
const stopWaitingTimer = () => {
|
|
4208
|
-
if (!waitingTimer) return;
|
|
4209
|
-
clearInterval(waitingTimer);
|
|
4210
|
-
waitingTimer = null;
|
|
4211
|
-
waitingPhrase = null;
|
|
4212
|
-
};
|
|
4213
|
-
const renderStatus = () => {
|
|
4214
|
-
if (busyStates.has(activityStatus)) {
|
|
4215
|
-
if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
|
|
4216
|
-
ensureStatusLoader();
|
|
4217
|
-
if (activityStatus === "waiting") {
|
|
4218
|
-
stopStatusTimer();
|
|
4219
|
-
startWaitingTimer();
|
|
4220
|
-
} else {
|
|
4221
|
-
stopWaitingTimer();
|
|
4222
|
-
startStatusTimer();
|
|
4223
|
-
}
|
|
4224
|
-
updateBusyStatusMessage();
|
|
4225
|
-
} else {
|
|
4226
|
-
statusStartedAt = null;
|
|
4227
|
-
stopStatusTimer();
|
|
4228
|
-
stopWaitingTimer();
|
|
4229
|
-
statusLoader?.stop();
|
|
4230
|
-
statusLoader = null;
|
|
4231
|
-
ensureStatusText();
|
|
4232
|
-
const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
|
|
4233
|
-
statusText?.setText(theme.dim(text));
|
|
4234
|
-
}
|
|
4235
|
-
lastActivityStatus = activityStatus;
|
|
4236
|
-
};
|
|
4237
|
-
const setConnectionStatus = (text, ttlMs) => {
|
|
4238
|
-
connectionStatus = text;
|
|
4239
|
-
renderStatus();
|
|
4240
|
-
if (statusTimeout) clearTimeout(statusTimeout);
|
|
4241
|
-
if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
|
|
4242
|
-
connectionStatus = isConnected ? isLocalMode ? "local ready" : "connected" : isLocalMode ? "local stopped" : "disconnected";
|
|
4243
|
-
renderStatus();
|
|
4244
|
-
}, ttlMs);
|
|
4245
|
-
};
|
|
4246
|
-
const setActivityStatus = (text) => {
|
|
4247
|
-
activityStatus = text;
|
|
4248
|
-
renderStatus();
|
|
4249
|
-
};
|
|
4250
|
-
const withTuiSuspended = async (work) => {
|
|
4251
|
-
await drainAndStopTuiSafely(tui);
|
|
4252
|
-
if (isLocalMode) setConsoleSubsystemFilter(previousConsoleSubsystemFilter);
|
|
4253
|
-
try {
|
|
4254
|
-
return await work();
|
|
4255
|
-
} finally {
|
|
4256
|
-
if (isLocalMode) setConsoleSubsystemFilter(["__genesis_tui_quiet__"]);
|
|
4257
|
-
tui.start();
|
|
4258
|
-
tui.setFocus(editor);
|
|
4259
|
-
updateHeader();
|
|
4260
|
-
updateFooter();
|
|
4261
|
-
tui.requestRender(true);
|
|
4262
|
-
}
|
|
4263
|
-
};
|
|
4264
|
-
const runAuthFlow = isLocalMode ? async (params) => await withTuiSuspended(async () => await new Promise((resolve, reject) => {
|
|
4265
|
-
const provider = params.provider?.trim() || void 0;
|
|
4266
|
-
const codexBin = provider === OPENAI_CODEX_PROVIDER || !provider && sessionInfo.modelProvider === OPENAI_CODEX_PROVIDER ? resolveCodexCliBin() : null;
|
|
4267
|
-
let command;
|
|
4268
|
-
let args;
|
|
4269
|
-
if (codexBin) {
|
|
4270
|
-
command = codexBin;
|
|
4271
|
-
args = ["login"];
|
|
4272
|
-
} else {
|
|
4273
|
-
({command, args} = resolveLocalAuthCliInvocation());
|
|
4274
|
-
if (provider) args.push("--provider", provider);
|
|
4275
|
-
}
|
|
4276
|
-
const child = spawn(command, args, {
|
|
4277
|
-
cwd: resolveLocalAuthSpawnCwd({
|
|
4278
|
-
args,
|
|
4279
|
-
defaultCwd: process.cwd()
|
|
4280
|
-
}),
|
|
4281
|
-
env: process.env,
|
|
4282
|
-
stdio: "inherit",
|
|
4283
|
-
...resolveLocalAuthSpawnOptions({ command })
|
|
4284
|
-
});
|
|
4285
|
-
child.once("error", reject);
|
|
4286
|
-
child.once("exit", (exitCode, signal) => {
|
|
4287
|
-
resolve({
|
|
4288
|
-
exitCode,
|
|
4289
|
-
signal
|
|
4290
|
-
});
|
|
4291
|
-
});
|
|
4292
|
-
})) : void 0;
|
|
4293
|
-
const updateFooter = () => {
|
|
4294
|
-
const sessionKeyLabel = formatSessionKey(currentSessionKey);
|
|
4295
|
-
const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
|
|
4296
|
-
const agentLabel = formatAgentLabel(currentAgentId);
|
|
4297
|
-
const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
|
|
4298
|
-
const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
|
|
4299
|
-
const think = sessionInfo.thinkingLevel ?? "off";
|
|
4300
|
-
const fast = sessionInfo.fastMode === true;
|
|
4301
|
-
const verbose = sessionInfo.verboseLevel ?? "off";
|
|
4302
|
-
const reasoning = sessionInfo.reasoningLevel ?? "off";
|
|
4303
|
-
const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
|
|
4304
|
-
const footerParts = [
|
|
4305
|
-
`agent ${agentLabel}`,
|
|
4306
|
-
`session ${sessionLabel}`,
|
|
4307
|
-
modelLabel,
|
|
4308
|
-
think !== "off" ? `think ${think}` : null,
|
|
4309
|
-
fast ? "fast" : null,
|
|
4310
|
-
verbose !== "off" ? `verbose ${verbose}` : null,
|
|
4311
|
-
reasoningLabel,
|
|
4312
|
-
tokens
|
|
4313
|
-
].filter(Boolean);
|
|
4314
|
-
footer.setText(theme.dim(footerParts.join(" | ")));
|
|
4315
|
-
};
|
|
4316
|
-
const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
|
|
4317
|
-
const btw = {
|
|
4318
|
-
showResult: (params) => {
|
|
4319
|
-
chatLog.showBtw(params);
|
|
4320
|
-
},
|
|
4321
|
-
clear: () => {
|
|
4322
|
-
chatLog.dismissBtw();
|
|
4323
|
-
}
|
|
4324
|
-
};
|
|
4325
|
-
const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
|
|
4326
|
-
client,
|
|
4327
|
-
chatLog,
|
|
4328
|
-
btw,
|
|
4329
|
-
tui,
|
|
4330
|
-
opts,
|
|
4331
|
-
state,
|
|
4332
|
-
agentNames,
|
|
4333
|
-
initialSessionInput,
|
|
4334
|
-
initialSessionAgentId: (() => {
|
|
4335
|
-
if (!initialSessionInput) return null;
|
|
4336
|
-
const parsed = parseAgentSessionKey(initialSessionInput);
|
|
4337
|
-
return parsed ? normalizeAgentId(parsed.agentId) : null;
|
|
4338
|
-
})(),
|
|
4339
|
-
resolveSessionKey,
|
|
4340
|
-
updateHeader,
|
|
4341
|
-
updateFooter,
|
|
4342
|
-
updateAutocompleteProvider,
|
|
4343
|
-
setActivityStatus,
|
|
4344
|
-
clearLocalRunIds
|
|
4345
|
-
});
|
|
4346
|
-
const { handleChatEvent, handleAgentEvent, handleBtwEvent } = createEventHandlers({
|
|
4347
|
-
chatLog,
|
|
4348
|
-
btw,
|
|
4349
|
-
tui,
|
|
4350
|
-
state,
|
|
4351
|
-
localMode: isLocalMode,
|
|
4352
|
-
setActivityStatus,
|
|
4353
|
-
refreshSessionInfo,
|
|
4354
|
-
loadHistory,
|
|
4355
|
-
noteLocalRunId,
|
|
4356
|
-
isLocalRunId,
|
|
4357
|
-
forgetLocalRunId,
|
|
4358
|
-
clearLocalRunIds,
|
|
4359
|
-
isLocalBtwRunId,
|
|
4360
|
-
forgetLocalBtwRunId,
|
|
4361
|
-
clearLocalBtwRunIds
|
|
4362
|
-
});
|
|
4363
|
-
const requestExit = () => {
|
|
4364
|
-
if (exitRequested) return;
|
|
4365
|
-
exitRequested = true;
|
|
4366
|
-
client.stop();
|
|
4367
|
-
drainAndStopTuiSafely(tui).then(() => {
|
|
4368
|
-
process.exit(0);
|
|
4369
|
-
});
|
|
4370
|
-
};
|
|
4371
|
-
const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
|
|
4372
|
-
client,
|
|
4373
|
-
chatLog,
|
|
4374
|
-
tui,
|
|
4375
|
-
opts,
|
|
4376
|
-
state,
|
|
4377
|
-
deliverDefault,
|
|
4378
|
-
openOverlay,
|
|
4379
|
-
closeOverlay,
|
|
4380
|
-
refreshSessionInfo,
|
|
4381
|
-
applySessionInfoFromPatch,
|
|
4382
|
-
loadHistory,
|
|
4383
|
-
setSession,
|
|
4384
|
-
refreshAgents,
|
|
4385
|
-
abortActive,
|
|
4386
|
-
setActivityStatus,
|
|
4387
|
-
formatSessionKey,
|
|
4388
|
-
noteLocalRunId,
|
|
4389
|
-
noteLocalBtwRunId,
|
|
4390
|
-
forgetLocalRunId,
|
|
4391
|
-
forgetLocalBtwRunId,
|
|
4392
|
-
runAuthFlow,
|
|
4393
|
-
requestExit
|
|
4394
|
-
});
|
|
4395
|
-
const { runLocalShellLine } = createLocalShellRunner({
|
|
4396
|
-
chatLog,
|
|
4397
|
-
tui,
|
|
4398
|
-
openOverlay,
|
|
4399
|
-
closeOverlay
|
|
4400
|
-
});
|
|
4401
|
-
updateAutocompleteProvider();
|
|
4402
|
-
editor.onSubmit = createSubmitBurstCoalescer({
|
|
4403
|
-
submit: createEditorSubmitHandler({
|
|
4404
|
-
editor,
|
|
4405
|
-
handleCommand,
|
|
4406
|
-
sendMessage,
|
|
4407
|
-
handleBangLine: runLocalShellLine
|
|
4408
|
-
}),
|
|
4409
|
-
enabled: shouldEnableWindowsGitBashPasteFallback()
|
|
4410
|
-
});
|
|
4411
|
-
editor.onEscape = () => {
|
|
4412
|
-
if (chatLog.hasVisibleBtw()) {
|
|
4413
|
-
chatLog.dismissBtw();
|
|
4414
|
-
tui.requestRender();
|
|
4415
|
-
return;
|
|
4416
|
-
}
|
|
4417
|
-
abortActive();
|
|
4418
|
-
};
|
|
4419
|
-
const handleCtrlC = () => {
|
|
4420
|
-
const now = Date.now();
|
|
4421
|
-
const decision = resolveCtrlCAction({
|
|
4422
|
-
hasInput: editor.getText().trim().length > 0,
|
|
4423
|
-
now,
|
|
4424
|
-
lastCtrlCAt
|
|
4425
|
-
});
|
|
4426
|
-
lastCtrlCAt = decision.nextLastCtrlCAt;
|
|
4427
|
-
if (decision.action === "clear") {
|
|
4428
|
-
editor.setText("");
|
|
4429
|
-
setActivityStatus("cleared input; press ctrl+c again to exit");
|
|
4430
|
-
tui.requestRender();
|
|
4431
|
-
return;
|
|
4432
|
-
}
|
|
4433
|
-
if (decision.action === "exit") {
|
|
4434
|
-
requestExit();
|
|
4435
|
-
return;
|
|
4436
|
-
}
|
|
4437
|
-
setActivityStatus("press ctrl+c again to exit");
|
|
4438
|
-
tui.requestRender();
|
|
4439
|
-
};
|
|
4440
|
-
editor.onCtrlC = () => {
|
|
4441
|
-
handleCtrlC();
|
|
4442
|
-
};
|
|
4443
|
-
editor.onCtrlD = () => {
|
|
4444
|
-
requestExit();
|
|
4445
|
-
};
|
|
4446
|
-
editor.onCtrlO = () => {
|
|
4447
|
-
toolsExpanded = !toolsExpanded;
|
|
4448
|
-
chatLog.setToolsExpanded(toolsExpanded);
|
|
4449
|
-
setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
|
|
4450
|
-
tui.requestRender();
|
|
4451
|
-
};
|
|
4452
|
-
editor.onCtrlL = () => {
|
|
4453
|
-
openModelSelector();
|
|
4454
|
-
};
|
|
4455
|
-
editor.onCtrlG = () => {
|
|
4456
|
-
openAgentSelector();
|
|
4457
|
-
};
|
|
4458
|
-
editor.onCtrlP = () => {
|
|
4459
|
-
openSessionSelector();
|
|
4460
|
-
};
|
|
4461
|
-
editor.onCtrlT = () => {
|
|
4462
|
-
showThinking = !showThinking;
|
|
4463
|
-
loadHistory();
|
|
4464
|
-
};
|
|
4465
|
-
tui.addInputListener((data) => {
|
|
4466
|
-
if (!chatLog.hasVisibleBtw()) return;
|
|
4467
|
-
if (editor.getText().length > 0) return;
|
|
4468
|
-
if (matchesKey(data, "enter")) {
|
|
4469
|
-
chatLog.dismissBtw();
|
|
4470
|
-
tui.requestRender();
|
|
4471
|
-
return { consume: true };
|
|
4472
|
-
}
|
|
4473
|
-
});
|
|
4474
|
-
client.onEvent = (evt) => {
|
|
4475
|
-
if (evt.event === "chat") handleChatEvent(evt.payload);
|
|
4476
|
-
if (evt.event === "chat.side_result") handleBtwEvent(evt.payload);
|
|
4477
|
-
if (evt.event === "agent") handleAgentEvent(evt.payload);
|
|
4478
|
-
};
|
|
4479
|
-
client.onConnected = () => {
|
|
4480
|
-
isConnected = true;
|
|
4481
|
-
pairingHintShown = false;
|
|
4482
|
-
const reconnected = wasDisconnected;
|
|
4483
|
-
wasDisconnected = false;
|
|
4484
|
-
setConnectionStatus(isLocalMode ? "local ready" : "connected");
|
|
4485
|
-
(async () => {
|
|
4486
|
-
await refreshAgents();
|
|
4487
|
-
updateHeader();
|
|
4488
|
-
await loadHistory();
|
|
4489
|
-
setConnectionStatus(isLocalMode ? "local ready" : reconnected ? "gateway reconnected" : "gateway connected", 4e3);
|
|
4490
|
-
tui.requestRender();
|
|
4491
|
-
if (!autoMessageSent && autoMessage) {
|
|
4492
|
-
autoMessageSent = true;
|
|
4493
|
-
await sendMessage(autoMessage);
|
|
4494
|
-
}
|
|
4495
|
-
updateFooter();
|
|
4496
|
-
tui.requestRender();
|
|
4497
|
-
})();
|
|
4498
|
-
};
|
|
4499
|
-
client.onDisconnected = (reason) => {
|
|
4500
|
-
isConnected = false;
|
|
4501
|
-
wasDisconnected = true;
|
|
4502
|
-
historyLoaded = false;
|
|
4503
|
-
const disconnectState = isLocalMode ? {
|
|
4504
|
-
connectionStatus: `local runtime stopped${reason ? `: ${reason}` : ""}`,
|
|
4505
|
-
activityStatus: "idle",
|
|
4506
|
-
pairingHint: void 0
|
|
4507
|
-
} : resolveGatewayDisconnectState(reason);
|
|
4508
|
-
setConnectionStatus(disconnectState.connectionStatus, 5e3);
|
|
4509
|
-
setActivityStatus(disconnectState.activityStatus);
|
|
4510
|
-
if (disconnectState.pairingHint && !pairingHintShown) {
|
|
4511
|
-
pairingHintShown = true;
|
|
4512
|
-
chatLog.addSystem(disconnectState.pairingHint);
|
|
4513
|
-
}
|
|
4514
|
-
updateFooter();
|
|
4515
|
-
tui.requestRender();
|
|
4516
|
-
};
|
|
4517
|
-
client.onGap = (info) => {
|
|
4518
|
-
setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
|
|
4519
|
-
tui.requestRender();
|
|
4520
|
-
};
|
|
4521
|
-
updateHeader();
|
|
4522
|
-
setConnectionStatus(isLocalMode ? "starting local runtime" : "connecting");
|
|
4523
|
-
updateFooter();
|
|
4524
|
-
const sigintHandler = () => {
|
|
4525
|
-
handleCtrlC();
|
|
4526
|
-
};
|
|
4527
|
-
const sigtermHandler = () => {
|
|
4528
|
-
requestExit();
|
|
4529
|
-
};
|
|
4530
|
-
process.on("SIGINT", sigintHandler);
|
|
4531
|
-
process.on("SIGTERM", sigtermHandler);
|
|
4532
|
-
tui.start();
|
|
4533
|
-
client.start();
|
|
4534
|
-
await new Promise((resolve) => {
|
|
4535
|
-
const finish = () => {
|
|
4536
|
-
if (isLocalMode) setConsoleSubsystemFilter(previousConsoleSubsystemFilter);
|
|
4537
|
-
process.removeListener("SIGINT", sigintHandler);
|
|
4538
|
-
process.removeListener("SIGTERM", sigtermHandler);
|
|
4539
|
-
resolve();
|
|
4540
|
-
};
|
|
4541
|
-
process.once("exit", finish);
|
|
4542
|
-
});
|
|
4543
|
-
}
|
|
4544
|
-
//#endregion
|
|
4545
|
-
//#region src/cli/tui-cli.ts
|
|
4546
|
-
function registerTuiCli(program) {
|
|
4547
|
-
program.command("tui").alias("terminal").alias("chat").description("Open a terminal UI connected to the Gateway").option("--local", "Run against the local embedded agent runtime", false).option("--url <url>", "Gateway WebSocket URL (defaults to gateway.remote.url when configured)").option("--token <token>", "Gateway token (if required)").option("--password <password>", "Gateway password (if required)").option("--session <key>", "Session key (default: \"main\", or \"global\" when scope is global)").option("--deliver", "Deliver assistant replies", false).option("--thinking <level>", "Thinking level override").option("--message <text>", "Send an initial message after connecting").option("--timeout-ms <ms>", "Agent timeout in ms (defaults to agents.defaults.timeoutSeconds)").option("--history-limit <n>", "History entries to load", "200").addHelpText("after", () => `\n${theme$1.muted("Docs:")} ${formatDocsLink("/cli/tui", "docs.genesis.ai/cli/tui")}\n`).action(async (opts, cmd) => {
|
|
4548
|
-
try {
|
|
4549
|
-
const invokedSubcommand = cmd.parent?.args[0];
|
|
4550
|
-
const invokedAsLocalAlias = invokedSubcommand === "terminal" || invokedSubcommand === "chat";
|
|
4551
|
-
const isLocal = Boolean(opts.local) || invokedAsLocalAlias;
|
|
4552
|
-
if (isLocal && (opts.url || opts.token || opts.password)) throw new Error("--local cannot be combined with --url, --token, or --password");
|
|
4553
|
-
const timeoutMs = parseTimeoutMs(opts.timeoutMs);
|
|
4554
|
-
if (opts.timeoutMs !== void 0 && timeoutMs === void 0) defaultRuntime.error(`warning: invalid --timeout-ms "${String(opts.timeoutMs)}"; ignoring`);
|
|
4555
|
-
const historyLimit = Number.parseInt(String(opts.historyLimit ?? "200"), 10);
|
|
4556
|
-
await runTui({
|
|
4557
|
-
local: isLocal,
|
|
4558
|
-
url: opts.url,
|
|
4559
|
-
token: opts.token,
|
|
4560
|
-
password: opts.password,
|
|
4561
|
-
session: opts.session,
|
|
4562
|
-
deliver: Boolean(opts.deliver),
|
|
4563
|
-
thinking: opts.thinking,
|
|
4564
|
-
message: opts.message,
|
|
4565
|
-
timeoutMs,
|
|
4566
|
-
historyLimit: Number.isNaN(historyLimit) ? void 0 : historyLimit
|
|
4567
|
-
});
|
|
4568
|
-
} catch (err) {
|
|
4569
|
-
defaultRuntime.error(String(err));
|
|
4570
|
-
defaultRuntime.exit(1);
|
|
4571
|
-
}
|
|
4572
|
-
});
|
|
4573
|
-
}
|
|
4574
|
-
//#endregion
|
|
4575
|
-
export { registerTuiCli };
|