clawbrah 1.0.1

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 (1900) hide show
  1. package/CHANGELOG.md +1577 -0
  2. package/LICENSE +21 -0
  3. package/README-header.png +0 -0
  4. package/README.md +655 -0
  5. package/assets/avatar-placeholder.svg +19 -0
  6. package/assets/chrome-extension/README.md +22 -0
  7. package/assets/chrome-extension/background.js +438 -0
  8. package/assets/chrome-extension/icons/icon128.png +0 -0
  9. package/assets/chrome-extension/icons/icon16.png +0 -0
  10. package/assets/chrome-extension/icons/icon32.png +0 -0
  11. package/assets/chrome-extension/icons/icon48.png +0 -0
  12. package/assets/chrome-extension/manifest.json +25 -0
  13. package/assets/chrome-extension/options.html +196 -0
  14. package/assets/chrome-extension/options.js +59 -0
  15. package/assets/dmg-background-small.png +0 -0
  16. package/assets/dmg-background.png +0 -0
  17. package/clawbrah.mjs +14 -0
  18. package/dist/accounts-CjPkmYhF.js +251 -0
  19. package/dist/accounts-D9U5z8T8.js +250 -0
  20. package/dist/acp-cli-BnKXNti3.js +929 -0
  21. package/dist/acp-cli-CQw991sO.js +925 -0
  22. package/dist/agent-BIxLfYkv.js +702 -0
  23. package/dist/agent-Dj_EwzkO.js +702 -0
  24. package/dist/agent-scope-BCxtHmMP.js +370 -0
  25. package/dist/agent-scope-C-hibssz.js +606 -0
  26. package/dist/agent-scope-CbEuCv2l.js +370 -0
  27. package/dist/ansi-Dslhk-pR.js +67 -0
  28. package/dist/archive-CCWYT_Aq.js +85 -0
  29. package/dist/archive-CIDIaMie.js +85 -0
  30. package/dist/audit-DK1NXsUR.js +1853 -0
  31. package/dist/audit-XFpWISrQ.js +1853 -0
  32. package/dist/auth-BPnkbfof.js +192 -0
  33. package/dist/auth-DwH9mnk7.js +192 -0
  34. package/dist/auth-health-DO7finG2.js +149 -0
  35. package/dist/auth-health-DUIg_lRU.js +149 -0
  36. package/dist/auth-profiles-BMF1fdhQ.js +2938 -0
  37. package/dist/boolean-C6Pbt2Ue.js +30 -0
  38. package/dist/brah-provider-CKcQ2qQ8.js +59 -0
  39. package/dist/brah-provider-D7G_zAuN.js +53 -0
  40. package/dist/brah-provider-Djzuocx7.js +54 -0
  41. package/dist/branding-CONYHJSC.js +82 -0
  42. package/dist/branding-DcW4KU4p.js +82 -0
  43. package/dist/brew-BIrWdDps.js +46 -0
  44. package/dist/brew-DYTEg8IL.js +46 -0
  45. package/dist/build-info.json +5 -0
  46. package/dist/call-B0EB11Hz.js +278 -0
  47. package/dist/call-Bykpt9_M.js +278 -0
  48. package/dist/canvas-host/a2ui/.bundle.hash +1 -0
  49. package/dist/canvas-host/a2ui/a2ui.bundle.js +17765 -0
  50. package/dist/canvas-host/a2ui/index.html +307 -0
  51. package/dist/channel-options-DLVRytYw.js +62 -0
  52. package/dist/channel-options-tgFQd3C0.js +32 -0
  53. package/dist/channel-selection-BE7PqmOC.js +51 -0
  54. package/dist/channel-selection-Dqp6K4Pw.js +51 -0
  55. package/dist/channel-summary-DZDiZAGl.js +1120 -0
  56. package/dist/channel-summary-ECvQTB5n.js +1121 -0
  57. package/dist/channels-cli-BFG8o_5O.js +1416 -0
  58. package/dist/channels-cli-NW8TfhTG.js +1419 -0
  59. package/dist/channels-status-issues-BiIcz4nz.js +18 -0
  60. package/dist/channels-status-issues-CIiu_Xxf.js +18 -0
  61. package/dist/chrome-4hKxr5KT.js +1973 -0
  62. package/dist/chrome-DQIhPH0W.js +1953 -0
  63. package/dist/clack-prompter-CJZpapQF.js +94 -0
  64. package/dist/clack-prompter-Dujo5dAa.js +94 -0
  65. package/dist/cli/daemon-cli.js +2 -0
  66. package/dist/cli-CBWZx_9K.js +94 -0
  67. package/dist/cli-Dpw7vdkR.js +90 -0
  68. package/dist/cli-utils-EpvLL-7H.js +43 -0
  69. package/dist/cli-utils-Yv4G3uEz.js +43 -0
  70. package/dist/client-DyaYZBTP.js +1617 -0
  71. package/dist/client-to8eMV2s.js +1617 -0
  72. package/dist/command-format-B96YFpq4.js +53 -0
  73. package/dist/command-format-Bb91kyB5.js +39 -0
  74. package/dist/command-format-Ch4rJeOo.js +133 -0
  75. package/dist/command-options-CiVRXfHE.js +33 -0
  76. package/dist/commands-DH9qcYUu.js +230 -0
  77. package/dist/completion-cli-BO3ziRR1.js +773 -0
  78. package/dist/completion-cli-xQqLK_Ni.js +434 -0
  79. package/dist/config-Ddbeba_Z.js +4915 -0
  80. package/dist/config-JJ_qstMV.js +4916 -0
  81. package/dist/config-c_xnI78-.js +5657 -0
  82. package/dist/config-guard-CKr985of.js +5971 -0
  83. package/dist/configure-Baroiqo5.js +895 -0
  84. package/dist/configure-tZw988ro.js +896 -0
  85. package/dist/constants-AeetkqWc.js +67 -0
  86. package/dist/constants-Dz79cVwc.js +67 -0
  87. package/dist/control-service-D6DqOGJY.js +61 -0
  88. package/dist/control-service-Dssk9Kaa.js +61 -0
  89. package/dist/control-ui/apple-touch-icon.png +0 -0
  90. package/dist/control-ui/assets/index-BoXosYY6.css +1 -0
  91. package/dist/control-ui/assets/index-Dm6g1E26.js +7553 -0
  92. package/dist/control-ui/assets/index-Dm6g1E26.js.map +1 -0
  93. package/dist/control-ui/favicon-32.png +0 -0
  94. package/dist/control-ui/favicon.ico +0 -0
  95. package/dist/control-ui/favicon.svg +22 -0
  96. package/dist/control-ui/index.html +17 -0
  97. package/dist/cron-cli-B-LWRLK-.js +460 -0
  98. package/dist/cron-cli-Ck-LIACc.js +456 -0
  99. package/dist/daemon-cli-CatDQvXp.js +759 -0
  100. package/dist/daemon-cli-DyljCSvh.js +757 -0
  101. package/dist/daemon-runtime-Bfpf-iTt.js +517 -0
  102. package/dist/daemon-runtime-Bof4EAty.js +517 -0
  103. package/dist/deliver-BBwjenkx.js +2587 -0
  104. package/dist/deliver-CQNhT-AZ.js +2587 -0
  105. package/dist/deliver-CqtN8jzj.js +2557 -0
  106. package/dist/deps-CwIHF5Kq.js +27 -0
  107. package/dist/deps-NlR-vxlh.js +27 -0
  108. package/dist/devices-cli-D2gNGH39.js +206 -0
  109. package/dist/devices-cli-_rugjRme.js +210 -0
  110. package/dist/directory-cli-BiGqaTbn.js +246 -0
  111. package/dist/directory-cli-DamxdQvl.js +250 -0
  112. package/dist/dispatcher-DOZGzrqb.js +160 -0
  113. package/dist/dns-cli-BGvF-HPE.js +200 -0
  114. package/dist/dns-cli-CwFuD5pv.js +204 -0
  115. package/dist/docs-cli-DJWF_t89.js +163 -0
  116. package/dist/docs-cli-Dplzz8Mq.js +160 -0
  117. package/dist/doctor-CdqmZxrK.js +2586 -0
  118. package/dist/doctor-DdHvLQSW.js +2588 -0
  119. package/dist/entry.js +1330 -0
  120. package/dist/env-YhBsuZYR.js +32 -0
  121. package/dist/errors-HrPt6FJ9.js +1952 -0
  122. package/dist/exec-4puFQDLB.js +246 -0
  123. package/dist/exec-BMnoMcZW.js +1099 -0
  124. package/dist/exec-BtbR_Cur.js +246 -0
  125. package/dist/exec-approvals-CA18XenO.js +1043 -0
  126. package/dist/exec-approvals-cli-BGB1TyrS.js +392 -0
  127. package/dist/exec-approvals-cli-Bq2Rv7if.js +388 -0
  128. package/dist/exec-approvals-iOoxTSaW.js +1043 -0
  129. package/dist/extensionAPI.js +67491 -0
  130. package/dist/format-DSCRXSo3.js +34 -0
  131. package/dist/format-DZA-SIiB.js +34 -0
  132. package/dist/gateway-cli-Ctozr1Nr.js +17356 -0
  133. package/dist/gateway-cli-Dm6fyKOW.js +17354 -0
  134. package/dist/gateway-rpc-DIBI9dZU.js +28 -0
  135. package/dist/gateway-rpc-DiR8jxC9.js +28 -0
  136. package/dist/github-copilot-auth-CWMgcPFb.js +1190 -0
  137. package/dist/github-copilot-auth-DBciFmic.js +1190 -0
  138. package/dist/github-copilot-token-B3SA95yo.js +103 -0
  139. package/dist/github-copilot-token-B9LJ8KjT.js +103 -0
  140. package/dist/github-copilot-token-BqZxoChM.js +103 -0
  141. package/dist/gmail-setup-utils-DC0hK-al.js +428 -0
  142. package/dist/gmail-setup-utils-Dt5K3pG2.js +428 -0
  143. package/dist/health-format-DZpQiSPr.js +1383 -0
  144. package/dist/health-format-rvKQDZAe.js +1385 -0
  145. package/dist/help-format-DUy1KRxq.js +17 -0
  146. package/dist/help-format-dO-Q4-RZ.js +17 -0
  147. package/dist/helpers-8O7IVGO-.js +25 -0
  148. package/dist/helpers-CcHGV820.js +10 -0
  149. package/dist/helpers-D_jqdWkd.js +25 -0
  150. package/dist/helpers-f7Q47hAD.js +10 -0
  151. package/dist/hooks/bundled/boot-md/HOOK.md +19 -0
  152. package/dist/hooks/bundled/command-logger/HOOK.md +122 -0
  153. package/dist/hooks/bundled/session-memory/HOOK.md +109 -0
  154. package/dist/hooks/bundled/soul-evil/HOOK.md +71 -0
  155. package/dist/hooks-cli-Dk70ZlpQ.js +1065 -0
  156. package/dist/hooks-cli-DkN_zNe_.js +1061 -0
  157. package/dist/hooks-status-BKToL6h7.js +443 -0
  158. package/dist/hooks-status-DAZqmvvU.js +443 -0
  159. package/dist/image-BZtCTxrR.js +634 -0
  160. package/dist/image-Yc5sSkOR.js +1426 -0
  161. package/dist/image-fscCHaO2.js +634 -0
  162. package/dist/index.js +6159 -0
  163. package/dist/installs-B8pY7vqZ.js +425 -0
  164. package/dist/installs-OI3UrTrZ.js +425 -0
  165. package/dist/is-main-BI9IbomE.js +25 -0
  166. package/dist/is-main-CatKw_er.js +25 -0
  167. package/dist/links-4bWi9tNq.js +15 -0
  168. package/dist/links-DPN-zsft.js +15 -0
  169. package/dist/loader-BQu3NLsc.js +64119 -0
  170. package/dist/logging-BggTN-OA.js +15 -0
  171. package/dist/logging-BvdokaVt.js +1 -0
  172. package/dist/logging-BzvBIA3Y.js +1 -0
  173. package/dist/logging-C-XFUtHZ.js +15 -0
  174. package/dist/login-qr-AehM-U7T.js +478 -0
  175. package/dist/login-qr-BbkDI6z-.js +475 -0
  176. package/dist/login-qr-KkxF3src.js +478 -0
  177. package/dist/logs-cli-GIy-ReUJ.js +232 -0
  178. package/dist/logs-cli-PkeymkCI.js +228 -0
  179. package/dist/manager-5cVcI5p8.js +2870 -0
  180. package/dist/manager-BHVQTR5S.js +2870 -0
  181. package/dist/manager-DYwowaGP.js +2872 -0
  182. package/dist/manifest-registry-CWVhL1Tp.js +669 -0
  183. package/dist/manifest-registry-yIkIFf0S.js +669 -0
  184. package/dist/message-channel-C0Y-pfV3.js +110 -0
  185. package/dist/message-channel-C3TK8GwV.js +110 -0
  186. package/dist/model-selection-BtrQIp5S.js +2940 -0
  187. package/dist/model-selection-DpbwUcPt.js +2691 -0
  188. package/dist/models-cli-BD-etPw9.js +2548 -0
  189. package/dist/models-cli-bdUO1YB5.js +2544 -0
  190. package/dist/net-8u61izyE.js +137 -0
  191. package/dist/net-D2zciGj5.js +137 -0
  192. package/dist/node-cli-DfUhskVm.js +1457 -0
  193. package/dist/node-cli-nnREUTNh.js +1461 -0
  194. package/dist/node-service-BF4ipV1g.js +67 -0
  195. package/dist/node-service-BQlkoIs-.js +67 -0
  196. package/dist/nodes-cli-BTFnWb5A.js +1209 -0
  197. package/dist/nodes-cli-C1KLCUgY.js +1213 -0
  198. package/dist/nodes-screen-BZIbguNP.js +157 -0
  199. package/dist/nodes-screen-D9YOHKnK.js +157 -0
  200. package/dist/note-DGwSQRou.js +73 -0
  201. package/dist/note-u0j4Zri6.js +73 -0
  202. package/dist/onboard-channels--6mZlRdm.js +671 -0
  203. package/dist/onboard-channels-Cjs_-7rV.js +671 -0
  204. package/dist/onboard-skills-CKh0otKb.js +3392 -0
  205. package/dist/onboard-skills-DFX908cv.js +3392 -0
  206. package/dist/onboarding-C9T4fYdo.js +3269 -0
  207. package/dist/openclaw-root-CNUzBTmy.js +84 -0
  208. package/dist/openclaw-root-DHli8vJO.js +84 -0
  209. package/dist/pairing-cli-DfM3LkLw.js +115 -0
  210. package/dist/pairing-cli-_nN81r25.js +119 -0
  211. package/dist/pairing-labels-BjA6wnhH.js +9 -0
  212. package/dist/pairing-labels-uGmG1FM-.js +9 -0
  213. package/dist/pairing-store-DfYWlf47.js +391 -0
  214. package/dist/pairing-store-RVhKX0MC.js +391 -0
  215. package/dist/parse-87ybtYW1.js +23 -0
  216. package/dist/parse-DOybnFJK.js +23 -0
  217. package/dist/parse-log-line-BoDqomM4.js +44 -0
  218. package/dist/parse-log-line-BuRiE-Ij.js +44 -0
  219. package/dist/parse-timeout-BIB19Upi.js +16 -0
  220. package/dist/parse-timeout-R8SiSP1t.js +16 -0
  221. package/dist/path-env-CXWUFfFv.js +77 -0
  222. package/dist/path-env-Dkh275Rh.js +77 -0
  223. package/dist/paths-B1kfl4h5.js +164 -0
  224. package/dist/paths-BPTe_oCW.js +43 -0
  225. package/dist/paths-BgalzSrB.js +40 -0
  226. package/dist/paths-DoU2wF-8.js +43 -0
  227. package/dist/paths-scjhy7N2.js +180 -0
  228. package/dist/pi-embedded-helpers-B8VNIgsS.js +8475 -0
  229. package/dist/pi-embedded-helpers-BpYQcZB0.js +1298 -0
  230. package/dist/pi-embedded-helpers-R5an9K5m.js +1298 -0
  231. package/dist/pi-model-discovery-CmCpGwer.js +20 -0
  232. package/dist/pi-model-discovery-DqgqUyAv.js +20 -0
  233. package/dist/pi-model-discovery-EhM2JAQo.js +20 -0
  234. package/dist/pi-tools.policy-6uFIt3Ju.js +230 -0
  235. package/dist/plugin-auto-enable-BhpgoPQ-.js +461 -0
  236. package/dist/plugin-auto-enable-C5fXErMQ.js +461 -0
  237. package/dist/plugin-sdk/brah-provider-Dv55ggdB.js +48 -0
  238. package/dist/plugin-sdk/index.d.ts +8856 -0
  239. package/dist/plugin-sdk/index.js +21240 -0
  240. package/dist/plugin-sdk/model-selection-D1wuaM-4.js +3184 -0
  241. package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
  242. package/dist/plugins-09ktk12_.js +496 -0
  243. package/dist/plugins-CDPqd0g4.js +495 -0
  244. package/dist/plugins-cli-BKPTobSa.js +445 -0
  245. package/dist/plugins-cli-FsBHhKXs.js +449 -0
  246. package/dist/ports-CNd5FYYb.js +96 -0
  247. package/dist/program-Tlz-_XHE.js +196 -0
  248. package/dist/progress-CkVQZWRm.js +133 -0
  249. package/dist/progress-DsH6InCn.js +133 -0
  250. package/dist/prompt-style-BdTr09G0.js +9 -0
  251. package/dist/prompt-style-XexlH5fB.js +9 -0
  252. package/dist/prompts-BaP7USwc.js +13 -0
  253. package/dist/prompts-CFRoaX7f.js +13 -0
  254. package/dist/pw-ai-8Eyk8VuD.js +1649 -0
  255. package/dist/pw-ai-Cl6-KNxy.js +1650 -0
  256. package/dist/pw-ai-DRdnHJHd.js +1653 -0
  257. package/dist/qmd-manager-BAFM4z59.js +619 -0
  258. package/dist/qmd-manager-Bmxs48Ir.js +615 -0
  259. package/dist/qmd-manager-CWJVDrwW.js +617 -0
  260. package/dist/redact-BIMJ3ntQ.js +94 -0
  261. package/dist/redact-CjQe_7H_.js +97 -0
  262. package/dist/redact-DAKeu7PA.js +97 -0
  263. package/dist/register.subclis-Buhb02qd.js +348 -0
  264. package/dist/reply-E1ga4GXi.js +64123 -0
  265. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  266. package/dist/routes-CcDbWmxz.js +2410 -0
  267. package/dist/routes-f7Edit7G.js +2410 -0
  268. package/dist/rpc-B655pmNJ.js +95 -0
  269. package/dist/rpc-CGmdslK7.js +95 -0
  270. package/dist/run-main-7eydAwGv.js +200 -0
  271. package/dist/sandbox-B4M0ryQ9.js +2945 -0
  272. package/dist/sandbox-BO_Ngn9c.js +2944 -0
  273. package/dist/sandbox-cli-CM0-sW9i.js +461 -0
  274. package/dist/sandbox-cli-CoTcXRmo.js +465 -0
  275. package/dist/security-cli-B_s4Rfs1.js +511 -0
  276. package/dist/security-cli-D3igkp01.js +507 -0
  277. package/dist/server-context-BqWI0WDa.js +740 -0
  278. package/dist/server-context-DGn4KtxY.js +740 -0
  279. package/dist/server-node-events-DXWeo9KB.js +224 -0
  280. package/dist/server-node-events-DxMqJ1vi.js +220 -0
  281. package/dist/service-BmhixqmA.js +680 -0
  282. package/dist/service-CkduwhWU.js +680 -0
  283. package/dist/service-audit-BaAmsSA_.js +542 -0
  284. package/dist/service-audit-Nmqw1tRw.js +542 -0
  285. package/dist/session-cost-usage-Oj8cY19d.js +692 -0
  286. package/dist/session-cost-usage-hz41m3rR.js +692 -0
  287. package/dist/session-key-Dm2EOhrH.js +177 -0
  288. package/dist/shared-ByqSbw-o.js +150 -0
  289. package/dist/shared-CUArCxmj.js +74 -0
  290. package/dist/shared-DV0YxQE5.js +150 -0
  291. package/dist/shared-Oinouexg.js +74 -0
  292. package/dist/skill-scanner-BSMluzCy.js +255 -0
  293. package/dist/skill-scanner-ClmmXaeD.js +255 -0
  294. package/dist/skills-CTnvXE52.js +693 -0
  295. package/dist/skills-cli-B7GNsN5Z.js +292 -0
  296. package/dist/skills-cli-DfNIFyiP.js +288 -0
  297. package/dist/skills-iqJKhB3Q.js +694 -0
  298. package/dist/skills-status-B6Hjszph.js +187 -0
  299. package/dist/skills-status-B9teTTgu.js +187 -0
  300. package/dist/sqlite-BK4CGCLp.js +197 -0
  301. package/dist/sqlite-Dnmf3LS7.js +215 -0
  302. package/dist/sqlite-wME36UET.js +215 -0
  303. package/dist/status-BH22yQwC.js +27 -0
  304. package/dist/status-C09l2YXY.js +3176 -0
  305. package/dist/status-C_dMhoE0.js +21 -0
  306. package/dist/status-CoAy6bEC.js +21 -0
  307. package/dist/status-UIA3ZI_U.js +27 -0
  308. package/dist/subsystem-MZJ7YwGv.js +771 -0
  309. package/dist/system-cli-DEm78jPM.js +86 -0
  310. package/dist/system-cli-DW-cysMR.js +82 -0
  311. package/dist/systemd-DSVtqGOg.js +438 -0
  312. package/dist/systemd-QeNHBKY_.js +438 -0
  313. package/dist/systemd-hints-Bm58h2q6.js +19 -0
  314. package/dist/systemd-hints-DpYzxoFm.js +19 -0
  315. package/dist/systemd-linger-6najuv4T.js +75 -0
  316. package/dist/systemd-linger-BAqwxT4B.js +75 -0
  317. package/dist/table-BnT-yxX7.js +279 -0
  318. package/dist/table-Br4x1U8t.js +279 -0
  319. package/dist/tailnet-PJSFUYzh.js +42 -0
  320. package/dist/tailnet-tKZZ7PZm.js +42 -0
  321. package/dist/tailscale-CLOGxzVe.js +225 -0
  322. package/dist/tailscale-Csps5HaJ.js +252 -0
  323. package/dist/tool-display-B-D4P2Fx.js +795 -0
  324. package/dist/tool-display-CeXLhfq_.js +795 -0
  325. package/dist/transcript-events-C1hdue6u.js +17 -0
  326. package/dist/transcript-events-CSDpB0zT.js +17 -0
  327. package/dist/transcript-events-JLH5W4He.js +17 -0
  328. package/dist/tui-DpSIQB-L.js +2671 -0
  329. package/dist/tui-M4SDqVBr.js +2672 -0
  330. package/dist/tui-cli-BgeLL-6G.js +57 -0
  331. package/dist/tui-cli-DM2GolnA.js +61 -0
  332. package/dist/update-By6OFSOm.js +317 -0
  333. package/dist/update-CrY_whxA.js +317 -0
  334. package/dist/update-cli-Bfsx9UKw.js +1039 -0
  335. package/dist/update-cli-DoiUKlNw.js +1042 -0
  336. package/dist/update-runner-LPAHTmXu.js +1458 -0
  337. package/dist/update-runner-_TG-7dl6.js +1458 -0
  338. package/dist/usage-format-Bhl_WCWP.js +36 -0
  339. package/dist/usage-format-C0mOZv3Q.js +36 -0
  340. package/dist/utils-BQRXRRrc.js +188 -0
  341. package/dist/utils-DZrCbm8I.js +192 -0
  342. package/dist/webhooks-cli-D5oYa1jv.js +314 -0
  343. package/dist/webhooks-cli-HqwLm34I.js +310 -0
  344. package/dist/widearea-dns-DYYvkzkp.js +127 -0
  345. package/dist/widearea-dns-pTj59jZd.js +127 -0
  346. package/dist/ws-CdWr05vX.js +13 -0
  347. package/dist/ws-log-CDRetW_w.js +267 -0
  348. package/dist/ws-log-Cmu4Hs9k.js +267 -0
  349. package/dist/ws-odwH8aKX.js +13 -0
  350. package/dist/wsl-BrI_Sz-3.js +160 -0
  351. package/docs/.i18n/README.md +31 -0
  352. package/docs/.i18n/glossary.zh-CN.json +210 -0
  353. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  354. package/docs/CNAME +1 -0
  355. package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
  356. package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
  357. package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
  358. package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
  359. package/docs/assets/macos-onboarding/05-permissions.png +0 -0
  360. package/docs/assets/openclaw-logo-text-dark.png +0 -0
  361. package/docs/assets/openclaw-logo-text.png +0 -0
  362. package/docs/assets/pixel-lobster.svg +60 -0
  363. package/docs/assets/showcase/agents-ui.jpg +0 -0
  364. package/docs/assets/showcase/bambu-cli.png +0 -0
  365. package/docs/assets/showcase/codexmonitor.png +0 -0
  366. package/docs/assets/showcase/gohome-grafana.png +0 -0
  367. package/docs/assets/showcase/ios-testflight.jpg +0 -0
  368. package/docs/assets/showcase/oura-health.png +0 -0
  369. package/docs/assets/showcase/padel-cli.svg +11 -0
  370. package/docs/assets/showcase/padel-screenshot.jpg +0 -0
  371. package/docs/assets/showcase/papla-tts.jpg +0 -0
  372. package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
  373. package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
  374. package/docs/assets/showcase/roborock-status.svg +13 -0
  375. package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
  376. package/docs/assets/showcase/snag.png +0 -0
  377. package/docs/assets/showcase/tesco-shop.jpg +0 -0
  378. package/docs/assets/showcase/wienerlinien.png +0 -0
  379. package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
  380. package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
  381. package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
  382. package/docs/automation/auth-monitoring.md +44 -0
  383. package/docs/automation/cron-jobs.md +468 -0
  384. package/docs/automation/cron-vs-heartbeat.md +282 -0
  385. package/docs/automation/gmail-pubsub.md +256 -0
  386. package/docs/automation/poll.md +69 -0
  387. package/docs/automation/webhook.md +163 -0
  388. package/docs/bedrock.md +176 -0
  389. package/docs/brave-search.md +41 -0
  390. package/docs/broadcast-groups.md +442 -0
  391. package/docs/channels/bluebubbles.md +338 -0
  392. package/docs/channels/brah-sync.md +92 -0
  393. package/docs/channels/discord.md +476 -0
  394. package/docs/channels/feishu.md +577 -0
  395. package/docs/channels/googlechat.md +250 -0
  396. package/docs/channels/grammy.md +31 -0
  397. package/docs/channels/imessage.md +299 -0
  398. package/docs/channels/index.md +47 -0
  399. package/docs/channels/line.md +186 -0
  400. package/docs/channels/location.md +56 -0
  401. package/docs/channels/matrix.md +233 -0
  402. package/docs/channels/mattermost.md +138 -0
  403. package/docs/channels/msteams.md +768 -0
  404. package/docs/channels/nextcloud-talk.md +136 -0
  405. package/docs/channels/nostr.md +233 -0
  406. package/docs/channels/signal.md +202 -0
  407. package/docs/channels/slack.md +548 -0
  408. package/docs/channels/telegram.md +769 -0
  409. package/docs/channels/tlon.md +132 -0
  410. package/docs/channels/troubleshooting.md +29 -0
  411. package/docs/channels/twitch.md +379 -0
  412. package/docs/channels/whatsapp.md +404 -0
  413. package/docs/channels/zalo.md +189 -0
  414. package/docs/channels/zalouser.md +140 -0
  415. package/docs/cli/acp.md +170 -0
  416. package/docs/cli/agent.md +24 -0
  417. package/docs/cli/agents.md +75 -0
  418. package/docs/cli/approvals.md +50 -0
  419. package/docs/cli/browser.md +107 -0
  420. package/docs/cli/channels.md +79 -0
  421. package/docs/cli/config.md +50 -0
  422. package/docs/cli/configure.md +33 -0
  423. package/docs/cli/cron.md +42 -0
  424. package/docs/cli/dashboard.md +16 -0
  425. package/docs/cli/devices.md +70 -0
  426. package/docs/cli/directory.md +63 -0
  427. package/docs/cli/dns.md +23 -0
  428. package/docs/cli/docs.md +15 -0
  429. package/docs/cli/doctor.md +41 -0
  430. package/docs/cli/gateway.md +202 -0
  431. package/docs/cli/health.md +21 -0
  432. package/docs/cli/hooks.md +304 -0
  433. package/docs/cli/index.md +1031 -0
  434. package/docs/cli/logs.md +24 -0
  435. package/docs/cli/memory.md +45 -0
  436. package/docs/cli/message.md +239 -0
  437. package/docs/cli/models.md +79 -0
  438. package/docs/cli/node.md +112 -0
  439. package/docs/cli/nodes.md +73 -0
  440. package/docs/cli/onboard.md +43 -0
  441. package/docs/cli/pairing.md +21 -0
  442. package/docs/cli/plugins.md +62 -0
  443. package/docs/cli/reset.md +17 -0
  444. package/docs/cli/sandbox.md +152 -0
  445. package/docs/cli/security.md +26 -0
  446. package/docs/cli/sessions.md +16 -0
  447. package/docs/cli/setup.md +29 -0
  448. package/docs/cli/skills.md +26 -0
  449. package/docs/cli/status.md +26 -0
  450. package/docs/cli/system.md +60 -0
  451. package/docs/cli/tui.md +23 -0
  452. package/docs/cli/uninstall.md +17 -0
  453. package/docs/cli/update.md +98 -0
  454. package/docs/cli/voicecall.md +34 -0
  455. package/docs/cli/webhooks.md +25 -0
  456. package/docs/concepts/agent-loop.md +146 -0
  457. package/docs/concepts/agent-workspace.md +233 -0
  458. package/docs/concepts/agent.md +123 -0
  459. package/docs/concepts/architecture.md +129 -0
  460. package/docs/concepts/channel-routing.md +114 -0
  461. package/docs/concepts/compaction.md +61 -0
  462. package/docs/concepts/context.md +161 -0
  463. package/docs/concepts/features.md +53 -0
  464. package/docs/concepts/group-messages.md +84 -0
  465. package/docs/concepts/groups.md +373 -0
  466. package/docs/concepts/markdown-formatting.md +130 -0
  467. package/docs/concepts/memory.md +546 -0
  468. package/docs/concepts/messages.md +154 -0
  469. package/docs/concepts/model-failover.md +149 -0
  470. package/docs/concepts/model-providers.md +316 -0
  471. package/docs/concepts/models.md +208 -0
  472. package/docs/concepts/multi-agent.md +376 -0
  473. package/docs/concepts/oauth.md +145 -0
  474. package/docs/concepts/presence.md +102 -0
  475. package/docs/concepts/queue.md +89 -0
  476. package/docs/concepts/retry.md +69 -0
  477. package/docs/concepts/session-pruning.md +122 -0
  478. package/docs/concepts/session-tool.md +193 -0
  479. package/docs/concepts/session.md +204 -0
  480. package/docs/concepts/sessions.md +10 -0
  481. package/docs/concepts/streaming.md +135 -0
  482. package/docs/concepts/system-prompt.md +115 -0
  483. package/docs/concepts/timezone.md +91 -0
  484. package/docs/concepts/typebox.md +289 -0
  485. package/docs/concepts/typing-indicators.md +68 -0
  486. package/docs/concepts/usage-tracking.md +35 -0
  487. package/docs/date-time.md +128 -0
  488. package/docs/debug/node-issue.md +83 -0
  489. package/docs/debugging.md +162 -0
  490. package/docs/diagnostics/flags.md +91 -0
  491. package/docs/docs.json +1736 -0
  492. package/docs/environment.md +81 -0
  493. package/docs/experiments/onboarding-config-protocol.md +40 -0
  494. package/docs/experiments/plans/cron-add-hardening.md +63 -0
  495. package/docs/experiments/plans/group-policy-hardening.md +40 -0
  496. package/docs/experiments/plans/openresponses-gateway.md +123 -0
  497. package/docs/experiments/proposals/model-config.md +36 -0
  498. package/docs/experiments/research/memory.md +228 -0
  499. package/docs/gateway/authentication.md +145 -0
  500. package/docs/gateway/background-process.md +93 -0
  501. package/docs/gateway/bonjour.md +167 -0
  502. package/docs/gateway/bridge-protocol.md +89 -0
  503. package/docs/gateway/cli-backends.md +225 -0
  504. package/docs/gateway/configuration-examples.md +606 -0
  505. package/docs/gateway/configuration.md +3411 -0
  506. package/docs/gateway/discovery.md +116 -0
  507. package/docs/gateway/doctor.md +282 -0
  508. package/docs/gateway/gateway-lock.md +34 -0
  509. package/docs/gateway/health.md +35 -0
  510. package/docs/gateway/heartbeat.md +362 -0
  511. package/docs/gateway/index.md +328 -0
  512. package/docs/gateway/local-models.md +150 -0
  513. package/docs/gateway/logging.md +113 -0
  514. package/docs/gateway/multiple-gateways.md +112 -0
  515. package/docs/gateway/network-model.md +17 -0
  516. package/docs/gateway/openai-http-api.md +118 -0
  517. package/docs/gateway/openresponses-http-api.md +317 -0
  518. package/docs/gateway/pairing.md +99 -0
  519. package/docs/gateway/protocol.md +221 -0
  520. package/docs/gateway/remote-gateway-readme.md +157 -0
  521. package/docs/gateway/remote.md +129 -0
  522. package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +128 -0
  523. package/docs/gateway/sandboxing.md +193 -0
  524. package/docs/gateway/security/formal-verification.md +164 -0
  525. package/docs/gateway/security/index.md +825 -0
  526. package/docs/gateway/tailscale.md +127 -0
  527. package/docs/gateway/tools-invoke-http-api.md +85 -0
  528. package/docs/gateway/troubleshooting.md +767 -0
  529. package/docs/help/faq.md +2829 -0
  530. package/docs/help/index.md +21 -0
  531. package/docs/help/submitting-a-pr.md +214 -0
  532. package/docs/help/submitting-an-issue.md +165 -0
  533. package/docs/help/troubleshooting.md +98 -0
  534. package/docs/hooks/soul-evil.md +69 -0
  535. package/docs/hooks.md +913 -0
  536. package/docs/images/feishu-step2-create-app.png +0 -0
  537. package/docs/images/feishu-step3-credentials.png +0 -0
  538. package/docs/images/feishu-step4-permissions.png +0 -0
  539. package/docs/images/feishu-step5-bot-capability.png +0 -0
  540. package/docs/images/feishu-step6-event-subscription.png +0 -0
  541. package/docs/images/groups-flow.svg +52 -0
  542. package/docs/images/mobile-ui-screenshot.png +0 -0
  543. package/docs/index.md +192 -0
  544. package/docs/install/ansible.md +208 -0
  545. package/docs/install/bun.md +59 -0
  546. package/docs/install/development-channels.md +75 -0
  547. package/docs/install/docker.md +567 -0
  548. package/docs/install/exe-dev.md +126 -0
  549. package/docs/install/fly.md +486 -0
  550. package/docs/install/gcp.md +503 -0
  551. package/docs/install/hetzner.md +330 -0
  552. package/docs/install/index.md +187 -0
  553. package/docs/install/installer.md +123 -0
  554. package/docs/install/macos-vm.md +281 -0
  555. package/docs/install/migrating.md +192 -0
  556. package/docs/install/nix.md +96 -0
  557. package/docs/install/node.md +78 -0
  558. package/docs/install/northflank.mdx +53 -0
  559. package/docs/install/railway.mdx +99 -0
  560. package/docs/install/render.mdx +165 -0
  561. package/docs/install/uninstall.md +128 -0
  562. package/docs/install/updating.md +228 -0
  563. package/docs/logging.md +350 -0
  564. package/docs/multi-agent-sandbox-tools.md +395 -0
  565. package/docs/network.md +54 -0
  566. package/docs/nodes/audio.md +114 -0
  567. package/docs/nodes/camera.md +156 -0
  568. package/docs/nodes/images.md +72 -0
  569. package/docs/nodes/index.md +341 -0
  570. package/docs/nodes/location-command.md +113 -0
  571. package/docs/nodes/media-understanding.md +379 -0
  572. package/docs/nodes/talk.md +90 -0
  573. package/docs/nodes/voicewake.md +65 -0
  574. package/docs/perplexity.md +80 -0
  575. package/docs/pi-dev.md +70 -0
  576. package/docs/pi.md +612 -0
  577. package/docs/platforms/android.md +148 -0
  578. package/docs/platforms/digitalocean.md +262 -0
  579. package/docs/platforms/index.md +53 -0
  580. package/docs/platforms/ios.md +107 -0
  581. package/docs/platforms/linux.md +94 -0
  582. package/docs/platforms/mac/bundled-gateway.md +73 -0
  583. package/docs/platforms/mac/canvas.md +125 -0
  584. package/docs/platforms/mac/child-process.md +69 -0
  585. package/docs/platforms/mac/dev-setup.md +102 -0
  586. package/docs/platforms/mac/health.md +34 -0
  587. package/docs/platforms/mac/icon.md +31 -0
  588. package/docs/platforms/mac/logging.md +57 -0
  589. package/docs/platforms/mac/menu-bar.md +81 -0
  590. package/docs/platforms/mac/peekaboo.md +65 -0
  591. package/docs/platforms/mac/permissions.md +44 -0
  592. package/docs/platforms/mac/release.md +85 -0
  593. package/docs/platforms/mac/remote.md +83 -0
  594. package/docs/platforms/mac/signing.md +47 -0
  595. package/docs/platforms/mac/skills.md +33 -0
  596. package/docs/platforms/mac/voice-overlay.md +60 -0
  597. package/docs/platforms/mac/voicewake.md +67 -0
  598. package/docs/platforms/mac/webchat.md +41 -0
  599. package/docs/platforms/mac/xpc.md +61 -0
  600. package/docs/platforms/macos.md +203 -0
  601. package/docs/platforms/oracle.md +303 -0
  602. package/docs/platforms/raspberry-pi.md +358 -0
  603. package/docs/platforms/windows.md +159 -0
  604. package/docs/plugin.md +664 -0
  605. package/docs/plugins/agent-tools.md +99 -0
  606. package/docs/plugins/manifest.md +71 -0
  607. package/docs/plugins/voice-call.md +284 -0
  608. package/docs/plugins/zalouser.md +81 -0
  609. package/docs/prose.md +134 -0
  610. package/docs/providers/anthropic.md +152 -0
  611. package/docs/providers/claude-max-api-proxy.md +148 -0
  612. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  613. package/docs/providers/deepgram.md +93 -0
  614. package/docs/providers/github-copilot.md +72 -0
  615. package/docs/providers/glm.md +33 -0
  616. package/docs/providers/index.md +63 -0
  617. package/docs/providers/minimax.md +208 -0
  618. package/docs/providers/models.md +51 -0
  619. package/docs/providers/moonshot.md +142 -0
  620. package/docs/providers/ollama.md +277 -0
  621. package/docs/providers/openai.md +62 -0
  622. package/docs/providers/opencode.md +36 -0
  623. package/docs/providers/openrouter.md +37 -0
  624. package/docs/providers/qwen.md +53 -0
  625. package/docs/providers/synthetic.md +99 -0
  626. package/docs/providers/venice.md +267 -0
  627. package/docs/providers/vercel-ai-gateway.md +50 -0
  628. package/docs/providers/xiaomi.md +64 -0
  629. package/docs/providers/zai.md +36 -0
  630. package/docs/refactor/clawnet.md +417 -0
  631. package/docs/refactor/exec-host.md +316 -0
  632. package/docs/refactor/outbound-session-mirroring.md +85 -0
  633. package/docs/refactor/plugin-sdk.md +214 -0
  634. package/docs/refactor/strict-config.md +93 -0
  635. package/docs/reference/AGENTS.default.md +124 -0
  636. package/docs/reference/RELEASING.md +120 -0
  637. package/docs/reference/api-usage-costs.md +137 -0
  638. package/docs/reference/credits.md +27 -0
  639. package/docs/reference/device-models.md +47 -0
  640. package/docs/reference/rpc.md +43 -0
  641. package/docs/reference/session-management-compaction.md +285 -0
  642. package/docs/reference/templates/AGENTS.dev.md +83 -0
  643. package/docs/reference/templates/AGENTS.md +218 -0
  644. package/docs/reference/templates/BOOT.md +10 -0
  645. package/docs/reference/templates/BOOTSTRAP.md +61 -0
  646. package/docs/reference/templates/HEARTBEAT.md +11 -0
  647. package/docs/reference/templates/IDENTITY.dev.md +47 -0
  648. package/docs/reference/templates/IDENTITY.md +27 -0
  649. package/docs/reference/templates/SOUL.dev.md +76 -0
  650. package/docs/reference/templates/SOUL.md +42 -0
  651. package/docs/reference/templates/TOOLS.dev.md +24 -0
  652. package/docs/reference/templates/TOOLS.md +46 -0
  653. package/docs/reference/templates/USER.dev.md +18 -0
  654. package/docs/reference/templates/USER.md +22 -0
  655. package/docs/reference/test.md +50 -0
  656. package/docs/reference/transcript-hygiene.md +129 -0
  657. package/docs/reference/wizard.md +268 -0
  658. package/docs/scripts.md +28 -0
  659. package/docs/security/formal-verification.md +164 -0
  660. package/docs/start/bootstrapping.md +41 -0
  661. package/docs/start/docs-directory.md +64 -0
  662. package/docs/start/getting-started.md +120 -0
  663. package/docs/start/hubs.md +197 -0
  664. package/docs/start/lore.md +219 -0
  665. package/docs/start/onboarding.md +80 -0
  666. package/docs/start/openclaw.md +224 -0
  667. package/docs/start/pairing.md +86 -0
  668. package/docs/start/quickstart.md +22 -0
  669. package/docs/start/setup.md +162 -0
  670. package/docs/start/showcase.md +416 -0
  671. package/docs/start/wizard-cli-automation.md +141 -0
  672. package/docs/start/wizard-cli-reference.md +244 -0
  673. package/docs/start/wizard.md +108 -0
  674. package/docs/style.css +3 -0
  675. package/docs/testing.md +368 -0
  676. package/docs/token-use.md +112 -0
  677. package/docs/tools/agent-send.md +53 -0
  678. package/docs/tools/apply-patch.md +50 -0
  679. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  680. package/docs/tools/browser-login.md +68 -0
  681. package/docs/tools/browser.md +576 -0
  682. package/docs/tools/chrome-extension.md +178 -0
  683. package/docs/tools/clawhub.md +257 -0
  684. package/docs/tools/creating-skills.md +54 -0
  685. package/docs/tools/elevated.md +57 -0
  686. package/docs/tools/exec-approvals.md +246 -0
  687. package/docs/tools/exec.md +179 -0
  688. package/docs/tools/firecrawl.md +61 -0
  689. package/docs/tools/index.md +512 -0
  690. package/docs/tools/llm-task.md +115 -0
  691. package/docs/tools/lobster.md +342 -0
  692. package/docs/tools/reactions.md +22 -0
  693. package/docs/tools/skills-config.md +76 -0
  694. package/docs/tools/skills.md +300 -0
  695. package/docs/tools/slash-commands.md +198 -0
  696. package/docs/tools/subagents.md +151 -0
  697. package/docs/tools/thinking.md +74 -0
  698. package/docs/tools/web.md +261 -0
  699. package/docs/tts.md +396 -0
  700. package/docs/tui.md +162 -0
  701. package/docs/vps.md +43 -0
  702. package/docs/web/control-ui.md +223 -0
  703. package/docs/web/dashboard.md +46 -0
  704. package/docs/web/index.md +116 -0
  705. package/docs/web/webchat.md +49 -0
  706. package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
  707. package/docs/whatsapp-openclaw.jpg +0 -0
  708. package/docs/zh-CN/AGENTS.md +59 -0
  709. package/docs/zh-CN/automation/auth-monitoring.md +47 -0
  710. package/docs/zh-CN/automation/cron-jobs.md +424 -0
  711. package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
  712. package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
  713. package/docs/zh-CN/automation/poll.md +76 -0
  714. package/docs/zh-CN/automation/webhook.md +163 -0
  715. package/docs/zh-CN/bedrock.md +170 -0
  716. package/docs/zh-CN/brave-search.md +48 -0
  717. package/docs/zh-CN/broadcast-groups.md +449 -0
  718. package/docs/zh-CN/channels/bluebubbles.md +271 -0
  719. package/docs/zh-CN/channels/discord.md +468 -0
  720. package/docs/zh-CN/channels/feishu.md +629 -0
  721. package/docs/zh-CN/channels/googlechat.md +257 -0
  722. package/docs/zh-CN/channels/grammy.md +38 -0
  723. package/docs/zh-CN/channels/imessage.md +302 -0
  724. package/docs/zh-CN/channels/index.md +53 -0
  725. package/docs/zh-CN/channels/line.md +180 -0
  726. package/docs/zh-CN/channels/location.md +63 -0
  727. package/docs/zh-CN/channels/matrix.md +221 -0
  728. package/docs/zh-CN/channels/mattermost.md +144 -0
  729. package/docs/zh-CN/channels/msteams.md +775 -0
  730. package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
  731. package/docs/zh-CN/channels/nostr.md +240 -0
  732. package/docs/zh-CN/channels/signal.md +209 -0
  733. package/docs/zh-CN/channels/slack.md +531 -0
  734. package/docs/zh-CN/channels/telegram.md +751 -0
  735. package/docs/zh-CN/channels/tlon.md +136 -0
  736. package/docs/zh-CN/channels/troubleshooting.md +36 -0
  737. package/docs/zh-CN/channels/twitch.md +385 -0
  738. package/docs/zh-CN/channels/whatsapp.md +411 -0
  739. package/docs/zh-CN/channels/zalo.md +196 -0
  740. package/docs/zh-CN/channels/zalouser.md +147 -0
  741. package/docs/zh-CN/cli/acp.md +173 -0
  742. package/docs/zh-CN/cli/agent.md +30 -0
  743. package/docs/zh-CN/cli/agents.md +82 -0
  744. package/docs/zh-CN/cli/approvals.md +57 -0
  745. package/docs/zh-CN/cli/browser.md +114 -0
  746. package/docs/zh-CN/cli/channels.md +86 -0
  747. package/docs/zh-CN/cli/config.md +57 -0
  748. package/docs/zh-CN/cli/configure.md +38 -0
  749. package/docs/zh-CN/cli/cron.md +43 -0
  750. package/docs/zh-CN/cli/dashboard.md +23 -0
  751. package/docs/zh-CN/cli/devices.md +74 -0
  752. package/docs/zh-CN/cli/directory.md +70 -0
  753. package/docs/zh-CN/cli/dns.md +30 -0
  754. package/docs/zh-CN/cli/docs.md +22 -0
  755. package/docs/zh-CN/cli/doctor.md +48 -0
  756. package/docs/zh-CN/cli/gateway.md +206 -0
  757. package/docs/zh-CN/cli/health.md +28 -0
  758. package/docs/zh-CN/cli/hooks.md +311 -0
  759. package/docs/zh-CN/cli/index.md +1032 -0
  760. package/docs/zh-CN/cli/logs.md +31 -0
  761. package/docs/zh-CN/cli/memory.md +52 -0
  762. package/docs/zh-CN/cli/message.md +246 -0
  763. package/docs/zh-CN/cli/models.md +85 -0
  764. package/docs/zh-CN/cli/node.md +115 -0
  765. package/docs/zh-CN/cli/nodes.md +80 -0
  766. package/docs/zh-CN/cli/onboard.md +36 -0
  767. package/docs/zh-CN/cli/pairing.md +28 -0
  768. package/docs/zh-CN/cli/plugins.md +66 -0
  769. package/docs/zh-CN/cli/reset.md +24 -0
  770. package/docs/zh-CN/cli/sandbox.md +158 -0
  771. package/docs/zh-CN/cli/security.md +33 -0
  772. package/docs/zh-CN/cli/sessions.md +23 -0
  773. package/docs/zh-CN/cli/setup.md +36 -0
  774. package/docs/zh-CN/cli/skills.md +33 -0
  775. package/docs/zh-CN/cli/status.md +33 -0
  776. package/docs/zh-CN/cli/system.md +63 -0
  777. package/docs/zh-CN/cli/tui.md +30 -0
  778. package/docs/zh-CN/cli/uninstall.md +24 -0
  779. package/docs/zh-CN/cli/update.md +101 -0
  780. package/docs/zh-CN/cli/voicecall.md +41 -0
  781. package/docs/zh-CN/cli/webhooks.md +32 -0
  782. package/docs/zh-CN/concepts/agent-loop.md +146 -0
  783. package/docs/zh-CN/concepts/agent-workspace.md +219 -0
  784. package/docs/zh-CN/concepts/agent.md +115 -0
  785. package/docs/zh-CN/concepts/architecture.md +123 -0
  786. package/docs/zh-CN/concepts/channel-routing.md +117 -0
  787. package/docs/zh-CN/concepts/compaction.md +67 -0
  788. package/docs/zh-CN/concepts/context.md +168 -0
  789. package/docs/zh-CN/concepts/features.md +59 -0
  790. package/docs/zh-CN/concepts/group-messages.md +91 -0
  791. package/docs/zh-CN/concepts/groups.md +379 -0
  792. package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
  793. package/docs/zh-CN/concepts/memory.md +412 -0
  794. package/docs/zh-CN/concepts/messages.md +141 -0
  795. package/docs/zh-CN/concepts/model-failover.md +145 -0
  796. package/docs/zh-CN/concepts/model-providers.md +320 -0
  797. package/docs/zh-CN/concepts/models.md +196 -0
  798. package/docs/zh-CN/concepts/multi-agent.md +372 -0
  799. package/docs/zh-CN/concepts/oauth.md +151 -0
  800. package/docs/zh-CN/concepts/presence.md +99 -0
  801. package/docs/zh-CN/concepts/queue.md +94 -0
  802. package/docs/zh-CN/concepts/retry.md +76 -0
  803. package/docs/zh-CN/concepts/session-pruning.md +129 -0
  804. package/docs/zh-CN/concepts/session-tool.md +200 -0
  805. package/docs/zh-CN/concepts/session.md +166 -0
  806. package/docs/zh-CN/concepts/sessions.md +17 -0
  807. package/docs/zh-CN/concepts/streaming.md +133 -0
  808. package/docs/zh-CN/concepts/system-prompt.md +101 -0
  809. package/docs/zh-CN/concepts/timezone.md +96 -0
  810. package/docs/zh-CN/concepts/typebox.md +284 -0
  811. package/docs/zh-CN/concepts/typing-indicators.md +74 -0
  812. package/docs/zh-CN/concepts/usage-tracking.md +42 -0
  813. package/docs/zh-CN/date-time.md +129 -0
  814. package/docs/zh-CN/debug/node-issue.md +90 -0
  815. package/docs/zh-CN/debugging.md +160 -0
  816. package/docs/zh-CN/diagnostics/flags.md +98 -0
  817. package/docs/zh-CN/environment.md +88 -0
  818. package/docs/zh-CN/experiments/onboarding-config-protocol.md +47 -0
  819. package/docs/zh-CN/experiments/plans/cron-add-hardening.md +70 -0
  820. package/docs/zh-CN/experiments/plans/group-policy-hardening.md +45 -0
  821. package/docs/zh-CN/experiments/plans/openresponses-gateway.md +121 -0
  822. package/docs/zh-CN/experiments/proposals/model-config.md +42 -0
  823. package/docs/zh-CN/experiments/research/memory.md +235 -0
  824. package/docs/zh-CN/gateway/authentication.md +142 -0
  825. package/docs/zh-CN/gateway/background-process.md +100 -0
  826. package/docs/zh-CN/gateway/bonjour.md +174 -0
  827. package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
  828. package/docs/zh-CN/gateway/cli-backends.md +213 -0
  829. package/docs/zh-CN/gateway/configuration-examples.md +587 -0
  830. package/docs/zh-CN/gateway/configuration.md +3332 -0
  831. package/docs/zh-CN/gateway/discovery.md +123 -0
  832. package/docs/zh-CN/gateway/doctor.md +238 -0
  833. package/docs/zh-CN/gateway/gateway-lock.md +41 -0
  834. package/docs/zh-CN/gateway/health.md +42 -0
  835. package/docs/zh-CN/gateway/heartbeat.md +274 -0
  836. package/docs/zh-CN/gateway/index.md +335 -0
  837. package/docs/zh-CN/gateway/local-models.md +157 -0
  838. package/docs/zh-CN/gateway/logging.md +114 -0
  839. package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
  840. package/docs/zh-CN/gateway/network-model.md +23 -0
  841. package/docs/zh-CN/gateway/openai-http-api.md +125 -0
  842. package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
  843. package/docs/zh-CN/gateway/pairing.md +99 -0
  844. package/docs/zh-CN/gateway/protocol.md +220 -0
  845. package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
  846. package/docs/zh-CN/gateway/remote.md +133 -0
  847. package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
  848. package/docs/zh-CN/gateway/sandboxing.md +188 -0
  849. package/docs/zh-CN/gateway/security/formal-verification.md +169 -0
  850. package/docs/zh-CN/gateway/security/index.md +777 -0
  851. package/docs/zh-CN/gateway/tailscale.md +124 -0
  852. package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
  853. package/docs/zh-CN/gateway/troubleshooting.md +771 -0
  854. package/docs/zh-CN/help/faq.md +2628 -0
  855. package/docs/zh-CN/help/index.md +28 -0
  856. package/docs/zh-CN/help/troubleshooting.md +104 -0
  857. package/docs/zh-CN/hooks/soul-evil.md +72 -0
  858. package/docs/zh-CN/hooks.md +919 -0
  859. package/docs/zh-CN/index.md +186 -0
  860. package/docs/zh-CN/install/ansible.md +215 -0
  861. package/docs/zh-CN/install/bun.md +65 -0
  862. package/docs/zh-CN/install/development-channels.md +81 -0
  863. package/docs/zh-CN/install/docker.md +532 -0
  864. package/docs/zh-CN/install/exe-dev.md +127 -0
  865. package/docs/zh-CN/install/fly.md +490 -0
  866. package/docs/zh-CN/install/gcp.md +510 -0
  867. package/docs/zh-CN/install/hetzner.md +337 -0
  868. package/docs/zh-CN/install/index.md +193 -0
  869. package/docs/zh-CN/install/installer.md +128 -0
  870. package/docs/zh-CN/install/macos-vm.md +288 -0
  871. package/docs/zh-CN/install/migrating.md +199 -0
  872. package/docs/zh-CN/install/nix.md +99 -0
  873. package/docs/zh-CN/install/node.md +85 -0
  874. package/docs/zh-CN/install/northflank.mdx +60 -0
  875. package/docs/zh-CN/install/railway.mdx +106 -0
  876. package/docs/zh-CN/install/render.mdx +169 -0
  877. package/docs/zh-CN/install/uninstall.md +135 -0
  878. package/docs/zh-CN/install/updating.md +233 -0
  879. package/docs/zh-CN/logging.md +329 -0
  880. package/docs/zh-CN/multi-agent-sandbox-tools.md +401 -0
  881. package/docs/zh-CN/network.md +59 -0
  882. package/docs/zh-CN/nodes/audio.md +120 -0
  883. package/docs/zh-CN/nodes/camera.md +162 -0
  884. package/docs/zh-CN/nodes/images.md +79 -0
  885. package/docs/zh-CN/nodes/index.md +348 -0
  886. package/docs/zh-CN/nodes/location-command.md +120 -0
  887. package/docs/zh-CN/nodes/media-understanding.md +380 -0
  888. package/docs/zh-CN/nodes/talk.md +97 -0
  889. package/docs/zh-CN/nodes/voicewake.md +72 -0
  890. package/docs/zh-CN/perplexity.md +84 -0
  891. package/docs/zh-CN/pi-dev.md +77 -0
  892. package/docs/zh-CN/pi.md +619 -0
  893. package/docs/zh-CN/platforms/android.md +155 -0
  894. package/docs/zh-CN/platforms/digitalocean.md +269 -0
  895. package/docs/zh-CN/platforms/index.md +60 -0
  896. package/docs/zh-CN/platforms/ios.md +114 -0
  897. package/docs/zh-CN/platforms/linux.md +101 -0
  898. package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
  899. package/docs/zh-CN/platforms/mac/canvas.md +128 -0
  900. package/docs/zh-CN/platforms/mac/child-process.md +73 -0
  901. package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
  902. package/docs/zh-CN/platforms/mac/health.md +41 -0
  903. package/docs/zh-CN/platforms/mac/icon.md +38 -0
  904. package/docs/zh-CN/platforms/mac/logging.md +64 -0
  905. package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
  906. package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
  907. package/docs/zh-CN/platforms/mac/permissions.md +46 -0
  908. package/docs/zh-CN/platforms/mac/release.md +92 -0
  909. package/docs/zh-CN/platforms/mac/remote.md +90 -0
  910. package/docs/zh-CN/platforms/mac/signing.md +54 -0
  911. package/docs/zh-CN/platforms/mac/skills.md +40 -0
  912. package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
  913. package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
  914. package/docs/zh-CN/platforms/mac/webchat.md +43 -0
  915. package/docs/zh-CN/platforms/mac/xpc.md +68 -0
  916. package/docs/zh-CN/platforms/macos.md +193 -0
  917. package/docs/zh-CN/platforms/oracle.md +310 -0
  918. package/docs/zh-CN/platforms/raspberry-pi.md +365 -0
  919. package/docs/zh-CN/platforms/windows.md +156 -0
  920. package/docs/zh-CN/plugin.md +639 -0
  921. package/docs/zh-CN/plugins/agent-tools.md +99 -0
  922. package/docs/zh-CN/plugins/manifest.md +68 -0
  923. package/docs/zh-CN/plugins/voice-call.md +250 -0
  924. package/docs/zh-CN/plugins/zalouser.md +88 -0
  925. package/docs/zh-CN/prose.md +141 -0
  926. package/docs/zh-CN/providers/anthropic.md +159 -0
  927. package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
  928. package/docs/zh-CN/providers/deepgram.md +97 -0
  929. package/docs/zh-CN/providers/github-copilot.md +67 -0
  930. package/docs/zh-CN/providers/glm.md +39 -0
  931. package/docs/zh-CN/providers/index.md +68 -0
  932. package/docs/zh-CN/providers/minimax.md +206 -0
  933. package/docs/zh-CN/providers/models.md +55 -0
  934. package/docs/zh-CN/providers/moonshot.md +145 -0
  935. package/docs/zh-CN/providers/ollama.md +230 -0
  936. package/docs/zh-CN/providers/openai.md +68 -0
  937. package/docs/zh-CN/providers/opencode.md +41 -0
  938. package/docs/zh-CN/providers/openrouter.md +43 -0
  939. package/docs/zh-CN/providers/qwen.md +55 -0
  940. package/docs/zh-CN/providers/synthetic.md +102 -0
  941. package/docs/zh-CN/providers/venice.md +274 -0
  942. package/docs/zh-CN/providers/vercel-ai-gateway.md +57 -0
  943. package/docs/zh-CN/providers/xiaomi.md +68 -0
  944. package/docs/zh-CN/providers/zai.md +41 -0
  945. package/docs/zh-CN/refactor/clawnet.md +424 -0
  946. package/docs/zh-CN/refactor/exec-host.md +323 -0
  947. package/docs/zh-CN/refactor/outbound-session-mirroring.md +92 -0
  948. package/docs/zh-CN/refactor/plugin-sdk.md +221 -0
  949. package/docs/zh-CN/refactor/strict-config.md +100 -0
  950. package/docs/zh-CN/reference/AGENTS.default.md +131 -0
  951. package/docs/zh-CN/reference/RELEASING.md +123 -0
  952. package/docs/zh-CN/reference/api-usage-costs.md +136 -0
  953. package/docs/zh-CN/reference/credits.md +34 -0
  954. package/docs/zh-CN/reference/device-models.md +54 -0
  955. package/docs/zh-CN/reference/rpc.md +48 -0
  956. package/docs/zh-CN/reference/session-management-compaction.md +287 -0
  957. package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
  958. package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
  959. package/docs/zh-CN/reference/templates/BOOT.md +17 -0
  960. package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
  961. package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
  962. package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
  963. package/docs/zh-CN/reference/templates/IDENTITY.md +35 -0
  964. package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
  965. package/docs/zh-CN/reference/templates/SOUL.md +49 -0
  966. package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
  967. package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
  968. package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
  969. package/docs/zh-CN/reference/templates/USER.md +30 -0
  970. package/docs/zh-CN/reference/test.md +57 -0
  971. package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
  972. package/docs/zh-CN/scripts.md +35 -0
  973. package/docs/zh-CN/security/formal-verification.md +171 -0
  974. package/docs/zh-CN/start/docs-directory.md +70 -0
  975. package/docs/zh-CN/start/getting-started.md +206 -0
  976. package/docs/zh-CN/start/hubs.md +200 -0
  977. package/docs/zh-CN/start/lore.md +226 -0
  978. package/docs/zh-CN/start/onboarding.md +105 -0
  979. package/docs/zh-CN/start/openclaw.md +248 -0
  980. package/docs/zh-CN/start/pairing.md +89 -0
  981. package/docs/zh-CN/start/quickstart.md +88 -0
  982. package/docs/zh-CN/start/setup.md +153 -0
  983. package/docs/zh-CN/start/showcase.md +423 -0
  984. package/docs/zh-CN/start/wizard.md +331 -0
  985. package/docs/zh-CN/testing.md +375 -0
  986. package/docs/zh-CN/token-use.md +119 -0
  987. package/docs/zh-CN/tools/agent-send.md +59 -0
  988. package/docs/zh-CN/tools/apply-patch.md +57 -0
  989. package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
  990. package/docs/zh-CN/tools/browser-login.md +75 -0
  991. package/docs/zh-CN/tools/browser.md +553 -0
  992. package/docs/zh-CN/tools/chrome-extension.md +183 -0
  993. package/docs/zh-CN/tools/clawhub.md +209 -0
  994. package/docs/zh-CN/tools/creating-skills.md +61 -0
  995. package/docs/zh-CN/tools/elevated.md +64 -0
  996. package/docs/zh-CN/tools/exec-approvals.md +234 -0
  997. package/docs/zh-CN/tools/exec.md +169 -0
  998. package/docs/zh-CN/tools/firecrawl.md +68 -0
  999. package/docs/zh-CN/tools/index.md +515 -0
  1000. package/docs/zh-CN/tools/llm-task.md +117 -0
  1001. package/docs/zh-CN/tools/lobster.md +349 -0
  1002. package/docs/zh-CN/tools/reactions.md +29 -0
  1003. package/docs/zh-CN/tools/skills-config.md +78 -0
  1004. package/docs/zh-CN/tools/skills.md +279 -0
  1005. package/docs/zh-CN/tools/slash-commands.md +205 -0
  1006. package/docs/zh-CN/tools/subagents.md +156 -0
  1007. package/docs/zh-CN/tools/thinking.md +80 -0
  1008. package/docs/zh-CN/tools/web.md +257 -0
  1009. package/docs/zh-CN/tts.md +375 -0
  1010. package/docs/zh-CN/tui.md +166 -0
  1011. package/docs/zh-CN/vps.md +47 -0
  1012. package/docs/zh-CN/web/control-ui.md +191 -0
  1013. package/docs/zh-CN/web/dashboard.md +53 -0
  1014. package/docs/zh-CN/web/index.md +118 -0
  1015. package/docs/zh-CN/web/webchat.md +56 -0
  1016. package/extensions/bluebubbles/README.md +45 -0
  1017. package/extensions/bluebubbles/index.ts +19 -0
  1018. package/extensions/bluebubbles/node_modules/.bin/clawbrah +21 -0
  1019. package/extensions/bluebubbles/node_modules/.bin/clawbrah.CMD +12 -0
  1020. package/extensions/bluebubbles/node_modules/.bin/clawbrah.ps1 +41 -0
  1021. package/extensions/bluebubbles/node_modules/.bin/openclaw +21 -0
  1022. package/extensions/bluebubbles/node_modules/.bin/openclaw.CMD +12 -0
  1023. package/extensions/bluebubbles/node_modules/.bin/openclaw.ps1 +41 -0
  1024. package/extensions/bluebubbles/openclaw.plugin.json +9 -0
  1025. package/extensions/bluebubbles/package.json +36 -0
  1026. package/extensions/bluebubbles/src/accounts.ts +88 -0
  1027. package/extensions/bluebubbles/src/actions.test.ts +650 -0
  1028. package/extensions/bluebubbles/src/actions.ts +438 -0
  1029. package/extensions/bluebubbles/src/attachments.test.ts +345 -0
  1030. package/extensions/bluebubbles/src/attachments.ts +300 -0
  1031. package/extensions/bluebubbles/src/channel.ts +414 -0
  1032. package/extensions/bluebubbles/src/chat.test.ts +461 -0
  1033. package/extensions/bluebubbles/src/chat.ts +378 -0
  1034. package/extensions/bluebubbles/src/config-schema.ts +51 -0
  1035. package/extensions/bluebubbles/src/media-send.ts +174 -0
  1036. package/extensions/bluebubbles/src/monitor.test.ts +2342 -0
  1037. package/extensions/bluebubbles/src/monitor.ts +2499 -0
  1038. package/extensions/bluebubbles/src/onboarding.ts +352 -0
  1039. package/extensions/bluebubbles/src/probe.ts +135 -0
  1040. package/extensions/bluebubbles/src/reactions.test.ts +392 -0
  1041. package/extensions/bluebubbles/src/reactions.ts +188 -0
  1042. package/extensions/bluebubbles/src/runtime.ts +14 -0
  1043. package/extensions/bluebubbles/src/send.test.ts +808 -0
  1044. package/extensions/bluebubbles/src/send.ts +467 -0
  1045. package/extensions/bluebubbles/src/targets.test.ts +183 -0
  1046. package/extensions/bluebubbles/src/targets.ts +422 -0
  1047. package/extensions/bluebubbles/src/types.ts +127 -0
  1048. package/extensions/brah-sync/README.md +53 -0
  1049. package/extensions/brah-sync/index.ts +19 -0
  1050. package/extensions/brah-sync/node_modules/.bin/clawbrah +21 -0
  1051. package/extensions/brah-sync/node_modules/.bin/clawbrah.CMD +12 -0
  1052. package/extensions/brah-sync/node_modules/.bin/clawbrah.ps1 +41 -0
  1053. package/extensions/brah-sync/node_modules/.bin/openclaw +21 -0
  1054. package/extensions/brah-sync/node_modules/.bin/openclaw.CMD +12 -0
  1055. package/extensions/brah-sync/node_modules/.bin/openclaw.ps1 +41 -0
  1056. package/extensions/brah-sync/openclaw.plugin.json +9 -0
  1057. package/extensions/brah-sync/package.json +12 -0
  1058. package/extensions/brah-sync/src/channel.ts +100 -0
  1059. package/extensions/brah-sync/src/config-schema.ts +35 -0
  1060. package/extensions/brah-sync/src/runtime.ts +14 -0
  1061. package/extensions/copilot-proxy/README.md +24 -0
  1062. package/extensions/copilot-proxy/index.ts +149 -0
  1063. package/extensions/copilot-proxy/node_modules/.bin/clawbrah +21 -0
  1064. package/extensions/copilot-proxy/node_modules/.bin/clawbrah.CMD +12 -0
  1065. package/extensions/copilot-proxy/node_modules/.bin/clawbrah.ps1 +41 -0
  1066. package/extensions/copilot-proxy/node_modules/.bin/openclaw +21 -0
  1067. package/extensions/copilot-proxy/node_modules/.bin/openclaw.CMD +12 -0
  1068. package/extensions/copilot-proxy/node_modules/.bin/openclaw.ps1 +41 -0
  1069. package/extensions/copilot-proxy/openclaw.plugin.json +9 -0
  1070. package/extensions/copilot-proxy/package.json +14 -0
  1071. package/extensions/diagnostics-otel/index.ts +15 -0
  1072. package/extensions/diagnostics-otel/node_modules/.bin/acorn +21 -0
  1073. package/extensions/diagnostics-otel/node_modules/.bin/acorn.CMD +12 -0
  1074. package/extensions/diagnostics-otel/node_modules/.bin/acorn.ps1 +41 -0
  1075. package/extensions/diagnostics-otel/node_modules/.bin/clawbrah +21 -0
  1076. package/extensions/diagnostics-otel/node_modules/.bin/clawbrah.CMD +12 -0
  1077. package/extensions/diagnostics-otel/node_modules/.bin/clawbrah.ps1 +41 -0
  1078. package/extensions/diagnostics-otel/node_modules/.bin/openclaw +21 -0
  1079. package/extensions/diagnostics-otel/node_modules/.bin/openclaw.CMD +12 -0
  1080. package/extensions/diagnostics-otel/node_modules/.bin/openclaw.ps1 +41 -0
  1081. package/extensions/diagnostics-otel/openclaw.plugin.json +8 -0
  1082. package/extensions/diagnostics-otel/package.json +27 -0
  1083. package/extensions/diagnostics-otel/src/service.test.ts +226 -0
  1084. package/extensions/diagnostics-otel/src/service.ts +635 -0
  1085. package/extensions/discord/index.ts +17 -0
  1086. package/extensions/discord/node_modules/.bin/clawbrah +21 -0
  1087. package/extensions/discord/node_modules/.bin/clawbrah.CMD +12 -0
  1088. package/extensions/discord/node_modules/.bin/clawbrah.ps1 +41 -0
  1089. package/extensions/discord/node_modules/.bin/openclaw +21 -0
  1090. package/extensions/discord/node_modules/.bin/openclaw.CMD +12 -0
  1091. package/extensions/discord/node_modules/.bin/openclaw.ps1 +41 -0
  1092. package/extensions/discord/openclaw.plugin.json +9 -0
  1093. package/extensions/discord/package.json +14 -0
  1094. package/extensions/discord/src/channel.ts +422 -0
  1095. package/extensions/discord/src/runtime.ts +14 -0
  1096. package/extensions/feishu/index.ts +63 -0
  1097. package/extensions/feishu/node_modules/.bin/clawbrah +21 -0
  1098. package/extensions/feishu/node_modules/.bin/clawbrah.CMD +12 -0
  1099. package/extensions/feishu/node_modules/.bin/clawbrah.ps1 +41 -0
  1100. package/extensions/feishu/node_modules/.bin/openclaw +21 -0
  1101. package/extensions/feishu/node_modules/.bin/openclaw.CMD +12 -0
  1102. package/extensions/feishu/node_modules/.bin/openclaw.ps1 +41 -0
  1103. package/extensions/feishu/openclaw.plugin.json +10 -0
  1104. package/extensions/feishu/package.json +37 -0
  1105. package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
  1106. package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
  1107. package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
  1108. package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
  1109. package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
  1110. package/extensions/feishu/src/accounts.ts +144 -0
  1111. package/extensions/feishu/src/bitable.ts +459 -0
  1112. package/extensions/feishu/src/bot.ts +871 -0
  1113. package/extensions/feishu/src/channel.ts +341 -0
  1114. package/extensions/feishu/src/client.ts +118 -0
  1115. package/extensions/feishu/src/config-schema.ts +172 -0
  1116. package/extensions/feishu/src/directory.ts +177 -0
  1117. package/extensions/feishu/src/doc-schema.ts +47 -0
  1118. package/extensions/feishu/src/docx.ts +521 -0
  1119. package/extensions/feishu/src/drive-schema.ts +46 -0
  1120. package/extensions/feishu/src/drive.ts +227 -0
  1121. package/extensions/feishu/src/media.ts +527 -0
  1122. package/extensions/feishu/src/mention.ts +126 -0
  1123. package/extensions/feishu/src/monitor.ts +190 -0
  1124. package/extensions/feishu/src/onboarding.ts +356 -0
  1125. package/extensions/feishu/src/outbound.ts +40 -0
  1126. package/extensions/feishu/src/perm-schema.ts +52 -0
  1127. package/extensions/feishu/src/perm.ts +173 -0
  1128. package/extensions/feishu/src/policy.ts +104 -0
  1129. package/extensions/feishu/src/probe.ts +44 -0
  1130. package/extensions/feishu/src/reactions.ts +160 -0
  1131. package/extensions/feishu/src/reply-dispatcher.ts +184 -0
  1132. package/extensions/feishu/src/runtime.ts +14 -0
  1133. package/extensions/feishu/src/send.ts +358 -0
  1134. package/extensions/feishu/src/targets.ts +78 -0
  1135. package/extensions/feishu/src/tools-config.ts +21 -0
  1136. package/extensions/feishu/src/types.ts +75 -0
  1137. package/extensions/feishu/src/typing.ts +80 -0
  1138. package/extensions/feishu/src/wiki-schema.ts +55 -0
  1139. package/extensions/feishu/src/wiki.ts +232 -0
  1140. package/extensions/google-antigravity-auth/README.md +24 -0
  1141. package/extensions/google-antigravity-auth/index.ts +461 -0
  1142. package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah +21 -0
  1143. package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah.CMD +12 -0
  1144. package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah.ps1 +41 -0
  1145. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw +21 -0
  1146. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.CMD +12 -0
  1147. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1148. package/extensions/google-antigravity-auth/openclaw.plugin.json +9 -0
  1149. package/extensions/google-antigravity-auth/package.json +14 -0
  1150. package/extensions/google-gemini-cli-auth/README.md +35 -0
  1151. package/extensions/google-gemini-cli-auth/index.ts +88 -0
  1152. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah +21 -0
  1153. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah.CMD +12 -0
  1154. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah.ps1 +41 -0
  1155. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw +21 -0
  1156. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.CMD +12 -0
  1157. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1158. package/extensions/google-gemini-cli-auth/oauth.test.ts +240 -0
  1159. package/extensions/google-gemini-cli-auth/oauth.ts +662 -0
  1160. package/extensions/google-gemini-cli-auth/openclaw.plugin.json +9 -0
  1161. package/extensions/google-gemini-cli-auth/package.json +14 -0
  1162. package/extensions/googlechat/index.ts +19 -0
  1163. package/extensions/googlechat/node_modules/.bin/clawbrah +21 -0
  1164. package/extensions/googlechat/node_modules/.bin/clawbrah.CMD +12 -0
  1165. package/extensions/googlechat/node_modules/.bin/clawbrah.ps1 +41 -0
  1166. package/extensions/googlechat/node_modules/.bin/openclaw +21 -0
  1167. package/extensions/googlechat/node_modules/.bin/openclaw.CMD +12 -0
  1168. package/extensions/googlechat/node_modules/.bin/openclaw.ps1 +41 -0
  1169. package/extensions/googlechat/openclaw.plugin.json +9 -0
  1170. package/extensions/googlechat/package.json +39 -0
  1171. package/extensions/googlechat/src/accounts.ts +147 -0
  1172. package/extensions/googlechat/src/actions.ts +181 -0
  1173. package/extensions/googlechat/src/api.test.ts +61 -0
  1174. package/extensions/googlechat/src/api.ts +282 -0
  1175. package/extensions/googlechat/src/auth.ts +123 -0
  1176. package/extensions/googlechat/src/channel.ts +583 -0
  1177. package/extensions/googlechat/src/monitor.test.ts +22 -0
  1178. package/extensions/googlechat/src/monitor.ts +960 -0
  1179. package/extensions/googlechat/src/onboarding.ts +269 -0
  1180. package/extensions/googlechat/src/runtime.ts +14 -0
  1181. package/extensions/googlechat/src/targets.test.ts +32 -0
  1182. package/extensions/googlechat/src/targets.ts +65 -0
  1183. package/extensions/googlechat/src/types.config.ts +3 -0
  1184. package/extensions/googlechat/src/types.ts +73 -0
  1185. package/extensions/imessage/index.ts +17 -0
  1186. package/extensions/imessage/node_modules/.bin/clawbrah +21 -0
  1187. package/extensions/imessage/node_modules/.bin/clawbrah.CMD +12 -0
  1188. package/extensions/imessage/node_modules/.bin/clawbrah.ps1 +41 -0
  1189. package/extensions/imessage/node_modules/.bin/openclaw +21 -0
  1190. package/extensions/imessage/node_modules/.bin/openclaw.CMD +12 -0
  1191. package/extensions/imessage/node_modules/.bin/openclaw.ps1 +41 -0
  1192. package/extensions/imessage/openclaw.plugin.json +9 -0
  1193. package/extensions/imessage/package.json +14 -0
  1194. package/extensions/imessage/src/channel.ts +294 -0
  1195. package/extensions/imessage/src/runtime.ts +14 -0
  1196. package/extensions/line/index.ts +19 -0
  1197. package/extensions/line/node_modules/.bin/clawbrah +21 -0
  1198. package/extensions/line/node_modules/.bin/clawbrah.CMD +12 -0
  1199. package/extensions/line/node_modules/.bin/clawbrah.ps1 +41 -0
  1200. package/extensions/line/node_modules/.bin/openclaw +21 -0
  1201. package/extensions/line/node_modules/.bin/openclaw.CMD +12 -0
  1202. package/extensions/line/node_modules/.bin/openclaw.ps1 +41 -0
  1203. package/extensions/line/openclaw.plugin.json +9 -0
  1204. package/extensions/line/package.json +29 -0
  1205. package/extensions/line/src/card-command.ts +344 -0
  1206. package/extensions/line/src/channel.logout.test.ts +99 -0
  1207. package/extensions/line/src/channel.sendPayload.test.ts +306 -0
  1208. package/extensions/line/src/channel.ts +780 -0
  1209. package/extensions/line/src/runtime.ts +14 -0
  1210. package/extensions/llm-task/README.md +97 -0
  1211. package/extensions/llm-task/index.ts +6 -0
  1212. package/extensions/llm-task/node_modules/.bin/clawbrah +21 -0
  1213. package/extensions/llm-task/node_modules/.bin/clawbrah.CMD +12 -0
  1214. package/extensions/llm-task/node_modules/.bin/clawbrah.ps1 +41 -0
  1215. package/extensions/llm-task/node_modules/.bin/openclaw +21 -0
  1216. package/extensions/llm-task/node_modules/.bin/openclaw.CMD +12 -0
  1217. package/extensions/llm-task/node_modules/.bin/openclaw.ps1 +41 -0
  1218. package/extensions/llm-task/openclaw.plugin.json +21 -0
  1219. package/extensions/llm-task/package.json +14 -0
  1220. package/extensions/llm-task/src/llm-task-tool.test.ts +138 -0
  1221. package/extensions/llm-task/src/llm-task-tool.ts +245 -0
  1222. package/extensions/lobster/README.md +75 -0
  1223. package/extensions/lobster/SKILL.md +97 -0
  1224. package/extensions/lobster/index.ts +14 -0
  1225. package/extensions/lobster/node_modules/.bin/clawbrah +21 -0
  1226. package/extensions/lobster/node_modules/.bin/clawbrah.CMD +12 -0
  1227. package/extensions/lobster/node_modules/.bin/clawbrah.ps1 +41 -0
  1228. package/extensions/lobster/node_modules/.bin/openclaw +21 -0
  1229. package/extensions/lobster/node_modules/.bin/openclaw.CMD +12 -0
  1230. package/extensions/lobster/node_modules/.bin/openclaw.ps1 +41 -0
  1231. package/extensions/lobster/openclaw.plugin.json +10 -0
  1232. package/extensions/lobster/package.json +14 -0
  1233. package/extensions/lobster/src/lobster-tool.test.ts +247 -0
  1234. package/extensions/lobster/src/lobster-tool.ts +328 -0
  1235. package/extensions/matrix/CHANGELOG.md +93 -0
  1236. package/extensions/matrix/index.ts +17 -0
  1237. package/extensions/matrix/node_modules/.bin/clawbrah +21 -0
  1238. package/extensions/matrix/node_modules/.bin/clawbrah.CMD +12 -0
  1239. package/extensions/matrix/node_modules/.bin/clawbrah.ps1 +41 -0
  1240. package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
  1241. package/extensions/matrix/node_modules/.bin/markdown-it.CMD +12 -0
  1242. package/extensions/matrix/node_modules/.bin/markdown-it.ps1 +41 -0
  1243. package/extensions/matrix/node_modules/.bin/openclaw +21 -0
  1244. package/extensions/matrix/node_modules/.bin/openclaw.CMD +12 -0
  1245. package/extensions/matrix/node_modules/.bin/openclaw.ps1 +41 -0
  1246. package/extensions/matrix/openclaw.plugin.json +9 -0
  1247. package/extensions/matrix/package.json +36 -0
  1248. package/extensions/matrix/src/actions.ts +195 -0
  1249. package/extensions/matrix/src/channel.directory.test.ts +64 -0
  1250. package/extensions/matrix/src/channel.ts +439 -0
  1251. package/extensions/matrix/src/config-schema.ts +63 -0
  1252. package/extensions/matrix/src/directory-live.ts +188 -0
  1253. package/extensions/matrix/src/group-mentions.ts +66 -0
  1254. package/extensions/matrix/src/matrix/accounts.test.ts +82 -0
  1255. package/extensions/matrix/src/matrix/accounts.ts +65 -0
  1256. package/extensions/matrix/src/matrix/actions/client.ts +57 -0
  1257. package/extensions/matrix/src/matrix/actions/messages.ts +128 -0
  1258. package/extensions/matrix/src/matrix/actions/pins.ts +76 -0
  1259. package/extensions/matrix/src/matrix/actions/reactions.ts +96 -0
  1260. package/extensions/matrix/src/matrix/actions/room.ts +85 -0
  1261. package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
  1262. package/extensions/matrix/src/matrix/actions/types.ts +84 -0
  1263. package/extensions/matrix/src/matrix/actions.ts +15 -0
  1264. package/extensions/matrix/src/matrix/active-client.ts +11 -0
  1265. package/extensions/matrix/src/matrix/client/config.ts +160 -0
  1266. package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
  1267. package/extensions/matrix/src/matrix/client/logging.ts +36 -0
  1268. package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
  1269. package/extensions/matrix/src/matrix/client/shared.ts +170 -0
  1270. package/extensions/matrix/src/matrix/client/storage.ts +131 -0
  1271. package/extensions/matrix/src/matrix/client/types.ts +34 -0
  1272. package/extensions/matrix/src/matrix/client.test.ts +56 -0
  1273. package/extensions/matrix/src/matrix/client.ts +5 -0
  1274. package/extensions/matrix/src/matrix/credentials.ts +105 -0
  1275. package/extensions/matrix/src/matrix/deps.ts +60 -0
  1276. package/extensions/matrix/src/matrix/format.test.ts +33 -0
  1277. package/extensions/matrix/src/matrix/format.ts +22 -0
  1278. package/extensions/matrix/src/matrix/index.ts +11 -0
  1279. package/extensions/matrix/src/matrix/monitor/allowlist.test.ts +45 -0
  1280. package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
  1281. package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
  1282. package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
  1283. package/extensions/matrix/src/matrix/monitor/events.ts +101 -0
  1284. package/extensions/matrix/src/matrix/monitor/handler.ts +665 -0
  1285. package/extensions/matrix/src/matrix/monitor/index.ts +338 -0
  1286. package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
  1287. package/extensions/matrix/src/matrix/monitor/media.test.ts +102 -0
  1288. package/extensions/matrix/src/matrix/monitor/media.ts +113 -0
  1289. package/extensions/matrix/src/matrix/monitor/mentions.ts +31 -0
  1290. package/extensions/matrix/src/matrix/monitor/replies.ts +97 -0
  1291. package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
  1292. package/extensions/matrix/src/matrix/monitor/rooms.test.ts +39 -0
  1293. package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
  1294. package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
  1295. package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
  1296. package/extensions/matrix/src/matrix/poll-types.test.ts +21 -0
  1297. package/extensions/matrix/src/matrix/poll-types.ts +166 -0
  1298. package/extensions/matrix/src/matrix/probe.ts +70 -0
  1299. package/extensions/matrix/src/matrix/send/client.ts +66 -0
  1300. package/extensions/matrix/src/matrix/send/formatting.ts +89 -0
  1301. package/extensions/matrix/src/matrix/send/media.ts +229 -0
  1302. package/extensions/matrix/src/matrix/send/targets.test.ts +98 -0
  1303. package/extensions/matrix/src/matrix/send/targets.ts +136 -0
  1304. package/extensions/matrix/src/matrix/send/types.ts +109 -0
  1305. package/extensions/matrix/src/matrix/send.test.ts +171 -0
  1306. package/extensions/matrix/src/matrix/send.ts +260 -0
  1307. package/extensions/matrix/src/onboarding.ts +449 -0
  1308. package/extensions/matrix/src/outbound.ts +52 -0
  1309. package/extensions/matrix/src/resolve-targets.test.ts +48 -0
  1310. package/extensions/matrix/src/resolve-targets.ts +135 -0
  1311. package/extensions/matrix/src/runtime.ts +14 -0
  1312. package/extensions/matrix/src/tool-actions.ts +164 -0
  1313. package/extensions/matrix/src/types.ts +97 -0
  1314. package/extensions/mattermost/index.ts +17 -0
  1315. package/extensions/mattermost/node_modules/.bin/clawbrah +21 -0
  1316. package/extensions/mattermost/node_modules/.bin/clawbrah.CMD +12 -0
  1317. package/extensions/mattermost/node_modules/.bin/clawbrah.ps1 +41 -0
  1318. package/extensions/mattermost/node_modules/.bin/openclaw +21 -0
  1319. package/extensions/mattermost/node_modules/.bin/openclaw.CMD +12 -0
  1320. package/extensions/mattermost/node_modules/.bin/openclaw.ps1 +41 -0
  1321. package/extensions/mattermost/openclaw.plugin.json +9 -0
  1322. package/extensions/mattermost/package.json +28 -0
  1323. package/extensions/mattermost/src/channel.test.ts +72 -0
  1324. package/extensions/mattermost/src/channel.ts +337 -0
  1325. package/extensions/mattermost/src/config-schema.ts +56 -0
  1326. package/extensions/mattermost/src/group-mentions.ts +15 -0
  1327. package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
  1328. package/extensions/mattermost/src/mattermost/client.ts +220 -0
  1329. package/extensions/mattermost/src/mattermost/index.ts +9 -0
  1330. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +166 -0
  1331. package/extensions/mattermost/src/mattermost/monitor.ts +991 -0
  1332. package/extensions/mattermost/src/mattermost/probe.ts +74 -0
  1333. package/extensions/mattermost/src/mattermost/send.ts +231 -0
  1334. package/extensions/mattermost/src/normalize.ts +46 -0
  1335. package/extensions/mattermost/src/onboarding-helpers.ts +44 -0
  1336. package/extensions/mattermost/src/onboarding.ts +186 -0
  1337. package/extensions/mattermost/src/runtime.ts +14 -0
  1338. package/extensions/mattermost/src/types.ts +52 -0
  1339. package/extensions/memory-core/index.ts +38 -0
  1340. package/extensions/memory-core/node_modules/.bin/clawbrah +21 -0
  1341. package/extensions/memory-core/node_modules/.bin/clawbrah.CMD +12 -0
  1342. package/extensions/memory-core/node_modules/.bin/clawbrah.ps1 +41 -0
  1343. package/extensions/memory-core/node_modules/.bin/openclaw +21 -0
  1344. package/extensions/memory-core/node_modules/.bin/openclaw.CMD +12 -0
  1345. package/extensions/memory-core/node_modules/.bin/openclaw.ps1 +41 -0
  1346. package/extensions/memory-core/openclaw.plugin.json +9 -0
  1347. package/extensions/memory-core/package.json +17 -0
  1348. package/extensions/memory-lancedb/config.ts +139 -0
  1349. package/extensions/memory-lancedb/index.test.ts +295 -0
  1350. package/extensions/memory-lancedb/index.ts +608 -0
  1351. package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +21 -0
  1352. package/extensions/memory-lancedb/node_modules/.bin/arrow2csv.CMD +12 -0
  1353. package/extensions/memory-lancedb/node_modules/.bin/arrow2csv.ps1 +41 -0
  1354. package/extensions/memory-lancedb/node_modules/.bin/clawbrah +21 -0
  1355. package/extensions/memory-lancedb/node_modules/.bin/clawbrah.CMD +12 -0
  1356. package/extensions/memory-lancedb/node_modules/.bin/clawbrah.ps1 +41 -0
  1357. package/extensions/memory-lancedb/node_modules/.bin/openai +21 -0
  1358. package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +12 -0
  1359. package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +41 -0
  1360. package/extensions/memory-lancedb/node_modules/.bin/openclaw +21 -0
  1361. package/extensions/memory-lancedb/node_modules/.bin/openclaw.CMD +12 -0
  1362. package/extensions/memory-lancedb/node_modules/.bin/openclaw.ps1 +41 -0
  1363. package/extensions/memory-lancedb/openclaw.plugin.json +60 -0
  1364. package/extensions/memory-lancedb/package.json +19 -0
  1365. package/extensions/minimax-portal-auth/README.md +33 -0
  1366. package/extensions/minimax-portal-auth/index.ts +155 -0
  1367. package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah +21 -0
  1368. package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah.CMD +12 -0
  1369. package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah.ps1 +41 -0
  1370. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw +21 -0
  1371. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.CMD +12 -0
  1372. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1373. package/extensions/minimax-portal-auth/oauth.ts +247 -0
  1374. package/extensions/minimax-portal-auth/openclaw.plugin.json +9 -0
  1375. package/extensions/minimax-portal-auth/package.json +14 -0
  1376. package/extensions/msteams/CHANGELOG.md +89 -0
  1377. package/extensions/msteams/index.ts +17 -0
  1378. package/extensions/msteams/node_modules/.bin/clawbrah +21 -0
  1379. package/extensions/msteams/node_modules/.bin/clawbrah.CMD +12 -0
  1380. package/extensions/msteams/node_modules/.bin/clawbrah.ps1 +41 -0
  1381. package/extensions/msteams/node_modules/.bin/openclaw +21 -0
  1382. package/extensions/msteams/node_modules/.bin/openclaw.CMD +12 -0
  1383. package/extensions/msteams/node_modules/.bin/openclaw.ps1 +41 -0
  1384. package/extensions/msteams/openclaw.plugin.json +9 -0
  1385. package/extensions/msteams/package.json +39 -0
  1386. package/extensions/msteams/src/attachments/download.ts +283 -0
  1387. package/extensions/msteams/src/attachments/graph.ts +353 -0
  1388. package/extensions/msteams/src/attachments/html.ts +90 -0
  1389. package/extensions/msteams/src/attachments/payload.ts +22 -0
  1390. package/extensions/msteams/src/attachments/shared.ts +291 -0
  1391. package/extensions/msteams/src/attachments/types.ts +37 -0
  1392. package/extensions/msteams/src/attachments.test.ts +459 -0
  1393. package/extensions/msteams/src/attachments.ts +18 -0
  1394. package/extensions/msteams/src/channel.directory.test.ts +48 -0
  1395. package/extensions/msteams/src/channel.ts +459 -0
  1396. package/extensions/msteams/src/conversation-store-fs.test.ts +88 -0
  1397. package/extensions/msteams/src/conversation-store-fs.ts +165 -0
  1398. package/extensions/msteams/src/conversation-store-memory.ts +47 -0
  1399. package/extensions/msteams/src/conversation-store.ts +41 -0
  1400. package/extensions/msteams/src/directory-live.ts +205 -0
  1401. package/extensions/msteams/src/errors.test.ts +45 -0
  1402. package/extensions/msteams/src/errors.ts +190 -0
  1403. package/extensions/msteams/src/file-consent-helpers.test.ts +243 -0
  1404. package/extensions/msteams/src/file-consent-helpers.ts +73 -0
  1405. package/extensions/msteams/src/file-consent.ts +126 -0
  1406. package/extensions/msteams/src/graph-chat.ts +53 -0
  1407. package/extensions/msteams/src/graph-upload.ts +453 -0
  1408. package/extensions/msteams/src/inbound.test.ts +66 -0
  1409. package/extensions/msteams/src/inbound.ts +48 -0
  1410. package/extensions/msteams/src/index.ts +4 -0
  1411. package/extensions/msteams/src/media-helpers.test.ts +189 -0
  1412. package/extensions/msteams/src/media-helpers.ts +86 -0
  1413. package/extensions/msteams/src/messenger.test.ts +248 -0
  1414. package/extensions/msteams/src/messenger.ts +495 -0
  1415. package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
  1416. package/extensions/msteams/src/monitor-handler/message-handler.ts +641 -0
  1417. package/extensions/msteams/src/monitor-handler.ts +162 -0
  1418. package/extensions/msteams/src/monitor-types.ts +5 -0
  1419. package/extensions/msteams/src/monitor.ts +295 -0
  1420. package/extensions/msteams/src/onboarding.ts +431 -0
  1421. package/extensions/msteams/src/outbound.ts +46 -0
  1422. package/extensions/msteams/src/pending-uploads.ts +89 -0
  1423. package/extensions/msteams/src/policy.test.ts +209 -0
  1424. package/extensions/msteams/src/policy.ts +273 -0
  1425. package/extensions/msteams/src/polls-store-memory.ts +32 -0
  1426. package/extensions/msteams/src/polls-store.test.ts +38 -0
  1427. package/extensions/msteams/src/polls.test.ts +72 -0
  1428. package/extensions/msteams/src/polls.ts +315 -0
  1429. package/extensions/msteams/src/probe.test.ts +58 -0
  1430. package/extensions/msteams/src/probe.ts +107 -0
  1431. package/extensions/msteams/src/reply-dispatcher.ts +132 -0
  1432. package/extensions/msteams/src/resolve-allowlist.ts +297 -0
  1433. package/extensions/msteams/src/runtime.ts +14 -0
  1434. package/extensions/msteams/src/sdk-types.ts +19 -0
  1435. package/extensions/msteams/src/sdk.ts +33 -0
  1436. package/extensions/msteams/src/send-context.ts +164 -0
  1437. package/extensions/msteams/src/send.ts +519 -0
  1438. package/extensions/msteams/src/sent-message-cache.test.ts +15 -0
  1439. package/extensions/msteams/src/sent-message-cache.ts +47 -0
  1440. package/extensions/msteams/src/storage.ts +25 -0
  1441. package/extensions/msteams/src/store-fs.ts +83 -0
  1442. package/extensions/msteams/src/token.ts +19 -0
  1443. package/extensions/nextcloud-talk/index.ts +17 -0
  1444. package/extensions/nextcloud-talk/node_modules/.bin/clawbrah +21 -0
  1445. package/extensions/nextcloud-talk/node_modules/.bin/clawbrah.CMD +12 -0
  1446. package/extensions/nextcloud-talk/node_modules/.bin/clawbrah.ps1 +41 -0
  1447. package/extensions/nextcloud-talk/node_modules/.bin/openclaw +21 -0
  1448. package/extensions/nextcloud-talk/node_modules/.bin/openclaw.CMD +12 -0
  1449. package/extensions/nextcloud-talk/node_modules/.bin/openclaw.ps1 +41 -0
  1450. package/extensions/nextcloud-talk/openclaw.plugin.json +9 -0
  1451. package/extensions/nextcloud-talk/package.json +33 -0
  1452. package/extensions/nextcloud-talk/src/accounts.ts +174 -0
  1453. package/extensions/nextcloud-talk/src/channel.ts +409 -0
  1454. package/extensions/nextcloud-talk/src/config-schema.ts +79 -0
  1455. package/extensions/nextcloud-talk/src/format.ts +79 -0
  1456. package/extensions/nextcloud-talk/src/inbound.ts +327 -0
  1457. package/extensions/nextcloud-talk/src/monitor.ts +246 -0
  1458. package/extensions/nextcloud-talk/src/normalize.ts +39 -0
  1459. package/extensions/nextcloud-talk/src/onboarding.ts +343 -0
  1460. package/extensions/nextcloud-talk/src/policy.test.ts +33 -0
  1461. package/extensions/nextcloud-talk/src/policy.ts +180 -0
  1462. package/extensions/nextcloud-talk/src/room-info.ts +125 -0
  1463. package/extensions/nextcloud-talk/src/runtime.ts +14 -0
  1464. package/extensions/nextcloud-talk/src/send.ts +215 -0
  1465. package/extensions/nextcloud-talk/src/signature.ts +72 -0
  1466. package/extensions/nextcloud-talk/src/types.ts +181 -0
  1467. package/extensions/nostr/CHANGELOG.md +80 -0
  1468. package/extensions/nostr/README.md +136 -0
  1469. package/extensions/nostr/index.ts +68 -0
  1470. package/extensions/nostr/node_modules/.bin/clawbrah +21 -0
  1471. package/extensions/nostr/node_modules/.bin/clawbrah.CMD +12 -0
  1472. package/extensions/nostr/node_modules/.bin/clawbrah.ps1 +41 -0
  1473. package/extensions/nostr/node_modules/.bin/openclaw +21 -0
  1474. package/extensions/nostr/node_modules/.bin/openclaw.CMD +12 -0
  1475. package/extensions/nostr/node_modules/.bin/openclaw.ps1 +41 -0
  1476. package/extensions/nostr/node_modules/.bin/tsc +21 -0
  1477. package/extensions/nostr/node_modules/.bin/tsc.CMD +12 -0
  1478. package/extensions/nostr/node_modules/.bin/tsc.ps1 +41 -0
  1479. package/extensions/nostr/node_modules/.bin/tsserver +21 -0
  1480. package/extensions/nostr/node_modules/.bin/tsserver.CMD +12 -0
  1481. package/extensions/nostr/node_modules/.bin/tsserver.ps1 +41 -0
  1482. package/extensions/nostr/openclaw.plugin.json +9 -0
  1483. package/extensions/nostr/package.json +34 -0
  1484. package/extensions/nostr/src/channel.test.ts +151 -0
  1485. package/extensions/nostr/src/channel.ts +353 -0
  1486. package/extensions/nostr/src/config-schema.ts +90 -0
  1487. package/extensions/nostr/src/metrics.ts +478 -0
  1488. package/extensions/nostr/src/nostr-bus.fuzz.test.ts +533 -0
  1489. package/extensions/nostr/src/nostr-bus.integration.test.ts +448 -0
  1490. package/extensions/nostr/src/nostr-bus.test.ts +199 -0
  1491. package/extensions/nostr/src/nostr-bus.ts +715 -0
  1492. package/extensions/nostr/src/nostr-profile-http.test.ts +378 -0
  1493. package/extensions/nostr/src/nostr-profile-http.ts +519 -0
  1494. package/extensions/nostr/src/nostr-profile-import.test.ts +119 -0
  1495. package/extensions/nostr/src/nostr-profile-import.ts +262 -0
  1496. package/extensions/nostr/src/nostr-profile.fuzz.test.ts +477 -0
  1497. package/extensions/nostr/src/nostr-profile.test.ts +410 -0
  1498. package/extensions/nostr/src/nostr-profile.ts +277 -0
  1499. package/extensions/nostr/src/nostr-state-store.test.ts +131 -0
  1500. package/extensions/nostr/src/nostr-state-store.ts +226 -0
  1501. package/extensions/nostr/src/runtime.ts +14 -0
  1502. package/extensions/nostr/src/seen-tracker.ts +303 -0
  1503. package/extensions/nostr/src/types.test.ts +157 -0
  1504. package/extensions/nostr/src/types.ts +101 -0
  1505. package/extensions/nostr/test/setup.ts +5 -0
  1506. package/extensions/open-prose/README.md +25 -0
  1507. package/extensions/open-prose/index.ts +5 -0
  1508. package/extensions/open-prose/node_modules/.bin/clawbrah +21 -0
  1509. package/extensions/open-prose/node_modules/.bin/clawbrah.CMD +12 -0
  1510. package/extensions/open-prose/node_modules/.bin/clawbrah.ps1 +41 -0
  1511. package/extensions/open-prose/node_modules/.bin/openclaw +21 -0
  1512. package/extensions/open-prose/node_modules/.bin/openclaw.CMD +12 -0
  1513. package/extensions/open-prose/node_modules/.bin/openclaw.ps1 +41 -0
  1514. package/extensions/open-prose/openclaw.plugin.json +11 -0
  1515. package/extensions/open-prose/package.json +14 -0
  1516. package/extensions/open-prose/skills/prose/LICENSE +21 -0
  1517. package/extensions/open-prose/skills/prose/SKILL.md +323 -0
  1518. package/extensions/open-prose/skills/prose/alt-borges.md +141 -0
  1519. package/extensions/open-prose/skills/prose/alts/arabian-nights.md +358 -0
  1520. package/extensions/open-prose/skills/prose/alts/borges.md +360 -0
  1521. package/extensions/open-prose/skills/prose/alts/folk.md +322 -0
  1522. package/extensions/open-prose/skills/prose/alts/homer.md +346 -0
  1523. package/extensions/open-prose/skills/prose/alts/kafka.md +373 -0
  1524. package/extensions/open-prose/skills/prose/compiler.md +2971 -0
  1525. package/extensions/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
  1526. package/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
  1527. package/extensions/open-prose/skills/prose/examples/03-code-review.prose +17 -0
  1528. package/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
  1529. package/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
  1530. package/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
  1531. package/extensions/open-prose/skills/prose/examples/07-refactor.prose +20 -0
  1532. package/extensions/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
  1533. package/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
  1534. package/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
  1535. package/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
  1536. package/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
  1537. package/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
  1538. package/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
  1539. package/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
  1540. package/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
  1541. package/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
  1542. package/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
  1543. package/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
  1544. package/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
  1545. package/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
  1546. package/extensions/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
  1547. package/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
  1548. package/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
  1549. package/extensions/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
  1550. package/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
  1551. package/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
  1552. package/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
  1553. package/extensions/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
  1554. package/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
  1555. package/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
  1556. package/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
  1557. package/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
  1558. package/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
  1559. package/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
  1560. package/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
  1561. package/extensions/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
  1562. package/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
  1563. package/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
  1564. package/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
  1565. package/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
  1566. package/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
  1567. package/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
  1568. package/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
  1569. package/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
  1570. package/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
  1571. package/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
  1572. package/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
  1573. package/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
  1574. package/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
  1575. package/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
  1576. package/extensions/open-prose/skills/prose/examples/README.md +391 -0
  1577. package/extensions/open-prose/skills/prose/examples/roadmap/README.md +22 -0
  1578. package/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
  1579. package/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
  1580. package/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
  1581. package/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
  1582. package/extensions/open-prose/skills/prose/guidance/antipatterns.md +951 -0
  1583. package/extensions/open-prose/skills/prose/guidance/patterns.md +700 -0
  1584. package/extensions/open-prose/skills/prose/guidance/system-prompt.md +180 -0
  1585. package/extensions/open-prose/skills/prose/help.md +144 -0
  1586. package/extensions/open-prose/skills/prose/lib/README.md +108 -0
  1587. package/extensions/open-prose/skills/prose/lib/calibrator.prose +215 -0
  1588. package/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
  1589. package/extensions/open-prose/skills/prose/lib/error-forensics.prose +250 -0
  1590. package/extensions/open-prose/skills/prose/lib/inspector.prose +196 -0
  1591. package/extensions/open-prose/skills/prose/lib/profiler.prose +460 -0
  1592. package/extensions/open-prose/skills/prose/lib/program-improver.prose +275 -0
  1593. package/extensions/open-prose/skills/prose/lib/project-memory.prose +118 -0
  1594. package/extensions/open-prose/skills/prose/lib/user-memory.prose +93 -0
  1595. package/extensions/open-prose/skills/prose/lib/vm-improver.prose +243 -0
  1596. package/extensions/open-prose/skills/prose/primitives/session.md +593 -0
  1597. package/extensions/open-prose/skills/prose/prose.md +1237 -0
  1598. package/extensions/open-prose/skills/prose/state/filesystem.md +498 -0
  1599. package/extensions/open-prose/skills/prose/state/in-context.md +384 -0
  1600. package/extensions/open-prose/skills/prose/state/postgres.md +880 -0
  1601. package/extensions/open-prose/skills/prose/state/sqlite.md +574 -0
  1602. package/extensions/qwen-portal-auth/README.md +24 -0
  1603. package/extensions/qwen-portal-auth/index.ts +130 -0
  1604. package/extensions/qwen-portal-auth/oauth.ts +190 -0
  1605. package/extensions/qwen-portal-auth/openclaw.plugin.json +9 -0
  1606. package/extensions/signal/index.ts +17 -0
  1607. package/extensions/signal/node_modules/.bin/clawbrah +21 -0
  1608. package/extensions/signal/node_modules/.bin/clawbrah.CMD +12 -0
  1609. package/extensions/signal/node_modules/.bin/clawbrah.ps1 +41 -0
  1610. package/extensions/signal/node_modules/.bin/openclaw +21 -0
  1611. package/extensions/signal/node_modules/.bin/openclaw.CMD +12 -0
  1612. package/extensions/signal/node_modules/.bin/openclaw.ps1 +41 -0
  1613. package/extensions/signal/openclaw.plugin.json +9 -0
  1614. package/extensions/signal/package.json +14 -0
  1615. package/extensions/signal/src/channel.ts +315 -0
  1616. package/extensions/signal/src/runtime.ts +14 -0
  1617. package/extensions/slack/index.ts +17 -0
  1618. package/extensions/slack/node_modules/.bin/clawbrah +21 -0
  1619. package/extensions/slack/node_modules/.bin/clawbrah.CMD +12 -0
  1620. package/extensions/slack/node_modules/.bin/clawbrah.ps1 +41 -0
  1621. package/extensions/slack/node_modules/.bin/openclaw +21 -0
  1622. package/extensions/slack/node_modules/.bin/openclaw.CMD +12 -0
  1623. package/extensions/slack/node_modules/.bin/openclaw.ps1 +41 -0
  1624. package/extensions/slack/openclaw.plugin.json +9 -0
  1625. package/extensions/slack/package.json +14 -0
  1626. package/extensions/slack/src/channel.ts +604 -0
  1627. package/extensions/slack/src/runtime.ts +14 -0
  1628. package/extensions/telegram/index.ts +17 -0
  1629. package/extensions/telegram/node_modules/.bin/clawbrah +21 -0
  1630. package/extensions/telegram/node_modules/.bin/clawbrah.CMD +12 -0
  1631. package/extensions/telegram/node_modules/.bin/clawbrah.ps1 +41 -0
  1632. package/extensions/telegram/node_modules/.bin/openclaw +21 -0
  1633. package/extensions/telegram/node_modules/.bin/openclaw.CMD +12 -0
  1634. package/extensions/telegram/node_modules/.bin/openclaw.ps1 +41 -0
  1635. package/extensions/telegram/openclaw.plugin.json +9 -0
  1636. package/extensions/telegram/package.json +14 -0
  1637. package/extensions/telegram/src/channel.ts +482 -0
  1638. package/extensions/telegram/src/runtime.ts +14 -0
  1639. package/extensions/tlon/README.md +5 -0
  1640. package/extensions/tlon/index.ts +17 -0
  1641. package/extensions/tlon/node_modules/.bin/clawbrah +21 -0
  1642. package/extensions/tlon/node_modules/.bin/clawbrah.CMD +12 -0
  1643. package/extensions/tlon/node_modules/.bin/clawbrah.ps1 +41 -0
  1644. package/extensions/tlon/node_modules/.bin/openclaw +21 -0
  1645. package/extensions/tlon/node_modules/.bin/openclaw.CMD +12 -0
  1646. package/extensions/tlon/node_modules/.bin/openclaw.ps1 +41 -0
  1647. package/extensions/tlon/openclaw.plugin.json +9 -0
  1648. package/extensions/tlon/package.json +33 -0
  1649. package/extensions/tlon/src/channel.ts +392 -0
  1650. package/extensions/tlon/src/config-schema.test.ts +31 -0
  1651. package/extensions/tlon/src/config-schema.ts +45 -0
  1652. package/extensions/tlon/src/monitor/discovery.ts +76 -0
  1653. package/extensions/tlon/src/monitor/history.ts +90 -0
  1654. package/extensions/tlon/src/monitor/index.ts +580 -0
  1655. package/extensions/tlon/src/monitor/processed-messages.test.ts +23 -0
  1656. package/extensions/tlon/src/monitor/processed-messages.ts +46 -0
  1657. package/extensions/tlon/src/monitor/utils.ts +106 -0
  1658. package/extensions/tlon/src/onboarding.ts +214 -0
  1659. package/extensions/tlon/src/runtime.ts +14 -0
  1660. package/extensions/tlon/src/targets.ts +89 -0
  1661. package/extensions/tlon/src/types.ts +92 -0
  1662. package/extensions/tlon/src/urbit/auth.ts +18 -0
  1663. package/extensions/tlon/src/urbit/http-api.ts +38 -0
  1664. package/extensions/tlon/src/urbit/send.test.ts +38 -0
  1665. package/extensions/tlon/src/urbit/send.ts +131 -0
  1666. package/extensions/tlon/src/urbit/sse-client.test.ts +40 -0
  1667. package/extensions/tlon/src/urbit/sse-client.ts +395 -0
  1668. package/extensions/twitch/CHANGELOG.md +51 -0
  1669. package/extensions/twitch/README.md +89 -0
  1670. package/extensions/twitch/index.ts +20 -0
  1671. package/extensions/twitch/node_modules/.bin/clawbrah +21 -0
  1672. package/extensions/twitch/node_modules/.bin/clawbrah.CMD +12 -0
  1673. package/extensions/twitch/node_modules/.bin/clawbrah.ps1 +41 -0
  1674. package/extensions/twitch/node_modules/.bin/openclaw +21 -0
  1675. package/extensions/twitch/node_modules/.bin/openclaw.CMD +12 -0
  1676. package/extensions/twitch/node_modules/.bin/openclaw.ps1 +41 -0
  1677. package/extensions/twitch/openclaw.plugin.json +9 -0
  1678. package/extensions/twitch/package.json +20 -0
  1679. package/extensions/twitch/src/access-control.test.ts +489 -0
  1680. package/extensions/twitch/src/access-control.ts +166 -0
  1681. package/extensions/twitch/src/actions.ts +173 -0
  1682. package/extensions/twitch/src/client-manager-registry.ts +115 -0
  1683. package/extensions/twitch/src/config-schema.ts +84 -0
  1684. package/extensions/twitch/src/config.test.ts +87 -0
  1685. package/extensions/twitch/src/config.ts +116 -0
  1686. package/extensions/twitch/src/monitor.ts +272 -0
  1687. package/extensions/twitch/src/onboarding.test.ts +311 -0
  1688. package/extensions/twitch/src/onboarding.ts +417 -0
  1689. package/extensions/twitch/src/outbound.test.ts +373 -0
  1690. package/extensions/twitch/src/outbound.ts +184 -0
  1691. package/extensions/twitch/src/plugin.test.ts +39 -0
  1692. package/extensions/twitch/src/plugin.ts +274 -0
  1693. package/extensions/twitch/src/probe.test.ts +195 -0
  1694. package/extensions/twitch/src/probe.ts +120 -0
  1695. package/extensions/twitch/src/resolver.ts +137 -0
  1696. package/extensions/twitch/src/runtime.ts +14 -0
  1697. package/extensions/twitch/src/send.test.ts +289 -0
  1698. package/extensions/twitch/src/send.ts +136 -0
  1699. package/extensions/twitch/src/status.test.ts +270 -0
  1700. package/extensions/twitch/src/status.ts +178 -0
  1701. package/extensions/twitch/src/token.test.ts +171 -0
  1702. package/extensions/twitch/src/token.ts +91 -0
  1703. package/extensions/twitch/src/twitch-client.test.ts +589 -0
  1704. package/extensions/twitch/src/twitch-client.ts +277 -0
  1705. package/extensions/twitch/src/types.ts +143 -0
  1706. package/extensions/twitch/src/utils/markdown.ts +98 -0
  1707. package/extensions/twitch/src/utils/twitch.ts +78 -0
  1708. package/extensions/twitch/test/setup.ts +7 -0
  1709. package/extensions/voice-call/CHANGELOG.md +115 -0
  1710. package/extensions/voice-call/README.md +139 -0
  1711. package/extensions/voice-call/index.ts +493 -0
  1712. package/extensions/voice-call/node_modules/.bin/clawbrah +21 -0
  1713. package/extensions/voice-call/node_modules/.bin/clawbrah.CMD +12 -0
  1714. package/extensions/voice-call/node_modules/.bin/clawbrah.ps1 +41 -0
  1715. package/extensions/voice-call/node_modules/.bin/openclaw +21 -0
  1716. package/extensions/voice-call/node_modules/.bin/openclaw.CMD +12 -0
  1717. package/extensions/voice-call/node_modules/.bin/openclaw.ps1 +41 -0
  1718. package/extensions/voice-call/openclaw.plugin.json +559 -0
  1719. package/extensions/voice-call/package.json +19 -0
  1720. package/extensions/voice-call/src/allowlist.ts +19 -0
  1721. package/extensions/voice-call/src/cli.ts +279 -0
  1722. package/extensions/voice-call/src/config.test.ts +234 -0
  1723. package/extensions/voice-call/src/config.ts +523 -0
  1724. package/extensions/voice-call/src/core-bridge.ts +159 -0
  1725. package/extensions/voice-call/src/manager/context.ts +21 -0
  1726. package/extensions/voice-call/src/manager/events.ts +188 -0
  1727. package/extensions/voice-call/src/manager/lookup.ts +35 -0
  1728. package/extensions/voice-call/src/manager/outbound.ts +275 -0
  1729. package/extensions/voice-call/src/manager/state.ts +48 -0
  1730. package/extensions/voice-call/src/manager/store.ts +91 -0
  1731. package/extensions/voice-call/src/manager/timers.ts +89 -0
  1732. package/extensions/voice-call/src/manager/twiml.ts +9 -0
  1733. package/extensions/voice-call/src/manager.test.ts +224 -0
  1734. package/extensions/voice-call/src/manager.ts +887 -0
  1735. package/extensions/voice-call/src/media-stream.test.ts +96 -0
  1736. package/extensions/voice-call/src/media-stream.ts +411 -0
  1737. package/extensions/voice-call/src/providers/base.ts +67 -0
  1738. package/extensions/voice-call/src/providers/index.ts +10 -0
  1739. package/extensions/voice-call/src/providers/mock.ts +165 -0
  1740. package/extensions/voice-call/src/providers/plivo.test.ts +27 -0
  1741. package/extensions/voice-call/src/providers/plivo.ts +515 -0
  1742. package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
  1743. package/extensions/voice-call/src/providers/telnyx.ts +371 -0
  1744. package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
  1745. package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
  1746. package/extensions/voice-call/src/providers/twilio/webhook.ts +32 -0
  1747. package/extensions/voice-call/src/providers/twilio.test.ts +60 -0
  1748. package/extensions/voice-call/src/providers/twilio.ts +626 -0
  1749. package/extensions/voice-call/src/response-generator.ts +158 -0
  1750. package/extensions/voice-call/src/runtime.ts +212 -0
  1751. package/extensions/voice-call/src/telephony-audio.ts +90 -0
  1752. package/extensions/voice-call/src/telephony-tts.ts +104 -0
  1753. package/extensions/voice-call/src/tunnel.ts +314 -0
  1754. package/extensions/voice-call/src/types.ts +272 -0
  1755. package/extensions/voice-call/src/utils.ts +14 -0
  1756. package/extensions/voice-call/src/voice-mapping.ts +67 -0
  1757. package/extensions/voice-call/src/webhook-security.test.ts +377 -0
  1758. package/extensions/voice-call/src/webhook-security.ts +689 -0
  1759. package/extensions/voice-call/src/webhook.ts +491 -0
  1760. package/extensions/whatsapp/index.ts +17 -0
  1761. package/extensions/whatsapp/node_modules/.bin/clawbrah +21 -0
  1762. package/extensions/whatsapp/node_modules/.bin/clawbrah.CMD +12 -0
  1763. package/extensions/whatsapp/node_modules/.bin/clawbrah.ps1 +41 -0
  1764. package/extensions/whatsapp/node_modules/.bin/openclaw +21 -0
  1765. package/extensions/whatsapp/node_modules/.bin/openclaw.CMD +12 -0
  1766. package/extensions/whatsapp/node_modules/.bin/openclaw.ps1 +41 -0
  1767. package/extensions/whatsapp/openclaw.plugin.json +9 -0
  1768. package/extensions/whatsapp/package.json +14 -0
  1769. package/extensions/whatsapp/src/channel.ts +508 -0
  1770. package/extensions/whatsapp/src/runtime.ts +14 -0
  1771. package/extensions/zalo/CHANGELOG.md +95 -0
  1772. package/extensions/zalo/README.md +50 -0
  1773. package/extensions/zalo/index.ts +19 -0
  1774. package/extensions/zalo/node_modules/.bin/clawbrah +21 -0
  1775. package/extensions/zalo/node_modules/.bin/clawbrah.CMD +12 -0
  1776. package/extensions/zalo/node_modules/.bin/clawbrah.ps1 +41 -0
  1777. package/extensions/zalo/node_modules/.bin/openclaw +21 -0
  1778. package/extensions/zalo/node_modules/.bin/openclaw.CMD +12 -0
  1779. package/extensions/zalo/node_modules/.bin/openclaw.ps1 +41 -0
  1780. package/extensions/zalo/openclaw.plugin.json +9 -0
  1781. package/extensions/zalo/package.json +36 -0
  1782. package/extensions/zalo/src/accounts.ts +80 -0
  1783. package/extensions/zalo/src/actions.ts +67 -0
  1784. package/extensions/zalo/src/api.ts +208 -0
  1785. package/extensions/zalo/src/channel.directory.test.ts +43 -0
  1786. package/extensions/zalo/src/channel.ts +414 -0
  1787. package/extensions/zalo/src/config-schema.ts +25 -0
  1788. package/extensions/zalo/src/monitor.ts +764 -0
  1789. package/extensions/zalo/src/monitor.webhook.test.ts +73 -0
  1790. package/extensions/zalo/src/onboarding.ts +401 -0
  1791. package/extensions/zalo/src/probe.ts +46 -0
  1792. package/extensions/zalo/src/proxy.ts +21 -0
  1793. package/extensions/zalo/src/runtime.ts +14 -0
  1794. package/extensions/zalo/src/send.ts +124 -0
  1795. package/extensions/zalo/src/status-issues.ts +53 -0
  1796. package/extensions/zalo/src/token.ts +63 -0
  1797. package/extensions/zalo/src/types.ts +44 -0
  1798. package/extensions/zalouser/CHANGELOG.md +67 -0
  1799. package/extensions/zalouser/README.md +225 -0
  1800. package/extensions/zalouser/index.ts +31 -0
  1801. package/extensions/zalouser/node_modules/.bin/clawbrah +21 -0
  1802. package/extensions/zalouser/node_modules/.bin/clawbrah.CMD +12 -0
  1803. package/extensions/zalouser/node_modules/.bin/clawbrah.ps1 +41 -0
  1804. package/extensions/zalouser/node_modules/.bin/openclaw +21 -0
  1805. package/extensions/zalouser/node_modules/.bin/openclaw.CMD +12 -0
  1806. package/extensions/zalouser/node_modules/.bin/openclaw.ps1 +41 -0
  1807. package/extensions/zalouser/openclaw.plugin.json +9 -0
  1808. package/extensions/zalouser/package.json +36 -0
  1809. package/extensions/zalouser/src/accounts.ts +135 -0
  1810. package/extensions/zalouser/src/channel.test.ts +18 -0
  1811. package/extensions/zalouser/src/channel.ts +686 -0
  1812. package/extensions/zalouser/src/config-schema.ts +28 -0
  1813. package/extensions/zalouser/src/monitor.ts +601 -0
  1814. package/extensions/zalouser/src/onboarding.ts +504 -0
  1815. package/extensions/zalouser/src/probe.ts +28 -0
  1816. package/extensions/zalouser/src/runtime.ts +14 -0
  1817. package/extensions/zalouser/src/send.ts +160 -0
  1818. package/extensions/zalouser/src/status-issues.test.ts +57 -0
  1819. package/extensions/zalouser/src/status-issues.ts +89 -0
  1820. package/extensions/zalouser/src/tool.ts +164 -0
  1821. package/extensions/zalouser/src/types.ts +110 -0
  1822. package/extensions/zalouser/src/zca.ts +202 -0
  1823. package/openclaw.mjs +14 -0
  1824. package/package.json +228 -0
  1825. package/skills/1password/SKILL.md +70 -0
  1826. package/skills/1password/references/cli-examples.md +29 -0
  1827. package/skills/1password/references/get-started.md +17 -0
  1828. package/skills/apple-notes/SKILL.md +77 -0
  1829. package/skills/apple-reminders/SKILL.md +96 -0
  1830. package/skills/bear-notes/SKILL.md +107 -0
  1831. package/skills/bird/SKILL.md +224 -0
  1832. package/skills/blogwatcher/SKILL.md +69 -0
  1833. package/skills/blucli/SKILL.md +47 -0
  1834. package/skills/bluebubbles/SKILL.md +131 -0
  1835. package/skills/camsnap/SKILL.md +45 -0
  1836. package/skills/canvas/SKILL.md +198 -0
  1837. package/skills/clawhub/SKILL.md +77 -0
  1838. package/skills/coding-agent/SKILL.md +284 -0
  1839. package/skills/discord/SKILL.md +578 -0
  1840. package/skills/eightctl/SKILL.md +50 -0
  1841. package/skills/food-order/SKILL.md +48 -0
  1842. package/skills/gemini/SKILL.md +43 -0
  1843. package/skills/gifgrep/SKILL.md +79 -0
  1844. package/skills/github/SKILL.md +77 -0
  1845. package/skills/gog/SKILL.md +116 -0
  1846. package/skills/goplaces/SKILL.md +52 -0
  1847. package/skills/healthcheck/SKILL.md +245 -0
  1848. package/skills/himalaya/SKILL.md +257 -0
  1849. package/skills/himalaya/references/configuration.md +184 -0
  1850. package/skills/himalaya/references/message-composition.md +199 -0
  1851. package/skills/imsg/SKILL.md +74 -0
  1852. package/skills/local-places/SERVER_README.md +101 -0
  1853. package/skills/local-places/SKILL.md +102 -0
  1854. package/skills/local-places/pyproject.toml +21 -0
  1855. package/skills/local-places/src/local_places/__init__.py +2 -0
  1856. package/skills/local-places/src/local_places/google_places.py +314 -0
  1857. package/skills/local-places/src/local_places/main.py +65 -0
  1858. package/skills/local-places/src/local_places/schemas.py +107 -0
  1859. package/skills/mcporter/SKILL.md +61 -0
  1860. package/skills/model-usage/SKILL.md +69 -0
  1861. package/skills/model-usage/references/codexbar-cli.md +33 -0
  1862. package/skills/model-usage/scripts/model_usage.py +310 -0
  1863. package/skills/nano-banana-pro/SKILL.md +58 -0
  1864. package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
  1865. package/skills/nano-pdf/SKILL.md +38 -0
  1866. package/skills/notion/SKILL.md +172 -0
  1867. package/skills/obsidian/SKILL.md +81 -0
  1868. package/skills/openai-image-gen/SKILL.md +89 -0
  1869. package/skills/openai-image-gen/scripts/gen.py +240 -0
  1870. package/skills/openai-whisper/SKILL.md +38 -0
  1871. package/skills/openai-whisper-api/SKILL.md +52 -0
  1872. package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
  1873. package/skills/openhue/SKILL.md +51 -0
  1874. package/skills/oracle/SKILL.md +125 -0
  1875. package/skills/ordercli/SKILL.md +78 -0
  1876. package/skills/peekaboo/SKILL.md +190 -0
  1877. package/skills/sag/SKILL.md +87 -0
  1878. package/skills/session-logs/SKILL.md +115 -0
  1879. package/skills/sherpa-onnx-tts/SKILL.md +103 -0
  1880. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1881. package/skills/skill-creator/SKILL.md +370 -0
  1882. package/skills/skill-creator/license.txt +202 -0
  1883. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1884. package/skills/skill-creator/scripts/package_skill.py +111 -0
  1885. package/skills/skill-creator/scripts/quick_validate.py +101 -0
  1886. package/skills/slack/SKILL.md +144 -0
  1887. package/skills/songsee/SKILL.md +49 -0
  1888. package/skills/sonoscli/SKILL.md +46 -0
  1889. package/skills/spotify-player/SKILL.md +64 -0
  1890. package/skills/summarize/SKILL.md +87 -0
  1891. package/skills/things-mac/SKILL.md +86 -0
  1892. package/skills/tmux/SKILL.md +135 -0
  1893. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1894. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1895. package/skills/trello/SKILL.md +95 -0
  1896. package/skills/video-frames/SKILL.md +46 -0
  1897. package/skills/video-frames/scripts/frame.sh +81 -0
  1898. package/skills/voice-call/SKILL.md +45 -0
  1899. package/skills/wacli/SKILL.md +72 -0
  1900. package/skills/weather/SKILL.md +54 -0
