vora-ai 0.1.0
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/LICENSE +21 -0
- package/README.md +606 -0
- package/assets/avatar-placeholder.svg +19 -0
- package/assets/chrome-extension/icons/icon128.png +0 -0
- package/assets/chrome-extension/icons/icon16.png +0 -0
- package/assets/chrome-extension/icons/icon32.png +0 -0
- package/assets/chrome-extension/icons/icon48.png +0 -0
- package/assets/dmg-background-small.png +0 -0
- package/assets/dmg-background.png +0 -0
- package/dist/abort-bAEt3OX0.js +192 -0
- package/dist/abort-cutoff-BW9X8atp.js +56 -0
- package/dist/abort-cutoff.runtime-BTdcverG.js +20 -0
- package/dist/abort-primitives-BkLaStf6.js +92 -0
- package/dist/abort-signal-OQ0B1Hsw.js +13 -0
- package/dist/abort.runtime-Bk-WTrsH.js +2 -0
- package/dist/access-DUWbTdtq.js +82 -0
- package/dist/account-action-gate-BhV8CpjB.js +12 -0
- package/dist/account-core-BxpV-R9y.js +26 -0
- package/dist/account-helpers-D1v4-R4z.js +102 -0
- package/dist/account-helpers-DsRxse98.js +1 -0
- package/dist/account-id-Da7aL0Gd.js +1 -0
- package/dist/account-inspect-CAOMlXxX.js +158 -0
- package/dist/account-inspect-sHk3NdqU.js +81 -0
- package/dist/account-lookup-C6jbidQL.js +17 -0
- package/dist/account-resolution-DKAWqmga.js +30 -0
- package/dist/account-snapshot-fields-D7AI5hQQ.js +130 -0
- package/dist/account-summary-BgeGcB_3.js +36 -0
- package/dist/accounts-Db4FI6Zz.js +58 -0
- package/dist/accounts-qrnlKu1q.js +137 -0
- package/dist/ack-reactions-BZ-o06GS.js +43 -0
- package/dist/acp-cli-BvaZntRI.js +88 -0
- package/dist/acp-runtime-JWaJYUhz.js +8 -0
- package/dist/acp-stateful-target-driver-Bw7044NV.js +60 -0
- package/dist/action-runtime-api-Oe9YXMPW.js +1026 -0
- package/dist/agent-B1rpctfA.js +2 -0
- package/dist/agent-command-Ca6TUUTc.js +1462 -0
- package/dist/agent-events-DvBJWaR9.js +51 -0
- package/dist/agent-list-BLH_azHg.js +52 -0
- package/dist/agent-media-payload-DJHM1u8B.js +17 -0
- package/dist/agent-paths-A_P9FLsb.js +12 -0
- package/dist/agent-runner-utils-9OoCJtjv.js +178 -0
- package/dist/agent-runner.runtime-CBOjZZGX.js +2205 -0
- package/dist/agent-runtime-DUidz-g-.js +142 -0
- package/dist/agent-scope-BsqFyt8u.js +203 -0
- package/dist/agents/auth-profiles.runtime.js +7 -0
- package/dist/agents/pi-model-discovery-runtime.js +2 -0
- package/dist/agents-BalJcJ6y.js +5 -0
- package/dist/agents-C3mHfRHd.js +888 -0
- package/dist/agents.config-BDTgYzjf.js +3 -0
- package/dist/agents.config-CD4kuH-_.js +121 -0
- package/dist/allow-from-Bj0HDNYh.js +20 -0
- package/dist/allow-from-D-rvXQ8h.js +9 -0
- package/dist/allow-from-xOap1t02.js +62 -0
- package/dist/allow-list-BFJp0pl8.js +341 -0
- package/dist/allowlist-config-edit-Cm1yBM1Z.js +279 -0
- package/dist/allowlist-match-CvP7M2nU.js +63 -0
- package/dist/ansi-B_0KjIJj.js +54 -0
- package/dist/anthropic-vertex-CmYuMVC4.js +21 -0
- package/dist/anthropic-vertex-stream-CDum4sTM.js +631 -0
- package/dist/api-C8PGNlY8.js +10 -0
- package/dist/api-CUkBKFva.js +74 -0
- package/dist/api-builder-Dxtk0Cjs.js +172 -0
- package/dist/api-fetch-D1Orij33.js +35 -0
- package/dist/api-key-rotation-BgD2ZwFB.js +150 -0
- package/dist/apply-uNQmdYrd.js +485 -0
- package/dist/apply.runtime-CDBPl8wO.js +166 -0
- package/dist/apply.runtime-DXzYQs7u.js +2 -0
- package/dist/approval-renderers-D-qQquHC.js +83 -0
- package/dist/approval-runtime-DodHpuxq.js +122 -0
- package/dist/archive-BUHAoH49.js +537 -0
- package/dist/arg-split-ShoVtQWt.js +38 -0
- package/dist/artifacts-UsJTFgjT.js +52 -0
- package/dist/assistant-error-format-KDZ_osDM.js +109 -0
- package/dist/audio-DFt2UJ9l.js +41 -0
- package/dist/audit-234llk_L.js +85 -0
- package/dist/audit-BzzkNrPw.js +893 -0
- package/dist/audit-D8ikC9Ex.js +54 -0
- package/dist/audit-channel.allow-from.runtime-todwwiYs.js +5 -0
- package/dist/audit-channel.collect.runtime-DmpUSGTW.js +528 -0
- package/dist/audit-channel.discord.runtime-eztVMsVi.js +5 -0
- package/dist/audit-channel.telegram.runtime-C1XTQaXt.js +8 -0
- package/dist/audit-channel.zalouser.runtime-0HM10car.js +5 -0
- package/dist/audit-extra.async-CSQaJlTH.js +820 -0
- package/dist/audit-fs-ClsvRCTg.js +375 -0
- package/dist/audit-membership-runtime-ByM59rIs.js +55 -0
- package/dist/audit.deep.runtime-DXGK_1J_.js +2 -0
- package/dist/audit.nondeep.runtime-DJXN9aBX.js +831 -0
- package/dist/audit.runtime-BS7_g95e.js +7 -0
- package/dist/auth-DEuZoVpN.js +371 -0
- package/dist/auth-choice-9Go6Q-oV.js +3 -0
- package/dist/auth-choice-BQBEikSW.js +69 -0
- package/dist/auth-choice-CbU_5K03.js +341 -0
- package/dist/auth-choice-legacy-D9rcQsLS.js +44 -0
- package/dist/auth-choice-options-DzvdP-W5.js +98 -0
- package/dist/auth-choice-prompt-CAt3z9Wn.js +2 -0
- package/dist/auth-choice-prompt-DfuSZB7t.js +36 -0
- package/dist/auth-choice.apply-helpers-CxPMo6aR.js +2 -0
- package/dist/auth-choice.plugin-providers.runtime-C4iPKNWh.js +11 -0
- package/dist/auth-health-CztAfAX3.js +165 -0
- package/dist/auth-mode-policy-C2dpPPMZ.js +18 -0
- package/dist/auth-profiles-DgsNxC4M.js +431 -0
- package/dist/auth-rate-limit-B3HOQz3U.js +119 -0
- package/dist/avatar-policy-D_F2Olbt.js +67 -0
- package/dist/backend-config-DRYC_KQP.js +311 -0
- package/dist/backoff-C-fId8Y0.js +18 -0
- package/dist/backup-create-CWffgs90.js +462 -0
- package/dist/banner-BJJQ_jor.js +2 -0
- package/dist/banner-CzYuF1AM.js +369 -0
- package/dist/base-session-key-yPDY2ReX.js +14 -0
- package/dist/binaries-D04aDwRb.js +2 -0
- package/dist/binaries-UyZ8gKvx.js +11 -0
- package/dist/binding-registry-DeW6GWl7.js +422 -0
- package/dist/binding-targets-Dew-Cmhe.js +99 -0
- package/dist/bindings-Be6kpbqd.js +21 -0
- package/dist/bindings-C415Adm_.js +69 -0
- package/dist/block-reply-pipeline-DOyiLrmk.js +266 -0
- package/dist/block-streaming-irtDjCPX.js +107 -0
- package/dist/bluebubbles-cpaV8DUH.js +64 -0
- package/dist/bluebubbles-policy-DO-t7OnD.js +13 -0
- package/dist/boolean-BRxEL2pT.js +29 -0
- package/dist/boolean-param-B3tzmZ3k.js +13 -0
- package/dist/bootstrap-budget-lNGYv_xu.js +314 -0
- package/dist/bootstrap-cache-CwL_mvEY.js +19 -0
- package/dist/bot-message-context-BDfCxJZs.js +1213 -0
- package/dist/bot-message-context-C-8RvNrP.js +2 -0
- package/dist/bot-native-commands.delivery.runtime-z0viWrSs.js +3 -0
- package/dist/boundary-file-read-DzY137L0.js +192 -0
- package/dist/brave-web-search-provider-Bab38BrX.js +441 -0
- package/dist/brew-CTkvvpxg.js +44 -0
- package/dist/browser-open-BU6ETbQQ.js +94 -0
- package/dist/browser-runtime-C9uxHbGW.js +76 -0
- package/dist/browser-support-Bb_k0jpF.js +34 -0
- package/dist/btw-command-NOqYNWtX.js +16 -0
- package/dist/bundle-lsp-BeRKY2JZ.js +93 -0
- package/dist/bundle-mcp-Bx8MNFO5.js +263 -0
- package/dist/bundled/boot-md/handler.js +180 -0
- package/dist/bundled/bootstrap-extra-files/handler.js +42 -0
- package/dist/bundled/command-logger/handler.js +56 -0
- package/dist/bundled/session-memory/handler.js +196 -0
- package/dist/bundled-capability-metadata-BJSb_HDr.js +38 -0
- package/dist/bundled-compat-CAM7KkKK.js +64 -0
- package/dist/bundled-plugin-metadata-DuQVm9f5.js +621 -0
- package/dist/bundled-sources-cwLmVfLO.js +53 -0
- package/dist/cache-controls-CpBpLE7o.js +40 -0
- package/dist/call-CYGZtInt.js +649 -0
- package/dist/call-DNl9zM74.js +2 -0
- package/dist/capability-provider-runtime-yc24eaUD.js +40 -0
- package/dist/catalog-CTTRbG9P.js +272 -0
- package/dist/channel-Ur_UNzw2.js +679 -0
- package/dist/channel-account-context-BWgKFgVH.js +104 -0
- package/dist/channel-actions-BOFC-_zU.js +39 -0
- package/dist/channel-catalog.json +26 -0
- package/dist/channel-config-B-7hYcg1.js +115 -0
- package/dist/channel-config-helpers-C1S4WfJJ.js +482 -0
- package/dist/channel-config-schema-2huPMu2x.js +6 -0
- package/dist/channel-feedback-Ro-BTZzh.js +257 -0
- package/dist/channel-inbound-_DJyFgZs.js +30 -0
- package/dist/channel-issues-BPmcKiOr.js +13 -0
- package/dist/channel-lifecycle-tykcw1CK.js +286 -0
- package/dist/channel-lifecycle.core-3OcmXTam.js +69 -0
- package/dist/channel-options-DgOdpBj-.js +39 -0
- package/dist/channel-pairing-Dx7NU9a4.js +68 -0
- package/dist/channel-plugin-common-B7gWshwF.js +4 -0
- package/dist/channel-plugin-ids-DGJsaNeP.js +230 -0
- package/dist/channel-plugin-resolution-B3C2B0Xc.js +113 -0
- package/dist/channel-policy-BiAdlZRY.js +32 -0
- package/dist/channel-reply-pipeline-DZQu_Smr.js +16 -0
- package/dist/channel-resolution-BRpGejEv.js +57 -0
- package/dist/channel-runtime-B3OwaSIN.js +8 -0
- package/dist/channel-selection-CJiUKode.js +125 -0
- package/dist/channel-send-result-C4cfMY3q.js +40 -0
- package/dist/channel-setup-CVb_d9r3.js +51 -0
- package/dist/channel-status-is1j_O8T.js +2 -0
- package/dist/channel-summary-CcHbPriu.js +2 -0
- package/dist/channel-summary-ChMRan7Y.js +139 -0
- package/dist/channel-target-B2-JZuxb.js +157 -0
- package/dist/channel-targets-C7I-yneV.js +173 -0
- package/dist/channel.runtime-DPqGWQMI.js +5 -0
- package/dist/channels-BLrLpPbs.js +1134 -0
- package/dist/channels-ClZdlIAP.js +409 -0
- package/dist/channels-cli-CxyDo24U.js +246 -0
- package/dist/channels-status-issues-DOvoiysl.js +17 -0
- package/dist/chat-envelope-BKa8gVwt.js +158 -0
- package/dist/chat-meta-CxxUMjgT.js +77 -0
- package/dist/chat-type-D66QkgK0.js +10 -0
- package/dist/chunk-BRNunu6m.js +334 -0
- package/dist/chunk-DBEY4PJZ.js +16 -0
- package/dist/chutes-oauth-df1s-ETh.js +127 -0
- package/dist/cjk-chars-nOH-kRF8.js +50 -0
- package/dist/clack-prompter-ByYhQnEc.js +112 -0
- package/dist/clawbot-cli-B1PP3cQS.js +9 -0
- package/dist/clawhub-BlNkstQC.js +163 -0
- package/dist/clawhub-PHPunBYA.js +263 -0
- package/dist/cli/daemon-cli.js +3 -0
- package/dist/cli-BVs9q78-.js +2 -0
- package/dist/cli-backend-BY5ACL_R.js +1 -0
- package/dist/cli-backend-MiCoOt1Y.js +44 -0
- package/dist/cli-eS9_49Ka.js +153 -0
- package/dist/cli-name-l1qeysOp.js +21 -0
- package/dist/cli-runner-rgKmST01.js +1010 -0
- package/dist/cli-utils-CMfpS8SF.js +40 -0
- package/dist/cli-watchdog-defaults-3Qs4l3Yf.js +14 -0
- package/dist/cmd-argv-BafMhhA4.js +68 -0
- package/dist/codex-native-web-search-CWYqRu9M.js +2 -0
- package/dist/codex-native-web-search-CbRntg-q.js +155 -0
- package/dist/command-auth-CJsP4GL7.js +64 -0
- package/dist/command-auth-Dfgmp_6_.js +356 -0
- package/dist/command-auth-native-CdgZoflY.js +3 -0
- package/dist/command-detection-CyrUVnod.js +46 -0
- package/dist/command-format-CfBy_-A6.js +2 -0
- package/dist/command-format-DmvS76BD.js +22 -0
- package/dist/command-gating-HO-bVa6h.js +40 -0
- package/dist/command-options-BUoAEXAi.js +25 -0
- package/dist/command-poll-backoff-BbGeC12t.js +56 -0
- package/dist/command-poll-backoff.runtime-BDcejg_n.js +7 -0
- package/dist/command-registry-C0kFYtIa.js +199 -0
- package/dist/command-registry-VUV6Y6SA.js +3 -0
- package/dist/command-secret-gateway-B2PsoqGE.js +2 -0
- package/dist/command-secret-gateway-rXrG4_xf.js +449 -0
- package/dist/command-secret-targets-BMcCyKKM.js +85 -0
- package/dist/command-secret-targets-DYLJqbik.js +2 -0
- package/dist/commands/status.summary.runtime.js +146 -0
- package/dist/commands-BNN8qnEq.js +42 -0
- package/dist/commands-D905e2TE.js +4 -0
- package/dist/commands-acp-DxpRaS_2.js +994 -0
- package/dist/commands-context-DYfg86cW.js +33 -0
- package/dist/commands-core-BkTgFXRe.js +185 -0
- package/dist/commands-core.runtime-DL4UA7LO.js +2 -0
- package/dist/commands-handlers.runtime-Dnqn4WRI.js +3597 -0
- package/dist/commands-info-9qXzZJZy.js +638 -0
- package/dist/commands-models-DaGXLYpI.js +395 -0
- package/dist/commands-rHJt1A27.js +192 -0
- package/dist/commands-registry-DsvlObRs.js +295 -0
- package/dist/commands-registry.data-D4mfAJVD.js +928 -0
- package/dist/commands-registry.runtime-CvK5vfUk.js +2 -0
- package/dist/commands-status.runtime-Biqry_fJ.js +2 -0
- package/dist/commands.runtime-BQNIS1_C.js +4 -0
- package/dist/common-B8KXadTs.js +206 -0
- package/dist/compact.runtime-DrIYPOe_.js +7 -0
- package/dist/completion-cli-DADmFZNY.js +2 -0
- package/dist/completion-cli-Xpp8XJNt.js +466 -0
- package/dist/config-B8J_0cJd.js +41 -0
- package/dist/config-BeMghpRW.js +136 -0
- package/dist/config-C6sbf2mt.js +7 -0
- package/dist/config-CKbWnj3S.js +52 -0
- package/dist/config-DUHgkJzn.js +421 -0
- package/dist/config-cli-CwphzfyS.js +944 -0
- package/dist/config-eval-DM9FHTGd.js +100 -0
- package/dist/config-guard-BQvfMpPf.js +94 -0
- package/dist/config-helpers-DiGV2z9-.js +117 -0
- package/dist/config-paths-h016qQJq.js +8 -0
- package/dist/config-presence-C16x_f3x.js +79 -0
- package/dist/config-regex-CvZFnWkO.js +39 -0
- package/dist/config-runtime-CGUisiU5.js +12 -0
- package/dist/config-schema-5JUAk8XL.js +202 -0
- package/dist/config-schema-BRTDDWFV.js +65 -0
- package/dist/config-schema-B_uHmf_j.js +133 -0
- package/dist/config-schema-dV8ghEVQ.js +85 -0
- package/dist/config-state-CiYvCzdZ.js +185 -0
- package/dist/config-validation-CzH2O_-H.js +276 -0
- package/dist/config-value-B0LE9l8u.js +25 -0
- package/dist/configure-BUZKW20U.js +1140 -0
- package/dist/configure-CFbHMkXc.js +2 -0
- package/dist/configured-provider-fallback-HW8QhjlX.js +15 -0
- package/dist/connection-auth-Cs3qTX0J.js +30 -0
- package/dist/connection-details-GqZVX1_1.js +56 -0
- package/dist/constants-lHqfjBOu.js +71 -0
- package/dist/content-blocks-DdN51R-1.js +1640 -0
- package/dist/context-Bv7BKF9l.js +227 -0
- package/dist/context-window-guard-BKQgasN7.js +46 -0
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/agents-sN8RQ1eS.js +813 -0
- package/dist/control-ui/assets/anthropic-ZDTkKd9P.js +37 -0
- package/dist/control-ui/assets/azure-openai-responses-CQjyuM35.js +2 -0
- package/dist/control-ui/assets/channel-config-extras-DNCeHtEf.js +2 -0
- package/dist/control-ui/assets/channels-LecGHhYY.js +349 -0
- package/dist/control-ui/assets/cron-BCSmuADd.js +928 -0
- package/dist/control-ui/assets/de-BhrN2Nih.js +2 -0
- package/dist/control-ui/assets/debug-DIDwUeSi.js +94 -0
- package/dist/control-ui/assets/directive-C6NBp6xJ.js +2 -0
- package/dist/control-ui/assets/dist-D8DZLmCF.js +18 -0
- package/dist/control-ui/assets/es-D2hTJirx.js +2 -0
- package/dist/control-ui/assets/event-stream-B8X6sYaV.js +2 -0
- package/dist/control-ui/assets/format-Cbj45nru.js +2 -0
- package/dist/control-ui/assets/github-copilot-headers-CrI0CIJ7.js +2 -0
- package/dist/control-ui/assets/google-gemini-cli-BpxbH95Q.js +3 -0
- package/dist/control-ui/assets/google-shared-CbPHVnPr.js +12 -0
- package/dist/control-ui/assets/google-vertex-lQwbjEII.js +2 -0
- package/dist/control-ui/assets/google-xtjMQAen.js +2 -0
- package/dist/control-ui/assets/hash-Bt1aVMQ3.js +2 -0
- package/dist/control-ui/assets/index-DqTClMaZ.js +4714 -0
- package/dist/control-ui/assets/index-yaW_F-Wi.css +1 -0
- package/dist/control-ui/assets/instances-CMgIM69b.js +57 -0
- package/dist/control-ui/assets/lit-zdTgzAJI.js +3 -0
- package/dist/control-ui/assets/logs-vVeVJ0CI.js +74 -0
- package/dist/control-ui/assets/mistral-u1o8NcCM.js +8 -0
- package/dist/control-ui/assets/nodes-B1R45Hyv.js +430 -0
- package/dist/control-ui/assets/openai-Cn7eGqwa.js +17 -0
- package/dist/control-ui/assets/openai-codex-responses-o0Z3RMWa.js +8 -0
- package/dist/control-ui/assets/openai-completions-7V2Ovprv.js +6 -0
- package/dist/control-ui/assets/openai-responses-oNxOx3Q1.js +2 -0
- package/dist/control-ui/assets/openai-responses-shared-OKpfrZ-q.js +11 -0
- package/dist/control-ui/assets/preload-helper-xBbMyY7u.js +1 -0
- package/dist/control-ui/assets/pt-BR-Bd9tFPER.js +2 -0
- package/dist/control-ui/assets/sessions-Lc0IvBNe.js +236 -0
- package/dist/control-ui/assets/skills-k1ptbgMP.js +216 -0
- package/dist/control-ui/assets/skills-shared-D4l2M8cL.js +11 -0
- package/dist/control-ui/assets/transform-messages-XKqwKV3D.js +2 -0
- package/dist/control-ui/assets/zh-CN-DvLwUwA1.js +2 -0
- package/dist/control-ui/assets/zh-TW-BXT7QT3h.js +2 -0
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +22 -0
- package/dist/control-ui/index.html +75 -0
- package/dist/control-ui-assets-DbOOvjtb.js +233 -0
- package/dist/control-ui-shared-DsqkrmmN.js +29 -0
- package/dist/conversation-binding-input-BGI5gsf7.js +250 -0
- package/dist/conversation-binding-xxmmj56H.js +520 -0
- package/dist/conversation-id-B2-7oYz5.js +9 -0
- package/dist/conversation-label-CDBJEzqs.js +32 -0
- package/dist/conversation-runtime-CPXVzEGP.js +85 -0
- package/dist/core-DidBIGEJ.js +195 -0
- package/dist/core-api-VzeJYIaC.js +670 -0
- package/dist/core-command-descriptors-OO8iMaXR.js +91 -0
- package/dist/credential-planner-B6V18E6X.js +109 -0
- package/dist/credentials-T7b82ytT.js +135 -0
- package/dist/cron-cli-D2epg2QX.js +643 -0
- package/dist/current-time-AvIq1E3O.js +20 -0
- package/dist/daemon-cli-Be7LAwcB.js +368 -0
- package/dist/daemon-install-CfvYrNa-.js +63 -0
- package/dist/daemon-install-plan.shared-Dm6sK7Lg.js +222 -0
- package/dist/daemon-runtime-DPejcJWG.js +12 -0
- package/dist/dangerous-config-flags-DyYwhFd-.js +38 -0
- package/dist/dangerous-name-matching-DJGvHcqL.js +48 -0
- package/dist/date-time-ChwO2p0r.js +118 -0
- package/dist/dedupe-ClGH5AD-.js +59 -0
- package/dist/default-account-warnings-DhrBUOxe.js +15 -0
- package/dist/default-models-p_jLxv9h.js +35 -0
- package/dist/defaults-DAt--D9n.js +6 -0
- package/dist/delegate-D_a6-aW6.js +43 -0
- package/dist/deliver-NyzvqqW3.js +954 -0
- package/dist/deliver-YFpAT2Gv.js +3 -0
- package/dist/deliver-runtime-CDYmnxXC.js +2 -0
- package/dist/delivery-DHz1_gua.js +819 -0
- package/dist/delivery-context-wkeob4lC.js +106 -0
- package/dist/delivery-info-0NXZH054.js +36 -0
- package/dist/delivery-queue-BceSoMom.js +2 -0
- package/dist/delivery-queue-Dij4z9yQ.js +289 -0
- package/dist/deps-xJ6d5mcR.js +67 -0
- package/dist/detect-binary-D5oXUD9C.js +30 -0
- package/dist/device-auth-BPeQrfAM.js +19 -0
- package/dist/device-bootstrap-IW2esZhx.js +176 -0
- package/dist/device-identity-2GhXUC5d.js +2 -0
- package/dist/device-identity-DH-dBXN2.js +140 -0
- package/dist/device-metadata-normalization-DesKWnX9.js +21 -0
- package/dist/device-pairing-D-eXc4mS.js +543 -0
- package/dist/devices-cli-CUkbtT5k.js +328 -0
- package/dist/diagnostic-BYcJF51S.js +311 -0
- package/dist/diagnostic-events-R6R0hsS8.js +48 -0
- package/dist/diagnostic-flags-DI1-YJxA.js +64 -0
- package/dist/diagnostic-runtime-iwrls2oi.js +1 -0
- package/dist/diagnostics-Bn7WBAMb.js +2 -0
- package/dist/diagnostics-CNOhNbiG.js +33 -0
- package/dist/direct-dm-DX9Sqse3.js +139 -0
- package/dist/directive-handling.defaults-CiM3zY4c.js +19 -0
- package/dist/directive-handling.fast-lane-CBsRyqm9.js +64 -0
- package/dist/directive-handling.fast-lane-CkLifH7t.js +2 -0
- package/dist/directive-handling.impl-DDDo9_pC.js +2 -0
- package/dist/directive-handling.impl-Rcgo5SCg.js +674 -0
- package/dist/directive-handling.levels-Dlk68wUB.js +2 -0
- package/dist/directive-handling.levels-Y1fuvRYT.js +12 -0
- package/dist/directive-handling.parse-CMEE0kEW.js +375 -0
- package/dist/directive-handling.persist-CvEtXaAd.js +133 -0
- package/dist/directive-handling.persist.runtime-Cdksoe_I.js +2 -0
- package/dist/directive-handling.shared-8kteIv4q.js +158 -0
- package/dist/directive-tags-B4NiUGng.js +109 -0
- package/dist/directives-DLcHC9jG.js +209 -0
- package/dist/directory-cache-KFfoEzq3.js +62 -0
- package/dist/directory-cli-DUY3BGGz.js +238 -0
- package/dist/directory-config-helpers-DBmVJY3U.js +141 -0
- package/dist/directory-runtime-DWVDd3A5.js +20 -0
- package/dist/discord-2uEduGX9.js +6 -0
- package/dist/discord-BMCiYFK_.js +11 -0
- package/dist/discord-account-HmxkZycn.js +11 -0
- package/dist/discord-core-Pl5ukuXB.js +5 -0
- package/dist/discord-runtime-surface-DNQNbA29.js +67 -0
- package/dist/discord-session-key-DoaFTAH3.js +11 -0
- package/dist/discord-surface-Cn77ggmj.js +30 -0
- package/dist/discord-thread-bindings-DRMbWo4Q.js +21 -0
- package/dist/discord-timeouts-Cv7cpmLu.js +12 -0
- package/dist/dispatch-CZypQktI.js +842 -0
- package/dist/dispatch-acp.runtime-DVu2VG71.js +887 -0
- package/dist/dist-C22HbjJn.js +3 -0
- package/dist/dist-C26-w-eb.js +14245 -0
- package/dist/dist-_cqaGkQM.js +503 -0
- package/dist/dm-policy-shared-BsSmWpF_.js +188 -0
- package/dist/dns-cli-CypS3rSW.js +192 -0
- package/dist/docker-e3sy4uxj.js +837 -0
- package/dist/docs-cli-CAc6XPQ1.js +156 -0
- package/dist/doctor-completion-D1GX1eYy.js +90 -0
- package/dist/doctor-config-preflight-BIjpCYLH.js +2 -0
- package/dist/doctor-config-preflight-C5YWG1Il.js +147 -0
- package/dist/doctor-state-migrations-C4JRWbB5.js +2 -0
- package/dist/doctor-state-migrations-Hkw1WYQh.js +3 -0
- package/dist/dotenv-5B3Ltg5m.js +11 -0
- package/dist/dotenv-C-ipPVRV.js +91 -0
- package/dist/enable-1JBZrsl3.js +57 -0
- package/dist/entry-status-8GZhSwz9.js +172 -0
- package/dist/entry.js +209 -0
- package/dist/env-DAI7QbHD.js +40 -0
- package/dist/env-substitution-D4FvNwAw.js +136 -0
- package/dist/envelope-BT4nxsRe.js +137 -0
- package/dist/error-runtime-BWR3edBz.js +2 -0
- package/dist/error-text-Dz9S7qeJ.js +9 -0
- package/dist/errors-BVF4CQJh.js +15 -0
- package/dist/errors-BxyFnvP3.js +58 -0
- package/dist/exa-web-search-provider-YdwhKG_r.js +355 -0
- package/dist/exec-DBEtpL4G.js +2 -0
- package/dist/exec-DNTgEe82.js +375 -0
- package/dist/exec-approval-reply-CIaFux57.js +161 -0
- package/dist/exec-approval-session-target-BsD_thnK.js +159 -0
- package/dist/exec-approvals-D6Kd1FHX.js +120 -0
- package/dist/exec-approvals-XWl5Qihe.js +394 -0
- package/dist/exec-approvals-allowlist-B90zHMFx.js +771 -0
- package/dist/exec-approvals-cli-CBwEU5lx.js +375 -0
- package/dist/exec-safe-bin-runtime-policy-CQ_6FV8z.js +90 -0
- package/dist/exec-safety-FkFR1qf5.js +24 -0
- package/dist/extensionAPI.js +17 -0
- package/dist/extensions/brave/index.js +13 -0
- package/dist/extensions/brave/package.json +12 -0
- package/dist/extensions/brave/test-api.js +2 -0
- package/dist/extensions/brave/vora.plugin.json +50 -0
- package/dist/extensions/brave/web-search-provider.js +2 -0
- package/dist/extensions/browser/browser-runtime-api.js +4 -0
- package/dist/extensions/browser/index.js +20 -0
- package/dist/extensions/browser/package.json +12 -0
- package/dist/extensions/browser/runtime-api.js +6 -0
- package/dist/extensions/browser/test-support.js +19 -0
- package/dist/extensions/browser/vora.plugin.json +9 -0
- package/dist/extensions/discord/action-runtime-api.js +2 -0
- package/dist/extensions/discord/api.js +14 -0
- package/dist/extensions/discord/channel-config-api.js +2 -0
- package/dist/extensions/discord/index.js +615 -0
- package/dist/extensions/discord/package.json +40 -0
- package/dist/extensions/discord/runtime-api.js +229 -0
- package/dist/extensions/discord/session-key-api.js +2 -0
- package/dist/extensions/discord/setup-entry.js +10 -0
- package/dist/extensions/discord/test-api.js +45 -0
- package/dist/extensions/discord/timeouts.js +2 -0
- package/dist/extensions/discord/vora.plugin.json +11 -0
- package/dist/extensions/exa/index.js +13 -0
- package/dist/extensions/exa/package.json +12 -0
- package/dist/extensions/exa/vora.plugin.json +39 -0
- package/dist/extensions/exa/web-search-provider.js +2 -0
- package/dist/extensions/openai/api.js +4 -0
- package/dist/extensions/openai/cli-backend.js +2 -0
- package/dist/extensions/openai/default-models.js +2 -0
- package/dist/extensions/openai/image-generation-provider.js +2 -0
- package/dist/extensions/openai/index.js +24 -0
- package/dist/extensions/openai/media-understanding-provider.js +2 -0
- package/dist/extensions/openai/openai-codex-auth-identity.js +2 -0
- package/dist/extensions/openai/openai-codex-catalog.js +2 -0
- package/dist/extensions/openai/openai-codex-provider.js +2 -0
- package/dist/extensions/openai/openai-codex-provider.runtime.js +14 -0
- package/dist/extensions/openai/openai-provider.js +2 -0
- package/dist/extensions/openai/package.json +12 -0
- package/dist/extensions/openai/shared.js +4 -0
- package/dist/extensions/openai/speech-provider.js +2 -0
- package/dist/extensions/openai/test-api.js +5 -0
- package/dist/extensions/openai/tts.js +2 -0
- package/dist/extensions/openai/vora.plugin.json +61 -0
- package/dist/extensions/tavily/index.js +128 -0
- package/dist/extensions/tavily/package.json +12 -0
- package/dist/extensions/tavily/skills/tavily/SKILL.md +94 -0
- package/dist/extensions/tavily/vora.plugin.json +53 -0
- package/dist/extensions/tavily/web-search-provider.js +2 -0
- package/dist/extensions/telegram/allow-from.js +2 -0
- package/dist/extensions/telegram/api.js +13 -0
- package/dist/extensions/telegram/channel-config-api.js +2 -0
- package/dist/extensions/telegram/index.js +12 -0
- package/dist/extensions/telegram/package.json +37 -0
- package/dist/extensions/telegram/runtime-api.js +24 -0
- package/dist/extensions/telegram/session-key-api.js +2 -0
- package/dist/extensions/telegram/setup-entry.js +13 -0
- package/dist/extensions/telegram/test-api.js +87 -0
- package/dist/extensions/telegram/test-support.js +72 -0
- package/dist/extensions/telegram/update-offset-runtime-api.js +2 -0
- package/dist/extensions/telegram/vora.plugin.json +11 -0
- package/dist/external-content-CCU3ADB4.js +242 -0
- package/dist/facade-runtime-FE2gvW08.js +183 -0
- package/dist/failover-error-Bv6ZpTGn.js +194 -0
- package/dist/feishu-conversation-CRGPLs2e.js +17 -0
- package/dist/feishu-setup-D3qBPVeH.js +12 -0
- package/dist/fetch-B7l-vxJ5.js +65 -0
- package/dist/fetch-BlEbs4zu.js +416 -0
- package/dist/fetch-guard-DECxJSgV.js +132 -0
- package/dist/fetch-mock-Y15aY-vX.js +6 -0
- package/dist/fetch-runtime-DfJc8pAb.js +4 -0
- package/dist/fetch-timeout-DlhFJxaz.js +58 -0
- package/dist/file-identity-CFjEVvlD.js +567 -0
- package/dist/file-lock-I_Ef85iM.js +141 -0
- package/dist/file-lock-_Bv5Z0H8.js +2 -0
- package/dist/format-Cmirp0jV.js +19 -0
- package/dist/format-DTr5MrB3.js +787 -0
- package/dist/format-datetime-BzFsOTtu.js +73 -0
- package/dist/format-duration-3-yx54b_.js +57 -0
- package/dist/format-relative-CKRrUR_e.js +54 -0
- package/dist/frontmatter-7NzkXiTl.js +45 -0
- package/dist/frontmatter-BruYJzuJ.js +210 -0
- package/dist/fs-safe-C7Y0npoY.js +999 -0
- package/dist/gateway-cli-CL9kkVgP.js +25330 -0
- package/dist/gateway-discovery-targets-Nj88oSf4.js +430 -0
- package/dist/gateway-install-token-DT4JSzW6.js +231 -0
- package/dist/gateway-presence-C9FNv0wz.js +15 -0
- package/dist/gateway-registry-bOE6bwiW.js +74 -0
- package/dist/gateway-rpc-EUERnNbW.js +26 -0
- package/dist/gateway-runtime-DA85e49x.js +12 -0
- package/dist/gaxios-fetch-compat-TyJGVB6l.js +180 -0
- package/dist/gemini-auth-DU9RM3Fo.js +29 -0
- package/dist/get-reply-from-config.runtime-BTZAHGwc.js +2 -0
- package/dist/git-commit-B_DkJ7LE.js +177 -0
- package/dist/git-commit-Bx0Yma3I.js +2 -0
- package/dist/github-copilot-login-BiqEMA_7.js +11 -0
- package/dist/github-copilot-token-BMHm0urT.js +2 -0
- package/dist/github-copilot-token-CGpIsMSL.js +77 -0
- package/dist/global-singleton-54zT3rCn.js +13 -0
- package/dist/global-singleton-o2ArPCEw.js +1 -0
- package/dist/global-state-DUuMGgts.js +17 -0
- package/dist/globals-DNhziPZz.js +25 -0
- package/dist/gmail-setup-utils-B4xK25jT.js +421 -0
- package/dist/google-CPRZDTjq.js +24 -0
- package/dist/group-access-Cd6mU7Ys.js +113 -0
- package/dist/group-activation-BwfaA0gP.js +22 -0
- package/dist/group-id-vLZLwNVz.js +11 -0
- package/dist/group-policy-Cr7UXkoj.js +201 -0
- package/dist/group-policy-warnings-DmIDYgw8.js +196 -0
- package/dist/groups.runtime-DKOqtNQC.js +7 -0
- package/dist/handle-action-DsH0nVWk.js +500 -0
- package/dist/health-B3O0HygG.js +577 -0
- package/dist/health-CojrwX7m.js +2 -0
- package/dist/health-format-JFM9rFJB.js +26 -0
- package/dist/heartbeat-C1Xvupsk.js +122 -0
- package/dist/heartbeat-reply-payload-C-Rlp4k5.js +13 -0
- package/dist/heartbeat-summary-D5pDHsmN.js +57 -0
- package/dist/heartbeat-visibility-kNXllOIC.js +102 -0
- package/dist/heartbeat-wake-DfVExPSU.js +188 -0
- package/dist/help-CpuviX5S.js +81 -0
- package/dist/help-format-Dad85O74.js +15 -0
- package/dist/helpers-4IKdDZX5.js +24 -0
- package/dist/helpers-fNw5R_YT.js +32 -0
- package/dist/history-CK-v5j98.js +102 -0
- package/dist/home-dir-BXPtwSCY.js +83 -0
- package/dist/hook-runner-global-DEn0PCL0.js +602 -0
- package/dist/hook-runtime-Dn-Congb.js +3 -0
- package/dist/hooks-cli-DNKW70lO.js +353 -0
- package/dist/hooks-policy-Ad8y_Dfl.js +20 -0
- package/dist/hooks-status-Cb31D01g.js +86 -0
- package/dist/host-env-security-Cks-ZF3X.js +285 -0
- package/dist/hostname-BYGiBG2v.js +8 -0
- package/dist/http-body-DoRUn0Id.js +238 -0
- package/dist/http-registry-1oFXUjVZ.js +54 -0
- package/dist/http-route-overlap-CRbY2bBV.js +101 -0
- package/dist/identity-BBfQnFMg.js +29 -0
- package/dist/identity-BoQQh6Y8.js +26 -0
- package/dist/identity-D7VGm34b.js +84 -0
- package/dist/identity-avatar-CBJpFxtc.js +86 -0
- package/dist/identity-file-9bBicCze.js +60 -0
- package/dist/image-UFatuV93.js +152 -0
- package/dist/image-generation-CB1-VO0n.js +1 -0
- package/dist/image-generation-provider-CoHdiPC_.js +86 -0
- package/dist/image-ops-EABsGjsc.js +476 -0
- package/dist/image-runtime-ZZOiUbiY.js +7 -0
- package/dist/imessage-UUBzYSCn.js +19 -0
- package/dist/inbound-context-BxNfypB6.js +59 -0
- package/dist/inbound-context-DQ_fXNSa.js +38 -0
- package/dist/inbound-debounce-YEtyt_k_.js +159 -0
- package/dist/inbound-envelope-B6C8FhsE.js +61 -0
- package/dist/inbound-reply-dispatch-BP3sajLc.js +73 -0
- package/dist/inbound-text-DibnKFqn.js +14 -0
- package/dist/inbound.runtime-SCcR_etw.js +3 -0
- package/dist/includes-CHoL4g8x.js +188 -0
- package/dist/includes-scan-rcUlg6Nq.js +55 -0
- package/dist/index.js +56 -0
- package/dist/infra/warning-filter.js +2 -0
- package/dist/infra-runtime-D1S_mYfO.js +326 -0
- package/dist/input-files-BJKZz7LU.js +251 -0
- package/dist/input-provenance-DqtZ-oaB.js +44 -0
- package/dist/inspect-BdrrX2i3.js +282 -0
- package/dist/install-BwbpybtH.js +588 -0
- package/dist/install-package-dir-DhoPrQ04.js +284 -0
- package/dist/install-safe-path-BK_5xK2H.js +69 -0
- package/dist/install-security-scan-qS3b3qEq.js +22 -0
- package/dist/install-security-scan.runtime-BChyO9J8.js +166 -0
- package/dist/install-source-utils-BvLftGQS.js +167 -0
- package/dist/install-target-CTg66IIO.js +175 -0
- package/dist/install.runtime-BTSq91Fr.js +27 -0
- package/dist/install.runtime-D4V_unI1.js +11 -0
- package/dist/installs-CRoSOFIQ.js +28 -0
- package/dist/interactive-C3NpHdfG.js +8 -0
- package/dist/interactive-runtime-ihi8xJat.js +1 -0
- package/dist/internal-DBQug4hL.js +411 -0
- package/dist/internal-hooks-BbEvCG0I.js +155 -0
- package/dist/io-B07IaARR.js +20276 -0
- package/dist/io-CNajM2P9.js +4 -0
- package/dist/ip-B9fdE2gz.js +208 -0
- package/dist/ipv4-C3dcphoh.js +82 -0
- package/dist/irc-surface-76sLILVt.js +15 -0
- package/dist/is-main-Bv5ej4lF.js +27 -0
- package/dist/issue-format-BSF24W54.js +31 -0
- package/dist/issue-format-DOmwnG2e.js +2 -0
- package/dist/json-file-BWMSefn1.js +23 -0
- package/dist/json-files-BTzholfl.js +72 -0
- package/dist/json-mode-BSMgY7a9.js +34 -0
- package/dist/json-pointer-jqlJaexT.js +43 -0
- package/dist/json-store-BMjN0M0e.js +37 -0
- package/dist/keyed-async-queue-BThh1lNJ.js +32 -0
- package/dist/kill-tree-B6ozo-AE.js +82 -0
- package/dist/kill-tree-Cqktd2UA.js +2 -0
- package/dist/launchd-D65d45MJ.js +517 -0
- package/dist/lazy-runtime-CeSDvNOX.js +29 -0
- package/dist/lazy-service-module-BfNSCPnr.js +24 -0
- package/dist/legacy-names-alNfx9uv.js +7 -0
- package/dist/legacy-web-search-PlL5wfRE.js +140 -0
- package/dist/legacy.shared-BdJdF_Ji.js +45 -0
- package/dist/level-overrides-DkpAP8Z5.js +36 -0
- package/dist/library-D0LkGi9S.js +44 -0
- package/dist/lifecycle-core-LQrm8n7o.js +401 -0
- package/dist/line-C7MzXHd9.js +4 -0
- package/dist/line-runtime-D0TK2zdy.js +60 -0
- package/dist/line-surface-CN8Lvuud.js +27 -0
- package/dist/links-Dew9XRNK.js +17 -0
- package/dist/listeners-CUHNPyTB.js +14 -0
- package/dist/llm-slug-generator-DdO4_-IV.js +68 -0
- package/dist/llm-slug-generator.js +2 -0
- package/dist/load-CadZ3tcc.js +28 -0
- package/dist/loader-CbUrcgTY.js +2096 -0
- package/dist/local-file-access-BKg2BnYT.js +49 -0
- package/dist/location-DAl2Dv-o.js +42 -0
- package/dist/logger-BOH4EG1g.js +75 -0
- package/dist/logger-DXmZnecR.js +582 -0
- package/dist/logger-hR5Nn0oR.js +11 -0
- package/dist/logging-BVrQyk5K.js +13 -0
- package/dist/logging-BoyMPDyh.js +16 -0
- package/dist/logging-DPN6sRQx.js +3 -0
- package/dist/logging-core-BOrwsQp5.js +3 -0
- package/dist/logging-x8ySQJz4.js +2 -0
- package/dist/logs-cli-DUKwlDzr.js +221 -0
- package/dist/magic-string.es-CnHiwmBJ.js +1011 -0
- package/dist/main-session-BQ1fLshb.js +38 -0
- package/dist/manager-BfZUkAlZ.js +7 -0
- package/dist/manager.runtime-CiRcAT_V.js +670 -0
- package/dist/manifest-D49j8zhq.js +231 -0
- package/dist/manifest-registry-CVwreH55.js +955 -0
- package/dist/map-size-CHeGE-Hu.js +15 -0
- package/dist/markdown-tables-D2sUymqZ.js +31 -0
- package/dist/mask-api-key-Dxw856id.js +10 -0
- package/dist/matrix-Ds9X7gxo.js +340 -0
- package/dist/matrix-config-helpers-CXItIHIe.js +153 -0
- package/dist/matrix-helper-dQNUz9y1.js +20 -0
- package/dist/matrix-migration-snapshot-BSPlCZpf.js +714 -0
- package/dist/matrix-runtime-surface-Dggb-0DD.js +12 -0
- package/dist/matrix-surface-CxJ9TM8l.js +13 -0
- package/dist/matrix-thread-bindings-CT4Dqsid.js +12 -0
- package/dist/mcp/plugin-tools-serve.js +105 -0
- package/dist/mcp-cli-IzvP-l2E.js +768 -0
- package/dist/mcp-config-Bul9F_lO.js +117 -0
- package/dist/media-limits-CfgImPSH.js +14 -0
- package/dist/media-runtime-D2qFlSNy.js +293 -0
- package/dist/media-understanding-D930-yxA.js +43 -0
- package/dist/media-understanding-provider-WeSvV5Jz.js +27 -0
- package/dist/media-understanding-runtime-C2xB_w9c.js +15 -0
- package/dist/media-understanding.runtime-Cad8YO-5.js +7 -0
- package/dist/memory-core-engine-runtime-e08xLNwK.js +14 -0
- package/dist/memory-core-host-engine-embeddings-CeqjF8mF.js +1369 -0
- package/dist/memory-core-host-engine-qmd-2rX9HR2g.js +375 -0
- package/dist/memory-core-host-engine-storage-BocZ6yow.js +109 -0
- package/dist/memory-core-host-multimodal-DgBuQzZm.js +1 -0
- package/dist/memory-core-host-query-Cekrv97-.js +2 -0
- package/dist/memory-core-host-runtime-cli--EQHw17R.js +10 -0
- package/dist/memory-core-host-runtime-core-DX17el9Z.js +8 -0
- package/dist/memory-core-host-runtime-files-CeDFldc-.js +3 -0
- package/dist/memory-core-host-secret-BUGjwboV.js +1 -0
- package/dist/memory-core-host-status-C7nF33J8.js +44 -0
- package/dist/memory-embedding-providers-C8KLZUqC.js +34 -0
- package/dist/memory-runtime-D2rQY7mY.js +2 -0
- package/dist/memory-runtime-WuWYrOU9.js +30 -0
- package/dist/memory-search-BQs_twVs.js +2 -0
- package/dist/memory-search-L16IM5VZ.js +202 -0
- package/dist/memory-state-BPOopEhZ.js +41 -0
- package/dist/mention-gating-BJSMiJu8.js +25 -0
- package/dist/mentions-D0fLhfbe.js +155 -0
- package/dist/mentions-Ksl6lu1X.js +65 -0
- package/dist/merge-patch-CY3S-7zE.js +240 -0
- package/dist/message-D1nCeSGV.js +205 -0
- package/dist/message-action-discovery-Bp_zFTg1.js +133 -0
- package/dist/message-action-runner-DOaZ7jbV.js +1601 -0
- package/dist/message-channel-Di9LQZCg.js +105 -0
- package/dist/message-handler-CVxycGRP.js +1759 -0
- package/dist/message-hook-mappers-CgJovp_6.js +255 -0
- package/dist/message-secret-scope-BsvGcXOU.js +104 -0
- package/dist/method-scopes-1fMDkPgy.js +2608 -0
- package/dist/mime-CPj5mSwT.js +150 -0
- package/dist/min-host-version-BROqyGiT.js +348 -0
- package/dist/minimax-vlm-ciXgon3-.js +502 -0
- package/dist/model-auth-FAjaPIyj.js +330 -0
- package/dist/model-auth-env-aXebmtnO.js +42 -0
- package/dist/model-auth-label-BdkmYsfL.js +45 -0
- package/dist/model-auth-markers-CAxoOhNr.js +70 -0
- package/dist/model-auth-runtime-shared-C6EfNsiC.js +18 -0
- package/dist/model-catalog-DcYmAWnK.js +208 -0
- package/dist/model-catalog.runtime-BnfcWBe6.js +2 -0
- package/dist/model-input-shLH7pnZ.js +20 -0
- package/dist/model-overrides-CCPXEsf4.js +61 -0
- package/dist/model-overrides-CbljEHPO.js +84 -0
- package/dist/model-param-b-C9Se0GAW.js +15 -0
- package/dist/model-picker-7YHY1_DM.js +439 -0
- package/dist/model-picker-cAVRu3J8.js +3 -0
- package/dist/model-picker.runtime-DbCF7jcT.js +15 -0
- package/dist/model-selection-DLV9QudA.js +486 -0
- package/dist/model-selection-teaznyVt.js +407 -0
- package/dist/model-suppression-DxU9Wl3w.js +24 -0
- package/dist/model-suppression.runtime-DdJpj7Pn.js +7 -0
- package/dist/models-BktgoCTN.js +3 -0
- package/dist/models-DxC1yWIR.js +2550 -0
- package/dist/models-cli-BQJGDwlZ.js +197 -0
- package/dist/models-config-BrM95ZWn.js +2 -0
- package/dist/models-config-WznILp-f.js +1106 -0
- package/dist/models-config.runtime-DKvV7dBw.js +2 -0
- package/dist/monitor-B7Wimfc0.js +6004 -0
- package/dist/moonshot-stream-wrappers-CAVTNNIV.js +27 -0
- package/dist/moonshot-thinking-stream-wrappers-DSGFaY0P.js +69 -0
- package/dist/multimodal-fHfIB02R.js +66 -0
- package/dist/mutable-allowlist-detectors-Cz3_rHTS.js +62 -0
- package/dist/native-command-session-targets-YEwzYdBY.js +10 -0
- package/dist/net-DV8cgxeU.js +264 -0
- package/dist/network-mode-DlVi9UOI.js +17 -0
- package/dist/node-cli-BOOTFx0A.js +2201 -0
- package/dist/node-command-policy-H9JvUbqw.js +190 -0
- package/dist/node-commands-CtUW-J-z.js +11 -0
- package/dist/node-require-BgDD9bTi.js +14 -0
- package/dist/node-resolve-r0n2qCFZ.js +110 -0
- package/dist/node-service-BTIQHcIe.js +68 -0
- package/dist/node-startup-env-CVMjxAUF.js +50 -0
- package/dist/nodes-cli-DSe8_891.js +1050 -0
- package/dist/nodes-screen-BFBwMK0F.js +219 -0
- package/dist/nodes.helpers-C5_joVF0.js +204 -0
- package/dist/normalize-TCHtmmQz.js +35 -0
- package/dist/normalize-reply-D3AZv-Ku.js +500 -0
- package/dist/normalize-secret-input-Botsab7G.js +32 -0
- package/dist/note-BopuvWl0.js +109 -0
- package/dist/npm-registry-spec-C04c6qSA.js +100 -0
- package/dist/ollama-DHGG2Bt4.js +26 -0
- package/dist/ollama-surface-C297W-Hb.js +24 -0
- package/dist/onboard-BLF26Ra3.js +591 -0
- package/dist/onboard-channels-C7VwUlqL.js +2 -0
- package/dist/onboard-channels-CNYuwk6A.js +705 -0
- package/dist/onboard-config-BHR99vFk.js +2 -0
- package/dist/onboard-config-CDwd7KFG.js +29 -0
- package/dist/onboard-custom-B-SjrGJ_.js +2 -0
- package/dist/onboard-custom-BYciMnUV.js +646 -0
- package/dist/onboard-helpers-CXSVhHmw.js +4 -0
- package/dist/onboard-helpers-DQzH15KX.js +272 -0
- package/dist/onboard-hooks-dbSmp47O.js +52 -0
- package/dist/onboard-remote-76zO-wtV.js +2 -0
- package/dist/onboard-remote-CV8CYWRk.js +193 -0
- package/dist/onboard-search-CR1tclPf.js +339 -0
- package/dist/onboard-skills-B3nol3_I.js +2 -0
- package/dist/onboard-skills-BWzgYZiw.js +134 -0
- package/dist/openai-CYdnp7Xp.js +21 -0
- package/dist/openai-codex-auth-identity-DYIekza3.js +40 -0
- package/dist/openai-codex-catalog-C9jNVPkk.js +11 -0
- package/dist/openai-codex-provider-CihFFdms.js +254 -0
- package/dist/openai-provider-CY9og1U4.js +272 -0
- package/dist/openai-stream-wrappers-DMltslUP.js +453 -0
- package/dist/operator-approvals-client-CrZARXVS.js +33 -0
- package/dist/order-EE5jGs_C.js +744 -0
- package/dist/origin-routing-IIB1gZNP.js +15 -0
- package/dist/os-summary-B2xVpxVk.js +26 -0
- package/dist/outbound-adapter-BXuNyLX4.js +181 -0
- package/dist/outbound-media-Do8el7w-.js +48 -0
- package/dist/outbound-runtime-BsrPMYQX.js +2 -0
- package/dist/outbound-send-deps-RCYokJDu.js +7 -0
- package/dist/pairing-challenge-C6zO1O_e.js +33 -0
- package/dist/pairing-cli-lSGiQegx.js +116 -0
- package/dist/pairing-labels-CqTzyQv4.js +7 -0
- package/dist/pairing-message-CLV_7GCg.js +4 -0
- package/dist/pairing-messages-Bms_bews.js +23 -0
- package/dist/pairing-pending-CymkYopg.js +14 -0
- package/dist/pairing-store-BgSXc67b.js +617 -0
- package/dist/pairing-token-trqjnXaR.js +80 -0
- package/dist/parse-duration-FGYGEVrK.js +41 -0
- package/dist/parse-finite-number-CpMi4ac9.js +30 -0
- package/dist/parse-log-line-DB02BPsG.js +43 -0
- package/dist/parse-port-CfkrReDG.js +8 -0
- package/dist/parse-timeout-CqVxIetA.js +27 -0
- package/dist/path-alias-guards-CTG--JDv.js +40 -0
- package/dist/path-env-Coe9j6U3.js +87 -0
- package/dist/path-safety-BtrNm8CZ.js +12 -0
- package/dist/paths-dFp6bjkV.js +180 -0
- package/dist/paths-voC5pD8X.js +201 -0
- package/dist/payload-BiCTL_Go.js +90 -0
- package/dist/pdf-extract-DYqhcrys.js +73 -0
- package/dist/persistent-bindings.resolve-BG1W2wH2.js +12 -0
- package/dist/persistent-bindings.types-yg27a-LN.js +6 -0
- package/dist/persistent-dedupe-DeJFOp8F.js +116 -0
- package/dist/pi-model-discovery-4V1cP6C-.js +188 -0
- package/dist/pi-settings-tFYTni5h.js +57 -0
- package/dist/plugin-approvals-BBS3Vgt6.js +34 -0
- package/dist/plugin-auto-enable-B4gIDfiP.js +349 -0
- package/dist/plugin-entry-D7EjsbGL.js +25 -0
- package/dist/plugin-install-CBe57uiZ.js +2 -0
- package/dist/plugin-install-PbQ6ukY-.js +191 -0
- package/dist/plugin-install-config-policy-MQbVt-fA.js +93 -0
- package/dist/plugin-install-path-warnings-BfBOA9nm.js +40 -0
- package/dist/plugin-install-plan-DKH1Osjr.js +50 -0
- package/dist/plugin-registry-D2DvWTxI.js +2 -0
- package/dist/plugin-registry-t_GnpNNe.js +70 -0
- package/dist/plugin-runtime-kxm6OF3O.js +6 -0
- package/dist/plugin-sdk/account-core.js +8 -0
- package/dist/plugin-sdk/account-helpers.js +4 -0
- package/dist/plugin-sdk/account-id.js +3 -0
- package/dist/plugin-sdk/account-resolution.js +12 -0
- package/dist/plugin-sdk/acp-runtime.js +6 -0
- package/dist/plugin-sdk/agent-config-primitives.js +3 -0
- package/dist/plugin-sdk/agent-runtime.js +29 -0
- package/dist/plugin-sdk/allow-from.js +5 -0
- package/dist/plugin-sdk/allowlist-config-edit.js +2 -0
- package/dist/plugin-sdk/amazon-bedrock.js +15 -0
- package/dist/plugin-sdk/anthropic-vertex.js +2 -0
- package/dist/plugin-sdk/approval-runtime.js +7 -0
- package/dist/plugin-sdk/bluebubbles-policy.js +2 -0
- package/dist/plugin-sdk/bluebubbles.js +255 -0
- package/dist/plugin-sdk/boolean-param.js +2 -0
- package/dist/plugin-sdk/browser-runtime.js +2 -0
- package/dist/plugin-sdk/browser-support.js +44 -0
- package/dist/plugin-sdk/browser.js +15 -0
- package/dist/plugin-sdk/byteplus.js +17 -0
- package/dist/plugin-sdk/channel-actions.js +3 -0
- package/dist/plugin-sdk/channel-config-helpers.js +2 -0
- package/dist/plugin-sdk/channel-config-primitives.js +3 -0
- package/dist/plugin-sdk/channel-config-schema.js +7 -0
- package/dist/plugin-sdk/channel-config-writes.js +2 -0
- package/dist/plugin-sdk/channel-contract.js +1 -0
- package/dist/plugin-sdk/channel-feedback.js +5 -0
- package/dist/plugin-sdk/channel-inbound.js +10 -0
- package/dist/plugin-sdk/channel-lifecycle.js +3 -0
- package/dist/plugin-sdk/channel-pairing.js +2 -0
- package/dist/plugin-sdk/channel-policy.js +6 -0
- package/dist/plugin-sdk/channel-reply-pipeline.js +2 -0
- package/dist/plugin-sdk/channel-runtime.js +15 -0
- package/dist/plugin-sdk/channel-send-result.js +2 -0
- package/dist/plugin-sdk/channel-setup.js +5 -0
- package/dist/plugin-sdk/channel-status.js +5 -0
- package/dist/plugin-sdk/channel-targets.js +4 -0
- package/dist/plugin-sdk/chutes.js +20 -0
- package/dist/plugin-sdk/cli-backend.js +3 -0
- package/dist/plugin-sdk/cli-runtime.js +6 -0
- package/dist/plugin-sdk/cloudflare-ai-gateway.js +18 -0
- package/dist/plugin-sdk/collection-runtime.js +2 -0
- package/dist/plugin-sdk/command-auth-native.js +6 -0
- package/dist/plugin-sdk/command-auth.js +14 -0
- package/dist/plugin-sdk/compat.js +35 -0
- package/dist/plugin-sdk/config-runtime.js +22 -0
- package/dist/plugin-sdk/conversation-runtime.js +15 -0
- package/dist/plugin-sdk/core.js +22 -0
- package/dist/plugin-sdk/deepseek.js +14 -0
- package/dist/plugin-sdk/device-bootstrap.js +3 -0
- package/dist/plugin-sdk/diagnostic-runtime.js +4 -0
- package/dist/plugin-sdk/diagnostics-otel.js +5 -0
- package/dist/plugin-sdk/diffs.js +3 -0
- package/dist/plugin-sdk/direct-dm.js +2 -0
- package/dist/plugin-sdk/directory-runtime.js +5 -0
- package/dist/plugin-sdk/discord-account.js +2 -0
- package/dist/plugin-sdk/discord-core.js +9 -0
- package/dist/plugin-sdk/discord-runtime-surface.js +2 -0
- package/dist/plugin-sdk/discord-session-key.js +2 -0
- package/dist/plugin-sdk/discord-surface.js +2 -0
- package/dist/plugin-sdk/discord-thread-bindings.js +2 -0
- package/dist/plugin-sdk/discord-timeouts.js +2 -0
- package/dist/plugin-sdk/discord.js +21 -0
- package/dist/plugin-sdk/error-runtime.js +3 -0
- package/dist/plugin-sdk/extension-shared.js +75 -0
- package/dist/plugin-sdk/feishu-conversation.js +2 -0
- package/dist/plugin-sdk/feishu-setup.js +2 -0
- package/dist/plugin-sdk/feishu.js +33 -0
- package/dist/plugin-sdk/fetch-runtime.js +7 -0
- package/dist/plugin-sdk/file-lock.js +2 -0
- package/dist/plugin-sdk/gateway-runtime.js +4 -0
- package/dist/plugin-sdk/github-copilot-login.js +2 -0
- package/dist/plugin-sdk/github-copilot-token.js +2 -0
- package/dist/plugin-sdk/global-singleton.js +4 -0
- package/dist/plugin-sdk/google.js +2 -0
- package/dist/plugin-sdk/googlechat.js +58 -0
- package/dist/plugin-sdk/group-access.js +2 -0
- package/dist/plugin-sdk/hook-runtime.js +4 -0
- package/dist/plugin-sdk/host-runtime.js +3 -0
- package/dist/plugin-sdk/huggingface.js +18 -0
- package/dist/plugin-sdk/image-generation-core.js +63 -0
- package/dist/plugin-sdk/image-generation.js +2 -0
- package/dist/plugin-sdk/index.js +5 -0
- package/dist/plugin-sdk/infra-runtime.js +45 -0
- package/dist/plugin-sdk/interactive-runtime.js +4 -0
- package/dist/plugin-sdk/irc-surface.js +2 -0
- package/dist/plugin-sdk/irc.js +30 -0
- package/dist/plugin-sdk/json-store.js +3 -0
- package/dist/plugin-sdk/keyed-async-queue.js +2 -0
- package/dist/plugin-sdk/kilocode.js +23 -0
- package/dist/plugin-sdk/kimi-coding.js +11 -0
- package/dist/plugin-sdk/lazy-runtime.js +2 -0
- package/dist/plugin-sdk/line-core.js +6 -0
- package/dist/plugin-sdk/line-runtime.js +2 -0
- package/dist/plugin-sdk/line-surface.js +2 -0
- package/dist/plugin-sdk/line.js +9 -0
- package/dist/plugin-sdk/llm-task.js +5 -0
- package/dist/plugin-sdk/logging-core.js +5 -0
- package/dist/plugin-sdk/matrix-helper.js +2 -0
- package/dist/plugin-sdk/matrix-runtime-heavy.js +4 -0
- package/dist/plugin-sdk/matrix-runtime-shared.js +2 -0
- package/dist/plugin-sdk/matrix-runtime-surface.js +2 -0
- package/dist/plugin-sdk/matrix-surface.js +2 -0
- package/dist/plugin-sdk/matrix-thread-bindings.js +2 -0
- package/dist/plugin-sdk/matrix.js +64 -0
- package/dist/plugin-sdk/mattermost-policy.js +11 -0
- package/dist/plugin-sdk/mattermost.js +42 -0
- package/dist/plugin-sdk/media-runtime.js +15 -0
- package/dist/plugin-sdk/media-understanding-runtime.js +2 -0
- package/dist/plugin-sdk/media-understanding.js +3 -0
- package/dist/plugin-sdk/memory-core-engine-runtime.js +2 -0
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +6 -0
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +17 -0
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +3 -0
- package/dist/plugin-sdk/memory-core-host-engine-storage.js +4 -0
- package/dist/plugin-sdk/memory-core-host-multimodal.js +3 -0
- package/dist/plugin-sdk/memory-core-host-query.js +3 -0
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +12 -0
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +13 -0
- package/dist/plugin-sdk/memory-core-host-runtime-files.js +4 -0
- package/dist/plugin-sdk/memory-core-host-secret.js +3 -0
- package/dist/plugin-sdk/memory-core-host-status.js +2 -0
- package/dist/plugin-sdk/memory-core.js +28 -0
- package/dist/plugin-sdk/memory-lancedb.js +4 -0
- package/dist/plugin-sdk/minimax.js +24 -0
- package/dist/plugin-sdk/mistral.js +17 -0
- package/dist/plugin-sdk/modelstudio-definitions.js +19 -0
- package/dist/plugin-sdk/modelstudio.js +24 -0
- package/dist/plugin-sdk/moonshot.js +17 -0
- package/dist/plugin-sdk/msteams.js +54 -0
- package/dist/plugin-sdk/nextcloud-talk.js +35 -0
- package/dist/plugin-sdk/nostr.js +24 -0
- package/dist/plugin-sdk/nvidia.js +11 -0
- package/dist/plugin-sdk/ollama-surface.js +2 -0
- package/dist/plugin-sdk/ollama.js +2 -0
- package/dist/plugin-sdk/openai.js +2 -0
- package/dist/plugin-sdk/opencode-go.js +14 -0
- package/dist/plugin-sdk/opencode.js +15 -0
- package/dist/plugin-sdk/outbound-runtime.js +5 -0
- package/dist/plugin-sdk/param-readers.js +2 -0
- package/dist/plugin-sdk/plugin-entry.js +3 -0
- package/dist/plugin-sdk/plugin-runtime.js +8 -0
- package/dist/plugin-sdk/process-runtime.js +2 -0
- package/dist/plugin-sdk/provider-auth-api-key.js +9 -0
- package/dist/plugin-sdk/provider-auth-login.js +2 -0
- package/dist/plugin-sdk/provider-auth-result.js +2 -0
- package/dist/plugin-sdk/provider-auth-runtime.js +5 -0
- package/dist/plugin-sdk/provider-auth.js +17 -0
- package/dist/plugin-sdk/provider-catalog-shared.js +2 -0
- package/dist/plugin-sdk/provider-entry.js +86 -0
- package/dist/plugin-sdk/provider-env-vars.js +2 -0
- package/dist/plugin-sdk/provider-http.js +3 -0
- package/dist/plugin-sdk/provider-model-shared.js +5 -0
- package/dist/plugin-sdk/provider-moonshot.js +3 -0
- package/dist/plugin-sdk/provider-onboard.js +3 -0
- package/dist/plugin-sdk/provider-setup.js +2 -0
- package/dist/plugin-sdk/provider-stream.js +4 -0
- package/dist/plugin-sdk/provider-tools.js +2 -0
- package/dist/plugin-sdk/provider-usage.js +3 -0
- package/dist/plugin-sdk/provider-web-search.js +6 -0
- package/dist/plugin-sdk/provider-zai-endpoint.js +116 -0
- package/dist/plugin-sdk/qianfan.js +13 -0
- package/dist/plugin-sdk/reply-chunking.js +3 -0
- package/dist/plugin-sdk/reply-dispatch-runtime.js +5 -0
- package/dist/plugin-sdk/reply-history.js +3 -0
- package/dist/plugin-sdk/reply-payload.js +2 -0
- package/dist/plugin-sdk/reply-runtime.js +14 -0
- package/dist/plugin-sdk/request-url.js +2 -0
- package/dist/plugin-sdk/retry-runtime.js +4 -0
- package/dist/plugin-sdk/root-alias.cjs +347 -0
- package/dist/plugin-sdk/routing.js +9 -0
- package/dist/plugin-sdk/runtime-env.js +17 -0
- package/dist/plugin-sdk/runtime-store.js +2 -0
- package/dist/plugin-sdk/runtime.js +9 -0
- package/dist/plugin-sdk/sandbox.js +5 -0
- package/dist/plugin-sdk/secret-input.js +4 -0
- package/dist/plugin-sdk/security-runtime.js +5 -0
- package/dist/plugin-sdk/self-hosted-provider-setup.js +2 -0
- package/dist/plugin-sdk/setup-adapter-runtime.js +3 -0
- package/dist/plugin-sdk/setup-runtime.js +6 -0
- package/dist/plugin-sdk/setup-tools.js +6 -0
- package/dist/plugin-sdk/setup.js +13 -0
- package/dist/plugin-sdk/sglang.js +15 -0
- package/dist/plugin-sdk/signal-account.js +2 -0
- package/dist/plugin-sdk/signal-surface.js +2 -0
- package/dist/plugin-sdk/signal.js +24 -0
- package/dist/plugin-sdk/slack-account.js +2 -0
- package/dist/plugin-sdk/slack-core.js +7 -0
- package/dist/plugin-sdk/slack-runtime-surface.js +2 -0
- package/dist/plugin-sdk/slack-surface.js +2 -0
- package/dist/plugin-sdk/slack-target-parser.js +2 -0
- package/dist/plugin-sdk/slack-targets.js +3 -0
- package/dist/plugin-sdk/slack.js +20 -0
- package/dist/plugin-sdk/speech-core.js +4 -0
- package/dist/plugin-sdk/speech-runtime.js +2 -0
- package/dist/plugin-sdk/speech.js +5 -0
- package/dist/plugin-sdk/ssrf-runtime.js +6 -0
- package/dist/plugin-sdk/state-paths.js +3 -0
- package/dist/plugin-sdk/status-helpers.js +4 -0
- package/dist/plugin-sdk/synthetic.js +17 -0
- package/dist/plugin-sdk/telegram-account.js +2 -0
- package/dist/plugin-sdk/telegram-allow-from.js +12 -0
- package/dist/plugin-sdk/telegram-core.js +18 -0
- package/dist/plugin-sdk/telegram-surface.js +42 -0
- package/dist/plugin-sdk/temp-path.js +4 -0
- package/dist/plugin-sdk/testing.js +11 -0
- package/dist/plugin-sdk/text-runtime.js +20 -0
- package/dist/plugin-sdk/thread-bindings-runtime.js +3 -0
- package/dist/plugin-sdk/thread-ownership.js +4 -0
- package/dist/plugin-sdk/tlon.js +23 -0
- package/dist/plugin-sdk/together.js +16 -0
- package/dist/plugin-sdk/tool-send.js +2 -0
- package/dist/plugin-sdk/twitch.js +17 -0
- package/dist/plugin-sdk/venice.js +16 -0
- package/dist/plugin-sdk/vllm.js +15 -0
- package/dist/plugin-sdk/voice-call.js +6 -0
- package/dist/plugin-sdk/volcengine.js +17 -0
- package/dist/plugin-sdk/web-media.js +3 -0
- package/dist/plugin-sdk/webhook-ingress.js +9 -0
- package/dist/plugin-sdk/webhook-path.js +2 -0
- package/dist/plugin-sdk/webhook-request-guards.js +3 -0
- package/dist/plugin-sdk/whatsapp-auth-presence.js +3 -0
- package/dist/plugin-sdk/whatsapp-core.js +11 -0
- package/dist/plugin-sdk/whatsapp-shared.js +3 -0
- package/dist/plugin-sdk/whatsapp-surface.js +2 -0
- package/dist/plugin-sdk/whatsapp-targets.js +2 -0
- package/dist/plugin-sdk/windows-spawn.js +2 -0
- package/dist/plugin-sdk/xai.js +2 -0
- package/dist/plugin-sdk/zalo-setup.js +2 -0
- package/dist/plugin-sdk/zalo.js +37 -0
- package/dist/plugin-sdk/zalouser.js +39 -0
- package/dist/plugin-sdk/zod.js +2 -0
- package/dist/plugins/build-smoke-entry.js +4 -0
- package/dist/plugins/provider-runtime.runtime.js +2 -0
- package/dist/plugins/runtime/index.js +2 -0
- package/dist/plugins/runtime/runtime-line.contract.js +23 -0
- package/dist/plugins-BUhqQahf.js +7 -0
- package/dist/plugins-D3E9gBoB.js +5 -0
- package/dist/plugins-allowlist-BsE4VUd6.js +14 -0
- package/dist/plugins-cli-DNIRlpEw.js +551 -0
- package/dist/plugins-command-helpers-D0cHWZ8k.js +116 -0
- package/dist/plugins-install-persist-B4VRDkMW.js +121 -0
- package/dist/plugins-update-command-CVpqSCHk.js +974 -0
- package/dist/pluralkit-BLAFsOsu.js +21 -0
- package/dist/poll-params-BRovIMUP.js +52 -0
- package/dist/polls-BJAJSaiP.js +35 -0
- package/dist/port-defaults-BSVMFkjY.js +30 -0
- package/dist/ports-Bc5Ccog1.js +262 -0
- package/dist/ports-C4UXOMrf.js +432 -0
- package/dist/ports-lsof-BGtOoYbU.js +25 -0
- package/dist/ports-probe-BsWR8TFT.js +14 -0
- package/dist/preflight-audio.runtime-C9Vy2rmC.js +7 -0
- package/dist/probe-BQag0DWb.js +178 -0
- package/dist/probe-Ba_tzX9A.js +383 -0
- package/dist/probe-CU89zpYY.js +2 -0
- package/dist/probe-DqrD8L5s.js +137 -0
- package/dist/probe-auth-B_8xyHva.js +63 -0
- package/dist/probe-auth-ynM8e9Ac.js +2 -0
- package/dist/probe.runtime-CJ9xp7YD.js +2 -0
- package/dist/process-scoped-map-DSo5-USL.js +61 -0
- package/dist/profile-utils-C7uzTwgJ.js +15 -0
- package/dist/profiles-bHSSYfJl.js +79 -0
- package/dist/program-context-87EEruZh.js +10 -0
- package/dist/program-context-D14SwQxo.js +2 -0
- package/dist/program-wvgzSxLY.js +158 -0
- package/dist/progress-BvK_oMpz.js +132 -0
- package/dist/prompt-CtkpPKiX.js +2 -0
- package/dist/prompt-DOBS3BID.js +20 -0
- package/dist/prompt-select-styled-c91_PlKW.js +5468 -0
- package/dist/prompt-style-DRmsfagi.js +7 -0
- package/dist/prompts-DAJPf5yB.js +9 -0
- package/dist/prototype-keys-BWjW0VW8.js +11 -0
- package/dist/provider-C6dmSPJE.js +7237 -0
- package/dist/provider-api-key-auth-BBRnMefH.js +109 -0
- package/dist/provider-api-key-auth.runtime-obo7wOYn.js +14 -0
- package/dist/provider-auth-BTrDFsFt.js +43 -0
- package/dist/provider-auth-api-key-BhD_cXM7.js +5 -0
- package/dist/provider-auth-choice-2fsBmYtb.js +134 -0
- package/dist/provider-auth-choice-helpers-DLlNwVwg.js +58 -0
- package/dist/provider-auth-choice-preference-BkZTzT1J.js +44 -0
- package/dist/provider-auth-choice.runtime-BHkXn7WH.js +14 -0
- package/dist/provider-auth-choice.runtime-r6ydqD_o.js +2 -0
- package/dist/provider-auth-choices-AHFkSF9C.js +65 -0
- package/dist/provider-auth-guidance-Bo67Hboq.js +35 -0
- package/dist/provider-auth-helpers-Bk-AB5Wp.js +92 -0
- package/dist/provider-auth-input-kKdGWlxc.js +116 -0
- package/dist/provider-auth-login-dOLrU5NV.js +8 -0
- package/dist/provider-auth-login.runtime-C_GzFGmF.js +196 -0
- package/dist/provider-auth-mode-B8uz1z07.js +20 -0
- package/dist/provider-auth-ref-Bq-MejeL.js +2 -0
- package/dist/provider-auth-ref-DRl66ULG.js +171 -0
- package/dist/provider-auth-result-CkUVvE5c.js +31 -0
- package/dist/provider-auth-runtime-BRAnqbBW.js +32 -0
- package/dist/provider-catalog-shared-BdXDqt2_.js +28 -0
- package/dist/provider-discovery.runtime-BKQXZvW1.js +10 -0
- package/dist/provider-dispatcher-Cic3Zvgm.js +22 -0
- package/dist/provider-env-vars-X-m-m1cR.js +119 -0
- package/dist/provider-flow-rMDy096Q.js +93 -0
- package/dist/provider-id-CTiEzT1T.js +30 -0
- package/dist/provider-model-primary-QC1J1e8s.js +26 -0
- package/dist/provider-model-shared-YwZtB78q.js +104 -0
- package/dist/provider-oauth-flow-DGhuMjqj.js +33 -0
- package/dist/provider-onboard-Dhee14q4.js +264 -0
- package/dist/provider-openai-codex-oauth-tls-CExxHKyb.js +101 -0
- package/dist/provider-registry-7IbNpklR.js +49 -0
- package/dist/provider-runtime-C3NxbOtm.js +2 -0
- package/dist/provider-runtime-DWDjorB4.js +275 -0
- package/dist/provider-runtime.runtime-BYVCPiGA.js +26 -0
- package/dist/provider-self-hosted-setup-Cr4L3fdW.js +272 -0
- package/dist/provider-session.runtime-BHtGAIna.js +8 -0
- package/dist/provider-stream-DpUrpHvN.js +266 -0
- package/dist/provider-tools-L23YSx8p.js +37 -0
- package/dist/provider-usage-BWLu6XJt.js +375 -0
- package/dist/provider-usage-BwHu9Ee_.js +3 -0
- package/dist/provider-usage-CfYpxnUD.js +2 -0
- package/dist/provider-usage.fetch-BCNscJcf.js +633 -0
- package/dist/provider-web-search-CJBYgiMq.js +717 -0
- package/dist/provider-wizard-BGXsleZZ.js +209 -0
- package/dist/provider.runtime-BS0qB3qa.js +2 -0
- package/dist/providers-DTi5kDSF.js +59 -0
- package/dist/providers.runtime-7kqrRLzO.js +55 -0
- package/dist/proxy-env-CEq84zdW.js +40 -0
- package/dist/proxy-fetch-BI4S6OOr.js +55 -0
- package/dist/push-apns-btlZ1qmo.js +921 -0
- package/dist/pw-ai-Crk1oU2c.js +1827 -0
- package/dist/qr-cli-CBrnKR40.js +368 -0
- package/dist/qr-cli-D35IbCMe.js +2 -0
- package/dist/query-expansion-CTVRVJBc.js +633 -0
- package/dist/read-only-account-inspect-CtMAYZjJ.js +9 -0
- package/dist/read-only-account-inspect.telegram-DsWhEWsi.js +202 -0
- package/dist/reasoning-tags-C0A8lJGB.js +77 -0
- package/dist/redact-BDinS1q9.js +102 -0
- package/dist/redact-identifier-CIxwZTyq.js +13 -0
- package/dist/redact-sensitive-url-BYqi2BEL.js +50 -0
- package/dist/redirect-headers-BX_akPpf.js +25 -0
- package/dist/ref-contract-D5ynmOGd.js +53 -0
- package/dist/register-lazy-command-C1up25zY.js +43 -0
- package/dist/register.agent-BoS4J17I.js +239 -0
- package/dist/register.backup-CJxtB0Qd.js +236 -0
- package/dist/register.configure-a7pFaHfe.js +15 -0
- package/dist/register.maintenance-BtI8X-uf.js +450 -0
- package/dist/register.message-BQRkPLq3.js +643 -0
- package/dist/register.onboard-CthiWQxu.js +79 -0
- package/dist/register.setup-BnxRKFDi.js +104 -0
- package/dist/register.status-health-sessions-CHaa5NX0.js +705 -0
- package/dist/register.subclis-DKmBSSCn.js +3 -0
- package/dist/register.subclis-TJY--uPt.js +287 -0
- package/dist/registry-8eF_COje.js +667 -0
- package/dist/registry-B84vjqPA.js +11 -0
- package/dist/registry-CJH_346k.js +60 -0
- package/dist/registry-CiuAeUhZ.js +50 -0
- package/dist/registry-DrnXCaTU.js +219 -0
- package/dist/repair-bIiF2iJn.js +112 -0
- package/dist/reply-B1wBiwTS.js +3134 -0
- package/dist/reply-dispatch-runtime-nSg-l3YV.js +3 -0
- package/dist/reply-history-DiOD0MK2.js +2 -0
- package/dist/reply-payload-D0XXyIHC.js +232 -0
- package/dist/reply-payloads-DW1w7Ckr.js +116 -0
- package/dist/reply-payloads-dedupe-BEPyuQQJ.js +135 -0
- package/dist/reply-payloads-dedupe.runtime-ClraIPuB.js +2 -0
- package/dist/reply-prefix-Bmqt3err.js +39 -0
- package/dist/reply-runtime-bbaSgEmi.js +123 -0
- package/dist/reply.runtime-leqfq1BG.js +2 -0
- package/dist/request-url-B5e58odi.js +10 -0
- package/dist/resolve-B-OthG4M.js +2 -0
- package/dist/resolve-BjvAwAfZ.js +619 -0
- package/dist/resolve-bBpW2W5z.js +174 -0
- package/dist/resolve-channels-543uTQ-Q.js +263 -0
- package/dist/resolve-configured-secret-input-string-CcNZQ54A.js +112 -0
- package/dist/resolve-route-CCHWflcJ.js +486 -0
- package/dist/resolve-system-bin-M8rzqZWg.js +120 -0
- package/dist/resolve-users-B2hIFlh6.js +145 -0
- package/dist/resolve-utils-B34dER9i.js +102 -0
- package/dist/response-prefix-template-CmRtMrPn.js +50 -0
- package/dist/restart-sentinel-BEGeUiKE.js +70 -0
- package/dist/restart-stale-pids-Co_AHlf1.js +187 -0
- package/dist/retry-DB6rKQUK.js +76 -0
- package/dist/retry-policy-vpZZs4Ql.js +58 -0
- package/dist/retry-runtime-BwFtUlOC.js +3 -0
- package/dist/root-help-BKc92COf.js +53 -0
- package/dist/route-reply-BhwCACur.js +133 -0
- package/dist/route-reply.runtime-CR3o0GzY.js +2 -0
- package/dist/route-resolution-C30ccEVA.js +1222 -0
- package/dist/routes-BkjFgytb.js +6880 -0
- package/dist/routing-B6ZVsl1G.js +16 -0
- package/dist/rpc-Ceg29ThW.js +67 -0
- package/dist/run-command-Bec0f6Qx.js +32 -0
- package/dist/run-main-B5ZRlNEV.js +425 -0
- package/dist/run-with-concurrency-oNPuq9N9.js +41 -0
- package/dist/runner-BEbGymO4.js +1478 -0
- package/dist/runtime-B3T4VytJ.js +1627 -0
- package/dist/runtime-CiU2aDgB.js +42 -0
- package/dist/runtime-D0VpiCHi.js +125 -0
- package/dist/runtime-Dtd5v6Gj.js +153 -0
- package/dist/runtime-Fhelf5Qd.js +126 -0
- package/dist/runtime-api-B0fBYyFa.js +241 -0
- package/dist/runtime-api-JdnJolgR.js +2484 -0
- package/dist/runtime-discord-ops.runtime-Cc-Clbrs.js +26 -0
- package/dist/runtime-embedded-pi.runtime-CAq8BTmS.js +2 -0
- package/dist/runtime-env-CkoJ2p8u.js +9 -0
- package/dist/runtime-forwarders-BwQHD11s.js +44 -0
- package/dist/runtime-gaN3vB28.js +284 -0
- package/dist/runtime-group-policy-BPxHuPda.js +59 -0
- package/dist/runtime-guard-VWNtYR4l.js +70 -0
- package/dist/runtime-media-understanding.runtime-BnfH3VZb.js +2 -0
- package/dist/runtime-model-auth.runtime-Bd2GMW6W.js +2 -0
- package/dist/runtime-parse-DFyJekfB.js +83 -0
- package/dist/runtime-paths-C22j-CNR.js +333 -0
- package/dist/runtime-schema-Bft9ccja.js +14524 -0
- package/dist/runtime-slack-ops.runtime-qCe8vp_N.js +15 -0
- package/dist/runtime-status-C7QK-Xow.js +109 -0
- package/dist/runtime-status-SEjcftwu.js +15 -0
- package/dist/runtime-store-j5RNDQBQ.js +22 -0
- package/dist/runtime-tts.runtime-IxRggKLH.js +2 -0
- package/dist/runtime-web-tools-Lf22Il6X.js +1891 -0
- package/dist/runtime-whatsapp-boundary-BQeud5Kv.js +6 -0
- package/dist/runtime-whatsapp-boundary-DbAJ9jGX.js +2 -0
- package/dist/safe-regex-tLlDZYfM.js +244 -0
- package/dist/safe-text-CRAu9RDR.js +16 -0
- package/dist/sandbox-DxQGIkI1.js +2698 -0
- package/dist/sandbox-cli-Bd8ECmMx.js +443 -0
- package/dist/sandbox-paths-ui_vqw2W.js +146 -0
- package/dist/sanitize-env-vars-DpPdECQ9.js +82 -0
- package/dist/scan-paths-VhLKL5WT.js +28 -0
- package/dist/scoped-expiring-id-cache-BmlyFPPR.js +35 -0
- package/dist/scp-host-C5NgDe_6.js +62 -0
- package/dist/secret-equal-fMR1DjSl.js +9 -0
- package/dist/secret-file-COQ7QNO9.js +4 -0
- package/dist/secret-file-Dv42g1FG.js +92 -0
- package/dist/secret-input-CzbdxXxu.js +13 -0
- package/dist/secret-input-DJ-sTcOE.js +38 -0
- package/dist/secrets-cli-OoRkxItP.js +2112 -0
- package/dist/secure-random-DJ9MB_Og.js +20 -0
- package/dist/security-cli-CQ4HiQLb.js +477 -0
- package/dist/security-runtime-CU_gbsBJ.js +51 -0
- package/dist/semver-compare-aGN2MIqz.js +53 -0
- package/dist/send-COItao1A.js +2473 -0
- package/dist/send-deps-K4k6Myst.js +19 -0
- package/dist/send-policy-B1t4c2Ab.js +60 -0
- package/dist/server-BPOSwT-c.js +67 -0
- package/dist/server-middleware-QGnAuw-H.js +108 -0
- package/dist/server-node-events-CoM4XGHV.js +454 -0
- package/dist/server-startup-matrix-migration-CMLAopuE.js +1255 -0
- package/dist/service-8Ef_HfQd.js +2 -0
- package/dist/service-DzXqyjgG.js +849 -0
- package/dist/session-DNTpr0A7.js +50 -0
- package/dist/session-archive.runtime-Bz20yPKg.js +2 -0
- package/dist/session-binding-service-BqY1J7gs.js +421 -0
- package/dist/session-context-D4ioj_ZC.js +23 -0
- package/dist/session-conversation-D3BLZCjg.js +15 -0
- package/dist/session-conversation-SDN1QbLK.js +135 -0
- package/dist/session-cost-usage-5D6Kkthv.js +650 -0
- package/dist/session-cost-usage-CqniZ9Q3.js +2 -0
- package/dist/session-envelope-DdZaP6iS.js +18 -0
- package/dist/session-file-SVifvwcV.js +120 -0
- package/dist/session-fork.runtime-Bhgl-_lq.js +50 -0
- package/dist/session-key-BIrdMs11.js +279 -0
- package/dist/session-key-CCQ4ZS9B.js +53 -0
- package/dist/session-key-normalization-DGxkxG3U.js +22 -0
- package/dist/session-meta-5PkRqQxG.js +9 -0
- package/dist/session-override-CqiOQ4Om.js +100 -0
- package/dist/session-reset-model.runtime-DFL5rk1J.js +119 -0
- package/dist/session-subagent-reactivation.runtime-DIIFdc6I.js +2 -0
- package/dist/session-system-events-BrXQQl_c.js +62 -0
- package/dist/session-transcript-files.fs-BltD5xvW.js +124 -0
- package/dist/session-updates-Dd6r5vhZ.js +177 -0
- package/dist/session-updates.runtime-CTmXpESa.js +2 -0
- package/dist/session-utils-CYh1zGmy.js +1735 -0
- package/dist/session-write-lock-D_1twm3Q.js +343 -0
- package/dist/sessions-BBObTITM.js +2 -0
- package/dist/sessions-BLL-TKEv.js +224 -0
- package/dist/sessions-zgiFsm1E.js +381 -0
- package/dist/setup-BnAbcoEP.js +15 -0
- package/dist/setup-CDUb3AWu.js +427 -0
- package/dist/setup-adapter-runtime-kV6aLMzB.js +2 -0
- package/dist/setup-binary-C35NJX1i.js +2 -0
- package/dist/setup-core-C-0ynF1r.js +256 -0
- package/dist/setup-group-access-BrKTGyeK.js +70 -0
- package/dist/setup-helpers-CNcOI9ct.js +390 -0
- package/dist/setup-runtime-CZF60tJ1.js +4 -0
- package/dist/setup-surface-BcZenSzA.js +237 -0
- package/dist/setup-surface-BwZZukYI.js +97 -0
- package/dist/setup-tools-DB-J75x8.js +4 -0
- package/dist/setup-wizard-helpers-u8iQ-OcY.js +841 -0
- package/dist/setup-wizard-proxy-DiI-Brmi.js +127 -0
- package/dist/setup.finalize-L3P2sSFi.js +443 -0
- package/dist/setup.gateway-config-ISaEE7wH.js +246 -0
- package/dist/setup.secret-input-DCxgkYJ3.js +25 -0
- package/dist/shared-B0P4kmoP.js +50 -0
- package/dist/shared-BOaKRLRY.js +64 -0
- package/dist/shared-BXUt8yQc.js +160 -0
- package/dist/shared-BZ338OsD.js +64 -0
- package/dist/shared-BjU08Pt_.js +54 -0
- package/dist/shared-BsFd7tT-.js +136 -0
- package/dist/shared-CvC-RYap.js +37 -0
- package/dist/shared-dXZZGNhj.js +10 -0
- package/dist/shared-rGax8vC3.js +221 -0
- package/dist/shell-argv-Z5ptFecq.js +72 -0
- package/dist/shell-env-BSJycHpS.js +181 -0
- package/dist/signal-BSV2xBJt.js +46 -0
- package/dist/signal-BZDASWHO.js +13 -0
- package/dist/signal-CId8sMA8.js +6 -0
- package/dist/signal-account-DcEiRyli.js +11 -0
- package/dist/signal-cli-install-CzSdr2VM.js +188 -0
- package/dist/signal-surface-DrUgouip.js +21 -0
- package/dist/simple-completion-transport-BNMmn163.js +24 -0
- package/dist/skill-commands-CZ_x2Cqy.js +77 -0
- package/dist/skill-commands-base-wY_Bsohb.js +60 -0
- package/dist/skill-commands.runtime-BV7uDCJx.js +2 -0
- package/dist/skill-scanner-B27VLIIq.js +354 -0
- package/dist/skills-BTiQjfVL.js +1310 -0
- package/dist/skills-CIF8vVlP.js +3 -0
- package/dist/skills-clawhub-BDym_41x.js +274 -0
- package/dist/skills-cli-C8m1I_bL.js +369 -0
- package/dist/skills-install-B_gFFO8I.js +818 -0
- package/dist/skills-remote-QuF4recE.js +550 -0
- package/dist/skills-status-BEZWIOBR.js +2 -0
- package/dist/skills-status-Dm_Jhtes.js +169 -0
- package/dist/slack-Cs63YrE6.js +6 -0
- package/dist/slack-account-5pXdcCaK.js +11 -0
- package/dist/slack-liv3adei.js +9 -0
- package/dist/slack-runtime-surface-B5JYrWWf.js +18 -0
- package/dist/slack-surface-DpNHDOit.js +44 -0
- package/dist/slack-target-parser-CErq1YCw.js +12 -0
- package/dist/slack-targets-xF6pth_v.js +45 -0
- package/dist/slots-PFLvT1Kq.js +93 -0
- package/dist/speech-BY_tUO7g.js +46 -0
- package/dist/speech-provider-S9O0XAp5.js +154 -0
- package/dist/speech-runtime-oxmNRw3Z.js +34 -0
- package/dist/ssh-config-BDfMcgtS.js +77 -0
- package/dist/ssh-tunnel-DG9ZYGsa.js +159 -0
- package/dist/ssh-tunnel-D_XZfkBV.js +2 -0
- package/dist/ssrf-BRA26Q75.js +246 -0
- package/dist/ssrf-policy-BIG3iChD.js +69 -0
- package/dist/ssrf-runtime-BPxpSyiW.js +5 -0
- package/dist/stage-sandbox-media.runtime-DOOiTZkt.js +229 -0
- package/dist/state-migrations-cqOvSXP-.js +845 -0
- package/dist/state-paths-CudqznX-.js +2 -0
- package/dist/status-B5sZUURG.js +3 -0
- package/dist/status-BXjWA90V.js +608 -0
- package/dist/status-Biw1EIdt.js +2 -0
- package/dist/status-CgHjqeMn.js +650 -0
- package/dist/status-DQZ0kLxk.js +44 -0
- package/dist/status-VHq1HAMM.js +240 -0
- package/dist/status-all-DhEDLGP9.js +798 -0
- package/dist/status-helpers-B7-UgIy8.js +170 -0
- package/dist/status-issues-BFrNHsVn.js +335 -0
- package/dist/status-issues-BUaLeYpi.js +187 -0
- package/dist/status-json-DOnh1xDZ.js +86 -0
- package/dist/status.agent-local-CaYKjhhX.js +59 -0
- package/dist/status.command.text-runtime-DsOhXWI5.js +18 -0
- package/dist/status.daemon-CriBgB61.js +25 -0
- package/dist/status.format-c9WFxqY6.js +44 -0
- package/dist/status.gateway-probe-FD9wNXhY.js +15 -0
- package/dist/status.link-channel-DYBN8KV3.js +35 -0
- package/dist/status.node-mode-FwHcEfkE.js +2 -0
- package/dist/status.node-mode-dPc3mfqx.js +32 -0
- package/dist/status.scan-DTGuZcAs.js +264 -0
- package/dist/status.scan.deps.runtime-BlestHMC.js +18 -0
- package/dist/status.scan.fast-json-Co7nNA_T.js +97 -0
- package/dist/status.scan.fast-json-DRsEwD_h.js +2 -0
- package/dist/status.scan.json-core-DaBuCMzr.js +254 -0
- package/dist/status.scan.runtime-Dp_UkjfG.js +9 -0
- package/dist/status.service-summary-BmHN_sIt.js +32 -0
- package/dist/status.summary-C0Jn9d8y.js +2 -0
- package/dist/status.summary-C3KHSLR1.js +210 -0
- package/dist/status.update-DiRYpvwE.js +2 -0
- package/dist/status.update-DjXE_PsH.js +79 -0
- package/dist/sticker-cache-kEcJqycr.js +1516 -0
- package/dist/sticker-vision.runtime-DdnhPS7k.js +16 -0
- package/dist/store-DKzOIKqx.js +1342 -0
- package/dist/store-DwAEHdgR.js +749 -0
- package/dist/store-HBHyNMRe.js +10 -0
- package/dist/store-NoUggnB3.js +365 -0
- package/dist/store-read-BHYG1WxT.js +16 -0
- package/dist/store.runtime-jT-JoPV1.js +2 -0
- package/dist/string-normalization-k4ilMPRu.js +19 -0
- package/dist/string-sample-BIWt11jp.js +11 -0
- package/dist/strip-inbound-meta-DuOzaKMB.js +665 -0
- package/dist/subagent-orphan-recovery-BaGPnDpY.js +206 -0
- package/dist/subagent-registry-runtime-C0hklxy4.js +2 -0
- package/dist/subcli-descriptors-Ccul9RKX.js +151 -0
- package/dist/subsystem-CpBs2R1c.js +582 -0
- package/dist/supervisor-log.runtime-BbxSpWqa.js +8 -0
- package/dist/system-cli-rGgbAbhD.js +58 -0
- package/dist/system-events-CkTr2pVV.js +93 -0
- package/dist/system-message-BwHVKRn-.js +16 -0
- package/dist/system-run-command-CeFzgmkE.js +295 -0
- package/dist/systemd-aS57J-tg.js +588 -0
- package/dist/systemd-hints-DexZGkZU.js +325 -0
- package/dist/systemd-linger-Dum_Ly5E.js +68 -0
- package/dist/systemd-linger-a109c27V.js +2 -0
- package/dist/table-BNAxmbtm.js +305 -0
- package/dist/tables-AGjErT3Z.js +832 -0
- package/dist/tailnet-CtCjQNPK.js +76 -0
- package/dist/tailscale-IqBQ_JBD.js +232 -0
- package/dist/tailscale-status-SUYxe8DO.js +71 -0
- package/dist/target-errors-Dd5ygAn4.js +26 -0
- package/dist/target-parsing-DsTnx9-F.js +14 -0
- package/dist/target-registry-Je8d-VjB.js +1280 -0
- package/dist/targets-B5CwzJUC.js +748 -0
- package/dist/targets-CsuOrZri.js +269 -0
- package/dist/targets-CwnVSfRA.js +70 -0
- package/dist/targets-DuUFEzKS.js +78 -0
- package/dist/task-registry-delivery-runtime-DqP8eooO.js +2 -0
- package/dist/task-registry.audit.shared-C4RGABy7.js +18 -0
- package/dist/task-registry.maintenance-Bu37anXR.js +281 -0
- package/dist/task-registry.maintenance-DOsnDSZk.js +2 -0
- package/dist/task-registry.summary-DxVk_l3y.js +44 -0
- package/dist/tavily-search-provider-CJqkM2Pl.js +226 -0
- package/dist/telegram/audit.js +2 -0
- package/dist/telegram/token.js +2 -0
- package/dist/telegram-DYAW3Sfk.js +23 -0
- package/dist/telegram-account-BJWXAeS3.js +11 -0
- package/dist/telegram-core-BB-oqWi1.js +6 -0
- package/dist/temp-download-vS-txIoM.js +62 -0
- package/dist/temp-path-DfCfU6WG.js +2 -0
- package/dist/templating-NXIs4v5N.js +24 -0
- package/dist/terminal-link-TU0E45HO.js +10 -0
- package/dist/testing-BnS6kfoS.js +575 -0
- package/dist/text-chunking-90VX7tgk.js +12 -0
- package/dist/text-chunking-BVps1926.js +20 -0
- package/dist/text-format-B1S_nIVb.js +8 -0
- package/dist/text-runtime-vMYWZmQD.js +398 -0
- package/dist/theme-BJIQPogA.js +34 -0
- package/dist/theme-SO8WovMK.js +2 -0
- package/dist/thinking-uI0siSaD.js +68 -0
- package/dist/thinking.shared-C4SN38qn.js +243 -0
- package/dist/thread-bindings-policy-BcpXmcKL.js +172 -0
- package/dist/thread-bindings-u1VyUaZn.js +778 -0
- package/dist/thread-bindings.discord-api-Cq6oEKwK.js +486 -0
- package/dist/threading-helpers-PW95yLIC.js +14 -0
- package/dist/timeouts-CTDvzc8O.js +72 -0
- package/dist/tmp-vora-dir-D2qk7W45.js +102 -0
- package/dist/token-CHFyaNO5.js +45 -0
- package/dist/token-D6h_ZVJn.js +82 -0
- package/dist/tokens-shGOmvyA.js +66 -0
- package/dist/tool-display-DqKeDkdg.js +1607 -0
- package/dist/tool-images-Dk60Ug5h.js +270 -0
- package/dist/tool-policy-CQHL2-I3.js +515 -0
- package/dist/tool-policy-match-DL8JY2vg.js +48 -0
- package/dist/tool-send-hJCuDJfS.js +16 -0
- package/dist/tools-effective-inventory-CWzIubjU.js +148 -0
- package/dist/tools-pE9BlK9y.js +119 -0
- package/dist/transcript-events-DRsDmwmp.js +29 -0
- package/dist/transport-ready-f6mdQOwn.js +36 -0
- package/dist/tts-B1m3C2Az.js +102 -0
- package/dist/tts-DUrUS0mZ.js +85 -0
- package/dist/tts-auto-mode-C8_kw3FV.js +14 -0
- package/dist/tts.runtime-BoqipRLV.js +2 -0
- package/dist/tui-CQLplrBK.js +3898 -0
- package/dist/tui-cli-DT0FyMjs.js +31 -0
- package/dist/typebox-DR5b98DT.js +22 -0
- package/dist/types-CGCTcpfm.js +465 -0
- package/dist/types-DDSZHm1L.js +12 -0
- package/dist/types-KyI2zD1Y.js +83 -0
- package/dist/types.secrets-CxoujPzV.js +80 -0
- package/dist/types.tools-DbA37tJ5.js +22 -0
- package/dist/typing-Dz7FaNst.js +68 -0
- package/dist/typing-mode-D3dtTRFq.js +75 -0
- package/dist/typing-policy-DNdXa4aP.js +11 -0
- package/dist/typing-start-guard-Bd69zP69.js +73 -0
- package/dist/ui-DBzDVf5Z.js +182 -0
- package/dist/undici-global-dispatcher-jevw8Gzz.js +99 -0
- package/dist/unhandled-rejections-D0HD8aaS.js +2 -0
- package/dist/unhandled-rejections-yZafPL2A.js +241 -0
- package/dist/update-Bof-SJAQ.js +1253 -0
- package/dist/update-channels-d8te77R1.js +78 -0
- package/dist/update-check-DK2tfDQH.js +354 -0
- package/dist/update-cli-Ck2vsRAq.js +1446 -0
- package/dist/update-offset-store-DzcRNELt.js +75 -0
- package/dist/utils-BiWzD1kh.js +230 -0
- package/dist/utils-QayXenI0.js +3 -0
- package/dist/version-B8PcQo5n.js +79 -0
- package/dist/version-DBzWIScg.js +2 -0
- package/dist/vora-embedded-block-chunker-3yyZObTq.js +258 -0
- package/dist/vora-embedded-helpers-CcpQ4UhE.js +1451 -0
- package/dist/vora-embedded-runner-CtRc9sK4.js +35200 -0
- package/dist/vora-embedded.runtime-DnQSqL4C.js +3 -0
- package/dist/vora-exec-env-D4Xwhvu2.js +14 -0
- package/dist/vora-root-LrpnxvkN.js +88 -0
- package/dist/vora-tools.before-tool-call.runtime-DMDQZj3b.js +354 -0
- package/dist/vora-tools.runtime-CRE3qINm.js +2 -0
- package/dist/wait-DINWFDZY.js +7 -0
- package/dist/warning-filter-SAevhKdH.js +57 -0
- package/dist/web-media-xqpNAEze.js +630 -0
- package/dist/web-search-providers-Dzq6HxbB.js +21 -0
- package/dist/web-search-providers.runtime-CtA0c8j7.js +110 -0
- package/dist/web-search-providers.shared-BDbtn1DP.js +404 -0
- package/dist/webhook-ingress-VjrwfCEq.js +164 -0
- package/dist/webhook-memory-guards-B-_GNMqp.js +129 -0
- package/dist/webhook-path-KmDDjLxH.js +22 -0
- package/dist/webhook-request-guards-RvZR0xOr.js +178 -0
- package/dist/webhooks-cli-DW2licxV.js +325 -0
- package/dist/whatsapp-BdBhDmjG.js +4 -0
- package/dist/whatsapp-DrWLgII5.js +33 -0
- package/dist/whatsapp-heartbeat-B9ic2dUo.js +114 -0
- package/dist/whatsapp-shared-CCB6ISPU.js +56 -0
- package/dist/whatsapp-surface-Dj75n55B.js +26 -0
- package/dist/whatsapp-targets-DC3kH_Ao.js +13 -0
- package/dist/widearea-dns-CQmUW5IF.js +125 -0
- package/dist/windows-argv-Dp3PZAV0.js +345 -0
- package/dist/windows-install-roots-XI3CvO9O.js +149 -0
- package/dist/windows-spawn-Bo5J7nQU.js +154 -0
- package/dist/with-timeout-82_4MKPJ.js +13 -0
- package/dist/with-timeout-C9cQCRMB.js +215 -0
- package/dist/workspace-Byy6tyA9.js +479 -0
- package/dist/workspace-dirs-DD2rvoad.js +13 -0
- package/dist/workspace-rZgvKsfA.js +306 -0
- package/dist/ws-H_UxQmDV.js +11 -0
- package/dist/ws-log-Colefm0_.js +289 -0
- package/dist/wsl-Cja5t6Cg.js +57 -0
- package/dist/xai-G_qBZ2Uy.js +27 -0
- package/dist/zalo-setup-DhLwoxOU.js +14 -0
- package/dist/zod-parse-CoS4Cf-k.js +14 -0
- package/dist/zod-schema.agent-runtime-DvpP4fxf.js +602 -0
- package/dist/zod-schema.channels-BAf89d5l.js +10 -0
- package/dist/zod-schema.core-BTG8QVOn.js +514 -0
- package/dist/zod-schema.providers-core-CBsF2dSN.js +1569 -0
- package/dist/zod-schema.providers-whatsapp-BORKPdar.js +125 -0
- package/dist/zod-schema.sensitive-bgI4eB_k.js +5 -0
- package/docs/.i18n/README.md +31 -0
- package/docs/.i18n/glossary.ja-JP.json +14 -0
- package/docs/.i18n/glossary.zh-CN.json +306 -0
- package/docs/.i18n/ja-JP.tm.jsonl +0 -0
- package/docs/assets/install-script.svg +1 -0
- package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
- package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
- package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
- package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
- package/docs/assets/macos-onboarding/05-permissions.png +0 -0
- package/docs/assets/pixel-lobster.svg +60 -0
- package/docs/assets/showcase/agents-ui.jpg +0 -0
- package/docs/assets/showcase/bambu-cli.png +0 -0
- package/docs/assets/showcase/codexmonitor.png +0 -0
- package/docs/assets/showcase/gohome-grafana.png +0 -0
- package/docs/assets/showcase/ios-testflight.jpg +0 -0
- package/docs/assets/showcase/oura-health.png +0 -0
- package/docs/assets/showcase/padel-cli.svg +11 -0
- package/docs/assets/showcase/padel-screenshot.jpg +0 -0
- package/docs/assets/showcase/papla-tts.jpg +0 -0
- package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
- package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
- package/docs/assets/showcase/roborock-status.svg +13 -0
- package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
- package/docs/assets/showcase/snag.png +0 -0
- package/docs/assets/showcase/tesco-shop.jpg +0 -0
- package/docs/assets/showcase/wienerlinien.png +0 -0
- package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
- package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
- package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
- package/docs/assets/sponsors/blacksmith-light.svg +14 -0
- package/docs/assets/sponsors/blacksmith.svg +14 -0
- package/docs/assets/sponsors/convex-light.svg +16 -0
- package/docs/assets/sponsors/convex.svg +16 -0
- package/docs/assets/sponsors/nvidia-dark.svg +9 -0
- package/docs/assets/sponsors/nvidia.svg +9 -0
- package/docs/assets/sponsors/openai-light.svg +3 -0
- package/docs/assets/sponsors/openai.svg +3 -0
- package/docs/assets/sponsors/vercel-light.svg +5 -0
- package/docs/assets/sponsors/vercel.svg +5 -0
- package/docs/assets/vora-logo-text-dark.png +0 -0
- package/docs/assets/vora-logo-text-dark.svg +418 -0
- package/docs/assets/vora-logo-text.png +0 -0
- package/docs/assets/vora-logo-text.svg +418 -0
- package/docs/auth-credential-semantics.md +60 -0
- package/docs/automation/auth-monitoring.md +44 -0
- package/docs/automation/clawflow.md +109 -0
- package/docs/automation/cron-jobs.md +744 -0
- package/docs/automation/cron-vs-heartbeat.md +299 -0
- package/docs/automation/gmail-pubsub.md +256 -0
- package/docs/automation/hooks.md +1375 -0
- package/docs/automation/index.md +69 -0
- package/docs/automation/poll.md +86 -0
- package/docs/automation/standing-orders.md +254 -0
- package/docs/automation/tasks.md +247 -0
- package/docs/automation/troubleshooting.md +122 -0
- package/docs/automation/webhook.md +217 -0
- package/docs/brave-search.md +93 -0
- package/docs/channels/bluebubbles.md +430 -0
- package/docs/channels/broadcast-groups.md +442 -0
- package/docs/channels/channel-routing.md +139 -0
- package/docs/channels/discord.md +1240 -0
- package/docs/channels/feishu.md +760 -0
- package/docs/channels/googlechat.md +270 -0
- package/docs/channels/group-messages.md +84 -0
- package/docs/channels/groups.md +385 -0
- package/docs/channels/imessage.md +427 -0
- package/docs/channels/index.md +50 -0
- package/docs/channels/irc.md +250 -0
- package/docs/channels/line.md +221 -0
- package/docs/channels/location.md +56 -0
- package/docs/channels/matrix.md +779 -0
- package/docs/channels/mattermost.md +435 -0
- package/docs/channels/msteams.md +802 -0
- package/docs/channels/nextcloud-talk.md +146 -0
- package/docs/channels/nostr.md +257 -0
- package/docs/channels/pairing.md +114 -0
- package/docs/channels/qqbot.md +193 -0
- package/docs/channels/signal.md +337 -0
- package/docs/channels/slack.md +607 -0
- package/docs/channels/synology-chat.md +150 -0
- package/docs/channels/telegram.md +991 -0
- package/docs/channels/tlon.md +284 -0
- package/docs/channels/troubleshooting.md +118 -0
- package/docs/channels/twitch.md +387 -0
- package/docs/channels/whatsapp.md +462 -0
- package/docs/channels/zalo.md +251 -0
- package/docs/channels/zalouser.md +189 -0
- package/docs/ci.md +57 -0
- package/docs/cli/acp.md +297 -0
- package/docs/cli/agent.md +29 -0
- package/docs/cli/agents.md +123 -0
- package/docs/cli/approvals.md +50 -0
- package/docs/cli/backup.md +76 -0
- package/docs/cli/browser.md +127 -0
- package/docs/cli/channels.md +102 -0
- package/docs/cli/clawbot.md +21 -0
- package/docs/cli/completion.md +35 -0
- package/docs/cli/config.md +317 -0
- package/docs/cli/configure.md +42 -0
- package/docs/cli/cron.md +80 -0
- package/docs/cli/daemon.md +55 -0
- package/docs/cli/dashboard.md +22 -0
- package/docs/cli/devices.md +139 -0
- package/docs/cli/directory.md +63 -0
- package/docs/cli/dns.md +23 -0
- package/docs/cli/docs.md +15 -0
- package/docs/cli/doctor.md +48 -0
- package/docs/cli/flows.md +54 -0
- package/docs/cli/gateway.md +238 -0
- package/docs/cli/health.md +21 -0
- package/docs/cli/hooks.md +330 -0
- package/docs/cli/index.md +1239 -0
- package/docs/cli/logs.md +28 -0
- package/docs/cli/mcp.md +467 -0
- package/docs/cli/memory.md +66 -0
- package/docs/cli/message.md +280 -0
- package/docs/cli/models.md +90 -0
- package/docs/cli/node.md +132 -0
- package/docs/cli/nodes.md +55 -0
- package/docs/cli/onboard.md +160 -0
- package/docs/cli/pairing.md +32 -0
- package/docs/cli/plugins.md +229 -0
- package/docs/cli/qr.md +46 -0
- package/docs/cli/reset.md +20 -0
- package/docs/cli/sandbox.md +197 -0
- package/docs/cli/secrets.md +188 -0
- package/docs/cli/security.md +79 -0
- package/docs/cli/sessions.md +110 -0
- package/docs/cli/setup.md +29 -0
- package/docs/cli/skills.md +40 -0
- package/docs/cli/status.md +30 -0
- package/docs/cli/system.md +60 -0
- package/docs/cli/tui.md +30 -0
- package/docs/cli/uninstall.md +20 -0
- package/docs/cli/update.md +103 -0
- package/docs/cli/voicecall.md +34 -0
- package/docs/cli/webhooks.md +25 -0
- package/docs/concepts/agent-loop.md +166 -0
- package/docs/concepts/agent-workspace.md +243 -0
- package/docs/concepts/agent.md +122 -0
- package/docs/concepts/architecture.md +144 -0
- package/docs/concepts/compaction.md +93 -0
- package/docs/concepts/context-engine.md +274 -0
- package/docs/concepts/context.md +179 -0
- package/docs/concepts/delegate-architecture.md +296 -0
- package/docs/concepts/features.md +73 -0
- package/docs/concepts/markdown-formatting.md +130 -0
- package/docs/concepts/memory-builtin.md +105 -0
- package/docs/concepts/memory-honcho.md +140 -0
- package/docs/concepts/memory-qmd.md +163 -0
- package/docs/concepts/memory-search.md +141 -0
- package/docs/concepts/memory.md +102 -0
- package/docs/concepts/messages.md +161 -0
- package/docs/concepts/model-failover.md +160 -0
- package/docs/concepts/model-providers.md +599 -0
- package/docs/concepts/models.md +232 -0
- package/docs/concepts/multi-agent.md +602 -0
- package/docs/concepts/oauth.md +193 -0
- package/docs/concepts/presence.md +102 -0
- package/docs/concepts/queue.md +89 -0
- package/docs/concepts/retry.md +69 -0
- package/docs/concepts/session-pruning.md +80 -0
- package/docs/concepts/session-tool.md +84 -0
- package/docs/concepts/session.md +116 -0
- package/docs/concepts/streaming.md +161 -0
- package/docs/concepts/system-prompt.md +132 -0
- package/docs/concepts/timezone.md +97 -0
- package/docs/concepts/typebox.md +291 -0
- package/docs/concepts/typing-indicators.md +68 -0
- package/docs/concepts/usage-tracking.md +35 -0
- package/docs/date-time.md +128 -0
- package/docs/debug/node-issue.md +85 -0
- package/docs/diagnostics/flags.md +91 -0
- package/docs/docs.json +2143 -0
- package/docs/gateway/authentication.md +204 -0
- package/docs/gateway/background-process.md +97 -0
- package/docs/gateway/bonjour.md +177 -0
- package/docs/gateway/bridge-protocol.md +86 -0
- package/docs/gateway/cli-backends.md +249 -0
- package/docs/gateway/configuration-examples.md +652 -0
- package/docs/gateway/configuration-reference.md +3384 -0
- package/docs/gateway/configuration.md +633 -0
- package/docs/gateway/discovery.md +127 -0
- package/docs/gateway/doctor.md +463 -0
- package/docs/gateway/gateway-lock.md +37 -0
- package/docs/gateway/health.md +53 -0
- package/docs/gateway/heartbeat.md +407 -0
- package/docs/gateway/index.md +286 -0
- package/docs/gateway/local-models.md +153 -0
- package/docs/gateway/logging.md +113 -0
- package/docs/gateway/multiple-gateways.md +112 -0
- package/docs/gateway/network-model.md +24 -0
- package/docs/gateway/openai-http-api.md +266 -0
- package/docs/gateway/openresponses-http-api.md +322 -0
- package/docs/gateway/openshell.md +307 -0
- package/docs/gateway/pairing.md +99 -0
- package/docs/gateway/protocol.md +280 -0
- package/docs/gateway/remote-gateway-readme.md +160 -0
- package/docs/gateway/remote.md +248 -0
- package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +134 -0
- package/docs/gateway/sandboxing.md +469 -0
- package/docs/gateway/secrets-plan-contract.md +116 -0
- package/docs/gateway/secrets.md +541 -0
- package/docs/gateway/security/index.md +1216 -0
- package/docs/gateway/tailscale.md +132 -0
- package/docs/gateway/tools-invoke-http-api.md +147 -0
- package/docs/gateway/troubleshooting.md +382 -0
- package/docs/gateway/trusted-proxy-auth.md +342 -0
- package/docs/help/debugging.md +168 -0
- package/docs/help/environment.md +163 -0
- package/docs/help/faq.md +3002 -0
- package/docs/help/index.md +28 -0
- package/docs/help/scripts.md +28 -0
- package/docs/help/testing.md +664 -0
- package/docs/help/troubleshooting.md +352 -0
- package/docs/images/configure-model-picker-unsearchable.png +0 -0
- package/docs/images/feishu-step2-create-app.png +0 -0
- package/docs/images/feishu-step3-credentials.png +0 -0
- package/docs/images/feishu-step4-permissions.png +0 -0
- package/docs/images/feishu-step5-bot-capability.png +0 -0
- package/docs/images/feishu-step6-event-subscription.png +0 -0
- package/docs/images/feishu-verification-token.png +0 -0
- package/docs/images/groups-flow.svg +52 -0
- package/docs/images/mobile-ui-screenshot.png +0 -0
- package/docs/index.md +196 -0
- package/docs/install/ansible.md +230 -0
- package/docs/install/azure.md +311 -0
- package/docs/install/bun.md +55 -0
- package/docs/install/clawdock.md +105 -0
- package/docs/install/development-channels.md +120 -0
- package/docs/install/digitalocean.md +129 -0
- package/docs/install/docker-vm-runtime.md +142 -0
- package/docs/install/docker.md +404 -0
- package/docs/install/exe-dev.md +126 -0
- package/docs/install/fly.md +501 -0
- package/docs/install/gcp.md +402 -0
- package/docs/install/hetzner.md +251 -0
- package/docs/install/index.md +183 -0
- package/docs/install/installer.md +421 -0
- package/docs/install/kubernetes.md +191 -0
- package/docs/install/macos-vm.md +281 -0
- package/docs/install/migrating-matrix.md +346 -0
- package/docs/install/migrating.md +110 -0
- package/docs/install/nix.md +89 -0
- package/docs/install/node.md +144 -0
- package/docs/install/northflank.mdx +40 -0
- package/docs/install/oracle.md +156 -0
- package/docs/install/podman.md +269 -0
- package/docs/install/railway.mdx +87 -0
- package/docs/install/raspberry-pi.md +159 -0
- package/docs/install/render.mdx +159 -0
- package/docs/install/uninstall.md +128 -0
- package/docs/install/updating.md +134 -0
- package/docs/ja-JP/index.md +186 -0
- package/docs/ja-JP/start/getting-started.md +125 -0
- package/docs/ja-JP/start/wizard.md +77 -0
- package/docs/logging.md +357 -0
- package/docs/nav-tabs-underline.js +100 -0
- package/docs/network.md +63 -0
- package/docs/nodes/audio.md +187 -0
- package/docs/nodes/camera.md +162 -0
- package/docs/nodes/images.md +72 -0
- package/docs/nodes/index.md +395 -0
- package/docs/nodes/location-command.md +98 -0
- package/docs/nodes/media-understanding.md +394 -0
- package/docs/nodes/talk.md +92 -0
- package/docs/nodes/troubleshooting.md +114 -0
- package/docs/nodes/voicewake.md +66 -0
- package/docs/perplexity.md +174 -0
- package/docs/pi-dev.md +80 -0
- package/docs/pi.md +567 -0
- package/docs/platforms/android.md +168 -0
- package/docs/platforms/digitalocean.md +266 -0
- package/docs/platforms/index.md +54 -0
- package/docs/platforms/ios.md +220 -0
- package/docs/platforms/linux.md +94 -0
- package/docs/platforms/mac/bundled-gateway.md +73 -0
- package/docs/platforms/mac/canvas.md +125 -0
- package/docs/platforms/mac/child-process.md +69 -0
- package/docs/platforms/mac/dev-setup.md +104 -0
- package/docs/platforms/mac/health.md +34 -0
- package/docs/platforms/mac/icon.md +31 -0
- package/docs/platforms/mac/logging.md +57 -0
- package/docs/platforms/mac/menu-bar.md +81 -0
- package/docs/platforms/mac/peekaboo.md +65 -0
- package/docs/platforms/mac/permissions.md +50 -0
- package/docs/platforms/mac/remote.md +84 -0
- package/docs/platforms/mac/signing.md +47 -0
- package/docs/platforms/mac/skills.md +34 -0
- package/docs/platforms/mac/voice-overlay.md +60 -0
- package/docs/platforms/mac/voicewake.md +67 -0
- package/docs/platforms/mac/webchat.md +43 -0
- package/docs/platforms/mac/xpc.md +61 -0
- package/docs/platforms/macos.md +228 -0
- package/docs/platforms/oracle.md +303 -0
- package/docs/platforms/raspberry-pi.md +412 -0
- package/docs/platforms/windows.md +241 -0
- package/docs/plugins/agent-tools.md +10 -0
- package/docs/plugins/architecture.md +1400 -0
- package/docs/plugins/building-extensions.md +10 -0
- package/docs/plugins/building-plugins.md +283 -0
- package/docs/plugins/bundles.md +278 -0
- package/docs/plugins/community.md +145 -0
- package/docs/plugins/manifest.md +284 -0
- package/docs/plugins/sdk-channel-plugins.md +419 -0
- package/docs/plugins/sdk-entrypoints.md +184 -0
- package/docs/plugins/sdk-migration.md +180 -0
- package/docs/plugins/sdk-overview.md +287 -0
- package/docs/plugins/sdk-provider-plugins.md +440 -0
- package/docs/plugins/sdk-runtime.md +347 -0
- package/docs/plugins/sdk-setup.md +365 -0
- package/docs/plugins/sdk-testing.md +263 -0
- package/docs/plugins/voice-call.md +397 -0
- package/docs/plugins/zalouser.md +78 -0
- package/docs/prose.md +134 -0
- package/docs/providers/anthropic.md +375 -0
- package/docs/providers/bedrock.md +217 -0
- package/docs/providers/claude-max-api-proxy.md +154 -0
- package/docs/providers/cloudflare-ai-gateway.md +71 -0
- package/docs/providers/deepgram.md +93 -0
- package/docs/providers/deepseek.md +53 -0
- package/docs/providers/github-copilot.md +72 -0
- package/docs/providers/glm.md +43 -0
- package/docs/providers/google.md +78 -0
- package/docs/providers/groq.md +96 -0
- package/docs/providers/huggingface.md +209 -0
- package/docs/providers/index.md +72 -0
- package/docs/providers/kilocode.md +74 -0
- package/docs/providers/litellm.md +154 -0
- package/docs/providers/minimax.md +183 -0
- package/docs/providers/mistral.md +54 -0
- package/docs/providers/models.md +45 -0
- package/docs/providers/moonshot.md +175 -0
- package/docs/providers/nvidia.md +55 -0
- package/docs/providers/ollama.md +352 -0
- package/docs/providers/openai.md +319 -0
- package/docs/providers/opencode-go.md +45 -0
- package/docs/providers/opencode.md +64 -0
- package/docs/providers/openrouter.md +37 -0
- package/docs/providers/perplexity-provider.md +62 -0
- package/docs/providers/qianfan.md +38 -0
- package/docs/providers/qwen.md +33 -0
- package/docs/providers/qwen_modelstudio.md +85 -0
- package/docs/providers/sglang.md +104 -0
- package/docs/providers/synthetic.md +99 -0
- package/docs/providers/together.md +66 -0
- package/docs/providers/venice.md +282 -0
- package/docs/providers/vercel-ai-gateway.md +60 -0
- package/docs/providers/vllm.md +92 -0
- package/docs/providers/volcengine.md +74 -0
- package/docs/providers/xai.md +69 -0
- package/docs/providers/xiaomi.md +86 -0
- package/docs/providers/zai.md +46 -0
- package/docs/reference/AGENTS.default.md +126 -0
- package/docs/reference/RELEASING.md +80 -0
- package/docs/reference/api-usage-costs.md +144 -0
- package/docs/reference/credits.md +30 -0
- package/docs/reference/device-models.md +47 -0
- package/docs/reference/memory-config.md +370 -0
- package/docs/reference/prompt-caching.md +195 -0
- package/docs/reference/rpc.md +43 -0
- package/docs/reference/secretref-credential-surface.md +137 -0
- package/docs/reference/secretref-user-supplied-credentials-matrix.json +535 -0
- package/docs/reference/session-management-compaction.md +326 -0
- package/docs/reference/templates/AGENTS.dev.md +84 -0
- package/docs/reference/templates/AGENTS.md +219 -0
- package/docs/reference/templates/BOOT.md +11 -0
- package/docs/reference/templates/BOOTSTRAP.md +62 -0
- package/docs/reference/templates/HEARTBEAT.md +14 -0
- package/docs/reference/templates/IDENTITY.dev.md +48 -0
- package/docs/reference/templates/IDENTITY.md +30 -0
- package/docs/reference/templates/SOUL.dev.md +77 -0
- package/docs/reference/templates/SOUL.md +43 -0
- package/docs/reference/templates/TOOLS.dev.md +25 -0
- package/docs/reference/templates/TOOLS.md +47 -0
- package/docs/reference/templates/USER.dev.md +19 -0
- package/docs/reference/templates/USER.md +24 -0
- package/docs/reference/test.md +120 -0
- package/docs/reference/token-use.md +175 -0
- package/docs/reference/transcript-hygiene.md +151 -0
- package/docs/reference/wizard.md +235 -0
- package/docs/security/CONTRIBUTING-THREAT-MODEL.md +98 -0
- package/docs/security/THREAT-MODEL-ATLAS.md +608 -0
- package/docs/security/formal-verification.md +167 -0
- package/docs/snippets/plugin-publish/minimal-package.json +16 -0
- package/docs/snippets/plugin-publish/minimal-vora.plugin.json +9 -0
- package/docs/start/bootstrapping.md +41 -0
- package/docs/start/docs-directory.md +66 -0
- package/docs/start/getting-started.md +116 -0
- package/docs/start/hubs.md +198 -0
- package/docs/start/lore.md +219 -0
- package/docs/start/onboarding-overview.md +67 -0
- package/docs/start/onboarding.md +91 -0
- package/docs/start/quickstart.md +22 -0
- package/docs/start/setup.md +164 -0
- package/docs/start/showcase.md +418 -0
- package/docs/start/vora.md +224 -0
- package/docs/start/wizard-cli-automation.md +215 -0
- package/docs/start/wizard-cli-reference.md +302 -0
- package/docs/start/wizard.md +125 -0
- package/docs/style.css +37 -0
- package/docs/tools/acp-agents.md +772 -0
- package/docs/tools/agent-send.md +100 -0
- package/docs/tools/apply-patch.md +52 -0
- package/docs/tools/brave-search.md +97 -0
- package/docs/tools/browser-linux-troubleshooting.md +138 -0
- package/docs/tools/browser-login.md +73 -0
- package/docs/tools/browser-wsl2-windows-remote-cdp-troubleshooting.md +211 -0
- package/docs/tools/browser.md +824 -0
- package/docs/tools/btw.md +142 -0
- package/docs/tools/capability-cookbook.md +119 -0
- package/docs/tools/clawhub.md +336 -0
- package/docs/tools/code-execution.md +90 -0
- package/docs/tools/creating-skills.md +117 -0
- package/docs/tools/diffs.md +388 -0
- package/docs/tools/duckduckgo-search.md +101 -0
- package/docs/tools/elevated.md +114 -0
- package/docs/tools/exa-search.md +127 -0
- package/docs/tools/exec-approvals.md +502 -0
- package/docs/tools/exec.md +217 -0
- package/docs/tools/firecrawl.md +144 -0
- package/docs/tools/gemini-search.md +93 -0
- package/docs/tools/grok-search.md +98 -0
- package/docs/tools/image-generation.md +125 -0
- package/docs/tools/index.md +140 -0
- package/docs/tools/kimi-search.md +73 -0
- package/docs/tools/llm-task.md +119 -0
- package/docs/tools/lobster.md +348 -0
- package/docs/tools/loop-detection.md +100 -0
- package/docs/tools/multi-agent-sandbox-tools.md +364 -0
- package/docs/tools/pdf.md +161 -0
- package/docs/tools/perplexity-search.md +178 -0
- package/docs/tools/plugin.md +291 -0
- package/docs/tools/reactions.md +64 -0
- package/docs/tools/skills-config.md +95 -0
- package/docs/tools/skills.md +331 -0
- package/docs/tools/slash-commands.md +315 -0
- package/docs/tools/subagents.md +296 -0
- package/docs/tools/tavily.md +129 -0
- package/docs/tools/thinking.md +96 -0
- package/docs/tools/tts.md +416 -0
- package/docs/tools/web-fetch.md +135 -0
- package/docs/tools/web.md +362 -0
- package/docs/tts.md +416 -0
- package/docs/vps.md +112 -0
- package/docs/web/control-ui.md +285 -0
- package/docs/web/dashboard.md +56 -0
- package/docs/web/index.md +120 -0
- package/docs/web/tui.md +175 -0
- package/docs/web/webchat.md +65 -0
- package/docs/whatsapp-vora-ai-zh.jpg +0 -0
- package/docs/whatsapp-vora.jpg +0 -0
- package/docs/zh-CN/AGENTS.md +61 -0
- package/docs/zh-CN/automation/auth-monitoring.md +47 -0
- package/docs/zh-CN/automation/cron-jobs.md +435 -0
- package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
- package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
- package/docs/zh-CN/automation/hooks.md +1051 -0
- package/docs/zh-CN/automation/poll.md +76 -0
- package/docs/zh-CN/automation/troubleshooting.md +8 -0
- package/docs/zh-CN/automation/webhook.md +163 -0
- package/docs/zh-CN/brave-search.md +60 -0
- package/docs/zh-CN/channels/bluebubbles.md +354 -0
- package/docs/zh-CN/channels/broadcast-groups.md +449 -0
- package/docs/zh-CN/channels/channel-routing.md +117 -0
- package/docs/zh-CN/channels/discord.md +468 -0
- package/docs/zh-CN/channels/feishu.md +728 -0
- package/docs/zh-CN/channels/googlechat.md +257 -0
- package/docs/zh-CN/channels/grammy.md +38 -0
- package/docs/zh-CN/channels/group-messages.md +91 -0
- package/docs/zh-CN/channels/groups.md +379 -0
- package/docs/zh-CN/channels/imessage.md +302 -0
- package/docs/zh-CN/channels/index.md +53 -0
- package/docs/zh-CN/channels/line.md +180 -0
- package/docs/zh-CN/channels/location.md +63 -0
- package/docs/zh-CN/channels/matrix.md +221 -0
- package/docs/zh-CN/channels/mattermost.md +144 -0
- package/docs/zh-CN/channels/msteams.md +775 -0
- package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
- package/docs/zh-CN/channels/nostr.md +249 -0
- package/docs/zh-CN/channels/pairing.md +89 -0
- package/docs/zh-CN/channels/signal.md +209 -0
- package/docs/zh-CN/channels/slack.md +531 -0
- package/docs/zh-CN/channels/synology-chat.md +138 -0
- package/docs/zh-CN/channels/telegram.md +751 -0
- package/docs/zh-CN/channels/tlon.md +136 -0
- package/docs/zh-CN/channels/troubleshooting.md +36 -0
- package/docs/zh-CN/channels/twitch.md +385 -0
- package/docs/zh-CN/channels/whatsapp.md +411 -0
- package/docs/zh-CN/channels/zalo.md +196 -0
- package/docs/zh-CN/channels/zalouser.md +147 -0
- package/docs/zh-CN/cli/acp.md +173 -0
- package/docs/zh-CN/cli/agent.md +30 -0
- package/docs/zh-CN/cli/agents.md +82 -0
- package/docs/zh-CN/cli/approvals.md +57 -0
- package/docs/zh-CN/cli/browser.md +114 -0
- package/docs/zh-CN/cli/channels.md +86 -0
- package/docs/zh-CN/cli/config.md +57 -0
- package/docs/zh-CN/cli/configure.md +38 -0
- package/docs/zh-CN/cli/cron.md +43 -0
- package/docs/zh-CN/cli/dashboard.md +23 -0
- package/docs/zh-CN/cli/devices.md +74 -0
- package/docs/zh-CN/cli/directory.md +70 -0
- package/docs/zh-CN/cli/dns.md +30 -0
- package/docs/zh-CN/cli/docs.md +22 -0
- package/docs/zh-CN/cli/doctor.md +48 -0
- package/docs/zh-CN/cli/gateway.md +206 -0
- package/docs/zh-CN/cli/health.md +28 -0
- package/docs/zh-CN/cli/hooks.md +298 -0
- package/docs/zh-CN/cli/index.md +1142 -0
- package/docs/zh-CN/cli/logs.md +31 -0
- package/docs/zh-CN/cli/memory.md +52 -0
- package/docs/zh-CN/cli/message.md +246 -0
- package/docs/zh-CN/cli/models.md +85 -0
- package/docs/zh-CN/cli/node.md +115 -0
- package/docs/zh-CN/cli/nodes.md +62 -0
- package/docs/zh-CN/cli/onboard.md +164 -0
- package/docs/zh-CN/cli/pairing.md +28 -0
- package/docs/zh-CN/cli/plugins.md +66 -0
- package/docs/zh-CN/cli/reset.md +24 -0
- package/docs/zh-CN/cli/sandbox.md +158 -0
- package/docs/zh-CN/cli/security.md +33 -0
- package/docs/zh-CN/cli/sessions.md +23 -0
- package/docs/zh-CN/cli/setup.md +36 -0
- package/docs/zh-CN/cli/skills.md +33 -0
- package/docs/zh-CN/cli/status.md +33 -0
- package/docs/zh-CN/cli/system.md +63 -0
- package/docs/zh-CN/cli/tui.md +30 -0
- package/docs/zh-CN/cli/uninstall.md +24 -0
- package/docs/zh-CN/cli/update.md +101 -0
- package/docs/zh-CN/cli/voicecall.md +41 -0
- package/docs/zh-CN/cli/webhooks.md +32 -0
- package/docs/zh-CN/concepts/agent-loop.md +146 -0
- package/docs/zh-CN/concepts/agent-workspace.md +219 -0
- package/docs/zh-CN/concepts/agent.md +115 -0
- package/docs/zh-CN/concepts/architecture.md +123 -0
- package/docs/zh-CN/concepts/compaction.md +67 -0
- package/docs/zh-CN/concepts/context.md +168 -0
- package/docs/zh-CN/concepts/features.md +59 -0
- package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
- package/docs/zh-CN/concepts/memory.md +412 -0
- package/docs/zh-CN/concepts/messages.md +141 -0
- package/docs/zh-CN/concepts/model-failover.md +145 -0
- package/docs/zh-CN/concepts/model-providers.md +589 -0
- package/docs/zh-CN/concepts/models.md +225 -0
- package/docs/zh-CN/concepts/multi-agent.md +372 -0
- package/docs/zh-CN/concepts/oauth.md +164 -0
- package/docs/zh-CN/concepts/presence.md +99 -0
- package/docs/zh-CN/concepts/queue.md +94 -0
- package/docs/zh-CN/concepts/retry.md +76 -0
- package/docs/zh-CN/concepts/session-pruning.md +129 -0
- package/docs/zh-CN/concepts/session-tool.md +200 -0
- package/docs/zh-CN/concepts/session.md +166 -0
- package/docs/zh-CN/concepts/streaming.md +133 -0
- package/docs/zh-CN/concepts/system-prompt.md +101 -0
- package/docs/zh-CN/concepts/timezone.md +96 -0
- package/docs/zh-CN/concepts/typebox.md +284 -0
- package/docs/zh-CN/concepts/typing-indicators.md +74 -0
- package/docs/zh-CN/concepts/usage-tracking.md +42 -0
- package/docs/zh-CN/date-time.md +129 -0
- package/docs/zh-CN/debug/node-issue.md +90 -0
- package/docs/zh-CN/diagnostics/flags.md +98 -0
- package/docs/zh-CN/gateway/authentication.md +184 -0
- package/docs/zh-CN/gateway/background-process.md +100 -0
- package/docs/zh-CN/gateway/bonjour.md +174 -0
- package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
- package/docs/zh-CN/gateway/cli-backends.md +213 -0
- package/docs/zh-CN/gateway/configuration-examples.md +587 -0
- package/docs/zh-CN/gateway/configuration-reference.md +3103 -0
- package/docs/zh-CN/gateway/configuration.md +640 -0
- package/docs/zh-CN/gateway/discovery.md +123 -0
- package/docs/zh-CN/gateway/doctor.md +238 -0
- package/docs/zh-CN/gateway/gateway-lock.md +41 -0
- package/docs/zh-CN/gateway/health.md +42 -0
- package/docs/zh-CN/gateway/heartbeat.md +274 -0
- package/docs/zh-CN/gateway/index.md +335 -0
- package/docs/zh-CN/gateway/local-models.md +159 -0
- package/docs/zh-CN/gateway/logging.md +114 -0
- package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
- package/docs/zh-CN/gateway/network-model.md +23 -0
- package/docs/zh-CN/gateway/openai-http-api.md +125 -0
- package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
- package/docs/zh-CN/gateway/pairing.md +99 -0
- package/docs/zh-CN/gateway/protocol.md +220 -0
- package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
- package/docs/zh-CN/gateway/remote.md +133 -0
- package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
- package/docs/zh-CN/gateway/sandboxing.md +188 -0
- package/docs/zh-CN/gateway/security/index.md +777 -0
- package/docs/zh-CN/gateway/tailscale.md +124 -0
- package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
- package/docs/zh-CN/gateway/troubleshooting.md +771 -0
- package/docs/zh-CN/help/debugging.md +160 -0
- package/docs/zh-CN/help/environment.md +88 -0
- package/docs/zh-CN/help/faq.md +2640 -0
- package/docs/zh-CN/help/index.md +28 -0
- package/docs/zh-CN/help/scripts.md +35 -0
- package/docs/zh-CN/help/testing.md +375 -0
- package/docs/zh-CN/help/troubleshooting.md +104 -0
- package/docs/zh-CN/index.md +186 -0
- package/docs/zh-CN/install/ansible.md +215 -0
- package/docs/zh-CN/install/bun.md +65 -0
- package/docs/zh-CN/install/development-channels.md +81 -0
- package/docs/zh-CN/install/docker.md +532 -0
- package/docs/zh-CN/install/exe-dev.md +133 -0
- package/docs/zh-CN/install/fly.md +490 -0
- package/docs/zh-CN/install/gcp.md +510 -0
- package/docs/zh-CN/install/hetzner.md +337 -0
- package/docs/zh-CN/install/index.md +235 -0
- package/docs/zh-CN/install/installer.md +422 -0
- package/docs/zh-CN/install/macos-vm.md +288 -0
- package/docs/zh-CN/install/migrating.md +199 -0
- package/docs/zh-CN/install/nix.md +99 -0
- package/docs/zh-CN/install/node.md +8 -0
- package/docs/zh-CN/install/northflank.mdx +60 -0
- package/docs/zh-CN/install/railway.mdx +106 -0
- package/docs/zh-CN/install/render.mdx +169 -0
- package/docs/zh-CN/install/uninstall.md +135 -0
- package/docs/zh-CN/install/updating.md +233 -0
- package/docs/zh-CN/logging.md +329 -0
- package/docs/zh-CN/network.md +59 -0
- package/docs/zh-CN/nodes/audio.md +120 -0
- package/docs/zh-CN/nodes/camera.md +162 -0
- package/docs/zh-CN/nodes/images.md +79 -0
- package/docs/zh-CN/nodes/index.md +350 -0
- package/docs/zh-CN/nodes/location-command.md +120 -0
- package/docs/zh-CN/nodes/media-understanding.md +380 -0
- package/docs/zh-CN/nodes/talk.md +97 -0
- package/docs/zh-CN/nodes/troubleshooting.md +8 -0
- package/docs/zh-CN/nodes/voicewake.md +72 -0
- package/docs/zh-CN/perplexity.md +102 -0
- package/docs/zh-CN/pi-dev.md +87 -0
- package/docs/zh-CN/pi.md +571 -0
- package/docs/zh-CN/platforms/android.md +155 -0
- package/docs/zh-CN/platforms/digitalocean.md +273 -0
- package/docs/zh-CN/platforms/index.md +60 -0
- package/docs/zh-CN/platforms/ios.md +114 -0
- package/docs/zh-CN/platforms/linux.md +100 -0
- package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
- package/docs/zh-CN/platforms/mac/canvas.md +128 -0
- package/docs/zh-CN/platforms/mac/child-process.md +73 -0
- package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
- package/docs/zh-CN/platforms/mac/health.md +41 -0
- package/docs/zh-CN/platforms/mac/icon.md +38 -0
- package/docs/zh-CN/platforms/mac/logging.md +64 -0
- package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
- package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
- package/docs/zh-CN/platforms/mac/permissions.md +46 -0
- package/docs/zh-CN/platforms/mac/remote.md +90 -0
- package/docs/zh-CN/platforms/mac/signing.md +54 -0
- package/docs/zh-CN/platforms/mac/skills.md +40 -0
- package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
- package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
- package/docs/zh-CN/platforms/mac/webchat.md +43 -0
- package/docs/zh-CN/platforms/mac/xpc.md +68 -0
- package/docs/zh-CN/platforms/macos.md +193 -0
- package/docs/zh-CN/platforms/oracle.md +310 -0
- package/docs/zh-CN/platforms/raspberry-pi.md +416 -0
- package/docs/zh-CN/platforms/windows.md +247 -0
- package/docs/zh-CN/plugins/agent-tools.md +99 -0
- package/docs/zh-CN/plugins/manifest.md +68 -0
- package/docs/zh-CN/plugins/voice-call.md +250 -0
- package/docs/zh-CN/plugins/zalouser.md +88 -0
- package/docs/zh-CN/prose.md +141 -0
- package/docs/zh-CN/providers/anthropic.md +265 -0
- package/docs/zh-CN/providers/bedrock.md +170 -0
- package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
- package/docs/zh-CN/providers/cloudflare-ai-gateway.md +78 -0
- package/docs/zh-CN/providers/deepgram.md +97 -0
- package/docs/zh-CN/providers/github-copilot.md +67 -0
- package/docs/zh-CN/providers/glm.md +50 -0
- package/docs/zh-CN/providers/huggingface.md +216 -0
- package/docs/zh-CN/providers/index.md +69 -0
- package/docs/zh-CN/providers/kilocode.md +80 -0
- package/docs/zh-CN/providers/litellm.md +160 -0
- package/docs/zh-CN/providers/minimax.md +222 -0
- package/docs/zh-CN/providers/mistral.md +61 -0
- package/docs/zh-CN/providers/models.md +51 -0
- package/docs/zh-CN/providers/moonshot.md +182 -0
- package/docs/zh-CN/providers/nvidia.md +62 -0
- package/docs/zh-CN/providers/ollama.md +359 -0
- package/docs/zh-CN/providers/openai.md +308 -0
- package/docs/zh-CN/providers/opencode-go.md +52 -0
- package/docs/zh-CN/providers/opencode.md +71 -0
- package/docs/zh-CN/providers/openrouter.md +44 -0
- package/docs/zh-CN/providers/qianfan.md +45 -0
- package/docs/zh-CN/providers/qwen.md +36 -0
- package/docs/zh-CN/providers/sglang.md +111 -0
- package/docs/zh-CN/providers/synthetic.md +106 -0
- package/docs/zh-CN/providers/together.md +72 -0
- package/docs/zh-CN/providers/venice.md +289 -0
- package/docs/zh-CN/providers/vercel-ai-gateway.md +66 -0
- package/docs/zh-CN/providers/xiaomi.md +93 -0
- package/docs/zh-CN/providers/zai.md +53 -0
- package/docs/zh-CN/reference/AGENTS.default.md +131 -0
- package/docs/zh-CN/reference/RELEASING.md +48 -0
- package/docs/zh-CN/reference/api-usage-costs.md +141 -0
- package/docs/zh-CN/reference/credits.md +34 -0
- package/docs/zh-CN/reference/device-models.md +54 -0
- package/docs/zh-CN/reference/rpc.md +48 -0
- package/docs/zh-CN/reference/session-management-compaction.md +287 -0
- package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
- package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
- package/docs/zh-CN/reference/templates/BOOT.md +17 -0
- package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
- package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
- package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
- package/docs/zh-CN/reference/templates/IDENTITY.md +36 -0
- package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
- package/docs/zh-CN/reference/templates/SOUL.md +49 -0
- package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
- package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
- package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
- package/docs/zh-CN/reference/templates/USER.md +30 -0
- package/docs/zh-CN/reference/test.md +57 -0
- package/docs/zh-CN/reference/token-use.md +119 -0
- package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
- package/docs/zh-CN/reference/wizard.md +242 -0
- package/docs/zh-CN/security/formal-verification.md +171 -0
- package/docs/zh-CN/start/bootstrapping.md +9 -0
- package/docs/zh-CN/start/docs-directory.md +70 -0
- package/docs/zh-CN/start/getting-started.md +143 -0
- package/docs/zh-CN/start/hubs.md +194 -0
- package/docs/zh-CN/start/lore.md +226 -0
- package/docs/zh-CN/start/onboarding-overview.md +58 -0
- package/docs/zh-CN/start/onboarding.md +105 -0
- package/docs/zh-CN/start/quickstart.md +88 -0
- package/docs/zh-CN/start/setup.md +153 -0
- package/docs/zh-CN/start/showcase.md +423 -0
- package/docs/zh-CN/start/vora.md +248 -0
- package/docs/zh-CN/start/wizard-cli-automation.md +222 -0
- package/docs/zh-CN/start/wizard-cli-reference.md +306 -0
- package/docs/zh-CN/start/wizard.md +132 -0
- package/docs/zh-CN/tools/agent-send.md +59 -0
- package/docs/zh-CN/tools/apply-patch.md +57 -0
- package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
- package/docs/zh-CN/tools/browser-login.md +75 -0
- package/docs/zh-CN/tools/browser.md +553 -0
- package/docs/zh-CN/tools/chrome-extension.md +183 -0
- package/docs/zh-CN/tools/clawhub.md +225 -0
- package/docs/zh-CN/tools/creating-skills.md +61 -0
- package/docs/zh-CN/tools/diffs.md +393 -0
- package/docs/zh-CN/tools/elevated.md +64 -0
- package/docs/zh-CN/tools/exec-approvals.md +234 -0
- package/docs/zh-CN/tools/exec.md +169 -0
- package/docs/zh-CN/tools/firecrawl.md +68 -0
- package/docs/zh-CN/tools/index.md +514 -0
- package/docs/zh-CN/tools/llm-task.md +117 -0
- package/docs/zh-CN/tools/lobster.md +349 -0
- package/docs/zh-CN/tools/multi-agent-sandbox-tools.md +401 -0
- package/docs/zh-CN/tools/plugin.md +1610 -0
- package/docs/zh-CN/tools/reactions.md +29 -0
- package/docs/zh-CN/tools/skills-config.md +78 -0
- package/docs/zh-CN/tools/skills.md +279 -0
- package/docs/zh-CN/tools/slash-commands.md +205 -0
- package/docs/zh-CN/tools/subagents.md +167 -0
- package/docs/zh-CN/tools/thinking.md +80 -0
- package/docs/zh-CN/tools/web.md +289 -0
- package/docs/zh-CN/tts.md +375 -0
- package/docs/zh-CN/vps.md +47 -0
- package/docs/zh-CN/web/control-ui.md +191 -0
- package/docs/zh-CN/web/dashboard.md +53 -0
- package/docs/zh-CN/web/index.md +118 -0
- package/docs/zh-CN/web/tui.md +166 -0
- package/docs/zh-CN/web/webchat.md +56 -0
- package/package.json +1305 -0
- package/scripts/postinstall-bundled-plugins.mjs +166 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +118 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +199 -0
- package/skills/clawflow/SKILL.md +76 -0
- package/skills/clawflow/examples/inbox-triage.lobster +33 -0
- package/skills/clawflow/examples/pr-intake.lobster +32 -0
- package/skills/clawflow-inbox-triage/SKILL.md +62 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +316 -0
- package/skills/discord/SKILL.md +197 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gh-issues/SKILL.md +885 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +163 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +122 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +320 -0
- package/skills/model-usage/scripts/test_model_usage.py +40 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/node-connect/SKILL.md +142 -0
- package/skills/notion/SKILL.md +174 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +62 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +88 -0
- package/skills/openhue/SKILL.md +112 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/session-logs/SKILL.md +151 -0
- package/skills/sherpa-onnx-tts/SKILL.md +109 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +372 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +139 -0
- package/skills/skill-creator/scripts/quick_validate.py +159 -0
- package/skills/skill-creator/scripts/test_package_skill.py +160 -0
- package/skills/skill-creator/scripts/test_quick_validate.py +72 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +65 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +170 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +108 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +129 -0
- package/skills/xurl/SKILL.md +461 -0
- package/vora.mjs +183 -0
|
@@ -0,0 +1,3898 @@
|
|
|
1
|
+
import { i as visibleWidth, r as stripAnsi$1 } from "./ansi-B_0KjIJj.js";
|
|
2
|
+
import { d as normalizeUsageDisplay, p as resolveResponseUsageMode } from "./thinking.shared-C4SN38qn.js";
|
|
3
|
+
import { a as hasConfiguredSecretInput } from "./types.secrets-CxoujPzV.js";
|
|
4
|
+
import { T as parseAgentSessionKey, c as normalizeAgentId, l as normalizeMainKey, r as buildAgentMainSessionKey } from "./session-key-BIrdMs11.js";
|
|
5
|
+
import { c as resolveAgentIdByWorkspacePath, m as resolveDefaultAgentId } from "./agent-scope-BsqFyt8u.js";
|
|
6
|
+
import { c as loadConfig } from "./io-B07IaARR.js";
|
|
7
|
+
import { n as VERSION } from "./version-B8PcQo5n.js";
|
|
8
|
+
import "./config-CKbWnj3S.js";
|
|
9
|
+
import { t as assertExplicitGatewayAuthModeWhenBothConfigured } from "./auth-mode-policy-C2dpPPMZ.js";
|
|
10
|
+
import { r as isLoopbackHost } from "./net-DV8cgxeU.js";
|
|
11
|
+
import { _ as GATEWAY_CLIENT_NAMES, g as GATEWAY_CLIENT_MODES, m as GATEWAY_CLIENT_CAPS } from "./message-channel-Di9LQZCg.js";
|
|
12
|
+
import { u as GatewayClient } from "./method-scopes-1fMDkPgy.js";
|
|
13
|
+
import { l as resolveExplicitGatewayAuth, n as buildGatewayConnectionDetails, s as ensureExplicitGatewayAuth } from "./call-CYGZtInt.js";
|
|
14
|
+
import { t as resolveConfiguredSecretInputString } from "./resolve-configured-secret-input-string-CcNZQ54A.js";
|
|
15
|
+
import { n as formatRawAssistantErrorForUi } from "./assistant-error-format-KDZ_osDM.js";
|
|
16
|
+
import { n as listThinkingLevelLabels, t as formatThinkingLevels } from "./thinking-uI0siSaD.js";
|
|
17
|
+
import { r as resolveToolDisplay, t as formatToolDetail } from "./tool-display-DqKeDkdg.js";
|
|
18
|
+
import { t as normalizeGroupActivation } from "./group-activation-BwfaA0gP.js";
|
|
19
|
+
import { n as formatTimeAgo, t as formatRelativeTimestamp } from "./format-relative-CKRrUR_e.js";
|
|
20
|
+
import { a as formatTokenCount, r as stripLeadingInboundMetadata } from "./strip-inbound-meta-DuOzaKMB.js";
|
|
21
|
+
import { c as listChatCommands, l as listChatCommandsForConfig } from "./commands-registry-DsvlObRs.js";
|
|
22
|
+
import { spawn } from "node:child_process";
|
|
23
|
+
import chalk from "chalk";
|
|
24
|
+
import { randomUUID } from "node:crypto";
|
|
25
|
+
import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, isKeyRelease, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
|
|
26
|
+
import { highlight, supportsLanguage } from "cli-highlight";
|
|
27
|
+
//#region src/tui/commands.ts
|
|
28
|
+
const VERBOSE_LEVELS = ["on", "off"];
|
|
29
|
+
const FAST_LEVELS = [
|
|
30
|
+
"status",
|
|
31
|
+
"on",
|
|
32
|
+
"off"
|
|
33
|
+
];
|
|
34
|
+
const REASONING_LEVELS = ["on", "off"];
|
|
35
|
+
const ELEVATED_LEVELS = [
|
|
36
|
+
"on",
|
|
37
|
+
"off",
|
|
38
|
+
"ask",
|
|
39
|
+
"full"
|
|
40
|
+
];
|
|
41
|
+
const ACTIVATION_LEVELS = ["mention", "always"];
|
|
42
|
+
const USAGE_FOOTER_LEVELS = [
|
|
43
|
+
"off",
|
|
44
|
+
"tokens",
|
|
45
|
+
"full"
|
|
46
|
+
];
|
|
47
|
+
const COMMAND_ALIASES = { elev: "elevated" };
|
|
48
|
+
function createLevelCompletion(levels) {
|
|
49
|
+
return (prefix) => levels.filter((value) => value.startsWith(prefix.toLowerCase())).map((value) => ({
|
|
50
|
+
value,
|
|
51
|
+
label: value
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
function parseCommand(input) {
|
|
55
|
+
const trimmed = input.replace(/^\//, "").trim();
|
|
56
|
+
if (!trimmed) return {
|
|
57
|
+
name: "",
|
|
58
|
+
args: ""
|
|
59
|
+
};
|
|
60
|
+
const [name, ...rest] = trimmed.split(/\s+/);
|
|
61
|
+
const normalized = name.toLowerCase();
|
|
62
|
+
return {
|
|
63
|
+
name: COMMAND_ALIASES[normalized] ?? normalized,
|
|
64
|
+
args: rest.join(" ").trim()
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getSlashCommands(options = {}) {
|
|
68
|
+
const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
|
|
69
|
+
const verboseCompletions = createLevelCompletion(VERBOSE_LEVELS);
|
|
70
|
+
const fastCompletions = createLevelCompletion(FAST_LEVELS);
|
|
71
|
+
const reasoningCompletions = createLevelCompletion(REASONING_LEVELS);
|
|
72
|
+
const usageCompletions = createLevelCompletion(USAGE_FOOTER_LEVELS);
|
|
73
|
+
const elevatedCompletions = createLevelCompletion(ELEVATED_LEVELS);
|
|
74
|
+
const activationCompletions = createLevelCompletion(ACTIVATION_LEVELS);
|
|
75
|
+
const commands = [
|
|
76
|
+
{
|
|
77
|
+
name: "help",
|
|
78
|
+
description: "Show slash command help"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "status",
|
|
82
|
+
description: "Show gateway status summary"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "agent",
|
|
86
|
+
description: "Switch agent (or open picker)"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "agents",
|
|
90
|
+
description: "Open agent picker"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "session",
|
|
94
|
+
description: "Switch session (or open picker)"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "sessions",
|
|
98
|
+
description: "Open session picker"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "model",
|
|
102
|
+
description: "Set model (or open picker)"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "models",
|
|
106
|
+
description: "Open model picker"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "think",
|
|
110
|
+
description: "Set thinking level",
|
|
111
|
+
getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
|
|
112
|
+
value,
|
|
113
|
+
label: value
|
|
114
|
+
}))
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "fast",
|
|
118
|
+
description: "Set fast mode on/off",
|
|
119
|
+
getArgumentCompletions: fastCompletions
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "verbose",
|
|
123
|
+
description: "Set verbose on/off",
|
|
124
|
+
getArgumentCompletions: verboseCompletions
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "reasoning",
|
|
128
|
+
description: "Set reasoning on/off",
|
|
129
|
+
getArgumentCompletions: reasoningCompletions
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "usage",
|
|
133
|
+
description: "Toggle per-response usage line",
|
|
134
|
+
getArgumentCompletions: usageCompletions
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "elevated",
|
|
138
|
+
description: "Set elevated on/off/ask/full",
|
|
139
|
+
getArgumentCompletions: elevatedCompletions
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "elev",
|
|
143
|
+
description: "Alias for /elevated",
|
|
144
|
+
getArgumentCompletions: elevatedCompletions
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "activation",
|
|
148
|
+
description: "Set group activation",
|
|
149
|
+
getArgumentCompletions: activationCompletions
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "abort",
|
|
153
|
+
description: "Abort active run"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "new",
|
|
157
|
+
description: "Reset the session"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "reset",
|
|
161
|
+
description: "Reset the session"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "settings",
|
|
165
|
+
description: "Open settings"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "exit",
|
|
169
|
+
description: "Exit the TUI"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "quit",
|
|
173
|
+
description: "Exit the TUI"
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
const seen = new Set(commands.map((command) => command.name));
|
|
177
|
+
const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
|
|
178
|
+
for (const command of gatewayCommands) {
|
|
179
|
+
const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
|
|
180
|
+
for (const alias of aliases) {
|
|
181
|
+
const name = alias.replace(/^\//, "").trim();
|
|
182
|
+
if (!name || seen.has(name)) continue;
|
|
183
|
+
seen.add(name);
|
|
184
|
+
commands.push({
|
|
185
|
+
name,
|
|
186
|
+
description: command.description
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return commands;
|
|
191
|
+
}
|
|
192
|
+
function helpText(options = {}) {
|
|
193
|
+
return [
|
|
194
|
+
"Slash commands:",
|
|
195
|
+
"/help",
|
|
196
|
+
"/commands",
|
|
197
|
+
"/status",
|
|
198
|
+
"/agent <id> (or /agents)",
|
|
199
|
+
"/session <key> (or /sessions)",
|
|
200
|
+
"/model <provider/model> (or /models)",
|
|
201
|
+
`/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
|
|
202
|
+
"/fast <status|on|off>",
|
|
203
|
+
"/verbose <on|off>",
|
|
204
|
+
"/reasoning <on|off>",
|
|
205
|
+
"/usage <off|tokens|full>",
|
|
206
|
+
"/elevated <on|off|ask|full>",
|
|
207
|
+
"/elev <on|off|ask|full>",
|
|
208
|
+
"/activation <mention|always>",
|
|
209
|
+
"/new or /reset",
|
|
210
|
+
"/abort",
|
|
211
|
+
"/settings",
|
|
212
|
+
"/exit"
|
|
213
|
+
].join("\n");
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/tui/theme/syntax-theme.ts
|
|
217
|
+
/**
|
|
218
|
+
* Syntax highlighting theme for code blocks.
|
|
219
|
+
* Uses chalk functions to style different token types.
|
|
220
|
+
*/
|
|
221
|
+
function createSyntaxTheme(fallback, light = false) {
|
|
222
|
+
if (light) return {
|
|
223
|
+
keyword: chalk.hex("#AF00DB"),
|
|
224
|
+
built_in: chalk.hex("#267F99"),
|
|
225
|
+
type: chalk.hex("#267F99"),
|
|
226
|
+
literal: chalk.hex("#0000FF"),
|
|
227
|
+
number: chalk.hex("#098658"),
|
|
228
|
+
string: chalk.hex("#A31515"),
|
|
229
|
+
regexp: chalk.hex("#811F3F"),
|
|
230
|
+
symbol: chalk.hex("#098658"),
|
|
231
|
+
class: chalk.hex("#267F99"),
|
|
232
|
+
function: chalk.hex("#795E26"),
|
|
233
|
+
title: chalk.hex("#795E26"),
|
|
234
|
+
params: chalk.hex("#001080"),
|
|
235
|
+
comment: chalk.hex("#008000"),
|
|
236
|
+
doctag: chalk.hex("#008000"),
|
|
237
|
+
meta: chalk.hex("#001080"),
|
|
238
|
+
"meta-keyword": chalk.hex("#AF00DB"),
|
|
239
|
+
"meta-string": chalk.hex("#A31515"),
|
|
240
|
+
section: chalk.hex("#795E26"),
|
|
241
|
+
tag: chalk.hex("#800000"),
|
|
242
|
+
name: chalk.hex("#001080"),
|
|
243
|
+
attr: chalk.hex("#C50000"),
|
|
244
|
+
attribute: chalk.hex("#C50000"),
|
|
245
|
+
variable: chalk.hex("#001080"),
|
|
246
|
+
bullet: chalk.hex("#795E26"),
|
|
247
|
+
code: chalk.hex("#A31515"),
|
|
248
|
+
emphasis: chalk.italic,
|
|
249
|
+
strong: chalk.bold,
|
|
250
|
+
formula: chalk.hex("#AF00DB"),
|
|
251
|
+
link: chalk.hex("#267F99"),
|
|
252
|
+
quote: chalk.hex("#008000"),
|
|
253
|
+
addition: chalk.hex("#098658"),
|
|
254
|
+
deletion: chalk.hex("#A31515"),
|
|
255
|
+
"selector-tag": chalk.hex("#800000"),
|
|
256
|
+
"selector-id": chalk.hex("#800000"),
|
|
257
|
+
"selector-class": chalk.hex("#800000"),
|
|
258
|
+
"selector-attr": chalk.hex("#800000"),
|
|
259
|
+
"selector-pseudo": chalk.hex("#800000"),
|
|
260
|
+
"template-tag": chalk.hex("#AF00DB"),
|
|
261
|
+
"template-variable": chalk.hex("#001080"),
|
|
262
|
+
default: fallback
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
keyword: chalk.hex("#C586C0"),
|
|
266
|
+
built_in: chalk.hex("#4EC9B0"),
|
|
267
|
+
type: chalk.hex("#4EC9B0"),
|
|
268
|
+
literal: chalk.hex("#569CD6"),
|
|
269
|
+
number: chalk.hex("#B5CEA8"),
|
|
270
|
+
string: chalk.hex("#7DD3FC"),
|
|
271
|
+
regexp: chalk.hex("#D16969"),
|
|
272
|
+
symbol: chalk.hex("#B5CEA8"),
|
|
273
|
+
class: chalk.hex("#4EC9B0"),
|
|
274
|
+
function: chalk.hex("#DCDCAA"),
|
|
275
|
+
title: chalk.hex("#DCDCAA"),
|
|
276
|
+
params: chalk.hex("#9CDCFE"),
|
|
277
|
+
comment: chalk.hex("#6A9955"),
|
|
278
|
+
doctag: chalk.hex("#608B4E"),
|
|
279
|
+
meta: chalk.hex("#9CDCFE"),
|
|
280
|
+
"meta-keyword": chalk.hex("#C586C0"),
|
|
281
|
+
"meta-string": chalk.hex("#7DD3FC"),
|
|
282
|
+
section: chalk.hex("#DCDCAA"),
|
|
283
|
+
tag: chalk.hex("#569CD6"),
|
|
284
|
+
name: chalk.hex("#9CDCFE"),
|
|
285
|
+
attr: chalk.hex("#9CDCFE"),
|
|
286
|
+
attribute: chalk.hex("#9CDCFE"),
|
|
287
|
+
variable: chalk.hex("#9CDCFE"),
|
|
288
|
+
bullet: chalk.hex("#D7BA7D"),
|
|
289
|
+
code: chalk.hex("#93C5FD"),
|
|
290
|
+
emphasis: chalk.italic,
|
|
291
|
+
strong: chalk.bold,
|
|
292
|
+
formula: chalk.hex("#C586C0"),
|
|
293
|
+
link: chalk.hex("#4EC9B0"),
|
|
294
|
+
quote: chalk.hex("#6A9955"),
|
|
295
|
+
addition: chalk.hex("#B5CEA8"),
|
|
296
|
+
deletion: chalk.hex("#F44747"),
|
|
297
|
+
"selector-tag": chalk.hex("#D7BA7D"),
|
|
298
|
+
"selector-id": chalk.hex("#D7BA7D"),
|
|
299
|
+
"selector-class": chalk.hex("#D7BA7D"),
|
|
300
|
+
"selector-attr": chalk.hex("#D7BA7D"),
|
|
301
|
+
"selector-pseudo": chalk.hex("#D7BA7D"),
|
|
302
|
+
"template-tag": chalk.hex("#C586C0"),
|
|
303
|
+
"template-variable": chalk.hex("#9CDCFE"),
|
|
304
|
+
default: fallback
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/tui/theme/theme.ts
|
|
309
|
+
const DARK_TEXT = "#E8E3D5";
|
|
310
|
+
const LIGHT_TEXT = "#1E1E1E";
|
|
311
|
+
const XTERM_LEVELS = [
|
|
312
|
+
0,
|
|
313
|
+
95,
|
|
314
|
+
135,
|
|
315
|
+
175,
|
|
316
|
+
215,
|
|
317
|
+
255
|
|
318
|
+
];
|
|
319
|
+
function channelToSrgb(value) {
|
|
320
|
+
const normalized = value / 255;
|
|
321
|
+
return normalized <= .03928 ? normalized / 12.92 : ((normalized + .055) / 1.055) ** 2.4;
|
|
322
|
+
}
|
|
323
|
+
function relativeLuminanceRgb(r, g, b) {
|
|
324
|
+
const red = channelToSrgb(r);
|
|
325
|
+
const green = channelToSrgb(g);
|
|
326
|
+
const blue = channelToSrgb(b);
|
|
327
|
+
return .2126 * red + .7152 * green + .0722 * blue;
|
|
328
|
+
}
|
|
329
|
+
function relativeLuminanceHex(hex) {
|
|
330
|
+
return relativeLuminanceRgb(Number.parseInt(hex.slice(1, 3), 16), Number.parseInt(hex.slice(3, 5), 16), Number.parseInt(hex.slice(5, 7), 16));
|
|
331
|
+
}
|
|
332
|
+
function contrastRatio(background, foregroundHex) {
|
|
333
|
+
const foreground = relativeLuminanceHex(foregroundHex);
|
|
334
|
+
const lighter = Math.max(background, foreground);
|
|
335
|
+
const darker = Math.min(background, foreground);
|
|
336
|
+
return (lighter + .05) / (darker + .05);
|
|
337
|
+
}
|
|
338
|
+
function pickHigherContrastText(r, g, b) {
|
|
339
|
+
const background = relativeLuminanceRgb(r, g, b);
|
|
340
|
+
return contrastRatio(background, LIGHT_TEXT) >= contrastRatio(background, DARK_TEXT);
|
|
341
|
+
}
|
|
342
|
+
function isLightBackground() {
|
|
343
|
+
const explicit = process.env.VORA_THEME?.toLowerCase();
|
|
344
|
+
if (explicit === "light") return true;
|
|
345
|
+
if (explicit === "dark") return false;
|
|
346
|
+
const colorfgbg = process.env.COLORFGBG;
|
|
347
|
+
if (colorfgbg && colorfgbg.length <= 64) {
|
|
348
|
+
const sep = colorfgbg.lastIndexOf(";");
|
|
349
|
+
const bg = Number.parseInt(sep >= 0 ? colorfgbg.slice(sep + 1) : colorfgbg, 10);
|
|
350
|
+
if (bg >= 0 && bg <= 255) {
|
|
351
|
+
if (bg <= 15) return bg === 7 || bg === 15;
|
|
352
|
+
if (bg >= 232) return bg >= 244;
|
|
353
|
+
const cubeIndex = bg - 16;
|
|
354
|
+
const bVal = XTERM_LEVELS[cubeIndex % 6];
|
|
355
|
+
const gVal = XTERM_LEVELS[Math.floor(cubeIndex / 6) % 6];
|
|
356
|
+
const rVal = XTERM_LEVELS[Math.floor(cubeIndex / 36)];
|
|
357
|
+
return pickHigherContrastText(rVal, gVal, bVal);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
/** Whether the terminal has a light background. Exported for testing only. */
|
|
363
|
+
const lightMode = isLightBackground();
|
|
364
|
+
const palette = lightMode ? {
|
|
365
|
+
text: "#1E1E1E",
|
|
366
|
+
dim: "#5B6472",
|
|
367
|
+
accent: "#0369A1",
|
|
368
|
+
accentSoft: "#075985",
|
|
369
|
+
border: "#5B6472",
|
|
370
|
+
userBg: "#F3F0E8",
|
|
371
|
+
userText: "#1E1E1E",
|
|
372
|
+
systemText: "#4B5563",
|
|
373
|
+
toolPendingBg: "#EFF6FF",
|
|
374
|
+
toolSuccessBg: "#ECFDF5",
|
|
375
|
+
toolErrorBg: "#FEF2F2",
|
|
376
|
+
toolTitle: "#0369A1",
|
|
377
|
+
toolOutput: "#374151",
|
|
378
|
+
quote: "#1D4ED8",
|
|
379
|
+
quoteBorder: "#2563EB",
|
|
380
|
+
code: "#1D4ED8",
|
|
381
|
+
codeBlock: "#F9FAFB",
|
|
382
|
+
codeBorder: "#1E40AF",
|
|
383
|
+
link: "#047857",
|
|
384
|
+
error: "#DC2626",
|
|
385
|
+
success: "#047857"
|
|
386
|
+
} : {
|
|
387
|
+
text: "#E8E3D5",
|
|
388
|
+
dim: "#7B7F87",
|
|
389
|
+
accent: "#38BDF8",
|
|
390
|
+
accentSoft: "#7DD3FC",
|
|
391
|
+
border: "#3C414B",
|
|
392
|
+
userBg: "#2B2F36",
|
|
393
|
+
userText: "#F3EEE0",
|
|
394
|
+
systemText: "#9BA3B2",
|
|
395
|
+
toolPendingBg: "#1F2A2F",
|
|
396
|
+
toolSuccessBg: "#1E2D23",
|
|
397
|
+
toolErrorBg: "#2F1F1F",
|
|
398
|
+
toolTitle: "#38BDF8",
|
|
399
|
+
toolOutput: "#E1DACB",
|
|
400
|
+
quote: "#8CC8FF",
|
|
401
|
+
quoteBorder: "#3B4D6B",
|
|
402
|
+
code: "#93C5FD",
|
|
403
|
+
codeBlock: "#1E232A",
|
|
404
|
+
codeBorder: "#2A4B6A",
|
|
405
|
+
link: "#7DD3A5",
|
|
406
|
+
error: "#F97066",
|
|
407
|
+
success: "#7DD3A5"
|
|
408
|
+
};
|
|
409
|
+
const fg = (hex) => (text) => chalk.hex(hex)(text);
|
|
410
|
+
const bg = (hex) => (text) => chalk.bgHex(hex)(text);
|
|
411
|
+
const syntaxTheme = createSyntaxTheme(fg(palette.code), lightMode);
|
|
412
|
+
/**
|
|
413
|
+
* Highlight code with syntax coloring.
|
|
414
|
+
* Returns an array of lines with ANSI escape codes.
|
|
415
|
+
*/
|
|
416
|
+
function highlightCode(code, lang) {
|
|
417
|
+
try {
|
|
418
|
+
return highlight(code, {
|
|
419
|
+
language: lang && supportsLanguage(lang) ? lang : void 0,
|
|
420
|
+
theme: syntaxTheme,
|
|
421
|
+
ignoreIllegals: true
|
|
422
|
+
}).split("\n");
|
|
423
|
+
} catch {
|
|
424
|
+
return code.split("\n").map((line) => fg(palette.code)(line));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const theme = {
|
|
428
|
+
fg: fg(palette.text),
|
|
429
|
+
assistantText: (text) => text,
|
|
430
|
+
dim: fg(palette.dim),
|
|
431
|
+
accent: fg(palette.accent),
|
|
432
|
+
accentSoft: fg(palette.accentSoft),
|
|
433
|
+
success: fg(palette.success),
|
|
434
|
+
error: fg(palette.error),
|
|
435
|
+
header: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
436
|
+
system: fg(palette.systemText),
|
|
437
|
+
userBg: bg(palette.userBg),
|
|
438
|
+
userText: fg(palette.userText),
|
|
439
|
+
toolTitle: fg(palette.toolTitle),
|
|
440
|
+
toolOutput: fg(palette.toolOutput),
|
|
441
|
+
toolPendingBg: bg(palette.toolPendingBg),
|
|
442
|
+
toolSuccessBg: bg(palette.toolSuccessBg),
|
|
443
|
+
toolErrorBg: bg(palette.toolErrorBg),
|
|
444
|
+
border: fg(palette.border),
|
|
445
|
+
bold: (text) => chalk.bold(text),
|
|
446
|
+
italic: (text) => chalk.italic(text)
|
|
447
|
+
};
|
|
448
|
+
const markdownTheme = {
|
|
449
|
+
heading: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
450
|
+
link: (text) => fg(palette.link)(text),
|
|
451
|
+
linkUrl: (text) => chalk.dim(text),
|
|
452
|
+
code: (text) => fg(palette.code)(text),
|
|
453
|
+
codeBlock: (text) => fg(palette.code)(text),
|
|
454
|
+
codeBlockBorder: (text) => fg(palette.codeBorder)(text),
|
|
455
|
+
quote: (text) => fg(palette.quote)(text),
|
|
456
|
+
quoteBorder: (text) => fg(palette.quoteBorder)(text),
|
|
457
|
+
hr: (text) => fg(palette.border)(text),
|
|
458
|
+
listBullet: (text) => fg(palette.accentSoft)(text),
|
|
459
|
+
bold: (text) => chalk.bold(text),
|
|
460
|
+
italic: (text) => chalk.italic(text),
|
|
461
|
+
strikethrough: (text) => chalk.strikethrough(text),
|
|
462
|
+
underline: (text) => chalk.underline(text),
|
|
463
|
+
highlightCode
|
|
464
|
+
};
|
|
465
|
+
const baseSelectListTheme = {
|
|
466
|
+
selectedPrefix: (text) => fg(palette.accent)(text),
|
|
467
|
+
selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
468
|
+
description: (text) => fg(palette.dim)(text),
|
|
469
|
+
scrollInfo: (text) => fg(palette.dim)(text),
|
|
470
|
+
noMatch: (text) => fg(palette.dim)(text)
|
|
471
|
+
};
|
|
472
|
+
const selectListTheme = baseSelectListTheme;
|
|
473
|
+
const filterableSelectListTheme = {
|
|
474
|
+
...baseSelectListTheme,
|
|
475
|
+
filterLabel: (text) => fg(palette.dim)(text)
|
|
476
|
+
};
|
|
477
|
+
const settingsListTheme = {
|
|
478
|
+
label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
|
|
479
|
+
value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
|
|
480
|
+
description: (text) => fg(palette.systemText)(text),
|
|
481
|
+
cursor: fg(palette.accent)("→ "),
|
|
482
|
+
hint: (text) => fg(palette.dim)(text)
|
|
483
|
+
};
|
|
484
|
+
const editorTheme = {
|
|
485
|
+
borderColor: (text) => fg(palette.border)(text),
|
|
486
|
+
selectList: selectListTheme
|
|
487
|
+
};
|
|
488
|
+
const searchableSelectListTheme = {
|
|
489
|
+
...baseSelectListTheme,
|
|
490
|
+
searchPrompt: (text) => fg(palette.accentSoft)(text),
|
|
491
|
+
searchInput: (text) => fg(palette.text)(text),
|
|
492
|
+
matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
|
|
493
|
+
};
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region src/tui/osc8-hyperlinks.ts
|
|
496
|
+
const SGR_PATTERN = "\\x1b\\[[0-9;]*m";
|
|
497
|
+
const OSC8_PATTERN = "\\x1b\\]8;;.*?(?:\\x07|\\x1b\\\\)";
|
|
498
|
+
const ANSI_RE = new RegExp(`${SGR_PATTERN}|${OSC8_PATTERN}`, "g");
|
|
499
|
+
const SGR_START_RE = new RegExp(`^${SGR_PATTERN}`);
|
|
500
|
+
const OSC8_START_RE = new RegExp(`^${OSC8_PATTERN}`);
|
|
501
|
+
/**
|
|
502
|
+
* Extract all unique URLs from raw markdown text.
|
|
503
|
+
* Finds both bare URLs and markdown link hrefs [text](url).
|
|
504
|
+
*/
|
|
505
|
+
function extractUrls(markdown) {
|
|
506
|
+
const urls = /* @__PURE__ */ new Set();
|
|
507
|
+
const mdLinkRe = /\[(?:[^\]]*)\]\(\s*<?(https?:\/\/[^)\s>]+)>?(?:\s+["'][^"']*["'])?\s*\)/g;
|
|
508
|
+
let m;
|
|
509
|
+
while ((m = mdLinkRe.exec(markdown)) !== null) urls.add(m[1]);
|
|
510
|
+
const stripped = markdown.replace(/\[(?:[^\]]*)\]\(\s*<?https?:\/\/[^)\s>]+>?(?:\s+["'][^"']*["'])?\s*\)/g, "");
|
|
511
|
+
const bareRe = /https?:\/\/[^\s)\]>]+/g;
|
|
512
|
+
while ((m = bareRe.exec(stripped)) !== null) urls.add(m[0]);
|
|
513
|
+
return [...urls];
|
|
514
|
+
}
|
|
515
|
+
/** Strip ANSI SGR and OSC 8 sequences to get visible text. */
|
|
516
|
+
function stripAnsi(input) {
|
|
517
|
+
return input.replace(ANSI_RE, "");
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Find URL ranges in a line's visible text, handling cross-line URL splits.
|
|
521
|
+
*/
|
|
522
|
+
function findUrlRanges(visibleText, knownUrls, pending) {
|
|
523
|
+
const ranges = [];
|
|
524
|
+
let newPending = null;
|
|
525
|
+
let searchFrom = 0;
|
|
526
|
+
if (pending) {
|
|
527
|
+
const remaining = pending.url.slice(pending.consumed);
|
|
528
|
+
const trimmed = visibleText.trimStart();
|
|
529
|
+
const leadingSpaces = visibleText.length - trimmed.length;
|
|
530
|
+
let matchLen = 0;
|
|
531
|
+
for (let j = 0; j < remaining.length && j < trimmed.length; j++) if (remaining[j] === trimmed[j]) matchLen++;
|
|
532
|
+
else break;
|
|
533
|
+
if (matchLen > 0) {
|
|
534
|
+
ranges.push({
|
|
535
|
+
start: leadingSpaces,
|
|
536
|
+
end: leadingSpaces + matchLen,
|
|
537
|
+
url: pending.url
|
|
538
|
+
});
|
|
539
|
+
searchFrom = leadingSpaces + matchLen;
|
|
540
|
+
if (pending.consumed + matchLen < pending.url.length) newPending = {
|
|
541
|
+
url: pending.url,
|
|
542
|
+
consumed: pending.consumed + matchLen
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
const urlRe = /https?:\/\/[^\s)\]>]+/g;
|
|
547
|
+
urlRe.lastIndex = searchFrom;
|
|
548
|
+
let match;
|
|
549
|
+
while ((match = urlRe.exec(visibleText)) !== null) {
|
|
550
|
+
const fragment = match[0];
|
|
551
|
+
const start = match.index;
|
|
552
|
+
let resolvedUrl = fragment;
|
|
553
|
+
let found = false;
|
|
554
|
+
for (const known of knownUrls) if (known === fragment) {
|
|
555
|
+
resolvedUrl = known;
|
|
556
|
+
found = true;
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
if (!found) {
|
|
560
|
+
let bestLen = 0;
|
|
561
|
+
for (const known of knownUrls) if (known.startsWith(fragment) && known.length > bestLen) {
|
|
562
|
+
resolvedUrl = known;
|
|
563
|
+
bestLen = known.length;
|
|
564
|
+
found = true;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
if (!found) {
|
|
568
|
+
let bestLen = 0;
|
|
569
|
+
for (const known of knownUrls) if (fragment.startsWith(known) && known.length > bestLen) {
|
|
570
|
+
resolvedUrl = known;
|
|
571
|
+
bestLen = known.length;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
ranges.push({
|
|
575
|
+
start,
|
|
576
|
+
end: start + fragment.length,
|
|
577
|
+
url: resolvedUrl
|
|
578
|
+
});
|
|
579
|
+
if (resolvedUrl.length > fragment.length && resolvedUrl.startsWith(fragment)) newPending = {
|
|
580
|
+
url: resolvedUrl,
|
|
581
|
+
consumed: fragment.length
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
return {
|
|
585
|
+
ranges,
|
|
586
|
+
pending: newPending
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Apply OSC 8 hyperlink sequences to a line based on visible-text URL ranges.
|
|
591
|
+
* Walks through the raw string character by character, inserting OSC 8
|
|
592
|
+
* open/close sequences at URL range boundaries while preserving ANSI codes.
|
|
593
|
+
*/
|
|
594
|
+
function applyOsc8Ranges(line, ranges) {
|
|
595
|
+
if (ranges.length === 0) return line;
|
|
596
|
+
const urlAt = /* @__PURE__ */ new Map();
|
|
597
|
+
for (const r of ranges) for (let p = r.start; p < r.end; p++) urlAt.set(p, r.url);
|
|
598
|
+
let result = "";
|
|
599
|
+
let visiblePos = 0;
|
|
600
|
+
let activeUrl = null;
|
|
601
|
+
let i = 0;
|
|
602
|
+
while (i < line.length) {
|
|
603
|
+
if (line.charCodeAt(i) === 27) {
|
|
604
|
+
const sgr = line.slice(i).match(SGR_START_RE);
|
|
605
|
+
if (sgr) {
|
|
606
|
+
result += sgr[0];
|
|
607
|
+
i += sgr[0].length;
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
const osc = line.slice(i).match(OSC8_START_RE);
|
|
611
|
+
if (osc) {
|
|
612
|
+
result += osc[0];
|
|
613
|
+
i += osc[0].length;
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const targetUrl = urlAt.get(visiblePos) ?? null;
|
|
618
|
+
if (targetUrl !== activeUrl) {
|
|
619
|
+
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
620
|
+
if (targetUrl !== null) result += `\x1b]8;;${targetUrl}\x07`;
|
|
621
|
+
activeUrl = targetUrl;
|
|
622
|
+
}
|
|
623
|
+
result += line[i];
|
|
624
|
+
visiblePos++;
|
|
625
|
+
i++;
|
|
626
|
+
}
|
|
627
|
+
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
628
|
+
return result;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Add OSC 8 hyperlinks to rendered lines using a pre-extracted URL list.
|
|
632
|
+
*
|
|
633
|
+
* For each line, finds URL-like substrings in the visible text, matches them
|
|
634
|
+
* against known URLs, and wraps each fragment with OSC 8 escape sequences.
|
|
635
|
+
* Handles URLs broken across multiple lines by pi-tui's word wrapping.
|
|
636
|
+
*/
|
|
637
|
+
function addOsc8Hyperlinks(lines, urls) {
|
|
638
|
+
if (urls.length === 0) return lines;
|
|
639
|
+
let pending = null;
|
|
640
|
+
return lines.map((line) => {
|
|
641
|
+
const result = findUrlRanges(stripAnsi(line), urls, pending);
|
|
642
|
+
pending = result.pending;
|
|
643
|
+
return applyOsc8Ranges(line, result.ranges);
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/tui/components/hyperlink-markdown.ts
|
|
648
|
+
/**
|
|
649
|
+
* Wrapper around pi-tui's Markdown component that adds OSC 8 terminal
|
|
650
|
+
* hyperlinks to rendered output, making URLs clickable even when broken
|
|
651
|
+
* across multiple lines by word wrapping.
|
|
652
|
+
*/
|
|
653
|
+
var HyperlinkMarkdown = class {
|
|
654
|
+
constructor(text, paddingX, paddingY, theme, options) {
|
|
655
|
+
this.inner = new Markdown(text, paddingX, paddingY, theme, options);
|
|
656
|
+
this.urls = extractUrls(text);
|
|
657
|
+
}
|
|
658
|
+
render(width) {
|
|
659
|
+
return addOsc8Hyperlinks(this.inner.render(width), this.urls);
|
|
660
|
+
}
|
|
661
|
+
setText(text) {
|
|
662
|
+
this.inner.setText(text);
|
|
663
|
+
this.urls = extractUrls(text);
|
|
664
|
+
}
|
|
665
|
+
invalidate() {
|
|
666
|
+
this.inner.invalidate();
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
//#endregion
|
|
670
|
+
//#region src/tui/components/assistant-message.ts
|
|
671
|
+
var AssistantMessageComponent = class extends Container {
|
|
672
|
+
constructor(text) {
|
|
673
|
+
super();
|
|
674
|
+
this.body = new HyperlinkMarkdown(text, 1, 0, markdownTheme, { color: (line) => theme.assistantText(line) });
|
|
675
|
+
this.addChild(new Spacer(1));
|
|
676
|
+
this.addChild(this.body);
|
|
677
|
+
}
|
|
678
|
+
setText(text) {
|
|
679
|
+
this.body.setText(text);
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/tui/components/btw-inline-message.ts
|
|
684
|
+
var BtwInlineMessage = class extends Container {
|
|
685
|
+
constructor(params) {
|
|
686
|
+
super();
|
|
687
|
+
this.setResult(params);
|
|
688
|
+
}
|
|
689
|
+
setResult(params) {
|
|
690
|
+
this.clear();
|
|
691
|
+
this.addChild(new Spacer(1));
|
|
692
|
+
this.addChild(new Text(theme.header(`BTW: ${params.question}`), 1, 0));
|
|
693
|
+
if (params.isError) this.addChild(new Text(theme.error(params.text), 1, 0));
|
|
694
|
+
else this.addChild(new AssistantMessageComponent(params.text));
|
|
695
|
+
this.addChild(new Text(theme.dim("Press Enter or Esc to dismiss"), 1, 0));
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/tui/tui-formatters.ts
|
|
700
|
+
const REPLACEMENT_CHAR_RE = /\uFFFD/g;
|
|
701
|
+
const MAX_TOKEN_CHARS = 32;
|
|
702
|
+
const LONG_TOKEN_RE = /\S{33,}/g;
|
|
703
|
+
const LONG_TOKEN_TEST_RE = /\S{33,}/;
|
|
704
|
+
const BINARY_LINE_REPLACEMENT_THRESHOLD = 12;
|
|
705
|
+
const URL_PREFIX_RE = /^(https?:\/\/|file:\/\/)/i;
|
|
706
|
+
const WINDOWS_DRIVE_RE = /^[a-zA-Z]:[\\/]/;
|
|
707
|
+
const FILE_LIKE_RE = /^[a-zA-Z0-9._-]+$/;
|
|
708
|
+
const EDGE_PUNCTUATION_RE = /^[`"'([{<]+|[`"')\]}>.,:;!?]+$/g;
|
|
709
|
+
const TOKENISH_MIN_LENGTH = 24;
|
|
710
|
+
const RTL_SCRIPT_RE = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;
|
|
711
|
+
const BIDI_CONTROL_RE = /[\u202a-\u202e\u2066-\u2069]/;
|
|
712
|
+
const RTL_ISOLATE_START = "";
|
|
713
|
+
const RTL_ISOLATE_END = "";
|
|
714
|
+
function hasControlChars(text) {
|
|
715
|
+
for (const char of text) {
|
|
716
|
+
const code = char.charCodeAt(0);
|
|
717
|
+
if (code <= 31 && code !== 9 && code !== 10 && code !== 13 || code >= 127 && code <= 159) return true;
|
|
718
|
+
}
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
function stripControlChars(text) {
|
|
722
|
+
if (!hasControlChars(text)) return text;
|
|
723
|
+
let sanitized = "";
|
|
724
|
+
for (const char of text) {
|
|
725
|
+
const code = char.charCodeAt(0);
|
|
726
|
+
if (!(code <= 31 && code !== 9 && code !== 10 && code !== 13) && !(code >= 127 && code <= 159)) sanitized += char;
|
|
727
|
+
}
|
|
728
|
+
return sanitized;
|
|
729
|
+
}
|
|
730
|
+
function chunkToken(token, maxChars) {
|
|
731
|
+
if (token.length <= maxChars) return [token];
|
|
732
|
+
const chunks = [];
|
|
733
|
+
for (let i = 0; i < token.length; i += maxChars) chunks.push(token.slice(i, i + maxChars));
|
|
734
|
+
return chunks;
|
|
735
|
+
}
|
|
736
|
+
function isCopySensitiveToken(token) {
|
|
737
|
+
const candidate = token.replace(EDGE_PUNCTUATION_RE, "") || token;
|
|
738
|
+
if (URL_PREFIX_RE.test(token)) return true;
|
|
739
|
+
if (token.startsWith("/") || token.startsWith("~/") || token.startsWith("./") || token.startsWith("../")) return true;
|
|
740
|
+
if (WINDOWS_DRIVE_RE.test(token) || token.startsWith("\\\\")) return true;
|
|
741
|
+
if (token.includes("/") || token.includes("\\")) return true;
|
|
742
|
+
if (token.includes("_") && FILE_LIKE_RE.test(token)) return true;
|
|
743
|
+
if (candidate.length >= TOKENISH_MIN_LENGTH && /[a-z]/i.test(candidate) && /\d/.test(candidate)) return true;
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
function normalizeLongTokenForDisplay(token) {
|
|
747
|
+
if (isCopySensitiveToken(token)) return token;
|
|
748
|
+
return chunkToken(token, MAX_TOKEN_CHARS).join(" ");
|
|
749
|
+
}
|
|
750
|
+
function redactBinaryLikeLine(line) {
|
|
751
|
+
const replacementCount = (line.match(REPLACEMENT_CHAR_RE) || []).length;
|
|
752
|
+
if (replacementCount >= BINARY_LINE_REPLACEMENT_THRESHOLD && replacementCount * 2 >= line.length) return "[binary data omitted]";
|
|
753
|
+
return line;
|
|
754
|
+
}
|
|
755
|
+
function isolateRtlLine(line) {
|
|
756
|
+
if (!RTL_SCRIPT_RE.test(line) || BIDI_CONTROL_RE.test(line)) return line;
|
|
757
|
+
return `${RTL_ISOLATE_START}${line}${RTL_ISOLATE_END}`;
|
|
758
|
+
}
|
|
759
|
+
function applyRtlIsolation(text) {
|
|
760
|
+
if (!RTL_SCRIPT_RE.test(text)) return text;
|
|
761
|
+
return text.split("\n").map((line) => isolateRtlLine(line)).join("\n");
|
|
762
|
+
}
|
|
763
|
+
function sanitizeRenderableText(text) {
|
|
764
|
+
if (!text) return text;
|
|
765
|
+
const hasAnsi = text.includes("\x1B");
|
|
766
|
+
const hasReplacementChars = text.includes("�");
|
|
767
|
+
const hasLongTokens = LONG_TOKEN_TEST_RE.test(text);
|
|
768
|
+
const hasControls = hasControlChars(text);
|
|
769
|
+
if (!hasAnsi && !hasReplacementChars && !hasLongTokens && !hasControls) return applyRtlIsolation(text);
|
|
770
|
+
const withoutAnsi = hasAnsi ? stripAnsi$1(text) : text;
|
|
771
|
+
const withoutControlChars = hasControls ? stripControlChars(withoutAnsi) : withoutAnsi;
|
|
772
|
+
const redacted = hasReplacementChars ? withoutControlChars.split("\n").map((line) => redactBinaryLikeLine(line)).join("\n") : withoutControlChars;
|
|
773
|
+
return applyRtlIsolation(LONG_TOKEN_TEST_RE.test(redacted) ? redacted.replace(LONG_TOKEN_RE, normalizeLongTokenForDisplay) : redacted);
|
|
774
|
+
}
|
|
775
|
+
function resolveFinalAssistantText(params) {
|
|
776
|
+
const finalText = params.finalText ?? "";
|
|
777
|
+
if (finalText.trim()) return finalText;
|
|
778
|
+
const streamedText = params.streamedText ?? "";
|
|
779
|
+
if (streamedText.trim()) return streamedText;
|
|
780
|
+
const errorMessage = params.errorMessage ?? "";
|
|
781
|
+
if (errorMessage.trim()) return formatRawAssistantErrorForUi(errorMessage);
|
|
782
|
+
return "(no output)";
|
|
783
|
+
}
|
|
784
|
+
function composeThinkingAndContent(params) {
|
|
785
|
+
const thinkingText = params.thinkingText?.trim() ?? "";
|
|
786
|
+
const contentText = params.contentText?.trim() ?? "";
|
|
787
|
+
const parts = [];
|
|
788
|
+
if (params.showThinking && thinkingText) parts.push(`[thinking]\n${thinkingText}`);
|
|
789
|
+
if (contentText) parts.push(contentText);
|
|
790
|
+
return parts.join("\n\n").trim();
|
|
791
|
+
}
|
|
792
|
+
function asMessageRecord(message) {
|
|
793
|
+
if (!message || typeof message !== "object") return;
|
|
794
|
+
return message;
|
|
795
|
+
}
|
|
796
|
+
function resolveMessageRecord(message) {
|
|
797
|
+
const record = asMessageRecord(message);
|
|
798
|
+
if (!record) return;
|
|
799
|
+
return {
|
|
800
|
+
record,
|
|
801
|
+
content: record.content
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function formatAssistantErrorFromRecord(record) {
|
|
805
|
+
if ((typeof record.stopReason === "string" ? record.stopReason : "") !== "error") return "";
|
|
806
|
+
return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
|
|
807
|
+
}
|
|
808
|
+
function collectSanitizedBlockStrings(params) {
|
|
809
|
+
if (!Array.isArray(params.content)) return [];
|
|
810
|
+
const parts = [];
|
|
811
|
+
for (const block of params.content) {
|
|
812
|
+
if (!block || typeof block !== "object") continue;
|
|
813
|
+
const rec = block;
|
|
814
|
+
if (rec.type === params.blockType && typeof rec[params.valueKey] === "string") parts.push(sanitizeRenderableText(rec[params.valueKey]));
|
|
815
|
+
}
|
|
816
|
+
return parts;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Extract ONLY thinking blocks from message content.
|
|
820
|
+
* Model-agnostic: returns empty string if no thinking blocks exist.
|
|
821
|
+
*/
|
|
822
|
+
function extractThinkingFromMessage(message) {
|
|
823
|
+
const resolved = resolveMessageRecord(message);
|
|
824
|
+
if (!resolved) return "";
|
|
825
|
+
const { content } = resolved;
|
|
826
|
+
if (typeof content === "string") return "";
|
|
827
|
+
return collectSanitizedBlockStrings({
|
|
828
|
+
content,
|
|
829
|
+
blockType: "thinking",
|
|
830
|
+
valueKey: "thinking"
|
|
831
|
+
}).join("\n").trim();
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Extract ONLY text content blocks from message (excludes thinking).
|
|
835
|
+
* Model-agnostic: works for any model with text content blocks.
|
|
836
|
+
*/
|
|
837
|
+
function extractContentFromMessage(message) {
|
|
838
|
+
const resolved = resolveMessageRecord(message);
|
|
839
|
+
if (!resolved) return "";
|
|
840
|
+
const { record, content } = resolved;
|
|
841
|
+
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
842
|
+
const parts = collectSanitizedBlockStrings({
|
|
843
|
+
content,
|
|
844
|
+
blockType: "text",
|
|
845
|
+
valueKey: "text"
|
|
846
|
+
});
|
|
847
|
+
if (parts.length > 0) return parts.join("\n").trim();
|
|
848
|
+
return formatAssistantErrorFromRecord(record);
|
|
849
|
+
}
|
|
850
|
+
function extractTextBlocks(content, opts) {
|
|
851
|
+
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
852
|
+
if (!Array.isArray(content)) return "";
|
|
853
|
+
const textParts = collectSanitizedBlockStrings({
|
|
854
|
+
content,
|
|
855
|
+
blockType: "text",
|
|
856
|
+
valueKey: "text"
|
|
857
|
+
});
|
|
858
|
+
return composeThinkingAndContent({
|
|
859
|
+
thinkingText: (opts?.includeThinking === true ? collectSanitizedBlockStrings({
|
|
860
|
+
content,
|
|
861
|
+
blockType: "thinking",
|
|
862
|
+
valueKey: "thinking"
|
|
863
|
+
}) : []).join("\n").trim(),
|
|
864
|
+
contentText: textParts.join("\n").trim(),
|
|
865
|
+
showThinking: opts?.includeThinking ?? false
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
function extractTextFromMessage(message, opts) {
|
|
869
|
+
const record = asMessageRecord(message);
|
|
870
|
+
if (!record) return "";
|
|
871
|
+
const text = extractTextBlocks(record.content, opts);
|
|
872
|
+
if (text) {
|
|
873
|
+
if (record.role === "user") return stripLeadingInboundMetadata(text);
|
|
874
|
+
return text;
|
|
875
|
+
}
|
|
876
|
+
const errorText = formatAssistantErrorFromRecord(record);
|
|
877
|
+
if (!errorText) return "";
|
|
878
|
+
return errorText;
|
|
879
|
+
}
|
|
880
|
+
function isCommandMessage(message) {
|
|
881
|
+
if (!message || typeof message !== "object") return false;
|
|
882
|
+
return message.command === true;
|
|
883
|
+
}
|
|
884
|
+
function formatTokens(total, context) {
|
|
885
|
+
if (total == null && context == null) return "tokens ?";
|
|
886
|
+
const totalLabel = total == null ? "?" : formatTokenCount(total);
|
|
887
|
+
if (context == null) return `tokens ${totalLabel}`;
|
|
888
|
+
const pct = typeof total === "number" && context > 0 ? Math.min(999, Math.round(total / context * 100)) : null;
|
|
889
|
+
return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
|
|
890
|
+
}
|
|
891
|
+
function formatContextUsageLine(params) {
|
|
892
|
+
const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
|
|
893
|
+
const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
|
|
894
|
+
const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
|
|
895
|
+
const extra = [typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null, pct !== null ? `${pct}%` : null].filter(Boolean).join(", ");
|
|
896
|
+
return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
|
|
897
|
+
}
|
|
898
|
+
function asString(value, fallback = "") {
|
|
899
|
+
if (typeof value === "string") return value;
|
|
900
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
901
|
+
return fallback;
|
|
902
|
+
}
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region src/tui/components/tool-execution.ts
|
|
905
|
+
const PREVIEW_LINES = 12;
|
|
906
|
+
function formatArgs(toolName, args) {
|
|
907
|
+
const detail = formatToolDetail(resolveToolDisplay({
|
|
908
|
+
name: toolName,
|
|
909
|
+
args
|
|
910
|
+
}));
|
|
911
|
+
if (detail) return sanitizeRenderableText(detail);
|
|
912
|
+
if (!args || typeof args !== "object") return "";
|
|
913
|
+
try {
|
|
914
|
+
return sanitizeRenderableText(JSON.stringify(args));
|
|
915
|
+
} catch {
|
|
916
|
+
return "";
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function extractText(result) {
|
|
920
|
+
if (!result?.content) return "";
|
|
921
|
+
const lines = [];
|
|
922
|
+
for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(sanitizeRenderableText(entry.text));
|
|
923
|
+
else if (entry.type === "image") {
|
|
924
|
+
const mime = entry.mimeType ?? "image";
|
|
925
|
+
const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
|
|
926
|
+
const omitted = entry.omitted ? " (omitted)" : "";
|
|
927
|
+
lines.push(`[${mime}${size}${omitted}]`);
|
|
928
|
+
}
|
|
929
|
+
return lines.join("\n").trim();
|
|
930
|
+
}
|
|
931
|
+
var ToolExecutionComponent = class extends Container {
|
|
932
|
+
constructor(toolName, args) {
|
|
933
|
+
super();
|
|
934
|
+
this.expanded = false;
|
|
935
|
+
this.isError = false;
|
|
936
|
+
this.isPartial = true;
|
|
937
|
+
this.toolName = toolName;
|
|
938
|
+
this.args = args;
|
|
939
|
+
this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
|
|
940
|
+
this.header = new Text("", 0, 0);
|
|
941
|
+
this.argsLine = new Text("", 0, 0);
|
|
942
|
+
this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
|
|
943
|
+
this.addChild(new Spacer(1));
|
|
944
|
+
this.addChild(this.box);
|
|
945
|
+
this.box.addChild(this.header);
|
|
946
|
+
this.box.addChild(this.argsLine);
|
|
947
|
+
this.box.addChild(this.output);
|
|
948
|
+
this.refresh();
|
|
949
|
+
}
|
|
950
|
+
setArgs(args) {
|
|
951
|
+
this.args = args;
|
|
952
|
+
this.refresh();
|
|
953
|
+
}
|
|
954
|
+
setExpanded(expanded) {
|
|
955
|
+
this.expanded = expanded;
|
|
956
|
+
this.refresh();
|
|
957
|
+
}
|
|
958
|
+
setResult(result, opts) {
|
|
959
|
+
this.result = result;
|
|
960
|
+
this.isPartial = false;
|
|
961
|
+
this.isError = Boolean(opts?.isError);
|
|
962
|
+
this.refresh();
|
|
963
|
+
}
|
|
964
|
+
setPartialResult(result) {
|
|
965
|
+
this.result = result;
|
|
966
|
+
this.isPartial = true;
|
|
967
|
+
this.refresh();
|
|
968
|
+
}
|
|
969
|
+
refresh() {
|
|
970
|
+
const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
|
|
971
|
+
this.box.setBgFn((line) => bg(line));
|
|
972
|
+
const display = resolveToolDisplay({
|
|
973
|
+
name: this.toolName,
|
|
974
|
+
args: this.args
|
|
975
|
+
});
|
|
976
|
+
const title = `${display.emoji} ${display.label}${this.isPartial ? " (running)" : ""}`;
|
|
977
|
+
this.header.setText(theme.toolTitle(theme.bold(title)));
|
|
978
|
+
const argLine = formatArgs(this.toolName, this.args);
|
|
979
|
+
this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
|
|
980
|
+
const text = extractText(this.result) || (this.isPartial ? "…" : "");
|
|
981
|
+
if (!this.expanded && text) {
|
|
982
|
+
const lines = text.split("\n");
|
|
983
|
+
const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
|
|
984
|
+
this.output.setText(preview);
|
|
985
|
+
} else this.output.setText(text);
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region src/tui/components/markdown-message.ts
|
|
990
|
+
var MarkdownMessageComponent = class extends Container {
|
|
991
|
+
constructor(text, y, options) {
|
|
992
|
+
super();
|
|
993
|
+
this.body = new Markdown(text, 1, y, markdownTheme, options);
|
|
994
|
+
this.addChild(new Spacer(1));
|
|
995
|
+
this.addChild(this.body);
|
|
996
|
+
}
|
|
997
|
+
setText(text) {
|
|
998
|
+
this.body.setText(text);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/tui/components/user-message.ts
|
|
1003
|
+
var UserMessageComponent = class extends MarkdownMessageComponent {
|
|
1004
|
+
constructor(text) {
|
|
1005
|
+
super(text, 1, {
|
|
1006
|
+
bgColor: (line) => theme.userBg(line),
|
|
1007
|
+
color: (line) => theme.userText(line)
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
//#endregion
|
|
1012
|
+
//#region src/tui/components/chat-log.ts
|
|
1013
|
+
var ChatLog = class extends Container {
|
|
1014
|
+
constructor(maxComponents = 180) {
|
|
1015
|
+
super();
|
|
1016
|
+
this.toolById = /* @__PURE__ */ new Map();
|
|
1017
|
+
this.streamingRuns = /* @__PURE__ */ new Map();
|
|
1018
|
+
this.btwMessage = null;
|
|
1019
|
+
this.toolsExpanded = false;
|
|
1020
|
+
this.maxComponents = Math.max(20, Math.floor(maxComponents));
|
|
1021
|
+
}
|
|
1022
|
+
dropComponentReferences(component) {
|
|
1023
|
+
for (const [toolId, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(toolId);
|
|
1024
|
+
for (const [runId, message] of this.streamingRuns.entries()) if (message === component) this.streamingRuns.delete(runId);
|
|
1025
|
+
if (this.btwMessage === component) this.btwMessage = null;
|
|
1026
|
+
}
|
|
1027
|
+
pruneOverflow() {
|
|
1028
|
+
while (this.children.length > this.maxComponents) {
|
|
1029
|
+
const oldest = this.children[0];
|
|
1030
|
+
if (!oldest) return;
|
|
1031
|
+
this.removeChild(oldest);
|
|
1032
|
+
this.dropComponentReferences(oldest);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
append(component) {
|
|
1036
|
+
this.addChild(component);
|
|
1037
|
+
this.pruneOverflow();
|
|
1038
|
+
}
|
|
1039
|
+
clearAll() {
|
|
1040
|
+
this.clear();
|
|
1041
|
+
this.toolById.clear();
|
|
1042
|
+
this.streamingRuns.clear();
|
|
1043
|
+
this.btwMessage = null;
|
|
1044
|
+
}
|
|
1045
|
+
createSystemMessage(text) {
|
|
1046
|
+
const entry = new Container();
|
|
1047
|
+
entry.addChild(new Spacer(1));
|
|
1048
|
+
entry.addChild(new Text(theme.system(text), 1, 0));
|
|
1049
|
+
return entry;
|
|
1050
|
+
}
|
|
1051
|
+
addSystem(text) {
|
|
1052
|
+
this.append(this.createSystemMessage(text));
|
|
1053
|
+
}
|
|
1054
|
+
addUser(text) {
|
|
1055
|
+
this.append(new UserMessageComponent(text));
|
|
1056
|
+
}
|
|
1057
|
+
resolveRunId(runId) {
|
|
1058
|
+
return runId ?? "default";
|
|
1059
|
+
}
|
|
1060
|
+
startAssistant(text, runId) {
|
|
1061
|
+
const effectiveRunId = this.resolveRunId(runId);
|
|
1062
|
+
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1063
|
+
if (existing) {
|
|
1064
|
+
existing.setText(text);
|
|
1065
|
+
return existing;
|
|
1066
|
+
}
|
|
1067
|
+
const component = new AssistantMessageComponent(text);
|
|
1068
|
+
this.streamingRuns.set(effectiveRunId, component);
|
|
1069
|
+
this.append(component);
|
|
1070
|
+
return component;
|
|
1071
|
+
}
|
|
1072
|
+
updateAssistant(text, runId) {
|
|
1073
|
+
const effectiveRunId = this.resolveRunId(runId);
|
|
1074
|
+
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1075
|
+
if (!existing) {
|
|
1076
|
+
this.startAssistant(text, runId);
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
existing.setText(text);
|
|
1080
|
+
}
|
|
1081
|
+
finalizeAssistant(text, runId) {
|
|
1082
|
+
const effectiveRunId = this.resolveRunId(runId);
|
|
1083
|
+
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1084
|
+
if (existing) {
|
|
1085
|
+
existing.setText(text);
|
|
1086
|
+
this.streamingRuns.delete(effectiveRunId);
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
this.append(new AssistantMessageComponent(text));
|
|
1090
|
+
}
|
|
1091
|
+
dropAssistant(runId) {
|
|
1092
|
+
const effectiveRunId = this.resolveRunId(runId);
|
|
1093
|
+
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1094
|
+
if (!existing) return;
|
|
1095
|
+
this.removeChild(existing);
|
|
1096
|
+
this.streamingRuns.delete(effectiveRunId);
|
|
1097
|
+
}
|
|
1098
|
+
showBtw(params) {
|
|
1099
|
+
if (this.btwMessage) {
|
|
1100
|
+
this.btwMessage.setResult(params);
|
|
1101
|
+
if (this.children[this.children.length - 1] !== this.btwMessage) {
|
|
1102
|
+
this.removeChild(this.btwMessage);
|
|
1103
|
+
this.append(this.btwMessage);
|
|
1104
|
+
}
|
|
1105
|
+
return this.btwMessage;
|
|
1106
|
+
}
|
|
1107
|
+
const component = new BtwInlineMessage(params);
|
|
1108
|
+
this.btwMessage = component;
|
|
1109
|
+
this.append(component);
|
|
1110
|
+
return component;
|
|
1111
|
+
}
|
|
1112
|
+
dismissBtw() {
|
|
1113
|
+
if (!this.btwMessage) return;
|
|
1114
|
+
this.removeChild(this.btwMessage);
|
|
1115
|
+
this.btwMessage = null;
|
|
1116
|
+
}
|
|
1117
|
+
hasVisibleBtw() {
|
|
1118
|
+
return this.btwMessage !== null;
|
|
1119
|
+
}
|
|
1120
|
+
startTool(toolCallId, toolName, args) {
|
|
1121
|
+
const existing = this.toolById.get(toolCallId);
|
|
1122
|
+
if (existing) {
|
|
1123
|
+
existing.setArgs(args);
|
|
1124
|
+
return existing;
|
|
1125
|
+
}
|
|
1126
|
+
const component = new ToolExecutionComponent(toolName, args);
|
|
1127
|
+
component.setExpanded(this.toolsExpanded);
|
|
1128
|
+
this.toolById.set(toolCallId, component);
|
|
1129
|
+
this.append(component);
|
|
1130
|
+
return component;
|
|
1131
|
+
}
|
|
1132
|
+
updateToolArgs(toolCallId, args) {
|
|
1133
|
+
const existing = this.toolById.get(toolCallId);
|
|
1134
|
+
if (!existing) return;
|
|
1135
|
+
existing.setArgs(args);
|
|
1136
|
+
}
|
|
1137
|
+
updateToolResult(toolCallId, result, opts) {
|
|
1138
|
+
const existing = this.toolById.get(toolCallId);
|
|
1139
|
+
if (!existing) return;
|
|
1140
|
+
if (opts?.partial) {
|
|
1141
|
+
existing.setPartialResult(result);
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
existing.setResult(result, { isError: opts?.isError });
|
|
1145
|
+
}
|
|
1146
|
+
setToolsExpanded(expanded) {
|
|
1147
|
+
this.toolsExpanded = expanded;
|
|
1148
|
+
for (const tool of this.toolById.values()) tool.setExpanded(expanded);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region src/tui/components/custom-editor.ts
|
|
1153
|
+
var CustomEditor = class extends Editor {
|
|
1154
|
+
handleInput(data) {
|
|
1155
|
+
if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
|
|
1156
|
+
this.onAltEnter();
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
|
|
1160
|
+
this.onCtrlL();
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
|
|
1164
|
+
this.onCtrlO();
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
|
|
1168
|
+
this.onCtrlP();
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
|
|
1172
|
+
this.onCtrlG();
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
|
|
1176
|
+
this.onCtrlT();
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
|
|
1180
|
+
this.onShiftTab();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
|
|
1184
|
+
this.onEscape();
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
|
|
1188
|
+
this.onCtrlC();
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (matchesKey(data, Key.ctrl("d"))) {
|
|
1192
|
+
if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
super.handleInput(data);
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/tui/gateway-chat.ts
|
|
1200
|
+
function trimToUndefined(value) {
|
|
1201
|
+
if (typeof value !== "string") return;
|
|
1202
|
+
const trimmed = value.trim();
|
|
1203
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
1204
|
+
}
|
|
1205
|
+
function throwGatewayAuthResolutionError(reason) {
|
|
1206
|
+
throw new Error([
|
|
1207
|
+
reason,
|
|
1208
|
+
"Fix: set VORA_GATEWAY_TOKEN/VORA_GATEWAY_PASSWORD, pass --token/--password,",
|
|
1209
|
+
"or resolve the configured secret provider for this credential."
|
|
1210
|
+
].join("\n"));
|
|
1211
|
+
}
|
|
1212
|
+
var GatewayChatClient = class GatewayChatClient {
|
|
1213
|
+
constructor(connection) {
|
|
1214
|
+
this.connection = connection;
|
|
1215
|
+
this.readyPromise = new Promise((resolve) => {
|
|
1216
|
+
this.resolveReady = resolve;
|
|
1217
|
+
});
|
|
1218
|
+
this.client = new GatewayClient({
|
|
1219
|
+
url: connection.url,
|
|
1220
|
+
token: connection.token,
|
|
1221
|
+
password: connection.password,
|
|
1222
|
+
clientName: GATEWAY_CLIENT_NAMES.TUI,
|
|
1223
|
+
clientDisplayName: "vora-tui",
|
|
1224
|
+
clientVersion: VERSION,
|
|
1225
|
+
platform: process.platform,
|
|
1226
|
+
mode: GATEWAY_CLIENT_MODES.UI,
|
|
1227
|
+
deviceIdentity: connection.allowInsecureLocalOperatorUi ? null : void 0,
|
|
1228
|
+
caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
|
|
1229
|
+
instanceId: randomUUID(),
|
|
1230
|
+
minProtocol: 3,
|
|
1231
|
+
maxProtocol: 3,
|
|
1232
|
+
onHelloOk: (hello) => {
|
|
1233
|
+
this.hello = hello;
|
|
1234
|
+
this.resolveReady?.();
|
|
1235
|
+
this.onConnected?.();
|
|
1236
|
+
},
|
|
1237
|
+
onEvent: (evt) => {
|
|
1238
|
+
this.onEvent?.({
|
|
1239
|
+
event: evt.event,
|
|
1240
|
+
payload: evt.payload,
|
|
1241
|
+
seq: evt.seq
|
|
1242
|
+
});
|
|
1243
|
+
},
|
|
1244
|
+
onClose: (_code, reason) => {
|
|
1245
|
+
this.readyPromise = new Promise((resolve) => {
|
|
1246
|
+
this.resolveReady = resolve;
|
|
1247
|
+
});
|
|
1248
|
+
this.onDisconnected?.(reason);
|
|
1249
|
+
},
|
|
1250
|
+
onGap: (info) => {
|
|
1251
|
+
this.onGap?.(info);
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
static async connect(opts) {
|
|
1256
|
+
return new GatewayChatClient(await resolveGatewayConnection(opts));
|
|
1257
|
+
}
|
|
1258
|
+
start() {
|
|
1259
|
+
this.client.start();
|
|
1260
|
+
}
|
|
1261
|
+
stop() {
|
|
1262
|
+
this.client.stop();
|
|
1263
|
+
}
|
|
1264
|
+
async waitForReady() {
|
|
1265
|
+
await this.readyPromise;
|
|
1266
|
+
}
|
|
1267
|
+
async sendChat(opts) {
|
|
1268
|
+
const runId = opts.runId ?? randomUUID();
|
|
1269
|
+
await this.client.request("chat.send", {
|
|
1270
|
+
sessionKey: opts.sessionKey,
|
|
1271
|
+
message: opts.message,
|
|
1272
|
+
thinking: opts.thinking,
|
|
1273
|
+
deliver: opts.deliver,
|
|
1274
|
+
timeoutMs: opts.timeoutMs,
|
|
1275
|
+
idempotencyKey: runId
|
|
1276
|
+
});
|
|
1277
|
+
return { runId };
|
|
1278
|
+
}
|
|
1279
|
+
async abortChat(opts) {
|
|
1280
|
+
return await this.client.request("chat.abort", {
|
|
1281
|
+
sessionKey: opts.sessionKey,
|
|
1282
|
+
runId: opts.runId
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
async loadHistory(opts) {
|
|
1286
|
+
return await this.client.request("chat.history", {
|
|
1287
|
+
sessionKey: opts.sessionKey,
|
|
1288
|
+
limit: opts.limit
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
async listSessions(opts) {
|
|
1292
|
+
return await this.client.request("sessions.list", {
|
|
1293
|
+
limit: opts?.limit,
|
|
1294
|
+
activeMinutes: opts?.activeMinutes,
|
|
1295
|
+
includeGlobal: opts?.includeGlobal,
|
|
1296
|
+
includeUnknown: opts?.includeUnknown,
|
|
1297
|
+
includeDerivedTitles: opts?.includeDerivedTitles,
|
|
1298
|
+
includeLastMessage: opts?.includeLastMessage,
|
|
1299
|
+
agentId: opts?.agentId
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
async listAgents() {
|
|
1303
|
+
return await this.client.request("agents.list", {});
|
|
1304
|
+
}
|
|
1305
|
+
async patchSession(opts) {
|
|
1306
|
+
return await this.client.request("sessions.patch", opts);
|
|
1307
|
+
}
|
|
1308
|
+
async resetSession(key, reason) {
|
|
1309
|
+
return await this.client.request("sessions.reset", {
|
|
1310
|
+
key,
|
|
1311
|
+
...reason ? { reason } : {}
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
async getStatus() {
|
|
1315
|
+
return await this.client.request("status");
|
|
1316
|
+
}
|
|
1317
|
+
async listModels() {
|
|
1318
|
+
const res = await this.client.request("models.list");
|
|
1319
|
+
return Array.isArray(res?.models) ? res.models : [];
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
async function resolveGatewayConnection(opts) {
|
|
1323
|
+
const config = loadConfig();
|
|
1324
|
+
const env = process.env;
|
|
1325
|
+
const gatewayAuthMode = config.gateway?.auth?.mode;
|
|
1326
|
+
const isRemoteMode = config.gateway?.mode === "remote";
|
|
1327
|
+
const remote = config.gateway?.remote;
|
|
1328
|
+
const envToken = trimToUndefined(env.VORA_GATEWAY_TOKEN);
|
|
1329
|
+
const envPassword = trimToUndefined(env.VORA_GATEWAY_PASSWORD);
|
|
1330
|
+
const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
|
|
1331
|
+
const explicitAuth = resolveExplicitGatewayAuth({
|
|
1332
|
+
token: opts.token,
|
|
1333
|
+
password: opts.password
|
|
1334
|
+
});
|
|
1335
|
+
ensureExplicitGatewayAuth({
|
|
1336
|
+
urlOverride,
|
|
1337
|
+
urlOverrideSource: "cli",
|
|
1338
|
+
explicitAuth,
|
|
1339
|
+
errorHint: "Fix: pass --token or --password when using --url."
|
|
1340
|
+
});
|
|
1341
|
+
const url = buildGatewayConnectionDetails({
|
|
1342
|
+
config,
|
|
1343
|
+
...urlOverride ? { url: urlOverride } : {}
|
|
1344
|
+
}).url;
|
|
1345
|
+
const allowInsecureLocalOperatorUi = (() => {
|
|
1346
|
+
if (config.gateway?.controlUi?.allowInsecureAuth !== true) return false;
|
|
1347
|
+
try {
|
|
1348
|
+
return isLoopbackHost(new URL(url).hostname);
|
|
1349
|
+
} catch {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
})();
|
|
1353
|
+
if (urlOverride) return {
|
|
1354
|
+
url,
|
|
1355
|
+
token: explicitAuth.token,
|
|
1356
|
+
password: explicitAuth.password,
|
|
1357
|
+
allowInsecureLocalOperatorUi
|
|
1358
|
+
};
|
|
1359
|
+
if (isRemoteMode) {
|
|
1360
|
+
const remoteToken = explicitAuth.token ? { value: explicitAuth.token } : await resolveConfiguredSecretInputString({
|
|
1361
|
+
value: remote?.token,
|
|
1362
|
+
path: "gateway.remote.token",
|
|
1363
|
+
env,
|
|
1364
|
+
config
|
|
1365
|
+
});
|
|
1366
|
+
const remotePassword = explicitAuth.password || envPassword ? { value: explicitAuth.password ?? envPassword } : await resolveConfiguredSecretInputString({
|
|
1367
|
+
value: remote?.password,
|
|
1368
|
+
path: "gateway.remote.password",
|
|
1369
|
+
env,
|
|
1370
|
+
config
|
|
1371
|
+
});
|
|
1372
|
+
const token = explicitAuth.token ?? remoteToken.value;
|
|
1373
|
+
const password = explicitAuth.password ?? envPassword ?? remotePassword.value;
|
|
1374
|
+
if (!token && !password) throwGatewayAuthResolutionError(remoteToken.unresolvedRefReason ?? remotePassword.unresolvedRefReason ?? "Missing gateway auth credentials.");
|
|
1375
|
+
return {
|
|
1376
|
+
url,
|
|
1377
|
+
token,
|
|
1378
|
+
password,
|
|
1379
|
+
allowInsecureLocalOperatorUi: false
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
if (gatewayAuthMode === "none" || gatewayAuthMode === "trusted-proxy") return {
|
|
1383
|
+
url,
|
|
1384
|
+
token: explicitAuth.token ?? envToken,
|
|
1385
|
+
password: explicitAuth.password ?? envPassword,
|
|
1386
|
+
allowInsecureLocalOperatorUi
|
|
1387
|
+
};
|
|
1388
|
+
try {
|
|
1389
|
+
assertExplicitGatewayAuthModeWhenBothConfigured(config);
|
|
1390
|
+
} catch (err) {
|
|
1391
|
+
throwGatewayAuthResolutionError(err instanceof Error ? err.message : String(err));
|
|
1392
|
+
}
|
|
1393
|
+
const defaults = config.secrets?.defaults;
|
|
1394
|
+
const hasConfiguredToken = hasConfiguredSecretInput(config.gateway?.auth?.token, defaults);
|
|
1395
|
+
const hasConfiguredPassword = hasConfiguredSecretInput(config.gateway?.auth?.password, defaults);
|
|
1396
|
+
if (gatewayAuthMode === "password") {
|
|
1397
|
+
const localPassword = explicitAuth.password || envPassword ? { value: explicitAuth.password ?? envPassword } : await resolveConfiguredSecretInputString({
|
|
1398
|
+
value: config.gateway?.auth?.password,
|
|
1399
|
+
path: "gateway.auth.password",
|
|
1400
|
+
env,
|
|
1401
|
+
config
|
|
1402
|
+
});
|
|
1403
|
+
const password = explicitAuth.password ?? envPassword ?? localPassword.value;
|
|
1404
|
+
if (!password) throwGatewayAuthResolutionError(localPassword.unresolvedRefReason ?? "Missing gateway auth password.");
|
|
1405
|
+
return {
|
|
1406
|
+
url,
|
|
1407
|
+
token: explicitAuth.token ?? envToken,
|
|
1408
|
+
password,
|
|
1409
|
+
allowInsecureLocalOperatorUi
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
const resolveToken = async () => {
|
|
1413
|
+
const localToken = explicitAuth.token ? { value: explicitAuth.token } : await resolveConfiguredSecretInputString({
|
|
1414
|
+
value: config.gateway?.auth?.token,
|
|
1415
|
+
path: "gateway.auth.token",
|
|
1416
|
+
env,
|
|
1417
|
+
config
|
|
1418
|
+
});
|
|
1419
|
+
const token = explicitAuth.token ?? localToken.value ?? envToken;
|
|
1420
|
+
if (!token) throwGatewayAuthResolutionError(localToken.unresolvedRefReason ?? "Missing gateway auth token.");
|
|
1421
|
+
return token;
|
|
1422
|
+
};
|
|
1423
|
+
if (gatewayAuthMode === "token") return {
|
|
1424
|
+
url,
|
|
1425
|
+
token: await resolveToken(),
|
|
1426
|
+
password: explicitAuth.password ?? envPassword,
|
|
1427
|
+
allowInsecureLocalOperatorUi
|
|
1428
|
+
};
|
|
1429
|
+
const passwordCandidate = explicitAuth.password ?? envPassword;
|
|
1430
|
+
if (Boolean(passwordCandidate) || hasConfiguredPassword && !hasConfiguredToken) {
|
|
1431
|
+
const localPassword = passwordCandidate ? { value: passwordCandidate } : await resolveConfiguredSecretInputString({
|
|
1432
|
+
value: config.gateway?.auth?.password,
|
|
1433
|
+
path: "gateway.auth.password",
|
|
1434
|
+
env,
|
|
1435
|
+
config
|
|
1436
|
+
});
|
|
1437
|
+
const password = explicitAuth.password ?? localPassword.value ?? envPassword;
|
|
1438
|
+
if (!password) throwGatewayAuthResolutionError(localPassword.unresolvedRefReason ?? "Missing gateway auth password.");
|
|
1439
|
+
return {
|
|
1440
|
+
url,
|
|
1441
|
+
token: explicitAuth.token ?? envToken,
|
|
1442
|
+
password,
|
|
1443
|
+
allowInsecureLocalOperatorUi
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
return {
|
|
1447
|
+
url,
|
|
1448
|
+
token: await resolveToken(),
|
|
1449
|
+
password: explicitAuth.password ?? envPassword,
|
|
1450
|
+
allowInsecureLocalOperatorUi
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region src/tui/components/fuzzy-filter.ts
|
|
1455
|
+
/**
|
|
1456
|
+
* Shared fuzzy filtering utilities for select list components.
|
|
1457
|
+
*/
|
|
1458
|
+
/**
|
|
1459
|
+
* Word boundary characters for matching.
|
|
1460
|
+
*/
|
|
1461
|
+
const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
|
|
1462
|
+
/**
|
|
1463
|
+
* Check if position is at a word boundary.
|
|
1464
|
+
*/
|
|
1465
|
+
function isWordBoundary(text, index) {
|
|
1466
|
+
return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Find index where query matches at a word boundary in text.
|
|
1470
|
+
* Returns null if no match.
|
|
1471
|
+
*/
|
|
1472
|
+
function findWordBoundaryIndex(text, query) {
|
|
1473
|
+
if (!query) return null;
|
|
1474
|
+
const textLower = text.toLowerCase();
|
|
1475
|
+
const queryLower = query.toLowerCase();
|
|
1476
|
+
const maxIndex = textLower.length - queryLower.length;
|
|
1477
|
+
if (maxIndex < 0) return null;
|
|
1478
|
+
for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
|
|
1479
|
+
return null;
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
|
|
1483
|
+
* Returns score (lower = better) or null if no match.
|
|
1484
|
+
*/
|
|
1485
|
+
function fuzzyMatchLower(queryLower, textLower) {
|
|
1486
|
+
if (queryLower.length === 0) return 0;
|
|
1487
|
+
if (queryLower.length > textLower.length) return null;
|
|
1488
|
+
let queryIndex = 0;
|
|
1489
|
+
let score = 0;
|
|
1490
|
+
let lastMatchIndex = -1;
|
|
1491
|
+
let consecutiveMatches = 0;
|
|
1492
|
+
for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
|
|
1493
|
+
const isAtWordBoundary = isWordBoundary(textLower, i);
|
|
1494
|
+
if (lastMatchIndex === i - 1) {
|
|
1495
|
+
consecutiveMatches++;
|
|
1496
|
+
score -= consecutiveMatches * 5;
|
|
1497
|
+
} else {
|
|
1498
|
+
consecutiveMatches = 0;
|
|
1499
|
+
if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
|
|
1500
|
+
}
|
|
1501
|
+
if (isAtWordBoundary) score -= 10;
|
|
1502
|
+
score += i * .1;
|
|
1503
|
+
lastMatchIndex = i;
|
|
1504
|
+
queryIndex++;
|
|
1505
|
+
}
|
|
1506
|
+
return queryIndex < queryLower.length ? null : score;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Filter items using pre-lowercased searchTextLower field.
|
|
1510
|
+
* Supports space-separated tokens (all must match).
|
|
1511
|
+
*/
|
|
1512
|
+
function fuzzyFilterLower(items, queryLower) {
|
|
1513
|
+
const trimmed = queryLower.trim();
|
|
1514
|
+
if (!trimmed) return items;
|
|
1515
|
+
const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
|
|
1516
|
+
if (tokens.length === 0) return items;
|
|
1517
|
+
const results = [];
|
|
1518
|
+
for (const item of items) {
|
|
1519
|
+
const text = item.searchTextLower ?? "";
|
|
1520
|
+
let totalScore = 0;
|
|
1521
|
+
let allMatch = true;
|
|
1522
|
+
for (const token of tokens) {
|
|
1523
|
+
const score = fuzzyMatchLower(token, text);
|
|
1524
|
+
if (score !== null) totalScore += score;
|
|
1525
|
+
else {
|
|
1526
|
+
allMatch = false;
|
|
1527
|
+
break;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
if (allMatch) results.push({
|
|
1531
|
+
item,
|
|
1532
|
+
score: totalScore
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
results.sort((a, b) => a.score - b.score);
|
|
1536
|
+
return results.map((r) => r.item);
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Prepare items for fuzzy filtering by pre-computing lowercase search text.
|
|
1540
|
+
*/
|
|
1541
|
+
function prepareSearchItems(items) {
|
|
1542
|
+
return items.map((item) => {
|
|
1543
|
+
const parts = [];
|
|
1544
|
+
if (item.label) parts.push(item.label);
|
|
1545
|
+
if (item.description) parts.push(item.description);
|
|
1546
|
+
if (item.searchText) parts.push(item.searchText);
|
|
1547
|
+
return {
|
|
1548
|
+
...item,
|
|
1549
|
+
searchTextLower: parts.join(" ").toLowerCase()
|
|
1550
|
+
};
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region src/tui/components/filterable-select-list.ts
|
|
1555
|
+
/**
|
|
1556
|
+
* Combines text input filtering with a select list.
|
|
1557
|
+
* User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
|
|
1558
|
+
*/
|
|
1559
|
+
var FilterableSelectList = class {
|
|
1560
|
+
constructor(items, maxVisible, theme) {
|
|
1561
|
+
this.filterText = "";
|
|
1562
|
+
this.allItems = prepareSearchItems(items);
|
|
1563
|
+
this.maxVisible = maxVisible;
|
|
1564
|
+
this.theme = theme;
|
|
1565
|
+
this.input = new Input();
|
|
1566
|
+
this.selectList = new SelectList(this.allItems, maxVisible, theme);
|
|
1567
|
+
}
|
|
1568
|
+
applyFilter() {
|
|
1569
|
+
const queryLower = this.filterText.toLowerCase();
|
|
1570
|
+
if (!queryLower.trim()) {
|
|
1571
|
+
this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
|
|
1575
|
+
}
|
|
1576
|
+
invalidate() {
|
|
1577
|
+
this.input.invalidate();
|
|
1578
|
+
this.selectList.invalidate();
|
|
1579
|
+
}
|
|
1580
|
+
render(width) {
|
|
1581
|
+
const lines = [];
|
|
1582
|
+
const filterLabel = this.theme.filterLabel("Filter: ");
|
|
1583
|
+
const inputText = this.input.render(width - 8)[0] ?? "";
|
|
1584
|
+
lines.push(filterLabel + inputText);
|
|
1585
|
+
lines.push(chalk.dim("─".repeat(Math.max(0, width))));
|
|
1586
|
+
const listLines = this.selectList.render(width);
|
|
1587
|
+
lines.push(...listLines);
|
|
1588
|
+
return lines;
|
|
1589
|
+
}
|
|
1590
|
+
handleInput(keyData) {
|
|
1591
|
+
const allowVimNav = !this.filterText.trim();
|
|
1592
|
+
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
|
|
1593
|
+
this.selectList.handleInput("\x1B[A");
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
|
|
1597
|
+
this.selectList.handleInput("\x1B[B");
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
if (matchesKey(keyData, "enter")) {
|
|
1601
|
+
const selected = this.selectList.getSelectedItem();
|
|
1602
|
+
if (selected) this.onSelect?.(selected);
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
1606
|
+
if (this.filterText) {
|
|
1607
|
+
this.filterText = "";
|
|
1608
|
+
this.input.setValue("");
|
|
1609
|
+
this.applyFilter();
|
|
1610
|
+
} else this.onCancel?.();
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
const prevValue = this.input.getValue();
|
|
1614
|
+
this.input.handleInput(keyData);
|
|
1615
|
+
const newValue = this.input.getValue();
|
|
1616
|
+
if (newValue !== prevValue) {
|
|
1617
|
+
this.filterText = newValue;
|
|
1618
|
+
this.applyFilter();
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
getSelectedItem() {
|
|
1622
|
+
return this.selectList.getSelectedItem();
|
|
1623
|
+
}
|
|
1624
|
+
getFilterText() {
|
|
1625
|
+
return this.filterText;
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
//#endregion
|
|
1629
|
+
//#region src/tui/components/searchable-select-list.ts
|
|
1630
|
+
const ANSI_SGR_REGEX = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
1631
|
+
/**
|
|
1632
|
+
* A select list with a search input at the top for fuzzy filtering.
|
|
1633
|
+
*/
|
|
1634
|
+
var SearchableSelectList = class SearchableSelectList {
|
|
1635
|
+
static {
|
|
1636
|
+
this.DESCRIPTION_LAYOUT_MIN_WIDTH = 40;
|
|
1637
|
+
}
|
|
1638
|
+
static {
|
|
1639
|
+
this.DESCRIPTION_MIN_WIDTH = 12;
|
|
1640
|
+
}
|
|
1641
|
+
static {
|
|
1642
|
+
this.DESCRIPTION_SPACING_WIDTH = 2;
|
|
1643
|
+
}
|
|
1644
|
+
static {
|
|
1645
|
+
this.RIGHT_MARGIN_WIDTH = 2;
|
|
1646
|
+
}
|
|
1647
|
+
constructor(items, maxVisible, theme) {
|
|
1648
|
+
this.selectedIndex = 0;
|
|
1649
|
+
this.regexCache = /* @__PURE__ */ new Map();
|
|
1650
|
+
this.compareByScore = (a, b) => {
|
|
1651
|
+
if (a.tier !== b.tier) return a.tier - b.tier;
|
|
1652
|
+
if (a.score !== b.score) return a.score - b.score;
|
|
1653
|
+
return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
|
|
1654
|
+
};
|
|
1655
|
+
this.items = items;
|
|
1656
|
+
this.filteredItems = items;
|
|
1657
|
+
this.maxVisible = maxVisible;
|
|
1658
|
+
this.theme = theme;
|
|
1659
|
+
this.searchInput = new Input();
|
|
1660
|
+
}
|
|
1661
|
+
getCachedRegex(pattern) {
|
|
1662
|
+
let regex = this.regexCache.get(pattern);
|
|
1663
|
+
if (!regex) {
|
|
1664
|
+
regex = new RegExp(this.escapeRegex(pattern), "gi");
|
|
1665
|
+
this.regexCache.set(pattern, regex);
|
|
1666
|
+
}
|
|
1667
|
+
return regex;
|
|
1668
|
+
}
|
|
1669
|
+
updateFilter() {
|
|
1670
|
+
const query = this.searchInput.getValue().trim();
|
|
1671
|
+
if (!query) this.filteredItems = this.items;
|
|
1672
|
+
else this.filteredItems = this.smartFilter(query);
|
|
1673
|
+
this.selectedIndex = 0;
|
|
1674
|
+
this.notifySelectionChange();
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Smart filtering that prioritizes:
|
|
1678
|
+
* 1. Exact substring match in label (highest priority)
|
|
1679
|
+
* 2. Word-boundary prefix match in label
|
|
1680
|
+
* 3. Exact substring in description
|
|
1681
|
+
* 4. Fuzzy match (lowest priority)
|
|
1682
|
+
*/
|
|
1683
|
+
smartFilter(query) {
|
|
1684
|
+
const q = query.toLowerCase();
|
|
1685
|
+
const scoredItems = [];
|
|
1686
|
+
const fuzzyCandidates = [];
|
|
1687
|
+
for (const item of this.items) {
|
|
1688
|
+
const rawLabel = this.getItemLabel(item);
|
|
1689
|
+
const rawDesc = item.description ?? "";
|
|
1690
|
+
const label = stripAnsi$1(rawLabel).toLowerCase();
|
|
1691
|
+
const desc = stripAnsi$1(rawDesc).toLowerCase();
|
|
1692
|
+
const labelIndex = label.indexOf(q);
|
|
1693
|
+
if (labelIndex !== -1) {
|
|
1694
|
+
scoredItems.push({
|
|
1695
|
+
item,
|
|
1696
|
+
tier: 0,
|
|
1697
|
+
score: labelIndex
|
|
1698
|
+
});
|
|
1699
|
+
continue;
|
|
1700
|
+
}
|
|
1701
|
+
const wordBoundaryIndex = findWordBoundaryIndex(label, q);
|
|
1702
|
+
if (wordBoundaryIndex !== null) {
|
|
1703
|
+
scoredItems.push({
|
|
1704
|
+
item,
|
|
1705
|
+
tier: 1,
|
|
1706
|
+
score: wordBoundaryIndex
|
|
1707
|
+
});
|
|
1708
|
+
continue;
|
|
1709
|
+
}
|
|
1710
|
+
const descIndex = desc.indexOf(q);
|
|
1711
|
+
if (descIndex !== -1) {
|
|
1712
|
+
scoredItems.push({
|
|
1713
|
+
item,
|
|
1714
|
+
tier: 2,
|
|
1715
|
+
score: descIndex
|
|
1716
|
+
});
|
|
1717
|
+
continue;
|
|
1718
|
+
}
|
|
1719
|
+
const searchText = item.searchText ?? "";
|
|
1720
|
+
fuzzyCandidates.push({
|
|
1721
|
+
item,
|
|
1722
|
+
searchTextLower: [
|
|
1723
|
+
rawLabel,
|
|
1724
|
+
rawDesc,
|
|
1725
|
+
searchText
|
|
1726
|
+
].map((value) => stripAnsi$1(value)).filter(Boolean).join(" ").toLowerCase()
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
scoredItems.sort(this.compareByScore);
|
|
1730
|
+
const fuzzyMatches = fuzzyFilterLower(fuzzyCandidates, q);
|
|
1731
|
+
return [...scoredItems.map((s) => s.item), ...fuzzyMatches.map((entry) => entry.item)];
|
|
1732
|
+
}
|
|
1733
|
+
escapeRegex(str) {
|
|
1734
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1735
|
+
}
|
|
1736
|
+
getItemLabel(item) {
|
|
1737
|
+
return item.label || item.value;
|
|
1738
|
+
}
|
|
1739
|
+
splitAnsiParts(text) {
|
|
1740
|
+
const parts = [];
|
|
1741
|
+
ANSI_SGR_REGEX.lastIndex = 0;
|
|
1742
|
+
let lastIndex = 0;
|
|
1743
|
+
let match;
|
|
1744
|
+
while ((match = ANSI_SGR_REGEX.exec(text)) !== null) {
|
|
1745
|
+
if (match.index > lastIndex) parts.push({
|
|
1746
|
+
text: text.slice(lastIndex, match.index),
|
|
1747
|
+
isAnsi: false
|
|
1748
|
+
});
|
|
1749
|
+
parts.push({
|
|
1750
|
+
text: match[0],
|
|
1751
|
+
isAnsi: true
|
|
1752
|
+
});
|
|
1753
|
+
lastIndex = match.index + match[0].length;
|
|
1754
|
+
}
|
|
1755
|
+
if (lastIndex < text.length) parts.push({
|
|
1756
|
+
text: text.slice(lastIndex),
|
|
1757
|
+
isAnsi: false
|
|
1758
|
+
});
|
|
1759
|
+
return parts;
|
|
1760
|
+
}
|
|
1761
|
+
highlightMatch(text, query) {
|
|
1762
|
+
const tokens = query.trim().split(/\s+/).map((token) => token.toLowerCase()).filter((token) => token.length > 0);
|
|
1763
|
+
if (tokens.length === 0) return text;
|
|
1764
|
+
const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
|
|
1765
|
+
let parts = this.splitAnsiParts(text);
|
|
1766
|
+
for (const token of uniqueTokens) {
|
|
1767
|
+
const regex = this.getCachedRegex(token);
|
|
1768
|
+
const nextParts = [];
|
|
1769
|
+
for (const part of parts) {
|
|
1770
|
+
if (part.isAnsi) {
|
|
1771
|
+
nextParts.push(part);
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
regex.lastIndex = 0;
|
|
1775
|
+
const replaced = part.text.replace(regex, (match) => this.theme.matchHighlight(match));
|
|
1776
|
+
if (replaced === part.text) {
|
|
1777
|
+
nextParts.push(part);
|
|
1778
|
+
continue;
|
|
1779
|
+
}
|
|
1780
|
+
nextParts.push(...this.splitAnsiParts(replaced));
|
|
1781
|
+
}
|
|
1782
|
+
parts = nextParts;
|
|
1783
|
+
}
|
|
1784
|
+
return parts.map((part) => part.text).join("");
|
|
1785
|
+
}
|
|
1786
|
+
setSelectedIndex(index) {
|
|
1787
|
+
this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
|
|
1788
|
+
}
|
|
1789
|
+
invalidate() {
|
|
1790
|
+
this.searchInput.invalidate();
|
|
1791
|
+
}
|
|
1792
|
+
render(width) {
|
|
1793
|
+
const lines = [];
|
|
1794
|
+
const prompt = this.theme.searchPrompt("search: ");
|
|
1795
|
+
const inputWidth = Math.max(1, width - visibleWidth(prompt));
|
|
1796
|
+
const inputText = this.searchInput.render(inputWidth)[0] ?? "";
|
|
1797
|
+
lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
|
|
1798
|
+
lines.push("");
|
|
1799
|
+
const query = this.searchInput.getValue().trim();
|
|
1800
|
+
if (this.filteredItems.length === 0) {
|
|
1801
|
+
lines.push(this.theme.noMatch(" No matches"));
|
|
1802
|
+
return lines;
|
|
1803
|
+
}
|
|
1804
|
+
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
|
|
1805
|
+
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
1806
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
1807
|
+
const item = this.filteredItems[i];
|
|
1808
|
+
if (!item) continue;
|
|
1809
|
+
const isSelected = i === this.selectedIndex;
|
|
1810
|
+
lines.push(this.renderItemLine(item, isSelected, width, query));
|
|
1811
|
+
}
|
|
1812
|
+
if (this.filteredItems.length > this.maxVisible) {
|
|
1813
|
+
const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
|
|
1814
|
+
lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
|
|
1815
|
+
}
|
|
1816
|
+
return lines;
|
|
1817
|
+
}
|
|
1818
|
+
renderItemLine(item, isSelected, width, query) {
|
|
1819
|
+
const prefix = isSelected ? "→ " : " ";
|
|
1820
|
+
const prefixWidth = prefix.length;
|
|
1821
|
+
const displayValue = this.getItemLabel(item);
|
|
1822
|
+
const description = item.description;
|
|
1823
|
+
if (description) {
|
|
1824
|
+
const descriptionLayout = this.getDescriptionLayout(width, prefixWidth);
|
|
1825
|
+
if (descriptionLayout) {
|
|
1826
|
+
const truncatedValue = truncateToWidth(displayValue, descriptionLayout.maxValueWidth, "");
|
|
1827
|
+
const valueText = this.highlightMatch(truncatedValue, query);
|
|
1828
|
+
const usedByValue = visibleWidth(valueText);
|
|
1829
|
+
const descriptionWidth = descriptionLayout.availableWidth - usedByValue - descriptionLayout.spacingWidth;
|
|
1830
|
+
if (descriptionWidth >= SearchableSelectList.DESCRIPTION_MIN_WIDTH) {
|
|
1831
|
+
const spacing = " ".repeat(descriptionLayout.spacingWidth);
|
|
1832
|
+
const truncatedDesc = truncateToWidth(description, descriptionWidth, "");
|
|
1833
|
+
const highlightedDesc = this.highlightMatch(truncatedDesc, query);
|
|
1834
|
+
const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
|
|
1835
|
+
return isSelected ? this.theme.selectedText(line) : line;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
|
|
1840
|
+
const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
|
|
1841
|
+
return isSelected ? this.theme.selectedText(line) : line;
|
|
1842
|
+
}
|
|
1843
|
+
getDescriptionLayout(width, prefixWidth) {
|
|
1844
|
+
if (width <= SearchableSelectList.DESCRIPTION_LAYOUT_MIN_WIDTH) return null;
|
|
1845
|
+
const availableWidth = Math.max(1, width - prefixWidth - SearchableSelectList.RIGHT_MARGIN_WIDTH);
|
|
1846
|
+
const maxValueWidth = availableWidth - SearchableSelectList.DESCRIPTION_MIN_WIDTH - SearchableSelectList.DESCRIPTION_SPACING_WIDTH;
|
|
1847
|
+
if (maxValueWidth < 1) return null;
|
|
1848
|
+
return {
|
|
1849
|
+
availableWidth,
|
|
1850
|
+
maxValueWidth,
|
|
1851
|
+
spacingWidth: SearchableSelectList.DESCRIPTION_SPACING_WIDTH
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
handleInput(keyData) {
|
|
1855
|
+
if (isKeyRelease(keyData)) return;
|
|
1856
|
+
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p")) {
|
|
1857
|
+
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
1858
|
+
this.notifySelectionChange();
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n")) {
|
|
1862
|
+
this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
|
|
1863
|
+
this.notifySelectionChange();
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
if (matchesKey(keyData, "enter")) {
|
|
1867
|
+
const item = this.filteredItems[this.selectedIndex];
|
|
1868
|
+
if (item && this.onSelect) this.onSelect(item);
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
1872
|
+
if (this.onCancel) this.onCancel();
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
const prevValue = this.searchInput.getValue();
|
|
1876
|
+
this.searchInput.handleInput(keyData);
|
|
1877
|
+
if (prevValue !== this.searchInput.getValue()) this.updateFilter();
|
|
1878
|
+
}
|
|
1879
|
+
notifySelectionChange() {
|
|
1880
|
+
const item = this.filteredItems[this.selectedIndex];
|
|
1881
|
+
if (item && this.onSelectionChange) this.onSelectionChange(item);
|
|
1882
|
+
}
|
|
1883
|
+
getSelectedItem() {
|
|
1884
|
+
return this.filteredItems[this.selectedIndex] ?? null;
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
//#endregion
|
|
1888
|
+
//#region src/tui/components/selectors.ts
|
|
1889
|
+
function createSearchableSelectList(items, maxVisible = 7) {
|
|
1890
|
+
return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
|
|
1891
|
+
}
|
|
1892
|
+
function createFilterableSelectList(items, maxVisible = 7) {
|
|
1893
|
+
return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
|
|
1894
|
+
}
|
|
1895
|
+
function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
|
|
1896
|
+
return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
|
|
1897
|
+
}
|
|
1898
|
+
//#endregion
|
|
1899
|
+
//#region src/tui/tui-status-summary.ts
|
|
1900
|
+
function formatStatusSummary(summary) {
|
|
1901
|
+
const lines = [];
|
|
1902
|
+
lines.push("Gateway status");
|
|
1903
|
+
if (summary.runtimeVersion) lines.push(`Version: ${summary.runtimeVersion}`);
|
|
1904
|
+
if (!summary.linkChannel) lines.push("Link channel: unknown");
|
|
1905
|
+
else {
|
|
1906
|
+
const linkLabel = summary.linkChannel.label ?? "Link channel";
|
|
1907
|
+
const linked = summary.linkChannel.linked === true;
|
|
1908
|
+
const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})` : "";
|
|
1909
|
+
lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
|
|
1910
|
+
}
|
|
1911
|
+
const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
|
|
1912
|
+
if (providerSummary.length > 0) {
|
|
1913
|
+
lines.push("");
|
|
1914
|
+
lines.push("System:");
|
|
1915
|
+
for (const line of providerSummary) lines.push(` ${line}`);
|
|
1916
|
+
}
|
|
1917
|
+
const heartbeatAgents = summary.heartbeat?.agents ?? [];
|
|
1918
|
+
if (heartbeatAgents.length > 0) {
|
|
1919
|
+
const heartbeatParts = heartbeatAgents.map((agent) => {
|
|
1920
|
+
const agentId = agent.agentId ?? "unknown";
|
|
1921
|
+
if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
|
|
1922
|
+
return `${agent.every ?? "unknown"} (${agentId})`;
|
|
1923
|
+
});
|
|
1924
|
+
lines.push("");
|
|
1925
|
+
lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
|
|
1926
|
+
}
|
|
1927
|
+
const sessionPaths = summary.sessions?.paths ?? [];
|
|
1928
|
+
if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
|
|
1929
|
+
else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
|
|
1930
|
+
const defaults = summary.sessions?.defaults;
|
|
1931
|
+
const defaultModel = defaults?.model ?? "unknown";
|
|
1932
|
+
const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
|
|
1933
|
+
lines.push(`Default model: ${defaultModel}${defaultCtx}`);
|
|
1934
|
+
const sessionCount = summary.sessions?.count ?? 0;
|
|
1935
|
+
lines.push(`Active sessions: ${sessionCount}`);
|
|
1936
|
+
const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
|
|
1937
|
+
if (recent.length > 0) {
|
|
1938
|
+
lines.push("Recent sessions:");
|
|
1939
|
+
for (const entry of recent) {
|
|
1940
|
+
const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
|
|
1941
|
+
const model = entry.model ?? "unknown";
|
|
1942
|
+
const usage = formatContextUsageLine({
|
|
1943
|
+
total: entry.totalTokens ?? null,
|
|
1944
|
+
context: entry.contextTokens ?? null,
|
|
1945
|
+
remaining: entry.remainingTokens ?? null,
|
|
1946
|
+
percent: entry.percentUsed ?? null
|
|
1947
|
+
});
|
|
1948
|
+
const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
|
|
1949
|
+
lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
|
|
1953
|
+
if (queued.length > 0) {
|
|
1954
|
+
const preview = queued.slice(0, 3).join(" | ");
|
|
1955
|
+
lines.push(`Queued system events (${queued.length}): ${preview}`);
|
|
1956
|
+
}
|
|
1957
|
+
return lines;
|
|
1958
|
+
}
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region src/tui/tui-command-handlers.ts
|
|
1961
|
+
function isBtwCommand(text) {
|
|
1962
|
+
return /^\/btw(?::|\s|$)/i.test(text.trim());
|
|
1963
|
+
}
|
|
1964
|
+
function createCommandHandlers(context) {
|
|
1965
|
+
const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalBtwRunId, forgetLocalRunId, forgetLocalBtwRunId, requestExit } = context;
|
|
1966
|
+
const setAgent = async (id) => {
|
|
1967
|
+
state.currentAgentId = normalizeAgentId(id);
|
|
1968
|
+
await setSession("");
|
|
1969
|
+
};
|
|
1970
|
+
const closeOverlayAndRender = () => {
|
|
1971
|
+
closeOverlay();
|
|
1972
|
+
tui.requestRender();
|
|
1973
|
+
};
|
|
1974
|
+
const openSelector = (selector, onSelect) => {
|
|
1975
|
+
selector.onSelect = (item) => {
|
|
1976
|
+
(async () => {
|
|
1977
|
+
await onSelect(item.value);
|
|
1978
|
+
closeOverlayAndRender();
|
|
1979
|
+
})();
|
|
1980
|
+
};
|
|
1981
|
+
selector.onCancel = closeOverlayAndRender;
|
|
1982
|
+
openOverlay(selector);
|
|
1983
|
+
tui.requestRender();
|
|
1984
|
+
};
|
|
1985
|
+
const openModelSelector = async () => {
|
|
1986
|
+
try {
|
|
1987
|
+
const models = await client.listModels();
|
|
1988
|
+
if (models.length === 0) {
|
|
1989
|
+
chatLog.addSystem("no models available");
|
|
1990
|
+
tui.requestRender();
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1993
|
+
openSelector(createSearchableSelectList(models.map((model) => ({
|
|
1994
|
+
value: `${model.provider}/${model.id}`,
|
|
1995
|
+
label: `${model.provider}/${model.id}`,
|
|
1996
|
+
description: model.name && model.name !== model.id ? model.name : ""
|
|
1997
|
+
})), 9), async (value) => {
|
|
1998
|
+
try {
|
|
1999
|
+
const result = await client.patchSession({
|
|
2000
|
+
key: state.currentSessionKey,
|
|
2001
|
+
model: value
|
|
2002
|
+
});
|
|
2003
|
+
chatLog.addSystem(`model set to ${value}`);
|
|
2004
|
+
applySessionInfoFromPatch(result);
|
|
2005
|
+
await refreshSessionInfo();
|
|
2006
|
+
} catch (err) {
|
|
2007
|
+
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
} catch (err) {
|
|
2011
|
+
chatLog.addSystem(`model list failed: ${String(err)}`);
|
|
2012
|
+
tui.requestRender();
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
const openAgentSelector = async () => {
|
|
2016
|
+
await refreshAgents();
|
|
2017
|
+
if (state.agents.length === 0) {
|
|
2018
|
+
chatLog.addSystem("no agents found");
|
|
2019
|
+
tui.requestRender();
|
|
2020
|
+
return;
|
|
2021
|
+
}
|
|
2022
|
+
openSelector(createSearchableSelectList(state.agents.map((agent) => ({
|
|
2023
|
+
value: agent.id,
|
|
2024
|
+
label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
|
|
2025
|
+
description: agent.id === state.agentDefaultId ? "default" : ""
|
|
2026
|
+
})), 9), async (value) => {
|
|
2027
|
+
await setAgent(value);
|
|
2028
|
+
});
|
|
2029
|
+
};
|
|
2030
|
+
const openSessionSelector = async () => {
|
|
2031
|
+
try {
|
|
2032
|
+
openSelector(createFilterableSelectList((await client.listSessions({
|
|
2033
|
+
includeGlobal: false,
|
|
2034
|
+
includeUnknown: false,
|
|
2035
|
+
includeDerivedTitles: true,
|
|
2036
|
+
includeLastMessage: true,
|
|
2037
|
+
agentId: state.currentAgentId
|
|
2038
|
+
})).sessions.map((session) => {
|
|
2039
|
+
const title = session.derivedTitle ?? session.displayName;
|
|
2040
|
+
const formattedKey = formatSessionKey(session.key);
|
|
2041
|
+
const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
|
|
2042
|
+
const timePart = session.updatedAt ? formatRelativeTimestamp(session.updatedAt, {
|
|
2043
|
+
dateFallback: true,
|
|
2044
|
+
fallback: ""
|
|
2045
|
+
}) : "";
|
|
2046
|
+
const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
|
|
2047
|
+
const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
|
|
2048
|
+
return {
|
|
2049
|
+
value: session.key,
|
|
2050
|
+
label,
|
|
2051
|
+
description,
|
|
2052
|
+
searchText: [
|
|
2053
|
+
session.displayName,
|
|
2054
|
+
session.label,
|
|
2055
|
+
session.subject,
|
|
2056
|
+
session.sessionId,
|
|
2057
|
+
session.key,
|
|
2058
|
+
session.lastMessagePreview
|
|
2059
|
+
].filter(Boolean).join(" ")
|
|
2060
|
+
};
|
|
2061
|
+
}), 9), async (value) => {
|
|
2062
|
+
await setSession(value);
|
|
2063
|
+
});
|
|
2064
|
+
} catch (err) {
|
|
2065
|
+
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
2066
|
+
tui.requestRender();
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
const openSettings = () => {
|
|
2070
|
+
openOverlay(createSettingsList([{
|
|
2071
|
+
id: "tools",
|
|
2072
|
+
label: "Tool output",
|
|
2073
|
+
currentValue: state.toolsExpanded ? "expanded" : "collapsed",
|
|
2074
|
+
values: ["collapsed", "expanded"]
|
|
2075
|
+
}, {
|
|
2076
|
+
id: "thinking",
|
|
2077
|
+
label: "Show thinking",
|
|
2078
|
+
currentValue: state.showThinking ? "on" : "off",
|
|
2079
|
+
values: ["off", "on"]
|
|
2080
|
+
}], (id, value) => {
|
|
2081
|
+
if (id === "tools") {
|
|
2082
|
+
state.toolsExpanded = value === "expanded";
|
|
2083
|
+
chatLog.setToolsExpanded(state.toolsExpanded);
|
|
2084
|
+
}
|
|
2085
|
+
if (id === "thinking") {
|
|
2086
|
+
state.showThinking = value === "on";
|
|
2087
|
+
loadHistory();
|
|
2088
|
+
}
|
|
2089
|
+
tui.requestRender();
|
|
2090
|
+
}, () => {
|
|
2091
|
+
closeOverlay();
|
|
2092
|
+
tui.requestRender();
|
|
2093
|
+
}));
|
|
2094
|
+
tui.requestRender();
|
|
2095
|
+
};
|
|
2096
|
+
const handleCommand = async (raw) => {
|
|
2097
|
+
const { name, args } = parseCommand(raw);
|
|
2098
|
+
if (!name) return;
|
|
2099
|
+
switch (name) {
|
|
2100
|
+
case "help":
|
|
2101
|
+
chatLog.addSystem(helpText({
|
|
2102
|
+
provider: state.sessionInfo.modelProvider,
|
|
2103
|
+
model: state.sessionInfo.model
|
|
2104
|
+
}));
|
|
2105
|
+
break;
|
|
2106
|
+
case "status":
|
|
2107
|
+
try {
|
|
2108
|
+
const status = await client.getStatus();
|
|
2109
|
+
if (typeof status === "string") {
|
|
2110
|
+
chatLog.addSystem(status);
|
|
2111
|
+
break;
|
|
2112
|
+
}
|
|
2113
|
+
if (status && typeof status === "object") {
|
|
2114
|
+
const lines = formatStatusSummary(status);
|
|
2115
|
+
for (const line of lines) chatLog.addSystem(line);
|
|
2116
|
+
break;
|
|
2117
|
+
}
|
|
2118
|
+
chatLog.addSystem("status: unknown response");
|
|
2119
|
+
} catch (err) {
|
|
2120
|
+
chatLog.addSystem(`status failed: ${String(err)}`);
|
|
2121
|
+
}
|
|
2122
|
+
break;
|
|
2123
|
+
case "agent":
|
|
2124
|
+
if (!args) await openAgentSelector();
|
|
2125
|
+
else await setAgent(args);
|
|
2126
|
+
break;
|
|
2127
|
+
case "agents":
|
|
2128
|
+
await openAgentSelector();
|
|
2129
|
+
break;
|
|
2130
|
+
case "session":
|
|
2131
|
+
if (!args) await openSessionSelector();
|
|
2132
|
+
else await setSession(args);
|
|
2133
|
+
break;
|
|
2134
|
+
case "sessions":
|
|
2135
|
+
await openSessionSelector();
|
|
2136
|
+
break;
|
|
2137
|
+
case "model":
|
|
2138
|
+
if (!args) await openModelSelector();
|
|
2139
|
+
else try {
|
|
2140
|
+
const result = await client.patchSession({
|
|
2141
|
+
key: state.currentSessionKey,
|
|
2142
|
+
model: args
|
|
2143
|
+
});
|
|
2144
|
+
chatLog.addSystem(`model set to ${args}`);
|
|
2145
|
+
applySessionInfoFromPatch(result);
|
|
2146
|
+
await refreshSessionInfo();
|
|
2147
|
+
} catch (err) {
|
|
2148
|
+
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2149
|
+
}
|
|
2150
|
+
break;
|
|
2151
|
+
case "models":
|
|
2152
|
+
await openModelSelector();
|
|
2153
|
+
break;
|
|
2154
|
+
case "think":
|
|
2155
|
+
if (!args) {
|
|
2156
|
+
const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
|
|
2157
|
+
chatLog.addSystem(`usage: /think <${levels}>`);
|
|
2158
|
+
break;
|
|
2159
|
+
}
|
|
2160
|
+
try {
|
|
2161
|
+
const result = await client.patchSession({
|
|
2162
|
+
key: state.currentSessionKey,
|
|
2163
|
+
thinkingLevel: args
|
|
2164
|
+
});
|
|
2165
|
+
chatLog.addSystem(`thinking set to ${args}`);
|
|
2166
|
+
applySessionInfoFromPatch(result);
|
|
2167
|
+
await refreshSessionInfo();
|
|
2168
|
+
} catch (err) {
|
|
2169
|
+
chatLog.addSystem(`think failed: ${String(err)}`);
|
|
2170
|
+
}
|
|
2171
|
+
break;
|
|
2172
|
+
case "verbose":
|
|
2173
|
+
if (!args) {
|
|
2174
|
+
chatLog.addSystem("usage: /verbose <on|off>");
|
|
2175
|
+
break;
|
|
2176
|
+
}
|
|
2177
|
+
try {
|
|
2178
|
+
const result = await client.patchSession({
|
|
2179
|
+
key: state.currentSessionKey,
|
|
2180
|
+
verboseLevel: args
|
|
2181
|
+
});
|
|
2182
|
+
chatLog.addSystem(`verbose set to ${args}`);
|
|
2183
|
+
applySessionInfoFromPatch(result);
|
|
2184
|
+
await loadHistory();
|
|
2185
|
+
} catch (err) {
|
|
2186
|
+
chatLog.addSystem(`verbose failed: ${String(err)}`);
|
|
2187
|
+
}
|
|
2188
|
+
break;
|
|
2189
|
+
case "fast":
|
|
2190
|
+
if (!args || args === "status") {
|
|
2191
|
+
chatLog.addSystem(`fast mode: ${state.sessionInfo.fastMode ? "on" : "off"}`);
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
if (args !== "on" && args !== "off") {
|
|
2195
|
+
chatLog.addSystem("usage: /fast <status|on|off>");
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
try {
|
|
2199
|
+
const result = await client.patchSession({
|
|
2200
|
+
key: state.currentSessionKey,
|
|
2201
|
+
fastMode: args === "on"
|
|
2202
|
+
});
|
|
2203
|
+
chatLog.addSystem(`fast mode ${args === "on" ? "enabled" : "disabled"}`);
|
|
2204
|
+
applySessionInfoFromPatch(result);
|
|
2205
|
+
await refreshSessionInfo();
|
|
2206
|
+
} catch (err) {
|
|
2207
|
+
chatLog.addSystem(`fast failed: ${String(err)}`);
|
|
2208
|
+
}
|
|
2209
|
+
break;
|
|
2210
|
+
case "reasoning":
|
|
2211
|
+
if (!args) {
|
|
2212
|
+
chatLog.addSystem("usage: /reasoning <on|off>");
|
|
2213
|
+
break;
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
const result = await client.patchSession({
|
|
2217
|
+
key: state.currentSessionKey,
|
|
2218
|
+
reasoningLevel: args
|
|
2219
|
+
});
|
|
2220
|
+
chatLog.addSystem(`reasoning set to ${args}`);
|
|
2221
|
+
applySessionInfoFromPatch(result);
|
|
2222
|
+
await refreshSessionInfo();
|
|
2223
|
+
} catch (err) {
|
|
2224
|
+
chatLog.addSystem(`reasoning failed: ${String(err)}`);
|
|
2225
|
+
}
|
|
2226
|
+
break;
|
|
2227
|
+
case "usage": {
|
|
2228
|
+
const normalized = args ? normalizeUsageDisplay(args) : void 0;
|
|
2229
|
+
if (args && !normalized) {
|
|
2230
|
+
chatLog.addSystem("usage: /usage <off|tokens|full>");
|
|
2231
|
+
break;
|
|
2232
|
+
}
|
|
2233
|
+
const currentRaw = state.sessionInfo.responseUsage;
|
|
2234
|
+
const current = resolveResponseUsageMode(currentRaw);
|
|
2235
|
+
const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
|
|
2236
|
+
try {
|
|
2237
|
+
const result = await client.patchSession({
|
|
2238
|
+
key: state.currentSessionKey,
|
|
2239
|
+
responseUsage: next === "off" ? null : next
|
|
2240
|
+
});
|
|
2241
|
+
chatLog.addSystem(`usage footer: ${next}`);
|
|
2242
|
+
applySessionInfoFromPatch(result);
|
|
2243
|
+
await refreshSessionInfo();
|
|
2244
|
+
} catch (err) {
|
|
2245
|
+
chatLog.addSystem(`usage failed: ${String(err)}`);
|
|
2246
|
+
}
|
|
2247
|
+
break;
|
|
2248
|
+
}
|
|
2249
|
+
case "elevated":
|
|
2250
|
+
if (!args) {
|
|
2251
|
+
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2252
|
+
break;
|
|
2253
|
+
}
|
|
2254
|
+
if (![
|
|
2255
|
+
"on",
|
|
2256
|
+
"off",
|
|
2257
|
+
"ask",
|
|
2258
|
+
"full"
|
|
2259
|
+
].includes(args)) {
|
|
2260
|
+
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2261
|
+
break;
|
|
2262
|
+
}
|
|
2263
|
+
try {
|
|
2264
|
+
const result = await client.patchSession({
|
|
2265
|
+
key: state.currentSessionKey,
|
|
2266
|
+
elevatedLevel: args
|
|
2267
|
+
});
|
|
2268
|
+
chatLog.addSystem(`elevated set to ${args}`);
|
|
2269
|
+
applySessionInfoFromPatch(result);
|
|
2270
|
+
await refreshSessionInfo();
|
|
2271
|
+
} catch (err) {
|
|
2272
|
+
chatLog.addSystem(`elevated failed: ${String(err)}`);
|
|
2273
|
+
}
|
|
2274
|
+
break;
|
|
2275
|
+
case "activation":
|
|
2276
|
+
if (!args) {
|
|
2277
|
+
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2280
|
+
const activation = normalizeGroupActivation(args);
|
|
2281
|
+
if (!activation) {
|
|
2282
|
+
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2283
|
+
break;
|
|
2284
|
+
}
|
|
2285
|
+
try {
|
|
2286
|
+
const result = await client.patchSession({
|
|
2287
|
+
key: state.currentSessionKey,
|
|
2288
|
+
groupActivation: activation
|
|
2289
|
+
});
|
|
2290
|
+
chatLog.addSystem(`activation set to ${activation}`);
|
|
2291
|
+
applySessionInfoFromPatch(result);
|
|
2292
|
+
await refreshSessionInfo();
|
|
2293
|
+
} catch (err) {
|
|
2294
|
+
chatLog.addSystem(`activation failed: ${String(err)}`);
|
|
2295
|
+
}
|
|
2296
|
+
break;
|
|
2297
|
+
case "new":
|
|
2298
|
+
try {
|
|
2299
|
+
state.sessionInfo.inputTokens = null;
|
|
2300
|
+
state.sessionInfo.outputTokens = null;
|
|
2301
|
+
state.sessionInfo.totalTokens = null;
|
|
2302
|
+
tui.requestRender();
|
|
2303
|
+
const uniqueKey = `tui-${randomUUID()}`;
|
|
2304
|
+
await setSession(uniqueKey);
|
|
2305
|
+
chatLog.addSystem(`new session: ${uniqueKey}`);
|
|
2306
|
+
} catch (err) {
|
|
2307
|
+
chatLog.addSystem(`new session failed: ${sanitizeRenderableText(String(err))}`);
|
|
2308
|
+
}
|
|
2309
|
+
break;
|
|
2310
|
+
case "reset":
|
|
2311
|
+
try {
|
|
2312
|
+
state.sessionInfo.inputTokens = null;
|
|
2313
|
+
state.sessionInfo.outputTokens = null;
|
|
2314
|
+
state.sessionInfo.totalTokens = null;
|
|
2315
|
+
tui.requestRender();
|
|
2316
|
+
await client.resetSession(state.currentSessionKey, name);
|
|
2317
|
+
chatLog.addSystem(`session ${state.currentSessionKey} reset`);
|
|
2318
|
+
await loadHistory();
|
|
2319
|
+
} catch (err) {
|
|
2320
|
+
chatLog.addSystem(`reset failed: ${sanitizeRenderableText(String(err))}`);
|
|
2321
|
+
}
|
|
2322
|
+
break;
|
|
2323
|
+
case "abort":
|
|
2324
|
+
await abortActive();
|
|
2325
|
+
break;
|
|
2326
|
+
case "settings":
|
|
2327
|
+
openSettings();
|
|
2328
|
+
break;
|
|
2329
|
+
case "exit":
|
|
2330
|
+
case "quit":
|
|
2331
|
+
requestExit();
|
|
2332
|
+
break;
|
|
2333
|
+
default:
|
|
2334
|
+
await sendMessage(raw);
|
|
2335
|
+
break;
|
|
2336
|
+
}
|
|
2337
|
+
tui.requestRender();
|
|
2338
|
+
};
|
|
2339
|
+
const sendMessage = async (text) => {
|
|
2340
|
+
if (!state.isConnected) {
|
|
2341
|
+
chatLog.addSystem("not connected to gateway — message not sent");
|
|
2342
|
+
setActivityStatus("disconnected");
|
|
2343
|
+
tui.requestRender();
|
|
2344
|
+
return;
|
|
2345
|
+
}
|
|
2346
|
+
const isBtw = isBtwCommand(text);
|
|
2347
|
+
const runId = randomUUID();
|
|
2348
|
+
try {
|
|
2349
|
+
if (!isBtw) {
|
|
2350
|
+
chatLog.addUser(text);
|
|
2351
|
+
state.pendingOptimisticUserMessage = true;
|
|
2352
|
+
setActivityStatus("sending");
|
|
2353
|
+
} else noteLocalBtwRunId?.(runId);
|
|
2354
|
+
tui.requestRender();
|
|
2355
|
+
await client.sendChat({
|
|
2356
|
+
sessionKey: state.currentSessionKey,
|
|
2357
|
+
message: text,
|
|
2358
|
+
thinking: opts.thinking,
|
|
2359
|
+
deliver: deliverDefault,
|
|
2360
|
+
timeoutMs: opts.timeoutMs,
|
|
2361
|
+
runId
|
|
2362
|
+
});
|
|
2363
|
+
if (!isBtw) {
|
|
2364
|
+
setActivityStatus("waiting");
|
|
2365
|
+
tui.requestRender();
|
|
2366
|
+
}
|
|
2367
|
+
} catch (err) {
|
|
2368
|
+
if (isBtw) forgetLocalBtwRunId?.(runId);
|
|
2369
|
+
if (!isBtw && state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
|
|
2370
|
+
if (!isBtw) {
|
|
2371
|
+
state.pendingOptimisticUserMessage = false;
|
|
2372
|
+
state.activeChatRunId = null;
|
|
2373
|
+
}
|
|
2374
|
+
chatLog.addSystem(`${isBtw ? "btw failed" : "send failed"}: ${String(err)}`);
|
|
2375
|
+
if (!isBtw) setActivityStatus("error");
|
|
2376
|
+
tui.requestRender();
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
return {
|
|
2380
|
+
handleCommand,
|
|
2381
|
+
sendMessage,
|
|
2382
|
+
openModelSelector,
|
|
2383
|
+
openAgentSelector,
|
|
2384
|
+
openSessionSelector,
|
|
2385
|
+
openSettings,
|
|
2386
|
+
setAgent
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
//#endregion
|
|
2390
|
+
//#region src/tui/tui-stream-assembler.ts
|
|
2391
|
+
function extractTextBlocksAndSignals(message) {
|
|
2392
|
+
if (!message || typeof message !== "object") return {
|
|
2393
|
+
textBlocks: [],
|
|
2394
|
+
sawNonTextContentBlocks: false
|
|
2395
|
+
};
|
|
2396
|
+
const content = message.content;
|
|
2397
|
+
if (typeof content === "string") {
|
|
2398
|
+
const text = content.trim();
|
|
2399
|
+
return {
|
|
2400
|
+
textBlocks: text ? [text] : [],
|
|
2401
|
+
sawNonTextContentBlocks: false
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
if (!Array.isArray(content)) return {
|
|
2405
|
+
textBlocks: [],
|
|
2406
|
+
sawNonTextContentBlocks: false
|
|
2407
|
+
};
|
|
2408
|
+
const textBlocks = [];
|
|
2409
|
+
let sawNonTextContentBlocks = false;
|
|
2410
|
+
for (const block of content) {
|
|
2411
|
+
if (!block || typeof block !== "object") continue;
|
|
2412
|
+
const rec = block;
|
|
2413
|
+
if (rec.type === "text" && typeof rec.text === "string") {
|
|
2414
|
+
const text = rec.text.trim();
|
|
2415
|
+
if (text) textBlocks.push(text);
|
|
2416
|
+
continue;
|
|
2417
|
+
}
|
|
2418
|
+
if (typeof rec.type === "string" && rec.type !== "thinking") sawNonTextContentBlocks = true;
|
|
2419
|
+
}
|
|
2420
|
+
return {
|
|
2421
|
+
textBlocks,
|
|
2422
|
+
sawNonTextContentBlocks
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
function isDroppedBoundaryTextBlockSubset(params) {
|
|
2426
|
+
const { streamedTextBlocks, finalTextBlocks } = params;
|
|
2427
|
+
if (finalTextBlocks.length === 0 || finalTextBlocks.length >= streamedTextBlocks.length) return false;
|
|
2428
|
+
if (finalTextBlocks.every((block, index) => streamedTextBlocks[index] === block)) return true;
|
|
2429
|
+
const suffixStart = streamedTextBlocks.length - finalTextBlocks.length;
|
|
2430
|
+
return finalTextBlocks.every((block, index) => streamedTextBlocks[suffixStart + index] === block);
|
|
2431
|
+
}
|
|
2432
|
+
function shouldPreserveBoundaryDroppedText(params) {
|
|
2433
|
+
if (params.boundaryDropMode === "off") return false;
|
|
2434
|
+
if (!(params.boundaryDropMode === "streamed-or-incoming" ? params.streamedSawNonTextContentBlocks || params.incomingSawNonTextContentBlocks : params.streamedSawNonTextContentBlocks)) return false;
|
|
2435
|
+
return isDroppedBoundaryTextBlockSubset({
|
|
2436
|
+
streamedTextBlocks: params.streamedTextBlocks,
|
|
2437
|
+
finalTextBlocks: params.nextContentBlocks
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
var TuiStreamAssembler = class {
|
|
2441
|
+
constructor() {
|
|
2442
|
+
this.runs = /* @__PURE__ */ new Map();
|
|
2443
|
+
}
|
|
2444
|
+
getOrCreateRun(runId) {
|
|
2445
|
+
let state = this.runs.get(runId);
|
|
2446
|
+
if (!state) {
|
|
2447
|
+
state = {
|
|
2448
|
+
thinkingText: "",
|
|
2449
|
+
contentText: "",
|
|
2450
|
+
contentBlocks: [],
|
|
2451
|
+
sawNonTextContentBlocks: false,
|
|
2452
|
+
displayText: ""
|
|
2453
|
+
};
|
|
2454
|
+
this.runs.set(runId, state);
|
|
2455
|
+
}
|
|
2456
|
+
return state;
|
|
2457
|
+
}
|
|
2458
|
+
updateRunState(state, message, showThinking, opts) {
|
|
2459
|
+
const thinkingText = extractThinkingFromMessage(message);
|
|
2460
|
+
const contentText = extractContentFromMessage(message);
|
|
2461
|
+
const { textBlocks, sawNonTextContentBlocks } = extractTextBlocksAndSignals(message);
|
|
2462
|
+
if (thinkingText) state.thinkingText = thinkingText;
|
|
2463
|
+
if (contentText) {
|
|
2464
|
+
const nextContentBlocks = textBlocks.length > 0 ? textBlocks : [contentText];
|
|
2465
|
+
if (!shouldPreserveBoundaryDroppedText({
|
|
2466
|
+
boundaryDropMode: opts?.boundaryDropMode ?? "off",
|
|
2467
|
+
streamedSawNonTextContentBlocks: state.sawNonTextContentBlocks,
|
|
2468
|
+
incomingSawNonTextContentBlocks: sawNonTextContentBlocks,
|
|
2469
|
+
streamedTextBlocks: state.contentBlocks,
|
|
2470
|
+
nextContentBlocks
|
|
2471
|
+
})) {
|
|
2472
|
+
state.contentText = contentText;
|
|
2473
|
+
state.contentBlocks = nextContentBlocks;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
if (sawNonTextContentBlocks) state.sawNonTextContentBlocks = true;
|
|
2477
|
+
state.displayText = composeThinkingAndContent({
|
|
2478
|
+
thinkingText: state.thinkingText,
|
|
2479
|
+
contentText: state.contentText,
|
|
2480
|
+
showThinking
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
ingestDelta(runId, message, showThinking) {
|
|
2484
|
+
const state = this.getOrCreateRun(runId);
|
|
2485
|
+
const previousDisplayText = state.displayText;
|
|
2486
|
+
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-or-incoming" });
|
|
2487
|
+
if (!state.displayText || state.displayText === previousDisplayText) return null;
|
|
2488
|
+
return state.displayText;
|
|
2489
|
+
}
|
|
2490
|
+
finalize(runId, message, showThinking, errorMessage) {
|
|
2491
|
+
const state = this.getOrCreateRun(runId);
|
|
2492
|
+
const streamedDisplayText = state.displayText;
|
|
2493
|
+
const streamedTextBlocks = [...state.contentBlocks];
|
|
2494
|
+
const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks;
|
|
2495
|
+
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-only" });
|
|
2496
|
+
const finalComposed = state.displayText;
|
|
2497
|
+
const finalText = resolveFinalAssistantText({
|
|
2498
|
+
finalText: streamedSawNonTextContentBlocks && isDroppedBoundaryTextBlockSubset({
|
|
2499
|
+
streamedTextBlocks,
|
|
2500
|
+
finalTextBlocks: state.contentBlocks
|
|
2501
|
+
}) ? streamedDisplayText : finalComposed,
|
|
2502
|
+
streamedText: streamedDisplayText,
|
|
2503
|
+
errorMessage
|
|
2504
|
+
});
|
|
2505
|
+
this.runs.delete(runId);
|
|
2506
|
+
return finalText;
|
|
2507
|
+
}
|
|
2508
|
+
drop(runId) {
|
|
2509
|
+
this.runs.delete(runId);
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
//#endregion
|
|
2513
|
+
//#region src/tui/tui-event-handlers.ts
|
|
2514
|
+
function createEventHandlers(context) {
|
|
2515
|
+
const { chatLog, btw, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, noteLocalRunId, isLocalRunId, forgetLocalRunId, clearLocalRunIds, isLocalBtwRunId, forgetLocalBtwRunId, clearLocalBtwRunIds } = context;
|
|
2516
|
+
const finalizedRuns = /* @__PURE__ */ new Map();
|
|
2517
|
+
const sessionRuns = /* @__PURE__ */ new Map();
|
|
2518
|
+
let streamAssembler = new TuiStreamAssembler();
|
|
2519
|
+
let lastSessionKey = state.currentSessionKey;
|
|
2520
|
+
let pendingHistoryRefresh = false;
|
|
2521
|
+
const pruneRunMap = (runs) => {
|
|
2522
|
+
if (runs.size <= 200) return;
|
|
2523
|
+
const keepUntil = Date.now() - 600 * 1e3;
|
|
2524
|
+
for (const [key, ts] of runs) {
|
|
2525
|
+
if (runs.size <= 150) break;
|
|
2526
|
+
if (ts < keepUntil) runs.delete(key);
|
|
2527
|
+
}
|
|
2528
|
+
if (runs.size > 200) for (const key of runs.keys()) {
|
|
2529
|
+
runs.delete(key);
|
|
2530
|
+
if (runs.size <= 150) break;
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2533
|
+
const syncSessionKey = () => {
|
|
2534
|
+
if (state.currentSessionKey === lastSessionKey) return;
|
|
2535
|
+
lastSessionKey = state.currentSessionKey;
|
|
2536
|
+
finalizedRuns.clear();
|
|
2537
|
+
sessionRuns.clear();
|
|
2538
|
+
streamAssembler = new TuiStreamAssembler();
|
|
2539
|
+
pendingHistoryRefresh = false;
|
|
2540
|
+
state.pendingOptimisticUserMessage = false;
|
|
2541
|
+
clearLocalRunIds?.();
|
|
2542
|
+
clearLocalBtwRunIds?.();
|
|
2543
|
+
btw.clear();
|
|
2544
|
+
};
|
|
2545
|
+
const flushPendingHistoryRefreshIfIdle = () => {
|
|
2546
|
+
if (!pendingHistoryRefresh || state.activeChatRunId) return;
|
|
2547
|
+
pendingHistoryRefresh = false;
|
|
2548
|
+
loadHistory?.();
|
|
2549
|
+
};
|
|
2550
|
+
const noteSessionRun = (runId) => {
|
|
2551
|
+
sessionRuns.set(runId, Date.now());
|
|
2552
|
+
pruneRunMap(sessionRuns);
|
|
2553
|
+
};
|
|
2554
|
+
const noteFinalizedRun = (runId) => {
|
|
2555
|
+
finalizedRuns.set(runId, Date.now());
|
|
2556
|
+
sessionRuns.delete(runId);
|
|
2557
|
+
streamAssembler.drop(runId);
|
|
2558
|
+
pruneRunMap(finalizedRuns);
|
|
2559
|
+
};
|
|
2560
|
+
const clearActiveRunIfMatch = (runId) => {
|
|
2561
|
+
if (state.activeChatRunId === runId) state.activeChatRunId = null;
|
|
2562
|
+
};
|
|
2563
|
+
const finalizeRun = (params) => {
|
|
2564
|
+
noteFinalizedRun(params.runId);
|
|
2565
|
+
clearActiveRunIfMatch(params.runId);
|
|
2566
|
+
flushPendingHistoryRefreshIfIdle();
|
|
2567
|
+
if (params.wasActiveRun) setActivityStatus(params.status);
|
|
2568
|
+
refreshSessionInfo?.();
|
|
2569
|
+
};
|
|
2570
|
+
const terminateRun = (params) => {
|
|
2571
|
+
streamAssembler.drop(params.runId);
|
|
2572
|
+
sessionRuns.delete(params.runId);
|
|
2573
|
+
clearActiveRunIfMatch(params.runId);
|
|
2574
|
+
flushPendingHistoryRefreshIfIdle();
|
|
2575
|
+
if (params.wasActiveRun) setActivityStatus(params.status);
|
|
2576
|
+
refreshSessionInfo?.();
|
|
2577
|
+
};
|
|
2578
|
+
const hasConcurrentActiveRun = (runId) => {
|
|
2579
|
+
const activeRunId = state.activeChatRunId;
|
|
2580
|
+
if (!activeRunId || activeRunId === runId) return false;
|
|
2581
|
+
return sessionRuns.has(activeRunId);
|
|
2582
|
+
};
|
|
2583
|
+
const maybeRefreshHistoryForRun = (runId, opts) => {
|
|
2584
|
+
if (isLocalRunId?.(runId) ?? false) {
|
|
2585
|
+
forgetLocalRunId?.(runId);
|
|
2586
|
+
if (!opts?.allowLocalWithoutDisplayableFinal) return;
|
|
2587
|
+
if (state.activeChatRunId && state.activeChatRunId !== runId) {
|
|
2588
|
+
pendingHistoryRefresh = true;
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
if (hasConcurrentActiveRun(runId)) return;
|
|
2593
|
+
pendingHistoryRefresh = false;
|
|
2594
|
+
loadHistory?.();
|
|
2595
|
+
};
|
|
2596
|
+
const isSameSessionKey = (left, right) => {
|
|
2597
|
+
const normalizedLeft = (left ?? "").trim().toLowerCase();
|
|
2598
|
+
const normalizedRight = (right ?? "").trim().toLowerCase();
|
|
2599
|
+
if (!normalizedLeft || !normalizedRight) return false;
|
|
2600
|
+
if (normalizedLeft === normalizedRight) return true;
|
|
2601
|
+
const parsedLeft = parseAgentSessionKey(normalizedLeft);
|
|
2602
|
+
const parsedRight = parseAgentSessionKey(normalizedRight);
|
|
2603
|
+
if (parsedLeft && parsedRight) return parsedLeft.agentId === parsedRight.agentId && parsedLeft.rest === parsedRight.rest;
|
|
2604
|
+
if (parsedLeft) return parsedLeft.rest === normalizedRight;
|
|
2605
|
+
if (parsedRight) return normalizedLeft === parsedRight.rest;
|
|
2606
|
+
return false;
|
|
2607
|
+
};
|
|
2608
|
+
const handleChatEvent = (payload) => {
|
|
2609
|
+
if (!payload || typeof payload !== "object") return;
|
|
2610
|
+
const evt = payload;
|
|
2611
|
+
syncSessionKey();
|
|
2612
|
+
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
2613
|
+
if (finalizedRuns.has(evt.runId)) {
|
|
2614
|
+
if (evt.state === "delta") return;
|
|
2615
|
+
if (evt.state === "final") return;
|
|
2616
|
+
}
|
|
2617
|
+
noteSessionRun(evt.runId);
|
|
2618
|
+
if (!state.activeChatRunId && !isLocalBtwRunId?.(evt.runId)) {
|
|
2619
|
+
state.activeChatRunId = evt.runId;
|
|
2620
|
+
if (state.pendingOptimisticUserMessage) {
|
|
2621
|
+
noteLocalRunId?.(evt.runId);
|
|
2622
|
+
state.pendingOptimisticUserMessage = false;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
if (evt.state === "delta") {
|
|
2626
|
+
const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
|
|
2627
|
+
if (!displayText) return;
|
|
2628
|
+
chatLog.updateAssistant(displayText, evt.runId);
|
|
2629
|
+
setActivityStatus("streaming");
|
|
2630
|
+
}
|
|
2631
|
+
if (evt.state === "final") {
|
|
2632
|
+
const isLocalBtwRun = isLocalBtwRunId?.(evt.runId) ?? false;
|
|
2633
|
+
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2634
|
+
if (!evt.message && isLocalBtwRun) {
|
|
2635
|
+
forgetLocalBtwRunId?.(evt.runId);
|
|
2636
|
+
noteFinalizedRun(evt.runId);
|
|
2637
|
+
tui.requestRender();
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
if (!evt.message) {
|
|
2641
|
+
maybeRefreshHistoryForRun(evt.runId, { allowLocalWithoutDisplayableFinal: true });
|
|
2642
|
+
chatLog.dropAssistant(evt.runId);
|
|
2643
|
+
finalizeRun({
|
|
2644
|
+
runId: evt.runId,
|
|
2645
|
+
wasActiveRun,
|
|
2646
|
+
status: "idle"
|
|
2647
|
+
});
|
|
2648
|
+
tui.requestRender();
|
|
2649
|
+
return;
|
|
2650
|
+
}
|
|
2651
|
+
if (isCommandMessage(evt.message)) {
|
|
2652
|
+
maybeRefreshHistoryForRun(evt.runId);
|
|
2653
|
+
const text = extractTextFromMessage(evt.message);
|
|
2654
|
+
if (text) chatLog.addSystem(text);
|
|
2655
|
+
finalizeRun({
|
|
2656
|
+
runId: evt.runId,
|
|
2657
|
+
wasActiveRun,
|
|
2658
|
+
status: "idle"
|
|
2659
|
+
});
|
|
2660
|
+
tui.requestRender();
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2663
|
+
maybeRefreshHistoryForRun(evt.runId);
|
|
2664
|
+
const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
|
|
2665
|
+
const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking, evt.errorMessage);
|
|
2666
|
+
if (finalText === "(no output)" && !isLocalRunId?.(evt.runId)) chatLog.dropAssistant(evt.runId);
|
|
2667
|
+
else chatLog.finalizeAssistant(finalText, evt.runId);
|
|
2668
|
+
finalizeRun({
|
|
2669
|
+
runId: evt.runId,
|
|
2670
|
+
wasActiveRun,
|
|
2671
|
+
status: stopReason === "error" ? "error" : "idle"
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
if (evt.state === "aborted") {
|
|
2675
|
+
forgetLocalBtwRunId?.(evt.runId);
|
|
2676
|
+
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2677
|
+
chatLog.addSystem("run aborted");
|
|
2678
|
+
terminateRun({
|
|
2679
|
+
runId: evt.runId,
|
|
2680
|
+
wasActiveRun,
|
|
2681
|
+
status: "aborted"
|
|
2682
|
+
});
|
|
2683
|
+
maybeRefreshHistoryForRun(evt.runId);
|
|
2684
|
+
}
|
|
2685
|
+
if (evt.state === "error") {
|
|
2686
|
+
forgetLocalBtwRunId?.(evt.runId);
|
|
2687
|
+
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2688
|
+
chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
|
|
2689
|
+
terminateRun({
|
|
2690
|
+
runId: evt.runId,
|
|
2691
|
+
wasActiveRun,
|
|
2692
|
+
status: "error"
|
|
2693
|
+
});
|
|
2694
|
+
maybeRefreshHistoryForRun(evt.runId);
|
|
2695
|
+
}
|
|
2696
|
+
tui.requestRender();
|
|
2697
|
+
};
|
|
2698
|
+
const handleAgentEvent = (payload) => {
|
|
2699
|
+
if (!payload || typeof payload !== "object") return;
|
|
2700
|
+
const evt = payload;
|
|
2701
|
+
syncSessionKey();
|
|
2702
|
+
const isActiveRun = evt.runId === state.activeChatRunId;
|
|
2703
|
+
if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
|
|
2704
|
+
if (evt.stream === "tool") {
|
|
2705
|
+
const verbose = state.sessionInfo.verboseLevel ?? "off";
|
|
2706
|
+
const allowToolEvents = verbose !== "off";
|
|
2707
|
+
const allowToolOutput = verbose === "full";
|
|
2708
|
+
if (!allowToolEvents) return;
|
|
2709
|
+
const data = evt.data ?? {};
|
|
2710
|
+
const phase = asString(data.phase, "");
|
|
2711
|
+
const toolCallId = asString(data.toolCallId, "");
|
|
2712
|
+
const toolName = asString(data.name, "tool");
|
|
2713
|
+
if (!toolCallId) return;
|
|
2714
|
+
if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
|
|
2715
|
+
else if (phase === "update") {
|
|
2716
|
+
if (!allowToolOutput) return;
|
|
2717
|
+
chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
|
|
2718
|
+
} else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
|
|
2719
|
+
else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
|
|
2720
|
+
tui.requestRender();
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
2723
|
+
if (evt.stream === "lifecycle") {
|
|
2724
|
+
if (!isActiveRun) return;
|
|
2725
|
+
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
2726
|
+
if (phase === "start") setActivityStatus("running");
|
|
2727
|
+
if (phase === "end") setActivityStatus("idle");
|
|
2728
|
+
if (phase === "error") setActivityStatus("error");
|
|
2729
|
+
tui.requestRender();
|
|
2730
|
+
}
|
|
2731
|
+
};
|
|
2732
|
+
const handleBtwEvent = (payload) => {
|
|
2733
|
+
if (!payload || typeof payload !== "object") return;
|
|
2734
|
+
const evt = payload;
|
|
2735
|
+
syncSessionKey();
|
|
2736
|
+
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
2737
|
+
if (evt.kind !== "btw") return;
|
|
2738
|
+
const question = evt.question.trim();
|
|
2739
|
+
const text = evt.text.trim();
|
|
2740
|
+
if (!question || !text) return;
|
|
2741
|
+
btw.showResult({
|
|
2742
|
+
question,
|
|
2743
|
+
text,
|
|
2744
|
+
isError: evt.isError
|
|
2745
|
+
});
|
|
2746
|
+
tui.requestRender();
|
|
2747
|
+
};
|
|
2748
|
+
return {
|
|
2749
|
+
handleChatEvent,
|
|
2750
|
+
handleAgentEvent,
|
|
2751
|
+
handleBtwEvent
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
//#endregion
|
|
2755
|
+
//#region src/tui/tui-local-shell.ts
|
|
2756
|
+
function createLocalShellRunner(deps) {
|
|
2757
|
+
let localExecAsked = false;
|
|
2758
|
+
let localExecAllowed = false;
|
|
2759
|
+
const createSelector = deps.createSelector ?? createSearchableSelectList;
|
|
2760
|
+
const spawnCommand = deps.spawnCommand ?? spawn;
|
|
2761
|
+
const getCwd = deps.getCwd ?? (() => process.cwd());
|
|
2762
|
+
const env = deps.env ?? process.env;
|
|
2763
|
+
const maxChars = deps.maxOutputChars ?? 4e4;
|
|
2764
|
+
const ensureLocalExecAllowed = async () => {
|
|
2765
|
+
if (localExecAllowed) return true;
|
|
2766
|
+
if (localExecAsked) return false;
|
|
2767
|
+
localExecAsked = true;
|
|
2768
|
+
return await new Promise((resolve) => {
|
|
2769
|
+
deps.chatLog.addSystem("Allow local shell commands for this session?");
|
|
2770
|
+
deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
|
|
2771
|
+
deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
|
|
2772
|
+
const selector = createSelector([{
|
|
2773
|
+
value: "no",
|
|
2774
|
+
label: "No"
|
|
2775
|
+
}, {
|
|
2776
|
+
value: "yes",
|
|
2777
|
+
label: "Yes"
|
|
2778
|
+
}], 2);
|
|
2779
|
+
selector.onSelect = (item) => {
|
|
2780
|
+
deps.closeOverlay();
|
|
2781
|
+
if (item.value === "yes") {
|
|
2782
|
+
localExecAllowed = true;
|
|
2783
|
+
deps.chatLog.addSystem("local shell: enabled for this session");
|
|
2784
|
+
resolve(true);
|
|
2785
|
+
} else {
|
|
2786
|
+
deps.chatLog.addSystem("local shell: not enabled");
|
|
2787
|
+
resolve(false);
|
|
2788
|
+
}
|
|
2789
|
+
deps.tui.requestRender();
|
|
2790
|
+
};
|
|
2791
|
+
selector.onCancel = () => {
|
|
2792
|
+
deps.closeOverlay();
|
|
2793
|
+
deps.chatLog.addSystem("local shell: cancelled");
|
|
2794
|
+
deps.tui.requestRender();
|
|
2795
|
+
resolve(false);
|
|
2796
|
+
};
|
|
2797
|
+
deps.openOverlay(selector);
|
|
2798
|
+
deps.tui.requestRender();
|
|
2799
|
+
});
|
|
2800
|
+
};
|
|
2801
|
+
const runLocalShellLine = async (line) => {
|
|
2802
|
+
const cmd = line.slice(1);
|
|
2803
|
+
if (cmd === "") return;
|
|
2804
|
+
if (localExecAsked && !localExecAllowed) {
|
|
2805
|
+
deps.chatLog.addSystem("local shell: not enabled for this session");
|
|
2806
|
+
deps.tui.requestRender();
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
if (!await ensureLocalExecAllowed()) return;
|
|
2810
|
+
deps.chatLog.addSystem(`[local] $ ${cmd}`);
|
|
2811
|
+
deps.tui.requestRender();
|
|
2812
|
+
const appendWithCap = (text, chunk) => {
|
|
2813
|
+
const combined = text + chunk;
|
|
2814
|
+
return combined.length > maxChars ? combined.slice(-maxChars) : combined;
|
|
2815
|
+
};
|
|
2816
|
+
await new Promise((resolve) => {
|
|
2817
|
+
const child = spawnCommand(cmd, {
|
|
2818
|
+
shell: true,
|
|
2819
|
+
cwd: getCwd(),
|
|
2820
|
+
env: {
|
|
2821
|
+
...env,
|
|
2822
|
+
VORA_SHELL: "tui-local"
|
|
2823
|
+
}
|
|
2824
|
+
});
|
|
2825
|
+
let stdout = "";
|
|
2826
|
+
let stderr = "";
|
|
2827
|
+
child.stdout.on("data", (buf) => {
|
|
2828
|
+
stdout = appendWithCap(stdout, buf.toString("utf8"));
|
|
2829
|
+
});
|
|
2830
|
+
child.stderr.on("data", (buf) => {
|
|
2831
|
+
stderr = appendWithCap(stderr, buf.toString("utf8"));
|
|
2832
|
+
});
|
|
2833
|
+
child.on("close", (code, signal) => {
|
|
2834
|
+
const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
|
|
2835
|
+
if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
|
|
2836
|
+
deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
|
|
2837
|
+
deps.tui.requestRender();
|
|
2838
|
+
resolve();
|
|
2839
|
+
});
|
|
2840
|
+
child.on("error", (err) => {
|
|
2841
|
+
deps.chatLog.addSystem(`[local] error: ${String(err)}`);
|
|
2842
|
+
deps.tui.requestRender();
|
|
2843
|
+
resolve();
|
|
2844
|
+
});
|
|
2845
|
+
});
|
|
2846
|
+
};
|
|
2847
|
+
return { runLocalShellLine };
|
|
2848
|
+
}
|
|
2849
|
+
//#endregion
|
|
2850
|
+
//#region src/tui/tui-overlays.ts
|
|
2851
|
+
function createOverlayHandlers(host, fallbackFocus) {
|
|
2852
|
+
const openOverlay = (component) => {
|
|
2853
|
+
host.showOverlay(component);
|
|
2854
|
+
};
|
|
2855
|
+
const closeOverlay = () => {
|
|
2856
|
+
if (host.hasOverlay()) {
|
|
2857
|
+
host.hideOverlay();
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2860
|
+
host.setFocus(fallbackFocus);
|
|
2861
|
+
};
|
|
2862
|
+
return {
|
|
2863
|
+
openOverlay,
|
|
2864
|
+
closeOverlay
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
//#endregion
|
|
2868
|
+
//#region src/tui/tui-session-actions.ts
|
|
2869
|
+
function createSessionActions(context) {
|
|
2870
|
+
const { client, chatLog, btw, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
|
|
2871
|
+
let refreshSessionInfoPromise = Promise.resolve();
|
|
2872
|
+
let lastSessionDefaults = null;
|
|
2873
|
+
const applyAgentsResult = (result) => {
|
|
2874
|
+
state.agentDefaultId = normalizeAgentId(result.defaultId);
|
|
2875
|
+
state.sessionMainKey = normalizeMainKey(result.mainKey);
|
|
2876
|
+
state.sessionScope = result.scope ?? state.sessionScope;
|
|
2877
|
+
state.agents = result.agents.map((agent) => ({
|
|
2878
|
+
id: normalizeAgentId(agent.id),
|
|
2879
|
+
name: agent.name?.trim() || void 0
|
|
2880
|
+
}));
|
|
2881
|
+
agentNames.clear();
|
|
2882
|
+
for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
|
|
2883
|
+
if (!state.initialSessionApplied) {
|
|
2884
|
+
if (initialSessionAgentId) {
|
|
2885
|
+
if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
|
|
2886
|
+
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
2887
|
+
const nextSessionKey = resolveSessionKey(initialSessionInput);
|
|
2888
|
+
if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
|
|
2889
|
+
state.initialSessionApplied = true;
|
|
2890
|
+
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
2891
|
+
updateHeader();
|
|
2892
|
+
updateFooter();
|
|
2893
|
+
};
|
|
2894
|
+
const refreshAgents = async () => {
|
|
2895
|
+
try {
|
|
2896
|
+
applyAgentsResult(await client.listAgents());
|
|
2897
|
+
} catch (err) {
|
|
2898
|
+
chatLog.addSystem(`agents list failed: ${String(err)}`);
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
const updateAgentFromSessionKey = (key) => {
|
|
2902
|
+
const parsed = parseAgentSessionKey(key);
|
|
2903
|
+
if (!parsed) return;
|
|
2904
|
+
const next = normalizeAgentId(parsed.agentId);
|
|
2905
|
+
if (next !== state.currentAgentId) state.currentAgentId = next;
|
|
2906
|
+
};
|
|
2907
|
+
const resolveModelSelection = (entry) => {
|
|
2908
|
+
if (entry?.modelProvider || entry?.model) return {
|
|
2909
|
+
modelProvider: entry.modelProvider ?? state.sessionInfo.modelProvider,
|
|
2910
|
+
model: entry.model ?? state.sessionInfo.model
|
|
2911
|
+
};
|
|
2912
|
+
const overrideModel = entry?.modelOverride?.trim();
|
|
2913
|
+
if (overrideModel) return {
|
|
2914
|
+
modelProvider: entry?.providerOverride?.trim() || state.sessionInfo.modelProvider,
|
|
2915
|
+
model: overrideModel
|
|
2916
|
+
};
|
|
2917
|
+
return {
|
|
2918
|
+
modelProvider: state.sessionInfo.modelProvider,
|
|
2919
|
+
model: state.sessionInfo.model
|
|
2920
|
+
};
|
|
2921
|
+
};
|
|
2922
|
+
const applySessionInfo = (params) => {
|
|
2923
|
+
const entry = params.entry ?? void 0;
|
|
2924
|
+
const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
|
|
2925
|
+
const previousDefaults = lastSessionDefaults;
|
|
2926
|
+
const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
|
|
2927
|
+
if (params.defaults) lastSessionDefaults = params.defaults;
|
|
2928
|
+
const entryUpdatedAt = entry?.updatedAt ?? null;
|
|
2929
|
+
const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
|
|
2930
|
+
if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged) return;
|
|
2931
|
+
const next = { ...state.sessionInfo };
|
|
2932
|
+
if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
|
|
2933
|
+
if (entry?.fastMode !== void 0) next.fastMode = entry.fastMode;
|
|
2934
|
+
if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
|
|
2935
|
+
if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
|
|
2936
|
+
if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
|
|
2937
|
+
if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
|
|
2938
|
+
if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
|
|
2939
|
+
if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
|
|
2940
|
+
if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
|
|
2941
|
+
if (entry?.displayName !== void 0) next.displayName = entry.displayName;
|
|
2942
|
+
if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
|
|
2943
|
+
const selection = resolveModelSelection(entry);
|
|
2944
|
+
if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
|
|
2945
|
+
if (selection.model !== void 0) next.model = selection.model;
|
|
2946
|
+
state.sessionInfo = next;
|
|
2947
|
+
updateAutocompleteProvider();
|
|
2948
|
+
updateFooter();
|
|
2949
|
+
tui.requestRender();
|
|
2950
|
+
};
|
|
2951
|
+
const runRefreshSessionInfo = async () => {
|
|
2952
|
+
try {
|
|
2953
|
+
const resolveListAgentId = () => {
|
|
2954
|
+
if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
|
|
2955
|
+
const parsed = parseAgentSessionKey(state.currentSessionKey);
|
|
2956
|
+
return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
|
|
2957
|
+
};
|
|
2958
|
+
const listAgentId = resolveListAgentId();
|
|
2959
|
+
const result = await client.listSessions({
|
|
2960
|
+
includeGlobal: false,
|
|
2961
|
+
includeUnknown: false,
|
|
2962
|
+
agentId: listAgentId
|
|
2963
|
+
});
|
|
2964
|
+
const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
|
|
2965
|
+
const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
|
|
2966
|
+
const entry = result.sessions.find((row) => {
|
|
2967
|
+
if (row.key === state.currentSessionKey) return true;
|
|
2968
|
+
return normalizeMatchKey(row.key) === currentMatchKey;
|
|
2969
|
+
});
|
|
2970
|
+
if (entry?.key && entry.key !== state.currentSessionKey) {
|
|
2971
|
+
updateAgentFromSessionKey(entry.key);
|
|
2972
|
+
state.currentSessionKey = entry.key;
|
|
2973
|
+
updateHeader();
|
|
2974
|
+
}
|
|
2975
|
+
applySessionInfo({
|
|
2976
|
+
entry,
|
|
2977
|
+
defaults: result.defaults
|
|
2978
|
+
});
|
|
2979
|
+
} catch (err) {
|
|
2980
|
+
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
2981
|
+
}
|
|
2982
|
+
};
|
|
2983
|
+
const refreshSessionInfo = async () => {
|
|
2984
|
+
refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
|
|
2985
|
+
await refreshSessionInfoPromise;
|
|
2986
|
+
};
|
|
2987
|
+
const applySessionInfoFromPatch = (result) => {
|
|
2988
|
+
if (!result?.entry) return;
|
|
2989
|
+
if (result.key && result.key !== state.currentSessionKey) {
|
|
2990
|
+
updateAgentFromSessionKey(result.key);
|
|
2991
|
+
state.currentSessionKey = result.key;
|
|
2992
|
+
updateHeader();
|
|
2993
|
+
}
|
|
2994
|
+
const resolved = result.resolved;
|
|
2995
|
+
applySessionInfo({
|
|
2996
|
+
entry: resolved && (resolved.modelProvider || resolved.model) ? {
|
|
2997
|
+
...result.entry,
|
|
2998
|
+
modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
|
|
2999
|
+
model: resolved.model ?? result.entry.model
|
|
3000
|
+
} : result.entry,
|
|
3001
|
+
force: true
|
|
3002
|
+
});
|
|
3003
|
+
};
|
|
3004
|
+
const loadHistory = async () => {
|
|
3005
|
+
try {
|
|
3006
|
+
const record = await client.loadHistory({
|
|
3007
|
+
sessionKey: state.currentSessionKey,
|
|
3008
|
+
limit: opts.historyLimit ?? 200
|
|
3009
|
+
});
|
|
3010
|
+
state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
|
|
3011
|
+
state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
|
|
3012
|
+
state.sessionInfo.fastMode = record.fastMode ?? state.sessionInfo.fastMode;
|
|
3013
|
+
state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
|
|
3014
|
+
const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
|
|
3015
|
+
chatLog.clearAll();
|
|
3016
|
+
btw.clear();
|
|
3017
|
+
chatLog.addSystem(`session ${state.currentSessionKey}`);
|
|
3018
|
+
for (const entry of record.messages ?? []) {
|
|
3019
|
+
if (!entry || typeof entry !== "object") continue;
|
|
3020
|
+
const message = entry;
|
|
3021
|
+
if (isCommandMessage(message)) {
|
|
3022
|
+
const text = extractTextFromMessage(message);
|
|
3023
|
+
if (text) chatLog.addSystem(text);
|
|
3024
|
+
continue;
|
|
3025
|
+
}
|
|
3026
|
+
if (message.role === "user") {
|
|
3027
|
+
const text = extractTextFromMessage(message);
|
|
3028
|
+
if (text) chatLog.addUser(text);
|
|
3029
|
+
continue;
|
|
3030
|
+
}
|
|
3031
|
+
if (message.role === "assistant") {
|
|
3032
|
+
const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
|
|
3033
|
+
if (text) chatLog.finalizeAssistant(text);
|
|
3034
|
+
continue;
|
|
3035
|
+
}
|
|
3036
|
+
if (message.role === "toolResult") {
|
|
3037
|
+
if (!showTools) continue;
|
|
3038
|
+
const toolCallId = asString(message.toolCallId, "");
|
|
3039
|
+
const toolName = asString(message.toolName, "tool");
|
|
3040
|
+
chatLog.startTool(toolCallId, toolName, {}).setResult({
|
|
3041
|
+
content: Array.isArray(message.content) ? message.content : [],
|
|
3042
|
+
details: typeof message.details === "object" && message.details ? message.details : void 0
|
|
3043
|
+
}, { isError: Boolean(message.isError) });
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
state.historyLoaded = true;
|
|
3047
|
+
} catch (err) {
|
|
3048
|
+
chatLog.addSystem(`history failed: ${String(err)}`);
|
|
3049
|
+
}
|
|
3050
|
+
await refreshSessionInfo();
|
|
3051
|
+
tui.requestRender();
|
|
3052
|
+
};
|
|
3053
|
+
const setSession = async (rawKey) => {
|
|
3054
|
+
const nextKey = resolveSessionKey(rawKey);
|
|
3055
|
+
updateAgentFromSessionKey(nextKey);
|
|
3056
|
+
state.currentSessionKey = nextKey;
|
|
3057
|
+
state.activeChatRunId = null;
|
|
3058
|
+
state.currentSessionId = null;
|
|
3059
|
+
state.sessionInfo.updatedAt = null;
|
|
3060
|
+
state.historyLoaded = false;
|
|
3061
|
+
clearLocalRunIds?.();
|
|
3062
|
+
btw.clear();
|
|
3063
|
+
updateHeader();
|
|
3064
|
+
updateFooter();
|
|
3065
|
+
await loadHistory();
|
|
3066
|
+
};
|
|
3067
|
+
const abortActive = async () => {
|
|
3068
|
+
if (!state.activeChatRunId) {
|
|
3069
|
+
chatLog.addSystem("no active run");
|
|
3070
|
+
tui.requestRender();
|
|
3071
|
+
return;
|
|
3072
|
+
}
|
|
3073
|
+
try {
|
|
3074
|
+
await client.abortChat({
|
|
3075
|
+
sessionKey: state.currentSessionKey,
|
|
3076
|
+
runId: state.activeChatRunId
|
|
3077
|
+
});
|
|
3078
|
+
setActivityStatus("aborted");
|
|
3079
|
+
} catch (err) {
|
|
3080
|
+
chatLog.addSystem(`abort failed: ${String(err)}`);
|
|
3081
|
+
setActivityStatus("abort failed");
|
|
3082
|
+
}
|
|
3083
|
+
tui.requestRender();
|
|
3084
|
+
};
|
|
3085
|
+
return {
|
|
3086
|
+
applyAgentsResult,
|
|
3087
|
+
refreshAgents,
|
|
3088
|
+
refreshSessionInfo,
|
|
3089
|
+
applySessionInfoFromPatch,
|
|
3090
|
+
loadHistory,
|
|
3091
|
+
setSession,
|
|
3092
|
+
abortActive
|
|
3093
|
+
};
|
|
3094
|
+
}
|
|
3095
|
+
//#endregion
|
|
3096
|
+
//#region src/tui/tui-submit.ts
|
|
3097
|
+
function createEditorSubmitHandler(params) {
|
|
3098
|
+
return (text) => {
|
|
3099
|
+
const raw = text;
|
|
3100
|
+
const value = raw.trim();
|
|
3101
|
+
params.editor.setText("");
|
|
3102
|
+
if (!value) return;
|
|
3103
|
+
if (raw.startsWith("!") && raw !== "!") {
|
|
3104
|
+
params.editor.addToHistory(raw);
|
|
3105
|
+
params.handleBangLine(raw);
|
|
3106
|
+
return;
|
|
3107
|
+
}
|
|
3108
|
+
params.editor.addToHistory(value);
|
|
3109
|
+
if (value.startsWith("/")) {
|
|
3110
|
+
params.handleCommand(value);
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
params.sendMessage(value);
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
function shouldEnableWindowsGitBashPasteFallback(params) {
|
|
3117
|
+
const platform = params?.platform ?? process.platform;
|
|
3118
|
+
const env = params?.env ?? process.env;
|
|
3119
|
+
const termProgram = (env.TERM_PROGRAM ?? "").toLowerCase();
|
|
3120
|
+
if (platform === "darwin") {
|
|
3121
|
+
if (termProgram.includes("iterm") || termProgram.includes("apple_terminal")) return true;
|
|
3122
|
+
return false;
|
|
3123
|
+
}
|
|
3124
|
+
if (platform !== "win32") return false;
|
|
3125
|
+
const msystem = (env.MSYSTEM ?? "").toUpperCase();
|
|
3126
|
+
const shell = env.SHELL ?? "";
|
|
3127
|
+
if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) return true;
|
|
3128
|
+
if (shell.toLowerCase().includes("bash")) return true;
|
|
3129
|
+
return termProgram.includes("mintty");
|
|
3130
|
+
}
|
|
3131
|
+
function createSubmitBurstCoalescer(params) {
|
|
3132
|
+
const windowMs = Math.max(1, params.burstWindowMs ?? 50);
|
|
3133
|
+
const now = params.now ?? (() => Date.now());
|
|
3134
|
+
const setTimer = params.setTimer ?? setTimeout;
|
|
3135
|
+
const clearTimer = params.clearTimer ?? clearTimeout;
|
|
3136
|
+
let pending = null;
|
|
3137
|
+
let pendingAt = 0;
|
|
3138
|
+
let flushTimer = null;
|
|
3139
|
+
const clearFlushTimer = () => {
|
|
3140
|
+
if (!flushTimer) return;
|
|
3141
|
+
clearTimer(flushTimer);
|
|
3142
|
+
flushTimer = null;
|
|
3143
|
+
};
|
|
3144
|
+
const flushPending = () => {
|
|
3145
|
+
if (pending === null) return;
|
|
3146
|
+
const value = pending;
|
|
3147
|
+
pending = null;
|
|
3148
|
+
pendingAt = 0;
|
|
3149
|
+
clearFlushTimer();
|
|
3150
|
+
params.submit(value);
|
|
3151
|
+
};
|
|
3152
|
+
const scheduleFlush = () => {
|
|
3153
|
+
clearFlushTimer();
|
|
3154
|
+
flushTimer = setTimer(() => {
|
|
3155
|
+
flushPending();
|
|
3156
|
+
}, windowMs);
|
|
3157
|
+
};
|
|
3158
|
+
return (value) => {
|
|
3159
|
+
if (!params.enabled) {
|
|
3160
|
+
params.submit(value);
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
if (value.includes("\n")) {
|
|
3164
|
+
flushPending();
|
|
3165
|
+
params.submit(value);
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
const ts = now();
|
|
3169
|
+
if (pending === null) {
|
|
3170
|
+
pending = value;
|
|
3171
|
+
pendingAt = ts;
|
|
3172
|
+
scheduleFlush();
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
if (ts - pendingAt <= windowMs) {
|
|
3176
|
+
pending = `${pending}\n${value}`;
|
|
3177
|
+
pendingAt = ts;
|
|
3178
|
+
scheduleFlush();
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
flushPending();
|
|
3182
|
+
pending = value;
|
|
3183
|
+
pendingAt = ts;
|
|
3184
|
+
scheduleFlush();
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
//#endregion
|
|
3188
|
+
//#region src/tui/tui-waiting.ts
|
|
3189
|
+
const defaultWaitingPhrases = [
|
|
3190
|
+
"flibbertigibbeting",
|
|
3191
|
+
"kerfuffling",
|
|
3192
|
+
"dillydallying",
|
|
3193
|
+
"twiddling thumbs",
|
|
3194
|
+
"noodling",
|
|
3195
|
+
"bamboozling",
|
|
3196
|
+
"moseying",
|
|
3197
|
+
"hobnobbing",
|
|
3198
|
+
"pondering",
|
|
3199
|
+
"conjuring"
|
|
3200
|
+
];
|
|
3201
|
+
function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
|
|
3202
|
+
return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
|
|
3203
|
+
}
|
|
3204
|
+
function shimmerText(theme, text, tick) {
|
|
3205
|
+
const width = 6;
|
|
3206
|
+
const hi = (ch) => theme.bold(theme.accentSoft(ch));
|
|
3207
|
+
const pos = tick % (text.length + width);
|
|
3208
|
+
const start = Math.max(0, pos - width);
|
|
3209
|
+
const end = Math.min(text.length - 1, pos);
|
|
3210
|
+
let out = "";
|
|
3211
|
+
for (let i = 0; i < text.length; i++) {
|
|
3212
|
+
const ch = text[i];
|
|
3213
|
+
out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
|
|
3214
|
+
}
|
|
3215
|
+
return out;
|
|
3216
|
+
}
|
|
3217
|
+
function buildWaitingStatusMessage(params) {
|
|
3218
|
+
const phrase = pickWaitingPhrase(params.tick, params.phrases);
|
|
3219
|
+
return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
|
|
3220
|
+
}
|
|
3221
|
+
//#endregion
|
|
3222
|
+
//#region src/tui/tui.ts
|
|
3223
|
+
function resolveTuiSessionKey(params) {
|
|
3224
|
+
const trimmed = (params.raw ?? "").trim();
|
|
3225
|
+
if (!trimmed) {
|
|
3226
|
+
if (params.sessionScope === "global") return "global";
|
|
3227
|
+
return buildAgentMainSessionKey({
|
|
3228
|
+
agentId: params.currentAgentId,
|
|
3229
|
+
mainKey: params.sessionMainKey
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
if (trimmed === "global" || trimmed === "unknown") return trimmed;
|
|
3233
|
+
if (trimmed.startsWith("agent:")) return trimmed.toLowerCase();
|
|
3234
|
+
return `agent:${params.currentAgentId}:${trimmed.toLowerCase()}`;
|
|
3235
|
+
}
|
|
3236
|
+
function resolveInitialTuiAgentId(params) {
|
|
3237
|
+
const parsed = parseAgentSessionKey((params.initialSessionInput ?? "").trim());
|
|
3238
|
+
if (parsed?.agentId) return normalizeAgentId(parsed.agentId);
|
|
3239
|
+
const inferredFromWorkspace = resolveAgentIdByWorkspacePath(params.cfg, params.cwd ?? process.cwd());
|
|
3240
|
+
if (inferredFromWorkspace) return inferredFromWorkspace;
|
|
3241
|
+
return normalizeAgentId(params.fallbackAgentId);
|
|
3242
|
+
}
|
|
3243
|
+
function resolveGatewayDisconnectState(reason) {
|
|
3244
|
+
const reasonLabel = reason?.trim() ? reason.trim() : "closed";
|
|
3245
|
+
if (/pairing required/i.test(reasonLabel)) return {
|
|
3246
|
+
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3247
|
+
activityStatus: "pairing required: run vora devices list",
|
|
3248
|
+
pairingHint: "Pairing required. Run `vora devices list`, approve your request ID, then reconnect."
|
|
3249
|
+
};
|
|
3250
|
+
return {
|
|
3251
|
+
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3252
|
+
activityStatus: "idle"
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
function createBackspaceDeduper(params) {
|
|
3256
|
+
const dedupeWindowMs = Math.max(0, Math.floor(params?.dedupeWindowMs ?? 8));
|
|
3257
|
+
const now = params?.now ?? (() => Date.now());
|
|
3258
|
+
let lastBackspaceAt = -1;
|
|
3259
|
+
return (data) => {
|
|
3260
|
+
if (!matchesKey(data, Key.backspace)) return data;
|
|
3261
|
+
const ts = now();
|
|
3262
|
+
if (lastBackspaceAt >= 0 && ts - lastBackspaceAt <= dedupeWindowMs) return "";
|
|
3263
|
+
lastBackspaceAt = ts;
|
|
3264
|
+
return data;
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
function isIgnorableTuiStopError(error) {
|
|
3268
|
+
if (!error || typeof error !== "object") return false;
|
|
3269
|
+
const err = error;
|
|
3270
|
+
const code = typeof err.code === "string" ? err.code : "";
|
|
3271
|
+
const syscall = typeof err.syscall === "string" ? err.syscall : "";
|
|
3272
|
+
const message = typeof err.message === "string" ? err.message : "";
|
|
3273
|
+
if (code === "EBADF" && syscall === "setRawMode") return true;
|
|
3274
|
+
return /setRawMode/i.test(message) && /EBADF/i.test(message);
|
|
3275
|
+
}
|
|
3276
|
+
function stopTuiSafely(stop) {
|
|
3277
|
+
try {
|
|
3278
|
+
stop();
|
|
3279
|
+
} catch (error) {
|
|
3280
|
+
if (!isIgnorableTuiStopError(error)) throw error;
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
function resolveCtrlCAction(params) {
|
|
3284
|
+
const exitWindowMs = Math.max(1, Math.floor(params.exitWindowMs ?? 1e3));
|
|
3285
|
+
if (params.hasInput) return {
|
|
3286
|
+
action: "clear",
|
|
3287
|
+
nextLastCtrlCAt: params.now
|
|
3288
|
+
};
|
|
3289
|
+
if (params.now - params.lastCtrlCAt <= exitWindowMs) return {
|
|
3290
|
+
action: "exit",
|
|
3291
|
+
nextLastCtrlCAt: params.lastCtrlCAt
|
|
3292
|
+
};
|
|
3293
|
+
return {
|
|
3294
|
+
action: "warn",
|
|
3295
|
+
nextLastCtrlCAt: params.now
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
async function runTui(opts) {
|
|
3299
|
+
const config = loadConfig();
|
|
3300
|
+
const initialSessionInput = (opts.session ?? "").trim();
|
|
3301
|
+
let sessionScope = config.session?.scope ?? "per-sender";
|
|
3302
|
+
let sessionMainKey = normalizeMainKey(config.session?.mainKey);
|
|
3303
|
+
let agentDefaultId = resolveDefaultAgentId(config);
|
|
3304
|
+
let currentAgentId = resolveInitialTuiAgentId({
|
|
3305
|
+
cfg: config,
|
|
3306
|
+
fallbackAgentId: agentDefaultId,
|
|
3307
|
+
initialSessionInput,
|
|
3308
|
+
cwd: process.cwd()
|
|
3309
|
+
});
|
|
3310
|
+
let agents = [];
|
|
3311
|
+
const agentNames = /* @__PURE__ */ new Map();
|
|
3312
|
+
let currentSessionKey = "";
|
|
3313
|
+
let initialSessionApplied = false;
|
|
3314
|
+
let currentSessionId = null;
|
|
3315
|
+
let activeChatRunId = null;
|
|
3316
|
+
let pendingOptimisticUserMessage = false;
|
|
3317
|
+
let historyLoaded = false;
|
|
3318
|
+
let isConnected = false;
|
|
3319
|
+
let wasDisconnected = false;
|
|
3320
|
+
let toolsExpanded = false;
|
|
3321
|
+
let showThinking = false;
|
|
3322
|
+
let pairingHintShown = false;
|
|
3323
|
+
const localRunIds = /* @__PURE__ */ new Set();
|
|
3324
|
+
const localBtwRunIds = /* @__PURE__ */ new Set();
|
|
3325
|
+
const deliverDefault = opts.deliver ?? false;
|
|
3326
|
+
const autoMessage = opts.message?.trim();
|
|
3327
|
+
let autoMessageSent = false;
|
|
3328
|
+
let sessionInfo = {};
|
|
3329
|
+
let lastCtrlCAt = 0;
|
|
3330
|
+
let exitRequested = false;
|
|
3331
|
+
let activityStatus = "idle";
|
|
3332
|
+
let connectionStatus = "connecting";
|
|
3333
|
+
let statusTimeout = null;
|
|
3334
|
+
let statusTimer = null;
|
|
3335
|
+
let statusStartedAt = null;
|
|
3336
|
+
let lastActivityStatus = activityStatus;
|
|
3337
|
+
const state = {
|
|
3338
|
+
get agentDefaultId() {
|
|
3339
|
+
return agentDefaultId;
|
|
3340
|
+
},
|
|
3341
|
+
set agentDefaultId(value) {
|
|
3342
|
+
agentDefaultId = value;
|
|
3343
|
+
},
|
|
3344
|
+
get sessionMainKey() {
|
|
3345
|
+
return sessionMainKey;
|
|
3346
|
+
},
|
|
3347
|
+
set sessionMainKey(value) {
|
|
3348
|
+
sessionMainKey = value;
|
|
3349
|
+
},
|
|
3350
|
+
get sessionScope() {
|
|
3351
|
+
return sessionScope;
|
|
3352
|
+
},
|
|
3353
|
+
set sessionScope(value) {
|
|
3354
|
+
sessionScope = value;
|
|
3355
|
+
},
|
|
3356
|
+
get agents() {
|
|
3357
|
+
return agents;
|
|
3358
|
+
},
|
|
3359
|
+
set agents(value) {
|
|
3360
|
+
agents = value;
|
|
3361
|
+
},
|
|
3362
|
+
get currentAgentId() {
|
|
3363
|
+
return currentAgentId;
|
|
3364
|
+
},
|
|
3365
|
+
set currentAgentId(value) {
|
|
3366
|
+
currentAgentId = value;
|
|
3367
|
+
},
|
|
3368
|
+
get currentSessionKey() {
|
|
3369
|
+
return currentSessionKey;
|
|
3370
|
+
},
|
|
3371
|
+
set currentSessionKey(value) {
|
|
3372
|
+
currentSessionKey = value;
|
|
3373
|
+
},
|
|
3374
|
+
get currentSessionId() {
|
|
3375
|
+
return currentSessionId;
|
|
3376
|
+
},
|
|
3377
|
+
set currentSessionId(value) {
|
|
3378
|
+
currentSessionId = value;
|
|
3379
|
+
},
|
|
3380
|
+
get activeChatRunId() {
|
|
3381
|
+
return activeChatRunId;
|
|
3382
|
+
},
|
|
3383
|
+
set activeChatRunId(value) {
|
|
3384
|
+
activeChatRunId = value;
|
|
3385
|
+
},
|
|
3386
|
+
get pendingOptimisticUserMessage() {
|
|
3387
|
+
return pendingOptimisticUserMessage;
|
|
3388
|
+
},
|
|
3389
|
+
set pendingOptimisticUserMessage(value) {
|
|
3390
|
+
pendingOptimisticUserMessage = value;
|
|
3391
|
+
},
|
|
3392
|
+
get historyLoaded() {
|
|
3393
|
+
return historyLoaded;
|
|
3394
|
+
},
|
|
3395
|
+
set historyLoaded(value) {
|
|
3396
|
+
historyLoaded = value;
|
|
3397
|
+
},
|
|
3398
|
+
get sessionInfo() {
|
|
3399
|
+
return sessionInfo;
|
|
3400
|
+
},
|
|
3401
|
+
set sessionInfo(value) {
|
|
3402
|
+
sessionInfo = value;
|
|
3403
|
+
},
|
|
3404
|
+
get initialSessionApplied() {
|
|
3405
|
+
return initialSessionApplied;
|
|
3406
|
+
},
|
|
3407
|
+
set initialSessionApplied(value) {
|
|
3408
|
+
initialSessionApplied = value;
|
|
3409
|
+
},
|
|
3410
|
+
get isConnected() {
|
|
3411
|
+
return isConnected;
|
|
3412
|
+
},
|
|
3413
|
+
set isConnected(value) {
|
|
3414
|
+
isConnected = value;
|
|
3415
|
+
},
|
|
3416
|
+
get autoMessageSent() {
|
|
3417
|
+
return autoMessageSent;
|
|
3418
|
+
},
|
|
3419
|
+
set autoMessageSent(value) {
|
|
3420
|
+
autoMessageSent = value;
|
|
3421
|
+
},
|
|
3422
|
+
get toolsExpanded() {
|
|
3423
|
+
return toolsExpanded;
|
|
3424
|
+
},
|
|
3425
|
+
set toolsExpanded(value) {
|
|
3426
|
+
toolsExpanded = value;
|
|
3427
|
+
},
|
|
3428
|
+
get showThinking() {
|
|
3429
|
+
return showThinking;
|
|
3430
|
+
},
|
|
3431
|
+
set showThinking(value) {
|
|
3432
|
+
showThinking = value;
|
|
3433
|
+
},
|
|
3434
|
+
get connectionStatus() {
|
|
3435
|
+
return connectionStatus;
|
|
3436
|
+
},
|
|
3437
|
+
set connectionStatus(value) {
|
|
3438
|
+
connectionStatus = value;
|
|
3439
|
+
},
|
|
3440
|
+
get activityStatus() {
|
|
3441
|
+
return activityStatus;
|
|
3442
|
+
},
|
|
3443
|
+
set activityStatus(value) {
|
|
3444
|
+
activityStatus = value;
|
|
3445
|
+
},
|
|
3446
|
+
get statusTimeout() {
|
|
3447
|
+
return statusTimeout;
|
|
3448
|
+
},
|
|
3449
|
+
set statusTimeout(value) {
|
|
3450
|
+
statusTimeout = value;
|
|
3451
|
+
},
|
|
3452
|
+
get lastCtrlCAt() {
|
|
3453
|
+
return lastCtrlCAt;
|
|
3454
|
+
},
|
|
3455
|
+
set lastCtrlCAt(value) {
|
|
3456
|
+
lastCtrlCAt = value;
|
|
3457
|
+
}
|
|
3458
|
+
};
|
|
3459
|
+
const noteLocalRunId = (runId) => {
|
|
3460
|
+
if (!runId) return;
|
|
3461
|
+
localRunIds.add(runId);
|
|
3462
|
+
if (localRunIds.size > 200) {
|
|
3463
|
+
const [first] = localRunIds;
|
|
3464
|
+
if (first) localRunIds.delete(first);
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3467
|
+
const forgetLocalRunId = (runId) => {
|
|
3468
|
+
localRunIds.delete(runId);
|
|
3469
|
+
};
|
|
3470
|
+
const isLocalRunId = (runId) => localRunIds.has(runId);
|
|
3471
|
+
const clearLocalRunIds = () => {
|
|
3472
|
+
localRunIds.clear();
|
|
3473
|
+
};
|
|
3474
|
+
const noteLocalBtwRunId = (runId) => {
|
|
3475
|
+
if (!runId) return;
|
|
3476
|
+
localBtwRunIds.add(runId);
|
|
3477
|
+
if (localBtwRunIds.size > 200) {
|
|
3478
|
+
const [first] = localBtwRunIds;
|
|
3479
|
+
if (first) localBtwRunIds.delete(first);
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
const forgetLocalBtwRunId = (runId) => {
|
|
3483
|
+
localBtwRunIds.delete(runId);
|
|
3484
|
+
};
|
|
3485
|
+
const isLocalBtwRunId = (runId) => localBtwRunIds.has(runId);
|
|
3486
|
+
const clearLocalBtwRunIds = () => {
|
|
3487
|
+
localBtwRunIds.clear();
|
|
3488
|
+
};
|
|
3489
|
+
const client = await GatewayChatClient.connect({
|
|
3490
|
+
url: opts.url,
|
|
3491
|
+
token: opts.token,
|
|
3492
|
+
password: opts.password
|
|
3493
|
+
});
|
|
3494
|
+
const tui = new TUI(new ProcessTerminal());
|
|
3495
|
+
const dedupeBackspace = createBackspaceDeduper();
|
|
3496
|
+
tui.addInputListener((data) => {
|
|
3497
|
+
const next = dedupeBackspace(data);
|
|
3498
|
+
if (next.length === 0) return { consume: true };
|
|
3499
|
+
return { data: next };
|
|
3500
|
+
});
|
|
3501
|
+
const header = new Text("", 1, 0);
|
|
3502
|
+
const statusContainer = new Container();
|
|
3503
|
+
const footer = new Text("", 1, 0);
|
|
3504
|
+
const chatLog = new ChatLog();
|
|
3505
|
+
const editor = new CustomEditor(tui, editorTheme);
|
|
3506
|
+
const root = new Container();
|
|
3507
|
+
root.addChild(header);
|
|
3508
|
+
root.addChild(chatLog);
|
|
3509
|
+
root.addChild(statusContainer);
|
|
3510
|
+
root.addChild(footer);
|
|
3511
|
+
root.addChild(editor);
|
|
3512
|
+
const updateAutocompleteProvider = () => {
|
|
3513
|
+
editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
|
|
3514
|
+
cfg: config,
|
|
3515
|
+
provider: sessionInfo.modelProvider,
|
|
3516
|
+
model: sessionInfo.model
|
|
3517
|
+
}), process.cwd()));
|
|
3518
|
+
};
|
|
3519
|
+
tui.addChild(root);
|
|
3520
|
+
tui.setFocus(editor);
|
|
3521
|
+
const formatSessionKey = (key) => {
|
|
3522
|
+
if (key === "global" || key === "unknown") return key;
|
|
3523
|
+
return parseAgentSessionKey(key)?.rest ?? key;
|
|
3524
|
+
};
|
|
3525
|
+
const formatAgentLabel = (id) => {
|
|
3526
|
+
const name = agentNames.get(id);
|
|
3527
|
+
return name ? `${id} (${name})` : id;
|
|
3528
|
+
};
|
|
3529
|
+
const resolveSessionKey = (raw) => {
|
|
3530
|
+
return resolveTuiSessionKey({
|
|
3531
|
+
raw,
|
|
3532
|
+
sessionScope,
|
|
3533
|
+
currentAgentId,
|
|
3534
|
+
sessionMainKey
|
|
3535
|
+
});
|
|
3536
|
+
};
|
|
3537
|
+
currentSessionKey = resolveSessionKey(initialSessionInput);
|
|
3538
|
+
const updateHeader = () => {
|
|
3539
|
+
const sessionLabel = formatSessionKey(currentSessionKey);
|
|
3540
|
+
const agentLabel = formatAgentLabel(currentAgentId);
|
|
3541
|
+
header.setText(theme.header(`vora tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
|
|
3542
|
+
};
|
|
3543
|
+
const busyStates = new Set([
|
|
3544
|
+
"sending",
|
|
3545
|
+
"waiting",
|
|
3546
|
+
"streaming",
|
|
3547
|
+
"running"
|
|
3548
|
+
]);
|
|
3549
|
+
let statusText = null;
|
|
3550
|
+
let statusLoader = null;
|
|
3551
|
+
const formatElapsed = (startMs) => {
|
|
3552
|
+
const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
|
|
3553
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
3554
|
+
return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
|
|
3555
|
+
};
|
|
3556
|
+
const ensureStatusText = () => {
|
|
3557
|
+
if (statusText) return;
|
|
3558
|
+
statusContainer.clear();
|
|
3559
|
+
statusLoader?.stop();
|
|
3560
|
+
statusLoader = null;
|
|
3561
|
+
statusText = new Text("", 1, 0);
|
|
3562
|
+
statusContainer.addChild(statusText);
|
|
3563
|
+
};
|
|
3564
|
+
const ensureStatusLoader = () => {
|
|
3565
|
+
if (statusLoader) return;
|
|
3566
|
+
statusContainer.clear();
|
|
3567
|
+
statusText = null;
|
|
3568
|
+
statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
|
|
3569
|
+
statusContainer.addChild(statusLoader);
|
|
3570
|
+
};
|
|
3571
|
+
let waitingTick = 0;
|
|
3572
|
+
let waitingTimer = null;
|
|
3573
|
+
let waitingPhrase = null;
|
|
3574
|
+
const updateBusyStatusMessage = () => {
|
|
3575
|
+
if (!statusLoader || !statusStartedAt) return;
|
|
3576
|
+
const elapsed = formatElapsed(statusStartedAt);
|
|
3577
|
+
if (activityStatus === "waiting") {
|
|
3578
|
+
waitingTick++;
|
|
3579
|
+
statusLoader.setMessage(buildWaitingStatusMessage({
|
|
3580
|
+
theme,
|
|
3581
|
+
tick: waitingTick,
|
|
3582
|
+
elapsed,
|
|
3583
|
+
connectionStatus,
|
|
3584
|
+
phrases: waitingPhrase ? [waitingPhrase] : void 0
|
|
3585
|
+
}));
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
|
|
3589
|
+
};
|
|
3590
|
+
const startStatusTimer = () => {
|
|
3591
|
+
if (statusTimer) return;
|
|
3592
|
+
statusTimer = setInterval(() => {
|
|
3593
|
+
if (!busyStates.has(activityStatus)) return;
|
|
3594
|
+
updateBusyStatusMessage();
|
|
3595
|
+
}, 1e3);
|
|
3596
|
+
};
|
|
3597
|
+
const stopStatusTimer = () => {
|
|
3598
|
+
if (!statusTimer) return;
|
|
3599
|
+
clearInterval(statusTimer);
|
|
3600
|
+
statusTimer = null;
|
|
3601
|
+
};
|
|
3602
|
+
const startWaitingTimer = () => {
|
|
3603
|
+
if (waitingTimer) return;
|
|
3604
|
+
if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
|
|
3605
|
+
waitingTick = 0;
|
|
3606
|
+
waitingTimer = setInterval(() => {
|
|
3607
|
+
if (activityStatus !== "waiting") return;
|
|
3608
|
+
updateBusyStatusMessage();
|
|
3609
|
+
}, 120);
|
|
3610
|
+
};
|
|
3611
|
+
const stopWaitingTimer = () => {
|
|
3612
|
+
if (!waitingTimer) return;
|
|
3613
|
+
clearInterval(waitingTimer);
|
|
3614
|
+
waitingTimer = null;
|
|
3615
|
+
waitingPhrase = null;
|
|
3616
|
+
};
|
|
3617
|
+
const renderStatus = () => {
|
|
3618
|
+
if (busyStates.has(activityStatus)) {
|
|
3619
|
+
if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
|
|
3620
|
+
ensureStatusLoader();
|
|
3621
|
+
if (activityStatus === "waiting") {
|
|
3622
|
+
stopStatusTimer();
|
|
3623
|
+
startWaitingTimer();
|
|
3624
|
+
} else {
|
|
3625
|
+
stopWaitingTimer();
|
|
3626
|
+
startStatusTimer();
|
|
3627
|
+
}
|
|
3628
|
+
updateBusyStatusMessage();
|
|
3629
|
+
} else {
|
|
3630
|
+
statusStartedAt = null;
|
|
3631
|
+
stopStatusTimer();
|
|
3632
|
+
stopWaitingTimer();
|
|
3633
|
+
statusLoader?.stop();
|
|
3634
|
+
statusLoader = null;
|
|
3635
|
+
ensureStatusText();
|
|
3636
|
+
const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
|
|
3637
|
+
statusText?.setText(theme.dim(text));
|
|
3638
|
+
}
|
|
3639
|
+
lastActivityStatus = activityStatus;
|
|
3640
|
+
};
|
|
3641
|
+
const setConnectionStatus = (text, ttlMs) => {
|
|
3642
|
+
connectionStatus = text;
|
|
3643
|
+
renderStatus();
|
|
3644
|
+
if (statusTimeout) clearTimeout(statusTimeout);
|
|
3645
|
+
if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
|
|
3646
|
+
connectionStatus = isConnected ? "connected" : "disconnected";
|
|
3647
|
+
renderStatus();
|
|
3648
|
+
}, ttlMs);
|
|
3649
|
+
};
|
|
3650
|
+
const setActivityStatus = (text) => {
|
|
3651
|
+
activityStatus = text;
|
|
3652
|
+
renderStatus();
|
|
3653
|
+
};
|
|
3654
|
+
const updateFooter = () => {
|
|
3655
|
+
const sessionKeyLabel = formatSessionKey(currentSessionKey);
|
|
3656
|
+
const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
|
|
3657
|
+
const agentLabel = formatAgentLabel(currentAgentId);
|
|
3658
|
+
const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
|
|
3659
|
+
const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
|
|
3660
|
+
const think = sessionInfo.thinkingLevel ?? "off";
|
|
3661
|
+
const fast = sessionInfo.fastMode === true;
|
|
3662
|
+
const verbose = sessionInfo.verboseLevel ?? "off";
|
|
3663
|
+
const reasoning = sessionInfo.reasoningLevel ?? "off";
|
|
3664
|
+
const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
|
|
3665
|
+
const footerParts = [
|
|
3666
|
+
`agent ${agentLabel}`,
|
|
3667
|
+
`session ${sessionLabel}`,
|
|
3668
|
+
modelLabel,
|
|
3669
|
+
think !== "off" ? `think ${think}` : null,
|
|
3670
|
+
fast ? "fast" : null,
|
|
3671
|
+
verbose !== "off" ? `verbose ${verbose}` : null,
|
|
3672
|
+
reasoningLabel,
|
|
3673
|
+
tokens
|
|
3674
|
+
].filter(Boolean);
|
|
3675
|
+
footer.setText(theme.dim(footerParts.join(" | ")));
|
|
3676
|
+
};
|
|
3677
|
+
const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
|
|
3678
|
+
const btw = {
|
|
3679
|
+
showResult: (params) => {
|
|
3680
|
+
chatLog.showBtw(params);
|
|
3681
|
+
},
|
|
3682
|
+
clear: () => {
|
|
3683
|
+
chatLog.dismissBtw();
|
|
3684
|
+
}
|
|
3685
|
+
};
|
|
3686
|
+
const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
|
|
3687
|
+
client,
|
|
3688
|
+
chatLog,
|
|
3689
|
+
btw,
|
|
3690
|
+
tui,
|
|
3691
|
+
opts,
|
|
3692
|
+
state,
|
|
3693
|
+
agentNames,
|
|
3694
|
+
initialSessionInput,
|
|
3695
|
+
initialSessionAgentId: (() => {
|
|
3696
|
+
if (!initialSessionInput) return null;
|
|
3697
|
+
const parsed = parseAgentSessionKey(initialSessionInput);
|
|
3698
|
+
return parsed ? normalizeAgentId(parsed.agentId) : null;
|
|
3699
|
+
})(),
|
|
3700
|
+
resolveSessionKey,
|
|
3701
|
+
updateHeader,
|
|
3702
|
+
updateFooter,
|
|
3703
|
+
updateAutocompleteProvider,
|
|
3704
|
+
setActivityStatus,
|
|
3705
|
+
clearLocalRunIds
|
|
3706
|
+
});
|
|
3707
|
+
const { handleChatEvent, handleAgentEvent, handleBtwEvent } = createEventHandlers({
|
|
3708
|
+
chatLog,
|
|
3709
|
+
btw,
|
|
3710
|
+
tui,
|
|
3711
|
+
state,
|
|
3712
|
+
setActivityStatus,
|
|
3713
|
+
refreshSessionInfo,
|
|
3714
|
+
loadHistory,
|
|
3715
|
+
noteLocalRunId,
|
|
3716
|
+
isLocalRunId,
|
|
3717
|
+
forgetLocalRunId,
|
|
3718
|
+
clearLocalRunIds,
|
|
3719
|
+
isLocalBtwRunId,
|
|
3720
|
+
forgetLocalBtwRunId,
|
|
3721
|
+
clearLocalBtwRunIds
|
|
3722
|
+
});
|
|
3723
|
+
const requestExit = () => {
|
|
3724
|
+
if (exitRequested) return;
|
|
3725
|
+
exitRequested = true;
|
|
3726
|
+
client.stop();
|
|
3727
|
+
stopTuiSafely(() => tui.stop());
|
|
3728
|
+
process.exit(0);
|
|
3729
|
+
};
|
|
3730
|
+
const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
|
|
3731
|
+
client,
|
|
3732
|
+
chatLog,
|
|
3733
|
+
tui,
|
|
3734
|
+
opts,
|
|
3735
|
+
state,
|
|
3736
|
+
deliverDefault,
|
|
3737
|
+
openOverlay,
|
|
3738
|
+
closeOverlay,
|
|
3739
|
+
refreshSessionInfo,
|
|
3740
|
+
applySessionInfoFromPatch,
|
|
3741
|
+
loadHistory,
|
|
3742
|
+
setSession,
|
|
3743
|
+
refreshAgents,
|
|
3744
|
+
abortActive,
|
|
3745
|
+
setActivityStatus,
|
|
3746
|
+
formatSessionKey,
|
|
3747
|
+
noteLocalRunId,
|
|
3748
|
+
noteLocalBtwRunId,
|
|
3749
|
+
forgetLocalRunId,
|
|
3750
|
+
forgetLocalBtwRunId,
|
|
3751
|
+
requestExit
|
|
3752
|
+
});
|
|
3753
|
+
const { runLocalShellLine } = createLocalShellRunner({
|
|
3754
|
+
chatLog,
|
|
3755
|
+
tui,
|
|
3756
|
+
openOverlay,
|
|
3757
|
+
closeOverlay
|
|
3758
|
+
});
|
|
3759
|
+
updateAutocompleteProvider();
|
|
3760
|
+
editor.onSubmit = createSubmitBurstCoalescer({
|
|
3761
|
+
submit: createEditorSubmitHandler({
|
|
3762
|
+
editor,
|
|
3763
|
+
handleCommand,
|
|
3764
|
+
sendMessage,
|
|
3765
|
+
handleBangLine: runLocalShellLine
|
|
3766
|
+
}),
|
|
3767
|
+
enabled: shouldEnableWindowsGitBashPasteFallback()
|
|
3768
|
+
});
|
|
3769
|
+
editor.onEscape = () => {
|
|
3770
|
+
if (chatLog.hasVisibleBtw()) {
|
|
3771
|
+
chatLog.dismissBtw();
|
|
3772
|
+
tui.requestRender();
|
|
3773
|
+
return;
|
|
3774
|
+
}
|
|
3775
|
+
abortActive();
|
|
3776
|
+
};
|
|
3777
|
+
const handleCtrlC = () => {
|
|
3778
|
+
const now = Date.now();
|
|
3779
|
+
const decision = resolveCtrlCAction({
|
|
3780
|
+
hasInput: editor.getText().trim().length > 0,
|
|
3781
|
+
now,
|
|
3782
|
+
lastCtrlCAt
|
|
3783
|
+
});
|
|
3784
|
+
lastCtrlCAt = decision.nextLastCtrlCAt;
|
|
3785
|
+
if (decision.action === "clear") {
|
|
3786
|
+
editor.setText("");
|
|
3787
|
+
setActivityStatus("cleared input; press ctrl+c again to exit");
|
|
3788
|
+
tui.requestRender();
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
if (decision.action === "exit") {
|
|
3792
|
+
requestExit();
|
|
3793
|
+
return;
|
|
3794
|
+
}
|
|
3795
|
+
setActivityStatus("press ctrl+c again to exit");
|
|
3796
|
+
tui.requestRender();
|
|
3797
|
+
};
|
|
3798
|
+
editor.onCtrlC = () => {
|
|
3799
|
+
handleCtrlC();
|
|
3800
|
+
};
|
|
3801
|
+
editor.onCtrlD = () => {
|
|
3802
|
+
requestExit();
|
|
3803
|
+
};
|
|
3804
|
+
editor.onCtrlO = () => {
|
|
3805
|
+
toolsExpanded = !toolsExpanded;
|
|
3806
|
+
chatLog.setToolsExpanded(toolsExpanded);
|
|
3807
|
+
setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
|
|
3808
|
+
tui.requestRender();
|
|
3809
|
+
};
|
|
3810
|
+
editor.onCtrlL = () => {
|
|
3811
|
+
openModelSelector();
|
|
3812
|
+
};
|
|
3813
|
+
editor.onCtrlG = () => {
|
|
3814
|
+
openAgentSelector();
|
|
3815
|
+
};
|
|
3816
|
+
editor.onCtrlP = () => {
|
|
3817
|
+
openSessionSelector();
|
|
3818
|
+
};
|
|
3819
|
+
editor.onCtrlT = () => {
|
|
3820
|
+
showThinking = !showThinking;
|
|
3821
|
+
loadHistory();
|
|
3822
|
+
};
|
|
3823
|
+
tui.addInputListener((data) => {
|
|
3824
|
+
if (!chatLog.hasVisibleBtw()) return;
|
|
3825
|
+
if (editor.getText().length > 0) return;
|
|
3826
|
+
if (matchesKey(data, "enter")) {
|
|
3827
|
+
chatLog.dismissBtw();
|
|
3828
|
+
tui.requestRender();
|
|
3829
|
+
return { consume: true };
|
|
3830
|
+
}
|
|
3831
|
+
});
|
|
3832
|
+
client.onEvent = (evt) => {
|
|
3833
|
+
if (evt.event === "chat") handleChatEvent(evt.payload);
|
|
3834
|
+
if (evt.event === "chat.side_result") handleBtwEvent(evt.payload);
|
|
3835
|
+
if (evt.event === "agent") handleAgentEvent(evt.payload);
|
|
3836
|
+
};
|
|
3837
|
+
client.onConnected = () => {
|
|
3838
|
+
isConnected = true;
|
|
3839
|
+
pairingHintShown = false;
|
|
3840
|
+
const reconnected = wasDisconnected;
|
|
3841
|
+
wasDisconnected = false;
|
|
3842
|
+
setConnectionStatus("connected");
|
|
3843
|
+
(async () => {
|
|
3844
|
+
await refreshAgents();
|
|
3845
|
+
updateHeader();
|
|
3846
|
+
await loadHistory();
|
|
3847
|
+
setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
|
|
3848
|
+
tui.requestRender();
|
|
3849
|
+
if (!autoMessageSent && autoMessage) {
|
|
3850
|
+
autoMessageSent = true;
|
|
3851
|
+
await sendMessage(autoMessage);
|
|
3852
|
+
}
|
|
3853
|
+
updateFooter();
|
|
3854
|
+
tui.requestRender();
|
|
3855
|
+
})();
|
|
3856
|
+
};
|
|
3857
|
+
client.onDisconnected = (reason) => {
|
|
3858
|
+
isConnected = false;
|
|
3859
|
+
wasDisconnected = true;
|
|
3860
|
+
historyLoaded = false;
|
|
3861
|
+
const disconnectState = resolveGatewayDisconnectState(reason);
|
|
3862
|
+
setConnectionStatus(disconnectState.connectionStatus, 5e3);
|
|
3863
|
+
setActivityStatus(disconnectState.activityStatus);
|
|
3864
|
+
if (disconnectState.pairingHint && !pairingHintShown) {
|
|
3865
|
+
pairingHintShown = true;
|
|
3866
|
+
chatLog.addSystem(disconnectState.pairingHint);
|
|
3867
|
+
}
|
|
3868
|
+
updateFooter();
|
|
3869
|
+
tui.requestRender();
|
|
3870
|
+
};
|
|
3871
|
+
client.onGap = (info) => {
|
|
3872
|
+
setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
|
|
3873
|
+
tui.requestRender();
|
|
3874
|
+
};
|
|
3875
|
+
updateHeader();
|
|
3876
|
+
setConnectionStatus("connecting");
|
|
3877
|
+
updateFooter();
|
|
3878
|
+
const sigintHandler = () => {
|
|
3879
|
+
handleCtrlC();
|
|
3880
|
+
};
|
|
3881
|
+
const sigtermHandler = () => {
|
|
3882
|
+
requestExit();
|
|
3883
|
+
};
|
|
3884
|
+
process.on("SIGINT", sigintHandler);
|
|
3885
|
+
process.on("SIGTERM", sigtermHandler);
|
|
3886
|
+
tui.start();
|
|
3887
|
+
client.start();
|
|
3888
|
+
await new Promise((resolve) => {
|
|
3889
|
+
const finish = () => {
|
|
3890
|
+
process.removeListener("SIGINT", sigintHandler);
|
|
3891
|
+
process.removeListener("SIGTERM", sigtermHandler);
|
|
3892
|
+
resolve();
|
|
3893
|
+
};
|
|
3894
|
+
process.once("exit", finish);
|
|
3895
|
+
});
|
|
3896
|
+
}
|
|
3897
|
+
//#endregion
|
|
3898
|
+
export { runTui as t };
|