remoteclaw 0.1.0-next.2abd2fa → 0.1.0-next.2e9a6cd

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.
Files changed (1052) hide show
  1. package/README.md +9 -7
  2. package/dist/accounts-A8jZK_v9.js +272 -0
  3. package/dist/accounts-BegPt5VR.js +36 -0
  4. package/dist/accounts-BmiimLpP.js +47 -0
  5. package/dist/accounts-Bomfgw0M.js +32 -0
  6. package/dist/accounts-Bpk-loA6.js +47 -0
  7. package/dist/accounts-DAdUdbPk.js +36 -0
  8. package/dist/accounts-WYyfAiie.js +270 -0
  9. package/dist/ack-reactions-CMDRj7fJ.js +446 -0
  10. package/dist/ack-reactions-D7VScSny.js +446 -0
  11. package/dist/acp-cli-BpMS0SsZ.js +1323 -0
  12. package/dist/acp-cli-DkXTlCpF.js +1317 -0
  13. package/dist/active-listener--FT8ewxl.js +37 -0
  14. package/dist/active-listener-C1StcdIA.js +37 -0
  15. package/dist/agent-C76P7tEr.js +703 -0
  16. package/dist/agent-helpers-CK3Obbsi.js +400 -0
  17. package/dist/agent-helpers-KHUla1K7.js +400 -0
  18. package/dist/agent-scope-BrDeaWWf.js +116 -0
  19. package/dist/agent-scope-DxqtYjuJ.js +114 -0
  20. package/dist/agent-ue8p9AIv.js +704 -0
  21. package/dist/agents--24oKN80.js +788 -0
  22. package/dist/agents.config-CWAUoPzG.js +116 -0
  23. package/dist/agents.config-Ck45E_ce.js +116 -0
  24. package/dist/audio-B85HoT7E.js +43 -0
  25. package/dist/audio-BbCUzndz.js +43 -0
  26. package/dist/audio-preflight-B3f0x3zu.js +69 -0
  27. package/dist/audio-preflight-Dv76vFTu.js +64 -0
  28. package/dist/audit-BAbBf2MU.js +3149 -0
  29. package/dist/audit-g55SYz1m.js +3149 -0
  30. package/dist/auth-Bq44qPUd.js +448 -0
  31. package/dist/auth-CVfoI--S.js +281 -0
  32. package/dist/auth-DTWpZJ1a.js +279 -0
  33. package/dist/auth-VItd2pwK.js +448 -0
  34. package/dist/banner-CyPQJybO.js +294 -0
  35. package/dist/binaries-DbgLoSWv.js +13 -0
  36. package/dist/bindings-6KojDoIi.js +69 -0
  37. package/dist/bindings-B6icMMUx.js +69 -0
  38. package/dist/bonjour-discovery-CQU4QbLK.js +378 -0
  39. package/dist/bonjour-discovery-D8aOnk3M.js +378 -0
  40. package/dist/boot/handler.js +42 -69
  41. package/dist/browser-cli-BH41geGr.js +1693 -0
  42. package/dist/browser-cli-u4nrjp1h.js +1688 -0
  43. package/dist/build-info.json +3 -3
  44. package/dist/call-CMDcRlGW.js +2826 -0
  45. package/dist/call-D5YKTYSM.js +2827 -0
  46. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  47. package/dist/catalog-CUY_iTaG.js +185 -0
  48. package/dist/catalog-p6W09S2j.js +185 -0
  49. package/dist/channel-account-context-CA2m93Kt.js +550 -0
  50. package/dist/channel-account-context-Las-t6RP.js +550 -0
  51. package/dist/channel-activity-BD603ehL.js +94 -0
  52. package/dist/channel-activity-CwiF_QMr.js +94 -0
  53. package/dist/channel-activity-daCpxHdT.js +292 -0
  54. package/dist/channel-options-CAlClffy.js +33 -0
  55. package/dist/channel-options-Hl_ep3UG.js +32 -0
  56. package/dist/channel-selection-CHJ7TumC.js +51 -0
  57. package/dist/channel-selection-DR7eW8UG.js +51 -0
  58. package/dist/channel-web-B79j9fSC.js +2134 -0
  59. package/dist/channel-web-DHTTcipm.js +2136 -0
  60. package/dist/channels-cli-DeZ95hcx.js +1427 -0
  61. package/dist/channels-cli-eUCi6jXk.js +1422 -0
  62. package/dist/channels-status-issues-By77REbh.js +18 -0
  63. package/dist/channels-status-issues-DXyOO-KH.js +18 -0
  64. package/dist/chat-envelope-BEDutlnF.js +248 -0
  65. package/dist/chat-envelope-vJJUdDE7.js +248 -0
  66. package/dist/chrome-BuAi16Rq.js +1732 -0
  67. package/dist/chrome-IR-2ukph.js +1733 -0
  68. package/dist/chunk-C1mQSjas.js +341 -0
  69. package/dist/chunk-D7VX4pmT.js +341 -0
  70. package/dist/clack-prompter-BX8SVxtP.js +122 -0
  71. package/dist/clack-prompter-D6HhVlZW.js +121 -0
  72. package/dist/cleanup-utils-DNd0wdKZ.js +94 -0
  73. package/dist/cli/daemon-cli.js +1 -1
  74. package/dist/cli-CK4Y43rx.js +131 -0
  75. package/dist/cli-Cha5Uk29.js +126 -0
  76. package/dist/clipboard-Cbj3McM_.js +31 -0
  77. package/dist/clipboard-Ne8gaWea.js +31 -0
  78. package/dist/command-format-D0vKipG9.js +32 -0
  79. package/dist/command-format-KkslAzwV.js +18 -0
  80. package/dist/command-logger/handler.js +3 -3
  81. package/dist/command-registry-07zlvSN8.js +215 -0
  82. package/dist/commands-DChC3pIF.js +41 -0
  83. package/dist/commands-DFHMoQgH.js +41 -0
  84. package/dist/commands-registry-BN04GIlJ.js +891 -0
  85. package/dist/commands-registry-DbS9NHeX.js +892 -0
  86. package/dist/common-DHHHAcmR.js +156 -0
  87. package/dist/common-De-Lakuh.js +156 -0
  88. package/dist/completion-cli--Jcg794c.js +452 -0
  89. package/dist/completion-cli-B8n7umme.js +452 -0
  90. package/dist/config-BupC6eiJ.js +4223 -0
  91. package/dist/config-CHDaGquZ.js +4225 -0
  92. package/dist/config-cli-Cu79BThx.js +242 -0
  93. package/dist/config-cli-DrJtiyW-.js +247 -0
  94. package/dist/config-guard-BLsqW1qt.js +98 -0
  95. package/dist/config-guard-NQ7jaYM4.js +75 -0
  96. package/dist/config-validation-BLllMW0t.js +18 -0
  97. package/dist/config-validation-DT29VEco.js +18 -0
  98. package/dist/configure-B25UEQnQ.js +889 -0
  99. package/dist/configure-CqMUE4Zw.js +891 -0
  100. package/dist/constants-BbAEYzFC.js +70 -0
  101. package/dist/constants-tLOgmZZ1.js +70 -0
  102. package/dist/control-auth-BFbDXKLK.js +397 -0
  103. package/dist/control-auth-BiiO-FNy.js +397 -0
  104. package/dist/control-ui/assets/index-CuY3pfh1.js +7716 -0
  105. package/dist/control-ui/assets/index-CuY3pfh1.js.map +1 -0
  106. package/dist/control-ui/assets/index-D_fjkN3g.css +1 -0
  107. package/dist/control-ui/index.html +2 -2
  108. package/dist/control-ui-assets-BlpSXjlT.js +186 -0
  109. package/dist/control-ui-assets-eJU2-yvs.js +186 -0
  110. package/dist/conversation-label-Bn5j3lUT.js +36 -0
  111. package/dist/conversation-label-L0QTtKji.js +36 -0
  112. package/dist/cron-cli-BV1o0UgM.js +491 -0
  113. package/dist/cron-cli-C8j-P8GF.js +496 -0
  114. package/dist/daemon-cli-BDvU0Xv6.js +1199 -0
  115. package/dist/daemon-cli-CoNl2Ugf.js +1197 -0
  116. package/dist/daemon-cli.js +53 -97
  117. package/dist/daemon-install-BMEnzWwq.js +60 -0
  118. package/dist/daemon-install-BkUJbdPC.js +55 -0
  119. package/dist/daemon-install-helpers-B9kMxC1v.js +462 -0
  120. package/dist/daemon-install-helpers-DoYR5z4H.js +462 -0
  121. package/dist/deliver-D8P9_nk-.js +481 -0
  122. package/dist/deliver-F9ed3dhp.js +481 -0
  123. package/dist/delivery-queue-B6TuHppj.js +244 -0
  124. package/dist/delivery-queue-BZc3AiGu.js +244 -0
  125. package/dist/devices-cli-DZgxMNLD.js +322 -0
  126. package/dist/devices-cli-DlG9ehK0.js +317 -0
  127. package/dist/diagnostics-CK2HGAFw.js +46 -0
  128. package/dist/diagnostics-G-C-IuxO.js +46 -0
  129. package/dist/directory-cli-CY6tHRIZ.js +218 -0
  130. package/dist/directory-cli-HyvRJ1Ua.js +223 -0
  131. package/dist/dm-policy-shared-1FdjwGtJ.js +22 -0
  132. package/dist/dm-policy-shared-CT3er5HI.js +22 -0
  133. package/dist/dns-cli-Cu-wYvll.js +203 -0
  134. package/dist/dns-cli-DQdnNJh4.js +198 -0
  135. package/dist/dock-D038fZZl.js +929 -0
  136. package/dist/dock-D5pZ3a44.js +928 -0
  137. package/dist/doctor-completion-BrHnayfU.js +92 -0
  138. package/dist/doctor-completion-CoZP2KiR.js +92 -0
  139. package/dist/doctor-config-flow-DJ1nWCTZ.js +1935 -0
  140. package/dist/doctor-config-flow-DYhXUwEq.js +1934 -0
  141. package/dist/enable-B5dIjgnm.js +59 -0
  142. package/dist/enable-FmiEY4ng.js +59 -0
  143. package/dist/entry.js +14 -16
  144. package/dist/env-DUb5GiQe.js +60 -0
  145. package/dist/env-vars-C8WMB8Ix.js +93 -0
  146. package/dist/errors-CdmXrBic.js +35 -0
  147. package/dist/errors-DdLfwEVi.js +35 -0
  148. package/dist/exec-BhkXWg7V.js +164 -0
  149. package/dist/exec-ClUTXFZ9.js +164 -0
  150. package/dist/export-html/template.css +0 -36
  151. package/dist/export-html/template.js +1 -32
  152. package/dist/extensionAPI.js +1015 -142
  153. package/dist/fetch-CCuD0LYV.js +67 -0
  154. package/dist/fetch-JBWLkOpL.js +67 -0
  155. package/dist/fetch-oku6r8tJ.js +67 -0
  156. package/dist/file-lock-6NXMPZTT.js +107 -0
  157. package/dist/file-lock-Ks-RPU6W.js +107 -0
  158. package/dist/fs-safe-93aDW4mH.js +98 -0
  159. package/dist/fs-safe-ACrBwOF5.js +88 -0
  160. package/dist/gateway-cli-CJs4Mxlv.js +23730 -0
  161. package/dist/gateway-cli-gUVR20v7.js +23725 -0
  162. package/dist/gateway-rpc-CSdrtPzg.js +28 -0
  163. package/dist/gateway-rpc-PNA_wUoe.js +28 -0
  164. package/dist/gmail-setup-utils-DNZEf6T0.js +422 -0
  165. package/dist/gmail-setup-utils-KPAKWwGy.js +423 -0
  166. package/dist/health-BCidscV-.js +1417 -0
  167. package/dist/health-Cw2dr19V.js +1414 -0
  168. package/dist/health-format-DOhfU1rY.js +28 -0
  169. package/dist/heartbeat-visibility-C5Vxudi9.js +125 -0
  170. package/dist/heartbeat-visibility-DHeZ-ko1.js +125 -0
  171. package/dist/help-format-Ch0EWh7N.js +17 -0
  172. package/dist/helpers-B4NWktS8.js +10 -0
  173. package/dist/hook-runner-global-Vj-YQxeR.js +527 -0
  174. package/dist/hooks-cli---vy0V0j.js +1218 -0
  175. package/dist/hooks-cli-CX-JUHdJ.js +1223 -0
  176. package/dist/image-ops-DMl7j7f4.js +354 -0
  177. package/dist/image-ops-DpkTOzhI.js +354 -0
  178. package/dist/import-DIjlFm_Y.js +493 -0
  179. package/dist/import-DdQvVR-_.js +495 -0
  180. package/dist/inbound-context-CmmmT8IP.js +68 -0
  181. package/dist/inbound-context-oxIWzEgc.js +68 -0
  182. package/dist/inbound-path-policy-BdmTOUka.js +90 -0
  183. package/dist/inbound-path-policy-DYTLjca8.js +90 -0
  184. package/dist/index.js +106 -105
  185. package/dist/inspect-C9d1V-lI.js +559 -0
  186. package/dist/inspect-rHjRqr3W.js +559 -0
  187. package/dist/installs-QUjSL2ZA.js +325 -0
  188. package/dist/installs-vT5wnxC4.js +325 -0
  189. package/dist/ipv4-DdcyK1aU.js +46 -0
  190. package/dist/ipv4-OHvujh00.js +46 -0
  191. package/dist/ir-CnMQRFBu.js +940 -0
  192. package/dist/json-files-BiA_B-xm.js +46 -0
  193. package/dist/links-CIHbVNO_.js +15 -0
  194. package/dist/loader-CYigLbch.js +22404 -0
  195. package/dist/loader-ElWX62xE.js +22401 -0
  196. package/dist/local-roots-B0QcJDJI.js +313 -0
  197. package/dist/local-roots-BfXsZRkm.js +314 -0
  198. package/dist/logger-BtwpYD7c.js +49 -0
  199. package/dist/logging-CLc3Umm0.js +20 -0
  200. package/dist/login-C8jHYLxN.js +61 -0
  201. package/dist/login-D__FYZX9.js +62 -0
  202. package/dist/login-qr-C0Gd6ybl.js +323 -0
  203. package/dist/login-qr-D7dw54Yp.js +328 -0
  204. package/dist/logs-cli-CFOVARdJ.js +234 -0
  205. package/dist/logs-cli-DtAR__VH.js +239 -0
  206. package/dist/markdown-tables-ChBqQA_Q.js +29 -0
  207. package/dist/markdown-tables-xMuH3QnS.js +29 -0
  208. package/dist/media-CmiNXiOZ.js +10453 -0
  209. package/dist/media-DYopaoc0.js +940 -0
  210. package/dist/message-action-names-CACBi-HB.js +2521 -0
  211. package/dist/message-action-names-CFwlz01T.js +2521 -0
  212. package/dist/message-channel-DF4I2vOK.js +91 -0
  213. package/dist/net-COL170MG.js +225 -0
  214. package/dist/net-QZ8IHNXc.js +225 -0
  215. package/dist/node-cli-CW8jOcHO.js +24 -0
  216. package/dist/nodes-cli-B4lvU9N5.js +1349 -0
  217. package/dist/nodes-cli-B8iTBsI6.js +1344 -0
  218. package/dist/nodes-screen-CZCXHrWB.js +250 -0
  219. package/dist/nodes-screen-C_K1vcS5.js +250 -0
  220. package/dist/note-BVerR3D5.js +92 -0
  221. package/dist/note-Dk8-EaJg.js +92 -0
  222. package/dist/npm-registry-spec-Dma0KHft.js +786 -0
  223. package/dist/npm-registry-spec-vYkxZb6u.js +786 -0
  224. package/dist/npm-resolution-CcZYnzrL.js +86 -0
  225. package/dist/npm-resolution-DsATEEGx.js +86 -0
  226. package/dist/onboard-Csm4bDd_.js +438 -0
  227. package/dist/onboard-D1b535pC.js +436 -0
  228. package/dist/onboard-channels-5EIXyDZh.js +2547 -0
  229. package/dist/onboard-channels-bedB47Hs.js +2548 -0
  230. package/dist/onboard-config-CcPV3Cqz.js +39 -0
  231. package/dist/onboard-config-DcTaxmuf.js +39 -0
  232. package/dist/onboard-helpers-BHNXyhA4.js +364 -0
  233. package/dist/onboard-helpers-eTUU00t8.js +363 -0
  234. package/dist/onboard-remote-DwDKQk1K.js +127 -0
  235. package/dist/onboard-remote-TPbiye5m.js +127 -0
  236. package/dist/onboarding-D0YGZ_Ux.js +588 -0
  237. package/dist/onboarding-DCfmKzl2.js +586 -0
  238. package/dist/onboarding.finalize-BhpsVwME.js +399 -0
  239. package/dist/onboarding.finalize-CY8vgmi9.js +402 -0
  240. package/dist/onboarding.gateway-config-C_eqpJ7D.js +192 -0
  241. package/dist/onboarding.gateway-config-DR1ey6tU.js +199 -0
  242. package/dist/outbound-Be4BgVqF.js +220 -0
  243. package/dist/outbound-CXJLn8kn.js +221 -0
  244. package/dist/outbound-attachment-CbNLn0lk.js +18 -0
  245. package/dist/outbound-attachment-DNCMF74c.js +18 -0
  246. package/dist/outbound-attachment-DaStRTGv.js +18 -0
  247. package/dist/pairing-cli-CxGDUsLT.js +128 -0
  248. package/dist/pairing-cli-D83T3PG9.js +123 -0
  249. package/dist/pairing-labels-6f8FqSS5.js +9 -0
  250. package/dist/pairing-labels-CI5j-OUT.js +9 -0
  251. package/dist/pairing-store-DnTHRcnO.js +459 -0
  252. package/dist/pairing-store-ONzqxcNb.js +460 -0
  253. package/dist/path-env-D7VB7sOO.js +89 -0
  254. package/dist/path-env-DFiYvvI-.js +89 -0
  255. package/dist/path-safety-BshBsw4P.js +14 -0
  256. package/dist/path-safety-CZbhQciI.js +14 -0
  257. package/dist/plugin-auto-enable-BnCQKkIK.js +302 -0
  258. package/dist/plugin-auto-enable-CFRs-pcA.js +301 -0
  259. package/dist/plugin-registry-CV5pfXOU.js +33 -0
  260. package/dist/plugin-registry-CmG34W0u.js +33 -0
  261. package/dist/plugin-sdk/agents/agent-helpers.d.ts +0 -1
  262. package/dist/plugin-sdk/agents/agent-scope.d.ts +10 -0
  263. package/dist/plugin-sdk/agents/agent-types.d.ts +1 -6
  264. package/dist/plugin-sdk/agents/agent-utils.d.ts +0 -14
  265. package/dist/plugin-sdk/agents/provider-utils.d.ts +0 -1
  266. package/dist/plugin-sdk/agents/subagent-spawn.d.ts +0 -1
  267. package/dist/plugin-sdk/agents/tools/sessions-helpers.d.ts +0 -1
  268. package/dist/plugin-sdk/auth/constants.d.ts +16 -0
  269. package/dist/plugin-sdk/auth/display.d.ts +7 -0
  270. package/dist/plugin-sdk/auth/doctor.d.ts +8 -0
  271. package/dist/plugin-sdk/auth/env-injection.d.ts +41 -0
  272. package/dist/plugin-sdk/auth/index.d.ts +8 -0
  273. package/dist/plugin-sdk/auth/oauth.d.ts +14 -0
  274. package/dist/plugin-sdk/auth/provider-auth.d.ts +40 -0
  275. package/dist/plugin-sdk/auth/session-override.d.ts +18 -0
  276. package/dist/plugin-sdk/auto-reply/reply/agent-runner-execution.d.ts +0 -1
  277. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +0 -2
  278. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +1 -4
  279. package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +1 -4
  280. package/dist/plugin-sdk/auto-reply/reply/directive-handling.levels.d.ts +1 -7
  281. package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +1 -4
  282. package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +1 -7
  283. package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +1 -4
  284. package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +3 -15
  285. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -5
  286. package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +1 -5
  287. package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +1 -5
  288. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +1 -3
  289. package/dist/plugin-sdk/auto-reply/reply/response-prefix-template.d.ts +4 -6
  290. package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +0 -7
  291. package/dist/plugin-sdk/auto-reply/reply/session-updates.d.ts +0 -10
  292. package/dist/plugin-sdk/auto-reply/reply.d.ts +1 -1
  293. package/dist/plugin-sdk/auto-reply/status.d.ts +2 -6
  294. package/dist/plugin-sdk/auto-reply/thinking.d.ts +0 -11
  295. package/dist/plugin-sdk/auto-reply/types.d.ts +1 -2
  296. package/dist/plugin-sdk/commands/agent/session.d.ts +1 -2
  297. package/dist/plugin-sdk/config/defaults.d.ts +0 -1
  298. package/dist/plugin-sdk/config/sessions/types.d.ts +0 -8
  299. package/dist/plugin-sdk/config/types.agent-defaults.d.ts +28 -112
  300. package/dist/plugin-sdk/config/types.agents.d.ts +8 -0
  301. package/dist/plugin-sdk/config/types.messages.d.ts +1 -2
  302. package/dist/plugin-sdk/config/types.tools.d.ts +1 -1
  303. package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +9 -66
  304. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +5 -13
  305. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +12 -76
  306. package/dist/plugin-sdk/config/zod-schema.d.ts +12 -76
  307. package/dist/plugin-sdk/daemon/constants.d.ts +2 -2
  308. package/dist/plugin-sdk/gateway/protocol/index.d.ts +1 -3
  309. package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +0 -2
  310. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +0 -2
  311. package/dist/plugin-sdk/index.js +108 -134
  312. package/dist/plugin-sdk/middleware/auth-key-retry.d.ts +32 -0
  313. package/dist/plugin-sdk/middleware/channel-bridge.d.ts +4 -0
  314. package/dist/plugin-sdk/middleware/error-classifier.d.ts +5 -0
  315. package/dist/plugin-sdk/middleware/media-resolver.d.ts +12 -0
  316. package/dist/plugin-sdk/middleware/runtime-factory.d.ts +42 -0
  317. package/dist/plugin-sdk/middleware/types.d.ts +33 -1
  318. package/dist/plugin-sdk/plugins/types.d.ts +1 -1
  319. package/dist/plugin-sdk/terminal/palette.d.ts +2 -2
  320. package/dist/plugins-B4waLB_f.js +453 -0
  321. package/dist/plugins-D6-JJ1il.js +455 -0
  322. package/dist/plugins-cli-DG2zHgdP.js +799 -0
  323. package/dist/plugins-cli-DZvQzkWd.js +794 -0
  324. package/dist/ports-BcTKFlWl.js +96 -0
  325. package/dist/ports-DAc2AlZE.js +316 -0
  326. package/dist/ports-HiuYk3bt.js +96 -0
  327. package/dist/ports-dEePqmCq.js +370 -0
  328. package/dist/program-CX-EtQ9W.js +245 -0
  329. package/dist/program-context-R3wsjl2f.js +474 -0
  330. package/dist/progress-DQ1drugY.js +124 -0
  331. package/dist/prompt-edYTUtju.js +21 -0
  332. package/dist/prompt-select-styled-BzL7v1zQ.js +1647 -0
  333. package/dist/prompt-select-styled-g5q4srtu.js +1650 -0
  334. package/dist/prompt-style-CYEpbwXH.js +9 -0
  335. package/dist/provider-dispatcher-D7qFGoUR.js +660 -0
  336. package/dist/provider-dispatcher-dB_rm6tV.js +659 -0
  337. package/dist/push-apns-DQwR-i4_.js +713 -0
  338. package/dist/push-apns-Dj5RApCY.js +711 -0
  339. package/dist/pw-ai-DOQMJFB-.js +1911 -0
  340. package/dist/pw-ai-oqtYDmjQ.js +1907 -0
  341. package/dist/qr-cli-CBGm_Cik.js +353 -0
  342. package/dist/qr-cli-D2jZPdW9.js +348 -0
  343. package/dist/redact-gXuh8MFk.js +191 -0
  344. package/dist/redact-snapshot-B-2V56Yb.js +2016 -0
  345. package/dist/redact-snapshot-CD36XSYE.js +2016 -0
  346. package/dist/register.agent-DLSuiqWE.js +287 -0
  347. package/dist/register.agent-DcvEt3hG.js +1044 -0
  348. package/dist/register.configure-3edoYZai.js +131 -0
  349. package/dist/register.configure-CyOJCmnY.js +125 -0
  350. package/dist/register.import-Cku0T-PA.js +31 -0
  351. package/dist/register.import-Dr8TiUVx.js +28 -0
  352. package/dist/register.maintenance-5aaPQbJk.js +495 -0
  353. package/dist/register.maintenance-DPSswZDJ.js +498 -0
  354. package/dist/register.message-BaSVFv92.js +682 -0
  355. package/dist/register.message-FEI0RiNN.js +687 -0
  356. package/dist/register.onboard-CO1UZL-9.js +258 -0
  357. package/dist/register.onboard-DuLKxjXl.js +263 -0
  358. package/dist/register.setup-CFYYd_Ev.js +115 -0
  359. package/dist/register.setup-P0UHDBMS.js +110 -0
  360. package/dist/register.status-health-sessions-D_3vm2yw.js +424 -0
  361. package/dist/register.status-health-sessions-z9x79dmg.js +665 -0
  362. package/dist/register.subclis-B-d970d6.js +267 -0
  363. package/dist/replies-BvarRpHb.js +136 -0
  364. package/dist/replies-CSzm5168.js +136 -0
  365. package/dist/reply-CTgksTO1.js +13695 -0
  366. package/dist/reply-CUyafs4J.js +13692 -0
  367. package/dist/reply-directives-Caq4zVTg.js +182 -0
  368. package/dist/reply-directives-D91fapDF.js +182 -0
  369. package/dist/reply-payloads-te0YnESs.js +527 -0
  370. package/dist/reply-prefix-Bv8Mv9q8.js +37 -0
  371. package/dist/reply-prefix-Rk_UEaJa.js +37 -0
  372. package/dist/resolve-route-BPa6q23t.js +249 -0
  373. package/dist/resolve-route-CN9BEALz.js +249 -0
  374. package/dist/response-prefix-template-D-ptXREi.js +134 -0
  375. package/dist/response-prefix-template-Dckjdftg.js +134 -0
  376. package/dist/retry-BcZuGfnV.js +77 -0
  377. package/dist/retry-BzWBtFpP.js +77 -0
  378. package/dist/run-main-BugUkGES.js +303 -0
  379. package/dist/runner-CVMXkHe9.js +2295 -0
  380. package/dist/runner-DOWTBU0-.js +2295 -0
  381. package/dist/runtime-guard-CXt4yzo-.js +60 -0
  382. package/dist/secure-random-CBwDBdj1.js +44 -0
  383. package/dist/security-cli-BQzdzJUp.js +479 -0
  384. package/dist/security-cli-D2d8RvsT.js +485 -0
  385. package/dist/send-B3G3I3II.js +349 -0
  386. package/dist/send-B6IB6ELR.js +547 -0
  387. package/dist/send-BT8XEvZB.js +332 -0
  388. package/dist/send-BTupAHVX.js +2245 -0
  389. package/dist/send-BZCfto_I.js +1174 -0
  390. package/dist/send-C5EDjThR.js +492 -0
  391. package/dist/send-CBM54hgN.js +349 -0
  392. package/dist/send-CPBd6ItT.js +29 -0
  393. package/dist/send-CzYm7ULP.js +2245 -0
  394. package/dist/send-D2m_x8xM.js +374 -0
  395. package/dist/send-DmEBPE2S.js +1779 -0
  396. package/dist/send-Dt4iCx61.js +426 -0
  397. package/dist/send-MWjpLHEV.js +11 -0
  398. package/dist/send-qpwqt34s.js +547 -0
  399. package/dist/send-rW25uKNz.js +1776 -0
  400. package/dist/send-uqa6CNuP.js +492 -0
  401. package/dist/server-BhmYVCED.js +201 -0
  402. package/dist/server-DaUw1o2B.js +206 -0
  403. package/dist/server-lifecycle-BeZsBQwF.js +2437 -0
  404. package/dist/server-lifecycle-C2F1_TE2.js +2437 -0
  405. package/dist/server-node-events-DoRFbKCT.js +390 -0
  406. package/dist/server-node-events-jbbbt-4R.js +395 -0
  407. package/dist/service-BDt-zUvV.js +670 -0
  408. package/dist/service-Os7W1F2S.js +670 -0
  409. package/dist/session-B9KGKVrY.js +170 -0
  410. package/dist/session-DzAupDyj.js +170 -0
  411. package/dist/session-cost-usage-BYCI739a.js +627 -0
  412. package/dist/session-cost-usage-DGsPcuMj.js +627 -0
  413. package/dist/session-dirs-BIg5RHAh.js +947 -0
  414. package/dist/session-dirs-DwDxjK1p.js +947 -0
  415. package/dist/session-utils-BgWDCbyx.js +622 -0
  416. package/dist/session-utils-CxxOeC1M.js +622 -0
  417. package/dist/sessions-Bwu0l_CG.js +2569 -0
  418. package/dist/sessions-CiuFFCnt.js +247 -0
  419. package/dist/shell-env-CsV_IkJj.js +163 -0
  420. package/dist/shell-env-hZW9j-Uc.js +163 -0
  421. package/dist/ssrf-B-rF_tZB.js +183 -0
  422. package/dist/ssrf-D6fl_7ww.js +183 -0
  423. package/dist/status-BOFm7iyj.js +2065 -0
  424. package/dist/status-RI2y_M21.js +2061 -0
  425. package/dist/status.update-DbO7izip.js +79 -0
  426. package/dist/status.update-wXyvcztI.js +79 -0
  427. package/dist/store-BLGrRL_E.js +64 -0
  428. package/dist/store-BYhcsOLr.js +64 -0
  429. package/dist/store-Dv76bGHg.js +2571 -0
  430. package/dist/store-Dw93tSB-.js +53 -0
  431. package/dist/subagent-registry-DWL-tayF.js +4856 -0
  432. package/dist/subagent-registry-HjR1tO3-.js +4854 -0
  433. package/dist/subsystem-BCkt9Ocb.js +1079 -0
  434. package/dist/subsystem-BgxIzx7w.js +1137 -0
  435. package/dist/system-cli-DtrDDmCt.js +71 -0
  436. package/dist/system-cli-xDr_Yyaa.js +76 -0
  437. package/dist/systemd-BlbIQ1PV.js +547 -0
  438. package/dist/systemd-DzXePo7r.js +547 -0
  439. package/dist/systemd-linger-mLbBF4pa.js +75 -0
  440. package/dist/systemd-linger-qlGGW2JB.js +75 -0
  441. package/dist/table-V_9n7CjP.js +279 -0
  442. package/dist/tables-Cy3gObW7.js +55 -0
  443. package/dist/tables-DAuk-Y6F.js +55 -0
  444. package/dist/tables-DRh09aPZ.js +55 -0
  445. package/dist/tailnet-BoTa0e2q.js +40 -0
  446. package/dist/tailnet-Cy0Q27lj.js +40 -0
  447. package/dist/tailscale-CiWkh0vS.js +230 -0
  448. package/dist/tailscale-Driw3j8E.js +230 -0
  449. package/dist/targets-3hewwPvM.js +120 -0
  450. package/dist/targets-Bkw_co-B.js +220 -0
  451. package/dist/targets-C1Tt0ZWd.js +2406 -0
  452. package/dist/targets-CsrqF2M4.js +650 -0
  453. package/dist/targets-DKriCISG.js +53 -0
  454. package/dist/targets-DTM2OPnS.js +650 -0
  455. package/dist/targets-DhhaK2xG.js +53 -0
  456. package/dist/targets-tDrl_ioQ.js +46 -0
  457. package/dist/targets-yq1kGK1_.js +2407 -0
  458. package/dist/thinking-XA5P_zFw.js +88 -0
  459. package/dist/thinking-l-rrvZwu.js +88 -0
  460. package/dist/tokens-7ZtWRjA3.js +21 -0
  461. package/dist/tool-display-AxpSXZVq.js +785 -0
  462. package/dist/tool-display-D6GD-41Y.js +785 -0
  463. package/dist/tool-images-D16vIWPg.js +263 -0
  464. package/dist/tool-images-IVIZ29ID.js +263 -0
  465. package/dist/trash--8b4GDyV.js +125 -0
  466. package/dist/trash-ivbG2QWV.js +125 -0
  467. package/dist/tui-Cbe1EW-B.js +3319 -0
  468. package/dist/tui-Dj3XrTCV.js +3319 -0
  469. package/dist/tui-cli-EGqEcdfE.js +64 -0
  470. package/dist/tui-cli-KKmqnNs2.js +59 -0
  471. package/dist/update-DruVguh4.js +349 -0
  472. package/dist/update-cli-C5tdQeGG.js +1371 -0
  473. package/dist/update-cli-Canq11sh.js +1374 -0
  474. package/dist/update-y8nz-3OC.js +349 -0
  475. package/dist/usage-CAuX4vsd.js +5384 -0
  476. package/dist/utils-C5daYcFn.js +631 -0
  477. package/dist/web-B9gR_cGR.js +3071 -0
  478. package/dist/web-DZ8ahrhK.js +77 -0
  479. package/dist/web-DkYPsnyd.js +71 -0
  480. package/dist/webhooks-cli-DFqGwW1f.js +329 -0
  481. package/dist/webhooks-cli-y-E-q0Xo.js +334 -0
  482. package/dist/whatsapp-actions-BXIe-Uei.js +123 -0
  483. package/dist/whatsapp-actions-BictxOCB.js +129 -0
  484. package/dist/widearea-dns-fHQt5-Q3.js +127 -0
  485. package/dist/workspace-DvbSDgO_.js +449 -0
  486. package/dist/workspace-zLfKNRwR.js +447 -0
  487. package/dist/zod-schema-B9RGngMW.js +2696 -0
  488. package/dist/zod-schema-D3hQ5SKe.js +2696 -0
  489. package/extensions/matrix/src/matrix/monitor/replies.ts +0 -24
  490. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +0 -1
  491. package/package.json +3 -3
  492. package/dist/accounts-BFy_Z3od.js +0 -272
  493. package/dist/accounts-BTXSfPWi.js +0 -270
  494. package/dist/accounts-BxGS70Do.js +0 -36
  495. package/dist/accounts-CNY1TGj1.js +0 -47
  496. package/dist/accounts-DBohBlww.js +0 -32
  497. package/dist/accounts-DqRQ75w3.js +0 -36
  498. package/dist/accounts-iODF3SK2.js +0 -47
  499. package/dist/ack-reactions-B11TAC2D.js +0 -446
  500. package/dist/ack-reactions-BWVjL4H6.js +0 -446
  501. package/dist/acp-cli-CA1xMmVo.js +0 -1320
  502. package/dist/acp-cli-CGo6fJVZ.js +0 -1326
  503. package/dist/active-listener-VzhWW8W6.js +0 -37
  504. package/dist/active-listener-z0qVEcom.js +0 -37
  505. package/dist/agent-CTizRPIJ.js +0 -732
  506. package/dist/agent-D2RVoS5g.js +0 -731
  507. package/dist/agent-helpers-B6VfZ9_u.js +0 -606
  508. package/dist/agent-helpers-CTx5KKJu.js +0 -606
  509. package/dist/agent-scope-BGYzhtWQ.js +0 -121
  510. package/dist/agent-scope-C50VuLKh.js +0 -119
  511. package/dist/agents-BuYn-obw.js +0 -788
  512. package/dist/agents.config-BSTxuTVd.js +0 -116
  513. package/dist/agents.config-p3V3b9u6.js +0 -116
  514. package/dist/audio-DPOuhNq7.js +0 -43
  515. package/dist/audio-VBcVDa08.js +0 -43
  516. package/dist/audio-preflight-BwmCYeuM.js +0 -64
  517. package/dist/audio-preflight-co8gjlPX.js +0 -69
  518. package/dist/audit-oH4urD3G.js +0 -3138
  519. package/dist/audit-qgtCT3ik.js +0 -3138
  520. package/dist/auth-CAczFgAO.js +0 -448
  521. package/dist/auth-Deh9i9Eg.js +0 -448
  522. package/dist/auth-profiles-BquJGKLC.js +0 -279
  523. package/dist/auth-profiles-D8vKiBPq.js +0 -281
  524. package/dist/banner-Cf978khN.js +0 -294
  525. package/dist/binaries-DXW6oATV.js +0 -13
  526. package/dist/bindings-CRU_udk8.js +0 -69
  527. package/dist/bindings-DQZAu8Wv.js +0 -69
  528. package/dist/bonjour-discovery-DdAk1VyO.js +0 -378
  529. package/dist/bonjour-discovery-DuhiIZZx.js +0 -378
  530. package/dist/browser-cli-CZC4h5V4.js +0 -1687
  531. package/dist/browser-cli-DAgi_aQk.js +0 -1692
  532. package/dist/call-BbwtB9Y-.js +0 -2828
  533. package/dist/call-PivL7Uex.js +0 -2829
  534. package/dist/catalog-BqO6yem_.js +0 -185
  535. package/dist/catalog-DFmaYwfk.js +0 -185
  536. package/dist/channel-account-context-CvIDAtHS.js +0 -550
  537. package/dist/channel-account-context-q-o0pG1A.js +0 -550
  538. package/dist/channel-activity-BaCNOZpP.js +0 -94
  539. package/dist/channel-activity-C-G4n9BK.js +0 -292
  540. package/dist/channel-activity-DTKGf3j5.js +0 -94
  541. package/dist/channel-options-Cyappik_.js +0 -32
  542. package/dist/channel-options-DFnypY5S.js +0 -33
  543. package/dist/channel-selection-BGl53D5K.js +0 -51
  544. package/dist/channel-selection-NNPbxnyZ.js +0 -51
  545. package/dist/channel-web-DmhVkWbP.js +0 -2134
  546. package/dist/channel-web-kRC3UYBJ.js +0 -2136
  547. package/dist/channels-cli-C5XRkPJl.js +0 -1421
  548. package/dist/channels-cli-D6TqCI0m.js +0 -1426
  549. package/dist/channels-status-issues-CUc9mpeW.js +0 -18
  550. package/dist/channels-status-issues-DwRDzwrV.js +0 -18
  551. package/dist/chat-envelope-DEZ-5RY8.js +0 -248
  552. package/dist/chat-envelope-el7Uo-Fe.js +0 -248
  553. package/dist/chrome-0QaGKb3L.js +0 -1732
  554. package/dist/chrome-CFeWdP0Y.js +0 -1733
  555. package/dist/chunk-CSQfUhgF.js +0 -341
  556. package/dist/chunk-D0Y_w4oX.js +0 -341
  557. package/dist/clack-prompter-B7tOxhJd.js +0 -122
  558. package/dist/clack-prompter-CCFnKP_1.js +0 -121
  559. package/dist/cleanup-utils-CqAVZz2b.js +0 -94
  560. package/dist/cli-BR2J3c4l.js +0 -125
  561. package/dist/cli-C1q1vSmN.js +0 -130
  562. package/dist/clipboard-D7_SKHPK.js +0 -31
  563. package/dist/clipboard-Dzkx6Q2K.js +0 -31
  564. package/dist/command-format-CVfo8I5f.js +0 -18
  565. package/dist/command-format-DgXcqxBt.js +0 -32
  566. package/dist/command-registry-CYjvOp8W.js +0 -215
  567. package/dist/commands-CDonBOrw.js +0 -41
  568. package/dist/commands-D_-bgTlO.js +0 -41
  569. package/dist/commands-registry-CWJv6xe2.js +0 -892
  570. package/dist/commands-registry-Ci8_cFk9.js +0 -893
  571. package/dist/common-CMI-qsF8.js +0 -156
  572. package/dist/common-DSVmydhm.js +0 -156
  573. package/dist/completion-cli-8iZJqfmX.js +0 -452
  574. package/dist/completion-cli-CYDjEZSt.js +0 -452
  575. package/dist/config-D5XU45KD.js +0 -6953
  576. package/dist/config-FHu9Bn4R.js +0 -6951
  577. package/dist/config-cli-Gehy4sav.js +0 -241
  578. package/dist/config-cli-RC9qMgJq.js +0 -246
  579. package/dist/config-guard-J-Q_DFWk.js +0 -97
  580. package/dist/config-guard-cB5a_ANg.js +0 -75
  581. package/dist/config-validation-BPNyd9_3.js +0 -18
  582. package/dist/config-validation-BPWuvhVe.js +0 -18
  583. package/dist/configure-CC2XdRRm.js +0 -891
  584. package/dist/configure-DxFBJuhZ.js +0 -889
  585. package/dist/constants-BmRFoHl0.js +0 -67
  586. package/dist/constants-C9WPAluB.js +0 -67
  587. package/dist/control-auth-D0tpV3ts.js +0 -397
  588. package/dist/control-auth-_-0PGRUs.js +0 -397
  589. package/dist/control-ui/assets/index-B4ZM1lW1.js +0 -7738
  590. package/dist/control-ui/assets/index-B4ZM1lW1.js.map +0 -1
  591. package/dist/control-ui/assets/index-PED72sKF.css +0 -1
  592. package/dist/control-ui-assets-Cx_mw4D0.js +0 -186
  593. package/dist/control-ui-assets-W1AUuGrO.js +0 -186
  594. package/dist/conversation-label-C4SDz4sT.js +0 -36
  595. package/dist/conversation-label-D1frnvYe.js +0 -36
  596. package/dist/cron-cli-BzERxhr5.js +0 -495
  597. package/dist/cron-cli-C8j_uslU.js +0 -490
  598. package/dist/daemon-cli-C95XNbX0.js +0 -1199
  599. package/dist/daemon-cli-e6sURMqd.js +0 -1197
  600. package/dist/daemon-install-CcohRvKV.js +0 -55
  601. package/dist/daemon-install-DDshfT0J.js +0 -60
  602. package/dist/daemon-install-helpers-CFGAfRlj.js +0 -462
  603. package/dist/daemon-install-helpers-DIUzSFG1.js +0 -462
  604. package/dist/defaults-B5KStIBg.js +0 -7
  605. package/dist/defaults-xUAL2Z-F.js +0 -7
  606. package/dist/deliver-912khjLK.js +0 -481
  607. package/dist/deliver-D56J4-1F.js +0 -481
  608. package/dist/delivery-queue-Cfa9Wmxp.js +0 -244
  609. package/dist/delivery-queue-CxVRi4tw.js +0 -244
  610. package/dist/devices-cli-0qDhTgZR.js +0 -316
  611. package/dist/devices-cli-6SKMR2bV.js +0 -321
  612. package/dist/diagnostics-99iCgBUh.js +0 -46
  613. package/dist/diagnostics-VC0cz7kX.js +0 -46
  614. package/dist/directory-cli-5YXdoVdn.js +0 -217
  615. package/dist/directory-cli-D3IKCHmn.js +0 -222
  616. package/dist/dm-policy-shared-4rkjhcrM.js +0 -22
  617. package/dist/dm-policy-shared-D8lgnmrC.js +0 -22
  618. package/dist/dns-cli-11CtErVU.js +0 -197
  619. package/dist/dns-cli-SiEd_1Lq.js +0 -202
  620. package/dist/dock-BqNINg7k.js +0 -928
  621. package/dist/dock-CQuu41bw.js +0 -929
  622. package/dist/doctor-completion-BR1SlAT3.js +0 -92
  623. package/dist/doctor-completion-CZwpEhIK.js +0 -92
  624. package/dist/doctor-config-flow-BVkHcvoj.js +0 -1933
  625. package/dist/doctor-config-flow-DVYRn0An.js +0 -1934
  626. package/dist/enable-DcJnkzfz.js +0 -59
  627. package/dist/enable-ibNq4UWy.js +0 -59
  628. package/dist/env-DeF64iu0.js +0 -60
  629. package/dist/env-vars-7aZqKPhk.js +0 -93
  630. package/dist/errors-8F-77i6m.js +0 -35
  631. package/dist/errors-DZ199hOo.js +0 -35
  632. package/dist/exec-DbKuYyM1.js +0 -164
  633. package/dist/exec-DkFE7lqU.js +0 -164
  634. package/dist/fetch-BFSBLBkA.js +0 -67
  635. package/dist/fetch-C6XKGA11.js +0 -67
  636. package/dist/fetch-CEDsOiql.js +0 -67
  637. package/dist/file-lock-CIvloidc.js +0 -107
  638. package/dist/file-lock-CzBL_VIx.js +0 -107
  639. package/dist/fs-safe-DSwT85uK.js +0 -88
  640. package/dist/fs-safe-DkBhNAc3.js +0 -98
  641. package/dist/gateway-cli-BEEZhCHv.js +0 -23747
  642. package/dist/gateway-cli-Nob0g_4y.js +0 -23742
  643. package/dist/gateway-rpc-CksB-N83.js +0 -28
  644. package/dist/gateway-rpc-Dq44SkOv.js +0 -28
  645. package/dist/gmail-setup-utils-Cnx8A5pW.js +0 -422
  646. package/dist/gmail-setup-utils-nkabbKOE.js +0 -423
  647. package/dist/health-RT-F3hzT.js +0 -1423
  648. package/dist/health-SOuaKNRa.js +0 -1420
  649. package/dist/health-format-BG95OE6N.js +0 -28
  650. package/dist/heartbeat-visibility-BxkZjE5m.js +0 -125
  651. package/dist/heartbeat-visibility-CGG-G7px.js +0 -125
  652. package/dist/help-format-DAxf0l_h.js +0 -17
  653. package/dist/helpers-kkeXif0Q.js +0 -10
  654. package/dist/hook-runner-global-DJ14gXFP.js +0 -527
  655. package/dist/hooks-cli-DyEKryW8.js +0 -1217
  656. package/dist/hooks-cli-RuEn0-oy.js +0 -1222
  657. package/dist/image-ops-Bi6JPSkD.js +0 -354
  658. package/dist/image-ops-DWytvdh_.js +0 -354
  659. package/dist/import-D8BBZQgl.js +0 -170
  660. package/dist/import-DQ6NI4Fz.js +0 -168
  661. package/dist/inbound-context-CPkkQW0i.js +0 -68
  662. package/dist/inbound-context-DS_kpIYI.js +0 -68
  663. package/dist/inbound-path-policy-Bg4gZBx-.js +0 -250
  664. package/dist/inbound-path-policy-sdr5Ji0k.js +0 -250
  665. package/dist/inspect-Dt8hogS3.js +0 -559
  666. package/dist/inspect-vYIL1oA0.js +0 -559
  667. package/dist/installs-aM5dWAyn.js +0 -325
  668. package/dist/installs-pWdqG8HL.js +0 -325
  669. package/dist/ipv4--2WXMVtE.js +0 -46
  670. package/dist/ipv4-CDQpx1A7.js +0 -46
  671. package/dist/ir-BpaAMTfW.js +0 -940
  672. package/dist/json-files-DzpTak5i.js +0 -46
  673. package/dist/links-C3soDNDH.js +0 -15
  674. package/dist/loader-Ccwsh8Sh.js +0 -22624
  675. package/dist/loader-y9MhJewT.js +0 -22621
  676. package/dist/local-roots-BrH0Q63K.js +0 -313
  677. package/dist/local-roots-nImrw2WR.js +0 -314
  678. package/dist/logger-Bw3cFE5t.js +0 -49
  679. package/dist/logging-C-nxX2fn.js +0 -20
  680. package/dist/login-C_Kt57nO.js +0 -62
  681. package/dist/login-DOmWDMeP.js +0 -61
  682. package/dist/login-qr-CXU0wC5K.js +0 -322
  683. package/dist/login-qr-D0u6fdeO.js +0 -327
  684. package/dist/logs-cli-CschwP4d.js +0 -238
  685. package/dist/logs-cli-D7ayUvz_.js +0 -233
  686. package/dist/markdown-tables-CrmghPAr.js +0 -29
  687. package/dist/markdown-tables-jrnSPvZ6.js +0 -29
  688. package/dist/media-CojxZ45J.js +0 -10492
  689. package/dist/media-DN7yRfrH.js +0 -940
  690. package/dist/message-action-names-CtEZcmlU.js +0 -2521
  691. package/dist/message-action-names-WglOO_DT.js +0 -2521
  692. package/dist/message-channel-DzJqHVZD.js +0 -91
  693. package/dist/net-Cg8AQeke.js +0 -225
  694. package/dist/net-D6D0wgcF.js +0 -225
  695. package/dist/node-cli-Q2-n3Fgv.js +0 -24
  696. package/dist/nodes-cli-C2SoKfCv.js +0 -1343
  697. package/dist/nodes-cli-CQmlfx0K.js +0 -1348
  698. package/dist/nodes-screen-BR9sYoPa.js +0 -250
  699. package/dist/nodes-screen-Cw7Hv7M2.js +0 -250
  700. package/dist/note-Dlv4NmlQ.js +0 -92
  701. package/dist/note-kvWV4xtw.js +0 -92
  702. package/dist/npm-registry-spec-0qiKawvv.js +0 -786
  703. package/dist/npm-registry-spec-COvUzy5J.js +0 -786
  704. package/dist/npm-resolution-6v_Zm-9G.js +0 -86
  705. package/dist/npm-resolution-BFz7LeoN.js +0 -86
  706. package/dist/onboard-CgyU-mDL.js +0 -407
  707. package/dist/onboard-RI4vNTZd.js +0 -405
  708. package/dist/onboard-channels-DN5JoKPd.js +0 -2548
  709. package/dist/onboard-channels-DyAd1OZr.js +0 -2547
  710. package/dist/onboard-config-BCTthQ7J.js +0 -24
  711. package/dist/onboard-config-y-2cgT0V.js +0 -24
  712. package/dist/onboard-helpers-BCzZUD0z.js +0 -363
  713. package/dist/onboard-helpers-sDc2Ky6H.js +0 -362
  714. package/dist/onboard-remote-CJrMtttl.js +0 -127
  715. package/dist/onboard-remote-hyQIBguz.js +0 -127
  716. package/dist/onboarding-DCu1iBTV.js +0 -541
  717. package/dist/onboarding-zKMitzpb.js +0 -543
  718. package/dist/onboarding.finalize-ClHhYE2E.js +0 -401
  719. package/dist/onboarding.finalize-D5JkVJgg.js +0 -398
  720. package/dist/onboarding.gateway-config-DFh71Ndn.js +0 -198
  721. package/dist/onboarding.gateway-config-VBk6AP9U.js +0 -191
  722. package/dist/outbound-BYlZshIw.js +0 -221
  723. package/dist/outbound-CFfJC1j5.js +0 -220
  724. package/dist/outbound-attachment-BCNs1u1F.js +0 -18
  725. package/dist/outbound-attachment-B_0D60Yr.js +0 -18
  726. package/dist/outbound-attachment-o0seS0CP.js +0 -18
  727. package/dist/pairing-cli-BeydfoF9.js +0 -122
  728. package/dist/pairing-cli-DWzX866x.js +0 -127
  729. package/dist/pairing-labels-B-N8S5Fc.js +0 -9
  730. package/dist/pairing-labels-B_53dY5L.js +0 -9
  731. package/dist/pairing-store-BxdqFZGK.js +0 -460
  732. package/dist/pairing-store-CTkD51uW.js +0 -459
  733. package/dist/path-env-DR5vn3QL.js +0 -89
  734. package/dist/path-env-qRJbjJzj.js +0 -89
  735. package/dist/path-safety-DkT9RmTG.js +0 -14
  736. package/dist/path-safety-juI2XbO1.js +0 -14
  737. package/dist/plugin-auto-enable-D23gv7Aw.js +0 -302
  738. package/dist/plugin-auto-enable-DuPS9XiJ.js +0 -301
  739. package/dist/plugin-registry-CNu_1KZz.js +0 -33
  740. package/dist/plugin-registry-DeHwd2jk.js +0 -33
  741. package/dist/plugin-sdk/agents/agent-helpers/thinking.d.ts +0 -5
  742. package/dist/plugin-sdk/agents/auth-profiles/constants.d.ts +0 -16
  743. package/dist/plugin-sdk/agents/auth-profiles/display.d.ts +0 -7
  744. package/dist/plugin-sdk/agents/auth-profiles/doctor.d.ts +0 -8
  745. package/dist/plugin-sdk/agents/auth-profiles/oauth.d.ts +0 -14
  746. package/dist/plugin-sdk/agents/auth-profiles/session-override.d.ts +0 -18
  747. package/dist/plugin-sdk/agents/auth-profiles.d.ts +0 -8
  748. package/dist/plugin-sdk/agents/defaults.d.ts +0 -3
  749. package/dist/plugin-sdk/agents/provider-auth.d.ts +0 -40
  750. package/dist/plugin-sdk/auto-reply/model-runtime.d.ts +0 -17
  751. package/dist/plugin-sdk/config/model-input.d.ts +0 -9
  752. package/dist/plugin-sdk/config/zod-schema.agent-model.d.ts +0 -5
  753. package/dist/plugin-sdk/sessions/model-overrides.d.ts +0 -14
  754. package/dist/plugin-sdk/telegram/reasoning-lane-coordinator.d.ts +0 -18
  755. package/dist/plugins-BflZz0sp.js +0 -453
  756. package/dist/plugins-cli-DV82scUw.js +0 -798
  757. package/dist/plugins-cli-Qj1UyIZO.js +0 -793
  758. package/dist/plugins-woGRXMzU.js +0 -455
  759. package/dist/ports-DrruB2fK.js +0 -370
  760. package/dist/ports-GT1yV-Tg.js +0 -96
  761. package/dist/ports-NPqtlfp0.js +0 -316
  762. package/dist/ports-QMI4-F9m.js +0 -96
  763. package/dist/program-CQmIaRUI.js +0 -244
  764. package/dist/program-context-DEU6ACnL.js +0 -474
  765. package/dist/progress-CBkSaM6z.js +0 -124
  766. package/dist/prompt-Bllj1dhc.js +0 -21
  767. package/dist/prompt-select-styled-BhTN6zE2.js +0 -1650
  768. package/dist/prompt-select-styled-WopXnjIy.js +0 -1647
  769. package/dist/prompt-style-DVEm3BZW.js +0 -9
  770. package/dist/provider-dispatcher-B4QMe-I6.js +0 -659
  771. package/dist/provider-dispatcher-Bfauw6zz.js +0 -660
  772. package/dist/push-apns-C0LyG-WB.js +0 -713
  773. package/dist/push-apns-DuG95AKC.js +0 -711
  774. package/dist/pw-ai-D9n6-Wa6.js +0 -1906
  775. package/dist/pw-ai-T280E6Mn.js +0 -1910
  776. package/dist/qr-cli-DVECWTHN.js +0 -352
  777. package/dist/qr-cli-hSLixZCe.js +0 -347
  778. package/dist/redact-eZq1uwNK.js +0 -191
  779. package/dist/redact-snapshot-BZYLIqe-.js +0 -2028
  780. package/dist/redact-snapshot-C6hVx_9I.js +0 -2028
  781. package/dist/register.agent-Dmj-sgEl.js +0 -1043
  782. package/dist/register.agent-IspcBFeD.js +0 -286
  783. package/dist/register.configure-BqJEqyGL.js +0 -130
  784. package/dist/register.configure-PPkU_4Ea.js +0 -124
  785. package/dist/register.import-Bs-UkOs-.js +0 -27
  786. package/dist/register.import-DLng8g-e.js +0 -30
  787. package/dist/register.maintenance-BbpkJil3.js +0 -497
  788. package/dist/register.maintenance-C5nkOQxa.js +0 -494
  789. package/dist/register.message-C83Hi1b3.js +0 -681
  790. package/dist/register.message-D16isu4u.js +0 -686
  791. package/dist/register.onboard-B8EzX3wY.js +0 -257
  792. package/dist/register.onboard-CyRbr_0V.js +0 -262
  793. package/dist/register.setup-DWyoowAz.js +0 -109
  794. package/dist/register.setup-Dz6GwMnu.js +0 -114
  795. package/dist/register.status-health-sessions-CbQOfycz.js +0 -423
  796. package/dist/register.status-health-sessions-DXIWG47y.js +0 -669
  797. package/dist/register.subclis-DeGP5UPU.js +0 -267
  798. package/dist/replies-BKrzM0QI.js +0 -136
  799. package/dist/replies-Cl2gYBVt.js +0 -136
  800. package/dist/reply-CCu_DY64.js +0 -13900
  801. package/dist/reply-DSKC8kyS.js +0 -13897
  802. package/dist/reply-directives-BHJKp1Du.js +0 -182
  803. package/dist/reply-directives-CD2WycBM.js +0 -182
  804. package/dist/reply-payloads-D_BM1Anb.js +0 -527
  805. package/dist/reply-prefix-DBLCYiup.js +0 -38
  806. package/dist/reply-prefix-Q4DOJSn_.js +0 -38
  807. package/dist/resolve-route-CBVbY0xS.js +0 -249
  808. package/dist/resolve-route-DGEgTEif.js +0 -249
  809. package/dist/response-prefix-template-rVZQOViK.js +0 -136
  810. package/dist/response-prefix-template-up4REfuR.js +0 -136
  811. package/dist/retry-BhuXOEVR.js +0 -77
  812. package/dist/retry-DUjAzOBy.js +0 -77
  813. package/dist/run-main-Um5xhxla.js +0 -320
  814. package/dist/runner-yVJ4HB2K.js +0 -2294
  815. package/dist/runner-z92MWZ3m.js +0 -2294
  816. package/dist/runtime-guard-DZ_xuCc4.js +0 -60
  817. package/dist/secure-random-Pl9rPl0l.js +0 -44
  818. package/dist/security-cli-CdwbWZUj.js +0 -484
  819. package/dist/security-cli-DP5QJpa5.js +0 -478
  820. package/dist/send-B1_Ymjb9.js +0 -1778
  821. package/dist/send-B84axiIa.js +0 -29
  822. package/dist/send-BN_zYVlx.js +0 -547
  823. package/dist/send-BqVOxAmK.js +0 -1174
  824. package/dist/send-Bx9bUGav.js +0 -492
  825. package/dist/send-C3pdJ6p-.js +0 -2245
  826. package/dist/send-CBGSXjfD.js +0 -2245
  827. package/dist/send-CGXyTF22.js +0 -426
  828. package/dist/send-CKavrhXj.js +0 -11
  829. package/dist/send-D08Je6DL.js +0 -374
  830. package/dist/send-D1aYEG-k.js +0 -332
  831. package/dist/send-DHldI3gf.js +0 -492
  832. package/dist/send-D_DUQJ6H.js +0 -349
  833. package/dist/send-Ds63eF4a.js +0 -349
  834. package/dist/send-YRVDWfSs.js +0 -547
  835. package/dist/send-xnwty9cY.js +0 -1775
  836. package/dist/server-BQFoyCRR.js +0 -200
  837. package/dist/server-DhXw25Jq.js +0 -205
  838. package/dist/server-lifecycle-BjCCyD3w.js +0 -2437
  839. package/dist/server-lifecycle-Coyr6Lda.js +0 -2437
  840. package/dist/server-node-events-De4WZQQD.js +0 -393
  841. package/dist/server-node-events-dXXayuqY.js +0 -398
  842. package/dist/service-Bjqii5nW.js +0 -670
  843. package/dist/service-fp29z5Ww.js +0 -670
  844. package/dist/session-DBL5nHDy.js +0 -170
  845. package/dist/session-cost-usage-DX09eTPU.js +0 -627
  846. package/dist/session-cost-usage-yYi525j3.js +0 -627
  847. package/dist/session-dirs-Cj5xi7zX.js +0 -947
  848. package/dist/session-dirs-DdF6TDsE.js +0 -947
  849. package/dist/session-utils-CEtEq6bi.js +0 -625
  850. package/dist/session-utils-WmlWAs1r.js +0 -625
  851. package/dist/session-xKIW6gL2.js +0 -170
  852. package/dist/sessions--PykPynp.js +0 -2593
  853. package/dist/sessions-Bw4LRnSr.js +0 -252
  854. package/dist/ssrf-Ck9HDZpv.js +0 -183
  855. package/dist/ssrf-m7kFIobZ.js +0 -183
  856. package/dist/status-CtzYFLLF.js +0 -2072
  857. package/dist/status-DiN1cq2p.js +0 -2068
  858. package/dist/status.update-C55QM2xs.js +0 -79
  859. package/dist/status.update-CBmPXwYN.js +0 -79
  860. package/dist/store-C3tOpizT.js +0 -64
  861. package/dist/store-CPJXuhvQ.js +0 -53
  862. package/dist/store-SusmIfz7.js +0 -2595
  863. package/dist/store-v3P-OWhi.js +0 -64
  864. package/dist/subagent-registry-Db4Ho_2Y.js +0 -4858
  865. package/dist/subagent-registry-Du_j0Fnt.js +0 -4860
  866. package/dist/subsystem-BUXAJwPD.js +0 -1079
  867. package/dist/subsystem-COd61u0P.js +0 -1139
  868. package/dist/system-cli-DYCpLO3T.js +0 -75
  869. package/dist/system-cli-eAk5wVbP.js +0 -70
  870. package/dist/systemd-DSnlM3jX.js +0 -547
  871. package/dist/systemd-TfK8GuTx.js +0 -547
  872. package/dist/systemd-linger-Axnc1xCb.js +0 -75
  873. package/dist/systemd-linger-_0_-RY4v.js +0 -75
  874. package/dist/table-DPTzZyhu.js +0 -279
  875. package/dist/tables-DI5LGEr1.js +0 -55
  876. package/dist/tables-PxcSPSO0.js +0 -55
  877. package/dist/tables-TWiml6b1.js +0 -55
  878. package/dist/tailnet-CEudzG0i.js +0 -40
  879. package/dist/tailnet-PnMrjwGT.js +0 -40
  880. package/dist/tailscale-DTATQxAG.js +0 -230
  881. package/dist/tailscale-Dbyahx0J.js +0 -230
  882. package/dist/targets-C1NeMn2J.js +0 -220
  883. package/dist/targets-CcTME3bp.js +0 -46
  884. package/dist/targets-CmC5m7Ey.js +0 -53
  885. package/dist/targets-D-u6Kyio.js +0 -650
  886. package/dist/targets-D7OKVXMI.js +0 -650
  887. package/dist/targets-DB4vBpIQ.js +0 -2172
  888. package/dist/targets-DfqPGOmM.js +0 -2173
  889. package/dist/targets-DyybKefq.js +0 -53
  890. package/dist/targets-JCISV-hS.js +0 -120
  891. package/dist/tokens-DzFOtLlW.js +0 -21
  892. package/dist/tool-display-Br6mwaJc.js +0 -785
  893. package/dist/tool-display-sgNwLOBj.js +0 -785
  894. package/dist/tool-images-BNfIJ_Kj.js +0 -263
  895. package/dist/tool-images-kloBqxqK.js +0 -263
  896. package/dist/trash-DPi0aCCQ.js +0 -125
  897. package/dist/trash-D_Jd_yQZ.js +0 -125
  898. package/dist/tui-CHc0EfJO.js +0 -3392
  899. package/dist/tui-CyHwc2uX.js +0 -3392
  900. package/dist/tui-cli-BvwbrIYO.js +0 -63
  901. package/dist/tui-cli-C9I18SfW.js +0 -58
  902. package/dist/update-DxyjwCL2.js +0 -349
  903. package/dist/update-IX7vdqA8.js +0 -349
  904. package/dist/update-cli-CBeXUSzq.js +0 -1373
  905. package/dist/update-cli-DkAWmUrp.js +0 -1370
  906. package/dist/usage-CYlQW4M2.js +0 -5279
  907. package/dist/utils-LBKvDoPx.js +0 -631
  908. package/dist/web-BUYUdnRH.js +0 -3065
  909. package/dist/web-Dquzwqf4.js +0 -70
  910. package/dist/web-tS8diboh.js +0 -76
  911. package/dist/webhooks-cli-B7Vw3CMz.js +0 -333
  912. package/dist/webhooks-cli-BpZHQlVd.js +0 -328
  913. package/dist/whatsapp-actions-D5HXezjp.js +0 -128
  914. package/dist/whatsapp-actions-DaA291Ya.js +0 -122
  915. package/dist/widearea-dns-DSoaA-eH.js +0 -127
  916. package/dist/workspace-B4ZvVYT9.js +0 -447
  917. package/dist/workspace-B8PA8oxJ.js +0 -449
  918. /package/dist/{account-lookup-0KDSp5Mj.js → account-lookup-BOCzCnir.js} +0 -0
  919. /package/dist/{account-lookup-zvANGr2x.js → account-lookup-DGscKBsr.js} +0 -0
  920. /package/dist/{ansi-D04X81yq.js → ansi-aRwLYlzD.js} +0 -0
  921. /package/dist/{api-BeQMq2iS.js → api-BDff51CS.js} +0 -0
  922. /package/dist/{api-CxX8-gGz.js → api-qWSMsT8m.js} +0 -0
  923. /package/dist/{argv-Co-b9Zsc.js → argv-neJY_Hxm.js} +0 -0
  924. /package/dist/{brew-C4zKZsHX.js → brew-ByYl36Mt.js} +0 -0
  925. /package/dist/{brew-DbSbN8sD.js → brew-CMSQ5Fek.js} +0 -0
  926. /package/dist/{chat-type-CYPyHAj-.js → chat-type-BKe459rw.js} +0 -0
  927. /package/dist/{chat-type-DKb2TlGZ.js → chat-type-DyovJwCt.js} +0 -0
  928. /package/dist/{cleanup-utils-CwQvD73q.js → cleanup-utils-S_P5Jebv.js} +0 -0
  929. /package/dist/{cli-name-BicfmwQX.js → cli-name-CRLBidNP.js} +0 -0
  930. /package/dist/{cli-name-C6rJGl18.js → cli-name-Yv30OygA.js} +0 -0
  931. /package/dist/{cli-utils-BhXbz2UF.js → cli-utils-C5nQDfa6.js} +0 -0
  932. /package/dist/{cli-utils-DZe_rVkZ.js → cli-utils-KcEwAsuZ.js} +0 -0
  933. /package/dist/{client-C61M8zI3.js → client-C7B0uFB0.js} +0 -0
  934. /package/dist/{client-DdpmATKq.js → client-Cd2HNUX0.js} +0 -0
  935. /package/dist/{command-options-C4paWSGf.js → command-options-1bi44p_B.js} +0 -0
  936. /package/dist/{command-options-CA30lfLK.js → command-options-7y5Zrv4M.js} +0 -0
  937. /package/dist/{config-eval-CjGZtLwx.js → config-eval-CJtk3Msr.js} +0 -0
  938. /package/dist/{config-eval-H_wlEYIG.js → config-eval-DQIwdWg7.js} +0 -0
  939. /package/dist/{constants-ChptG3d7.js → constants--3PuQVaS.js} +0 -0
  940. /package/dist/{constants-DY6b-_Wl.js → constants-DNWjlxZ5.js} +0 -0
  941. /package/dist/{credentials-BHWUBHMd.js → credentials-BhnauW0K.js} +0 -0
  942. /package/dist/{credentials-DFsi1_e8.js → credentials-eZcqWNG_.js} +0 -0
  943. /package/dist/{daemon-runtime-CMnbwryP.js → daemon-runtime-99xh1fGv.js} +0 -0
  944. /package/dist/{daemon-runtime-CvqE4ysg.js → daemon-runtime-BOcdJaFy.js} +0 -0
  945. /package/dist/{dangerous-name-matching-BzmiLXmA.js → dangerous-name-matching-YeatnYIA.js} +0 -0
  946. /package/dist/{dangerous-name-matching-DaVRgwer.js → dangerous-name-matching-oVb1EqYT.js} +0 -0
  947. /package/dist/{dangerous-tools-BOLoCRv4.js → dangerous-tools-BMt8-6jE.js} +0 -0
  948. /package/dist/{dangerous-tools-Baq7Q-i6.js → dangerous-tools-CripTfYv.js} +0 -0
  949. /package/dist/{fetch-timeout-DTIN7CGM.js → fetch-timeout-Db3da8yR.js} +0 -0
  950. /package/dist/{fetch-timeout-DoySHqfO.js → fetch-timeout-l_6RdoMw.js} +0 -0
  951. /package/dist/{file-identity-BxlKD8Ys.js → file-identity-Bs9zZOi2.js} +0 -0
  952. /package/dist/{format-duration-CqUERz51.js → format-duration-Bo-Mxi3E.js} +0 -0
  953. /package/dist/{format-duration-Ct-yiwkS.js → format-duration-CfrJ5T8k.js} +0 -0
  954. /package/dist/{format-relative-79_Y1n2Y.js → format-relative-8cNYQsqb.js} +0 -0
  955. /package/dist/{format-relative-CxLpEQOX.js → format-relative-CZOlQ2pA.js} +0 -0
  956. /package/dist/{health-format-B_QRD8Si.js → health-format-WMRp1BbP.js} +0 -0
  957. /package/dist/{heartbeat-wake-LGEgcXjs.js → heartbeat-wake-BtRrOB-t.js} +0 -0
  958. /package/dist/{heartbeat-wake-Y97geucO.js → heartbeat-wake-eRINROYK.js} +0 -0
  959. /package/dist/{help-format-NNm_Ov4H.js → help-format-BEb0SPHF.js} +0 -0
  960. /package/dist/{helpers-BAsMXprO.js → helpers-BJtPtu_2.js} +0 -0
  961. /package/dist/{helpers-DLgbkcEn.js → helpers-Cj6f8SPZ.js} +0 -0
  962. /package/dist/{helpers-R7bU5IBz.js → helpers-ryxLx-aM.js} +0 -0
  963. /package/dist/{host-env-security-szwfmhC4.js → host-env-security-CbiODGvQ.js} +0 -0
  964. /package/dist/{input-provenance-Bn6thJNm.js → input-provenance-CPhdY-0F.js} +0 -0
  965. /package/dist/{input-provenance-xUsSMOsz.js → input-provenance-DUNEQoFM.js} +0 -0
  966. /package/dist/{ip-C9q3Oq20.js → ip-BAhS4rY2.js} +0 -0
  967. /package/dist/{ip-D0zgNmBV.js → ip-BcdPcLiP.js} +0 -0
  968. /package/dist/{is-main-DN8-sNR5.js → is-main-KcWqINzy.js} +0 -0
  969. /package/dist/{json-file-ChO_R9yh.js → json-file-BVvmrQG3.js} +0 -0
  970. /package/dist/{json-file-B7l5-Xhr.js → json-file-Dbg7nZg1.js} +0 -0
  971. /package/dist/{json-files-CmpYSF4G.js → json-files-DSKEdz7x.js} +0 -0
  972. /package/dist/{lanes-ByWMUgrz.js → lanes-Brd-nf-Z.js} +0 -0
  973. /package/dist/{lanes-cHJ5arWg.js → lanes-COs3zODW.js} +0 -0
  974. /package/dist/{links-Bz4V7R_p.js → links-gse8sWn-.js} +0 -0
  975. /package/dist/{location-DBWCGNLq.js → location-D1FM_C63.js} +0 -0
  976. /package/dist/{location-GbZ0bBRU.js → location-LuzkqHGi.js} +0 -0
  977. /package/dist/{logger-DyL5G2DO.js → logger-BMP_j_Lx.js} +0 -0
  978. /package/dist/{logger-BWMPnILd.js → logger-DWbwXLjl.js} +0 -0
  979. /package/dist/{logger-GvipVDfh.js → logger-DXCDb7qu.js} +0 -0
  980. /package/dist/{logging-D8-Kozjc.js → logging-CAgCb3n3.js} +0 -0
  981. /package/dist/{message-channel-uWMAiywE.js → message-channel-D72Bc6Tb.js} +0 -0
  982. /package/dist/{mime-BS3jhcZE.js → mime-Cqg1jjia.js} +0 -0
  983. /package/dist/{mime-Cxh_64P6.js → mime-D4bQLMJL.js} +0 -0
  984. /package/dist/{mutable-allowlist-detectors-DiZDtmlZ.js → mutable-allowlist-detectors-NtI6s4TE.js} +0 -0
  985. /package/dist/{mutable-allowlist-detectors-U5ThQr9V.js → mutable-allowlist-detectors-nAmo9v5u.js} +0 -0
  986. /package/dist/{node-cli-Uf6lAntf.js → node-cli-bNJbha3z.js} +0 -0
  987. /package/dist/{parse-log-line-enq8pduH.js → parse-log-line-BY9Vz72K.js} +0 -0
  988. /package/dist/{parse-log-line-mz9TG6ig.js → parse-log-line-BrrE4onI.js} +0 -0
  989. /package/dist/{parse-timeout-BMP8a0_a.js → parse-timeout-Dfyln-4M.js} +0 -0
  990. /package/dist/{path-guards-CIx4hURU.js → path-guards-D9LU0y9L.js} +0 -0
  991. /package/dist/{path-guards-CrQOUlsq.js → path-guards-crZaTVvq.js} +0 -0
  992. /package/dist/plugin-sdk/{agents → auth}/api-key-rotation.d.ts +0 -0
  993. /package/dist/plugin-sdk/{agents/auth-profiles → auth}/paths.d.ts +0 -0
  994. /package/dist/plugin-sdk/{agents/auth-profiles → auth}/profiles.d.ts +0 -0
  995. /package/dist/plugin-sdk/{agents/auth-profiles → auth}/store.d.ts +0 -0
  996. /package/dist/plugin-sdk/{agents/auth-profiles → auth}/types.d.ts +0 -0
  997. /package/dist/{plugins-allowlist-BbTQ5Z2k.js → plugins-allowlist-CD4oIJNk.js} +0 -0
  998. /package/dist/{plugins-allowlist-C20oaESO.js → plugins-allowlist-CUhk3GDh.js} +0 -0
  999. /package/dist/{polls-B0CCBDeR.js → polls-ChvH1OIW.js} +0 -0
  1000. /package/dist/{polls-CwwHzYBM.js → polls-Dn1C2d1-.js} +0 -0
  1001. /package/dist/{ports-lsof-Wteul3ju.js → ports-lsof-BDQWExpn.js} +0 -0
  1002. /package/dist/{process-scoped-map-CV9kDvfG.js → process-scoped-map-BwUkYFQV.js} +0 -0
  1003. /package/dist/{process-scoped-map-PEvnG75N.js → process-scoped-map-CBWcUvTa.js} +0 -0
  1004. /package/dist/{program-context-jqeI5alP.js → program-context-DtsEOsdM.js} +0 -0
  1005. /package/dist/{progress-C1kUfYL-.js → progress-BjGCAXH7.js} +0 -0
  1006. /package/dist/{prompt-Yn2yClg1.js → prompt-FIISMuNm.js} +0 -0
  1007. /package/dist/{prompt-style-DjEYC_s-.js → prompt-style-DL64_X-p.js} +0 -0
  1008. /package/dist/{provider-utils-3JTMJroG.js → provider-utils-DiLhkKQp.js} +0 -0
  1009. /package/dist/{proxy-DL3MD6-P.js → proxy-DUTF0OYE.js} +0 -0
  1010. /package/dist/{proxy-DpNv2cSV.js → proxy-Dv0sbx6A.js} +0 -0
  1011. /package/dist/{pw-ai-state-CGfLv6nV.js → pw-ai-state-DKhOTqDv.js} +0 -0
  1012. /package/dist/{pw-ai-state-Dynx20hr.js → pw-ai-state-kkp06zyZ.js} +0 -0
  1013. /package/dist/{redact-Dx1Fue21.js → redact-BTeK8lMZ.js} +0 -0
  1014. /package/dist/{redact-identifier-BTIWtaa-.js → redact-identifier-F6t5pklx.js} +0 -0
  1015. /package/dist/{redact-identifier-CAagcfWA.js → redact-identifier-VdOrq-IK.js} +0 -0
  1016. /package/dist/{remoteclaw-root-C2HV2VeC.js → remoteclaw-root-DF8m3X4C.js} +0 -0
  1017. /package/dist/{remoteclaw-root-DybYl8PL.js → remoteclaw-root-rJHOCwzo.js} +0 -0
  1018. /package/dist/{render-CCLsW6Lz.js → render-e7fENCYH.js} +0 -0
  1019. /package/dist/{render-uf6PvGMV.js → render-qcqmrHse.js} +0 -0
  1020. /package/dist/{retry-DnqPAqWp.js → retry-CwZiwLDN.js} +0 -0
  1021. /package/dist/{runtime-DJNp29jv.js → runtime-Ds3E9SqF.js} +0 -0
  1022. /package/dist/{runtime-guard-U-ewY_QH.js → runtime-guard-CdJVmJc0.js} +0 -0
  1023. /package/dist/{secret-equal-BbHdTtqY.js → secret-equal-CDUVxXmp.js} +0 -0
  1024. /package/dist/{secret-equal-CXJEZiWb.js → secret-equal-d3sEnK98.js} +0 -0
  1025. /package/dist/{secure-random-CS2mSdTn.js → secure-random-CJtykx_p.js} +0 -0
  1026. /package/dist/{secure-random-_dzDDlFo.js → secure-random-y6N6Gted.js} +0 -0
  1027. /package/dist/{session-key-5YLnn_qf.js → session-key-BF-9YzxC.js} +0 -0
  1028. /package/dist/{stagger-BXv_apuy.js → stagger-B-_Wnofy.js} +0 -0
  1029. /package/dist/{stagger-MI9gd2rQ.js → stagger-CjkdqPuN.js} +0 -0
  1030. /package/dist/{status-BmtCS3T1.js → status-BFmH9Uge.js} +0 -0
  1031. /package/dist/{status-BrwHRn2B.js → status-BIupzBh9.js} +0 -0
  1032. /package/dist/{strip-inbound-meta-DjKcSFaW.js → strip-inbound-meta-BNXRYvmY.js} +0 -0
  1033. /package/dist/{strip-inbound-meta-jy3bkUab.js → strip-inbound-meta-BtNFmc6V.js} +0 -0
  1034. /package/dist/{table-C1rdyYl9.js → table-Au5EeKD6.js} +0 -0
  1035. /package/dist/{target-errors-BDpPcwh5.js → target-errors-B6YON-5k.js} +0 -0
  1036. /package/dist/{target-errors-DdIAPcMM.js → target-errors-sPHoHj73.js} +0 -0
  1037. /package/dist/{targets-D-qLBpTA.js → targets-BtGRUQMa.js} +0 -0
  1038. /package/dist/{targets-BMenhVHg.js → targets-D3r6Zgic.js} +0 -0
  1039. /package/dist/{targets-C-2xwh9f.js → targets-DDdPVd12.js} +0 -0
  1040. /package/dist/{targets-UncQvCVs.js → targets-Ds5eT_RZ.js} +0 -0
  1041. /package/dist/{targets-D7PT_rdO.js → targets-DtvPW-B8.js} +0 -0
  1042. /package/dist/{text-format-BQ3z_OXA.js → text-format-CFm4X8Ze.js} +0 -0
  1043. /package/dist/{text-format-oWqzVmah.js → text-format-KHU3KzvQ.js} +0 -0
  1044. /package/dist/{tokens-B-jmvNR9.js → tokens-BGw4xHhW.js} +0 -0
  1045. /package/dist/{usage-BdhBT0Vz.js → usage-BEjWlD9A.js} +0 -0
  1046. /package/dist/{usage-format-C3mNLfhI.js → usage-format-Cx3JveFn.js} +0 -0
  1047. /package/dist/{usage-format-DAaPzr_z.js → usage-format-D-ZaYT_e.js} +0 -0
  1048. /package/dist/{usage-BtQcAnf6.js → usage-o8O_TxA-.js} +0 -0
  1049. /package/dist/{widearea-dns-CsmBVbez.js → widearea-dns-DUDYT3z2.js} +0 -0
  1050. /package/dist/{workspace-BzPeZDew.js → workspace-9__vtmnA.js} +0 -0
  1051. /package/dist/{wsl-B_sPlzWw.js → wsl-BLrG__iS.js} +0 -0
  1052. /package/dist/{wsl-BCnYV9O0.js → wsl-C2dudsWt.js} +0 -0