@@ -0,0 +1,2671 @@
1
+ import { W as resolveGatewayPort, f as visibleWidth } from "./entry.js";
2
+ import { _ as parseAgentSessionKey, c as normalizeAgentId, i as buildAgentMainSessionKey, l as normalizeMainKey } from "./session-key-Dm2EOhrH.js";
3
+ import { c as resolveDefaultAgentId } from "./agent-scope-CbEuCv2l.js";
4
+ import { i as loadConfig, j as VERSION } from "./config-Ddbeba_Z.js";
5
+ import { Ct as PROTOCOL_VERSION, t as GatewayClient } from "./client-DyaYZBTP.js";
6
+ import { a as resolveExplicitGatewayAuth, r as ensureExplicitGatewayAuth } from "./call-Bykpt9_M.js";
7
+ import { f as GATEWAY_CLIENT_CAPS, h as GATEWAY_CLIENT_NAMES, m as GATEWAY_CLIENT_MODES } from "./message-channel-C3TK8GwV.js";
8
+ import { I as listThinkingLevelLabels, P as formatThinkingLevels, U as resolveResponseUsageMode, V as normalizeUsageDisplay } from "./pi-embedded-helpers-BpYQcZB0.js";
9
+ import { a as extractContentFromMessage, c as formatContextUsageLine, d as resolveFinalAssistantText, h as listChatCommandsForConfig, i as composeThinkingAndContent, l as formatTokens, m as listChatCommands, n as formatAge, o as extractTextFromMessage, r as asString, s as extractThinkingFromMessage, u as isCommandMessage } from "./channel-summary-DZDiZAGl.js";
10
+ import { n as resolveToolDisplay, t as formatToolDetail } from "./tool-display-CeXLhfq_.js";
11
+ import { n as formatTokenCount } from "./usage-format-Bhl_WCWP.js";
12
+ import { spawn } from "node:child_process";
13
+ import chalk from "chalk";
14
+ import { randomUUID } from "node:crypto";
15
+ import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, getEditorKeybindings, isKeyRelease, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
16
+ import { highlight, supportsLanguage } from "cli-highlight";
17
+
18
+ //#region src/tui/commands.ts
19
+ const VERBOSE_LEVELS = ["on", "off"];
20
+ const REASONING_LEVELS = ["on", "off"];
21
+ const ELEVATED_LEVELS = [
22
+ "on",
23
+ "off",
24
+ "ask",
25
+ "full"
26
+ ];
27
+ const ACTIVATION_LEVELS = ["mention", "always"];
28
+ const USAGE_FOOTER_LEVELS = [
29
+ "off",
30
+ "tokens",
31
+ "full"
32
+ ];
33
+ const COMMAND_ALIASES = { elev: "elevated" };
34
+ function parseCommand(input) {
35
+ const trimmed = input.replace(/^\//, "").trim();
36
+ if (!trimmed) return {
37
+ name: "",
38
+ args: ""
39
+ };
40
+ const [name, ...rest] = trimmed.split(/\s+/);
41
+ const normalized = name.toLowerCase();
42
+ return {
43
+ name: COMMAND_ALIASES[normalized] ?? normalized,
44
+ args: rest.join(" ").trim()
45
+ };
46
+ }
47
+ function getSlashCommands(options = {}) {
48
+ const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
49
+ const commands = [
50
+ {
51
+ name: "help",
52
+ description: "Show slash command help"
53
+ },
54
+ {
55
+ name: "status",
56
+ description: "Show gateway status summary"
57
+ },
58
+ {
59
+ name: "agent",
60
+ description: "Switch agent (or open picker)"
61
+ },
62
+ {
63
+ name: "agents",
64
+ description: "Open agent picker"
65
+ },
66
+ {
67
+ name: "session",
68
+ description: "Switch session (or open picker)"
69
+ },
70
+ {
71
+ name: "sessions",
72
+ description: "Open session picker"
73
+ },
74
+ {
75
+ name: "model",
76
+ description: "Set model (or open picker)"
77
+ },
78
+ {
79
+ name: "models",
80
+ description: "Open model picker"
81
+ },
82
+ {
83
+ name: "think",
84
+ description: "Set thinking level",
85
+ getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
86
+ value,
87
+ label: value
88
+ }))
89
+ },
90
+ {
91
+ name: "verbose",
92
+ description: "Set verbose on/off",
93
+ getArgumentCompletions: (prefix) => VERBOSE_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
94
+ value,
95
+ label: value
96
+ }))
97
+ },
98
+ {
99
+ name: "reasoning",
100
+ description: "Set reasoning on/off",
101
+ getArgumentCompletions: (prefix) => REASONING_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
102
+ value,
103
+ label: value
104
+ }))
105
+ },
106
+ {
107
+ name: "usage",
108
+ description: "Toggle per-response usage line",
109
+ getArgumentCompletions: (prefix) => USAGE_FOOTER_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
110
+ value,
111
+ label: value
112
+ }))
113
+ },
114
+ {
115
+ name: "elevated",
116
+ description: "Set elevated on/off/ask/full",
117
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
118
+ value,
119
+ label: value
120
+ }))
121
+ },
122
+ {
123
+ name: "elev",
124
+ description: "Alias for /elevated",
125
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
126
+ value,
127
+ label: value
128
+ }))
129
+ },
130
+ {
131
+ name: "activation",
132
+ description: "Set group activation",
133
+ getArgumentCompletions: (prefix) => ACTIVATION_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
134
+ value,
135
+ label: value
136
+ }))
137
+ },
138
+ {
139
+ name: "abort",
140
+ description: "Abort active run"
141
+ },
142
+ {
143
+ name: "new",
144
+ description: "Reset the session"
145
+ },
146
+ {
147
+ name: "reset",
148
+ description: "Reset the session"
149
+ },
150
+ {
151
+ name: "settings",
152
+ description: "Open settings"
153
+ },
154
+ {
155
+ name: "exit",
156
+ description: "Exit the TUI"
157
+ },
158
+ {
159
+ name: "quit",
160
+ description: "Exit the TUI"
161
+ }
162
+ ];
163
+ const seen = new Set(commands.map((command) => command.name));
164
+ const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
165
+ for (const command of gatewayCommands) {
166
+ const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
167
+ for (const alias of aliases) {
168
+ const name = alias.replace(/^\//, "").trim();
169
+ if (!name || seen.has(name)) continue;
170
+ seen.add(name);
171
+ commands.push({
172
+ name,
173
+ description: command.description
174
+ });
175
+ }
176
+ }
177
+ return commands;
178
+ }
179
+ function helpText(options = {}) {
180
+ return [
181
+ "Slash commands:",
182
+ "/help",
183
+ "/commands",
184
+ "/status",
185
+ "/agent <id> (or /agents)",
186
+ "/session <key> (or /sessions)",
187
+ "/model <provider/model> (or /models)",
188
+ `/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
189
+ "/verbose <on|off>",
190
+ "/reasoning <on|off>",
191
+ "/usage <off|tokens|full>",
192
+ "/elevated <on|off|ask|full>",
193
+ "/elev <on|off|ask|full>",
194
+ "/activation <mention|always>",
195
+ "/new or /reset",
196
+ "/abort",
197
+ "/settings",
198
+ "/exit"
199
+ ].join("\n");
200
+ }
201
+
202
+ //#endregion
203
+ //#region src/tui/theme/syntax-theme.ts
204
+ /**
205
+ * Syntax highlighting theme for code blocks.
206
+ * Uses chalk functions to style different token types.
207
+ */
208
+ function createSyntaxTheme(fallback) {
209
+ return {
210
+ keyword: chalk.hex("#C586C0"),
211
+ built_in: chalk.hex("#4EC9B0"),
212
+ type: chalk.hex("#4EC9B0"),
213
+ literal: chalk.hex("#569CD6"),
214
+ number: chalk.hex("#B5CEA8"),
215
+ string: chalk.hex("#CE9178"),
216
+ regexp: chalk.hex("#D16969"),
217
+ symbol: chalk.hex("#B5CEA8"),
218
+ class: chalk.hex("#4EC9B0"),
219
+ function: chalk.hex("#DCDCAA"),
220
+ title: chalk.hex("#DCDCAA"),
221
+ params: chalk.hex("#9CDCFE"),
222
+ comment: chalk.hex("#6A9955"),
223
+ doctag: chalk.hex("#608B4E"),
224
+ meta: chalk.hex("#9CDCFE"),
225
+ "meta-keyword": chalk.hex("#C586C0"),
226
+ "meta-string": chalk.hex("#CE9178"),
227
+ section: chalk.hex("#DCDCAA"),
228
+ tag: chalk.hex("#569CD6"),
229
+ name: chalk.hex("#9CDCFE"),
230
+ attr: chalk.hex("#9CDCFE"),
231
+ attribute: chalk.hex("#9CDCFE"),
232
+ variable: chalk.hex("#9CDCFE"),
233
+ bullet: chalk.hex("#D7BA7D"),
234
+ code: chalk.hex("#CE9178"),
235
+ emphasis: chalk.italic,
236
+ strong: chalk.bold,
237
+ formula: chalk.hex("#C586C0"),
238
+ link: chalk.hex("#4EC9B0"),
239
+ quote: chalk.hex("#6A9955"),
240
+ addition: chalk.hex("#B5CEA8"),
241
+ deletion: chalk.hex("#F44747"),
242
+ "selector-tag": chalk.hex("#D7BA7D"),
243
+ "selector-id": chalk.hex("#D7BA7D"),
244
+ "selector-class": chalk.hex("#D7BA7D"),
245
+ "selector-attr": chalk.hex("#D7BA7D"),
246
+ "selector-pseudo": chalk.hex("#D7BA7D"),
247
+ "template-tag": chalk.hex("#C586C0"),
248
+ "template-variable": chalk.hex("#9CDCFE"),
249
+ default: fallback
250
+ };
251
+ }
252
+
253
+ //#endregion
254
+ //#region src/tui/theme/theme.ts
255
+ const palette = {
256
+ text: "#E8E3D5",
257
+ dim: "#7B7F87",
258
+ accent: "#F6C453",
259
+ accentSoft: "#F2A65A",
260
+ border: "#3C414B",
261
+ userBg: "#2B2F36",
262
+ userText: "#F3EEE0",
263
+ systemText: "#9BA3B2",
264
+ toolPendingBg: "#1F2A2F",
265
+ toolSuccessBg: "#1E2D23",
266
+ toolErrorBg: "#2F1F1F",
267
+ toolTitle: "#F6C453",
268
+ toolOutput: "#E1DACB",
269
+ quote: "#8CC8FF",
270
+ quoteBorder: "#3B4D6B",
271
+ code: "#F0C987",
272
+ codeBlock: "#1E232A",
273
+ codeBorder: "#343A45",
274
+ link: "#7DD3A5",
275
+ error: "#F97066",
276
+ success: "#7DD3A5"
277
+ };
278
+ const fg = (hex) => (text) => chalk.hex(hex)(text);
279
+ const bg = (hex) => (text) => chalk.bgHex(hex)(text);
280
+ const syntaxTheme = createSyntaxTheme(fg(palette.code));
281
+ /**
282
+ * Highlight code with syntax coloring.
283
+ * Returns an array of lines with ANSI escape codes.
284
+ */
285
+ function highlightCode(code, lang) {
286
+ try {
287
+ return highlight(code, {
288
+ language: lang && supportsLanguage(lang) ? lang : void 0,
289
+ theme: syntaxTheme,
290
+ ignoreIllegals: true
291
+ }).split("\n");
292
+ } catch {
293
+ return code.split("\n").map((line) => fg(palette.code)(line));
294
+ }
295
+ }
296
+ const theme = {
297
+ fg: fg(palette.text),
298
+ dim: fg(palette.dim),
299
+ accent: fg(palette.accent),
300
+ accentSoft: fg(palette.accentSoft),
301
+ success: fg(palette.success),
302
+ error: fg(palette.error),
303
+ header: (text) => chalk.bold(fg(palette.accent)(text)),
304
+ system: fg(palette.systemText),
305
+ userBg: bg(palette.userBg),
306
+ userText: fg(palette.userText),
307
+ toolTitle: fg(palette.toolTitle),
308
+ toolOutput: fg(palette.toolOutput),
309
+ toolPendingBg: bg(palette.toolPendingBg),
310
+ toolSuccessBg: bg(palette.toolSuccessBg),
311
+ toolErrorBg: bg(palette.toolErrorBg),
312
+ border: fg(palette.border),
313
+ bold: (text) => chalk.bold(text),
314
+ italic: (text) => chalk.italic(text)
315
+ };
316
+ const markdownTheme = {
317
+ heading: (text) => chalk.bold(fg(palette.accent)(text)),
318
+ link: (text) => fg(palette.link)(text),
319
+ linkUrl: (text) => chalk.dim(text),
320
+ code: (text) => fg(palette.code)(text),
321
+ codeBlock: (text) => fg(palette.code)(text),
322
+ codeBlockBorder: (text) => fg(palette.codeBorder)(text),
323
+ quote: (text) => fg(palette.quote)(text),
324
+ quoteBorder: (text) => fg(palette.quoteBorder)(text),
325
+ hr: (text) => fg(palette.border)(text),
326
+ listBullet: (text) => fg(palette.accentSoft)(text),
327
+ bold: (text) => chalk.bold(text),
328
+ italic: (text) => chalk.italic(text),
329
+ strikethrough: (text) => chalk.strikethrough(text),
330
+ underline: (text) => chalk.underline(text),
331
+ highlightCode
332
+ };
333
+ const selectListTheme = {
334
+ selectedPrefix: (text) => fg(palette.accent)(text),
335
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
336
+ description: (text) => fg(palette.dim)(text),
337
+ scrollInfo: (text) => fg(palette.dim)(text),
338
+ noMatch: (text) => fg(palette.dim)(text)
339
+ };
340
+ const filterableSelectListTheme = {
341
+ ...selectListTheme,
342
+ filterLabel: (text) => fg(palette.dim)(text)
343
+ };
344
+ const settingsListTheme = {
345
+ label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
346
+ value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
347
+ description: (text) => fg(palette.systemText)(text),
348
+ cursor: fg(palette.accent)("→ "),
349
+ hint: (text) => fg(palette.dim)(text)
350
+ };
351
+ const editorTheme = {
352
+ borderColor: (text) => fg(palette.border)(text),
353
+ selectList: selectListTheme
354
+ };
355
+ const searchableSelectListTheme = {
356
+ selectedPrefix: (text) => fg(palette.accent)(text),
357
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
358
+ description: (text) => fg(palette.dim)(text),
359
+ scrollInfo: (text) => fg(palette.dim)(text),
360
+ noMatch: (text) => fg(palette.dim)(text),
361
+ searchPrompt: (text) => fg(palette.accentSoft)(text),
362
+ searchInput: (text) => fg(palette.text)(text),
363
+ matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
364
+ };
365
+
366
+ //#endregion
367
+ //#region src/tui/components/assistant-message.ts
368
+ var AssistantMessageComponent = class extends Container {
369
+ constructor(text) {
370
+ super();
371
+ this.body = new Markdown(text, 1, 0, markdownTheme, { color: (line) => theme.fg(line) });
372
+ this.addChild(new Spacer(1));
373
+ this.addChild(this.body);
374
+ }
375
+ setText(text) {
376
+ this.body.setText(text);
377
+ }
378
+ };
379
+
380
+ //#endregion
381
+ //#region src/tui/components/tool-execution.ts
382
+ const PREVIEW_LINES = 12;
383
+ function formatArgs(toolName, args) {
384
+ const detail = formatToolDetail(resolveToolDisplay({
385
+ name: toolName,
386
+ args
387
+ }));
388
+ if (detail) return detail;
389
+ if (!args || typeof args !== "object") return "";
390
+ try {
391
+ return JSON.stringify(args);
392
+ } catch {
393
+ return "";
394
+ }
395
+ }
396
+ function extractText(result) {
397
+ if (!result?.content) return "";
398
+ const lines = [];
399
+ for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(entry.text);
400
+ else if (entry.type === "image") {
401
+ const mime = entry.mimeType ?? "image";
402
+ const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
403
+ const omitted = entry.omitted ? " (omitted)" : "";
404
+ lines.push(`[${mime}${size}${omitted}]`);
405
+ }
406
+ return lines.join("\n").trim();
407
+ }
408
+ var ToolExecutionComponent = class extends Container {
409
+ constructor(toolName, args) {
410
+ super();
411
+ this.expanded = false;
412
+ this.isError = false;
413
+ this.isPartial = true;
414
+ this.toolName = toolName;
415
+ this.args = args;
416
+ this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
417
+ this.header = new Text("", 0, 0);
418
+ this.argsLine = new Text("", 0, 0);
419
+ this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
420
+ this.addChild(new Spacer(1));
421
+ this.addChild(this.box);
422
+ this.box.addChild(this.header);
423
+ this.box.addChild(this.argsLine);
424
+ this.box.addChild(this.output);
425
+ this.refresh();
426
+ }
427
+ setArgs(args) {
428
+ this.args = args;
429
+ this.refresh();
430
+ }
431
+ setExpanded(expanded) {
432
+ this.expanded = expanded;
433
+ this.refresh();
434
+ }
435
+ setResult(result, opts) {
436
+ this.result = result;
437
+ this.isPartial = false;
438
+ this.isError = Boolean(opts?.isError);
439
+ this.refresh();
440
+ }
441
+ setPartialResult(result) {
442
+ this.result = result;
443
+ this.isPartial = true;
444
+ this.refresh();
445
+ }
446
+ refresh() {
447
+ const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
448
+ this.box.setBgFn((line) => bg(line));
449
+ const display = resolveToolDisplay({
450
+ name: this.toolName,
451
+ args: this.args
452
+ });
453
+ const title = `${display.emoji} ${display.label}${this.isPartial ? " (running)" : ""}`;
454
+ this.header.setText(theme.toolTitle(theme.bold(title)));
455
+ const argLine = formatArgs(this.toolName, this.args);
456
+ this.argsLine.setText(argLine ? theme.dim(argLine) : theme.dim(" "));
457
+ const text = extractText(this.result) || (this.isPartial ? "…" : "");
458
+ if (!this.expanded && text) {
459
+ const lines = text.split("\n");
460
+ const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
461
+ this.output.setText(preview);
462
+ } else this.output.setText(text);
463
+ }
464
+ };
465
+
466
+ //#endregion
467
+ //#region src/tui/components/user-message.ts
468
+ var UserMessageComponent = class extends Container {
469
+ constructor(text) {
470
+ super();
471
+ this.body = new Markdown(text, 1, 1, markdownTheme, {
472
+ bgColor: (line) => theme.userBg(line),
473
+ color: (line) => theme.userText(line)
474
+ });
475
+ this.addChild(new Spacer(1));
476
+ this.addChild(this.body);
477
+ }
478
+ setText(text) {
479
+ this.body.setText(text);
480
+ }
481
+ };
482
+
483
+ //#endregion
484
+ //#region src/tui/components/chat-log.ts
485
+ var ChatLog = class extends Container {
486
+ constructor(..._args) {
487
+ super(..._args);
488
+ this.toolById = /* @__PURE__ */ new Map();
489
+ this.streamingRuns = /* @__PURE__ */ new Map();
490
+ this.toolsExpanded = false;
491
+ }
492
+ clearAll() {
493
+ this.clear();
494
+ this.toolById.clear();
495
+ this.streamingRuns.clear();
496
+ }
497
+ addSystem(text) {
498
+ this.addChild(new Spacer(1));
499
+ this.addChild(new Text(theme.system(text), 1, 0));
500
+ }
501
+ addUser(text) {
502
+ this.addChild(new UserMessageComponent(text));
503
+ }
504
+ resolveRunId(runId) {
505
+ return runId ?? "default";
506
+ }
507
+ startAssistant(text, runId) {
508
+ const component = new AssistantMessageComponent(text);
509
+ this.streamingRuns.set(this.resolveRunId(runId), component);
510
+ this.addChild(component);
511
+ return component;
512
+ }
513
+ updateAssistant(text, runId) {
514
+ const effectiveRunId = this.resolveRunId(runId);
515
+ const existing = this.streamingRuns.get(effectiveRunId);
516
+ if (!existing) {
517
+ this.startAssistant(text, runId);
518
+ return;
519
+ }
520
+ existing.setText(text);
521
+ }
522
+ finalizeAssistant(text, runId) {
523
+ const effectiveRunId = this.resolveRunId(runId);
524
+ const existing = this.streamingRuns.get(effectiveRunId);
525
+ if (existing) {
526
+ existing.setText(text);
527
+ this.streamingRuns.delete(effectiveRunId);
528
+ return;
529
+ }
530
+ this.addChild(new AssistantMessageComponent(text));
531
+ }
532
+ startTool(toolCallId, toolName, args) {
533
+ const existing = this.toolById.get(toolCallId);
534
+ if (existing) {
535
+ existing.setArgs(args);
536
+ return existing;
537
+ }
538
+ const component = new ToolExecutionComponent(toolName, args);
539
+ component.setExpanded(this.toolsExpanded);
540
+ this.toolById.set(toolCallId, component);
541
+ this.addChild(component);
542
+ return component;
543
+ }
544
+ updateToolArgs(toolCallId, args) {
545
+ const existing = this.toolById.get(toolCallId);
546
+ if (!existing) return;
547
+ existing.setArgs(args);
548
+ }
549
+ updateToolResult(toolCallId, result, opts) {
550
+ const existing = this.toolById.get(toolCallId);
551
+ if (!existing) return;
552
+ if (opts?.partial) {
553
+ existing.setPartialResult(result);
554
+ return;
555
+ }
556
+ existing.setResult(result, { isError: opts?.isError });
557
+ }
558
+ setToolsExpanded(expanded) {
559
+ this.toolsExpanded = expanded;
560
+ for (const tool of this.toolById.values()) tool.setExpanded(expanded);
561
+ }
562
+ };
563
+
564
+ //#endregion
565
+ //#region src/tui/components/custom-editor.ts
566
+ var CustomEditor = class extends Editor {
567
+ handleInput(data) {
568
+ if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
569
+ this.onAltEnter();
570
+ return;
571
+ }
572
+ if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
573
+ this.onCtrlL();
574
+ return;
575
+ }
576
+ if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
577
+ this.onCtrlO();
578
+ return;
579
+ }
580
+ if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
581
+ this.onCtrlP();
582
+ return;
583
+ }
584
+ if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
585
+ this.onCtrlG();
586
+ return;
587
+ }
588
+ if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
589
+ this.onCtrlT();
590
+ return;
591
+ }
592
+ if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
593
+ this.onShiftTab();
594
+ return;
595
+ }
596
+ if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
597
+ this.onEscape();
598
+ return;
599
+ }
600
+ if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
601
+ this.onCtrlC();
602
+ return;
603
+ }
604
+ if (matchesKey(data, Key.ctrl("d"))) {
605
+ if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
606
+ return;
607
+ }
608
+ super.handleInput(data);
609
+ }
610
+ };
611
+
612
+ //#endregion
613
+ //#region src/tui/gateway-chat.ts
614
+ var GatewayChatClient = class {
615
+ constructor(opts) {
616
+ const resolved = resolveGatewayConnection(opts);
617
+ this.connection = resolved;
618
+ this.readyPromise = new Promise((resolve) => {
619
+ this.resolveReady = resolve;
620
+ });
621
+ this.client = new GatewayClient({
622
+ url: resolved.url,
623
+ token: resolved.token,
624
+ password: resolved.password,
625
+ clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
626
+ clientDisplayName: "openclaw-tui",
627
+ clientVersion: VERSION,
628
+ platform: process.platform,
629
+ mode: GATEWAY_CLIENT_MODES.UI,
630
+ caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
631
+ instanceId: randomUUID(),
632
+ minProtocol: PROTOCOL_VERSION,
633
+ maxProtocol: PROTOCOL_VERSION,
634
+ onHelloOk: (hello) => {
635
+ this.hello = hello;
636
+ this.resolveReady?.();
637
+ this.onConnected?.();
638
+ },
639
+ onEvent: (evt) => {
640
+ this.onEvent?.({
641
+ event: evt.event,
642
+ payload: evt.payload,
643
+ seq: evt.seq
644
+ });
645
+ },
646
+ onClose: (_code, reason) => {
647
+ this.onDisconnected?.(reason);
648
+ },
649
+ onGap: (info) => {
650
+ this.onGap?.(info);
651
+ }
652
+ });
653
+ }
654
+ start() {
655
+ this.client.start();
656
+ }
657
+ stop() {
658
+ this.client.stop();
659
+ }
660
+ async waitForReady() {
661
+ await this.readyPromise;
662
+ }
663
+ async sendChat(opts) {
664
+ const runId = opts.runId ?? randomUUID();
665
+ await this.client.request("chat.send", {
666
+ sessionKey: opts.sessionKey,
667
+ message: opts.message,
668
+ thinking: opts.thinking,
669
+ deliver: opts.deliver,
670
+ timeoutMs: opts.timeoutMs,
671
+ idempotencyKey: runId
672
+ });
673
+ return { runId };
674
+ }
675
+ async abortChat(opts) {
676
+ return await this.client.request("chat.abort", {
677
+ sessionKey: opts.sessionKey,
678
+ runId: opts.runId
679
+ });
680
+ }
681
+ async loadHistory(opts) {
682
+ return await this.client.request("chat.history", {
683
+ sessionKey: opts.sessionKey,
684
+ limit: opts.limit
685
+ });
686
+ }
687
+ async listSessions(opts) {
688
+ return await this.client.request("sessions.list", {
689
+ limit: opts?.limit,
690
+ activeMinutes: opts?.activeMinutes,
691
+ includeGlobal: opts?.includeGlobal,
692
+ includeUnknown: opts?.includeUnknown,
693
+ includeDerivedTitles: opts?.includeDerivedTitles,
694
+ includeLastMessage: opts?.includeLastMessage,
695
+ agentId: opts?.agentId
696
+ });
697
+ }
698
+ async listAgents() {
699
+ return await this.client.request("agents.list", {});
700
+ }
701
+ async patchSession(opts) {
702
+ return await this.client.request("sessions.patch", opts);
703
+ }
704
+ async resetSession(key) {
705
+ return await this.client.request("sessions.reset", { key });
706
+ }
707
+ async getStatus() {
708
+ return await this.client.request("status");
709
+ }
710
+ async listModels() {
711
+ const res = await this.client.request("models.list");
712
+ return Array.isArray(res?.models) ? res.models : [];
713
+ }
714
+ };
715
+ function resolveGatewayConnection(opts) {
716
+ const config = loadConfig();
717
+ const isRemoteMode = config.gateway?.mode === "remote";
718
+ const remote = isRemoteMode ? config.gateway?.remote : void 0;
719
+ const authToken = config.gateway?.auth?.token;
720
+ const localPort = resolveGatewayPort(config);
721
+ const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
722
+ const explicitAuth = resolveExplicitGatewayAuth({
723
+ token: opts.token,
724
+ password: opts.password
725
+ });
726
+ ensureExplicitGatewayAuth({
727
+ urlOverride,
728
+ auth: explicitAuth,
729
+ errorHint: "Fix: pass --token or --password when using --url."
730
+ });
731
+ return {
732
+ url: urlOverride || (typeof remote?.url === "string" && remote.url.trim().length > 0 ? remote.url.trim() : void 0) || `ws://127.0.0.1:${localPort}`,
733
+ token: explicitAuth.token || (!urlOverride ? isRemoteMode ? typeof remote?.token === "string" && remote.token.trim().length > 0 ? remote.token.trim() : void 0 : process.env.OPENCLAW_GATEWAY_TOKEN?.trim() || (typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : void 0) : void 0),
734
+ password: explicitAuth.password || (!urlOverride ? process.env.OPENCLAW_GATEWAY_PASSWORD?.trim() || (typeof remote?.password === "string" && remote.password.trim().length > 0 ? remote.password.trim() : void 0) : void 0)
735
+ };
736
+ }
737
+
738
+ //#endregion
739
+ //#region src/utils/time-format.ts
740
+ function formatRelativeTime(timestamp) {
741
+ const diff = Date.now() - timestamp;
742
+ const seconds = Math.floor(diff / 1e3);
743
+ const minutes = Math.floor(seconds / 60);
744
+ const hours = Math.floor(minutes / 60);
745
+ const days = Math.floor(hours / 24);
746
+ if (seconds < 60) return "just now";
747
+ if (minutes < 60) return `${minutes}m ago`;
748
+ if (hours < 24) return `${hours}h ago`;
749
+ if (days === 1) return "Yesterday";
750
+ if (days < 7) return `${days}d ago`;
751
+ return new Date(timestamp).toLocaleDateString(void 0, {
752
+ month: "short",
753
+ day: "numeric"
754
+ });
755
+ }
756
+
757
+ //#endregion
758
+ //#region src/tui/components/fuzzy-filter.ts
759
+ /**
760
+ * Shared fuzzy filtering utilities for select list components.
761
+ */
762
+ /**
763
+ * Word boundary characters for matching.
764
+ */
765
+ const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
766
+ /**
767
+ * Check if position is at a word boundary.
768
+ */
769
+ function isWordBoundary(text, index) {
770
+ return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
771
+ }
772
+ /**
773
+ * Find index where query matches at a word boundary in text.
774
+ * Returns null if no match.
775
+ */
776
+ function findWordBoundaryIndex(text, query) {
777
+ if (!query) return null;
778
+ const textLower = text.toLowerCase();
779
+ const queryLower = query.toLowerCase();
780
+ const maxIndex = textLower.length - queryLower.length;
781
+ if (maxIndex < 0) return null;
782
+ for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
783
+ return null;
784
+ }
785
+ /**
786
+ * Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
787
+ * Returns score (lower = better) or null if no match.
788
+ */
789
+ function fuzzyMatchLower(queryLower, textLower) {
790
+ if (queryLower.length === 0) return 0;
791
+ if (queryLower.length > textLower.length) return null;
792
+ let queryIndex = 0;
793
+ let score = 0;
794
+ let lastMatchIndex = -1;
795
+ let consecutiveMatches = 0;
796
+ for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
797
+ const isAtWordBoundary = isWordBoundary(textLower, i);
798
+ if (lastMatchIndex === i - 1) {
799
+ consecutiveMatches++;
800
+ score -= consecutiveMatches * 5;
801
+ } else {
802
+ consecutiveMatches = 0;
803
+ if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
804
+ }
805
+ if (isAtWordBoundary) score -= 10;
806
+ score += i * .1;
807
+ lastMatchIndex = i;
808
+ queryIndex++;
809
+ }
810
+ return queryIndex < queryLower.length ? null : score;
811
+ }
812
+ /**
813
+ * Filter items using pre-lowercased searchTextLower field.
814
+ * Supports space-separated tokens (all must match).
815
+ */
816
+ function fuzzyFilterLower(items, queryLower) {
817
+ const trimmed = queryLower.trim();
818
+ if (!trimmed) return items;
819
+ const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
820
+ if (tokens.length === 0) return items;
821
+ const results = [];
822
+ for (const item of items) {
823
+ const text = item.searchTextLower ?? "";
824
+ let totalScore = 0;
825
+ let allMatch = true;
826
+ for (const token of tokens) {
827
+ const score = fuzzyMatchLower(token, text);
828
+ if (score !== null) totalScore += score;
829
+ else {
830
+ allMatch = false;
831
+ break;
832
+ }
833
+ }
834
+ if (allMatch) results.push({
835
+ item,
836
+ score: totalScore
837
+ });
838
+ }
839
+ results.sort((a, b) => a.score - b.score);
840
+ return results.map((r) => r.item);
841
+ }
842
+ /**
843
+ * Prepare items for fuzzy filtering by pre-computing lowercase search text.
844
+ */
845
+ function prepareSearchItems(items) {
846
+ return items.map((item) => {
847
+ const parts = [];
848
+ if (item.label) parts.push(item.label);
849
+ if (item.description) parts.push(item.description);
850
+ if (item.searchText) parts.push(item.searchText);
851
+ return {
852
+ ...item,
853
+ searchTextLower: parts.join(" ").toLowerCase()
854
+ };
855
+ });
856
+ }
857
+
858
+ //#endregion
859
+ //#region src/tui/components/filterable-select-list.ts
860
+ /**
861
+ * Combines text input filtering with a select list.
862
+ * User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
863
+ */
864
+ var FilterableSelectList = class {
865
+ constructor(items, maxVisible, theme) {
866
+ this.filterText = "";
867
+ this.allItems = prepareSearchItems(items);
868
+ this.maxVisible = maxVisible;
869
+ this.theme = theme;
870
+ this.input = new Input();
871
+ this.selectList = new SelectList(this.allItems, maxVisible, theme);
872
+ }
873
+ applyFilter() {
874
+ const queryLower = this.filterText.toLowerCase();
875
+ if (!queryLower.trim()) {
876
+ this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
877
+ return;
878
+ }
879
+ this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
880
+ }
881
+ invalidate() {
882
+ this.input.invalidate();
883
+ this.selectList.invalidate();
884
+ }
885
+ render(width) {
886
+ const lines = [];
887
+ const filterLabel = this.theme.filterLabel("Filter: ");
888
+ const inputText = this.input.render(width - 8)[0] ?? "";
889
+ lines.push(filterLabel + inputText);
890
+ lines.push(chalk.dim("─".repeat(Math.max(0, width))));
891
+ const listLines = this.selectList.render(width);
892
+ lines.push(...listLines);
893
+ return lines;
894
+ }
895
+ handleInput(keyData) {
896
+ const allowVimNav = !this.filterText.trim();
897
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
898
+ this.selectList.handleInput("\x1B[A");
899
+ return;
900
+ }
901
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
902
+ this.selectList.handleInput("\x1B[B");
903
+ return;
904
+ }
905
+ if (matchesKey(keyData, "enter")) {
906
+ const selected = this.selectList.getSelectedItem();
907
+ if (selected) this.onSelect?.(selected);
908
+ return;
909
+ }
910
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
911
+ if (this.filterText) {
912
+ this.filterText = "";
913
+ this.input.setValue("");
914
+ this.applyFilter();
915
+ } else this.onCancel?.();
916
+ return;
917
+ }
918
+ const prevValue = this.input.getValue();
919
+ this.input.handleInput(keyData);
920
+ const newValue = this.input.getValue();
921
+ if (newValue !== prevValue) {
922
+ this.filterText = newValue;
923
+ this.applyFilter();
924
+ }
925
+ }
926
+ getSelectedItem() {
927
+ return this.selectList.getSelectedItem();
928
+ }
929
+ getFilterText() {
930
+ return this.filterText;
931
+ }
932
+ };
933
+
934
+ //#endregion
935
+ //#region src/tui/components/searchable-select-list.ts
936
+ /**
937
+ * A select list with a search input at the top for fuzzy filtering.
938
+ */
939
+ var SearchableSelectList = class {
940
+ constructor(items, maxVisible, theme) {
941
+ this.selectedIndex = 0;
942
+ this.regexCache = /* @__PURE__ */ new Map();
943
+ this.compareByScore = (a, b) => {
944
+ if (a.tier !== b.tier) return a.tier - b.tier;
945
+ if (a.score !== b.score) return a.score - b.score;
946
+ return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
947
+ };
948
+ this.items = items;
949
+ this.filteredItems = items;
950
+ this.maxVisible = maxVisible;
951
+ this.theme = theme;
952
+ this.searchInput = new Input();
953
+ }
954
+ getCachedRegex(pattern) {
955
+ let regex = this.regexCache.get(pattern);
956
+ if (!regex) {
957
+ regex = new RegExp(this.escapeRegex(pattern), "gi");
958
+ this.regexCache.set(pattern, regex);
959
+ }
960
+ return regex;
961
+ }
962
+ updateFilter() {
963
+ const query = this.searchInput.getValue().trim();
964
+ if (!query) this.filteredItems = this.items;
965
+ else this.filteredItems = this.smartFilter(query);
966
+ this.selectedIndex = 0;
967
+ this.notifySelectionChange();
968
+ }
969
+ /**
970
+ * Smart filtering that prioritizes:
971
+ * 1. Exact substring match in label (highest priority)
972
+ * 2. Word-boundary prefix match in label
973
+ * 3. Exact substring in description
974
+ * 4. Fuzzy match (lowest priority)
975
+ */
976
+ smartFilter(query) {
977
+ const q = query.toLowerCase();
978
+ const scoredItems = [];
979
+ const fuzzyCandidates = [];
980
+ for (const item of this.items) {
981
+ const label = item.label.toLowerCase();
982
+ const desc = (item.description ?? "").toLowerCase();
983
+ const labelIndex = label.indexOf(q);
984
+ if (labelIndex !== -1) {
985
+ scoredItems.push({
986
+ item,
987
+ tier: 0,
988
+ score: labelIndex
989
+ });
990
+ continue;
991
+ }
992
+ const wordBoundaryIndex = findWordBoundaryIndex(label, q);
993
+ if (wordBoundaryIndex !== null) {
994
+ scoredItems.push({
995
+ item,
996
+ tier: 1,
997
+ score: wordBoundaryIndex
998
+ });
999
+ continue;
1000
+ }
1001
+ const descIndex = desc.indexOf(q);
1002
+ if (descIndex !== -1) {
1003
+ scoredItems.push({
1004
+ item,
1005
+ tier: 2,
1006
+ score: descIndex
1007
+ });
1008
+ continue;
1009
+ }
1010
+ fuzzyCandidates.push(item);
1011
+ }
1012
+ scoredItems.sort(this.compareByScore);
1013
+ const fuzzyMatches = fuzzyFilterLower(prepareSearchItems(fuzzyCandidates), q);
1014
+ return [...scoredItems.map((s) => s.item), ...fuzzyMatches];
1015
+ }
1016
+ escapeRegex(str) {
1017
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1018
+ }
1019
+ getItemLabel(item) {
1020
+ return item.label || item.value;
1021
+ }
1022
+ highlightMatch(text, query) {
1023
+ const tokens = query.trim().split(/\s+/).map((token) => token.toLowerCase()).filter((token) => token.length > 0);
1024
+ if (tokens.length === 0) return text;
1025
+ const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
1026
+ let result = text;
1027
+ for (const token of uniqueTokens) {
1028
+ const regex = this.getCachedRegex(token);
1029
+ result = result.replace(regex, (match) => this.theme.matchHighlight(match));
1030
+ }
1031
+ return result;
1032
+ }
1033
+ setSelectedIndex(index) {
1034
+ this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
1035
+ }
1036
+ invalidate() {
1037
+ this.searchInput.invalidate();
1038
+ }
1039
+ render(width) {
1040
+ const lines = [];
1041
+ const prompt = this.theme.searchPrompt("search: ");
1042
+ const inputWidth = Math.max(1, width - visibleWidth(prompt));
1043
+ const inputText = this.searchInput.render(inputWidth)[0] ?? "";
1044
+ lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
1045
+ lines.push("");
1046
+ const query = this.searchInput.getValue().trim();
1047
+ if (this.filteredItems.length === 0) {
1048
+ lines.push(this.theme.noMatch(" No matches"));
1049
+ return lines;
1050
+ }
1051
+ const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
1052
+ const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
1053
+ for (let i = startIndex; i < endIndex; i++) {
1054
+ const item = this.filteredItems[i];
1055
+ if (!item) continue;
1056
+ const isSelected = i === this.selectedIndex;
1057
+ lines.push(this.renderItemLine(item, isSelected, width, query));
1058
+ }
1059
+ if (this.filteredItems.length > this.maxVisible) {
1060
+ const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
1061
+ lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
1062
+ }
1063
+ return lines;
1064
+ }
1065
+ renderItemLine(item, isSelected, width, query) {
1066
+ const prefix = isSelected ? "→ " : " ";
1067
+ const prefixWidth = prefix.length;
1068
+ const displayValue = this.getItemLabel(item);
1069
+ if (item.description && width > 40) {
1070
+ const truncatedValue = truncateToWidth(displayValue, Math.min(30, width - prefixWidth - 4), "");
1071
+ const valueText = this.highlightMatch(truncatedValue, query);
1072
+ const spacingWidth = Math.max(1, 32 - visibleWidth(valueText));
1073
+ const spacing = " ".repeat(spacingWidth);
1074
+ const remainingWidth = width - (prefixWidth + visibleWidth(valueText) + spacing.length) - 2;
1075
+ if (remainingWidth > 10) {
1076
+ const truncatedDesc = truncateToWidth(item.description, remainingWidth, "");
1077
+ const highlightedDesc = this.highlightMatch(truncatedDesc, query);
1078
+ const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
1079
+ return isSelected ? this.theme.selectedText(line) : line;
1080
+ }
1081
+ }
1082
+ const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
1083
+ const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
1084
+ return isSelected ? this.theme.selectedText(line) : line;
1085
+ }
1086
+ handleInput(keyData) {
1087
+ if (isKeyRelease(keyData)) return;
1088
+ const allowVimNav = !this.searchInput.getValue().trim();
1089
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
1090
+ this.selectedIndex = Math.max(0, this.selectedIndex - 1);
1091
+ this.notifySelectionChange();
1092
+ return;
1093
+ }
1094
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
1095
+ this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
1096
+ this.notifySelectionChange();
1097
+ return;
1098
+ }
1099
+ if (matchesKey(keyData, "enter")) {
1100
+ const item = this.filteredItems[this.selectedIndex];
1101
+ if (item && this.onSelect) this.onSelect(item);
1102
+ return;
1103
+ }
1104
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
1105
+ if (this.onCancel) this.onCancel();
1106
+ return;
1107
+ }
1108
+ const prevValue = this.searchInput.getValue();
1109
+ this.searchInput.handleInput(keyData);
1110
+ if (prevValue !== this.searchInput.getValue()) this.updateFilter();
1111
+ }
1112
+ notifySelectionChange() {
1113
+ const item = this.filteredItems[this.selectedIndex];
1114
+ if (item && this.onSelectionChange) this.onSelectionChange(item);
1115
+ }
1116
+ getSelectedItem() {
1117
+ return this.filteredItems[this.selectedIndex] ?? null;
1118
+ }
1119
+ };
1120
+
1121
+ //#endregion
1122
+ //#region src/tui/components/selectors.ts
1123
+ function createSearchableSelectList(items, maxVisible = 7) {
1124
+ return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
1125
+ }
1126
+ function createFilterableSelectList(items, maxVisible = 7) {
1127
+ return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
1128
+ }
1129
+ function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
1130
+ return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
1131
+ }
1132
+
1133
+ //#endregion
1134
+ //#region src/tui/tui-status-summary.ts
1135
+ function formatStatusSummary(summary) {
1136
+ const lines = [];
1137
+ lines.push("Gateway status");
1138
+ if (!summary.linkChannel) lines.push("Link channel: unknown");
1139
+ else {
1140
+ const linkLabel = summary.linkChannel.label ?? "Link channel";
1141
+ const linked = summary.linkChannel.linked === true;
1142
+ const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatAge(summary.linkChannel.authAgeMs)})` : "";
1143
+ lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
1144
+ }
1145
+ const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
1146
+ if (providerSummary.length > 0) {
1147
+ lines.push("");
1148
+ lines.push("System:");
1149
+ for (const line of providerSummary) lines.push(` ${line}`);
1150
+ }
1151
+ const heartbeatAgents = summary.heartbeat?.agents ?? [];
1152
+ if (heartbeatAgents.length > 0) {
1153
+ const heartbeatParts = heartbeatAgents.map((agent) => {
1154
+ const agentId = agent.agentId ?? "unknown";
1155
+ if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
1156
+ return `${agent.every ?? "unknown"} (${agentId})`;
1157
+ });
1158
+ lines.push("");
1159
+ lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
1160
+ }
1161
+ const sessionPaths = summary.sessions?.paths ?? [];
1162
+ if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
1163
+ else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
1164
+ const defaults = summary.sessions?.defaults;
1165
+ const defaultModel = defaults?.model ?? "unknown";
1166
+ const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
1167
+ lines.push(`Default model: ${defaultModel}${defaultCtx}`);
1168
+ const sessionCount = summary.sessions?.count ?? 0;
1169
+ lines.push(`Active sessions: ${sessionCount}`);
1170
+ const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
1171
+ if (recent.length > 0) {
1172
+ lines.push("Recent sessions:");
1173
+ for (const entry of recent) {
1174
+ const ageLabel = typeof entry.age === "number" ? formatAge(entry.age) : "no activity";
1175
+ const model = entry.model ?? "unknown";
1176
+ const usage = formatContextUsageLine({
1177
+ total: entry.totalTokens ?? null,
1178
+ context: entry.contextTokens ?? null,
1179
+ remaining: entry.remainingTokens ?? null,
1180
+ percent: entry.percentUsed ?? null
1181
+ });
1182
+ const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
1183
+ lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
1184
+ }
1185
+ }
1186
+ const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
1187
+ if (queued.length > 0) {
1188
+ const preview = queued.slice(0, 3).join(" | ");
1189
+ lines.push(`Queued system events (${queued.length}): ${preview}`);
1190
+ }
1191
+ return lines;
1192
+ }
1193
+
1194
+ //#endregion
1195
+ //#region src/tui/tui-command-handlers.ts
1196
+ function createCommandHandlers(context) {
1197
+ const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalRunId, forgetLocalRunId } = context;
1198
+ const setAgent = async (id) => {
1199
+ state.currentAgentId = normalizeAgentId(id);
1200
+ await setSession("");
1201
+ };
1202
+ const openModelSelector = async () => {
1203
+ try {
1204
+ const models = await client.listModels();
1205
+ if (models.length === 0) {
1206
+ chatLog.addSystem("no models available");
1207
+ tui.requestRender();
1208
+ return;
1209
+ }
1210
+ const selector = createSearchableSelectList(models.map((model) => ({
1211
+ value: `${model.provider}/${model.id}`,
1212
+ label: `${model.provider}/${model.id}`,
1213
+ description: model.name && model.name !== model.id ? model.name : ""
1214
+ })), 9);
1215
+ selector.onSelect = (item) => {
1216
+ (async () => {
1217
+ try {
1218
+ const result = await client.patchSession({
1219
+ key: state.currentSessionKey,
1220
+ model: item.value
1221
+ });
1222
+ chatLog.addSystem(`model set to ${item.value}`);
1223
+ applySessionInfoFromPatch(result);
1224
+ await refreshSessionInfo();
1225
+ } catch (err) {
1226
+ chatLog.addSystem(`model set failed: ${String(err)}`);
1227
+ }
1228
+ closeOverlay();
1229
+ tui.requestRender();
1230
+ })();
1231
+ };
1232
+ selector.onCancel = () => {
1233
+ closeOverlay();
1234
+ tui.requestRender();
1235
+ };
1236
+ openOverlay(selector);
1237
+ tui.requestRender();
1238
+ } catch (err) {
1239
+ chatLog.addSystem(`model list failed: ${String(err)}`);
1240
+ tui.requestRender();
1241
+ }
1242
+ };
1243
+ const openAgentSelector = async () => {
1244
+ await refreshAgents();
1245
+ if (state.agents.length === 0) {
1246
+ chatLog.addSystem("no agents found");
1247
+ tui.requestRender();
1248
+ return;
1249
+ }
1250
+ const selector = createSearchableSelectList(state.agents.map((agent) => ({
1251
+ value: agent.id,
1252
+ label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
1253
+ description: agent.id === state.agentDefaultId ? "default" : ""
1254
+ })), 9);
1255
+ selector.onSelect = (item) => {
1256
+ (async () => {
1257
+ closeOverlay();
1258
+ await setAgent(item.value);
1259
+ tui.requestRender();
1260
+ })();
1261
+ };
1262
+ selector.onCancel = () => {
1263
+ closeOverlay();
1264
+ tui.requestRender();
1265
+ };
1266
+ openOverlay(selector);
1267
+ tui.requestRender();
1268
+ };
1269
+ const openSessionSelector = async () => {
1270
+ try {
1271
+ const selector = createFilterableSelectList((await client.listSessions({
1272
+ includeGlobal: false,
1273
+ includeUnknown: false,
1274
+ includeDerivedTitles: true,
1275
+ includeLastMessage: true,
1276
+ agentId: state.currentAgentId
1277
+ })).sessions.map((session) => {
1278
+ const title = session.derivedTitle ?? session.displayName;
1279
+ const formattedKey = formatSessionKey(session.key);
1280
+ const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
1281
+ const timePart = session.updatedAt ? formatRelativeTime(session.updatedAt) : "";
1282
+ const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
1283
+ const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
1284
+ return {
1285
+ value: session.key,
1286
+ label,
1287
+ description,
1288
+ searchText: [
1289
+ session.displayName,
1290
+ session.label,
1291
+ session.subject,
1292
+ session.sessionId,
1293
+ session.key,
1294
+ session.lastMessagePreview
1295
+ ].filter(Boolean).join(" ")
1296
+ };
1297
+ }), 9);
1298
+ selector.onSelect = (item) => {
1299
+ (async () => {
1300
+ closeOverlay();
1301
+ await setSession(item.value);
1302
+ tui.requestRender();
1303
+ })();
1304
+ };
1305
+ selector.onCancel = () => {
1306
+ closeOverlay();
1307
+ tui.requestRender();
1308
+ };
1309
+ openOverlay(selector);
1310
+ tui.requestRender();
1311
+ } catch (err) {
1312
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
1313
+ tui.requestRender();
1314
+ }
1315
+ };
1316
+ const openSettings = () => {
1317
+ openOverlay(createSettingsList([{
1318
+ id: "tools",
1319
+ label: "Tool output",
1320
+ currentValue: state.toolsExpanded ? "expanded" : "collapsed",
1321
+ values: ["collapsed", "expanded"]
1322
+ }, {
1323
+ id: "thinking",
1324
+ label: "Show thinking",
1325
+ currentValue: state.showThinking ? "on" : "off",
1326
+ values: ["off", "on"]
1327
+ }], (id, value) => {
1328
+ if (id === "tools") {
1329
+ state.toolsExpanded = value === "expanded";
1330
+ chatLog.setToolsExpanded(state.toolsExpanded);
1331
+ }
1332
+ if (id === "thinking") {
1333
+ state.showThinking = value === "on";
1334
+ loadHistory();
1335
+ }
1336
+ tui.requestRender();
1337
+ }, () => {
1338
+ closeOverlay();
1339
+ tui.requestRender();
1340
+ }));
1341
+ tui.requestRender();
1342
+ };
1343
+ const handleCommand = async (raw) => {
1344
+ const { name, args } = parseCommand(raw);
1345
+ if (!name) return;
1346
+ switch (name) {
1347
+ case "help":
1348
+ chatLog.addSystem(helpText({
1349
+ provider: state.sessionInfo.modelProvider,
1350
+ model: state.sessionInfo.model
1351
+ }));
1352
+ break;
1353
+ case "status":
1354
+ try {
1355
+ const status = await client.getStatus();
1356
+ if (typeof status === "string") {
1357
+ chatLog.addSystem(status);
1358
+ break;
1359
+ }
1360
+ if (status && typeof status === "object") {
1361
+ const lines = formatStatusSummary(status);
1362
+ for (const line of lines) chatLog.addSystem(line);
1363
+ break;
1364
+ }
1365
+ chatLog.addSystem("status: unknown response");
1366
+ } catch (err) {
1367
+ chatLog.addSystem(`status failed: ${String(err)}`);
1368
+ }
1369
+ break;
1370
+ case "agent":
1371
+ if (!args) await openAgentSelector();
1372
+ else await setAgent(args);
1373
+ break;
1374
+ case "agents":
1375
+ await openAgentSelector();
1376
+ break;
1377
+ case "session":
1378
+ if (!args) await openSessionSelector();
1379
+ else await setSession(args);
1380
+ break;
1381
+ case "sessions":
1382
+ await openSessionSelector();
1383
+ break;
1384
+ case "model":
1385
+ if (!args) await openModelSelector();
1386
+ else try {
1387
+ const result = await client.patchSession({
1388
+ key: state.currentSessionKey,
1389
+ model: args
1390
+ });
1391
+ chatLog.addSystem(`model set to ${args}`);
1392
+ applySessionInfoFromPatch(result);
1393
+ await refreshSessionInfo();
1394
+ } catch (err) {
1395
+ chatLog.addSystem(`model set failed: ${String(err)}`);
1396
+ }
1397
+ break;
1398
+ case "models":
1399
+ await openModelSelector();
1400
+ break;
1401
+ case "think":
1402
+ if (!args) {
1403
+ const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
1404
+ chatLog.addSystem(`usage: /think <${levels}>`);
1405
+ break;
1406
+ }
1407
+ try {
1408
+ const result = await client.patchSession({
1409
+ key: state.currentSessionKey,
1410
+ thinkingLevel: args
1411
+ });
1412
+ chatLog.addSystem(`thinking set to ${args}`);
1413
+ applySessionInfoFromPatch(result);
1414
+ await refreshSessionInfo();
1415
+ } catch (err) {
1416
+ chatLog.addSystem(`think failed: ${String(err)}`);
1417
+ }
1418
+ break;
1419
+ case "verbose":
1420
+ if (!args) {
1421
+ chatLog.addSystem("usage: /verbose <on|off>");
1422
+ break;
1423
+ }
1424
+ try {
1425
+ const result = await client.patchSession({
1426
+ key: state.currentSessionKey,
1427
+ verboseLevel: args
1428
+ });
1429
+ chatLog.addSystem(`verbose set to ${args}`);
1430
+ applySessionInfoFromPatch(result);
1431
+ await loadHistory();
1432
+ } catch (err) {
1433
+ chatLog.addSystem(`verbose failed: ${String(err)}`);
1434
+ }
1435
+ break;
1436
+ case "reasoning":
1437
+ if (!args) {
1438
+ chatLog.addSystem("usage: /reasoning <on|off>");
1439
+ break;
1440
+ }
1441
+ try {
1442
+ const result = await client.patchSession({
1443
+ key: state.currentSessionKey,
1444
+ reasoningLevel: args
1445
+ });
1446
+ chatLog.addSystem(`reasoning set to ${args}`);
1447
+ applySessionInfoFromPatch(result);
1448
+ await refreshSessionInfo();
1449
+ } catch (err) {
1450
+ chatLog.addSystem(`reasoning failed: ${String(err)}`);
1451
+ }
1452
+ break;
1453
+ case "usage": {
1454
+ const normalized = args ? normalizeUsageDisplay(args) : void 0;
1455
+ if (args && !normalized) {
1456
+ chatLog.addSystem("usage: /usage <off|tokens|full>");
1457
+ break;
1458
+ }
1459
+ const currentRaw = state.sessionInfo.responseUsage;
1460
+ const current = resolveResponseUsageMode(currentRaw);
1461
+ const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
1462
+ try {
1463
+ const result = await client.patchSession({
1464
+ key: state.currentSessionKey,
1465
+ responseUsage: next === "off" ? null : next
1466
+ });
1467
+ chatLog.addSystem(`usage footer: ${next}`);
1468
+ applySessionInfoFromPatch(result);
1469
+ await refreshSessionInfo();
1470
+ } catch (err) {
1471
+ chatLog.addSystem(`usage failed: ${String(err)}`);
1472
+ }
1473
+ break;
1474
+ }
1475
+ case "elevated":
1476
+ if (!args) {
1477
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1478
+ break;
1479
+ }
1480
+ if (![
1481
+ "on",
1482
+ "off",
1483
+ "ask",
1484
+ "full"
1485
+ ].includes(args)) {
1486
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1487
+ break;
1488
+ }
1489
+ try {
1490
+ const result = await client.patchSession({
1491
+ key: state.currentSessionKey,
1492
+ elevatedLevel: args
1493
+ });
1494
+ chatLog.addSystem(`elevated set to ${args}`);
1495
+ applySessionInfoFromPatch(result);
1496
+ await refreshSessionInfo();
1497
+ } catch (err) {
1498
+ chatLog.addSystem(`elevated failed: ${String(err)}`);
1499
+ }
1500
+ break;
1501
+ case "activation":
1502
+ if (!args) {
1503
+ chatLog.addSystem("usage: /activation <mention|always>");
1504
+ break;
1505
+ }
1506
+ try {
1507
+ const result = await client.patchSession({
1508
+ key: state.currentSessionKey,
1509
+ groupActivation: args === "always" ? "always" : "mention"
1510
+ });
1511
+ chatLog.addSystem(`activation set to ${args}`);
1512
+ applySessionInfoFromPatch(result);
1513
+ await refreshSessionInfo();
1514
+ } catch (err) {
1515
+ chatLog.addSystem(`activation failed: ${String(err)}`);
1516
+ }
1517
+ break;
1518
+ case "new":
1519
+ case "reset":
1520
+ try {
1521
+ state.sessionInfo.inputTokens = null;
1522
+ state.sessionInfo.outputTokens = null;
1523
+ state.sessionInfo.totalTokens = null;
1524
+ tui.requestRender();
1525
+ await client.resetSession(state.currentSessionKey);
1526
+ chatLog.addSystem(`session ${state.currentSessionKey} reset`);
1527
+ await loadHistory();
1528
+ } catch (err) {
1529
+ chatLog.addSystem(`reset failed: ${String(err)}`);
1530
+ }
1531
+ break;
1532
+ case "abort":
1533
+ await abortActive();
1534
+ break;
1535
+ case "settings":
1536
+ openSettings();
1537
+ break;
1538
+ case "exit":
1539
+ case "quit":
1540
+ client.stop();
1541
+ tui.stop();
1542
+ process.exit(0);
1543
+ break;
1544
+ default:
1545
+ await sendMessage(raw);
1546
+ break;
1547
+ }
1548
+ tui.requestRender();
1549
+ };
1550
+ const sendMessage = async (text) => {
1551
+ try {
1552
+ chatLog.addUser(text);
1553
+ tui.requestRender();
1554
+ const runId = randomUUID();
1555
+ noteLocalRunId(runId);
1556
+ state.activeChatRunId = runId;
1557
+ setActivityStatus("sending");
1558
+ await client.sendChat({
1559
+ sessionKey: state.currentSessionKey,
1560
+ message: text,
1561
+ thinking: opts.thinking,
1562
+ deliver: deliverDefault,
1563
+ timeoutMs: opts.timeoutMs,
1564
+ runId
1565
+ });
1566
+ setActivityStatus("waiting");
1567
+ } catch (err) {
1568
+ if (state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
1569
+ state.activeChatRunId = null;
1570
+ chatLog.addSystem(`send failed: ${String(err)}`);
1571
+ setActivityStatus("error");
1572
+ }
1573
+ tui.requestRender();
1574
+ };
1575
+ return {
1576
+ handleCommand,
1577
+ sendMessage,
1578
+ openModelSelector,
1579
+ openAgentSelector,
1580
+ openSessionSelector,
1581
+ openSettings,
1582
+ setAgent
1583
+ };
1584
+ }
1585
+
1586
+ //#endregion
1587
+ //#region src/tui/tui-stream-assembler.ts
1588
+ var TuiStreamAssembler = class {
1589
+ constructor() {
1590
+ this.runs = /* @__PURE__ */ new Map();
1591
+ }
1592
+ getOrCreateRun(runId) {
1593
+ let state = this.runs.get(runId);
1594
+ if (!state) {
1595
+ state = {
1596
+ thinkingText: "",
1597
+ contentText: "",
1598
+ displayText: ""
1599
+ };
1600
+ this.runs.set(runId, state);
1601
+ }
1602
+ return state;
1603
+ }
1604
+ updateRunState(state, message, showThinking) {
1605
+ const thinkingText = extractThinkingFromMessage(message);
1606
+ const contentText = extractContentFromMessage(message);
1607
+ if (thinkingText) state.thinkingText = thinkingText;
1608
+ if (contentText) state.contentText = contentText;
1609
+ state.displayText = composeThinkingAndContent({
1610
+ thinkingText: state.thinkingText,
1611
+ contentText: state.contentText,
1612
+ showThinking
1613
+ });
1614
+ }
1615
+ ingestDelta(runId, message, showThinking) {
1616
+ const state = this.getOrCreateRun(runId);
1617
+ const previousDisplayText = state.displayText;
1618
+ this.updateRunState(state, message, showThinking);
1619
+ if (!state.displayText || state.displayText === previousDisplayText) return null;
1620
+ return state.displayText;
1621
+ }
1622
+ finalize(runId, message, showThinking) {
1623
+ const state = this.getOrCreateRun(runId);
1624
+ this.updateRunState(state, message, showThinking);
1625
+ const finalComposed = state.displayText;
1626
+ const finalText = resolveFinalAssistantText({
1627
+ finalText: finalComposed,
1628
+ streamedText: state.displayText
1629
+ });
1630
+ this.runs.delete(runId);
1631
+ return finalText;
1632
+ }
1633
+ drop(runId) {
1634
+ this.runs.delete(runId);
1635
+ }
1636
+ };
1637
+
1638
+ //#endregion
1639
+ //#region src/tui/tui-event-handlers.ts
1640
+ function createEventHandlers(context) {
1641
+ const { chatLog, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, isLocalRunId, forgetLocalRunId, clearLocalRunIds } = context;
1642
+ const finalizedRuns = /* @__PURE__ */ new Map();
1643
+ const sessionRuns = /* @__PURE__ */ new Map();
1644
+ let streamAssembler = new TuiStreamAssembler();
1645
+ let lastSessionKey = state.currentSessionKey;
1646
+ const pruneRunMap = (runs) => {
1647
+ if (runs.size <= 200) return;
1648
+ const keepUntil = Date.now() - 600 * 1e3;
1649
+ for (const [key, ts] of runs) {
1650
+ if (runs.size <= 150) break;
1651
+ if (ts < keepUntil) runs.delete(key);
1652
+ }
1653
+ if (runs.size > 200) for (const key of runs.keys()) {
1654
+ runs.delete(key);
1655
+ if (runs.size <= 150) break;
1656
+ }
1657
+ };
1658
+ const syncSessionKey = () => {
1659
+ if (state.currentSessionKey === lastSessionKey) return;
1660
+ lastSessionKey = state.currentSessionKey;
1661
+ finalizedRuns.clear();
1662
+ sessionRuns.clear();
1663
+ streamAssembler = new TuiStreamAssembler();
1664
+ clearLocalRunIds?.();
1665
+ };
1666
+ const noteSessionRun = (runId) => {
1667
+ sessionRuns.set(runId, Date.now());
1668
+ pruneRunMap(sessionRuns);
1669
+ };
1670
+ const noteFinalizedRun = (runId) => {
1671
+ finalizedRuns.set(runId, Date.now());
1672
+ sessionRuns.delete(runId);
1673
+ streamAssembler.drop(runId);
1674
+ pruneRunMap(finalizedRuns);
1675
+ };
1676
+ const handleChatEvent = (payload) => {
1677
+ if (!payload || typeof payload !== "object") return;
1678
+ const evt = payload;
1679
+ syncSessionKey();
1680
+ if (evt.sessionKey !== state.currentSessionKey) return;
1681
+ if (finalizedRuns.has(evt.runId)) {
1682
+ if (evt.state === "delta") return;
1683
+ if (evt.state === "final") return;
1684
+ }
1685
+ noteSessionRun(evt.runId);
1686
+ if (!state.activeChatRunId) state.activeChatRunId = evt.runId;
1687
+ if (evt.state === "delta") {
1688
+ const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
1689
+ if (!displayText) return;
1690
+ chatLog.updateAssistant(displayText, evt.runId);
1691
+ setActivityStatus("streaming");
1692
+ }
1693
+ if (evt.state === "final") {
1694
+ if (isCommandMessage(evt.message)) {
1695
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1696
+ else loadHistory?.();
1697
+ const text = extractTextFromMessage(evt.message);
1698
+ if (text) chatLog.addSystem(text);
1699
+ streamAssembler.drop(evt.runId);
1700
+ noteFinalizedRun(evt.runId);
1701
+ state.activeChatRunId = null;
1702
+ setActivityStatus("idle");
1703
+ refreshSessionInfo?.();
1704
+ tui.requestRender();
1705
+ return;
1706
+ }
1707
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1708
+ else loadHistory?.();
1709
+ const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
1710
+ const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking);
1711
+ chatLog.finalizeAssistant(finalText, evt.runId);
1712
+ noteFinalizedRun(evt.runId);
1713
+ state.activeChatRunId = null;
1714
+ setActivityStatus(stopReason === "error" ? "error" : "idle");
1715
+ refreshSessionInfo?.();
1716
+ }
1717
+ if (evt.state === "aborted") {
1718
+ chatLog.addSystem("run aborted");
1719
+ streamAssembler.drop(evt.runId);
1720
+ sessionRuns.delete(evt.runId);
1721
+ state.activeChatRunId = null;
1722
+ setActivityStatus("aborted");
1723
+ refreshSessionInfo?.();
1724
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1725
+ else loadHistory?.();
1726
+ }
1727
+ if (evt.state === "error") {
1728
+ chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
1729
+ streamAssembler.drop(evt.runId);
1730
+ sessionRuns.delete(evt.runId);
1731
+ state.activeChatRunId = null;
1732
+ setActivityStatus("error");
1733
+ refreshSessionInfo?.();
1734
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1735
+ else loadHistory?.();
1736
+ }
1737
+ tui.requestRender();
1738
+ };
1739
+ const handleAgentEvent = (payload) => {
1740
+ if (!payload || typeof payload !== "object") return;
1741
+ const evt = payload;
1742
+ syncSessionKey();
1743
+ const isActiveRun = evt.runId === state.activeChatRunId;
1744
+ if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
1745
+ if (evt.stream === "tool") {
1746
+ const verbose = state.sessionInfo.verboseLevel ?? "off";
1747
+ const allowToolEvents = verbose !== "off";
1748
+ const allowToolOutput = verbose === "full";
1749
+ if (!allowToolEvents) return;
1750
+ const data = evt.data ?? {};
1751
+ const phase = asString(data.phase, "");
1752
+ const toolCallId = asString(data.toolCallId, "");
1753
+ const toolName = asString(data.name, "tool");
1754
+ if (!toolCallId) return;
1755
+ if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
1756
+ else if (phase === "update") {
1757
+ if (!allowToolOutput) return;
1758
+ chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
1759
+ } else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
1760
+ else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
1761
+ tui.requestRender();
1762
+ return;
1763
+ }
1764
+ if (evt.stream === "lifecycle") {
1765
+ if (!isActiveRun) return;
1766
+ const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
1767
+ if (phase === "start") setActivityStatus("running");
1768
+ if (phase === "end") setActivityStatus("idle");
1769
+ if (phase === "error") setActivityStatus("error");
1770
+ tui.requestRender();
1771
+ }
1772
+ };
1773
+ return {
1774
+ handleChatEvent,
1775
+ handleAgentEvent
1776
+ };
1777
+ }
1778
+
1779
+ //#endregion
1780
+ //#region src/tui/tui-local-shell.ts
1781
+ function createLocalShellRunner(deps) {
1782
+ let localExecAsked = false;
1783
+ let localExecAllowed = false;
1784
+ const createSelector = deps.createSelector ?? createSearchableSelectList;
1785
+ const spawnCommand = deps.spawnCommand ?? spawn;
1786
+ const getCwd = deps.getCwd ?? (() => process.cwd());
1787
+ const env = deps.env ?? process.env;
1788
+ const maxChars = deps.maxOutputChars ?? 4e4;
1789
+ const ensureLocalExecAllowed = async () => {
1790
+ if (localExecAllowed) return true;
1791
+ if (localExecAsked) return false;
1792
+ localExecAsked = true;
1793
+ return await new Promise((resolve) => {
1794
+ deps.chatLog.addSystem("Allow local shell commands for this session?");
1795
+ deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
1796
+ deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
1797
+ const selector = createSelector([{
1798
+ value: "no",
1799
+ label: "No"
1800
+ }, {
1801
+ value: "yes",
1802
+ label: "Yes"
1803
+ }], 2);
1804
+ selector.onSelect = (item) => {
1805
+ deps.closeOverlay();
1806
+ if (item.value === "yes") {
1807
+ localExecAllowed = true;
1808
+ deps.chatLog.addSystem("local shell: enabled for this session");
1809
+ resolve(true);
1810
+ } else {
1811
+ deps.chatLog.addSystem("local shell: not enabled");
1812
+ resolve(false);
1813
+ }
1814
+ deps.tui.requestRender();
1815
+ };
1816
+ selector.onCancel = () => {
1817
+ deps.closeOverlay();
1818
+ deps.chatLog.addSystem("local shell: cancelled");
1819
+ deps.tui.requestRender();
1820
+ resolve(false);
1821
+ };
1822
+ deps.openOverlay(selector);
1823
+ deps.tui.requestRender();
1824
+ });
1825
+ };
1826
+ const runLocalShellLine = async (line) => {
1827
+ const cmd = line.slice(1);
1828
+ if (cmd === "") return;
1829
+ if (localExecAsked && !localExecAllowed) {
1830
+ deps.chatLog.addSystem("local shell: not enabled for this session");
1831
+ deps.tui.requestRender();
1832
+ return;
1833
+ }
1834
+ if (!await ensureLocalExecAllowed()) return;
1835
+ deps.chatLog.addSystem(`[local] $ ${cmd}`);
1836
+ deps.tui.requestRender();
1837
+ await new Promise((resolve) => {
1838
+ const child = spawnCommand(cmd, {
1839
+ shell: true,
1840
+ cwd: getCwd(),
1841
+ env
1842
+ });
1843
+ let stdout = "";
1844
+ let stderr = "";
1845
+ child.stdout.on("data", (buf) => {
1846
+ stdout += buf.toString("utf8");
1847
+ });
1848
+ child.stderr.on("data", (buf) => {
1849
+ stderr += buf.toString("utf8");
1850
+ });
1851
+ child.on("close", (code, signal) => {
1852
+ const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
1853
+ if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
1854
+ deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
1855
+ deps.tui.requestRender();
1856
+ resolve();
1857
+ });
1858
+ child.on("error", (err) => {
1859
+ deps.chatLog.addSystem(`[local] error: ${String(err)}`);
1860
+ deps.tui.requestRender();
1861
+ resolve();
1862
+ });
1863
+ });
1864
+ };
1865
+ return { runLocalShellLine };
1866
+ }
1867
+
1868
+ //#endregion
1869
+ //#region src/tui/tui-overlays.ts
1870
+ function createOverlayHandlers(host, fallbackFocus) {
1871
+ const openOverlay = (component) => {
1872
+ host.showOverlay(component);
1873
+ };
1874
+ const closeOverlay = () => {
1875
+ if (host.hasOverlay()) {
1876
+ host.hideOverlay();
1877
+ return;
1878
+ }
1879
+ host.setFocus(fallbackFocus);
1880
+ };
1881
+ return {
1882
+ openOverlay,
1883
+ closeOverlay
1884
+ };
1885
+ }
1886
+
1887
+ //#endregion
1888
+ //#region src/tui/tui-session-actions.ts
1889
+ function createSessionActions(context) {
1890
+ const { client, chatLog, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
1891
+ let refreshSessionInfoPromise = Promise.resolve();
1892
+ let lastSessionDefaults = null;
1893
+ const applyAgentsResult = (result) => {
1894
+ state.agentDefaultId = normalizeAgentId(result.defaultId);
1895
+ state.sessionMainKey = normalizeMainKey(result.mainKey);
1896
+ state.sessionScope = result.scope ?? state.sessionScope;
1897
+ state.agents = result.agents.map((agent) => ({
1898
+ id: normalizeAgentId(agent.id),
1899
+ name: agent.name?.trim() || void 0
1900
+ }));
1901
+ agentNames.clear();
1902
+ for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
1903
+ if (!state.initialSessionApplied) {
1904
+ if (initialSessionAgentId) {
1905
+ if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
1906
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
1907
+ const nextSessionKey = resolveSessionKey(initialSessionInput);
1908
+ if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
1909
+ state.initialSessionApplied = true;
1910
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
1911
+ updateHeader();
1912
+ updateFooter();
1913
+ };
1914
+ const refreshAgents = async () => {
1915
+ try {
1916
+ applyAgentsResult(await client.listAgents());
1917
+ } catch (err) {
1918
+ chatLog.addSystem(`agents list failed: ${String(err)}`);
1919
+ }
1920
+ };
1921
+ const updateAgentFromSessionKey = (key) => {
1922
+ const parsed = parseAgentSessionKey(key);
1923
+ if (!parsed) return;
1924
+ const next = normalizeAgentId(parsed.agentId);
1925
+ if (next !== state.currentAgentId) state.currentAgentId = next;
1926
+ };
1927
+ const resolveModelSelection = (entry) => {
1928
+ if (entry?.modelProvider || entry?.model) return {
1929
+ modelProvider: entry.modelProvider ?? state.sessionInfo.modelProvider,
1930
+ model: entry.model ?? state.sessionInfo.model
1931
+ };
1932
+ const overrideModel = entry?.modelOverride?.trim();
1933
+ if (overrideModel) return {
1934
+ modelProvider: entry?.providerOverride?.trim() || state.sessionInfo.modelProvider,
1935
+ model: overrideModel
1936
+ };
1937
+ return {
1938
+ modelProvider: state.sessionInfo.modelProvider,
1939
+ model: state.sessionInfo.model
1940
+ };
1941
+ };
1942
+ const applySessionInfo = (params) => {
1943
+ const entry = params.entry ?? void 0;
1944
+ const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
1945
+ const previousDefaults = lastSessionDefaults;
1946
+ const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
1947
+ if (params.defaults) lastSessionDefaults = params.defaults;
1948
+ const entryUpdatedAt = entry?.updatedAt ?? null;
1949
+ const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
1950
+ const modelChanged = entry?.modelProvider !== void 0 && entry.modelProvider !== state.sessionInfo.modelProvider || entry?.model !== void 0 && entry.model !== state.sessionInfo.model;
1951
+ if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged && !modelChanged) return;
1952
+ const next = { ...state.sessionInfo };
1953
+ if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
1954
+ if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
1955
+ if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
1956
+ if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
1957
+ if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
1958
+ if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
1959
+ if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
1960
+ if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
1961
+ if (entry?.displayName !== void 0) next.displayName = entry.displayName;
1962
+ if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
1963
+ const selection = resolveModelSelection(entry);
1964
+ if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
1965
+ if (selection.model !== void 0) next.model = selection.model;
1966
+ state.sessionInfo = next;
1967
+ updateAutocompleteProvider();
1968
+ updateFooter();
1969
+ tui.requestRender();
1970
+ };
1971
+ const runRefreshSessionInfo = async () => {
1972
+ try {
1973
+ const resolveListAgentId = () => {
1974
+ if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
1975
+ const parsed = parseAgentSessionKey(state.currentSessionKey);
1976
+ return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
1977
+ };
1978
+ const listAgentId = resolveListAgentId();
1979
+ const result = await client.listSessions({
1980
+ includeGlobal: false,
1981
+ includeUnknown: false,
1982
+ agentId: listAgentId
1983
+ });
1984
+ const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
1985
+ const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
1986
+ const entry = result.sessions.find((row) => {
1987
+ if (row.key === state.currentSessionKey) return true;
1988
+ return normalizeMatchKey(row.key) === currentMatchKey;
1989
+ });
1990
+ if (entry?.key && entry.key !== state.currentSessionKey) {
1991
+ updateAgentFromSessionKey(entry.key);
1992
+ state.currentSessionKey = entry.key;
1993
+ updateHeader();
1994
+ }
1995
+ applySessionInfo({
1996
+ entry,
1997
+ defaults: result.defaults
1998
+ });
1999
+ } catch (err) {
2000
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
2001
+ }
2002
+ };
2003
+ const refreshSessionInfo = async () => {
2004
+ refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
2005
+ await refreshSessionInfoPromise;
2006
+ };
2007
+ const applySessionInfoFromPatch = (result) => {
2008
+ if (!result?.entry) return;
2009
+ if (result.key && result.key !== state.currentSessionKey) {
2010
+ updateAgentFromSessionKey(result.key);
2011
+ state.currentSessionKey = result.key;
2012
+ updateHeader();
2013
+ }
2014
+ const resolved = result.resolved;
2015
+ applySessionInfo({
2016
+ entry: resolved && (resolved.modelProvider || resolved.model) ? {
2017
+ ...result.entry,
2018
+ modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
2019
+ model: resolved.model ?? result.entry.model
2020
+ } : result.entry,
2021
+ force: true
2022
+ });
2023
+ };
2024
+ const loadHistory = async () => {
2025
+ try {
2026
+ const record = await client.loadHistory({
2027
+ sessionKey: state.currentSessionKey,
2028
+ limit: opts.historyLimit ?? 200
2029
+ });
2030
+ state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
2031
+ state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
2032
+ state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
2033
+ const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
2034
+ chatLog.clearAll();
2035
+ chatLog.addSystem(`session ${state.currentSessionKey}`);
2036
+ for (const entry of record.messages ?? []) {
2037
+ if (!entry || typeof entry !== "object") continue;
2038
+ const message = entry;
2039
+ if (isCommandMessage(message)) {
2040
+ const text = extractTextFromMessage(message);
2041
+ if (text) chatLog.addSystem(text);
2042
+ continue;
2043
+ }
2044
+ if (message.role === "user") {
2045
+ const text = extractTextFromMessage(message);
2046
+ if (text) chatLog.addUser(text);
2047
+ continue;
2048
+ }
2049
+ if (message.role === "assistant") {
2050
+ const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
2051
+ if (text) chatLog.finalizeAssistant(text);
2052
+ continue;
2053
+ }
2054
+ if (message.role === "toolResult") {
2055
+ if (!showTools) continue;
2056
+ const toolCallId = asString(message.toolCallId, "");
2057
+ const toolName = asString(message.toolName, "tool");
2058
+ chatLog.startTool(toolCallId, toolName, {}).setResult({
2059
+ content: Array.isArray(message.content) ? message.content : [],
2060
+ details: typeof message.details === "object" && message.details ? message.details : void 0
2061
+ }, { isError: Boolean(message.isError) });
2062
+ }
2063
+ }
2064
+ state.historyLoaded = true;
2065
+ } catch (err) {
2066
+ chatLog.addSystem(`history failed: ${String(err)}`);
2067
+ }
2068
+ await refreshSessionInfo();
2069
+ tui.requestRender();
2070
+ };
2071
+ const setSession = async (rawKey) => {
2072
+ const nextKey = resolveSessionKey(rawKey);
2073
+ updateAgentFromSessionKey(nextKey);
2074
+ state.currentSessionKey = nextKey;
2075
+ state.activeChatRunId = null;
2076
+ state.currentSessionId = null;
2077
+ state.historyLoaded = false;
2078
+ clearLocalRunIds?.();
2079
+ updateHeader();
2080
+ updateFooter();
2081
+ await loadHistory();
2082
+ };
2083
+ const abortActive = async () => {
2084
+ if (!state.activeChatRunId) {
2085
+ chatLog.addSystem("no active run");
2086
+ tui.requestRender();
2087
+ return;
2088
+ }
2089
+ try {
2090
+ await client.abortChat({
2091
+ sessionKey: state.currentSessionKey,
2092
+ runId: state.activeChatRunId
2093
+ });
2094
+ setActivityStatus("aborted");
2095
+ } catch (err) {
2096
+ chatLog.addSystem(`abort failed: ${String(err)}`);
2097
+ setActivityStatus("abort failed");
2098
+ }
2099
+ tui.requestRender();
2100
+ };
2101
+ return {
2102
+ applyAgentsResult,
2103
+ refreshAgents,
2104
+ refreshSessionInfo,
2105
+ applySessionInfoFromPatch,
2106
+ loadHistory,
2107
+ setSession,
2108
+ abortActive
2109
+ };
2110
+ }
2111
+
2112
+ //#endregion
2113
+ //#region src/tui/tui-waiting.ts
2114
+ const defaultWaitingPhrases = [
2115
+ "flibbertigibbeting",
2116
+ "kerfuffling",
2117
+ "dillydallying",
2118
+ "twiddling thumbs",
2119
+ "noodling",
2120
+ "bamboozling",
2121
+ "moseying",
2122
+ "hobnobbing",
2123
+ "pondering",
2124
+ "conjuring"
2125
+ ];
2126
+ function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
2127
+ return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
2128
+ }
2129
+ function shimmerText(theme, text, tick) {
2130
+ const width = 6;
2131
+ const hi = (ch) => theme.bold(theme.accentSoft(ch));
2132
+ const pos = tick % (text.length + width);
2133
+ const start = Math.max(0, pos - width);
2134
+ const end = Math.min(text.length - 1, pos);
2135
+ let out = "";
2136
+ for (let i = 0; i < text.length; i++) {
2137
+ const ch = text[i];
2138
+ out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
2139
+ }
2140
+ return out;
2141
+ }
2142
+ function buildWaitingStatusMessage(params) {
2143
+ const phrase = pickWaitingPhrase(params.tick, params.phrases);
2144
+ return `${shimmerText(params.theme, `${phrase}…`, params.tick)} • ${params.elapsed} | ${params.connectionStatus}`;
2145
+ }
2146
+
2147
+ //#endregion
2148
+ //#region src/tui/tui.ts
2149
+ function createEditorSubmitHandler(params) {
2150
+ return (text) => {
2151
+ const raw = text;
2152
+ const value = raw.trim();
2153
+ params.editor.setText("");
2154
+ if (!value) return;
2155
+ if (raw.startsWith("!") && raw !== "!") {
2156
+ params.editor.addToHistory(raw);
2157
+ params.handleBangLine(raw);
2158
+ return;
2159
+ }
2160
+ params.editor.addToHistory(value);
2161
+ if (value.startsWith("/")) {
2162
+ params.handleCommand(value);
2163
+ return;
2164
+ }
2165
+ params.sendMessage(value);
2166
+ };
2167
+ }
2168
+ async function runTui(opts) {
2169
+ const config = loadConfig();
2170
+ const initialSessionInput = (opts.session ?? "").trim();
2171
+ let sessionScope = config.session?.scope ?? "per-sender";
2172
+ let sessionMainKey = normalizeMainKey(config.session?.mainKey);
2173
+ let agentDefaultId = resolveDefaultAgentId(config);
2174
+ let currentAgentId = agentDefaultId;
2175
+ let agents = [];
2176
+ const agentNames = /* @__PURE__ */ new Map();
2177
+ let currentSessionKey = "";
2178
+ let initialSessionApplied = false;
2179
+ let currentSessionId = null;
2180
+ let activeChatRunId = null;
2181
+ let historyLoaded = false;
2182
+ let isConnected = false;
2183
+ let wasDisconnected = false;
2184
+ let toolsExpanded = false;
2185
+ let showThinking = false;
2186
+ const localRunIds = /* @__PURE__ */ new Set();
2187
+ const deliverDefault = opts.deliver ?? false;
2188
+ const autoMessage = opts.message?.trim();
2189
+ let autoMessageSent = false;
2190
+ let sessionInfo = {};
2191
+ let lastCtrlCAt = 0;
2192
+ let activityStatus = "idle";
2193
+ let connectionStatus = "connecting";
2194
+ let statusTimeout = null;
2195
+ let statusTimer = null;
2196
+ let statusStartedAt = null;
2197
+ let lastActivityStatus = activityStatus;
2198
+ const state = {
2199
+ get agentDefaultId() {
2200
+ return agentDefaultId;
2201
+ },
2202
+ set agentDefaultId(value) {
2203
+ agentDefaultId = value;
2204
+ },
2205
+ get sessionMainKey() {
2206
+ return sessionMainKey;
2207
+ },
2208
+ set sessionMainKey(value) {
2209
+ sessionMainKey = value;
2210
+ },
2211
+ get sessionScope() {
2212
+ return sessionScope;
2213
+ },
2214
+ set sessionScope(value) {
2215
+ sessionScope = value;
2216
+ },
2217
+ get agents() {
2218
+ return agents;
2219
+ },
2220
+ set agents(value) {
2221
+ agents = value;
2222
+ },
2223
+ get currentAgentId() {
2224
+ return currentAgentId;
2225
+ },
2226
+ set currentAgentId(value) {
2227
+ currentAgentId = value;
2228
+ },
2229
+ get currentSessionKey() {
2230
+ return currentSessionKey;
2231
+ },
2232
+ set currentSessionKey(value) {
2233
+ currentSessionKey = value;
2234
+ },
2235
+ get currentSessionId() {
2236
+ return currentSessionId;
2237
+ },
2238
+ set currentSessionId(value) {
2239
+ currentSessionId = value;
2240
+ },
2241
+ get activeChatRunId() {
2242
+ return activeChatRunId;
2243
+ },
2244
+ set activeChatRunId(value) {
2245
+ activeChatRunId = value;
2246
+ },
2247
+ get historyLoaded() {
2248
+ return historyLoaded;
2249
+ },
2250
+ set historyLoaded(value) {
2251
+ historyLoaded = value;
2252
+ },
2253
+ get sessionInfo() {
2254
+ return sessionInfo;
2255
+ },
2256
+ set sessionInfo(value) {
2257
+ sessionInfo = value;
2258
+ },
2259
+ get initialSessionApplied() {
2260
+ return initialSessionApplied;
2261
+ },
2262
+ set initialSessionApplied(value) {
2263
+ initialSessionApplied = value;
2264
+ },
2265
+ get isConnected() {
2266
+ return isConnected;
2267
+ },
2268
+ set isConnected(value) {
2269
+ isConnected = value;
2270
+ },
2271
+ get autoMessageSent() {
2272
+ return autoMessageSent;
2273
+ },
2274
+ set autoMessageSent(value) {
2275
+ autoMessageSent = value;
2276
+ },
2277
+ get toolsExpanded() {
2278
+ return toolsExpanded;
2279
+ },
2280
+ set toolsExpanded(value) {
2281
+ toolsExpanded = value;
2282
+ },
2283
+ get showThinking() {
2284
+ return showThinking;
2285
+ },
2286
+ set showThinking(value) {
2287
+ showThinking = value;
2288
+ },
2289
+ get connectionStatus() {
2290
+ return connectionStatus;
2291
+ },
2292
+ set connectionStatus(value) {
2293
+ connectionStatus = value;
2294
+ },
2295
+ get activityStatus() {
2296
+ return activityStatus;
2297
+ },
2298
+ set activityStatus(value) {
2299
+ activityStatus = value;
2300
+ },
2301
+ get statusTimeout() {
2302
+ return statusTimeout;
2303
+ },
2304
+ set statusTimeout(value) {
2305
+ statusTimeout = value;
2306
+ },
2307
+ get lastCtrlCAt() {
2308
+ return lastCtrlCAt;
2309
+ },
2310
+ set lastCtrlCAt(value) {
2311
+ lastCtrlCAt = value;
2312
+ }
2313
+ };
2314
+ const noteLocalRunId = (runId) => {
2315
+ if (!runId) return;
2316
+ localRunIds.add(runId);
2317
+ if (localRunIds.size > 200) {
2318
+ const [first] = localRunIds;
2319
+ if (first) localRunIds.delete(first);
2320
+ }
2321
+ };
2322
+ const forgetLocalRunId = (runId) => {
2323
+ localRunIds.delete(runId);
2324
+ };
2325
+ const isLocalRunId = (runId) => localRunIds.has(runId);
2326
+ const clearLocalRunIds = () => {
2327
+ localRunIds.clear();
2328
+ };
2329
+ const client = new GatewayChatClient({
2330
+ url: opts.url,
2331
+ token: opts.token,
2332
+ password: opts.password
2333
+ });
2334
+ const tui = new TUI(new ProcessTerminal());
2335
+ const header = new Text("", 1, 0);
2336
+ const statusContainer = new Container();
2337
+ const footer = new Text("", 1, 0);
2338
+ const chatLog = new ChatLog();
2339
+ const editor = new CustomEditor(tui, editorTheme);
2340
+ const root = new Container();
2341
+ root.addChild(header);
2342
+ root.addChild(chatLog);
2343
+ root.addChild(statusContainer);
2344
+ root.addChild(footer);
2345
+ root.addChild(editor);
2346
+ const updateAutocompleteProvider = () => {
2347
+ editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
2348
+ cfg: config,
2349
+ provider: sessionInfo.modelProvider,
2350
+ model: sessionInfo.model
2351
+ }), process.cwd()));
2352
+ };
2353
+ tui.addChild(root);
2354
+ tui.setFocus(editor);
2355
+ const formatSessionKey = (key) => {
2356
+ if (key === "global" || key === "unknown") return key;
2357
+ return parseAgentSessionKey(key)?.rest ?? key;
2358
+ };
2359
+ const formatAgentLabel = (id) => {
2360
+ const name = agentNames.get(id);
2361
+ return name ? `${id} (${name})` : id;
2362
+ };
2363
+ const resolveSessionKey = (raw) => {
2364
+ const trimmed = (raw ?? "").trim();
2365
+ if (sessionScope === "global") return "global";
2366
+ if (!trimmed) return buildAgentMainSessionKey({
2367
+ agentId: currentAgentId,
2368
+ mainKey: sessionMainKey
2369
+ });
2370
+ if (trimmed === "global" || trimmed === "unknown") return trimmed;
2371
+ if (trimmed.startsWith("agent:")) return trimmed;
2372
+ return `agent:${currentAgentId}:${trimmed}`;
2373
+ };
2374
+ currentSessionKey = resolveSessionKey(initialSessionInput);
2375
+ const updateHeader = () => {
2376
+ const sessionLabel = formatSessionKey(currentSessionKey);
2377
+ const agentLabel = formatAgentLabel(currentAgentId);
2378
+ header.setText(theme.header(`openclaw tui - ${client.connection.url} - agent ${agentLabel} - session ${sessionLabel}`));
2379
+ };
2380
+ const busyStates = new Set([
2381
+ "sending",
2382
+ "waiting",
2383
+ "streaming",
2384
+ "running"
2385
+ ]);
2386
+ let statusText = null;
2387
+ let statusLoader = null;
2388
+ const formatElapsed = (startMs) => {
2389
+ const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
2390
+ if (totalSeconds < 60) return `${totalSeconds}s`;
2391
+ return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
2392
+ };
2393
+ const ensureStatusText = () => {
2394
+ if (statusText) return;
2395
+ statusContainer.clear();
2396
+ statusLoader?.stop();
2397
+ statusLoader = null;
2398
+ statusText = new Text("", 1, 0);
2399
+ statusContainer.addChild(statusText);
2400
+ };
2401
+ const ensureStatusLoader = () => {
2402
+ if (statusLoader) return;
2403
+ statusContainer.clear();
2404
+ statusText = null;
2405
+ statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
2406
+ statusContainer.addChild(statusLoader);
2407
+ };
2408
+ let waitingTick = 0;
2409
+ let waitingTimer = null;
2410
+ let waitingPhrase = null;
2411
+ const updateBusyStatusMessage = () => {
2412
+ if (!statusLoader || !statusStartedAt) return;
2413
+ const elapsed = formatElapsed(statusStartedAt);
2414
+ if (activityStatus === "waiting") {
2415
+ waitingTick++;
2416
+ statusLoader.setMessage(buildWaitingStatusMessage({
2417
+ theme,
2418
+ tick: waitingTick,
2419
+ elapsed,
2420
+ connectionStatus,
2421
+ phrases: waitingPhrase ? [waitingPhrase] : void 0
2422
+ }));
2423
+ return;
2424
+ }
2425
+ statusLoader.setMessage(`${activityStatus} • ${elapsed} | ${connectionStatus}`);
2426
+ };
2427
+ const startStatusTimer = () => {
2428
+ if (statusTimer) return;
2429
+ statusTimer = setInterval(() => {
2430
+ if (!busyStates.has(activityStatus)) return;
2431
+ updateBusyStatusMessage();
2432
+ }, 1e3);
2433
+ };
2434
+ const stopStatusTimer = () => {
2435
+ if (!statusTimer) return;
2436
+ clearInterval(statusTimer);
2437
+ statusTimer = null;
2438
+ };
2439
+ const startWaitingTimer = () => {
2440
+ if (waitingTimer) return;
2441
+ if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
2442
+ waitingTick = 0;
2443
+ waitingTimer = setInterval(() => {
2444
+ if (activityStatus !== "waiting") return;
2445
+ updateBusyStatusMessage();
2446
+ }, 120);
2447
+ };
2448
+ const stopWaitingTimer = () => {
2449
+ if (!waitingTimer) return;
2450
+ clearInterval(waitingTimer);
2451
+ waitingTimer = null;
2452
+ waitingPhrase = null;
2453
+ };
2454
+ const renderStatus = () => {
2455
+ if (busyStates.has(activityStatus)) {
2456
+ if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
2457
+ ensureStatusLoader();
2458
+ if (activityStatus === "waiting") {
2459
+ stopStatusTimer();
2460
+ startWaitingTimer();
2461
+ } else {
2462
+ stopWaitingTimer();
2463
+ startStatusTimer();
2464
+ }
2465
+ updateBusyStatusMessage();
2466
+ } else {
2467
+ statusStartedAt = null;
2468
+ stopStatusTimer();
2469
+ stopWaitingTimer();
2470
+ statusLoader?.stop();
2471
+ statusLoader = null;
2472
+ ensureStatusText();
2473
+ const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
2474
+ statusText?.setText(theme.dim(text));
2475
+ }
2476
+ lastActivityStatus = activityStatus;
2477
+ };
2478
+ const setConnectionStatus = (text, ttlMs) => {
2479
+ connectionStatus = text;
2480
+ renderStatus();
2481
+ if (statusTimeout) clearTimeout(statusTimeout);
2482
+ if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
2483
+ connectionStatus = isConnected ? "connected" : "disconnected";
2484
+ renderStatus();
2485
+ }, ttlMs);
2486
+ };
2487
+ const setActivityStatus = (text) => {
2488
+ activityStatus = text;
2489
+ renderStatus();
2490
+ };
2491
+ const updateFooter = () => {
2492
+ const sessionKeyLabel = formatSessionKey(currentSessionKey);
2493
+ const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
2494
+ const agentLabel = formatAgentLabel(currentAgentId);
2495
+ const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
2496
+ const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
2497
+ const think = sessionInfo.thinkingLevel ?? "off";
2498
+ const verbose = sessionInfo.verboseLevel ?? "off";
2499
+ const reasoning = sessionInfo.reasoningLevel ?? "off";
2500
+ const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
2501
+ const footerParts = [
2502
+ `agent ${agentLabel}`,
2503
+ `session ${sessionLabel}`,
2504
+ modelLabel,
2505
+ think !== "off" ? `think ${think}` : null,
2506
+ verbose !== "off" ? `verbose ${verbose}` : null,
2507
+ reasoningLabel,
2508
+ tokens
2509
+ ].filter(Boolean);
2510
+ footer.setText(theme.dim(footerParts.join(" | ")));
2511
+ };
2512
+ const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
2513
+ const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
2514
+ client,
2515
+ chatLog,
2516
+ tui,
2517
+ opts,
2518
+ state,
2519
+ agentNames,
2520
+ initialSessionInput,
2521
+ initialSessionAgentId: (() => {
2522
+ if (!initialSessionInput) return null;
2523
+ const parsed = parseAgentSessionKey(initialSessionInput);
2524
+ return parsed ? normalizeAgentId(parsed.agentId) : null;
2525
+ })(),
2526
+ resolveSessionKey,
2527
+ updateHeader,
2528
+ updateFooter,
2529
+ updateAutocompleteProvider,
2530
+ setActivityStatus,
2531
+ clearLocalRunIds
2532
+ });
2533
+ const { handleChatEvent, handleAgentEvent } = createEventHandlers({
2534
+ chatLog,
2535
+ tui,
2536
+ state,
2537
+ setActivityStatus,
2538
+ refreshSessionInfo,
2539
+ loadHistory,
2540
+ isLocalRunId,
2541
+ forgetLocalRunId,
2542
+ clearLocalRunIds
2543
+ });
2544
+ const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
2545
+ client,
2546
+ chatLog,
2547
+ tui,
2548
+ opts,
2549
+ state,
2550
+ deliverDefault,
2551
+ openOverlay,
2552
+ closeOverlay,
2553
+ refreshSessionInfo,
2554
+ applySessionInfoFromPatch,
2555
+ loadHistory,
2556
+ setSession,
2557
+ refreshAgents,
2558
+ abortActive,
2559
+ setActivityStatus,
2560
+ formatSessionKey,
2561
+ noteLocalRunId,
2562
+ forgetLocalRunId
2563
+ });
2564
+ const { runLocalShellLine } = createLocalShellRunner({
2565
+ chatLog,
2566
+ tui,
2567
+ openOverlay,
2568
+ closeOverlay
2569
+ });
2570
+ updateAutocompleteProvider();
2571
+ editor.onSubmit = createEditorSubmitHandler({
2572
+ editor,
2573
+ handleCommand,
2574
+ sendMessage,
2575
+ handleBangLine: runLocalShellLine
2576
+ });
2577
+ editor.onEscape = () => {
2578
+ abortActive();
2579
+ };
2580
+ editor.onCtrlC = () => {
2581
+ const now = Date.now();
2582
+ if (editor.getText().trim().length > 0) {
2583
+ editor.setText("");
2584
+ setActivityStatus("cleared input");
2585
+ tui.requestRender();
2586
+ return;
2587
+ }
2588
+ if (now - lastCtrlCAt < 1e3) {
2589
+ client.stop();
2590
+ tui.stop();
2591
+ process.exit(0);
2592
+ }
2593
+ lastCtrlCAt = now;
2594
+ setActivityStatus("press ctrl+c again to exit");
2595
+ tui.requestRender();
2596
+ };
2597
+ editor.onCtrlD = () => {
2598
+ client.stop();
2599
+ tui.stop();
2600
+ process.exit(0);
2601
+ };
2602
+ editor.onCtrlO = () => {
2603
+ toolsExpanded = !toolsExpanded;
2604
+ chatLog.setToolsExpanded(toolsExpanded);
2605
+ setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
2606
+ tui.requestRender();
2607
+ };
2608
+ editor.onCtrlL = () => {
2609
+ openModelSelector();
2610
+ };
2611
+ editor.onCtrlG = () => {
2612
+ openAgentSelector();
2613
+ };
2614
+ editor.onCtrlP = () => {
2615
+ openSessionSelector();
2616
+ };
2617
+ editor.onCtrlT = () => {
2618
+ showThinking = !showThinking;
2619
+ loadHistory();
2620
+ };
2621
+ client.onEvent = (evt) => {
2622
+ if (evt.event === "chat") handleChatEvent(evt.payload);
2623
+ if (evt.event === "agent") handleAgentEvent(evt.payload);
2624
+ };
2625
+ client.onConnected = () => {
2626
+ isConnected = true;
2627
+ const reconnected = wasDisconnected;
2628
+ wasDisconnected = false;
2629
+ setConnectionStatus("connected");
2630
+ (async () => {
2631
+ await refreshAgents();
2632
+ updateHeader();
2633
+ await loadHistory();
2634
+ setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
2635
+ tui.requestRender();
2636
+ if (!autoMessageSent && autoMessage) {
2637
+ autoMessageSent = true;
2638
+ await sendMessage(autoMessage);
2639
+ }
2640
+ updateFooter();
2641
+ tui.requestRender();
2642
+ })();
2643
+ };
2644
+ client.onDisconnected = (reason) => {
2645
+ isConnected = false;
2646
+ wasDisconnected = true;
2647
+ historyLoaded = false;
2648
+ setConnectionStatus(`gateway disconnected: ${reason?.trim() ? reason.trim() : "closed"}`, 5e3);
2649
+ setActivityStatus("idle");
2650
+ updateFooter();
2651
+ tui.requestRender();
2652
+ };
2653
+ client.onGap = (info) => {
2654
+ setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
2655
+ tui.requestRender();
2656
+ };
2657
+ updateHeader();
2658
+ setConnectionStatus("connecting");
2659
+ updateFooter();
2660
+ tui.start();
2661
+ client.start();
2662
+ await new Promise((resolve) => {
2663
+ const finish = () => resolve();
2664
+ process.once("exit", finish);
2665
+ process.once("SIGINT", finish);
2666
+ process.once("SIGTERM", finish);
2667
+ });
2668
+ }
2669
+
2670
+ //#endregion
2671
+ export { runTui as t };