@noxsoft/anima 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1570) hide show
  1. package/CHANGELOG.md +2065 -0
  2. package/LICENSE +23 -0
  3. package/README.md +47 -0
  4. package/anima.mjs +56 -0
  5. package/dist/accounts-Cc5E4IDO.js +260 -0
  6. package/dist/accounts-CcVrwKqv.js +259 -0
  7. package/dist/acp-cli-BbvR4dNz.js +1081 -0
  8. package/dist/acp-cli-CePIi7gD.js +1084 -0
  9. package/dist/agent-CSrGrAg1.js +725 -0
  10. package/dist/agent-NgeWEcBM.js +725 -0
  11. package/dist/agent-events-UF0DxwKS.js +182 -0
  12. package/dist/agent-scope-BVf4aSwY.js +112 -0
  13. package/dist/agent-scope-OZi7lb8S.js +452 -0
  14. package/dist/agent-scope-V1bi9OYL.js +452 -0
  15. package/dist/agents-Bw06WthM.js +809 -0
  16. package/dist/agents.config-Dvo2ULxs.js +182 -0
  17. package/dist/agents.config-d6H0_3oj.js +182 -0
  18. package/dist/argv-DqUHKf0o.js +73 -0
  19. package/dist/audit-Buja3mbS.js +2401 -0
  20. package/dist/audit-CWIz6mM7.js +2401 -0
  21. package/dist/auth-91o2YM96.js +648 -0
  22. package/dist/auth-choice-7dFCqblU.js +2681 -0
  23. package/dist/auth-choice-S_0K9gpl.js +2681 -0
  24. package/dist/auth-health-CctpRTdC.js +149 -0
  25. package/dist/auth-health-DoHai4eD.js +149 -0
  26. package/dist/auth-lZ26wsbN.js +639 -0
  27. package/dist/auth-profiles-Cz2rxrav.js +2690 -0
  28. package/dist/auth-profiles-_5BsNObq.js +1565 -0
  29. package/dist/banner-ieAUufx9.js +294 -0
  30. package/dist/boolean-Ce2-qkSB.js +30 -0
  31. package/dist/boolean-Wzu0-e0P.js +30 -0
  32. package/dist/brew-CVZkr0GU.js +46 -0
  33. package/dist/brew-DAdyX1_1.js +46 -0
  34. package/dist/browser-cli-D_qgYDik.js +1679 -0
  35. package/dist/browser-cli-DldrdaCW.js +1676 -0
  36. package/dist/budget-ChKARYPY.js +132 -0
  37. package/dist/budget-Dspr6N_e.js +132 -0
  38. package/dist/build-info.json +5 -0
  39. package/dist/bundled/boot-md/HOOK.md +19 -0
  40. package/dist/bundled/boot-md/handler.js +861 -0
  41. package/dist/bundled/bootstrap-extra-files/HOOK.md +53 -0
  42. package/dist/bundled/bootstrap-extra-files/handler.js +39 -0
  43. package/dist/bundled/command-logger/HOOK.md +122 -0
  44. package/dist/bundled/command-logger/handler.js +55 -0
  45. package/dist/bundled/session-memory/HOOK.md +109 -0
  46. package/dist/bundled/session-memory/handler.js +128 -0
  47. package/dist/call-DPzNR_Qi.js +282 -0
  48. package/dist/call-ktoEhkOQ.js +282 -0
  49. package/dist/canvas-host/a2ui/.bundle.hash +1 -0
  50. package/dist/canvas-host/a2ui/a2ui.bundle.js +19040 -0
  51. package/dist/canvas-host/a2ui/index.html +307 -0
  52. package/dist/catalog-BAayBt1L.js +185 -0
  53. package/dist/catalog-BNsf97BM.js +185 -0
  54. package/dist/channel-options-C3GV4Fgg.js +33 -0
  55. package/dist/channel-options-DJ4GNfwk.js +32 -0
  56. package/dist/channel-selection-CujyiWGM.js +51 -0
  57. package/dist/channel-selection-DfGpCyh2.js +51 -0
  58. package/dist/channel-web-D42mzlCJ.js +2162 -0
  59. package/dist/channels-cli-BAtARz4A.js +1306 -0
  60. package/dist/channels-cli-Ddo_tIRR.js +1304 -0
  61. package/dist/channels-status-issues-DBc1pU_R.js +18 -0
  62. package/dist/channels-status-issues-DjO9MHIG.js +18 -0
  63. package/dist/chrome-Bi6iZ5sG.js +1601 -0
  64. package/dist/chrome-DNSv7Cpy.js +1629 -0
  65. package/dist/chrome-DScZx4Lk.js +1601 -0
  66. package/dist/chunk-mxPVo000.js +348 -0
  67. package/dist/clack-prompter-B0kl7shw.js +92 -0
  68. package/dist/clack-prompter-B1YxZdRy.js +92 -0
  69. package/dist/cli/daemon-cli.js +9 -0
  70. package/dist/cli-D3hUnL_G.js +101 -0
  71. package/dist/cli-DDwD6VgH.js +99 -0
  72. package/dist/cli-session-CP7ZH2-6.js +5463 -0
  73. package/dist/cli-session-oXJQpenl.js +5408 -0
  74. package/dist/cli-utils-BTBABPX9.js +40 -0
  75. package/dist/cli-utils-DtAxdCte.js +40 -0
  76. package/dist/client-C1avc0vD.js +1692 -0
  77. package/dist/client-CC94YZrT.js +1692 -0
  78. package/dist/clipboard-B2fBy8tG.js +31 -0
  79. package/dist/clipboard-BbGnZskJ.js +31 -0
  80. package/dist/command-format-Clp46jkj.js +38 -0
  81. package/dist/command-format-DELazozB.js +52 -0
  82. package/dist/command-format-SkzzRqR1.js +52 -0
  83. package/dist/command-options-CSbuuqHr.js +8 -0
  84. package/dist/command-options-Cp1tf96a.js +8 -0
  85. package/dist/command-registry-DDGudZEQ.js +248 -0
  86. package/dist/commands-CRcFD5MO.js +509 -0
  87. package/dist/commands-Dh40OpQL.js +509 -0
  88. package/dist/commands-registry-Bd0xbvwG.js +766 -0
  89. package/dist/commands-registry-DYfRSVF3.js +766 -0
  90. package/dist/common-D6bu0zHC.js +287 -0
  91. package/dist/common-zW9Y2P1B.js +287 -0
  92. package/dist/completion-cli-B9Cn374l.js +431 -0
  93. package/dist/completion-cli-BEHghUFx.js +432 -0
  94. package/dist/config-Bmm8tmZF.js +6523 -0
  95. package/dist/config-CHc5qzaI.js +5704 -0
  96. package/dist/config-Co6UXXF5.js +11 -0
  97. package/dist/config-Xm0j9LUa.js +5705 -0
  98. package/dist/config-cli-9ZbCHoV8.js +247 -0
  99. package/dist/config-cli-sxuGl29N.js +244 -0
  100. package/dist/config-guard-BwRD-b9Z.js +93 -0
  101. package/dist/config-guard-Dy7wyhAX.js +76 -0
  102. package/dist/config-sync-Bllc1TJ4.js +89 -0
  103. package/dist/config-sync-mfuOoGHl.js +89 -0
  104. package/dist/configure-CCyVzQZ7.js +1006 -0
  105. package/dist/configure-Nntbxt4t.js +1008 -0
  106. package/dist/constants-BwBn5CGe.js +65 -0
  107. package/dist/constants-O8yBqCBv.js +65 -0
  108. package/dist/context-DKaQYnCH.js +60 -0
  109. package/dist/control-service-BeOtZCCS.js +72 -0
  110. package/dist/control-service-vyKJ-XUp.js +72 -0
  111. package/dist/cron-cli-BasqtsJ0.js +451 -0
  112. package/dist/cron-cli-C8XzIpyX.js +448 -0
  113. package/dist/daemon-cli-cwL2GI5i.js +565 -0
  114. package/dist/daemon-cli-sjDh2xbf.js +566 -0
  115. package/dist/daemon-cli.js +13117 -0
  116. package/dist/daemon-runtime-BuMT6nck.js +460 -0
  117. package/dist/daemon-runtime-CTvi3m4D.js +460 -0
  118. package/dist/dangerous-tools-5ObDWy1N.js +32 -0
  119. package/dist/dangerous-tools-Jwr7jqNw.js +32 -0
  120. package/dist/deliver-D6cdhg5m.js +1097 -0
  121. package/dist/deliver-DlNDKlA4.js +1162 -0
  122. package/dist/deliver-bC6iI_rv.js +1097 -0
  123. package/dist/delivery-queue-B6IHz4Ry.js +220 -0
  124. package/dist/delivery-queue-TnQykYsg.js +220 -0
  125. package/dist/deps-C9kDG-Ru.js +42 -0
  126. package/dist/devices-cli-BE-Nib4Y.js +198 -0
  127. package/dist/devices-cli-GyPlNRyd.js +195 -0
  128. package/dist/diagnostics-Dj75aEHN.js +35 -0
  129. package/dist/diagnostics-DlIw6fqD.js +35 -0
  130. package/dist/directory-cli-BEaIvWkc.js +246 -0
  131. package/dist/directory-cli-CZ_-DP5Z.js +243 -0
  132. package/dist/dispatcher-Bkcui7jz.js +100 -0
  133. package/dist/dispatcher-C1B6cT_7.js +100 -0
  134. package/dist/display-A8k-mxv8.js +171 -0
  135. package/dist/display-BDOsXu8F.js +171 -0
  136. package/dist/dns-cli-BUzpVoMv.js +200 -0
  137. package/dist/dns-cli-DstQOMQt.js +197 -0
  138. package/dist/dock-DbxBBv30.js +753 -0
  139. package/dist/dock-cPBY4qGl.js +753 -0
  140. package/dist/docs-cli-BWp6p-Tq.js +161 -0
  141. package/dist/docs-cli-x22FnZfL.js +159 -0
  142. package/dist/doctor-B5HFw-nC.js +1813 -0
  143. package/dist/doctor-DnEyqGcQ.js +1815 -0
  144. package/dist/doctor-completion-BMEPXgVg.js +92 -0
  145. package/dist/doctor-completion-usPeH2ol.js +92 -0
  146. package/dist/doctor-config-flow-CS0WFnjL.js +1232 -0
  147. package/dist/doctor-config-flow-Cs4O_Kmq.js +1232 -0
  148. package/dist/engine-DgK9s3lk.js +561 -0
  149. package/dist/engine-ZSd5I5JN.js +561 -0
  150. package/dist/entry.js +1560 -0
  151. package/dist/env-0lJfCPsw.js +32 -0
  152. package/dist/errors-A_GqUU6B.js +26 -0
  153. package/dist/errors-CHow2wtt.js +37 -0
  154. package/dist/errors-Cojm0Kl7.js +37 -0
  155. package/dist/exec-BenD3A5l.js +1167 -0
  156. package/dist/exec-BizYYQgP.js +255 -0
  157. package/dist/exec-Bv3pyjeM.js +255 -0
  158. package/dist/exec-approvals-BP9AhCSw.js +1221 -0
  159. package/dist/exec-approvals-CdLmKX2R.js +1221 -0
  160. package/dist/exec-approvals-cli-25CGlFNw.js +368 -0
  161. package/dist/exec-approvals-cli-BXZ-hOlT.js +371 -0
  162. package/dist/extensionAPI.js +8542 -0
  163. package/dist/format-CjKG6raZ.js +20 -0
  164. package/dist/format-Mq6iU0_5.js +20 -0
  165. package/dist/format-duration-Cm3xh8xz.js +58 -0
  166. package/dist/format-duration-DhWzz_5b.js +58 -0
  167. package/dist/format-relative-C6kUHuOj.js +55 -0
  168. package/dist/format-relative-sy9iviQN.js +55 -0
  169. package/dist/frontmatter-YijVi0FQ.js +204 -0
  170. package/dist/gateway-cli-B9uc0RCI.js +19971 -0
  171. package/dist/gateway-cli-D8Qz7kCf.js +19972 -0
  172. package/dist/gateway-rpc-Ch9mCYEB.js +28 -0
  173. package/dist/gateway-rpc-DBhcdLFs.js +28 -0
  174. package/dist/github-copilot-auth-D6ZErYqa.js +1418 -0
  175. package/dist/github-copilot-auth-DGmyWJms.js +1418 -0
  176. package/dist/gmail-setup-utils-BPo_LkKI.js +428 -0
  177. package/dist/gmail-setup-utils-D3Yqgor7.js +428 -0
  178. package/dist/health-DsTZaAzV.js +1258 -0
  179. package/dist/health-V6dGthLA.js +1253 -0
  180. package/dist/health-format-CdP99j3Y.js +208 -0
  181. package/dist/health-format-JEChH08S.js +208 -0
  182. package/dist/heartbeat-visibility-CkL00WRR.js +98 -0
  183. package/dist/heartbeat-visibility-Cmni9671.js +98 -0
  184. package/dist/help-format-DUBI91Ti.js +17 -0
  185. package/dist/help-format-Dl4bsrLI.js +17 -0
  186. package/dist/helpers-9N2Q5aZj.js +25 -0
  187. package/dist/helpers-DLgbkcEn.js +25 -0
  188. package/dist/helpers-ZKNRexvX.js +10 -0
  189. package/dist/helpers-eJFa4K6r.js +10 -0
  190. package/dist/hooks-cli-Cu0D0fPS.js +993 -0
  191. package/dist/hooks-cli-E63uffR6.js +991 -0
  192. package/dist/hooks-status-B-e96dZj.js +356 -0
  193. package/dist/hooks-status-C_9sE0ox.js +356 -0
  194. package/dist/image-ops-Dlt3T7th.js +541 -0
  195. package/dist/image-ops-omlvdfah.js +541 -0
  196. package/dist/index.js +499 -0
  197. package/dist/init-Bm04RagW.js +122 -0
  198. package/dist/init-CaJBf4p1.js +122 -0
  199. package/dist/input-provenance-BgwBljRz.js +35 -0
  200. package/dist/input-provenance-DJBdpeKk.js +35 -0
  201. package/dist/input-provenance-iu26y0GH.js +35 -0
  202. package/dist/installs-C2iMRBVz.js +383 -0
  203. package/dist/installs-D-cPGdCw.js +383 -0
  204. package/dist/internal-hooks-DFTIurVM.js +77 -0
  205. package/dist/ipv4-C5QxzriV.js +1964 -0
  206. package/dist/ipv4-TxR9wQCQ.js +1964 -0
  207. package/dist/is-main-Dt9DTcH1.js +25 -0
  208. package/dist/is-main-cB3p7uob.js +25 -0
  209. package/dist/lanes-CNxj3tit.js +232 -0
  210. package/dist/legacy-names-CKU7tKQR.js +8 -0
  211. package/dist/lifecycle-core-B_7XRcvF.js +388 -0
  212. package/dist/lifecycle-core-By83PVAK.js +387 -0
  213. package/dist/links-BfjHVTB_.js +15 -0
  214. package/dist/links-DPGe0OHw.js +15 -0
  215. package/dist/llm-slug-generator.js +62 -0
  216. package/dist/loader-6Qkyybg1.js +87 -0
  217. package/dist/loader-Dmc0KyQK.js +87 -0
  218. package/dist/logging-54nXj81z.js +1 -0
  219. package/dist/logging-BdnOSVPD.js +1 -0
  220. package/dist/logging-DB6BQmhi.js +15 -0
  221. package/dist/logging-mcb66J0p.js +15 -0
  222. package/dist/login--8D8kyRy.js +61 -0
  223. package/dist/login-C-ugYHKt.js +61 -0
  224. package/dist/login-CX5Q2fYl.js +59 -0
  225. package/dist/login-qr-BLmGvITg.js +321 -0
  226. package/dist/login-qr-BNtuXLKL.js +323 -0
  227. package/dist/login-qr-PcyTC7Ra.js +326 -0
  228. package/dist/logs-cli-BEQVkiXp.js +245 -0
  229. package/dist/logs-cli-CIqiVMkY.js +242 -0
  230. package/dist/manager-Bsy9ifug.js +3244 -0
  231. package/dist/manager-CDgcZ51c.js +3246 -0
  232. package/dist/manager-D7QQ5XrE.js +3244 -0
  233. package/dist/manifest-registry-CW1zCyRF.js +748 -0
  234. package/dist/manifest-registry-D4lM2RdV.js +748 -0
  235. package/dist/markdown-tables-BT1X6jqH.js +347 -0
  236. package/dist/markdown-tables-DHgOK2vI.js +348 -0
  237. package/dist/media-THyainiE.js +1342 -0
  238. package/dist/memory-cli-BmIyAOZm.js +869 -0
  239. package/dist/memory-cli-BoXdfCLT.js +868 -0
  240. package/dist/message-channel-dSTVVCyX.js +110 -0
  241. package/dist/message-channel-w4F2b2F6.js +110 -0
  242. package/dist/migrate-BR6iAIjO.js +157 -0
  243. package/dist/migrate-D0EcMs0f.js +157 -0
  244. package/dist/mime-B1ZoR53M.js +145 -0
  245. package/dist/mime-Bm1xTtpY.js +145 -0
  246. package/dist/mime-C1RlpUSs.js +145 -0
  247. package/dist/model-param-b-C4BL7w0Z.js +16 -0
  248. package/dist/model-param-b-DPwyNGn8.js +16 -0
  249. package/dist/model-selection-BnEobs_z.js +2692 -0
  250. package/dist/models-KLd8Evmq.js +2545 -0
  251. package/dist/models-cli-D4UFQLid.js +258 -0
  252. package/dist/models-cli-DJHs5rJF.js +2739 -0
  253. package/dist/net-B5lXhYLV.js +218 -0
  254. package/dist/net-CDi_lJMH.js +88 -0
  255. package/dist/node-cli-BNCJUkgA.js +1319 -0
  256. package/dist/node-cli-C7S0vk0_.js +1322 -0
  257. package/dist/node-match-8XZnaid6.js +34 -0
  258. package/dist/node-match-B3Osv-5C.js +34 -0
  259. package/dist/node-service-BFxHJsno.js +67 -0
  260. package/dist/node-service-DUnan4uK.js +67 -0
  261. package/dist/nodes-cli-DOXhYgc8.js +1200 -0
  262. package/dist/nodes-cli-wvPZ3HwH.js +1197 -0
  263. package/dist/nodes-screen-1YiLkqr5.js +234 -0
  264. package/dist/nodes-screen-DZeD8hE5.js +234 -0
  265. package/dist/normalize-Dlcj9D3K.js +52 -0
  266. package/dist/normalize-GDK8JTNW.js +52 -0
  267. package/dist/note-Bi8Wb8DV.js +73 -0
  268. package/dist/note-uiuPxhyX.js +73 -0
  269. package/dist/npm-registry-spec-B-XIShkB.js +351 -0
  270. package/dist/npm-registry-spec-za3itb5Y.js +351 -0
  271. package/dist/onboard-DiTRW6CH.js +1165 -0
  272. package/dist/onboard-channels-BgruIpyg.js +672 -0
  273. package/dist/onboard-channels-gyq0VHHp.js +672 -0
  274. package/dist/onboard-helpers-BEaUind0.js +365 -0
  275. package/dist/onboard-helpers-f5Zprayl.js +365 -0
  276. package/dist/onboard-lH3XPWAK.js +1166 -0
  277. package/dist/onboarding-D0FOkXGt.js +910 -0
  278. package/dist/onboarding-kQVgbiIR.js +911 -0
  279. package/dist/openclaw-root-0yHXtO35.js +88 -0
  280. package/dist/openclaw-root-C85WMnVV.js +88 -0
  281. package/dist/orchestrator-CYTk7mq6.js +355 -0
  282. package/dist/orchestrator-J6ELnJXl.js +355 -0
  283. package/dist/outbound-BEq0qbPR.js +214 -0
  284. package/dist/outbound-BSVD-rjk.js +2062 -0
  285. package/dist/outbound-DXijk0db.js +214 -0
  286. package/dist/outbound-send-deps-ANnAhImn.js +14 -0
  287. package/dist/outbound-send-deps-BNGPU7jV.js +55 -0
  288. package/dist/pairing-cli-DKUyb6eK.js +118 -0
  289. package/dist/pairing-cli-ET2p_mXH.js +121 -0
  290. package/dist/pairing-store-CGYSwICJ.js +388 -0
  291. package/dist/pairing-store-DqQPqRMe.js +388 -0
  292. package/dist/parse-6-2MDhdT.js +23 -0
  293. package/dist/parse-CpunmTOS.js +23 -0
  294. package/dist/parse-log-line-Bqh1SSzC.js +44 -0
  295. package/dist/parse-log-line-DUZCjXbl.js +44 -0
  296. package/dist/parse-port-BKB9Exlg.js +12 -0
  297. package/dist/parse-port-DrfvwwiL.js +12 -0
  298. package/dist/parse-timeout-Di_tcEmi.js +16 -0
  299. package/dist/parse-timeout-vVlESvju.js +16 -0
  300. package/dist/path-env-Bu6k0jDQ.js +89 -0
  301. package/dist/path-env-C0zQSjw8.js +89 -0
  302. package/dist/paths-BTc4nk-6.js +126 -0
  303. package/dist/paths-BgUi2Z2G.js +54 -0
  304. package/dist/paths-C6VCWKo3.js +238 -0
  305. package/dist/paths-CCxa0o9c.js +222 -0
  306. package/dist/paths-CxRf2rBG.js +129 -0
  307. package/dist/paths-DcVEkYX5.js +54 -0
  308. package/dist/paths-hcX1Gqg5.js +129 -0
  309. package/dist/pi-auth-json-BzX-qyRo.js +82 -0
  310. package/dist/pi-auth-json-eesA38iW.js +78 -0
  311. package/dist/pi-auth-json-uEDdgg8K.js +80 -0
  312. package/dist/pi-embedded-C1Nl7L89.js +22 -0
  313. package/dist/pi-model-discovery-BkqhoPls.js +20 -0
  314. package/dist/pi-model-discovery-CQOWUAmK.js +3 -0
  315. package/dist/pi-model-discovery-DsRqYJLy.js +20 -0
  316. package/dist/pi-tools.policy-D9AUlreI.js +200 -0
  317. package/dist/pi-tools.policy-DRDm3v-2.js +200 -0
  318. package/dist/plugin-auto-enable-C-JwYMlZ.js +282 -0
  319. package/dist/plugin-auto-enable-DLIDBBfi.js +282 -0
  320. package/dist/plugin-registry-Bp8mivr-.js +32 -0
  321. package/dist/plugin-registry-CP7KgCvC.js +32 -0
  322. package/dist/plugin-sdk/account-id.d.ts +1 -0
  323. package/dist/plugin-sdk/account-id.js +15 -0
  324. package/dist/plugin-sdk/agents/agent-paths.d.ts +6 -0
  325. package/dist/plugin-sdk/agents/agent-scope.d.ts +37 -0
  326. package/dist/plugin-sdk/agents/anima-tools.d.ts +1 -0
  327. package/dist/plugin-sdk/agents/apply-patch-update.d.ts +10 -0
  328. package/dist/plugin-sdk/agents/apply-patch.d.ts +35 -0
  329. package/dist/plugin-sdk/agents/auth-profiles/constants.d.ts +20 -0
  330. package/dist/plugin-sdk/agents/auth-profiles/display.d.ts +7 -0
  331. package/dist/plugin-sdk/agents/auth-profiles/doctor.d.ts +8 -0
  332. package/dist/plugin-sdk/agents/auth-profiles/external-cli-sync.d.ts +7 -0
  333. package/dist/plugin-sdk/agents/auth-profiles/oauth.d.ts +12 -0
  334. package/dist/plugin-sdk/agents/auth-profiles/order.d.ts +8 -0
  335. package/dist/plugin-sdk/agents/auth-profiles/paths.d.ts +4 -0
  336. package/dist/plugin-sdk/agents/auth-profiles/profiles.d.ts +23 -0
  337. package/dist/plugin-sdk/agents/auth-profiles/repair.d.ts +14 -0
  338. package/dist/plugin-sdk/agents/auth-profiles/session-override.d.ts +18 -0
  339. package/dist/plugin-sdk/agents/auth-profiles/store.d.ts +10 -0
  340. package/dist/plugin-sdk/agents/auth-profiles/types.d.ts +60 -0
  341. package/dist/plugin-sdk/agents/auth-profiles/usage.d.ts +47 -0
  342. package/dist/plugin-sdk/agents/auth-profiles.d.ts +11 -0
  343. package/dist/plugin-sdk/agents/bash-process-registry.d.ts +70 -0
  344. package/dist/plugin-sdk/agents/bash-tools.d.ts +4 -0
  345. package/dist/plugin-sdk/agents/bash-tools.exec-runtime.d.ts +73 -0
  346. package/dist/plugin-sdk/agents/bash-tools.exec.d.ts +55 -0
  347. package/dist/plugin-sdk/agents/bash-tools.process.d.ts +7 -0
  348. package/dist/plugin-sdk/agents/bash-tools.shared.d.ts +48 -0
  349. package/dist/plugin-sdk/agents/bedrock-discovery.d.ts +9 -0
  350. package/dist/plugin-sdk/agents/bootstrap-files.d.ts +25 -0
  351. package/dist/plugin-sdk/agents/bootstrap-hooks.d.ts +10 -0
  352. package/dist/plugin-sdk/agents/channel-tools.d.ts +27 -0
  353. package/dist/plugin-sdk/agents/chutes-oauth.d.ts +46 -0
  354. package/dist/plugin-sdk/agents/cli-backends.d.ts +8 -0
  355. package/dist/plugin-sdk/agents/cli-credentials.d.ts +83 -0
  356. package/dist/plugin-sdk/agents/cli-runner/helpers.d.ts +76 -0
  357. package/dist/plugin-sdk/agents/cli-runner.d.ts +41 -0
  358. package/dist/plugin-sdk/agents/cli-session.d.ts +3 -0
  359. package/dist/plugin-sdk/agents/cloudflare-ai-gateway.d.ts +22 -0
  360. package/dist/plugin-sdk/agents/context.d.ts +1 -0
  361. package/dist/plugin-sdk/agents/current-time.d.ts +17 -0
  362. package/dist/plugin-sdk/agents/date-time.d.ts +13 -0
  363. package/dist/plugin-sdk/agents/defaults.d.ts +3 -0
  364. package/dist/plugin-sdk/agents/docs-path.d.ts +6 -0
  365. package/dist/plugin-sdk/agents/failover-error.d.ts +33 -0
  366. package/dist/plugin-sdk/agents/glob-pattern.d.ts +18 -0
  367. package/dist/plugin-sdk/agents/huggingface-models.d.ts +17 -0
  368. package/dist/plugin-sdk/agents/identity-avatar.d.ts +15 -0
  369. package/dist/plugin-sdk/agents/identity-file.d.ts +12 -0
  370. package/dist/plugin-sdk/agents/identity.d.ts +25 -0
  371. package/dist/plugin-sdk/agents/lanes.d.ts +3 -0
  372. package/dist/plugin-sdk/agents/memory-search.d.ts +66 -0
  373. package/dist/plugin-sdk/agents/minimax-vlm.d.ts +7 -0
  374. package/dist/plugin-sdk/agents/model-alias-lines.d.ts +2 -0
  375. package/dist/plugin-sdk/agents/model-auth.d.ts +36 -0
  376. package/dist/plugin-sdk/agents/model-catalog.d.ts +25 -0
  377. package/dist/plugin-sdk/agents/model-fallback.d.ts +40 -0
  378. package/dist/plugin-sdk/agents/model-selection.d.ts +94 -0
  379. package/dist/plugin-sdk/agents/models-config.d.ts +13 -0
  380. package/dist/plugin-sdk/agents/models-config.providers.d.ts +37 -0
  381. package/dist/plugin-sdk/agents/ollama-stream.d.ts +45 -0
  382. package/dist/plugin-sdk/agents/openclaw-tools.d.ts +46 -0
  383. package/dist/plugin-sdk/agents/pi-auth-json.d.ts +14 -0
  384. package/dist/plugin-sdk/agents/pi-embedded-helpers.d.ts +7 -0
  385. package/dist/plugin-sdk/agents/pi-embedded-runner/model.d.ts +1 -0
  386. package/dist/plugin-sdk/agents/pi-embedded-runner/run/params.d.ts +5 -0
  387. package/dist/plugin-sdk/agents/pi-embedded-runner.d.ts +25 -0
  388. package/dist/plugin-sdk/agents/pi-embedded-utils.d.ts +7 -0
  389. package/dist/plugin-sdk/agents/pi-embedded.d.ts +25 -0
  390. package/dist/plugin-sdk/agents/pi-model-discovery.d.ts +4 -0
  391. package/dist/plugin-sdk/agents/pi-settings.d.ts +19 -0
  392. package/dist/plugin-sdk/agents/pi-tools.abort.d.ts +2 -0
  393. package/dist/plugin-sdk/agents/pi-tools.before-tool-call.d.ts +29 -0
  394. package/dist/plugin-sdk/agents/pi-tools.d.ts +69 -0
  395. package/dist/plugin-sdk/agents/pi-tools.policy.d.ts +37 -0
  396. package/dist/plugin-sdk/agents/pi-tools.read.d.ts +44 -0
  397. package/dist/plugin-sdk/agents/pi-tools.schema.d.ts +3 -0
  398. package/dist/plugin-sdk/agents/pi-tools.types.d.ts +2 -0
  399. package/dist/plugin-sdk/agents/pty-dsr.d.ts +5 -0
  400. package/dist/plugin-sdk/agents/pty-keys.d.ts +13 -0
  401. package/dist/plugin-sdk/agents/sandbox/browser-bridges.d.ts +7 -0
  402. package/dist/plugin-sdk/agents/sandbox/browser.d.ts +12 -0
  403. package/dist/plugin-sdk/agents/sandbox/config-hash.d.ts +17 -0
  404. package/dist/plugin-sdk/agents/sandbox/config.d.ts +26 -0
  405. package/dist/plugin-sdk/agents/sandbox/constants.d.ts +19 -0
  406. package/dist/plugin-sdk/agents/sandbox/context.d.ts +12 -0
  407. package/dist/plugin-sdk/agents/sandbox/docker.d.ts +40 -0
  408. package/dist/plugin-sdk/agents/sandbox/fs-bridge.d.ts +56 -0
  409. package/dist/plugin-sdk/agents/sandbox/fs-paths.d.ts +28 -0
  410. package/dist/plugin-sdk/agents/sandbox/manage.d.ts +13 -0
  411. package/dist/plugin-sdk/agents/sandbox/prune.d.ts +3 -0
  412. package/dist/plugin-sdk/agents/sandbox/registry.d.ts +31 -0
  413. package/dist/plugin-sdk/agents/sandbox/runtime-status.d.ts +18 -0
  414. package/dist/plugin-sdk/agents/sandbox/shared.d.ts +4 -0
  415. package/dist/plugin-sdk/agents/sandbox/tool-policy.d.ts +4 -0
  416. package/dist/plugin-sdk/agents/sandbox/types.d.ts +76 -0
  417. package/dist/plugin-sdk/agents/sandbox/types.docker.d.ts +25 -0
  418. package/dist/plugin-sdk/agents/sandbox/workspace.d.ts +1 -0
  419. package/dist/plugin-sdk/agents/sandbox-paths.d.ts +23 -0
  420. package/dist/plugin-sdk/agents/sandbox.d.ts +8 -0
  421. package/dist/plugin-sdk/agents/schema/clean-for-gemini.d.ts +2 -0
  422. package/dist/plugin-sdk/agents/schema/typebox.d.ts +14 -0
  423. package/dist/plugin-sdk/agents/session-slug.d.ts +1 -0
  424. package/dist/plugin-sdk/agents/session-write-lock.d.ts +21 -0
  425. package/dist/plugin-sdk/agents/shell-utils.d.ts +7 -0
  426. package/dist/plugin-sdk/agents/skills/bundled-dir.d.ts +7 -0
  427. package/dist/plugin-sdk/agents/skills/config.d.ts +13 -0
  428. package/dist/plugin-sdk/agents/skills/env-overrides.d.ts +10 -0
  429. package/dist/plugin-sdk/agents/skills/frontmatter.d.ts +6 -0
  430. package/dist/plugin-sdk/agents/skills/plugin-skills.d.ts +5 -0
  431. package/dist/plugin-sdk/agents/skills/refresh.d.ts +19 -0
  432. package/dist/plugin-sdk/agents/skills/serialize.d.ts +1 -0
  433. package/dist/plugin-sdk/agents/skills/types.d.ts +80 -0
  434. package/dist/plugin-sdk/agents/skills/workspace.d.ts +49 -0
  435. package/dist/plugin-sdk/agents/skills.d.ts +7 -0
  436. package/dist/plugin-sdk/agents/subagent-announce-queue.d.ts +23 -0
  437. package/dist/plugin-sdk/agents/subagent-announce.d.ts +34 -0
  438. package/dist/plugin-sdk/agents/subagent-depth.d.ts +11 -0
  439. package/dist/plugin-sdk/agents/subagent-registry.d.ts +62 -0
  440. package/dist/plugin-sdk/agents/subagent-registry.store.d.ts +5 -0
  441. package/dist/plugin-sdk/agents/synthetic-models.d.ts +160 -0
  442. package/dist/plugin-sdk/agents/system-prompt-params.d.ts +30 -0
  443. package/dist/plugin-sdk/agents/system-prompt-report.d.ts +20 -0
  444. package/dist/plugin-sdk/agents/system-prompt.d.ts +78 -0
  445. package/dist/plugin-sdk/agents/timeout.d.ts +8 -0
  446. package/dist/plugin-sdk/agents/together-models.d.ts +4 -0
  447. package/dist/plugin-sdk/agents/tool-images.d.ts +19 -0
  448. package/dist/plugin-sdk/agents/tool-policy-pipeline.d.ts +27 -0
  449. package/dist/plugin-sdk/agents/tool-policy.d.ts +39 -0
  450. package/dist/plugin-sdk/agents/tool-summaries.d.ts +2 -0
  451. package/dist/plugin-sdk/agents/tools/agent-step.d.ts +15 -0
  452. package/dist/plugin-sdk/agents/tools/agents-list-tool.d.ts +6 -0
  453. package/dist/plugin-sdk/agents/tools/browser-tool.d.ts +5 -0
  454. package/dist/plugin-sdk/agents/tools/browser-tool.schema.d.ts +50 -0
  455. package/dist/plugin-sdk/agents/tools/canvas-tool.d.ts +2 -0
  456. package/dist/plugin-sdk/agents/tools/common.d.ts +56 -0
  457. package/dist/plugin-sdk/agents/tools/cron-tool.d.ts +6 -0
  458. package/dist/plugin-sdk/agents/tools/discord-actions-guild.d.ts +4 -0
  459. package/dist/plugin-sdk/agents/tools/discord-actions-messaging.d.ts +4 -0
  460. package/dist/plugin-sdk/agents/tools/discord-actions-moderation.d.ts +4 -0
  461. package/dist/plugin-sdk/agents/tools/discord-actions-presence.d.ts +4 -0
  462. package/dist/plugin-sdk/agents/tools/discord-actions.d.ts +3 -0
  463. package/dist/plugin-sdk/agents/tools/gateway-tool.d.ts +6 -0
  464. package/dist/plugin-sdk/agents/tools/gateway.d.ts +14 -0
  465. package/dist/plugin-sdk/agents/tools/image-tool.d.ts +35 -0
  466. package/dist/plugin-sdk/agents/tools/image-tool.helpers.d.ts +21 -0
  467. package/dist/plugin-sdk/agents/tools/memory-tool.d.ts +10 -0
  468. package/dist/plugin-sdk/agents/tools/message-tool.d.ts +18 -0
  469. package/dist/plugin-sdk/agents/tools/nodes-tool.d.ts +6 -0
  470. package/dist/plugin-sdk/agents/tools/nodes-utils.d.ts +20 -0
  471. package/dist/plugin-sdk/agents/tools/session-status-tool.d.ts +6 -0
  472. package/dist/plugin-sdk/agents/tools/sessions-announce-target.d.ts +5 -0
  473. package/dist/plugin-sdk/agents/tools/sessions-helpers.d.ts +90 -0
  474. package/dist/plugin-sdk/agents/tools/sessions-history-tool.d.ts +5 -0
  475. package/dist/plugin-sdk/agents/tools/sessions-list-tool.d.ts +5 -0
  476. package/dist/plugin-sdk/agents/tools/sessions-send-helpers.d.ts +34 -0
  477. package/dist/plugin-sdk/agents/tools/sessions-send-tool.a2a.d.ts +12 -0
  478. package/dist/plugin-sdk/agents/tools/sessions-send-tool.d.ts +7 -0
  479. package/dist/plugin-sdk/agents/tools/sessions-spawn-tool.d.ts +15 -0
  480. package/dist/plugin-sdk/agents/tools/slack-actions.d.ts +15 -0
  481. package/dist/plugin-sdk/agents/tools/subagents-tool.d.ts +4 -0
  482. package/dist/plugin-sdk/agents/tools/telegram-actions.d.ts +9 -0
  483. package/dist/plugin-sdk/agents/tools/tts-tool.d.ts +7 -0
  484. package/dist/plugin-sdk/agents/tools/web-fetch-utils.d.ts +18 -0
  485. package/dist/plugin-sdk/agents/tools/web-fetch.d.ts +25 -0
  486. package/dist/plugin-sdk/agents/tools/web-search.d.ts +71 -0
  487. package/dist/plugin-sdk/agents/tools/web-shared.d.ts +17 -0
  488. package/dist/plugin-sdk/agents/tools/web-tools.d.ts +2 -0
  489. package/dist/plugin-sdk/agents/tools/whatsapp-actions.d.ts +3 -0
  490. package/dist/plugin-sdk/agents/usage.d.ts +45 -0
  491. package/dist/plugin-sdk/agents/venice-models.d.ts +238 -0
  492. package/dist/plugin-sdk/agents/workspace-dir.d.ts +2 -0
  493. package/dist/plugin-sdk/agents/workspace-run.d.ts +18 -0
  494. package/dist/plugin-sdk/agents/workspace-templates.d.ts +6 -0
  495. package/dist/plugin-sdk/agents/workspace.d.ts +34 -0
  496. package/dist/plugin-sdk/auto-reply/chunk.d.ts +45 -0
  497. package/dist/plugin-sdk/auto-reply/command-auth.d.ts +17 -0
  498. package/dist/plugin-sdk/auto-reply/command-detection.d.ts +13 -0
  499. package/dist/plugin-sdk/auto-reply/commands-args.d.ts +3 -0
  500. package/dist/plugin-sdk/auto-reply/commands-registry.d.ts +54 -0
  501. package/dist/plugin-sdk/auto-reply/commands-registry.data.d.ts +3 -0
  502. package/dist/plugin-sdk/auto-reply/commands-registry.types.d.ts +66 -0
  503. package/dist/plugin-sdk/auto-reply/dispatch.d.ts +32 -0
  504. package/dist/plugin-sdk/auto-reply/envelope.d.ts +58 -0
  505. package/dist/plugin-sdk/auto-reply/group-activation.d.ts +6 -0
  506. package/dist/plugin-sdk/auto-reply/heartbeat-reply-payload.d.ts +2 -0
  507. package/dist/plugin-sdk/auto-reply/heartbeat.d.ts +26 -0
  508. package/dist/plugin-sdk/auto-reply/inbound-debounce.d.ts +16 -0
  509. package/dist/plugin-sdk/auto-reply/media-note.d.ts +2 -0
  510. package/dist/plugin-sdk/auto-reply/model.d.ts +8 -0
  511. package/dist/plugin-sdk/auto-reply/reply/abort.d.ts +22 -0
  512. package/dist/plugin-sdk/auto-reply/reply/agent-runner-execution.d.ts +49 -0
  513. package/dist/plugin-sdk/auto-reply/reply/agent-runner-helpers.d.ts +17 -0
  514. package/dist/plugin-sdk/auto-reply/reply/agent-runner-memory.d.ts +20 -0
  515. package/dist/plugin-sdk/auto-reply/reply/agent-runner-payloads.d.ts +25 -0
  516. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +30 -0
  517. package/dist/plugin-sdk/auto-reply/reply/agent-runner.d.ts +38 -0
  518. package/dist/plugin-sdk/auto-reply/reply/bash-command.d.ts +19 -0
  519. package/dist/plugin-sdk/auto-reply/reply/block-reply-coalescer.d.ts +15 -0
  520. package/dist/plugin-sdk/auto-reply/reply/block-reply-pipeline.d.ts +31 -0
  521. package/dist/plugin-sdk/auto-reply/reply/block-streaming.d.ts +22 -0
  522. package/dist/plugin-sdk/auto-reply/reply/body.d.ts +10 -0
  523. package/dist/plugin-sdk/auto-reply/reply/commands-allowlist.d.ts +2 -0
  524. package/dist/plugin-sdk/auto-reply/reply/commands-approve.d.ts +2 -0
  525. package/dist/plugin-sdk/auto-reply/reply/commands-bash.d.ts +2 -0
  526. package/dist/plugin-sdk/auto-reply/reply/commands-compact.d.ts +2 -0
  527. package/dist/plugin-sdk/auto-reply/reply/commands-config.d.ts +3 -0
  528. package/dist/plugin-sdk/auto-reply/reply/commands-context-report.d.ts +3 -0
  529. package/dist/plugin-sdk/auto-reply/reply/commands-context.d.ts +12 -0
  530. package/dist/plugin-sdk/auto-reply/reply/commands-core.d.ts +2 -0
  531. package/dist/plugin-sdk/auto-reply/reply/commands-info.d.ts +10 -0
  532. package/dist/plugin-sdk/auto-reply/reply/commands-models.d.ts +23 -0
  533. package/dist/plugin-sdk/auto-reply/reply/commands-plugin.d.ts +13 -0
  534. package/dist/plugin-sdk/auto-reply/reply/commands-session.d.ts +7 -0
  535. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +25 -0
  536. package/dist/plugin-sdk/auto-reply/reply/commands-subagents.d.ts +13 -0
  537. package/dist/plugin-sdk/auto-reply/reply/commands-tts.d.ts +2 -0
  538. package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +60 -0
  539. package/dist/plugin-sdk/auto-reply/reply/commands.d.ts +4 -0
  540. package/dist/plugin-sdk/auto-reply/reply/config-commands.d.ts +15 -0
  541. package/dist/plugin-sdk/auto-reply/reply/config-value.d.ts +4 -0
  542. package/dist/plugin-sdk/auto-reply/reply/debug-commands.d.ts +16 -0
  543. package/dist/plugin-sdk/auto-reply/reply/directive-handling.auth.d.ts +19 -0
  544. package/dist/plugin-sdk/auto-reply/reply/directive-handling.d.ts +6 -0
  545. package/dist/plugin-sdk/auto-reply/reply/directive-handling.fast-lane.d.ts +7 -0
  546. package/dist/plugin-sdk/auto-reply/reply/directive-handling.impl.d.ts +3 -0
  547. package/dist/plugin-sdk/auto-reply/reply/directive-handling.model-picker.d.ts +13 -0
  548. package/dist/plugin-sdk/auto-reply/reply/directive-handling.model.d.ts +42 -0
  549. package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +51 -0
  550. package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +62 -0
  551. package/dist/plugin-sdk/auto-reply/reply/directive-handling.persist.d.ts +37 -0
  552. package/dist/plugin-sdk/auto-reply/reply/directive-handling.queue-validation.d.ts +10 -0
  553. package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +16 -0
  554. package/dist/plugin-sdk/auto-reply/reply/directive-parsing.d.ts +5 -0
  555. package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +38 -0
  556. package/dist/plugin-sdk/auto-reply/reply/dispatch-from-config.d.ts +16 -0
  557. package/dist/plugin-sdk/auto-reply/reply/dispatcher-registry.d.ts +24 -0
  558. package/dist/plugin-sdk/auto-reply/reply/elevated-unavailable.d.ts +8 -0
  559. package/dist/plugin-sdk/auto-reply/reply/exec/directive.d.ts +20 -0
  560. package/dist/plugin-sdk/auto-reply/reply/exec.d.ts +1 -0
  561. package/dist/plugin-sdk/auto-reply/reply/followup-runner.d.ts +16 -0
  562. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-apply.d.ts +64 -0
  563. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-utils.d.ts +2 -0
  564. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +92 -0
  565. package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +59 -0
  566. package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +69 -0
  567. package/dist/plugin-sdk/auto-reply/reply/get-reply.d.ts +4 -0
  568. package/dist/plugin-sdk/auto-reply/reply/groups.d.ts +26 -0
  569. package/dist/plugin-sdk/auto-reply/reply/history.d.ts +72 -0
  570. package/dist/plugin-sdk/auto-reply/reply/inbound-context.d.ts +8 -0
  571. package/dist/plugin-sdk/auto-reply/reply/inbound-dedupe.d.ts +8 -0
  572. package/dist/plugin-sdk/auto-reply/reply/inbound-meta.d.ts +3 -0
  573. package/dist/plugin-sdk/auto-reply/reply/inbound-text.d.ts +1 -0
  574. package/dist/plugin-sdk/auto-reply/reply/line-directives.d.ts +22 -0
  575. package/dist/plugin-sdk/auto-reply/reply/memory-flush.d.ts +23 -0
  576. package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +19 -0
  577. package/dist/plugin-sdk/auto-reply/reply/model-selection.d.ts +64 -0
  578. package/dist/plugin-sdk/auto-reply/reply/normalize-reply.d.ts +13 -0
  579. package/dist/plugin-sdk/auto-reply/reply/provider-dispatcher.d.ts +19 -0
  580. package/dist/plugin-sdk/auto-reply/reply/queue/cleanup.d.ts +6 -0
  581. package/dist/plugin-sdk/auto-reply/reply/queue/directive.d.ts +15 -0
  582. package/dist/plugin-sdk/auto-reply/reply/queue/drain.d.ts +2 -0
  583. package/dist/plugin-sdk/auto-reply/reply/queue/enqueue.d.ts +3 -0
  584. package/dist/plugin-sdk/auto-reply/reply/queue/normalize.d.ts +3 -0
  585. package/dist/plugin-sdk/auto-reply/reply/queue/settings.d.ts +2 -0
  586. package/dist/plugin-sdk/auto-reply/reply/queue/state.d.ts +19 -0
  587. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +84 -0
  588. package/dist/plugin-sdk/auto-reply/reply/queue.d.ts +8 -0
  589. package/dist/plugin-sdk/auto-reply/reply/reply-delivery.d.ts +27 -0
  590. package/dist/plugin-sdk/auto-reply/reply/reply-directives.d.ts +14 -0
  591. package/dist/plugin-sdk/auto-reply/reply/reply-dispatcher.d.ts +52 -0
  592. package/dist/plugin-sdk/auto-reply/reply/reply-elevated.d.ts +16 -0
  593. package/dist/plugin-sdk/auto-reply/reply/reply-inline.d.ts +8 -0
  594. package/dist/plugin-sdk/auto-reply/reply/reply-payloads.d.ts +22 -0
  595. package/dist/plugin-sdk/auto-reply/reply/reply-tags.d.ts +6 -0
  596. package/dist/plugin-sdk/auto-reply/reply/reply-threading.d.ts +9 -0
  597. package/dist/plugin-sdk/auto-reply/reply/response-prefix-template.d.ts +51 -0
  598. package/dist/plugin-sdk/auto-reply/reply/route-reply.d.ts +56 -0
  599. package/dist/plugin-sdk/auto-reply/reply/session-reset-model.d.ts +24 -0
  600. package/dist/plugin-sdk/auto-reply/reply/session-reset-prompt.d.ts +1 -0
  601. package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +11 -0
  602. package/dist/plugin-sdk/auto-reply/reply/session-updates.d.ts +34 -0
  603. package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +21 -0
  604. package/dist/plugin-sdk/auto-reply/reply/session.d.ts +26 -0
  605. package/dist/plugin-sdk/auto-reply/reply/stage-sandbox-media.d.ts +9 -0
  606. package/dist/plugin-sdk/auto-reply/reply/subagents-utils.d.ts +7 -0
  607. package/dist/plugin-sdk/auto-reply/reply/typing-mode.d.ts +27 -0
  608. package/dist/plugin-sdk/auto-reply/reply/typing.d.ts +18 -0
  609. package/dist/plugin-sdk/auto-reply/reply/untrusted-context.d.ts +1 -0
  610. package/dist/plugin-sdk/auto-reply/reply.d.ts +6 -0
  611. package/dist/plugin-sdk/auto-reply/send-policy.d.ts +6 -0
  612. package/dist/plugin-sdk/auto-reply/skill-commands.d.ts +18 -0
  613. package/dist/plugin-sdk/auto-reply/status.d.ts +55 -0
  614. package/dist/plugin-sdk/auto-reply/templating.d.ts +152 -0
  615. package/dist/plugin-sdk/auto-reply/thinking.d.ts +22 -0
  616. package/dist/plugin-sdk/auto-reply/tokens.d.ts +3 -0
  617. package/dist/plugin-sdk/auto-reply/types.d.ts +61 -0
  618. package/dist/plugin-sdk/browser/bridge-auth-registry.d.ts +8 -0
  619. package/dist/plugin-sdk/browser/bridge-server.d.ts +18 -0
  620. package/dist/plugin-sdk/browser/cdp.d.ts +123 -0
  621. package/dist/plugin-sdk/browser/cdp.helpers.d.ts +13 -0
  622. package/dist/plugin-sdk/browser/chrome.d.ts +20 -0
  623. package/dist/plugin-sdk/browser/chrome.executables.d.ts +9 -0
  624. package/dist/plugin-sdk/browser/chrome.profile-decoration.d.ts +10 -0
  625. package/dist/plugin-sdk/browser/client-actions-core.d.ts +144 -0
  626. package/dist/plugin-sdk/browser/client-actions-observe.d.ts +68 -0
  627. package/dist/plugin-sdk/browser/client-actions-state.d.ts +90 -0
  628. package/dist/plugin-sdk/browser/client-actions-types.d.ts +18 -0
  629. package/dist/plugin-sdk/browser/client-actions.d.ts +4 -0
  630. package/dist/plugin-sdk/browser/client-fetch.d.ts +20 -0
  631. package/dist/plugin-sdk/browser/client.d.ts +147 -0
  632. package/dist/plugin-sdk/browser/config.d.ts +39 -0
  633. package/dist/plugin-sdk/browser/constants.d.ts +8 -0
  634. package/dist/plugin-sdk/browser/control-auth.d.ts +13 -0
  635. package/dist/plugin-sdk/browser/control-service.d.ts +5 -0
  636. package/dist/plugin-sdk/browser/csrf.d.ts +8 -0
  637. package/dist/plugin-sdk/browser/extension-relay.d.ts +15 -0
  638. package/dist/plugin-sdk/browser/http-auth.d.ts +5 -0
  639. package/dist/plugin-sdk/browser/paths.d.ts +27 -0
  640. package/dist/plugin-sdk/browser/profiles-service.d.ts +25 -0
  641. package/dist/plugin-sdk/browser/profiles.d.ts +30 -0
  642. package/dist/plugin-sdk/browser/proxy-files.d.ts +7 -0
  643. package/dist/plugin-sdk/browser/pw-ai-module.d.ts +6 -0
  644. package/dist/plugin-sdk/browser/pw-ai-state.d.ts +2 -0
  645. package/dist/plugin-sdk/browser/pw-ai.d.ts +2 -0
  646. package/dist/plugin-sdk/browser/pw-role-snapshot.d.ts +35 -0
  647. package/dist/plugin-sdk/browser/pw-session.d.ts +160 -0
  648. package/dist/plugin-sdk/browser/pw-tools-core.activity.d.ts +21 -0
  649. package/dist/plugin-sdk/browser/pw-tools-core.d.ts +8 -0
  650. package/dist/plugin-sdk/browser/pw-tools-core.downloads.d.ts +34 -0
  651. package/dist/plugin-sdk/browser/pw-tools-core.interactions.d.ts +114 -0
  652. package/dist/plugin-sdk/browser/pw-tools-core.responses.d.ts +13 -0
  653. package/dist/plugin-sdk/browser/pw-tools-core.shared.d.ts +6 -0
  654. package/dist/plugin-sdk/browser/pw-tools-core.snapshot.d.ts +64 -0
  655. package/dist/plugin-sdk/browser/pw-tools-core.state.d.ts +46 -0
  656. package/dist/plugin-sdk/browser/pw-tools-core.storage.d.ts +47 -0
  657. package/dist/plugin-sdk/browser/pw-tools-core.trace.d.ts +12 -0
  658. package/dist/plugin-sdk/browser/resolved-config-refresh.d.ts +12 -0
  659. package/dist/plugin-sdk/browser/routes/agent.act.d.ts +3 -0
  660. package/dist/plugin-sdk/browser/routes/agent.act.shared.d.ts +10 -0
  661. package/dist/plugin-sdk/browser/routes/agent.d.ts +3 -0
  662. package/dist/plugin-sdk/browser/routes/agent.debug.d.ts +3 -0
  663. package/dist/plugin-sdk/browser/routes/agent.shared.d.ts +9 -0
  664. package/dist/plugin-sdk/browser/routes/agent.snapshot.d.ts +3 -0
  665. package/dist/plugin-sdk/browser/routes/agent.storage.d.ts +3 -0
  666. package/dist/plugin-sdk/browser/routes/basic.d.ts +3 -0
  667. package/dist/plugin-sdk/browser/routes/dispatcher.d.ts +16 -0
  668. package/dist/plugin-sdk/browser/routes/index.d.ts +3 -0
  669. package/dist/plugin-sdk/browser/routes/path-output.d.ts +1 -0
  670. package/dist/plugin-sdk/browser/routes/tabs.d.ts +3 -0
  671. package/dist/plugin-sdk/browser/routes/types.d.ts +20 -0
  672. package/dist/plugin-sdk/browser/routes/utils.d.ts +15 -0
  673. package/dist/plugin-sdk/browser/screenshot.d.ts +9 -0
  674. package/dist/plugin-sdk/browser/server-context.d.ts +4 -0
  675. package/dist/plugin-sdk/browser/server-context.types.d.ts +79 -0
  676. package/dist/plugin-sdk/browser/server-middleware.d.ts +6 -0
  677. package/dist/plugin-sdk/browser/target-id.d.ts +11 -0
  678. package/dist/plugin-sdk/browser/trash.d.ts +1 -0
  679. package/dist/plugin-sdk/channel-web.d.ts +6 -0
  680. package/dist/plugin-sdk/channels/account-summary.d.ts +17 -0
  681. package/dist/plugin-sdk/channels/ack-reactions.d.ts +29 -0
  682. package/dist/plugin-sdk/channels/allowlist-match.d.ts +15 -0
  683. package/dist/plugin-sdk/channels/allowlists/resolve-utils.d.ts +20 -0
  684. package/dist/plugin-sdk/channels/channel-config.d.ts +39 -0
  685. package/dist/plugin-sdk/channels/chat-type.d.ts +2 -0
  686. package/dist/plugin-sdk/channels/command-gating.d.ts +20 -0
  687. package/dist/plugin-sdk/channels/conversation-label.d.ts +2 -0
  688. package/dist/plugin-sdk/channels/dock.d.ts +36 -0
  689. package/dist/plugin-sdk/channels/location.d.ts +21 -0
  690. package/dist/plugin-sdk/channels/logging.d.ts +20 -0
  691. package/dist/plugin-sdk/channels/mention-gating.d.ts +27 -0
  692. package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.d.ts +3 -0
  693. package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.guild-admin.d.ts +9 -0
  694. package/dist/plugin-sdk/channels/plugins/actions/discord.d.ts +2 -0
  695. package/dist/plugin-sdk/channels/plugins/actions/signal.d.ts +2 -0
  696. package/dist/plugin-sdk/channels/plugins/actions/telegram.d.ts +2 -0
  697. package/dist/plugin-sdk/channels/plugins/agent-tools/whatsapp-login.d.ts +2 -0
  698. package/dist/plugin-sdk/channels/plugins/allowlist-match.d.ts +2 -0
  699. package/dist/plugin-sdk/channels/plugins/bluebubbles-actions.d.ts +48 -0
  700. package/dist/plugin-sdk/channels/plugins/channel-config.d.ts +2 -0
  701. package/dist/plugin-sdk/channels/plugins/config-helpers.d.ts +14 -0
  702. package/dist/plugin-sdk/channels/plugins/config-schema.d.ts +3 -0
  703. package/dist/plugin-sdk/channels/plugins/config-writes.d.ts +7 -0
  704. package/dist/plugin-sdk/channels/plugins/directory-config.d.ts +16 -0
  705. package/dist/plugin-sdk/channels/plugins/group-mentions.d.ts +28 -0
  706. package/dist/plugin-sdk/channels/plugins/helpers.d.ts +8 -0
  707. package/dist/plugin-sdk/channels/plugins/index.d.ts +8 -0
  708. package/dist/plugin-sdk/channels/plugins/media-limits.d.ts +9 -0
  709. package/dist/plugin-sdk/channels/plugins/message-action-names.d.ts +2 -0
  710. package/dist/plugin-sdk/channels/plugins/message-actions.d.ts +7 -0
  711. package/dist/plugin-sdk/channels/plugins/normalize/discord.d.ts +2 -0
  712. package/dist/plugin-sdk/channels/plugins/normalize/imessage.d.ts +2 -0
  713. package/dist/plugin-sdk/channels/plugins/normalize/signal.d.ts +2 -0
  714. package/dist/plugin-sdk/channels/plugins/normalize/slack.d.ts +2 -0
  715. package/dist/plugin-sdk/channels/plugins/normalize/telegram.d.ts +2 -0
  716. package/dist/plugin-sdk/channels/plugins/normalize/whatsapp.d.ts +2 -0
  717. package/dist/plugin-sdk/channels/plugins/onboarding/channel-access.d.ts +31 -0
  718. package/dist/plugin-sdk/channels/plugins/onboarding/discord.d.ts +2 -0
  719. package/dist/plugin-sdk/channels/plugins/onboarding/helpers.d.ts +3 -0
  720. package/dist/plugin-sdk/channels/plugins/onboarding/imessage.d.ts +2 -0
  721. package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +3 -0
  722. package/dist/plugin-sdk/channels/plugins/onboarding/slack.d.ts +2 -0
  723. package/dist/plugin-sdk/channels/plugins/onboarding/telegram.d.ts +2 -0
  724. package/dist/plugin-sdk/channels/plugins/onboarding/whatsapp.d.ts +2 -0
  725. package/dist/plugin-sdk/channels/plugins/onboarding-types.d.ts +77 -0
  726. package/dist/plugin-sdk/channels/plugins/outbound/load.d.ts +2 -0
  727. package/dist/plugin-sdk/channels/plugins/pairing-message.d.ts +1 -0
  728. package/dist/plugin-sdk/channels/plugins/pairing.d.ts +16 -0
  729. package/dist/plugin-sdk/channels/plugins/setup-helpers.d.ts +13 -0
  730. package/dist/plugin-sdk/channels/plugins/status-issues/bluebubbles.d.ts +2 -0
  731. package/dist/plugin-sdk/channels/plugins/status-issues/discord.d.ts +2 -0
  732. package/dist/plugin-sdk/channels/plugins/status-issues/shared.d.ts +11 -0
  733. package/dist/plugin-sdk/channels/plugins/status-issues/telegram.d.ts +2 -0
  734. package/dist/plugin-sdk/channels/plugins/status-issues/whatsapp.d.ts +2 -0
  735. package/dist/plugin-sdk/channels/plugins/types.adapters.d.ts +297 -0
  736. package/dist/plugin-sdk/channels/plugins/types.core.d.ts +329 -0
  737. package/dist/plugin-sdk/channels/plugins/types.d.ts +6 -0
  738. package/dist/plugin-sdk/channels/plugins/types.plugin.d.ts +53 -0
  739. package/dist/plugin-sdk/channels/plugins/whatsapp-heartbeat.d.ts +11 -0
  740. package/dist/plugin-sdk/channels/registry.d.ts +16 -0
  741. package/dist/plugin-sdk/channels/reply-prefix.d.ts +24 -0
  742. package/dist/plugin-sdk/channels/sender-label.d.ts +9 -0
  743. package/dist/plugin-sdk/channels/session.d.ts +18 -0
  744. package/dist/plugin-sdk/channels/typing.d.ts +12 -0
  745. package/dist/plugin-sdk/channels/web/index.d.ts +1 -0
  746. package/dist/plugin-sdk/cli/cli-name.d.ts +3 -0
  747. package/dist/plugin-sdk/cli/cli-utils.d.ts +19 -0
  748. package/dist/plugin-sdk/cli/command-format.d.ts +1 -0
  749. package/dist/plugin-sdk/cli/deps.d.ts +18 -0
  750. package/dist/plugin-sdk/cli/memory-cli.d.ts +12 -0
  751. package/dist/plugin-sdk/cli/nodes-camera.d.ts +32 -0
  752. package/dist/plugin-sdk/cli/nodes-canvas.d.ts +10 -0
  753. package/dist/plugin-sdk/cli/nodes-run.d.ts +3 -0
  754. package/dist/plugin-sdk/cli/nodes-screen.d.ts +18 -0
  755. package/dist/plugin-sdk/cli/parse-bytes.d.ts +4 -0
  756. package/dist/plugin-sdk/cli/parse-duration.d.ts +4 -0
  757. package/dist/plugin-sdk/cli/parse-timeout.d.ts +1 -0
  758. package/dist/plugin-sdk/cli/profile-utils.d.ts +2 -0
  759. package/dist/plugin-sdk/cli/progress.d.ts +24 -0
  760. package/dist/plugin-sdk/cli/prompt.d.ts +1 -0
  761. package/dist/plugin-sdk/cli/wait.d.ts +1 -0
  762. package/dist/plugin-sdk/commands/agent/types.d.ts +77 -0
  763. package/dist/plugin-sdk/commands/daemon-runtime.d.ts +8 -0
  764. package/dist/plugin-sdk/commands/health.d.ts +63 -0
  765. package/dist/plugin-sdk/commands/oauth-flow.d.ts +21 -0
  766. package/dist/plugin-sdk/commands/onboard-helpers.d.ts +82 -0
  767. package/dist/plugin-sdk/commands/onboard-types.d.ts +76 -0
  768. package/dist/plugin-sdk/commands/signal-install.d.ts +30 -0
  769. package/dist/plugin-sdk/compat/legacy-names.d.ts +8 -0
  770. package/dist/plugin-sdk/config/agent-dirs.d.ts +14 -0
  771. package/dist/plugin-sdk/config/agent-limits.d.ts +5 -0
  772. package/dist/plugin-sdk/config/backup-rotation.d.ts +5 -0
  773. package/dist/plugin-sdk/config/cache-utils.d.ts +6 -0
  774. package/dist/plugin-sdk/config/config-paths.d.ts +10 -0
  775. package/dist/plugin-sdk/config/config.d.ts +7 -0
  776. package/dist/plugin-sdk/config/defaults.d.ts +18 -0
  777. package/dist/plugin-sdk/config/env-preserve.d.ts +25 -0
  778. package/dist/plugin-sdk/config/env-substitution.d.ts +36 -0
  779. package/dist/plugin-sdk/config/env-vars.d.ts +3 -0
  780. package/dist/plugin-sdk/config/group-policy.d.ts +47 -0
  781. package/dist/plugin-sdk/config/includes.d.ts +32 -0
  782. package/dist/plugin-sdk/config/io.d.ts +55 -0
  783. package/dist/plugin-sdk/config/legacy-migrate.d.ts +5 -0
  784. package/dist/plugin-sdk/config/legacy.d.ts +6 -0
  785. package/dist/plugin-sdk/config/legacy.migrations.d.ts +1 -0
  786. package/dist/plugin-sdk/config/legacy.migrations.part-1.d.ts +2 -0
  787. package/dist/plugin-sdk/config/legacy.migrations.part-2.d.ts +2 -0
  788. package/dist/plugin-sdk/config/legacy.migrations.part-3.d.ts +2 -0
  789. package/dist/plugin-sdk/config/legacy.rules.d.ts +2 -0
  790. package/dist/plugin-sdk/config/legacy.shared.d.ts +19 -0
  791. package/dist/plugin-sdk/config/markdown-tables.d.ts +7 -0
  792. package/dist/plugin-sdk/config/merge-config.d.ts +7 -0
  793. package/dist/plugin-sdk/config/merge-patch.d.ts +5 -0
  794. package/dist/plugin-sdk/config/normalize-paths.d.ts +8 -0
  795. package/dist/plugin-sdk/config/paths.d.ts +57 -0
  796. package/dist/plugin-sdk/config/port-defaults.d.ts +13 -0
  797. package/dist/plugin-sdk/config/runtime-overrides.d.ts +15 -0
  798. package/dist/plugin-sdk/config/sessions/delivery-info.d.ts +12 -0
  799. package/dist/plugin-sdk/config/sessions/group.d.ts +11 -0
  800. package/dist/plugin-sdk/config/sessions/main-session.d.ts +43 -0
  801. package/dist/plugin-sdk/config/sessions/metadata.d.ts +16 -0
  802. package/dist/plugin-sdk/config/sessions/paths.d.ts +21 -0
  803. package/dist/plugin-sdk/config/sessions/reset.d.ts +43 -0
  804. package/dist/plugin-sdk/config/sessions/session-key.d.ts +8 -0
  805. package/dist/plugin-sdk/config/sessions/store.d.ts +99 -0
  806. package/dist/plugin-sdk/config/sessions/transcript.d.ts +18 -0
  807. package/dist/plugin-sdk/config/sessions/types.d.ts +156 -0
  808. package/dist/plugin-sdk/config/sessions.d.ts +10 -0
  809. package/dist/plugin-sdk/config/talk.d.ts +11 -0
  810. package/dist/plugin-sdk/config/telegram-custom-commands.d.ts +24 -0
  811. package/dist/plugin-sdk/config/types.agent-defaults.d.ts +260 -0
  812. package/dist/plugin-sdk/config/types.agents.d.ts +80 -0
  813. package/dist/plugin-sdk/config/types.anima.d.ts +1 -0
  814. package/dist/plugin-sdk/config/types.approvals.d.ts +26 -0
  815. package/dist/plugin-sdk/config/types.auth.d.ts +28 -0
  816. package/dist/plugin-sdk/config/types.base.d.ts +172 -0
  817. package/dist/plugin-sdk/config/types.browser.d.ts +41 -0
  818. package/dist/plugin-sdk/config/types.channels.d.ts +48 -0
  819. package/dist/plugin-sdk/config/types.cron.d.ts +11 -0
  820. package/dist/plugin-sdk/config/types.d.ts +30 -0
  821. package/dist/plugin-sdk/config/types.discord.d.ts +188 -0
  822. package/dist/plugin-sdk/config/types.gateway.d.ts +288 -0
  823. package/dist/plugin-sdk/config/types.googlechat.d.ts +100 -0
  824. package/dist/plugin-sdk/config/types.hooks.d.ts +128 -0
  825. package/dist/plugin-sdk/config/types.imessage.d.ts +71 -0
  826. package/dist/plugin-sdk/config/types.irc.d.ts +96 -0
  827. package/dist/plugin-sdk/config/types.memory.d.ts +45 -0
  828. package/dist/plugin-sdk/config/types.messages.d.ts +121 -0
  829. package/dist/plugin-sdk/config/types.models.d.ts +54 -0
  830. package/dist/plugin-sdk/config/types.msteams.d.ts +101 -0
  831. package/dist/plugin-sdk/config/types.node-host.d.ts +10 -0
  832. package/dist/plugin-sdk/config/types.openclaw.d.ts +114 -0
  833. package/dist/plugin-sdk/config/types.plugins.d.ts +32 -0
  834. package/dist/plugin-sdk/config/types.queue.d.ts +14 -0
  835. package/dist/plugin-sdk/config/types.sandbox.d.ts +78 -0
  836. package/dist/plugin-sdk/config/types.signal.d.ts +86 -0
  837. package/dist/plugin-sdk/config/types.skills.d.ts +28 -0
  838. package/dist/plugin-sdk/config/types.slack.d.ts +150 -0
  839. package/dist/plugin-sdk/config/types.telegram.d.ts +163 -0
  840. package/dist/plugin-sdk/config/types.tools.d.ts +467 -0
  841. package/dist/plugin-sdk/config/types.tts.d.ts +78 -0
  842. package/dist/plugin-sdk/config/types.whatsapp.d.ts +142 -0
  843. package/dist/plugin-sdk/config/validation.d.ts +37 -0
  844. package/dist/plugin-sdk/config/version.d.ts +8 -0
  845. package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +249 -0
  846. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +856 -0
  847. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +504 -0
  848. package/dist/plugin-sdk/config/zod-schema.allowdeny.d.ts +13 -0
  849. package/dist/plugin-sdk/config/zod-schema.approvals.d.ts +15 -0
  850. package/dist/plugin-sdk/config/zod-schema.channels.d.ts +6 -0
  851. package/dist/plugin-sdk/config/zod-schema.core.d.ts +683 -0
  852. package/dist/plugin-sdk/config/zod-schema.d.ts +3401 -0
  853. package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +79 -0
  854. package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +3233 -0
  855. package/dist/plugin-sdk/config/zod-schema.providers-whatsapp.d.ts +231 -0
  856. package/dist/plugin-sdk/config/zod-schema.providers.d.ts +1900 -0
  857. package/dist/plugin-sdk/config/zod-schema.sensitive.d.ts +2 -0
  858. package/dist/plugin-sdk/config/zod-schema.session.d.ts +203 -0
  859. package/dist/plugin-sdk/cron/delivery.d.ts +9 -0
  860. package/dist/plugin-sdk/cron/normalize.d.ts +9 -0
  861. package/dist/plugin-sdk/cron/parse.d.ts +1 -0
  862. package/dist/plugin-sdk/cron/payload-migration.d.ts +3 -0
  863. package/dist/plugin-sdk/cron/schedule.d.ts +2 -0
  864. package/dist/plugin-sdk/cron/service/jobs.d.ts +21 -0
  865. package/dist/plugin-sdk/cron/service/locked.d.ts +2 -0
  866. package/dist/plugin-sdk/cron/service/normalize.d.ts +17 -0
  867. package/dist/plugin-sdk/cron/service/ops.d.ts +43 -0
  868. package/dist/plugin-sdk/cron/service/state.d.ts +121 -0
  869. package/dist/plugin-sdk/cron/service/store.d.ts +9 -0
  870. package/dist/plugin-sdk/cron/service/timer.d.ts +25 -0
  871. package/dist/plugin-sdk/cron/service.d.ts +48 -0
  872. package/dist/plugin-sdk/cron/session-reaper.d.ts +35 -0
  873. package/dist/plugin-sdk/cron/store.d.ts +6 -0
  874. package/dist/plugin-sdk/cron/types.d.ts +95 -0
  875. package/dist/plugin-sdk/daemon/constants.d.ts +30 -0
  876. package/dist/plugin-sdk/discord/accounts.d.ts +9 -0
  877. package/dist/plugin-sdk/discord/audit.d.ts +2 -0
  878. package/dist/plugin-sdk/discord/directory-live.d.ts +4 -0
  879. package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +1 -0
  880. package/dist/plugin-sdk/discord/monitor/gateway-registry.d.ts +3 -0
  881. package/dist/plugin-sdk/discord/monitor/presence-cache.d.ts +1 -0
  882. package/dist/plugin-sdk/discord/monitor.d.ts +3 -0
  883. package/dist/plugin-sdk/discord/pluralkit.d.ts +1 -0
  884. package/dist/plugin-sdk/discord/probe.d.ts +3 -0
  885. package/dist/plugin-sdk/discord/resolve-channels.d.ts +1 -0
  886. package/dist/plugin-sdk/discord/resolve-users.d.ts +1 -0
  887. package/dist/plugin-sdk/discord/send.d.ts +6 -0
  888. package/dist/plugin-sdk/discord/targets.d.ts +2 -0
  889. package/dist/plugin-sdk/gateway/auth-rate-limit.d.ts +59 -0
  890. package/dist/plugin-sdk/gateway/auth.d.ts +48 -0
  891. package/dist/plugin-sdk/gateway/call.d.ts +51 -0
  892. package/dist/plugin-sdk/gateway/chat-abort.d.ts +44 -0
  893. package/dist/plugin-sdk/gateway/chat-sanitize.d.ts +4 -0
  894. package/dist/plugin-sdk/gateway/client.d.ts +63 -0
  895. package/dist/plugin-sdk/gateway/control-ui-shared.d.ts +9 -0
  896. package/dist/plugin-sdk/gateway/device-auth.d.ts +12 -0
  897. package/dist/plugin-sdk/gateway/exec-approval-manager.d.ts +44 -0
  898. package/dist/plugin-sdk/gateway/net.d.ts +57 -0
  899. package/dist/plugin-sdk/gateway/node-registry.d.ts +60 -0
  900. package/dist/plugin-sdk/gateway/protocol/client-info.d.ts +58 -0
  901. package/dist/plugin-sdk/gateway/protocol/index.d.ts +661 -0
  902. package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +86 -0
  903. package/dist/plugin-sdk/gateway/protocol/schema/agents-models-skills.d.ts +152 -0
  904. package/dist/plugin-sdk/gateway/protocol/schema/channels.d.ts +126 -0
  905. package/dist/plugin-sdk/gateway/protocol/schema/config.d.ts +51 -0
  906. package/dist/plugin-sdk/gateway/protocol/schema/cron.d.ts +353 -0
  907. package/dist/plugin-sdk/gateway/protocol/schema/devices.d.ts +38 -0
  908. package/dist/plugin-sdk/gateway/protocol/schema/error-codes.d.ts +14 -0
  909. package/dist/plugin-sdk/gateway/protocol/schema/exec-approvals.d.ts +163 -0
  910. package/dist/plugin-sdk/gateway/protocol/schema/frames.d.ts +164 -0
  911. package/dist/plugin-sdk/gateway/protocol/schema/logs-chat.d.ts +45 -0
  912. package/dist/plugin-sdk/gateway/protocol/schema/nodes.d.ts +64 -0
  913. package/dist/plugin-sdk/gateway/protocol/schema/primitives.d.ts +4 -0
  914. package/dist/plugin-sdk/gateway/protocol/schema/protocol-schemas.d.ts +3 -0
  915. package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +76 -0
  916. package/dist/plugin-sdk/gateway/protocol/schema/snapshot.d.ts +64 -0
  917. package/dist/plugin-sdk/gateway/protocol/schema/types.d.ts +124 -0
  918. package/dist/plugin-sdk/gateway/protocol/schema/wizard.d.ts +86 -0
  919. package/dist/plugin-sdk/gateway/protocol/schema.d.ts +16 -0
  920. package/dist/plugin-sdk/gateway/server/ws-types.d.ts +9 -0
  921. package/dist/plugin-sdk/gateway/server-channels.d.ts +24 -0
  922. package/dist/plugin-sdk/gateway/server-methods/types.d.ts +98 -0
  923. package/dist/plugin-sdk/gateway/server-shared.d.ts +7 -0
  924. package/dist/plugin-sdk/gateway/session-utils.d.ts +71 -0
  925. package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +33 -0
  926. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +84 -0
  927. package/dist/plugin-sdk/globals.d.ts +11 -0
  928. package/dist/plugin-sdk/hooks/internal-hooks.d.ts +95 -0
  929. package/dist/plugin-sdk/hooks/types.d.ts +62 -0
  930. package/dist/plugin-sdk/imessage/accounts.d.ts +8 -0
  931. package/dist/plugin-sdk/imessage/monitor.d.ts +3 -0
  932. package/dist/plugin-sdk/imessage/probe.d.ts +3 -0
  933. package/dist/plugin-sdk/imessage/send.d.ts +1 -0
  934. package/dist/plugin-sdk/imessage/target-parsing-helpers.d.ts +4 -0
  935. package/dist/plugin-sdk/imessage/targets.d.ts +2 -0
  936. package/dist/plugin-sdk/index.d.ts +1 -0
  937. package/dist/plugin-sdk/index.js +27570 -0
  938. package/dist/plugin-sdk/infra/agent-events.d.ts +21 -0
  939. package/dist/plugin-sdk/infra/anima-root.d.ts +1 -0
  940. package/dist/plugin-sdk/infra/archive.d.ts +41 -0
  941. package/dist/plugin-sdk/infra/backoff.d.ts +8 -0
  942. package/dist/plugin-sdk/infra/binaries.d.ts +3 -0
  943. package/dist/plugin-sdk/infra/brew.d.ts +8 -0
  944. package/dist/plugin-sdk/infra/channel-activity.d.ts +18 -0
  945. package/dist/plugin-sdk/infra/channel-summary.d.ts +6 -0
  946. package/dist/plugin-sdk/infra/dedupe.d.ts +11 -0
  947. package/dist/plugin-sdk/infra/device-auth-store.d.ts +18 -0
  948. package/dist/plugin-sdk/infra/device-identity.d.ts +11 -0
  949. package/dist/plugin-sdk/infra/device-pairing.d.ts +96 -0
  950. package/dist/plugin-sdk/infra/diagnostic-events.d.ts +121 -0
  951. package/dist/plugin-sdk/infra/dotenv.d.ts +3 -0
  952. package/dist/plugin-sdk/infra/env.d.ts +11 -0
  953. package/dist/plugin-sdk/infra/errors.d.ts +11 -0
  954. package/dist/plugin-sdk/infra/exec-approvals-allowlist.d.ts +45 -0
  955. package/dist/plugin-sdk/infra/exec-approvals-analysis.d.ts +78 -0
  956. package/dist/plugin-sdk/infra/exec-approvals.d.ts +107 -0
  957. package/dist/plugin-sdk/infra/exec-safety.d.ts +1 -0
  958. package/dist/plugin-sdk/infra/fetch.d.ts +2 -0
  959. package/dist/plugin-sdk/infra/file-lock.d.ts +2 -0
  960. package/dist/plugin-sdk/infra/format-time/format-datetime.d.ts +35 -0
  961. package/dist/plugin-sdk/infra/format-time/format-duration.d.ts +23 -0
  962. package/dist/plugin-sdk/infra/format-time/format-relative.d.ts +39 -0
  963. package/dist/plugin-sdk/infra/git-commit.d.ts +4 -0
  964. package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
  965. package/dist/plugin-sdk/infra/heartbeat-events-filter.d.ts +3 -0
  966. package/dist/plugin-sdk/infra/heartbeat-events.d.ts +21 -0
  967. package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +45 -0
  968. package/dist/plugin-sdk/infra/heartbeat-visibility.d.ts +17 -0
  969. package/dist/plugin-sdk/infra/heartbeat-wake.d.ts +27 -0
  970. package/dist/plugin-sdk/infra/home-dir.d.ts +7 -0
  971. package/dist/plugin-sdk/infra/http-body.d.ts +46 -0
  972. package/dist/plugin-sdk/infra/json-file.d.ts +2 -0
  973. package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +21 -0
  974. package/dist/plugin-sdk/infra/net/ssrf.d.ts +32 -0
  975. package/dist/plugin-sdk/infra/node-pairing.d.ts +62 -0
  976. package/dist/plugin-sdk/infra/node-shell.d.ts +1 -0
  977. package/dist/plugin-sdk/infra/openclaw-root.d.ts +10 -0
  978. package/dist/plugin-sdk/infra/outbound/abort.d.ts +8 -0
  979. package/dist/plugin-sdk/infra/outbound/channel-adapters.d.ts +6 -0
  980. package/dist/plugin-sdk/infra/outbound/channel-selection.d.ts +11 -0
  981. package/dist/plugin-sdk/infra/outbound/channel-target.d.ts +6 -0
  982. package/dist/plugin-sdk/infra/outbound/deliver.d.ts +77 -0
  983. package/dist/plugin-sdk/infra/outbound/delivery-queue.d.ts +103 -0
  984. package/dist/plugin-sdk/infra/outbound/directory-cache.d.ts +24 -0
  985. package/dist/plugin-sdk/infra/outbound/identity.d.ts +8 -0
  986. package/dist/plugin-sdk/infra/outbound/message-action-params.d.ts +47 -0
  987. package/dist/plugin-sdk/infra/outbound/message-action-runner.d.ts +74 -0
  988. package/dist/plugin-sdk/infra/outbound/message-action-spec.d.ts +5 -0
  989. package/dist/plugin-sdk/infra/outbound/message.d.ts +85 -0
  990. package/dist/plugin-sdk/infra/outbound/outbound-policy.d.ts +31 -0
  991. package/dist/plugin-sdk/infra/outbound/outbound-send-service.d.ts +64 -0
  992. package/dist/plugin-sdk/infra/outbound/outbound-session.d.ts +31 -0
  993. package/dist/plugin-sdk/infra/outbound/payloads.d.ts +16 -0
  994. package/dist/plugin-sdk/infra/outbound/target-errors.d.ts +6 -0
  995. package/dist/plugin-sdk/infra/outbound/target-normalization.d.ts +4 -0
  996. package/dist/plugin-sdk/infra/outbound/target-resolver.d.ts +53 -0
  997. package/dist/plugin-sdk/infra/outbound/targets.d.ts +65 -0
  998. package/dist/plugin-sdk/infra/outbound/tool-payload.d.ts +2 -0
  999. package/dist/plugin-sdk/infra/pairing-files.d.ts +11 -0
  1000. package/dist/plugin-sdk/infra/pairing-token.d.ts +3 -0
  1001. package/dist/plugin-sdk/infra/path-prepend.d.ts +5 -0
  1002. package/dist/plugin-sdk/infra/ports-format.d.ts +5 -0
  1003. package/dist/plugin-sdk/infra/ports-inspect.d.ts +2 -0
  1004. package/dist/plugin-sdk/infra/ports-lsof.d.ts +2 -0
  1005. package/dist/plugin-sdk/infra/ports-types.d.ts +17 -0
  1006. package/dist/plugin-sdk/infra/ports.d.ts +14 -0
  1007. package/dist/plugin-sdk/infra/provider-usage.auth.d.ts +11 -0
  1008. package/dist/plugin-sdk/infra/provider-usage.d.ts +4 -0
  1009. package/dist/plugin-sdk/infra/provider-usage.fetch.antigravity.d.ts +2 -0
  1010. package/dist/plugin-sdk/infra/provider-usage.fetch.claude.d.ts +2 -0
  1011. package/dist/plugin-sdk/infra/provider-usage.fetch.codex.d.ts +2 -0
  1012. package/dist/plugin-sdk/infra/provider-usage.fetch.copilot.d.ts +2 -0
  1013. package/dist/plugin-sdk/infra/provider-usage.fetch.d.ts +7 -0
  1014. package/dist/plugin-sdk/infra/provider-usage.fetch.gemini.d.ts +2 -0
  1015. package/dist/plugin-sdk/infra/provider-usage.fetch.minimax.d.ts +2 -0
  1016. package/dist/plugin-sdk/infra/provider-usage.fetch.shared.d.ts +1 -0
  1017. package/dist/plugin-sdk/infra/provider-usage.fetch.zai.d.ts +2 -0
  1018. package/dist/plugin-sdk/infra/provider-usage.format.d.ts +13 -0
  1019. package/dist/plugin-sdk/infra/provider-usage.load.d.ts +12 -0
  1020. package/dist/plugin-sdk/infra/provider-usage.shared.d.ts +8 -0
  1021. package/dist/plugin-sdk/infra/provider-usage.types.d.ts +17 -0
  1022. package/dist/plugin-sdk/infra/restart-sentinel.d.ts +50 -0
  1023. package/dist/plugin-sdk/infra/restart.d.ts +61 -0
  1024. package/dist/plugin-sdk/infra/retry.d.ts +21 -0
  1025. package/dist/plugin-sdk/infra/session-cost-usage.d.ts +45 -0
  1026. package/dist/plugin-sdk/infra/session-cost-usage.types.d.ts +153 -0
  1027. package/dist/plugin-sdk/infra/session-maintenance-warning.d.ts +10 -0
  1028. package/dist/plugin-sdk/infra/shell-env.d.ts +33 -0
  1029. package/dist/plugin-sdk/infra/skills-remote.d.ts +25 -0
  1030. package/dist/plugin-sdk/infra/system-events.d.ts +18 -0
  1031. package/dist/plugin-sdk/infra/tailnet.d.ts +7 -0
  1032. package/dist/plugin-sdk/infra/tailscale.d.ts +34 -0
  1033. package/dist/plugin-sdk/infra/tls/fingerprint.d.ts +1 -0
  1034. package/dist/plugin-sdk/infra/tls/gateway.d.ts +16 -0
  1035. package/dist/plugin-sdk/infra/tmp-anima-dir.d.ts +1 -0
  1036. package/dist/plugin-sdk/infra/tmp-openclaw-dir.d.ts +18 -0
  1037. package/dist/plugin-sdk/infra/unhandled-rejections.d.ts +15 -0
  1038. package/dist/plugin-sdk/infra/warning-filter.d.ts +7 -0
  1039. package/dist/plugin-sdk/infra/ws.d.ts +2 -0
  1040. package/dist/plugin-sdk/infra/wsl.d.ts +11 -0
  1041. package/dist/plugin-sdk/line/accounts.d.ts +9 -0
  1042. package/dist/plugin-sdk/line/config-schema.d.ts +1 -0
  1043. package/dist/plugin-sdk/line/flex-templates.d.ts +14 -0
  1044. package/dist/plugin-sdk/line/markdown-to-line.d.ts +6 -0
  1045. package/dist/plugin-sdk/line/monitor.d.ts +3 -0
  1046. package/dist/plugin-sdk/line/probe.d.ts +3 -0
  1047. package/dist/plugin-sdk/line/send.d.ts +14 -0
  1048. package/dist/plugin-sdk/line/template-messages.d.ts +1 -0
  1049. package/dist/plugin-sdk/line/types.d.ts +6 -0
  1050. package/dist/plugin-sdk/link-understanding/apply.d.ts +10 -0
  1051. package/dist/plugin-sdk/link-understanding/defaults.d.ts +2 -0
  1052. package/dist/plugin-sdk/link-understanding/detect.d.ts +3 -0
  1053. package/dist/plugin-sdk/link-understanding/format.d.ts +4 -0
  1054. package/dist/plugin-sdk/link-understanding/runner.d.ts +11 -0
  1055. package/dist/plugin-sdk/logger.d.ts +6 -0
  1056. package/dist/plugin-sdk/logging/config.d.ts +4 -0
  1057. package/dist/plugin-sdk/logging/console.d.ts +23 -0
  1058. package/dist/plugin-sdk/logging/diagnostic-session-state.d.ts +17 -0
  1059. package/dist/plugin-sdk/logging/diagnostic.d.ts +56 -0
  1060. package/dist/plugin-sdk/logging/levels.d.ts +4 -0
  1061. package/dist/plugin-sdk/logging/logger.d.ts +42 -0
  1062. package/dist/plugin-sdk/logging/redact-identifier.d.ts +4 -0
  1063. package/dist/plugin-sdk/logging/redact.d.ts +9 -0
  1064. package/dist/plugin-sdk/logging/state.d.ts +18 -0
  1065. package/dist/plugin-sdk/logging/subsystem.d.ts +18 -0
  1066. package/dist/plugin-sdk/logging.d.ts +10 -0
  1067. package/dist/plugin-sdk/markdown/fences.d.ts +10 -0
  1068. package/dist/plugin-sdk/markdown/frontmatter.d.ts +2 -0
  1069. package/dist/plugin-sdk/markdown/ir.d.ts +32 -0
  1070. package/dist/plugin-sdk/markdown/render.d.ts +18 -0
  1071. package/dist/plugin-sdk/markdown/tables.d.ts +2 -0
  1072. package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
  1073. package/dist/plugin-sdk/media/audio-tags.d.ts +10 -0
  1074. package/dist/plugin-sdk/media/audio.d.ts +19 -0
  1075. package/dist/plugin-sdk/media/base64.d.ts +1 -0
  1076. package/dist/plugin-sdk/media/constants.d.ts +7 -0
  1077. package/dist/plugin-sdk/media/fetch.d.ts +23 -0
  1078. package/dist/plugin-sdk/media/image-ops.d.ts +39 -0
  1079. package/dist/plugin-sdk/media/input-files.d.ts +81 -0
  1080. package/dist/plugin-sdk/media/mime.d.ts +16 -0
  1081. package/dist/plugin-sdk/media/parse.d.ts +8 -0
  1082. package/dist/plugin-sdk/media/png-encode.d.ts +8 -0
  1083. package/dist/plugin-sdk/media/read-response-with-limit.d.ts +7 -0
  1084. package/dist/plugin-sdk/media/sniff-mime-from-base64.d.ts +1 -0
  1085. package/dist/plugin-sdk/media/store.d.ts +28 -0
  1086. package/dist/plugin-sdk/media-understanding/apply.d.ts +19 -0
  1087. package/dist/plugin-sdk/media-understanding/attachments.d.ts +43 -0
  1088. package/dist/plugin-sdk/media-understanding/concurrency.d.ts +1 -0
  1089. package/dist/plugin-sdk/media-understanding/defaults.d.ts +14 -0
  1090. package/dist/plugin-sdk/media-understanding/errors.d.ts +6 -0
  1091. package/dist/plugin-sdk/media-understanding/format.d.ts +7 -0
  1092. package/dist/plugin-sdk/media-understanding/output-extract.d.ts +2 -0
  1093. package/dist/plugin-sdk/media-understanding/providers/image.d.ts +1 -0
  1094. package/dist/plugin-sdk/media-understanding/providers/index.d.ts +8 -0
  1095. package/dist/plugin-sdk/media-understanding/providers/shared.d.ts +4 -0
  1096. package/dist/plugin-sdk/media-understanding/resolve.d.ts +44 -0
  1097. package/dist/plugin-sdk/media-understanding/runner.d.ts +35 -0
  1098. package/dist/plugin-sdk/media-understanding/runner.entries.d.ts +33 -0
  1099. package/dist/plugin-sdk/media-understanding/scope.d.ts +9 -0
  1100. package/dist/plugin-sdk/media-understanding/types.d.ts +93 -0
  1101. package/dist/plugin-sdk/media-understanding/video.d.ts +2 -0
  1102. package/dist/plugin-sdk/memory/backend-config.d.ts +49 -0
  1103. package/dist/plugin-sdk/memory/batch-gemini.d.ts +55 -0
  1104. package/dist/plugin-sdk/memory/batch-http.d.ts +6 -0
  1105. package/dist/plugin-sdk/memory/batch-openai.d.ts +45 -0
  1106. package/dist/plugin-sdk/memory/batch-output.d.ts +23 -0
  1107. package/dist/plugin-sdk/memory/batch-voyage.d.ts +46 -0
  1108. package/dist/plugin-sdk/memory/embedding-chunk-limits.d.ts +3 -0
  1109. package/dist/plugin-sdk/memory/embedding-input-limits.d.ts +2 -0
  1110. package/dist/plugin-sdk/memory/embedding-model-limits.d.ts +2 -0
  1111. package/dist/plugin-sdk/memory/embeddings-gemini.d.ts +13 -0
  1112. package/dist/plugin-sdk/memory/embeddings-openai.d.ts +13 -0
  1113. package/dist/plugin-sdk/memory/embeddings-voyage.d.ts +13 -0
  1114. package/dist/plugin-sdk/memory/embeddings.d.ts +44 -0
  1115. package/dist/plugin-sdk/memory/hybrid.d.ts +34 -0
  1116. package/dist/plugin-sdk/memory/index.d.ts +3 -0
  1117. package/dist/plugin-sdk/memory/internal.d.ts +38 -0
  1118. package/dist/plugin-sdk/memory/manager-embedding-ops.d.ts +32 -0
  1119. package/dist/plugin-sdk/memory/manager-search.d.ts +60 -0
  1120. package/dist/plugin-sdk/memory/manager-sync-ops.d.ts +40 -0
  1121. package/dist/plugin-sdk/memory/manager.d.ts +75 -0
  1122. package/dist/plugin-sdk/memory/memory-schema.d.ts +10 -0
  1123. package/dist/plugin-sdk/memory/node-llama.d.ts +8 -0
  1124. package/dist/plugin-sdk/memory/qmd-manager.d.ts +109 -0
  1125. package/dist/plugin-sdk/memory/qmd-query-parser.d.ts +8 -0
  1126. package/dist/plugin-sdk/memory/qmd-scope.d.ts +4 -0
  1127. package/dist/plugin-sdk/memory/search-manager.d.ts +11 -0
  1128. package/dist/plugin-sdk/memory/session-files.d.ts +14 -0
  1129. package/dist/plugin-sdk/memory/sqlite-vec.d.ts +9 -0
  1130. package/dist/plugin-sdk/memory/sqlite.d.ts +1 -0
  1131. package/dist/plugin-sdk/memory/types.d.ts +94 -0
  1132. package/dist/plugin-sdk/pairing/pairing-messages.d.ts +6 -0
  1133. package/dist/plugin-sdk/pairing/pairing-store.d.ts +46 -0
  1134. package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
  1135. package/dist/plugin-sdk/plugin-sdk/account-id.d.ts +1 -0
  1136. package/dist/plugin-sdk/plugin-sdk/allow-from.d.ts +4 -0
  1137. package/dist/plugin-sdk/plugin-sdk/config-paths.d.ts +6 -0
  1138. package/dist/plugin-sdk/plugin-sdk/file-lock.d.ts +16 -0
  1139. package/dist/plugin-sdk/plugin-sdk/index.d.ts +123 -0
  1140. package/dist/plugin-sdk/plugin-sdk/onboarding.d.ts +11 -0
  1141. package/dist/plugin-sdk/plugin-sdk/text-chunking.d.ts +1 -0
  1142. package/dist/plugin-sdk/plugins/bundled-dir.d.ts +1 -0
  1143. package/dist/plugin-sdk/plugins/commands.d.ts +83 -0
  1144. package/dist/plugin-sdk/plugins/config-schema.d.ts +2 -0
  1145. package/dist/plugin-sdk/plugins/config-state.d.ts +33 -0
  1146. package/dist/plugin-sdk/plugins/discovery.d.ts +22 -0
  1147. package/dist/plugin-sdk/plugins/hook-runner-global.d.ts +37 -0
  1148. package/dist/plugin-sdk/plugins/hooks.d.ts +42 -0
  1149. package/dist/plugin-sdk/plugins/http-path.d.ts +1 -0
  1150. package/dist/plugin-sdk/plugins/http-registry.d.ts +13 -0
  1151. package/dist/plugin-sdk/plugins/loader.d.ts +14 -0
  1152. package/dist/plugin-sdk/plugins/manifest-registry.d.ts +33 -0
  1153. package/dist/plugin-sdk/plugins/manifest.d.ts +64 -0
  1154. package/dist/plugin-sdk/plugins/registry.d.ts +130 -0
  1155. package/dist/plugin-sdk/plugins/runtime/index.d.ts +3 -0
  1156. package/dist/plugin-sdk/plugins/runtime/native-deps.d.ts +8 -0
  1157. package/dist/plugin-sdk/plugins/runtime/types.d.ts +317 -0
  1158. package/dist/plugin-sdk/plugins/runtime.d.ts +5 -0
  1159. package/dist/plugin-sdk/plugins/schema-validator.d.ts +10 -0
  1160. package/dist/plugin-sdk/plugins/slots.d.ts +24 -0
  1161. package/dist/plugin-sdk/plugins/tools.d.ts +13 -0
  1162. package/dist/plugin-sdk/plugins/types.d.ts +411 -0
  1163. package/dist/plugin-sdk/polls.d.ts +31 -0
  1164. package/dist/plugin-sdk/process/command-queue.d.ts +51 -0
  1165. package/dist/plugin-sdk/process/exec.d.ts +26 -0
  1166. package/dist/plugin-sdk/process/lanes.d.ts +6 -0
  1167. package/dist/plugin-sdk/process/spawn-utils.d.ts +26 -0
  1168. package/dist/plugin-sdk/providers/github-copilot-token.d.ts +8 -0
  1169. package/dist/plugin-sdk/providers/qwen-portal-oauth.d.ts +8 -0
  1170. package/dist/plugin-sdk/routing/bindings.d.ts +11 -0
  1171. package/dist/plugin-sdk/routing/resolve-route.d.ts +42 -0
  1172. package/dist/plugin-sdk/routing/session-key.d.ts +48 -0
  1173. package/dist/plugin-sdk/runtime.d.ts +7 -0
  1174. package/dist/plugin-sdk/security/external-content.d.ts +67 -0
  1175. package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
  1176. package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
  1177. package/dist/plugin-sdk/sessions/level-overrides.d.ts +10 -0
  1178. package/dist/plugin-sdk/sessions/model-overrides.d.ts +14 -0
  1179. package/dist/plugin-sdk/sessions/send-policy.d.ts +11 -0
  1180. package/dist/plugin-sdk/sessions/session-key-utils.d.ts +11 -0
  1181. package/dist/plugin-sdk/sessions/session-label.d.ts +9 -0
  1182. package/dist/plugin-sdk/sessions/transcript-events.d.ts +7 -0
  1183. package/dist/plugin-sdk/shared/chat-envelope.d.ts +2 -0
  1184. package/dist/plugin-sdk/shared/config-eval.d.ts +5 -0
  1185. package/dist/plugin-sdk/shared/device-auth.d.ts +13 -0
  1186. package/dist/plugin-sdk/shared/frontmatter.d.ts +7 -0
  1187. package/dist/plugin-sdk/shared/node-match.d.ts +8 -0
  1188. package/dist/plugin-sdk/shared/subagents-format.d.ts +15 -0
  1189. package/dist/plugin-sdk/shared/text/reasoning-tags.d.ts +6 -0
  1190. package/dist/plugin-sdk/signal/accounts.d.ts +9 -0
  1191. package/dist/plugin-sdk/signal/format.d.ts +9 -0
  1192. package/dist/plugin-sdk/signal/identity.d.ts +3 -0
  1193. package/dist/plugin-sdk/signal/index.d.ts +3 -0
  1194. package/dist/plugin-sdk/signal/probe.d.ts +3 -0
  1195. package/dist/plugin-sdk/signal/reaction-level.d.ts +1 -0
  1196. package/dist/plugin-sdk/signal/send-reactions.d.ts +2 -0
  1197. package/dist/plugin-sdk/signal/send.d.ts +1 -0
  1198. package/dist/plugin-sdk/slack/accounts.d.ts +11 -0
  1199. package/dist/plugin-sdk/slack/actions.d.ts +17 -0
  1200. package/dist/plugin-sdk/slack/client.d.ts +1 -0
  1201. package/dist/plugin-sdk/slack/directory-live.d.ts +4 -0
  1202. package/dist/plugin-sdk/slack/index.d.ts +3 -0
  1203. package/dist/plugin-sdk/slack/message-actions.d.ts +2 -0
  1204. package/dist/plugin-sdk/slack/monitor/allow-list.d.ts +1 -0
  1205. package/dist/plugin-sdk/slack/probe.d.ts +3 -0
  1206. package/dist/plugin-sdk/slack/resolve-channels.d.ts +1 -0
  1207. package/dist/plugin-sdk/slack/resolve-users.d.ts +1 -0
  1208. package/dist/plugin-sdk/slack/send.d.ts +5 -0
  1209. package/dist/plugin-sdk/slack/targets.d.ts +2 -0
  1210. package/dist/plugin-sdk/slack/threading-tool-context.d.ts +1 -0
  1211. package/dist/plugin-sdk/telegram/accounts.d.ts +9 -0
  1212. package/dist/plugin-sdk/telegram/audit.d.ts +4 -0
  1213. package/dist/plugin-sdk/telegram/bot/helpers.d.ts +1 -0
  1214. package/dist/plugin-sdk/telegram/bot/types.d.ts +5 -0
  1215. package/dist/plugin-sdk/telegram/inline-buttons.d.ts +2 -0
  1216. package/dist/plugin-sdk/telegram/model-buttons.d.ts +5 -0
  1217. package/dist/plugin-sdk/telegram/monitor.d.ts +3 -0
  1218. package/dist/plugin-sdk/telegram/outbound-params.d.ts +2 -0
  1219. package/dist/plugin-sdk/telegram/probe.d.ts +6 -0
  1220. package/dist/plugin-sdk/telegram/reaction-level.d.ts +1 -0
  1221. package/dist/plugin-sdk/telegram/send.d.ts +10 -0
  1222. package/dist/plugin-sdk/telegram/sticker-cache.d.ts +2 -0
  1223. package/dist/plugin-sdk/telegram/targets.d.ts +1 -0
  1224. package/dist/plugin-sdk/telegram/token.d.ts +1 -0
  1225. package/dist/plugin-sdk/terminal/ansi.d.ts +2 -0
  1226. package/dist/plugin-sdk/terminal/health-style.d.ts +1 -0
  1227. package/dist/plugin-sdk/terminal/links.d.ts +6 -0
  1228. package/dist/plugin-sdk/terminal/palette.d.ts +10 -0
  1229. package/dist/plugin-sdk/terminal/progress-line.d.ts +3 -0
  1230. package/dist/plugin-sdk/terminal/prompt-style.d.ts +3 -0
  1231. package/dist/plugin-sdk/terminal/restore.d.ts +17 -0
  1232. package/dist/plugin-sdk/terminal/theme.d.ts +15 -0
  1233. package/dist/plugin-sdk/tts/tts-core.d.ts +52 -0
  1234. package/dist/plugin-sdk/tts/tts.d.ts +179 -0
  1235. package/dist/plugin-sdk/utils/account-id.d.ts +1 -0
  1236. package/dist/plugin-sdk/utils/boolean.d.ts +5 -0
  1237. package/dist/plugin-sdk/utils/delivery-context.d.ts +29 -0
  1238. package/dist/plugin-sdk/utils/directive-tags.d.ts +16 -0
  1239. package/dist/plugin-sdk/utils/fetch-timeout.d.ts +13 -0
  1240. package/dist/plugin-sdk/utils/message-channel.d.ts +27 -0
  1241. package/dist/plugin-sdk/utils/normalize-secret-input.d.ts +11 -0
  1242. package/dist/plugin-sdk/utils/provider-utils.d.ts +9 -0
  1243. package/dist/plugin-sdk/utils/queue-helpers.d.ts +41 -0
  1244. package/dist/plugin-sdk/utils/shell-argv.d.ts +1 -0
  1245. package/dist/plugin-sdk/utils/transcript-tools.d.ts +8 -0
  1246. package/dist/plugin-sdk/utils/usage-format.d.ts +26 -0
  1247. package/dist/plugin-sdk/utils.d.ts +67 -0
  1248. package/dist/plugin-sdk/version.d.ts +4 -0
  1249. package/dist/plugin-sdk/web/accounts.d.ts +39 -0
  1250. package/dist/plugin-sdk/web/active-listener.d.ts +25 -0
  1251. package/dist/plugin-sdk/web/auth-store.d.ts +25 -0
  1252. package/dist/plugin-sdk/web/auto-reply/constants.d.ts +1 -0
  1253. package/dist/plugin-sdk/web/auto-reply/deliver-reply.d.ts +18 -0
  1254. package/dist/plugin-sdk/web/auto-reply/heartbeat-runner.d.ts +20 -0
  1255. package/dist/plugin-sdk/web/auto-reply/loggers.d.ts +4 -0
  1256. package/dist/plugin-sdk/web/auto-reply/mentions.d.ts +19 -0
  1257. package/dist/plugin-sdk/web/auto-reply/monitor/ack-reaction.d.ts +13 -0
  1258. package/dist/plugin-sdk/web/auto-reply/monitor/broadcast.d.ts +16 -0
  1259. package/dist/plugin-sdk/web/auto-reply/monitor/commands.d.ts +2 -0
  1260. package/dist/plugin-sdk/web/auto-reply/monitor/echo.d.ts +17 -0
  1261. package/dist/plugin-sdk/web/auto-reply/monitor/group-activation.d.ts +9 -0
  1262. package/dist/plugin-sdk/web/auto-reply/monitor/group-gating.d.ts +29 -0
  1263. package/dist/plugin-sdk/web/auto-reply/monitor/group-members.d.ts +6 -0
  1264. package/dist/plugin-sdk/web/auto-reply/monitor/last-route.d.ts +15 -0
  1265. package/dist/plugin-sdk/web/auto-reply/monitor/message-line.d.ts +11 -0
  1266. package/dist/plugin-sdk/web/auto-reply/monitor/on-message.d.ts +24 -0
  1267. package/dist/plugin-sdk/web/auto-reply/monitor/peer.d.ts +2 -0
  1268. package/dist/plugin-sdk/web/auto-reply/monitor/process-message.d.ts +40 -0
  1269. package/dist/plugin-sdk/web/auto-reply/monitor.d.ts +5 -0
  1270. package/dist/plugin-sdk/web/auto-reply/session-snapshot.d.ts +17 -0
  1271. package/dist/plugin-sdk/web/auto-reply/types.d.ts +28 -0
  1272. package/dist/plugin-sdk/web/auto-reply/util.d.ts +2 -0
  1273. package/dist/plugin-sdk/web/auto-reply.d.ts +1 -0
  1274. package/dist/plugin-sdk/web/auto-reply.impl.d.ts +6 -0
  1275. package/dist/plugin-sdk/web/inbound/access-control.d.ts +24 -0
  1276. package/dist/plugin-sdk/web/inbound/dedupe.d.ts +2 -0
  1277. package/dist/plugin-sdk/web/inbound/extract.d.ts +13 -0
  1278. package/dist/plugin-sdk/web/inbound/media.d.ts +7 -0
  1279. package/dist/plugin-sdk/web/inbound/monitor.d.ts +30 -0
  1280. package/dist/plugin-sdk/web/inbound/send-api.d.ts +22 -0
  1281. package/dist/plugin-sdk/web/inbound/types.d.ts +41 -0
  1282. package/dist/plugin-sdk/web/inbound.d.ts +4 -0
  1283. package/dist/plugin-sdk/web/login-qr.d.ts +19 -0
  1284. package/dist/plugin-sdk/web/login.d.ts +3 -0
  1285. package/dist/plugin-sdk/web/media.d.ts +38 -0
  1286. package/dist/plugin-sdk/web/outbound.d.ts +23 -0
  1287. package/dist/plugin-sdk/web/qr-image.d.ts +4 -0
  1288. package/dist/plugin-sdk/web/reconnect.d.ts +12 -0
  1289. package/dist/plugin-sdk/web/session.d.ts +14 -0
  1290. package/dist/plugin-sdk/web/vcard.d.ts +6 -0
  1291. package/dist/plugin-sdk/whatsapp/normalize.d.ts +2 -0
  1292. package/dist/plugin-sdk/whatsapp/resolve-outbound-target.d.ts +1 -0
  1293. package/dist/plugin-sdk/wizard/prompts.d.ts +42 -0
  1294. package/dist/plugin-sdk/wizard/session.d.ts +42 -0
  1295. package/dist/plugins-B362e77G.js +168 -0
  1296. package/dist/plugins-CDJw924T.js +38 -0
  1297. package/dist/plugins-CmSUIUNi.js +38 -0
  1298. package/dist/plugins-cli-CtFRTC2I.js +734 -0
  1299. package/dist/plugins-cli-D1lvqLG9.js +736 -0
  1300. package/dist/polls-CItfB1H8.js +1343 -0
  1301. package/dist/ports-BVLMN1Sr.js +96 -0
  1302. package/dist/ports-CqLSlU6Z.js +317 -0
  1303. package/dist/ports-D94CwCrv.js +344 -0
  1304. package/dist/ports-D_NHthOz.js +96 -0
  1305. package/dist/program-Bve7k4jO.js +176 -0
  1306. package/dist/program-context-8lqacY-M.js +496 -0
  1307. package/dist/program-context-Bvn8046-.js +17 -0
  1308. package/dist/progress-Bek_GyWS.js +133 -0
  1309. package/dist/progress-CbZ2D53A.js +133 -0
  1310. package/dist/prompt-style-DKy6qQxR.js +9 -0
  1311. package/dist/prompt-style-lu0clOOE.js +9 -0
  1312. package/dist/prompts-BI__va99.js +10 -0
  1313. package/dist/prompts-_dDWkCAz.js +10 -0
  1314. package/dist/pw-ai-BLVMuSLv.js +1867 -0
  1315. package/dist/pw-ai-DZJWEF_f.js +1865 -0
  1316. package/dist/pw-ai-dzf-ptcn.js +1868 -0
  1317. package/dist/qmd-manager-B0FWDi1x.js +938 -0
  1318. package/dist/qmd-manager-CrDrpgh3.js +937 -0
  1319. package/dist/qmd-manager-DepEoASu.js +935 -0
  1320. package/dist/queue-2CW7pnm1.js +209 -0
  1321. package/dist/queue-DhjMEG_Q.js +209 -0
  1322. package/dist/redact-BHmk44DI.js +97 -0
  1323. package/dist/redact-ClVwO7Nn.js +97 -0
  1324. package/dist/register.agent-CE_8JbTE.js +265 -0
  1325. package/dist/register.agent-CGRdcftb.js +1003 -0
  1326. package/dist/register.anima-B4NPeesF.js +167 -0
  1327. package/dist/register.anima-hNCtQ_jl.js +167 -0
  1328. package/dist/register.configure-3prVPXwx.js +101 -0
  1329. package/dist/register.configure-Dqm2IveL.js +103 -0
  1330. package/dist/register.maintenance-BSIx4eNS.js +543 -0
  1331. package/dist/register.maintenance-DDeG6CHa.js +543 -0
  1332. package/dist/register.message-DcYPDzYr.js +657 -0
  1333. package/dist/register.message-RbFrjbch.js +660 -0
  1334. package/dist/register.onboard-BBJK_0_C.js +170 -0
  1335. package/dist/register.onboard-BrcWHC9j.js +170 -0
  1336. package/dist/register.setup-ByvEHxYQ.js +175 -0
  1337. package/dist/register.setup-CNwO5Yq3.js +175 -0
  1338. package/dist/register.status-health-sessions-CGT7bn4C.js +142 -0
  1339. package/dist/register.status-health-sessions-QK6iQSJc.js +313 -0
  1340. package/dist/register.subclis-Bd8eE94r.js +255 -0
  1341. package/dist/registry-BiekeB9q.js +116 -0
  1342. package/dist/registry-qI6V4gqU.js +116 -0
  1343. package/dist/reply-Clj5jcM5.js +32212 -0
  1344. package/dist/reply-DnH1Ueoz.js +32212 -0
  1345. package/dist/reply-prefix-D2NxVzGZ.js +100 -0
  1346. package/dist/reply-prefix-DPpz_mEi.js +100 -0
  1347. package/dist/requirements-BzZxj2Wu.js +107 -0
  1348. package/dist/requirements-DIW1svgA.js +107 -0
  1349. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  1350. package/dist/routes-CXpne1-p.js +1820 -0
  1351. package/dist/routes-DtRwwTy6.js +1820 -0
  1352. package/dist/rpc-BBB_Fbes.js +70 -0
  1353. package/dist/rpc-CMEWfcci.js +70 -0
  1354. package/dist/run-main-DOXNrnL2.js +371 -0
  1355. package/dist/runtime-guard-BSUFiAQV.js +60 -0
  1356. package/dist/runtime-guard-DeOXA_86.js +60 -0
  1357. package/dist/sandbox-Bk0ZXcag.js +859 -0
  1358. package/dist/sandbox-D3CFkNeF.js +858 -0
  1359. package/dist/sandbox-cli-BCnnmQ03.js +458 -0
  1360. package/dist/sandbox-cli-Ctpa2Isy.js +461 -0
  1361. package/dist/secret-equal-B268kALC.js +13 -0
  1362. package/dist/secret-equal-Dghy3xsA.js +13 -0
  1363. package/dist/security-cli-BiiLLcQV.js +462 -0
  1364. package/dist/security-cli-DOZmLENS.js +465 -0
  1365. package/dist/send-BTA6qupx.js +10 -0
  1366. package/dist/send-BhAfdGII.js +10 -0
  1367. package/dist/send-C2t9xpXI.js +10 -0
  1368. package/dist/send-C6ccOW_U.js +10 -0
  1369. package/dist/send-CP74DxzJ.js +28 -0
  1370. package/dist/send-CS3G_YWr.js +10 -0
  1371. package/dist/send-D5JnqErc.js +10 -0
  1372. package/dist/send-DEMhcauI.js +32 -0
  1373. package/dist/send-DF8KJImx.js +28 -0
  1374. package/dist/send-DVW0CcHX.js +32 -0
  1375. package/dist/send-DigO-i9j.js +28 -0
  1376. package/dist/send-DqMLjD9Z.js +10 -0
  1377. package/dist/send-Dz2BDHll.js +32 -0
  1378. package/dist/send-ga9udK1_.js +10 -0
  1379. package/dist/send-oDz9NATu.js +10 -0
  1380. package/dist/server-context-BznDS2td.js +824 -0
  1381. package/dist/server-context-CXnE2F7d.js +824 -0
  1382. package/dist/server-node-events-Cu6Qkjor.js +231 -0
  1383. package/dist/server-node-events-Cv8MuF1g.js +233 -0
  1384. package/dist/service-BNVpYcQe.js +642 -0
  1385. package/dist/service-D56aMXUB.js +642 -0
  1386. package/dist/service-audit-DBsygs7y.js +488 -0
  1387. package/dist/service-audit-DKWJcTu4.js +488 -0
  1388. package/dist/session-CXcl3Xrp.js +181 -0
  1389. package/dist/session-DUFuU29j.js +179 -0
  1390. package/dist/session-M_uCxF0U.js +181 -0
  1391. package/dist/session-cost-usage-BwiTZuKl.js +600 -0
  1392. package/dist/session-cost-usage-DT9YNXTJ.js +600 -0
  1393. package/dist/session-key-BGiG_JcT.js +198 -0
  1394. package/dist/session-key-DxcgHezu.js +198 -0
  1395. package/dist/sessions-B8GUAiF6.js +1296 -0
  1396. package/dist/sessions-D0Zd1CND.js +1296 -0
  1397. package/dist/sessions-D0spLCm7.js +187 -0
  1398. package/dist/sessions-XvkHLXt4.js +2038 -0
  1399. package/dist/shared-CEHU0exQ.js +77 -0
  1400. package/dist/shared-Cgly1vPb.js +66 -0
  1401. package/dist/shared-DAHxpviD.js +77 -0
  1402. package/dist/shared-JOo05hST.js +66 -0
  1403. package/dist/shell-argv-CAq1mLa2.js +72 -0
  1404. package/dist/shell-argv-Ce41guJv.js +72 -0
  1405. package/dist/skill-scanner-CkaVLABv.js +263 -0
  1406. package/dist/skill-scanner-Coo4QoCd.js +263 -0
  1407. package/dist/skills-B-G7UHOa.js +808 -0
  1408. package/dist/skills-B5LQx4lT.js +807 -0
  1409. package/dist/skills-cli-DF9XJ2_0.js +286 -0
  1410. package/dist/skills-cli-eLBluVoD.js +289 -0
  1411. package/dist/skills-status-Clq9ZnYu.js +166 -0
  1412. package/dist/skills-status-JQluhU-P.js +166 -0
  1413. package/dist/sqlite-BukcjdJa.js +321 -0
  1414. package/dist/sqlite-CGcOZZ0C.js +368 -0
  1415. package/dist/sqlite-Ck6f9KWc.js +453 -0
  1416. package/dist/start-BvsoGNHJ.js +354 -0
  1417. package/dist/start-CF_Cp6YC.js +353 -0
  1418. package/dist/status-BKGJ7VPQ.js +27 -0
  1419. package/dist/status-BZip7mx9.js +27 -0
  1420. package/dist/status-BqYq_J5J.js +2132 -0
  1421. package/dist/status-CMnlcBVc.js +21 -0
  1422. package/dist/status-CXQrTLri.js +2137 -0
  1423. package/dist/status-tDZPwewW.js +21 -0
  1424. package/dist/status.update-CWiod7o_.js +79 -0
  1425. package/dist/status.update-D1PyrhoB.js +79 -0
  1426. package/dist/subagent-registry-CpSZ2RSO.js +2760 -0
  1427. package/dist/subagent-registry-DkCXRdwf.js +2759 -0
  1428. package/dist/subagent-registry-MPrTYaEB.js +14 -0
  1429. package/dist/subsystem-Dowf8fSU.js +860 -0
  1430. package/dist/system-cli-4Urk9KV1.js +79 -0
  1431. package/dist/system-cli-CgMzkg8R.js +82 -0
  1432. package/dist/system-run-command-DGk7dwQP.js +93 -0
  1433. package/dist/system-run-command-X9lDJIy0.js +93 -0
  1434. package/dist/systemd-BSrHDyeU.js +452 -0
  1435. package/dist/systemd-By5xdSB4.js +452 -0
  1436. package/dist/systemd-hints-BtjL_5Rh.js +36 -0
  1437. package/dist/systemd-hints-sJmr6cjb.js +36 -0
  1438. package/dist/systemd-linger-BNz8PXPF.js +75 -0
  1439. package/dist/systemd-linger-D5vLilKH.js +75 -0
  1440. package/dist/table-BL0lJzsm.js +279 -0
  1441. package/dist/table-DoiRPsn0.js +279 -0
  1442. package/dist/tailnet-CuiNECdL.js +42 -0
  1443. package/dist/tailnet-__ODlBOT.js +42 -0
  1444. package/dist/templates-DJ0ii6X2.js +47 -0
  1445. package/dist/templates-DPTs18po.js +47 -0
  1446. package/dist/thinking-BLU0jXR8.js +204 -0
  1447. package/dist/thinking-BXEswx1X.js +204 -0
  1448. package/dist/timeout-CswI_K-U.js +232 -0
  1449. package/dist/tokens-C-X7wDKj.js +14 -0
  1450. package/dist/tokens-DkvqA72p.js +14 -0
  1451. package/dist/transcript-events-C1hdue6u.js +17 -0
  1452. package/dist/transcript-events-C8Tqw4td.js +17 -0
  1453. package/dist/transcript-events-DW_H__a1.js +17 -0
  1454. package/dist/transcript-tools-DtE5di1q.js +108 -0
  1455. package/dist/transcript-tools-DuyYOkUq.js +108 -0
  1456. package/dist/trash-BJLK1vMn.js +23 -0
  1457. package/dist/trash-_x5UZ94k.js +23 -0
  1458. package/dist/tui-Cj25a9wc.js +3894 -0
  1459. package/dist/tui-Iv4T-9gg.js +3894 -0
  1460. package/dist/tui-cli-BkJxFa_n.js +50 -0
  1461. package/dist/tui-cli-DeFmBtZ7.js +47 -0
  1462. package/dist/update-DZRKbMjq.js +317 -0
  1463. package/dist/update-LFgxHHPd.js +317 -0
  1464. package/dist/update-check-CWc7YXmc.js +400 -0
  1465. package/dist/update-check-IhlWaui6.js +400 -0
  1466. package/dist/update-cli-qGGlL5Lg.js +1105 -0
  1467. package/dist/update-cli-rMqhSUMc.js +1105 -0
  1468. package/dist/update-runner-BT77y3bz.js +894 -0
  1469. package/dist/update-runner-DvzFqFJf.js +894 -0
  1470. package/dist/usage-BeZuVAY4.js +4516 -0
  1471. package/dist/usage-format-BAirWUSO.js +36 -0
  1472. package/dist/usage-format-CpORtVCG.js +36 -0
  1473. package/dist/utils-Bsw__U-F.js +243 -0
  1474. package/dist/utils-C9sj30YY.js +239 -0
  1475. package/dist/warning-filter.js +48 -0
  1476. package/dist/web-DEx7MMYq.js +2203 -0
  1477. package/dist/web-DHSoj6bL.js +46842 -0
  1478. package/dist/web-DI0g5K4c.js +63 -0
  1479. package/dist/webhooks-cli-sfLRE89X.js +319 -0
  1480. package/dist/webhooks-cli-xtZBlaD1.js +316 -0
  1481. package/dist/whatsapp-actions-DIREhxrq.js +49 -0
  1482. package/dist/whatsapp-actions-TGHl9p4i.js +45 -0
  1483. package/dist/whatsapp-actions-dBHozeuk.js +53 -0
  1484. package/dist/widearea-dns-B6ocX23x.js +127 -0
  1485. package/dist/widearea-dns-NsEUNYwz.js +127 -0
  1486. package/dist/workspace-Dcfoy5JJ.js +649 -0
  1487. package/dist/ws-COSqlEPx.js +218 -0
  1488. package/dist/ws-log-N8R5MvGE.js +267 -0
  1489. package/dist/ws-log-gwFxPxj5.js +267 -0
  1490. package/dist/wsl-CqyuRvtM.js +26 -0
  1491. package/dist/wsl-ymJYvc9Q.js +26 -0
  1492. package/package.json +209 -0
  1493. package/skills/1password/SKILL.md +70 -0
  1494. package/skills/1password/references/cli-examples.md +29 -0
  1495. package/skills/1password/references/get-started.md +17 -0
  1496. package/skills/animahub/SKILL.md +77 -0
  1497. package/skills/apple-notes/SKILL.md +77 -0
  1498. package/skills/apple-reminders/SKILL.md +96 -0
  1499. package/skills/audit/SKILL.md +68 -0
  1500. package/skills/bear-notes/SKILL.md +107 -0
  1501. package/skills/blogwatcher/SKILL.md +69 -0
  1502. package/skills/blucli/SKILL.md +47 -0
  1503. package/skills/bluebubbles/SKILL.md +131 -0
  1504. package/skills/camsnap/SKILL.md +45 -0
  1505. package/skills/canvas/SKILL.md +198 -0
  1506. package/skills/coding-agent/SKILL.md +284 -0
  1507. package/skills/deploy/SKILL.md +45 -0
  1508. package/skills/discord/SKILL.md +160 -0
  1509. package/skills/eightctl/SKILL.md +50 -0
  1510. package/skills/food-order/SKILL.md +48 -0
  1511. package/skills/gemini/SKILL.md +43 -0
  1512. package/skills/gifgrep/SKILL.md +79 -0
  1513. package/skills/github/SKILL.md +77 -0
  1514. package/skills/gog/SKILL.md +116 -0
  1515. package/skills/goplaces/SKILL.md +52 -0
  1516. package/skills/healthcheck/SKILL.md +245 -0
  1517. package/skills/himalaya/SKILL.md +257 -0
  1518. package/skills/himalaya/references/configuration.md +184 -0
  1519. package/skills/himalaya/references/message-composition.md +199 -0
  1520. package/skills/imsg/SKILL.md +74 -0
  1521. package/skills/mcporter/SKILL.md +61 -0
  1522. package/skills/model-usage/SKILL.md +69 -0
  1523. package/skills/model-usage/references/codexbar-cli.md +33 -0
  1524. package/skills/model-usage/scripts/model_usage.py +310 -0
  1525. package/skills/nano-banana-pro/SKILL.md +58 -0
  1526. package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
  1527. package/skills/nano-pdf/SKILL.md +38 -0
  1528. package/skills/notion/SKILL.md +172 -0
  1529. package/skills/obsidian/SKILL.md +81 -0
  1530. package/skills/openai-image-gen/SKILL.md +89 -0
  1531. package/skills/openai-image-gen/scripts/gen.py +240 -0
  1532. package/skills/openai-whisper/SKILL.md +38 -0
  1533. package/skills/openai-whisper-api/SKILL.md +52 -0
  1534. package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
  1535. package/skills/openhue/SKILL.md +51 -0
  1536. package/skills/oracle/SKILL.md +125 -0
  1537. package/skills/ordercli/SKILL.md +78 -0
  1538. package/skills/peekaboo/SKILL.md +190 -0
  1539. package/skills/review/SKILL.md +58 -0
  1540. package/skills/sag/SKILL.md +87 -0
  1541. package/skills/session-logs/SKILL.md +115 -0
  1542. package/skills/sherpa-onnx-tts/SKILL.md +103 -0
  1543. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1544. package/skills/skill-creator/SKILL.md +370 -0
  1545. package/skills/skill-creator/license.txt +202 -0
  1546. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1547. package/skills/skill-creator/scripts/package_skill.py +111 -0
  1548. package/skills/skill-creator/scripts/quick_validate.py +101 -0
  1549. package/skills/slack/SKILL.md +144 -0
  1550. package/skills/songsee/SKILL.md +49 -0
  1551. package/skills/sonoscli/SKILL.md +46 -0
  1552. package/skills/spotify-player/SKILL.md +64 -0
  1553. package/skills/summarize/SKILL.md +87 -0
  1554. package/skills/things-mac/SKILL.md +86 -0
  1555. package/skills/tmux/SKILL.md +135 -0
  1556. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1557. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1558. package/skills/trello/SKILL.md +95 -0
  1559. package/skills/video-frames/SKILL.md +46 -0
  1560. package/skills/video-frames/scripts/frame.sh +81 -0
  1561. package/skills/voice-call/SKILL.md +45 -0
  1562. package/skills/wacli/SKILL.md +72 -0
  1563. package/skills/weather/SKILL.md +54 -0
  1564. package/templates/BRAIN.md +65 -0
  1565. package/templates/GUT.md +44 -0
  1566. package/templates/HEART.md +51 -0
  1567. package/templates/MEMORY.md +66 -0
  1568. package/templates/SHADOW.md +68 -0
  1569. package/templates/SOUL.md +38 -0
  1570. package/templates/SPIRIT.md +43 -0
