kaijibot 2026.6.21 → 2026.6.22
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/dist/.buildstamp +1 -1
- package/dist/abort-CxZY3nsr.js +202 -0
- package/dist/abort-cutoff.runtime-D5FOsnYW.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort.runtime-DfIOyW8M.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/acp-cli-CGXRdw_k.js +2171 -0
- package/dist/acp-spawn-DKbKvPuU.js +1023 -0
- package/dist/acp-stateful-target-driver-WeMIyQR2.js +87 -0
- package/dist/action-agents-Dw33v5ym.js +67 -0
- package/dist/action-focus-BTLYwzxx.js +124 -0
- package/dist/action-help-DjgRJFg3.js +7 -0
- package/dist/action-info-6xDvEX0Q.js +58 -0
- package/dist/action-kill-DtQoZS29.js +33 -0
- package/dist/action-list-ClDeI7iE.js +21 -0
- package/dist/action-log-DSosstuh.js +30 -0
- package/dist/action-send-Vh1BuuNd.js +39 -0
- package/dist/action-spawn-B08ssbZ3.js +46 -0
- package/dist/action-unfocus-CEw-Ww9k.js +28 -0
- package/dist/agent-BXBykpuI.js +2 -0
- package/dist/agent-command-CUB1Qm88.js +1479 -0
- package/dist/agent-runner-utils-DN7nVODy.js +202 -0
- package/dist/agent-runner.runtime-DVXE9zZ9.js +2825 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents-BqqSOUcc.js +887 -0
- package/dist/agents-CVsWMDVp.js +5 -0
- package/dist/api--VGwAnD8.js +3 -0
- package/dist/api-6V55tozK.js +5 -0
- package/dist/api-B6ziqa7E.js +5 -0
- package/dist/api-C4yFynS8.js +2 -0
- package/dist/api-CT1XstLQ.js +4 -0
- package/dist/api-CgLK0Nl9.js +45 -0
- package/dist/api-CkSziYo8.js +4 -0
- package/dist/api-CmDVoeIs.js +2 -0
- package/dist/api-CziR8HhH.js +35 -0
- package/dist/api-D85vczn8.js +2 -0
- package/dist/api-DlP6Jt7i.js +3 -0
- package/dist/api-DvwX5wEJ.js +16 -0
- package/dist/api-cZen2Qw8.js +44 -0
- package/dist/api-gQ5luSlW.js +19 -0
- package/dist/apply-DQD25Xw1.js +493 -0
- package/dist/apply.runtime-BUedp4X6.js +166 -0
- package/dist/apply.runtime-CUOWwc5E.js +2 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/audit-channel.collect.runtime.js +1 -1
- package/dist/audit-extra.async-UlJ9dtlX.js +847 -0
- package/dist/audit-u9caRELf.js +885 -0
- package/dist/audit.deep.runtime-DV71Wkn_.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-DOxcit3s.js +859 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CkaC5K-V.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-BtFIcjkK.js +181 -0
- package/dist/auth-choice-BDu6h5u6.js +353 -0
- package/dist/auth-choice-ChZMk5hI.js +3 -0
- package/dist/auth-choice-oYsuPPg8.js +71 -0
- package/dist/auth-choice-options-kLAihnil.js +104 -0
- package/dist/auth-choice-prompt-C6XJsZ_j.js +2 -0
- package/dist/auth-choice-prompt-sWGu0fT8.js +36 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auto-disable-B57JdBwe.js +69 -0
- package/dist/auto-disable-CmJfHDbk.js +2 -0
- package/dist/banner-BLSO_rVb.js +290 -0
- package/dist/banner-Bq8rH7x0.js +2 -0
- package/dist/binding-routing-CUqlgYnB.js +50 -0
- package/dist/binding-targets-r1FCdNWk.js +99 -0
- package/dist/bridge-server-DBiqLRkF.js +103 -0
- package/dist/browser-node-runtime-CaV_umAQ.js +12 -0
- package/dist/browser-runtime-a3vYRS_q.js +377 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +3 -3
- package/dist/bundled/bootstrap-extra-files/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +3 -3
- package/dist/call.runtime.js +1 -1
- package/dist/capability-cli-5gQaEAHR.js +1350 -0
- package/dist/catalog-provider-DtmYtDqx.js +40 -0
- package/dist/cdp.helpers-C6bHP7D_.js +372 -0
- package/dist/channel-core-CmBBxIyB.js +5 -0
- package/dist/channel-plugin-resolution-CmsYI1my.js +146 -0
- package/dist/channel-selection.runtime.js +1 -1
- package/dist/channel.runtime-CVJx87rS.js +399 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-DSyzN9z5.js +1146 -0
- package/dist/channels-cli-CyaVWu4s.js +247 -0
- package/dist/chat-fHuZdqCl.js +213 -0
- package/dist/chrome-DMEt4NXy.js +1080 -0
- package/dist/chrome.executables-B9jFs6UO.js +541 -0
- package/dist/clawbot-cli-mwz1sM6a.js +9 -0
- package/dist/clawhub-D05ayw3D.js +400 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-8zsU8vEs.js +191 -0
- package/dist/cli-Bi46ARiq.js +57 -0
- package/dist/cli-By89kZva.js +154 -0
- package/dist/cli-C746a0v5.js +2 -0
- package/dist/cli-auth-seam-BTvzapW1.js +14 -0
- package/dist/cli-backend-lsjr78tt.js +66 -0
- package/dist/cli-migration-DcoLYfHA.js +127 -0
- package/dist/cli-pyy2tVYy.js +2 -0
- package/dist/cli-runner-CdYSI1Cq.js +1661 -0
- package/dist/cli-runner.runtime-DAabHOxt.js +3 -0
- package/dist/cli-runner.runtime-DVi1zg9k.js +2 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-shared-DFDLtvnu.js +142 -0
- package/dist/cli-startup-metadata.json +2 -2
- package/dist/cli.runtime-Cz1t2jpS.js +819 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/collector-DrX56GKv.js +378 -0
- package/dist/collector-Shnn0RWR.js +2 -0
- package/dist/command-config-resolution-CZpMVpIs.js +2 -0
- package/dist/command-config-resolution-CcNutmmy.js +23 -0
- package/dist/command-execution-startup-BQsvV7-V.js +269 -0
- package/dist/command-poll-backoff.runtime.js +1 -1
- package/dist/command-queue-BfrVf4dr.js +260 -0
- package/dist/command-registry-9kQrd6fb.js +108 -0
- package/dist/command-registry-Bdx4B3wy.js +3 -0
- package/dist/command-secret-gateway-DxVWgQ4Q.js +528 -0
- package/dist/commands-acp-DBpRNdkG.js +1017 -0
- package/dist/commands-compact.runtime-BxRaheVf.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-DoUzOeqH.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-CscK2Pgm.js +3762 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-DqYeVT69.js +306 -0
- package/dist/commands-registry.runtime.js +1 -1
- package/dist/commands-reset-hooks-CRAAqkiL.js +129 -0
- package/dist/commands-status-D8ZaMIRi.js +223 -0
- package/dist/commands-status.runtime-BtUfa8Vo.js +2 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-3mseouWV.js +2 -0
- package/dist/commands-subagents-control.runtime-C7Ew7ep6.js +3 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands.runtime-BJ_5rAYe.js +103 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/comment-shared-yDp8Dd41.js +40 -0
- package/dist/compact-k1PfNa6G.js +11322 -0
- package/dist/compact.runtime-cKbXZ_kZ.js +7 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-DUy1xq5t.js +2 -0
- package/dist/completion-cli-TT57JQFZ.js +464 -0
- package/dist/config-Bza6q-tk.js +107 -0
- package/dist/config-CAd-vFQh.js +2 -0
- package/dist/config-CpSlb4Mg.js +166 -0
- package/dist/config-CwRPACbU.js +136 -0
- package/dist/config-cli-_8Iokq8y.js +947 -0
- package/dist/config-defaults-Bjf5n5HI.js +163 -0
- package/dist/config-guard-CfF5-yEi.js +94 -0
- package/dist/config-runtime-BNDhHDpw.js +14 -0
- package/dist/config-validation-BhhUrU16.js +279 -0
- package/dist/configure-CQyw8lzJ.js +1159 -0
- package/dist/configure-qodb2db7.js +2 -0
- package/dist/context-writer-AquXRiMC.js +286 -0
- package/dist/control-auth-CBhIsAGb.js +122 -0
- package/dist/conversation-id-BpHFaBiM.js +140 -0
- package/dist/conversation-runtime-CV7B9eh2.js +31 -0
- package/dist/core-Dhps3xfM.js +210 -0
- package/dist/core-command-descriptors-ByQEHYvG.js +106 -0
- package/dist/cron-cli-CZI77HtC.js +637 -0
- package/dist/curator-CqSJZrlY.js +586 -0
- package/dist/daemon-cli-BdP5r4bR.js +416 -0
- package/dist/daemon-install-C8jNe_d9.js +63 -0
- package/dist/delegate-BLZcdNc7.js +61 -0
- package/dist/deliver-BZKHu27h.js +3 -0
- package/dist/deliver-C_JUBT2Q.js +782 -0
- package/dist/deliver-runtime-BlUTLk1h.js +2 -0
- package/dist/delivery-outbound.runtime-Dx5f5V4o.js +6 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-BEM44EtF.js +372 -0
- package/dist/delivery-queue-DtcoyE2W.js +2 -0
- package/dist/detect-B4AtZ1VF.js +113 -0
- package/dist/devices-cli-BwUXV1ns.js +329 -0
- package/dist/diagnostic-B9b_3vaL.js +311 -0
- package/dist/direct-dm-06KHJO-9.js +139 -0
- package/dist/directive-handling.fast-lane-BAXtkU2a.js +64 -0
- package/dist/directive-handling.fast-lane-cbiyzgY6.js +2 -0
- package/dist/directive-handling.impl-DXbCFQNy.js +2 -0
- package/dist/directive-handling.impl-DscJlWrJ.js +659 -0
- package/dist/directive-handling.parse-BjPmnlrf.js +376 -0
- package/dist/directive-handling.persist-CR8atm5a.js +139 -0
- package/dist/directive-handling.persist.runtime-BD4hf46l.js +2 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directive-handling.shared-CBO8J9ho.js +159 -0
- package/dist/directory-cli-jmT5IFyz.js +239 -0
- package/dist/dispatch-D0nF0fyZ.js +1041 -0
- package/dist/dispatch-acp-DkXjplxI.js +969 -0
- package/dist/dispatch-acp-manager.runtime-BatYBoZJ.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-ij81_4Nz.js +3 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-session.runtime-BuR_lKDu.js +2 -0
- package/dist/dispatch-acp-session.runtime.js +1 -1
- package/dist/dispatch-acp-tts.runtime-7dlcj_x_.js +3 -0
- package/dist/dispatch-acp-tts.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DD9eCP-b.js +19 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dns-cli-RO2WqQHr.js +192 -0
- package/dist/doctor-completion-5vnr7sel.js +90 -0
- package/dist/doctor-config-preflight-6FaPZK61.js +148 -0
- package/dist/doctor-config-preflight-CTYLYtZw.js +2 -0
- package/dist/doctor-state-migrations-BvJBqBwP.js +2 -0
- package/dist/doctor-state-migrations-CH2rs-LR.js +3 -0
- package/dist/drive-D8QfYZ4p.js +750 -0
- package/dist/embedding-provider-Bj7KsQ8q.js +129 -0
- package/dist/engine-BY6K0Vfe.js +72 -0
- package/dist/entry-capabilities-BSz58Ocn.js +89 -0
- package/dist/entry.js +5 -5
- package/dist/env-overrides.runtime.js +1 -1
- package/dist/exec-approval-forwarder.runtime-D5JousLd.js +3 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approvals-cli-C63N8e4p.js +484 -0
- package/dist/exec-defaults-BWTMcQ8O.js +1440 -0
- package/dist/extensionAPI.js +4 -4
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/anthropic/api.js +2 -2
- package/dist/extensions/anthropic/cli-auth-seam.js +1 -1
- package/dist/extensions/anthropic/cli-backend-api.js +2 -2
- package/dist/extensions/anthropic/cli-backend.js +1 -1
- package/dist/extensions/anthropic/cli-migration.js +1 -1
- package/dist/extensions/anthropic/cli-shared.js +1 -1
- package/dist/extensions/anthropic/config-defaults.js +1 -1
- package/dist/extensions/anthropic/contract-api.js +1 -1
- package/dist/extensions/anthropic/index.js +1 -1
- package/dist/extensions/anthropic/media-understanding-provider.js +1 -1
- package/dist/extensions/anthropic/provider-policy-api.js +1 -1
- package/dist/extensions/anthropic/register.runtime.js +1 -1
- package/dist/extensions/anthropic/setup-api.js +1 -1
- package/dist/extensions/anthropic/stream-wrappers.js +1 -1
- package/dist/extensions/anthropic/test-api.js +3 -3
- package/dist/extensions/anthropic-vertex/api.js +3 -3
- package/dist/extensions/anthropic-vertex/index.js +2 -2
- package/dist/extensions/anthropic-vertex/provider-catalog.js +1 -1
- package/dist/extensions/anthropic-vertex/region.js +1 -1
- package/dist/extensions/anthropic-vertex/setup-api.js +1 -1
- package/dist/extensions/arcee/index.js +2 -2
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-cdp.js +1 -1
- package/dist/extensions/browser/browser-config.js +3 -3
- package/dist/extensions/browser/browser-control-auth.js +1 -1
- package/dist/extensions/browser/browser-doctor.js +3 -3
- package/dist/extensions/browser/browser-host-inspection.js +1 -1
- package/dist/extensions/browser/browser-maintenance.js +2 -2
- package/dist/extensions/browser/browser-profiles.js +1 -1
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +3 -3
- package/dist/extensions/browser/runtime-api.js +12 -12
- package/dist/extensions/browser/setup-api.js +2 -2
- package/dist/extensions/browser/test-support.js +2 -2
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/cerebras/index.js +1 -1
- package/dist/extensions/chutes/api.js +3 -3
- package/dist/extensions/chutes/index.js +8 -8
- package/dist/extensions/chutes/models.js +1 -1
- package/dist/extensions/chutes/onboard.js +2 -2
- package/dist/extensions/chutes/provider-catalog.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
- package/dist/extensions/cloudflare-ai-gateway/index.js +3 -3
- package/dist/extensions/deepinfra/api.js +2 -2
- package/dist/extensions/deepinfra/index.js +2 -2
- package/dist/extensions/deepinfra/media-understanding-provider.js +1 -1
- package/dist/extensions/deepinfra/video-generation-provider.js +1 -1
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/index.js +5 -5
- package/dist/extensions/device-pair/notify.js +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/diffs/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/diffs/index.js +1 -1
- package/dist/extensions/diffs/node_modules/.package-lock.json +3 -3
- package/dist/extensions/diffs/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/dist/extensions/diffs/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/dist/extensions/diffs/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/guard/guard.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/guard/guard.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/schema.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/dist/extensions/diffs/node_modules/typebox/build/system/memory/clone.mjs +72 -26
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/with.d.mts +0 -10
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/with.mjs +0 -8
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/check.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/check.mjs +9 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +4 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/instantiate.d.mts +7 -12
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/instantiate.mjs +60 -66
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +1 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +4 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/extends_left.d.mts +1 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/extends_left.mjs +23 -32
- package/dist/extensions/diffs/node_modules/typebox/build/type/script/mapping.d.mts +0 -12
- package/dist/extensions/diffs/node_modules/typebox/build/type/script/mapping.mjs +21 -25
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/_refine.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/index.d.mts +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/index.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/static.d.mts +1 -5
- package/dist/extensions/diffs/node_modules/typebox/build/typebox.d.mts +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/typebox.mjs +2 -7
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/dist/extensions/diffs/node_modules/typebox/build/value/clone/clone.mjs +1 -86
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/dist/extensions/diffs/node_modules/typebox/build/value/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_type.mjs +2 -12
- package/dist/extensions/diffs/node_modules/typebox/build/value/value.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/value.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/package.json +1 -1
- package/dist/extensions/diffs/node_modules/typebox/readme.md +1 -1
- package/dist/extensions/exa/index.js +1 -1
- package/dist/extensions/feishu/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/feishu/api.js +16 -16
- package/dist/extensions/feishu/contract-api.js +2 -2
- package/dist/extensions/feishu/node_modules/.package-lock.json +3 -3
- package/dist/extensions/feishu/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/dist/extensions/feishu/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/dist/extensions/feishu/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/guard/guard.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/guard/guard.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/schema.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/dist/extensions/feishu/node_modules/typebox/build/system/memory/clone.mjs +72 -26
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/with.d.mts +0 -10
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/with.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/check.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/check.mjs +9 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +1 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +4 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/instantiate.d.mts +7 -12
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/instantiate.mjs +60 -66
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +1 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +4 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/extends_left.d.mts +1 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/extends_left.mjs +23 -32
- package/dist/extensions/feishu/node_modules/typebox/build/type/script/mapping.d.mts +0 -12
- package/dist/extensions/feishu/node_modules/typebox/build/type/script/mapping.mjs +21 -25
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/_refine.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/index.d.mts +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/index.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/static.d.mts +1 -5
- package/dist/extensions/feishu/node_modules/typebox/build/typebox.d.mts +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/typebox.mjs +2 -7
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/dist/extensions/feishu/node_modules/typebox/build/value/clone/clone.mjs +1 -86
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/dist/extensions/feishu/node_modules/typebox/build/value/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_type.mjs +2 -12
- package/dist/extensions/feishu/node_modules/typebox/build/value/value.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/value.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/package.json +1 -1
- package/dist/extensions/feishu/node_modules/typebox/readme.md +1 -1
- package/dist/extensions/feishu/runtime-api.js +2 -2
- package/dist/extensions/feishu/security-contract-api.js +1 -1
- package/dist/extensions/feishu/session-key-api.js +1 -1
- package/dist/extensions/feishu/setup-api.js +1 -1
- package/dist/extensions/fireworks/index.js +1 -1
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/index.js +4 -4
- package/dist/extensions/github-copilot/login.js +1 -1
- package/dist/extensions/github-copilot/models-defaults.js +1 -1
- package/dist/extensions/github-copilot/models.js +1 -1
- package/dist/extensions/github-copilot/register.runtime.js +3 -3
- package/dist/extensions/github-copilot/replay-policy.js +1 -1
- package/dist/extensions/google/api.js +1 -1
- package/dist/extensions/google/gemini-cli-provider.js +1 -1
- package/dist/extensions/google/google-shared.test-helpers.js +1 -1
- package/dist/extensions/google/image-generation-provider.js +1 -1
- package/dist/extensions/google/index.js +5 -5
- package/dist/extensions/google/media-understanding-provider.js +1 -1
- package/dist/extensions/google/music-generation-provider.js +1 -1
- package/dist/extensions/google/oauth-token-shared.js +1 -1
- package/dist/extensions/google/oauth.credentials.js +1 -1
- package/dist/extensions/google/oauth.flow.js +1 -1
- package/dist/extensions/google/oauth.js +2 -2
- package/dist/extensions/google/oauth.runtime.js +1 -1
- package/dist/extensions/google/oauth.settings.js +1 -1
- package/dist/extensions/google/oauth.token.js +1 -1
- package/dist/extensions/google/provider-models.js +1 -1
- package/dist/extensions/google/provider-registration.js +1 -1
- package/dist/extensions/google/runtime-api.js +2 -2
- package/dist/extensions/google/test-api.js +2 -2
- package/dist/extensions/google/video-generation-provider.js +1 -1
- package/dist/extensions/google/web-search-provider.js +1 -1
- package/dist/extensions/groq/index.js +1 -1
- package/dist/extensions/groq/media-understanding-provider.js +1 -1
- package/dist/extensions/groq/test-api.js +1 -1
- package/dist/extensions/huggingface/api.js +3 -3
- package/dist/extensions/huggingface/index.js +3 -3
- package/dist/extensions/huggingface/models.js +1 -1
- package/dist/extensions/huggingface/onboard.js +1 -1
- package/dist/extensions/huggingface/provider-catalog.js +2 -2
- package/dist/extensions/image-generation-core/api.js +1 -1
- package/dist/extensions/kilocode/api.js +2 -2
- package/dist/extensions/kilocode/index.js +4 -4
- package/dist/extensions/kilocode/onboard.js +2 -2
- package/dist/extensions/kilocode/provider-catalog.js +1 -1
- package/dist/extensions/kilocode/provider-models.js +1 -1
- package/dist/extensions/kilocode/shared.js +1 -1
- package/dist/extensions/kimi-coding/index.js +3 -3
- package/dist/extensions/knowledge-wiki/index.js +26 -12
- package/dist/extensions/knowledge-wiki/kaijibot.plugin.json +2 -1
- package/dist/extensions/litellm/api.js +1 -1
- package/dist/extensions/litellm/index.js +3 -3
- package/dist/extensions/litellm/onboard.js +1 -1
- package/dist/extensions/litellm/provider-catalog.js +1 -1
- package/dist/extensions/llm-task/api.js +1 -1
- package/dist/extensions/llm-task/index.js +2 -2
- package/dist/extensions/lmstudio/api.js +2 -2
- package/dist/extensions/lmstudio/index.js +2 -2
- package/dist/extensions/lmstudio/runtime-api.js +1 -1
- package/dist/extensions/media-understanding-core/runtime-api.js +2 -2
- package/dist/extensions/memory-core/cli-metadata.js +2 -2
- package/dist/extensions/memory-core/index.js +13 -13
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +4 -4
- package/dist/extensions/memory-lancedb/api.js +1 -1
- package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
- package/dist/extensions/memory-lancedb/config.js +1 -1
- package/dist/extensions/memory-lancedb/index.js +4 -4
- package/dist/extensions/memory-lancedb/lancedb-runtime.js +1 -1
- package/dist/extensions/microsoft/index.js +1 -1
- package/dist/extensions/microsoft/speech-provider.js +1 -1
- package/dist/extensions/microsoft/test-api.js +1 -1
- package/dist/extensions/microsoft/tts.js +1 -1
- package/dist/extensions/microsoft-foundry/auth.js +1 -1
- package/dist/extensions/microsoft-foundry/cli.js +1 -1
- package/dist/extensions/microsoft-foundry/index.js +1 -1
- package/dist/extensions/microsoft-foundry/onboard.js +2 -2
- package/dist/extensions/microsoft-foundry/provider.js +1 -1
- package/dist/extensions/microsoft-foundry/runtime.js +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
- package/dist/extensions/microsoft-foundry/shared.js +1 -1
- package/dist/extensions/minimax/api.js +5 -5
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/model-definitions.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/onboard.js +1 -1
- package/dist/extensions/minimax/provider-catalog.js +1 -1
- package/dist/extensions/minimax/provider-http.test-helpers.js +1 -1
- package/dist/extensions/minimax/provider-models.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/test-api.js +2 -2
- package/dist/extensions/minimax/tts.js +1 -1
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/mistral/api.js +4 -4
- package/dist/extensions/mistral/embedding-provider.js +1 -1
- package/dist/extensions/mistral/index.js +6 -6
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/mistral/memory-embedding-adapter.js +1 -1
- package/dist/extensions/mistral/model-definitions.js +1 -1
- package/dist/extensions/mistral/onboard.js +1 -1
- package/dist/extensions/mistral/provider-catalog.js +1 -1
- package/dist/extensions/mistral/provider-compat.js +1 -1
- package/dist/extensions/mistral/realtime-transcription-provider.js +1 -1
- package/dist/extensions/mistral/test-api.js +2 -2
- package/dist/extensions/moonshot/api.js +3 -3
- package/dist/extensions/moonshot/index.js +6 -6
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/onboard.js +1 -1
- package/dist/extensions/moonshot/provider-catalog.js +1 -1
- package/dist/extensions/moonshot/test-api.js +2 -2
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/nvidia/api.js +1 -1
- package/dist/extensions/nvidia/index.js +2 -2
- package/dist/extensions/nvidia/provider-catalog.js +1 -1
- package/dist/extensions/ollama/api.js +4 -4
- package/dist/extensions/ollama/index.js +7 -7
- package/dist/extensions/ollama/provider-discovery.js +1 -1
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/ollama/web-search-provider.js +1 -1
- package/dist/extensions/open-prose/runtime-api.js +1 -1
- package/dist/extensions/openai/api.js +5 -5
- package/dist/extensions/openai/cli-backend.js +1 -1
- package/dist/extensions/openai/default-models.js +1 -1
- package/dist/extensions/openai/image-generation-provider.js +1 -1
- package/dist/extensions/openai/index.js +10 -10
- package/dist/extensions/openai/media-understanding-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
- package/dist/extensions/openai/openai-codex-catalog.js +1 -1
- package/dist/extensions/openai/openai-codex-cli-auth.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-shared.js +1 -1
- package/dist/extensions/openai/openai-provider.js +1 -1
- package/dist/extensions/openai/prompt-overlay.js +1 -1
- package/dist/extensions/openai/realtime-provider-shared.js +1 -1
- package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/openai/realtime-voice-provider.js +1 -1
- package/dist/extensions/openai/register.runtime.js +9 -9
- package/dist/extensions/openai/replay-policy.js +1 -1
- package/dist/extensions/openai/setup-api.js +1 -1
- package/dist/extensions/openai/shared.js +1 -1
- package/dist/extensions/openai/speech-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +6 -6
- package/dist/extensions/openai/transport-policy.js +1 -1
- package/dist/extensions/openai/tts.js +1 -1
- package/dist/extensions/openai/video-generation-provider.js +1 -1
- package/dist/extensions/opencode/api.js +2 -2
- package/dist/extensions/opencode/index.js +4 -4
- package/dist/extensions/opencode/onboard.js +1 -1
- package/dist/extensions/opencode-go/api.js +2 -2
- package/dist/extensions/opencode-go/index.js +3 -3
- package/dist/extensions/opencode-go/onboard.js +1 -1
- package/dist/extensions/openrouter/api.js +5 -5
- package/dist/extensions/openrouter/image-generation-provider.js +1 -1
- package/dist/extensions/openrouter/index.js +8 -8
- package/dist/extensions/openrouter/media-understanding-provider.js +1 -1
- package/dist/extensions/openrouter/models.js +1 -1
- package/dist/extensions/openrouter/music-generation-provider.js +1 -1
- package/dist/extensions/openrouter/onboard.js +1 -1
- package/dist/extensions/openrouter/provider-catalog.js +1 -1
- package/dist/extensions/openrouter/provider-policy-api.js +1 -1
- package/dist/extensions/openrouter/speech-provider.js +1 -1
- package/dist/extensions/openrouter/stream.js +1 -1
- package/dist/extensions/openrouter/test-api.js +4 -4
- package/dist/extensions/openrouter/thinking-policy.js +1 -1
- package/dist/extensions/openrouter/video-generation-provider.js +4 -4
- package/dist/extensions/openrouter/video-http.js +1 -1
- package/dist/extensions/openrouter/video-model-catalog.js +1 -1
- package/dist/extensions/openshell/index.js +4 -4
- package/dist/extensions/perplexity/index.js +1 -1
- package/dist/extensions/perplexity/test-api.js +1 -1
- package/dist/extensions/perplexity/web-search-contract-api.js +1 -1
- package/dist/extensions/perplexity/web-search-provider.js +1 -1
- package/dist/extensions/qianfan/api.js +2 -2
- package/dist/extensions/qianfan/index.js +3 -3
- package/dist/extensions/qianfan/onboard.js +1 -1
- package/dist/extensions/qianfan/provider-catalog.js +1 -1
- package/dist/extensions/qwen/api.js +4 -4
- package/dist/extensions/qwen/index.js +8 -8
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/model-definitions.js +1 -1
- package/dist/extensions/qwen/models.js +1 -1
- package/dist/extensions/qwen/onboard.js +1 -1
- package/dist/extensions/qwen/provider-catalog.js +1 -1
- package/dist/extensions/qwen/stream.js +1 -1
- package/dist/extensions/qwen/test-api.js +2 -2
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/runway/index.js +1 -1
- package/dist/extensions/runway/video-generation-provider.js +1 -1
- package/dist/extensions/sglang/api.js +3 -3
- package/dist/extensions/sglang/defaults.js +1 -1
- package/dist/extensions/sglang/index.js +3 -3
- package/dist/extensions/sglang/models.js +1 -1
- package/dist/extensions/speech-core/api.js +1 -1
- package/dist/extensions/speech-core/runtime-api.js +3 -3
- package/dist/extensions/stepfun/index.js +4 -4
- package/dist/extensions/stepfun/onboard.js +1 -1
- package/dist/extensions/stepfun/provider-catalog.js +1 -1
- package/dist/extensions/talk-voice/api.js +1 -1
- package/dist/extensions/talk-voice/index.js +2 -2
- package/dist/extensions/tavily/index.js +1 -1
- package/dist/extensions/together/api.js +3 -3
- package/dist/extensions/together/index.js +3 -3
- package/dist/extensions/together/models.js +1 -1
- package/dist/extensions/together/onboard.js +1 -1
- package/dist/extensions/together/provider-catalog.js +1 -1
- package/dist/extensions/together/video-generation-provider.js +2 -2
- package/dist/extensions/venice/api.js +3 -3
- package/dist/extensions/venice/index.js +5 -5
- package/dist/extensions/venice/models.js +1 -1
- package/dist/extensions/venice/onboard.js +2 -2
- package/dist/extensions/venice/provider-catalog.js +1 -1
- package/dist/extensions/vercel-ai-gateway/api.js +3 -3
- package/dist/extensions/vercel-ai-gateway/index.js +3 -3
- package/dist/extensions/vercel-ai-gateway/models.js +1 -1
- package/dist/extensions/vercel-ai-gateway/onboard.js +1 -1
- package/dist/extensions/vercel-ai-gateway/provider-catalog.js +1 -1
- package/dist/extensions/vllm/api.js +3 -3
- package/dist/extensions/vllm/defaults.js +1 -1
- package/dist/extensions/vllm/index.js +3 -3
- package/dist/extensions/vllm/models.js +1 -1
- package/dist/extensions/vllm/register.runtime.js +3 -3
- package/dist/extensions/volcengine/api.js +2 -2
- package/dist/extensions/volcengine/index.js +4 -4
- package/dist/extensions/volcengine/models.js +1 -1
- package/dist/extensions/volcengine/provider-catalog.js +1 -1
- package/dist/extensions/vydra/image-generation-provider.js +1 -1
- package/dist/extensions/vydra/index.js +6 -6
- package/dist/extensions/vydra/onboard.js +1 -1
- package/dist/extensions/vydra/shared.js +1 -1
- package/dist/extensions/vydra/speech-provider.js +1 -1
- package/dist/extensions/vydra/video-generation-provider.js +1 -1
- package/dist/extensions/webhooks/.kaijibot-runtime-deps-stamp.json +1 -1
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +3 -3
- package/dist/extensions/webhooks/runtime-api.js +1 -1
- package/dist/extensions/xai/api.js +5 -5
- package/dist/extensions/xai/code-execution.js +4 -4
- package/dist/extensions/xai/index.js +11 -11
- package/dist/extensions/xai/model-definitions.js +1 -1
- package/dist/extensions/xai/model-id.js +1 -1
- package/dist/extensions/xai/onboard.js +1 -1
- package/dist/extensions/xai/provider-catalog.js +1 -1
- package/dist/extensions/xai/provider-models.js +1 -1
- package/dist/extensions/xai/setup-api.js +1 -1
- package/dist/extensions/xai/stream.js +1 -1
- package/dist/extensions/xai/video-generation-provider.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/x-search-tool-shared.js +1 -1
- package/dist/extensions/xai/x-search.js +4 -4
- package/dist/extensions/xiaomi/api.js +2 -2
- package/dist/extensions/xiaomi/index.js +3 -3
- package/dist/extensions/xiaomi/onboard.js +1 -1
- package/dist/extensions/xiaomi/provider-catalog.js +1 -1
- package/dist/extensions/zai/api.js +3 -3
- package/dist/extensions/zai/detect.js +1 -1
- package/dist/extensions/zai/index.js +6 -6
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zai/model-definitions.js +1 -1
- package/dist/extensions/zai/onboard.js +1 -1
- package/dist/extensions/zai/runtime-api.js +1 -1
- package/dist/extensions/zai/test-api.js +1 -1
- package/dist/fragment-collector-MPWszaY5.js +189 -0
- package/dist/fragment-store-SR8Bo1em.js +218 -0
- package/dist/fragment-store-TRt-PDu_.js +2 -0
- package/dist/gateway-cli-Lc4_vwt0.js +1518 -0
- package/dist/gateway-discovery-targets-_JD1loMg.js +431 -0
- package/dist/gateway-install-token-DuMEOLtu.js +284 -0
- package/dist/gateway-rpc-JpewBoh5.js +14 -0
- package/dist/gateway-rpc.runtime.js +1 -1
- package/dist/gateway-secret-options-DIWh0avy.js +38 -0
- package/dist/gemini-cli-provider-DJmyF3F1.js +106 -0
- package/dist/gemini-web-search-provider-cXSR-qZm.js +167 -0
- package/dist/get-reply-from-config.runtime-dgpM1fFS.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/git-commit-D50Y5N45.js +2 -0
- package/dist/groups.runtime.js +1 -1
- package/dist/hard-trigger-DRIZJ_PJ.js +98 -0
- package/dist/health-BF4wCwJ7.js +2 -0
- package/dist/health-DuV85G9Q.js +579 -0
- package/dist/heartbeat-runner-CIQHWCd1.js +1209 -0
- package/dist/heartbeat-runner-DMXeqQSX.js +4 -0
- package/dist/heartbeat-runner.runtime-DSMkYfFM.js +2 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/help-Byb6TFWt.js +81 -0
- package/dist/hooks-cli-DnhC5miz.js +354 -0
- package/dist/hooks-status-7gNHQOXj.js +86 -0
- package/dist/image-generation-core-DgBQ7yxF.js +17 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-BKlDd4sX.js +130 -0
- package/dist/image-generation-provider-BVJFZnGv.js +136 -0
- package/dist/image-generation-provider-C4zaGMAe.js +279 -0
- package/dist/image-generation-provider-CYdLui77.js +94 -0
- package/dist/image-generation-provider-vw6Mifhx.js +163 -0
- package/dist/image-runtime-B76ETuEi.js +7 -0
- package/dist/inbound-reply-dispatch-DcaeKmuz.js +73 -0
- package/dist/inbound.runtime-DzuOEHYA.js +4 -0
- package/dist/inbound.runtime-ImqdTVOI.js +3 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/ingest-BNyXzldJ.js +842 -0
- package/dist/ingest-C35XEC_T.js +2 -0
- package/dist/install-BdauYB9u.js +662 -0
- package/dist/install-security-scan-ZoCtjNeN.js +22 -0
- package/dist/install-security-scan.runtime-B1sRhkiV.js +299 -0
- package/dist/install-security-scan.runtime.js +1 -1
- package/dist/install-skills-CQnadGky.js +70 -0
- package/dist/install.runtime-QcrQsqdQ.js +12 -0
- package/dist/install.runtime-zgelN4-_.js +27 -0
- package/dist/install.runtime.js +1 -1
- package/dist/kaijibot-tools-Dl2qUSAS.js +9233 -0
- package/dist/kaijibot-tools.runtime-BuTXGJaj.js +2 -0
- package/dist/kaijibot-tools.runtime.js +1 -1
- package/dist/kimi-web-search-provider-OUDV-0Ow.js +308 -0
- package/dist/lancedb-runtime-DyHQv3-S.js +201 -0
- package/dist/library-Dhl58R3p.js +45 -0
- package/dist/list.runtime-CeH-Xrnd.js +9 -0
- package/dist/list.runtime-FnCw60Xk.js +12 -0
- package/dist/list.runtime.js +1 -1
- package/dist/llm-draft-generator-Be49MQGG.js +567 -0
- package/dist/llm-draft-generator-DEhC2yYf.js +2 -0
- package/dist/llm-engine-BFepNvS0.js +2 -0
- package/dist/llm-engine-BNOxcQrz.js +1829 -0
- package/dist/llm-slug-generator.js +2 -2
- package/dist/login-DAPUtXft.js +108 -0
- package/dist/logs-cli-Dee6SLM_.js +264 -0
- package/dist/logs-cli.runtime.js +1 -1
- package/dist/manager-ZJ_EZtK4.js +2048 -0
- package/dist/manager-czo1q1sv.js +3301 -0
- package/dist/mcp-cli-BjG2nOiR.js +723 -0
- package/dist/media-runtime-CGXSFOdW.js +312 -0
- package/dist/media-understanding-CEFjui05.js +83 -0
- package/dist/media-understanding-provider-2LeNsCXQ.js +13 -0
- package/dist/media-understanding-provider-AxZChB3Q.js +14 -0
- package/dist/media-understanding-provider-B8KTGMNt.js +67 -0
- package/dist/media-understanding-provider-BhfBs6XJ.js +37 -0
- package/dist/media-understanding-provider-By7-KDWp.js +112 -0
- package/dist/media-understanding-provider-CJvPSRD_.js +18 -0
- package/dist/media-understanding-provider-CeDiKBMV.js +21 -0
- package/dist/media-understanding-provider-Cflmzkbe.js +18 -0
- package/dist/media-understanding-provider-D0G4SyRE.js +69 -0
- package/dist/media-understanding-provider-D5w0Ycf_.js +30 -0
- package/dist/media-understanding-provider-RWVVnBkv.js +123 -0
- package/dist/media-understanding-runtime-DrGfjXfY.js +2 -0
- package/dist/memory-C89wZkq_.js +3 -0
- package/dist/memory-core-host-runtime-cli-D5QiXWY7.js +9 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-index-B4acWB-F.js +514 -0
- package/dist/memory-index-Ci_IEkkP.js +2 -0
- package/dist/memory-kGhz1aad.js +242 -0
- package/dist/memory-repair-CXOPaLj_.js +2 -0
- package/dist/message-VnqF7FPQ.js +223 -0
- package/dist/message-action-runner-D1JKJNCt.js +1628 -0
- package/dist/message-action-runner-sNr7cRbq.js +2 -0
- package/dist/message.config.runtime.js +1 -1
- package/dist/message.gateway.runtime.js +1 -1
- package/dist/metadata-registry-loader-FpYi7huO.js +2 -0
- package/dist/minimax-web-search-provider-B80wlL3J.js +165 -0
- package/dist/mmr-BUVQm7ma.js +146 -0
- package/dist/model-catalog-BGubK2PO.js +157 -0
- package/dist/model-definitions-6-ZRKXxZ.js +74 -0
- package/dist/model-definitions-BGyaoan5.js +258 -0
- package/dist/model-definitions-CcSMc0tQ.js +28 -0
- package/dist/model-picker-BFYJZOu-.js +490 -0
- package/dist/model-picker-DU3_Nbi5.js +3 -0
- package/dist/model-picker.runtime-CMM8ER27.js +15 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-selection-Beb96cml.js +381 -0
- package/dist/model-suppression.runtime.js +1 -1
- package/dist/models-B86OciCd.js +47 -0
- package/dist/models-BNG4ZStW.js +18 -0
- package/dist/models-Bw6Q27IA.js +555 -0
- package/dist/models-CUBw1avj.js +18 -0
- package/dist/models-CwtKbjMZ.js +157 -0
- package/dist/models-DUOR6dY_.js +760 -0
- package/dist/models-DltDSCEF.js +19 -0
- package/dist/models-EzdNn5lr.js +2 -0
- package/dist/models-cWV4E77X.js +2584 -0
- package/dist/models-cli-CSnvqJzN.js +197 -0
- package/dist/models.fetch-CmkgmRli.js +518 -0
- package/dist/monitor-Cy4MsZcL.js +4435 -0
- package/dist/music-generation-provider-IKtFX3pf.js +169 -0
- package/dist/music-generation-provider-qXzAqm-8.js +238 -0
- package/dist/music-generation-provider-x1vHpdDc.js +142 -0
- package/dist/node-cli-U7yaSPh3.js +2362 -0
- package/dist/nodes-cli-CsrUwJmw.js +1046 -0
- package/dist/notify-DnKv7zGy.js +305 -0
- package/dist/oauth-BU9Kg4J4.js +57 -0
- package/dist/oauth-D9z3vVZZ.js +152 -0
- package/dist/oauth-token-shared-C2vJuJJA.js +28 -0
- package/dist/oauth.credentials-BDOOigYJ.js +165 -0
- package/dist/oauth.flow-Bi3XRwXD.js +122 -0
- package/dist/oauth.settings-BRN2Sz6R.js +44 -0
- package/dist/oauth.token-CASx9EQP.js +43 -0
- package/dist/onboard-4eXQ1KyP.js +29 -0
- package/dist/onboard-8UfovJuH.js +48 -0
- package/dist/onboard-BEkTYzmT.js +25 -0
- package/dist/onboard-BFu8lV32.js +312 -0
- package/dist/onboard-BICzWILe.js +36 -0
- package/dist/onboard-BOUcR8be.js +621 -0
- package/dist/onboard-BcoQSNQW.js +25 -0
- package/dist/onboard-BuBPPxds.js +26 -0
- package/dist/onboard-CX7hnr8D.js +39 -0
- package/dist/onboard-CXfC1yg8.js +67 -0
- package/dist/onboard-CbymSfBU.js +58 -0
- package/dist/onboard-DGyDRLc3.js +29 -0
- package/dist/onboard-DK-jzfWx.js +22 -0
- package/dist/onboard-DVWKadpJ.js +34 -0
- package/dist/onboard-DoIWd2We.js +25 -0
- package/dist/onboard-Ez4QGniV2.js +54 -0
- package/dist/onboard-channels-BILGE-i9.js +2 -0
- package/dist/onboard-channels-MuLliRf5.js +1260 -0
- package/dist/onboard-config-Byvc0oUh.js +2 -0
- package/dist/onboard-custom-CLaOD_BI.js +2 -0
- package/dist/onboard-custom-CbRHjDNL.js +647 -0
- package/dist/onboard-helpers-BJhCcI9U.js +223 -0
- package/dist/onboard-helpers-CMvJfZTX.js +5 -0
- package/dist/onboard-hooks-BfXdgHQj.js +35 -0
- package/dist/onboard-remote-B0KquzSo.js +193 -0
- package/dist/onboard-remote-B7vnhLj3.js +2 -0
- package/dist/onboard-search-BLjfhCPG.js +324 -0
- package/dist/onboard-skills-CkO8UvfF.js +134 -0
- package/dist/onboard-skills-D9ML0g4M.js +2 -0
- package/dist/openai-codex-auth-identity-DSKWx0wS.js +45 -0
- package/dist/openai-codex-cli-auth-DzOuQekO.js +57 -0
- package/dist/openai-codex-provider-DmVwiyKq.js +299 -0
- package/dist/openai-codex-shared-DGT1w6Uz.js +6 -0
- package/dist/openai-provider-SnRU2x3L.js +283 -0
- package/dist/openclaw-migrator-BQWk325M.js +2 -0
- package/dist/pair-command-approve-DdHdrhCK.js +34 -0
- package/dist/pairing-cli-B57ZjuC5.js +117 -0
- package/dist/perplexity-web-search-provider-BbeQ3_8w.js +92 -0
- package/dist/perplexity-web-search-provider.runtime-BtpRxkdq.js +332 -0
- package/dist/perplexity-web-search-provider.runtime-Dt4WauP_.js +2 -0
- package/dist/perplexity-web-search-provider.runtime.js +1 -1
- package/dist/persistent-bindings.lifecycle-BevP5OlU.js +94 -0
- package/dist/pi-embedded-BbJAO5yK.js +6 -0
- package/dist/pi-embedded-runner-DZaBmFzW.js +8346 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-CfHAZp-z.js +23 -0
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
- package/dist/pi-embedded-tQf0HjTv.js +2 -0
- package/dist/pi-embedded.runtime-B9ZAb_RR.js +5 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools.before-tool-call.runtime-BqDR-_03.js +354 -0
- package/dist/pi-tools.before-tool-call.runtime.js +1 -1
- package/dist/plugin-enabled-B2DgsAtk.js +71 -0
- package/dist/plugin-install-BjOxLVHm.js +227 -0
- package/dist/plugin-install-CLGT8Lak.js +2 -0
- package/dist/plugin-install-config-policy-CZTvkRR9.js +137 -0
- package/dist/plugin-install-plan-CySOZ7mU.js +50 -0
- package/dist/plugin-registration-CfKqWKnW.js +23 -0
- package/dist/plugin-registry-C1mIFpCz.js +2 -0
- package/dist/plugin-registry-igF4eBbt.js +3 -0
- package/dist/plugin-registry-loader-BUYJrGoS.js +22 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +3 -3
- package/dist/plugin-sdk/agent-harness-runtime.js +4 -4
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/browser-node-runtime.js +2 -2
- package/dist/plugin-sdk/browser-support.js +2 -2
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +3 -3
- package/dist/plugin-sdk/command-auth.js +3 -3
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/config-runtime.js +3 -3
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +4 -4
- package/dist/plugin-sdk/core.js +3 -3
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +1 -1
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +5 -5
- package/dist/plugin-sdk/media-understanding-runtime.js +2 -2
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core.js +2 -2
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/plugin-test-contracts.js +1 -1
- package/dist/plugin-sdk/plugin-test-runtime.js +1 -1
- package/dist/plugin-sdk/provider-auth-api-key.js +2 -2
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth.js +2 -2
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-http-test-mocks.js +1 -1
- package/dist/plugin-sdk/provider-test-contracts.js +1 -1
- package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/runtime-doctor.js +1 -1
- package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/sandbox.js +2 -2
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
- package/dist/plugin-sdk/test-env.js +1 -1
- package/dist/plugin-sdk/testing.js +4 -4
- package/dist/plugin-sdk/text-runtime.js +2 -2
- package/dist/plugin-service-Dozf9cCQ.js +2494 -0
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-DQjn2ytT.js +566 -0
- package/dist/plugins-command-helpers-Bq2ECLcC.js +117 -0
- package/dist/plugins-install-persist-chKkbZiL.js +121 -0
- package/dist/plugins-update-command-CmzP42fb.js +1008 -0
- package/dist/policy-BsszCKEI.js +172 -0
- package/dist/preemptive-compaction-CVDrUhXK.js +430 -0
- package/dist/proactive-scheduler-tMSsCjDZ.js +1311 -0
- package/dist/probe-Kqo7OqQF.js +426 -0
- package/dist/probe-auth-BJ3yckIw.js +3 -0
- package/dist/program-DFP-Y-n2.js +111 -0
- package/dist/program-context-6irSsyF2.js +2 -0
- package/dist/prompt-overlay-BEhj9P_7.js +72 -0
- package/dist/prompt-select-styled-sDck0Qqt.js +5299 -0
- package/dist/provider-CeNuW2fv.js +70 -0
- package/dist/provider-api-key-auth-URznqBcK.js +113 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-6QHap3yT.js +36 -0
- package/dist/provider-auth-api-key-LiKYWj18.js +5 -0
- package/dist/provider-auth-choice-Dos9S6zz.js +134 -0
- package/dist/provider-auth-choice-preference-CT90SYMg.js +62 -0
- package/dist/provider-auth-login-CxyguwXg.js +8 -0
- package/dist/provider-auth-login.runtime-CcwpVvy3.js +206 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-catalog-5ZYAb8dU.js +11 -0
- package/dist/provider-catalog-B4PQf5FY.js +12 -0
- package/dist/provider-catalog-BDZO2k2i.js +18 -0
- package/dist/provider-catalog-BfLspzSz.js +11 -0
- package/dist/provider-catalog-CVTCMT4G.js +11 -0
- package/dist/provider-catalog-CsAe-lZz.js +11 -0
- package/dist/provider-catalog-DHN9L06H.js +61 -0
- package/dist/provider-catalog-DIJbow9j.js +26 -0
- package/dist/provider-catalog-DWOeklon.js +16 -0
- package/dist/provider-catalog-FJLanWNs.js +16 -0
- package/dist/provider-catalog-High_lTQ.js +13 -0
- package/dist/provider-catalog-n-gU9Nae.js +56 -0
- package/dist/provider-catalog-wB54CKl2.js +17 -0
- package/dist/provider-compat-luZe7x7D.js +37 -0
- package/dist/provider-dispatcher-BXUvUURc.js +22 -0
- package/dist/provider-entry-DTu3iGNy.js +97 -0
- package/dist/provider-flow-0fivwh2g.js +66 -0
- package/dist/provider-models-BLjQcHNo.js +35 -0
- package/dist/provider-models-CLzRFNLI.js +116 -0
- package/dist/provider-models-K_luQ9zn.js +119 -0
- package/dist/provider-registration-CCkbZbdG.js +238 -0
- package/dist/provider-registration-COl5A7qb.js +57 -0
- package/dist/push-apns-8kAU9XsA.js +1013 -0
- package/dist/pw-ai-BNM0ufGa.js +2268 -0
- package/dist/qmd-manager-jB94G-JS.js +1799 -0
- package/dist/qr-cli-6tySRB_t.js +2 -0
- package/dist/qr-cli-CIhINSCH.js +359 -0
- package/dist/qr-image-D0nYZ-TN.js +2 -0
- package/dist/queue-BjJj4JaJ.js +636 -0
- package/dist/realtime-provider-shared-DW8GAMAi.js +21 -0
- package/dist/realtime-transcription-provider-5PlTLQxo.js +180 -0
- package/dist/realtime-voice-provider-Rl-_1Ycr.js +342 -0
- package/dist/record-shared-7rP3Bc1p.js +10 -0
- package/dist/region-BMo8YuB-.js +74 -0
- package/dist/register-command-groups-BoiHpzbo.js +121 -0
- package/dist/register.agent-CMlgjTUp.js +241 -0
- package/dist/register.configure-D2PnybVp.js +15 -0
- package/dist/register.maintenance-Cx1bo75e.js +438 -0
- package/dist/register.message-CX4jxOsU.js +601 -0
- package/dist/register.migrate-BSWEPPJq.js +195 -0
- package/dist/register.onboard-D204MxI8.js +79 -0
- package/dist/register.runtime-BHO4Mi1q.js +343 -0
- package/dist/register.runtime-CVCoeVMv.js +81 -0
- package/dist/register.runtime.js +1 -1
- package/dist/register.setup-B4Satuvx.js +104 -0
- package/dist/register.status-health-sessions-CFmAM_xF.js +1210 -0
- package/dist/register.subclis-BXqnDdhF.js +237 -0
- package/dist/register.subclis-BZeyeBpg.js +3 -0
- package/dist/replay-policy-DDo0U5gR.js +8 -0
- package/dist/reply-DOkWfPrg.js +3498 -0
- package/dist/reply-payloads-dedupe.runtime.js +1 -1
- package/dist/reply.runtime-7BWsyeU3.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-BF5HlfJ2.js +280 -0
- package/dist/root-help-Do6N50zy.js +44 -0
- package/dist/route-reply-CxLiVUHW.js +141 -0
- package/dist/route-reply.runtime-WJUFT71F.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/rpc-DaMAO4N5.js +61 -0
- package/dist/rpc.runtime.js +1 -1
- package/dist/run-main-i1Lwkfhp.js +452 -0
- package/dist/runner-BhfpNH-y.js +1497 -0
- package/dist/runs-Dtgg0O85.js +495 -0
- package/dist/runtime-BkiJ7uXt.js +725 -0
- package/dist/runtime-DMH3YN2r.js +200 -0
- package/dist/runtime-Dbujl_K6.js +72 -0
- package/dist/runtime-api-CyQJnTq5.js +3 -0
- package/dist/runtime-api-DTGmvXqo.js +2 -0
- package/dist/runtime-api-XhgZNDDz.js +12 -0
- package/dist/runtime-embedded-pi.runtime-2IY46Gqk.js +3 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-hZStyXlw.js +9 -0
- package/dist/runtime-iikVqZe4.js +107 -0
- package/dist/runtime-internal-ezWrk6r4.js +2 -0
- package/dist/runtime-manifest.runtime.js +1 -1
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-plugins-Db6kuYci.js +69 -0
- package/dist/runtime-prepare.runtime-Cwi1gPe8.js +80 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-FNR5p8dE.js +21 -0
- package/dist/runtime-registry-loader-B2uTAkcu.js +2 -0
- package/dist/runtime-registry-loader-BSSFfiA2.js +58 -0
- package/dist/runtime-taskflow-BNYQSKvj.js +250 -0
- package/dist/runtime-web-tools-C2G_nK0L.js +1467 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/runtime-web-tools-manifest.runtime.js +1 -1
- package/dist/runtime-web-tools-public-artifacts.runtime.js +1 -1
- package/dist/runtime-xrE2MaAG.js +2 -0
- package/dist/sandbox-BvT5A1gq.js +2586 -0
- package/dist/sandbox-DcIgRqKW.js +4 -0
- package/dist/sandbox-cli-6nhldN9E.js +446 -0
- package/dist/secrets-cli-Cvl-P5yr.js +2099 -0
- package/dist/security-audit-BeGlFXMY.js +34 -0
- package/dist/security-cli-oVahjZR_.js +486 -0
- package/dist/semantic-dedup-CA-I7Ukf.js +95 -0
- package/dist/send-D85zCCtz.js +993 -0
- package/dist/server-A5MuFop-.js +13 -0
- package/dist/server-BeEiCBG9.js +77 -0
- package/dist/server-context-COXRgV8p.js +4164 -0
- package/dist/server-methods-CXboJZ1n.js +11666 -0
- package/dist/server-middleware-4ESC7-Sf.js +110 -0
- package/dist/server-node-events-CBlxJH3f.js +451 -0
- package/dist/server.impl-DZDIujUx.js +19517 -0
- package/dist/session-CA0A9yxZ.js +48 -0
- package/dist/session-archive.runtime.js +1 -1
- package/dist/session-conversation-BECTi25r.js +27 -0
- package/dist/session-file-B8YnZYnE.js +44 -0
- package/dist/session-fork.runtime.js +1 -1
- package/dist/session-key-DlOZb3y8.js +65 -0
- package/dist/session-meta-Mc12pE_f.js +109 -0
- package/dist/session-override-BOCk8YTE.js +103 -0
- package/dist/session-reset-model.runtime-Dd8V_Qvt.js +120 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-Di0Ge9fM.js +473 -0
- package/dist/session-subagent-reactivation.runtime-Cj6XCKz6.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-DGfXa1gc.js +553 -0
- package/dist/session-updates-D3PEvDgu.js +234 -0
- package/dist/session-updates.runtime-CkHjMzfc.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-D1IfM96V.js +915 -0
- package/dist/sessions-CEUVpAYU.js +2 -0
- package/dist/sessions-CoYhbu6F.js +45 -0
- package/dist/sessions-Dr45TPx1.js +226 -0
- package/dist/sessions.runtime-3gC3AX8f.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-CuKFik4t.js +496 -0
- package/dist/setup-DAJzkyY_.js +329 -0
- package/dist/setup-surface-Df7BhHSW.js +586 -0
- package/dist/setup.finalize-DhoSjlM4.js +432 -0
- package/dist/setup.gateway-config-B52nJix9.js +246 -0
- package/dist/shared-BYZv0yT8.js +218 -0
- package/dist/shared-D0v2yZO3.js +224 -0
- package/dist/shared-DNpedGYM.js +175 -0
- package/dist/shared-rD1K1AE-.js +36 -0
- package/dist/shared-runtime-C_5NHgLY.js +7 -0
- package/dist/short-term-promotion-BVTlPjVr.js +1631 -0
- package/dist/skill-commands-DRwVp1wc.js +82 -0
- package/dist/skill-commands.runtime-BKbablWg.js +2 -0
- package/dist/skill-commands.runtime.js +1 -1
- package/dist/skill-lifecycle-rVTllkZP.js +105 -0
- package/dist/skill-quality-gate-DHgd48qD.js +127 -0
- package/dist/skill-usage-tracker-B7aHh_Ob.js +31 -0
- package/dist/skills-cli-KHLSIaYT.js +370 -0
- package/dist/skills-install-Bi0q12q3.js +822 -0
- package/dist/speech-provider-BKPgfWII.js +103 -0
- package/dist/speech-provider-CqKVL2PU.js +184 -0
- package/dist/speech-provider-DaDkiNqQ.js +182 -0
- package/dist/speech-provider-DzPBhJrM.js +43 -0
- package/dist/speech-provider-vPL2J1om.js +167 -0
- package/dist/stage-sandbox-media.runtime-BKwxztks.js +230 -0
- package/dist/stage-sandbox-media.runtime.js +1 -1
- package/dist/state-dir-env-BwtlM2-b.js +156 -0
- package/dist/state-migrations-yqQW8QaA.js +822 -0
- package/dist/status-B1w-wvI5.js +278 -0
- package/dist/status-BhC5yy0h.js +479 -0
- package/dist/status-BnKPMpvt.js +473 -0
- package/dist/status-CRKDtvgH.js +391 -0
- package/dist/status-D9-BPbMq.js +3 -0
- package/dist/status-DuipKIlm.js +2 -0
- package/dist/status-I6cSEcXL.js +2 -0
- package/dist/status-all-dJ4Cgy30.js +487 -0
- package/dist/status-json-7SU-gA25.js +14 -0
- package/dist/status-json-command-SjLpkj4G.js +84 -0
- package/dist/status-runtime-shared-DAXwrfRv.js +254 -0
- package/dist/status.command.text-runtime-DBq5ztDE.js +15 -0
- package/dist/status.gateway-connection.runtime.js +1 -1
- package/dist/status.gateway-probe-BMXgnQZz.js +16 -0
- package/dist/status.link-channel-Co7PKXYC.js +35 -0
- package/dist/status.node-mode-BskByQcM.js +2 -0
- package/dist/status.node-mode-MNP21t-j.js +32 -0
- package/dist/status.scan-86I4Stxm.js +62 -0
- package/dist/status.scan-overview-CL7c8JQD.js +395 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json-C3Kd8f32.js +128 -0
- package/dist/status.scan.fast-json-DLYIlSmm.js +2 -0
- package/dist/status.scan.runtime-D7E5Jl1o.js +417 -0
- package/dist/status.scan.runtime.js +1 -1
- package/dist/status.summary-0CUmMOwK.js +209 -0
- package/dist/status.summary-Bc7FVtbT.js +2 -0
- package/dist/store-DEIAq0ow.js +190 -0
- package/dist/store-Dv1w50zD.js +1112 -0
- package/dist/store.runtime-CMb32WnT.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-CV2RD2-m.js +153 -0
- package/dist/stream-DcD1NqBt.js +649 -0
- package/dist/stream-wrappers-C7tDdQmU.js +144 -0
- package/dist/subagent-announce.registry.runtime-BN09hP9S.js +3 -0
- package/dist/subagent-announce.registry.runtime.js +1 -1
- package/dist/subagent-control-g8gumjoW.js +485 -0
- package/dist/subagent-followup.runtime-D8_8y-bE.js +68 -0
- package/dist/subagent-followup.runtime.js +1 -1
- package/dist/subagent-list-BQadcXKp.js +168 -0
- package/dist/subagent-orphan-recovery-DKtl7-gN.js +214 -0
- package/dist/subagent-registry-CgA-7Sw0.js +2888 -0
- package/dist/subagent-registry-runtime-U36TYYp-.js +2 -0
- package/dist/subagent-registry.runtime-BG_04MZ8.js +3 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-spawn-C-lFCaZU.js +781 -0
- package/dist/subagents-format-L-LSiKRw.js +628 -0
- package/dist/subcli-descriptors-BhcmMAKP.js +173 -0
- package/dist/supervisor-D0ax5pz4.js +737 -0
- package/dist/supervisor-log.runtime.js +1 -1
- package/dist/system-cli-R67ndVvg.js +59 -0
- package/dist/systemd-linger-BGik3fP6.js +2 -0
- package/dist/targets-fPlUpwy5.js +594 -0
- package/dist/targets.runtime.js +1 -1
- package/dist/task-executor-C5OqCdJT.js +350 -0
- package/dist/task-owner-access-DUUqFfrD.js +48 -0
- package/dist/task-registry-BLiMD4oJ.js +2346 -0
- package/dist/task-registry-control.runtime-r5niRcNj.js +3 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/task-registry-delivery-runtime-IKmxWzoW.js +3 -0
- package/dist/task-registry-delivery-runtime-OKU7m4ZJ.js +2 -0
- package/dist/task-registry.maintenance-BD6d9fLw.js +425 -0
- package/dist/task-registry.maintenance-BWULaP2e.js +2 -0
- package/dist/test.DNmyFkvJ-NRc14Xgm.js +13549 -0
- package/dist/testing-CaQDWPX6.js +441 -0
- package/dist/text-report-B1SlZa6w.js +587 -0
- package/dist/text-runtime-CNganbWZ.js +313 -0
- package/dist/thinking-policy-Cvv8S99b.js +25 -0
- package/dist/thread-bindings-1wsoDY-O.js +223 -0
- package/dist/tool-auth-shared-C6gQslQe.js +53 -0
- package/dist/tool-config-shared-RmlkWteZ.js +19 -0
- package/dist/tool-schema-runtime-CNP7lov-.js +1892 -0
- package/dist/tools-effective-inventory-D2LiEd3k.js +152 -0
- package/dist/tools.runtime-dLGMSI3J.js +4 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/topic-types-DbuGFU7y.js +176 -0
- package/dist/topic-types-zRlULO3k.js +2 -0
- package/dist/transcript-DYzzYksv.js +191 -0
- package/dist/transcript.runtime-ChFgiLq_.js +2 -0
- package/dist/transcript.runtime.js +1 -1
- package/dist/transport-policy-BHGu-DSE.js +75 -0
- package/dist/tts-lKPaxyDc.js +31 -0
- package/dist/tts.runtime-DLCeTRap.js +3 -0
- package/dist/tts.runtime.js +1 -1
- package/dist/tui-1ksaisKX.js +4017 -0
- package/dist/tui-cli-B809Ui8G.js +31 -0
- package/dist/uninstall-CG2Twdr_.js +172 -0
- package/dist/update-3rFnCBJG.js +1253 -0
- package/dist/update-cli-S6D0vMUi.js +1763 -0
- package/dist/update-runner-Cp7B-UEq.js +1490 -0
- package/dist/video-generation-provider-4GrzW0iH.js +240 -0
- package/dist/video-generation-provider-BFzOwA12.js +77 -0
- package/dist/video-generation-provider-BIqj5J7G.js +227 -0
- package/dist/video-generation-provider-BrpGBUIA.js +64 -0
- package/dist/video-generation-provider-Bww0w9Vg.js +263 -0
- package/dist/video-generation-provider-CAqz-_cR.js +246 -0
- package/dist/video-generation-provider-DVgCz9i4.js +181 -0
- package/dist/video-generation-provider-_ge0iP27.js +233 -0
- package/dist/video-generation-provider-cMUD_fls.js +104 -0
- package/dist/video-generation-provider-m9cCpntw.js +171 -0
- package/dist/video-model-catalog-CyWIvCKl.js +187 -0
- package/dist/web-search-BtwmRrNq.js +221 -0
- package/dist/web-search-provider-BpVY1JYn.js +155 -0
- package/dist/webhooks-cli-BGIp-CI4.js +321 -0
- package/dist/workspace-B5a0KS0o.js +306 -0
- package/dist/x-search-shared-lXehAzFd.js +109 -0
- package/package.json +1 -1
- package/dist/abort-BAZ4Ebr2.js +0 -202
- package/dist/abort-cutoff.runtime-igWwDxEw.js +0 -20
- package/dist/abort.runtime-DcpaA7X3.js +0 -2
- package/dist/acp-cli-fDFv0ZXk.js +0 -2171
- package/dist/acp-spawn-DMdjDkJ5.js +0 -1023
- package/dist/acp-stateful-target-driver-D5xSz_pT.js +0 -87
- package/dist/action-agents-qdK1hUqZ.js +0 -67
- package/dist/action-focus-CdznyCxX.js +0 -124
- package/dist/action-help-BXDtyZ9B.js +0 -7
- package/dist/action-info-DeYigB1U.js +0 -58
- package/dist/action-kill-BYYddQgx.js +0 -33
- package/dist/action-list-DCUxXaqg.js +0 -21
- package/dist/action-log-ta83LqJ5.js +0 -30
- package/dist/action-send-BwBxb6AI.js +0 -39
- package/dist/action-spawn-CDGEb2hC.js +0 -46
- package/dist/action-unfocus-MTpGUzeN.js +0 -28
- package/dist/agent-5S4TqcpJ.js +0 -2
- package/dist/agent-command-DYyWnBzs.js +0 -1479
- package/dist/agent-runner-utils-rqbgwfQ0.js +0 -202
- package/dist/agent-runner.runtime-CTRf_5bQ.js +0 -2825
- package/dist/agents-CfpAO55S.js +0 -887
- package/dist/agents-D-ZmUSjz.js +0 -5
- package/dist/api-C5y5vg1n.js +0 -35
- package/dist/api-CepvsESp.js +0 -5
- package/dist/api-CxsUi6pI.js +0 -4
- package/dist/api-D-WxCS9o.js +0 -16
- package/dist/api-D0KNG-Ur.js +0 -3
- package/dist/api-D2Ik6_Ws.js +0 -4
- package/dist/api-D2RppWnw.js +0 -3
- package/dist/api-DSlHQbdg.js +0 -2
- package/dist/api-DZMhnnQa.js +0 -2
- package/dist/api-Do7V2W5w.js +0 -5
- package/dist/api-Dzb-44IA.js +0 -45
- package/dist/api-Nut6qdm_.js +0 -2
- package/dist/api-YOeD914m.js +0 -19
- package/dist/api-uhRvZWia.js +0 -44
- package/dist/apply-BVSjDVZt.js +0 -493
- package/dist/apply.runtime-BHaqP4o2.js +0 -2
- package/dist/apply.runtime-CGLynFYo.js +0 -166
- package/dist/audit-D0PNQf9m.js +0 -885
- package/dist/audit-extra.async-fyXymls3.js +0 -847
- package/dist/audit.deep.runtime-T3-fGhge.js +0 -2
- package/dist/audit.nondeep.runtime-D-CVblWF.js +0 -859
- package/dist/audit.runtime-CjBqFqlt.js +0 -7
- package/dist/auth-CeX7bu-Z.js +0 -181
- package/dist/auth-choice-D5Gw60Q0.js +0 -3
- package/dist/auth-choice-DEMT93N0.js +0 -71
- package/dist/auth-choice-ilal0OWZ.js +0 -353
- package/dist/auth-choice-options-BwW-zFH5.js +0 -104
- package/dist/auth-choice-prompt--rfX_gS3.js +0 -2
- package/dist/auth-choice-prompt-X5e5PeD9.js +0 -36
- package/dist/auto-disable-BIMG7Fjd.js +0 -69
- package/dist/auto-disable-C-48B0tK.js +0 -2
- package/dist/banner-B6HSrIeR.js +0 -2
- package/dist/banner-Dd3dApUc.js +0 -290
- package/dist/binding-routing-cuSlltgJ.js +0 -50
- package/dist/binding-targets-Cx48IZQc.js +0 -99
- package/dist/bridge-server-CRtklB7G.js +0 -103
- package/dist/browser-node-runtime-BwLBwW3b.js +0 -12
- package/dist/browser-runtime-DjH_OV90.js +0 -377
- package/dist/capability-cli-KFyLj819.js +0 -1350
- package/dist/catalog-provider-B4tNRXms.js +0 -40
- package/dist/cdp.helpers-01EoG2KI.js +0 -372
- package/dist/channel-core-D1nci65b.js +0 -5
- package/dist/channel-plugin-resolution-xTnpOtic.js +0 -146
- package/dist/channel.runtime-DadpArDu.js +0 -399
- package/dist/channels-6yreyEBs.js +0 -1146
- package/dist/channels-cli-bimz2bUo.js +0 -247
- package/dist/chat-BFMiUu-G.js +0 -213
- package/dist/chrome-WA-FdKve.js +0 -1080
- package/dist/chrome.executables-BlV3kIfY.js +0 -541
- package/dist/clawbot-cli-BLdu0IQ8.js +0 -9
- package/dist/clawhub-BuLRhTNF.js +0 -400
- package/dist/cli-CDdqVrBY.js +0 -2
- package/dist/cli-DOuRcnxP.js +0 -2
- package/dist/cli-DgwVAGNK.js +0 -154
- package/dist/cli-DkIGpSHw.js +0 -57
- package/dist/cli-auth-seam-ynlvw1N6.js +0 -14
- package/dist/cli-backend-6x4Q-WdC.js +0 -66
- package/dist/cli-geEuOB-I.js +0 -191
- package/dist/cli-migration-ChII14Ro.js +0 -127
- package/dist/cli-runner-B1EhBITN.js +0 -1661
- package/dist/cli-runner.runtime-Boum-j7F.js +0 -3
- package/dist/cli-runner.runtime-h-ixiuX9.js +0 -2
- package/dist/cli-shared-Bz_H1_nP.js +0 -142
- package/dist/cli.runtime-D9B-1X3E.js +0 -819
- package/dist/collector-CkXyPwuF.js +0 -378
- package/dist/collector-Fmz7hWGE.js +0 -2
- package/dist/command-config-resolution-C7qsfOyi.js +0 -23
- package/dist/command-config-resolution-DaAgReAg.js +0 -2
- package/dist/command-execution-startup-BBpnISEp.js +0 -269
- package/dist/command-queue-BCnBBdS2.js +0 -260
- package/dist/command-registry-BXxYFSZD.js +0 -3
- package/dist/command-registry-CWHMKAbU.js +0 -108
- package/dist/command-secret-gateway-B-nb52Yw.js +0 -528
- package/dist/commands-acp-B6t0636h.js +0 -1017
- package/dist/commands-compact.runtime-Bs4Jrohf.js +0 -10
- package/dist/commands-core.runtime-uSBWVpXt.js +0 -2
- package/dist/commands-handlers.runtime-i2DbzlBK.js +0 -3762
- package/dist/commands-models-iSG3asW2.js +0 -306
- package/dist/commands-reset-hooks-CRo29fjd.js +0 -129
- package/dist/commands-status-CDGtgSo_.js +0 -223
- package/dist/commands-status.runtime-VMRV_4zg.js +0 -2
- package/dist/commands-subagents-control.runtime-B8wUjfcG.js +0 -3
- package/dist/commands-subagents-control.runtime-DlZEcLMM.js +0 -2
- package/dist/commands.runtime-faXcqJ1G.js +0 -103
- package/dist/comment-shared-CZcHHaVj.js +0 -40
- package/dist/compact-CJd53VDB.js +0 -11322
- package/dist/compact.runtime-BM5uCK5R.js +0 -7
- package/dist/completion-cli-CYgAzE_f.js +0 -2
- package/dist/completion-cli-W2b6VuQY.js +0 -464
- package/dist/config-B3ly_OWp.js +0 -2
- package/dist/config-BZWQh368.js +0 -136
- package/dist/config-CAo3Ki55.js +0 -101
- package/dist/config-DHTe4Ity.js +0 -166
- package/dist/config-cli-W3JjPbd5.js +0 -947
- package/dist/config-defaults-BQ8HCUkk.js +0 -163
- package/dist/config-guard-BWis2bnW.js +0 -94
- package/dist/config-runtime-Buoon-Hh.js +0 -14
- package/dist/config-validation-DiYgptBq.js +0 -279
- package/dist/configure-Bza-h92_.js +0 -1159
- package/dist/configure-DBn0SJq4.js +0 -2
- package/dist/context-writer-vqAKHKCE.js +0 -286
- package/dist/control-auth-OK_tGODq.js +0 -122
- package/dist/conversation-id-CRxR5h1M.js +0 -140
- package/dist/conversation-runtime-BijGAsoO.js +0 -31
- package/dist/core-DgA4TZVZ.js +0 -210
- package/dist/core-command-descriptors-CLSA5Moa.js +0 -106
- package/dist/cron-cli-Dm_zUhf-.js +0 -637
- package/dist/curator-BPSUUSGi.js +0 -586
- package/dist/daemon-cli-DZEJkmJ3.js +0 -416
- package/dist/daemon-install--tdrtKs3.js +0 -63
- package/dist/delegate-UEuflcXA.js +0 -61
- package/dist/deliver-BALTiw7q.js +0 -782
- package/dist/deliver-D0l9CtEc.js +0 -3
- package/dist/deliver-runtime-Dq4JvMOl.js +0 -2
- package/dist/delivery-outbound.runtime-CWIWrBQ9.js +0 -6
- package/dist/delivery-queue--ayb_Pk_.js +0 -2
- package/dist/delivery-queue-BwVoZNGI.js +0 -372
- package/dist/detect-BgviB4L6.js +0 -113
- package/dist/devices-cli-BdpXHC-r.js +0 -329
- package/dist/diagnostic-IuQCudMt.js +0 -311
- package/dist/direct-dm-DJMPWBuI.js +0 -139
- package/dist/directive-handling.fast-lane-f0CLC4-E.js +0 -2
- package/dist/directive-handling.fast-lane-sh0YnNSx.js +0 -64
- package/dist/directive-handling.impl-B7o2ov0i.js +0 -2
- package/dist/directive-handling.impl-a0yZtzf0.js +0 -659
- package/dist/directive-handling.parse-UrrfLTt9.js +0 -376
- package/dist/directive-handling.persist-DMdCGdJo.js +0 -139
- package/dist/directive-handling.persist.runtime-Bj-oQrrf.js +0 -2
- package/dist/directive-handling.shared-B3kBVf8z.js +0 -159
- package/dist/directory-cli-Dd1zPBaO.js +0 -239
- package/dist/dispatch-acp-D_6seEb3.js +0 -969
- package/dist/dispatch-acp-manager.runtime-CblPKuWP.js +0 -3
- package/dist/dispatch-acp-media.runtime-jQ51iwVZ.js +0 -3
- package/dist/dispatch-acp-session.runtime-CztwPJU8.js +0 -2
- package/dist/dispatch-acp-tts.runtime-CYwftiQH.js +0 -3
- package/dist/dispatch-acp.runtime-CslN35Tv.js +0 -19
- package/dist/dispatch-rlOjKp0R.js +0 -1041
- package/dist/dns-cli-oGpuQf5e.js +0 -192
- package/dist/doctor-completion-DzuKPgxo.js +0 -90
- package/dist/doctor-config-preflight-BvbXh8XL.js +0 -2
- package/dist/doctor-config-preflight-gAI_GeuH.js +0 -148
- package/dist/doctor-state-migrations-BVYC3Dnw.js +0 -2
- package/dist/doctor-state-migrations-Bb5ljS8B.js +0 -3
- package/dist/drive-C-EcQpgt.js +0 -750
- package/dist/embedding-provider-p9lV_6yT.js +0 -129
- package/dist/engine-lzlFl9eS.js +0 -72
- package/dist/entry-capabilities-C4wBXlqX.js +0 -89
- package/dist/exec-approval-forwarder.runtime-pAraMyEv.js +0 -3
- package/dist/exec-approvals-cli-DFRUYivK.js +0 -484
- package/dist/exec-defaults-DiLurRDC.js +0 -1440
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/dist/extensions/diffs/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/dist/extensions/diffs/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/dist/extensions/diffs/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/dist/extensions/diffs/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/dist/extensions/diffs/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/dist/extensions/diffs/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/dist/extensions/feishu/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/dist/extensions/feishu/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/dist/extensions/feishu/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/dist/extensions/feishu/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/dist/extensions/feishu/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/dist/extensions/feishu/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- package/dist/fragment-collector-BCPVxm0P.js +0 -189
- package/dist/fragment-store-9TxXgGV-.js +0 -218
- package/dist/fragment-store-BHYVqNjU.js +0 -2
- package/dist/gateway-cli-Apcziann.js +0 -1518
- package/dist/gateway-discovery-targets-B_svEsZh.js +0 -431
- package/dist/gateway-install-token-DYyEiJEM.js +0 -284
- package/dist/gateway-rpc-rkIqagFK.js +0 -14
- package/dist/gateway-secret-options-DqYvLFrh.js +0 -38
- package/dist/gemini-cli-provider-D_Q97B93.js +0 -106
- package/dist/gemini-web-search-provider-C5AqCOHg.js +0 -167
- package/dist/get-reply-from-config.runtime-yQ65D-BO.js +0 -2
- package/dist/git-commit-CYrjhrEv.js +0 -2
- package/dist/hard-trigger-CWQ1TzAM.js +0 -98
- package/dist/health-C-3mkxI4.js +0 -2
- package/dist/health-Jkvh_gy_.js +0 -579
- package/dist/heartbeat-runner-COZgAa6a.js +0 -4
- package/dist/heartbeat-runner-c-hruBTy.js +0 -1209
- package/dist/heartbeat-runner.runtime-CGjPrCRu.js +0 -2
- package/dist/help-ChHRacYd.js +0 -81
- package/dist/hooks-cli-Be0aA_p5.js +0 -354
- package/dist/hooks-status-y8H2HWQf.js +0 -86
- package/dist/image-generation-core-DmsyCN1n.js +0 -17
- package/dist/image-generation-provider-BV6Pfe-s.js +0 -136
- package/dist/image-generation-provider-BlMt8X7X.js +0 -94
- package/dist/image-generation-provider-BoAxEAD_.js +0 -130
- package/dist/image-generation-provider-CrsgbMNJ.js +0 -163
- package/dist/image-generation-provider-ppz9PIhB.js +0 -279
- package/dist/image-runtime-DHMm2iiA.js +0 -7
- package/dist/inbound-reply-dispatch-D4pxE_PL.js +0 -73
- package/dist/inbound.runtime-CgrGH800.js +0 -4
- package/dist/inbound.runtime-ddIkY_PP.js +0 -3
- package/dist/ingest-CUZSOIc_.js +0 -2
- package/dist/ingest-DAxhsmxh.js +0 -691
- package/dist/install-3w_mg2Qx.js +0 -662
- package/dist/install-security-scan-C-6bE5h5.js +0 -22
- package/dist/install-security-scan.runtime-B_GzpPuC.js +0 -299
- package/dist/install-skills-YwdSU6-H.js +0 -70
- package/dist/install.runtime-B-r9-spQ.js +0 -27
- package/dist/install.runtime-Cy-vGIfI.js +0 -12
- package/dist/kaijibot-tools-oT0CsNSN.js +0 -9233
- package/dist/kaijibot-tools.runtime-SmBrfYIG.js +0 -2
- package/dist/kimi-web-search-provider-CH8BxsLJ.js +0 -308
- package/dist/lancedb-runtime-SvOqB09K.js +0 -201
- package/dist/library-BAFScIar.js +0 -45
- package/dist/list.runtime-CpyEd39c.js +0 -9
- package/dist/list.runtime-DC4mjmHx.js +0 -12
- package/dist/llm-draft-generator-DCqJ5qYk.js +0 -567
- package/dist/llm-draft-generator-DRAYzsiM.js +0 -2
- package/dist/llm-engine-BFVOaalJ.js +0 -1829
- package/dist/llm-engine-Bi8xqCtn.js +0 -2
- package/dist/login-D-oLC3GG.js +0 -108
- package/dist/logs-cli-DWeiHJ3L.js +0 -264
- package/dist/manager-CO5bSnH2.js +0 -3301
- package/dist/manager-Mv-1Vint.js +0 -2048
- package/dist/mcp-cli-D-6e6tc4.js +0 -723
- package/dist/media-runtime-vNPB_wvw.js +0 -312
- package/dist/media-understanding-LgBsXLVI.js +0 -83
- package/dist/media-understanding-provider-BOjajU5r.js +0 -18
- package/dist/media-understanding-provider-BTwJ_UWh.js +0 -112
- package/dist/media-understanding-provider-BXCpgh96.js +0 -13
- package/dist/media-understanding-provider-B_nfix0N.js +0 -30
- package/dist/media-understanding-provider-C6Wlc9vT.js +0 -21
- package/dist/media-understanding-provider-CvCuZ9SC.js +0 -14
- package/dist/media-understanding-provider-D7M3-aQh.js +0 -67
- package/dist/media-understanding-provider-DcEr1WSL.js +0 -123
- package/dist/media-understanding-provider-Ph7rGWKI.js +0 -37
- package/dist/media-understanding-provider-Wri695dH.js +0 -69
- package/dist/media-understanding-provider-um6kxSmK.js +0 -18
- package/dist/media-understanding-runtime-DJKuKxY0.js +0 -2
- package/dist/memory-B1XoiBa2.js +0 -3
- package/dist/memory-CYhHObg6.js +0 -242
- package/dist/memory-core-host-runtime-cli-DKoKyS93.js +0 -9
- package/dist/memory-index-BJqUmQXm.js +0 -2
- package/dist/memory-index-BUBt9yHK.js +0 -514
- package/dist/memory-repair-BhB6W5xm.js +0 -2
- package/dist/message-DVdUnIlB.js +0 -223
- package/dist/message-action-runner-QfFvL3oa.js +0 -2
- package/dist/message-action-runner-Y7yazXbD.js +0 -1628
- package/dist/metadata-registry-loader-DWwP6rZg.js +0 -2
- package/dist/minimax-web-search-provider-QCTjMoVf.js +0 -165
- package/dist/mmr-B1GMktQo.js +0 -146
- package/dist/model-catalog-CA2IsB6Z.js +0 -157
- package/dist/model-definitions-BNLayQ7G.js +0 -74
- package/dist/model-definitions-DejSv-w8.js +0 -28
- package/dist/model-definitions-DhIGF3DB.js +0 -258
- package/dist/model-picker-BoTUAvyS.js +0 -3
- package/dist/model-picker-zTMq5U_r.js +0 -490
- package/dist/model-picker.runtime-COHk6fb4.js +0 -15
- package/dist/model-selection-FnwgRfx6.js +0 -381
- package/dist/models-3LfDzypw.js +0 -2584
- package/dist/models-8gXAOc0J.js +0 -555
- package/dist/models-BQ8ZS754.js +0 -18
- package/dist/models-BXgvHura.js +0 -760
- package/dist/models-BdrRvR0O.js +0 -157
- package/dist/models-Be6rN_97.js +0 -19
- package/dist/models-CgvFbxD_.js +0 -47
- package/dist/models-Dq3fePTE.js +0 -18
- package/dist/models-_CdIkMJJ.js +0 -2
- package/dist/models-cli-ChSB3jod.js +0 -197
- package/dist/models.fetch-BlOH1ObL.js +0 -518
- package/dist/monitor-SKMOYue_.js +0 -4435
- package/dist/music-generation-provider-CAgLx7IH.js +0 -169
- package/dist/music-generation-provider-CWV2efO0.js +0 -142
- package/dist/music-generation-provider-tvRm1diG.js +0 -238
- package/dist/node-cli-CnQUquRc.js +0 -2362
- package/dist/nodes-cli-k8tVMKp0.js +0 -1046
- package/dist/notify-Da_SjUtR.js +0 -305
- package/dist/oauth-BgpHp4DM.js +0 -152
- package/dist/oauth-CnJkK1xf.js +0 -57
- package/dist/oauth-token-shared-GMxqYtaF.js +0 -28
- package/dist/oauth.credentials-Bz3A0tpU.js +0 -165
- package/dist/oauth.flow-C1pBobyI.js +0 -122
- package/dist/oauth.settings-DO5ybG8C.js +0 -44
- package/dist/oauth.token-BiOjbfIt.js +0 -43
- package/dist/onboard-4cz1qQ_A.js +0 -25
- package/dist/onboard-BDsdPtMZ.js +0 -25
- package/dist/onboard-BMwN-mJd.js +0 -29
- package/dist/onboard-BdGGek2m.js +0 -26
- package/dist/onboard-BfesemW3.js +0 -34
- package/dist/onboard-C5lGFfDY.js +0 -39
- package/dist/onboard-CNrLUedN.js +0 -25
- package/dist/onboard-CR_sdI-6.js +0 -29
- package/dist/onboard-CpyvClpQ.js +0 -621
- package/dist/onboard-CuviKb6n2.js +0 -54
- package/dist/onboard-D2FOrkio.js +0 -67
- package/dist/onboard-DAt-DAZJ.js +0 -22
- package/dist/onboard-DIurCAm9.js +0 -36
- package/dist/onboard-DJZmbiCZ.js +0 -58
- package/dist/onboard-NUWGhXYK.js +0 -48
- package/dist/onboard-_zwmdns7.js +0 -312
- package/dist/onboard-channels-8xjH4Rxx.js +0 -2
- package/dist/onboard-channels-C5YcSaTV.js +0 -1260
- package/dist/onboard-config-BPXiaYYN.js +0 -2
- package/dist/onboard-custom-CbvrlqwN.js +0 -2
- package/dist/onboard-custom-DpGZWCkE.js +0 -647
- package/dist/onboard-helpers-BkgpYw91.js +0 -223
- package/dist/onboard-helpers-DNXP1va5.js +0 -5
- package/dist/onboard-hooks-DBikJ6h9.js +0 -35
- package/dist/onboard-remote-CGGcjWRI.js +0 -193
- package/dist/onboard-remote-CjC2kFSP.js +0 -2
- package/dist/onboard-search-_eepOkzc.js +0 -324
- package/dist/onboard-skills-BhHUGPqh.js +0 -2
- package/dist/onboard-skills-CEzVQ_WL.js +0 -134
- package/dist/openai-codex-auth-identity-D-KQbSyQ.js +0 -45
- package/dist/openai-codex-cli-auth-CuaNZ-Xi.js +0 -57
- package/dist/openai-codex-provider-CbIKBwnQ.js +0 -299
- package/dist/openai-codex-shared-C17lyOLN.js +0 -6
- package/dist/openai-provider-CgI6oZZJ.js +0 -283
- package/dist/openclaw-migrator-ulNNIw-g.js +0 -2
- package/dist/pair-command-approve-B6cPcRmP.js +0 -34
- package/dist/pairing-cli-Dopy7pMf.js +0 -117
- package/dist/perplexity-web-search-provider-CLfCz5ll.js +0 -92
- package/dist/perplexity-web-search-provider.runtime-BlBBCnh1.js +0 -332
- package/dist/perplexity-web-search-provider.runtime-F_tn1b70.js +0 -2
- package/dist/persistent-bindings.lifecycle-4Sj3YvH6.js +0 -94
- package/dist/pi-embedded-CXUV32ut.js +0 -2
- package/dist/pi-embedded-DoNNtCWr.js +0 -6
- package/dist/pi-embedded-runner-Dq4lYjca.js +0 -8346
- package/dist/pi-embedded-subscribe.handlers.compaction.runtime-Ca5o8DbU.js +0 -23
- package/dist/pi-embedded.runtime-BCRJuvse.js +0 -5
- package/dist/pi-tools.before-tool-call.runtime-B6HYOE8c.js +0 -354
- package/dist/plugin-enabled-CKRm8wtW.js +0 -71
- package/dist/plugin-install-CybWKOIa.js +0 -2
- package/dist/plugin-install-config-policy-DTrvBgla.js +0 -137
- package/dist/plugin-install-oAl4Yczg.js +0 -227
- package/dist/plugin-install-plan-DLIR_ZqM.js +0 -50
- package/dist/plugin-registration-BmV1gqZB.js +0 -23
- package/dist/plugin-registry-1Rq5Tmvl.js +0 -3
- package/dist/plugin-registry-DL8pf5Mp.js +0 -2
- package/dist/plugin-registry-loader-CAAg3dpS.js +0 -22
- package/dist/plugin-service-CK4Rim4g.js +0 -2494
- package/dist/plugins-cli-CjQt0z09.js +0 -566
- package/dist/plugins-command-helpers-AJAozWnL.js +0 -117
- package/dist/plugins-install-persist-Dj-wP3UP.js +0 -121
- package/dist/plugins-update-command-DfAN1qbt.js +0 -1008
- package/dist/policy-B_C91HSo.js +0 -172
- package/dist/preemptive-compaction-DHty3miI.js +0 -430
- package/dist/proactive-scheduler-BQynqyS0.js +0 -1287
- package/dist/probe-CASgRLVo.js +0 -426
- package/dist/probe-auth-Crs0lOpZ.js +0 -3
- package/dist/program-BlfK81FP.js +0 -111
- package/dist/program-context-BgeVW_T_.js +0 -2
- package/dist/prompt-overlay-v0MJ0MCL.js +0 -72
- package/dist/prompt-select-styled-Dzmrxj1a.js +0 -5299
- package/dist/provider-BilPcosq.js +0 -70
- package/dist/provider-api-key-auth-CgLB-D5X.js +0 -113
- package/dist/provider-auth-DBykvpJk.js +0 -36
- package/dist/provider-auth-api-key-BFqSZqff.js +0 -5
- package/dist/provider-auth-choice-mXKWNw2A.js +0 -134
- package/dist/provider-auth-choice-preference-C8geLQZU.js +0 -62
- package/dist/provider-auth-login-C8nHiSGB.js +0 -8
- package/dist/provider-auth-login.runtime-Bw7qvsMK.js +0 -206
- package/dist/provider-catalog-BLuW7xxm.js +0 -18
- package/dist/provider-catalog-Ba8jbbQC.js +0 -11
- package/dist/provider-catalog-BezjZlH4.js +0 -11
- package/dist/provider-catalog-Bzs0kPzn.js +0 -13
- package/dist/provider-catalog-CXItaIYb.js +0 -11
- package/dist/provider-catalog-CaVK2dyj.js +0 -12
- package/dist/provider-catalog-CcWsqYpE.js +0 -61
- package/dist/provider-catalog-CksVg6Lz.js +0 -16
- package/dist/provider-catalog-CvVlJ7h-.js +0 -26
- package/dist/provider-catalog-Dh9jKgh9.js +0 -56
- package/dist/provider-catalog-Dm1dfTk-.js +0 -11
- package/dist/provider-catalog-DqcQOA4Z.js +0 -17
- package/dist/provider-catalog-pqamOkUm.js +0 -16
- package/dist/provider-compat-D9qDQQMG.js +0 -37
- package/dist/provider-dispatcher-C3XfRHRF.js +0 -22
- package/dist/provider-entry-zMxxN1fH.js +0 -97
- package/dist/provider-flow-ao7lxs66.js +0 -66
- package/dist/provider-models-CuPoy-A4.js +0 -119
- package/dist/provider-models-DU2n84FS.js +0 -116
- package/dist/provider-models-jw0IBHgS.js +0 -35
- package/dist/provider-registration-6GPZtKMt.js +0 -57
- package/dist/provider-registration-CjmTFGKf.js +0 -238
- package/dist/push-apns-Bzrexlse.js +0 -1013
- package/dist/pw-ai-C7JdV54y.js +0 -2268
- package/dist/qmd-manager-T2BUCG7n.js +0 -1799
- package/dist/qr-cli-B_e_0-SF.js +0 -359
- package/dist/qr-cli-rxc0H2Mk.js +0 -2
- package/dist/qr-image-BYACGRPv.js +0 -2
- package/dist/queue-CF6El_UA.js +0 -636
- package/dist/realtime-provider-shared-Yd1KkPvt.js +0 -21
- package/dist/realtime-transcription-provider-DwmEvubU.js +0 -180
- package/dist/realtime-voice-provider-T861rzVh.js +0 -342
- package/dist/record-shared-BKxprVFr.js +0 -10
- package/dist/region--gybyKDE.js +0 -74
- package/dist/register-command-groups-1_FI6ux5.js +0 -121
- package/dist/register.agent-Bhv7o14f.js +0 -241
- package/dist/register.configure-Bix6QVEo.js +0 -15
- package/dist/register.maintenance-Bw2Dbvb6.js +0 -438
- package/dist/register.message-PxnL8FCg.js +0 -601
- package/dist/register.migrate-DLiZYeE7.js +0 -195
- package/dist/register.onboard-CfOvvN5q.js +0 -79
- package/dist/register.runtime--HXgNnrv.js +0 -343
- package/dist/register.runtime-DJaq2P7l.js +0 -81
- package/dist/register.setup-B0IYNZZy.js +0 -104
- package/dist/register.status-health-sessions-5Avwn_Rh.js +0 -1210
- package/dist/register.subclis-Bhqe4RNX.js +0 -3
- package/dist/register.subclis-CwyReoC0.js +0 -237
- package/dist/replay-policy-DRHPdlTy.js +0 -8
- package/dist/reply-DsQGSqHM.js +0 -3498
- package/dist/reply.runtime-BoEhxvtc.js +0 -2
- package/dist/resolve-vsY3RgCu.js +0 -280
- package/dist/root-help-C9EaUEol.js +0 -44
- package/dist/route-reply-yzqZEMM1.js +0 -141
- package/dist/route-reply.runtime-Dn_gMZjY.js +0 -2
- package/dist/rpc-DZksOtsP.js +0 -61
- package/dist/run-main-29gZWc8b.js +0 -452
- package/dist/runner-W6n2pkfJ.js +0 -1497
- package/dist/runs-OzLk07t4.js +0 -495
- package/dist/runtime-CGl5K_IU.js +0 -72
- package/dist/runtime-D0vBMNhQ.js +0 -2
- package/dist/runtime-DFgQhIdO.js +0 -725
- package/dist/runtime-DKfK_AD5.js +0 -107
- package/dist/runtime-DyrhCUAq.js +0 -200
- package/dist/runtime-api-BDFg7VKM.js +0 -2
- package/dist/runtime-api-BWcPxjgR.js +0 -3
- package/dist/runtime-api-C1USU1Xg.js +0 -12
- package/dist/runtime-embedded-pi.runtime-CMNGvq_M.js +0 -3
- package/dist/runtime-internal-BjxS9kh1.js +0 -2
- package/dist/runtime-plugins-BrjMM_2S.js +0 -69
- package/dist/runtime-prepare.runtime-C5uhgIL5.js +0 -80
- package/dist/runtime-provider-Bd6DTZcR.js +0 -21
- package/dist/runtime-qvUIWcEn.js +0 -9
- package/dist/runtime-registry-loader-DC_zdtAM.js +0 -58
- package/dist/runtime-registry-loader-ZJtMVrYf.js +0 -2
- package/dist/runtime-taskflow-DkJ0OEcb.js +0 -250
- package/dist/runtime-web-tools-Caph1Q8W.js +0 -1467
- package/dist/sandbox-BPefFVsD.js +0 -2586
- package/dist/sandbox-VqaevbKP.js +0 -4
- package/dist/sandbox-cli-Dmz8tNOk.js +0 -446
- package/dist/secrets-cli-DjJm5KkT.js +0 -2099
- package/dist/security-audit-sGsom2f1.js +0 -34
- package/dist/security-cli-2B9RasP6.js +0 -486
- package/dist/semantic-dedup-I5wMh6pu.js +0 -95
- package/dist/send-CHJpeuAq.js +0 -993
- package/dist/server-Cf1sUtlR.js +0 -13
- package/dist/server-ChrBeFtC.js +0 -77
- package/dist/server-context-C9DshDZM.js +0 -4164
- package/dist/server-methods-42GWgP-w.js +0 -11666
- package/dist/server-middleware-DpGttIke.js +0 -110
- package/dist/server-node-events-LXraw8n1.js +0 -451
- package/dist/server.impl-DcCSaFuL.js +0 -19522
- package/dist/session-DB-oGCus.js +0 -48
- package/dist/session-conversation-BVC-IDB-.js +0 -27
- package/dist/session-file-DcogHTZ9.js +0 -44
- package/dist/session-key-BeN4V5Ps.js +0 -65
- package/dist/session-meta-B2LNjKYp.js +0 -109
- package/dist/session-override-DT7hcbx1.js +0 -103
- package/dist/session-reset-model.runtime-DKJSQ8Rr.js +0 -120
- package/dist/session-reset-service-DFqsF-Zh.js +0 -473
- package/dist/session-subagent-reactivation.runtime-yj_xOXm2.js +0 -2
- package/dist/session-tab-registry-C5JZRgsa.js +0 -553
- package/dist/session-updates-Z-4cmoh_.js +0 -234
- package/dist/session-updates.runtime-Co08h535.js +0 -2
- package/dist/session-utils-Cxgqr7-c.js +0 -915
- package/dist/sessions-BgcN8F-X.js +0 -226
- package/dist/sessions-Ciwd_Ht8.js +0 -2
- package/dist/sessions-DE-AO5Jk.js +0 -45
- package/dist/sessions.runtime-CG1opxuM.js +0 -2
- package/dist/setup-BysllKEA.js +0 -496
- package/dist/setup-ayo63KAb.js +0 -329
- package/dist/setup-surface-DbrOe3E8.js +0 -586
- package/dist/setup.finalize-DhLR2yO4.js +0 -432
- package/dist/setup.gateway-config-Df2_Em8i.js +0 -246
- package/dist/shared-B-rMwdad.js +0 -218
- package/dist/shared-BWdSBVdK.js +0 -224
- package/dist/shared-BX9blqPL.js +0 -36
- package/dist/shared-C_-wWbDm.js +0 -175
- package/dist/shared-runtime-rz9t-KLz.js +0 -7
- package/dist/short-term-promotion-FgE_Jnib.js +0 -1631
- package/dist/skill-commands-FgYq8X4R.js +0 -82
- package/dist/skill-commands.runtime-CUJDRqa1.js +0 -2
- package/dist/skill-lifecycle-BVV6fXSs.js +0 -105
- package/dist/skill-quality-gate-4pWY82-e.js +0 -127
- package/dist/skill-usage-tracker-BxM2RLxT.js +0 -31
- package/dist/skills-cli-LwJDf23u.js +0 -370
- package/dist/skills-install-CkncHLZo.js +0 -822
- package/dist/speech-provider-CMtHMx9Y.js +0 -182
- package/dist/speech-provider-DczkEjhR.js +0 -103
- package/dist/speech-provider-Mv_D3qiG.js +0 -43
- package/dist/speech-provider-US8CydoJ.js +0 -167
- package/dist/speech-provider-WWkc6FaL.js +0 -184
- package/dist/stage-sandbox-media.runtime-D71Kd4Ch.js +0 -230
- package/dist/state-dir-env-DYjPXVYi.js +0 -156
- package/dist/state-migrations-B6uRvX1P.js +0 -822
- package/dist/status-BBFiEAa-.js +0 -391
- package/dist/status-CcJcQrD4.js +0 -479
- package/dist/status-CoxoUT8_.js +0 -473
- package/dist/status-DNCnieP0.js +0 -2
- package/dist/status-DpqurBP_.js +0 -3
- package/dist/status-OQhsSx2y.js +0 -2
- package/dist/status-all-CMnGLf_-.js +0 -487
- package/dist/status-json-LKYWmcM2.js +0 -14
- package/dist/status-json-command-ChpTTpoM.js +0 -84
- package/dist/status-runtime-shared-D-NmIA_0.js +0 -254
- package/dist/status-wtlbmlzi.js +0 -278
- package/dist/status.command.text-runtime-B-0GXh3N.js +0 -15
- package/dist/status.gateway-probe-Bqtogs2U.js +0 -16
- package/dist/status.link-channel-BPe4GfI5.js +0 -35
- package/dist/status.node-mode-Chn_dsMR.js +0 -32
- package/dist/status.node-mode-CqkA7hYz.js +0 -2
- package/dist/status.scan-Cwao8eXh.js +0 -62
- package/dist/status.scan-overview-_YjgtE8T.js +0 -395
- package/dist/status.scan.fast-json-BDSAZ_0A.js +0 -128
- package/dist/status.scan.fast-json-D0XMZbbT.js +0 -2
- package/dist/status.scan.runtime-KroF5nhu.js +0 -417
- package/dist/status.summary-CdBWpLqd.js +0 -2
- package/dist/status.summary-jy2zyMVD.js +0 -209
- package/dist/store-BAOUBmZQ.js +0 -190
- package/dist/store-Da7djjD4.js +0 -1112
- package/dist/store.runtime-abrTHLrz.js +0 -2
- package/dist/stream-DTFokQkL.js +0 -153
- package/dist/stream-DjBbXFCo.js +0 -649
- package/dist/stream-wrappers-DyQzM00M.js +0 -144
- package/dist/subagent-announce.registry.runtime-BABRFSMF.js +0 -3
- package/dist/subagent-control-D2OSqmZ7.js +0 -485
- package/dist/subagent-followup.runtime-DTNKCe5w.js +0 -68
- package/dist/subagent-list-MAV67Sxm.js +0 -168
- package/dist/subagent-orphan-recovery-Kzzz2mgk.js +0 -214
- package/dist/subagent-registry-CTAMEje4.js +0 -2888
- package/dist/subagent-registry-runtime-CP_a8qhv.js +0 -2
- package/dist/subagent-registry.runtime-DeC3RNRE.js +0 -3
- package/dist/subagent-spawn-C5uY3sfO.js +0 -781
- package/dist/subagents-format-D73DetCG.js +0 -628
- package/dist/subcli-descriptors-DlMSW5i6.js +0 -173
- package/dist/supervisor-BahyZDOz.js +0 -737
- package/dist/system-cli-Dt32QC1G.js +0 -59
- package/dist/systemd-linger-3DzEUocY.js +0 -2
- package/dist/targets-CnJhw62V.js +0 -594
- package/dist/task-executor-BBNtTTy3.js +0 -350
- package/dist/task-owner-access-CnjSqyDU.js +0 -48
- package/dist/task-registry-BEFL1tD7.js +0 -2346
- package/dist/task-registry-control.runtime-Dgk5Yb4X.js +0 -3
- package/dist/task-registry-delivery-runtime-BiITP8us.js +0 -2
- package/dist/task-registry-delivery-runtime-V0EObe7x.js +0 -3
- package/dist/task-registry.maintenance-CRGVNmNv.js +0 -2
- package/dist/task-registry.maintenance-E1MKWD6e.js +0 -425
- package/dist/test.DNmyFkvJ-DJRLm6sy.js +0 -13549
- package/dist/testing-ehflWoVg.js +0 -441
- package/dist/text-report-XuvHwHc9.js +0 -587
- package/dist/text-runtime-DsiP7VdZ.js +0 -313
- package/dist/thinking-policy-ZVmg-bUw.js +0 -25
- package/dist/thread-bindings-BCS_rM9y.js +0 -223
- package/dist/tool-auth-shared-DdmOv578.js +0 -53
- package/dist/tool-config-shared-CP5dDyyW.js +0 -19
- package/dist/tool-schema-runtime-BjWzmAN3.js +0 -1892
- package/dist/tools-effective-inventory-Dy07SBEL.js +0 -152
- package/dist/tools.runtime-DImY1euX.js +0 -4
- package/dist/topic-types-BXXY5uZL.js +0 -176
- package/dist/topic-types-CDaB_YbE.js +0 -2
- package/dist/transcript-CF5_OBmp.js +0 -191
- package/dist/transcript.runtime-D5nr49Ef.js +0 -2
- package/dist/transport-policy-w54T42K4.js +0 -75
- package/dist/tts-zh6pvJpM.js +0 -31
- package/dist/tts.runtime-CWxkpW7l.js +0 -3
- package/dist/tui-cli-Ci0sIDB1.js +0 -31
- package/dist/tui-h4YVnTtv.js +0 -4017
- package/dist/uninstall-D37a24rS.js +0 -172
- package/dist/update-Y8g3ecTl.js +0 -1253
- package/dist/update-cli-D3D_lWB1.js +0 -1763
- package/dist/update-runner-YEixuUNC.js +0 -1490
- package/dist/vault--pPeoJoM.js +0 -64
- package/dist/vault-ETiei3jF.js +0 -2
- package/dist/video-generation-provider-BfYPJ2X3.js +0 -227
- package/dist/video-generation-provider-BhdoE2LB.js +0 -77
- package/dist/video-generation-provider-BltQBaCu.js +0 -171
- package/dist/video-generation-provider-C6Y4MTBa.js +0 -233
- package/dist/video-generation-provider-CPMWGfJj.js +0 -64
- package/dist/video-generation-provider-CTEKMPLy.js +0 -240
- package/dist/video-generation-provider-CcCvv3LR.js +0 -104
- package/dist/video-generation-provider-CpGtTNnb.js +0 -246
- package/dist/video-generation-provider-CvpbK0Tj.js +0 -263
- package/dist/video-generation-provider-PvbMacjT.js +0 -181
- package/dist/video-model-catalog-Cp71BhF6.js +0 -187
- package/dist/web-search-DP15ZlNE.js +0 -221
- package/dist/web-search-provider-CpRV6QJI.js +0 -155
- package/dist/webhooks-cli-DdLGU5xA.js +0 -321
- package/dist/workspace-BpzmLImG.js +0 -306
- package/dist/x-search-shared-D-L79ilT.js +0 -109
- /package/dist/{api-BFKI2NNn.js → api-B6g0B-IG.js} +0 -0
- /package/dist/{api-BhPfvHfo.js → api-B_5tuRF_.js} +0 -0
- /package/dist/{api-BUpga5J-.js → api-ChDERchn.js} +0 -0
- /package/dist/{api-B1PE6fwA.js → api-DiGfNOT2.js} +0 -0
- /package/dist/{api-DkqAFzSg.js → api-O7zsDPPJ.js} +0 -0
- /package/dist/{audit-channel.collect.runtime-CaPqFh87.js → audit-channel.collect.runtime-CUn9BMvq.js} +0 -0
- /package/dist/{audit-log-C8WDD3D1.js → audit-log-pMArHIEh.js} +0 -0
- /package/dist/{auth-choice-legacy-waB0iFpm.js → auth-choice-legacy-BM0vn9R-.js} +0 -0
- /package/dist/{auth-choice.apply-helpers-BvYl7HR5.js → auth-choice.apply-helpers-Bw9wToYL.js} +0 -0
- /package/dist/{auth-choice.plugin-providers.runtime-PpyhN_80.js → auth-choice.plugin-providers.runtime-BZseWyNy.js} +0 -0
- /package/dist/{auth-surface-resolution-BZLSPNTs.js → auth-surface-resolution-CrQGM9Cp.js} +0 -0
- /package/dist/{auto-recall-B1PCG6uf.js → auto-recall-B_bK8mCh.js} +0 -0
- /package/dist/{block-reply-pipeline-B79ibtIR.js → block-reply-pipeline-Dq4aLNqX.js} +0 -0
- /package/dist/{call.runtime-BwcZkbkG.js → call.runtime-DVcVSdEu.js} +0 -0
- /package/dist/{channel-account-context-BNzGuw03.js → channel-account-context-D0WBO2Yx.js} +0 -0
- /package/dist/{channel-options-dCZOcBUc.js → channel-options-plNrATBP.js} +0 -0
- /package/dist/{channel-plugin-ids-jLxAn1L5.js → channel-plugin-ids-CscSLyjB.js} +0 -0
- /package/dist/{channel-selection.runtime-rS6hNp6w.js → channel-selection.runtime-Dd9_LxxA.js} +0 -0
- /package/dist/{channels-status-issues-QT-v4vzD.js → channels-status-issues-byWfP2WG.js} +0 -0
- /package/dist/{clack-prompter-BarukVw2.js → clack-prompter-OiJwdy5r.js} +0 -0
- /package/dist/{cli-backend-CNk0L0wa.js → cli-backend-CdM4Rh6F.js} +0 -0
- /package/dist/{close-reason-nz_ERN9v.js → close-reason-CI_g9IO0.js} +0 -0
- /package/dist/{cognitive-delivery-B8bSjIL2.js → cognitive-delivery-B5TbScd2.js} +0 -0
- /package/dist/{command-poll-backoff.runtime-DDWZcsnF.js → command-poll-backoff.runtime-CFRUBpul.js} +0 -0
- /package/dist/{command-registration-policy-CVzf9lZy.js → command-registration-policy-Bp03ya2T.js} +0 -0
- /package/dist/{commands-registry.runtime-CThK_6yQ.js → commands-registry.runtime-C9vjMKif.js} +0 -0
- /package/dist/{config-DCqmbAmi.js → config-DWP1lSic.js} +0 -0
- /package/dist/{config-BXvOgFjS.js → config-GpqmqI37.js} +0 -0
- /package/dist/{config-value-C7bZPr1X.js → config-value-1FzBpid8.js} +0 -0
- /package/dist/{consolidation-userid-BtKeSaAs.js → consolidation-userid-Di0Sgxnz.js} +0 -0
- /package/dist/{dangerous-tools-Cwuv7WFD.js → dangerous-tools-C6SsOcC4.js} +0 -0
- /package/dist/{default-models-CTHi5V4f.js → default-models-DxJmcrq7.js} +0 -0
- /package/dist/{defaults-CwPgGXAk.js → defaults-DWxSBxL9.js} +0 -0
- /package/dist/{defaults-BQA1GDhJ.js → defaults-UyycRG_v.js} +0 -0
- /package/dist/{dispatch-acp-command-bypass-imK9PCdQ.js → dispatch-acp-command-bypass-B9NMLuX9.js} +0 -0
- /package/dist/{docs-cli-Dv1RQsBb.js → docs-cli-DDIF10fG.js} +0 -0
- /package/dist/{dotenv-CmO55tnC.js → dotenv-DPb0MMoy.js} +0 -0
- /package/dist/{embedding-provider-BYQlcbTv.js → embedding-provider-BiItBepR.js} +0 -0
- /package/dist/{env-overrides.runtime-BbiEI7F8.js → env-overrides.runtime-BtBGU8bb.js} +0 -0
- /package/dist/{exec-approvals-effective-MiJpVS3B.js → exec-approvals-effective-C4m2WXg-.js} +0 -0
- /package/dist/{extractor-Dc5z0hMf.js → extractor-B-CDYBJx.js} +0 -0
- /package/dist/{fallback-state-D3l8zuca.js → fallback-state-C-BXNQDE.js} +0 -0
- /package/dist/{fragment-types-B8q-zg6v.js → fragment-types-3NSFX3fG.js} +0 -0
- /package/dist/{frontmatter-XYZsyLoY.js → frontmatter-CMd6M3iu.js} +0 -0
- /package/dist/{gateway-lock-BkhPbe1x.js → gateway-lock-B4lxvDfZ.js} +0 -0
- /package/dist/{gateway-presence-C7ZKme5I.js → gateway-presence-D2Ad8otD.js} +0 -0
- /package/dist/{gateway-rpc.runtime-mL0HdmjE.js → gateway-rpc.runtime-eZMYTrLe.js} +0 -0
- /package/dist/{gaxios-fetch-compat-jL2xxHMj.js → gaxios-fetch-compat-DvraiCww.js} +0 -0
- /package/dist/{git-commit-XJxkSBCC.js → git-commit-BIx8__jW.js} +0 -0
- /package/dist/{gmail-setup-utils-DjHySRPr.js → gmail-setup-utils-Jqi6TbIM.js} +0 -0
- /package/dist/{groups.runtime-BFrnryp_.js → groups.runtime-BmbQxpi-.js} +0 -0
- /package/dist/{health-format-lG7x3cNF.js → health-format-CPlFnpEc.js} +0 -0
- /package/dist/{helpers-5EtzqHah.js → helpers-q3dUkuqz.js} +0 -0
- /package/dist/{hooks-policy-DudtxOUW.js → hooks-policy-Bmv6J1kh.js} +0 -0
- /package/dist/{image-v-_YZCwf.js → image-De5xRFlj.js} +0 -0
- /package/dist/{image-generation-core.auth.runtime-BN813D6r.js → image-generation-core.auth.runtime-BGoZ9htm.js} +0 -0
- /package/dist/{includes-scan-DpxlIONl.js → includes-scan-9AWKrWlU.js} +0 -0
- /package/dist/{info-scan-source-DnaROGLQ.js → info-scan-source-JX82stxX.js} +0 -0
- /package/dist/{input-files-DgrhtMjl.js → input-files-CnyTkGg0.js} +0 -0
- /package/dist/{install-target-BX2Crr_Y.js → install-target-9iPjuY88.js} +0 -0
- /package/dist/{installs-DbMRUEa5.js → installs-30EmXCK0.js} +0 -0
- /package/dist/{ipv4-Lxd0AUyd.js → ipv4-Ddm_keVD.js} +0 -0
- /package/dist/{json-mode-DXOGRndc.js → json-mode-Be3c80wJ.js} +0 -0
- /package/dist/{kaijibot.plugin-BhXQfURP.js → kaijibot.plugin-DzS9VUni.js} +0 -0
- /package/dist/{kaijibot.plugin-CtsiVmAP.js → kaijibot.plugin-xVZah2G8.js} +0 -0
- /package/dist/{lifecycle-B9_XEJMF.js → lifecycle-DwLKRe0M.js} +0 -0
- /package/dist/{llm-extractor-bvGxU-9w.js → llm-extractor-CssLZel9.js} +0 -0
- /package/dist/{llm-key-probe-DBxS-6MP.js → llm-key-probe-BH61J04k.js} +0 -0
- /package/dist/{local-date-DXS-3gnV.js → local-date-Dx9LHstd.js} +0 -0
- /package/dist/{logs-cli.runtime-DjFXprX7.js → logs-cli.runtime-DCwDBoHH.js} +0 -0
- /package/dist/{magic-string.es-DBWRzyEr.js → magic-string.es-JqU65QWY.js} +0 -0
- /package/dist/{memory-host-search.runtime-D1s9jwc9.js → memory-host-search.runtime-BKu5Oyo8.js} +0 -0
- /package/dist/{memory-repair-RLio0mfn.js → memory-repair-DONaxvFd.js} +0 -0
- /package/dist/{message.config.runtime-m-HYPbwu.js → message.config.runtime-CbnMOfHF.js} +0 -0
- /package/dist/{message.gateway.runtime-ypqgoSHq.js → message.gateway.runtime-B93AumDT.js} +0 -0
- /package/dist/{metadata-registry-loader-BiXHJddm.js → metadata-registry-loader-Dgk5UBMT.js} +0 -0
- /package/dist/{model-definitions-CqVPpHiG.js → model-definitions-JcfBkTza.js} +0 -0
- /package/dist/{model-id-cnFVogsJ.js → model-id-D1Wk8S2O.js} +0 -0
- /package/dist/{model-param-b-WFgsRlGS.js → model-param-b-B7-mzaOP.js} +0 -0
- /package/dist/{model-suppression.runtime-Cc9MfXhr.js → model-suppression.runtime-Bb9ypkGZ.js} +0 -0
- /package/dist/{models-CGB1Gmfi.js → models--eT1kpdv.js} +0 -0
- /package/dist/{models-DnnqdU39.js → models-CI5KSADc.js} +0 -0
- /package/dist/{models-Cuivu-zg.js → models-D56ZxCfo.js} +0 -0
- /package/dist/{models-JQFu1Rq9.js → models-N8WgRXKT.js} +0 -0
- /package/dist/{oauth-refresh-failure-Bf74s_bF.js → oauth-refresh-failure-DWFIDvjh.js} +0 -0
- /package/dist/{onboard-DQP5yP_h.js → onboard-C36W-uR9.js} +0 -0
- /package/dist/{onboard-BaA-_42k.js → onboard-C5_C5Dgl.js} +0 -0
- /package/dist/{onboard-2v_escld.js → onboard-DDG1-mJG.js} +0 -0
- /package/dist/{onboard-UHJyYUjC.js → onboard-DJoyh-Z8.js} +0 -0
- /package/dist/{onboard-AGZDUqWC.js → onboard-DSxroSTN.js} +0 -0
- /package/dist/{onboard-KTOtavc-.js → onboard-b6hp3tPS.js} +0 -0
- /package/dist/{onboard-config-BXe45WpU.js → onboard-config-Lh_yB7dL.js} +0 -0
- /package/dist/{openai-codex-catalog-DQgPnnGt.js → openai-codex-catalog-DD_VIQlG.js} +0 -0
- /package/dist/{openclaw-migrator-DUfsOWq9.js → openclaw-migrator-CaGcuTUZ.js} +0 -0
- /package/dist/{package-update-utils-D9AkQosZ.js → package-update-utils-Yv076eAO.js} +0 -0
- /package/dist/{parse-log-line-B4l-DSpE.js → parse-log-line-BIaXQg_P.js} +0 -0
- /package/dist/{path-env-CoRBKA1C.js → path-env-Dk2a_giL.js} +0 -0
- /package/dist/{perplexity-web-search-provider.shared-o8SEWE6d.js → perplexity-web-search-provider.shared-65M7qer4.js} +0 -0
- /package/dist/{persona-change-source-sZfR2-3I.js → persona-change-source-QUczl_FE.js} +0 -0
- /package/dist/{ports-BrD2WgKB.js → ports-Qs7MEJp6.js} +0 -0
- /package/dist/{preference-learner-Dd-MkiXx.js → preference-learner-BoMWQ_UT.js} +0 -0
- /package/dist/{probe-70HRGl4a.js → probe-BvHudo6i.js} +0 -0
- /package/dist/{probe-auth-BQSPI8E3.js → probe-auth-DhX7blo2.js} +0 -0
- /package/dist/{probe-target-DD7FyREr.js → probe-target-BeTB7wVs.js} +0 -0
- /package/dist/{program-context-BcxnUK0Z.js → program-context-B9uUWtK2.js} +0 -0
- /package/dist/{provider-api-key-auth.runtime-HSJGnSmr.js → provider-api-key-auth.runtime-N653FDIT.js} +0 -0
- /package/dist/{provider-auth-choice-helpers-CcPOjvnI.js → provider-auth-choice-helpers-ChvFgjfz.js} +0 -0
- /package/dist/{provider-auth-guidance-ChSkQI-k.js → provider-auth-guidance-Ctl6x9Du.js} +0 -0
- /package/dist/{provider-catalog-145O7qu0.js → provider-catalog-BDAFvO45.js} +0 -0
- /package/dist/{provider-catalog-BV3gdu3r.js → provider-catalog-CO-sQSae.js} +0 -0
- /package/dist/{provider-catalog-BWbMEO1u.js → provider-catalog-D34gpSgG.js} +0 -0
- /package/dist/{provider-catalog-CmraKltl.js → provider-catalog-Dwp85UjM.js} +0 -0
- /package/dist/{provider-catalog-CGGu1xY7.js → provider-catalog-NxTI5xr-.js} +0 -0
- /package/dist/{provider-catalog-BwaMk_71.js → provider-catalog-dX-9JR2_.js} +0 -0
- /package/dist/{provider-models-Cj2Dj2Eb.js → provider-models-BS_NZn6m.js} +0 -0
- /package/dist/{provider-models-yFLzb_gM.js → provider-models-BrE46jCo2.js} +0 -0
- /package/dist/{provider-oauth-flow-Dwldw3m9.js → provider-oauth-flow-CdiPoFwM.js} +0 -0
- /package/dist/{provider-openai-codex-oauth-tls-B5spv5ZL.js → provider-openai-codex-oauth-tls-Dd7Khxm1.js} +0 -0
- /package/dist/{qa-cli-CHZ17YNo.js → qa-cli-BTEZmDBl.js} +0 -0
- /package/dist/{realtime-transcription-provider-CaGqiqi5.js → realtime-transcription-provider-DKVD0xK4.js} +0 -0
- /package/dist/{register.backup-DEGba8yV.js → register.backup-BsTZm_ln.js} +0 -0
- /package/dist/{remote-env-XoAdM3lK.js → remote-env-DlSMoBM9.js} +0 -0
- /package/dist/{replay-policy-Cz4vCd2t.js → replay-policy-DBCcSA9H.js} +0 -0
- /package/dist/{reply-payloads-dedupe.runtime-DHqFOSfO.js → reply-payloads-dedupe.runtime-DoaNG4lo.js} +0 -0
- /package/dist/{resolve-pBPj3wEy.js → resolve-D1pCHyvv.js} +0 -0
- /package/dist/{responses-tool-shared-CjK_9Hne.js → responses-tool-shared-DHcb1dPQ.js} +0 -0
- /package/dist/{root-help-metadata-CHfvsXBe.js → root-help-metadata-Drx7dB2u.js} +0 -0
- /package/dist/{rpc.runtime-DvvupI-T.js → rpc.runtime-DUWYp4eO.js} +0 -0
- /package/dist/{runtime-api-BzmBrFf3.js → runtime-api-CUPLCkbC.js} +0 -0
- /package/dist/{runtime-manifest.runtime-T4MgRCzw.js → runtime-manifest.runtime-CT5Jdegq.js} +0 -0
- /package/dist/{runtime-model-auth.runtime-DkBcOdwA.js → runtime-model-auth.runtime-C1QVotRO.js} +0 -0
- /package/dist/{runtime-web-channel-plugin-CSkwa3oV.js → runtime-web-channel-plugin-B_jKtF5_.js} +0 -0
- /package/dist/{runtime-web-tools-fallback.runtime-Cl479qhm.js → runtime-web-tools-fallback.runtime-vvVY2hzf.js} +0 -0
- /package/dist/{runtime-web-tools-manifest.runtime-BsrsHIeH.js → runtime-web-tools-manifest.runtime-q4FwzQyo.js} +0 -0
- /package/dist/{runtime-web-tools-public-artifacts.runtime--NfpoCOF.js → runtime-web-tools-public-artifacts.runtime-DH1OendY.js} +0 -0
- /package/dist/{schedule-10eqkliM.js → schedule-B0pphiI5.js} +0 -0
- /package/dist/{secret-file-yoaT8Z2N.js → secret-file-CZYHVmYt.js} +0 -0
- /package/dist/{session-archive.runtime-CoAMhBxN.js → session-archive.runtime-DMp_Mux1.js} +0 -0
- /package/dist/{session-fork.runtime-CZDDfV7c.js → session-fork.runtime--xGBhpew.js} +0 -0
- /package/dist/{setup.plugin-config-B6erjihE.js → setup.plugin-config-DcRd-H0v.js} +0 -0
- /package/dist/{setup.secret-input-BR7Y2Hg1.js → setup.secret-input-NrcTToqs.js} +0 -0
- /package/dist/{skill-draft-generator-C8zPLkD-.js → skill-draft-generator-m9nku0CK.js} +0 -0
- /package/dist/{skill-reviewer-ZeuLRxUy.js → skill-reviewer-BzUB5yY8.js} +0 -0
- /package/dist/{skill-scanner-C3hWfmOb.js → skill-scanner-BlxMlpUH.js} +0 -0
- /package/dist/{skill-writer-DNOmOldW.js → skill-writer-C43S6Lsi.js} +0 -0
- /package/dist/{soul-cli-Co0KcdP3.js → soul-cli-Bb2iCP9P.js} +0 -0
- /package/dist/{ssh-config-m0F_3hKh.js → ssh-config-BA1Y7a8V.js} +0 -0
- /package/dist/{status-config-DbtvFlek.js → status-config-IryaKgaK.js} +0 -0
- /package/dist/{status.agent-local-BNfQnBBE.js → status.agent-local-VigNjFn5.js} +0 -0
- /package/dist/{status.gateway-connection.runtime-eEPv-X0Z.js → status.gateway-connection.runtime-YZTKQZGP.js} +0 -0
- /package/dist/{status.scan.deps.runtime-BAPi7Dm4.js → status.scan.deps.runtime-d3HueyxP.js} +0 -0
- /package/dist/{store-CeTaOlf7.js → store-C-kqItww.js} +0 -0
- /package/dist/{store-DE9I_z-U.js → store-CioZN-iH.js} +0 -0
- /package/dist/{store-BFeUim-y.js → store-Dji_Mahl.js} +0 -0
- /package/dist/{stream-BoFx9-PE.js → stream-BENwbELC.js} +0 -0
- /package/dist/{stream-Bb3o_iaj.js → stream-C2mX5-8a.js} +0 -0
- /package/dist/{subagent-followup-hints-DSxKx2h5.js → subagent-followup-hints-BSNsTYsF.js} +0 -0
- /package/dist/{supervisor-log.runtime-CtoSv_g7.js → supervisor-log.runtime-BSystMWy.js} +0 -0
- /package/dist/{systemd-linger-BeOkR_jw.js → systemd-linger-p1W5Ka5U.js} +0 -0
- /package/dist/{table-B8RObGt5.js → table-UVJgHZWO.js} +0 -0
- /package/dist/{targets.runtime-BTOlvIZi.js → targets.runtime-Dy1_53At.js} +0 -0
- /package/dist/{task-registry.audit.shared-D1VOvgzO.js → task-registry.audit.shared-Bzuti1TG.js} +0 -0
- /package/dist/{text-similarity-DIRFELa3.js → text-similarity-BLCcuUbL.js} +0 -0
- /package/dist/{trust-calculator-lCRAZCPt.js → trust-calculator-CEYEccNS.js} +0 -0
- /package/dist/{tts-CUq9yK2z.js → tts-CKB2MJSq.js} +0 -0
- /package/dist/{tts-B0_QVtVV.js → tts-y10rjplW.js} +0 -0
- /package/dist/{tts.runtime-DIBAMvsb.js → tts.runtime-DJhcLC3T.js} +0 -0
- /package/dist/{types-CNJErmew.js → types-Cl5KlDxs.js} +0 -0
- /package/dist/{video-http-BlHIyytb.js → video-http-lbLggCxb.js} +0 -0
- /package/dist/{widearea-dns-BWrAD9S6.js → widearea-dns-DYys1Z7C.js} +0 -0
- /package/dist/{x-search-tool-shared-Cxa0ul0H.js → x-search-tool-shared-Dy7MMhpV.js} +0 -0
package/dist/tui-h4YVnTtv.js
DELETED
|
@@ -1,4017 +0,0 @@
|
|
|
1
|
-
import { r as formatErrorMessage } from "./errors-CGMew-1w.js";
|
|
2
|
-
import { i as normalizeLowercaseStringOrEmpty, o as normalizeOptionalLowercaseString, s as normalizeOptionalString } from "./string-coerce-CIT1-v_a.js";
|
|
3
|
-
import { _ as GATEWAY_CLIENT_NAMES, g as GATEWAY_CLIENT_MODES, m as GATEWAY_CLIENT_CAPS } from "./message-channel-BIhV7ttg.js";
|
|
4
|
-
import { i as visibleWidth, r as stripAnsi$1 } from "./ansi-lD0AkxvX.js";
|
|
5
|
-
import { d as resolveResponseUsageMode, l as normalizeUsageDisplay } from "./thinking.shared-BoHZoGWm.js";
|
|
6
|
-
import { n as VERSION } from "./version-CL-VJOV3.js";
|
|
7
|
-
import { S as parseAgentSessionKey, c as normalizeAgentId, l as normalizeMainKey, r as buildAgentMainSessionKey } from "./session-key-NGoeHrFI.js";
|
|
8
|
-
import { c as resolveAgentIdByWorkspacePath, m as resolveDefaultAgentId } from "./agent-scope-DfuA1KpS.js";
|
|
9
|
-
import { a as loadConfig } from "./io-4SsSDURt.js";
|
|
10
|
-
import "./config-BAxY-VFe.js";
|
|
11
|
-
import { t as assertExplicitGatewayAuthModeWhenBothConfigured } from "./auth-mode-policy-D2t6VRe0.js";
|
|
12
|
-
import { a as isLoopbackHost } from "./net-Dx7qKYeO.js";
|
|
13
|
-
import { f as GatewayClient } from "./method-scopes-ByQu9bCa.js";
|
|
14
|
-
import { r as formatTokenCount } from "./usage-format-vjcbO7O-.js";
|
|
15
|
-
import { r as extractAssistantVisibleText } from "./chat-message-content-D16moSaP.js";
|
|
16
|
-
import { r as stripLeadingInboundMetadata } from "./strip-inbound-meta-r3DBmZqp.js";
|
|
17
|
-
import { n as formatRawAssistantErrorForUi } from "./assistant-error-format-CyD_bZTp.js";
|
|
18
|
-
import { n as listThinkingLevelLabels, t as formatThinkingLevels } from "./thinking-BZshql3z.js";
|
|
19
|
-
import { l as resolveExplicitGatewayAuth, n as buildGatewayConnectionDetails, s as ensureExplicitGatewayAuth } from "./call-BjMhqiDB.js";
|
|
20
|
-
import { r as resolveToolDisplay, t as formatToolDetail } from "./tool-display-CW-zjuOP.js";
|
|
21
|
-
import { r as resolveSessionInfoModelSelection } from "./model-selection-display-BfvhVzuw.js";
|
|
22
|
-
import { c as listChatCommands, l as listChatCommandsForConfig } from "./commands-registry-xojAUyHT.js";
|
|
23
|
-
import { n as formatTimeAgo, t as formatRelativeTimestamp } from "./format-relative-Ccudwi7X.js";
|
|
24
|
-
import { t as normalizeGroupActivation } from "./group-activation-DM0o4Crk.js";
|
|
25
|
-
import { t as resolveGatewayInteractiveSurfaceAuth } from "./auth-surface-resolution-BZLSPNTs.js";
|
|
26
|
-
import { spawn } from "node:child_process";
|
|
27
|
-
import chalk from "chalk";
|
|
28
|
-
import { randomUUID } from "node:crypto";
|
|
29
|
-
import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, isKeyRelease, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
30
|
-
import { highlight, supportsLanguage } from "cli-highlight";
|
|
31
|
-
//#region src/tui/commands.ts
|
|
32
|
-
const VERBOSE_LEVELS = ["on", "off"];
|
|
33
|
-
const FAST_LEVELS = [
|
|
34
|
-
"status",
|
|
35
|
-
"on",
|
|
36
|
-
"off"
|
|
37
|
-
];
|
|
38
|
-
const REASONING_LEVELS = ["on", "off"];
|
|
39
|
-
const ELEVATED_LEVELS = [
|
|
40
|
-
"on",
|
|
41
|
-
"off",
|
|
42
|
-
"ask",
|
|
43
|
-
"full"
|
|
44
|
-
];
|
|
45
|
-
const ACTIVATION_LEVELS = ["mention", "always"];
|
|
46
|
-
const USAGE_FOOTER_LEVELS = [
|
|
47
|
-
"off",
|
|
48
|
-
"tokens",
|
|
49
|
-
"full"
|
|
50
|
-
];
|
|
51
|
-
const COMMAND_ALIASES = {
|
|
52
|
-
elev: "elevated",
|
|
53
|
-
gwstatus: "gateway-status"
|
|
54
|
-
};
|
|
55
|
-
function createLevelCompletion(levels) {
|
|
56
|
-
return (prefix) => levels.filter((value) => value.startsWith(normalizeLowercaseStringOrEmpty(prefix))).map((value) => ({
|
|
57
|
-
value,
|
|
58
|
-
label: value
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
function parseCommand(input) {
|
|
62
|
-
const trimmed = input.replace(/^\//, "").trim();
|
|
63
|
-
if (!trimmed) return {
|
|
64
|
-
name: "",
|
|
65
|
-
args: ""
|
|
66
|
-
};
|
|
67
|
-
const [name, ...rest] = trimmed.split(/\s+/);
|
|
68
|
-
const normalized = normalizeLowercaseStringOrEmpty(name);
|
|
69
|
-
return {
|
|
70
|
-
name: COMMAND_ALIASES[normalized] ?? normalized,
|
|
71
|
-
args: rest.join(" ").trim()
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function getSlashCommands(options = {}) {
|
|
75
|
-
const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
|
|
76
|
-
const verboseCompletions = createLevelCompletion(VERBOSE_LEVELS);
|
|
77
|
-
const fastCompletions = createLevelCompletion(FAST_LEVELS);
|
|
78
|
-
const reasoningCompletions = createLevelCompletion(REASONING_LEVELS);
|
|
79
|
-
const usageCompletions = createLevelCompletion(USAGE_FOOTER_LEVELS);
|
|
80
|
-
const elevatedCompletions = createLevelCompletion(ELEVATED_LEVELS);
|
|
81
|
-
const activationCompletions = createLevelCompletion(ACTIVATION_LEVELS);
|
|
82
|
-
const commands = [
|
|
83
|
-
{
|
|
84
|
-
name: "help",
|
|
85
|
-
description: "Show slash command help"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "gateway-status",
|
|
89
|
-
description: "Show gateway status summary"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "gwstatus",
|
|
93
|
-
description: "Alias for /gateway-status"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: "agent",
|
|
97
|
-
description: "Switch agent (or open picker)"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "agents",
|
|
101
|
-
description: "Open agent picker"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "session",
|
|
105
|
-
description: "Switch session (or open picker)"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: "sessions",
|
|
109
|
-
description: "Open session picker"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "model",
|
|
113
|
-
description: "Set model (or open picker)"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: "models",
|
|
117
|
-
description: "Open model picker"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "think",
|
|
121
|
-
description: "Set thinking level",
|
|
122
|
-
getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(normalizeLowercaseStringOrEmpty(prefix))).map((value) => ({
|
|
123
|
-
value,
|
|
124
|
-
label: value
|
|
125
|
-
}))
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "fast",
|
|
129
|
-
description: "Set fast mode on/off",
|
|
130
|
-
getArgumentCompletions: fastCompletions
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "verbose",
|
|
134
|
-
description: "Set verbose on/off",
|
|
135
|
-
getArgumentCompletions: verboseCompletions
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "reasoning",
|
|
139
|
-
description: "Set reasoning on/off",
|
|
140
|
-
getArgumentCompletions: reasoningCompletions
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "usage",
|
|
144
|
-
description: "Toggle per-response usage line",
|
|
145
|
-
getArgumentCompletions: usageCompletions
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "elevated",
|
|
149
|
-
description: "Set elevated on/off/ask/full",
|
|
150
|
-
getArgumentCompletions: elevatedCompletions
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "elev",
|
|
154
|
-
description: "Alias for /elevated",
|
|
155
|
-
getArgumentCompletions: elevatedCompletions
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "activation",
|
|
159
|
-
description: "Set group activation",
|
|
160
|
-
getArgumentCompletions: activationCompletions
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: "abort",
|
|
164
|
-
description: "Abort active run"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "new",
|
|
168
|
-
description: "Reset the session"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "reset",
|
|
172
|
-
description: "Reset the session"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "settings",
|
|
176
|
-
description: "Open settings"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: "exit",
|
|
180
|
-
description: "Exit the TUI"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "quit",
|
|
184
|
-
description: "Exit the TUI"
|
|
185
|
-
}
|
|
186
|
-
];
|
|
187
|
-
const seen = new Set(commands.map((command) => command.name));
|
|
188
|
-
const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
|
|
189
|
-
for (const command of gatewayCommands) {
|
|
190
|
-
const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
|
|
191
|
-
for (const alias of aliases) {
|
|
192
|
-
const name = alias.replace(/^\//, "").trim();
|
|
193
|
-
if (!name || seen.has(name)) continue;
|
|
194
|
-
seen.add(name);
|
|
195
|
-
commands.push({
|
|
196
|
-
name,
|
|
197
|
-
description: command.description
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return commands;
|
|
202
|
-
}
|
|
203
|
-
function helpText(options = {}) {
|
|
204
|
-
return [
|
|
205
|
-
"Slash commands:",
|
|
206
|
-
"/help",
|
|
207
|
-
"/commands",
|
|
208
|
-
"/status",
|
|
209
|
-
"/gateway-status",
|
|
210
|
-
"/gwstatus",
|
|
211
|
-
"/agent <id> (or /agents)",
|
|
212
|
-
"/session <key> (or /sessions)",
|
|
213
|
-
"/model <provider/model> (or /models)",
|
|
214
|
-
`/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
|
|
215
|
-
"/fast <status|on|off>",
|
|
216
|
-
"/verbose <on|off>",
|
|
217
|
-
"/reasoning <on|off>",
|
|
218
|
-
"/usage <off|tokens|full>",
|
|
219
|
-
"/elevated <on|off|ask|full>",
|
|
220
|
-
"/elev <on|off|ask|full>",
|
|
221
|
-
"/activation <mention|always>",
|
|
222
|
-
"/new or /reset",
|
|
223
|
-
"/abort",
|
|
224
|
-
"/settings",
|
|
225
|
-
"/exit"
|
|
226
|
-
].join("\n");
|
|
227
|
-
}
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/tui/theme/syntax-theme.ts
|
|
230
|
-
/**
|
|
231
|
-
* Syntax highlighting theme for code blocks.
|
|
232
|
-
* Uses chalk functions to style different token types.
|
|
233
|
-
*/
|
|
234
|
-
function createSyntaxTheme(fallback, light = false) {
|
|
235
|
-
if (light) return {
|
|
236
|
-
keyword: chalk.hex("#AF00DB"),
|
|
237
|
-
built_in: chalk.hex("#267F99"),
|
|
238
|
-
type: chalk.hex("#267F99"),
|
|
239
|
-
literal: chalk.hex("#0000FF"),
|
|
240
|
-
number: chalk.hex("#098658"),
|
|
241
|
-
string: chalk.hex("#A31515"),
|
|
242
|
-
regexp: chalk.hex("#811F3F"),
|
|
243
|
-
symbol: chalk.hex("#098658"),
|
|
244
|
-
class: chalk.hex("#267F99"),
|
|
245
|
-
function: chalk.hex("#795E26"),
|
|
246
|
-
title: chalk.hex("#795E26"),
|
|
247
|
-
params: chalk.hex("#001080"),
|
|
248
|
-
comment: chalk.hex("#008000"),
|
|
249
|
-
doctag: chalk.hex("#008000"),
|
|
250
|
-
meta: chalk.hex("#001080"),
|
|
251
|
-
"meta-keyword": chalk.hex("#AF00DB"),
|
|
252
|
-
"meta-string": chalk.hex("#A31515"),
|
|
253
|
-
section: chalk.hex("#795E26"),
|
|
254
|
-
tag: chalk.hex("#800000"),
|
|
255
|
-
name: chalk.hex("#001080"),
|
|
256
|
-
attr: chalk.hex("#C50000"),
|
|
257
|
-
attribute: chalk.hex("#C50000"),
|
|
258
|
-
variable: chalk.hex("#001080"),
|
|
259
|
-
bullet: chalk.hex("#795E26"),
|
|
260
|
-
code: chalk.hex("#A31515"),
|
|
261
|
-
emphasis: chalk.italic,
|
|
262
|
-
strong: chalk.bold,
|
|
263
|
-
formula: chalk.hex("#AF00DB"),
|
|
264
|
-
link: chalk.hex("#267F99"),
|
|
265
|
-
quote: chalk.hex("#008000"),
|
|
266
|
-
addition: chalk.hex("#098658"),
|
|
267
|
-
deletion: chalk.hex("#A31515"),
|
|
268
|
-
"selector-tag": chalk.hex("#800000"),
|
|
269
|
-
"selector-id": chalk.hex("#800000"),
|
|
270
|
-
"selector-class": chalk.hex("#800000"),
|
|
271
|
-
"selector-attr": chalk.hex("#800000"),
|
|
272
|
-
"selector-pseudo": chalk.hex("#800000"),
|
|
273
|
-
"template-tag": chalk.hex("#AF00DB"),
|
|
274
|
-
"template-variable": chalk.hex("#001080"),
|
|
275
|
-
default: fallback
|
|
276
|
-
};
|
|
277
|
-
return {
|
|
278
|
-
keyword: chalk.hex("#C586C0"),
|
|
279
|
-
built_in: chalk.hex("#4EC9B0"),
|
|
280
|
-
type: chalk.hex("#4EC9B0"),
|
|
281
|
-
literal: chalk.hex("#569CD6"),
|
|
282
|
-
number: chalk.hex("#B5CEA8"),
|
|
283
|
-
string: chalk.hex("#CE9178"),
|
|
284
|
-
regexp: chalk.hex("#D16969"),
|
|
285
|
-
symbol: chalk.hex("#B5CEA8"),
|
|
286
|
-
class: chalk.hex("#4EC9B0"),
|
|
287
|
-
function: chalk.hex("#DCDCAA"),
|
|
288
|
-
title: chalk.hex("#DCDCAA"),
|
|
289
|
-
params: chalk.hex("#9CDCFE"),
|
|
290
|
-
comment: chalk.hex("#6A9955"),
|
|
291
|
-
doctag: chalk.hex("#608B4E"),
|
|
292
|
-
meta: chalk.hex("#9CDCFE"),
|
|
293
|
-
"meta-keyword": chalk.hex("#C586C0"),
|
|
294
|
-
"meta-string": chalk.hex("#CE9178"),
|
|
295
|
-
section: chalk.hex("#DCDCAA"),
|
|
296
|
-
tag: chalk.hex("#569CD6"),
|
|
297
|
-
name: chalk.hex("#9CDCFE"),
|
|
298
|
-
attr: chalk.hex("#9CDCFE"),
|
|
299
|
-
attribute: chalk.hex("#9CDCFE"),
|
|
300
|
-
variable: chalk.hex("#9CDCFE"),
|
|
301
|
-
bullet: chalk.hex("#D7BA7D"),
|
|
302
|
-
code: chalk.hex("#CE9178"),
|
|
303
|
-
emphasis: chalk.italic,
|
|
304
|
-
strong: chalk.bold,
|
|
305
|
-
formula: chalk.hex("#C586C0"),
|
|
306
|
-
link: chalk.hex("#4EC9B0"),
|
|
307
|
-
quote: chalk.hex("#6A9955"),
|
|
308
|
-
addition: chalk.hex("#B5CEA8"),
|
|
309
|
-
deletion: chalk.hex("#F44747"),
|
|
310
|
-
"selector-tag": chalk.hex("#D7BA7D"),
|
|
311
|
-
"selector-id": chalk.hex("#D7BA7D"),
|
|
312
|
-
"selector-class": chalk.hex("#D7BA7D"),
|
|
313
|
-
"selector-attr": chalk.hex("#D7BA7D"),
|
|
314
|
-
"selector-pseudo": chalk.hex("#D7BA7D"),
|
|
315
|
-
"template-tag": chalk.hex("#C586C0"),
|
|
316
|
-
"template-variable": chalk.hex("#9CDCFE"),
|
|
317
|
-
default: fallback
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
//#endregion
|
|
321
|
-
//#region src/tui/theme/theme.ts
|
|
322
|
-
const DARK_TEXT = "#E8E3D5";
|
|
323
|
-
const LIGHT_TEXT = "#1E1E1E";
|
|
324
|
-
const XTERM_LEVELS = [
|
|
325
|
-
0,
|
|
326
|
-
95,
|
|
327
|
-
135,
|
|
328
|
-
175,
|
|
329
|
-
215,
|
|
330
|
-
255
|
|
331
|
-
];
|
|
332
|
-
function channelToSrgb(value) {
|
|
333
|
-
const normalized = value / 255;
|
|
334
|
-
return normalized <= .03928 ? normalized / 12.92 : ((normalized + .055) / 1.055) ** 2.4;
|
|
335
|
-
}
|
|
336
|
-
function relativeLuminanceRgb(r, g, b) {
|
|
337
|
-
const red = channelToSrgb(r);
|
|
338
|
-
const green = channelToSrgb(g);
|
|
339
|
-
const blue = channelToSrgb(b);
|
|
340
|
-
return .2126 * red + .7152 * green + .0722 * blue;
|
|
341
|
-
}
|
|
342
|
-
function relativeLuminanceHex(hex) {
|
|
343
|
-
return relativeLuminanceRgb(Number.parseInt(hex.slice(1, 3), 16), Number.parseInt(hex.slice(3, 5), 16), Number.parseInt(hex.slice(5, 7), 16));
|
|
344
|
-
}
|
|
345
|
-
function contrastRatio(background, foregroundHex) {
|
|
346
|
-
const foreground = relativeLuminanceHex(foregroundHex);
|
|
347
|
-
const lighter = Math.max(background, foreground);
|
|
348
|
-
const darker = Math.min(background, foreground);
|
|
349
|
-
return (lighter + .05) / (darker + .05);
|
|
350
|
-
}
|
|
351
|
-
function pickHigherContrastText(r, g, b) {
|
|
352
|
-
const background = relativeLuminanceRgb(r, g, b);
|
|
353
|
-
return contrastRatio(background, LIGHT_TEXT) >= contrastRatio(background, DARK_TEXT);
|
|
354
|
-
}
|
|
355
|
-
function isLightBackground() {
|
|
356
|
-
const explicit = normalizeOptionalLowercaseString(process.env.KAIJIBOT_THEME);
|
|
357
|
-
if (explicit === "light") return true;
|
|
358
|
-
if (explicit === "dark") return false;
|
|
359
|
-
const colorfgbg = process.env.COLORFGBG;
|
|
360
|
-
if (colorfgbg && colorfgbg.length <= 64) {
|
|
361
|
-
const sep = colorfgbg.lastIndexOf(";");
|
|
362
|
-
const bg = Number.parseInt(sep >= 0 ? colorfgbg.slice(sep + 1) : colorfgbg, 10);
|
|
363
|
-
if (bg >= 0 && bg <= 255) {
|
|
364
|
-
if (bg <= 15) return bg === 7 || bg === 15;
|
|
365
|
-
if (bg >= 232) return bg >= 244;
|
|
366
|
-
const cubeIndex = bg - 16;
|
|
367
|
-
const bVal = XTERM_LEVELS[cubeIndex % 6];
|
|
368
|
-
const gVal = XTERM_LEVELS[Math.floor(cubeIndex / 6) % 6];
|
|
369
|
-
const rVal = XTERM_LEVELS[Math.floor(cubeIndex / 36)];
|
|
370
|
-
return pickHigherContrastText(rVal, gVal, bVal);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
/** Whether the terminal has a light background. Exported for testing only. */
|
|
376
|
-
const lightMode = isLightBackground();
|
|
377
|
-
const palette = lightMode ? {
|
|
378
|
-
text: "#1E1E1E",
|
|
379
|
-
dim: "#5B6472",
|
|
380
|
-
accent: "#B45309",
|
|
381
|
-
accentSoft: "#C2410C",
|
|
382
|
-
border: "#5B6472",
|
|
383
|
-
userBg: "#F3F0E8",
|
|
384
|
-
userText: "#1E1E1E",
|
|
385
|
-
systemText: "#4B5563",
|
|
386
|
-
toolPendingBg: "#EFF6FF",
|
|
387
|
-
toolSuccessBg: "#ECFDF5",
|
|
388
|
-
toolErrorBg: "#FEF2F2",
|
|
389
|
-
toolTitle: "#B45309",
|
|
390
|
-
toolOutput: "#374151",
|
|
391
|
-
quote: "#1D4ED8",
|
|
392
|
-
quoteBorder: "#2563EB",
|
|
393
|
-
code: "#92400E",
|
|
394
|
-
codeBlock: "#F9FAFB",
|
|
395
|
-
codeBorder: "#92400E",
|
|
396
|
-
link: "#047857",
|
|
397
|
-
error: "#DC2626",
|
|
398
|
-
success: "#047857"
|
|
399
|
-
} : {
|
|
400
|
-
text: "#E8E3D5",
|
|
401
|
-
dim: "#7B7F87",
|
|
402
|
-
accent: "#F6C453",
|
|
403
|
-
accentSoft: "#F2A65A",
|
|
404
|
-
border: "#3C414B",
|
|
405
|
-
userBg: "#2B2F36",
|
|
406
|
-
userText: "#F3EEE0",
|
|
407
|
-
systemText: "#9BA3B2",
|
|
408
|
-
toolPendingBg: "#1F2A2F",
|
|
409
|
-
toolSuccessBg: "#1E2D23",
|
|
410
|
-
toolErrorBg: "#2F1F1F",
|
|
411
|
-
toolTitle: "#F6C453",
|
|
412
|
-
toolOutput: "#E1DACB",
|
|
413
|
-
quote: "#8CC8FF",
|
|
414
|
-
quoteBorder: "#3B4D6B",
|
|
415
|
-
code: "#F0C987",
|
|
416
|
-
codeBlock: "#1E232A",
|
|
417
|
-
codeBorder: "#343A45",
|
|
418
|
-
link: "#7DD3A5",
|
|
419
|
-
error: "#F97066",
|
|
420
|
-
success: "#7DD3A5"
|
|
421
|
-
};
|
|
422
|
-
const fg = (hex) => (text) => chalk.hex(hex)(text);
|
|
423
|
-
const bg = (hex) => (text) => chalk.bgHex(hex)(text);
|
|
424
|
-
const syntaxTheme = createSyntaxTheme(fg(palette.code), lightMode);
|
|
425
|
-
/**
|
|
426
|
-
* Highlight code with syntax coloring.
|
|
427
|
-
* Returns an array of lines with ANSI escape codes.
|
|
428
|
-
*/
|
|
429
|
-
function highlightCode(code, lang) {
|
|
430
|
-
try {
|
|
431
|
-
return highlight(code, {
|
|
432
|
-
language: lang && supportsLanguage(lang) ? lang : void 0,
|
|
433
|
-
theme: syntaxTheme,
|
|
434
|
-
ignoreIllegals: true
|
|
435
|
-
}).split("\n");
|
|
436
|
-
} catch {
|
|
437
|
-
return code.split("\n").map((line) => fg(palette.code)(line));
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
const theme = {
|
|
441
|
-
fg: fg(palette.text),
|
|
442
|
-
assistantText: (text) => text,
|
|
443
|
-
dim: fg(palette.dim),
|
|
444
|
-
accent: fg(palette.accent),
|
|
445
|
-
accentSoft: fg(palette.accentSoft),
|
|
446
|
-
success: fg(palette.success),
|
|
447
|
-
error: fg(palette.error),
|
|
448
|
-
header: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
449
|
-
system: fg(palette.systemText),
|
|
450
|
-
userBg: bg(palette.userBg),
|
|
451
|
-
userText: fg(palette.userText),
|
|
452
|
-
toolTitle: fg(palette.toolTitle),
|
|
453
|
-
toolOutput: fg(palette.toolOutput),
|
|
454
|
-
toolPendingBg: bg(palette.toolPendingBg),
|
|
455
|
-
toolSuccessBg: bg(palette.toolSuccessBg),
|
|
456
|
-
toolErrorBg: bg(palette.toolErrorBg),
|
|
457
|
-
border: fg(palette.border),
|
|
458
|
-
bold: (text) => chalk.bold(text),
|
|
459
|
-
italic: (text) => chalk.italic(text)
|
|
460
|
-
};
|
|
461
|
-
const markdownTheme = {
|
|
462
|
-
heading: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
463
|
-
link: (text) => fg(palette.link)(text),
|
|
464
|
-
linkUrl: (text) => chalk.dim(text),
|
|
465
|
-
code: (text) => fg(palette.code)(text),
|
|
466
|
-
codeBlock: (text) => fg(palette.code)(text),
|
|
467
|
-
codeBlockBorder: (text) => fg(palette.codeBorder)(text),
|
|
468
|
-
quote: (text) => fg(palette.quote)(text),
|
|
469
|
-
quoteBorder: (text) => fg(palette.quoteBorder)(text),
|
|
470
|
-
hr: (text) => fg(palette.border)(text),
|
|
471
|
-
listBullet: (text) => fg(palette.accentSoft)(text),
|
|
472
|
-
bold: (text) => chalk.bold(text),
|
|
473
|
-
italic: (text) => chalk.italic(text),
|
|
474
|
-
strikethrough: (text) => chalk.strikethrough(text),
|
|
475
|
-
underline: (text) => chalk.underline(text),
|
|
476
|
-
highlightCode
|
|
477
|
-
};
|
|
478
|
-
const baseSelectListTheme = {
|
|
479
|
-
selectedPrefix: (text) => fg(palette.accent)(text),
|
|
480
|
-
selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
|
|
481
|
-
description: (text) => fg(palette.dim)(text),
|
|
482
|
-
scrollInfo: (text) => fg(palette.dim)(text),
|
|
483
|
-
noMatch: (text) => fg(palette.dim)(text)
|
|
484
|
-
};
|
|
485
|
-
const selectListTheme = baseSelectListTheme;
|
|
486
|
-
const filterableSelectListTheme = {
|
|
487
|
-
...baseSelectListTheme,
|
|
488
|
-
filterLabel: (text) => fg(palette.dim)(text)
|
|
489
|
-
};
|
|
490
|
-
const settingsListTheme = {
|
|
491
|
-
label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
|
|
492
|
-
value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
|
|
493
|
-
description: (text) => fg(palette.systemText)(text),
|
|
494
|
-
cursor: fg(palette.accent)("→ "),
|
|
495
|
-
hint: (text) => fg(palette.dim)(text)
|
|
496
|
-
};
|
|
497
|
-
const editorTheme = {
|
|
498
|
-
borderColor: (text) => fg(palette.border)(text),
|
|
499
|
-
selectList: selectListTheme
|
|
500
|
-
};
|
|
501
|
-
const searchableSelectListTheme = {
|
|
502
|
-
...baseSelectListTheme,
|
|
503
|
-
searchPrompt: (text) => fg(palette.accentSoft)(text),
|
|
504
|
-
searchInput: (text) => fg(palette.text)(text),
|
|
505
|
-
matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
|
|
506
|
-
};
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src/tui/osc8-hyperlinks.ts
|
|
509
|
-
const SGR_PATTERN = "\\x1b\\[[0-9;]*m";
|
|
510
|
-
const OSC8_PATTERN = "\\x1b\\]8;;.*?(?:\\x07|\\x1b\\\\)";
|
|
511
|
-
const ANSI_RE = new RegExp(`${SGR_PATTERN}|${OSC8_PATTERN}`, "g");
|
|
512
|
-
const SGR_START_RE = new RegExp(`^${SGR_PATTERN}`);
|
|
513
|
-
const OSC8_START_RE = new RegExp(`^${OSC8_PATTERN}`);
|
|
514
|
-
/**
|
|
515
|
-
* Extract all unique URLs from raw markdown text.
|
|
516
|
-
* Finds both bare URLs and markdown link hrefs [text](url).
|
|
517
|
-
*/
|
|
518
|
-
function extractUrls(markdown) {
|
|
519
|
-
const urls = /* @__PURE__ */ new Set();
|
|
520
|
-
const mdLinkRe = /\[(?:[^\]]*)\]\(\s*<?(https?:\/\/[^)\s>]+)>?(?:\s+["'][^"']*["'])?\s*\)/g;
|
|
521
|
-
let m;
|
|
522
|
-
while ((m = mdLinkRe.exec(markdown)) !== null) urls.add(m[1]);
|
|
523
|
-
const stripped = markdown.replace(/\[(?:[^\]]*)\]\(\s*<?https?:\/\/[^)\s>]+>?(?:\s+["'][^"']*["'])?\s*\)/g, "");
|
|
524
|
-
const bareRe = /https?:\/\/[^\s)\]>]+/g;
|
|
525
|
-
while ((m = bareRe.exec(stripped)) !== null) urls.add(m[0]);
|
|
526
|
-
return [...urls];
|
|
527
|
-
}
|
|
528
|
-
/** Strip ANSI SGR and OSC 8 sequences to get visible text. */
|
|
529
|
-
function stripAnsi(input) {
|
|
530
|
-
return input.replace(ANSI_RE, "");
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Find URL ranges in a line's visible text, handling cross-line URL splits.
|
|
534
|
-
*/
|
|
535
|
-
function findUrlRanges(visibleText, knownUrls, pending) {
|
|
536
|
-
const ranges = [];
|
|
537
|
-
let newPending = null;
|
|
538
|
-
let searchFrom = 0;
|
|
539
|
-
if (pending) {
|
|
540
|
-
const remaining = pending.url.slice(pending.consumed);
|
|
541
|
-
const trimmed = visibleText.trimStart();
|
|
542
|
-
const leadingSpaces = visibleText.length - trimmed.length;
|
|
543
|
-
let matchLen = 0;
|
|
544
|
-
for (let j = 0; j < remaining.length && j < trimmed.length; j++) if (remaining[j] === trimmed[j]) matchLen++;
|
|
545
|
-
else break;
|
|
546
|
-
if (matchLen > 0) {
|
|
547
|
-
ranges.push({
|
|
548
|
-
start: leadingSpaces,
|
|
549
|
-
end: leadingSpaces + matchLen,
|
|
550
|
-
url: pending.url
|
|
551
|
-
});
|
|
552
|
-
searchFrom = leadingSpaces + matchLen;
|
|
553
|
-
if (pending.consumed + matchLen < pending.url.length) newPending = {
|
|
554
|
-
url: pending.url,
|
|
555
|
-
consumed: pending.consumed + matchLen
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
const urlRe = /https?:\/\/[^\s)\]>]+/g;
|
|
560
|
-
urlRe.lastIndex = searchFrom;
|
|
561
|
-
let match;
|
|
562
|
-
while ((match = urlRe.exec(visibleText)) !== null) {
|
|
563
|
-
const fragment = match[0];
|
|
564
|
-
const start = match.index;
|
|
565
|
-
let resolvedUrl = fragment;
|
|
566
|
-
let found = false;
|
|
567
|
-
for (const known of knownUrls) if (known === fragment) {
|
|
568
|
-
resolvedUrl = known;
|
|
569
|
-
found = true;
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
if (!found) {
|
|
573
|
-
let bestLen = 0;
|
|
574
|
-
for (const known of knownUrls) if (known.startsWith(fragment) && known.length > bestLen) {
|
|
575
|
-
resolvedUrl = known;
|
|
576
|
-
bestLen = known.length;
|
|
577
|
-
found = true;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
if (!found) {
|
|
581
|
-
let bestLen = 0;
|
|
582
|
-
for (const known of knownUrls) if (fragment.startsWith(known) && known.length > bestLen) {
|
|
583
|
-
resolvedUrl = known;
|
|
584
|
-
bestLen = known.length;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
ranges.push({
|
|
588
|
-
start,
|
|
589
|
-
end: start + fragment.length,
|
|
590
|
-
url: resolvedUrl
|
|
591
|
-
});
|
|
592
|
-
if (resolvedUrl.length > fragment.length && resolvedUrl.startsWith(fragment)) newPending = {
|
|
593
|
-
url: resolvedUrl,
|
|
594
|
-
consumed: fragment.length
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
return {
|
|
598
|
-
ranges,
|
|
599
|
-
pending: newPending
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Apply OSC 8 hyperlink sequences to a line based on visible-text URL ranges.
|
|
604
|
-
* Walks through the raw string character by character, inserting OSC 8
|
|
605
|
-
* open/close sequences at URL range boundaries while preserving ANSI codes.
|
|
606
|
-
*/
|
|
607
|
-
function applyOsc8Ranges(line, ranges) {
|
|
608
|
-
if (ranges.length === 0) return line;
|
|
609
|
-
const urlAt = /* @__PURE__ */ new Map();
|
|
610
|
-
for (const r of ranges) for (let p = r.start; p < r.end; p++) urlAt.set(p, r.url);
|
|
611
|
-
let result = "";
|
|
612
|
-
let visiblePos = 0;
|
|
613
|
-
let activeUrl = null;
|
|
614
|
-
let i = 0;
|
|
615
|
-
while (i < line.length) {
|
|
616
|
-
if (line.charCodeAt(i) === 27) {
|
|
617
|
-
const sgr = line.slice(i).match(SGR_START_RE);
|
|
618
|
-
if (sgr) {
|
|
619
|
-
result += sgr[0];
|
|
620
|
-
i += sgr[0].length;
|
|
621
|
-
continue;
|
|
622
|
-
}
|
|
623
|
-
const osc = line.slice(i).match(OSC8_START_RE);
|
|
624
|
-
if (osc) {
|
|
625
|
-
result += osc[0];
|
|
626
|
-
i += osc[0].length;
|
|
627
|
-
continue;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
const targetUrl = urlAt.get(visiblePos) ?? null;
|
|
631
|
-
if (targetUrl !== activeUrl) {
|
|
632
|
-
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
633
|
-
if (targetUrl !== null) result += `\x1b]8;;${targetUrl}\x07`;
|
|
634
|
-
activeUrl = targetUrl;
|
|
635
|
-
}
|
|
636
|
-
result += line[i];
|
|
637
|
-
visiblePos++;
|
|
638
|
-
i++;
|
|
639
|
-
}
|
|
640
|
-
if (activeUrl !== null) result += "\x1B]8;;\x07";
|
|
641
|
-
return result;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Add OSC 8 hyperlinks to rendered lines using a pre-extracted URL list.
|
|
645
|
-
*
|
|
646
|
-
* For each line, finds URL-like substrings in the visible text, matches them
|
|
647
|
-
* against known URLs, and wraps each fragment with OSC 8 escape sequences.
|
|
648
|
-
* Handles URLs broken across multiple lines by pi-tui's word wrapping.
|
|
649
|
-
*/
|
|
650
|
-
function addOsc8Hyperlinks(lines, urls) {
|
|
651
|
-
if (urls.length === 0) return lines;
|
|
652
|
-
let pending = null;
|
|
653
|
-
return lines.map((line) => {
|
|
654
|
-
const result = findUrlRanges(stripAnsi(line), urls, pending);
|
|
655
|
-
pending = result.pending;
|
|
656
|
-
return applyOsc8Ranges(line, result.ranges);
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
//#endregion
|
|
660
|
-
//#region src/tui/components/hyperlink-markdown.ts
|
|
661
|
-
/**
|
|
662
|
-
* Wrapper around pi-tui's Markdown component that adds OSC 8 terminal
|
|
663
|
-
* hyperlinks to rendered output, making URLs clickable even when broken
|
|
664
|
-
* across multiple lines by word wrapping.
|
|
665
|
-
*/
|
|
666
|
-
var HyperlinkMarkdown = class {
|
|
667
|
-
constructor(text, paddingX, paddingY, theme, options) {
|
|
668
|
-
this.inner = new Markdown(text, paddingX, paddingY, theme, options);
|
|
669
|
-
this.urls = extractUrls(text);
|
|
670
|
-
}
|
|
671
|
-
render(width) {
|
|
672
|
-
return addOsc8Hyperlinks(this.inner.render(width), this.urls);
|
|
673
|
-
}
|
|
674
|
-
setText(text) {
|
|
675
|
-
this.inner.setText(text);
|
|
676
|
-
this.urls = extractUrls(text);
|
|
677
|
-
}
|
|
678
|
-
invalidate() {
|
|
679
|
-
this.inner.invalidate();
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
//#endregion
|
|
683
|
-
//#region src/tui/components/assistant-message.ts
|
|
684
|
-
var AssistantMessageComponent = class extends Container {
|
|
685
|
-
constructor(text) {
|
|
686
|
-
super();
|
|
687
|
-
this.body = new HyperlinkMarkdown(text, 0, 0, markdownTheme, { color: (line) => theme.assistantText(line) });
|
|
688
|
-
this.addChild(new Spacer(1));
|
|
689
|
-
this.addChild(this.body);
|
|
690
|
-
}
|
|
691
|
-
setText(text) {
|
|
692
|
-
this.body.setText(text);
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/tui/components/btw-inline-message.ts
|
|
697
|
-
var BtwInlineMessage = class extends Container {
|
|
698
|
-
constructor(params) {
|
|
699
|
-
super();
|
|
700
|
-
this.setResult(params);
|
|
701
|
-
}
|
|
702
|
-
setResult(params) {
|
|
703
|
-
this.clear();
|
|
704
|
-
this.addChild(new Spacer(1));
|
|
705
|
-
this.addChild(new Text(theme.header(`BTW: ${params.question}`), 1, 0));
|
|
706
|
-
if (params.isError) this.addChild(new Text(theme.error(params.text), 1, 0));
|
|
707
|
-
else this.addChild(new AssistantMessageComponent(params.text));
|
|
708
|
-
this.addChild(new Text(theme.dim("Press Enter or Esc to dismiss"), 1, 0));
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/tui/tui-formatters.ts
|
|
713
|
-
const REPLACEMENT_CHAR_RE = /\uFFFD/g;
|
|
714
|
-
const MAX_TOKEN_CHARS = 32;
|
|
715
|
-
const LONG_TOKEN_RE = /\S{33,}/g;
|
|
716
|
-
const LONG_TOKEN_TEST_RE = /\S{33,}/;
|
|
717
|
-
const BINARY_LINE_REPLACEMENT_THRESHOLD = 12;
|
|
718
|
-
const URL_PREFIX_RE = /^(https?:\/\/|file:\/\/)/i;
|
|
719
|
-
const WINDOWS_DRIVE_RE = /^[a-zA-Z]:[\\/]/;
|
|
720
|
-
const FILE_LIKE_RE = /^[a-zA-Z0-9._-]+$/;
|
|
721
|
-
const EDGE_PUNCTUATION_RE = /^[`"'([{<]+|[`"')\]}>.,:;!?]+$/g;
|
|
722
|
-
const TOKENISH_MIN_LENGTH = 24;
|
|
723
|
-
const RTL_SCRIPT_RE = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;
|
|
724
|
-
const BIDI_CONTROL_RE = /[\u202a-\u202e\u2066-\u2069]/;
|
|
725
|
-
const RTL_ISOLATE_START = "";
|
|
726
|
-
const RTL_ISOLATE_END = "";
|
|
727
|
-
function hasControlChars(text) {
|
|
728
|
-
for (const char of text) {
|
|
729
|
-
const code = char.charCodeAt(0);
|
|
730
|
-
if (code <= 31 && code !== 9 && code !== 10 && code !== 13 || code >= 127 && code <= 159) return true;
|
|
731
|
-
}
|
|
732
|
-
return false;
|
|
733
|
-
}
|
|
734
|
-
function stripControlChars(text) {
|
|
735
|
-
if (!hasControlChars(text)) return text;
|
|
736
|
-
let sanitized = "";
|
|
737
|
-
for (const char of text) {
|
|
738
|
-
const code = char.charCodeAt(0);
|
|
739
|
-
if (!(code <= 31 && code !== 9 && code !== 10 && code !== 13) && !(code >= 127 && code <= 159)) sanitized += char;
|
|
740
|
-
}
|
|
741
|
-
return sanitized;
|
|
742
|
-
}
|
|
743
|
-
function chunkToken(token, maxChars) {
|
|
744
|
-
if (token.length <= maxChars) return [token];
|
|
745
|
-
const chunks = [];
|
|
746
|
-
for (let i = 0; i < token.length; i += maxChars) chunks.push(token.slice(i, i + maxChars));
|
|
747
|
-
return chunks;
|
|
748
|
-
}
|
|
749
|
-
function isCopySensitiveToken(token) {
|
|
750
|
-
const candidate = token.replace(EDGE_PUNCTUATION_RE, "") || token;
|
|
751
|
-
if (URL_PREFIX_RE.test(token)) return true;
|
|
752
|
-
if (token.startsWith("/") || token.startsWith("~/") || token.startsWith("./") || token.startsWith("../")) return true;
|
|
753
|
-
if (WINDOWS_DRIVE_RE.test(token) || token.startsWith("\\\\")) return true;
|
|
754
|
-
if (token.includes("/") || token.includes("\\")) return true;
|
|
755
|
-
if (token.includes("_") && FILE_LIKE_RE.test(token)) return true;
|
|
756
|
-
if (candidate.length >= TOKENISH_MIN_LENGTH && /[a-z]/i.test(candidate) && /\d/.test(candidate)) return true;
|
|
757
|
-
return false;
|
|
758
|
-
}
|
|
759
|
-
function normalizeLongTokenForDisplay(token) {
|
|
760
|
-
if (isCopySensitiveToken(token)) return token;
|
|
761
|
-
return chunkToken(token, MAX_TOKEN_CHARS).join(" ");
|
|
762
|
-
}
|
|
763
|
-
function redactBinaryLikeLine(line) {
|
|
764
|
-
const replacementCount = (line.match(REPLACEMENT_CHAR_RE) || []).length;
|
|
765
|
-
if (replacementCount >= BINARY_LINE_REPLACEMENT_THRESHOLD && replacementCount * 2 >= line.length) return "[binary data omitted]";
|
|
766
|
-
return line;
|
|
767
|
-
}
|
|
768
|
-
function isolateRtlLine(line) {
|
|
769
|
-
if (!RTL_SCRIPT_RE.test(line) || BIDI_CONTROL_RE.test(line)) return line;
|
|
770
|
-
return `${RTL_ISOLATE_START}${line}${RTL_ISOLATE_END}`;
|
|
771
|
-
}
|
|
772
|
-
function applyRtlIsolation(text) {
|
|
773
|
-
if (!RTL_SCRIPT_RE.test(text)) return text;
|
|
774
|
-
return text.split("\n").map((line) => isolateRtlLine(line)).join("\n");
|
|
775
|
-
}
|
|
776
|
-
function sanitizeRenderableText(text) {
|
|
777
|
-
if (!text) return text;
|
|
778
|
-
const hasAnsi = text.includes("\x1B");
|
|
779
|
-
const hasReplacementChars = text.includes("�");
|
|
780
|
-
const hasLongTokens = LONG_TOKEN_TEST_RE.test(text);
|
|
781
|
-
const hasControls = hasControlChars(text);
|
|
782
|
-
if (!hasAnsi && !hasReplacementChars && !hasLongTokens && !hasControls) return applyRtlIsolation(text);
|
|
783
|
-
const withoutAnsi = hasAnsi ? stripAnsi$1(text) : text;
|
|
784
|
-
const withoutControlChars = hasControls ? stripControlChars(withoutAnsi) : withoutAnsi;
|
|
785
|
-
const redacted = hasReplacementChars ? withoutControlChars.split("\n").map((line) => redactBinaryLikeLine(line)).join("\n") : withoutControlChars;
|
|
786
|
-
return applyRtlIsolation(LONG_TOKEN_TEST_RE.test(redacted) ? redacted.replace(LONG_TOKEN_RE, normalizeLongTokenForDisplay) : redacted);
|
|
787
|
-
}
|
|
788
|
-
function resolveFinalAssistantText(params) {
|
|
789
|
-
const finalText = params.finalText ?? "";
|
|
790
|
-
if (finalText.trim()) return finalText;
|
|
791
|
-
const streamedText = params.streamedText ?? "";
|
|
792
|
-
if (streamedText.trim()) return streamedText;
|
|
793
|
-
const errorMessage = params.errorMessage ?? "";
|
|
794
|
-
if (errorMessage.trim()) return formatRawAssistantErrorForUi(errorMessage);
|
|
795
|
-
return "(no output)";
|
|
796
|
-
}
|
|
797
|
-
function composeThinkingAndContent(params) {
|
|
798
|
-
const thinkingText = params.thinkingText?.trim() ?? "";
|
|
799
|
-
const contentText = params.contentText?.trim() ?? "";
|
|
800
|
-
const parts = [];
|
|
801
|
-
if (params.showThinking && thinkingText) parts.push(`[thinking]\n${thinkingText}`);
|
|
802
|
-
if (contentText) parts.push(contentText);
|
|
803
|
-
return parts.join("\n\n").trim();
|
|
804
|
-
}
|
|
805
|
-
function asMessageRecord(message) {
|
|
806
|
-
if (!message || typeof message !== "object") return;
|
|
807
|
-
return message;
|
|
808
|
-
}
|
|
809
|
-
function resolveMessageRecord(message) {
|
|
810
|
-
const record = asMessageRecord(message);
|
|
811
|
-
if (!record) return;
|
|
812
|
-
return {
|
|
813
|
-
record,
|
|
814
|
-
content: record.content
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
function formatAssistantErrorFromRecord(record) {
|
|
818
|
-
if ((typeof record.stopReason === "string" ? record.stopReason : "") !== "error") return "";
|
|
819
|
-
return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
|
|
820
|
-
}
|
|
821
|
-
function collectSanitizedBlockStrings(params) {
|
|
822
|
-
if (!Array.isArray(params.content)) return [];
|
|
823
|
-
const parts = [];
|
|
824
|
-
for (const block of params.content) {
|
|
825
|
-
if (!block || typeof block !== "object") continue;
|
|
826
|
-
const rec = block;
|
|
827
|
-
if (rec.type === params.blockType && typeof rec[params.valueKey] === "string") parts.push(sanitizeRenderableText(rec[params.valueKey]));
|
|
828
|
-
}
|
|
829
|
-
return parts;
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* Extract ONLY thinking blocks from message content.
|
|
833
|
-
* Model-agnostic: returns empty string if no thinking blocks exist.
|
|
834
|
-
*/
|
|
835
|
-
function extractThinkingFromMessage(message) {
|
|
836
|
-
const resolved = resolveMessageRecord(message);
|
|
837
|
-
if (!resolved) return "";
|
|
838
|
-
const { content } = resolved;
|
|
839
|
-
if (typeof content === "string") return "";
|
|
840
|
-
return collectSanitizedBlockStrings({
|
|
841
|
-
content,
|
|
842
|
-
blockType: "thinking",
|
|
843
|
-
valueKey: "thinking"
|
|
844
|
-
}).join("\n").trim();
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
* Extract ONLY text content blocks from message (excludes thinking).
|
|
848
|
-
* Model-agnostic: works for any model with text content blocks.
|
|
849
|
-
*/
|
|
850
|
-
function extractContentFromMessage(message) {
|
|
851
|
-
const resolved = resolveMessageRecord(message);
|
|
852
|
-
if (!resolved) return "";
|
|
853
|
-
const { record, content } = resolved;
|
|
854
|
-
if (record.role === "assistant") {
|
|
855
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
856
|
-
if (Array.isArray(content)) return extractAssistantRenderableContent(record);
|
|
857
|
-
}
|
|
858
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
859
|
-
const parts = collectSanitizedBlockStrings({
|
|
860
|
-
content,
|
|
861
|
-
blockType: "text",
|
|
862
|
-
valueKey: "text"
|
|
863
|
-
});
|
|
864
|
-
if (parts.length > 0) return parts.join("\n").trim();
|
|
865
|
-
return formatAssistantErrorFromRecord(record);
|
|
866
|
-
}
|
|
867
|
-
function extractAssistantRenderableContent(record) {
|
|
868
|
-
const visible = sanitizeRenderableText(extractAssistantVisibleText(record) ?? "").trim();
|
|
869
|
-
if (visible) return visible;
|
|
870
|
-
return formatAssistantErrorFromRecord(record);
|
|
871
|
-
}
|
|
872
|
-
function extractTextBlocks(content, opts) {
|
|
873
|
-
if (typeof content === "string") return sanitizeRenderableText(content).trim();
|
|
874
|
-
if (!Array.isArray(content)) return "";
|
|
875
|
-
const textParts = collectSanitizedBlockStrings({
|
|
876
|
-
content,
|
|
877
|
-
blockType: "text",
|
|
878
|
-
valueKey: "text"
|
|
879
|
-
});
|
|
880
|
-
return composeThinkingAndContent({
|
|
881
|
-
thinkingText: (opts?.includeThinking === true ? collectSanitizedBlockStrings({
|
|
882
|
-
content,
|
|
883
|
-
blockType: "thinking",
|
|
884
|
-
valueKey: "thinking"
|
|
885
|
-
}) : []).join("\n").trim(),
|
|
886
|
-
contentText: textParts.join("\n").trim(),
|
|
887
|
-
showThinking: opts?.includeThinking ?? false
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
function extractTextFromMessage(message, opts) {
|
|
891
|
-
const record = asMessageRecord(message);
|
|
892
|
-
if (!record) return "";
|
|
893
|
-
if (record.role === "assistant") return composeThinkingAndContent({
|
|
894
|
-
thinkingText: extractThinkingFromMessage(record),
|
|
895
|
-
contentText: extractAssistantRenderableContent(record),
|
|
896
|
-
showThinking: opts?.includeThinking ?? false
|
|
897
|
-
});
|
|
898
|
-
const text = extractTextBlocks(record.content, opts);
|
|
899
|
-
if (text) {
|
|
900
|
-
if (record.role === "user" || record.command === true) return stripLeadingInboundMetadata(text);
|
|
901
|
-
return text;
|
|
902
|
-
}
|
|
903
|
-
const errorText = formatAssistantErrorFromRecord(record);
|
|
904
|
-
if (!errorText) return "";
|
|
905
|
-
return errorText;
|
|
906
|
-
}
|
|
907
|
-
function isCommandMessage(message) {
|
|
908
|
-
if (!message || typeof message !== "object") return false;
|
|
909
|
-
return message.command === true;
|
|
910
|
-
}
|
|
911
|
-
function formatTokens(total, context) {
|
|
912
|
-
if (total == null && context == null) return "tokens ?";
|
|
913
|
-
const totalLabel = total == null ? "?" : formatTokenCount(total);
|
|
914
|
-
if (context == null) return `tokens ${totalLabel}`;
|
|
915
|
-
const pct = typeof total === "number" && context > 0 ? Math.min(999, Math.round(total / context * 100)) : null;
|
|
916
|
-
return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
|
|
917
|
-
}
|
|
918
|
-
function formatContextUsageLine(params) {
|
|
919
|
-
const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
|
|
920
|
-
const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
|
|
921
|
-
const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
|
|
922
|
-
const extra = [typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null, pct !== null ? `${pct}%` : null].filter(Boolean).join(", ");
|
|
923
|
-
return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
|
|
924
|
-
}
|
|
925
|
-
function asString(value, fallback = "") {
|
|
926
|
-
if (typeof value === "string") return value;
|
|
927
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
928
|
-
return fallback;
|
|
929
|
-
}
|
|
930
|
-
//#endregion
|
|
931
|
-
//#region src/tui/components/tool-execution.ts
|
|
932
|
-
function formatArgs(toolName, args) {
|
|
933
|
-
const detail = formatToolDetail(resolveToolDisplay({
|
|
934
|
-
name: toolName,
|
|
935
|
-
args
|
|
936
|
-
}));
|
|
937
|
-
if (detail) return sanitizeRenderableText(detail);
|
|
938
|
-
if (!args || typeof args !== "object") return "";
|
|
939
|
-
try {
|
|
940
|
-
return sanitizeRenderableText(JSON.stringify(args));
|
|
941
|
-
} catch {
|
|
942
|
-
return "";
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
function extractText(result) {
|
|
946
|
-
if (!result?.content) return "";
|
|
947
|
-
const lines = [];
|
|
948
|
-
for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(sanitizeRenderableText(entry.text));
|
|
949
|
-
else if (entry.type === "image") {
|
|
950
|
-
const mime = entry.mimeType ?? "image";
|
|
951
|
-
const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
|
|
952
|
-
const omitted = entry.omitted ? " (omitted)" : "";
|
|
953
|
-
lines.push(`[${mime}${size}${omitted}]`);
|
|
954
|
-
}
|
|
955
|
-
return lines.join("\n").trim();
|
|
956
|
-
}
|
|
957
|
-
var ToolExecutionComponent = class extends Container {
|
|
958
|
-
constructor(toolName, args) {
|
|
959
|
-
super();
|
|
960
|
-
this.expanded = false;
|
|
961
|
-
this.isError = false;
|
|
962
|
-
this.isPartial = true;
|
|
963
|
-
this.toolName = toolName;
|
|
964
|
-
this.args = args;
|
|
965
|
-
this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
|
|
966
|
-
this.header = new Text("", 0, 0);
|
|
967
|
-
this.argsLine = new Text("", 0, 0);
|
|
968
|
-
this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
|
|
969
|
-
this.addChild(new Spacer(1));
|
|
970
|
-
this.addChild(this.box);
|
|
971
|
-
this.box.addChild(this.header);
|
|
972
|
-
this.box.addChild(this.argsLine);
|
|
973
|
-
this.box.addChild(this.output);
|
|
974
|
-
this.refresh();
|
|
975
|
-
}
|
|
976
|
-
setArgs(args) {
|
|
977
|
-
this.args = args;
|
|
978
|
-
this.refresh();
|
|
979
|
-
}
|
|
980
|
-
setExpanded(expanded) {
|
|
981
|
-
this.expanded = expanded;
|
|
982
|
-
this.refresh();
|
|
983
|
-
}
|
|
984
|
-
setResult(result, opts) {
|
|
985
|
-
this.result = result;
|
|
986
|
-
this.isPartial = false;
|
|
987
|
-
this.isError = Boolean(opts?.isError);
|
|
988
|
-
this.refresh();
|
|
989
|
-
}
|
|
990
|
-
setPartialResult(result) {
|
|
991
|
-
this.result = result;
|
|
992
|
-
this.isPartial = true;
|
|
993
|
-
this.refresh();
|
|
994
|
-
}
|
|
995
|
-
refresh() {
|
|
996
|
-
const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
|
|
997
|
-
this.box.setBgFn((line) => bg(line));
|
|
998
|
-
const display = resolveToolDisplay({
|
|
999
|
-
name: this.toolName,
|
|
1000
|
-
args: this.args
|
|
1001
|
-
});
|
|
1002
|
-
const status = this.isPartial ? " (running)" : this.isError ? " (error)" : " ✓";
|
|
1003
|
-
const title = `${display.emoji} ${display.label}${status}`;
|
|
1004
|
-
this.header.setText(theme.toolTitle(theme.bold(title)));
|
|
1005
|
-
if (!this.expanded) {
|
|
1006
|
-
this.argsLine.setText("");
|
|
1007
|
-
this.output.setText("");
|
|
1008
|
-
return;
|
|
1009
|
-
}
|
|
1010
|
-
const argLine = formatArgs(this.toolName, this.args);
|
|
1011
|
-
this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
|
|
1012
|
-
const text = extractText(this.result) || (this.isPartial ? "…" : "");
|
|
1013
|
-
this.output.setText(text);
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
//#endregion
|
|
1017
|
-
//#region src/tui/components/markdown-message.ts
|
|
1018
|
-
var MarkdownMessageComponent = class extends Container {
|
|
1019
|
-
constructor(text, y, options) {
|
|
1020
|
-
super();
|
|
1021
|
-
this.body = new HyperlinkMarkdown(text, 0, y, markdownTheme, options);
|
|
1022
|
-
this.addChild(new Spacer(1));
|
|
1023
|
-
this.addChild(this.body);
|
|
1024
|
-
}
|
|
1025
|
-
setText(text) {
|
|
1026
|
-
this.body.setText(text);
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
//#endregion
|
|
1030
|
-
//#region src/tui/components/user-message.ts
|
|
1031
|
-
var UserMessageComponent = class extends MarkdownMessageComponent {
|
|
1032
|
-
constructor(text) {
|
|
1033
|
-
super(text, 1, {
|
|
1034
|
-
bgColor: (line) => theme.userBg(line),
|
|
1035
|
-
color: (line) => theme.userText(line)
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
//#endregion
|
|
1040
|
-
//#region src/tui/components/chat-log.ts
|
|
1041
|
-
const PENDING_HISTORY_CLOCK_SKEW_TOLERANCE_MS = 6e4;
|
|
1042
|
-
/** Lines reserved for header, status bar, footer, and editor (outside chat log) */
|
|
1043
|
-
const RESERVED_TERMINAL_LINES = 5;
|
|
1044
|
-
const SCROLL_STEP = 3;
|
|
1045
|
-
var ChatLog = class extends Container {
|
|
1046
|
-
constructor(maxComponents = 180) {
|
|
1047
|
-
super();
|
|
1048
|
-
this.toolById = /* @__PURE__ */ new Map();
|
|
1049
|
-
this.streamingRuns = /* @__PURE__ */ new Map();
|
|
1050
|
-
this.pendingUsers = /* @__PURE__ */ new Map();
|
|
1051
|
-
this.btwMessage = null;
|
|
1052
|
-
this.toolsExpanded = false;
|
|
1053
|
-
this.scrollOffset = 0;
|
|
1054
|
-
this.userScrolled = false;
|
|
1055
|
-
this.tuiRef = null;
|
|
1056
|
-
this.maxComponents = Math.max(20, Math.floor(maxComponents));
|
|
1057
|
-
}
|
|
1058
|
-
setTuiRef(ref) {
|
|
1059
|
-
this.tuiRef = ref;
|
|
1060
|
-
}
|
|
1061
|
-
scrollUp(lines = SCROLL_STEP) {
|
|
1062
|
-
this.scrollOffset += lines;
|
|
1063
|
-
this.userScrolled = true;
|
|
1064
|
-
this.tuiRef?.requestRender();
|
|
1065
|
-
}
|
|
1066
|
-
scrollDown(lines = SCROLL_STEP) {
|
|
1067
|
-
this.scrollOffset = Math.max(0, this.scrollOffset - lines);
|
|
1068
|
-
if (this.scrollOffset === 0) this.userScrolled = false;
|
|
1069
|
-
this.tuiRef?.requestRender();
|
|
1070
|
-
}
|
|
1071
|
-
scrollToBottom() {
|
|
1072
|
-
this.scrollOffset = 0;
|
|
1073
|
-
this.userScrolled = false;
|
|
1074
|
-
}
|
|
1075
|
-
isUserScrolled() {
|
|
1076
|
-
return this.userScrolled;
|
|
1077
|
-
}
|
|
1078
|
-
getScrollOffset() {
|
|
1079
|
-
return this.scrollOffset;
|
|
1080
|
-
}
|
|
1081
|
-
dropComponentReferences(component) {
|
|
1082
|
-
for (const [toolId, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(toolId);
|
|
1083
|
-
for (const [runId, message] of this.streamingRuns.entries()) if (message === component) this.streamingRuns.delete(runId);
|
|
1084
|
-
for (const [runId, entry] of this.pendingUsers.entries()) if (entry.component === component) this.pendingUsers.delete(runId);
|
|
1085
|
-
if (this.btwMessage === component) this.btwMessage = null;
|
|
1086
|
-
}
|
|
1087
|
-
pruneOverflow() {
|
|
1088
|
-
while (this.children.length > this.maxComponents) {
|
|
1089
|
-
const oldest = this.children[0];
|
|
1090
|
-
if (!oldest) return;
|
|
1091
|
-
this.removeChild(oldest);
|
|
1092
|
-
this.dropComponentReferences(oldest);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
append(component) {
|
|
1096
|
-
this.addChild(component);
|
|
1097
|
-
this.pruneOverflow();
|
|
1098
|
-
}
|
|
1099
|
-
render(width) {
|
|
1100
|
-
const allLines = super.render(width);
|
|
1101
|
-
const totalLines = allLines.length;
|
|
1102
|
-
if (!this.tuiRef) return allLines;
|
|
1103
|
-
const termRows = this.tuiRef.terminal.rows;
|
|
1104
|
-
const maxVisibleLines = Math.max(SCROLL_STEP, termRows - RESERVED_TERMINAL_LINES);
|
|
1105
|
-
if (totalLines <= maxVisibleLines) {
|
|
1106
|
-
if (this.scrollOffset !== 0 || this.userScrolled) {
|
|
1107
|
-
this.scrollOffset = 0;
|
|
1108
|
-
this.userScrolled = false;
|
|
1109
|
-
}
|
|
1110
|
-
return allLines;
|
|
1111
|
-
}
|
|
1112
|
-
if (!this.userScrolled) {
|
|
1113
|
-
this.scrollOffset = 0;
|
|
1114
|
-
return allLines.slice(Math.max(0, totalLines - maxVisibleLines));
|
|
1115
|
-
}
|
|
1116
|
-
const effectiveOffset = Math.min(this.scrollOffset, totalLines - maxVisibleLines);
|
|
1117
|
-
this.scrollOffset = effectiveOffset;
|
|
1118
|
-
if (effectiveOffset === 0) {
|
|
1119
|
-
this.userScrolled = false;
|
|
1120
|
-
return allLines.slice(Math.max(0, totalLines - maxVisibleLines));
|
|
1121
|
-
}
|
|
1122
|
-
const startIdx = Math.max(0, totalLines - maxVisibleLines - effectiveOffset);
|
|
1123
|
-
return allLines.slice(startIdx, startIdx + maxVisibleLines);
|
|
1124
|
-
}
|
|
1125
|
-
clearAll(opts) {
|
|
1126
|
-
this.clear();
|
|
1127
|
-
this.toolById.clear();
|
|
1128
|
-
this.streamingRuns.clear();
|
|
1129
|
-
this.btwMessage = null;
|
|
1130
|
-
if (!opts?.preservePendingUsers) this.pendingUsers.clear();
|
|
1131
|
-
}
|
|
1132
|
-
restorePendingUsers() {
|
|
1133
|
-
for (const entry of this.pendingUsers.values()) {
|
|
1134
|
-
if (this.children.includes(entry.component)) continue;
|
|
1135
|
-
this.append(entry.component);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
clearPendingUsers() {
|
|
1139
|
-
for (const entry of this.pendingUsers.values()) this.removeChild(entry.component);
|
|
1140
|
-
this.pendingUsers.clear();
|
|
1141
|
-
}
|
|
1142
|
-
createSystemMessage(text) {
|
|
1143
|
-
const entry = new Container();
|
|
1144
|
-
entry.addChild(new Spacer(1));
|
|
1145
|
-
entry.addChild(new Text(theme.system(text), 1, 0));
|
|
1146
|
-
return entry;
|
|
1147
|
-
}
|
|
1148
|
-
addSystem(text) {
|
|
1149
|
-
this.append(this.createSystemMessage(text));
|
|
1150
|
-
}
|
|
1151
|
-
addUser(text) {
|
|
1152
|
-
this.append(new UserMessageComponent(text));
|
|
1153
|
-
}
|
|
1154
|
-
addPendingUser(runId, text, createdAt = Date.now()) {
|
|
1155
|
-
const existing = this.pendingUsers.get(runId);
|
|
1156
|
-
if (existing) {
|
|
1157
|
-
existing.text = text;
|
|
1158
|
-
existing.createdAt = createdAt;
|
|
1159
|
-
existing.component.setText(text);
|
|
1160
|
-
return existing.component;
|
|
1161
|
-
}
|
|
1162
|
-
const component = new UserMessageComponent(text);
|
|
1163
|
-
this.pendingUsers.set(runId, {
|
|
1164
|
-
component,
|
|
1165
|
-
text,
|
|
1166
|
-
createdAt
|
|
1167
|
-
});
|
|
1168
|
-
this.append(component);
|
|
1169
|
-
return component;
|
|
1170
|
-
}
|
|
1171
|
-
commitPendingUser(runId) {
|
|
1172
|
-
return this.pendingUsers.delete(runId);
|
|
1173
|
-
}
|
|
1174
|
-
dropPendingUser(runId) {
|
|
1175
|
-
const existing = this.pendingUsers.get(runId);
|
|
1176
|
-
if (!existing) return false;
|
|
1177
|
-
this.removeChild(existing.component);
|
|
1178
|
-
this.pendingUsers.delete(runId);
|
|
1179
|
-
return true;
|
|
1180
|
-
}
|
|
1181
|
-
hasPendingUser(runId) {
|
|
1182
|
-
return this.pendingUsers.has(runId);
|
|
1183
|
-
}
|
|
1184
|
-
reconcilePendingUsers(historyUsers) {
|
|
1185
|
-
const normalizedHistory = historyUsers.map((entry) => ({
|
|
1186
|
-
text: entry.text.trim(),
|
|
1187
|
-
timestamp: typeof entry.timestamp === "number" ? entry.timestamp : null
|
|
1188
|
-
})).filter((entry) => entry.text.length > 0 && entry.timestamp !== null);
|
|
1189
|
-
const clearedRunIds = [];
|
|
1190
|
-
for (const [runId, entry] of this.pendingUsers.entries()) {
|
|
1191
|
-
const pendingText = entry.text.trim();
|
|
1192
|
-
if (!pendingText) continue;
|
|
1193
|
-
const matchIndex = normalizedHistory.findIndex((historyEntry) => historyEntry.text === pendingText && (historyEntry.timestamp ?? 0) >= entry.createdAt - PENDING_HISTORY_CLOCK_SKEW_TOLERANCE_MS);
|
|
1194
|
-
if (matchIndex === -1) continue;
|
|
1195
|
-
if (this.children.includes(entry.component)) this.removeChild(entry.component);
|
|
1196
|
-
this.pendingUsers.delete(runId);
|
|
1197
|
-
clearedRunIds.push(runId);
|
|
1198
|
-
normalizedHistory.splice(matchIndex, 1);
|
|
1199
|
-
}
|
|
1200
|
-
return clearedRunIds;
|
|
1201
|
-
}
|
|
1202
|
-
countPendingUsers() {
|
|
1203
|
-
return this.pendingUsers.size;
|
|
1204
|
-
}
|
|
1205
|
-
resolveRunId(runId) {
|
|
1206
|
-
return runId ?? "default";
|
|
1207
|
-
}
|
|
1208
|
-
startAssistant(text, runId) {
|
|
1209
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1210
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1211
|
-
if (existing) {
|
|
1212
|
-
existing.setText(text);
|
|
1213
|
-
return existing;
|
|
1214
|
-
}
|
|
1215
|
-
const component = new AssistantMessageComponent(text);
|
|
1216
|
-
this.streamingRuns.set(effectiveRunId, component);
|
|
1217
|
-
this.append(component);
|
|
1218
|
-
return component;
|
|
1219
|
-
}
|
|
1220
|
-
updateAssistant(text, runId) {
|
|
1221
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1222
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1223
|
-
if (!existing) {
|
|
1224
|
-
this.startAssistant(text, runId);
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
existing.setText(text);
|
|
1228
|
-
}
|
|
1229
|
-
finalizeAssistant(text, runId) {
|
|
1230
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1231
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1232
|
-
if (existing) {
|
|
1233
|
-
existing.setText(text);
|
|
1234
|
-
this.streamingRuns.delete(effectiveRunId);
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
this.append(new AssistantMessageComponent(text));
|
|
1238
|
-
}
|
|
1239
|
-
dropAssistant(runId) {
|
|
1240
|
-
const effectiveRunId = this.resolveRunId(runId);
|
|
1241
|
-
const existing = this.streamingRuns.get(effectiveRunId);
|
|
1242
|
-
if (!existing) return;
|
|
1243
|
-
this.removeChild(existing);
|
|
1244
|
-
this.streamingRuns.delete(effectiveRunId);
|
|
1245
|
-
}
|
|
1246
|
-
showBtw(params) {
|
|
1247
|
-
if (this.btwMessage) {
|
|
1248
|
-
this.btwMessage.setResult(params);
|
|
1249
|
-
if (this.children[this.children.length - 1] !== this.btwMessage) {
|
|
1250
|
-
this.removeChild(this.btwMessage);
|
|
1251
|
-
this.append(this.btwMessage);
|
|
1252
|
-
}
|
|
1253
|
-
return this.btwMessage;
|
|
1254
|
-
}
|
|
1255
|
-
const component = new BtwInlineMessage(params);
|
|
1256
|
-
this.btwMessage = component;
|
|
1257
|
-
this.append(component);
|
|
1258
|
-
return component;
|
|
1259
|
-
}
|
|
1260
|
-
dismissBtw() {
|
|
1261
|
-
if (!this.btwMessage) return;
|
|
1262
|
-
this.removeChild(this.btwMessage);
|
|
1263
|
-
this.btwMessage = null;
|
|
1264
|
-
}
|
|
1265
|
-
hasVisibleBtw() {
|
|
1266
|
-
return this.btwMessage !== null;
|
|
1267
|
-
}
|
|
1268
|
-
startTool(toolCallId, toolName, args) {
|
|
1269
|
-
const existing = this.toolById.get(toolCallId);
|
|
1270
|
-
if (existing) {
|
|
1271
|
-
existing.setArgs(args);
|
|
1272
|
-
return existing;
|
|
1273
|
-
}
|
|
1274
|
-
const component = new ToolExecutionComponent(toolName, args);
|
|
1275
|
-
component.setExpanded(this.toolsExpanded);
|
|
1276
|
-
this.toolById.set(toolCallId, component);
|
|
1277
|
-
this.append(component);
|
|
1278
|
-
return component;
|
|
1279
|
-
}
|
|
1280
|
-
updateToolArgs(toolCallId, args) {
|
|
1281
|
-
const existing = this.toolById.get(toolCallId);
|
|
1282
|
-
if (!existing) return;
|
|
1283
|
-
existing.setArgs(args);
|
|
1284
|
-
}
|
|
1285
|
-
updateToolResult(toolCallId, result, opts) {
|
|
1286
|
-
const existing = this.toolById.get(toolCallId);
|
|
1287
|
-
if (!existing) return;
|
|
1288
|
-
if (opts?.partial) {
|
|
1289
|
-
existing.setPartialResult(result);
|
|
1290
|
-
return;
|
|
1291
|
-
}
|
|
1292
|
-
existing.setResult(result, { isError: opts?.isError });
|
|
1293
|
-
}
|
|
1294
|
-
setToolsExpanded(expanded) {
|
|
1295
|
-
this.toolsExpanded = expanded;
|
|
1296
|
-
for (const tool of this.toolById.values()) tool.setExpanded(expanded);
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region src/tui/components/custom-editor.ts
|
|
1301
|
-
var CustomEditor = class extends Editor {
|
|
1302
|
-
handleInput(data) {
|
|
1303
|
-
if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
|
|
1304
|
-
this.onAltEnter();
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
if (matchesKey(data, Key.alt("up")) && this.onAltUp) {
|
|
1308
|
-
this.onAltUp();
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
|
|
1312
|
-
this.onCtrlL();
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
|
|
1316
|
-
this.onCtrlO();
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
|
|
1320
|
-
this.onCtrlP();
|
|
1321
|
-
return;
|
|
1322
|
-
}
|
|
1323
|
-
if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
|
|
1324
|
-
this.onCtrlG();
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
|
|
1328
|
-
this.onCtrlT();
|
|
1329
|
-
return;
|
|
1330
|
-
}
|
|
1331
|
-
if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
|
|
1332
|
-
this.onShiftTab();
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
|
|
1336
|
-
this.onEscape();
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
|
-
if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
|
|
1340
|
-
this.onCtrlC();
|
|
1341
|
-
return;
|
|
1342
|
-
}
|
|
1343
|
-
if (matchesKey(data, Key.ctrl("d"))) {
|
|
1344
|
-
if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
|
|
1345
|
-
return;
|
|
1346
|
-
}
|
|
1347
|
-
super.handleInput(data);
|
|
1348
|
-
}
|
|
1349
|
-
};
|
|
1350
|
-
//#endregion
|
|
1351
|
-
//#region src/tui/gateway-chat.ts
|
|
1352
|
-
function throwGatewayAuthResolutionError(reason) {
|
|
1353
|
-
throw new Error([
|
|
1354
|
-
reason,
|
|
1355
|
-
"Fix: set KAIJIBOT_GATEWAY_TOKEN/KAIJIBOT_GATEWAY_PASSWORD, pass --token/--password,",
|
|
1356
|
-
"or resolve the configured secret provider for this credential."
|
|
1357
|
-
].join("\n"));
|
|
1358
|
-
}
|
|
1359
|
-
var GatewayChatClient = class GatewayChatClient {
|
|
1360
|
-
constructor(connection) {
|
|
1361
|
-
this.connection = connection;
|
|
1362
|
-
this.readyPromise = new Promise((resolve) => {
|
|
1363
|
-
this.resolveReady = resolve;
|
|
1364
|
-
});
|
|
1365
|
-
this.client = new GatewayClient({
|
|
1366
|
-
url: connection.url,
|
|
1367
|
-
token: connection.token,
|
|
1368
|
-
password: connection.password,
|
|
1369
|
-
clientName: GATEWAY_CLIENT_NAMES.TUI,
|
|
1370
|
-
clientDisplayName: "kaijibot-tui",
|
|
1371
|
-
clientVersion: VERSION,
|
|
1372
|
-
platform: process.platform,
|
|
1373
|
-
mode: GATEWAY_CLIENT_MODES.UI,
|
|
1374
|
-
deviceIdentity: connection.allowInsecureLocalOperatorUi ? null : void 0,
|
|
1375
|
-
caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
|
|
1376
|
-
instanceId: randomUUID(),
|
|
1377
|
-
minProtocol: 3,
|
|
1378
|
-
maxProtocol: 3,
|
|
1379
|
-
onHelloOk: (hello) => {
|
|
1380
|
-
this.hello = hello;
|
|
1381
|
-
this.resolveReady?.();
|
|
1382
|
-
this.onConnected?.();
|
|
1383
|
-
},
|
|
1384
|
-
onEvent: (evt) => {
|
|
1385
|
-
this.onEvent?.({
|
|
1386
|
-
event: evt.event,
|
|
1387
|
-
payload: evt.payload,
|
|
1388
|
-
seq: evt.seq
|
|
1389
|
-
});
|
|
1390
|
-
},
|
|
1391
|
-
onClose: (_code, reason) => {
|
|
1392
|
-
this.readyPromise = new Promise((resolve) => {
|
|
1393
|
-
this.resolveReady = resolve;
|
|
1394
|
-
});
|
|
1395
|
-
this.onDisconnected?.(reason);
|
|
1396
|
-
},
|
|
1397
|
-
onGap: (info) => {
|
|
1398
|
-
this.onGap?.(info);
|
|
1399
|
-
}
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
static async connect(opts) {
|
|
1403
|
-
return new GatewayChatClient(await resolveGatewayConnection(opts));
|
|
1404
|
-
}
|
|
1405
|
-
start() {
|
|
1406
|
-
this.client.start();
|
|
1407
|
-
}
|
|
1408
|
-
stop() {
|
|
1409
|
-
this.client.stop();
|
|
1410
|
-
}
|
|
1411
|
-
async waitForReady() {
|
|
1412
|
-
await this.readyPromise;
|
|
1413
|
-
}
|
|
1414
|
-
async sendChat(opts) {
|
|
1415
|
-
const runId = opts.runId ?? randomUUID();
|
|
1416
|
-
await this.client.request("chat.send", {
|
|
1417
|
-
sessionKey: opts.sessionKey,
|
|
1418
|
-
message: opts.message,
|
|
1419
|
-
thinking: opts.thinking,
|
|
1420
|
-
deliver: opts.deliver,
|
|
1421
|
-
timeoutMs: opts.timeoutMs,
|
|
1422
|
-
idempotencyKey: runId
|
|
1423
|
-
});
|
|
1424
|
-
return { runId };
|
|
1425
|
-
}
|
|
1426
|
-
async abortChat(opts) {
|
|
1427
|
-
return await this.client.request("chat.abort", {
|
|
1428
|
-
sessionKey: opts.sessionKey,
|
|
1429
|
-
runId: opts.runId
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
1432
|
-
async loadHistory(opts) {
|
|
1433
|
-
return await this.client.request("chat.history", {
|
|
1434
|
-
sessionKey: opts.sessionKey,
|
|
1435
|
-
limit: opts.limit
|
|
1436
|
-
});
|
|
1437
|
-
}
|
|
1438
|
-
async listSessions(opts) {
|
|
1439
|
-
return await this.client.request("sessions.list", {
|
|
1440
|
-
limit: opts?.limit,
|
|
1441
|
-
activeMinutes: opts?.activeMinutes,
|
|
1442
|
-
includeGlobal: opts?.includeGlobal,
|
|
1443
|
-
includeUnknown: opts?.includeUnknown,
|
|
1444
|
-
includeDerivedTitles: opts?.includeDerivedTitles,
|
|
1445
|
-
includeLastMessage: opts?.includeLastMessage,
|
|
1446
|
-
agentId: opts?.agentId
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
async listAgents() {
|
|
1450
|
-
return await this.client.request("agents.list", {});
|
|
1451
|
-
}
|
|
1452
|
-
async patchSession(opts) {
|
|
1453
|
-
return await this.client.request("sessions.patch", opts);
|
|
1454
|
-
}
|
|
1455
|
-
async resetSession(key, reason) {
|
|
1456
|
-
return await this.client.request("sessions.reset", {
|
|
1457
|
-
key,
|
|
1458
|
-
...reason ? { reason } : {}
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
async getGatewayStatus() {
|
|
1462
|
-
return await this.client.request("status");
|
|
1463
|
-
}
|
|
1464
|
-
async listModels() {
|
|
1465
|
-
const res = await this.client.request("models.list");
|
|
1466
|
-
return Array.isArray(res?.models) ? res.models : [];
|
|
1467
|
-
}
|
|
1468
|
-
};
|
|
1469
|
-
async function resolveGatewayConnection(opts) {
|
|
1470
|
-
const config = loadConfig();
|
|
1471
|
-
const env = process.env;
|
|
1472
|
-
const gatewayAuthMode = config.gateway?.auth?.mode;
|
|
1473
|
-
const isRemoteMode = config.gateway?.mode === "remote";
|
|
1474
|
-
const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
|
|
1475
|
-
const explicitAuth = resolveExplicitGatewayAuth({
|
|
1476
|
-
token: opts.token,
|
|
1477
|
-
password: opts.password
|
|
1478
|
-
});
|
|
1479
|
-
ensureExplicitGatewayAuth({
|
|
1480
|
-
urlOverride,
|
|
1481
|
-
urlOverrideSource: "cli",
|
|
1482
|
-
explicitAuth,
|
|
1483
|
-
errorHint: "Fix: pass --token or --password when using --url."
|
|
1484
|
-
});
|
|
1485
|
-
const url = buildGatewayConnectionDetails({
|
|
1486
|
-
config,
|
|
1487
|
-
...urlOverride ? { url: urlOverride } : {}
|
|
1488
|
-
}).url;
|
|
1489
|
-
const allowInsecureLocalOperatorUi = (() => {
|
|
1490
|
-
if (config.gateway?.controlUi?.allowInsecureAuth !== true) return false;
|
|
1491
|
-
try {
|
|
1492
|
-
return isLoopbackHost(new URL(url).hostname);
|
|
1493
|
-
} catch {
|
|
1494
|
-
return false;
|
|
1495
|
-
}
|
|
1496
|
-
})();
|
|
1497
|
-
if (urlOverride) return {
|
|
1498
|
-
url,
|
|
1499
|
-
token: explicitAuth.token,
|
|
1500
|
-
password: explicitAuth.password,
|
|
1501
|
-
allowInsecureLocalOperatorUi
|
|
1502
|
-
};
|
|
1503
|
-
if (isRemoteMode) {
|
|
1504
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1505
|
-
config,
|
|
1506
|
-
env,
|
|
1507
|
-
explicitAuth,
|
|
1508
|
-
surface: "remote"
|
|
1509
|
-
});
|
|
1510
|
-
if (resolved.failureReason) throwGatewayAuthResolutionError(resolved.failureReason);
|
|
1511
|
-
return {
|
|
1512
|
-
url,
|
|
1513
|
-
token: resolved.token,
|
|
1514
|
-
password: resolved.password,
|
|
1515
|
-
allowInsecureLocalOperatorUi: false
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
if (gatewayAuthMode === "none" || gatewayAuthMode === "trusted-proxy") {
|
|
1519
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1520
|
-
config,
|
|
1521
|
-
env,
|
|
1522
|
-
explicitAuth,
|
|
1523
|
-
surface: "local"
|
|
1524
|
-
});
|
|
1525
|
-
return {
|
|
1526
|
-
url,
|
|
1527
|
-
token: resolved.token,
|
|
1528
|
-
password: resolved.password,
|
|
1529
|
-
allowInsecureLocalOperatorUi
|
|
1530
|
-
};
|
|
1531
|
-
}
|
|
1532
|
-
try {
|
|
1533
|
-
assertExplicitGatewayAuthModeWhenBothConfigured(config);
|
|
1534
|
-
} catch (err) {
|
|
1535
|
-
throwGatewayAuthResolutionError(formatErrorMessage(err));
|
|
1536
|
-
}
|
|
1537
|
-
const resolved = await resolveGatewayInteractiveSurfaceAuth({
|
|
1538
|
-
config,
|
|
1539
|
-
env,
|
|
1540
|
-
explicitAuth,
|
|
1541
|
-
surface: "local"
|
|
1542
|
-
});
|
|
1543
|
-
if (resolved.failureReason) throwGatewayAuthResolutionError(resolved.failureReason);
|
|
1544
|
-
return {
|
|
1545
|
-
url,
|
|
1546
|
-
token: resolved.token,
|
|
1547
|
-
password: resolved.password,
|
|
1548
|
-
allowInsecureLocalOperatorUi
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
//#endregion
|
|
1552
|
-
//#region src/tui/components/fuzzy-filter.ts
|
|
1553
|
-
/**
|
|
1554
|
-
* Shared fuzzy filtering utilities for select list components.
|
|
1555
|
-
*/
|
|
1556
|
-
/**
|
|
1557
|
-
* Word boundary characters for matching.
|
|
1558
|
-
*/
|
|
1559
|
-
const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
|
|
1560
|
-
/**
|
|
1561
|
-
* Check if position is at a word boundary.
|
|
1562
|
-
*/
|
|
1563
|
-
function isWordBoundary(text, index) {
|
|
1564
|
-
return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
|
|
1565
|
-
}
|
|
1566
|
-
/**
|
|
1567
|
-
* Find index where query matches at a word boundary in text.
|
|
1568
|
-
* Returns null if no match.
|
|
1569
|
-
*/
|
|
1570
|
-
function findWordBoundaryIndex(text, query) {
|
|
1571
|
-
if (!query) return null;
|
|
1572
|
-
const textLower = normalizeLowercaseStringOrEmpty(text);
|
|
1573
|
-
const queryLower = normalizeLowercaseStringOrEmpty(query);
|
|
1574
|
-
const maxIndex = textLower.length - queryLower.length;
|
|
1575
|
-
if (maxIndex < 0) return null;
|
|
1576
|
-
for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
|
|
1577
|
-
return null;
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
|
|
1581
|
-
* Returns score (lower = better) or null if no match.
|
|
1582
|
-
*/
|
|
1583
|
-
function fuzzyMatchLower(queryLower, textLower) {
|
|
1584
|
-
if (queryLower.length === 0) return 0;
|
|
1585
|
-
if (queryLower.length > textLower.length) return null;
|
|
1586
|
-
let queryIndex = 0;
|
|
1587
|
-
let score = 0;
|
|
1588
|
-
let lastMatchIndex = -1;
|
|
1589
|
-
let consecutiveMatches = 0;
|
|
1590
|
-
for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
|
|
1591
|
-
const isAtWordBoundary = isWordBoundary(textLower, i);
|
|
1592
|
-
if (lastMatchIndex === i - 1) {
|
|
1593
|
-
consecutiveMatches++;
|
|
1594
|
-
score -= consecutiveMatches * 5;
|
|
1595
|
-
} else {
|
|
1596
|
-
consecutiveMatches = 0;
|
|
1597
|
-
if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
|
|
1598
|
-
}
|
|
1599
|
-
if (isAtWordBoundary) score -= 10;
|
|
1600
|
-
score += i * .1;
|
|
1601
|
-
lastMatchIndex = i;
|
|
1602
|
-
queryIndex++;
|
|
1603
|
-
}
|
|
1604
|
-
return queryIndex < queryLower.length ? null : score;
|
|
1605
|
-
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Filter items using pre-lowercased searchTextLower field.
|
|
1608
|
-
* Supports space-separated tokens (all must match).
|
|
1609
|
-
*/
|
|
1610
|
-
function fuzzyFilterLower(items, queryLower) {
|
|
1611
|
-
const trimmed = queryLower.trim();
|
|
1612
|
-
if (!trimmed) return items;
|
|
1613
|
-
const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
|
|
1614
|
-
if (tokens.length === 0) return items;
|
|
1615
|
-
const results = [];
|
|
1616
|
-
for (const item of items) {
|
|
1617
|
-
const text = item.searchTextLower ?? "";
|
|
1618
|
-
let totalScore = 0;
|
|
1619
|
-
let allMatch = true;
|
|
1620
|
-
for (const token of tokens) {
|
|
1621
|
-
const score = fuzzyMatchLower(token, text);
|
|
1622
|
-
if (score !== null) totalScore += score;
|
|
1623
|
-
else {
|
|
1624
|
-
allMatch = false;
|
|
1625
|
-
break;
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
if (allMatch) results.push({
|
|
1629
|
-
item,
|
|
1630
|
-
score: totalScore
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
results.sort((a, b) => a.score - b.score);
|
|
1634
|
-
return results.map((r) => r.item);
|
|
1635
|
-
}
|
|
1636
|
-
/**
|
|
1637
|
-
* Prepare items for fuzzy filtering by pre-computing lowercase search text.
|
|
1638
|
-
*/
|
|
1639
|
-
function prepareSearchItems(items) {
|
|
1640
|
-
return items.map((item) => {
|
|
1641
|
-
const parts = [];
|
|
1642
|
-
if (item.label) parts.push(item.label);
|
|
1643
|
-
if (item.description) parts.push(item.description);
|
|
1644
|
-
if (item.searchText) parts.push(item.searchText);
|
|
1645
|
-
return {
|
|
1646
|
-
...item,
|
|
1647
|
-
searchTextLower: normalizeLowercaseStringOrEmpty(parts.join(" "))
|
|
1648
|
-
};
|
|
1649
|
-
});
|
|
1650
|
-
}
|
|
1651
|
-
//#endregion
|
|
1652
|
-
//#region src/tui/components/filterable-select-list.ts
|
|
1653
|
-
/**
|
|
1654
|
-
* Combines text input filtering with a select list.
|
|
1655
|
-
* User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
|
|
1656
|
-
*/
|
|
1657
|
-
var FilterableSelectList = class {
|
|
1658
|
-
constructor(items, maxVisible, theme) {
|
|
1659
|
-
this.filterText = "";
|
|
1660
|
-
this.allItems = prepareSearchItems(items);
|
|
1661
|
-
this.maxVisible = maxVisible;
|
|
1662
|
-
this.theme = theme;
|
|
1663
|
-
this.input = new Input();
|
|
1664
|
-
this.selectList = new SelectList(this.allItems, maxVisible, theme);
|
|
1665
|
-
}
|
|
1666
|
-
applyFilter() {
|
|
1667
|
-
const queryLower = normalizeLowercaseStringOrEmpty(this.filterText);
|
|
1668
|
-
if (!queryLower.trim()) {
|
|
1669
|
-
this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
|
|
1673
|
-
}
|
|
1674
|
-
invalidate() {
|
|
1675
|
-
this.input.invalidate();
|
|
1676
|
-
this.selectList.invalidate();
|
|
1677
|
-
}
|
|
1678
|
-
render(width) {
|
|
1679
|
-
const lines = [];
|
|
1680
|
-
const filterLabel = this.theme.filterLabel("Filter: ");
|
|
1681
|
-
const inputText = this.input.render(width - 8)[0] ?? "";
|
|
1682
|
-
lines.push(filterLabel + inputText);
|
|
1683
|
-
lines.push(chalk.dim("─".repeat(Math.max(0, width))));
|
|
1684
|
-
const listLines = this.selectList.render(width);
|
|
1685
|
-
lines.push(...listLines);
|
|
1686
|
-
return lines;
|
|
1687
|
-
}
|
|
1688
|
-
handleInput(keyData) {
|
|
1689
|
-
const allowVimNav = !this.filterText.trim();
|
|
1690
|
-
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
|
|
1691
|
-
this.selectList.handleInput("\x1B[A");
|
|
1692
|
-
return;
|
|
1693
|
-
}
|
|
1694
|
-
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
|
|
1695
|
-
this.selectList.handleInput("\x1B[B");
|
|
1696
|
-
return;
|
|
1697
|
-
}
|
|
1698
|
-
if (matchesKey(keyData, "enter")) {
|
|
1699
|
-
const selected = this.selectList.getSelectedItem();
|
|
1700
|
-
if (selected) this.onSelect?.(selected);
|
|
1701
|
-
return;
|
|
1702
|
-
}
|
|
1703
|
-
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
1704
|
-
if (this.filterText) {
|
|
1705
|
-
this.filterText = "";
|
|
1706
|
-
this.input.setValue("");
|
|
1707
|
-
this.applyFilter();
|
|
1708
|
-
} else this.onCancel?.();
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
const prevValue = this.input.getValue();
|
|
1712
|
-
this.input.handleInput(keyData);
|
|
1713
|
-
const newValue = this.input.getValue();
|
|
1714
|
-
if (newValue !== prevValue) {
|
|
1715
|
-
this.filterText = newValue;
|
|
1716
|
-
this.applyFilter();
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
getSelectedItem() {
|
|
1720
|
-
return this.selectList.getSelectedItem();
|
|
1721
|
-
}
|
|
1722
|
-
getFilterText() {
|
|
1723
|
-
return this.filterText;
|
|
1724
|
-
}
|
|
1725
|
-
};
|
|
1726
|
-
//#endregion
|
|
1727
|
-
//#region src/tui/components/searchable-select-list.ts
|
|
1728
|
-
const ANSI_SGR_REGEX = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
1729
|
-
/**
|
|
1730
|
-
* A select list with a search input at the top for fuzzy filtering.
|
|
1731
|
-
*/
|
|
1732
|
-
var SearchableSelectList = class SearchableSelectList {
|
|
1733
|
-
static {
|
|
1734
|
-
this.DESCRIPTION_LAYOUT_MIN_WIDTH = 40;
|
|
1735
|
-
}
|
|
1736
|
-
static {
|
|
1737
|
-
this.DESCRIPTION_MIN_WIDTH = 12;
|
|
1738
|
-
}
|
|
1739
|
-
static {
|
|
1740
|
-
this.DESCRIPTION_SPACING_WIDTH = 2;
|
|
1741
|
-
}
|
|
1742
|
-
static {
|
|
1743
|
-
this.RIGHT_MARGIN_WIDTH = 2;
|
|
1744
|
-
}
|
|
1745
|
-
constructor(items, maxVisible, theme) {
|
|
1746
|
-
this.selectedIndex = 0;
|
|
1747
|
-
this.regexCache = /* @__PURE__ */ new Map();
|
|
1748
|
-
this.compareByScore = (a, b) => {
|
|
1749
|
-
if (a.tier !== b.tier) return a.tier - b.tier;
|
|
1750
|
-
if (a.score !== b.score) return a.score - b.score;
|
|
1751
|
-
return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
|
|
1752
|
-
};
|
|
1753
|
-
this.items = items;
|
|
1754
|
-
this.filteredItems = items;
|
|
1755
|
-
this.maxVisible = maxVisible;
|
|
1756
|
-
this.theme = theme;
|
|
1757
|
-
this.searchInput = new Input();
|
|
1758
|
-
}
|
|
1759
|
-
getCachedRegex(pattern) {
|
|
1760
|
-
let regex = this.regexCache.get(pattern);
|
|
1761
|
-
if (!regex) {
|
|
1762
|
-
regex = new RegExp(this.escapeRegex(pattern), "gi");
|
|
1763
|
-
this.regexCache.set(pattern, regex);
|
|
1764
|
-
}
|
|
1765
|
-
return regex;
|
|
1766
|
-
}
|
|
1767
|
-
updateFilter() {
|
|
1768
|
-
const query = this.searchInput.getValue().trim();
|
|
1769
|
-
if (!query) this.filteredItems = this.items;
|
|
1770
|
-
else this.filteredItems = this.smartFilter(query);
|
|
1771
|
-
this.selectedIndex = 0;
|
|
1772
|
-
this.notifySelectionChange();
|
|
1773
|
-
}
|
|
1774
|
-
/**
|
|
1775
|
-
* Smart filtering that prioritizes:
|
|
1776
|
-
* 1. Exact substring match in label (highest priority)
|
|
1777
|
-
* 2. Word-boundary prefix match in label
|
|
1778
|
-
* 3. Exact substring in description
|
|
1779
|
-
* 4. Fuzzy match (lowest priority)
|
|
1780
|
-
*/
|
|
1781
|
-
smartFilter(query) {
|
|
1782
|
-
const q = normalizeLowercaseStringOrEmpty(query);
|
|
1783
|
-
const scoredItems = [];
|
|
1784
|
-
const fuzzyCandidates = [];
|
|
1785
|
-
for (const item of this.items) {
|
|
1786
|
-
const rawLabel = this.getItemLabel(item);
|
|
1787
|
-
const rawDesc = item.description ?? "";
|
|
1788
|
-
const label = normalizeLowercaseStringOrEmpty(stripAnsi$1(rawLabel));
|
|
1789
|
-
const desc = normalizeLowercaseStringOrEmpty(stripAnsi$1(rawDesc));
|
|
1790
|
-
const labelIndex = label.indexOf(q);
|
|
1791
|
-
if (labelIndex !== -1) {
|
|
1792
|
-
scoredItems.push({
|
|
1793
|
-
item,
|
|
1794
|
-
tier: 0,
|
|
1795
|
-
score: labelIndex
|
|
1796
|
-
});
|
|
1797
|
-
continue;
|
|
1798
|
-
}
|
|
1799
|
-
const wordBoundaryIndex = findWordBoundaryIndex(label, q);
|
|
1800
|
-
if (wordBoundaryIndex !== null) {
|
|
1801
|
-
scoredItems.push({
|
|
1802
|
-
item,
|
|
1803
|
-
tier: 1,
|
|
1804
|
-
score: wordBoundaryIndex
|
|
1805
|
-
});
|
|
1806
|
-
continue;
|
|
1807
|
-
}
|
|
1808
|
-
const descIndex = desc.indexOf(q);
|
|
1809
|
-
if (descIndex !== -1) {
|
|
1810
|
-
scoredItems.push({
|
|
1811
|
-
item,
|
|
1812
|
-
tier: 2,
|
|
1813
|
-
score: descIndex
|
|
1814
|
-
});
|
|
1815
|
-
continue;
|
|
1816
|
-
}
|
|
1817
|
-
const searchText = item.searchText ?? "";
|
|
1818
|
-
fuzzyCandidates.push({
|
|
1819
|
-
item,
|
|
1820
|
-
searchTextLower: normalizeLowercaseStringOrEmpty([
|
|
1821
|
-
rawLabel,
|
|
1822
|
-
rawDesc,
|
|
1823
|
-
searchText
|
|
1824
|
-
].map((value) => stripAnsi$1(value)).filter(Boolean).join(" "))
|
|
1825
|
-
});
|
|
1826
|
-
}
|
|
1827
|
-
scoredItems.sort(this.compareByScore);
|
|
1828
|
-
const fuzzyMatches = fuzzyFilterLower(fuzzyCandidates, q);
|
|
1829
|
-
return [...scoredItems.map((s) => s.item), ...fuzzyMatches.map((entry) => entry.item)];
|
|
1830
|
-
}
|
|
1831
|
-
escapeRegex(str) {
|
|
1832
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1833
|
-
}
|
|
1834
|
-
getItemLabel(item) {
|
|
1835
|
-
return item.label || item.value;
|
|
1836
|
-
}
|
|
1837
|
-
splitAnsiParts(text) {
|
|
1838
|
-
const parts = [];
|
|
1839
|
-
ANSI_SGR_REGEX.lastIndex = 0;
|
|
1840
|
-
let lastIndex = 0;
|
|
1841
|
-
let match;
|
|
1842
|
-
while ((match = ANSI_SGR_REGEX.exec(text)) !== null) {
|
|
1843
|
-
if (match.index > lastIndex) parts.push({
|
|
1844
|
-
text: text.slice(lastIndex, match.index),
|
|
1845
|
-
isAnsi: false
|
|
1846
|
-
});
|
|
1847
|
-
parts.push({
|
|
1848
|
-
text: match[0],
|
|
1849
|
-
isAnsi: true
|
|
1850
|
-
});
|
|
1851
|
-
lastIndex = match.index + match[0].length;
|
|
1852
|
-
}
|
|
1853
|
-
if (lastIndex < text.length) parts.push({
|
|
1854
|
-
text: text.slice(lastIndex),
|
|
1855
|
-
isAnsi: false
|
|
1856
|
-
});
|
|
1857
|
-
return parts;
|
|
1858
|
-
}
|
|
1859
|
-
highlightMatch(text, query) {
|
|
1860
|
-
const tokens = query.trim().split(/\s+/).map((token) => normalizeLowercaseStringOrEmpty(token)).filter((token) => token.length > 0);
|
|
1861
|
-
if (tokens.length === 0) return text;
|
|
1862
|
-
const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
|
|
1863
|
-
let parts = this.splitAnsiParts(text);
|
|
1864
|
-
for (const token of uniqueTokens) {
|
|
1865
|
-
const regex = this.getCachedRegex(token);
|
|
1866
|
-
const nextParts = [];
|
|
1867
|
-
for (const part of parts) {
|
|
1868
|
-
if (part.isAnsi) {
|
|
1869
|
-
nextParts.push(part);
|
|
1870
|
-
continue;
|
|
1871
|
-
}
|
|
1872
|
-
regex.lastIndex = 0;
|
|
1873
|
-
const replaced = part.text.replace(regex, (match) => this.theme.matchHighlight(match));
|
|
1874
|
-
if (replaced === part.text) {
|
|
1875
|
-
nextParts.push(part);
|
|
1876
|
-
continue;
|
|
1877
|
-
}
|
|
1878
|
-
nextParts.push(...this.splitAnsiParts(replaced));
|
|
1879
|
-
}
|
|
1880
|
-
parts = nextParts;
|
|
1881
|
-
}
|
|
1882
|
-
return parts.map((part) => part.text).join("");
|
|
1883
|
-
}
|
|
1884
|
-
setSelectedIndex(index) {
|
|
1885
|
-
this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
|
|
1886
|
-
}
|
|
1887
|
-
invalidate() {
|
|
1888
|
-
this.searchInput.invalidate();
|
|
1889
|
-
}
|
|
1890
|
-
render(width) {
|
|
1891
|
-
const lines = [];
|
|
1892
|
-
const prompt = this.theme.searchPrompt("search: ");
|
|
1893
|
-
const inputWidth = Math.max(1, width - visibleWidth(prompt));
|
|
1894
|
-
const inputText = this.searchInput.render(inputWidth)[0] ?? "";
|
|
1895
|
-
lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
|
|
1896
|
-
lines.push("");
|
|
1897
|
-
const query = this.searchInput.getValue().trim();
|
|
1898
|
-
if (this.filteredItems.length === 0) {
|
|
1899
|
-
lines.push(this.theme.noMatch(" No matches"));
|
|
1900
|
-
return lines;
|
|
1901
|
-
}
|
|
1902
|
-
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
|
|
1903
|
-
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
1904
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
1905
|
-
const item = this.filteredItems[i];
|
|
1906
|
-
if (!item) continue;
|
|
1907
|
-
const isSelected = i === this.selectedIndex;
|
|
1908
|
-
lines.push(this.renderItemLine(item, isSelected, width, query));
|
|
1909
|
-
}
|
|
1910
|
-
if (this.filteredItems.length > this.maxVisible) {
|
|
1911
|
-
const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
|
|
1912
|
-
lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
|
|
1913
|
-
}
|
|
1914
|
-
return lines;
|
|
1915
|
-
}
|
|
1916
|
-
renderItemLine(item, isSelected, width, query) {
|
|
1917
|
-
const prefix = isSelected ? "→ " : " ";
|
|
1918
|
-
const prefixWidth = prefix.length;
|
|
1919
|
-
const displayValue = this.getItemLabel(item);
|
|
1920
|
-
const description = item.description;
|
|
1921
|
-
if (description) {
|
|
1922
|
-
const descriptionLayout = this.getDescriptionLayout(width, prefixWidth);
|
|
1923
|
-
if (descriptionLayout) {
|
|
1924
|
-
const truncatedValue = truncateToWidth(displayValue, descriptionLayout.maxValueWidth, "");
|
|
1925
|
-
const valueText = this.highlightMatch(truncatedValue, query);
|
|
1926
|
-
const usedByValue = visibleWidth(valueText);
|
|
1927
|
-
const descriptionWidth = descriptionLayout.availableWidth - usedByValue - descriptionLayout.spacingWidth;
|
|
1928
|
-
if (descriptionWidth >= SearchableSelectList.DESCRIPTION_MIN_WIDTH) {
|
|
1929
|
-
const spacing = " ".repeat(descriptionLayout.spacingWidth);
|
|
1930
|
-
const truncatedDesc = truncateToWidth(description, descriptionWidth, "");
|
|
1931
|
-
const highlightedDesc = this.highlightMatch(truncatedDesc, query);
|
|
1932
|
-
const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
|
|
1933
|
-
return isSelected ? this.theme.selectedText(line) : line;
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
|
|
1938
|
-
const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
|
|
1939
|
-
return isSelected ? this.theme.selectedText(line) : line;
|
|
1940
|
-
}
|
|
1941
|
-
getDescriptionLayout(width, prefixWidth) {
|
|
1942
|
-
if (width <= SearchableSelectList.DESCRIPTION_LAYOUT_MIN_WIDTH) return null;
|
|
1943
|
-
const availableWidth = Math.max(1, width - prefixWidth - SearchableSelectList.RIGHT_MARGIN_WIDTH);
|
|
1944
|
-
const maxValueWidth = availableWidth - SearchableSelectList.DESCRIPTION_MIN_WIDTH - SearchableSelectList.DESCRIPTION_SPACING_WIDTH;
|
|
1945
|
-
if (maxValueWidth < 1) return null;
|
|
1946
|
-
return {
|
|
1947
|
-
availableWidth,
|
|
1948
|
-
maxValueWidth,
|
|
1949
|
-
spacingWidth: SearchableSelectList.DESCRIPTION_SPACING_WIDTH
|
|
1950
|
-
};
|
|
1951
|
-
}
|
|
1952
|
-
handleInput(keyData) {
|
|
1953
|
-
if (isKeyRelease(keyData)) return;
|
|
1954
|
-
if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p")) {
|
|
1955
|
-
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
1956
|
-
this.notifySelectionChange();
|
|
1957
|
-
return;
|
|
1958
|
-
}
|
|
1959
|
-
if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n")) {
|
|
1960
|
-
this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
|
|
1961
|
-
this.notifySelectionChange();
|
|
1962
|
-
return;
|
|
1963
|
-
}
|
|
1964
|
-
if (matchesKey(keyData, "enter")) {
|
|
1965
|
-
const item = this.filteredItems[this.selectedIndex];
|
|
1966
|
-
if (item && this.onSelect) this.onSelect(item);
|
|
1967
|
-
return;
|
|
1968
|
-
}
|
|
1969
|
-
if (matchesKey(keyData, "escape") || keyData === "") {
|
|
1970
|
-
if (this.onCancel) this.onCancel();
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
const prevValue = this.searchInput.getValue();
|
|
1974
|
-
this.searchInput.handleInput(keyData);
|
|
1975
|
-
if (prevValue !== this.searchInput.getValue()) this.updateFilter();
|
|
1976
|
-
}
|
|
1977
|
-
notifySelectionChange() {
|
|
1978
|
-
const item = this.filteredItems[this.selectedIndex];
|
|
1979
|
-
if (item && this.onSelectionChange) this.onSelectionChange(item);
|
|
1980
|
-
}
|
|
1981
|
-
getSelectedItem() {
|
|
1982
|
-
return this.filteredItems[this.selectedIndex] ?? null;
|
|
1983
|
-
}
|
|
1984
|
-
};
|
|
1985
|
-
//#endregion
|
|
1986
|
-
//#region src/tui/components/selectors.ts
|
|
1987
|
-
function createSearchableSelectList(items, maxVisible = 7) {
|
|
1988
|
-
return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
|
|
1989
|
-
}
|
|
1990
|
-
function createFilterableSelectList(items, maxVisible = 7) {
|
|
1991
|
-
return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
|
|
1992
|
-
}
|
|
1993
|
-
function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
|
|
1994
|
-
return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
|
|
1995
|
-
}
|
|
1996
|
-
//#endregion
|
|
1997
|
-
//#region src/tui/tui-status-summary.ts
|
|
1998
|
-
function formatStatusSummary(summary) {
|
|
1999
|
-
const lines = [];
|
|
2000
|
-
lines.push("Gateway status");
|
|
2001
|
-
if (summary.runtimeVersion) lines.push(`Version: ${summary.runtimeVersion}`);
|
|
2002
|
-
if (!summary.linkChannel) lines.push("Link channel: unknown");
|
|
2003
|
-
else {
|
|
2004
|
-
const linkLabel = summary.linkChannel.label ?? "Link channel";
|
|
2005
|
-
const linked = summary.linkChannel.linked === true;
|
|
2006
|
-
const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})` : "";
|
|
2007
|
-
lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
|
|
2008
|
-
}
|
|
2009
|
-
const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
|
|
2010
|
-
if (providerSummary.length > 0) {
|
|
2011
|
-
lines.push("");
|
|
2012
|
-
lines.push("System:");
|
|
2013
|
-
for (const line of providerSummary) lines.push(` ${line}`);
|
|
2014
|
-
}
|
|
2015
|
-
const heartbeatAgents = summary.heartbeat?.agents ?? [];
|
|
2016
|
-
if (heartbeatAgents.length > 0) {
|
|
2017
|
-
const heartbeatParts = heartbeatAgents.map((agent) => {
|
|
2018
|
-
const agentId = agent.agentId ?? "unknown";
|
|
2019
|
-
if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
|
|
2020
|
-
return `${agent.every ?? "unknown"} (${agentId})`;
|
|
2021
|
-
});
|
|
2022
|
-
lines.push("");
|
|
2023
|
-
lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
|
|
2024
|
-
}
|
|
2025
|
-
const sessionPaths = summary.sessions?.paths ?? [];
|
|
2026
|
-
if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
|
|
2027
|
-
else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
|
|
2028
|
-
const defaults = summary.sessions?.defaults;
|
|
2029
|
-
const defaultModel = defaults?.model ?? "unknown";
|
|
2030
|
-
const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
|
|
2031
|
-
lines.push(`Default model: ${defaultModel}${defaultCtx}`);
|
|
2032
|
-
const sessionCount = summary.sessions?.count ?? 0;
|
|
2033
|
-
lines.push(`Active sessions: ${sessionCount}`);
|
|
2034
|
-
const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
|
|
2035
|
-
if (recent.length > 0) {
|
|
2036
|
-
lines.push("Recent sessions:");
|
|
2037
|
-
for (const entry of recent) {
|
|
2038
|
-
const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
|
|
2039
|
-
const model = entry.model ?? "unknown";
|
|
2040
|
-
const usage = formatContextUsageLine({
|
|
2041
|
-
total: entry.totalTokens ?? null,
|
|
2042
|
-
context: entry.contextTokens ?? null,
|
|
2043
|
-
remaining: entry.remainingTokens ?? null,
|
|
2044
|
-
percent: entry.percentUsed ?? null
|
|
2045
|
-
});
|
|
2046
|
-
const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
|
|
2047
|
-
lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
|
|
2051
|
-
if (queued.length > 0) {
|
|
2052
|
-
const preview = queued.slice(0, 3).join(" | ");
|
|
2053
|
-
lines.push(`Queued system events (${queued.length}): ${preview}`);
|
|
2054
|
-
}
|
|
2055
|
-
return lines;
|
|
2056
|
-
}
|
|
2057
|
-
//#endregion
|
|
2058
|
-
//#region src/tui/tui-command-handlers.ts
|
|
2059
|
-
function isBtwCommand(text) {
|
|
2060
|
-
return /^\/btw(?::|\s|$)/i.test(text.trim());
|
|
2061
|
-
}
|
|
2062
|
-
function createCommandHandlers(context) {
|
|
2063
|
-
const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalBtwRunId, forgetLocalRunId, forgetLocalBtwRunId, requestExit } = context;
|
|
2064
|
-
const setAgent = async (id) => {
|
|
2065
|
-
state.currentAgentId = normalizeAgentId(id);
|
|
2066
|
-
await setSession("");
|
|
2067
|
-
};
|
|
2068
|
-
const closeOverlayAndRender = () => {
|
|
2069
|
-
closeOverlay();
|
|
2070
|
-
tui.requestRender();
|
|
2071
|
-
};
|
|
2072
|
-
const openSelector = (selector, onSelect) => {
|
|
2073
|
-
selector.onSelect = (item) => {
|
|
2074
|
-
(async () => {
|
|
2075
|
-
await onSelect(item.value);
|
|
2076
|
-
closeOverlayAndRender();
|
|
2077
|
-
})();
|
|
2078
|
-
};
|
|
2079
|
-
selector.onCancel = closeOverlayAndRender;
|
|
2080
|
-
openOverlay(selector);
|
|
2081
|
-
tui.requestRender();
|
|
2082
|
-
};
|
|
2083
|
-
const openModelSelector = async () => {
|
|
2084
|
-
try {
|
|
2085
|
-
const models = await client.listModels();
|
|
2086
|
-
if (models.length === 0) {
|
|
2087
|
-
chatLog.addSystem("no models available");
|
|
2088
|
-
tui.requestRender();
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
openSelector(createSearchableSelectList(models.map((model) => ({
|
|
2092
|
-
value: `${model.provider}/${model.id}`,
|
|
2093
|
-
label: `${model.provider}/${model.id}`,
|
|
2094
|
-
description: model.name && model.name !== model.id ? model.name : ""
|
|
2095
|
-
})), 9), async (value) => {
|
|
2096
|
-
try {
|
|
2097
|
-
const result = await client.patchSession({
|
|
2098
|
-
key: state.currentSessionKey,
|
|
2099
|
-
model: value
|
|
2100
|
-
});
|
|
2101
|
-
chatLog.addSystem(`model set to ${value}`);
|
|
2102
|
-
applySessionInfoFromPatch(result);
|
|
2103
|
-
await refreshSessionInfo();
|
|
2104
|
-
} catch (err) {
|
|
2105
|
-
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2106
|
-
}
|
|
2107
|
-
});
|
|
2108
|
-
} catch (err) {
|
|
2109
|
-
chatLog.addSystem(`model list failed: ${String(err)}`);
|
|
2110
|
-
tui.requestRender();
|
|
2111
|
-
}
|
|
2112
|
-
};
|
|
2113
|
-
const openAgentSelector = async () => {
|
|
2114
|
-
await refreshAgents();
|
|
2115
|
-
if (state.agents.length === 0) {
|
|
2116
|
-
chatLog.addSystem("no agents found");
|
|
2117
|
-
tui.requestRender();
|
|
2118
|
-
return;
|
|
2119
|
-
}
|
|
2120
|
-
openSelector(createSearchableSelectList(state.agents.map((agent) => ({
|
|
2121
|
-
value: agent.id,
|
|
2122
|
-
label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
|
|
2123
|
-
description: agent.id === state.agentDefaultId ? "default" : ""
|
|
2124
|
-
})), 9), async (value) => {
|
|
2125
|
-
await setAgent(value);
|
|
2126
|
-
});
|
|
2127
|
-
};
|
|
2128
|
-
const openSessionSelector = async () => {
|
|
2129
|
-
try {
|
|
2130
|
-
openSelector(createFilterableSelectList((await client.listSessions({
|
|
2131
|
-
includeGlobal: false,
|
|
2132
|
-
includeUnknown: false,
|
|
2133
|
-
includeDerivedTitles: true,
|
|
2134
|
-
includeLastMessage: true,
|
|
2135
|
-
agentId: state.currentAgentId
|
|
2136
|
-
})).sessions.map((session) => {
|
|
2137
|
-
const title = session.derivedTitle ?? session.displayName;
|
|
2138
|
-
const formattedKey = formatSessionKey(session.key);
|
|
2139
|
-
const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
|
|
2140
|
-
const timePart = session.updatedAt ? formatRelativeTimestamp(session.updatedAt, {
|
|
2141
|
-
dateFallback: true,
|
|
2142
|
-
fallback: ""
|
|
2143
|
-
}) : "";
|
|
2144
|
-
const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
|
|
2145
|
-
const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
|
|
2146
|
-
return {
|
|
2147
|
-
value: session.key,
|
|
2148
|
-
label,
|
|
2149
|
-
description,
|
|
2150
|
-
searchText: [
|
|
2151
|
-
session.displayName,
|
|
2152
|
-
session.label,
|
|
2153
|
-
session.subject,
|
|
2154
|
-
session.sessionId,
|
|
2155
|
-
session.key,
|
|
2156
|
-
session.lastMessagePreview
|
|
2157
|
-
].filter(Boolean).join(" ")
|
|
2158
|
-
};
|
|
2159
|
-
}), 9), async (value) => {
|
|
2160
|
-
await setSession(value);
|
|
2161
|
-
});
|
|
2162
|
-
} catch (err) {
|
|
2163
|
-
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
2164
|
-
tui.requestRender();
|
|
2165
|
-
}
|
|
2166
|
-
};
|
|
2167
|
-
const openSettings = () => {
|
|
2168
|
-
openOverlay(createSettingsList([{
|
|
2169
|
-
id: "tools",
|
|
2170
|
-
label: "Tool output",
|
|
2171
|
-
currentValue: state.toolsExpanded ? "expanded" : "collapsed",
|
|
2172
|
-
values: ["collapsed", "expanded"]
|
|
2173
|
-
}, {
|
|
2174
|
-
id: "thinking",
|
|
2175
|
-
label: "Show thinking",
|
|
2176
|
-
currentValue: state.showThinking ? "on" : "off",
|
|
2177
|
-
values: ["off", "on"]
|
|
2178
|
-
}], (id, value) => {
|
|
2179
|
-
if (id === "tools") {
|
|
2180
|
-
state.toolsExpanded = value === "expanded";
|
|
2181
|
-
chatLog.setToolsExpanded(state.toolsExpanded);
|
|
2182
|
-
}
|
|
2183
|
-
if (id === "thinking") {
|
|
2184
|
-
state.showThinking = value === "on";
|
|
2185
|
-
loadHistory();
|
|
2186
|
-
}
|
|
2187
|
-
tui.requestRender();
|
|
2188
|
-
}, () => {
|
|
2189
|
-
closeOverlay();
|
|
2190
|
-
tui.requestRender();
|
|
2191
|
-
}));
|
|
2192
|
-
tui.requestRender();
|
|
2193
|
-
};
|
|
2194
|
-
const handleCommand = async (raw) => {
|
|
2195
|
-
const { name, args } = parseCommand(raw);
|
|
2196
|
-
if (!name) return;
|
|
2197
|
-
switch (name) {
|
|
2198
|
-
case "help":
|
|
2199
|
-
chatLog.addSystem(helpText({
|
|
2200
|
-
provider: state.sessionInfo.modelProvider,
|
|
2201
|
-
model: state.sessionInfo.model
|
|
2202
|
-
}));
|
|
2203
|
-
break;
|
|
2204
|
-
case "gateway-status":
|
|
2205
|
-
try {
|
|
2206
|
-
const status = await client.getGatewayStatus();
|
|
2207
|
-
if (typeof status === "string") {
|
|
2208
|
-
chatLog.addSystem(status);
|
|
2209
|
-
break;
|
|
2210
|
-
}
|
|
2211
|
-
if (status && typeof status === "object") {
|
|
2212
|
-
const lines = formatStatusSummary(status);
|
|
2213
|
-
for (const line of lines) chatLog.addSystem(line);
|
|
2214
|
-
break;
|
|
2215
|
-
}
|
|
2216
|
-
chatLog.addSystem("status: unknown response");
|
|
2217
|
-
} catch (err) {
|
|
2218
|
-
chatLog.addSystem(`status failed: ${String(err)}`);
|
|
2219
|
-
}
|
|
2220
|
-
break;
|
|
2221
|
-
case "agent":
|
|
2222
|
-
if (!args) await openAgentSelector();
|
|
2223
|
-
else await setAgent(args);
|
|
2224
|
-
break;
|
|
2225
|
-
case "agents":
|
|
2226
|
-
await openAgentSelector();
|
|
2227
|
-
break;
|
|
2228
|
-
case "session":
|
|
2229
|
-
if (!args) await openSessionSelector();
|
|
2230
|
-
else await setSession(args);
|
|
2231
|
-
break;
|
|
2232
|
-
case "sessions":
|
|
2233
|
-
await openSessionSelector();
|
|
2234
|
-
break;
|
|
2235
|
-
case "model":
|
|
2236
|
-
if (!args) await openModelSelector();
|
|
2237
|
-
else try {
|
|
2238
|
-
const result = await client.patchSession({
|
|
2239
|
-
key: state.currentSessionKey,
|
|
2240
|
-
model: args
|
|
2241
|
-
});
|
|
2242
|
-
chatLog.addSystem(`model set to ${args}`);
|
|
2243
|
-
applySessionInfoFromPatch(result);
|
|
2244
|
-
await refreshSessionInfo();
|
|
2245
|
-
} catch (err) {
|
|
2246
|
-
chatLog.addSystem(`model set failed: ${String(err)}`);
|
|
2247
|
-
}
|
|
2248
|
-
break;
|
|
2249
|
-
case "models":
|
|
2250
|
-
await openModelSelector();
|
|
2251
|
-
break;
|
|
2252
|
-
case "think":
|
|
2253
|
-
if (!args) {
|
|
2254
|
-
const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
|
|
2255
|
-
chatLog.addSystem(`usage: /think <${levels}>`);
|
|
2256
|
-
break;
|
|
2257
|
-
}
|
|
2258
|
-
try {
|
|
2259
|
-
const result = await client.patchSession({
|
|
2260
|
-
key: state.currentSessionKey,
|
|
2261
|
-
thinkingLevel: args
|
|
2262
|
-
});
|
|
2263
|
-
chatLog.addSystem(`thinking set to ${args}`);
|
|
2264
|
-
applySessionInfoFromPatch(result);
|
|
2265
|
-
await refreshSessionInfo();
|
|
2266
|
-
} catch (err) {
|
|
2267
|
-
chatLog.addSystem(`think failed: ${String(err)}`);
|
|
2268
|
-
}
|
|
2269
|
-
break;
|
|
2270
|
-
case "verbose":
|
|
2271
|
-
if (!args) {
|
|
2272
|
-
chatLog.addSystem("usage: /verbose <on|off>");
|
|
2273
|
-
break;
|
|
2274
|
-
}
|
|
2275
|
-
try {
|
|
2276
|
-
const result = await client.patchSession({
|
|
2277
|
-
key: state.currentSessionKey,
|
|
2278
|
-
verboseLevel: args
|
|
2279
|
-
});
|
|
2280
|
-
chatLog.addSystem(`verbose set to ${args}`);
|
|
2281
|
-
applySessionInfoFromPatch(result);
|
|
2282
|
-
await loadHistory();
|
|
2283
|
-
} catch (err) {
|
|
2284
|
-
chatLog.addSystem(`verbose failed: ${String(err)}`);
|
|
2285
|
-
}
|
|
2286
|
-
break;
|
|
2287
|
-
case "fast":
|
|
2288
|
-
if (!args || args === "status") {
|
|
2289
|
-
chatLog.addSystem(`fast mode: ${state.sessionInfo.fastMode ? "on" : "off"}`);
|
|
2290
|
-
break;
|
|
2291
|
-
}
|
|
2292
|
-
if (args !== "on" && args !== "off") {
|
|
2293
|
-
chatLog.addSystem("usage: /fast <status|on|off>");
|
|
2294
|
-
break;
|
|
2295
|
-
}
|
|
2296
|
-
try {
|
|
2297
|
-
const result = await client.patchSession({
|
|
2298
|
-
key: state.currentSessionKey,
|
|
2299
|
-
fastMode: args === "on"
|
|
2300
|
-
});
|
|
2301
|
-
chatLog.addSystem(`fast mode ${args === "on" ? "enabled" : "disabled"}`);
|
|
2302
|
-
applySessionInfoFromPatch(result);
|
|
2303
|
-
await refreshSessionInfo();
|
|
2304
|
-
} catch (err) {
|
|
2305
|
-
chatLog.addSystem(`fast failed: ${String(err)}`);
|
|
2306
|
-
}
|
|
2307
|
-
break;
|
|
2308
|
-
case "reasoning":
|
|
2309
|
-
if (!args) {
|
|
2310
|
-
chatLog.addSystem("usage: /reasoning <on|off>");
|
|
2311
|
-
break;
|
|
2312
|
-
}
|
|
2313
|
-
try {
|
|
2314
|
-
const result = await client.patchSession({
|
|
2315
|
-
key: state.currentSessionKey,
|
|
2316
|
-
reasoningLevel: args
|
|
2317
|
-
});
|
|
2318
|
-
chatLog.addSystem(`reasoning set to ${args}`);
|
|
2319
|
-
applySessionInfoFromPatch(result);
|
|
2320
|
-
await refreshSessionInfo();
|
|
2321
|
-
} catch (err) {
|
|
2322
|
-
chatLog.addSystem(`reasoning failed: ${String(err)}`);
|
|
2323
|
-
}
|
|
2324
|
-
break;
|
|
2325
|
-
case "usage": {
|
|
2326
|
-
const normalized = args ? normalizeUsageDisplay(args) : void 0;
|
|
2327
|
-
if (args && !normalized) {
|
|
2328
|
-
chatLog.addSystem("usage: /usage <off|tokens|full>");
|
|
2329
|
-
break;
|
|
2330
|
-
}
|
|
2331
|
-
const currentRaw = state.sessionInfo.responseUsage;
|
|
2332
|
-
const current = resolveResponseUsageMode(currentRaw);
|
|
2333
|
-
const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
|
|
2334
|
-
try {
|
|
2335
|
-
const result = await client.patchSession({
|
|
2336
|
-
key: state.currentSessionKey,
|
|
2337
|
-
responseUsage: next === "off" ? null : next
|
|
2338
|
-
});
|
|
2339
|
-
chatLog.addSystem(`usage footer: ${next}`);
|
|
2340
|
-
applySessionInfoFromPatch(result);
|
|
2341
|
-
await refreshSessionInfo();
|
|
2342
|
-
} catch (err) {
|
|
2343
|
-
chatLog.addSystem(`usage failed: ${String(err)}`);
|
|
2344
|
-
}
|
|
2345
|
-
break;
|
|
2346
|
-
}
|
|
2347
|
-
case "elevated":
|
|
2348
|
-
if (!args) {
|
|
2349
|
-
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2350
|
-
break;
|
|
2351
|
-
}
|
|
2352
|
-
if (![
|
|
2353
|
-
"on",
|
|
2354
|
-
"off",
|
|
2355
|
-
"ask",
|
|
2356
|
-
"full"
|
|
2357
|
-
].includes(args)) {
|
|
2358
|
-
chatLog.addSystem("usage: /elevated <on|off|ask|full>");
|
|
2359
|
-
break;
|
|
2360
|
-
}
|
|
2361
|
-
try {
|
|
2362
|
-
const result = await client.patchSession({
|
|
2363
|
-
key: state.currentSessionKey,
|
|
2364
|
-
elevatedLevel: args
|
|
2365
|
-
});
|
|
2366
|
-
chatLog.addSystem(`elevated set to ${args}`);
|
|
2367
|
-
applySessionInfoFromPatch(result);
|
|
2368
|
-
await refreshSessionInfo();
|
|
2369
|
-
} catch (err) {
|
|
2370
|
-
chatLog.addSystem(`elevated failed: ${String(err)}`);
|
|
2371
|
-
}
|
|
2372
|
-
break;
|
|
2373
|
-
case "activation":
|
|
2374
|
-
if (!args) {
|
|
2375
|
-
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2376
|
-
break;
|
|
2377
|
-
}
|
|
2378
|
-
const activation = normalizeGroupActivation(args);
|
|
2379
|
-
if (!activation) {
|
|
2380
|
-
chatLog.addSystem("usage: /activation <mention|always>");
|
|
2381
|
-
break;
|
|
2382
|
-
}
|
|
2383
|
-
try {
|
|
2384
|
-
const result = await client.patchSession({
|
|
2385
|
-
key: state.currentSessionKey,
|
|
2386
|
-
groupActivation: activation
|
|
2387
|
-
});
|
|
2388
|
-
chatLog.addSystem(`activation set to ${activation}`);
|
|
2389
|
-
applySessionInfoFromPatch(result);
|
|
2390
|
-
await refreshSessionInfo();
|
|
2391
|
-
} catch (err) {
|
|
2392
|
-
chatLog.addSystem(`activation failed: ${String(err)}`);
|
|
2393
|
-
}
|
|
2394
|
-
break;
|
|
2395
|
-
case "new":
|
|
2396
|
-
try {
|
|
2397
|
-
state.sessionInfo.inputTokens = null;
|
|
2398
|
-
state.sessionInfo.outputTokens = null;
|
|
2399
|
-
state.sessionInfo.totalTokens = null;
|
|
2400
|
-
tui.requestRender();
|
|
2401
|
-
const uniqueKey = `tui-${randomUUID()}`;
|
|
2402
|
-
await setSession(uniqueKey);
|
|
2403
|
-
chatLog.addSystem(`new session: ${uniqueKey}`);
|
|
2404
|
-
} catch (err) {
|
|
2405
|
-
chatLog.addSystem(`new session failed: ${sanitizeRenderableText(String(err))}`);
|
|
2406
|
-
}
|
|
2407
|
-
break;
|
|
2408
|
-
case "reset":
|
|
2409
|
-
try {
|
|
2410
|
-
state.sessionInfo.inputTokens = null;
|
|
2411
|
-
state.sessionInfo.outputTokens = null;
|
|
2412
|
-
state.sessionInfo.totalTokens = null;
|
|
2413
|
-
tui.requestRender();
|
|
2414
|
-
await client.resetSession(state.currentSessionKey, name);
|
|
2415
|
-
chatLog.addSystem(`session ${state.currentSessionKey} reset`);
|
|
2416
|
-
await loadHistory();
|
|
2417
|
-
} catch (err) {
|
|
2418
|
-
chatLog.addSystem(`reset failed: ${sanitizeRenderableText(String(err))}`);
|
|
2419
|
-
}
|
|
2420
|
-
break;
|
|
2421
|
-
case "abort":
|
|
2422
|
-
await abortActive();
|
|
2423
|
-
break;
|
|
2424
|
-
case "settings":
|
|
2425
|
-
openSettings();
|
|
2426
|
-
break;
|
|
2427
|
-
case "exit":
|
|
2428
|
-
case "quit":
|
|
2429
|
-
requestExit();
|
|
2430
|
-
break;
|
|
2431
|
-
default:
|
|
2432
|
-
await sendMessage(raw);
|
|
2433
|
-
break;
|
|
2434
|
-
}
|
|
2435
|
-
tui.requestRender();
|
|
2436
|
-
};
|
|
2437
|
-
const sendMessage = async (text) => {
|
|
2438
|
-
if (!state.isConnected) {
|
|
2439
|
-
chatLog.addSystem("not connected to gateway — message not sent");
|
|
2440
|
-
setActivityStatus("disconnected");
|
|
2441
|
-
tui.requestRender();
|
|
2442
|
-
return;
|
|
2443
|
-
}
|
|
2444
|
-
const isBtw = isBtwCommand(text);
|
|
2445
|
-
const runId = randomUUID();
|
|
2446
|
-
try {
|
|
2447
|
-
if (!isBtw) {
|
|
2448
|
-
chatLog.addUser(text);
|
|
2449
|
-
state.pendingOptimisticUserMessage = true;
|
|
2450
|
-
setActivityStatus("sending");
|
|
2451
|
-
} else noteLocalBtwRunId?.(runId);
|
|
2452
|
-
tui.requestRender();
|
|
2453
|
-
await client.sendChat({
|
|
2454
|
-
sessionKey: state.currentSessionKey,
|
|
2455
|
-
message: text,
|
|
2456
|
-
thinking: opts.thinking,
|
|
2457
|
-
deliver: deliverDefault,
|
|
2458
|
-
timeoutMs: opts.timeoutMs,
|
|
2459
|
-
runId
|
|
2460
|
-
});
|
|
2461
|
-
if (!isBtw) {
|
|
2462
|
-
setActivityStatus("waiting");
|
|
2463
|
-
tui.requestRender();
|
|
2464
|
-
}
|
|
2465
|
-
} catch (err) {
|
|
2466
|
-
if (isBtw) forgetLocalBtwRunId?.(runId);
|
|
2467
|
-
if (!isBtw && state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
|
|
2468
|
-
if (!isBtw) {
|
|
2469
|
-
state.pendingOptimisticUserMessage = false;
|
|
2470
|
-
state.activeChatRunId = null;
|
|
2471
|
-
}
|
|
2472
|
-
chatLog.addSystem(`${isBtw ? "btw failed" : "send failed"}: ${String(err)}`);
|
|
2473
|
-
if (!isBtw) setActivityStatus("error");
|
|
2474
|
-
tui.requestRender();
|
|
2475
|
-
}
|
|
2476
|
-
};
|
|
2477
|
-
return {
|
|
2478
|
-
handleCommand,
|
|
2479
|
-
sendMessage,
|
|
2480
|
-
openModelSelector,
|
|
2481
|
-
openAgentSelector,
|
|
2482
|
-
openSessionSelector,
|
|
2483
|
-
openSettings,
|
|
2484
|
-
setAgent
|
|
2485
|
-
};
|
|
2486
|
-
}
|
|
2487
|
-
//#endregion
|
|
2488
|
-
//#region src/tui/tui-stream-assembler.ts
|
|
2489
|
-
function extractTextBlocksAndSignals(message) {
|
|
2490
|
-
if (!message || typeof message !== "object") return {
|
|
2491
|
-
textBlocks: [],
|
|
2492
|
-
sawNonTextContentBlocks: false
|
|
2493
|
-
};
|
|
2494
|
-
const content = message.content;
|
|
2495
|
-
if (typeof content === "string") {
|
|
2496
|
-
const text = content.trim();
|
|
2497
|
-
return {
|
|
2498
|
-
textBlocks: text ? [text] : [],
|
|
2499
|
-
sawNonTextContentBlocks: false
|
|
2500
|
-
};
|
|
2501
|
-
}
|
|
2502
|
-
if (!Array.isArray(content)) return {
|
|
2503
|
-
textBlocks: [],
|
|
2504
|
-
sawNonTextContentBlocks: false
|
|
2505
|
-
};
|
|
2506
|
-
const textBlocks = [];
|
|
2507
|
-
let sawNonTextContentBlocks = false;
|
|
2508
|
-
for (const block of content) {
|
|
2509
|
-
if (!block || typeof block !== "object") continue;
|
|
2510
|
-
const rec = block;
|
|
2511
|
-
if (rec.type === "text" && typeof rec.text === "string") {
|
|
2512
|
-
const text = rec.text.trim();
|
|
2513
|
-
if (text) textBlocks.push(text);
|
|
2514
|
-
continue;
|
|
2515
|
-
}
|
|
2516
|
-
if (typeof rec.type === "string" && rec.type !== "thinking") sawNonTextContentBlocks = true;
|
|
2517
|
-
}
|
|
2518
|
-
return {
|
|
2519
|
-
textBlocks,
|
|
2520
|
-
sawNonTextContentBlocks
|
|
2521
|
-
};
|
|
2522
|
-
}
|
|
2523
|
-
function isDroppedBoundaryTextBlockSubset(params) {
|
|
2524
|
-
const { streamedTextBlocks, finalTextBlocks } = params;
|
|
2525
|
-
if (finalTextBlocks.length === 0 || finalTextBlocks.length >= streamedTextBlocks.length) return false;
|
|
2526
|
-
if (finalTextBlocks.every((block, index) => streamedTextBlocks[index] === block)) return true;
|
|
2527
|
-
const suffixStart = streamedTextBlocks.length - finalTextBlocks.length;
|
|
2528
|
-
return finalTextBlocks.every((block, index) => streamedTextBlocks[suffixStart + index] === block);
|
|
2529
|
-
}
|
|
2530
|
-
function shouldPreserveBoundaryDroppedText(params) {
|
|
2531
|
-
if (params.boundaryDropMode === "off") return false;
|
|
2532
|
-
if (!(params.boundaryDropMode === "streamed-or-incoming" ? params.streamedSawNonTextContentBlocks || params.incomingSawNonTextContentBlocks : params.streamedSawNonTextContentBlocks)) return false;
|
|
2533
|
-
return isDroppedBoundaryTextBlockSubset({
|
|
2534
|
-
streamedTextBlocks: params.streamedTextBlocks,
|
|
2535
|
-
finalTextBlocks: params.nextContentBlocks
|
|
2536
|
-
});
|
|
2537
|
-
}
|
|
2538
|
-
var TuiStreamAssembler = class {
|
|
2539
|
-
constructor() {
|
|
2540
|
-
this.runs = /* @__PURE__ */ new Map();
|
|
2541
|
-
}
|
|
2542
|
-
getOrCreateRun(runId) {
|
|
2543
|
-
let state = this.runs.get(runId);
|
|
2544
|
-
if (!state) {
|
|
2545
|
-
state = {
|
|
2546
|
-
thinkingText: "",
|
|
2547
|
-
contentText: "",
|
|
2548
|
-
contentBlocks: [],
|
|
2549
|
-
sawNonTextContentBlocks: false,
|
|
2550
|
-
displayText: ""
|
|
2551
|
-
};
|
|
2552
|
-
this.runs.set(runId, state);
|
|
2553
|
-
}
|
|
2554
|
-
return state;
|
|
2555
|
-
}
|
|
2556
|
-
updateRunState(state, message, showThinking, opts) {
|
|
2557
|
-
const thinkingText = extractThinkingFromMessage(message);
|
|
2558
|
-
const contentText = extractContentFromMessage(message);
|
|
2559
|
-
const { textBlocks, sawNonTextContentBlocks } = extractTextBlocksAndSignals(message);
|
|
2560
|
-
if (thinkingText) state.thinkingText = thinkingText;
|
|
2561
|
-
if (contentText) {
|
|
2562
|
-
const nextContentBlocks = textBlocks.length > 0 ? textBlocks : [contentText];
|
|
2563
|
-
if (!shouldPreserveBoundaryDroppedText({
|
|
2564
|
-
boundaryDropMode: opts?.boundaryDropMode ?? "off",
|
|
2565
|
-
streamedSawNonTextContentBlocks: state.sawNonTextContentBlocks,
|
|
2566
|
-
incomingSawNonTextContentBlocks: sawNonTextContentBlocks,
|
|
2567
|
-
streamedTextBlocks: state.contentBlocks,
|
|
2568
|
-
nextContentBlocks
|
|
2569
|
-
})) {
|
|
2570
|
-
state.contentText = contentText;
|
|
2571
|
-
state.contentBlocks = nextContentBlocks;
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
if (sawNonTextContentBlocks) state.sawNonTextContentBlocks = true;
|
|
2575
|
-
state.displayText = composeThinkingAndContent({
|
|
2576
|
-
thinkingText: state.thinkingText,
|
|
2577
|
-
contentText: state.contentText,
|
|
2578
|
-
showThinking
|
|
2579
|
-
});
|
|
2580
|
-
}
|
|
2581
|
-
ingestDelta(runId, message, showThinking) {
|
|
2582
|
-
const state = this.getOrCreateRun(runId);
|
|
2583
|
-
const previousDisplayText = state.displayText;
|
|
2584
|
-
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-or-incoming" });
|
|
2585
|
-
if (!state.displayText || state.displayText === previousDisplayText) return null;
|
|
2586
|
-
return state.displayText;
|
|
2587
|
-
}
|
|
2588
|
-
finalize(runId, message, showThinking, errorMessage) {
|
|
2589
|
-
const state = this.getOrCreateRun(runId);
|
|
2590
|
-
const streamedDisplayText = state.displayText;
|
|
2591
|
-
const streamedTextBlocks = [...state.contentBlocks];
|
|
2592
|
-
const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks;
|
|
2593
|
-
this.updateRunState(state, message, showThinking, { boundaryDropMode: "streamed-only" });
|
|
2594
|
-
const finalComposed = state.displayText;
|
|
2595
|
-
const finalText = resolveFinalAssistantText({
|
|
2596
|
-
finalText: streamedSawNonTextContentBlocks && isDroppedBoundaryTextBlockSubset({
|
|
2597
|
-
streamedTextBlocks,
|
|
2598
|
-
finalTextBlocks: state.contentBlocks
|
|
2599
|
-
}) ? streamedDisplayText : finalComposed,
|
|
2600
|
-
streamedText: streamedDisplayText,
|
|
2601
|
-
errorMessage
|
|
2602
|
-
});
|
|
2603
|
-
this.runs.delete(runId);
|
|
2604
|
-
return finalText;
|
|
2605
|
-
}
|
|
2606
|
-
drop(runId) {
|
|
2607
|
-
this.runs.delete(runId);
|
|
2608
|
-
}
|
|
2609
|
-
};
|
|
2610
|
-
//#endregion
|
|
2611
|
-
//#region src/tui/tui-event-handlers.ts
|
|
2612
|
-
function createEventHandlers(context) {
|
|
2613
|
-
const { chatLog, btw, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, noteLocalRunId, isLocalRunId, forgetLocalRunId, clearLocalRunIds, isLocalBtwRunId, forgetLocalBtwRunId, clearLocalBtwRunIds } = context;
|
|
2614
|
-
const finalizedRuns = /* @__PURE__ */ new Map();
|
|
2615
|
-
const sessionRuns = /* @__PURE__ */ new Map();
|
|
2616
|
-
let streamAssembler = new TuiStreamAssembler();
|
|
2617
|
-
let lastSessionKey = state.currentSessionKey;
|
|
2618
|
-
let pendingHistoryRefresh = false;
|
|
2619
|
-
const pruneRunMap = (runs) => {
|
|
2620
|
-
if (runs.size <= 200) return;
|
|
2621
|
-
const keepUntil = Date.now() - 600 * 1e3;
|
|
2622
|
-
for (const [key, ts] of runs) {
|
|
2623
|
-
if (runs.size <= 150) break;
|
|
2624
|
-
if (ts < keepUntil) runs.delete(key);
|
|
2625
|
-
}
|
|
2626
|
-
if (runs.size > 200) for (const key of runs.keys()) {
|
|
2627
|
-
runs.delete(key);
|
|
2628
|
-
if (runs.size <= 150) break;
|
|
2629
|
-
}
|
|
2630
|
-
};
|
|
2631
|
-
const syncSessionKey = () => {
|
|
2632
|
-
if (state.currentSessionKey === lastSessionKey) return;
|
|
2633
|
-
lastSessionKey = state.currentSessionKey;
|
|
2634
|
-
finalizedRuns.clear();
|
|
2635
|
-
sessionRuns.clear();
|
|
2636
|
-
streamAssembler = new TuiStreamAssembler();
|
|
2637
|
-
pendingHistoryRefresh = false;
|
|
2638
|
-
state.pendingOptimisticUserMessage = false;
|
|
2639
|
-
clearLocalRunIds?.();
|
|
2640
|
-
clearLocalBtwRunIds?.();
|
|
2641
|
-
btw.clear();
|
|
2642
|
-
};
|
|
2643
|
-
const flushPendingHistoryRefreshIfIdle = () => {
|
|
2644
|
-
if (!pendingHistoryRefresh || state.activeChatRunId) return;
|
|
2645
|
-
pendingHistoryRefresh = false;
|
|
2646
|
-
loadHistory?.();
|
|
2647
|
-
};
|
|
2648
|
-
const noteSessionRun = (runId) => {
|
|
2649
|
-
sessionRuns.set(runId, Date.now());
|
|
2650
|
-
pruneRunMap(sessionRuns);
|
|
2651
|
-
};
|
|
2652
|
-
const noteFinalizedRun = (runId) => {
|
|
2653
|
-
finalizedRuns.set(runId, Date.now());
|
|
2654
|
-
sessionRuns.delete(runId);
|
|
2655
|
-
streamAssembler.drop(runId);
|
|
2656
|
-
pruneRunMap(finalizedRuns);
|
|
2657
|
-
};
|
|
2658
|
-
const clearActiveRunIfMatch = (runId) => {
|
|
2659
|
-
if (state.activeChatRunId === runId) state.activeChatRunId = null;
|
|
2660
|
-
};
|
|
2661
|
-
const finalizeRun = (params) => {
|
|
2662
|
-
noteFinalizedRun(params.runId);
|
|
2663
|
-
clearActiveRunIfMatch(params.runId);
|
|
2664
|
-
flushPendingHistoryRefreshIfIdle();
|
|
2665
|
-
if (!hasConcurrentActiveRun(params.runId)) setActivityStatus(params.status);
|
|
2666
|
-
refreshSessionInfo?.();
|
|
2667
|
-
};
|
|
2668
|
-
const terminateRun = (params) => {
|
|
2669
|
-
streamAssembler.drop(params.runId);
|
|
2670
|
-
sessionRuns.delete(params.runId);
|
|
2671
|
-
clearActiveRunIfMatch(params.runId);
|
|
2672
|
-
flushPendingHistoryRefreshIfIdle();
|
|
2673
|
-
if (!hasConcurrentActiveRun(params.runId)) setActivityStatus(params.status);
|
|
2674
|
-
refreshSessionInfo?.();
|
|
2675
|
-
};
|
|
2676
|
-
const hasConcurrentActiveRun = (runId) => {
|
|
2677
|
-
const activeRunId = state.activeChatRunId;
|
|
2678
|
-
if (!activeRunId || activeRunId === runId) return false;
|
|
2679
|
-
return sessionRuns.has(activeRunId);
|
|
2680
|
-
};
|
|
2681
|
-
const maybeRefreshHistoryForRun = (runId, opts) => {
|
|
2682
|
-
if (isLocalRunId?.(runId) ?? false) {
|
|
2683
|
-
forgetLocalRunId?.(runId);
|
|
2684
|
-
if (!opts?.allowLocalWithoutDisplayableFinal) return;
|
|
2685
|
-
if (state.activeChatRunId && state.activeChatRunId !== runId) {
|
|
2686
|
-
pendingHistoryRefresh = true;
|
|
2687
|
-
return;
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
if (hasConcurrentActiveRun(runId)) return;
|
|
2691
|
-
pendingHistoryRefresh = false;
|
|
2692
|
-
loadHistory?.();
|
|
2693
|
-
};
|
|
2694
|
-
const isSameSessionKey = (left, right) => {
|
|
2695
|
-
const normalizedLeft = normalizeLowercaseStringOrEmpty(left);
|
|
2696
|
-
const normalizedRight = normalizeLowercaseStringOrEmpty(right);
|
|
2697
|
-
if (!normalizedLeft || !normalizedRight) return false;
|
|
2698
|
-
if (normalizedLeft === normalizedRight) return true;
|
|
2699
|
-
const parsedLeft = parseAgentSessionKey(normalizedLeft);
|
|
2700
|
-
const parsedRight = parseAgentSessionKey(normalizedRight);
|
|
2701
|
-
if (parsedLeft && parsedRight) return parsedLeft.agentId === parsedRight.agentId && parsedLeft.rest === parsedRight.rest;
|
|
2702
|
-
if (parsedLeft) return parsedLeft.rest === normalizedRight;
|
|
2703
|
-
if (parsedRight) return normalizedLeft === parsedRight.rest;
|
|
2704
|
-
return false;
|
|
2705
|
-
};
|
|
2706
|
-
const handleChatEvent = (payload) => {
|
|
2707
|
-
if (!payload || typeof payload !== "object") return;
|
|
2708
|
-
const evt = payload;
|
|
2709
|
-
syncSessionKey();
|
|
2710
|
-
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
2711
|
-
if (finalizedRuns.has(evt.runId)) {
|
|
2712
|
-
if (evt.state === "delta") return;
|
|
2713
|
-
if (evt.state === "final") return;
|
|
2714
|
-
}
|
|
2715
|
-
noteSessionRun(evt.runId);
|
|
2716
|
-
if (!state.activeChatRunId && !isLocalBtwRunId?.(evt.runId)) {
|
|
2717
|
-
state.activeChatRunId = evt.runId;
|
|
2718
|
-
if (state.pendingOptimisticUserMessage) {
|
|
2719
|
-
noteLocalRunId?.(evt.runId);
|
|
2720
|
-
state.pendingOptimisticUserMessage = false;
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
if (evt.state === "delta") {
|
|
2724
|
-
const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
|
|
2725
|
-
if (!displayText) return;
|
|
2726
|
-
chatLog.updateAssistant(displayText, evt.runId);
|
|
2727
|
-
setActivityStatus("streaming");
|
|
2728
|
-
}
|
|
2729
|
-
if (evt.state === "final") {
|
|
2730
|
-
const isLocalBtwRun = isLocalBtwRunId?.(evt.runId) ?? false;
|
|
2731
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2732
|
-
if (!evt.message && isLocalBtwRun) {
|
|
2733
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
2734
|
-
noteFinalizedRun(evt.runId);
|
|
2735
|
-
tui.requestRender();
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
if (!evt.message) {
|
|
2739
|
-
maybeRefreshHistoryForRun(evt.runId, { allowLocalWithoutDisplayableFinal: true });
|
|
2740
|
-
chatLog.dropAssistant(evt.runId);
|
|
2741
|
-
finalizeRun({
|
|
2742
|
-
runId: evt.runId,
|
|
2743
|
-
wasActiveRun,
|
|
2744
|
-
status: "idle"
|
|
2745
|
-
});
|
|
2746
|
-
tui.requestRender();
|
|
2747
|
-
return;
|
|
2748
|
-
}
|
|
2749
|
-
if (isCommandMessage(evt.message)) {
|
|
2750
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
2751
|
-
const text = extractTextFromMessage(evt.message);
|
|
2752
|
-
if (text) chatLog.addSystem(text);
|
|
2753
|
-
finalizeRun({
|
|
2754
|
-
runId: evt.runId,
|
|
2755
|
-
wasActiveRun,
|
|
2756
|
-
status: "idle"
|
|
2757
|
-
});
|
|
2758
|
-
tui.requestRender();
|
|
2759
|
-
return;
|
|
2760
|
-
}
|
|
2761
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
2762
|
-
const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
|
|
2763
|
-
const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking, evt.errorMessage);
|
|
2764
|
-
if (finalText === "(no output)" && !isLocalRunId?.(evt.runId)) chatLog.dropAssistant(evt.runId);
|
|
2765
|
-
else chatLog.finalizeAssistant(finalText, evt.runId);
|
|
2766
|
-
finalizeRun({
|
|
2767
|
-
runId: evt.runId,
|
|
2768
|
-
wasActiveRun,
|
|
2769
|
-
status: stopReason === "error" ? "error" : "idle"
|
|
2770
|
-
});
|
|
2771
|
-
}
|
|
2772
|
-
if (evt.state === "aborted") {
|
|
2773
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
2774
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2775
|
-
chatLog.addSystem("run aborted");
|
|
2776
|
-
terminateRun({
|
|
2777
|
-
runId: evt.runId,
|
|
2778
|
-
wasActiveRun,
|
|
2779
|
-
status: "aborted"
|
|
2780
|
-
});
|
|
2781
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
2782
|
-
}
|
|
2783
|
-
if (evt.state === "error") {
|
|
2784
|
-
forgetLocalBtwRunId?.(evt.runId);
|
|
2785
|
-
const wasActiveRun = state.activeChatRunId === evt.runId;
|
|
2786
|
-
chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
|
|
2787
|
-
terminateRun({
|
|
2788
|
-
runId: evt.runId,
|
|
2789
|
-
wasActiveRun,
|
|
2790
|
-
status: "error"
|
|
2791
|
-
});
|
|
2792
|
-
maybeRefreshHistoryForRun(evt.runId);
|
|
2793
|
-
}
|
|
2794
|
-
tui.requestRender();
|
|
2795
|
-
};
|
|
2796
|
-
const handleAgentEvent = (payload) => {
|
|
2797
|
-
if (!payload || typeof payload !== "object") return;
|
|
2798
|
-
const evt = payload;
|
|
2799
|
-
syncSessionKey();
|
|
2800
|
-
const isActiveRun = evt.runId === state.activeChatRunId;
|
|
2801
|
-
if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
|
|
2802
|
-
if (evt.stream === "tool") {
|
|
2803
|
-
const verbose = state.sessionInfo.verboseLevel ?? "off";
|
|
2804
|
-
const allowToolEvents = verbose !== "off";
|
|
2805
|
-
const allowToolOutput = verbose === "full";
|
|
2806
|
-
if (!allowToolEvents) return;
|
|
2807
|
-
const data = evt.data ?? {};
|
|
2808
|
-
const phase = asString(data.phase, "");
|
|
2809
|
-
const toolCallId = asString(data.toolCallId, "");
|
|
2810
|
-
const toolName = asString(data.name, "tool");
|
|
2811
|
-
if (!toolCallId) return;
|
|
2812
|
-
if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
|
|
2813
|
-
else if (phase === "update") {
|
|
2814
|
-
if (!allowToolOutput) return;
|
|
2815
|
-
chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
|
|
2816
|
-
} else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
|
|
2817
|
-
else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
|
|
2818
|
-
tui.requestRender();
|
|
2819
|
-
return;
|
|
2820
|
-
}
|
|
2821
|
-
if (evt.stream === "lifecycle") {
|
|
2822
|
-
if (!isActiveRun) return;
|
|
2823
|
-
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
2824
|
-
if (phase === "start") setActivityStatus("running");
|
|
2825
|
-
if (phase === "end") setActivityStatus("idle");
|
|
2826
|
-
if (phase === "error") setActivityStatus("error");
|
|
2827
|
-
tui.requestRender();
|
|
2828
|
-
}
|
|
2829
|
-
};
|
|
2830
|
-
const handleBtwEvent = (payload) => {
|
|
2831
|
-
if (!payload || typeof payload !== "object") return;
|
|
2832
|
-
const evt = payload;
|
|
2833
|
-
syncSessionKey();
|
|
2834
|
-
if (!isSameSessionKey(evt.sessionKey, state.currentSessionKey)) return;
|
|
2835
|
-
if (evt.kind !== "btw") return;
|
|
2836
|
-
const question = evt.question.trim();
|
|
2837
|
-
const text = evt.text.trim();
|
|
2838
|
-
if (!question || !text) return;
|
|
2839
|
-
btw.showResult({
|
|
2840
|
-
question,
|
|
2841
|
-
text,
|
|
2842
|
-
isError: evt.isError
|
|
2843
|
-
});
|
|
2844
|
-
tui.requestRender();
|
|
2845
|
-
};
|
|
2846
|
-
return {
|
|
2847
|
-
handleChatEvent,
|
|
2848
|
-
handleAgentEvent,
|
|
2849
|
-
handleBtwEvent
|
|
2850
|
-
};
|
|
2851
|
-
}
|
|
2852
|
-
//#endregion
|
|
2853
|
-
//#region src/tui/tui-local-shell.ts
|
|
2854
|
-
function createLocalShellRunner(deps) {
|
|
2855
|
-
let localExecAsked = false;
|
|
2856
|
-
let localExecAllowed = false;
|
|
2857
|
-
const createSelector = deps.createSelector ?? createSearchableSelectList;
|
|
2858
|
-
const spawnCommand = deps.spawnCommand ?? spawn;
|
|
2859
|
-
const getCwd = deps.getCwd ?? (() => process.cwd());
|
|
2860
|
-
const env = deps.env ?? process.env;
|
|
2861
|
-
const maxChars = deps.maxOutputChars ?? 4e4;
|
|
2862
|
-
const ensureLocalExecAllowed = async () => {
|
|
2863
|
-
if (localExecAllowed) return true;
|
|
2864
|
-
if (localExecAsked) return false;
|
|
2865
|
-
localExecAsked = true;
|
|
2866
|
-
return await new Promise((resolve) => {
|
|
2867
|
-
deps.chatLog.addSystem("Allow local shell commands for this session?");
|
|
2868
|
-
deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
|
|
2869
|
-
deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
|
|
2870
|
-
const selector = createSelector([{
|
|
2871
|
-
value: "no",
|
|
2872
|
-
label: "No"
|
|
2873
|
-
}, {
|
|
2874
|
-
value: "yes",
|
|
2875
|
-
label: "Yes"
|
|
2876
|
-
}], 2);
|
|
2877
|
-
selector.onSelect = (item) => {
|
|
2878
|
-
deps.closeOverlay();
|
|
2879
|
-
if (item.value === "yes") {
|
|
2880
|
-
localExecAllowed = true;
|
|
2881
|
-
deps.chatLog.addSystem("local shell: enabled for this session");
|
|
2882
|
-
resolve(true);
|
|
2883
|
-
} else {
|
|
2884
|
-
deps.chatLog.addSystem("local shell: not enabled");
|
|
2885
|
-
resolve(false);
|
|
2886
|
-
}
|
|
2887
|
-
deps.tui.requestRender();
|
|
2888
|
-
};
|
|
2889
|
-
selector.onCancel = () => {
|
|
2890
|
-
deps.closeOverlay();
|
|
2891
|
-
deps.chatLog.addSystem("local shell: cancelled");
|
|
2892
|
-
deps.tui.requestRender();
|
|
2893
|
-
resolve(false);
|
|
2894
|
-
};
|
|
2895
|
-
deps.openOverlay(selector);
|
|
2896
|
-
deps.tui.requestRender();
|
|
2897
|
-
});
|
|
2898
|
-
};
|
|
2899
|
-
const runLocalShellLine = async (line) => {
|
|
2900
|
-
const cmd = line.slice(1);
|
|
2901
|
-
if (cmd === "") return;
|
|
2902
|
-
if (localExecAsked && !localExecAllowed) {
|
|
2903
|
-
deps.chatLog.addSystem("local shell: not enabled for this session");
|
|
2904
|
-
deps.tui.requestRender();
|
|
2905
|
-
return;
|
|
2906
|
-
}
|
|
2907
|
-
if (!await ensureLocalExecAllowed()) return;
|
|
2908
|
-
deps.chatLog.addSystem(`[local] $ ${cmd}`);
|
|
2909
|
-
deps.tui.requestRender();
|
|
2910
|
-
const appendWithCap = (text, chunk) => {
|
|
2911
|
-
const combined = text + chunk;
|
|
2912
|
-
return combined.length > maxChars ? combined.slice(-maxChars) : combined;
|
|
2913
|
-
};
|
|
2914
|
-
await new Promise((resolve) => {
|
|
2915
|
-
const child = spawnCommand(cmd, {
|
|
2916
|
-
shell: true,
|
|
2917
|
-
cwd: getCwd(),
|
|
2918
|
-
env: {
|
|
2919
|
-
...env,
|
|
2920
|
-
KAIJIBOT_SHELL: "tui-local"
|
|
2921
|
-
}
|
|
2922
|
-
});
|
|
2923
|
-
let stdout = "";
|
|
2924
|
-
let stderr = "";
|
|
2925
|
-
child.stdout.on("data", (buf) => {
|
|
2926
|
-
stdout = appendWithCap(stdout, buf.toString("utf8"));
|
|
2927
|
-
});
|
|
2928
|
-
child.stderr.on("data", (buf) => {
|
|
2929
|
-
stderr = appendWithCap(stderr, buf.toString("utf8"));
|
|
2930
|
-
});
|
|
2931
|
-
child.on("close", (code, signal) => {
|
|
2932
|
-
const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
|
|
2933
|
-
if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
|
|
2934
|
-
deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
|
|
2935
|
-
deps.tui.requestRender();
|
|
2936
|
-
resolve();
|
|
2937
|
-
});
|
|
2938
|
-
child.on("error", (err) => {
|
|
2939
|
-
deps.chatLog.addSystem(`[local] error: ${String(err)}`);
|
|
2940
|
-
deps.tui.requestRender();
|
|
2941
|
-
resolve();
|
|
2942
|
-
});
|
|
2943
|
-
});
|
|
2944
|
-
};
|
|
2945
|
-
return { runLocalShellLine };
|
|
2946
|
-
}
|
|
2947
|
-
//#endregion
|
|
2948
|
-
//#region src/tui/tui-overlays.ts
|
|
2949
|
-
function createOverlayHandlers(host, fallbackFocus) {
|
|
2950
|
-
const openOverlay = (component) => {
|
|
2951
|
-
host.showOverlay(component);
|
|
2952
|
-
};
|
|
2953
|
-
const closeOverlay = () => {
|
|
2954
|
-
if (host.hasOverlay()) {
|
|
2955
|
-
host.hideOverlay();
|
|
2956
|
-
return;
|
|
2957
|
-
}
|
|
2958
|
-
host.setFocus(fallbackFocus);
|
|
2959
|
-
};
|
|
2960
|
-
return {
|
|
2961
|
-
openOverlay,
|
|
2962
|
-
closeOverlay
|
|
2963
|
-
};
|
|
2964
|
-
}
|
|
2965
|
-
//#endregion
|
|
2966
|
-
//#region src/tui/tui-session-actions.ts
|
|
2967
|
-
function createSessionActions(context) {
|
|
2968
|
-
const { client, chatLog, btw, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
|
|
2969
|
-
let refreshSessionInfoPromise = Promise.resolve();
|
|
2970
|
-
let lastSessionDefaults = null;
|
|
2971
|
-
const applyAgentsResult = (result) => {
|
|
2972
|
-
state.agentDefaultId = normalizeAgentId(result.defaultId);
|
|
2973
|
-
state.sessionMainKey = normalizeMainKey(result.mainKey);
|
|
2974
|
-
state.sessionScope = result.scope ?? state.sessionScope;
|
|
2975
|
-
state.agents = result.agents.map((agent) => ({
|
|
2976
|
-
id: normalizeAgentId(agent.id),
|
|
2977
|
-
name: normalizeOptionalString(agent.name)
|
|
2978
|
-
}));
|
|
2979
|
-
agentNames.clear();
|
|
2980
|
-
for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
|
|
2981
|
-
if (!state.initialSessionApplied) {
|
|
2982
|
-
if (initialSessionAgentId) {
|
|
2983
|
-
if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
|
|
2984
|
-
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
2985
|
-
const nextSessionKey = resolveSessionKey(initialSessionInput);
|
|
2986
|
-
if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
|
|
2987
|
-
state.initialSessionApplied = true;
|
|
2988
|
-
} else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
|
|
2989
|
-
updateHeader();
|
|
2990
|
-
updateFooter();
|
|
2991
|
-
};
|
|
2992
|
-
const refreshAgents = async () => {
|
|
2993
|
-
try {
|
|
2994
|
-
applyAgentsResult(await client.listAgents());
|
|
2995
|
-
} catch (err) {
|
|
2996
|
-
chatLog.addSystem(`agents list failed: ${String(err)}`);
|
|
2997
|
-
}
|
|
2998
|
-
};
|
|
2999
|
-
const updateAgentFromSessionKey = (key) => {
|
|
3000
|
-
const parsed = parseAgentSessionKey(key);
|
|
3001
|
-
if (!parsed) return;
|
|
3002
|
-
const next = normalizeAgentId(parsed.agentId);
|
|
3003
|
-
if (next !== state.currentAgentId) state.currentAgentId = next;
|
|
3004
|
-
};
|
|
3005
|
-
const resolveModelSelection = (entry) => {
|
|
3006
|
-
return resolveSessionInfoModelSelection({
|
|
3007
|
-
currentProvider: state.sessionInfo.modelProvider,
|
|
3008
|
-
currentModel: state.sessionInfo.model,
|
|
3009
|
-
entryProvider: entry?.modelProvider,
|
|
3010
|
-
entryModel: entry?.model,
|
|
3011
|
-
overrideProvider: entry?.providerOverride,
|
|
3012
|
-
overrideModel: entry?.modelOverride
|
|
3013
|
-
});
|
|
3014
|
-
};
|
|
3015
|
-
const applySessionInfo = (params) => {
|
|
3016
|
-
const entry = params.entry ?? void 0;
|
|
3017
|
-
const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
|
|
3018
|
-
const previousDefaults = lastSessionDefaults;
|
|
3019
|
-
const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
|
|
3020
|
-
if (params.defaults) lastSessionDefaults = params.defaults;
|
|
3021
|
-
const entryUpdatedAt = entry?.updatedAt ?? null;
|
|
3022
|
-
const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
|
|
3023
|
-
if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged) return;
|
|
3024
|
-
const next = { ...state.sessionInfo };
|
|
3025
|
-
if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
|
|
3026
|
-
if (entry?.fastMode !== void 0) next.fastMode = entry.fastMode;
|
|
3027
|
-
if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
|
|
3028
|
-
if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
|
|
3029
|
-
if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
|
|
3030
|
-
if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
|
|
3031
|
-
if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
|
|
3032
|
-
if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
|
|
3033
|
-
if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
|
|
3034
|
-
if (entry?.displayName !== void 0) next.displayName = entry.displayName;
|
|
3035
|
-
if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
|
|
3036
|
-
const selection = resolveModelSelection(entry);
|
|
3037
|
-
if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
|
|
3038
|
-
if (selection.model !== void 0) next.model = selection.model;
|
|
3039
|
-
state.sessionInfo = next;
|
|
3040
|
-
updateAutocompleteProvider();
|
|
3041
|
-
updateFooter();
|
|
3042
|
-
tui.requestRender();
|
|
3043
|
-
};
|
|
3044
|
-
const runRefreshSessionInfo = async () => {
|
|
3045
|
-
try {
|
|
3046
|
-
const resolveListAgentId = () => {
|
|
3047
|
-
if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
|
|
3048
|
-
const parsed = parseAgentSessionKey(state.currentSessionKey);
|
|
3049
|
-
return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
|
|
3050
|
-
};
|
|
3051
|
-
const listAgentId = resolveListAgentId();
|
|
3052
|
-
const result = await client.listSessions({
|
|
3053
|
-
includeGlobal: false,
|
|
3054
|
-
includeUnknown: false,
|
|
3055
|
-
agentId: listAgentId
|
|
3056
|
-
});
|
|
3057
|
-
const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
|
|
3058
|
-
const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
|
|
3059
|
-
const entry = result.sessions.find((row) => {
|
|
3060
|
-
if (row.key === state.currentSessionKey) return true;
|
|
3061
|
-
return normalizeMatchKey(row.key) === currentMatchKey;
|
|
3062
|
-
});
|
|
3063
|
-
if (entry?.key && entry.key !== state.currentSessionKey) {
|
|
3064
|
-
updateAgentFromSessionKey(entry.key);
|
|
3065
|
-
state.currentSessionKey = entry.key;
|
|
3066
|
-
updateHeader();
|
|
3067
|
-
}
|
|
3068
|
-
applySessionInfo({
|
|
3069
|
-
entry,
|
|
3070
|
-
defaults: result.defaults
|
|
3071
|
-
});
|
|
3072
|
-
} catch (err) {
|
|
3073
|
-
chatLog.addSystem(`sessions list failed: ${String(err)}`);
|
|
3074
|
-
}
|
|
3075
|
-
};
|
|
3076
|
-
const refreshSessionInfo = async () => {
|
|
3077
|
-
refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
|
|
3078
|
-
await refreshSessionInfoPromise;
|
|
3079
|
-
};
|
|
3080
|
-
const applySessionInfoFromPatch = (result) => {
|
|
3081
|
-
if (!result?.entry) return;
|
|
3082
|
-
if (result.key && result.key !== state.currentSessionKey) {
|
|
3083
|
-
updateAgentFromSessionKey(result.key);
|
|
3084
|
-
state.currentSessionKey = result.key;
|
|
3085
|
-
updateHeader();
|
|
3086
|
-
}
|
|
3087
|
-
const resolved = result.resolved;
|
|
3088
|
-
applySessionInfo({
|
|
3089
|
-
entry: resolved && (resolved.modelProvider || resolved.model) ? {
|
|
3090
|
-
...result.entry,
|
|
3091
|
-
modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
|
|
3092
|
-
model: resolved.model ?? result.entry.model
|
|
3093
|
-
} : result.entry,
|
|
3094
|
-
force: true
|
|
3095
|
-
});
|
|
3096
|
-
};
|
|
3097
|
-
const loadHistory = async () => {
|
|
3098
|
-
try {
|
|
3099
|
-
const record = await client.loadHistory({
|
|
3100
|
-
sessionKey: state.currentSessionKey,
|
|
3101
|
-
limit: opts.historyLimit ?? 200
|
|
3102
|
-
});
|
|
3103
|
-
state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
|
|
3104
|
-
state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
|
|
3105
|
-
state.sessionInfo.fastMode = record.fastMode ?? state.sessionInfo.fastMode;
|
|
3106
|
-
state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
|
|
3107
|
-
const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
|
|
3108
|
-
chatLog.clearAll();
|
|
3109
|
-
btw.clear();
|
|
3110
|
-
chatLog.addSystem(`session ${state.currentSessionKey}`);
|
|
3111
|
-
for (const entry of record.messages ?? []) {
|
|
3112
|
-
if (!entry || typeof entry !== "object") continue;
|
|
3113
|
-
const message = entry;
|
|
3114
|
-
if (isCommandMessage(message)) {
|
|
3115
|
-
const text = extractTextFromMessage(message);
|
|
3116
|
-
if (text) chatLog.addSystem(text);
|
|
3117
|
-
continue;
|
|
3118
|
-
}
|
|
3119
|
-
if (message.role === "user") {
|
|
3120
|
-
const text = extractTextFromMessage(message);
|
|
3121
|
-
if (text) chatLog.addUser(text);
|
|
3122
|
-
continue;
|
|
3123
|
-
}
|
|
3124
|
-
if (message.role === "assistant") {
|
|
3125
|
-
const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
|
|
3126
|
-
if (text) chatLog.finalizeAssistant(text);
|
|
3127
|
-
continue;
|
|
3128
|
-
}
|
|
3129
|
-
if (message.role === "toolResult") {
|
|
3130
|
-
if (!showTools) continue;
|
|
3131
|
-
const toolCallId = asString(message.toolCallId, "");
|
|
3132
|
-
const toolName = asString(message.toolName, "tool");
|
|
3133
|
-
chatLog.startTool(toolCallId, toolName, {}).setResult({
|
|
3134
|
-
content: Array.isArray(message.content) ? message.content : [],
|
|
3135
|
-
details: typeof message.details === "object" && message.details ? message.details : void 0
|
|
3136
|
-
}, { isError: Boolean(message.isError) });
|
|
3137
|
-
}
|
|
3138
|
-
}
|
|
3139
|
-
state.historyLoaded = true;
|
|
3140
|
-
} catch (err) {
|
|
3141
|
-
chatLog.addSystem(`history failed: ${String(err)}`);
|
|
3142
|
-
}
|
|
3143
|
-
await refreshSessionInfo();
|
|
3144
|
-
tui.requestRender();
|
|
3145
|
-
};
|
|
3146
|
-
const setSession = async (rawKey) => {
|
|
3147
|
-
const nextKey = resolveSessionKey(rawKey);
|
|
3148
|
-
updateAgentFromSessionKey(nextKey);
|
|
3149
|
-
state.currentSessionKey = nextKey;
|
|
3150
|
-
state.activeChatRunId = null;
|
|
3151
|
-
state.currentSessionId = null;
|
|
3152
|
-
state.sessionInfo.updatedAt = null;
|
|
3153
|
-
state.historyLoaded = false;
|
|
3154
|
-
clearLocalRunIds?.();
|
|
3155
|
-
btw.clear();
|
|
3156
|
-
updateHeader();
|
|
3157
|
-
updateFooter();
|
|
3158
|
-
await loadHistory();
|
|
3159
|
-
};
|
|
3160
|
-
const abortActive = async () => {
|
|
3161
|
-
if (!state.activeChatRunId) {
|
|
3162
|
-
chatLog.addSystem("no active run");
|
|
3163
|
-
tui.requestRender();
|
|
3164
|
-
return;
|
|
3165
|
-
}
|
|
3166
|
-
try {
|
|
3167
|
-
await client.abortChat({
|
|
3168
|
-
sessionKey: state.currentSessionKey,
|
|
3169
|
-
runId: state.activeChatRunId
|
|
3170
|
-
});
|
|
3171
|
-
setActivityStatus("aborted");
|
|
3172
|
-
} catch (err) {
|
|
3173
|
-
chatLog.addSystem(`abort failed: ${String(err)}`);
|
|
3174
|
-
setActivityStatus("abort failed");
|
|
3175
|
-
}
|
|
3176
|
-
tui.requestRender();
|
|
3177
|
-
};
|
|
3178
|
-
return {
|
|
3179
|
-
applyAgentsResult,
|
|
3180
|
-
refreshAgents,
|
|
3181
|
-
refreshSessionInfo,
|
|
3182
|
-
applySessionInfoFromPatch,
|
|
3183
|
-
loadHistory,
|
|
3184
|
-
setSession,
|
|
3185
|
-
abortActive
|
|
3186
|
-
};
|
|
3187
|
-
}
|
|
3188
|
-
//#endregion
|
|
3189
|
-
//#region src/tui/tui-submit.ts
|
|
3190
|
-
function createEditorSubmitHandler(params) {
|
|
3191
|
-
return (text) => {
|
|
3192
|
-
const raw = text;
|
|
3193
|
-
const value = raw.trim();
|
|
3194
|
-
params.editor.setText("");
|
|
3195
|
-
if (!value) return;
|
|
3196
|
-
if (raw.startsWith("!") && raw !== "!") {
|
|
3197
|
-
params.editor.addToHistory(raw);
|
|
3198
|
-
params.handleBangLine(raw);
|
|
3199
|
-
return;
|
|
3200
|
-
}
|
|
3201
|
-
params.editor.addToHistory(value);
|
|
3202
|
-
if (value.startsWith("/")) {
|
|
3203
|
-
params.handleCommand(value);
|
|
3204
|
-
return;
|
|
3205
|
-
}
|
|
3206
|
-
params.sendMessage(value);
|
|
3207
|
-
};
|
|
3208
|
-
}
|
|
3209
|
-
function shouldEnableWindowsGitBashPasteFallback(params) {
|
|
3210
|
-
const platform = params?.platform ?? process.platform;
|
|
3211
|
-
const env = params?.env ?? process.env;
|
|
3212
|
-
const termProgram = normalizeLowercaseStringOrEmpty(env.TERM_PROGRAM);
|
|
3213
|
-
if (platform === "darwin") {
|
|
3214
|
-
if (termProgram.includes("iterm") || termProgram.includes("apple_terminal")) return true;
|
|
3215
|
-
return false;
|
|
3216
|
-
}
|
|
3217
|
-
if (platform !== "win32") return false;
|
|
3218
|
-
const msystem = (env.MSYSTEM ?? "").toUpperCase();
|
|
3219
|
-
const shell = env.SHELL ?? "";
|
|
3220
|
-
if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) return true;
|
|
3221
|
-
if (normalizeLowercaseStringOrEmpty(shell).includes("bash")) return true;
|
|
3222
|
-
return termProgram.includes("mintty");
|
|
3223
|
-
}
|
|
3224
|
-
function createSubmitBurstCoalescer(params) {
|
|
3225
|
-
const windowMs = Math.max(1, params.burstWindowMs ?? 50);
|
|
3226
|
-
const now = params.now ?? (() => Date.now());
|
|
3227
|
-
const setTimer = params.setTimer ?? setTimeout;
|
|
3228
|
-
const clearTimer = params.clearTimer ?? clearTimeout;
|
|
3229
|
-
let pending = null;
|
|
3230
|
-
let pendingAt = 0;
|
|
3231
|
-
let flushTimer = null;
|
|
3232
|
-
const clearFlushTimer = () => {
|
|
3233
|
-
if (!flushTimer) return;
|
|
3234
|
-
clearTimer(flushTimer);
|
|
3235
|
-
flushTimer = null;
|
|
3236
|
-
};
|
|
3237
|
-
const flushPending = () => {
|
|
3238
|
-
if (pending === null) return;
|
|
3239
|
-
const value = pending;
|
|
3240
|
-
pending = null;
|
|
3241
|
-
pendingAt = 0;
|
|
3242
|
-
clearFlushTimer();
|
|
3243
|
-
params.submit(value);
|
|
3244
|
-
};
|
|
3245
|
-
const scheduleFlush = () => {
|
|
3246
|
-
clearFlushTimer();
|
|
3247
|
-
flushTimer = setTimer(() => {
|
|
3248
|
-
flushPending();
|
|
3249
|
-
}, windowMs);
|
|
3250
|
-
};
|
|
3251
|
-
return (value) => {
|
|
3252
|
-
if (!params.enabled) {
|
|
3253
|
-
params.submit(value);
|
|
3254
|
-
return;
|
|
3255
|
-
}
|
|
3256
|
-
if (value.includes("\n")) {
|
|
3257
|
-
flushPending();
|
|
3258
|
-
params.submit(value);
|
|
3259
|
-
return;
|
|
3260
|
-
}
|
|
3261
|
-
const ts = now();
|
|
3262
|
-
if (pending === null) {
|
|
3263
|
-
pending = value;
|
|
3264
|
-
pendingAt = ts;
|
|
3265
|
-
scheduleFlush();
|
|
3266
|
-
return;
|
|
3267
|
-
}
|
|
3268
|
-
if (ts - pendingAt <= windowMs) {
|
|
3269
|
-
pending = `${pending}\n${value}`;
|
|
3270
|
-
pendingAt = ts;
|
|
3271
|
-
scheduleFlush();
|
|
3272
|
-
return;
|
|
3273
|
-
}
|
|
3274
|
-
flushPending();
|
|
3275
|
-
pending = value;
|
|
3276
|
-
pendingAt = ts;
|
|
3277
|
-
scheduleFlush();
|
|
3278
|
-
};
|
|
3279
|
-
}
|
|
3280
|
-
//#endregion
|
|
3281
|
-
//#region src/tui/tui-waiting.ts
|
|
3282
|
-
const defaultWaitingPhrases = [
|
|
3283
|
-
"flibbertigibbeting",
|
|
3284
|
-
"kerfuffling",
|
|
3285
|
-
"dillydallying",
|
|
3286
|
-
"twiddling thumbs",
|
|
3287
|
-
"noodling",
|
|
3288
|
-
"bamboozling",
|
|
3289
|
-
"moseying",
|
|
3290
|
-
"hobnobbing",
|
|
3291
|
-
"pondering",
|
|
3292
|
-
"conjuring"
|
|
3293
|
-
];
|
|
3294
|
-
function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
|
|
3295
|
-
return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
|
|
3296
|
-
}
|
|
3297
|
-
function shimmerText(theme, text, tick) {
|
|
3298
|
-
const width = 6;
|
|
3299
|
-
const hi = (ch) => theme.bold(theme.accentSoft(ch));
|
|
3300
|
-
const pos = tick % (text.length + width);
|
|
3301
|
-
const start = Math.max(0, pos - width);
|
|
3302
|
-
const end = Math.min(text.length - 1, pos);
|
|
3303
|
-
let out = "";
|
|
3304
|
-
for (let i = 0; i < text.length; i++) {
|
|
3305
|
-
const ch = text[i];
|
|
3306
|
-
out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
|
|
3307
|
-
}
|
|
3308
|
-
return out;
|
|
3309
|
-
}
|
|
3310
|
-
function buildWaitingStatusMessage(params) {
|
|
3311
|
-
const phrase = pickWaitingPhrase(params.tick, params.phrases);
|
|
3312
|
-
return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
|
|
3313
|
-
}
|
|
3314
|
-
//#endregion
|
|
3315
|
-
//#region src/tui/tui.ts
|
|
3316
|
-
function resolveTuiSessionKey(params) {
|
|
3317
|
-
const trimmed = (params.raw ?? "").trim();
|
|
3318
|
-
if (!trimmed) {
|
|
3319
|
-
if (params.sessionScope === "global") return "global";
|
|
3320
|
-
return buildAgentMainSessionKey({
|
|
3321
|
-
agentId: params.currentAgentId,
|
|
3322
|
-
mainKey: params.sessionMainKey
|
|
3323
|
-
});
|
|
3324
|
-
}
|
|
3325
|
-
if (trimmed === "global" || trimmed === "unknown") return trimmed;
|
|
3326
|
-
if (trimmed.startsWith("agent:")) return normalizeLowercaseStringOrEmpty(trimmed);
|
|
3327
|
-
return `agent:${params.currentAgentId}:${normalizeLowercaseStringOrEmpty(trimmed)}`;
|
|
3328
|
-
}
|
|
3329
|
-
function resolveInitialTuiAgentId(params) {
|
|
3330
|
-
const parsed = parseAgentSessionKey((params.initialSessionInput ?? "").trim());
|
|
3331
|
-
if (parsed?.agentId) return normalizeAgentId(parsed.agentId);
|
|
3332
|
-
const inferredFromWorkspace = resolveAgentIdByWorkspacePath(params.cfg, params.cwd ?? process.cwd());
|
|
3333
|
-
if (inferredFromWorkspace) return inferredFromWorkspace;
|
|
3334
|
-
return normalizeAgentId(params.fallbackAgentId);
|
|
3335
|
-
}
|
|
3336
|
-
function resolveGatewayDisconnectState(reason) {
|
|
3337
|
-
const reasonLabel = reason?.trim() ? reason.trim() : "closed";
|
|
3338
|
-
if (/pairing required/i.test(reasonLabel)) return {
|
|
3339
|
-
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3340
|
-
activityStatus: "pairing required: run kaijibot devices list",
|
|
3341
|
-
pairingHint: "Pairing required. Run `kaijibot devices list`, approve your request ID, then reconnect."
|
|
3342
|
-
};
|
|
3343
|
-
return {
|
|
3344
|
-
connectionStatus: `gateway disconnected: ${reasonLabel}`,
|
|
3345
|
-
activityStatus: "idle"
|
|
3346
|
-
};
|
|
3347
|
-
}
|
|
3348
|
-
function createBackspaceDeduper(params) {
|
|
3349
|
-
const dedupeWindowMs = Math.max(0, Math.floor(params?.dedupeWindowMs ?? 8));
|
|
3350
|
-
const now = params?.now ?? (() => Date.now());
|
|
3351
|
-
let lastBackspaceAt = -1;
|
|
3352
|
-
return (data) => {
|
|
3353
|
-
if (!matchesKey(data, Key.backspace)) return data;
|
|
3354
|
-
const ts = now();
|
|
3355
|
-
if (lastBackspaceAt >= 0 && ts - lastBackspaceAt <= dedupeWindowMs) return "";
|
|
3356
|
-
lastBackspaceAt = ts;
|
|
3357
|
-
return data;
|
|
3358
|
-
};
|
|
3359
|
-
}
|
|
3360
|
-
function isIgnorableTuiStopError(error) {
|
|
3361
|
-
if (!error || typeof error !== "object") return false;
|
|
3362
|
-
const err = error;
|
|
3363
|
-
const code = typeof err.code === "string" ? err.code : "";
|
|
3364
|
-
const syscall = typeof err.syscall === "string" ? err.syscall : "";
|
|
3365
|
-
const message = typeof err.message === "string" ? err.message : "";
|
|
3366
|
-
if (code === "EBADF" && syscall === "setRawMode") return true;
|
|
3367
|
-
return /setRawMode/i.test(message) && /EBADF/i.test(message);
|
|
3368
|
-
}
|
|
3369
|
-
function stopTuiSafely(stop) {
|
|
3370
|
-
try {
|
|
3371
|
-
stop();
|
|
3372
|
-
} catch (error) {
|
|
3373
|
-
if (!isIgnorableTuiStopError(error)) throw error;
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
async function drainAndStopTuiSafely(tui) {
|
|
3377
|
-
if (typeof tui.terminal?.drainInput === "function") try {
|
|
3378
|
-
await tui.terminal.drainInput();
|
|
3379
|
-
} catch {}
|
|
3380
|
-
stopTuiSafely(() => tui.stop());
|
|
3381
|
-
}
|
|
3382
|
-
function resolveCtrlCAction(params) {
|
|
3383
|
-
const exitWindowMs = Math.max(1, Math.floor(params.exitWindowMs ?? 1e3));
|
|
3384
|
-
if (params.hasInput) return {
|
|
3385
|
-
action: "clear",
|
|
3386
|
-
nextLastCtrlCAt: params.now
|
|
3387
|
-
};
|
|
3388
|
-
if (params.now - params.lastCtrlCAt <= exitWindowMs) return {
|
|
3389
|
-
action: "exit",
|
|
3390
|
-
nextLastCtrlCAt: params.lastCtrlCAt
|
|
3391
|
-
};
|
|
3392
|
-
return {
|
|
3393
|
-
action: "warn",
|
|
3394
|
-
nextLastCtrlCAt: params.now
|
|
3395
|
-
};
|
|
3396
|
-
}
|
|
3397
|
-
async function runTui(opts) {
|
|
3398
|
-
const config = loadConfig();
|
|
3399
|
-
const initialSessionInput = (opts.session ?? "").trim();
|
|
3400
|
-
let sessionScope = config.session?.scope ?? "per-sender";
|
|
3401
|
-
let sessionMainKey = normalizeMainKey(config.session?.mainKey);
|
|
3402
|
-
let agentDefaultId = resolveDefaultAgentId(config);
|
|
3403
|
-
let currentAgentId = resolveInitialTuiAgentId({
|
|
3404
|
-
cfg: config,
|
|
3405
|
-
fallbackAgentId: agentDefaultId,
|
|
3406
|
-
initialSessionInput,
|
|
3407
|
-
cwd: process.cwd()
|
|
3408
|
-
});
|
|
3409
|
-
let agents = [];
|
|
3410
|
-
const agentNames = /* @__PURE__ */ new Map();
|
|
3411
|
-
let currentSessionKey = "";
|
|
3412
|
-
let initialSessionApplied = false;
|
|
3413
|
-
let currentSessionId = null;
|
|
3414
|
-
let activeChatRunId = null;
|
|
3415
|
-
let pendingOptimisticUserMessage = false;
|
|
3416
|
-
let historyLoaded = false;
|
|
3417
|
-
let isConnected = false;
|
|
3418
|
-
let wasDisconnected = false;
|
|
3419
|
-
let toolsExpanded = false;
|
|
3420
|
-
let showThinking = false;
|
|
3421
|
-
let pairingHintShown = false;
|
|
3422
|
-
const localRunIds = /* @__PURE__ */ new Set();
|
|
3423
|
-
const localBtwRunIds = /* @__PURE__ */ new Set();
|
|
3424
|
-
const deliverDefault = opts.deliver ?? false;
|
|
3425
|
-
const autoMessage = opts.message?.trim();
|
|
3426
|
-
let autoMessageSent = false;
|
|
3427
|
-
let sessionInfo = {};
|
|
3428
|
-
let lastCtrlCAt = 0;
|
|
3429
|
-
let exitRequested = false;
|
|
3430
|
-
let activityStatus = "idle";
|
|
3431
|
-
let connectionStatus = "connecting";
|
|
3432
|
-
let statusTimeout = null;
|
|
3433
|
-
let statusTimer = null;
|
|
3434
|
-
let statusStartedAt = null;
|
|
3435
|
-
let lastActivityStatus = activityStatus;
|
|
3436
|
-
const state = {
|
|
3437
|
-
get agentDefaultId() {
|
|
3438
|
-
return agentDefaultId;
|
|
3439
|
-
},
|
|
3440
|
-
set agentDefaultId(value) {
|
|
3441
|
-
agentDefaultId = value;
|
|
3442
|
-
},
|
|
3443
|
-
get sessionMainKey() {
|
|
3444
|
-
return sessionMainKey;
|
|
3445
|
-
},
|
|
3446
|
-
set sessionMainKey(value) {
|
|
3447
|
-
sessionMainKey = value;
|
|
3448
|
-
},
|
|
3449
|
-
get sessionScope() {
|
|
3450
|
-
return sessionScope;
|
|
3451
|
-
},
|
|
3452
|
-
set sessionScope(value) {
|
|
3453
|
-
sessionScope = value;
|
|
3454
|
-
},
|
|
3455
|
-
get agents() {
|
|
3456
|
-
return agents;
|
|
3457
|
-
},
|
|
3458
|
-
set agents(value) {
|
|
3459
|
-
agents = value;
|
|
3460
|
-
},
|
|
3461
|
-
get currentAgentId() {
|
|
3462
|
-
return currentAgentId;
|
|
3463
|
-
},
|
|
3464
|
-
set currentAgentId(value) {
|
|
3465
|
-
currentAgentId = value;
|
|
3466
|
-
},
|
|
3467
|
-
get currentSessionKey() {
|
|
3468
|
-
return currentSessionKey;
|
|
3469
|
-
},
|
|
3470
|
-
set currentSessionKey(value) {
|
|
3471
|
-
currentSessionKey = value;
|
|
3472
|
-
},
|
|
3473
|
-
get currentSessionId() {
|
|
3474
|
-
return currentSessionId;
|
|
3475
|
-
},
|
|
3476
|
-
set currentSessionId(value) {
|
|
3477
|
-
currentSessionId = value;
|
|
3478
|
-
},
|
|
3479
|
-
get activeChatRunId() {
|
|
3480
|
-
return activeChatRunId;
|
|
3481
|
-
},
|
|
3482
|
-
set activeChatRunId(value) {
|
|
3483
|
-
activeChatRunId = value;
|
|
3484
|
-
},
|
|
3485
|
-
get pendingOptimisticUserMessage() {
|
|
3486
|
-
return pendingOptimisticUserMessage;
|
|
3487
|
-
},
|
|
3488
|
-
set pendingOptimisticUserMessage(value) {
|
|
3489
|
-
pendingOptimisticUserMessage = value;
|
|
3490
|
-
},
|
|
3491
|
-
get historyLoaded() {
|
|
3492
|
-
return historyLoaded;
|
|
3493
|
-
},
|
|
3494
|
-
set historyLoaded(value) {
|
|
3495
|
-
historyLoaded = value;
|
|
3496
|
-
},
|
|
3497
|
-
get sessionInfo() {
|
|
3498
|
-
return sessionInfo;
|
|
3499
|
-
},
|
|
3500
|
-
set sessionInfo(value) {
|
|
3501
|
-
sessionInfo = value;
|
|
3502
|
-
},
|
|
3503
|
-
get initialSessionApplied() {
|
|
3504
|
-
return initialSessionApplied;
|
|
3505
|
-
},
|
|
3506
|
-
set initialSessionApplied(value) {
|
|
3507
|
-
initialSessionApplied = value;
|
|
3508
|
-
},
|
|
3509
|
-
get isConnected() {
|
|
3510
|
-
return isConnected;
|
|
3511
|
-
},
|
|
3512
|
-
set isConnected(value) {
|
|
3513
|
-
isConnected = value;
|
|
3514
|
-
},
|
|
3515
|
-
get autoMessageSent() {
|
|
3516
|
-
return autoMessageSent;
|
|
3517
|
-
},
|
|
3518
|
-
set autoMessageSent(value) {
|
|
3519
|
-
autoMessageSent = value;
|
|
3520
|
-
},
|
|
3521
|
-
get toolsExpanded() {
|
|
3522
|
-
return toolsExpanded;
|
|
3523
|
-
},
|
|
3524
|
-
set toolsExpanded(value) {
|
|
3525
|
-
toolsExpanded = value;
|
|
3526
|
-
},
|
|
3527
|
-
get showThinking() {
|
|
3528
|
-
return showThinking;
|
|
3529
|
-
},
|
|
3530
|
-
set showThinking(value) {
|
|
3531
|
-
showThinking = value;
|
|
3532
|
-
},
|
|
3533
|
-
get connectionStatus() {
|
|
3534
|
-
return connectionStatus;
|
|
3535
|
-
},
|
|
3536
|
-
set connectionStatus(value) {
|
|
3537
|
-
connectionStatus = value;
|
|
3538
|
-
},
|
|
3539
|
-
get activityStatus() {
|
|
3540
|
-
return activityStatus;
|
|
3541
|
-
},
|
|
3542
|
-
set activityStatus(value) {
|
|
3543
|
-
activityStatus = value;
|
|
3544
|
-
},
|
|
3545
|
-
get statusTimeout() {
|
|
3546
|
-
return statusTimeout;
|
|
3547
|
-
},
|
|
3548
|
-
set statusTimeout(value) {
|
|
3549
|
-
statusTimeout = value;
|
|
3550
|
-
},
|
|
3551
|
-
get lastCtrlCAt() {
|
|
3552
|
-
return lastCtrlCAt;
|
|
3553
|
-
},
|
|
3554
|
-
set lastCtrlCAt(value) {
|
|
3555
|
-
lastCtrlCAt = value;
|
|
3556
|
-
}
|
|
3557
|
-
};
|
|
3558
|
-
const noteLocalRunId = (runId) => {
|
|
3559
|
-
if (!runId) return;
|
|
3560
|
-
localRunIds.add(runId);
|
|
3561
|
-
if (localRunIds.size > 200) {
|
|
3562
|
-
const [first] = localRunIds;
|
|
3563
|
-
if (first) localRunIds.delete(first);
|
|
3564
|
-
}
|
|
3565
|
-
};
|
|
3566
|
-
const forgetLocalRunId = (runId) => {
|
|
3567
|
-
localRunIds.delete(runId);
|
|
3568
|
-
};
|
|
3569
|
-
const isLocalRunId = (runId) => localRunIds.has(runId);
|
|
3570
|
-
const clearLocalRunIds = () => {
|
|
3571
|
-
localRunIds.clear();
|
|
3572
|
-
};
|
|
3573
|
-
const noteLocalBtwRunId = (runId) => {
|
|
3574
|
-
if (!runId) return;
|
|
3575
|
-
localBtwRunIds.add(runId);
|
|
3576
|
-
if (localBtwRunIds.size > 200) {
|
|
3577
|
-
const [first] = localBtwRunIds;
|
|
3578
|
-
if (first) localBtwRunIds.delete(first);
|
|
3579
|
-
}
|
|
3580
|
-
};
|
|
3581
|
-
const forgetLocalBtwRunId = (runId) => {
|
|
3582
|
-
localBtwRunIds.delete(runId);
|
|
3583
|
-
};
|
|
3584
|
-
const isLocalBtwRunId = (runId) => localBtwRunIds.has(runId);
|
|
3585
|
-
const clearLocalBtwRunIds = () => {
|
|
3586
|
-
localBtwRunIds.clear();
|
|
3587
|
-
};
|
|
3588
|
-
const client = await GatewayChatClient.connect({
|
|
3589
|
-
url: opts.url,
|
|
3590
|
-
token: opts.token,
|
|
3591
|
-
password: opts.password
|
|
3592
|
-
});
|
|
3593
|
-
const tui = new TUI(new ProcessTerminal());
|
|
3594
|
-
const dedupeBackspace = createBackspaceDeduper();
|
|
3595
|
-
tui.addInputListener((data) => {
|
|
3596
|
-
const next = dedupeBackspace(data);
|
|
3597
|
-
if (next.length === 0) return { consume: true };
|
|
3598
|
-
return { data: next };
|
|
3599
|
-
});
|
|
3600
|
-
const header = new Text("", 1, 0);
|
|
3601
|
-
const statusContainer = new Container();
|
|
3602
|
-
const footer = new Text("", 1, 0);
|
|
3603
|
-
const chatLog = new ChatLog();
|
|
3604
|
-
chatLog.setTuiRef(tui);
|
|
3605
|
-
const editor = new CustomEditor(tui, editorTheme);
|
|
3606
|
-
const root = new Container();
|
|
3607
|
-
root.addChild(header);
|
|
3608
|
-
root.addChild(chatLog);
|
|
3609
|
-
root.addChild(statusContainer);
|
|
3610
|
-
root.addChild(footer);
|
|
3611
|
-
root.addChild(editor);
|
|
3612
|
-
const updateAutocompleteProvider = () => {
|
|
3613
|
-
editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
|
|
3614
|
-
cfg: config,
|
|
3615
|
-
provider: sessionInfo.modelProvider,
|
|
3616
|
-
model: sessionInfo.model
|
|
3617
|
-
}), process.cwd()));
|
|
3618
|
-
};
|
|
3619
|
-
tui.addChild(root);
|
|
3620
|
-
tui.setFocus(editor);
|
|
3621
|
-
const formatSessionKey = (key) => {
|
|
3622
|
-
if (key === "global" || key === "unknown") return key;
|
|
3623
|
-
return parseAgentSessionKey(key)?.rest ?? key;
|
|
3624
|
-
};
|
|
3625
|
-
const formatAgentLabel = (id) => {
|
|
3626
|
-
const name = agentNames.get(id);
|
|
3627
|
-
return name ? `${id} (${name})` : id;
|
|
3628
|
-
};
|
|
3629
|
-
const resolveSessionKey = (raw) => {
|
|
3630
|
-
return resolveTuiSessionKey({
|
|
3631
|
-
raw,
|
|
3632
|
-
sessionScope,
|
|
3633
|
-
currentAgentId,
|
|
3634
|
-
sessionMainKey
|
|
3635
|
-
});
|
|
3636
|
-
};
|
|
3637
|
-
currentSessionKey = resolveSessionKey(initialSessionInput);
|
|
3638
|
-
const updateHeader = () => {
|
|
3639
|
-
const sessionLabel = formatSessionKey(currentSessionKey);
|
|
3640
|
-
const agentLabel = formatAgentLabel(currentAgentId);
|
|
3641
|
-
header.setText(theme.header(`kaijibot tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
|
|
3642
|
-
};
|
|
3643
|
-
const busyStates = new Set([
|
|
3644
|
-
"sending",
|
|
3645
|
-
"waiting",
|
|
3646
|
-
"streaming",
|
|
3647
|
-
"running"
|
|
3648
|
-
]);
|
|
3649
|
-
let statusText = null;
|
|
3650
|
-
let statusLoader = null;
|
|
3651
|
-
const formatElapsed = (startMs) => {
|
|
3652
|
-
const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
|
|
3653
|
-
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
3654
|
-
return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
|
|
3655
|
-
};
|
|
3656
|
-
const ensureStatusText = () => {
|
|
3657
|
-
if (statusText) return;
|
|
3658
|
-
statusContainer.clear();
|
|
3659
|
-
statusLoader?.stop();
|
|
3660
|
-
statusLoader = null;
|
|
3661
|
-
statusText = new Text("", 1, 0);
|
|
3662
|
-
statusContainer.addChild(statusText);
|
|
3663
|
-
};
|
|
3664
|
-
const ensureStatusLoader = () => {
|
|
3665
|
-
if (statusLoader) return;
|
|
3666
|
-
statusContainer.clear();
|
|
3667
|
-
statusText = null;
|
|
3668
|
-
statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
|
|
3669
|
-
statusContainer.addChild(statusLoader);
|
|
3670
|
-
};
|
|
3671
|
-
let waitingTick = 0;
|
|
3672
|
-
let waitingTimer = null;
|
|
3673
|
-
let waitingPhrase = null;
|
|
3674
|
-
const updateBusyStatusMessage = () => {
|
|
3675
|
-
if (!statusLoader || !statusStartedAt) return;
|
|
3676
|
-
const elapsed = formatElapsed(statusStartedAt);
|
|
3677
|
-
if (activityStatus === "waiting") {
|
|
3678
|
-
waitingTick++;
|
|
3679
|
-
statusLoader.setMessage(buildWaitingStatusMessage({
|
|
3680
|
-
theme,
|
|
3681
|
-
tick: waitingTick,
|
|
3682
|
-
elapsed,
|
|
3683
|
-
connectionStatus,
|
|
3684
|
-
phrases: waitingPhrase ? [waitingPhrase] : void 0
|
|
3685
|
-
}));
|
|
3686
|
-
return;
|
|
3687
|
-
}
|
|
3688
|
-
statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
|
|
3689
|
-
};
|
|
3690
|
-
const startStatusTimer = () => {
|
|
3691
|
-
if (statusTimer) return;
|
|
3692
|
-
statusTimer = setInterval(() => {
|
|
3693
|
-
if (!busyStates.has(activityStatus)) return;
|
|
3694
|
-
updateBusyStatusMessage();
|
|
3695
|
-
}, 1e3);
|
|
3696
|
-
};
|
|
3697
|
-
const stopStatusTimer = () => {
|
|
3698
|
-
if (!statusTimer) return;
|
|
3699
|
-
clearInterval(statusTimer);
|
|
3700
|
-
statusTimer = null;
|
|
3701
|
-
};
|
|
3702
|
-
const startWaitingTimer = () => {
|
|
3703
|
-
if (waitingTimer) return;
|
|
3704
|
-
if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
|
|
3705
|
-
waitingTick = 0;
|
|
3706
|
-
waitingTimer = setInterval(() => {
|
|
3707
|
-
if (activityStatus !== "waiting") return;
|
|
3708
|
-
updateBusyStatusMessage();
|
|
3709
|
-
}, 120);
|
|
3710
|
-
};
|
|
3711
|
-
const stopWaitingTimer = () => {
|
|
3712
|
-
if (!waitingTimer) return;
|
|
3713
|
-
clearInterval(waitingTimer);
|
|
3714
|
-
waitingTimer = null;
|
|
3715
|
-
waitingPhrase = null;
|
|
3716
|
-
};
|
|
3717
|
-
const renderStatus = () => {
|
|
3718
|
-
if (busyStates.has(activityStatus)) {
|
|
3719
|
-
if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
|
|
3720
|
-
ensureStatusLoader();
|
|
3721
|
-
if (activityStatus === "waiting") {
|
|
3722
|
-
stopStatusTimer();
|
|
3723
|
-
startWaitingTimer();
|
|
3724
|
-
} else {
|
|
3725
|
-
stopWaitingTimer();
|
|
3726
|
-
startStatusTimer();
|
|
3727
|
-
}
|
|
3728
|
-
updateBusyStatusMessage();
|
|
3729
|
-
} else {
|
|
3730
|
-
statusStartedAt = null;
|
|
3731
|
-
stopStatusTimer();
|
|
3732
|
-
stopWaitingTimer();
|
|
3733
|
-
statusLoader?.stop();
|
|
3734
|
-
statusLoader = null;
|
|
3735
|
-
ensureStatusText();
|
|
3736
|
-
const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
|
|
3737
|
-
statusText?.setText(theme.dim(text));
|
|
3738
|
-
}
|
|
3739
|
-
lastActivityStatus = activityStatus;
|
|
3740
|
-
};
|
|
3741
|
-
const setConnectionStatus = (text, ttlMs) => {
|
|
3742
|
-
connectionStatus = text;
|
|
3743
|
-
renderStatus();
|
|
3744
|
-
if (statusTimeout) clearTimeout(statusTimeout);
|
|
3745
|
-
if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
|
|
3746
|
-
connectionStatus = isConnected ? "connected" : "disconnected";
|
|
3747
|
-
renderStatus();
|
|
3748
|
-
}, ttlMs);
|
|
3749
|
-
};
|
|
3750
|
-
const setActivityStatus = (text) => {
|
|
3751
|
-
activityStatus = text;
|
|
3752
|
-
renderStatus();
|
|
3753
|
-
};
|
|
3754
|
-
const updateFooter = () => {
|
|
3755
|
-
const sessionKeyLabel = formatSessionKey(currentSessionKey);
|
|
3756
|
-
const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
|
|
3757
|
-
const agentLabel = formatAgentLabel(currentAgentId);
|
|
3758
|
-
const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
|
|
3759
|
-
const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
|
|
3760
|
-
const think = sessionInfo.thinkingLevel ?? "off";
|
|
3761
|
-
const fast = sessionInfo.fastMode === true;
|
|
3762
|
-
const verbose = sessionInfo.verboseLevel ?? "off";
|
|
3763
|
-
const reasoning = sessionInfo.reasoningLevel ?? "off";
|
|
3764
|
-
const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
|
|
3765
|
-
const footerParts = [
|
|
3766
|
-
`agent ${agentLabel}`,
|
|
3767
|
-
`session ${sessionLabel}`,
|
|
3768
|
-
modelLabel,
|
|
3769
|
-
think !== "off" ? `think ${think}` : null,
|
|
3770
|
-
fast ? "fast" : null,
|
|
3771
|
-
verbose !== "off" ? `verbose ${verbose}` : null,
|
|
3772
|
-
reasoningLabel,
|
|
3773
|
-
tokens
|
|
3774
|
-
].filter(Boolean);
|
|
3775
|
-
footer.setText(theme.dim(footerParts.join(" | ")));
|
|
3776
|
-
};
|
|
3777
|
-
const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
|
|
3778
|
-
const btw = {
|
|
3779
|
-
showResult: (params) => {
|
|
3780
|
-
chatLog.showBtw(params);
|
|
3781
|
-
},
|
|
3782
|
-
clear: () => {
|
|
3783
|
-
chatLog.dismissBtw();
|
|
3784
|
-
}
|
|
3785
|
-
};
|
|
3786
|
-
const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
|
|
3787
|
-
client,
|
|
3788
|
-
chatLog,
|
|
3789
|
-
btw,
|
|
3790
|
-
tui,
|
|
3791
|
-
opts,
|
|
3792
|
-
state,
|
|
3793
|
-
agentNames,
|
|
3794
|
-
initialSessionInput,
|
|
3795
|
-
initialSessionAgentId: (() => {
|
|
3796
|
-
if (!initialSessionInput) return null;
|
|
3797
|
-
const parsed = parseAgentSessionKey(initialSessionInput);
|
|
3798
|
-
return parsed ? normalizeAgentId(parsed.agentId) : null;
|
|
3799
|
-
})(),
|
|
3800
|
-
resolveSessionKey,
|
|
3801
|
-
updateHeader,
|
|
3802
|
-
updateFooter,
|
|
3803
|
-
updateAutocompleteProvider,
|
|
3804
|
-
setActivityStatus,
|
|
3805
|
-
clearLocalRunIds
|
|
3806
|
-
});
|
|
3807
|
-
const { handleChatEvent, handleAgentEvent, handleBtwEvent } = createEventHandlers({
|
|
3808
|
-
chatLog,
|
|
3809
|
-
btw,
|
|
3810
|
-
tui,
|
|
3811
|
-
state,
|
|
3812
|
-
setActivityStatus,
|
|
3813
|
-
refreshSessionInfo,
|
|
3814
|
-
loadHistory,
|
|
3815
|
-
noteLocalRunId,
|
|
3816
|
-
isLocalRunId,
|
|
3817
|
-
forgetLocalRunId,
|
|
3818
|
-
clearLocalRunIds,
|
|
3819
|
-
isLocalBtwRunId,
|
|
3820
|
-
forgetLocalBtwRunId,
|
|
3821
|
-
clearLocalBtwRunIds
|
|
3822
|
-
});
|
|
3823
|
-
const requestExit = () => {
|
|
3824
|
-
if (exitRequested) return;
|
|
3825
|
-
exitRequested = true;
|
|
3826
|
-
client.stop();
|
|
3827
|
-
process.stdout.write("\x1B[?1000l\x1B[?1006l");
|
|
3828
|
-
drainAndStopTuiSafely(tui).then(() => {
|
|
3829
|
-
process.exit(0);
|
|
3830
|
-
});
|
|
3831
|
-
};
|
|
3832
|
-
const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
|
|
3833
|
-
client,
|
|
3834
|
-
chatLog,
|
|
3835
|
-
tui,
|
|
3836
|
-
opts,
|
|
3837
|
-
state,
|
|
3838
|
-
deliverDefault,
|
|
3839
|
-
openOverlay,
|
|
3840
|
-
closeOverlay,
|
|
3841
|
-
refreshSessionInfo,
|
|
3842
|
-
applySessionInfoFromPatch,
|
|
3843
|
-
loadHistory,
|
|
3844
|
-
setSession,
|
|
3845
|
-
refreshAgents,
|
|
3846
|
-
abortActive,
|
|
3847
|
-
setActivityStatus,
|
|
3848
|
-
formatSessionKey,
|
|
3849
|
-
noteLocalRunId,
|
|
3850
|
-
noteLocalBtwRunId,
|
|
3851
|
-
forgetLocalRunId,
|
|
3852
|
-
forgetLocalBtwRunId,
|
|
3853
|
-
requestExit
|
|
3854
|
-
});
|
|
3855
|
-
const { runLocalShellLine } = createLocalShellRunner({
|
|
3856
|
-
chatLog,
|
|
3857
|
-
tui,
|
|
3858
|
-
openOverlay,
|
|
3859
|
-
closeOverlay
|
|
3860
|
-
});
|
|
3861
|
-
updateAutocompleteProvider();
|
|
3862
|
-
const rawSubmitHandler = createEditorSubmitHandler({
|
|
3863
|
-
editor,
|
|
3864
|
-
handleCommand,
|
|
3865
|
-
sendMessage,
|
|
3866
|
-
handleBangLine: runLocalShellLine
|
|
3867
|
-
});
|
|
3868
|
-
const submitHandler = (text) => {
|
|
3869
|
-
chatLog.scrollToBottom();
|
|
3870
|
-
return rawSubmitHandler(text);
|
|
3871
|
-
};
|
|
3872
|
-
editor.onSubmit = createSubmitBurstCoalescer({
|
|
3873
|
-
submit: submitHandler,
|
|
3874
|
-
enabled: shouldEnableWindowsGitBashPasteFallback()
|
|
3875
|
-
});
|
|
3876
|
-
editor.onEscape = () => {
|
|
3877
|
-
if (chatLog.hasVisibleBtw()) {
|
|
3878
|
-
chatLog.dismissBtw();
|
|
3879
|
-
tui.requestRender();
|
|
3880
|
-
return;
|
|
3881
|
-
}
|
|
3882
|
-
abortActive();
|
|
3883
|
-
};
|
|
3884
|
-
const handleCtrlC = () => {
|
|
3885
|
-
const now = Date.now();
|
|
3886
|
-
const decision = resolveCtrlCAction({
|
|
3887
|
-
hasInput: editor.getText().trim().length > 0,
|
|
3888
|
-
now,
|
|
3889
|
-
lastCtrlCAt
|
|
3890
|
-
});
|
|
3891
|
-
lastCtrlCAt = decision.nextLastCtrlCAt;
|
|
3892
|
-
if (decision.action === "clear") {
|
|
3893
|
-
editor.setText("");
|
|
3894
|
-
setActivityStatus("cleared input; press ctrl+c again to exit");
|
|
3895
|
-
tui.requestRender();
|
|
3896
|
-
return;
|
|
3897
|
-
}
|
|
3898
|
-
if (decision.action === "exit") {
|
|
3899
|
-
requestExit();
|
|
3900
|
-
return;
|
|
3901
|
-
}
|
|
3902
|
-
setActivityStatus("press ctrl+c again to exit");
|
|
3903
|
-
tui.requestRender();
|
|
3904
|
-
};
|
|
3905
|
-
editor.onCtrlC = () => {
|
|
3906
|
-
handleCtrlC();
|
|
3907
|
-
};
|
|
3908
|
-
editor.onCtrlD = () => {
|
|
3909
|
-
requestExit();
|
|
3910
|
-
};
|
|
3911
|
-
editor.onCtrlO = () => {
|
|
3912
|
-
toolsExpanded = !toolsExpanded;
|
|
3913
|
-
chatLog.setToolsExpanded(toolsExpanded);
|
|
3914
|
-
setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
|
|
3915
|
-
tui.requestRender();
|
|
3916
|
-
};
|
|
3917
|
-
editor.onCtrlL = () => {
|
|
3918
|
-
openModelSelector();
|
|
3919
|
-
};
|
|
3920
|
-
editor.onCtrlG = () => {
|
|
3921
|
-
openAgentSelector();
|
|
3922
|
-
};
|
|
3923
|
-
editor.onCtrlP = () => {
|
|
3924
|
-
openSessionSelector();
|
|
3925
|
-
};
|
|
3926
|
-
editor.onCtrlT = () => {
|
|
3927
|
-
showThinking = !showThinking;
|
|
3928
|
-
loadHistory();
|
|
3929
|
-
};
|
|
3930
|
-
tui.addInputListener((data) => {
|
|
3931
|
-
if (!chatLog.hasVisibleBtw()) return;
|
|
3932
|
-
if (editor.getText().length > 0) return;
|
|
3933
|
-
if (matchesKey(data, "enter")) {
|
|
3934
|
-
chatLog.dismissBtw();
|
|
3935
|
-
tui.requestRender();
|
|
3936
|
-
return { consume: true };
|
|
3937
|
-
}
|
|
3938
|
-
});
|
|
3939
|
-
const SGR_MOUSE_WHEEL = new RegExp(`^\\[<(64|65);\\d+;\\d+[Mm]$`);
|
|
3940
|
-
tui.addInputListener((data) => {
|
|
3941
|
-
const match = data.match(SGR_MOUSE_WHEEL);
|
|
3942
|
-
if (!match) return;
|
|
3943
|
-
const button = parseInt(match[1], 10);
|
|
3944
|
-
if (button === 64) chatLog.scrollUp();
|
|
3945
|
-
else if (button === 65) chatLog.scrollDown();
|
|
3946
|
-
return { consume: true };
|
|
3947
|
-
});
|
|
3948
|
-
client.onEvent = (evt) => {
|
|
3949
|
-
if (evt.event === "chat") handleChatEvent(evt.payload);
|
|
3950
|
-
if (evt.event === "chat.side_result") handleBtwEvent(evt.payload);
|
|
3951
|
-
if (evt.event === "agent") handleAgentEvent(evt.payload);
|
|
3952
|
-
};
|
|
3953
|
-
client.onConnected = () => {
|
|
3954
|
-
isConnected = true;
|
|
3955
|
-
pairingHintShown = false;
|
|
3956
|
-
const reconnected = wasDisconnected;
|
|
3957
|
-
wasDisconnected = false;
|
|
3958
|
-
setConnectionStatus("connected");
|
|
3959
|
-
(async () => {
|
|
3960
|
-
await refreshAgents();
|
|
3961
|
-
updateHeader();
|
|
3962
|
-
await loadHistory();
|
|
3963
|
-
setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
|
|
3964
|
-
tui.requestRender();
|
|
3965
|
-
if (!autoMessageSent && autoMessage) {
|
|
3966
|
-
autoMessageSent = true;
|
|
3967
|
-
await sendMessage(autoMessage);
|
|
3968
|
-
}
|
|
3969
|
-
updateFooter();
|
|
3970
|
-
tui.requestRender();
|
|
3971
|
-
})();
|
|
3972
|
-
};
|
|
3973
|
-
client.onDisconnected = (reason) => {
|
|
3974
|
-
isConnected = false;
|
|
3975
|
-
wasDisconnected = true;
|
|
3976
|
-
historyLoaded = false;
|
|
3977
|
-
state.activeChatRunId = null;
|
|
3978
|
-
chatLog.scrollToBottom();
|
|
3979
|
-
const disconnectState = resolveGatewayDisconnectState(reason);
|
|
3980
|
-
setConnectionStatus(disconnectState.connectionStatus, 5e3);
|
|
3981
|
-
setActivityStatus(disconnectState.activityStatus);
|
|
3982
|
-
if (disconnectState.pairingHint && !pairingHintShown) {
|
|
3983
|
-
pairingHintShown = true;
|
|
3984
|
-
chatLog.addSystem(disconnectState.pairingHint);
|
|
3985
|
-
}
|
|
3986
|
-
updateFooter();
|
|
3987
|
-
tui.requestRender();
|
|
3988
|
-
};
|
|
3989
|
-
client.onGap = (info) => {
|
|
3990
|
-
setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
|
|
3991
|
-
tui.requestRender();
|
|
3992
|
-
};
|
|
3993
|
-
updateHeader();
|
|
3994
|
-
setConnectionStatus("connecting");
|
|
3995
|
-
updateFooter();
|
|
3996
|
-
const sigintHandler = () => {
|
|
3997
|
-
handleCtrlC();
|
|
3998
|
-
};
|
|
3999
|
-
const sigtermHandler = () => {
|
|
4000
|
-
requestExit();
|
|
4001
|
-
};
|
|
4002
|
-
process.on("SIGINT", sigintHandler);
|
|
4003
|
-
process.on("SIGTERM", sigtermHandler);
|
|
4004
|
-
tui.start();
|
|
4005
|
-
process.stdout.write("\x1B[?1006h\x1B[?1000h");
|
|
4006
|
-
client.start();
|
|
4007
|
-
await new Promise((resolve) => {
|
|
4008
|
-
const finish = () => {
|
|
4009
|
-
process.removeListener("SIGINT", sigintHandler);
|
|
4010
|
-
process.removeListener("SIGTERM", sigtermHandler);
|
|
4011
|
-
resolve();
|
|
4012
|
-
};
|
|
4013
|
-
process.once("exit", finish);
|
|
4014
|
-
});
|
|
4015
|
-
}
|
|
4016
|
-
//#endregion
|
|
4017
|
-
export { runTui as t };
|