@@ -1,3392 +0,0 @@
1
- import { c as formatThinkingLevels, g as resolveResponseUsageMode, m as normalizeUsageDisplay, n as formatRawAssistantErrorForUi, u as listThinkingLevelLabels } from "./agent-helpers-B6VfZ9_u.js";
2
- import { s as resolveDefaultAgentId } from "./agent-scope-BGYzhtWQ.js";
3
- import { n as visibleWidth, t as stripAnsi$1 } from "./ansi-D04X81yq.js";
4
- import { C as parseAgentSessionKey, c as normalizeMainKey, r as buildAgentMainSessionKey, s as normalizeAgentId } from "./session-key-5YLnn_qf.js";
5
- import { f as GATEWAY_CLIENT_MODES, p as GATEWAY_CLIENT_NAMES, u as GATEWAY_CLIENT_CAPS } from "./message-channel-DzJqHVZD.js";
6
- import { i as loadConfig } from "./config-D5XU45KD.js";
7
- import { r as VERSION } from "./env-vars-CLGbxdpL.js";
8
- import { a as listChatCommandsForConfig, i as listChatCommands } from "./commands-registry-Ci8_cFk9.js";
9
- import { n as stripLeadingInboundMetadata } from "./strip-inbound-meta-jy3bkUab.js";
10
- import { n as formatTimeAgo, t as formatRelativeTimestamp } from "./format-relative-79_Y1n2Y.js";
11
- import { n as formatTokenCount } from "./usage-format-DAaPzr_z.js";
12
- import { At as PROTOCOL_VERSION, f as GatewayClient, i as ensureExplicitGatewayAuth, o as resolveExplicitGatewayAuth, t as buildGatewayConnectionDetails } from "./call-PivL7Uex.js";
13
- import { n as resolveToolDisplay, t as formatToolDetail } from "./tool-display-sgNwLOBj.js";
14
- import chalk from "chalk";
15
- import { randomUUID } from "node:crypto";
16
- import { spawn } from "node:child_process";
17
- import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, getEditorKeybindings, isKeyRelease, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
18
- import { highlight, supportsLanguage } from "cli-highlight";
19
-
20
- //#region src/tui/commands.ts
21
- const VERBOSE_LEVELS = ["on", "off"];
22
- const REASONING_LEVELS = ["on", "off"];
23
- const ELEVATED_LEVELS = [
24
- "on",
25
- "off",
26
- "ask",
27
- "full"
28
- ];
29
- const ACTIVATION_LEVELS = ["mention", "always"];
30
- const USAGE_FOOTER_LEVELS = [
31
- "off",
32
- "tokens",
33
- "full"
34
- ];
35
- const COMMAND_ALIASES = { elev: "elevated" };
36
- function createLevelCompletion(levels) {
37
- return (prefix) => levels.filter((value) => value.startsWith(prefix.toLowerCase())).map((value) => ({
38
- value,
39
- label: value
40
- }));
41
- }
42
- function parseCommand(input) {
43
- const trimmed = input.replace(/^\//, "").trim();
44
- if (!trimmed) return {
45
- name: "",
46
- args: ""
47
- };
48
- const [name, ...rest] = trimmed.split(/\s+/);
49
- const normalized = name.toLowerCase();
50
- return {
51
- name: COMMAND_ALIASES[normalized] ?? normalized,
52
- args: rest.join(" ").trim()
53
- };
54
- }
55
- function getSlashCommands(options = {}) {
56
- const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
57
- const verboseCompletions = createLevelCompletion(VERBOSE_LEVELS);
58
- const reasoningCompletions = createLevelCompletion(REASONING_LEVELS);
59
- const usageCompletions = createLevelCompletion(USAGE_FOOTER_LEVELS);
60
- const elevatedCompletions = createLevelCompletion(ELEVATED_LEVELS);
61
- const activationCompletions = createLevelCompletion(ACTIVATION_LEVELS);
62
- const commands = [
63
- {
64
- name: "help",
65
- description: "Show slash command help"
66
- },
67
- {
68
- name: "status",
69
- description: "Show gateway status summary"
70
- },
71
- {
72
- name: "agent",
73
- description: "Switch agent (or open picker)"
74
- },
75
- {
76
- name: "agents",
77
- description: "Open agent picker"
78
- },
79
- {
80
- name: "session",
81
- description: "Switch session (or open picker)"
82
- },
83
- {
84
- name: "sessions",
85
- description: "Open session picker"
86
- },
87
- {
88
- name: "model",
89
- description: "Set model (or open picker)"
90
- },
91
- {
92
- name: "models",
93
- description: "Open model picker"
94
- },
95
- {
96
- name: "think",
97
- description: "Set thinking level",
98
- getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
99
- value,
100
- label: value
101
- }))
102
- },
103
- {
104
- name: "verbose",
105
- description: "Set verbose on/off",
106
- getArgumentCompletions: verboseCompletions
107
- },
108
- {
109
- name: "reasoning",
110
- description: "Set reasoning on/off",
111
- getArgumentCompletions: reasoningCompletions
112
- },
113
- {
114
- name: "usage",
115
- description: "Toggle per-response usage line",
116
- getArgumentCompletions: usageCompletions
117
- },
118
- {
119
- name: "elevated",
120
- description: "Set elevated on/off/ask/full",
121
- getArgumentCompletions: elevatedCompletions
122
- },
123
- {
124
- name: "elev",
125
- description: "Alias for /elevated",
126
- getArgumentCompletions: elevatedCompletions
127
- },
128
- {
129
- name: "activation",
130
- description: "Set group activation",
131
- getArgumentCompletions: activationCompletions
132
- },
133
- {
134
- name: "abort",
135
- description: "Abort active run"
136
- },
137
- {
138
- name: "new",
139
- description: "Reset the session"
140
- },
141
- {
142
- name: "reset",
143
- description: "Reset the session"
144
- },
145
- {
146
- name: "settings",
147
- description: "Open settings"
148
- },
149
- {
150
- name: "exit",
151
- description: "Exit the TUI"
152
- },
153
- {
154
- name: "quit",
155
- description: "Exit the TUI"
156
- }
157
- ];
158
- const seen = new Set(commands.map((command) => command.name));
159
- const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
160
- for (const command of gatewayCommands) {
161
- const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
162
- for (const alias of aliases) {
163
- const name = alias.replace(/^\//, "").trim();
164
- if (!name || seen.has(name)) continue;
165
- seen.add(name);
166
- commands.push({
167
- name,
168
- description: command.description
169
- });
170
- }
171
- }
172
- return commands;
173
- }
174
- function helpText(options = {}) {
175
- return [
176
- "Slash commands:",
177
- "/help",
178
- "/commands",
179
- "/status",
180
- "/agent <id> (or /agents)",
181
- "/session <key> (or /sessions)",
182
- "/model <provider/model> (or /models)",
183
- `/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
184
- "/verbose <on|off>",
185
- "/reasoning <on|off>",
186
- "/usage <off|tokens|full>",
187
- "/elevated <on|off|ask|full>",
188
- "/elev <on|off|ask|full>",
189
- "/activation <mention|always>",
190
- "/new or /reset",
191
- "/abort",
192
- "/settings",
193
- "/exit"
194
- ].join("\n");
195
- }
196
-
197
- //#endregion
198
- //#region src/tui/theme/syntax-theme.ts
199
- /**
200
- * Syntax highlighting theme for code blocks.
201
- * Uses chalk functions to style different token types.
202
- */
203
- function createSyntaxTheme(fallback) {
204
- return {
205
- keyword: chalk.hex("#C586C0"),
206
- built_in: chalk.hex("#4EC9B0"),
207
- type: chalk.hex("#4EC9B0"),
208
- literal: chalk.hex("#569CD6"),
209
- number: chalk.hex("#B5CEA8"),
210
- string: chalk.hex("#CE9178"),
211
- regexp: chalk.hex("#D16969"),
212
- symbol: chalk.hex("#B5CEA8"),
213
- class: chalk.hex("#4EC9B0"),
214
- function: chalk.hex("#DCDCAA"),
215
- title: chalk.hex("#DCDCAA"),
216
- params: chalk.hex("#9CDCFE"),
217
- comment: chalk.hex("#6A9955"),
218
- doctag: chalk.hex("#608B4E"),
219
- meta: chalk.hex("#9CDCFE"),
220
- "meta-keyword": chalk.hex("#C586C0"),
221
- "meta-string": chalk.hex("#CE9178"),
222
- section: chalk.hex("#DCDCAA"),
223
- tag: chalk.hex("#569CD6"),
224
- name: chalk.hex("#9CDCFE"),
225
- attr: chalk.hex("#9CDCFE"),
226
- attribute: chalk.hex("#9CDCFE"),
227
- variable: chalk.hex("#9CDCFE"),
228
- bullet: chalk.hex("#D7BA7D"),
229
- code: chalk.hex("#CE9178"),
230
- emphasis: chalk.italic,
231
- strong: chalk.bold,
232
- formula: chalk.hex("#C586C0"),
233
- link: chalk.hex("#4EC9B0"),
234
- quote: chalk.hex("#6A9955"),
235
- addition: chalk.hex("#B5CEA8"),
236
- deletion: chalk.hex("#F44747"),
237
- "selector-tag": chalk.hex("#D7BA7D"),
238
- "selector-id": chalk.hex("#D7BA7D"),
239
- "selector-class": chalk.hex("#D7BA7D"),
240
- "selector-attr": chalk.hex("#D7BA7D"),
241
- "selector-pseudo": chalk.hex("#D7BA7D"),
242
- "template-tag": chalk.hex("#C586C0"),
243
- "template-variable": chalk.hex("#9CDCFE"),
244
- default: fallback
245
- };
246
- }
247
-
248
- //#endregion
249
- //#region src/tui/theme/theme.ts
250
- const palette = {
251
- text: "#E8E3D5",
252
- dim: "#7B7F87",
253
- accent: "#F6C453",
254
- accentSoft: "#F2A65A",
255
- border: "#3C414B",
256
- userBg: "#2B2F36",
257
- userText: "#F3EEE0",
258
- systemText: "#9BA3B2",
259
- toolPendingBg: "#1F2A2F",
260
- toolSuccessBg: "#1E2D23",
261
- toolErrorBg: "#2F1F1F",
262
- toolTitle: "#F6C453",
263
- toolOutput: "#E1DACB",
264
- quote: "#8CC8FF",
265
- quoteBorder: "#3B4D6B",
266
- code: "#F0C987",
267
- codeBlock: "#1E232A",
268
- codeBorder: "#343A45",
269
- link: "#7DD3A5",
270
- error: "#F97066",
271
- success: "#7DD3A5"
272
- };
273
- const fg = (hex) => (text) => chalk.hex(hex)(text);
274
- const bg = (hex) => (text) => chalk.bgHex(hex)(text);
275
- const syntaxTheme = createSyntaxTheme(fg(palette.code));
276
- /**
277
- * Highlight code with syntax coloring.
278
- * Returns an array of lines with ANSI escape codes.
279
- */
280
- function highlightCode(code, lang) {
281
- try {
282
- return highlight(code, {
283
- language: lang && supportsLanguage(lang) ? lang : void 0,
284
- theme: syntaxTheme,
285
- ignoreIllegals: true
286
- }).split("\n");
287
- } catch {
288
- return code.split("\n").map((line) => fg(palette.code)(line));
289
- }
290
- }
291
- const theme = {
292
- fg: fg(palette.text),
293
- assistantText: (text) => text,
294
- dim: fg(palette.dim),
295
- accent: fg(palette.accent),
296
- accentSoft: fg(palette.accentSoft),
297
- success: fg(palette.success),
298
- error: fg(palette.error),
299
- header: (text) => chalk.bold(fg(palette.accent)(text)),
300
- system: fg(palette.systemText),
301
- userBg: bg(palette.userBg),
302
- userText: fg(palette.userText),
303
- toolTitle: fg(palette.toolTitle),
304
- toolOutput: fg(palette.toolOutput),
305
- toolPendingBg: bg(palette.toolPendingBg),
306
- toolSuccessBg: bg(palette.toolSuccessBg),
307
- toolErrorBg: bg(palette.toolErrorBg),
308
- border: fg(palette.border),
309
- bold: (text) => chalk.bold(text),
310
- italic: (text) => chalk.italic(text)
311
- };
312
- const markdownTheme = {
313
- heading: (text) => chalk.bold(fg(palette.accent)(text)),
314
- link: (text) => fg(palette.link)(text),
315
- linkUrl: (text) => chalk.dim(text),
316
- code: (text) => fg(palette.code)(text),
317
- codeBlock: (text) => fg(palette.code)(text),
318
- codeBlockBorder: (text) => fg(palette.codeBorder)(text),
319
- quote: (text) => fg(palette.quote)(text),
320
- quoteBorder: (text) => fg(palette.quoteBorder)(text),
321
- hr: (text) => fg(palette.border)(text),
322
- listBullet: (text) => fg(palette.accentSoft)(text),
323
- bold: (text) => chalk.bold(text),
324
- italic: (text) => chalk.italic(text),
325
- strikethrough: (text) => chalk.strikethrough(text),
326
- underline: (text) => chalk.underline(text),
327
- highlightCode
328
- };
329
- const baseSelectListTheme = {
330
- selectedPrefix: (text) => fg(palette.accent)(text),
331
- selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
332
- description: (text) => fg(palette.dim)(text),
333
- scrollInfo: (text) => fg(palette.dim)(text),
334
- noMatch: (text) => fg(palette.dim)(text)
335
- };
336
- const selectListTheme = baseSelectListTheme;
337
- const filterableSelectListTheme = {
338
- ...baseSelectListTheme,
339
- filterLabel: (text) => fg(palette.dim)(text)
340
- };
341
- const settingsListTheme = {
342
- label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
343
- value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
344
- description: (text) => fg(palette.systemText)(text),
345
- cursor: fg(palette.accent)("→ "),
346
- hint: (text) => fg(palette.dim)(text)
347
- };
348
- const editorTheme = {
349
- borderColor: (text) => fg(palette.border)(text),
350
- selectList: selectListTheme
351
- };
352
- const searchableSelectListTheme = {
353
- ...baseSelectListTheme,
354
- searchPrompt: (text) => fg(palette.accentSoft)(text),
355
- searchInput: (text) => fg(palette.text)(text),
356
- matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
357
- };
358
-
359
- //#endregion
360
- //#region src/tui/osc8-hyperlinks.ts
361
- const SGR_PATTERN = "\\x1b\\[[0-9;]*m";
362
- const OSC8_PATTERN = "\\x1b\\]8;;.*?(?:\\x07|\\x1b\\\\)";
363
- const ANSI_RE = new RegExp(`${SGR_PATTERN}|${OSC8_PATTERN}`, "g");
364
- const SGR_START_RE = new RegExp(`^${SGR_PATTERN}`);
365
- const OSC8_START_RE = new RegExp(`^${OSC8_PATTERN}`);
366
- /**
367
- * Extract all unique URLs from raw markdown text.
368
- * Finds both bare URLs and markdown link hrefs [text](url).
369
- */
370
- function extractUrls(markdown) {
371
- const urls = /* @__PURE__ */ new Set();
372
- const mdLinkRe = /\[(?:[^\]]*)\]\(\s*<?(https?:\/\/[^)\s>]+)>?(?:\s+["'][^"']*["'])?\s*\)/g;
373
- let m;
374
- while ((m = mdLinkRe.exec(markdown)) !== null) urls.add(m[1]);
375
- const stripped = markdown.replace(/\[(?:[^\]]*)\]\(\s*<?https?:\/\/[^)\s>]+>?(?:\s+["'][^"']*["'])?\s*\)/g, "");
376
- const bareRe = /https?:\/\/[^\s)\]>]+/g;
377
- while ((m = bareRe.exec(stripped)) !== null) urls.add(m[0]);
378
- return [...urls];
379
- }
380
- /** Strip ANSI SGR and OSC 8 sequences to get visible text. */
381
- function stripAnsi(input) {
382
- return input.replace(ANSI_RE, "");
383
- }
384
- /**
385
- * Find URL ranges in a line's visible text, handling cross-line URL splits.
386
- */
387
- function findUrlRanges(visibleText, knownUrls, pending) {
388
- const ranges = [];
389
- let newPending = null;
390
- let searchFrom = 0;
391
- if (pending) {
392
- const remaining = pending.url.slice(pending.consumed);
393
- const trimmed = visibleText.trimStart();
394
- const leadingSpaces = visibleText.length - trimmed.length;
395
- let matchLen = 0;
396
- for (let j = 0; j < remaining.length && j < trimmed.length; j++) if (remaining[j] === trimmed[j]) matchLen++;
397
- else break;
398
- if (matchLen > 0) {
399
- ranges.push({
400
- start: leadingSpaces,
401
- end: leadingSpaces + matchLen,
402
- url: pending.url
403
- });
404
- searchFrom = leadingSpaces + matchLen;
405
- if (pending.consumed + matchLen < pending.url.length) newPending = {
406
- url: pending.url,
407
- consumed: pending.consumed + matchLen
408
- };
409
- }
410
- }
411
- const urlRe = /https?:\/\/[^\s)\]>]+/g;
412
- urlRe.lastIndex = searchFrom;
413
- let match;
414
- while ((match = urlRe.exec(visibleText)) !== null) {
415
- const fragment = match[0];
416
- const start = match.index;
417
- let resolvedUrl = fragment;
418
- let found = false;
419
- for (const known of knownUrls) if (known === fragment) {
420
- resolvedUrl = known;
421
- found = true;
422
- break;
423
- }
424
- if (!found) {
425
- let bestLen = 0;
426
- for (const known of knownUrls) if (known.startsWith(fragment) && known.length > bestLen) {
427
- resolvedUrl = known;
428
- bestLen = known.length;
429
- found = true;
430
- }
431
- }
432
- if (!found) {
433
- let bestLen = 0;
434
- for (const known of knownUrls) if (fragment.startsWith(known) && known.length > bestLen) {
435
- resolvedUrl = known;
436
- bestLen = known.length;
437
- }
438
- }
439
- ranges.push({
440
- start,
441
- end: start + fragment.length,
442
- url: resolvedUrl
443
- });
444
- if (resolvedUrl.length > fragment.length && resolvedUrl.startsWith(fragment)) newPending = {
445
- url: resolvedUrl,
446
- consumed: fragment.length
447
- };
448
- }
449
- return {
450
- ranges,
451
- pending: newPending
452
- };
453
- }
454
- /**
455
- * Apply OSC 8 hyperlink sequences to a line based on visible-text URL ranges.
456
- * Walks through the raw string character by character, inserting OSC 8
457
- * open/close sequences at URL range boundaries while preserving ANSI codes.
458
- */
459
- function applyOsc8Ranges(line, ranges) {
460
- if (ranges.length === 0) return line;
461
- const urlAt = /* @__PURE__ */ new Map();
462
- for (const r of ranges) for (let p = r.start; p < r.end; p++) urlAt.set(p, r.url);
463
- let result = "";
464
- let visiblePos = 0;
465
- let activeUrl = null;
466
- let i = 0;
467
- while (i < line.length) {
468
- if (line.charCodeAt(i) === 27) {
469
- const sgr = line.slice(i).match(SGR_START_RE);
470
- if (sgr) {
471
- result += sgr[0];
472
- i += sgr[0].length;
473
- continue;
474
- }
475
- const osc = line.slice(i).match(OSC8_START_RE);
476
- if (osc) {
477
- result += osc[0];
478
- i += osc[0].length;
479
- continue;
480
- }
481
- }
482
- const targetUrl = urlAt.get(visiblePos) ?? null;
483
- if (targetUrl !== activeUrl) {
484
- if (activeUrl !== null) result += "\x1B]8;;\x07";
485
- if (targetUrl !== null) result += `\x1b]8;;${targetUrl}\x07`;
486
- activeUrl = targetUrl;
487
- }
488
- result += line[i];
489
- visiblePos++;
490
- i++;
491
- }
492
- if (activeUrl !== null) result += "\x1B]8;;\x07";
493
- return result;
494
- }
495
- /**
496
- * Add OSC 8 hyperlinks to rendered lines using a pre-extracted URL list.
497
- *
498
- * For each line, finds URL-like substrings in the visible text, matches them
499
- * against known URLs, and wraps each fragment with OSC 8 escape sequences.
500
- * Handles URLs broken across multiple lines by pi-tui's word wrapping.
501
- */
502
- function addOsc8Hyperlinks(lines, urls) {
503
- if (urls.length === 0) return lines;
504
- let pending = null;
505
- return lines.map((line) => {
506
- const result = findUrlRanges(stripAnsi(line), urls, pending);
507
- pending = result.pending;
508
- return applyOsc8Ranges(line, result.ranges);
509
- });
510
- }
511
-
512
- //#endregion
513
- //#region src/tui/components/hyperlink-markdown.ts
514
- /**
515
- * Wrapper around pi-tui's Markdown component that adds OSC 8 terminal
516
- * hyperlinks to rendered output, making URLs clickable even when broken
517
- * across multiple lines by word wrapping.
518
- */
519
- var HyperlinkMarkdown = class {
520
- constructor(text, paddingX, paddingY, theme, options) {
521
- this.inner = new Markdown(text, paddingX, paddingY, theme, options);
522
- this.urls = extractUrls(text);
523
- }
524
- render(width) {
525
- return addOsc8Hyperlinks(this.inner.render(width), this.urls);
526
- }
527
- setText(text) {
528
- this.inner.setText(text);
529
- this.urls = extractUrls(text);
530
- }
531
- invalidate() {
532
- this.inner.invalidate();
533
- }
534
- };
535
-
536
- //#endregion
537
- //#region src/tui/components/assistant-message.ts
538
- var AssistantMessageComponent = class extends Container {
539
- constructor(text) {
540
- super();
541
- this.body = new HyperlinkMarkdown(text, 1, 0, markdownTheme, { color: (line) => theme.assistantText(line) });
542
- this.addChild(new Spacer(1));
543
- this.addChild(this.body);
544
- }
545
- setText(text) {
546
- this.body.setText(text);
547
- }
548
- };
549
-
550
- //#endregion
551
- //#region src/tui/tui-formatters.ts
552
- const REPLACEMENT_CHAR_RE = /\uFFFD/g;
553
- const MAX_TOKEN_CHARS = 32;
554
- const LONG_TOKEN_RE = /\S{33,}/g;
555
- const LONG_TOKEN_TEST_RE = /\S{33,}/;
556
- const BINARY_LINE_REPLACEMENT_THRESHOLD = 12;
557
- const URL_PREFIX_RE = /^(https?:\/\/|file:\/\/)/i;
558
- const WINDOWS_DRIVE_RE = /^[a-zA-Z]:[\\/]/;
559
- const FILE_LIKE_RE = /^[a-zA-Z0-9._-]+$/;
560
- const RTL_SCRIPT_RE = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;
561
- const BIDI_CONTROL_RE = /[\u202a-\u202e\u2066-\u2069]/;
562
- const RTL_ISOLATE_START = "⁧";
563
- const RTL_ISOLATE_END = "⁩";
564
- function hasControlChars(text) {
565
- for (const char of text) {
566
- const code = char.charCodeAt(0);
567
- if (code <= 31 && code !== 9 && code !== 10 && code !== 13 || code >= 127 && code <= 159) return true;
568
- }
569
- return false;
570
- }
571
- function stripControlChars(text) {
572
- if (!hasControlChars(text)) return text;
573
- let sanitized = "";
574
- for (const char of text) {
575
- const code = char.charCodeAt(0);
576
- if (!(code <= 31 && code !== 9 && code !== 10 && code !== 13) && !(code >= 127 && code <= 159)) sanitized += char;
577
- }
578
- return sanitized;
579
- }
580
- function chunkToken(token, maxChars) {
581
- if (token.length <= maxChars) return [token];
582
- const chunks = [];
583
- for (let i = 0; i < token.length; i += maxChars) chunks.push(token.slice(i, i + maxChars));
584
- return chunks;
585
- }
586
- function isCopySensitiveToken(token) {
587
- if (URL_PREFIX_RE.test(token)) return true;
588
- if (token.startsWith("/") || token.startsWith("~/") || token.startsWith("./") || token.startsWith("../")) return true;
589
- if (WINDOWS_DRIVE_RE.test(token) || token.startsWith("\\\\")) return true;
590
- if (token.includes("/") || token.includes("\\")) return true;
591
- return token.includes("_") && FILE_LIKE_RE.test(token);
592
- }
593
- function normalizeLongTokenForDisplay(token) {
594
- if (isCopySensitiveToken(token)) return token;
595
- return chunkToken(token, MAX_TOKEN_CHARS).join(" ");
596
- }
597
- function redactBinaryLikeLine(line) {
598
- const replacementCount = (line.match(REPLACEMENT_CHAR_RE) || []).length;
599
- if (replacementCount >= BINARY_LINE_REPLACEMENT_THRESHOLD && replacementCount * 2 >= line.length) return "[binary data omitted]";
600
- return line;
601
- }
602
- function isolateRtlLine(line) {
603
- if (!RTL_SCRIPT_RE.test(line) || BIDI_CONTROL_RE.test(line)) return line;
604
- return `${RTL_ISOLATE_START}${line}${RTL_ISOLATE_END}`;
605
- }
606
- function applyRtlIsolation(text) {
607
- if (!RTL_SCRIPT_RE.test(text)) return text;
608
- return text.split("\n").map((line) => isolateRtlLine(line)).join("\n");
609
- }
610
- function sanitizeRenderableText(text) {
611
- if (!text) return text;
612
- const hasAnsi = text.includes("\x1B");
613
- const hasReplacementChars = text.includes("�");
614
- const hasLongTokens = LONG_TOKEN_TEST_RE.test(text);
615
- const hasControls = hasControlChars(text);
616
- if (!hasAnsi && !hasReplacementChars && !hasLongTokens && !hasControls) return applyRtlIsolation(text);
617
- const withoutAnsi = hasAnsi ? stripAnsi$1(text) : text;
618
- const withoutControlChars = hasControls ? stripControlChars(withoutAnsi) : withoutAnsi;
619
- const redacted = hasReplacementChars ? withoutControlChars.split("\n").map((line) => redactBinaryLikeLine(line)).join("\n") : withoutControlChars;
620
- return applyRtlIsolation(LONG_TOKEN_TEST_RE.test(redacted) ? redacted.replace(LONG_TOKEN_RE, normalizeLongTokenForDisplay) : redacted);
621
- }
622
- function resolveFinalAssistantText(params) {
623
- const finalText = params.finalText ?? "";
624
- if (finalText.trim()) return finalText;
625
- const streamedText = params.streamedText ?? "";
626
- if (streamedText.trim()) return streamedText;
627
- return "(no output)";
628
- }
629
- function composeThinkingAndContent(params) {
630
- const thinkingText = params.thinkingText?.trim() ?? "";
631
- const contentText = params.contentText?.trim() ?? "";
632
- const parts = [];
633
- if (params.showThinking && thinkingText) parts.push(`[thinking]\n${thinkingText}`);
634
- if (contentText) parts.push(contentText);
635
- return parts.join("\n\n").trim();
636
- }
637
- function asMessageRecord(message) {
638
- if (!message || typeof message !== "object") return;
639
- return message;
640
- }
641
- function resolveMessageRecord(message) {
642
- const record = asMessageRecord(message);
643
- if (!record) return;
644
- return {
645
- record,
646
- content: record.content
647
- };
648
- }
649
- function formatAssistantErrorFromRecord(record) {
650
- if ((typeof record.stopReason === "string" ? record.stopReason : "") !== "error") return "";
651
- return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
652
- }
653
- function collectSanitizedBlockStrings(params) {
654
- if (!Array.isArray(params.content)) return [];
655
- const parts = [];
656
- for (const block of params.content) {
657
- if (!block || typeof block !== "object") continue;
658
- const rec = block;
659
- if (rec.type === params.blockType && typeof rec[params.valueKey] === "string") parts.push(sanitizeRenderableText(rec[params.valueKey]));
660
- }
661
- return parts;
662
- }
663
- /**
664
- * Extract ONLY thinking blocks from message content.
665
- * Model-agnostic: returns empty string if no thinking blocks exist.
666
- */
667
- function extractThinkingFromMessage(message) {
668
- const resolved = resolveMessageRecord(message);
669
- if (!resolved) return "";
670
- const { content } = resolved;
671
- if (typeof content === "string") return "";
672
- return collectSanitizedBlockStrings({
673
- content,
674
- blockType: "thinking",
675
- valueKey: "thinking"
676
- }).join("\n").trim();
677
- }
678
- /**
679
- * Extract ONLY text content blocks from message (excludes thinking).
680
- * Model-agnostic: works for any model with text content blocks.
681
- */
682
- function extractContentFromMessage(message) {
683
- const resolved = resolveMessageRecord(message);
684
- if (!resolved) return "";
685
- const { record, content } = resolved;
686
- if (typeof content === "string") return sanitizeRenderableText(content).trim();
687
- const parts = collectSanitizedBlockStrings({
688
- content,
689
- blockType: "text",
690
- valueKey: "text"
691
- });
692
- if (parts.length > 0) return parts.join("\n").trim();
693
- return formatAssistantErrorFromRecord(record);
694
- }
695
- function extractTextBlocks(content, opts) {
696
- if (typeof content === "string") return sanitizeRenderableText(content).trim();
697
- if (!Array.isArray(content)) return "";
698
- const textParts = collectSanitizedBlockStrings({
699
- content,
700
- blockType: "text",
701
- valueKey: "text"
702
- });
703
- return composeThinkingAndContent({
704
- thinkingText: (opts?.includeThinking === true ? collectSanitizedBlockStrings({
705
- content,
706
- blockType: "thinking",
707
- valueKey: "thinking"
708
- }) : []).join("\n").trim(),
709
- contentText: textParts.join("\n").trim(),
710
- showThinking: opts?.includeThinking ?? false
711
- });
712
- }
713
- function extractTextFromMessage(message, opts) {
714
- const record = asMessageRecord(message);
715
- if (!record) return "";
716
- const text = extractTextBlocks(record.content, opts);
717
- if (text) {
718
- if (record.role === "user") return stripLeadingInboundMetadata(text);
719
- return text;
720
- }
721
- const errorText = formatAssistantErrorFromRecord(record);
722
- if (!errorText) return "";
723
- return errorText;
724
- }
725
- function isCommandMessage(message) {
726
- if (!message || typeof message !== "object") return false;
727
- return message.command === true;
728
- }
729
- function formatTokens(total, context) {
730
- if (total == null && context == null) return "tokens ?";
731
- const totalLabel = total == null ? "?" : formatTokenCount(total);
732
- if (context == null) return `tokens ${totalLabel}`;
733
- const pct = typeof total === "number" && context > 0 ? Math.min(999, Math.round(total / context * 100)) : null;
734
- return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
735
- }
736
- function formatContextUsageLine(params) {
737
- const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
738
- const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
739
- const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
740
- const extra = [typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null, pct !== null ? `${pct}%` : null].filter(Boolean).join(", ");
741
- return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
742
- }
743
- function asString(value, fallback = "") {
744
- if (typeof value === "string") return value;
745
- if (typeof value === "number" || typeof value === "boolean") return String(value);
746
- return fallback;
747
- }
748
-
749
- //#endregion
750
- //#region src/tui/components/tool-execution.ts
751
- const PREVIEW_LINES = 12;
752
- function formatArgs(toolName, args) {
753
- const detail = formatToolDetail(resolveToolDisplay({
754
- name: toolName,
755
- args
756
- }));
757
- if (detail) return sanitizeRenderableText(detail);
758
- if (!args || typeof args !== "object") return "";
759
- try {
760
- return sanitizeRenderableText(JSON.stringify(args));
761
- } catch {
762
- return "";
763
- }
764
- }
765
- function extractText(result) {
766
- if (!result?.content) return "";
767
- const lines = [];
768
- for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(sanitizeRenderableText(entry.text));
769
- else if (entry.type === "image") {
770
- const mime = entry.mimeType ?? "image";
771
- const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
772
- const omitted = entry.omitted ? " (omitted)" : "";
773
- lines.push(`[${mime}${size}${omitted}]`);
774
- }
775
- return lines.join("\n").trim();
776
- }
777
- var ToolExecutionComponent = class extends Container {
778
- constructor(toolName, args) {
779
- super();
780
- this.expanded = false;
781
- this.isError = false;
782
- this.isPartial = true;
783
- this.toolName = toolName;
784
- this.args = args;
785
- this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
786
- this.header = new Text("", 0, 0);
787
- this.argsLine = new Text("", 0, 0);
788
- this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
789
- this.addChild(new Spacer(1));
790
- this.addChild(this.box);
791
- this.box.addChild(this.header);
792
- this.box.addChild(this.argsLine);
793
- this.box.addChild(this.output);
794
- this.refresh();
795
- }
796
- setArgs(args) {
797
- this.args = args;
798
- this.refresh();
799
- }
800
- setExpanded(expanded) {
801
- this.expanded = expanded;
802
- this.refresh();
803
- }
804
- setResult(result, opts) {
805
- this.result = result;
806
- this.isPartial = false;
807
- this.isError = Boolean(opts?.isError);
808
- this.refresh();
809
- }
810
- setPartialResult(result) {
811
- this.result = result;
812
- this.isPartial = true;
813
- this.refresh();
814
- }
815
- refresh() {
816
- const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
817
- this.box.setBgFn((line) => bg(line));
818
- const display = resolveToolDisplay({
819
- name: this.toolName,
820
- args: this.args
821
- });
822
- const title = `${display.emoji} ${display.label}${this.isPartial ? " (running)" : ""}`;
823
- this.header.setText(theme.toolTitle(theme.bold(title)));
824
- const argLine = formatArgs(this.toolName, this.args);
825
- this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
826
- const text = extractText(this.result) || (this.isPartial ? "…" : "");
827
- if (!this.expanded && text) {
828
- const lines = text.split("\n");
829
- const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
830
- this.output.setText(preview);
831
- } else this.output.setText(text);
832
- }
833
- };
834
-
835
- //#endregion
836
- //#region src/tui/components/markdown-message.ts
837
- var MarkdownMessageComponent = class extends Container {
838
- constructor(text, y, options) {
839
- super();
840
- this.body = new Markdown(text, 1, y, markdownTheme, options);
841
- this.addChild(new Spacer(1));
842
- this.addChild(this.body);
843
- }
844
- setText(text) {
845
- this.body.setText(text);
846
- }
847
- };
848
-
849
- //#endregion
850
- //#region src/tui/components/user-message.ts
851
- var UserMessageComponent = class extends MarkdownMessageComponent {
852
- constructor(text) {
853
- super(text, 1, {
854
- bgColor: (line) => theme.userBg(line),
855
- color: (line) => theme.userText(line)
856
- });
857
- }
858
- };
859
-
860
- //#endregion
861
- //#region src/tui/components/chat-log.ts
862
- var ChatLog = class extends Container {
863
- constructor(maxComponents = 180) {
864
- super();
865
- this.toolById = /* @__PURE__ */ new Map();
866
- this.streamingRuns = /* @__PURE__ */ new Map();
867
- this.toolsExpanded = false;
868
- this.maxComponents = Math.max(20, Math.floor(maxComponents));
869
- }
870
- dropComponentReferences(component) {
871
- for (const [toolId, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(toolId);
872
- for (const [runId, message] of this.streamingRuns.entries()) if (message === component) this.streamingRuns.delete(runId);
873
- }
874
- pruneOverflow() {
875
- while (this.children.length > this.maxComponents) {
876
- const oldest = this.children[0];
877
- if (!oldest) return;
878
- this.removeChild(oldest);
879
- this.dropComponentReferences(oldest);
880
- }
881
- }
882
- append(component) {
883
- this.addChild(component);
884
- this.pruneOverflow();
885
- }
886
- clearAll() {
887
- this.clear();
888
- this.toolById.clear();
889
- this.streamingRuns.clear();
890
- }
891
- addSystem(text) {
892
- this.append(new Spacer(1));
893
- this.append(new Text(theme.system(text), 1, 0));
894
- }
895
- addUser(text) {
896
- this.append(new UserMessageComponent(text));
897
- }
898
- resolveRunId(runId) {
899
- return runId ?? "default";
900
- }
901
- startAssistant(text, runId) {
902
- const component = new AssistantMessageComponent(text);
903
- this.streamingRuns.set(this.resolveRunId(runId), component);
904
- this.append(component);
905
- return component;
906
- }
907
- updateAssistant(text, runId) {
908
- const effectiveRunId = this.resolveRunId(runId);
909
- const existing = this.streamingRuns.get(effectiveRunId);
910
- if (!existing) {
911
- this.startAssistant(text, runId);
912
- return;
913
- }
914
- existing.setText(text);
915
- }
916
- finalizeAssistant(text, runId) {
917
- const effectiveRunId = this.resolveRunId(runId);
918
- const existing = this.streamingRuns.get(effectiveRunId);
919
- if (existing) {
920
- existing.setText(text);
921
- this.streamingRuns.delete(effectiveRunId);
922
- return;
923
- }
924
- this.append(new AssistantMessageComponent(text));
925
- }
926
- dropAssistant(runId) {
927
- const effectiveRunId = this.resolveRunId(runId);
928
- const existing = this.streamingRuns.get(effectiveRunId);
929
- if (!existing) return;
930
- this.removeChild(existing);
931
- this.streamingRuns.delete(effectiveRunId);
932
- }
933
- startTool(toolCallId, toolName, args) {
934
- const existing = this.toolById.get(toolCallId);
935
- if (existing) {
936
- existing.setArgs(args);
937
- return existing;
938
- }
939
- const component = new ToolExecutionComponent(toolName, args);
940
- component.setExpanded(this.toolsExpanded);
941
- this.toolById.set(toolCallId, component);
942
- this.append(component);
943
- return component;
944
- }
945
- updateToolArgs(toolCallId, args) {
946
- const existing = this.toolById.get(toolCallId);
947
- if (!existing) return;
948
- existing.setArgs(args);
949
- }
950
- updateToolResult(toolCallId, result, opts) {
951
- const existing = this.toolById.get(toolCallId);
952
- if (!existing) return;
953
- if (opts?.partial) {
954
- existing.setPartialResult(result);
955
- return;
956
- }
957
- existing.setResult(result, { isError: opts?.isError });
958
- }
959
- setToolsExpanded(expanded) {
960
- this.toolsExpanded = expanded;
961
- for (const tool of this.toolById.values()) tool.setExpanded(expanded);
962
- }
963
- };
964
-
965
- //#endregion
966
- //#region src/tui/components/custom-editor.ts
967
- var CustomEditor = class extends Editor {
968
- handleInput(data) {
969
- if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
970
- this.onAltEnter();
971
- return;
972
- }
973
- if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
974
- this.onCtrlL();
975
- return;
976
- }
977
- if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
978
- this.onCtrlO();
979
- return;
980
- }
981
- if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
982
- this.onCtrlP();
983
- return;
984
- }
985
- if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
986
- this.onCtrlG();
987
- return;
988
- }
989
- if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
990
- this.onCtrlT();
991
- return;
992
- }
993
- if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
994
- this.onShiftTab();
995
- return;
996
- }
997
- if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
998
- this.onEscape();
999
- return;
1000
- }
1001
- if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
1002
- this.onCtrlC();
1003
- return;
1004
- }
1005
- if (matchesKey(data, Key.ctrl("d"))) {
1006
- if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
1007
- return;
1008
- }
1009
- super.handleInput(data);
1010
- }
1011
- };
1012
-
1013
- //#endregion
1014
- //#region src/tui/gateway-chat.ts
1015
- var GatewayChatClient = class {
1016
- constructor(opts) {
1017
- const resolved = resolveGatewayConnection(opts);
1018
- this.connection = resolved;
1019
- this.readyPromise = new Promise((resolve) => {
1020
- this.resolveReady = resolve;
1021
- });
1022
- this.client = new GatewayClient({
1023
- url: resolved.url,
1024
- token: resolved.token,
1025
- password: resolved.password,
1026
- clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
1027
- clientDisplayName: "remoteclaw-tui",
1028
- clientVersion: VERSION,
1029
- platform: process.platform,
1030
- mode: GATEWAY_CLIENT_MODES.UI,
1031
- caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
1032
- instanceId: randomUUID(),
1033
- minProtocol: PROTOCOL_VERSION,
1034
- maxProtocol: PROTOCOL_VERSION,
1035
- onHelloOk: (hello) => {
1036
- this.hello = hello;
1037
- this.resolveReady?.();
1038
- this.onConnected?.();
1039
- },
1040
- onEvent: (evt) => {
1041
- this.onEvent?.({
1042
- event: evt.event,
1043
- payload: evt.payload,
1044
- seq: evt.seq
1045
- });
1046
- },
1047
- onClose: (_code, reason) => {
1048
- this.readyPromise = new Promise((resolve) => {
1049
- this.resolveReady = resolve;
1050
- });
1051
- this.onDisconnected?.(reason);
1052
- },
1053
- onGap: (info) => {
1054
- this.onGap?.(info);
1055
- }
1056
- });
1057
- }
1058
- start() {
1059
- this.client.start();
1060
- }
1061
- stop() {
1062
- this.client.stop();
1063
- }
1064
- async waitForReady() {
1065
- await this.readyPromise;
1066
- }
1067
- async sendChat(opts) {
1068
- const runId = opts.runId ?? randomUUID();
1069
- await this.client.request("chat.send", {
1070
- sessionKey: opts.sessionKey,
1071
- message: opts.message,
1072
- thinking: opts.thinking,
1073
- deliver: opts.deliver,
1074
- timeoutMs: opts.timeoutMs,
1075
- idempotencyKey: runId
1076
- });
1077
- return { runId };
1078
- }
1079
- async abortChat(opts) {
1080
- return await this.client.request("chat.abort", {
1081
- sessionKey: opts.sessionKey,
1082
- runId: opts.runId
1083
- });
1084
- }
1085
- async loadHistory(opts) {
1086
- return await this.client.request("chat.history", {
1087
- sessionKey: opts.sessionKey,
1088
- limit: opts.limit
1089
- });
1090
- }
1091
- async listSessions(opts) {
1092
- return await this.client.request("sessions.list", {
1093
- limit: opts?.limit,
1094
- activeMinutes: opts?.activeMinutes,
1095
- includeGlobal: opts?.includeGlobal,
1096
- includeUnknown: opts?.includeUnknown,
1097
- includeDerivedTitles: opts?.includeDerivedTitles,
1098
- includeLastMessage: opts?.includeLastMessage,
1099
- agentId: opts?.agentId
1100
- });
1101
- }
1102
- async listAgents() {
1103
- return await this.client.request("agents.list", {});
1104
- }
1105
- async patchSession(opts) {
1106
- return await this.client.request("sessions.patch", opts);
1107
- }
1108
- async resetSession(key, reason) {
1109
- return await this.client.request("sessions.reset", {
1110
- key,
1111
- ...reason ? { reason } : {}
1112
- });
1113
- }
1114
- async getStatus() {
1115
- return await this.client.request("status");
1116
- }
1117
- async listModels() {
1118
- const res = await this.client.request("models.list");
1119
- return Array.isArray(res?.models) ? res.models : [];
1120
- }
1121
- };
1122
- function resolveGatewayConnection(opts) {
1123
- const config = loadConfig();
1124
- const isRemoteMode = config.gateway?.mode === "remote";
1125
- const remote = isRemoteMode ? config.gateway?.remote : void 0;
1126
- const authToken = config.gateway?.auth?.token;
1127
- const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
1128
- const explicitAuth = resolveExplicitGatewayAuth({
1129
- token: opts.token,
1130
- password: opts.password
1131
- });
1132
- ensureExplicitGatewayAuth({
1133
- urlOverride,
1134
- auth: explicitAuth,
1135
- errorHint: "Fix: pass --token or --password when using --url."
1136
- });
1137
- return {
1138
- url: buildGatewayConnectionDetails({
1139
- config,
1140
- ...urlOverride ? { url: urlOverride } : {}
1141
- }).url,
1142
- token: explicitAuth.token || (!urlOverride ? isRemoteMode ? typeof remote?.token === "string" && remote.token.trim().length > 0 ? remote.token.trim() : void 0 : process.env.REMOTECLAW_GATEWAY_TOKEN?.trim() || (typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : void 0) : void 0),
1143
- password: explicitAuth.password || (!urlOverride ? process.env.REMOTECLAW_GATEWAY_PASSWORD?.trim() || (typeof remote?.password === "string" && remote.password.trim().length > 0 ? remote.password.trim() : void 0) : void 0)
1144
- };
1145
- }
1146
-
1147
- //#endregion
1148
- //#region src/tui/components/fuzzy-filter.ts
1149
- /**
1150
- * Shared fuzzy filtering utilities for select list components.
1151
- */
1152
- /**
1153
- * Word boundary characters for matching.
1154
- */
1155
- const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
1156
- /**
1157
- * Check if position is at a word boundary.
1158
- */
1159
- function isWordBoundary(text, index) {
1160
- return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
1161
- }
1162
- /**
1163
- * Find index where query matches at a word boundary in text.
1164
- * Returns null if no match.
1165
- */
1166
- function findWordBoundaryIndex(text, query) {
1167
- if (!query) return null;
1168
- const textLower = text.toLowerCase();
1169
- const queryLower = query.toLowerCase();
1170
- const maxIndex = textLower.length - queryLower.length;
1171
- if (maxIndex < 0) return null;
1172
- for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
1173
- return null;
1174
- }
1175
- /**
1176
- * Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
1177
- * Returns score (lower = better) or null if no match.
1178
- */
1179
- function fuzzyMatchLower(queryLower, textLower) {
1180
- if (queryLower.length === 0) return 0;
1181
- if (queryLower.length > textLower.length) return null;
1182
- let queryIndex = 0;
1183
- let score = 0;
1184
- let lastMatchIndex = -1;
1185
- let consecutiveMatches = 0;
1186
- for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
1187
- const isAtWordBoundary = isWordBoundary(textLower, i);
1188
- if (lastMatchIndex === i - 1) {
1189
- consecutiveMatches++;
1190
- score -= consecutiveMatches * 5;
1191
- } else {
1192
- consecutiveMatches = 0;
1193
- if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
1194
- }
1195
- if (isAtWordBoundary) score -= 10;
1196
- score += i * .1;
1197
- lastMatchIndex = i;
1198
- queryIndex++;
1199
- }
1200
- return queryIndex < queryLower.length ? null : score;
1201
- }
1202
- /**
1203
- * Filter items using pre-lowercased searchTextLower field.
1204
- * Supports space-separated tokens (all must match).
1205
- */
1206
- function fuzzyFilterLower(items, queryLower) {
1207
- const trimmed = queryLower.trim();
1208
- if (!trimmed) return items;
1209
- const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
1210
- if (tokens.length === 0) return items;
1211
- const results = [];
1212
- for (const item of items) {
1213
- const text = item.searchTextLower ?? "";
1214
- let totalScore = 0;
1215
- let allMatch = true;
1216
- for (const token of tokens) {
1217
- const score = fuzzyMatchLower(token, text);
1218
- if (score !== null) totalScore += score;
1219
- else {
1220
- allMatch = false;
1221
- break;
1222
- }
1223
- }
1224
- if (allMatch) results.push({
1225
- item,
1226
- score: totalScore
1227
- });
1228
- }
1229
- results.sort((a, b) => a.score - b.score);
1230
- return results.map((r) => r.item);
1231
- }
1232
- /**
1233
- * Prepare items for fuzzy filtering by pre-computing lowercase search text.
1234
- */
1235
- function prepareSearchItems(items) {
1236
- return items.map((item) => {
1237
- const parts = [];
1238
- if (item.label) parts.push(item.label);
1239
- if (item.description) parts.push(item.description);
1240
- if (item.searchText) parts.push(item.searchText);
1241
- return {
1242
- ...item,
1243
- searchTextLower: parts.join(" ").toLowerCase()
1244
- };
1245
- });
1246
- }
1247
-
1248
- //#endregion
1249
- //#region src/tui/components/filterable-select-list.ts
1250
- /**
1251
- * Combines text input filtering with a select list.
1252
- * User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
1253
- */
1254
- var FilterableSelectList = class {
1255
- constructor(items, maxVisible, theme) {
1256
- this.filterText = "";
1257
- this.allItems = prepareSearchItems(items);
1258
- this.maxVisible = maxVisible;
1259
- this.theme = theme;
1260
- this.input = new Input();
1261
- this.selectList = new SelectList(this.allItems, maxVisible, theme);
1262
- }
1263
- applyFilter() {
1264
- const queryLower = this.filterText.toLowerCase();
1265
- if (!queryLower.trim()) {
1266
- this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
1267
- return;
1268
- }
1269
- this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
1270
- }
1271
- invalidate() {
1272
- this.input.invalidate();
1273
- this.selectList.invalidate();
1274
- }
1275
- render(width) {
1276
- const lines = [];
1277
- const filterLabel = this.theme.filterLabel("Filter: ");
1278
- const inputText = this.input.render(width - 8)[0] ?? "";
1279
- lines.push(filterLabel + inputText);
1280
- lines.push(chalk.dim("─".repeat(Math.max(0, width))));
1281
- const listLines = this.selectList.render(width);
1282
- lines.push(...listLines);
1283
- return lines;
1284
- }
1285
- handleInput(keyData) {
1286
- const allowVimNav = !this.filterText.trim();
1287
- if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
1288
- this.selectList.handleInput("\x1B[A");
1289
- return;
1290
- }
1291
- if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
1292
- this.selectList.handleInput("\x1B[B");
1293
- return;
1294
- }
1295
- if (matchesKey(keyData, "enter")) {
1296
- const selected = this.selectList.getSelectedItem();
1297
- if (selected) this.onSelect?.(selected);
1298
- return;
1299
- }
1300
- if (getEditorKeybindings().matches(keyData, "selectCancel")) {
1301
- if (this.filterText) {
1302
- this.filterText = "";
1303
- this.input.setValue("");
1304
- this.applyFilter();
1305
- } else this.onCancel?.();
1306
- return;
1307
- }
1308
- const prevValue = this.input.getValue();
1309
- this.input.handleInput(keyData);
1310
- const newValue = this.input.getValue();
1311
- if (newValue !== prevValue) {
1312
- this.filterText = newValue;
1313
- this.applyFilter();
1314
- }
1315
- }
1316
- getSelectedItem() {
1317
- return this.selectList.getSelectedItem();
1318
- }
1319
- getFilterText() {
1320
- return this.filterText;
1321
- }
1322
- };
1323
-
1324
- //#endregion
1325
- //#region src/tui/components/searchable-select-list.ts
1326
- const ANSI_ESCAPE = String.fromCharCode(27);
1327
- const ANSI_SGR_REGEX = new RegExp(`${ANSI_ESCAPE}\\[[0-9;]*m`, "g");
1328
- /**
1329
- * A select list with a search input at the top for fuzzy filtering.
1330
- */
1331
- var SearchableSelectList = class SearchableSelectList {
1332
- static {
1333
- this.DESCRIPTION_LAYOUT_MIN_WIDTH = 40;
1334
- }
1335
- static {
1336
- this.DESCRIPTION_MIN_WIDTH = 12;
1337
- }
1338
- static {
1339
- this.DESCRIPTION_SPACING_WIDTH = 2;
1340
- }
1341
- static {
1342
- this.RIGHT_MARGIN_WIDTH = 2;
1343
- }
1344
- constructor(items, maxVisible, theme) {
1345
- this.selectedIndex = 0;
1346
- this.regexCache = /* @__PURE__ */ new Map();
1347
- this.compareByScore = (a, b) => {
1348
- if (a.tier !== b.tier) return a.tier - b.tier;
1349
- if (a.score !== b.score) return a.score - b.score;
1350
- return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
1351
- };
1352
- this.items = items;
1353
- this.filteredItems = items;
1354
- this.maxVisible = maxVisible;
1355
- this.theme = theme;
1356
- this.searchInput = new Input();
1357
- }
1358
- getCachedRegex(pattern) {
1359
- let regex = this.regexCache.get(pattern);
1360
- if (!regex) {
1361
- regex = new RegExp(this.escapeRegex(pattern), "gi");
1362
- this.regexCache.set(pattern, regex);
1363
- }
1364
- return regex;
1365
- }
1366
- updateFilter() {
1367
- const query = this.searchInput.getValue().trim();
1368
- if (!query) this.filteredItems = this.items;
1369
- else this.filteredItems = this.smartFilter(query);
1370
- this.selectedIndex = 0;
1371
- this.notifySelectionChange();
1372
- }
1373
- /**
1374
- * Smart filtering that prioritizes:
1375
- * 1. Exact substring match in label (highest priority)
1376
- * 2. Word-boundary prefix match in label
1377
- * 3. Exact substring in description
1378
- * 4. Fuzzy match (lowest priority)
1379
- */
1380
- smartFilter(query) {
1381
- const q = query.toLowerCase();
1382
- const scoredItems = [];
1383
- const fuzzyCandidates = [];
1384
- for (const item of this.items) {
1385
- const rawLabel = this.getItemLabel(item);
1386
- const rawDesc = item.description ?? "";
1387
- const label = stripAnsi$1(rawLabel).toLowerCase();
1388
- const desc = stripAnsi$1(rawDesc).toLowerCase();
1389
- const labelIndex = label.indexOf(q);
1390
- if (labelIndex !== -1) {
1391
- scoredItems.push({
1392
- item,
1393
- tier: 0,
1394
- score: labelIndex
1395
- });
1396
- continue;
1397
- }
1398
- const wordBoundaryIndex = findWordBoundaryIndex(label, q);
1399
- if (wordBoundaryIndex !== null) {
1400
- scoredItems.push({
1401
- item,
1402
- tier: 1,
1403
- score: wordBoundaryIndex
1404
- });
1405
- continue;
1406
- }
1407
- const descIndex = desc.indexOf(q);
1408
- if (descIndex !== -1) {
1409
- scoredItems.push({
1410
- item,
1411
- tier: 2,
1412
- score: descIndex
1413
- });
1414
- continue;
1415
- }
1416
- const searchText = item.searchText ?? "";
1417
- fuzzyCandidates.push({
1418
- item,
1419
- searchTextLower: [
1420
- rawLabel,
1421
- rawDesc,
1422
- searchText
1423
- ].map((value) => stripAnsi$1(value)).filter(Boolean).join(" ").toLowerCase()
1424
- });
1425
- }
1426
- scoredItems.sort(this.compareByScore);
1427
- const fuzzyMatches = fuzzyFilterLower(fuzzyCandidates, q);
1428
- return [...scoredItems.map((s) => s.item), ...fuzzyMatches.map((entry) => entry.item)];
1429
- }
1430
- escapeRegex(str) {
1431
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1432
- }
1433
- getItemLabel(item) {
1434
- return item.label || item.value;
1435
- }
1436
- splitAnsiParts(text) {
1437
- const parts = [];
1438
- ANSI_SGR_REGEX.lastIndex = 0;
1439
- let lastIndex = 0;
1440
- let match;
1441
- while ((match = ANSI_SGR_REGEX.exec(text)) !== null) {
1442
- if (match.index > lastIndex) parts.push({
1443
- text: text.slice(lastIndex, match.index),
1444
- isAnsi: false
1445
- });
1446
- parts.push({
1447
- text: match[0],
1448
- isAnsi: true
1449
- });
1450
- lastIndex = match.index + match[0].length;
1451
- }
1452
- if (lastIndex < text.length) parts.push({
1453
- text: text.slice(lastIndex),
1454
- isAnsi: false
1455
- });
1456
- return parts;
1457
- }
1458
- highlightMatch(text, query) {
1459
- const tokens = query.trim().split(/\s+/).map((token) => token.toLowerCase()).filter((token) => token.length > 0);
1460
- if (tokens.length === 0) return text;
1461
- const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
1462
- let parts = this.splitAnsiParts(text);
1463
- for (const token of uniqueTokens) {
1464
- const regex = this.getCachedRegex(token);
1465
- const nextParts = [];
1466
- for (const part of parts) {
1467
- if (part.isAnsi) {
1468
- nextParts.push(part);
1469
- continue;
1470
- }
1471
- regex.lastIndex = 0;
1472
- const replaced = part.text.replace(regex, (match) => this.theme.matchHighlight(match));
1473
- if (replaced === part.text) {
1474
- nextParts.push(part);
1475
- continue;
1476
- }
1477
- nextParts.push(...this.splitAnsiParts(replaced));
1478
- }
1479
- parts = nextParts;
1480
- }
1481
- return parts.map((part) => part.text).join("");
1482
- }
1483
- setSelectedIndex(index) {
1484
- this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
1485
- }
1486
- invalidate() {
1487
- this.searchInput.invalidate();
1488
- }
1489
- render(width) {
1490
- const lines = [];
1491
- const prompt = this.theme.searchPrompt("search: ");
1492
- const inputWidth = Math.max(1, width - visibleWidth(prompt));
1493
- const inputText = this.searchInput.render(inputWidth)[0] ?? "";
1494
- lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
1495
- lines.push("");
1496
- const query = this.searchInput.getValue().trim();
1497
- if (this.filteredItems.length === 0) {
1498
- lines.push(this.theme.noMatch(" No matches"));
1499
- return lines;
1500
- }
1501
- const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
1502
- const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
1503
- for (let i = startIndex; i < endIndex; i++) {
1504
- const item = this.filteredItems[i];
1505
- if (!item) continue;
1506
- const isSelected = i === this.selectedIndex;
1507
- lines.push(this.renderItemLine(item, isSelected, width, query));
1508
- }
1509
- if (this.filteredItems.length > this.maxVisible) {
1510
- const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
1511
- lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
1512
- }
1513
- return lines;
1514
- }
1515
- renderItemLine(item, isSelected, width, query) {
1516
- const prefix = isSelected ? "→ " : " ";
1517
- const prefixWidth = prefix.length;
1518
- const displayValue = this.getItemLabel(item);
1519
- const description = item.description;
1520
- if (description) {
1521
- const descriptionLayout = this.getDescriptionLayout(width, prefixWidth);
1522
- if (descriptionLayout) {
1523
- const truncatedValue = truncateToWidth(displayValue, descriptionLayout.maxValueWidth, "");
1524
- const valueText = this.highlightMatch(truncatedValue, query);
1525
- const usedByValue = visibleWidth(valueText);
1526
- const descriptionWidth = descriptionLayout.availableWidth - usedByValue - descriptionLayout.spacingWidth;
1527
- if (descriptionWidth >= SearchableSelectList.DESCRIPTION_MIN_WIDTH) {
1528
- const spacing = " ".repeat(descriptionLayout.spacingWidth);
1529
- const truncatedDesc = truncateToWidth(description, descriptionWidth, "");
1530
- const highlightedDesc = this.highlightMatch(truncatedDesc, query);
1531
- const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
1532
- return isSelected ? this.theme.selectedText(line) : line;
1533
- }
1534
- }
1535
- }
1536
- const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
1537
- const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
1538
- return isSelected ? this.theme.selectedText(line) : line;
1539
- }
1540
- getDescriptionLayout(width, prefixWidth) {
1541
- if (width <= SearchableSelectList.DESCRIPTION_LAYOUT_MIN_WIDTH) return null;
1542
- const availableWidth = Math.max(1, width - prefixWidth - SearchableSelectList.RIGHT_MARGIN_WIDTH);
1543
- const maxValueWidth = availableWidth - SearchableSelectList.DESCRIPTION_MIN_WIDTH - SearchableSelectList.DESCRIPTION_SPACING_WIDTH;
1544
- if (maxValueWidth < 1) return null;
1545
- return {
1546
- availableWidth,
1547
- maxValueWidth,
1548
- spacingWidth: SearchableSelectList.DESCRIPTION_SPACING_WIDTH
1549
- };
1550
- }
1551
- handleInput(keyData) {
1552
- if (isKeyRelease(keyData)) return;
1553
- const allowVimNav = !this.searchInput.getValue().trim();
1554
- if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
1555
- this.selectedIndex = Math.max(0, this.selectedIndex - 1);
1556
- this.notifySelectionChange();
1557
- return;
1558
- }
1559
- if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
1560
- this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
1561
- this.notifySelectionChange();
1562
- return;
1563
- }
1564
- if (matchesKey(keyData, "enter")) {
1565
- const item = this.filteredItems[this.selectedIndex];
1566
- if (item && this.onSelect) this.onSelect(item);
1567
- return;
1568
- }
1569
- if (getEditorKeybindings().matches(keyData, "selectCancel")) {
1570
- if (this.onCancel) this.onCancel();
1571
- return;
1572
- }
1573
- const prevValue = this.searchInput.getValue();
1574
- this.searchInput.handleInput(keyData);
1575
- if (prevValue !== this.searchInput.getValue()) this.updateFilter();
1576
- }
1577
- notifySelectionChange() {
1578
- const item = this.filteredItems[this.selectedIndex];
1579
- if (item && this.onSelectionChange) this.onSelectionChange(item);
1580
- }
1581
- getSelectedItem() {
1582
- return this.filteredItems[this.selectedIndex] ?? null;
1583
- }
1584
- };
1585
-
1586
- //#endregion
1587
- //#region src/tui/components/selectors.ts
1588
- function createSearchableSelectList(items, maxVisible = 7) {
1589
- return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
1590
- }
1591
- function createFilterableSelectList(items, maxVisible = 7) {
1592
- return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
1593
- }
1594
- function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
1595
- return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
1596
- }
1597
-
1598
- //#endregion
1599
- //#region src/tui/tui-status-summary.ts
1600
- function formatStatusSummary(summary) {
1601
- const lines = [];
1602
- lines.push("Gateway status");
1603
- if (!summary.linkChannel) lines.push("Link channel: unknown");
1604
- else {
1605
- const linkLabel = summary.linkChannel.label ?? "Link channel";
1606
- const linked = summary.linkChannel.linked === true;
1607
- const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})` : "";
1608
- lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
1609
- }
1610
- const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
1611
- if (providerSummary.length > 0) {
1612
- lines.push("");
1613
- lines.push("System:");
1614
- for (const line of providerSummary) lines.push(` ${line}`);
1615
- }
1616
- const heartbeatAgents = summary.heartbeat?.agents ?? [];
1617
- if (heartbeatAgents.length > 0) {
1618
- const heartbeatParts = heartbeatAgents.map((agent) => {
1619
- const agentId = agent.agentId ?? "unknown";
1620
- if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
1621
- return `${agent.every ?? "unknown"} (${agentId})`;
1622
- });
1623
- lines.push("");
1624
- lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
1625
- }
1626
- const sessionPaths = summary.sessions?.paths ?? [];
1627
- if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
1628
- else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
1629
- const defaults = summary.sessions?.defaults;
1630
- const defaultModel = defaults?.model ?? "unknown";
1631
- const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
1632
- lines.push(`Default model: ${defaultModel}${defaultCtx}`);
1633
- const sessionCount = summary.sessions?.count ?? 0;
1634
- lines.push(`Active sessions: ${sessionCount}`);
1635
- const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
1636
- if (recent.length > 0) {
1637
- lines.push("Recent sessions:");
1638
- for (const entry of recent) {
1639
- const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
1640
- const model = entry.model ?? "unknown";
1641
- const usage = formatContextUsageLine({
1642
- total: entry.totalTokens ?? null,
1643
- context: entry.contextTokens ?? null,
1644
- remaining: entry.remainingTokens ?? null,
1645
- percent: entry.percentUsed ?? null
1646
- });
1647
- const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
1648
- lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
1649
- }
1650
- }
1651
- const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
1652
- if (queued.length > 0) {
1653
- const preview = queued.slice(0, 3).join(" | ");
1654
- lines.push(`Queued system events (${queued.length}): ${preview}`);
1655
- }
1656
- return lines;
1657
- }
1658
-
1659
- //#endregion
1660
- //#region src/tui/tui-command-handlers.ts
1661
- function createCommandHandlers(context) {
1662
- const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalRunId, forgetLocalRunId, requestExit } = context;
1663
- const setAgent = async (id) => {
1664
- state.currentAgentId = normalizeAgentId(id);
1665
- await setSession("");
1666
- };
1667
- const closeOverlayAndRender = () => {
1668
- closeOverlay();
1669
- tui.requestRender();
1670
- };
1671
- const openSelector = (selector, onSelect) => {
1672
- selector.onSelect = (item) => {
1673
- (async () => {
1674
- await onSelect(item.value);
1675
- closeOverlayAndRender();
1676
- })();
1677
- };
1678
- selector.onCancel = closeOverlayAndRender;
1679
- openOverlay(selector);
1680
- tui.requestRender();
1681
- };
1682
- const openModelSelector = async () => {
1683
- try {
1684
- const models = await client.listModels();
1685
- if (models.length === 0) {
1686
- chatLog.addSystem("no models available");
1687
- tui.requestRender();
1688
- return;
1689
- }
1690
- openSelector(createSearchableSelectList(models.map((model) => ({
1691
- value: `${model.provider}/${model.id}`,
1692
- label: `${model.provider}/${model.id}`,
1693
- description: model.name && model.name !== model.id ? model.name : ""
1694
- })), 9), async (value) => {
1695
- try {
1696
- const result = await client.patchSession({
1697
- key: state.currentSessionKey,
1698
- model: value
1699
- });
1700
- chatLog.addSystem(`model set to ${value}`);
1701
- applySessionInfoFromPatch(result);
1702
- await refreshSessionInfo();
1703
- } catch (err) {
1704
- chatLog.addSystem(`model set failed: ${String(err)}`);
1705
- }
1706
- });
1707
- } catch (err) {
1708
- chatLog.addSystem(`model list failed: ${String(err)}`);
1709
- tui.requestRender();
1710
- }
1711
- };
1712
- const openAgentSelector = async () => {
1713
- await refreshAgents();
1714
- if (state.agents.length === 0) {
1715
- chatLog.addSystem("no agents found");
1716
- tui.requestRender();
1717
- return;
1718
- }
1719
- openSelector(createSearchableSelectList(state.agents.map((agent) => ({
1720
- value: agent.id,
1721
- label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
1722
- description: agent.id === state.agentDefaultId ? "default" : ""
1723
- })), 9), async (value) => {
1724
- await setAgent(value);
1725
- });
1726
- };
1727
- const openSessionSelector = async () => {
1728
- try {
1729
- openSelector(createFilterableSelectList((await client.listSessions({
1730
- includeGlobal: false,
1731
- includeUnknown: false,
1732
- includeDerivedTitles: true,
1733
- includeLastMessage: true,
1734
- agentId: state.currentAgentId
1735
- })).sessions.map((session) => {
1736
- const title = session.derivedTitle ?? session.displayName;
1737
- const formattedKey = formatSessionKey(session.key);
1738
- const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
1739
- const timePart = session.updatedAt ? formatRelativeTimestamp(session.updatedAt, {
1740
- dateFallback: true,
1741
- fallback: ""
1742
- }) : "";
1743
- const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
1744
- const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
1745
- return {
1746
- value: session.key,
1747
- label,
1748
- description,
1749
- searchText: [
1750
- session.displayName,
1751
- session.label,
1752
- session.subject,
1753
- session.sessionId,
1754
- session.key,
1755
- session.lastMessagePreview
1756
- ].filter(Boolean).join(" ")
1757
- };
1758
- }), 9), async (value) => {
1759
- await setSession(value);
1760
- });
1761
- } catch (err) {
1762
- chatLog.addSystem(`sessions list failed: ${String(err)}`);
1763
- tui.requestRender();
1764
- }
1765
- };
1766
- const openSettings = () => {
1767
- openOverlay(createSettingsList([{
1768
- id: "tools",
1769
- label: "Tool output",
1770
- currentValue: state.toolsExpanded ? "expanded" : "collapsed",
1771
- values: ["collapsed", "expanded"]
1772
- }, {
1773
- id: "thinking",
1774
- label: "Show thinking",
1775
- currentValue: state.showThinking ? "on" : "off",
1776
- values: ["off", "on"]
1777
- }], (id, value) => {
1778
- if (id === "tools") {
1779
- state.toolsExpanded = value === "expanded";
1780
- chatLog.setToolsExpanded(state.toolsExpanded);
1781
- }
1782
- if (id === "thinking") {
1783
- state.showThinking = value === "on";
1784
- loadHistory();
1785
- }
1786
- tui.requestRender();
1787
- }, () => {
1788
- closeOverlay();
1789
- tui.requestRender();
1790
- }));
1791
- tui.requestRender();
1792
- };
1793
- const handleCommand = async (raw) => {
1794
- const { name, args } = parseCommand(raw);
1795
- if (!name) return;
1796
- switch (name) {
1797
- case "help":
1798
- chatLog.addSystem(helpText({
1799
- provider: state.sessionInfo.modelProvider,
1800
- model: state.sessionInfo.model
1801
- }));
1802
- break;
1803
- case "status":
1804
- try {
1805
- const status = await client.getStatus();
1806
- if (typeof status === "string") {
1807
- chatLog.addSystem(status);
1808
- break;
1809
- }
1810
- if (status && typeof status === "object") {
1811
- const lines = formatStatusSummary(status);
1812
- for (const line of lines) chatLog.addSystem(line);
1813
- break;
1814
- }
1815
- chatLog.addSystem("status: unknown response");
1816
- } catch (err) {
1817
- chatLog.addSystem(`status failed: ${String(err)}`);
1818
- }
1819
- break;
1820
- case "agent":
1821
- if (!args) await openAgentSelector();
1822
- else await setAgent(args);
1823
- break;
1824
- case "agents":
1825
- await openAgentSelector();
1826
- break;
1827
- case "session":
1828
- if (!args) await openSessionSelector();
1829
- else await setSession(args);
1830
- break;
1831
- case "sessions":
1832
- await openSessionSelector();
1833
- break;
1834
- case "model":
1835
- if (!args) await openModelSelector();
1836
- else try {
1837
- const result = await client.patchSession({
1838
- key: state.currentSessionKey,
1839
- model: args
1840
- });
1841
- chatLog.addSystem(`model set to ${args}`);
1842
- applySessionInfoFromPatch(result);
1843
- await refreshSessionInfo();
1844
- } catch (err) {
1845
- chatLog.addSystem(`model set failed: ${String(err)}`);
1846
- }
1847
- break;
1848
- case "models":
1849
- await openModelSelector();
1850
- break;
1851
- case "think":
1852
- if (!args) {
1853
- const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
1854
- chatLog.addSystem(`usage: /think <${levels}>`);
1855
- break;
1856
- }
1857
- try {
1858
- const result = await client.patchSession({
1859
- key: state.currentSessionKey,
1860
- thinkingLevel: args
1861
- });
1862
- chatLog.addSystem(`thinking set to ${args}`);
1863
- applySessionInfoFromPatch(result);
1864
- await refreshSessionInfo();
1865
- } catch (err) {
1866
- chatLog.addSystem(`think failed: ${String(err)}`);
1867
- }
1868
- break;
1869
- case "verbose":
1870
- if (!args) {
1871
- chatLog.addSystem("usage: /verbose <on|off>");
1872
- break;
1873
- }
1874
- try {
1875
- const result = await client.patchSession({
1876
- key: state.currentSessionKey,
1877
- verboseLevel: args
1878
- });
1879
- chatLog.addSystem(`verbose set to ${args}`);
1880
- applySessionInfoFromPatch(result);
1881
- await loadHistory();
1882
- } catch (err) {
1883
- chatLog.addSystem(`verbose failed: ${String(err)}`);
1884
- }
1885
- break;
1886
- case "reasoning":
1887
- if (!args) {
1888
- chatLog.addSystem("usage: /reasoning <on|off>");
1889
- break;
1890
- }
1891
- try {
1892
- const result = await client.patchSession({
1893
- key: state.currentSessionKey,
1894
- reasoningLevel: args
1895
- });
1896
- chatLog.addSystem(`reasoning set to ${args}`);
1897
- applySessionInfoFromPatch(result);
1898
- await refreshSessionInfo();
1899
- } catch (err) {
1900
- chatLog.addSystem(`reasoning failed: ${String(err)}`);
1901
- }
1902
- break;
1903
- case "usage": {
1904
- const normalized = args ? normalizeUsageDisplay(args) : void 0;
1905
- if (args && !normalized) {
1906
- chatLog.addSystem("usage: /usage <off|tokens|full>");
1907
- break;
1908
- }
1909
- const currentRaw = state.sessionInfo.responseUsage;
1910
- const current = resolveResponseUsageMode(currentRaw);
1911
- const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
1912
- try {
1913
- const result = await client.patchSession({
1914
- key: state.currentSessionKey,
1915
- responseUsage: next === "off" ? null : next
1916
- });
1917
- chatLog.addSystem(`usage footer: ${next}`);
1918
- applySessionInfoFromPatch(result);
1919
- await refreshSessionInfo();
1920
- } catch (err) {
1921
- chatLog.addSystem(`usage failed: ${String(err)}`);
1922
- }
1923
- break;
1924
- }
1925
- case "elevated":
1926
- if (!args) {
1927
- chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1928
- break;
1929
- }
1930
- if (![
1931
- "on",
1932
- "off",
1933
- "ask",
1934
- "full"
1935
- ].includes(args)) {
1936
- chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1937
- break;
1938
- }
1939
- try {
1940
- const result = await client.patchSession({
1941
- key: state.currentSessionKey,
1942
- elevatedLevel: args
1943
- });
1944
- chatLog.addSystem(`elevated set to ${args}`);
1945
- applySessionInfoFromPatch(result);
1946
- await refreshSessionInfo();
1947
- } catch (err) {
1948
- chatLog.addSystem(`elevated failed: ${String(err)}`);
1949
- }
1950
- break;
1951
- case "activation":
1952
- if (!args) {
1953
- chatLog.addSystem("usage: /activation <mention|always>");
1954
- break;
1955
- }
1956
- try {
1957
- const result = await client.patchSession({
1958
- key: state.currentSessionKey,
1959
- groupActivation: args === "always" ? "always" : "mention"
1960
- });
1961
- chatLog.addSystem(`activation set to ${args}`);
1962
- applySessionInfoFromPatch(result);
1963
- await refreshSessionInfo();
1964
- } catch (err) {
1965
- chatLog.addSystem(`activation failed: ${String(err)}`);
1966
- }
1967
- break;
1968
- case "new":
1969
- case "reset":
1970
- try {
1971
- state.sessionInfo.inputTokens = null;
1972
- state.sessionInfo.outputTokens = null;
1973
- state.sessionInfo.totalTokens = null;
1974
- tui.requestRender();
1975
- await client.resetSession(state.currentSessionKey, name);
1976
- chatLog.addSystem(`session ${state.currentSessionKey} reset`);
1977
- await loadHistory();
1978
- } catch (err) {
1979
- chatLog.addSystem(`reset failed: ${String(err)}`);
1980
- }
1981
- break;
1982
- case "abort":
1983
- await abortActive();
1984
- break;
1985
- case "settings":
1986
- openSettings();
1987
- break;
1988
- case "exit":
1989
- case "quit":
1990
- requestExit();
1991
- break;
1992
- default:
1993
- await sendMessage(raw);
1994
- break;
1995
- }
1996
- tui.requestRender();
1997
- };
1998
- const sendMessage = async (text) => {
1999
- if (!state.isConnected) {
2000
- chatLog.addSystem("not connected to gateway — message not sent");
2001
- setActivityStatus("disconnected");
2002
- tui.requestRender();
2003
- return;
2004
- }
2005
- try {
2006
- chatLog.addUser(text);
2007
- tui.requestRender();
2008
- const runId = randomUUID();
2009
- noteLocalRunId(runId);
2010
- state.activeChatRunId = runId;
2011
- setActivityStatus("sending");
2012
- tui.requestRender();
2013
- await client.sendChat({
2014
- sessionKey: state.currentSessionKey,
2015
- message: text,
2016
- thinking: opts.thinking,
2017
- deliver: deliverDefault,
2018
- timeoutMs: opts.timeoutMs,
2019
- runId
2020
- });
2021
- setActivityStatus("waiting");
2022
- tui.requestRender();
2023
- } catch (err) {
2024
- if (state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
2025
- state.activeChatRunId = null;
2026
- chatLog.addSystem(`send failed: ${String(err)}`);
2027
- setActivityStatus("error");
2028
- tui.requestRender();
2029
- }
2030
- };
2031
- return {
2032
- handleCommand,
2033
- sendMessage,
2034
- openModelSelector,
2035
- openAgentSelector,
2036
- openSessionSelector,
2037
- openSettings,
2038
- setAgent
2039
- };
2040
- }
2041
-
2042
- //#endregion
2043
- //#region src/tui/tui-stream-assembler.ts
2044
- function extractTextBlocksAndSignals(message) {
2045
- if (!message || typeof message !== "object") return {
2046
- textBlocks: [],
2047
- sawNonTextContentBlocks: false
2048
- };
2049
- const content = message.content;
2050
- if (typeof content === "string") {
2051
- const text = content.trim();
2052
- return {
2053
- textBlocks: text ? [text] : [],
2054
- sawNonTextContentBlocks: false
2055
- };
2056
- }
2057
- if (!Array.isArray(content)) return {
2058
- textBlocks: [],
2059
- sawNonTextContentBlocks: false
2060
- };
2061
- const textBlocks = [];
2062
- let sawNonTextContentBlocks = false;
2063
- for (const block of content) {
2064
- if (!block || typeof block !== "object") continue;
2065
- const rec = block;
2066
- if (rec.type === "text" && typeof rec.text === "string") {
2067
- const text = rec.text.trim();
2068
- if (text) textBlocks.push(text);
2069
- continue;
2070
- }
2071
- if (typeof rec.type === "string" && rec.type !== "thinking") sawNonTextContentBlocks = true;
2072
- }
2073
- return {
2074
- textBlocks,
2075
- sawNonTextContentBlocks
2076
- };
2077
- }
2078
- function isDroppedBoundaryTextBlockSubset(params) {
2079
- const { streamedTextBlocks, finalTextBlocks } = params;
2080
- if (finalTextBlocks.length === 0 || finalTextBlocks.length >= streamedTextBlocks.length) return false;
2081
- if (finalTextBlocks.every((block, index) => streamedTextBlocks[index] === block)) return true;
2082
- const suffixStart = streamedTextBlocks.length - finalTextBlocks.length;
2083
- return finalTextBlocks.every((block, index) => streamedTextBlocks[suffixStart + index] === block);
2084
- }
2085
- var TuiStreamAssembler = class {
2086
- constructor() {
2087
- this.runs = /* @__PURE__ */ new Map();
2088
- }
2089
- getOrCreateRun(runId) {
2090
- let state = this.runs.get(runId);
2091
- if (!state) {
2092
- state = {
2093
- thinkingText: "",
2094
- contentText: "",
2095
- contentBlocks: [],
2096
- sawNonTextContentBlocks: false,
2097
- displayText: ""
2098
- };
2099
- this.runs.set(runId, state);
2100
- }
2101
- return state;
2102
- }
2103
- updateRunState(state, message, showThinking, opts) {
2104
- const thinkingText = extractThinkingFromMessage(message);
2105
- const contentText = extractContentFromMessage(message);
2106
- const { textBlocks, sawNonTextContentBlocks } = extractTextBlocksAndSignals(message);
2107
- if (thinkingText) state.thinkingText = thinkingText;
2108
- if (contentText) {
2109
- const nextContentBlocks = textBlocks.length > 0 ? textBlocks : [contentText];
2110
- if (!(opts?.protectBoundaryDrops === true && (state.sawNonTextContentBlocks || sawNonTextContentBlocks) && isDroppedBoundaryTextBlockSubset({
2111
- streamedTextBlocks: state.contentBlocks,
2112
- finalTextBlocks: nextContentBlocks
2113
- }))) {
2114
- state.contentText = contentText;
2115
- state.contentBlocks = nextContentBlocks;
2116
- }
2117
- }
2118
- if (sawNonTextContentBlocks) state.sawNonTextContentBlocks = true;
2119
- state.displayText = composeThinkingAndContent({
2120
- thinkingText: state.thinkingText,
2121
- contentText: state.contentText,
2122
- showThinking
2123
- });
2124
- }
2125
- ingestDelta(runId, message, showThinking) {
2126
- const state = this.getOrCreateRun(runId);
2127
- const previousDisplayText = state.displayText;
2128
- this.updateRunState(state, message, showThinking, { protectBoundaryDrops: true });
2129
- if (!state.displayText || state.displayText === previousDisplayText) return null;
2130
- return state.displayText;
2131
- }
2132
- finalize(runId, message, showThinking) {
2133
- const state = this.getOrCreateRun(runId);
2134
- const streamedDisplayText = state.displayText;
2135
- const streamedTextBlocks = [...state.contentBlocks];
2136
- const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks;
2137
- this.updateRunState(state, message, showThinking);
2138
- const finalComposed = state.displayText;
2139
- const finalText = resolveFinalAssistantText({
2140
- finalText: streamedSawNonTextContentBlocks && isDroppedBoundaryTextBlockSubset({
2141
- streamedTextBlocks,
2142
- finalTextBlocks: state.contentBlocks
2143
- }) ? streamedDisplayText : finalComposed,
2144
- streamedText: streamedDisplayText
2145
- });
2146
- this.runs.delete(runId);
2147
- return finalText;
2148
- }
2149
- drop(runId) {
2150
- this.runs.delete(runId);
2151
- }
2152
- };
2153
-
2154
- //#endregion
2155
- //#region src/tui/tui-event-handlers.ts
2156
- function createEventHandlers(context) {
2157
- const { chatLog, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, isLocalRunId, forgetLocalRunId, clearLocalRunIds } = context;
2158
- const finalizedRuns = /* @__PURE__ */ new Map();
2159
- const sessionRuns = /* @__PURE__ */ new Map();
2160
- let streamAssembler = new TuiStreamAssembler();
2161
- let lastSessionKey = state.currentSessionKey;
2162
- const pruneRunMap = (runs) => {
2163
- if (runs.size <= 200) return;
2164
- const keepUntil = Date.now() - 600 * 1e3;
2165
- for (const [key, ts] of runs) {
2166
- if (runs.size <= 150) break;
2167
- if (ts < keepUntil) runs.delete(key);
2168
- }
2169
- if (runs.size > 200) for (const key of runs.keys()) {
2170
- runs.delete(key);
2171
- if (runs.size <= 150) break;
2172
- }
2173
- };
2174
- const syncSessionKey = () => {
2175
- if (state.currentSessionKey === lastSessionKey) return;
2176
- lastSessionKey = state.currentSessionKey;
2177
- finalizedRuns.clear();
2178
- sessionRuns.clear();
2179
- streamAssembler = new TuiStreamAssembler();
2180
- clearLocalRunIds?.();
2181
- };
2182
- const noteSessionRun = (runId) => {
2183
- sessionRuns.set(runId, Date.now());
2184
- pruneRunMap(sessionRuns);
2185
- };
2186
- const noteFinalizedRun = (runId) => {
2187
- finalizedRuns.set(runId, Date.now());
2188
- sessionRuns.delete(runId);
2189
- streamAssembler.drop(runId);
2190
- pruneRunMap(finalizedRuns);
2191
- };
2192
- const clearActiveRunIfMatch = (runId) => {
2193
- if (state.activeChatRunId === runId) state.activeChatRunId = null;
2194
- };
2195
- const finalizeRun = (params) => {
2196
- noteFinalizedRun(params.runId);
2197
- clearActiveRunIfMatch(params.runId);
2198
- if (params.wasActiveRun) setActivityStatus(params.status);
2199
- refreshSessionInfo?.();
2200
- };
2201
- const terminateRun = (params) => {
2202
- streamAssembler.drop(params.runId);
2203
- sessionRuns.delete(params.runId);
2204
- clearActiveRunIfMatch(params.runId);
2205
- if (params.wasActiveRun) setActivityStatus(params.status);
2206
- refreshSessionInfo?.();
2207
- };
2208
- const hasConcurrentActiveRun = (runId) => {
2209
- const activeRunId = state.activeChatRunId;
2210
- if (!activeRunId || activeRunId === runId) return false;
2211
- return sessionRuns.has(activeRunId);
2212
- };
2213
- const maybeRefreshHistoryForRun = (runId) => {
2214
- if (isLocalRunId?.(runId)) {
2215
- forgetLocalRunId?.(runId);
2216
- return;
2217
- }
2218
- if (hasConcurrentActiveRun(runId)) return;
2219
- loadHistory?.();
2220
- };
2221
- const handleChatEvent = (payload) => {
2222
- if (!payload || typeof payload !== "object") return;
2223
- const evt = payload;
2224
- syncSessionKey();
2225
- if (evt.sessionKey !== state.currentSessionKey) return;
2226
- if (finalizedRuns.has(evt.runId)) {
2227
- if (evt.state === "delta") return;
2228
- if (evt.state === "final") return;
2229
- }
2230
- noteSessionRun(evt.runId);
2231
- if (!state.activeChatRunId) state.activeChatRunId = evt.runId;
2232
- if (evt.state === "delta") {
2233
- const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
2234
- if (!displayText) return;
2235
- chatLog.updateAssistant(displayText, evt.runId);
2236
- setActivityStatus("streaming");
2237
- }
2238
- if (evt.state === "final") {
2239
- const wasActiveRun = state.activeChatRunId === evt.runId;
2240
- if (!evt.message) {
2241
- maybeRefreshHistoryForRun(evt.runId);
2242
- chatLog.dropAssistant(evt.runId);
2243
- finalizeRun({
2244
- runId: evt.runId,
2245
- wasActiveRun,
2246
- status: "idle"
2247
- });
2248
- tui.requestRender();
2249
- return;
2250
- }
2251
- if (isCommandMessage(evt.message)) {
2252
- maybeRefreshHistoryForRun(evt.runId);
2253
- const text = extractTextFromMessage(evt.message);
2254
- if (text) chatLog.addSystem(text);
2255
- finalizeRun({
2256
- runId: evt.runId,
2257
- wasActiveRun,
2258
- status: "idle"
2259
- });
2260
- tui.requestRender();
2261
- return;
2262
- }
2263
- maybeRefreshHistoryForRun(evt.runId);
2264
- const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
2265
- const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking);
2266
- if (finalText === "(no output)" && !isLocalRunId?.(evt.runId)) chatLog.dropAssistant(evt.runId);
2267
- else chatLog.finalizeAssistant(finalText, evt.runId);
2268
- finalizeRun({
2269
- runId: evt.runId,
2270
- wasActiveRun,
2271
- status: stopReason === "error" ? "error" : "idle"
2272
- });
2273
- }
2274
- if (evt.state === "aborted") {
2275
- const wasActiveRun = state.activeChatRunId === evt.runId;
2276
- chatLog.addSystem("run aborted");
2277
- terminateRun({
2278
- runId: evt.runId,
2279
- wasActiveRun,
2280
- status: "aborted"
2281
- });
2282
- maybeRefreshHistoryForRun(evt.runId);
2283
- }
2284
- if (evt.state === "error") {
2285
- const wasActiveRun = state.activeChatRunId === evt.runId;
2286
- chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
2287
- terminateRun({
2288
- runId: evt.runId,
2289
- wasActiveRun,
2290
- status: "error"
2291
- });
2292
- maybeRefreshHistoryForRun(evt.runId);
2293
- }
2294
- tui.requestRender();
2295
- };
2296
- const handleAgentEvent = (payload) => {
2297
- if (!payload || typeof payload !== "object") return;
2298
- const evt = payload;
2299
- syncSessionKey();
2300
- const isActiveRun = evt.runId === state.activeChatRunId;
2301
- if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
2302
- if (evt.stream === "tool") {
2303
- const verbose = state.sessionInfo.verboseLevel ?? "off";
2304
- const allowToolEvents = verbose !== "off";
2305
- const allowToolOutput = verbose === "full";
2306
- if (!allowToolEvents) return;
2307
- const data = evt.data ?? {};
2308
- const phase = asString(data.phase, "");
2309
- const toolCallId = asString(data.toolCallId, "");
2310
- const toolName = asString(data.name, "tool");
2311
- if (!toolCallId) return;
2312
- if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
2313
- else if (phase === "update") {
2314
- if (!allowToolOutput) return;
2315
- chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
2316
- } else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
2317
- else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
2318
- tui.requestRender();
2319
- return;
2320
- }
2321
- if (evt.stream === "lifecycle") {
2322
- if (!isActiveRun) return;
2323
- const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
2324
- if (phase === "start") setActivityStatus("running");
2325
- if (phase === "end") setActivityStatus("idle");
2326
- if (phase === "error") setActivityStatus("error");
2327
- tui.requestRender();
2328
- }
2329
- };
2330
- return {
2331
- handleChatEvent,
2332
- handleAgentEvent
2333
- };
2334
- }
2335
-
2336
- //#endregion
2337
- //#region src/tui/tui-local-shell.ts
2338
- function createLocalShellRunner(deps) {
2339
- let localExecAsked = false;
2340
- let localExecAllowed = false;
2341
- const createSelector = deps.createSelector ?? createSearchableSelectList;
2342
- const spawnCommand = deps.spawnCommand ?? spawn;
2343
- const getCwd = deps.getCwd ?? (() => process.cwd());
2344
- const env = deps.env ?? process.env;
2345
- const maxChars = deps.maxOutputChars ?? 4e4;
2346
- const ensureLocalExecAllowed = async () => {
2347
- if (localExecAllowed) return true;
2348
- if (localExecAsked) return false;
2349
- localExecAsked = true;
2350
- return await new Promise((resolve) => {
2351
- deps.chatLog.addSystem("Allow local shell commands for this session?");
2352
- deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
2353
- deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
2354
- const selector = createSelector([{
2355
- value: "no",
2356
- label: "No"
2357
- }, {
2358
- value: "yes",
2359
- label: "Yes"
2360
- }], 2);
2361
- selector.onSelect = (item) => {
2362
- deps.closeOverlay();
2363
- if (item.value === "yes") {
2364
- localExecAllowed = true;
2365
- deps.chatLog.addSystem("local shell: enabled for this session");
2366
- resolve(true);
2367
- } else {
2368
- deps.chatLog.addSystem("local shell: not enabled");
2369
- resolve(false);
2370
- }
2371
- deps.tui.requestRender();
2372
- };
2373
- selector.onCancel = () => {
2374
- deps.closeOverlay();
2375
- deps.chatLog.addSystem("local shell: cancelled");
2376
- deps.tui.requestRender();
2377
- resolve(false);
2378
- };
2379
- deps.openOverlay(selector);
2380
- deps.tui.requestRender();
2381
- });
2382
- };
2383
- const runLocalShellLine = async (line) => {
2384
- const cmd = line.slice(1);
2385
- if (cmd === "") return;
2386
- if (localExecAsked && !localExecAllowed) {
2387
- deps.chatLog.addSystem("local shell: not enabled for this session");
2388
- deps.tui.requestRender();
2389
- return;
2390
- }
2391
- if (!await ensureLocalExecAllowed()) return;
2392
- deps.chatLog.addSystem(`[local] $ ${cmd}`);
2393
- deps.tui.requestRender();
2394
- const appendWithCap = (text, chunk) => {
2395
- const combined = text + chunk;
2396
- return combined.length > maxChars ? combined.slice(-maxChars) : combined;
2397
- };
2398
- await new Promise((resolve) => {
2399
- const child = spawnCommand(cmd, {
2400
- shell: true,
2401
- cwd: getCwd(),
2402
- env
2403
- });
2404
- let stdout = "";
2405
- let stderr = "";
2406
- child.stdout.on("data", (buf) => {
2407
- stdout = appendWithCap(stdout, buf.toString("utf8"));
2408
- });
2409
- child.stderr.on("data", (buf) => {
2410
- stderr = appendWithCap(stderr, buf.toString("utf8"));
2411
- });
2412
- child.on("close", (code, signal) => {
2413
- const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
2414
- if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
2415
- deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
2416
- deps.tui.requestRender();
2417
- resolve();
2418
- });
2419
- child.on("error", (err) => {
2420
- deps.chatLog.addSystem(`[local] error: ${String(err)}`);
2421
- deps.tui.requestRender();
2422
- resolve();
2423
- });
2424
- });
2425
- };
2426
- return { runLocalShellLine };
2427
- }
2428
-
2429
- //#endregion
2430
- //#region src/tui/tui-overlays.ts
2431
- function createOverlayHandlers(host, fallbackFocus) {
2432
- const openOverlay = (component) => {
2433
- host.showOverlay(component);
2434
- };
2435
- const closeOverlay = () => {
2436
- if (host.hasOverlay()) {
2437
- host.hideOverlay();
2438
- return;
2439
- }
2440
- host.setFocus(fallbackFocus);
2441
- };
2442
- return {
2443
- openOverlay,
2444
- closeOverlay
2445
- };
2446
- }
2447
-
2448
- //#endregion
2449
- //#region src/tui/tui-session-actions.ts
2450
- function createSessionActions(context) {
2451
- const { client, chatLog, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
2452
- let refreshSessionInfoPromise = Promise.resolve();
2453
- let lastSessionDefaults = null;
2454
- const applyAgentsResult = (result) => {
2455
- state.agentDefaultId = normalizeAgentId(result.defaultId);
2456
- state.sessionMainKey = normalizeMainKey(result.mainKey);
2457
- state.sessionScope = result.scope ?? state.sessionScope;
2458
- state.agents = result.agents.map((agent) => ({
2459
- id: normalizeAgentId(agent.id),
2460
- name: agent.name?.trim() || void 0
2461
- }));
2462
- agentNames.clear();
2463
- for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
2464
- if (!state.initialSessionApplied) {
2465
- if (initialSessionAgentId) {
2466
- if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
2467
- } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
2468
- const nextSessionKey = resolveSessionKey(initialSessionInput);
2469
- if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
2470
- state.initialSessionApplied = true;
2471
- } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
2472
- updateHeader();
2473
- updateFooter();
2474
- };
2475
- const refreshAgents = async () => {
2476
- try {
2477
- applyAgentsResult(await client.listAgents());
2478
- } catch (err) {
2479
- chatLog.addSystem(`agents list failed: ${String(err)}`);
2480
- }
2481
- };
2482
- const updateAgentFromSessionKey = (key) => {
2483
- const parsed = parseAgentSessionKey(key);
2484
- if (!parsed) return;
2485
- const next = normalizeAgentId(parsed.agentId);
2486
- if (next !== state.currentAgentId) state.currentAgentId = next;
2487
- };
2488
- const resolveModelSelection = (entry) => {
2489
- if (entry?.modelProvider || entry?.model) return {
2490
- modelProvider: entry.modelProvider ?? state.sessionInfo.modelProvider,
2491
- model: entry.model ?? state.sessionInfo.model
2492
- };
2493
- const overrideModel = entry?.modelOverride?.trim();
2494
- if (overrideModel) return {
2495
- modelProvider: entry?.providerOverride?.trim() || state.sessionInfo.modelProvider,
2496
- model: overrideModel
2497
- };
2498
- return {
2499
- modelProvider: state.sessionInfo.modelProvider,
2500
- model: state.sessionInfo.model
2501
- };
2502
- };
2503
- const applySessionInfo = (params) => {
2504
- const entry = params.entry ?? void 0;
2505
- const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
2506
- const previousDefaults = lastSessionDefaults;
2507
- const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
2508
- if (params.defaults) lastSessionDefaults = params.defaults;
2509
- const entryUpdatedAt = entry?.updatedAt ?? null;
2510
- const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
2511
- const modelChanged = entry?.modelProvider !== void 0 && entry.modelProvider !== state.sessionInfo.modelProvider || entry?.model !== void 0 && entry.model !== state.sessionInfo.model;
2512
- if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged && !modelChanged) return;
2513
- const next = { ...state.sessionInfo };
2514
- if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
2515
- if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
2516
- if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
2517
- if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
2518
- if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
2519
- if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
2520
- if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
2521
- if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
2522
- if (entry?.displayName !== void 0) next.displayName = entry.displayName;
2523
- if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
2524
- const selection = resolveModelSelection(entry);
2525
- if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
2526
- if (selection.model !== void 0) next.model = selection.model;
2527
- state.sessionInfo = next;
2528
- updateAutocompleteProvider();
2529
- updateFooter();
2530
- tui.requestRender();
2531
- };
2532
- const runRefreshSessionInfo = async () => {
2533
- try {
2534
- const resolveListAgentId = () => {
2535
- if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
2536
- const parsed = parseAgentSessionKey(state.currentSessionKey);
2537
- return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
2538
- };
2539
- const listAgentId = resolveListAgentId();
2540
- const result = await client.listSessions({
2541
- includeGlobal: false,
2542
- includeUnknown: false,
2543
- agentId: listAgentId
2544
- });
2545
- const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
2546
- const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
2547
- const entry = result.sessions.find((row) => {
2548
- if (row.key === state.currentSessionKey) return true;
2549
- return normalizeMatchKey(row.key) === currentMatchKey;
2550
- });
2551
- if (entry?.key && entry.key !== state.currentSessionKey) {
2552
- updateAgentFromSessionKey(entry.key);
2553
- state.currentSessionKey = entry.key;
2554
- updateHeader();
2555
- }
2556
- applySessionInfo({
2557
- entry,
2558
- defaults: result.defaults
2559
- });
2560
- } catch (err) {
2561
- chatLog.addSystem(`sessions list failed: ${String(err)}`);
2562
- }
2563
- };
2564
- const refreshSessionInfo = async () => {
2565
- refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
2566
- await refreshSessionInfoPromise;
2567
- };
2568
- const applySessionInfoFromPatch = (result) => {
2569
- if (!result?.entry) return;
2570
- if (result.key && result.key !== state.currentSessionKey) {
2571
- updateAgentFromSessionKey(result.key);
2572
- state.currentSessionKey = result.key;
2573
- updateHeader();
2574
- }
2575
- const resolved = result.resolved;
2576
- applySessionInfo({
2577
- entry: resolved && (resolved.modelProvider || resolved.model) ? {
2578
- ...result.entry,
2579
- modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
2580
- model: resolved.model ?? result.entry.model
2581
- } : result.entry,
2582
- force: true
2583
- });
2584
- };
2585
- const loadHistory = async () => {
2586
- try {
2587
- const record = await client.loadHistory({
2588
- sessionKey: state.currentSessionKey,
2589
- limit: opts.historyLimit ?? 200
2590
- });
2591
- state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
2592
- state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
2593
- state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
2594
- const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
2595
- chatLog.clearAll();
2596
- chatLog.addSystem(`session ${state.currentSessionKey}`);
2597
- for (const entry of record.messages ?? []) {
2598
- if (!entry || typeof entry !== "object") continue;
2599
- const message = entry;
2600
- if (isCommandMessage(message)) {
2601
- const text = extractTextFromMessage(message);
2602
- if (text) chatLog.addSystem(text);
2603
- continue;
2604
- }
2605
- if (message.role === "user") {
2606
- const text = extractTextFromMessage(message);
2607
- if (text) chatLog.addUser(text);
2608
- continue;
2609
- }
2610
- if (message.role === "assistant") {
2611
- const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
2612
- if (text) chatLog.finalizeAssistant(text);
2613
- continue;
2614
- }
2615
- if (message.role === "toolResult") {
2616
- if (!showTools) continue;
2617
- const toolCallId = asString(message.toolCallId, "");
2618
- const toolName = asString(message.toolName, "tool");
2619
- chatLog.startTool(toolCallId, toolName, {}).setResult({
2620
- content: Array.isArray(message.content) ? message.content : [],
2621
- details: typeof message.details === "object" && message.details ? message.details : void 0
2622
- }, { isError: Boolean(message.isError) });
2623
- }
2624
- }
2625
- state.historyLoaded = true;
2626
- } catch (err) {
2627
- chatLog.addSystem(`history failed: ${String(err)}`);
2628
- }
2629
- await refreshSessionInfo();
2630
- tui.requestRender();
2631
- };
2632
- const setSession = async (rawKey) => {
2633
- const nextKey = resolveSessionKey(rawKey);
2634
- updateAgentFromSessionKey(nextKey);
2635
- state.currentSessionKey = nextKey;
2636
- state.activeChatRunId = null;
2637
- state.currentSessionId = null;
2638
- state.historyLoaded = false;
2639
- clearLocalRunIds?.();
2640
- updateHeader();
2641
- updateFooter();
2642
- await loadHistory();
2643
- };
2644
- const abortActive = async () => {
2645
- if (!state.activeChatRunId) {
2646
- chatLog.addSystem("no active run");
2647
- tui.requestRender();
2648
- return;
2649
- }
2650
- try {
2651
- await client.abortChat({
2652
- sessionKey: state.currentSessionKey,
2653
- runId: state.activeChatRunId
2654
- });
2655
- setActivityStatus("aborted");
2656
- } catch (err) {
2657
- chatLog.addSystem(`abort failed: ${String(err)}`);
2658
- setActivityStatus("abort failed");
2659
- }
2660
- tui.requestRender();
2661
- };
2662
- return {
2663
- applyAgentsResult,
2664
- refreshAgents,
2665
- refreshSessionInfo,
2666
- applySessionInfoFromPatch,
2667
- loadHistory,
2668
- setSession,
2669
- abortActive
2670
- };
2671
- }
2672
-
2673
- //#endregion
2674
- //#region src/tui/tui-waiting.ts
2675
- const defaultWaitingPhrases = [
2676
- "flibbertigibbeting",
2677
- "kerfuffling",
2678
- "dillydallying",
2679
- "twiddling thumbs",
2680
- "noodling",
2681
- "bamboozling",
2682
- "moseying",
2683
- "hobnobbing",
2684
- "pondering",
2685
- "conjuring"
2686
- ];
2687
- function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
2688
- return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
2689
- }
2690
- function shimmerText(theme, text, tick) {
2691
- const width = 6;
2692
- const hi = (ch) => theme.bold(theme.accentSoft(ch));
2693
- const pos = tick % (text.length + width);
2694
- const start = Math.max(0, pos - width);
2695
- const end = Math.min(text.length - 1, pos);
2696
- let out = "";
2697
- for (let i = 0; i < text.length; i++) {
2698
- const ch = text[i];
2699
- out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
2700
- }
2701
- return out;
2702
- }
2703
- function buildWaitingStatusMessage(params) {
2704
- const phrase = pickWaitingPhrase(params.tick, params.phrases);
2705
- return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
2706
- }
2707
-
2708
- //#endregion
2709
- //#region src/tui/tui.ts
2710
- function createEditorSubmitHandler(params) {
2711
- return (text) => {
2712
- const raw = text;
2713
- const value = raw.trim();
2714
- params.editor.setText("");
2715
- if (!value) return;
2716
- if (raw.startsWith("!") && raw !== "!") {
2717
- params.editor.addToHistory(raw);
2718
- params.handleBangLine(raw);
2719
- return;
2720
- }
2721
- params.editor.addToHistory(value);
2722
- if (value.startsWith("/")) {
2723
- params.handleCommand(value);
2724
- return;
2725
- }
2726
- params.sendMessage(value);
2727
- };
2728
- }
2729
- function shouldEnableWindowsGitBashPasteFallback(params) {
2730
- const platform = params?.platform ?? process.platform;
2731
- const env = params?.env ?? process.env;
2732
- const termProgram = (env.TERM_PROGRAM ?? "").toLowerCase();
2733
- if (platform === "darwin") {
2734
- if (termProgram.includes("iterm") || termProgram.includes("apple_terminal")) return true;
2735
- return false;
2736
- }
2737
- if (platform !== "win32") return false;
2738
- const msystem = (env.MSYSTEM ?? "").toUpperCase();
2739
- const shell = env.SHELL ?? "";
2740
- if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) return true;
2741
- if (shell.toLowerCase().includes("bash")) return true;
2742
- return termProgram.includes("mintty");
2743
- }
2744
- function createSubmitBurstCoalescer(params) {
2745
- const windowMs = Math.max(1, params.burstWindowMs ?? 50);
2746
- const now = params.now ?? (() => Date.now());
2747
- const setTimer = params.setTimer ?? setTimeout;
2748
- const clearTimer = params.clearTimer ?? clearTimeout;
2749
- let pending = null;
2750
- let pendingAt = 0;
2751
- let flushTimer = null;
2752
- const clearFlushTimer = () => {
2753
- if (!flushTimer) return;
2754
- clearTimer(flushTimer);
2755
- flushTimer = null;
2756
- };
2757
- const flushPending = () => {
2758
- if (pending === null) return;
2759
- const value = pending;
2760
- pending = null;
2761
- pendingAt = 0;
2762
- clearFlushTimer();
2763
- params.submit(value);
2764
- };
2765
- const scheduleFlush = () => {
2766
- clearFlushTimer();
2767
- flushTimer = setTimer(() => {
2768
- flushPending();
2769
- }, windowMs);
2770
- };
2771
- return (value) => {
2772
- if (!params.enabled) {
2773
- params.submit(value);
2774
- return;
2775
- }
2776
- if (value.includes("\n")) {
2777
- flushPending();
2778
- params.submit(value);
2779
- return;
2780
- }
2781
- const ts = now();
2782
- if (pending === null) {
2783
- pending = value;
2784
- pendingAt = ts;
2785
- scheduleFlush();
2786
- return;
2787
- }
2788
- if (ts - pendingAt <= windowMs) {
2789
- pending = `${pending}\n${value}`;
2790
- pendingAt = ts;
2791
- scheduleFlush();
2792
- return;
2793
- }
2794
- flushPending();
2795
- pending = value;
2796
- pendingAt = ts;
2797
- scheduleFlush();
2798
- };
2799
- }
2800
- function resolveTuiSessionKey(params) {
2801
- const trimmed = (params.raw ?? "").trim();
2802
- if (!trimmed) {
2803
- if (params.sessionScope === "global") return "global";
2804
- return buildAgentMainSessionKey({
2805
- agentId: params.currentAgentId,
2806
- mainKey: params.sessionMainKey
2807
- });
2808
- }
2809
- if (trimmed === "global" || trimmed === "unknown") return trimmed;
2810
- if (trimmed.startsWith("agent:")) return trimmed;
2811
- return `agent:${params.currentAgentId}:${trimmed}`;
2812
- }
2813
- function resolveGatewayDisconnectState(reason) {
2814
- const reasonLabel = reason?.trim() ? reason.trim() : "closed";
2815
- if (/pairing required/i.test(reasonLabel)) return {
2816
- connectionStatus: `gateway disconnected: ${reasonLabel}`,
2817
- activityStatus: "pairing required: run remoteclaw devices list",
2818
- pairingHint: "Pairing required. Run `remoteclaw devices list`, approve your request ID, then reconnect."
2819
- };
2820
- return {
2821
- connectionStatus: `gateway disconnected: ${reasonLabel}`,
2822
- activityStatus: "idle"
2823
- };
2824
- }
2825
- function createBackspaceDeduper(params) {
2826
- const dedupeWindowMs = Math.max(0, Math.floor(params?.dedupeWindowMs ?? 8));
2827
- const now = params?.now ?? (() => Date.now());
2828
- let lastBackspaceAt = -1;
2829
- return (data) => {
2830
- if (!matchesKey(data, Key.backspace)) return data;
2831
- const ts = now();
2832
- if (lastBackspaceAt >= 0 && ts - lastBackspaceAt <= dedupeWindowMs) return "";
2833
- lastBackspaceAt = ts;
2834
- return data;
2835
- };
2836
- }
2837
- function resolveCtrlCAction(params) {
2838
- const exitWindowMs = Math.max(1, Math.floor(params.exitWindowMs ?? 1e3));
2839
- if (params.hasInput) return {
2840
- action: "clear",
2841
- nextLastCtrlCAt: params.now
2842
- };
2843
- if (params.now - params.lastCtrlCAt <= exitWindowMs) return {
2844
- action: "exit",
2845
- nextLastCtrlCAt: params.lastCtrlCAt
2846
- };
2847
- return {
2848
- action: "warn",
2849
- nextLastCtrlCAt: params.now
2850
- };
2851
- }
2852
- async function runTui(opts) {
2853
- const config = loadConfig();
2854
- const initialSessionInput = (opts.session ?? "").trim();
2855
- let sessionScope = config.session?.scope ?? "per-sender";
2856
- let sessionMainKey = normalizeMainKey(config.session?.mainKey);
2857
- let agentDefaultId = resolveDefaultAgentId(config);
2858
- let currentAgentId = agentDefaultId;
2859
- let agents = [];
2860
- const agentNames = /* @__PURE__ */ new Map();
2861
- let currentSessionKey = "";
2862
- let initialSessionApplied = false;
2863
- let currentSessionId = null;
2864
- let activeChatRunId = null;
2865
- let historyLoaded = false;
2866
- let isConnected = false;
2867
- let wasDisconnected = false;
2868
- let toolsExpanded = false;
2869
- let showThinking = false;
2870
- let pairingHintShown = false;
2871
- const localRunIds = /* @__PURE__ */ new Set();
2872
- const deliverDefault = opts.deliver ?? false;
2873
- const autoMessage = opts.message?.trim();
2874
- let autoMessageSent = false;
2875
- let sessionInfo = {};
2876
- let lastCtrlCAt = 0;
2877
- let exitRequested = false;
2878
- let activityStatus = "idle";
2879
- let connectionStatus = "connecting";
2880
- let statusTimeout = null;
2881
- let statusTimer = null;
2882
- let statusStartedAt = null;
2883
- let lastActivityStatus = activityStatus;
2884
- const state = {
2885
- get agentDefaultId() {
2886
- return agentDefaultId;
2887
- },
2888
- set agentDefaultId(value) {
2889
- agentDefaultId = value;
2890
- },
2891
- get sessionMainKey() {
2892
- return sessionMainKey;
2893
- },
2894
- set sessionMainKey(value) {
2895
- sessionMainKey = value;
2896
- },
2897
- get sessionScope() {
2898
- return sessionScope;
2899
- },
2900
- set sessionScope(value) {
2901
- sessionScope = value;
2902
- },
2903
- get agents() {
2904
- return agents;
2905
- },
2906
- set agents(value) {
2907
- agents = value;
2908
- },
2909
- get currentAgentId() {
2910
- return currentAgentId;
2911
- },
2912
- set currentAgentId(value) {
2913
- currentAgentId = value;
2914
- },
2915
- get currentSessionKey() {
2916
- return currentSessionKey;
2917
- },
2918
- set currentSessionKey(value) {
2919
- currentSessionKey = value;
2920
- },
2921
- get currentSessionId() {
2922
- return currentSessionId;
2923
- },
2924
- set currentSessionId(value) {
2925
- currentSessionId = value;
2926
- },
2927
- get activeChatRunId() {
2928
- return activeChatRunId;
2929
- },
2930
- set activeChatRunId(value) {
2931
- activeChatRunId = value;
2932
- },
2933
- get historyLoaded() {
2934
- return historyLoaded;
2935
- },
2936
- set historyLoaded(value) {
2937
- historyLoaded = value;
2938
- },
2939
- get sessionInfo() {
2940
- return sessionInfo;
2941
- },
2942
- set sessionInfo(value) {
2943
- sessionInfo = value;
2944
- },
2945
- get initialSessionApplied() {
2946
- return initialSessionApplied;
2947
- },
2948
- set initialSessionApplied(value) {
2949
- initialSessionApplied = value;
2950
- },
2951
- get isConnected() {
2952
- return isConnected;
2953
- },
2954
- set isConnected(value) {
2955
- isConnected = value;
2956
- },
2957
- get autoMessageSent() {
2958
- return autoMessageSent;
2959
- },
2960
- set autoMessageSent(value) {
2961
- autoMessageSent = value;
2962
- },
2963
- get toolsExpanded() {
2964
- return toolsExpanded;
2965
- },
2966
- set toolsExpanded(value) {
2967
- toolsExpanded = value;
2968
- },
2969
- get showThinking() {
2970
- return showThinking;
2971
- },
2972
- set showThinking(value) {
2973
- showThinking = value;
2974
- },
2975
- get connectionStatus() {
2976
- return connectionStatus;
2977
- },
2978
- set connectionStatus(value) {
2979
- connectionStatus = value;
2980
- },
2981
- get activityStatus() {
2982
- return activityStatus;
2983
- },
2984
- set activityStatus(value) {
2985
- activityStatus = value;
2986
- },
2987
- get statusTimeout() {
2988
- return statusTimeout;
2989
- },
2990
- set statusTimeout(value) {
2991
- statusTimeout = value;
2992
- },
2993
- get lastCtrlCAt() {
2994
- return lastCtrlCAt;
2995
- },
2996
- set lastCtrlCAt(value) {
2997
- lastCtrlCAt = value;
2998
- }
2999
- };
3000
- const noteLocalRunId = (runId) => {
3001
- if (!runId) return;
3002
- localRunIds.add(runId);
3003
- if (localRunIds.size > 200) {
3004
- const [first] = localRunIds;
3005
- if (first) localRunIds.delete(first);
3006
- }
3007
- };
3008
- const forgetLocalRunId = (runId) => {
3009
- localRunIds.delete(runId);
3010
- };
3011
- const isLocalRunId = (runId) => localRunIds.has(runId);
3012
- const clearLocalRunIds = () => {
3013
- localRunIds.clear();
3014
- };
3015
- const client = new GatewayChatClient({
3016
- url: opts.url,
3017
- token: opts.token,
3018
- password: opts.password
3019
- });
3020
- const tui = new TUI(new ProcessTerminal());
3021
- const dedupeBackspace = createBackspaceDeduper();
3022
- tui.addInputListener((data) => {
3023
- const next = dedupeBackspace(data);
3024
- if (next.length === 0) return { consume: true };
3025
- return { data: next };
3026
- });
3027
- const header = new Text("", 1, 0);
3028
- const statusContainer = new Container();
3029
- const footer = new Text("", 1, 0);
3030
- const chatLog = new ChatLog();
3031
- const editor = new CustomEditor(tui, editorTheme);
3032
- const root = new Container();
3033
- root.addChild(header);
3034
- root.addChild(chatLog);
3035
- root.addChild(statusContainer);
3036
- root.addChild(footer);
3037
- root.addChild(editor);
3038
- const updateAutocompleteProvider = () => {
3039
- editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
3040
- cfg: config,
3041
- provider: sessionInfo.modelProvider,
3042
- model: sessionInfo.model
3043
- }), process.cwd()));
3044
- };
3045
- tui.addChild(root);
3046
- tui.setFocus(editor);
3047
- const formatSessionKey = (key) => {
3048
- if (key === "global" || key === "unknown") return key;
3049
- return parseAgentSessionKey(key)?.rest ?? key;
3050
- };
3051
- const formatAgentLabel = (id) => {
3052
- const name = agentNames.get(id);
3053
- return name ? `${id} (${name})` : id;
3054
- };
3055
- const resolveSessionKey = (raw) => {
3056
- return resolveTuiSessionKey({
3057
- raw,
3058
- sessionScope,
3059
- currentAgentId,
3060
- sessionMainKey
3061
- });
3062
- };
3063
- currentSessionKey = resolveSessionKey(initialSessionInput);
3064
- const updateHeader = () => {
3065
- const sessionLabel = formatSessionKey(currentSessionKey);
3066
- const agentLabel = formatAgentLabel(currentAgentId);
3067
- header.setText(theme.header(`remoteclaw tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
3068
- };
3069
- const busyStates = new Set([
3070
- "sending",
3071
- "waiting",
3072
- "streaming",
3073
- "running"
3074
- ]);
3075
- let statusText = null;
3076
- let statusLoader = null;
3077
- const formatElapsed = (startMs) => {
3078
- const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
3079
- if (totalSeconds < 60) return `${totalSeconds}s`;
3080
- return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
3081
- };
3082
- const ensureStatusText = () => {
3083
- if (statusText) return;
3084
- statusContainer.clear();
3085
- statusLoader?.stop();
3086
- statusLoader = null;
3087
- statusText = new Text("", 1, 0);
3088
- statusContainer.addChild(statusText);
3089
- };
3090
- const ensureStatusLoader = () => {
3091
- if (statusLoader) return;
3092
- statusContainer.clear();
3093
- statusText = null;
3094
- statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
3095
- statusContainer.addChild(statusLoader);
3096
- };
3097
- let waitingTick = 0;
3098
- let waitingTimer = null;
3099
- let waitingPhrase = null;
3100
- const updateBusyStatusMessage = () => {
3101
- if (!statusLoader || !statusStartedAt) return;
3102
- const elapsed = formatElapsed(statusStartedAt);
3103
- if (activityStatus === "waiting") {
3104
- waitingTick++;
3105
- statusLoader.setMessage(buildWaitingStatusMessage({
3106
- theme,
3107
- tick: waitingTick,
3108
- elapsed,
3109
- connectionStatus,
3110
- phrases: waitingPhrase ? [waitingPhrase] : void 0
3111
- }));
3112
- return;
3113
- }
3114
- statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
3115
- };
3116
- const startStatusTimer = () => {
3117
- if (statusTimer) return;
3118
- statusTimer = setInterval(() => {
3119
- if (!busyStates.has(activityStatus)) return;
3120
- updateBusyStatusMessage();
3121
- }, 1e3);
3122
- };
3123
- const stopStatusTimer = () => {
3124
- if (!statusTimer) return;
3125
- clearInterval(statusTimer);
3126
- statusTimer = null;
3127
- };
3128
- const startWaitingTimer = () => {
3129
- if (waitingTimer) return;
3130
- if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
3131
- waitingTick = 0;
3132
- waitingTimer = setInterval(() => {
3133
- if (activityStatus !== "waiting") return;
3134
- updateBusyStatusMessage();
3135
- }, 120);
3136
- };
3137
- const stopWaitingTimer = () => {
3138
- if (!waitingTimer) return;
3139
- clearInterval(waitingTimer);
3140
- waitingTimer = null;
3141
- waitingPhrase = null;
3142
- };
3143
- const renderStatus = () => {
3144
- if (busyStates.has(activityStatus)) {
3145
- if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
3146
- ensureStatusLoader();
3147
- if (activityStatus === "waiting") {
3148
- stopStatusTimer();
3149
- startWaitingTimer();
3150
- } else {
3151
- stopWaitingTimer();
3152
- startStatusTimer();
3153
- }
3154
- updateBusyStatusMessage();
3155
- } else {
3156
- statusStartedAt = null;
3157
- stopStatusTimer();
3158
- stopWaitingTimer();
3159
- statusLoader?.stop();
3160
- statusLoader = null;
3161
- ensureStatusText();
3162
- const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
3163
- statusText?.setText(theme.dim(text));
3164
- }
3165
- lastActivityStatus = activityStatus;
3166
- };
3167
- const setConnectionStatus = (text, ttlMs) => {
3168
- connectionStatus = text;
3169
- renderStatus();
3170
- if (statusTimeout) clearTimeout(statusTimeout);
3171
- if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
3172
- connectionStatus = isConnected ? "connected" : "disconnected";
3173
- renderStatus();
3174
- }, ttlMs);
3175
- };
3176
- const setActivityStatus = (text) => {
3177
- activityStatus = text;
3178
- renderStatus();
3179
- };
3180
- const updateFooter = () => {
3181
- const sessionKeyLabel = formatSessionKey(currentSessionKey);
3182
- const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
3183
- const agentLabel = formatAgentLabel(currentAgentId);
3184
- const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
3185
- const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
3186
- const think = sessionInfo.thinkingLevel ?? "off";
3187
- const verbose = sessionInfo.verboseLevel ?? "off";
3188
- const reasoning = sessionInfo.reasoningLevel ?? "off";
3189
- const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
3190
- const footerParts = [
3191
- `agent ${agentLabel}`,
3192
- `session ${sessionLabel}`,
3193
- modelLabel,
3194
- think !== "off" ? `think ${think}` : null,
3195
- verbose !== "off" ? `verbose ${verbose}` : null,
3196
- reasoningLabel,
3197
- tokens
3198
- ].filter(Boolean);
3199
- footer.setText(theme.dim(footerParts.join(" | ")));
3200
- };
3201
- const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
3202
- const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
3203
- client,
3204
- chatLog,
3205
- tui,
3206
- opts,
3207
- state,
3208
- agentNames,
3209
- initialSessionInput,
3210
- initialSessionAgentId: (() => {
3211
- if (!initialSessionInput) return null;
3212
- const parsed = parseAgentSessionKey(initialSessionInput);
3213
- return parsed ? normalizeAgentId(parsed.agentId) : null;
3214
- })(),
3215
- resolveSessionKey,
3216
- updateHeader,
3217
- updateFooter,
3218
- updateAutocompleteProvider,
3219
- setActivityStatus,
3220
- clearLocalRunIds
3221
- });
3222
- const { handleChatEvent, handleAgentEvent } = createEventHandlers({
3223
- chatLog,
3224
- tui,
3225
- state,
3226
- setActivityStatus,
3227
- refreshSessionInfo,
3228
- loadHistory,
3229
- isLocalRunId,
3230
- forgetLocalRunId,
3231
- clearLocalRunIds
3232
- });
3233
- const requestExit = () => {
3234
- if (exitRequested) return;
3235
- exitRequested = true;
3236
- client.stop();
3237
- tui.stop();
3238
- process.exit(0);
3239
- };
3240
- const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
3241
- client,
3242
- chatLog,
3243
- tui,
3244
- opts,
3245
- state,
3246
- deliverDefault,
3247
- openOverlay,
3248
- closeOverlay,
3249
- refreshSessionInfo,
3250
- applySessionInfoFromPatch,
3251
- loadHistory,
3252
- setSession,
3253
- refreshAgents,
3254
- abortActive,
3255
- setActivityStatus,
3256
- formatSessionKey,
3257
- noteLocalRunId,
3258
- forgetLocalRunId,
3259
- requestExit
3260
- });
3261
- const { runLocalShellLine } = createLocalShellRunner({
3262
- chatLog,
3263
- tui,
3264
- openOverlay,
3265
- closeOverlay
3266
- });
3267
- updateAutocompleteProvider();
3268
- editor.onSubmit = createSubmitBurstCoalescer({
3269
- submit: createEditorSubmitHandler({
3270
- editor,
3271
- handleCommand,
3272
- sendMessage,
3273
- handleBangLine: runLocalShellLine
3274
- }),
3275
- enabled: shouldEnableWindowsGitBashPasteFallback()
3276
- });
3277
- editor.onEscape = () => {
3278
- abortActive();
3279
- };
3280
- const handleCtrlC = () => {
3281
- const now = Date.now();
3282
- const decision = resolveCtrlCAction({
3283
- hasInput: editor.getText().trim().length > 0,
3284
- now,
3285
- lastCtrlCAt
3286
- });
3287
- lastCtrlCAt = decision.nextLastCtrlCAt;
3288
- if (decision.action === "clear") {
3289
- editor.setText("");
3290
- setActivityStatus("cleared input; press ctrl+c again to exit");
3291
- tui.requestRender();
3292
- return;
3293
- }
3294
- if (decision.action === "exit") {
3295
- requestExit();
3296
- return;
3297
- }
3298
- setActivityStatus("press ctrl+c again to exit");
3299
- tui.requestRender();
3300
- };
3301
- editor.onCtrlC = () => {
3302
- handleCtrlC();
3303
- };
3304
- editor.onCtrlD = () => {
3305
- requestExit();
3306
- };
3307
- editor.onCtrlO = () => {
3308
- toolsExpanded = !toolsExpanded;
3309
- chatLog.setToolsExpanded(toolsExpanded);
3310
- setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
3311
- tui.requestRender();
3312
- };
3313
- editor.onCtrlL = () => {
3314
- openModelSelector();
3315
- };
3316
- editor.onCtrlG = () => {
3317
- openAgentSelector();
3318
- };
3319
- editor.onCtrlP = () => {
3320
- openSessionSelector();
3321
- };
3322
- editor.onCtrlT = () => {
3323
- showThinking = !showThinking;
3324
- loadHistory();
3325
- };
3326
- client.onEvent = (evt) => {
3327
- if (evt.event === "chat") handleChatEvent(evt.payload);
3328
- if (evt.event === "agent") handleAgentEvent(evt.payload);
3329
- };
3330
- client.onConnected = () => {
3331
- isConnected = true;
3332
- pairingHintShown = false;
3333
- const reconnected = wasDisconnected;
3334
- wasDisconnected = false;
3335
- setConnectionStatus("connected");
3336
- (async () => {
3337
- await refreshAgents();
3338
- updateHeader();
3339
- await loadHistory();
3340
- setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
3341
- tui.requestRender();
3342
- if (!autoMessageSent && autoMessage) {
3343
- autoMessageSent = true;
3344
- await sendMessage(autoMessage);
3345
- }
3346
- updateFooter();
3347
- tui.requestRender();
3348
- })();
3349
- };
3350
- client.onDisconnected = (reason) => {
3351
- isConnected = false;
3352
- wasDisconnected = true;
3353
- historyLoaded = false;
3354
- const disconnectState = resolveGatewayDisconnectState(reason);
3355
- setConnectionStatus(disconnectState.connectionStatus, 5e3);
3356
- setActivityStatus(disconnectState.activityStatus);
3357
- if (disconnectState.pairingHint && !pairingHintShown) {
3358
- pairingHintShown = true;
3359
- chatLog.addSystem(disconnectState.pairingHint);
3360
- }
3361
- updateFooter();
3362
- tui.requestRender();
3363
- };
3364
- client.onGap = (info) => {
3365
- setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
3366
- tui.requestRender();
3367
- };
3368
- updateHeader();
3369
- setConnectionStatus("connecting");
3370
- updateFooter();
3371
- const sigintHandler = () => {
3372
- handleCtrlC();
3373
- };
3374
- const sigtermHandler = () => {
3375
- requestExit();
3376
- };
3377
- process.on("SIGINT", sigintHandler);
3378
- process.on("SIGTERM", sigtermHandler);
3379
- tui.start();
3380
- client.start();
3381
- await new Promise((resolve) => {
3382
- const finish = () => {
3383
- process.removeListener("SIGINT", sigintHandler);
3384
- process.removeListener("SIGTERM", sigtermHandler);
3385
- resolve();
3386
- };
3387
- process.once("exit", finish);
3388
- });
3389
- }
3390
-
3391
- //#endregion
3392
- export { runTui as t };