@@ -0,0 +1,3894 @@
1
+ import { m as visibleWidth, p as stripAnsi } from "./entry.js";
2
+ import { i as buildAgentMainSessionKey, l as normalizeAgentId, u as normalizeMainKey, x as parseAgentSessionKey } from "./session-key-BGiG_JcT.js";
3
+ import { x as shortenHomeInString } from "./utils-C9sj30YY.js";
4
+ import { c as resolveDefaultAgentId } from "./agent-scope-OZi7lb8S.js";
5
+ import { M as VERSION, i as loadConfig } from "./config-CHc5qzaI.js";
6
+ import { Dt as PROTOCOL_VERSION, t as GatewayClient } from "./client-C1avc0vD.js";
7
+ import { a as resolveExplicitGatewayAuth, r as ensureExplicitGatewayAuth, t as buildGatewayConnectionDetails } from "./call-ktoEhkOQ.js";
8
+ import { f as GATEWAY_CLIENT_CAPS, h as GATEWAY_CLIENT_NAMES, m as GATEWAY_CLIENT_MODES } from "./message-channel-w4F2b2F6.js";
9
+ import { c as normalizeUsageDisplay, r as listThinkingLevelLabels, t as formatThinkingLevels, u as resolveResponseUsageMode } from "./thinking-BXEswx1X.js";
10
+ import { n as listChatCommandsForConfig, t as listChatCommands } from "./commands-registry-Bd0xbvwG.js";
11
+ import { n as formatTimeAgo, t as formatRelativeTimestamp } from "./format-relative-C6kUHuOj.js";
12
+ import { n as formatTokenCount } from "./usage-format-BAirWUSO.js";
13
+ import { r as redactToolDetail } from "./redact-ClVwO7Nn.js";
14
+ import { spawn } from "node:child_process";
15
+ import chalk from "chalk";
16
+ import { randomUUID } from "node:crypto";
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 parseCommand(input) {
37
+ const trimmed = input.replace(/^\//, "").trim();
38
+ if (!trimmed) return {
39
+ name: "",
40
+ args: ""
41
+ };
42
+ const [name, ...rest] = trimmed.split(/\s+/);
43
+ const normalized = name.toLowerCase();
44
+ return {
45
+ name: COMMAND_ALIASES[normalized] ?? normalized,
46
+ args: rest.join(" ").trim()
47
+ };
48
+ }
49
+ function getSlashCommands(options = {}) {
50
+ const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
51
+ const commands = [
52
+ {
53
+ name: "help",
54
+ description: "Show slash command help"
55
+ },
56
+ {
57
+ name: "status",
58
+ description: "Show gateway status summary"
59
+ },
60
+ {
61
+ name: "agent",
62
+ description: "Switch agent (or open picker)"
63
+ },
64
+ {
65
+ name: "agents",
66
+ description: "Open agent picker"
67
+ },
68
+ {
69
+ name: "session",
70
+ description: "Switch session (or open picker)"
71
+ },
72
+ {
73
+ name: "sessions",
74
+ description: "Open session picker"
75
+ },
76
+ {
77
+ name: "model",
78
+ description: "Set model (or open picker)"
79
+ },
80
+ {
81
+ name: "models",
82
+ description: "Open model picker"
83
+ },
84
+ {
85
+ name: "think",
86
+ description: "Set thinking level",
87
+ getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
88
+ value,
89
+ label: value
90
+ }))
91
+ },
92
+ {
93
+ name: "verbose",
94
+ description: "Set verbose on/off",
95
+ getArgumentCompletions: (prefix) => VERBOSE_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
96
+ value,
97
+ label: value
98
+ }))
99
+ },
100
+ {
101
+ name: "reasoning",
102
+ description: "Set reasoning on/off",
103
+ getArgumentCompletions: (prefix) => REASONING_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
104
+ value,
105
+ label: value
106
+ }))
107
+ },
108
+ {
109
+ name: "usage",
110
+ description: "Toggle per-response usage line",
111
+ getArgumentCompletions: (prefix) => USAGE_FOOTER_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
112
+ value,
113
+ label: value
114
+ }))
115
+ },
116
+ {
117
+ name: "elevated",
118
+ description: "Set elevated on/off/ask/full",
119
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
120
+ value,
121
+ label: value
122
+ }))
123
+ },
124
+ {
125
+ name: "elev",
126
+ description: "Alias for /elevated",
127
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
128
+ value,
129
+ label: value
130
+ }))
131
+ },
132
+ {
133
+ name: "activation",
134
+ description: "Set group activation",
135
+ getArgumentCompletions: (prefix) => ACTIVATION_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
136
+ value,
137
+ label: value
138
+ }))
139
+ },
140
+ {
141
+ name: "abort",
142
+ description: "Abort active run"
143
+ },
144
+ {
145
+ name: "new",
146
+ description: "Reset the session"
147
+ },
148
+ {
149
+ name: "reset",
150
+ description: "Reset the session"
151
+ },
152
+ {
153
+ name: "settings",
154
+ description: "Open settings"
155
+ },
156
+ {
157
+ name: "exit",
158
+ description: "Exit the TUI"
159
+ },
160
+ {
161
+ name: "quit",
162
+ description: "Exit the TUI"
163
+ }
164
+ ];
165
+ const seen = new Set(commands.map((command) => command.name));
166
+ const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
167
+ for (const command of gatewayCommands) {
168
+ const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
169
+ for (const alias of aliases) {
170
+ const name = alias.replace(/^\//, "").trim();
171
+ if (!name || seen.has(name)) continue;
172
+ seen.add(name);
173
+ commands.push({
174
+ name,
175
+ description: command.description
176
+ });
177
+ }
178
+ }
179
+ return commands;
180
+ }
181
+ function helpText(options = {}) {
182
+ return [
183
+ "Slash commands:",
184
+ "/help",
185
+ "/commands",
186
+ "/status",
187
+ "/agent <id> (or /agents)",
188
+ "/session <key> (or /sessions)",
189
+ "/model <provider/model> (or /models)",
190
+ `/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
191
+ "/verbose <on|off>",
192
+ "/reasoning <on|off>",
193
+ "/usage <off|tokens|full>",
194
+ "/elevated <on|off|ask|full>",
195
+ "/elev <on|off|ask|full>",
196
+ "/activation <mention|always>",
197
+ "/new or /reset",
198
+ "/abort",
199
+ "/settings",
200
+ "/exit"
201
+ ].join("\n");
202
+ }
203
+
204
+ //#endregion
205
+ //#region src/tui/theme/syntax-theme.ts
206
+ /**
207
+ * Syntax highlighting theme for code blocks.
208
+ * Uses chalk functions to style different token types.
209
+ */
210
+ function createSyntaxTheme(fallback) {
211
+ return {
212
+ keyword: chalk.hex("#C586C0"),
213
+ built_in: chalk.hex("#4EC9B0"),
214
+ type: chalk.hex("#4EC9B0"),
215
+ literal: chalk.hex("#569CD6"),
216
+ number: chalk.hex("#B5CEA8"),
217
+ string: chalk.hex("#CE9178"),
218
+ regexp: chalk.hex("#D16969"),
219
+ symbol: chalk.hex("#B5CEA8"),
220
+ class: chalk.hex("#4EC9B0"),
221
+ function: chalk.hex("#DCDCAA"),
222
+ title: chalk.hex("#DCDCAA"),
223
+ params: chalk.hex("#9CDCFE"),
224
+ comment: chalk.hex("#6A9955"),
225
+ doctag: chalk.hex("#608B4E"),
226
+ meta: chalk.hex("#9CDCFE"),
227
+ "meta-keyword": chalk.hex("#C586C0"),
228
+ "meta-string": chalk.hex("#CE9178"),
229
+ section: chalk.hex("#DCDCAA"),
230
+ tag: chalk.hex("#569CD6"),
231
+ name: chalk.hex("#9CDCFE"),
232
+ attr: chalk.hex("#9CDCFE"),
233
+ attribute: chalk.hex("#9CDCFE"),
234
+ variable: chalk.hex("#9CDCFE"),
235
+ bullet: chalk.hex("#D7BA7D"),
236
+ code: chalk.hex("#CE9178"),
237
+ emphasis: chalk.italic,
238
+ strong: chalk.bold,
239
+ formula: chalk.hex("#C586C0"),
240
+ link: chalk.hex("#4EC9B0"),
241
+ quote: chalk.hex("#6A9955"),
242
+ addition: chalk.hex("#B5CEA8"),
243
+ deletion: chalk.hex("#F44747"),
244
+ "selector-tag": chalk.hex("#D7BA7D"),
245
+ "selector-id": chalk.hex("#D7BA7D"),
246
+ "selector-class": chalk.hex("#D7BA7D"),
247
+ "selector-attr": chalk.hex("#D7BA7D"),
248
+ "selector-pseudo": chalk.hex("#D7BA7D"),
249
+ "template-tag": chalk.hex("#C586C0"),
250
+ "template-variable": chalk.hex("#9CDCFE"),
251
+ default: fallback
252
+ };
253
+ }
254
+
255
+ //#endregion
256
+ //#region src/tui/theme/theme.ts
257
+ const palette = {
258
+ text: "#E8E3D5",
259
+ dim: "#7B7F87",
260
+ accent: "#F6C453",
261
+ accentSoft: "#F2A65A",
262
+ border: "#3C414B",
263
+ userBg: "#2B2F36",
264
+ userText: "#F3EEE0",
265
+ systemText: "#9BA3B2",
266
+ toolPendingBg: "#1F2A2F",
267
+ toolSuccessBg: "#1E2D23",
268
+ toolErrorBg: "#2F1F1F",
269
+ toolTitle: "#F6C453",
270
+ toolOutput: "#E1DACB",
271
+ quote: "#8CC8FF",
272
+ quoteBorder: "#3B4D6B",
273
+ code: "#F0C987",
274
+ codeBlock: "#1E232A",
275
+ codeBorder: "#343A45",
276
+ link: "#7DD3A5",
277
+ error: "#F97066",
278
+ success: "#7DD3A5"
279
+ };
280
+ const fg = (hex) => (text) => chalk.hex(hex)(text);
281
+ const bg = (hex) => (text) => chalk.bgHex(hex)(text);
282
+ const syntaxTheme = createSyntaxTheme(fg(palette.code));
283
+ /**
284
+ * Highlight code with syntax coloring.
285
+ * Returns an array of lines with ANSI escape codes.
286
+ */
287
+ function highlightCode(code, lang) {
288
+ try {
289
+ return highlight(code, {
290
+ language: lang && supportsLanguage(lang) ? lang : void 0,
291
+ theme: syntaxTheme,
292
+ ignoreIllegals: true
293
+ }).split("\n");
294
+ } catch {
295
+ return code.split("\n").map((line) => fg(palette.code)(line));
296
+ }
297
+ }
298
+ const theme = {
299
+ fg: fg(palette.text),
300
+ assistantText: (text) => text,
301
+ dim: fg(palette.dim),
302
+ accent: fg(palette.accent),
303
+ accentSoft: fg(palette.accentSoft),
304
+ success: fg(palette.success),
305
+ error: fg(palette.error),
306
+ header: (text) => chalk.bold(fg(palette.accent)(text)),
307
+ system: fg(palette.systemText),
308
+ userBg: bg(palette.userBg),
309
+ userText: fg(palette.userText),
310
+ toolTitle: fg(palette.toolTitle),
311
+ toolOutput: fg(palette.toolOutput),
312
+ toolPendingBg: bg(palette.toolPendingBg),
313
+ toolSuccessBg: bg(palette.toolSuccessBg),
314
+ toolErrorBg: bg(palette.toolErrorBg),
315
+ border: fg(palette.border),
316
+ bold: (text) => chalk.bold(text),
317
+ italic: (text) => chalk.italic(text)
318
+ };
319
+ const markdownTheme = {
320
+ heading: (text) => chalk.bold(fg(palette.accent)(text)),
321
+ link: (text) => fg(palette.link)(text),
322
+ linkUrl: (text) => chalk.dim(text),
323
+ code: (text) => fg(palette.code)(text),
324
+ codeBlock: (text) => fg(palette.code)(text),
325
+ codeBlockBorder: (text) => fg(palette.codeBorder)(text),
326
+ quote: (text) => fg(palette.quote)(text),
327
+ quoteBorder: (text) => fg(palette.quoteBorder)(text),
328
+ hr: (text) => fg(palette.border)(text),
329
+ listBullet: (text) => fg(palette.accentSoft)(text),
330
+ bold: (text) => chalk.bold(text),
331
+ italic: (text) => chalk.italic(text),
332
+ strikethrough: (text) => chalk.strikethrough(text),
333
+ underline: (text) => chalk.underline(text),
334
+ highlightCode
335
+ };
336
+ const selectListTheme = {
337
+ selectedPrefix: (text) => fg(palette.accent)(text),
338
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
339
+ description: (text) => fg(palette.dim)(text),
340
+ scrollInfo: (text) => fg(palette.dim)(text),
341
+ noMatch: (text) => fg(palette.dim)(text)
342
+ };
343
+ const filterableSelectListTheme = {
344
+ ...selectListTheme,
345
+ filterLabel: (text) => fg(palette.dim)(text)
346
+ };
347
+ const settingsListTheme = {
348
+ label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
349
+ value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
350
+ description: (text) => fg(palette.systemText)(text),
351
+ cursor: fg(palette.accent)("→ "),
352
+ hint: (text) => fg(palette.dim)(text)
353
+ };
354
+ const editorTheme = {
355
+ borderColor: (text) => fg(palette.border)(text),
356
+ selectList: selectListTheme
357
+ };
358
+ const searchableSelectListTheme = {
359
+ selectedPrefix: (text) => fg(palette.accent)(text),
360
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
361
+ description: (text) => fg(palette.dim)(text),
362
+ scrollInfo: (text) => fg(palette.dim)(text),
363
+ noMatch: (text) => fg(palette.dim)(text),
364
+ searchPrompt: (text) => fg(palette.accentSoft)(text),
365
+ searchInput: (text) => fg(palette.text)(text),
366
+ matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
367
+ };
368
+
369
+ //#endregion
370
+ //#region src/tui/components/assistant-message.ts
371
+ var AssistantMessageComponent = class extends Container {
372
+ constructor(text) {
373
+ super();
374
+ this.body = new Markdown(text, 1, 0, markdownTheme, { color: (line) => theme.assistantText(line) });
375
+ this.addChild(new Spacer(1));
376
+ this.addChild(this.body);
377
+ }
378
+ setText(text) {
379
+ this.body.setText(text);
380
+ }
381
+ };
382
+
383
+ //#endregion
384
+ //#region src/agents/tool-display-common.ts
385
+ function normalizeToolName(name) {
386
+ return (name ?? "tool").trim();
387
+ }
388
+ function defaultTitle(name) {
389
+ const cleaned = name.replace(/_/g, " ").trim();
390
+ if (!cleaned) return "Tool";
391
+ return cleaned.split(/\s+/).map((part) => part.length <= 2 && part.toUpperCase() === part ? part : `${part.at(0)?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
392
+ }
393
+ function normalizeVerb(value) {
394
+ const trimmed = value?.trim();
395
+ if (!trimmed) return;
396
+ return trimmed.replace(/_/g, " ");
397
+ }
398
+ function coerceDisplayValue(value, opts = {}) {
399
+ const maxStringChars = opts.maxStringChars ?? 160;
400
+ const maxArrayEntries = opts.maxArrayEntries ?? 3;
401
+ if (value === null || value === void 0) return;
402
+ if (typeof value === "string") {
403
+ const trimmed = value.trim();
404
+ if (!trimmed) return;
405
+ const firstLine = trimmed.split(/\r?\n/)[0]?.trim() ?? "";
406
+ if (!firstLine) return;
407
+ if (firstLine.length > maxStringChars) return `${firstLine.slice(0, Math.max(0, maxStringChars - 3))}…`;
408
+ return firstLine;
409
+ }
410
+ if (typeof value === "boolean") {
411
+ if (!value && !opts.includeFalse) return;
412
+ return value ? "true" : "false";
413
+ }
414
+ if (typeof value === "number") {
415
+ if (!Number.isFinite(value)) return opts.includeNonFinite ? String(value) : void 0;
416
+ if (value === 0 && !opts.includeZero) return;
417
+ return String(value);
418
+ }
419
+ if (Array.isArray(value)) {
420
+ const values = value.map((item) => coerceDisplayValue(item, opts)).filter((item) => Boolean(item));
421
+ if (values.length === 0) return;
422
+ const preview = values.slice(0, maxArrayEntries).join(", ");
423
+ return values.length > maxArrayEntries ? `${preview}…` : preview;
424
+ }
425
+ }
426
+ function lookupValueByPath(args, path) {
427
+ if (!args || typeof args !== "object") return;
428
+ let current = args;
429
+ for (const segment of path.split(".")) {
430
+ if (!segment) return;
431
+ if (!current || typeof current !== "object") return;
432
+ current = current[segment];
433
+ }
434
+ return current;
435
+ }
436
+ function formatDetailKey(raw, overrides = {}) {
437
+ const last = raw.split(".").filter(Boolean).at(-1) ?? raw;
438
+ const override = overrides[last];
439
+ if (override) return override;
440
+ return last.replace(/_/g, " ").replace(/-/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().toLowerCase() || last.toLowerCase();
441
+ }
442
+ function resolveReadDetail(args) {
443
+ if (!args || typeof args !== "object") return;
444
+ const record = args;
445
+ const path = typeof record.path === "string" ? record.path : void 0;
446
+ if (!path) return;
447
+ const offset = typeof record.offset === "number" ? record.offset : void 0;
448
+ const limit = typeof record.limit === "number" ? record.limit : void 0;
449
+ if (offset !== void 0 && limit !== void 0) return `${path}:${offset}-${offset + limit}`;
450
+ return path;
451
+ }
452
+ function resolveWriteDetail(args) {
453
+ if (!args || typeof args !== "object") return;
454
+ const record = args;
455
+ return typeof record.path === "string" ? record.path : void 0;
456
+ }
457
+ function resolveActionSpec(spec, action) {
458
+ if (!spec || !action) return;
459
+ return spec.actions?.[action] ?? void 0;
460
+ }
461
+ function resolveDetailFromKeys(args, keys, opts) {
462
+ if (opts.mode === "first") {
463
+ for (const key of keys) {
464
+ const display = coerceDisplayValue(lookupValueByPath(args, key), opts.coerce);
465
+ if (display) return display;
466
+ }
467
+ return;
468
+ }
469
+ const entries = [];
470
+ for (const key of keys) {
471
+ const display = coerceDisplayValue(lookupValueByPath(args, key), opts.coerce);
472
+ if (!display) continue;
473
+ entries.push({
474
+ label: opts.formatKey ? opts.formatKey(key) : key,
475
+ value: display
476
+ });
477
+ }
478
+ if (entries.length === 0) return;
479
+ if (entries.length === 1) return entries[0].value;
480
+ const seen = /* @__PURE__ */ new Set();
481
+ const unique = [];
482
+ for (const entry of entries) {
483
+ const token = `${entry.label}:${entry.value}`;
484
+ if (seen.has(token)) continue;
485
+ seen.add(token);
486
+ unique.push(entry);
487
+ }
488
+ if (unique.length === 0) return;
489
+ return unique.slice(0, opts.maxEntries ?? 8).map((entry) => `${entry.label} ${entry.value}`).join(" · ");
490
+ }
491
+
492
+ //#endregion
493
+ //#region src/agents/tool-display.json
494
+ var tool_display_default = {
495
+ version: 1,
496
+ fallback: {
497
+ "emoji": "🧩",
498
+ "detailKeys": [
499
+ "command",
500
+ "path",
501
+ "url",
502
+ "targetUrl",
503
+ "targetId",
504
+ "ref",
505
+ "element",
506
+ "node",
507
+ "nodeId",
508
+ "id",
509
+ "requestId",
510
+ "to",
511
+ "channelId",
512
+ "guildId",
513
+ "userId",
514
+ "name",
515
+ "query",
516
+ "pattern",
517
+ "messageId"
518
+ ]
519
+ },
520
+ tools: {
521
+ "exec": {
522
+ "emoji": "🛠️",
523
+ "title": "Exec",
524
+ "detailKeys": ["command"]
525
+ },
526
+ "process": {
527
+ "emoji": "🧰",
528
+ "title": "Process",
529
+ "detailKeys": ["sessionId"]
530
+ },
531
+ "read": {
532
+ "emoji": "📖",
533
+ "title": "Read",
534
+ "detailKeys": ["path"]
535
+ },
536
+ "write": {
537
+ "emoji": "✍️",
538
+ "title": "Write",
539
+ "detailKeys": ["path"]
540
+ },
541
+ "edit": {
542
+ "emoji": "📝",
543
+ "title": "Edit",
544
+ "detailKeys": ["path"]
545
+ },
546
+ "apply_patch": {
547
+ "emoji": "🩹",
548
+ "title": "Apply Patch",
549
+ "detailKeys": []
550
+ },
551
+ "attach": {
552
+ "emoji": "📎",
553
+ "title": "Attach",
554
+ "detailKeys": [
555
+ "path",
556
+ "url",
557
+ "fileName"
558
+ ]
559
+ },
560
+ "browser": {
561
+ "emoji": "🌐",
562
+ "title": "Browser",
563
+ "actions": {
564
+ "status": { "label": "status" },
565
+ "start": { "label": "start" },
566
+ "stop": { "label": "stop" },
567
+ "tabs": { "label": "tabs" },
568
+ "open": {
569
+ "label": "open",
570
+ "detailKeys": ["targetUrl"]
571
+ },
572
+ "focus": {
573
+ "label": "focus",
574
+ "detailKeys": ["targetId"]
575
+ },
576
+ "close": {
577
+ "label": "close",
578
+ "detailKeys": ["targetId"]
579
+ },
580
+ "snapshot": {
581
+ "label": "snapshot",
582
+ "detailKeys": [
583
+ "targetUrl",
584
+ "targetId",
585
+ "ref",
586
+ "element",
587
+ "format"
588
+ ]
589
+ },
590
+ "screenshot": {
591
+ "label": "screenshot",
592
+ "detailKeys": [
593
+ "targetUrl",
594
+ "targetId",
595
+ "ref",
596
+ "element"
597
+ ]
598
+ },
599
+ "navigate": {
600
+ "label": "navigate",
601
+ "detailKeys": ["targetUrl", "targetId"]
602
+ },
603
+ "console": {
604
+ "label": "console",
605
+ "detailKeys": ["level", "targetId"]
606
+ },
607
+ "pdf": {
608
+ "label": "pdf",
609
+ "detailKeys": ["targetId"]
610
+ },
611
+ "upload": {
612
+ "label": "upload",
613
+ "detailKeys": [
614
+ "paths",
615
+ "ref",
616
+ "inputRef",
617
+ "element",
618
+ "targetId"
619
+ ]
620
+ },
621
+ "dialog": {
622
+ "label": "dialog",
623
+ "detailKeys": [
624
+ "accept",
625
+ "promptText",
626
+ "targetId"
627
+ ]
628
+ },
629
+ "act": {
630
+ "label": "act",
631
+ "detailKeys": [
632
+ "request.kind",
633
+ "request.ref",
634
+ "request.selector",
635
+ "request.text",
636
+ "request.value"
637
+ ]
638
+ }
639
+ }
640
+ },
641
+ "canvas": {
642
+ "emoji": "🖼️",
643
+ "title": "Canvas",
644
+ "actions": {
645
+ "present": {
646
+ "label": "present",
647
+ "detailKeys": [
648
+ "target",
649
+ "node",
650
+ "nodeId"
651
+ ]
652
+ },
653
+ "hide": {
654
+ "label": "hide",
655
+ "detailKeys": ["node", "nodeId"]
656
+ },
657
+ "navigate": {
658
+ "label": "navigate",
659
+ "detailKeys": [
660
+ "url",
661
+ "node",
662
+ "nodeId"
663
+ ]
664
+ },
665
+ "eval": {
666
+ "label": "eval",
667
+ "detailKeys": [
668
+ "javaScript",
669
+ "node",
670
+ "nodeId"
671
+ ]
672
+ },
673
+ "snapshot": {
674
+ "label": "snapshot",
675
+ "detailKeys": [
676
+ "format",
677
+ "node",
678
+ "nodeId"
679
+ ]
680
+ },
681
+ "a2ui_push": {
682
+ "label": "A2UI push",
683
+ "detailKeys": [
684
+ "jsonlPath",
685
+ "node",
686
+ "nodeId"
687
+ ]
688
+ },
689
+ "a2ui_reset": {
690
+ "label": "A2UI reset",
691
+ "detailKeys": ["node", "nodeId"]
692
+ }
693
+ }
694
+ },
695
+ "nodes": {
696
+ "emoji": "📱",
697
+ "title": "Nodes",
698
+ "actions": {
699
+ "status": { "label": "status" },
700
+ "describe": {
701
+ "label": "describe",
702
+ "detailKeys": ["node", "nodeId"]
703
+ },
704
+ "pending": { "label": "pending" },
705
+ "approve": {
706
+ "label": "approve",
707
+ "detailKeys": ["requestId"]
708
+ },
709
+ "reject": {
710
+ "label": "reject",
711
+ "detailKeys": ["requestId"]
712
+ },
713
+ "notify": {
714
+ "label": "notify",
715
+ "detailKeys": [
716
+ "node",
717
+ "nodeId",
718
+ "title",
719
+ "body"
720
+ ]
721
+ },
722
+ "camera_snap": {
723
+ "label": "camera snap",
724
+ "detailKeys": [
725
+ "node",
726
+ "nodeId",
727
+ "facing",
728
+ "deviceId"
729
+ ]
730
+ },
731
+ "camera_list": {
732
+ "label": "camera list",
733
+ "detailKeys": ["node", "nodeId"]
734
+ },
735
+ "camera_clip": {
736
+ "label": "camera clip",
737
+ "detailKeys": [
738
+ "node",
739
+ "nodeId",
740
+ "facing",
741
+ "duration",
742
+ "durationMs"
743
+ ]
744
+ },
745
+ "screen_record": {
746
+ "label": "screen record",
747
+ "detailKeys": [
748
+ "node",
749
+ "nodeId",
750
+ "duration",
751
+ "durationMs",
752
+ "fps",
753
+ "screenIndex"
754
+ ]
755
+ }
756
+ }
757
+ },
758
+ "cron": {
759
+ "emoji": "⏰",
760
+ "title": "Cron",
761
+ "actions": {
762
+ "status": { "label": "status" },
763
+ "list": { "label": "list" },
764
+ "add": {
765
+ "label": "add",
766
+ "detailKeys": [
767
+ "job.name",
768
+ "job.id",
769
+ "job.schedule",
770
+ "job.cron"
771
+ ]
772
+ },
773
+ "update": {
774
+ "label": "update",
775
+ "detailKeys": ["id"]
776
+ },
777
+ "remove": {
778
+ "label": "remove",
779
+ "detailKeys": ["id"]
780
+ },
781
+ "run": {
782
+ "label": "run",
783
+ "detailKeys": ["id"]
784
+ },
785
+ "runs": {
786
+ "label": "runs",
787
+ "detailKeys": ["id"]
788
+ },
789
+ "wake": {
790
+ "label": "wake",
791
+ "detailKeys": ["text", "mode"]
792
+ }
793
+ }
794
+ },
795
+ "gateway": {
796
+ "emoji": "🔌",
797
+ "title": "Gateway",
798
+ "actions": { "restart": {
799
+ "label": "restart",
800
+ "detailKeys": ["reason", "delayMs"]
801
+ } }
802
+ },
803
+ "message": {
804
+ "emoji": "✉️",
805
+ "title": "Message",
806
+ "actions": {
807
+ "send": {
808
+ "label": "send",
809
+ "detailKeys": [
810
+ "provider",
811
+ "to",
812
+ "media",
813
+ "replyTo",
814
+ "threadId"
815
+ ]
816
+ },
817
+ "poll": {
818
+ "label": "poll",
819
+ "detailKeys": [
820
+ "provider",
821
+ "to",
822
+ "pollQuestion"
823
+ ]
824
+ },
825
+ "react": {
826
+ "label": "react",
827
+ "detailKeys": [
828
+ "provider",
829
+ "to",
830
+ "messageId",
831
+ "emoji",
832
+ "remove"
833
+ ]
834
+ },
835
+ "reactions": {
836
+ "label": "reactions",
837
+ "detailKeys": [
838
+ "provider",
839
+ "to",
840
+ "messageId",
841
+ "limit"
842
+ ]
843
+ },
844
+ "read": {
845
+ "label": "read",
846
+ "detailKeys": [
847
+ "provider",
848
+ "to",
849
+ "limit"
850
+ ]
851
+ },
852
+ "edit": {
853
+ "label": "edit",
854
+ "detailKeys": [
855
+ "provider",
856
+ "to",
857
+ "messageId"
858
+ ]
859
+ },
860
+ "delete": {
861
+ "label": "delete",
862
+ "detailKeys": [
863
+ "provider",
864
+ "to",
865
+ "messageId"
866
+ ]
867
+ },
868
+ "pin": {
869
+ "label": "pin",
870
+ "detailKeys": [
871
+ "provider",
872
+ "to",
873
+ "messageId"
874
+ ]
875
+ },
876
+ "unpin": {
877
+ "label": "unpin",
878
+ "detailKeys": [
879
+ "provider",
880
+ "to",
881
+ "messageId"
882
+ ]
883
+ },
884
+ "list-pins": {
885
+ "label": "list pins",
886
+ "detailKeys": ["provider", "to"]
887
+ },
888
+ "permissions": {
889
+ "label": "permissions",
890
+ "detailKeys": [
891
+ "provider",
892
+ "channelId",
893
+ "to"
894
+ ]
895
+ },
896
+ "thread-create": {
897
+ "label": "thread create",
898
+ "detailKeys": [
899
+ "provider",
900
+ "channelId",
901
+ "threadName"
902
+ ]
903
+ },
904
+ "thread-list": {
905
+ "label": "thread list",
906
+ "detailKeys": [
907
+ "provider",
908
+ "guildId",
909
+ "channelId"
910
+ ]
911
+ },
912
+ "thread-reply": {
913
+ "label": "thread reply",
914
+ "detailKeys": [
915
+ "provider",
916
+ "channelId",
917
+ "messageId"
918
+ ]
919
+ },
920
+ "search": {
921
+ "label": "search",
922
+ "detailKeys": [
923
+ "provider",
924
+ "guildId",
925
+ "query"
926
+ ]
927
+ },
928
+ "sticker": {
929
+ "label": "sticker",
930
+ "detailKeys": [
931
+ "provider",
932
+ "to",
933
+ "stickerId"
934
+ ]
935
+ },
936
+ "member-info": {
937
+ "label": "member",
938
+ "detailKeys": [
939
+ "provider",
940
+ "guildId",
941
+ "userId"
942
+ ]
943
+ },
944
+ "role-info": {
945
+ "label": "roles",
946
+ "detailKeys": ["provider", "guildId"]
947
+ },
948
+ "emoji-list": {
949
+ "label": "emoji list",
950
+ "detailKeys": ["provider", "guildId"]
951
+ },
952
+ "emoji-upload": {
953
+ "label": "emoji upload",
954
+ "detailKeys": [
955
+ "provider",
956
+ "guildId",
957
+ "emojiName"
958
+ ]
959
+ },
960
+ "sticker-upload": {
961
+ "label": "sticker upload",
962
+ "detailKeys": [
963
+ "provider",
964
+ "guildId",
965
+ "stickerName"
966
+ ]
967
+ },
968
+ "role-add": {
969
+ "label": "role add",
970
+ "detailKeys": [
971
+ "provider",
972
+ "guildId",
973
+ "userId",
974
+ "roleId"
975
+ ]
976
+ },
977
+ "role-remove": {
978
+ "label": "role remove",
979
+ "detailKeys": [
980
+ "provider",
981
+ "guildId",
982
+ "userId",
983
+ "roleId"
984
+ ]
985
+ },
986
+ "channel-info": {
987
+ "label": "channel",
988
+ "detailKeys": ["provider", "channelId"]
989
+ },
990
+ "channel-list": {
991
+ "label": "channels",
992
+ "detailKeys": ["provider", "guildId"]
993
+ },
994
+ "voice-status": {
995
+ "label": "voice",
996
+ "detailKeys": [
997
+ "provider",
998
+ "guildId",
999
+ "userId"
1000
+ ]
1001
+ },
1002
+ "event-list": {
1003
+ "label": "events",
1004
+ "detailKeys": ["provider", "guildId"]
1005
+ },
1006
+ "event-create": {
1007
+ "label": "event create",
1008
+ "detailKeys": [
1009
+ "provider",
1010
+ "guildId",
1011
+ "eventName"
1012
+ ]
1013
+ },
1014
+ "timeout": {
1015
+ "label": "timeout",
1016
+ "detailKeys": [
1017
+ "provider",
1018
+ "guildId",
1019
+ "userId"
1020
+ ]
1021
+ },
1022
+ "kick": {
1023
+ "label": "kick",
1024
+ "detailKeys": [
1025
+ "provider",
1026
+ "guildId",
1027
+ "userId"
1028
+ ]
1029
+ },
1030
+ "ban": {
1031
+ "label": "ban",
1032
+ "detailKeys": [
1033
+ "provider",
1034
+ "guildId",
1035
+ "userId"
1036
+ ]
1037
+ }
1038
+ }
1039
+ },
1040
+ "agents_list": {
1041
+ "emoji": "🧭",
1042
+ "title": "Agents",
1043
+ "detailKeys": []
1044
+ },
1045
+ "sessions_list": {
1046
+ "emoji": "🗂️",
1047
+ "title": "Sessions",
1048
+ "detailKeys": [
1049
+ "kinds",
1050
+ "limit",
1051
+ "activeMinutes",
1052
+ "messageLimit"
1053
+ ]
1054
+ },
1055
+ "sessions_history": {
1056
+ "emoji": "🧾",
1057
+ "title": "Session History",
1058
+ "detailKeys": [
1059
+ "sessionKey",
1060
+ "limit",
1061
+ "includeTools"
1062
+ ]
1063
+ },
1064
+ "sessions_send": {
1065
+ "emoji": "📨",
1066
+ "title": "Session Send",
1067
+ "detailKeys": [
1068
+ "label",
1069
+ "sessionKey",
1070
+ "agentId",
1071
+ "timeoutSeconds"
1072
+ ]
1073
+ },
1074
+ "sessions_spawn": {
1075
+ "emoji": "🧑‍🔧",
1076
+ "title": "Sub-agent",
1077
+ "detailKeys": [
1078
+ "label",
1079
+ "task",
1080
+ "agentId",
1081
+ "model",
1082
+ "thinking",
1083
+ "runTimeoutSeconds",
1084
+ "cleanup"
1085
+ ]
1086
+ },
1087
+ "subagents": {
1088
+ "emoji": "🤖",
1089
+ "title": "Subagents",
1090
+ "actions": {
1091
+ "list": {
1092
+ "label": "list",
1093
+ "detailKeys": ["recentMinutes"]
1094
+ },
1095
+ "kill": {
1096
+ "label": "kill",
1097
+ "detailKeys": ["target"]
1098
+ },
1099
+ "steer": {
1100
+ "label": "steer",
1101
+ "detailKeys": ["target"]
1102
+ }
1103
+ }
1104
+ },
1105
+ "session_status": {
1106
+ "emoji": "📊",
1107
+ "title": "Session Status",
1108
+ "detailKeys": ["sessionKey", "model"]
1109
+ },
1110
+ "memory_search": {
1111
+ "emoji": "🧠",
1112
+ "title": "Memory Search",
1113
+ "detailKeys": ["query"]
1114
+ },
1115
+ "memory_get": {
1116
+ "emoji": "📓",
1117
+ "title": "Memory Get",
1118
+ "detailKeys": [
1119
+ "path",
1120
+ "from",
1121
+ "lines"
1122
+ ]
1123
+ },
1124
+ "web_search": {
1125
+ "emoji": "🔎",
1126
+ "title": "Web Search",
1127
+ "detailKeys": ["query", "count"]
1128
+ },
1129
+ "web_fetch": {
1130
+ "emoji": "📄",
1131
+ "title": "Web Fetch",
1132
+ "detailKeys": [
1133
+ "url",
1134
+ "extractMode",
1135
+ "maxChars"
1136
+ ]
1137
+ },
1138
+ "whatsapp_login": {
1139
+ "emoji": "🟢",
1140
+ "title": "WhatsApp Login",
1141
+ "actions": {
1142
+ "start": { "label": "start" },
1143
+ "wait": { "label": "wait" }
1144
+ }
1145
+ }
1146
+ }
1147
+ };
1148
+
1149
+ //#endregion
1150
+ //#region src/agents/tool-display.ts
1151
+ const TOOL_DISPLAY_CONFIG = tool_display_default;
1152
+ const FALLBACK = TOOL_DISPLAY_CONFIG.fallback ?? { emoji: "🧩" };
1153
+ const TOOL_MAP = TOOL_DISPLAY_CONFIG.tools ?? {};
1154
+ const DETAIL_LABEL_OVERRIDES = {
1155
+ agentId: "agent",
1156
+ sessionKey: "session",
1157
+ targetId: "target",
1158
+ targetUrl: "url",
1159
+ nodeId: "node",
1160
+ requestId: "request",
1161
+ messageId: "message",
1162
+ threadId: "thread",
1163
+ channelId: "channel",
1164
+ guildId: "guild",
1165
+ userId: "user",
1166
+ runTimeoutSeconds: "timeout",
1167
+ timeoutSeconds: "timeout",
1168
+ includeTools: "tools",
1169
+ pollQuestion: "poll",
1170
+ maxChars: "max chars"
1171
+ };
1172
+ const MAX_DETAIL_ENTRIES = 8;
1173
+ function resolveToolDisplay(params) {
1174
+ const name = normalizeToolName(params.name);
1175
+ const key = name.toLowerCase();
1176
+ const spec = TOOL_MAP[key];
1177
+ const emoji = spec?.emoji ?? FALLBACK.emoji ?? "🧩";
1178
+ const title = spec?.title ?? defaultTitle(name);
1179
+ const label = spec?.label ?? title;
1180
+ const actionRaw = params.args && typeof params.args === "object" ? params.args.action : void 0;
1181
+ const action = typeof actionRaw === "string" ? actionRaw.trim() : void 0;
1182
+ const actionSpec = resolveActionSpec(spec, action);
1183
+ const verb = normalizeVerb(actionSpec?.label ?? action);
1184
+ let detail;
1185
+ if (key === "read") detail = resolveReadDetail(params.args);
1186
+ if (!detail && (key === "write" || key === "edit" || key === "attach")) detail = resolveWriteDetail(params.args);
1187
+ const detailKeys = actionSpec?.detailKeys ?? spec?.detailKeys ?? FALLBACK.detailKeys ?? [];
1188
+ if (!detail && detailKeys.length > 0) detail = resolveDetailFromKeys(params.args, detailKeys, {
1189
+ mode: "summary",
1190
+ maxEntries: MAX_DETAIL_ENTRIES,
1191
+ formatKey: (raw) => formatDetailKey(raw, DETAIL_LABEL_OVERRIDES)
1192
+ });
1193
+ if (!detail && params.meta) detail = params.meta;
1194
+ if (detail) detail = shortenHomeInString(detail);
1195
+ return {
1196
+ name,
1197
+ emoji,
1198
+ title,
1199
+ label,
1200
+ verb,
1201
+ detail
1202
+ };
1203
+ }
1204
+ function formatToolDetail(display) {
1205
+ const parts = [];
1206
+ if (display.verb) parts.push(display.verb);
1207
+ if (display.detail) parts.push(redactToolDetail(display.detail));
1208
+ if (parts.length === 0) return;
1209
+ return parts.join(" · ");
1210
+ }
1211
+
1212
+ //#endregion
1213
+ //#region src/tui/tui-formatters.ts
1214
+ const REPLACEMENT_CHAR_RE = /\uFFFD/g;
1215
+ const MAX_TOKEN_CHARS = 32;
1216
+ const LONG_TOKEN_RE = /\S{33,}/g;
1217
+ const LONG_TOKEN_TEST_RE = /\S{33,}/;
1218
+ const BINARY_LINE_REPLACEMENT_THRESHOLD = 12;
1219
+ function hasControlChars(text) {
1220
+ for (const char of text) {
1221
+ const code = char.charCodeAt(0);
1222
+ if (code <= 31 && code !== 9 && code !== 10 && code !== 13 || code >= 127 && code <= 159) return true;
1223
+ }
1224
+ return false;
1225
+ }
1226
+ function stripControlChars(text) {
1227
+ if (!hasControlChars(text)) return text;
1228
+ let sanitized = "";
1229
+ for (const char of text) {
1230
+ const code = char.charCodeAt(0);
1231
+ if (!(code <= 31 && code !== 9 && code !== 10 && code !== 13) && !(code >= 127 && code <= 159)) sanitized += char;
1232
+ }
1233
+ return sanitized;
1234
+ }
1235
+ function chunkToken(token, maxChars) {
1236
+ if (token.length <= maxChars) return [token];
1237
+ const chunks = [];
1238
+ for (let i = 0; i < token.length; i += maxChars) chunks.push(token.slice(i, i + maxChars));
1239
+ return chunks;
1240
+ }
1241
+ function redactBinaryLikeLine(line) {
1242
+ const replacementCount = (line.match(REPLACEMENT_CHAR_RE) || []).length;
1243
+ if (replacementCount >= BINARY_LINE_REPLACEMENT_THRESHOLD && replacementCount * 2 >= line.length) return "[binary data omitted]";
1244
+ return line;
1245
+ }
1246
+ function sanitizeRenderableText(text) {
1247
+ if (!text) return text;
1248
+ const hasAnsi = text.includes("\x1B");
1249
+ const hasReplacementChars = text.includes("�");
1250
+ const hasLongTokens = LONG_TOKEN_TEST_RE.test(text);
1251
+ const hasControls = hasControlChars(text);
1252
+ if (!hasAnsi && !hasReplacementChars && !hasLongTokens && !hasControls) return text;
1253
+ const withoutAnsi = hasAnsi ? stripAnsi(text) : text;
1254
+ const withoutControlChars = hasControls ? stripControlChars(withoutAnsi) : withoutAnsi;
1255
+ const redacted = hasReplacementChars ? withoutControlChars.split("\n").map((line) => redactBinaryLikeLine(line)).join("\n") : withoutControlChars;
1256
+ return LONG_TOKEN_TEST_RE.test(redacted) ? redacted.replace(LONG_TOKEN_RE, (token) => chunkToken(token, MAX_TOKEN_CHARS).join(" ")) : redacted;
1257
+ }
1258
+ function resolveFinalAssistantText(params) {
1259
+ const finalText = params.finalText ?? "";
1260
+ if (finalText.trim()) return finalText;
1261
+ const streamedText = params.streamedText ?? "";
1262
+ if (streamedText.trim()) return streamedText;
1263
+ return "(no output)";
1264
+ }
1265
+ function composeThinkingAndContent(params) {
1266
+ const thinkingText = params.thinkingText?.trim() ?? "";
1267
+ const contentText = params.contentText?.trim() ?? "";
1268
+ const parts = [];
1269
+ if (params.showThinking && thinkingText) parts.push(`[thinking]\n${thinkingText}`);
1270
+ if (contentText) parts.push(contentText);
1271
+ return parts.join("\n\n").trim();
1272
+ }
1273
+ /**
1274
+ * Extract ONLY thinking blocks from message content.
1275
+ * Model-agnostic: returns empty string if no thinking blocks exist.
1276
+ */
1277
+ function extractThinkingFromMessage(message) {
1278
+ if (!message || typeof message !== "object") return "";
1279
+ const content = message.content;
1280
+ if (typeof content === "string") return "";
1281
+ if (!Array.isArray(content)) return "";
1282
+ const parts = [];
1283
+ for (const block of content) {
1284
+ if (!block || typeof block !== "object") continue;
1285
+ const rec = block;
1286
+ if (rec.type === "thinking" && typeof rec.thinking === "string") parts.push(sanitizeRenderableText(rec.thinking));
1287
+ }
1288
+ return parts.join("\n").trim();
1289
+ }
1290
+ /**
1291
+ * Extract ONLY text content blocks from message (excludes thinking).
1292
+ * Model-agnostic: works for any model with text content blocks.
1293
+ */
1294
+ function extractContentFromMessage(message) {
1295
+ if (!message || typeof message !== "object") return "";
1296
+ const record = message;
1297
+ const content = record.content;
1298
+ if (typeof content === "string") return sanitizeRenderableText(content).trim();
1299
+ if (!Array.isArray(content)) {
1300
+ if ((typeof record.stopReason === "string" ? record.stopReason : "") === "error") return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
1301
+ return "";
1302
+ }
1303
+ const parts = [];
1304
+ for (const block of content) {
1305
+ if (!block || typeof block !== "object") continue;
1306
+ const rec = block;
1307
+ if (rec.type === "text" && typeof rec.text === "string") parts.push(sanitizeRenderableText(rec.text));
1308
+ }
1309
+ if (parts.length === 0) {
1310
+ if ((typeof record.stopReason === "string" ? record.stopReason : "") === "error") return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
1311
+ }
1312
+ return parts.join("\n").trim();
1313
+ }
1314
+ function extractTextBlocks(content, opts) {
1315
+ if (typeof content === "string") return sanitizeRenderableText(content).trim();
1316
+ if (!Array.isArray(content)) return "";
1317
+ const thinkingParts = [];
1318
+ const textParts = [];
1319
+ for (const block of content) {
1320
+ if (!block || typeof block !== "object") continue;
1321
+ const record = block;
1322
+ if (record.type === "text" && typeof record.text === "string") textParts.push(sanitizeRenderableText(record.text));
1323
+ if (opts?.includeThinking && record.type === "thinking" && typeof record.thinking === "string") thinkingParts.push(sanitizeRenderableText(record.thinking));
1324
+ }
1325
+ return composeThinkingAndContent({
1326
+ thinkingText: thinkingParts.join("\n").trim(),
1327
+ contentText: textParts.join("\n").trim(),
1328
+ showThinking: opts?.includeThinking ?? false
1329
+ });
1330
+ }
1331
+ function extractTextFromMessage(message, opts) {
1332
+ if (!message || typeof message !== "object") return "";
1333
+ const record = message;
1334
+ const text = extractTextBlocks(record.content, opts);
1335
+ if (text) return text;
1336
+ if ((typeof record.stopReason === "string" ? record.stopReason : "") !== "error") return "";
1337
+ return formatRawAssistantErrorForUi(typeof record.errorMessage === "string" ? record.errorMessage : "");
1338
+ }
1339
+ function isCommandMessage(message) {
1340
+ if (!message || typeof message !== "object") return false;
1341
+ return message.command === true;
1342
+ }
1343
+ function formatTokens(total, context) {
1344
+ if (total == null && context == null) return "tokens ?";
1345
+ const totalLabel = total == null ? "?" : formatTokenCount(total);
1346
+ if (context == null) return `tokens ${totalLabel}`;
1347
+ const pct = typeof total === "number" && context > 0 ? Math.min(999, Math.round(total / context * 100)) : null;
1348
+ return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
1349
+ }
1350
+ function formatContextUsageLine(params) {
1351
+ const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
1352
+ const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
1353
+ const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
1354
+ const extra = [typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null, pct !== null ? `${pct}%` : null].filter(Boolean).join(", ");
1355
+ return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
1356
+ }
1357
+ function asString(value, fallback = "") {
1358
+ if (typeof value === "string") return value;
1359
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
1360
+ return fallback;
1361
+ }
1362
+
1363
+ //#endregion
1364
+ //#region src/tui/components/tool-execution.ts
1365
+ const PREVIEW_LINES = 12;
1366
+ function formatArgs(toolName, args) {
1367
+ const detail = formatToolDetail(resolveToolDisplay({
1368
+ name: toolName,
1369
+ args
1370
+ }));
1371
+ if (detail) return sanitizeRenderableText(detail);
1372
+ if (!args || typeof args !== "object") return "";
1373
+ try {
1374
+ return sanitizeRenderableText(JSON.stringify(args));
1375
+ } catch {
1376
+ return "";
1377
+ }
1378
+ }
1379
+ function extractText(result) {
1380
+ if (!result?.content) return "";
1381
+ const lines = [];
1382
+ for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(sanitizeRenderableText(entry.text));
1383
+ else if (entry.type === "image") {
1384
+ const mime = entry.mimeType ?? "image";
1385
+ const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
1386
+ const omitted = entry.omitted ? " (omitted)" : "";
1387
+ lines.push(`[${mime}${size}${omitted}]`);
1388
+ }
1389
+ return lines.join("\n").trim();
1390
+ }
1391
+ var ToolExecutionComponent = class extends Container {
1392
+ constructor(toolName, args) {
1393
+ super();
1394
+ this.expanded = false;
1395
+ this.isError = false;
1396
+ this.isPartial = true;
1397
+ this.toolName = toolName;
1398
+ this.args = args;
1399
+ this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
1400
+ this.header = new Text("", 0, 0);
1401
+ this.argsLine = new Text("", 0, 0);
1402
+ this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
1403
+ this.addChild(new Spacer(1));
1404
+ this.addChild(this.box);
1405
+ this.box.addChild(this.header);
1406
+ this.box.addChild(this.argsLine);
1407
+ this.box.addChild(this.output);
1408
+ this.refresh();
1409
+ }
1410
+ setArgs(args) {
1411
+ this.args = args;
1412
+ this.refresh();
1413
+ }
1414
+ setExpanded(expanded) {
1415
+ this.expanded = expanded;
1416
+ this.refresh();
1417
+ }
1418
+ setResult(result, opts) {
1419
+ this.result = result;
1420
+ this.isPartial = false;
1421
+ this.isError = Boolean(opts?.isError);
1422
+ this.refresh();
1423
+ }
1424
+ setPartialResult(result) {
1425
+ this.result = result;
1426
+ this.isPartial = true;
1427
+ this.refresh();
1428
+ }
1429
+ refresh() {
1430
+ const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
1431
+ this.box.setBgFn((line) => bg(line));
1432
+ const display = resolveToolDisplay({
1433
+ name: this.toolName,
1434
+ args: this.args
1435
+ });
1436
+ const title = `${display.emoji} ${display.label}${this.isPartial ? " (running)" : ""}`;
1437
+ this.header.setText(theme.toolTitle(theme.bold(title)));
1438
+ const argLine = formatArgs(this.toolName, this.args);
1439
+ this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
1440
+ const text = extractText(this.result) || (this.isPartial ? "…" : "");
1441
+ if (!this.expanded && text) {
1442
+ const lines = text.split("\n");
1443
+ const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
1444
+ this.output.setText(preview);
1445
+ } else this.output.setText(text);
1446
+ }
1447
+ };
1448
+
1449
+ //#endregion
1450
+ //#region src/tui/components/user-message.ts
1451
+ var UserMessageComponent = class extends Container {
1452
+ constructor(text) {
1453
+ super();
1454
+ this.body = new Markdown(text, 1, 1, markdownTheme, {
1455
+ bgColor: (line) => theme.userBg(line),
1456
+ color: (line) => theme.userText(line)
1457
+ });
1458
+ this.addChild(new Spacer(1));
1459
+ this.addChild(this.body);
1460
+ }
1461
+ setText(text) {
1462
+ this.body.setText(text);
1463
+ }
1464
+ };
1465
+
1466
+ //#endregion
1467
+ //#region src/tui/components/chat-log.ts
1468
+ var ChatLog = class extends Container {
1469
+ constructor(..._args) {
1470
+ super(..._args);
1471
+ this.toolById = /* @__PURE__ */ new Map();
1472
+ this.streamingRuns = /* @__PURE__ */ new Map();
1473
+ this.toolsExpanded = false;
1474
+ }
1475
+ clearAll() {
1476
+ this.clear();
1477
+ this.toolById.clear();
1478
+ this.streamingRuns.clear();
1479
+ }
1480
+ addSystem(text) {
1481
+ this.addChild(new Spacer(1));
1482
+ this.addChild(new Text(theme.system(text), 1, 0));
1483
+ }
1484
+ addUser(text) {
1485
+ this.addChild(new UserMessageComponent(text));
1486
+ }
1487
+ resolveRunId(runId) {
1488
+ return runId ?? "default";
1489
+ }
1490
+ startAssistant(text, runId) {
1491
+ const component = new AssistantMessageComponent(text);
1492
+ this.streamingRuns.set(this.resolveRunId(runId), component);
1493
+ this.addChild(component);
1494
+ return component;
1495
+ }
1496
+ updateAssistant(text, runId) {
1497
+ const effectiveRunId = this.resolveRunId(runId);
1498
+ const existing = this.streamingRuns.get(effectiveRunId);
1499
+ if (!existing) {
1500
+ this.startAssistant(text, runId);
1501
+ return;
1502
+ }
1503
+ existing.setText(text);
1504
+ }
1505
+ finalizeAssistant(text, runId) {
1506
+ const effectiveRunId = this.resolveRunId(runId);
1507
+ const existing = this.streamingRuns.get(effectiveRunId);
1508
+ if (existing) {
1509
+ existing.setText(text);
1510
+ this.streamingRuns.delete(effectiveRunId);
1511
+ return;
1512
+ }
1513
+ this.addChild(new AssistantMessageComponent(text));
1514
+ }
1515
+ dropAssistant(runId) {
1516
+ const effectiveRunId = this.resolveRunId(runId);
1517
+ const existing = this.streamingRuns.get(effectiveRunId);
1518
+ if (!existing) return;
1519
+ this.removeChild(existing);
1520
+ this.streamingRuns.delete(effectiveRunId);
1521
+ }
1522
+ startTool(toolCallId, toolName, args) {
1523
+ const existing = this.toolById.get(toolCallId);
1524
+ if (existing) {
1525
+ existing.setArgs(args);
1526
+ return existing;
1527
+ }
1528
+ const component = new ToolExecutionComponent(toolName, args);
1529
+ component.setExpanded(this.toolsExpanded);
1530
+ this.toolById.set(toolCallId, component);
1531
+ this.addChild(component);
1532
+ return component;
1533
+ }
1534
+ updateToolArgs(toolCallId, args) {
1535
+ const existing = this.toolById.get(toolCallId);
1536
+ if (!existing) return;
1537
+ existing.setArgs(args);
1538
+ }
1539
+ updateToolResult(toolCallId, result, opts) {
1540
+ const existing = this.toolById.get(toolCallId);
1541
+ if (!existing) return;
1542
+ if (opts?.partial) {
1543
+ existing.setPartialResult(result);
1544
+ return;
1545
+ }
1546
+ existing.setResult(result, { isError: opts?.isError });
1547
+ }
1548
+ setToolsExpanded(expanded) {
1549
+ this.toolsExpanded = expanded;
1550
+ for (const tool of this.toolById.values()) tool.setExpanded(expanded);
1551
+ }
1552
+ };
1553
+
1554
+ //#endregion
1555
+ //#region src/tui/components/custom-editor.ts
1556
+ var CustomEditor = class extends Editor {
1557
+ handleInput(data) {
1558
+ if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
1559
+ this.onAltEnter();
1560
+ return;
1561
+ }
1562
+ if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
1563
+ this.onCtrlL();
1564
+ return;
1565
+ }
1566
+ if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
1567
+ this.onCtrlO();
1568
+ return;
1569
+ }
1570
+ if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
1571
+ this.onCtrlP();
1572
+ return;
1573
+ }
1574
+ if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
1575
+ this.onCtrlG();
1576
+ return;
1577
+ }
1578
+ if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
1579
+ this.onCtrlT();
1580
+ return;
1581
+ }
1582
+ if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
1583
+ this.onShiftTab();
1584
+ return;
1585
+ }
1586
+ if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
1587
+ this.onEscape();
1588
+ return;
1589
+ }
1590
+ if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
1591
+ this.onCtrlC();
1592
+ return;
1593
+ }
1594
+ if (matchesKey(data, Key.ctrl("d"))) {
1595
+ if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
1596
+ return;
1597
+ }
1598
+ super.handleInput(data);
1599
+ }
1600
+ };
1601
+
1602
+ //#endregion
1603
+ //#region src/tui/gateway-chat.ts
1604
+ var GatewayChatClient = class {
1605
+ constructor(opts) {
1606
+ const resolved = resolveGatewayConnection(opts);
1607
+ this.connection = resolved;
1608
+ this.readyPromise = new Promise((resolve) => {
1609
+ this.resolveReady = resolve;
1610
+ });
1611
+ this.client = new GatewayClient({
1612
+ url: resolved.url,
1613
+ token: resolved.token,
1614
+ password: resolved.password,
1615
+ clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
1616
+ clientDisplayName: "anima-tui",
1617
+ clientVersion: VERSION,
1618
+ platform: process.platform,
1619
+ mode: GATEWAY_CLIENT_MODES.UI,
1620
+ caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
1621
+ instanceId: randomUUID(),
1622
+ minProtocol: PROTOCOL_VERSION,
1623
+ maxProtocol: PROTOCOL_VERSION,
1624
+ onHelloOk: (hello) => {
1625
+ this.hello = hello;
1626
+ this.resolveReady?.();
1627
+ this.onConnected?.();
1628
+ },
1629
+ onEvent: (evt) => {
1630
+ this.onEvent?.({
1631
+ event: evt.event,
1632
+ payload: evt.payload,
1633
+ seq: evt.seq
1634
+ });
1635
+ },
1636
+ onClose: (_code, reason) => {
1637
+ this.onDisconnected?.(reason);
1638
+ },
1639
+ onGap: (info) => {
1640
+ this.onGap?.(info);
1641
+ }
1642
+ });
1643
+ }
1644
+ start() {
1645
+ this.client.start();
1646
+ }
1647
+ stop() {
1648
+ this.client.stop();
1649
+ }
1650
+ async waitForReady() {
1651
+ await this.readyPromise;
1652
+ }
1653
+ async sendChat(opts) {
1654
+ const runId = opts.runId ?? randomUUID();
1655
+ await this.client.request("chat.send", {
1656
+ sessionKey: opts.sessionKey,
1657
+ message: opts.message,
1658
+ thinking: opts.thinking,
1659
+ deliver: opts.deliver,
1660
+ timeoutMs: opts.timeoutMs,
1661
+ idempotencyKey: runId
1662
+ });
1663
+ return { runId };
1664
+ }
1665
+ async abortChat(opts) {
1666
+ return await this.client.request("chat.abort", {
1667
+ sessionKey: opts.sessionKey,
1668
+ runId: opts.runId
1669
+ });
1670
+ }
1671
+ async loadHistory(opts) {
1672
+ return await this.client.request("chat.history", {
1673
+ sessionKey: opts.sessionKey,
1674
+ limit: opts.limit
1675
+ });
1676
+ }
1677
+ async listSessions(opts) {
1678
+ return await this.client.request("sessions.list", {
1679
+ limit: opts?.limit,
1680
+ activeMinutes: opts?.activeMinutes,
1681
+ includeGlobal: opts?.includeGlobal,
1682
+ includeUnknown: opts?.includeUnknown,
1683
+ includeDerivedTitles: opts?.includeDerivedTitles,
1684
+ includeLastMessage: opts?.includeLastMessage,
1685
+ agentId: opts?.agentId
1686
+ });
1687
+ }
1688
+ async listAgents() {
1689
+ return await this.client.request("agents.list", {});
1690
+ }
1691
+ async patchSession(opts) {
1692
+ return await this.client.request("sessions.patch", opts);
1693
+ }
1694
+ async resetSession(key, reason) {
1695
+ return await this.client.request("sessions.reset", {
1696
+ key,
1697
+ ...reason ? { reason } : {}
1698
+ });
1699
+ }
1700
+ async getStatus() {
1701
+ return await this.client.request("status");
1702
+ }
1703
+ async listModels() {
1704
+ const res = await this.client.request("models.list");
1705
+ return Array.isArray(res?.models) ? res.models : [];
1706
+ }
1707
+ };
1708
+ function resolveGatewayConnection(opts) {
1709
+ const config = loadConfig();
1710
+ const isRemoteMode = config.gateway?.mode === "remote";
1711
+ const remote = isRemoteMode ? config.gateway?.remote : void 0;
1712
+ const authToken = config.gateway?.auth?.token;
1713
+ const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
1714
+ const explicitAuth = resolveExplicitGatewayAuth({
1715
+ token: opts.token,
1716
+ password: opts.password
1717
+ });
1718
+ ensureExplicitGatewayAuth({
1719
+ urlOverride,
1720
+ auth: explicitAuth,
1721
+ errorHint: "Fix: pass --token or --password when using --url."
1722
+ });
1723
+ return {
1724
+ url: buildGatewayConnectionDetails({
1725
+ config,
1726
+ ...urlOverride ? { url: urlOverride } : {}
1727
+ }).url,
1728
+ token: explicitAuth.token || (!urlOverride ? isRemoteMode ? typeof remote?.token === "string" && remote.token.trim().length > 0 ? remote.token.trim() : void 0 : process.env.ANIMA_GATEWAY_TOKEN?.trim() || (typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : void 0) : void 0),
1729
+ password: explicitAuth.password || (!urlOverride ? process.env.ANIMA_GATEWAY_PASSWORD?.trim() || (typeof remote?.password === "string" && remote.password.trim().length > 0 ? remote.password.trim() : void 0) : void 0)
1730
+ };
1731
+ }
1732
+
1733
+ //#endregion
1734
+ //#region src/tui/components/fuzzy-filter.ts
1735
+ /**
1736
+ * Shared fuzzy filtering utilities for select list components.
1737
+ */
1738
+ /**
1739
+ * Word boundary characters for matching.
1740
+ */
1741
+ const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
1742
+ /**
1743
+ * Check if position is at a word boundary.
1744
+ */
1745
+ function isWordBoundary(text, index) {
1746
+ return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
1747
+ }
1748
+ /**
1749
+ * Find index where query matches at a word boundary in text.
1750
+ * Returns null if no match.
1751
+ */
1752
+ function findWordBoundaryIndex(text, query) {
1753
+ if (!query) return null;
1754
+ const textLower = text.toLowerCase();
1755
+ const queryLower = query.toLowerCase();
1756
+ const maxIndex = textLower.length - queryLower.length;
1757
+ if (maxIndex < 0) return null;
1758
+ for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
1759
+ return null;
1760
+ }
1761
+ /**
1762
+ * Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
1763
+ * Returns score (lower = better) or null if no match.
1764
+ */
1765
+ function fuzzyMatchLower(queryLower, textLower) {
1766
+ if (queryLower.length === 0) return 0;
1767
+ if (queryLower.length > textLower.length) return null;
1768
+ let queryIndex = 0;
1769
+ let score = 0;
1770
+ let lastMatchIndex = -1;
1771
+ let consecutiveMatches = 0;
1772
+ for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
1773
+ const isAtWordBoundary = isWordBoundary(textLower, i);
1774
+ if (lastMatchIndex === i - 1) {
1775
+ consecutiveMatches++;
1776
+ score -= consecutiveMatches * 5;
1777
+ } else {
1778
+ consecutiveMatches = 0;
1779
+ if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
1780
+ }
1781
+ if (isAtWordBoundary) score -= 10;
1782
+ score += i * .1;
1783
+ lastMatchIndex = i;
1784
+ queryIndex++;
1785
+ }
1786
+ return queryIndex < queryLower.length ? null : score;
1787
+ }
1788
+ /**
1789
+ * Filter items using pre-lowercased searchTextLower field.
1790
+ * Supports space-separated tokens (all must match).
1791
+ */
1792
+ function fuzzyFilterLower(items, queryLower) {
1793
+ const trimmed = queryLower.trim();
1794
+ if (!trimmed) return items;
1795
+ const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
1796
+ if (tokens.length === 0) return items;
1797
+ const results = [];
1798
+ for (const item of items) {
1799
+ const text = item.searchTextLower ?? "";
1800
+ let totalScore = 0;
1801
+ let allMatch = true;
1802
+ for (const token of tokens) {
1803
+ const score = fuzzyMatchLower(token, text);
1804
+ if (score !== null) totalScore += score;
1805
+ else {
1806
+ allMatch = false;
1807
+ break;
1808
+ }
1809
+ }
1810
+ if (allMatch) results.push({
1811
+ item,
1812
+ score: totalScore
1813
+ });
1814
+ }
1815
+ results.sort((a, b) => a.score - b.score);
1816
+ return results.map((r) => r.item);
1817
+ }
1818
+ /**
1819
+ * Prepare items for fuzzy filtering by pre-computing lowercase search text.
1820
+ */
1821
+ function prepareSearchItems(items) {
1822
+ return items.map((item) => {
1823
+ const parts = [];
1824
+ if (item.label) parts.push(item.label);
1825
+ if (item.description) parts.push(item.description);
1826
+ if (item.searchText) parts.push(item.searchText);
1827
+ return {
1828
+ ...item,
1829
+ searchTextLower: parts.join(" ").toLowerCase()
1830
+ };
1831
+ });
1832
+ }
1833
+
1834
+ //#endregion
1835
+ //#region src/tui/components/filterable-select-list.ts
1836
+ /**
1837
+ * Combines text input filtering with a select list.
1838
+ * User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
1839
+ */
1840
+ var FilterableSelectList = class {
1841
+ constructor(items, maxVisible, theme) {
1842
+ this.filterText = "";
1843
+ this.allItems = prepareSearchItems(items);
1844
+ this.maxVisible = maxVisible;
1845
+ this.theme = theme;
1846
+ this.input = new Input();
1847
+ this.selectList = new SelectList(this.allItems, maxVisible, theme);
1848
+ }
1849
+ applyFilter() {
1850
+ const queryLower = this.filterText.toLowerCase();
1851
+ if (!queryLower.trim()) {
1852
+ this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
1853
+ return;
1854
+ }
1855
+ this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
1856
+ }
1857
+ invalidate() {
1858
+ this.input.invalidate();
1859
+ this.selectList.invalidate();
1860
+ }
1861
+ render(width) {
1862
+ const lines = [];
1863
+ const filterLabel = this.theme.filterLabel("Filter: ");
1864
+ const inputText = this.input.render(width - 8)[0] ?? "";
1865
+ lines.push(filterLabel + inputText);
1866
+ lines.push(chalk.dim("─".repeat(Math.max(0, width))));
1867
+ const listLines = this.selectList.render(width);
1868
+ lines.push(...listLines);
1869
+ return lines;
1870
+ }
1871
+ handleInput(keyData) {
1872
+ const allowVimNav = !this.filterText.trim();
1873
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
1874
+ this.selectList.handleInput("\x1B[A");
1875
+ return;
1876
+ }
1877
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
1878
+ this.selectList.handleInput("\x1B[B");
1879
+ return;
1880
+ }
1881
+ if (matchesKey(keyData, "enter")) {
1882
+ const selected = this.selectList.getSelectedItem();
1883
+ if (selected) this.onSelect?.(selected);
1884
+ return;
1885
+ }
1886
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
1887
+ if (this.filterText) {
1888
+ this.filterText = "";
1889
+ this.input.setValue("");
1890
+ this.applyFilter();
1891
+ } else this.onCancel?.();
1892
+ return;
1893
+ }
1894
+ const prevValue = this.input.getValue();
1895
+ this.input.handleInput(keyData);
1896
+ const newValue = this.input.getValue();
1897
+ if (newValue !== prevValue) {
1898
+ this.filterText = newValue;
1899
+ this.applyFilter();
1900
+ }
1901
+ }
1902
+ getSelectedItem() {
1903
+ return this.selectList.getSelectedItem();
1904
+ }
1905
+ getFilterText() {
1906
+ return this.filterText;
1907
+ }
1908
+ };
1909
+
1910
+ //#endregion
1911
+ //#region src/tui/components/searchable-select-list.ts
1912
+ const ANSI_ESCAPE = String.fromCharCode(27);
1913
+ const ANSI_SGR_REGEX = new RegExp(`${ANSI_ESCAPE}\\[[0-9;]*m`, "g");
1914
+ /**
1915
+ * A select list with a search input at the top for fuzzy filtering.
1916
+ */
1917
+ var SearchableSelectList = class SearchableSelectList {
1918
+ static {
1919
+ this.DESCRIPTION_LAYOUT_MIN_WIDTH = 40;
1920
+ }
1921
+ static {
1922
+ this.DESCRIPTION_MIN_WIDTH = 12;
1923
+ }
1924
+ static {
1925
+ this.DESCRIPTION_SPACING_WIDTH = 2;
1926
+ }
1927
+ static {
1928
+ this.RIGHT_MARGIN_WIDTH = 2;
1929
+ }
1930
+ constructor(items, maxVisible, theme) {
1931
+ this.selectedIndex = 0;
1932
+ this.regexCache = /* @__PURE__ */ new Map();
1933
+ this.compareByScore = (a, b) => {
1934
+ if (a.tier !== b.tier) return a.tier - b.tier;
1935
+ if (a.score !== b.score) return a.score - b.score;
1936
+ return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
1937
+ };
1938
+ this.items = items;
1939
+ this.filteredItems = items;
1940
+ this.maxVisible = maxVisible;
1941
+ this.theme = theme;
1942
+ this.searchInput = new Input();
1943
+ }
1944
+ getCachedRegex(pattern) {
1945
+ let regex = this.regexCache.get(pattern);
1946
+ if (!regex) {
1947
+ regex = new RegExp(this.escapeRegex(pattern), "gi");
1948
+ this.regexCache.set(pattern, regex);
1949
+ }
1950
+ return regex;
1951
+ }
1952
+ updateFilter() {
1953
+ const query = this.searchInput.getValue().trim();
1954
+ if (!query) this.filteredItems = this.items;
1955
+ else this.filteredItems = this.smartFilter(query);
1956
+ this.selectedIndex = 0;
1957
+ this.notifySelectionChange();
1958
+ }
1959
+ /**
1960
+ * Smart filtering that prioritizes:
1961
+ * 1. Exact substring match in label (highest priority)
1962
+ * 2. Word-boundary prefix match in label
1963
+ * 3. Exact substring in description
1964
+ * 4. Fuzzy match (lowest priority)
1965
+ */
1966
+ smartFilter(query) {
1967
+ const q = query.toLowerCase();
1968
+ const scoredItems = [];
1969
+ const fuzzyCandidates = [];
1970
+ for (const item of this.items) {
1971
+ const rawLabel = this.getItemLabel(item);
1972
+ const rawDesc = item.description ?? "";
1973
+ const label = stripAnsi(rawLabel).toLowerCase();
1974
+ const desc = stripAnsi(rawDesc).toLowerCase();
1975
+ const labelIndex = label.indexOf(q);
1976
+ if (labelIndex !== -1) {
1977
+ scoredItems.push({
1978
+ item,
1979
+ tier: 0,
1980
+ score: labelIndex
1981
+ });
1982
+ continue;
1983
+ }
1984
+ const wordBoundaryIndex = findWordBoundaryIndex(label, q);
1985
+ if (wordBoundaryIndex !== null) {
1986
+ scoredItems.push({
1987
+ item,
1988
+ tier: 1,
1989
+ score: wordBoundaryIndex
1990
+ });
1991
+ continue;
1992
+ }
1993
+ const descIndex = desc.indexOf(q);
1994
+ if (descIndex !== -1) {
1995
+ scoredItems.push({
1996
+ item,
1997
+ tier: 2,
1998
+ score: descIndex
1999
+ });
2000
+ continue;
2001
+ }
2002
+ const searchText = item.searchText ?? "";
2003
+ fuzzyCandidates.push({
2004
+ item,
2005
+ searchTextLower: [
2006
+ rawLabel,
2007
+ rawDesc,
2008
+ searchText
2009
+ ].map((value) => stripAnsi(value)).filter(Boolean).join(" ").toLowerCase()
2010
+ });
2011
+ }
2012
+ scoredItems.sort(this.compareByScore);
2013
+ const fuzzyMatches = fuzzyFilterLower(fuzzyCandidates, q);
2014
+ return [...scoredItems.map((s) => s.item), ...fuzzyMatches.map((entry) => entry.item)];
2015
+ }
2016
+ escapeRegex(str) {
2017
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2018
+ }
2019
+ getItemLabel(item) {
2020
+ return item.label || item.value;
2021
+ }
2022
+ splitAnsiParts(text) {
2023
+ const parts = [];
2024
+ ANSI_SGR_REGEX.lastIndex = 0;
2025
+ let lastIndex = 0;
2026
+ let match;
2027
+ while ((match = ANSI_SGR_REGEX.exec(text)) !== null) {
2028
+ if (match.index > lastIndex) parts.push({
2029
+ text: text.slice(lastIndex, match.index),
2030
+ isAnsi: false
2031
+ });
2032
+ parts.push({
2033
+ text: match[0],
2034
+ isAnsi: true
2035
+ });
2036
+ lastIndex = match.index + match[0].length;
2037
+ }
2038
+ if (lastIndex < text.length) parts.push({
2039
+ text: text.slice(lastIndex),
2040
+ isAnsi: false
2041
+ });
2042
+ return parts;
2043
+ }
2044
+ highlightMatch(text, query) {
2045
+ const tokens = query.trim().split(/\s+/).map((token) => token.toLowerCase()).filter((token) => token.length > 0);
2046
+ if (tokens.length === 0) return text;
2047
+ const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
2048
+ let parts = this.splitAnsiParts(text);
2049
+ for (const token of uniqueTokens) {
2050
+ const regex = this.getCachedRegex(token);
2051
+ const nextParts = [];
2052
+ for (const part of parts) {
2053
+ if (part.isAnsi) {
2054
+ nextParts.push(part);
2055
+ continue;
2056
+ }
2057
+ regex.lastIndex = 0;
2058
+ const replaced = part.text.replace(regex, (match) => this.theme.matchHighlight(match));
2059
+ if (replaced === part.text) {
2060
+ nextParts.push(part);
2061
+ continue;
2062
+ }
2063
+ nextParts.push(...this.splitAnsiParts(replaced));
2064
+ }
2065
+ parts = nextParts;
2066
+ }
2067
+ return parts.map((part) => part.text).join("");
2068
+ }
2069
+ setSelectedIndex(index) {
2070
+ this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
2071
+ }
2072
+ invalidate() {
2073
+ this.searchInput.invalidate();
2074
+ }
2075
+ render(width) {
2076
+ const lines = [];
2077
+ const prompt = this.theme.searchPrompt("search: ");
2078
+ const inputWidth = Math.max(1, width - visibleWidth(prompt));
2079
+ const inputText = this.searchInput.render(inputWidth)[0] ?? "";
2080
+ lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
2081
+ lines.push("");
2082
+ const query = this.searchInput.getValue().trim();
2083
+ if (this.filteredItems.length === 0) {
2084
+ lines.push(this.theme.noMatch(" No matches"));
2085
+ return lines;
2086
+ }
2087
+ const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
2088
+ const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
2089
+ for (let i = startIndex; i < endIndex; i++) {
2090
+ const item = this.filteredItems[i];
2091
+ if (!item) continue;
2092
+ const isSelected = i === this.selectedIndex;
2093
+ lines.push(this.renderItemLine(item, isSelected, width, query));
2094
+ }
2095
+ if (this.filteredItems.length > this.maxVisible) {
2096
+ const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
2097
+ lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
2098
+ }
2099
+ return lines;
2100
+ }
2101
+ renderItemLine(item, isSelected, width, query) {
2102
+ const prefix = isSelected ? "→ " : " ";
2103
+ const prefixWidth = prefix.length;
2104
+ const displayValue = this.getItemLabel(item);
2105
+ const description = item.description;
2106
+ if (description) {
2107
+ const descriptionLayout = this.getDescriptionLayout(width, prefixWidth);
2108
+ if (descriptionLayout) {
2109
+ const truncatedValue = truncateToWidth(displayValue, descriptionLayout.maxValueWidth, "");
2110
+ const valueText = this.highlightMatch(truncatedValue, query);
2111
+ const usedByValue = visibleWidth(valueText);
2112
+ const descriptionWidth = descriptionLayout.availableWidth - usedByValue - descriptionLayout.spacingWidth;
2113
+ if (descriptionWidth >= SearchableSelectList.DESCRIPTION_MIN_WIDTH) {
2114
+ const spacing = " ".repeat(descriptionLayout.spacingWidth);
2115
+ const truncatedDesc = truncateToWidth(description, descriptionWidth, "");
2116
+ const highlightedDesc = this.highlightMatch(truncatedDesc, query);
2117
+ const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
2118
+ return isSelected ? this.theme.selectedText(line) : line;
2119
+ }
2120
+ }
2121
+ }
2122
+ const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
2123
+ const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
2124
+ return isSelected ? this.theme.selectedText(line) : line;
2125
+ }
2126
+ getDescriptionLayout(width, prefixWidth) {
2127
+ if (width <= SearchableSelectList.DESCRIPTION_LAYOUT_MIN_WIDTH) return null;
2128
+ const availableWidth = Math.max(1, width - prefixWidth - SearchableSelectList.RIGHT_MARGIN_WIDTH);
2129
+ const maxValueWidth = availableWidth - SearchableSelectList.DESCRIPTION_MIN_WIDTH - SearchableSelectList.DESCRIPTION_SPACING_WIDTH;
2130
+ if (maxValueWidth < 1) return null;
2131
+ return {
2132
+ availableWidth,
2133
+ maxValueWidth,
2134
+ spacingWidth: SearchableSelectList.DESCRIPTION_SPACING_WIDTH
2135
+ };
2136
+ }
2137
+ handleInput(keyData) {
2138
+ if (isKeyRelease(keyData)) return;
2139
+ const allowVimNav = !this.searchInput.getValue().trim();
2140
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
2141
+ this.selectedIndex = Math.max(0, this.selectedIndex - 1);
2142
+ this.notifySelectionChange();
2143
+ return;
2144
+ }
2145
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
2146
+ this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
2147
+ this.notifySelectionChange();
2148
+ return;
2149
+ }
2150
+ if (matchesKey(keyData, "enter")) {
2151
+ const item = this.filteredItems[this.selectedIndex];
2152
+ if (item && this.onSelect) this.onSelect(item);
2153
+ return;
2154
+ }
2155
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
2156
+ if (this.onCancel) this.onCancel();
2157
+ return;
2158
+ }
2159
+ const prevValue = this.searchInput.getValue();
2160
+ this.searchInput.handleInput(keyData);
2161
+ if (prevValue !== this.searchInput.getValue()) this.updateFilter();
2162
+ }
2163
+ notifySelectionChange() {
2164
+ const item = this.filteredItems[this.selectedIndex];
2165
+ if (item && this.onSelectionChange) this.onSelectionChange(item);
2166
+ }
2167
+ getSelectedItem() {
2168
+ return this.filteredItems[this.selectedIndex] ?? null;
2169
+ }
2170
+ };
2171
+
2172
+ //#endregion
2173
+ //#region src/tui/components/selectors.ts
2174
+ function createSearchableSelectList(items, maxVisible = 7) {
2175
+ return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
2176
+ }
2177
+ function createFilterableSelectList(items, maxVisible = 7) {
2178
+ return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
2179
+ }
2180
+ function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
2181
+ return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
2182
+ }
2183
+
2184
+ //#endregion
2185
+ //#region src/tui/tui-status-summary.ts
2186
+ function formatStatusSummary(summary) {
2187
+ const lines = [];
2188
+ lines.push("Gateway status");
2189
+ if (!summary.linkChannel) lines.push("Link channel: unknown");
2190
+ else {
2191
+ const linkLabel = summary.linkChannel.label ?? "Link channel";
2192
+ const linked = summary.linkChannel.linked === true;
2193
+ const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})` : "";
2194
+ lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
2195
+ }
2196
+ const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
2197
+ if (providerSummary.length > 0) {
2198
+ lines.push("");
2199
+ lines.push("System:");
2200
+ for (const line of providerSummary) lines.push(` ${line}`);
2201
+ }
2202
+ const heartbeatAgents = summary.heartbeat?.agents ?? [];
2203
+ if (heartbeatAgents.length > 0) {
2204
+ const heartbeatParts = heartbeatAgents.map((agent) => {
2205
+ const agentId = agent.agentId ?? "unknown";
2206
+ if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
2207
+ return `${agent.every ?? "unknown"} (${agentId})`;
2208
+ });
2209
+ lines.push("");
2210
+ lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
2211
+ }
2212
+ const sessionPaths = summary.sessions?.paths ?? [];
2213
+ if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
2214
+ else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
2215
+ const defaults = summary.sessions?.defaults;
2216
+ const defaultModel = defaults?.model ?? "unknown";
2217
+ const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
2218
+ lines.push(`Default model: ${defaultModel}${defaultCtx}`);
2219
+ const sessionCount = summary.sessions?.count ?? 0;
2220
+ lines.push(`Active sessions: ${sessionCount}`);
2221
+ const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
2222
+ if (recent.length > 0) {
2223
+ lines.push("Recent sessions:");
2224
+ for (const entry of recent) {
2225
+ const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
2226
+ const model = entry.model ?? "unknown";
2227
+ const usage = formatContextUsageLine({
2228
+ total: entry.totalTokens ?? null,
2229
+ context: entry.contextTokens ?? null,
2230
+ remaining: entry.remainingTokens ?? null,
2231
+ percent: entry.percentUsed ?? null
2232
+ });
2233
+ const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
2234
+ lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
2235
+ }
2236
+ }
2237
+ const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
2238
+ if (queued.length > 0) {
2239
+ const preview = queued.slice(0, 3).join(" | ");
2240
+ lines.push(`Queued system events (${queued.length}): ${preview}`);
2241
+ }
2242
+ return lines;
2243
+ }
2244
+
2245
+ //#endregion
2246
+ //#region src/tui/tui-command-handlers.ts
2247
+ function createCommandHandlers(context) {
2248
+ const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalRunId, forgetLocalRunId } = context;
2249
+ const setAgent = async (id) => {
2250
+ state.currentAgentId = normalizeAgentId(id);
2251
+ await setSession("");
2252
+ };
2253
+ const openModelSelector = async () => {
2254
+ try {
2255
+ const models = await client.listModels();
2256
+ if (models.length === 0) {
2257
+ chatLog.addSystem("no models available");
2258
+ tui.requestRender();
2259
+ return;
2260
+ }
2261
+ const selector = createSearchableSelectList(models.map((model) => ({
2262
+ value: `${model.provider}/${model.id}`,
2263
+ label: `${model.provider}/${model.id}`,
2264
+ description: model.name && model.name !== model.id ? model.name : ""
2265
+ })), 9);
2266
+ selector.onSelect = (item) => {
2267
+ (async () => {
2268
+ try {
2269
+ const result = await client.patchSession({
2270
+ key: state.currentSessionKey,
2271
+ model: item.value
2272
+ });
2273
+ chatLog.addSystem(`model set to ${item.value}`);
2274
+ applySessionInfoFromPatch(result);
2275
+ await refreshSessionInfo();
2276
+ } catch (err) {
2277
+ chatLog.addSystem(`model set failed: ${String(err)}`);
2278
+ }
2279
+ closeOverlay();
2280
+ tui.requestRender();
2281
+ })();
2282
+ };
2283
+ selector.onCancel = () => {
2284
+ closeOverlay();
2285
+ tui.requestRender();
2286
+ };
2287
+ openOverlay(selector);
2288
+ tui.requestRender();
2289
+ } catch (err) {
2290
+ chatLog.addSystem(`model list failed: ${String(err)}`);
2291
+ tui.requestRender();
2292
+ }
2293
+ };
2294
+ const openAgentSelector = async () => {
2295
+ await refreshAgents();
2296
+ if (state.agents.length === 0) {
2297
+ chatLog.addSystem("no agents found");
2298
+ tui.requestRender();
2299
+ return;
2300
+ }
2301
+ const selector = createSearchableSelectList(state.agents.map((agent) => ({
2302
+ value: agent.id,
2303
+ label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
2304
+ description: agent.id === state.agentDefaultId ? "default" : ""
2305
+ })), 9);
2306
+ selector.onSelect = (item) => {
2307
+ (async () => {
2308
+ closeOverlay();
2309
+ await setAgent(item.value);
2310
+ tui.requestRender();
2311
+ })();
2312
+ };
2313
+ selector.onCancel = () => {
2314
+ closeOverlay();
2315
+ tui.requestRender();
2316
+ };
2317
+ openOverlay(selector);
2318
+ tui.requestRender();
2319
+ };
2320
+ const openSessionSelector = async () => {
2321
+ try {
2322
+ const selector = createFilterableSelectList((await client.listSessions({
2323
+ includeGlobal: false,
2324
+ includeUnknown: false,
2325
+ includeDerivedTitles: true,
2326
+ includeLastMessage: true,
2327
+ agentId: state.currentAgentId
2328
+ })).sessions.map((session) => {
2329
+ const title = session.derivedTitle ?? session.displayName;
2330
+ const formattedKey = formatSessionKey(session.key);
2331
+ const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
2332
+ const timePart = session.updatedAt ? formatRelativeTimestamp(session.updatedAt, {
2333
+ dateFallback: true,
2334
+ fallback: ""
2335
+ }) : "";
2336
+ const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
2337
+ const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
2338
+ return {
2339
+ value: session.key,
2340
+ label,
2341
+ description,
2342
+ searchText: [
2343
+ session.displayName,
2344
+ session.label,
2345
+ session.subject,
2346
+ session.sessionId,
2347
+ session.key,
2348
+ session.lastMessagePreview
2349
+ ].filter(Boolean).join(" ")
2350
+ };
2351
+ }), 9);
2352
+ selector.onSelect = (item) => {
2353
+ (async () => {
2354
+ closeOverlay();
2355
+ await setSession(item.value);
2356
+ tui.requestRender();
2357
+ })();
2358
+ };
2359
+ selector.onCancel = () => {
2360
+ closeOverlay();
2361
+ tui.requestRender();
2362
+ };
2363
+ openOverlay(selector);
2364
+ tui.requestRender();
2365
+ } catch (err) {
2366
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
2367
+ tui.requestRender();
2368
+ }
2369
+ };
2370
+ const openSettings = () => {
2371
+ openOverlay(createSettingsList([{
2372
+ id: "tools",
2373
+ label: "Tool output",
2374
+ currentValue: state.toolsExpanded ? "expanded" : "collapsed",
2375
+ values: ["collapsed", "expanded"]
2376
+ }, {
2377
+ id: "thinking",
2378
+ label: "Show thinking",
2379
+ currentValue: state.showThinking ? "on" : "off",
2380
+ values: ["off", "on"]
2381
+ }], (id, value) => {
2382
+ if (id === "tools") {
2383
+ state.toolsExpanded = value === "expanded";
2384
+ chatLog.setToolsExpanded(state.toolsExpanded);
2385
+ }
2386
+ if (id === "thinking") {
2387
+ state.showThinking = value === "on";
2388
+ loadHistory();
2389
+ }
2390
+ tui.requestRender();
2391
+ }, () => {
2392
+ closeOverlay();
2393
+ tui.requestRender();
2394
+ }));
2395
+ tui.requestRender();
2396
+ };
2397
+ const handleCommand = async (raw) => {
2398
+ const { name, args } = parseCommand(raw);
2399
+ if (!name) return;
2400
+ switch (name) {
2401
+ case "help":
2402
+ chatLog.addSystem(helpText({
2403
+ provider: state.sessionInfo.modelProvider,
2404
+ model: state.sessionInfo.model
2405
+ }));
2406
+ break;
2407
+ case "status":
2408
+ try {
2409
+ const status = await client.getStatus();
2410
+ if (typeof status === "string") {
2411
+ chatLog.addSystem(status);
2412
+ break;
2413
+ }
2414
+ if (status && typeof status === "object") {
2415
+ const lines = formatStatusSummary(status);
2416
+ for (const line of lines) chatLog.addSystem(line);
2417
+ break;
2418
+ }
2419
+ chatLog.addSystem("status: unknown response");
2420
+ } catch (err) {
2421
+ chatLog.addSystem(`status failed: ${String(err)}`);
2422
+ }
2423
+ break;
2424
+ case "agent":
2425
+ if (!args) await openAgentSelector();
2426
+ else await setAgent(args);
2427
+ break;
2428
+ case "agents":
2429
+ await openAgentSelector();
2430
+ break;
2431
+ case "session":
2432
+ if (!args) await openSessionSelector();
2433
+ else await setSession(args);
2434
+ break;
2435
+ case "sessions":
2436
+ await openSessionSelector();
2437
+ break;
2438
+ case "model":
2439
+ if (!args) await openModelSelector();
2440
+ else try {
2441
+ const result = await client.patchSession({
2442
+ key: state.currentSessionKey,
2443
+ model: args
2444
+ });
2445
+ chatLog.addSystem(`model set to ${args}`);
2446
+ applySessionInfoFromPatch(result);
2447
+ await refreshSessionInfo();
2448
+ } catch (err) {
2449
+ chatLog.addSystem(`model set failed: ${String(err)}`);
2450
+ }
2451
+ break;
2452
+ case "models":
2453
+ await openModelSelector();
2454
+ break;
2455
+ case "think":
2456
+ if (!args) {
2457
+ const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
2458
+ chatLog.addSystem(`usage: /think <${levels}>`);
2459
+ break;
2460
+ }
2461
+ try {
2462
+ const result = await client.patchSession({
2463
+ key: state.currentSessionKey,
2464
+ thinkingLevel: args
2465
+ });
2466
+ chatLog.addSystem(`thinking set to ${args}`);
2467
+ applySessionInfoFromPatch(result);
2468
+ await refreshSessionInfo();
2469
+ } catch (err) {
2470
+ chatLog.addSystem(`think failed: ${String(err)}`);
2471
+ }
2472
+ break;
2473
+ case "verbose":
2474
+ if (!args) {
2475
+ chatLog.addSystem("usage: /verbose <on|off>");
2476
+ break;
2477
+ }
2478
+ try {
2479
+ const result = await client.patchSession({
2480
+ key: state.currentSessionKey,
2481
+ verboseLevel: args
2482
+ });
2483
+ chatLog.addSystem(`verbose set to ${args}`);
2484
+ applySessionInfoFromPatch(result);
2485
+ await loadHistory();
2486
+ } catch (err) {
2487
+ chatLog.addSystem(`verbose failed: ${String(err)}`);
2488
+ }
2489
+ break;
2490
+ case "reasoning":
2491
+ if (!args) {
2492
+ chatLog.addSystem("usage: /reasoning <on|off>");
2493
+ break;
2494
+ }
2495
+ try {
2496
+ const result = await client.patchSession({
2497
+ key: state.currentSessionKey,
2498
+ reasoningLevel: args
2499
+ });
2500
+ chatLog.addSystem(`reasoning set to ${args}`);
2501
+ applySessionInfoFromPatch(result);
2502
+ await refreshSessionInfo();
2503
+ } catch (err) {
2504
+ chatLog.addSystem(`reasoning failed: ${String(err)}`);
2505
+ }
2506
+ break;
2507
+ case "usage": {
2508
+ const normalized = args ? normalizeUsageDisplay(args) : void 0;
2509
+ if (args && !normalized) {
2510
+ chatLog.addSystem("usage: /usage <off|tokens|full>");
2511
+ break;
2512
+ }
2513
+ const currentRaw = state.sessionInfo.responseUsage;
2514
+ const current = resolveResponseUsageMode(currentRaw);
2515
+ const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
2516
+ try {
2517
+ const result = await client.patchSession({
2518
+ key: state.currentSessionKey,
2519
+ responseUsage: next === "off" ? null : next
2520
+ });
2521
+ chatLog.addSystem(`usage footer: ${next}`);
2522
+ applySessionInfoFromPatch(result);
2523
+ await refreshSessionInfo();
2524
+ } catch (err) {
2525
+ chatLog.addSystem(`usage failed: ${String(err)}`);
2526
+ }
2527
+ break;
2528
+ }
2529
+ case "elevated":
2530
+ if (!args) {
2531
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
2532
+ break;
2533
+ }
2534
+ if (![
2535
+ "on",
2536
+ "off",
2537
+ "ask",
2538
+ "full"
2539
+ ].includes(args)) {
2540
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
2541
+ break;
2542
+ }
2543
+ try {
2544
+ const result = await client.patchSession({
2545
+ key: state.currentSessionKey,
2546
+ elevatedLevel: args
2547
+ });
2548
+ chatLog.addSystem(`elevated set to ${args}`);
2549
+ applySessionInfoFromPatch(result);
2550
+ await refreshSessionInfo();
2551
+ } catch (err) {
2552
+ chatLog.addSystem(`elevated failed: ${String(err)}`);
2553
+ }
2554
+ break;
2555
+ case "activation":
2556
+ if (!args) {
2557
+ chatLog.addSystem("usage: /activation <mention|always>");
2558
+ break;
2559
+ }
2560
+ try {
2561
+ const result = await client.patchSession({
2562
+ key: state.currentSessionKey,
2563
+ groupActivation: args === "always" ? "always" : "mention"
2564
+ });
2565
+ chatLog.addSystem(`activation set to ${args}`);
2566
+ applySessionInfoFromPatch(result);
2567
+ await refreshSessionInfo();
2568
+ } catch (err) {
2569
+ chatLog.addSystem(`activation failed: ${String(err)}`);
2570
+ }
2571
+ break;
2572
+ case "new":
2573
+ case "reset":
2574
+ try {
2575
+ state.sessionInfo.inputTokens = null;
2576
+ state.sessionInfo.outputTokens = null;
2577
+ state.sessionInfo.totalTokens = null;
2578
+ tui.requestRender();
2579
+ await client.resetSession(state.currentSessionKey, name);
2580
+ chatLog.addSystem(`session ${state.currentSessionKey} reset`);
2581
+ await loadHistory();
2582
+ } catch (err) {
2583
+ chatLog.addSystem(`reset failed: ${String(err)}`);
2584
+ }
2585
+ break;
2586
+ case "abort":
2587
+ await abortActive();
2588
+ break;
2589
+ case "settings":
2590
+ openSettings();
2591
+ break;
2592
+ case "exit":
2593
+ case "quit":
2594
+ client.stop();
2595
+ tui.stop();
2596
+ process.exit(0);
2597
+ break;
2598
+ default:
2599
+ await sendMessage(raw);
2600
+ break;
2601
+ }
2602
+ tui.requestRender();
2603
+ };
2604
+ const sendMessage = async (text) => {
2605
+ try {
2606
+ chatLog.addUser(text);
2607
+ tui.requestRender();
2608
+ const runId = randomUUID();
2609
+ noteLocalRunId(runId);
2610
+ state.activeChatRunId = runId;
2611
+ setActivityStatus("sending");
2612
+ await client.sendChat({
2613
+ sessionKey: state.currentSessionKey,
2614
+ message: text,
2615
+ thinking: opts.thinking,
2616
+ deliver: deliverDefault,
2617
+ timeoutMs: opts.timeoutMs,
2618
+ runId
2619
+ });
2620
+ setActivityStatus("waiting");
2621
+ } catch (err) {
2622
+ if (state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
2623
+ state.activeChatRunId = null;
2624
+ chatLog.addSystem(`send failed: ${String(err)}`);
2625
+ setActivityStatus("error");
2626
+ }
2627
+ tui.requestRender();
2628
+ };
2629
+ return {
2630
+ handleCommand,
2631
+ sendMessage,
2632
+ openModelSelector,
2633
+ openAgentSelector,
2634
+ openSessionSelector,
2635
+ openSettings,
2636
+ setAgent
2637
+ };
2638
+ }
2639
+
2640
+ //#endregion
2641
+ //#region src/tui/tui-stream-assembler.ts
2642
+ function extractTextBlocksAndSignals(message) {
2643
+ if (!message || typeof message !== "object") return {
2644
+ textBlocks: [],
2645
+ sawNonTextContentBlocks: false
2646
+ };
2647
+ const content = message.content;
2648
+ if (typeof content === "string") {
2649
+ const text = content.trim();
2650
+ return {
2651
+ textBlocks: text ? [text] : [],
2652
+ sawNonTextContentBlocks: false
2653
+ };
2654
+ }
2655
+ if (!Array.isArray(content)) return {
2656
+ textBlocks: [],
2657
+ sawNonTextContentBlocks: false
2658
+ };
2659
+ const textBlocks = [];
2660
+ let sawNonTextContentBlocks = false;
2661
+ for (const block of content) {
2662
+ if (!block || typeof block !== "object") continue;
2663
+ const rec = block;
2664
+ if (rec.type === "text" && typeof rec.text === "string") {
2665
+ const text = rec.text.trim();
2666
+ if (text) textBlocks.push(text);
2667
+ continue;
2668
+ }
2669
+ if (typeof rec.type === "string" && rec.type !== "thinking") sawNonTextContentBlocks = true;
2670
+ }
2671
+ return {
2672
+ textBlocks,
2673
+ sawNonTextContentBlocks
2674
+ };
2675
+ }
2676
+ function isDroppedBoundaryTextBlockSubset(params) {
2677
+ const { streamedTextBlocks, finalTextBlocks } = params;
2678
+ if (finalTextBlocks.length === 0 || finalTextBlocks.length >= streamedTextBlocks.length) return false;
2679
+ if (finalTextBlocks.every((block, index) => streamedTextBlocks[index] === block)) return true;
2680
+ const suffixStart = streamedTextBlocks.length - finalTextBlocks.length;
2681
+ return finalTextBlocks.every((block, index) => streamedTextBlocks[suffixStart + index] === block);
2682
+ }
2683
+ var TuiStreamAssembler = class {
2684
+ constructor() {
2685
+ this.runs = /* @__PURE__ */ new Map();
2686
+ }
2687
+ getOrCreateRun(runId) {
2688
+ let state = this.runs.get(runId);
2689
+ if (!state) {
2690
+ state = {
2691
+ thinkingText: "",
2692
+ contentText: "",
2693
+ contentBlocks: [],
2694
+ sawNonTextContentBlocks: false,
2695
+ displayText: ""
2696
+ };
2697
+ this.runs.set(runId, state);
2698
+ }
2699
+ return state;
2700
+ }
2701
+ updateRunState(state, message, showThinking, opts) {
2702
+ const thinkingText = extractThinkingFromMessage(message);
2703
+ const contentText = extractContentFromMessage(message);
2704
+ const { textBlocks, sawNonTextContentBlocks } = extractTextBlocksAndSignals(message);
2705
+ if (thinkingText) state.thinkingText = thinkingText;
2706
+ if (contentText) {
2707
+ const nextContentBlocks = textBlocks.length > 0 ? textBlocks : [contentText];
2708
+ if (!(opts?.protectBoundaryDrops === true && (state.sawNonTextContentBlocks || sawNonTextContentBlocks) && isDroppedBoundaryTextBlockSubset({
2709
+ streamedTextBlocks: state.contentBlocks,
2710
+ finalTextBlocks: nextContentBlocks
2711
+ }))) {
2712
+ state.contentText = contentText;
2713
+ state.contentBlocks = nextContentBlocks;
2714
+ }
2715
+ }
2716
+ if (sawNonTextContentBlocks) state.sawNonTextContentBlocks = true;
2717
+ state.displayText = composeThinkingAndContent({
2718
+ thinkingText: state.thinkingText,
2719
+ contentText: state.contentText,
2720
+ showThinking
2721
+ });
2722
+ }
2723
+ ingestDelta(runId, message, showThinking) {
2724
+ const state = this.getOrCreateRun(runId);
2725
+ const previousDisplayText = state.displayText;
2726
+ this.updateRunState(state, message, showThinking, { protectBoundaryDrops: true });
2727
+ if (!state.displayText || state.displayText === previousDisplayText) return null;
2728
+ return state.displayText;
2729
+ }
2730
+ finalize(runId, message, showThinking) {
2731
+ const state = this.getOrCreateRun(runId);
2732
+ const streamedDisplayText = state.displayText;
2733
+ const streamedTextBlocks = [...state.contentBlocks];
2734
+ const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks;
2735
+ this.updateRunState(state, message, showThinking);
2736
+ const finalComposed = state.displayText;
2737
+ const finalText = resolveFinalAssistantText({
2738
+ finalText: streamedSawNonTextContentBlocks && isDroppedBoundaryTextBlockSubset({
2739
+ streamedTextBlocks,
2740
+ finalTextBlocks: state.contentBlocks
2741
+ }) ? streamedDisplayText : finalComposed,
2742
+ streamedText: streamedDisplayText
2743
+ });
2744
+ this.runs.delete(runId);
2745
+ return finalText;
2746
+ }
2747
+ drop(runId) {
2748
+ this.runs.delete(runId);
2749
+ }
2750
+ };
2751
+
2752
+ //#endregion
2753
+ //#region src/tui/tui-event-handlers.ts
2754
+ function createEventHandlers(context) {
2755
+ const { chatLog, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, isLocalRunId, forgetLocalRunId, clearLocalRunIds } = context;
2756
+ const finalizedRuns = /* @__PURE__ */ new Map();
2757
+ const sessionRuns = /* @__PURE__ */ new Map();
2758
+ let streamAssembler = new TuiStreamAssembler();
2759
+ let lastSessionKey = state.currentSessionKey;
2760
+ const pruneRunMap = (runs) => {
2761
+ if (runs.size <= 200) return;
2762
+ const keepUntil = Date.now() - 600 * 1e3;
2763
+ for (const [key, ts] of runs) {
2764
+ if (runs.size <= 150) break;
2765
+ if (ts < keepUntil) runs.delete(key);
2766
+ }
2767
+ if (runs.size > 200) for (const key of runs.keys()) {
2768
+ runs.delete(key);
2769
+ if (runs.size <= 150) break;
2770
+ }
2771
+ };
2772
+ const syncSessionKey = () => {
2773
+ if (state.currentSessionKey === lastSessionKey) return;
2774
+ lastSessionKey = state.currentSessionKey;
2775
+ finalizedRuns.clear();
2776
+ sessionRuns.clear();
2777
+ streamAssembler = new TuiStreamAssembler();
2778
+ clearLocalRunIds?.();
2779
+ };
2780
+ const noteSessionRun = (runId) => {
2781
+ sessionRuns.set(runId, Date.now());
2782
+ pruneRunMap(sessionRuns);
2783
+ };
2784
+ const noteFinalizedRun = (runId) => {
2785
+ finalizedRuns.set(runId, Date.now());
2786
+ sessionRuns.delete(runId);
2787
+ streamAssembler.drop(runId);
2788
+ pruneRunMap(finalizedRuns);
2789
+ };
2790
+ const clearActiveRunIfMatch = (runId) => {
2791
+ if (state.activeChatRunId === runId) state.activeChatRunId = null;
2792
+ };
2793
+ const hasConcurrentActiveRun = (runId) => {
2794
+ const activeRunId = state.activeChatRunId;
2795
+ if (!activeRunId || activeRunId === runId) return false;
2796
+ return sessionRuns.has(activeRunId);
2797
+ };
2798
+ const maybeRefreshHistoryForRun = (runId) => {
2799
+ if (isLocalRunId?.(runId)) {
2800
+ forgetLocalRunId?.(runId);
2801
+ return;
2802
+ }
2803
+ if (hasConcurrentActiveRun(runId)) return;
2804
+ loadHistory?.();
2805
+ };
2806
+ const handleChatEvent = (payload) => {
2807
+ if (!payload || typeof payload !== "object") return;
2808
+ const evt = payload;
2809
+ syncSessionKey();
2810
+ if (evt.sessionKey !== state.currentSessionKey) return;
2811
+ if (finalizedRuns.has(evt.runId)) {
2812
+ if (evt.state === "delta") return;
2813
+ if (evt.state === "final") return;
2814
+ }
2815
+ noteSessionRun(evt.runId);
2816
+ if (!state.activeChatRunId) state.activeChatRunId = evt.runId;
2817
+ if (evt.state === "delta") {
2818
+ const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
2819
+ if (!displayText) return;
2820
+ chatLog.updateAssistant(displayText, evt.runId);
2821
+ setActivityStatus("streaming");
2822
+ }
2823
+ if (evt.state === "final") {
2824
+ const wasActiveRun = state.activeChatRunId === evt.runId;
2825
+ if (!evt.message) {
2826
+ maybeRefreshHistoryForRun(evt.runId);
2827
+ chatLog.dropAssistant(evt.runId);
2828
+ noteFinalizedRun(evt.runId);
2829
+ clearActiveRunIfMatch(evt.runId);
2830
+ if (wasActiveRun) setActivityStatus("idle");
2831
+ refreshSessionInfo?.();
2832
+ tui.requestRender();
2833
+ return;
2834
+ }
2835
+ if (isCommandMessage(evt.message)) {
2836
+ maybeRefreshHistoryForRun(evt.runId);
2837
+ const text = extractTextFromMessage(evt.message);
2838
+ if (text) chatLog.addSystem(text);
2839
+ streamAssembler.drop(evt.runId);
2840
+ noteFinalizedRun(evt.runId);
2841
+ clearActiveRunIfMatch(evt.runId);
2842
+ if (wasActiveRun) setActivityStatus("idle");
2843
+ refreshSessionInfo?.();
2844
+ tui.requestRender();
2845
+ return;
2846
+ }
2847
+ maybeRefreshHistoryForRun(evt.runId);
2848
+ const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
2849
+ const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking);
2850
+ if (finalText === "(no output)" && !isLocalRunId?.(evt.runId)) chatLog.dropAssistant(evt.runId);
2851
+ else chatLog.finalizeAssistant(finalText, evt.runId);
2852
+ noteFinalizedRun(evt.runId);
2853
+ clearActiveRunIfMatch(evt.runId);
2854
+ if (wasActiveRun) setActivityStatus(stopReason === "error" ? "error" : "idle");
2855
+ refreshSessionInfo?.();
2856
+ }
2857
+ if (evt.state === "aborted") {
2858
+ const wasActiveRun = state.activeChatRunId === evt.runId;
2859
+ chatLog.addSystem("run aborted");
2860
+ streamAssembler.drop(evt.runId);
2861
+ sessionRuns.delete(evt.runId);
2862
+ clearActiveRunIfMatch(evt.runId);
2863
+ if (wasActiveRun) setActivityStatus("aborted");
2864
+ refreshSessionInfo?.();
2865
+ maybeRefreshHistoryForRun(evt.runId);
2866
+ }
2867
+ if (evt.state === "error") {
2868
+ const wasActiveRun = state.activeChatRunId === evt.runId;
2869
+ chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
2870
+ streamAssembler.drop(evt.runId);
2871
+ sessionRuns.delete(evt.runId);
2872
+ clearActiveRunIfMatch(evt.runId);
2873
+ if (wasActiveRun) setActivityStatus("error");
2874
+ refreshSessionInfo?.();
2875
+ maybeRefreshHistoryForRun(evt.runId);
2876
+ }
2877
+ tui.requestRender();
2878
+ };
2879
+ const handleAgentEvent = (payload) => {
2880
+ if (!payload || typeof payload !== "object") return;
2881
+ const evt = payload;
2882
+ syncSessionKey();
2883
+ const isActiveRun = evt.runId === state.activeChatRunId;
2884
+ if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
2885
+ if (evt.stream === "tool") {
2886
+ const verbose = state.sessionInfo.verboseLevel ?? "off";
2887
+ const allowToolEvents = verbose !== "off";
2888
+ const allowToolOutput = verbose === "full";
2889
+ if (!allowToolEvents) return;
2890
+ const data = evt.data ?? {};
2891
+ const phase = asString(data.phase, "");
2892
+ const toolCallId = asString(data.toolCallId, "");
2893
+ const toolName = asString(data.name, "tool");
2894
+ if (!toolCallId) return;
2895
+ if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
2896
+ else if (phase === "update") {
2897
+ if (!allowToolOutput) return;
2898
+ chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
2899
+ } else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
2900
+ else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
2901
+ tui.requestRender();
2902
+ return;
2903
+ }
2904
+ if (evt.stream === "lifecycle") {
2905
+ if (!isActiveRun) return;
2906
+ const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
2907
+ if (phase === "start") setActivityStatus("running");
2908
+ if (phase === "end") setActivityStatus("idle");
2909
+ if (phase === "error") setActivityStatus("error");
2910
+ tui.requestRender();
2911
+ }
2912
+ };
2913
+ return {
2914
+ handleChatEvent,
2915
+ handleAgentEvent
2916
+ };
2917
+ }
2918
+
2919
+ //#endregion
2920
+ //#region src/tui/tui-local-shell.ts
2921
+ function createLocalShellRunner(deps) {
2922
+ let localExecAsked = false;
2923
+ let localExecAllowed = false;
2924
+ const createSelector = deps.createSelector ?? createSearchableSelectList;
2925
+ const spawnCommand = deps.spawnCommand ?? spawn;
2926
+ const getCwd = deps.getCwd ?? (() => process.cwd());
2927
+ const env = deps.env ?? process.env;
2928
+ const maxChars = deps.maxOutputChars ?? 4e4;
2929
+ const ensureLocalExecAllowed = async () => {
2930
+ if (localExecAllowed) return true;
2931
+ if (localExecAsked) return false;
2932
+ localExecAsked = true;
2933
+ return await new Promise((resolve) => {
2934
+ deps.chatLog.addSystem("Allow local shell commands for this session?");
2935
+ deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
2936
+ deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
2937
+ const selector = createSelector([{
2938
+ value: "no",
2939
+ label: "No"
2940
+ }, {
2941
+ value: "yes",
2942
+ label: "Yes"
2943
+ }], 2);
2944
+ selector.onSelect = (item) => {
2945
+ deps.closeOverlay();
2946
+ if (item.value === "yes") {
2947
+ localExecAllowed = true;
2948
+ deps.chatLog.addSystem("local shell: enabled for this session");
2949
+ resolve(true);
2950
+ } else {
2951
+ deps.chatLog.addSystem("local shell: not enabled");
2952
+ resolve(false);
2953
+ }
2954
+ deps.tui.requestRender();
2955
+ };
2956
+ selector.onCancel = () => {
2957
+ deps.closeOverlay();
2958
+ deps.chatLog.addSystem("local shell: cancelled");
2959
+ deps.tui.requestRender();
2960
+ resolve(false);
2961
+ };
2962
+ deps.openOverlay(selector);
2963
+ deps.tui.requestRender();
2964
+ });
2965
+ };
2966
+ const runLocalShellLine = async (line) => {
2967
+ const cmd = line.slice(1);
2968
+ if (cmd === "") return;
2969
+ if (localExecAsked && !localExecAllowed) {
2970
+ deps.chatLog.addSystem("local shell: not enabled for this session");
2971
+ deps.tui.requestRender();
2972
+ return;
2973
+ }
2974
+ if (!await ensureLocalExecAllowed()) return;
2975
+ deps.chatLog.addSystem(`[local] $ ${cmd}`);
2976
+ deps.tui.requestRender();
2977
+ const appendWithCap = (text, chunk) => {
2978
+ const combined = text + chunk;
2979
+ return combined.length > maxChars ? combined.slice(-maxChars) : combined;
2980
+ };
2981
+ await new Promise((resolve) => {
2982
+ const child = spawnCommand(cmd, {
2983
+ shell: true,
2984
+ cwd: getCwd(),
2985
+ env
2986
+ });
2987
+ let stdout = "";
2988
+ let stderr = "";
2989
+ child.stdout.on("data", (buf) => {
2990
+ stdout = appendWithCap(stdout, buf.toString("utf8"));
2991
+ });
2992
+ child.stderr.on("data", (buf) => {
2993
+ stderr = appendWithCap(stderr, buf.toString("utf8"));
2994
+ });
2995
+ child.on("close", (code, signal) => {
2996
+ const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
2997
+ if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
2998
+ deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
2999
+ deps.tui.requestRender();
3000
+ resolve();
3001
+ });
3002
+ child.on("error", (err) => {
3003
+ deps.chatLog.addSystem(`[local] error: ${String(err)}`);
3004
+ deps.tui.requestRender();
3005
+ resolve();
3006
+ });
3007
+ });
3008
+ };
3009
+ return { runLocalShellLine };
3010
+ }
3011
+
3012
+ //#endregion
3013
+ //#region src/tui/tui-overlays.ts
3014
+ function createOverlayHandlers(host, fallbackFocus) {
3015
+ const openOverlay = (component) => {
3016
+ host.showOverlay(component);
3017
+ };
3018
+ const closeOverlay = () => {
3019
+ if (host.hasOverlay()) {
3020
+ host.hideOverlay();
3021
+ return;
3022
+ }
3023
+ host.setFocus(fallbackFocus);
3024
+ };
3025
+ return {
3026
+ openOverlay,
3027
+ closeOverlay
3028
+ };
3029
+ }
3030
+
3031
+ //#endregion
3032
+ //#region src/tui/tui-session-actions.ts
3033
+ function createSessionActions(context) {
3034
+ const { client, chatLog, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
3035
+ let refreshSessionInfoPromise = Promise.resolve();
3036
+ let lastSessionDefaults = null;
3037
+ const applyAgentsResult = (result) => {
3038
+ state.agentDefaultId = normalizeAgentId(result.defaultId);
3039
+ state.sessionMainKey = normalizeMainKey(result.mainKey);
3040
+ state.sessionScope = result.scope ?? state.sessionScope;
3041
+ state.agents = result.agents.map((agent) => ({
3042
+ id: normalizeAgentId(agent.id),
3043
+ name: agent.name?.trim() || void 0
3044
+ }));
3045
+ agentNames.clear();
3046
+ for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
3047
+ if (!state.initialSessionApplied) {
3048
+ if (initialSessionAgentId) {
3049
+ if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
3050
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
3051
+ const nextSessionKey = resolveSessionKey(initialSessionInput);
3052
+ if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
3053
+ state.initialSessionApplied = true;
3054
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
3055
+ updateHeader();
3056
+ updateFooter();
3057
+ };
3058
+ const refreshAgents = async () => {
3059
+ try {
3060
+ applyAgentsResult(await client.listAgents());
3061
+ } catch (err) {
3062
+ chatLog.addSystem(`agents list failed: ${String(err)}`);
3063
+ }
3064
+ };
3065
+ const updateAgentFromSessionKey = (key) => {
3066
+ const parsed = parseAgentSessionKey(key);
3067
+ if (!parsed) return;
3068
+ const next = normalizeAgentId(parsed.agentId);
3069
+ if (next !== state.currentAgentId) state.currentAgentId = next;
3070
+ };
3071
+ const resolveModelSelection = (entry) => {
3072
+ if (entry?.modelProvider || entry?.model) return {
3073
+ modelProvider: entry.modelProvider ?? state.sessionInfo.modelProvider,
3074
+ model: entry.model ?? state.sessionInfo.model
3075
+ };
3076
+ const overrideModel = entry?.modelOverride?.trim();
3077
+ if (overrideModel) return {
3078
+ modelProvider: entry?.providerOverride?.trim() || state.sessionInfo.modelProvider,
3079
+ model: overrideModel
3080
+ };
3081
+ return {
3082
+ modelProvider: state.sessionInfo.modelProvider,
3083
+ model: state.sessionInfo.model
3084
+ };
3085
+ };
3086
+ const applySessionInfo = (params) => {
3087
+ const entry = params.entry ?? void 0;
3088
+ const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
3089
+ const previousDefaults = lastSessionDefaults;
3090
+ const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
3091
+ if (params.defaults) lastSessionDefaults = params.defaults;
3092
+ const entryUpdatedAt = entry?.updatedAt ?? null;
3093
+ const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
3094
+ const modelChanged = entry?.modelProvider !== void 0 && entry.modelProvider !== state.sessionInfo.modelProvider || entry?.model !== void 0 && entry.model !== state.sessionInfo.model;
3095
+ if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged && !modelChanged) return;
3096
+ const next = { ...state.sessionInfo };
3097
+ if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
3098
+ if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
3099
+ if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
3100
+ if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
3101
+ if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
3102
+ if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
3103
+ if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
3104
+ if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
3105
+ if (entry?.displayName !== void 0) next.displayName = entry.displayName;
3106
+ if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
3107
+ const selection = resolveModelSelection(entry);
3108
+ if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
3109
+ if (selection.model !== void 0) next.model = selection.model;
3110
+ state.sessionInfo = next;
3111
+ updateAutocompleteProvider();
3112
+ updateFooter();
3113
+ tui.requestRender();
3114
+ };
3115
+ const runRefreshSessionInfo = async () => {
3116
+ try {
3117
+ const resolveListAgentId = () => {
3118
+ if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
3119
+ const parsed = parseAgentSessionKey(state.currentSessionKey);
3120
+ return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
3121
+ };
3122
+ const listAgentId = resolveListAgentId();
3123
+ const result = await client.listSessions({
3124
+ includeGlobal: false,
3125
+ includeUnknown: false,
3126
+ agentId: listAgentId
3127
+ });
3128
+ const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
3129
+ const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
3130
+ const entry = result.sessions.find((row) => {
3131
+ if (row.key === state.currentSessionKey) return true;
3132
+ return normalizeMatchKey(row.key) === currentMatchKey;
3133
+ });
3134
+ if (entry?.key && entry.key !== state.currentSessionKey) {
3135
+ updateAgentFromSessionKey(entry.key);
3136
+ state.currentSessionKey = entry.key;
3137
+ updateHeader();
3138
+ }
3139
+ applySessionInfo({
3140
+ entry,
3141
+ defaults: result.defaults
3142
+ });
3143
+ } catch (err) {
3144
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
3145
+ }
3146
+ };
3147
+ const refreshSessionInfo = async () => {
3148
+ refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
3149
+ await refreshSessionInfoPromise;
3150
+ };
3151
+ const applySessionInfoFromPatch = (result) => {
3152
+ if (!result?.entry) return;
3153
+ if (result.key && result.key !== state.currentSessionKey) {
3154
+ updateAgentFromSessionKey(result.key);
3155
+ state.currentSessionKey = result.key;
3156
+ updateHeader();
3157
+ }
3158
+ const resolved = result.resolved;
3159
+ applySessionInfo({
3160
+ entry: resolved && (resolved.modelProvider || resolved.model) ? {
3161
+ ...result.entry,
3162
+ modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
3163
+ model: resolved.model ?? result.entry.model
3164
+ } : result.entry,
3165
+ force: true
3166
+ });
3167
+ };
3168
+ const loadHistory = async () => {
3169
+ try {
3170
+ const record = await client.loadHistory({
3171
+ sessionKey: state.currentSessionKey,
3172
+ limit: opts.historyLimit ?? 200
3173
+ });
3174
+ state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
3175
+ state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
3176
+ state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
3177
+ const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
3178
+ chatLog.clearAll();
3179
+ chatLog.addSystem(`session ${state.currentSessionKey}`);
3180
+ for (const entry of record.messages ?? []) {
3181
+ if (!entry || typeof entry !== "object") continue;
3182
+ const message = entry;
3183
+ if (isCommandMessage(message)) {
3184
+ const text = extractTextFromMessage(message);
3185
+ if (text) chatLog.addSystem(text);
3186
+ continue;
3187
+ }
3188
+ if (message.role === "user") {
3189
+ const text = extractTextFromMessage(message);
3190
+ if (text) chatLog.addUser(text);
3191
+ continue;
3192
+ }
3193
+ if (message.role === "assistant") {
3194
+ const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
3195
+ if (text) chatLog.finalizeAssistant(text);
3196
+ continue;
3197
+ }
3198
+ if (message.role === "toolResult") {
3199
+ if (!showTools) continue;
3200
+ const toolCallId = asString(message.toolCallId, "");
3201
+ const toolName = asString(message.toolName, "tool");
3202
+ chatLog.startTool(toolCallId, toolName, {}).setResult({
3203
+ content: Array.isArray(message.content) ? message.content : [],
3204
+ details: typeof message.details === "object" && message.details ? message.details : void 0
3205
+ }, { isError: Boolean(message.isError) });
3206
+ }
3207
+ }
3208
+ state.historyLoaded = true;
3209
+ } catch (err) {
3210
+ chatLog.addSystem(`history failed: ${String(err)}`);
3211
+ }
3212
+ await refreshSessionInfo();
3213
+ tui.requestRender();
3214
+ };
3215
+ const setSession = async (rawKey) => {
3216
+ const nextKey = resolveSessionKey(rawKey);
3217
+ updateAgentFromSessionKey(nextKey);
3218
+ state.currentSessionKey = nextKey;
3219
+ state.activeChatRunId = null;
3220
+ state.currentSessionId = null;
3221
+ state.historyLoaded = false;
3222
+ clearLocalRunIds?.();
3223
+ updateHeader();
3224
+ updateFooter();
3225
+ await loadHistory();
3226
+ };
3227
+ const abortActive = async () => {
3228
+ if (!state.activeChatRunId) {
3229
+ chatLog.addSystem("no active run");
3230
+ tui.requestRender();
3231
+ return;
3232
+ }
3233
+ try {
3234
+ await client.abortChat({
3235
+ sessionKey: state.currentSessionKey,
3236
+ runId: state.activeChatRunId
3237
+ });
3238
+ setActivityStatus("aborted");
3239
+ } catch (err) {
3240
+ chatLog.addSystem(`abort failed: ${String(err)}`);
3241
+ setActivityStatus("abort failed");
3242
+ }
3243
+ tui.requestRender();
3244
+ };
3245
+ return {
3246
+ applyAgentsResult,
3247
+ refreshAgents,
3248
+ refreshSessionInfo,
3249
+ applySessionInfoFromPatch,
3250
+ loadHistory,
3251
+ setSession,
3252
+ abortActive
3253
+ };
3254
+ }
3255
+
3256
+ //#endregion
3257
+ //#region src/tui/tui-waiting.ts
3258
+ const defaultWaitingPhrases = [
3259
+ "flibbertigibbeting",
3260
+ "kerfuffling",
3261
+ "dillydallying",
3262
+ "twiddling thumbs",
3263
+ "noodling",
3264
+ "bamboozling",
3265
+ "moseying",
3266
+ "hobnobbing",
3267
+ "pondering",
3268
+ "conjuring"
3269
+ ];
3270
+ function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
3271
+ return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
3272
+ }
3273
+ function shimmerText(theme, text, tick) {
3274
+ const width = 6;
3275
+ const hi = (ch) => theme.bold(theme.accentSoft(ch));
3276
+ const pos = tick % (text.length + width);
3277
+ const start = Math.max(0, pos - width);
3278
+ const end = Math.min(text.length - 1, pos);
3279
+ let out = "";
3280
+ for (let i = 0; i < text.length; i++) {
3281
+ const ch = text[i];
3282
+ out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
3283
+ }
3284
+ return out;
3285
+ }
3286
+ function buildWaitingStatusMessage(params) {
3287
+ const phrase = pickWaitingPhrase(params.tick, params.phrases);
3288
+ return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
3289
+ }
3290
+
3291
+ //#endregion
3292
+ //#region src/tui/tui.ts
3293
+ function createEditorSubmitHandler(params) {
3294
+ return (text) => {
3295
+ const raw = text;
3296
+ const value = raw.trim();
3297
+ params.editor.setText("");
3298
+ if (!value) return;
3299
+ if (raw.startsWith("!") && raw !== "!") {
3300
+ params.editor.addToHistory(raw);
3301
+ params.handleBangLine(raw);
3302
+ return;
3303
+ }
3304
+ params.editor.addToHistory(value);
3305
+ if (value.startsWith("/")) {
3306
+ params.handleCommand(value);
3307
+ return;
3308
+ }
3309
+ params.sendMessage(value);
3310
+ };
3311
+ }
3312
+ function shouldEnableWindowsGitBashPasteFallback(params) {
3313
+ if ((params?.platform ?? process.platform) !== "win32") return false;
3314
+ const env = params?.env ?? process.env;
3315
+ const msystem = (env.MSYSTEM ?? "").toUpperCase();
3316
+ const shell = env.SHELL ?? "";
3317
+ const termProgram = (env.TERM_PROGRAM ?? "").toLowerCase();
3318
+ if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) return true;
3319
+ if (shell.toLowerCase().includes("bash")) return true;
3320
+ return termProgram.includes("mintty");
3321
+ }
3322
+ function createSubmitBurstCoalescer(params) {
3323
+ const windowMs = Math.max(1, params.burstWindowMs ?? 50);
3324
+ const now = params.now ?? (() => Date.now());
3325
+ const setTimer = params.setTimer ?? setTimeout;
3326
+ const clearTimer = params.clearTimer ?? clearTimeout;
3327
+ let pending = null;
3328
+ let pendingAt = 0;
3329
+ let flushTimer = null;
3330
+ const clearFlushTimer = () => {
3331
+ if (!flushTimer) return;
3332
+ clearTimer(flushTimer);
3333
+ flushTimer = null;
3334
+ };
3335
+ const flushPending = () => {
3336
+ if (pending === null) return;
3337
+ const value = pending;
3338
+ pending = null;
3339
+ pendingAt = 0;
3340
+ clearFlushTimer();
3341
+ params.submit(value);
3342
+ };
3343
+ const scheduleFlush = () => {
3344
+ clearFlushTimer();
3345
+ flushTimer = setTimer(() => {
3346
+ flushPending();
3347
+ }, windowMs);
3348
+ };
3349
+ return (value) => {
3350
+ if (!params.enabled) {
3351
+ params.submit(value);
3352
+ return;
3353
+ }
3354
+ if (value.includes("\n")) {
3355
+ flushPending();
3356
+ params.submit(value);
3357
+ return;
3358
+ }
3359
+ const ts = now();
3360
+ if (pending === null) {
3361
+ pending = value;
3362
+ pendingAt = ts;
3363
+ scheduleFlush();
3364
+ return;
3365
+ }
3366
+ if (ts - pendingAt <= windowMs) {
3367
+ pending = `${pending}\n${value}`;
3368
+ pendingAt = ts;
3369
+ scheduleFlush();
3370
+ return;
3371
+ }
3372
+ flushPending();
3373
+ pending = value;
3374
+ pendingAt = ts;
3375
+ scheduleFlush();
3376
+ };
3377
+ }
3378
+ function resolveTuiSessionKey(params) {
3379
+ const trimmed = (params.raw ?? "").trim();
3380
+ if (!trimmed) {
3381
+ if (params.sessionScope === "global") return "global";
3382
+ return buildAgentMainSessionKey({
3383
+ agentId: params.currentAgentId,
3384
+ mainKey: params.sessionMainKey
3385
+ });
3386
+ }
3387
+ if (trimmed === "global" || trimmed === "unknown") return trimmed;
3388
+ if (trimmed.startsWith("agent:")) return trimmed;
3389
+ return `agent:${params.currentAgentId}:${trimmed}`;
3390
+ }
3391
+ async function runTui(opts) {
3392
+ const config = loadConfig();
3393
+ const initialSessionInput = (opts.session ?? "").trim();
3394
+ let sessionScope = config.session?.scope ?? "per-sender";
3395
+ let sessionMainKey = normalizeMainKey(config.session?.mainKey);
3396
+ let agentDefaultId = resolveDefaultAgentId(config);
3397
+ let currentAgentId = agentDefaultId;
3398
+ let agents = [];
3399
+ const agentNames = /* @__PURE__ */ new Map();
3400
+ let currentSessionKey = "";
3401
+ let initialSessionApplied = false;
3402
+ let currentSessionId = null;
3403
+ let activeChatRunId = null;
3404
+ let historyLoaded = false;
3405
+ let isConnected = false;
3406
+ let wasDisconnected = false;
3407
+ let toolsExpanded = false;
3408
+ let showThinking = false;
3409
+ const localRunIds = /* @__PURE__ */ new Set();
3410
+ const deliverDefault = opts.deliver ?? false;
3411
+ const autoMessage = opts.message?.trim();
3412
+ let autoMessageSent = false;
3413
+ let sessionInfo = {};
3414
+ let lastCtrlCAt = 0;
3415
+ let activityStatus = "idle";
3416
+ let connectionStatus = "connecting";
3417
+ let statusTimeout = null;
3418
+ let statusTimer = null;
3419
+ let statusStartedAt = null;
3420
+ let lastActivityStatus = activityStatus;
3421
+ const state = {
3422
+ get agentDefaultId() {
3423
+ return agentDefaultId;
3424
+ },
3425
+ set agentDefaultId(value) {
3426
+ agentDefaultId = value;
3427
+ },
3428
+ get sessionMainKey() {
3429
+ return sessionMainKey;
3430
+ },
3431
+ set sessionMainKey(value) {
3432
+ sessionMainKey = value;
3433
+ },
3434
+ get sessionScope() {
3435
+ return sessionScope;
3436
+ },
3437
+ set sessionScope(value) {
3438
+ sessionScope = value;
3439
+ },
3440
+ get agents() {
3441
+ return agents;
3442
+ },
3443
+ set agents(value) {
3444
+ agents = value;
3445
+ },
3446
+ get currentAgentId() {
3447
+ return currentAgentId;
3448
+ },
3449
+ set currentAgentId(value) {
3450
+ currentAgentId = value;
3451
+ },
3452
+ get currentSessionKey() {
3453
+ return currentSessionKey;
3454
+ },
3455
+ set currentSessionKey(value) {
3456
+ currentSessionKey = value;
3457
+ },
3458
+ get currentSessionId() {
3459
+ return currentSessionId;
3460
+ },
3461
+ set currentSessionId(value) {
3462
+ currentSessionId = value;
3463
+ },
3464
+ get activeChatRunId() {
3465
+ return activeChatRunId;
3466
+ },
3467
+ set activeChatRunId(value) {
3468
+ activeChatRunId = value;
3469
+ },
3470
+ get historyLoaded() {
3471
+ return historyLoaded;
3472
+ },
3473
+ set historyLoaded(value) {
3474
+ historyLoaded = value;
3475
+ },
3476
+ get sessionInfo() {
3477
+ return sessionInfo;
3478
+ },
3479
+ set sessionInfo(value) {
3480
+ sessionInfo = value;
3481
+ },
3482
+ get initialSessionApplied() {
3483
+ return initialSessionApplied;
3484
+ },
3485
+ set initialSessionApplied(value) {
3486
+ initialSessionApplied = value;
3487
+ },
3488
+ get isConnected() {
3489
+ return isConnected;
3490
+ },
3491
+ set isConnected(value) {
3492
+ isConnected = value;
3493
+ },
3494
+ get autoMessageSent() {
3495
+ return autoMessageSent;
3496
+ },
3497
+ set autoMessageSent(value) {
3498
+ autoMessageSent = value;
3499
+ },
3500
+ get toolsExpanded() {
3501
+ return toolsExpanded;
3502
+ },
3503
+ set toolsExpanded(value) {
3504
+ toolsExpanded = value;
3505
+ },
3506
+ get showThinking() {
3507
+ return showThinking;
3508
+ },
3509
+ set showThinking(value) {
3510
+ showThinking = value;
3511
+ },
3512
+ get connectionStatus() {
3513
+ return connectionStatus;
3514
+ },
3515
+ set connectionStatus(value) {
3516
+ connectionStatus = value;
3517
+ },
3518
+ get activityStatus() {
3519
+ return activityStatus;
3520
+ },
3521
+ set activityStatus(value) {
3522
+ activityStatus = value;
3523
+ },
3524
+ get statusTimeout() {
3525
+ return statusTimeout;
3526
+ },
3527
+ set statusTimeout(value) {
3528
+ statusTimeout = value;
3529
+ },
3530
+ get lastCtrlCAt() {
3531
+ return lastCtrlCAt;
3532
+ },
3533
+ set lastCtrlCAt(value) {
3534
+ lastCtrlCAt = value;
3535
+ }
3536
+ };
3537
+ const noteLocalRunId = (runId) => {
3538
+ if (!runId) return;
3539
+ localRunIds.add(runId);
3540
+ if (localRunIds.size > 200) {
3541
+ const [first] = localRunIds;
3542
+ if (first) localRunIds.delete(first);
3543
+ }
3544
+ };
3545
+ const forgetLocalRunId = (runId) => {
3546
+ localRunIds.delete(runId);
3547
+ };
3548
+ const isLocalRunId = (runId) => localRunIds.has(runId);
3549
+ const clearLocalRunIds = () => {
3550
+ localRunIds.clear();
3551
+ };
3552
+ const client = new GatewayChatClient({
3553
+ url: opts.url,
3554
+ token: opts.token,
3555
+ password: opts.password
3556
+ });
3557
+ const tui = new TUI(new ProcessTerminal());
3558
+ const header = new Text("", 1, 0);
3559
+ const statusContainer = new Container();
3560
+ const footer = new Text("", 1, 0);
3561
+ const chatLog = new ChatLog();
3562
+ const editor = new CustomEditor(tui, editorTheme);
3563
+ const root = new Container();
3564
+ root.addChild(header);
3565
+ root.addChild(chatLog);
3566
+ root.addChild(statusContainer);
3567
+ root.addChild(footer);
3568
+ root.addChild(editor);
3569
+ const updateAutocompleteProvider = () => {
3570
+ editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
3571
+ cfg: config,
3572
+ provider: sessionInfo.modelProvider,
3573
+ model: sessionInfo.model
3574
+ }), process.cwd()));
3575
+ };
3576
+ tui.addChild(root);
3577
+ tui.setFocus(editor);
3578
+ const formatSessionKey = (key) => {
3579
+ if (key === "global" || key === "unknown") return key;
3580
+ return parseAgentSessionKey(key)?.rest ?? key;
3581
+ };
3582
+ const formatAgentLabel = (id) => {
3583
+ const name = agentNames.get(id);
3584
+ return name ? `${id} (${name})` : id;
3585
+ };
3586
+ const resolveSessionKey = (raw) => {
3587
+ return resolveTuiSessionKey({
3588
+ raw,
3589
+ sessionScope,
3590
+ currentAgentId,
3591
+ sessionMainKey
3592
+ });
3593
+ };
3594
+ currentSessionKey = resolveSessionKey(initialSessionInput);
3595
+ const updateHeader = () => {
3596
+ const sessionLabel = formatSessionKey(currentSessionKey);
3597
+ const agentLabel = formatAgentLabel(currentAgentId);
3598
+ header.setText(theme.header(`anima tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
3599
+ };
3600
+ const busyStates = new Set([
3601
+ "sending",
3602
+ "waiting",
3603
+ "streaming",
3604
+ "running"
3605
+ ]);
3606
+ let statusText = null;
3607
+ let statusLoader = null;
3608
+ const formatElapsed = (startMs) => {
3609
+ const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
3610
+ if (totalSeconds < 60) return `${totalSeconds}s`;
3611
+ return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
3612
+ };
3613
+ const ensureStatusText = () => {
3614
+ if (statusText) return;
3615
+ statusContainer.clear();
3616
+ statusLoader?.stop();
3617
+ statusLoader = null;
3618
+ statusText = new Text("", 1, 0);
3619
+ statusContainer.addChild(statusText);
3620
+ };
3621
+ const ensureStatusLoader = () => {
3622
+ if (statusLoader) return;
3623
+ statusContainer.clear();
3624
+ statusText = null;
3625
+ statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
3626
+ statusContainer.addChild(statusLoader);
3627
+ };
3628
+ let waitingTick = 0;
3629
+ let waitingTimer = null;
3630
+ let waitingPhrase = null;
3631
+ const updateBusyStatusMessage = () => {
3632
+ if (!statusLoader || !statusStartedAt) return;
3633
+ const elapsed = formatElapsed(statusStartedAt);
3634
+ if (activityStatus === "waiting") {
3635
+ waitingTick++;
3636
+ statusLoader.setMessage(buildWaitingStatusMessage({
3637
+ theme,
3638
+ tick: waitingTick,
3639
+ elapsed,
3640
+ connectionStatus,
3641
+ phrases: waitingPhrase ? [waitingPhrase] : void 0
3642
+ }));
3643
+ return;
3644
+ }
3645
+ statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
3646
+ };
3647
+ const startStatusTimer = () => {
3648
+ if (statusTimer) return;
3649
+ statusTimer = setInterval(() => {
3650
+ if (!busyStates.has(activityStatus)) return;
3651
+ updateBusyStatusMessage();
3652
+ }, 1e3);
3653
+ };
3654
+ const stopStatusTimer = () => {
3655
+ if (!statusTimer) return;
3656
+ clearInterval(statusTimer);
3657
+ statusTimer = null;
3658
+ };
3659
+ const startWaitingTimer = () => {
3660
+ if (waitingTimer) return;
3661
+ if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
3662
+ waitingTick = 0;
3663
+ waitingTimer = setInterval(() => {
3664
+ if (activityStatus !== "waiting") return;
3665
+ updateBusyStatusMessage();
3666
+ }, 120);
3667
+ };
3668
+ const stopWaitingTimer = () => {
3669
+ if (!waitingTimer) return;
3670
+ clearInterval(waitingTimer);
3671
+ waitingTimer = null;
3672
+ waitingPhrase = null;
3673
+ };
3674
+ const renderStatus = () => {
3675
+ if (busyStates.has(activityStatus)) {
3676
+ if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
3677
+ ensureStatusLoader();
3678
+ if (activityStatus === "waiting") {
3679
+ stopStatusTimer();
3680
+ startWaitingTimer();
3681
+ } else {
3682
+ stopWaitingTimer();
3683
+ startStatusTimer();
3684
+ }
3685
+ updateBusyStatusMessage();
3686
+ } else {
3687
+ statusStartedAt = null;
3688
+ stopStatusTimer();
3689
+ stopWaitingTimer();
3690
+ statusLoader?.stop();
3691
+ statusLoader = null;
3692
+ ensureStatusText();
3693
+ const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
3694
+ statusText?.setText(theme.dim(text));
3695
+ }
3696
+ lastActivityStatus = activityStatus;
3697
+ };
3698
+ const setConnectionStatus = (text, ttlMs) => {
3699
+ connectionStatus = text;
3700
+ renderStatus();
3701
+ if (statusTimeout) clearTimeout(statusTimeout);
3702
+ if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
3703
+ connectionStatus = isConnected ? "connected" : "disconnected";
3704
+ renderStatus();
3705
+ }, ttlMs);
3706
+ };
3707
+ const setActivityStatus = (text) => {
3708
+ activityStatus = text;
3709
+ renderStatus();
3710
+ };
3711
+ const updateFooter = () => {
3712
+ const sessionKeyLabel = formatSessionKey(currentSessionKey);
3713
+ const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
3714
+ const agentLabel = formatAgentLabel(currentAgentId);
3715
+ const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
3716
+ const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
3717
+ const think = sessionInfo.thinkingLevel ?? "off";
3718
+ const verbose = sessionInfo.verboseLevel ?? "off";
3719
+ const reasoning = sessionInfo.reasoningLevel ?? "off";
3720
+ const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
3721
+ const footerParts = [
3722
+ `agent ${agentLabel}`,
3723
+ `session ${sessionLabel}`,
3724
+ modelLabel,
3725
+ think !== "off" ? `think ${think}` : null,
3726
+ verbose !== "off" ? `verbose ${verbose}` : null,
3727
+ reasoningLabel,
3728
+ tokens
3729
+ ].filter(Boolean);
3730
+ footer.setText(theme.dim(footerParts.join(" | ")));
3731
+ };
3732
+ const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
3733
+ const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
3734
+ client,
3735
+ chatLog,
3736
+ tui,
3737
+ opts,
3738
+ state,
3739
+ agentNames,
3740
+ initialSessionInput,
3741
+ initialSessionAgentId: (() => {
3742
+ if (!initialSessionInput) return null;
3743
+ const parsed = parseAgentSessionKey(initialSessionInput);
3744
+ return parsed ? normalizeAgentId(parsed.agentId) : null;
3745
+ })(),
3746
+ resolveSessionKey,
3747
+ updateHeader,
3748
+ updateFooter,
3749
+ updateAutocompleteProvider,
3750
+ setActivityStatus,
3751
+ clearLocalRunIds
3752
+ });
3753
+ const { handleChatEvent, handleAgentEvent } = createEventHandlers({
3754
+ chatLog,
3755
+ tui,
3756
+ state,
3757
+ setActivityStatus,
3758
+ refreshSessionInfo,
3759
+ loadHistory,
3760
+ isLocalRunId,
3761
+ forgetLocalRunId,
3762
+ clearLocalRunIds
3763
+ });
3764
+ const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
3765
+ client,
3766
+ chatLog,
3767
+ tui,
3768
+ opts,
3769
+ state,
3770
+ deliverDefault,
3771
+ openOverlay,
3772
+ closeOverlay,
3773
+ refreshSessionInfo,
3774
+ applySessionInfoFromPatch,
3775
+ loadHistory,
3776
+ setSession,
3777
+ refreshAgents,
3778
+ abortActive,
3779
+ setActivityStatus,
3780
+ formatSessionKey,
3781
+ noteLocalRunId,
3782
+ forgetLocalRunId
3783
+ });
3784
+ const { runLocalShellLine } = createLocalShellRunner({
3785
+ chatLog,
3786
+ tui,
3787
+ openOverlay,
3788
+ closeOverlay
3789
+ });
3790
+ updateAutocompleteProvider();
3791
+ editor.onSubmit = createSubmitBurstCoalescer({
3792
+ submit: createEditorSubmitHandler({
3793
+ editor,
3794
+ handleCommand,
3795
+ sendMessage,
3796
+ handleBangLine: runLocalShellLine
3797
+ }),
3798
+ enabled: shouldEnableWindowsGitBashPasteFallback()
3799
+ });
3800
+ editor.onEscape = () => {
3801
+ abortActive();
3802
+ };
3803
+ editor.onCtrlC = () => {
3804
+ const now = Date.now();
3805
+ if (editor.getText().trim().length > 0) {
3806
+ editor.setText("");
3807
+ setActivityStatus("cleared input");
3808
+ tui.requestRender();
3809
+ return;
3810
+ }
3811
+ if (now - lastCtrlCAt < 1e3) {
3812
+ client.stop();
3813
+ tui.stop();
3814
+ process.exit(0);
3815
+ }
3816
+ lastCtrlCAt = now;
3817
+ setActivityStatus("press ctrl+c again to exit");
3818
+ tui.requestRender();
3819
+ };
3820
+ editor.onCtrlD = () => {
3821
+ client.stop();
3822
+ tui.stop();
3823
+ process.exit(0);
3824
+ };
3825
+ editor.onCtrlO = () => {
3826
+ toolsExpanded = !toolsExpanded;
3827
+ chatLog.setToolsExpanded(toolsExpanded);
3828
+ setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
3829
+ tui.requestRender();
3830
+ };
3831
+ editor.onCtrlL = () => {
3832
+ openModelSelector();
3833
+ };
3834
+ editor.onCtrlG = () => {
3835
+ openAgentSelector();
3836
+ };
3837
+ editor.onCtrlP = () => {
3838
+ openSessionSelector();
3839
+ };
3840
+ editor.onCtrlT = () => {
3841
+ showThinking = !showThinking;
3842
+ loadHistory();
3843
+ };
3844
+ client.onEvent = (evt) => {
3845
+ if (evt.event === "chat") handleChatEvent(evt.payload);
3846
+ if (evt.event === "agent") handleAgentEvent(evt.payload);
3847
+ };
3848
+ client.onConnected = () => {
3849
+ isConnected = true;
3850
+ const reconnected = wasDisconnected;
3851
+ wasDisconnected = false;
3852
+ setConnectionStatus("connected");
3853
+ (async () => {
3854
+ await refreshAgents();
3855
+ updateHeader();
3856
+ await loadHistory();
3857
+ setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
3858
+ tui.requestRender();
3859
+ if (!autoMessageSent && autoMessage) {
3860
+ autoMessageSent = true;
3861
+ await sendMessage(autoMessage);
3862
+ }
3863
+ updateFooter();
3864
+ tui.requestRender();
3865
+ })();
3866
+ };
3867
+ client.onDisconnected = (reason) => {
3868
+ isConnected = false;
3869
+ wasDisconnected = true;
3870
+ historyLoaded = false;
3871
+ setConnectionStatus(`gateway disconnected: ${reason?.trim() ? reason.trim() : "closed"}`, 5e3);
3872
+ setActivityStatus("idle");
3873
+ updateFooter();
3874
+ tui.requestRender();
3875
+ };
3876
+ client.onGap = (info) => {
3877
+ setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
3878
+ tui.requestRender();
3879
+ };
3880
+ updateHeader();
3881
+ setConnectionStatus("connecting");
3882
+ updateFooter();
3883
+ tui.start();
3884
+ client.start();
3885
+ await new Promise((resolve) => {
3886
+ const finish = () => resolve();
3887
+ process.once("exit", finish);
3888
+ process.once("SIGINT", finish);
3889
+ process.once("SIGTERM", finish);
3890
+ });
3891
+ }
3892
+
3893
+ //#endregion
3894
+ export { runTui as t };