synurex 2026.2.19-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 (1944) hide show
  1. package/CHANGELOG.md +1594 -0
  2. package/LICENSE +21 -0
  3. package/README-header.png +0 -0
  4. package/README.md +547 -0
  5. package/THIRD_PARTY_LICENSES.txt +27 -0
  6. package/assets/avatar-placeholder.svg +19 -0
  7. package/assets/chrome-extension/README.md +22 -0
  8. package/assets/chrome-extension/background.js +438 -0
  9. package/assets/chrome-extension/icons/icon128.png +0 -0
  10. package/assets/chrome-extension/icons/icon16.png +0 -0
  11. package/assets/chrome-extension/icons/icon32.png +0 -0
  12. package/assets/chrome-extension/icons/icon48.png +0 -0
  13. package/assets/chrome-extension/manifest.json +25 -0
  14. package/assets/chrome-extension/options.html +196 -0
  15. package/assets/chrome-extension/options.js +59 -0
  16. package/assets/dmg-background-small.png +0 -0
  17. package/assets/dmg-background.png +0 -0
  18. package/dist/Synurex-root-CbEdPwLE.js +84 -0
  19. package/dist/Synurex-root-CwTH98Xq.js +84 -0
  20. package/dist/accounts-B6AkTILW.js +250 -0
  21. package/dist/accounts-BqN2SY0Z.js +251 -0
  22. package/dist/acp-cli-C1jHGRAm.js +926 -0
  23. package/dist/acp-cli-C3a9o7M2.js +923 -0
  24. package/dist/agent-9DtpfYJk.js +704 -0
  25. package/dist/agent-N2Qtra36.js +704 -0
  26. package/dist/agent-scope-CRRhJ7Hf.js +370 -0
  27. package/dist/agent-scope-CpSMNwey.js +611 -0
  28. package/dist/agent-scope-DNmzkYn4.js +370 -0
  29. package/dist/archive-Dy3Ezb-5.js +85 -0
  30. package/dist/archive-ccN9aDgq.js +85 -0
  31. package/dist/audit--oGM5x0J.js +1853 -0
  32. package/dist/audit-CM8pyctg.js +1853 -0
  33. package/dist/auth-3NYeRZYb.js +192 -0
  34. package/dist/auth-CVOB8Q9A.js +192 -0
  35. package/dist/auth-health-BSF-YNSl.js +149 -0
  36. package/dist/auth-health-BrChJQW-.js +149 -0
  37. package/dist/auth-profiles-xwZAMwdh.js +2981 -0
  38. package/dist/boolean-BgXe2hyu.js +30 -0
  39. package/dist/brew-CAcErcKz.js +46 -0
  40. package/dist/brew-CcZV0dSS.js +46 -0
  41. package/dist/call-BJsfB_NC.js +280 -0
  42. package/dist/call-mnjMMyVJ.js +280 -0
  43. package/dist/channel-options-BXpm2xHl.js +32 -0
  44. package/dist/channel-options-Bjh17Z08.js +62 -0
  45. package/dist/channel-selection-D2iDbzGy.js +51 -0
  46. package/dist/channel-selection-i-6yBKAk.js +51 -0
  47. package/dist/channel-summary-Cw9cmi4M.js +1216 -0
  48. package/dist/channel-summary-D7joKboS.js +1216 -0
  49. package/dist/channels-cli-8HUWD1_p.js +1415 -0
  50. package/dist/channels-cli-DFia3kGl.js +1413 -0
  51. package/dist/channels-status-issues-CT6Q1t1h.js +18 -0
  52. package/dist/channels-status-issues-CgVNTMMz.js +18 -0
  53. package/dist/chrome-CXlGlG3I.js +1953 -0
  54. package/dist/chrome-D0V3Ybil.js +1973 -0
  55. package/dist/clack-prompter-B9yLhyOm.js +92 -0
  56. package/dist/clack-prompter-C7J7X7j7.js +92 -0
  57. package/dist/cli-1b35n5Cc.js +86 -0
  58. package/dist/cli-BYL7Dz_4.js +89 -0
  59. package/dist/cli-utils-BkRQdAoC.js +43 -0
  60. package/dist/cli-utils-DzrdzskQ.js +43 -0
  61. package/dist/client-atZzP6kK.js +1814 -0
  62. package/dist/command-format-CEnDvS9q.js +56 -0
  63. package/dist/command-format-DUskR3Ej.js +42 -0
  64. package/dist/command-format-rFzrPj6c.js +56 -0
  65. package/dist/command-options-BnW-e302.js +33 -0
  66. package/dist/commands-U_88HsqX.js +230 -0
  67. package/dist/completion-cli-Bh3ds9Rv.js +773 -0
  68. package/dist/completion-cli-BhVl7J3C.js +434 -0
  69. package/dist/config-AFzxllYx.js +4924 -0
  70. package/dist/config-BBxxzNm-.js +4923 -0
  71. package/dist/config-UB10lGn3.js +5664 -0
  72. package/dist/config-guard-BCvAEaxA.js +5484 -0
  73. package/dist/configure-0W-OLHK1.js +895 -0
  74. package/dist/configure-D4ci8KU6.js +896 -0
  75. package/dist/constants-Cf-Zsiqd.js +65 -0
  76. package/dist/constants-CpnpJcmu.js +65 -0
  77. package/dist/control-service-BLzGkUMf.js +61 -0
  78. package/dist/control-service-DpyCNhOa.js +61 -0
  79. package/dist/cron-cli-2W0wnKNI.js +457 -0
  80. package/dist/cron-cli-BGc0ZmXl.js +454 -0
  81. package/dist/daemon-cli-C4IIRXZr.js +758 -0
  82. package/dist/daemon-cli-RFrEzOyc.js +757 -0
  83. package/dist/daemon-runtime-BlKOqOPH.js +517 -0
  84. package/dist/daemon-runtime-CRdmLdkD.js +517 -0
  85. package/dist/deliver-B0C5m0kU.js +2587 -0
  86. package/dist/deliver-BUV-sfaF.js +2557 -0
  87. package/dist/deliver-CQQ0e2eM.js +2587 -0
  88. package/dist/deps-D1eiWUgD.js +27 -0
  89. package/dist/deps-DgFrcXzw.js +27 -0
  90. package/dist/devices-cli-CUYqlUBU.js +207 -0
  91. package/dist/devices-cli-De1Q_0ob.js +204 -0
  92. package/dist/directory-cli-DYkFHmO6.js +244 -0
  93. package/dist/directory-cli-DoquUzqm.js +247 -0
  94. package/dist/dispatcher-BLeixzBZ.js +160 -0
  95. package/dist/dns-cli-C5dXU6Nk.js +198 -0
  96. package/dist/dns-cli-rkR0HJpi.js +201 -0
  97. package/dist/docs-cli-CqtgkhfC.js +161 -0
  98. package/dist/docs-cli-DrFTuzUe.js +159 -0
  99. package/dist/doctor-Cakg6jea.js +2577 -0
  100. package/dist/doctor-Cuk5zryG.js +2579 -0
  101. package/dist/entry.js +1336 -0
  102. package/dist/env-DgIs6BZg.js +32 -0
  103. package/dist/errors-C8t2PjW_.js +1952 -0
  104. package/dist/exec-B8JKbXKW.js +246 -0
  105. package/dist/exec-Dloa-d0d.js +246 -0
  106. package/dist/exec-EqLC5sqa.js +1103 -0
  107. package/dist/exec-approvals-B-sykLIC.js +1043 -0
  108. package/dist/exec-approvals-Ff_p0CYa.js +1043 -0
  109. package/dist/exec-approvals-cli-CfSTGR7F.js +388 -0
  110. package/dist/exec-approvals-cli-DBgnm_6P.js +385 -0
  111. package/dist/extensionAPI.js +68185 -0
  112. package/dist/format-8citvr_1.js +34 -0
  113. package/dist/format-tlvh4-cQ.js +34 -0
  114. package/dist/gateway-cli-BKJbSNiq.js +17878 -0
  115. package/dist/gateway-cli-DMbgzP3o.js +17877 -0
  116. package/dist/gateway-rpc-CFkdcw9l.js +28 -0
  117. package/dist/gateway-rpc-CJljb7MY.js +28 -0
  118. package/dist/github-copilot-auth-BGWtD7lK.js +1256 -0
  119. package/dist/github-copilot-auth-Bog6I9WM.js +1256 -0
  120. package/dist/github-copilot-token-BOoCTERW.js +103 -0
  121. package/dist/github-copilot-token-SLWintYd.js +103 -0
  122. package/dist/github-copilot-token-_jdpoYjM.js +103 -0
  123. package/dist/gmail-setup-utils-C97cHaGd.js +428 -0
  124. package/dist/gmail-setup-utils-n354D0jO.js +428 -0
  125. package/dist/health-format-CLSugjQl.js +1383 -0
  126. package/dist/health-format-KsXnqZiA.js +1382 -0
  127. package/dist/help-format-DuMTLWZ-.js +17 -0
  128. package/dist/help-format-GYRujDx9.js +17 -0
  129. package/dist/helpers-BiyEksaK.js +25 -0
  130. package/dist/helpers-DMlRCrD6.js +10 -0
  131. package/dist/helpers-azbX_hrI.js +25 -0
  132. package/dist/helpers-yjIEMzi8.js +10 -0
  133. package/dist/hooks-cli-DXs2Jiyd.js +1061 -0
  134. package/dist/hooks-cli-Dsah_Ryz.js +1058 -0
  135. package/dist/hooks-status-CpkHFMVY.js +443 -0
  136. package/dist/hooks-status-DQRtaH38.js +443 -0
  137. package/dist/image-C6SHcuJM.js +1421 -0
  138. package/dist/image-Cyv4Hr2t.js +629 -0
  139. package/dist/image-DXuHvpqC.js +629 -0
  140. package/dist/index.js +5667 -0
  141. package/dist/installs-BvY-yqDY.js +425 -0
  142. package/dist/installs-Snp4gUlG.js +425 -0
  143. package/dist/is-main-B6kCyqsv.js +25 -0
  144. package/dist/is-main-PYGa3tDA.js +25 -0
  145. package/dist/links-B79LZSNJ.js +15 -0
  146. package/dist/links-iCD68SwJ.js +15 -0
  147. package/dist/loader-ysGIXyYq.js +64701 -0
  148. package/dist/logging-BWRYHvLp.js +1 -0
  149. package/dist/logging-CzN9OPmT.js +15 -0
  150. package/dist/logging-awp_aUN6.js +15 -0
  151. package/dist/logging-pqyrk15z.js +1 -0
  152. package/dist/login-qr-BEXsF0Oj.js +475 -0
  153. package/dist/login-qr-D823w1Qv.js +478 -0
  154. package/dist/login-qr-wnUfVUoC.js +478 -0
  155. package/dist/logs-cli-D912P9Qo.js +230 -0
  156. package/dist/logs-cli-DHYl4Nfl.js +227 -0
  157. package/dist/manager-DORkoiXy.js +3216 -0
  158. package/dist/manager-MLoKmXjg.js +3218 -0
  159. package/dist/manager-e20ne1Ai.js +3216 -0
  160. package/dist/manifest-registry-D8FEq9qs.js +668 -0
  161. package/dist/manifest-registry-DjRSe72U.js +668 -0
  162. package/dist/message-channel-DJEeCAZD.js +110 -0
  163. package/dist/message-channel-DcxF0eJh.js +110 -0
  164. package/dist/model-selection-CjYymzT8.js +2983 -0
  165. package/dist/model-selection-Cz_VcpX5.js +2734 -0
  166. package/dist/models-cli-CURq5BOw.js +2542 -0
  167. package/dist/models-cli-_y06d7uQ.js +2545 -0
  168. package/dist/net-MZzhgr1g.js +1814 -0
  169. package/dist/node-cli-BkEdPem3.js +1456 -0
  170. package/dist/node-cli-PesFC8YY.js +1459 -0
  171. package/dist/node-service-CmyQuldc.js +67 -0
  172. package/dist/node-service-DB0Rp9Fr.js +67 -0
  173. package/dist/nodes-cli-BV7z71Ke.js +1207 -0
  174. package/dist/nodes-cli-D-pPXmLu.js +1210 -0
  175. package/dist/nodes-screen-B240wNB8.js +157 -0
  176. package/dist/nodes-screen-CGLXLco9.js +157 -0
  177. package/dist/note-_C44YfAQ.js +73 -0
  178. package/dist/note-rStT8AJi.js +73 -0
  179. package/dist/onboard-channels-CSGrNeHm.js +671 -0
  180. package/dist/onboard-channels-CyYMvXjh.js +671 -0
  181. package/dist/onboard-skills-BzZrWnt3.js +3452 -0
  182. package/dist/onboard-skills-Z3OoXEqp.js +3452 -0
  183. package/dist/onboarding--5CEtfSX.js +3269 -0
  184. package/dist/pairing-cli-BrPmwezL.js +114 -0
  185. package/dist/pairing-cli-CN183i69.js +117 -0
  186. package/dist/pairing-labels-CrJtLbMY.js +9 -0
  187. package/dist/pairing-labels-DXioxZ5X.js +9 -0
  188. package/dist/pairing-store-D_NP0mJs.js +391 -0
  189. package/dist/pairing-store-pdzxfI5n.js +391 -0
  190. package/dist/parse-BZz5lHzQ.js +23 -0
  191. package/dist/parse-DqAvJRIf.js +23 -0
  192. package/dist/parse-log-line-BnB7770k.js +44 -0
  193. package/dist/parse-log-line-DSvJi17i.js +44 -0
  194. package/dist/parse-timeout-DV8NQQWk.js +16 -0
  195. package/dist/parse-timeout-Du-wHHNi.js +16 -0
  196. package/dist/path-env-Bc8ZqjfY.js +77 -0
  197. package/dist/path-env-DwZUJC_M.js +77 -0
  198. package/dist/paths-8P2BYpvK.js +156 -0
  199. package/dist/paths-Cn5vXlEi.js +43 -0
  200. package/dist/paths-D4TjaAs9.js +40 -0
  201. package/dist/paths-Drx5WZ13.js +172 -0
  202. package/dist/paths-mzsdSoO2.js +43 -0
  203. package/dist/pi-embedded-helpers-Dpu3lm3V.js +1303 -0
  204. package/dist/pi-embedded-helpers-N_L31uhW.js +1303 -0
  205. package/dist/pi-embedded-helpers-dkrwwXev.js +8481 -0
  206. package/dist/pi-model-discovery-CV2V1HHz.js +20 -0
  207. package/dist/pi-model-discovery-DzEIEgHL.js +20 -0
  208. package/dist/pi-model-discovery-EhM2JAQo.js +20 -0
  209. package/dist/pi-tools.policy-m0G0As1p.js +230 -0
  210. package/dist/plugin-auto-enable-Bu3hK0U6.js +460 -0
  211. package/dist/plugin-auto-enable-Ca3Ou67i.js +460 -0
  212. package/dist/plugin-sdk/index.js +24446 -0
  213. package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
  214. package/dist/plugins-Bng3p5bC.js +496 -0
  215. package/dist/plugins-C1mc_xWv.js +495 -0
  216. package/dist/plugins-cli-B8FonfqG.js +441 -0
  217. package/dist/plugins-cli-B9q0wqUI.js +444 -0
  218. package/dist/ports-DKGBzWgI.js +96 -0
  219. package/dist/program-_5hB5I-4.js +191 -0
  220. package/dist/progress-Bcjniu7m.js +133 -0
  221. package/dist/progress-DWODVbwW.js +133 -0
  222. package/dist/prompt-style-CFsleyxV.js +9 -0
  223. package/dist/prompt-style-DZli5767.js +9 -0
  224. package/dist/prompts-CudpZgTI.js +10 -0
  225. package/dist/prompts-FbZThK8w.js +10 -0
  226. package/dist/pw-ai-BUeSOvm-.js +1649 -0
  227. package/dist/pw-ai-GjX4Az_L.js +1649 -0
  228. package/dist/pw-ai-bugVLPkL.js +1651 -0
  229. package/dist/qmd-manager-C1JB3Owf.js +677 -0
  230. package/dist/qmd-manager-TkF_5Pm-.js +676 -0
  231. package/dist/qmd-manager-t9qHekRb.js +674 -0
  232. package/dist/redact-BIMJ3ntQ.js +94 -0
  233. package/dist/redact-Bt-krp_b.js +97 -0
  234. package/dist/redact-DJCFY628.js +97 -0
  235. package/dist/register.subclis-CZG20DZj.js +348 -0
  236. package/dist/reply-8T1JOF0R.js +64704 -0
  237. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  238. package/dist/routes-BxFcXB4m.js +2411 -0
  239. package/dist/routes-Dw3vw8Re.js +2411 -0
  240. package/dist/rpc-DgcF4XNR.js +95 -0
  241. package/dist/rpc-f-LmE9z_.js +95 -0
  242. package/dist/run-main-_bbXf2vQ.js +194 -0
  243. package/dist/sandbox-BcOPJhQv.js +2945 -0
  244. package/dist/sandbox-DfBaWfDh.js +2944 -0
  245. package/dist/sandbox-cli-BRcke02J.js +460 -0
  246. package/dist/sandbox-cli-CbUgIVf2.js +463 -0
  247. package/dist/security-cli-76hHzPsz.js +505 -0
  248. package/dist/security-cli-CQ6iSAev.js +508 -0
  249. package/dist/server-context-BuV65eg5.js +740 -0
  250. package/dist/server-context-CFielb4y.js +740 -0
  251. package/dist/server-node-events-CkLBKtGs.js +216 -0
  252. package/dist/server-node-events-D_3bg9qE.js +219 -0
  253. package/dist/service-CZFM7dlu.js +680 -0
  254. package/dist/service-audit-DBdadurs.js +537 -0
  255. package/dist/service-audit-DptlZVXP.js +537 -0
  256. package/dist/service-sZqtAG53.js +680 -0
  257. package/dist/session-cost-usage-CPvtWzot.js +692 -0
  258. package/dist/session-cost-usage-lYVH5MAy.js +692 -0
  259. package/dist/session-key-DrNCyvP1.js +182 -0
  260. package/dist/session-key-n2HVbrj0.js +182 -0
  261. package/dist/shared-Bl4lcfSF.js +74 -0
  262. package/dist/shared-C79dnas0.js +74 -0
  263. package/dist/shared-CDe5yKDd.js +152 -0
  264. package/dist/shared-Cpd7X2eE.js +152 -0
  265. package/dist/skill-scanner-BoGjHXUZ.js +255 -0
  266. package/dist/skill-scanner-COatt01v.js +255 -0
  267. package/dist/skills-CrYcs9jK.js +694 -0
  268. package/dist/skills-DxzXqcWw.js +693 -0
  269. package/dist/skills-cli-BWqUiFIC.js +287 -0
  270. package/dist/skills-cli-C2rWGqKQ.js +290 -0
  271. package/dist/skills-status-Bhe2beiQ.js +187 -0
  272. package/dist/skills-status-DQyBTrvU.js +187 -0
  273. package/dist/sqlite-BjBQdG8T.js +239 -0
  274. package/dist/sqlite-BjhYBODp.js +221 -0
  275. package/dist/sqlite-CbZh0dx1.js +239 -0
  276. package/dist/status-BF8IVV7c.js +21 -0
  277. package/dist/status-BHPh7bCk.js +27 -0
  278. package/dist/status-CWDof7Cn.js +21 -0
  279. package/dist/status-DyjCSdtm.js +27 -0
  280. package/dist/status-RJGk9wHW.js +3177 -0
  281. package/dist/subsystem-DPYBJG7C.js +838 -0
  282. package/dist/system-cli-BY3oOcLX.js +83 -0
  283. package/dist/system-cli-pg7MxYKd.js +80 -0
  284. package/dist/systemd-DerMq_3Y.js +438 -0
  285. package/dist/systemd-Gt0riLnX.js +438 -0
  286. package/dist/systemd-hints-C6JS-A6Y.js +19 -0
  287. package/dist/systemd-hints-Db4JjAxJ.js +19 -0
  288. package/dist/systemd-linger-CRL7Xf4C.js +75 -0
  289. package/dist/systemd-linger-DS0IcHsk.js +75 -0
  290. package/dist/table-BzJyfJCd.js +279 -0
  291. package/dist/table-DCcFNw6e.js +279 -0
  292. package/dist/tailnet-Byp3obcc.js +42 -0
  293. package/dist/tailnet-DLDGNuH2.js +42 -0
  294. package/dist/tailscale-9MusRvOi.js +225 -0
  295. package/dist/tailscale-CGhNcgVS.js +252 -0
  296. package/dist/tool-display-C9u4CdQu.js +795 -0
  297. package/dist/tool-display-D_HGmnfa.js +795 -0
  298. package/dist/transcript-events-Bv_eRVym.js +17 -0
  299. package/dist/transcript-events-ChU6IQwp.js +17 -0
  300. package/dist/transcript-events-JLH5W4He.js +17 -0
  301. package/dist/tui-BPqDn4Jf.js +3090 -0
  302. package/dist/tui-BniTBjBP.js +3089 -0
  303. package/dist/tui-cli-AeeP52_J.js +58 -0
  304. package/dist/tui-cli-DrWl0dkQ.js +55 -0
  305. package/dist/update-BKGU5x_o.js +317 -0
  306. package/dist/update-CZqqbW73.js +317 -0
  307. package/dist/update-cli-DTXxX27F.js +1036 -0
  308. package/dist/update-cli-j0POazuO.js +1034 -0
  309. package/dist/update-runner-BY-i_k4L.js +1458 -0
  310. package/dist/update-runner-CmdPxJg5.js +1458 -0
  311. package/dist/usage-format-BcU1flOY.js +36 -0
  312. package/dist/usage-format-DvowRSs-.js +36 -0
  313. package/dist/utils-C7NsUvD1.js +192 -0
  314. package/dist/utils-DBu98aoz.js +188 -0
  315. package/dist/webhooks-cli-BBw-pRTs.js +309 -0
  316. package/dist/webhooks-cli-BXxSGFuL.js +312 -0
  317. package/dist/widearea-dns-C2mRm6hu.js +127 -0
  318. package/dist/widearea-dns-DbdWF6kP.js +127 -0
  319. package/dist/ws-CEcdsnN9.js +13 -0
  320. package/dist/ws-D091yo4M.js +13 -0
  321. package/dist/ws-log-Bpm8rpoP.js +267 -0
  322. package/dist/ws-log-vBkmxf4_.js +267 -0
  323. package/dist/wsl-QYB9yGZN.js +160 -0
  324. package/docs/.i18n/README.md +31 -0
  325. package/docs/.i18n/glossary.zh-CN.json +210 -0
  326. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  327. package/docs/CNAME +1 -0
  328. package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
  329. package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
  330. package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
  331. package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
  332. package/docs/assets/macos-onboarding/05-permissions.png +0 -0
  333. package/docs/assets/openclaw-logo-text-dark.png +0 -0
  334. package/docs/assets/openclaw-logo-text.png +0 -0
  335. package/docs/assets/pixel-lobster.svg +60 -0
  336. package/docs/assets/showcase/agents-ui.jpg +0 -0
  337. package/docs/assets/showcase/bambu-cli.png +0 -0
  338. package/docs/assets/showcase/codexmonitor.png +0 -0
  339. package/docs/assets/showcase/gohome-grafana.png +0 -0
  340. package/docs/assets/showcase/ios-testflight.jpg +0 -0
  341. package/docs/assets/showcase/oura-health.png +0 -0
  342. package/docs/assets/showcase/padel-cli.svg +11 -0
  343. package/docs/assets/showcase/padel-screenshot.jpg +0 -0
  344. package/docs/assets/showcase/papla-tts.jpg +0 -0
  345. package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
  346. package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
  347. package/docs/assets/showcase/roborock-status.svg +13 -0
  348. package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
  349. package/docs/assets/showcase/snag.png +0 -0
  350. package/docs/assets/showcase/tesco-shop.jpg +0 -0
  351. package/docs/assets/showcase/wienerlinien.png +0 -0
  352. package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
  353. package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
  354. package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
  355. package/docs/automation/auth-monitoring.md +44 -0
  356. package/docs/automation/cron-jobs.md +471 -0
  357. package/docs/automation/cron-vs-heartbeat.md +282 -0
  358. package/docs/automation/gmail-pubsub.md +256 -0
  359. package/docs/automation/hooks.md +916 -0
  360. package/docs/automation/poll.md +69 -0
  361. package/docs/automation/troubleshooting.md +122 -0
  362. package/docs/automation/webhook.md +163 -0
  363. package/docs/brave-search.md +41 -0
  364. package/docs/channels/bluebubbles.md +340 -0
  365. package/docs/channels/broadcast-groups.md +442 -0
  366. package/docs/channels/channel-routing.md +114 -0
  367. package/docs/channels/discord.md +476 -0
  368. package/docs/channels/feishu.md +579 -0
  369. package/docs/channels/googlechat.md +252 -0
  370. package/docs/channels/grammy.md +31 -0
  371. package/docs/channels/group-messages.md +84 -0
  372. package/docs/channels/groups.md +374 -0
  373. package/docs/channels/imessage.md +321 -0
  374. package/docs/channels/index.md +46 -0
  375. package/docs/channels/line.md +186 -0
  376. package/docs/channels/location.md +56 -0
  377. package/docs/channels/matrix.md +259 -0
  378. package/docs/channels/mattermost.md +138 -0
  379. package/docs/channels/msteams.md +769 -0
  380. package/docs/channels/nextcloud-talk.md +138 -0
  381. package/docs/channels/nostr.md +233 -0
  382. package/docs/channels/pairing.md +86 -0
  383. package/docs/channels/signal.md +228 -0
  384. package/docs/channels/slack.md +574 -0
  385. package/docs/channels/telegram.md +770 -0
  386. package/docs/channels/tlon.md +132 -0
  387. package/docs/channels/troubleshooting.md +116 -0
  388. package/docs/channels/twitch.md +379 -0
  389. package/docs/channels/whatsapp.md +406 -0
  390. package/docs/channels/zalo.md +189 -0
  391. package/docs/channels/zalouser.md +140 -0
  392. package/docs/cli/acp.md +170 -0
  393. package/docs/cli/agent.md +24 -0
  394. package/docs/cli/agents.md +75 -0
  395. package/docs/cli/approvals.md +50 -0
  396. package/docs/cli/browser.md +107 -0
  397. package/docs/cli/channels.md +79 -0
  398. package/docs/cli/config.md +50 -0
  399. package/docs/cli/configure.md +33 -0
  400. package/docs/cli/cron.md +42 -0
  401. package/docs/cli/dashboard.md +16 -0
  402. package/docs/cli/devices.md +70 -0
  403. package/docs/cli/directory.md +63 -0
  404. package/docs/cli/dns.md +23 -0
  405. package/docs/cli/docs.md +15 -0
  406. package/docs/cli/doctor.md +41 -0
  407. package/docs/cli/gateway.md +202 -0
  408. package/docs/cli/health.md +21 -0
  409. package/docs/cli/hooks.md +304 -0
  410. package/docs/cli/index.md +1031 -0
  411. package/docs/cli/logs.md +24 -0
  412. package/docs/cli/memory.md +45 -0
  413. package/docs/cli/message.md +239 -0
  414. package/docs/cli/models.md +79 -0
  415. package/docs/cli/node.md +112 -0
  416. package/docs/cli/nodes.md +73 -0
  417. package/docs/cli/onboard.md +43 -0
  418. package/docs/cli/pairing.md +21 -0
  419. package/docs/cli/plugins.md +62 -0
  420. package/docs/cli/reset.md +17 -0
  421. package/docs/cli/sandbox.md +152 -0
  422. package/docs/cli/security.md +26 -0
  423. package/docs/cli/sessions.md +16 -0
  424. package/docs/cli/setup.md +29 -0
  425. package/docs/cli/skills.md +26 -0
  426. package/docs/cli/status.md +26 -0
  427. package/docs/cli/system.md +60 -0
  428. package/docs/cli/tui.md +23 -0
  429. package/docs/cli/uninstall.md +17 -0
  430. package/docs/cli/update.md +98 -0
  431. package/docs/cli/voicecall.md +34 -0
  432. package/docs/cli/webhooks.md +25 -0
  433. package/docs/concepts/agent-loop.md +146 -0
  434. package/docs/concepts/agent-workspace.md +233 -0
  435. package/docs/concepts/agent.md +123 -0
  436. package/docs/concepts/architecture.md +131 -0
  437. package/docs/concepts/compaction.md +61 -0
  438. package/docs/concepts/context.md +161 -0
  439. package/docs/concepts/features.md +53 -0
  440. package/docs/concepts/markdown-formatting.md +130 -0
  441. package/docs/concepts/memory.md +556 -0
  442. package/docs/concepts/messages.md +154 -0
  443. package/docs/concepts/model-failover.md +149 -0
  444. package/docs/concepts/model-providers.md +316 -0
  445. package/docs/concepts/models.md +208 -0
  446. package/docs/concepts/multi-agent.md +376 -0
  447. package/docs/concepts/oauth.md +145 -0
  448. package/docs/concepts/presence.md +102 -0
  449. package/docs/concepts/queue.md +89 -0
  450. package/docs/concepts/retry.md +69 -0
  451. package/docs/concepts/session-pruning.md +122 -0
  452. package/docs/concepts/session-tool.md +193 -0
  453. package/docs/concepts/session.md +204 -0
  454. package/docs/concepts/sessions.md +10 -0
  455. package/docs/concepts/streaming.md +135 -0
  456. package/docs/concepts/system-prompt.md +115 -0
  457. package/docs/concepts/timezone.md +91 -0
  458. package/docs/concepts/typebox.md +289 -0
  459. package/docs/concepts/typing-indicators.md +68 -0
  460. package/docs/concepts/usage-tracking.md +35 -0
  461. package/docs/date-time.md +128 -0
  462. package/docs/debug/node-issue.md +85 -0
  463. package/docs/diagnostics/flags.md +91 -0
  464. package/docs/docs.json +1802 -0
  465. package/docs/experiments/onboarding-config-protocol.md +40 -0
  466. package/docs/experiments/plans/cron-add-hardening.md +63 -0
  467. package/docs/experiments/plans/group-policy-hardening.md +40 -0
  468. package/docs/experiments/plans/openresponses-gateway.md +123 -0
  469. package/docs/experiments/proposals/model-config.md +36 -0
  470. package/docs/experiments/research/memory.md +228 -0
  471. package/docs/gateway/authentication.md +145 -0
  472. package/docs/gateway/background-process.md +93 -0
  473. package/docs/gateway/bonjour.md +170 -0
  474. package/docs/gateway/bridge-protocol.md +89 -0
  475. package/docs/gateway/cli-backends.md +225 -0
  476. package/docs/gateway/configuration-examples.md +606 -0
  477. package/docs/gateway/configuration.md +3416 -0
  478. package/docs/gateway/discovery.md +116 -0
  479. package/docs/gateway/doctor.md +282 -0
  480. package/docs/gateway/gateway-lock.md +34 -0
  481. package/docs/gateway/health.md +35 -0
  482. package/docs/gateway/heartbeat.md +364 -0
  483. package/docs/gateway/index.md +330 -0
  484. package/docs/gateway/local-models.md +150 -0
  485. package/docs/gateway/logging.md +113 -0
  486. package/docs/gateway/multiple-gateways.md +112 -0
  487. package/docs/gateway/network-model.md +17 -0
  488. package/docs/gateway/openai-http-api.md +118 -0
  489. package/docs/gateway/openresponses-http-api.md +317 -0
  490. package/docs/gateway/pairing.md +99 -0
  491. package/docs/gateway/protocol.md +221 -0
  492. package/docs/gateway/remote-gateway-readme.md +157 -0
  493. package/docs/gateway/remote.md +129 -0
  494. package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +128 -0
  495. package/docs/gateway/sandboxing.md +193 -0
  496. package/docs/gateway/security/index.md +829 -0
  497. package/docs/gateway/tailscale.md +127 -0
  498. package/docs/gateway/tools-invoke-http-api.md +85 -0
  499. package/docs/gateway/troubleshooting.md +318 -0
  500. package/docs/help/debugging.md +162 -0
  501. package/docs/help/environment.md +81 -0
  502. package/docs/help/faq.md +2848 -0
  503. package/docs/help/index.md +21 -0
  504. package/docs/help/scripts.md +28 -0
  505. package/docs/help/submitting-a-pr.md +398 -0
  506. package/docs/help/submitting-an-issue.md +152 -0
  507. package/docs/help/testing.md +368 -0
  508. package/docs/help/troubleshooting.md +265 -0
  509. package/docs/hooks/soul-evil.md +69 -0
  510. package/docs/images/feishu-step2-create-app.png +0 -0
  511. package/docs/images/feishu-step3-credentials.png +0 -0
  512. package/docs/images/feishu-step4-permissions.png +0 -0
  513. package/docs/images/feishu-step5-bot-capability.png +0 -0
  514. package/docs/images/feishu-step6-event-subscription.png +0 -0
  515. package/docs/images/groups-flow.svg +52 -0
  516. package/docs/images/mobile-ui-screenshot.png +0 -0
  517. package/docs/index.md +192 -0
  518. package/docs/install/ansible.md +208 -0
  519. package/docs/install/bun.md +59 -0
  520. package/docs/install/development-channels.md +75 -0
  521. package/docs/install/docker.md +567 -0
  522. package/docs/install/exe-dev.md +126 -0
  523. package/docs/install/fly.md +486 -0
  524. package/docs/install/gcp.md +504 -0
  525. package/docs/install/hetzner.md +330 -0
  526. package/docs/install/index.md +203 -0
  527. package/docs/install/installer.md +385 -0
  528. package/docs/install/macos-vm.md +281 -0
  529. package/docs/install/migrating.md +192 -0
  530. package/docs/install/nix.md +96 -0
  531. package/docs/install/node.md +138 -0
  532. package/docs/install/northflank.mdx +53 -0
  533. package/docs/install/railway.mdx +99 -0
  534. package/docs/install/render.mdx +159 -0
  535. package/docs/install/uninstall.md +128 -0
  536. package/docs/install/updating.md +231 -0
  537. package/docs/logging.md +350 -0
  538. package/docs/network.md +54 -0
  539. package/docs/nodes/audio.md +114 -0
  540. package/docs/nodes/camera.md +156 -0
  541. package/docs/nodes/images.md +72 -0
  542. package/docs/nodes/index.md +342 -0
  543. package/docs/nodes/location-command.md +113 -0
  544. package/docs/nodes/media-understanding.md +379 -0
  545. package/docs/nodes/talk.md +90 -0
  546. package/docs/nodes/troubleshooting.md +112 -0
  547. package/docs/nodes/voicewake.md +65 -0
  548. package/docs/perplexity.md +80 -0
  549. package/docs/pi-dev.md +70 -0
  550. package/docs/pi.md +612 -0
  551. package/docs/platforms/android.md +151 -0
  552. package/docs/platforms/digitalocean.md +262 -0
  553. package/docs/platforms/index.md +53 -0
  554. package/docs/platforms/ios.md +107 -0
  555. package/docs/platforms/linux.md +94 -0
  556. package/docs/platforms/mac/bundled-gateway.md +73 -0
  557. package/docs/platforms/mac/canvas.md +125 -0
  558. package/docs/platforms/mac/child-process.md +69 -0
  559. package/docs/platforms/mac/dev-setup.md +104 -0
  560. package/docs/platforms/mac/health.md +34 -0
  561. package/docs/platforms/mac/icon.md +31 -0
  562. package/docs/platforms/mac/logging.md +57 -0
  563. package/docs/platforms/mac/menu-bar.md +81 -0
  564. package/docs/platforms/mac/peekaboo.md +65 -0
  565. package/docs/platforms/mac/permissions.md +50 -0
  566. package/docs/platforms/mac/release.md +85 -0
  567. package/docs/platforms/mac/remote.md +83 -0
  568. package/docs/platforms/mac/signing.md +47 -0
  569. package/docs/platforms/mac/skills.md +33 -0
  570. package/docs/platforms/mac/voice-overlay.md +60 -0
  571. package/docs/platforms/mac/voicewake.md +67 -0
  572. package/docs/platforms/mac/webchat.md +43 -0
  573. package/docs/platforms/mac/xpc.md +61 -0
  574. package/docs/platforms/macos.md +203 -0
  575. package/docs/platforms/oracle.md +303 -0
  576. package/docs/platforms/raspberry-pi.md +358 -0
  577. package/docs/platforms/windows.md +159 -0
  578. package/docs/plugins/agent-tools.md +99 -0
  579. package/docs/plugins/manifest.md +71 -0
  580. package/docs/plugins/voice-call.md +284 -0
  581. package/docs/plugins/zalouser.md +81 -0
  582. package/docs/prose.md +134 -0
  583. package/docs/providers/anthropic.md +152 -0
  584. package/docs/providers/bedrock.md +176 -0
  585. package/docs/providers/claude-max-api-proxy.md +148 -0
  586. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  587. package/docs/providers/deepgram.md +93 -0
  588. package/docs/providers/github-copilot.md +72 -0
  589. package/docs/providers/glm.md +33 -0
  590. package/docs/providers/index.md +64 -0
  591. package/docs/providers/minimax.md +208 -0
  592. package/docs/providers/models.md +52 -0
  593. package/docs/providers/moonshot.md +142 -0
  594. package/docs/providers/ollama.md +277 -0
  595. package/docs/providers/openai.md +62 -0
  596. package/docs/providers/opencode.md +36 -0
  597. package/docs/providers/openrouter.md +37 -0
  598. package/docs/providers/qianfan.md +38 -0
  599. package/docs/providers/qwen.md +53 -0
  600. package/docs/providers/synthetic.md +99 -0
  601. package/docs/providers/venice.md +267 -0
  602. package/docs/providers/vercel-ai-gateway.md +50 -0
  603. package/docs/providers/xiaomi.md +64 -0
  604. package/docs/providers/zai.md +36 -0
  605. package/docs/refactor/clawnet.md +417 -0
  606. package/docs/refactor/exec-host.md +316 -0
  607. package/docs/refactor/outbound-session-mirroring.md +85 -0
  608. package/docs/refactor/plugin-sdk.md +214 -0
  609. package/docs/refactor/strict-config.md +93 -0
  610. package/docs/reference/AGENTS.default.md +123 -0
  611. package/docs/reference/RELEASING.md +120 -0
  612. package/docs/reference/api-usage-costs.md +138 -0
  613. package/docs/reference/credits.md +27 -0
  614. package/docs/reference/device-models.md +47 -0
  615. package/docs/reference/rpc.md +43 -0
  616. package/docs/reference/session-management-compaction.md +285 -0
  617. package/docs/reference/templates/AGENTS.dev.md +83 -0
  618. package/docs/reference/templates/AGENTS.md +218 -0
  619. package/docs/reference/templates/BOOT.md +10 -0
  620. package/docs/reference/templates/BOOTSTRAP.md +61 -0
  621. package/docs/reference/templates/HEARTBEAT.md +11 -0
  622. package/docs/reference/templates/IDENTITY.dev.md +47 -0
  623. package/docs/reference/templates/IDENTITY.md +29 -0
  624. package/docs/reference/templates/SOUL.dev.md +76 -0
  625. package/docs/reference/templates/SOUL.md +42 -0
  626. package/docs/reference/templates/TOOLS.dev.md +24 -0
  627. package/docs/reference/templates/TOOLS.md +46 -0
  628. package/docs/reference/templates/USER.dev.md +18 -0
  629. package/docs/reference/templates/USER.md +23 -0
  630. package/docs/reference/test.md +50 -0
  631. package/docs/reference/token-use.md +112 -0
  632. package/docs/reference/transcript-hygiene.md +129 -0
  633. package/docs/reference/wizard.md +269 -0
  634. package/docs/security/formal-verification.md +164 -0
  635. package/docs/start/bootstrapping.md +41 -0
  636. package/docs/start/docs-directory.md +64 -0
  637. package/docs/start/getting-started.md +120 -0
  638. package/docs/start/hubs.md +197 -0
  639. package/docs/start/lore.md +219 -0
  640. package/docs/start/onboarding.md +80 -0
  641. package/docs/start/openclaw.md +224 -0
  642. package/docs/start/quickstart.md +22 -0
  643. package/docs/start/setup.md +162 -0
  644. package/docs/start/showcase.md +416 -0
  645. package/docs/start/wizard-cli-automation.md +141 -0
  646. package/docs/start/wizard-cli-reference.md +247 -0
  647. package/docs/start/wizard.md +108 -0
  648. package/docs/style.css +3 -0
  649. package/docs/tools/agent-send.md +53 -0
  650. package/docs/tools/apply-patch.md +50 -0
  651. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  652. package/docs/tools/browser-login.md +67 -0
  653. package/docs/tools/browser.md +576 -0
  654. package/docs/tools/chrome-extension.md +178 -0
  655. package/docs/tools/clawhub.md +257 -0
  656. package/docs/tools/creating-skills.md +54 -0
  657. package/docs/tools/elevated.md +57 -0
  658. package/docs/tools/exec-approvals.md +246 -0
  659. package/docs/tools/exec.md +179 -0
  660. package/docs/tools/firecrawl.md +61 -0
  661. package/docs/tools/index.md +512 -0
  662. package/docs/tools/llm-task.md +115 -0
  663. package/docs/tools/lobster.md +342 -0
  664. package/docs/tools/multi-agent-sandbox-tools.md +396 -0
  665. package/docs/tools/plugin.md +664 -0
  666. package/docs/tools/reactions.md +22 -0
  667. package/docs/tools/skills-config.md +76 -0
  668. package/docs/tools/skills.md +300 -0
  669. package/docs/tools/slash-commands.md +198 -0
  670. package/docs/tools/subagents.md +151 -0
  671. package/docs/tools/thinking.md +74 -0
  672. package/docs/tools/web.md +261 -0
  673. package/docs/tts.md +396 -0
  674. package/docs/vps.md +43 -0
  675. package/docs/web/control-ui.md +223 -0
  676. package/docs/web/dashboard.md +46 -0
  677. package/docs/web/index.md +116 -0
  678. package/docs/web/tui.md +162 -0
  679. package/docs/web/webchat.md +49 -0
  680. package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
  681. package/docs/whatsapp-openclaw.jpg +0 -0
  682. package/docs/zh-CN/AGENTS.md +59 -0
  683. package/docs/zh-CN/automation/auth-monitoring.md +47 -0
  684. package/docs/zh-CN/automation/cron-jobs.md +424 -0
  685. package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
  686. package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
  687. package/docs/zh-CN/automation/hooks.md +919 -0
  688. package/docs/zh-CN/automation/poll.md +76 -0
  689. package/docs/zh-CN/automation/troubleshooting.md +8 -0
  690. package/docs/zh-CN/automation/webhook.md +163 -0
  691. package/docs/zh-CN/brave-search.md +48 -0
  692. package/docs/zh-CN/channels/bluebubbles.md +271 -0
  693. package/docs/zh-CN/channels/broadcast-groups.md +449 -0
  694. package/docs/zh-CN/channels/channel-routing.md +117 -0
  695. package/docs/zh-CN/channels/discord.md +468 -0
  696. package/docs/zh-CN/channels/feishu.md +629 -0
  697. package/docs/zh-CN/channels/googlechat.md +257 -0
  698. package/docs/zh-CN/channels/grammy.md +38 -0
  699. package/docs/zh-CN/channels/group-messages.md +91 -0
  700. package/docs/zh-CN/channels/groups.md +379 -0
  701. package/docs/zh-CN/channels/imessage.md +302 -0
  702. package/docs/zh-CN/channels/index.md +53 -0
  703. package/docs/zh-CN/channels/line.md +180 -0
  704. package/docs/zh-CN/channels/location.md +63 -0
  705. package/docs/zh-CN/channels/matrix.md +221 -0
  706. package/docs/zh-CN/channels/mattermost.md +144 -0
  707. package/docs/zh-CN/channels/msteams.md +775 -0
  708. package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
  709. package/docs/zh-CN/channels/nostr.md +240 -0
  710. package/docs/zh-CN/channels/pairing.md +89 -0
  711. package/docs/zh-CN/channels/signal.md +209 -0
  712. package/docs/zh-CN/channels/slack.md +531 -0
  713. package/docs/zh-CN/channels/telegram.md +751 -0
  714. package/docs/zh-CN/channels/tlon.md +136 -0
  715. package/docs/zh-CN/channels/troubleshooting.md +36 -0
  716. package/docs/zh-CN/channels/twitch.md +385 -0
  717. package/docs/zh-CN/channels/whatsapp.md +411 -0
  718. package/docs/zh-CN/channels/zalo.md +196 -0
  719. package/docs/zh-CN/channels/zalouser.md +147 -0
  720. package/docs/zh-CN/cli/acp.md +173 -0
  721. package/docs/zh-CN/cli/agent.md +30 -0
  722. package/docs/zh-CN/cli/agents.md +82 -0
  723. package/docs/zh-CN/cli/approvals.md +57 -0
  724. package/docs/zh-CN/cli/browser.md +114 -0
  725. package/docs/zh-CN/cli/channels.md +86 -0
  726. package/docs/zh-CN/cli/config.md +57 -0
  727. package/docs/zh-CN/cli/configure.md +38 -0
  728. package/docs/zh-CN/cli/cron.md +43 -0
  729. package/docs/zh-CN/cli/dashboard.md +23 -0
  730. package/docs/zh-CN/cli/devices.md +74 -0
  731. package/docs/zh-CN/cli/directory.md +70 -0
  732. package/docs/zh-CN/cli/dns.md +30 -0
  733. package/docs/zh-CN/cli/docs.md +22 -0
  734. package/docs/zh-CN/cli/doctor.md +48 -0
  735. package/docs/zh-CN/cli/gateway.md +206 -0
  736. package/docs/zh-CN/cli/health.md +28 -0
  737. package/docs/zh-CN/cli/hooks.md +311 -0
  738. package/docs/zh-CN/cli/index.md +1032 -0
  739. package/docs/zh-CN/cli/logs.md +31 -0
  740. package/docs/zh-CN/cli/memory.md +52 -0
  741. package/docs/zh-CN/cli/message.md +246 -0
  742. package/docs/zh-CN/cli/models.md +85 -0
  743. package/docs/zh-CN/cli/node.md +115 -0
  744. package/docs/zh-CN/cli/nodes.md +80 -0
  745. package/docs/zh-CN/cli/onboard.md +36 -0
  746. package/docs/zh-CN/cli/pairing.md +28 -0
  747. package/docs/zh-CN/cli/plugins.md +66 -0
  748. package/docs/zh-CN/cli/reset.md +24 -0
  749. package/docs/zh-CN/cli/sandbox.md +158 -0
  750. package/docs/zh-CN/cli/security.md +33 -0
  751. package/docs/zh-CN/cli/sessions.md +23 -0
  752. package/docs/zh-CN/cli/setup.md +36 -0
  753. package/docs/zh-CN/cli/skills.md +33 -0
  754. package/docs/zh-CN/cli/status.md +33 -0
  755. package/docs/zh-CN/cli/system.md +63 -0
  756. package/docs/zh-CN/cli/tui.md +30 -0
  757. package/docs/zh-CN/cli/uninstall.md +24 -0
  758. package/docs/zh-CN/cli/update.md +101 -0
  759. package/docs/zh-CN/cli/voicecall.md +41 -0
  760. package/docs/zh-CN/cli/webhooks.md +32 -0
  761. package/docs/zh-CN/concepts/agent-loop.md +146 -0
  762. package/docs/zh-CN/concepts/agent-workspace.md +219 -0
  763. package/docs/zh-CN/concepts/agent.md +115 -0
  764. package/docs/zh-CN/concepts/architecture.md +123 -0
  765. package/docs/zh-CN/concepts/compaction.md +67 -0
  766. package/docs/zh-CN/concepts/context.md +168 -0
  767. package/docs/zh-CN/concepts/features.md +59 -0
  768. package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
  769. package/docs/zh-CN/concepts/memory.md +412 -0
  770. package/docs/zh-CN/concepts/messages.md +141 -0
  771. package/docs/zh-CN/concepts/model-failover.md +145 -0
  772. package/docs/zh-CN/concepts/model-providers.md +320 -0
  773. package/docs/zh-CN/concepts/models.md +196 -0
  774. package/docs/zh-CN/concepts/multi-agent.md +372 -0
  775. package/docs/zh-CN/concepts/oauth.md +151 -0
  776. package/docs/zh-CN/concepts/presence.md +99 -0
  777. package/docs/zh-CN/concepts/queue.md +94 -0
  778. package/docs/zh-CN/concepts/retry.md +76 -0
  779. package/docs/zh-CN/concepts/session-pruning.md +129 -0
  780. package/docs/zh-CN/concepts/session-tool.md +200 -0
  781. package/docs/zh-CN/concepts/session.md +166 -0
  782. package/docs/zh-CN/concepts/sessions.md +17 -0
  783. package/docs/zh-CN/concepts/streaming.md +133 -0
  784. package/docs/zh-CN/concepts/system-prompt.md +101 -0
  785. package/docs/zh-CN/concepts/timezone.md +96 -0
  786. package/docs/zh-CN/concepts/typebox.md +284 -0
  787. package/docs/zh-CN/concepts/typing-indicators.md +74 -0
  788. package/docs/zh-CN/concepts/usage-tracking.md +42 -0
  789. package/docs/zh-CN/date-time.md +129 -0
  790. package/docs/zh-CN/debug/node-issue.md +90 -0
  791. package/docs/zh-CN/diagnostics/flags.md +98 -0
  792. package/docs/zh-CN/experiments/onboarding-config-protocol.md +47 -0
  793. package/docs/zh-CN/experiments/plans/cron-add-hardening.md +70 -0
  794. package/docs/zh-CN/experiments/plans/group-policy-hardening.md +45 -0
  795. package/docs/zh-CN/experiments/plans/openresponses-gateway.md +121 -0
  796. package/docs/zh-CN/experiments/proposals/model-config.md +42 -0
  797. package/docs/zh-CN/experiments/research/memory.md +235 -0
  798. package/docs/zh-CN/gateway/authentication.md +142 -0
  799. package/docs/zh-CN/gateway/background-process.md +100 -0
  800. package/docs/zh-CN/gateway/bonjour.md +174 -0
  801. package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
  802. package/docs/zh-CN/gateway/cli-backends.md +213 -0
  803. package/docs/zh-CN/gateway/configuration-examples.md +587 -0
  804. package/docs/zh-CN/gateway/configuration.md +3332 -0
  805. package/docs/zh-CN/gateway/discovery.md +123 -0
  806. package/docs/zh-CN/gateway/doctor.md +238 -0
  807. package/docs/zh-CN/gateway/gateway-lock.md +41 -0
  808. package/docs/zh-CN/gateway/health.md +42 -0
  809. package/docs/zh-CN/gateway/heartbeat.md +274 -0
  810. package/docs/zh-CN/gateway/index.md +335 -0
  811. package/docs/zh-CN/gateway/local-models.md +157 -0
  812. package/docs/zh-CN/gateway/logging.md +114 -0
  813. package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
  814. package/docs/zh-CN/gateway/network-model.md +23 -0
  815. package/docs/zh-CN/gateway/openai-http-api.md +125 -0
  816. package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
  817. package/docs/zh-CN/gateway/pairing.md +99 -0
  818. package/docs/zh-CN/gateway/protocol.md +220 -0
  819. package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
  820. package/docs/zh-CN/gateway/remote.md +133 -0
  821. package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
  822. package/docs/zh-CN/gateway/sandboxing.md +188 -0
  823. package/docs/zh-CN/gateway/security/index.md +777 -0
  824. package/docs/zh-CN/gateway/tailscale.md +124 -0
  825. package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
  826. package/docs/zh-CN/gateway/troubleshooting.md +771 -0
  827. package/docs/zh-CN/help/debugging.md +160 -0
  828. package/docs/zh-CN/help/environment.md +88 -0
  829. package/docs/zh-CN/help/faq.md +2628 -0
  830. package/docs/zh-CN/help/index.md +28 -0
  831. package/docs/zh-CN/help/scripts.md +35 -0
  832. package/docs/zh-CN/help/submitting-a-pr.md +8 -0
  833. package/docs/zh-CN/help/submitting-an-issue.md +8 -0
  834. package/docs/zh-CN/help/testing.md +375 -0
  835. package/docs/zh-CN/help/troubleshooting.md +104 -0
  836. package/docs/zh-CN/hooks/soul-evil.md +72 -0
  837. package/docs/zh-CN/index.md +186 -0
  838. package/docs/zh-CN/install/ansible.md +215 -0
  839. package/docs/zh-CN/install/bun.md +65 -0
  840. package/docs/zh-CN/install/development-channels.md +81 -0
  841. package/docs/zh-CN/install/docker.md +532 -0
  842. package/docs/zh-CN/install/exe-dev.md +127 -0
  843. package/docs/zh-CN/install/fly.md +490 -0
  844. package/docs/zh-CN/install/gcp.md +510 -0
  845. package/docs/zh-CN/install/hetzner.md +337 -0
  846. package/docs/zh-CN/install/index.md +193 -0
  847. package/docs/zh-CN/install/installer.md +128 -0
  848. package/docs/zh-CN/install/macos-vm.md +288 -0
  849. package/docs/zh-CN/install/migrating.md +199 -0
  850. package/docs/zh-CN/install/nix.md +99 -0
  851. package/docs/zh-CN/install/node.md +8 -0
  852. package/docs/zh-CN/install/northflank.mdx +60 -0
  853. package/docs/zh-CN/install/railway.mdx +106 -0
  854. package/docs/zh-CN/install/render.mdx +169 -0
  855. package/docs/zh-CN/install/uninstall.md +135 -0
  856. package/docs/zh-CN/install/updating.md +233 -0
  857. package/docs/zh-CN/logging.md +329 -0
  858. package/docs/zh-CN/network.md +59 -0
  859. package/docs/zh-CN/nodes/audio.md +120 -0
  860. package/docs/zh-CN/nodes/camera.md +162 -0
  861. package/docs/zh-CN/nodes/images.md +79 -0
  862. package/docs/zh-CN/nodes/index.md +348 -0
  863. package/docs/zh-CN/nodes/location-command.md +120 -0
  864. package/docs/zh-CN/nodes/media-understanding.md +380 -0
  865. package/docs/zh-CN/nodes/talk.md +97 -0
  866. package/docs/zh-CN/nodes/troubleshooting.md +8 -0
  867. package/docs/zh-CN/nodes/voicewake.md +72 -0
  868. package/docs/zh-CN/perplexity.md +84 -0
  869. package/docs/zh-CN/pi-dev.md +77 -0
  870. package/docs/zh-CN/pi.md +619 -0
  871. package/docs/zh-CN/platforms/android.md +155 -0
  872. package/docs/zh-CN/platforms/digitalocean.md +269 -0
  873. package/docs/zh-CN/platforms/index.md +60 -0
  874. package/docs/zh-CN/platforms/ios.md +114 -0
  875. package/docs/zh-CN/platforms/linux.md +101 -0
  876. package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
  877. package/docs/zh-CN/platforms/mac/canvas.md +128 -0
  878. package/docs/zh-CN/platforms/mac/child-process.md +73 -0
  879. package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
  880. package/docs/zh-CN/platforms/mac/health.md +41 -0
  881. package/docs/zh-CN/platforms/mac/icon.md +38 -0
  882. package/docs/zh-CN/platforms/mac/logging.md +64 -0
  883. package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
  884. package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
  885. package/docs/zh-CN/platforms/mac/permissions.md +46 -0
  886. package/docs/zh-CN/platforms/mac/release.md +92 -0
  887. package/docs/zh-CN/platforms/mac/remote.md +90 -0
  888. package/docs/zh-CN/platforms/mac/signing.md +54 -0
  889. package/docs/zh-CN/platforms/mac/skills.md +40 -0
  890. package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
  891. package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
  892. package/docs/zh-CN/platforms/mac/webchat.md +43 -0
  893. package/docs/zh-CN/platforms/mac/xpc.md +68 -0
  894. package/docs/zh-CN/platforms/macos.md +193 -0
  895. package/docs/zh-CN/platforms/oracle.md +310 -0
  896. package/docs/zh-CN/platforms/raspberry-pi.md +365 -0
  897. package/docs/zh-CN/platforms/windows.md +156 -0
  898. package/docs/zh-CN/plugins/agent-tools.md +99 -0
  899. package/docs/zh-CN/plugins/manifest.md +68 -0
  900. package/docs/zh-CN/plugins/voice-call.md +250 -0
  901. package/docs/zh-CN/plugins/zalouser.md +88 -0
  902. package/docs/zh-CN/prose.md +141 -0
  903. package/docs/zh-CN/providers/anthropic.md +159 -0
  904. package/docs/zh-CN/providers/bedrock.md +170 -0
  905. package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
  906. package/docs/zh-CN/providers/deepgram.md +97 -0
  907. package/docs/zh-CN/providers/github-copilot.md +67 -0
  908. package/docs/zh-CN/providers/glm.md +39 -0
  909. package/docs/zh-CN/providers/index.md +68 -0
  910. package/docs/zh-CN/providers/minimax.md +206 -0
  911. package/docs/zh-CN/providers/models.md +55 -0
  912. package/docs/zh-CN/providers/moonshot.md +145 -0
  913. package/docs/zh-CN/providers/ollama.md +230 -0
  914. package/docs/zh-CN/providers/openai.md +68 -0
  915. package/docs/zh-CN/providers/opencode.md +41 -0
  916. package/docs/zh-CN/providers/openrouter.md +43 -0
  917. package/docs/zh-CN/providers/qianfan.md +8 -0
  918. package/docs/zh-CN/providers/qwen.md +55 -0
  919. package/docs/zh-CN/providers/synthetic.md +102 -0
  920. package/docs/zh-CN/providers/venice.md +274 -0
  921. package/docs/zh-CN/providers/vercel-ai-gateway.md +57 -0
  922. package/docs/zh-CN/providers/xiaomi.md +68 -0
  923. package/docs/zh-CN/providers/zai.md +41 -0
  924. package/docs/zh-CN/refactor/clawnet.md +424 -0
  925. package/docs/zh-CN/refactor/exec-host.md +323 -0
  926. package/docs/zh-CN/refactor/outbound-session-mirroring.md +92 -0
  927. package/docs/zh-CN/refactor/plugin-sdk.md +221 -0
  928. package/docs/zh-CN/refactor/strict-config.md +100 -0
  929. package/docs/zh-CN/reference/AGENTS.default.md +131 -0
  930. package/docs/zh-CN/reference/RELEASING.md +123 -0
  931. package/docs/zh-CN/reference/api-usage-costs.md +136 -0
  932. package/docs/zh-CN/reference/credits.md +34 -0
  933. package/docs/zh-CN/reference/device-models.md +54 -0
  934. package/docs/zh-CN/reference/rpc.md +48 -0
  935. package/docs/zh-CN/reference/session-management-compaction.md +287 -0
  936. package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
  937. package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
  938. package/docs/zh-CN/reference/templates/BOOT.md +17 -0
  939. package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
  940. package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
  941. package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
  942. package/docs/zh-CN/reference/templates/IDENTITY.md +36 -0
  943. package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
  944. package/docs/zh-CN/reference/templates/SOUL.md +49 -0
  945. package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
  946. package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
  947. package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
  948. package/docs/zh-CN/reference/templates/USER.md +30 -0
  949. package/docs/zh-CN/reference/test.md +57 -0
  950. package/docs/zh-CN/reference/token-use.md +119 -0
  951. package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
  952. package/docs/zh-CN/reference/wizard.md +9 -0
  953. package/docs/zh-CN/security/formal-verification.md +171 -0
  954. package/docs/zh-CN/start/bootstrapping.md +9 -0
  955. package/docs/zh-CN/start/docs-directory.md +70 -0
  956. package/docs/zh-CN/start/getting-started.md +206 -0
  957. package/docs/zh-CN/start/hubs.md +200 -0
  958. package/docs/zh-CN/start/lore.md +226 -0
  959. package/docs/zh-CN/start/onboarding.md +105 -0
  960. package/docs/zh-CN/start/openclaw.md +248 -0
  961. package/docs/zh-CN/start/quickstart.md +88 -0
  962. package/docs/zh-CN/start/setup.md +153 -0
  963. package/docs/zh-CN/start/showcase.md +423 -0
  964. package/docs/zh-CN/start/wizard.md +331 -0
  965. package/docs/zh-CN/tools/agent-send.md +59 -0
  966. package/docs/zh-CN/tools/apply-patch.md +57 -0
  967. package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
  968. package/docs/zh-CN/tools/browser-login.md +75 -0
  969. package/docs/zh-CN/tools/browser.md +553 -0
  970. package/docs/zh-CN/tools/chrome-extension.md +183 -0
  971. package/docs/zh-CN/tools/clawhub.md +209 -0
  972. package/docs/zh-CN/tools/creating-skills.md +61 -0
  973. package/docs/zh-CN/tools/elevated.md +64 -0
  974. package/docs/zh-CN/tools/exec-approvals.md +234 -0
  975. package/docs/zh-CN/tools/exec.md +169 -0
  976. package/docs/zh-CN/tools/firecrawl.md +68 -0
  977. package/docs/zh-CN/tools/index.md +515 -0
  978. package/docs/zh-CN/tools/llm-task.md +117 -0
  979. package/docs/zh-CN/tools/lobster.md +349 -0
  980. package/docs/zh-CN/tools/multi-agent-sandbox-tools.md +401 -0
  981. package/docs/zh-CN/tools/plugin.md +639 -0
  982. package/docs/zh-CN/tools/reactions.md +29 -0
  983. package/docs/zh-CN/tools/skills-config.md +78 -0
  984. package/docs/zh-CN/tools/skills.md +279 -0
  985. package/docs/zh-CN/tools/slash-commands.md +205 -0
  986. package/docs/zh-CN/tools/subagents.md +156 -0
  987. package/docs/zh-CN/tools/thinking.md +80 -0
  988. package/docs/zh-CN/tools/web.md +257 -0
  989. package/docs/zh-CN/tts.md +375 -0
  990. package/docs/zh-CN/vps.md +47 -0
  991. package/docs/zh-CN/web/control-ui.md +191 -0
  992. package/docs/zh-CN/web/dashboard.md +53 -0
  993. package/docs/zh-CN/web/index.md +118 -0
  994. package/docs/zh-CN/web/tui.md +166 -0
  995. package/docs/zh-CN/web/webchat.md +56 -0
  996. package/extensions/bluebubbles/README.md +45 -0
  997. package/extensions/bluebubbles/index.ts +19 -0
  998. package/extensions/bluebubbles/node_modules/.bin/clawdbot +21 -0
  999. package/extensions/bluebubbles/node_modules/.bin/clawdbot.CMD +12 -0
  1000. package/extensions/bluebubbles/node_modules/.bin/clawdbot.ps1 +41 -0
  1001. package/extensions/bluebubbles/node_modules/.bin/openclaw +21 -0
  1002. package/extensions/bluebubbles/node_modules/.bin/openclaw.CMD +12 -0
  1003. package/extensions/bluebubbles/node_modules/.bin/openclaw.ps1 +41 -0
  1004. package/extensions/bluebubbles/node_modules/.bin/synurex +21 -0
  1005. package/extensions/bluebubbles/node_modules/.bin/synurex.CMD +12 -0
  1006. package/extensions/bluebubbles/node_modules/.bin/synurex.ps1 +41 -0
  1007. package/extensions/bluebubbles/package.json +36 -0
  1008. package/extensions/bluebubbles/src/accounts.ts +88 -0
  1009. package/extensions/bluebubbles/src/actions.test.ts +650 -0
  1010. package/extensions/bluebubbles/src/actions.ts +438 -0
  1011. package/extensions/bluebubbles/src/attachments.test.ts +345 -0
  1012. package/extensions/bluebubbles/src/attachments.ts +302 -0
  1013. package/extensions/bluebubbles/src/channel.ts +414 -0
  1014. package/extensions/bluebubbles/src/chat.test.ts +461 -0
  1015. package/extensions/bluebubbles/src/chat.ts +382 -0
  1016. package/extensions/bluebubbles/src/config-schema.ts +51 -0
  1017. package/extensions/bluebubbles/src/media-send.ts +174 -0
  1018. package/extensions/bluebubbles/src/monitor.test.ts +2384 -0
  1019. package/extensions/bluebubbles/src/monitor.ts +2517 -0
  1020. package/extensions/bluebubbles/src/onboarding.ts +352 -0
  1021. package/extensions/bluebubbles/src/probe.ts +144 -0
  1022. package/extensions/bluebubbles/src/reactions.test.ts +392 -0
  1023. package/extensions/bluebubbles/src/reactions.ts +188 -0
  1024. package/extensions/bluebubbles/src/runtime.ts +14 -0
  1025. package/extensions/bluebubbles/src/send.test.ts +889 -0
  1026. package/extensions/bluebubbles/src/send.ts +474 -0
  1027. package/extensions/bluebubbles/src/targets.test.ts +183 -0
  1028. package/extensions/bluebubbles/src/targets.ts +422 -0
  1029. package/extensions/bluebubbles/src/types.ts +127 -0
  1030. package/extensions/bluebubbles/synurex.plugin.json +9 -0
  1031. package/extensions/copilot-proxy/README.md +24 -0
  1032. package/extensions/copilot-proxy/index.ts +149 -0
  1033. package/extensions/copilot-proxy/node_modules/.bin/clawdbot +21 -0
  1034. package/extensions/copilot-proxy/node_modules/.bin/clawdbot.CMD +12 -0
  1035. package/extensions/copilot-proxy/node_modules/.bin/clawdbot.ps1 +41 -0
  1036. package/extensions/copilot-proxy/node_modules/.bin/openclaw +21 -0
  1037. package/extensions/copilot-proxy/node_modules/.bin/openclaw.CMD +12 -0
  1038. package/extensions/copilot-proxy/node_modules/.bin/openclaw.ps1 +41 -0
  1039. package/extensions/copilot-proxy/node_modules/.bin/synurex +21 -0
  1040. package/extensions/copilot-proxy/node_modules/.bin/synurex.CMD +12 -0
  1041. package/extensions/copilot-proxy/node_modules/.bin/synurex.ps1 +41 -0
  1042. package/extensions/copilot-proxy/package.json +14 -0
  1043. package/extensions/copilot-proxy/synurex.plugin.json +9 -0
  1044. package/extensions/diagnostics-otel/index.ts +15 -0
  1045. package/extensions/diagnostics-otel/node_modules/.bin/clawdbot +21 -0
  1046. package/extensions/diagnostics-otel/node_modules/.bin/clawdbot.CMD +12 -0
  1047. package/extensions/diagnostics-otel/node_modules/.bin/clawdbot.ps1 +41 -0
  1048. package/extensions/diagnostics-otel/node_modules/.bin/openclaw +21 -0
  1049. package/extensions/diagnostics-otel/node_modules/.bin/openclaw.CMD +12 -0
  1050. package/extensions/diagnostics-otel/node_modules/.bin/openclaw.ps1 +41 -0
  1051. package/extensions/diagnostics-otel/node_modules/.bin/synurex +21 -0
  1052. package/extensions/diagnostics-otel/node_modules/.bin/synurex.CMD +12 -0
  1053. package/extensions/diagnostics-otel/node_modules/.bin/synurex.ps1 +41 -0
  1054. package/extensions/diagnostics-otel/package.json +27 -0
  1055. package/extensions/diagnostics-otel/src/service.test.ts +226 -0
  1056. package/extensions/diagnostics-otel/src/service.ts +635 -0
  1057. package/extensions/diagnostics-otel/synurex.plugin.json +8 -0
  1058. package/extensions/discord/index.ts +17 -0
  1059. package/extensions/discord/node_modules/.bin/clawdbot +21 -0
  1060. package/extensions/discord/node_modules/.bin/clawdbot.CMD +12 -0
  1061. package/extensions/discord/node_modules/.bin/clawdbot.ps1 +41 -0
  1062. package/extensions/discord/node_modules/.bin/openclaw +21 -0
  1063. package/extensions/discord/node_modules/.bin/openclaw.CMD +12 -0
  1064. package/extensions/discord/node_modules/.bin/openclaw.ps1 +41 -0
  1065. package/extensions/discord/node_modules/.bin/synurex +21 -0
  1066. package/extensions/discord/node_modules/.bin/synurex.CMD +12 -0
  1067. package/extensions/discord/node_modules/.bin/synurex.ps1 +41 -0
  1068. package/extensions/discord/package.json +14 -0
  1069. package/extensions/discord/src/channel.ts +422 -0
  1070. package/extensions/discord/src/runtime.ts +14 -0
  1071. package/extensions/discord/synurex.plugin.json +9 -0
  1072. package/extensions/feishu/index.ts +63 -0
  1073. package/extensions/feishu/node_modules/.bin/clawdbot +21 -0
  1074. package/extensions/feishu/node_modules/.bin/clawdbot.CMD +12 -0
  1075. package/extensions/feishu/node_modules/.bin/clawdbot.ps1 +41 -0
  1076. package/extensions/feishu/node_modules/.bin/openclaw +21 -0
  1077. package/extensions/feishu/node_modules/.bin/openclaw.CMD +12 -0
  1078. package/extensions/feishu/node_modules/.bin/openclaw.ps1 +41 -0
  1079. package/extensions/feishu/node_modules/.bin/synurex +21 -0
  1080. package/extensions/feishu/node_modules/.bin/synurex.CMD +12 -0
  1081. package/extensions/feishu/node_modules/.bin/synurex.ps1 +41 -0
  1082. package/extensions/feishu/package.json +37 -0
  1083. package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
  1084. package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
  1085. package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
  1086. package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
  1087. package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
  1088. package/extensions/feishu/src/accounts.ts +144 -0
  1089. package/extensions/feishu/src/bitable.ts +459 -0
  1090. package/extensions/feishu/src/bot.ts +871 -0
  1091. package/extensions/feishu/src/channel.ts +341 -0
  1092. package/extensions/feishu/src/client.ts +118 -0
  1093. package/extensions/feishu/src/config-schema.ts +172 -0
  1094. package/extensions/feishu/src/directory.ts +177 -0
  1095. package/extensions/feishu/src/doc-schema.ts +47 -0
  1096. package/extensions/feishu/src/docx.ts +521 -0
  1097. package/extensions/feishu/src/drive-schema.ts +46 -0
  1098. package/extensions/feishu/src/drive.ts +227 -0
  1099. package/extensions/feishu/src/media.ts +527 -0
  1100. package/extensions/feishu/src/mention.ts +126 -0
  1101. package/extensions/feishu/src/monitor.ts +190 -0
  1102. package/extensions/feishu/src/onboarding.ts +356 -0
  1103. package/extensions/feishu/src/outbound.ts +40 -0
  1104. package/extensions/feishu/src/perm-schema.ts +52 -0
  1105. package/extensions/feishu/src/perm.ts +173 -0
  1106. package/extensions/feishu/src/policy.ts +104 -0
  1107. package/extensions/feishu/src/probe.ts +44 -0
  1108. package/extensions/feishu/src/reactions.ts +160 -0
  1109. package/extensions/feishu/src/reply-dispatcher.ts +184 -0
  1110. package/extensions/feishu/src/runtime.ts +14 -0
  1111. package/extensions/feishu/src/send.ts +358 -0
  1112. package/extensions/feishu/src/targets.ts +78 -0
  1113. package/extensions/feishu/src/tools-config.ts +21 -0
  1114. package/extensions/feishu/src/types.ts +75 -0
  1115. package/extensions/feishu/src/typing.ts +80 -0
  1116. package/extensions/feishu/src/wiki-schema.ts +55 -0
  1117. package/extensions/feishu/src/wiki.ts +232 -0
  1118. package/extensions/feishu/synurex.plugin.json +10 -0
  1119. package/extensions/google-antigravity-auth/README.md +24 -0
  1120. package/extensions/google-antigravity-auth/index.ts +461 -0
  1121. package/extensions/google-antigravity-auth/node_modules/.bin/clawdbot +21 -0
  1122. package/extensions/google-antigravity-auth/node_modules/.bin/clawdbot.CMD +12 -0
  1123. package/extensions/google-antigravity-auth/node_modules/.bin/clawdbot.ps1 +41 -0
  1124. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw +21 -0
  1125. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.CMD +12 -0
  1126. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1127. package/extensions/google-antigravity-auth/node_modules/.bin/synurex +21 -0
  1128. package/extensions/google-antigravity-auth/node_modules/.bin/synurex.CMD +12 -0
  1129. package/extensions/google-antigravity-auth/node_modules/.bin/synurex.ps1 +41 -0
  1130. package/extensions/google-antigravity-auth/package.json +14 -0
  1131. package/extensions/google-antigravity-auth/synurex.plugin.json +9 -0
  1132. package/extensions/google-gemini-cli-auth/README.md +35 -0
  1133. package/extensions/google-gemini-cli-auth/index.ts +88 -0
  1134. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawdbot +21 -0
  1135. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawdbot.CMD +12 -0
  1136. package/extensions/google-gemini-cli-auth/node_modules/.bin/clawdbot.ps1 +41 -0
  1137. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw +21 -0
  1138. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.CMD +12 -0
  1139. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1140. package/extensions/google-gemini-cli-auth/node_modules/.bin/synurex +21 -0
  1141. package/extensions/google-gemini-cli-auth/node_modules/.bin/synurex.CMD +12 -0
  1142. package/extensions/google-gemini-cli-auth/node_modules/.bin/synurex.ps1 +41 -0
  1143. package/extensions/google-gemini-cli-auth/oauth.test.ts +240 -0
  1144. package/extensions/google-gemini-cli-auth/oauth.ts +662 -0
  1145. package/extensions/google-gemini-cli-auth/package.json +14 -0
  1146. package/extensions/google-gemini-cli-auth/synurex.plugin.json +9 -0
  1147. package/extensions/googlechat/index.ts +19 -0
  1148. package/extensions/googlechat/node_modules/.bin/clawdbot +21 -0
  1149. package/extensions/googlechat/node_modules/.bin/clawdbot.CMD +12 -0
  1150. package/extensions/googlechat/node_modules/.bin/clawdbot.ps1 +41 -0
  1151. package/extensions/googlechat/node_modules/.bin/openclaw +21 -0
  1152. package/extensions/googlechat/node_modules/.bin/openclaw.CMD +12 -0
  1153. package/extensions/googlechat/node_modules/.bin/openclaw.ps1 +41 -0
  1154. package/extensions/googlechat/node_modules/.bin/synurex +21 -0
  1155. package/extensions/googlechat/node_modules/.bin/synurex.CMD +12 -0
  1156. package/extensions/googlechat/node_modules/.bin/synurex.ps1 +41 -0
  1157. package/extensions/googlechat/package.json +39 -0
  1158. package/extensions/googlechat/src/accounts.ts +147 -0
  1159. package/extensions/googlechat/src/actions.ts +181 -0
  1160. package/extensions/googlechat/src/api.test.ts +61 -0
  1161. package/extensions/googlechat/src/api.ts +282 -0
  1162. package/extensions/googlechat/src/auth.ts +137 -0
  1163. package/extensions/googlechat/src/channel.ts +583 -0
  1164. package/extensions/googlechat/src/monitor.test.ts +22 -0
  1165. package/extensions/googlechat/src/monitor.ts +960 -0
  1166. package/extensions/googlechat/src/onboarding.ts +269 -0
  1167. package/extensions/googlechat/src/runtime.ts +14 -0
  1168. package/extensions/googlechat/src/targets.test.ts +32 -0
  1169. package/extensions/googlechat/src/targets.ts +65 -0
  1170. package/extensions/googlechat/src/types.config.ts +3 -0
  1171. package/extensions/googlechat/src/types.ts +73 -0
  1172. package/extensions/googlechat/synurex.plugin.json +9 -0
  1173. package/extensions/imessage/index.ts +17 -0
  1174. package/extensions/imessage/node_modules/.bin/clawdbot +21 -0
  1175. package/extensions/imessage/node_modules/.bin/clawdbot.CMD +12 -0
  1176. package/extensions/imessage/node_modules/.bin/clawdbot.ps1 +41 -0
  1177. package/extensions/imessage/node_modules/.bin/openclaw +21 -0
  1178. package/extensions/imessage/node_modules/.bin/openclaw.CMD +12 -0
  1179. package/extensions/imessage/node_modules/.bin/openclaw.ps1 +41 -0
  1180. package/extensions/imessage/node_modules/.bin/synurex +21 -0
  1181. package/extensions/imessage/node_modules/.bin/synurex.CMD +12 -0
  1182. package/extensions/imessage/node_modules/.bin/synurex.ps1 +41 -0
  1183. package/extensions/imessage/package.json +14 -0
  1184. package/extensions/imessage/src/channel.ts +294 -0
  1185. package/extensions/imessage/src/runtime.ts +14 -0
  1186. package/extensions/imessage/synurex.plugin.json +9 -0
  1187. package/extensions/line/index.ts +19 -0
  1188. package/extensions/line/node_modules/.bin/clawdbot +21 -0
  1189. package/extensions/line/node_modules/.bin/clawdbot.CMD +12 -0
  1190. package/extensions/line/node_modules/.bin/clawdbot.ps1 +41 -0
  1191. package/extensions/line/node_modules/.bin/openclaw +21 -0
  1192. package/extensions/line/node_modules/.bin/openclaw.CMD +12 -0
  1193. package/extensions/line/node_modules/.bin/openclaw.ps1 +41 -0
  1194. package/extensions/line/node_modules/.bin/synurex +21 -0
  1195. package/extensions/line/node_modules/.bin/synurex.CMD +12 -0
  1196. package/extensions/line/node_modules/.bin/synurex.ps1 +41 -0
  1197. package/extensions/line/package.json +29 -0
  1198. package/extensions/line/src/card-command.ts +344 -0
  1199. package/extensions/line/src/channel.logout.test.ts +99 -0
  1200. package/extensions/line/src/channel.sendPayload.test.ts +306 -0
  1201. package/extensions/line/src/channel.ts +780 -0
  1202. package/extensions/line/src/runtime.ts +14 -0
  1203. package/extensions/line/synurex.plugin.json +9 -0
  1204. package/extensions/llm-task/README.md +97 -0
  1205. package/extensions/llm-task/index.ts +6 -0
  1206. package/extensions/llm-task/node_modules/.bin/clawdbot +21 -0
  1207. package/extensions/llm-task/node_modules/.bin/clawdbot.CMD +12 -0
  1208. package/extensions/llm-task/node_modules/.bin/clawdbot.ps1 +41 -0
  1209. package/extensions/llm-task/node_modules/.bin/openclaw +21 -0
  1210. package/extensions/llm-task/node_modules/.bin/openclaw.CMD +12 -0
  1211. package/extensions/llm-task/node_modules/.bin/openclaw.ps1 +41 -0
  1212. package/extensions/llm-task/node_modules/.bin/synurex +21 -0
  1213. package/extensions/llm-task/node_modules/.bin/synurex.CMD +12 -0
  1214. package/extensions/llm-task/node_modules/.bin/synurex.ps1 +41 -0
  1215. package/extensions/llm-task/package.json +14 -0
  1216. package/extensions/llm-task/src/llm-task-tool.test.ts +138 -0
  1217. package/extensions/llm-task/src/llm-task-tool.ts +245 -0
  1218. package/extensions/llm-task/synurex.plugin.json +21 -0
  1219. package/extensions/lobster/README.md +75 -0
  1220. package/extensions/lobster/SKILL.md +97 -0
  1221. package/extensions/lobster/index.ts +14 -0
  1222. package/extensions/lobster/node_modules/.bin/clawdbot +21 -0
  1223. package/extensions/lobster/node_modules/.bin/clawdbot.CMD +12 -0
  1224. package/extensions/lobster/node_modules/.bin/clawdbot.ps1 +41 -0
  1225. package/extensions/lobster/node_modules/.bin/openclaw +21 -0
  1226. package/extensions/lobster/node_modules/.bin/openclaw.CMD +12 -0
  1227. package/extensions/lobster/node_modules/.bin/openclaw.ps1 +41 -0
  1228. package/extensions/lobster/node_modules/.bin/synurex +21 -0
  1229. package/extensions/lobster/node_modules/.bin/synurex.CMD +12 -0
  1230. package/extensions/lobster/node_modules/.bin/synurex.ps1 +41 -0
  1231. package/extensions/lobster/package.json +14 -0
  1232. package/extensions/lobster/src/lobster-tool.test.ts +247 -0
  1233. package/extensions/lobster/src/lobster-tool.ts +328 -0
  1234. package/extensions/lobster/synurex.plugin.json +10 -0
  1235. package/extensions/matrix/CHANGELOG.md +111 -0
  1236. package/extensions/matrix/index.ts +17 -0
  1237. package/extensions/matrix/node_modules/.bin/clawdbot +21 -0
  1238. package/extensions/matrix/node_modules/.bin/clawdbot.CMD +12 -0
  1239. package/extensions/matrix/node_modules/.bin/clawdbot.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/node_modules/.bin/synurex +21 -0
  1247. package/extensions/matrix/node_modules/.bin/synurex.CMD +12 -0
  1248. package/extensions/matrix/node_modules/.bin/synurex.ps1 +41 -0
  1249. package/extensions/matrix/package.json +36 -0
  1250. package/extensions/matrix/src/actions.ts +195 -0
  1251. package/extensions/matrix/src/channel.directory.test.ts +64 -0
  1252. package/extensions/matrix/src/channel.ts +439 -0
  1253. package/extensions/matrix/src/config-schema.ts +63 -0
  1254. package/extensions/matrix/src/directory-live.ts +188 -0
  1255. package/extensions/matrix/src/group-mentions.ts +66 -0
  1256. package/extensions/matrix/src/matrix/accounts.test.ts +82 -0
  1257. package/extensions/matrix/src/matrix/accounts.ts +65 -0
  1258. package/extensions/matrix/src/matrix/actions/client.ts +57 -0
  1259. package/extensions/matrix/src/matrix/actions/messages.ts +128 -0
  1260. package/extensions/matrix/src/matrix/actions/pins.ts +76 -0
  1261. package/extensions/matrix/src/matrix/actions/reactions.ts +96 -0
  1262. package/extensions/matrix/src/matrix/actions/room.ts +85 -0
  1263. package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
  1264. package/extensions/matrix/src/matrix/actions/types.ts +84 -0
  1265. package/extensions/matrix/src/matrix/actions.ts +15 -0
  1266. package/extensions/matrix/src/matrix/active-client.ts +11 -0
  1267. package/extensions/matrix/src/matrix/client/config.ts +160 -0
  1268. package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
  1269. package/extensions/matrix/src/matrix/client/logging.ts +36 -0
  1270. package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
  1271. package/extensions/matrix/src/matrix/client/shared.ts +170 -0
  1272. package/extensions/matrix/src/matrix/client/storage.ts +131 -0
  1273. package/extensions/matrix/src/matrix/client/types.ts +34 -0
  1274. package/extensions/matrix/src/matrix/client.test.ts +56 -0
  1275. package/extensions/matrix/src/matrix/client.ts +5 -0
  1276. package/extensions/matrix/src/matrix/credentials.ts +105 -0
  1277. package/extensions/matrix/src/matrix/deps.ts +60 -0
  1278. package/extensions/matrix/src/matrix/format.test.ts +33 -0
  1279. package/extensions/matrix/src/matrix/format.ts +22 -0
  1280. package/extensions/matrix/src/matrix/index.ts +11 -0
  1281. package/extensions/matrix/src/matrix/monitor/allowlist.test.ts +45 -0
  1282. package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
  1283. package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
  1284. package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
  1285. package/extensions/matrix/src/matrix/monitor/events.ts +101 -0
  1286. package/extensions/matrix/src/matrix/monitor/handler.ts +665 -0
  1287. package/extensions/matrix/src/matrix/monitor/index.ts +338 -0
  1288. package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
  1289. package/extensions/matrix/src/matrix/monitor/media.test.ts +102 -0
  1290. package/extensions/matrix/src/matrix/monitor/media.ts +113 -0
  1291. package/extensions/matrix/src/matrix/monitor/mentions.ts +31 -0
  1292. package/extensions/matrix/src/matrix/monitor/replies.ts +97 -0
  1293. package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
  1294. package/extensions/matrix/src/matrix/monitor/rooms.test.ts +39 -0
  1295. package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
  1296. package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
  1297. package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
  1298. package/extensions/matrix/src/matrix/poll-types.test.ts +21 -0
  1299. package/extensions/matrix/src/matrix/poll-types.ts +166 -0
  1300. package/extensions/matrix/src/matrix/probe.ts +70 -0
  1301. package/extensions/matrix/src/matrix/send/client.ts +66 -0
  1302. package/extensions/matrix/src/matrix/send/formatting.ts +89 -0
  1303. package/extensions/matrix/src/matrix/send/media.ts +229 -0
  1304. package/extensions/matrix/src/matrix/send/targets.test.ts +98 -0
  1305. package/extensions/matrix/src/matrix/send/targets.ts +147 -0
  1306. package/extensions/matrix/src/matrix/send/types.ts +109 -0
  1307. package/extensions/matrix/src/matrix/send.test.ts +171 -0
  1308. package/extensions/matrix/src/matrix/send.ts +260 -0
  1309. package/extensions/matrix/src/onboarding.ts +449 -0
  1310. package/extensions/matrix/src/outbound.ts +52 -0
  1311. package/extensions/matrix/src/resolve-targets.test.ts +48 -0
  1312. package/extensions/matrix/src/resolve-targets.ts +135 -0
  1313. package/extensions/matrix/src/runtime.ts +14 -0
  1314. package/extensions/matrix/src/tool-actions.ts +164 -0
  1315. package/extensions/matrix/src/types.ts +97 -0
  1316. package/extensions/matrix/synurex.plugin.json +9 -0
  1317. package/extensions/mattermost/index.ts +17 -0
  1318. package/extensions/mattermost/node_modules/.bin/clawdbot +21 -0
  1319. package/extensions/mattermost/node_modules/.bin/clawdbot.CMD +12 -0
  1320. package/extensions/mattermost/node_modules/.bin/clawdbot.ps1 +41 -0
  1321. package/extensions/mattermost/node_modules/.bin/openclaw +21 -0
  1322. package/extensions/mattermost/node_modules/.bin/openclaw.CMD +12 -0
  1323. package/extensions/mattermost/node_modules/.bin/openclaw.ps1 +41 -0
  1324. package/extensions/mattermost/node_modules/.bin/synurex +21 -0
  1325. package/extensions/mattermost/node_modules/.bin/synurex.CMD +12 -0
  1326. package/extensions/mattermost/node_modules/.bin/synurex.ps1 +41 -0
  1327. package/extensions/mattermost/package.json +28 -0
  1328. package/extensions/mattermost/src/channel.test.ts +72 -0
  1329. package/extensions/mattermost/src/channel.ts +337 -0
  1330. package/extensions/mattermost/src/config-schema.ts +56 -0
  1331. package/extensions/mattermost/src/group-mentions.ts +15 -0
  1332. package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
  1333. package/extensions/mattermost/src/mattermost/client.ts +220 -0
  1334. package/extensions/mattermost/src/mattermost/index.ts +9 -0
  1335. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +166 -0
  1336. package/extensions/mattermost/src/mattermost/monitor.ts +991 -0
  1337. package/extensions/mattermost/src/mattermost/probe.ts +74 -0
  1338. package/extensions/mattermost/src/mattermost/send.ts +231 -0
  1339. package/extensions/mattermost/src/normalize.ts +46 -0
  1340. package/extensions/mattermost/src/onboarding-helpers.ts +44 -0
  1341. package/extensions/mattermost/src/onboarding.ts +186 -0
  1342. package/extensions/mattermost/src/runtime.ts +14 -0
  1343. package/extensions/mattermost/src/types.ts +52 -0
  1344. package/extensions/mattermost/synurex.plugin.json +9 -0
  1345. package/extensions/memory-core/index.ts +38 -0
  1346. package/extensions/memory-core/node_modules/.bin/clawdbot +21 -0
  1347. package/extensions/memory-core/node_modules/.bin/clawdbot.CMD +12 -0
  1348. package/extensions/memory-core/node_modules/.bin/clawdbot.ps1 +41 -0
  1349. package/extensions/memory-core/node_modules/.bin/openclaw +21 -0
  1350. package/extensions/memory-core/node_modules/.bin/openclaw.CMD +12 -0
  1351. package/extensions/memory-core/node_modules/.bin/openclaw.ps1 +41 -0
  1352. package/extensions/memory-core/node_modules/.bin/synurex +21 -0
  1353. package/extensions/memory-core/node_modules/.bin/synurex.CMD +12 -0
  1354. package/extensions/memory-core/node_modules/.bin/synurex.ps1 +41 -0
  1355. package/extensions/memory-core/package.json +17 -0
  1356. package/extensions/memory-core/synurex.plugin.json +9 -0
  1357. package/extensions/memory-lancedb/config.ts +139 -0
  1358. package/extensions/memory-lancedb/index.test.ts +253 -0
  1359. package/extensions/memory-lancedb/index.ts +622 -0
  1360. package/extensions/memory-lancedb/node_modules/.bin/clawdbot +21 -0
  1361. package/extensions/memory-lancedb/node_modules/.bin/clawdbot.CMD +12 -0
  1362. package/extensions/memory-lancedb/node_modules/.bin/clawdbot.ps1 +41 -0
  1363. package/extensions/memory-lancedb/node_modules/.bin/openai +21 -0
  1364. package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +12 -0
  1365. package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +41 -0
  1366. package/extensions/memory-lancedb/node_modules/.bin/openclaw +21 -0
  1367. package/extensions/memory-lancedb/node_modules/.bin/openclaw.CMD +12 -0
  1368. package/extensions/memory-lancedb/node_modules/.bin/openclaw.ps1 +41 -0
  1369. package/extensions/memory-lancedb/node_modules/.bin/synurex +21 -0
  1370. package/extensions/memory-lancedb/node_modules/.bin/synurex.CMD +12 -0
  1371. package/extensions/memory-lancedb/node_modules/.bin/synurex.ps1 +41 -0
  1372. package/extensions/memory-lancedb/package.json +19 -0
  1373. package/extensions/memory-lancedb/synurex.plugin.json +60 -0
  1374. package/extensions/minimax-portal-auth/README.md +33 -0
  1375. package/extensions/minimax-portal-auth/index.ts +155 -0
  1376. package/extensions/minimax-portal-auth/node_modules/.bin/clawdbot +21 -0
  1377. package/extensions/minimax-portal-auth/node_modules/.bin/clawdbot.CMD +12 -0
  1378. package/extensions/minimax-portal-auth/node_modules/.bin/clawdbot.ps1 +41 -0
  1379. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw +21 -0
  1380. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.CMD +12 -0
  1381. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.ps1 +41 -0
  1382. package/extensions/minimax-portal-auth/node_modules/.bin/synurex +21 -0
  1383. package/extensions/minimax-portal-auth/node_modules/.bin/synurex.CMD +12 -0
  1384. package/extensions/minimax-portal-auth/node_modules/.bin/synurex.ps1 +41 -0
  1385. package/extensions/minimax-portal-auth/oauth.ts +247 -0
  1386. package/extensions/minimax-portal-auth/package.json +14 -0
  1387. package/extensions/minimax-portal-auth/synurex.plugin.json +9 -0
  1388. package/extensions/msteams/CHANGELOG.md +107 -0
  1389. package/extensions/msteams/index.ts +17 -0
  1390. package/extensions/msteams/node_modules/.bin/clawdbot +21 -0
  1391. package/extensions/msteams/node_modules/.bin/clawdbot.CMD +12 -0
  1392. package/extensions/msteams/node_modules/.bin/clawdbot.ps1 +41 -0
  1393. package/extensions/msteams/node_modules/.bin/openclaw +21 -0
  1394. package/extensions/msteams/node_modules/.bin/openclaw.CMD +12 -0
  1395. package/extensions/msteams/node_modules/.bin/openclaw.ps1 +41 -0
  1396. package/extensions/msteams/node_modules/.bin/synurex +21 -0
  1397. package/extensions/msteams/node_modules/.bin/synurex.CMD +12 -0
  1398. package/extensions/msteams/node_modules/.bin/synurex.ps1 +41 -0
  1399. package/extensions/msteams/package.json +39 -0
  1400. package/extensions/msteams/src/attachments/download.ts +283 -0
  1401. package/extensions/msteams/src/attachments/graph.ts +353 -0
  1402. package/extensions/msteams/src/attachments/html.ts +90 -0
  1403. package/extensions/msteams/src/attachments/payload.ts +22 -0
  1404. package/extensions/msteams/src/attachments/shared.ts +291 -0
  1405. package/extensions/msteams/src/attachments/types.ts +37 -0
  1406. package/extensions/msteams/src/attachments.test.ts +459 -0
  1407. package/extensions/msteams/src/attachments.ts +18 -0
  1408. package/extensions/msteams/src/channel.directory.test.ts +48 -0
  1409. package/extensions/msteams/src/channel.ts +459 -0
  1410. package/extensions/msteams/src/conversation-store-fs.test.ts +88 -0
  1411. package/extensions/msteams/src/conversation-store-fs.ts +165 -0
  1412. package/extensions/msteams/src/conversation-store-memory.ts +47 -0
  1413. package/extensions/msteams/src/conversation-store.ts +41 -0
  1414. package/extensions/msteams/src/directory-live.ts +205 -0
  1415. package/extensions/msteams/src/errors.test.ts +45 -0
  1416. package/extensions/msteams/src/errors.ts +190 -0
  1417. package/extensions/msteams/src/file-consent-helpers.test.ts +243 -0
  1418. package/extensions/msteams/src/file-consent-helpers.ts +73 -0
  1419. package/extensions/msteams/src/file-consent.ts +126 -0
  1420. package/extensions/msteams/src/graph-chat.ts +53 -0
  1421. package/extensions/msteams/src/graph-upload.ts +453 -0
  1422. package/extensions/msteams/src/inbound.test.ts +66 -0
  1423. package/extensions/msteams/src/inbound.ts +48 -0
  1424. package/extensions/msteams/src/index.ts +4 -0
  1425. package/extensions/msteams/src/media-helpers.test.ts +189 -0
  1426. package/extensions/msteams/src/media-helpers.ts +86 -0
  1427. package/extensions/msteams/src/messenger.test.ts +248 -0
  1428. package/extensions/msteams/src/messenger.ts +495 -0
  1429. package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
  1430. package/extensions/msteams/src/monitor-handler/message-handler.ts +641 -0
  1431. package/extensions/msteams/src/monitor-handler.ts +162 -0
  1432. package/extensions/msteams/src/monitor-types.ts +5 -0
  1433. package/extensions/msteams/src/monitor.ts +295 -0
  1434. package/extensions/msteams/src/onboarding.ts +431 -0
  1435. package/extensions/msteams/src/outbound.ts +46 -0
  1436. package/extensions/msteams/src/pending-uploads.ts +89 -0
  1437. package/extensions/msteams/src/policy.test.ts +209 -0
  1438. package/extensions/msteams/src/policy.ts +273 -0
  1439. package/extensions/msteams/src/polls-store-memory.ts +32 -0
  1440. package/extensions/msteams/src/polls-store.test.ts +38 -0
  1441. package/extensions/msteams/src/polls.test.ts +72 -0
  1442. package/extensions/msteams/src/polls.ts +315 -0
  1443. package/extensions/msteams/src/probe.test.ts +58 -0
  1444. package/extensions/msteams/src/probe.ts +107 -0
  1445. package/extensions/msteams/src/reply-dispatcher.ts +132 -0
  1446. package/extensions/msteams/src/resolve-allowlist.ts +297 -0
  1447. package/extensions/msteams/src/runtime.ts +14 -0
  1448. package/extensions/msteams/src/sdk-types.ts +19 -0
  1449. package/extensions/msteams/src/sdk.ts +33 -0
  1450. package/extensions/msteams/src/send-context.ts +164 -0
  1451. package/extensions/msteams/src/send.ts +519 -0
  1452. package/extensions/msteams/src/sent-message-cache.test.ts +15 -0
  1453. package/extensions/msteams/src/sent-message-cache.ts +47 -0
  1454. package/extensions/msteams/src/storage.ts +25 -0
  1455. package/extensions/msteams/src/store-fs.ts +83 -0
  1456. package/extensions/msteams/src/token.ts +19 -0
  1457. package/extensions/msteams/synurex.plugin.json +9 -0
  1458. package/extensions/nextcloud-talk/index.ts +17 -0
  1459. package/extensions/nextcloud-talk/node_modules/.bin/clawdbot +21 -0
  1460. package/extensions/nextcloud-talk/node_modules/.bin/clawdbot.CMD +12 -0
  1461. package/extensions/nextcloud-talk/node_modules/.bin/clawdbot.ps1 +41 -0
  1462. package/extensions/nextcloud-talk/node_modules/.bin/openclaw +21 -0
  1463. package/extensions/nextcloud-talk/node_modules/.bin/openclaw.CMD +12 -0
  1464. package/extensions/nextcloud-talk/node_modules/.bin/openclaw.ps1 +41 -0
  1465. package/extensions/nextcloud-talk/node_modules/.bin/synurex +21 -0
  1466. package/extensions/nextcloud-talk/node_modules/.bin/synurex.CMD +12 -0
  1467. package/extensions/nextcloud-talk/node_modules/.bin/synurex.ps1 +41 -0
  1468. package/extensions/nextcloud-talk/package.json +33 -0
  1469. package/extensions/nextcloud-talk/src/accounts.ts +174 -0
  1470. package/extensions/nextcloud-talk/src/channel.ts +409 -0
  1471. package/extensions/nextcloud-talk/src/config-schema.ts +79 -0
  1472. package/extensions/nextcloud-talk/src/format.ts +79 -0
  1473. package/extensions/nextcloud-talk/src/inbound.ts +327 -0
  1474. package/extensions/nextcloud-talk/src/monitor.ts +246 -0
  1475. package/extensions/nextcloud-talk/src/normalize.ts +39 -0
  1476. package/extensions/nextcloud-talk/src/onboarding.ts +343 -0
  1477. package/extensions/nextcloud-talk/src/policy.test.ts +33 -0
  1478. package/extensions/nextcloud-talk/src/policy.ts +180 -0
  1479. package/extensions/nextcloud-talk/src/room-info.ts +125 -0
  1480. package/extensions/nextcloud-talk/src/runtime.ts +14 -0
  1481. package/extensions/nextcloud-talk/src/send.ts +215 -0
  1482. package/extensions/nextcloud-talk/src/signature.ts +72 -0
  1483. package/extensions/nextcloud-talk/src/types.ts +181 -0
  1484. package/extensions/nextcloud-talk/synurex.plugin.json +9 -0
  1485. package/extensions/nostr/CHANGELOG.md +98 -0
  1486. package/extensions/nostr/README.md +136 -0
  1487. package/extensions/nostr/index.ts +68 -0
  1488. package/extensions/nostr/node_modules/.bin/clawdbot +21 -0
  1489. package/extensions/nostr/node_modules/.bin/clawdbot.CMD +12 -0
  1490. package/extensions/nostr/node_modules/.bin/clawdbot.ps1 +41 -0
  1491. package/extensions/nostr/node_modules/.bin/openclaw +21 -0
  1492. package/extensions/nostr/node_modules/.bin/openclaw.CMD +12 -0
  1493. package/extensions/nostr/node_modules/.bin/openclaw.ps1 +41 -0
  1494. package/extensions/nostr/node_modules/.bin/synurex +21 -0
  1495. package/extensions/nostr/node_modules/.bin/synurex.CMD +12 -0
  1496. package/extensions/nostr/node_modules/.bin/synurex.ps1 +41 -0
  1497. package/extensions/nostr/package.json +34 -0
  1498. package/extensions/nostr/src/channel.test.ts +151 -0
  1499. package/extensions/nostr/src/channel.ts +353 -0
  1500. package/extensions/nostr/src/config-schema.ts +90 -0
  1501. package/extensions/nostr/src/metrics.ts +478 -0
  1502. package/extensions/nostr/src/nostr-bus.fuzz.test.ts +533 -0
  1503. package/extensions/nostr/src/nostr-bus.integration.test.ts +448 -0
  1504. package/extensions/nostr/src/nostr-bus.test.ts +199 -0
  1505. package/extensions/nostr/src/nostr-bus.ts +715 -0
  1506. package/extensions/nostr/src/nostr-profile-http.test.ts +378 -0
  1507. package/extensions/nostr/src/nostr-profile-http.ts +546 -0
  1508. package/extensions/nostr/src/nostr-profile-import.test.ts +119 -0
  1509. package/extensions/nostr/src/nostr-profile-import.ts +262 -0
  1510. package/extensions/nostr/src/nostr-profile.fuzz.test.ts +477 -0
  1511. package/extensions/nostr/src/nostr-profile.test.ts +410 -0
  1512. package/extensions/nostr/src/nostr-profile.ts +277 -0
  1513. package/extensions/nostr/src/nostr-state-store.test.ts +131 -0
  1514. package/extensions/nostr/src/nostr-state-store.ts +226 -0
  1515. package/extensions/nostr/src/runtime.ts +14 -0
  1516. package/extensions/nostr/src/seen-tracker.ts +303 -0
  1517. package/extensions/nostr/src/types.test.ts +157 -0
  1518. package/extensions/nostr/src/types.ts +101 -0
  1519. package/extensions/nostr/synurex.plugin.json +9 -0
  1520. package/extensions/nostr/test/setup.ts +5 -0
  1521. package/extensions/open-prose/README.md +25 -0
  1522. package/extensions/open-prose/index.ts +5 -0
  1523. package/extensions/open-prose/node_modules/.bin/clawdbot +21 -0
  1524. package/extensions/open-prose/node_modules/.bin/clawdbot.CMD +12 -0
  1525. package/extensions/open-prose/node_modules/.bin/clawdbot.ps1 +41 -0
  1526. package/extensions/open-prose/node_modules/.bin/openclaw +21 -0
  1527. package/extensions/open-prose/node_modules/.bin/openclaw.CMD +12 -0
  1528. package/extensions/open-prose/node_modules/.bin/openclaw.ps1 +41 -0
  1529. package/extensions/open-prose/node_modules/.bin/synurex +21 -0
  1530. package/extensions/open-prose/node_modules/.bin/synurex.CMD +12 -0
  1531. package/extensions/open-prose/node_modules/.bin/synurex.ps1 +41 -0
  1532. package/extensions/open-prose/package.json +14 -0
  1533. package/extensions/open-prose/skills/prose/LICENSE +21 -0
  1534. package/extensions/open-prose/skills/prose/SKILL.md +323 -0
  1535. package/extensions/open-prose/skills/prose/alt-borges.md +141 -0
  1536. package/extensions/open-prose/skills/prose/alts/arabian-nights.md +358 -0
  1537. package/extensions/open-prose/skills/prose/alts/borges.md +360 -0
  1538. package/extensions/open-prose/skills/prose/alts/folk.md +322 -0
  1539. package/extensions/open-prose/skills/prose/alts/homer.md +346 -0
  1540. package/extensions/open-prose/skills/prose/alts/kafka.md +373 -0
  1541. package/extensions/open-prose/skills/prose/compiler.md +2971 -0
  1542. package/extensions/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
  1543. package/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
  1544. package/extensions/open-prose/skills/prose/examples/03-code-review.prose +17 -0
  1545. package/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
  1546. package/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
  1547. package/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
  1548. package/extensions/open-prose/skills/prose/examples/07-refactor.prose +20 -0
  1549. package/extensions/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
  1550. package/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
  1551. package/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
  1552. package/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
  1553. package/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
  1554. package/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
  1555. package/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
  1556. package/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
  1557. package/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
  1558. package/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
  1559. package/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
  1560. package/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
  1561. package/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
  1562. package/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
  1563. package/extensions/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
  1564. package/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
  1565. package/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
  1566. package/extensions/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
  1567. package/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
  1568. package/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
  1569. package/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
  1570. package/extensions/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
  1571. package/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
  1572. package/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
  1573. package/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
  1574. package/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
  1575. package/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
  1576. package/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
  1577. package/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
  1578. package/extensions/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
  1579. package/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
  1580. package/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
  1581. package/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
  1582. package/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
  1583. package/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
  1584. package/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
  1585. package/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
  1586. package/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
  1587. package/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
  1588. package/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
  1589. package/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
  1590. package/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
  1591. package/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
  1592. package/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
  1593. package/extensions/open-prose/skills/prose/examples/README.md +391 -0
  1594. package/extensions/open-prose/skills/prose/examples/roadmap/README.md +22 -0
  1595. package/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
  1596. package/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
  1597. package/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
  1598. package/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
  1599. package/extensions/open-prose/skills/prose/guidance/antipatterns.md +951 -0
  1600. package/extensions/open-prose/skills/prose/guidance/patterns.md +700 -0
  1601. package/extensions/open-prose/skills/prose/guidance/system-prompt.md +180 -0
  1602. package/extensions/open-prose/skills/prose/help.md +144 -0
  1603. package/extensions/open-prose/skills/prose/lib/README.md +108 -0
  1604. package/extensions/open-prose/skills/prose/lib/calibrator.prose +215 -0
  1605. package/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
  1606. package/extensions/open-prose/skills/prose/lib/error-forensics.prose +250 -0
  1607. package/extensions/open-prose/skills/prose/lib/inspector.prose +196 -0
  1608. package/extensions/open-prose/skills/prose/lib/profiler.prose +460 -0
  1609. package/extensions/open-prose/skills/prose/lib/program-improver.prose +275 -0
  1610. package/extensions/open-prose/skills/prose/lib/project-memory.prose +118 -0
  1611. package/extensions/open-prose/skills/prose/lib/user-memory.prose +93 -0
  1612. package/extensions/open-prose/skills/prose/lib/vm-improver.prose +243 -0
  1613. package/extensions/open-prose/skills/prose/primitives/session.md +593 -0
  1614. package/extensions/open-prose/skills/prose/prose.md +1237 -0
  1615. package/extensions/open-prose/skills/prose/state/filesystem.md +498 -0
  1616. package/extensions/open-prose/skills/prose/state/in-context.md +384 -0
  1617. package/extensions/open-prose/skills/prose/state/postgres.md +880 -0
  1618. package/extensions/open-prose/skills/prose/state/sqlite.md +574 -0
  1619. package/extensions/open-prose/synurex.plugin.json +11 -0
  1620. package/extensions/qwen-portal-auth/README.md +24 -0
  1621. package/extensions/qwen-portal-auth/index.ts +130 -0
  1622. package/extensions/qwen-portal-auth/oauth.ts +190 -0
  1623. package/extensions/qwen-portal-auth/synurex.plugin.json +9 -0
  1624. package/extensions/signal/index.ts +17 -0
  1625. package/extensions/signal/node_modules/.bin/clawdbot +21 -0
  1626. package/extensions/signal/node_modules/.bin/clawdbot.CMD +12 -0
  1627. package/extensions/signal/node_modules/.bin/clawdbot.ps1 +41 -0
  1628. package/extensions/signal/node_modules/.bin/openclaw +21 -0
  1629. package/extensions/signal/node_modules/.bin/openclaw.CMD +12 -0
  1630. package/extensions/signal/node_modules/.bin/openclaw.ps1 +41 -0
  1631. package/extensions/signal/node_modules/.bin/synurex +21 -0
  1632. package/extensions/signal/node_modules/.bin/synurex.CMD +12 -0
  1633. package/extensions/signal/node_modules/.bin/synurex.ps1 +41 -0
  1634. package/extensions/signal/package.json +14 -0
  1635. package/extensions/signal/src/channel.ts +315 -0
  1636. package/extensions/signal/src/runtime.ts +14 -0
  1637. package/extensions/signal/synurex.plugin.json +9 -0
  1638. package/extensions/slack/index.ts +17 -0
  1639. package/extensions/slack/node_modules/.bin/clawdbot +21 -0
  1640. package/extensions/slack/node_modules/.bin/clawdbot.CMD +12 -0
  1641. package/extensions/slack/node_modules/.bin/clawdbot.ps1 +41 -0
  1642. package/extensions/slack/node_modules/.bin/openclaw +21 -0
  1643. package/extensions/slack/node_modules/.bin/openclaw.CMD +12 -0
  1644. package/extensions/slack/node_modules/.bin/openclaw.ps1 +41 -0
  1645. package/extensions/slack/node_modules/.bin/synurex +21 -0
  1646. package/extensions/slack/node_modules/.bin/synurex.CMD +12 -0
  1647. package/extensions/slack/node_modules/.bin/synurex.ps1 +41 -0
  1648. package/extensions/slack/package.json +14 -0
  1649. package/extensions/slack/src/channel.ts +604 -0
  1650. package/extensions/slack/src/runtime.ts +14 -0
  1651. package/extensions/slack/synurex.plugin.json +9 -0
  1652. package/extensions/telegram/index.ts +17 -0
  1653. package/extensions/telegram/node_modules/.bin/clawdbot +21 -0
  1654. package/extensions/telegram/node_modules/.bin/clawdbot.CMD +12 -0
  1655. package/extensions/telegram/node_modules/.bin/clawdbot.ps1 +41 -0
  1656. package/extensions/telegram/node_modules/.bin/openclaw +21 -0
  1657. package/extensions/telegram/node_modules/.bin/openclaw.CMD +12 -0
  1658. package/extensions/telegram/node_modules/.bin/openclaw.ps1 +41 -0
  1659. package/extensions/telegram/node_modules/.bin/synurex +21 -0
  1660. package/extensions/telegram/node_modules/.bin/synurex.CMD +12 -0
  1661. package/extensions/telegram/node_modules/.bin/synurex.ps1 +41 -0
  1662. package/extensions/telegram/package.json +14 -0
  1663. package/extensions/telegram/src/channel.ts +482 -0
  1664. package/extensions/telegram/src/runtime.ts +14 -0
  1665. package/extensions/telegram/synurex.plugin.json +9 -0
  1666. package/extensions/tlon/README.md +5 -0
  1667. package/extensions/tlon/index.ts +17 -0
  1668. package/extensions/tlon/node_modules/.bin/clawdbot +21 -0
  1669. package/extensions/tlon/node_modules/.bin/clawdbot.CMD +12 -0
  1670. package/extensions/tlon/node_modules/.bin/clawdbot.ps1 +41 -0
  1671. package/extensions/tlon/node_modules/.bin/openclaw +21 -0
  1672. package/extensions/tlon/node_modules/.bin/openclaw.CMD +12 -0
  1673. package/extensions/tlon/node_modules/.bin/openclaw.ps1 +41 -0
  1674. package/extensions/tlon/node_modules/.bin/synurex +21 -0
  1675. package/extensions/tlon/node_modules/.bin/synurex.CMD +12 -0
  1676. package/extensions/tlon/node_modules/.bin/synurex.ps1 +41 -0
  1677. package/extensions/tlon/package.json +33 -0
  1678. package/extensions/tlon/src/channel.ts +392 -0
  1679. package/extensions/tlon/src/config-schema.test.ts +31 -0
  1680. package/extensions/tlon/src/config-schema.ts +45 -0
  1681. package/extensions/tlon/src/monitor/discovery.ts +76 -0
  1682. package/extensions/tlon/src/monitor/history.ts +90 -0
  1683. package/extensions/tlon/src/monitor/index.ts +580 -0
  1684. package/extensions/tlon/src/monitor/processed-messages.test.ts +23 -0
  1685. package/extensions/tlon/src/monitor/processed-messages.ts +46 -0
  1686. package/extensions/tlon/src/monitor/utils.ts +106 -0
  1687. package/extensions/tlon/src/onboarding.ts +214 -0
  1688. package/extensions/tlon/src/runtime.ts +14 -0
  1689. package/extensions/tlon/src/targets.ts +89 -0
  1690. package/extensions/tlon/src/types.ts +92 -0
  1691. package/extensions/tlon/src/urbit/auth.ts +18 -0
  1692. package/extensions/tlon/src/urbit/http-api.ts +38 -0
  1693. package/extensions/tlon/src/urbit/send.test.ts +38 -0
  1694. package/extensions/tlon/src/urbit/send.ts +131 -0
  1695. package/extensions/tlon/src/urbit/sse-client.test.ts +40 -0
  1696. package/extensions/tlon/src/urbit/sse-client.ts +395 -0
  1697. package/extensions/tlon/synurex.plugin.json +9 -0
  1698. package/extensions/twitch/CHANGELOG.md +69 -0
  1699. package/extensions/twitch/README.md +89 -0
  1700. package/extensions/twitch/index.ts +20 -0
  1701. package/extensions/twitch/node_modules/.bin/clawdbot +21 -0
  1702. package/extensions/twitch/node_modules/.bin/clawdbot.CMD +12 -0
  1703. package/extensions/twitch/node_modules/.bin/clawdbot.ps1 +41 -0
  1704. package/extensions/twitch/node_modules/.bin/openclaw +21 -0
  1705. package/extensions/twitch/node_modules/.bin/openclaw.CMD +12 -0
  1706. package/extensions/twitch/node_modules/.bin/openclaw.ps1 +41 -0
  1707. package/extensions/twitch/node_modules/.bin/synurex +21 -0
  1708. package/extensions/twitch/node_modules/.bin/synurex.CMD +12 -0
  1709. package/extensions/twitch/node_modules/.bin/synurex.ps1 +41 -0
  1710. package/extensions/twitch/package.json +20 -0
  1711. package/extensions/twitch/src/access-control.test.ts +489 -0
  1712. package/extensions/twitch/src/access-control.ts +166 -0
  1713. package/extensions/twitch/src/actions.ts +173 -0
  1714. package/extensions/twitch/src/client-manager-registry.ts +115 -0
  1715. package/extensions/twitch/src/config-schema.ts +84 -0
  1716. package/extensions/twitch/src/config.test.ts +87 -0
  1717. package/extensions/twitch/src/config.ts +116 -0
  1718. package/extensions/twitch/src/monitor.ts +272 -0
  1719. package/extensions/twitch/src/onboarding.test.ts +311 -0
  1720. package/extensions/twitch/src/onboarding.ts +417 -0
  1721. package/extensions/twitch/src/outbound.test.ts +373 -0
  1722. package/extensions/twitch/src/outbound.ts +184 -0
  1723. package/extensions/twitch/src/plugin.test.ts +39 -0
  1724. package/extensions/twitch/src/plugin.ts +274 -0
  1725. package/extensions/twitch/src/probe.test.ts +195 -0
  1726. package/extensions/twitch/src/probe.ts +120 -0
  1727. package/extensions/twitch/src/resolver.ts +137 -0
  1728. package/extensions/twitch/src/runtime.ts +14 -0
  1729. package/extensions/twitch/src/send.test.ts +289 -0
  1730. package/extensions/twitch/src/send.ts +136 -0
  1731. package/extensions/twitch/src/status.test.ts +270 -0
  1732. package/extensions/twitch/src/status.ts +178 -0
  1733. package/extensions/twitch/src/token.test.ts +171 -0
  1734. package/extensions/twitch/src/token.ts +91 -0
  1735. package/extensions/twitch/src/twitch-client.test.ts +589 -0
  1736. package/extensions/twitch/src/twitch-client.ts +277 -0
  1737. package/extensions/twitch/src/types.ts +143 -0
  1738. package/extensions/twitch/src/utils/markdown.ts +98 -0
  1739. package/extensions/twitch/src/utils/twitch.ts +78 -0
  1740. package/extensions/twitch/synurex.plugin.json +9 -0
  1741. package/extensions/twitch/test/setup.ts +7 -0
  1742. package/extensions/voice-call/CHANGELOG.md +133 -0
  1743. package/extensions/voice-call/README.md +139 -0
  1744. package/extensions/voice-call/index.ts +493 -0
  1745. package/extensions/voice-call/node_modules/.bin/clawdbot +21 -0
  1746. package/extensions/voice-call/node_modules/.bin/clawdbot.CMD +12 -0
  1747. package/extensions/voice-call/node_modules/.bin/clawdbot.ps1 +41 -0
  1748. package/extensions/voice-call/node_modules/.bin/openclaw +21 -0
  1749. package/extensions/voice-call/node_modules/.bin/openclaw.CMD +12 -0
  1750. package/extensions/voice-call/node_modules/.bin/openclaw.ps1 +41 -0
  1751. package/extensions/voice-call/node_modules/.bin/synurex +21 -0
  1752. package/extensions/voice-call/node_modules/.bin/synurex.CMD +12 -0
  1753. package/extensions/voice-call/node_modules/.bin/synurex.ps1 +41 -0
  1754. package/extensions/voice-call/package.json +19 -0
  1755. package/extensions/voice-call/src/allowlist.ts +19 -0
  1756. package/extensions/voice-call/src/cli.ts +279 -0
  1757. package/extensions/voice-call/src/config.test.ts +234 -0
  1758. package/extensions/voice-call/src/config.ts +523 -0
  1759. package/extensions/voice-call/src/core-bridge.ts +159 -0
  1760. package/extensions/voice-call/src/manager/context.ts +21 -0
  1761. package/extensions/voice-call/src/manager/events.ts +188 -0
  1762. package/extensions/voice-call/src/manager/lookup.ts +35 -0
  1763. package/extensions/voice-call/src/manager/outbound.ts +275 -0
  1764. package/extensions/voice-call/src/manager/state.ts +48 -0
  1765. package/extensions/voice-call/src/manager/store.ts +91 -0
  1766. package/extensions/voice-call/src/manager/timers.ts +89 -0
  1767. package/extensions/voice-call/src/manager/twiml.ts +9 -0
  1768. package/extensions/voice-call/src/manager.test.ts +224 -0
  1769. package/extensions/voice-call/src/manager.ts +887 -0
  1770. package/extensions/voice-call/src/media-stream.test.ts +96 -0
  1771. package/extensions/voice-call/src/media-stream.ts +411 -0
  1772. package/extensions/voice-call/src/providers/base.ts +67 -0
  1773. package/extensions/voice-call/src/providers/index.ts +10 -0
  1774. package/extensions/voice-call/src/providers/mock.ts +165 -0
  1775. package/extensions/voice-call/src/providers/plivo.test.ts +27 -0
  1776. package/extensions/voice-call/src/providers/plivo.ts +515 -0
  1777. package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
  1778. package/extensions/voice-call/src/providers/telnyx.ts +371 -0
  1779. package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
  1780. package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
  1781. package/extensions/voice-call/src/providers/twilio/webhook.ts +32 -0
  1782. package/extensions/voice-call/src/providers/twilio.test.ts +60 -0
  1783. package/extensions/voice-call/src/providers/twilio.ts +626 -0
  1784. package/extensions/voice-call/src/response-generator.ts +158 -0
  1785. package/extensions/voice-call/src/runtime.ts +212 -0
  1786. package/extensions/voice-call/src/telephony-audio.ts +90 -0
  1787. package/extensions/voice-call/src/telephony-tts.ts +104 -0
  1788. package/extensions/voice-call/src/tunnel.ts +314 -0
  1789. package/extensions/voice-call/src/types.ts +272 -0
  1790. package/extensions/voice-call/src/utils.ts +14 -0
  1791. package/extensions/voice-call/src/voice-mapping.ts +67 -0
  1792. package/extensions/voice-call/src/webhook-security.test.ts +377 -0
  1793. package/extensions/voice-call/src/webhook-security.ts +689 -0
  1794. package/extensions/voice-call/src/webhook.ts +516 -0
  1795. package/extensions/voice-call/synurex.plugin.json +559 -0
  1796. package/extensions/whatsapp/index.ts +17 -0
  1797. package/extensions/whatsapp/node_modules/.bin/clawdbot +21 -0
  1798. package/extensions/whatsapp/node_modules/.bin/clawdbot.CMD +12 -0
  1799. package/extensions/whatsapp/node_modules/.bin/clawdbot.ps1 +41 -0
  1800. package/extensions/whatsapp/node_modules/.bin/openclaw +21 -0
  1801. package/extensions/whatsapp/node_modules/.bin/openclaw.CMD +12 -0
  1802. package/extensions/whatsapp/node_modules/.bin/openclaw.ps1 +41 -0
  1803. package/extensions/whatsapp/node_modules/.bin/synurex +21 -0
  1804. package/extensions/whatsapp/node_modules/.bin/synurex.CMD +12 -0
  1805. package/extensions/whatsapp/node_modules/.bin/synurex.ps1 +41 -0
  1806. package/extensions/whatsapp/package.json +14 -0
  1807. package/extensions/whatsapp/src/channel.ts +508 -0
  1808. package/extensions/whatsapp/src/runtime.ts +14 -0
  1809. package/extensions/whatsapp/synurex.plugin.json +9 -0
  1810. package/extensions/zalo/CHANGELOG.md +113 -0
  1811. package/extensions/zalo/README.md +50 -0
  1812. package/extensions/zalo/index.ts +19 -0
  1813. package/extensions/zalo/node_modules/.bin/clawdbot +21 -0
  1814. package/extensions/zalo/node_modules/.bin/clawdbot.CMD +12 -0
  1815. package/extensions/zalo/node_modules/.bin/clawdbot.ps1 +41 -0
  1816. package/extensions/zalo/node_modules/.bin/openclaw +21 -0
  1817. package/extensions/zalo/node_modules/.bin/openclaw.CMD +12 -0
  1818. package/extensions/zalo/node_modules/.bin/openclaw.ps1 +41 -0
  1819. package/extensions/zalo/node_modules/.bin/synurex +21 -0
  1820. package/extensions/zalo/node_modules/.bin/synurex.CMD +12 -0
  1821. package/extensions/zalo/node_modules/.bin/synurex.ps1 +41 -0
  1822. package/extensions/zalo/package.json +36 -0
  1823. package/extensions/zalo/src/accounts.ts +80 -0
  1824. package/extensions/zalo/src/actions.ts +67 -0
  1825. package/extensions/zalo/src/api.ts +208 -0
  1826. package/extensions/zalo/src/channel.directory.test.ts +43 -0
  1827. package/extensions/zalo/src/channel.ts +414 -0
  1828. package/extensions/zalo/src/config-schema.ts +25 -0
  1829. package/extensions/zalo/src/monitor.ts +764 -0
  1830. package/extensions/zalo/src/monitor.webhook.test.ts +73 -0
  1831. package/extensions/zalo/src/onboarding.ts +401 -0
  1832. package/extensions/zalo/src/probe.ts +46 -0
  1833. package/extensions/zalo/src/proxy.ts +21 -0
  1834. package/extensions/zalo/src/runtime.ts +14 -0
  1835. package/extensions/zalo/src/send.ts +124 -0
  1836. package/extensions/zalo/src/status-issues.ts +53 -0
  1837. package/extensions/zalo/src/token.ts +63 -0
  1838. package/extensions/zalo/src/types.ts +44 -0
  1839. package/extensions/zalo/synurex.plugin.json +9 -0
  1840. package/extensions/zalouser/CHANGELOG.md +85 -0
  1841. package/extensions/zalouser/README.md +225 -0
  1842. package/extensions/zalouser/index.ts +31 -0
  1843. package/extensions/zalouser/node_modules/.bin/clawdbot +21 -0
  1844. package/extensions/zalouser/node_modules/.bin/clawdbot.CMD +12 -0
  1845. package/extensions/zalouser/node_modules/.bin/clawdbot.ps1 +41 -0
  1846. package/extensions/zalouser/node_modules/.bin/openclaw +21 -0
  1847. package/extensions/zalouser/node_modules/.bin/openclaw.CMD +12 -0
  1848. package/extensions/zalouser/node_modules/.bin/openclaw.ps1 +41 -0
  1849. package/extensions/zalouser/node_modules/.bin/synurex +21 -0
  1850. package/extensions/zalouser/node_modules/.bin/synurex.CMD +12 -0
  1851. package/extensions/zalouser/node_modules/.bin/synurex.ps1 +41 -0
  1852. package/extensions/zalouser/package.json +36 -0
  1853. package/extensions/zalouser/src/accounts.ts +135 -0
  1854. package/extensions/zalouser/src/channel.test.ts +18 -0
  1855. package/extensions/zalouser/src/channel.ts +686 -0
  1856. package/extensions/zalouser/src/config-schema.ts +28 -0
  1857. package/extensions/zalouser/src/monitor.ts +601 -0
  1858. package/extensions/zalouser/src/onboarding.ts +504 -0
  1859. package/extensions/zalouser/src/probe.ts +28 -0
  1860. package/extensions/zalouser/src/runtime.ts +14 -0
  1861. package/extensions/zalouser/src/send.ts +160 -0
  1862. package/extensions/zalouser/src/status-issues.test.ts +57 -0
  1863. package/extensions/zalouser/src/status-issues.ts +89 -0
  1864. package/extensions/zalouser/src/tool.ts +164 -0
  1865. package/extensions/zalouser/src/types.ts +110 -0
  1866. package/extensions/zalouser/src/zca.ts +202 -0
  1867. package/extensions/zalouser/synurex.plugin.json +9 -0
  1868. package/package.json +263 -0
  1869. package/skills/1password/SKILL.md +70 -0
  1870. package/skills/1password/references/cli-examples.md +29 -0
  1871. package/skills/1password/references/get-started.md +17 -0
  1872. package/skills/apple-notes/SKILL.md +77 -0
  1873. package/skills/apple-reminders/SKILL.md +96 -0
  1874. package/skills/bear-notes/SKILL.md +107 -0
  1875. package/skills/blogwatcher/SKILL.md +69 -0
  1876. package/skills/blucli/SKILL.md +47 -0
  1877. package/skills/bluebubbles/SKILL.md +131 -0
  1878. package/skills/camsnap/SKILL.md +45 -0
  1879. package/skills/canvas/SKILL.md +198 -0
  1880. package/skills/clawhub/SKILL.md +77 -0
  1881. package/skills/coding-agent/SKILL.md +284 -0
  1882. package/skills/discord/SKILL.md +578 -0
  1883. package/skills/eightctl/SKILL.md +50 -0
  1884. package/skills/food-order/SKILL.md +48 -0
  1885. package/skills/gemini/SKILL.md +43 -0
  1886. package/skills/gifgrep/SKILL.md +79 -0
  1887. package/skills/github/SKILL.md +77 -0
  1888. package/skills/gog/SKILL.md +116 -0
  1889. package/skills/goplaces/SKILL.md +52 -0
  1890. package/skills/healthcheck/SKILL.md +245 -0
  1891. package/skills/himalaya/SKILL.md +257 -0
  1892. package/skills/himalaya/references/configuration.md +184 -0
  1893. package/skills/himalaya/references/message-composition.md +199 -0
  1894. package/skills/imsg/SKILL.md +74 -0
  1895. package/skills/local-places/SERVER_README.md +101 -0
  1896. package/skills/local-places/SKILL.md +102 -0
  1897. package/skills/local-places/pyproject.toml +21 -0
  1898. package/skills/local-places/src/local_places/__init__.py +2 -0
  1899. package/skills/local-places/src/local_places/google_places.py +314 -0
  1900. package/skills/local-places/src/local_places/main.py +65 -0
  1901. package/skills/local-places/src/local_places/schemas.py +107 -0
  1902. package/skills/mcporter/SKILL.md +61 -0
  1903. package/skills/model-usage/SKILL.md +69 -0
  1904. package/skills/model-usage/references/codexbar-cli.md +33 -0
  1905. package/skills/model-usage/scripts/model_usage.py +310 -0
  1906. package/skills/nano-banana-pro/SKILL.md +58 -0
  1907. package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
  1908. package/skills/nano-pdf/SKILL.md +38 -0
  1909. package/skills/notion/SKILL.md +172 -0
  1910. package/skills/obsidian/SKILL.md +81 -0
  1911. package/skills/openai-image-gen/SKILL.md +89 -0
  1912. package/skills/openai-image-gen/scripts/gen.py +240 -0
  1913. package/skills/openai-whisper/SKILL.md +38 -0
  1914. package/skills/openai-whisper-api/SKILL.md +52 -0
  1915. package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
  1916. package/skills/openhue/SKILL.md +51 -0
  1917. package/skills/oracle/SKILL.md +125 -0
  1918. package/skills/ordercli/SKILL.md +78 -0
  1919. package/skills/peekaboo/SKILL.md +190 -0
  1920. package/skills/sag/SKILL.md +87 -0
  1921. package/skills/session-logs/SKILL.md +115 -0
  1922. package/skills/sherpa-onnx-tts/SKILL.md +103 -0
  1923. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1924. package/skills/skill-creator/SKILL.md +370 -0
  1925. package/skills/skill-creator/license.txt +202 -0
  1926. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1927. package/skills/skill-creator/scripts/package_skill.py +111 -0
  1928. package/skills/skill-creator/scripts/quick_validate.py +101 -0
  1929. package/skills/slack/SKILL.md +144 -0
  1930. package/skills/songsee/SKILL.md +49 -0
  1931. package/skills/sonoscli/SKILL.md +46 -0
  1932. package/skills/spotify-player/SKILL.md +64 -0
  1933. package/skills/summarize/SKILL.md +87 -0
  1934. package/skills/things-mac/SKILL.md +86 -0
  1935. package/skills/tmux/SKILL.md +135 -0
  1936. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1937. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1938. package/skills/trello/SKILL.md +95 -0
  1939. package/skills/video-frames/SKILL.md +46 -0
  1940. package/skills/video-frames/scripts/frame.sh +81 -0
  1941. package/skills/voice-call/SKILL.md +45 -0
  1942. package/skills/wacli/SKILL.md +72 -0
  1943. package/skills/weather/SKILL.md +54 -0
  1944. package/synurex.mjs +33 -0
@@ -0,0 +1,3090 @@
1
+ import { G as resolveResponseUsageMode, I as formatThinkingLevels, R as listThinkingLevelLabels, U as normalizeUsageDisplay } from "./pi-embedded-helpers-N_L31uhW.js";
2
+ import { u as resolveGatewayPort } from "./paths-Drx5WZ13.js";
3
+ import { i as buildAgentMainSessionKey, l as normalizeAgentId, u as normalizeMainKey, v as parseAgentSessionKey } from "./session-key-DrNCyvP1.js";
4
+ import { L as isRich, R as theme$1, s as visibleWidth } from "./subsystem-DPYBJG7C.js";
5
+ import { c as resolveDefaultAgentId } from "./agent-scope-CRRhJ7Hf.js";
6
+ import { i as loadConfig, j as VERSION } from "./config-AFzxllYx.js";
7
+ import { f as GATEWAY_CLIENT_CAPS, h as GATEWAY_CLIENT_NAMES, m as GATEWAY_CLIENT_MODES } from "./message-channel-DJEeCAZD.js";
8
+ import { n as resolveToolDisplay, t as formatToolDetail } from "./tool-display-C9u4CdQu.js";
9
+ import { a as extractContentFromMessage, c as formatContextUsageLine, d as resolveFinalAssistantText, f as resolveCommitHash, g as listChatCommandsForConfig, h as listChatCommands, i as composeThinkingAndContent, l as formatTokens, n as formatAge, o as extractTextFromMessage, r as asString, s as extractThinkingFromMessage, u as isCommandMessage } from "./channel-summary-D7joKboS.js";
10
+ import { Pt as PROTOCOL_VERSION, l as GatewayClient } from "./net-MZzhgr1g.js";
11
+ import { a as resolveExplicitGatewayAuth, r as ensureExplicitGatewayAuth } from "./call-mnjMMyVJ.js";
12
+ import { n as formatTokenCount } from "./usage-format-DvowRSs-.js";
13
+ import chalk from "chalk";
14
+ import { spawn } from "node:child_process";
15
+ import { randomUUID } from "node:crypto";
16
+ import { Box, CombinedAutocompleteProvider, Container, Editor, Input, Key, Loader, Markdown, ProcessTerminal, SelectList, SettingsList, Spacer, TUI, Text, getEditorKeybindings, isKeyRelease, matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
17
+ import { highlight, supportsLanguage } from "cli-highlight";
18
+
19
+ //#region src/tui/commands.ts
20
+ const VERBOSE_LEVELS = ["on", "off"];
21
+ const REASONING_LEVELS = ["on", "off"];
22
+ const ELEVATED_LEVELS = [
23
+ "on",
24
+ "off",
25
+ "ask",
26
+ "full"
27
+ ];
28
+ const ACTIVATION_LEVELS = ["mention", "always"];
29
+ const USAGE_FOOTER_LEVELS = [
30
+ "off",
31
+ "tokens",
32
+ "full"
33
+ ];
34
+ const COMMAND_ALIASES = { elev: "elevated" };
35
+ function parseCommand(input) {
36
+ const trimmed = input.replace(/^\//, "").trim();
37
+ if (!trimmed) return {
38
+ name: "",
39
+ args: ""
40
+ };
41
+ const [name, ...rest] = trimmed.split(/\s+/);
42
+ const normalized = name.toLowerCase();
43
+ return {
44
+ name: COMMAND_ALIASES[normalized] ?? normalized,
45
+ args: rest.join(" ").trim()
46
+ };
47
+ }
48
+ function getSlashCommands(options = {}) {
49
+ const thinkLevels = listThinkingLevelLabels(options.provider, options.model);
50
+ const commands = [
51
+ {
52
+ name: "help",
53
+ description: "Show slash command help"
54
+ },
55
+ {
56
+ name: "status",
57
+ description: "Show gateway status summary"
58
+ },
59
+ {
60
+ name: "agent",
61
+ description: "Switch agent (or open picker)"
62
+ },
63
+ {
64
+ name: "agents",
65
+ description: "Open agent picker"
66
+ },
67
+ {
68
+ name: "session",
69
+ description: "Switch session (or open picker)"
70
+ },
71
+ {
72
+ name: "sessions",
73
+ description: "Open session picker"
74
+ },
75
+ {
76
+ name: "model",
77
+ description: "Set model (or open picker)"
78
+ },
79
+ {
80
+ name: "models",
81
+ description: "Open model picker"
82
+ },
83
+ {
84
+ name: "think",
85
+ description: "Set thinking level",
86
+ getArgumentCompletions: (prefix) => thinkLevels.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
87
+ value,
88
+ label: value
89
+ }))
90
+ },
91
+ {
92
+ name: "verbose",
93
+ description: "Set verbose on/off",
94
+ getArgumentCompletions: (prefix) => VERBOSE_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
95
+ value,
96
+ label: value
97
+ }))
98
+ },
99
+ {
100
+ name: "reasoning",
101
+ description: "Set reasoning on/off",
102
+ getArgumentCompletions: (prefix) => REASONING_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
103
+ value,
104
+ label: value
105
+ }))
106
+ },
107
+ {
108
+ name: "usage",
109
+ description: "Toggle per-response usage line",
110
+ getArgumentCompletions: (prefix) => USAGE_FOOTER_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
111
+ value,
112
+ label: value
113
+ }))
114
+ },
115
+ {
116
+ name: "elevated",
117
+ description: "Set elevated on/off/ask/full",
118
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
119
+ value,
120
+ label: value
121
+ }))
122
+ },
123
+ {
124
+ name: "elev",
125
+ description: "Alias for /elevated",
126
+ getArgumentCompletions: (prefix) => ELEVATED_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
127
+ value,
128
+ label: value
129
+ }))
130
+ },
131
+ {
132
+ name: "activation",
133
+ description: "Set group activation",
134
+ getArgumentCompletions: (prefix) => ACTIVATION_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map((value) => ({
135
+ value,
136
+ label: value
137
+ }))
138
+ },
139
+ {
140
+ name: "abort",
141
+ description: "Abort active run"
142
+ },
143
+ {
144
+ name: "new",
145
+ description: "Reset the session"
146
+ },
147
+ {
148
+ name: "reset",
149
+ description: "Reset the session"
150
+ },
151
+ {
152
+ name: "settings",
153
+ description: "Open settings"
154
+ },
155
+ {
156
+ name: "exit",
157
+ description: "Exit the TUI"
158
+ },
159
+ {
160
+ name: "quit",
161
+ description: "Exit the TUI"
162
+ }
163
+ ];
164
+ const seen = new Set(commands.map((command) => command.name));
165
+ const gatewayCommands = options.cfg ? listChatCommandsForConfig(options.cfg) : listChatCommands();
166
+ for (const command of gatewayCommands) {
167
+ const aliases = command.textAliases.length > 0 ? command.textAliases : [`/${command.key}`];
168
+ for (const alias of aliases) {
169
+ const name = alias.replace(/^\//, "").trim();
170
+ if (!name || seen.has(name)) continue;
171
+ seen.add(name);
172
+ commands.push({
173
+ name,
174
+ description: command.description
175
+ });
176
+ }
177
+ }
178
+ return commands;
179
+ }
180
+ function helpText(options = {}) {
181
+ return [
182
+ "Slash commands:",
183
+ "/help",
184
+ "/commands",
185
+ "/status",
186
+ "/agent <id> (or /agents)",
187
+ "/session <key> (or /sessions)",
188
+ "/model <provider/model> (or /models)",
189
+ `/think <${formatThinkingLevels(options.provider, options.model, "|")}>`,
190
+ "/verbose <on|off>",
191
+ "/reasoning <on|off>",
192
+ "/usage <off|tokens|full>",
193
+ "/elevated <on|off|ask|full>",
194
+ "/elev <on|off|ask|full>",
195
+ "/activation <mention|always>",
196
+ "/new or /reset",
197
+ "/abort",
198
+ "/settings",
199
+ "/exit"
200
+ ].join("\n");
201
+ }
202
+
203
+ //#endregion
204
+ //#region src/tui/theme/syntax-theme.ts
205
+ /**
206
+ * Syntax highlighting theme for code blocks.
207
+ * Uses chalk functions to style different token types.
208
+ */
209
+ function createSyntaxTheme(fallback) {
210
+ return {
211
+ keyword: chalk.hex("#C586C0"),
212
+ built_in: chalk.hex("#4EC9B0"),
213
+ type: chalk.hex("#4EC9B0"),
214
+ literal: chalk.hex("#569CD6"),
215
+ number: chalk.hex("#B5CEA8"),
216
+ string: chalk.hex("#CE9178"),
217
+ regexp: chalk.hex("#D16969"),
218
+ symbol: chalk.hex("#B5CEA8"),
219
+ class: chalk.hex("#4EC9B0"),
220
+ function: chalk.hex("#DCDCAA"),
221
+ title: chalk.hex("#DCDCAA"),
222
+ params: chalk.hex("#9CDCFE"),
223
+ comment: chalk.hex("#6A9955"),
224
+ doctag: chalk.hex("#608B4E"),
225
+ meta: chalk.hex("#9CDCFE"),
226
+ "meta-keyword": chalk.hex("#C586C0"),
227
+ "meta-string": chalk.hex("#CE9178"),
228
+ section: chalk.hex("#DCDCAA"),
229
+ tag: chalk.hex("#569CD6"),
230
+ name: chalk.hex("#9CDCFE"),
231
+ attr: chalk.hex("#9CDCFE"),
232
+ attribute: chalk.hex("#9CDCFE"),
233
+ variable: chalk.hex("#9CDCFE"),
234
+ bullet: chalk.hex("#D7BA7D"),
235
+ code: chalk.hex("#CE9178"),
236
+ emphasis: chalk.italic,
237
+ strong: chalk.bold,
238
+ formula: chalk.hex("#C586C0"),
239
+ link: chalk.hex("#4EC9B0"),
240
+ quote: chalk.hex("#6A9955"),
241
+ addition: chalk.hex("#B5CEA8"),
242
+ deletion: chalk.hex("#F44747"),
243
+ "selector-tag": chalk.hex("#D7BA7D"),
244
+ "selector-id": chalk.hex("#D7BA7D"),
245
+ "selector-class": chalk.hex("#D7BA7D"),
246
+ "selector-attr": chalk.hex("#D7BA7D"),
247
+ "selector-pseudo": chalk.hex("#D7BA7D"),
248
+ "template-tag": chalk.hex("#C586C0"),
249
+ "template-variable": chalk.hex("#9CDCFE"),
250
+ default: fallback
251
+ };
252
+ }
253
+
254
+ //#endregion
255
+ //#region src/tui/theme/theme.ts
256
+ const palette = {
257
+ text: "#E8E3D5",
258
+ dim: "#7B7F87",
259
+ accent: "#8B5CF6",
260
+ accentSoft: "#A78BFA",
261
+ border: "#3C414B",
262
+ userBg: "#1E1B2E",
263
+ userText: "#F3EEE0",
264
+ systemText: "#9BA3B2",
265
+ toolPendingBg: "#1A1625",
266
+ toolSuccessBg: "#0F2318",
267
+ toolErrorBg: "#2A0F0F",
268
+ toolTitle: "#8B5CF6",
269
+ toolOutput: "#E1DACB",
270
+ quote: "#A78BFA",
271
+ quoteBorder: "#4C1D95",
272
+ code: "#C4B5FD",
273
+ codeBlock: "#1E232A",
274
+ codeBorder: "#343A45",
275
+ link: "#34D399",
276
+ error: "#F97066",
277
+ success: "#7DD3A5"
278
+ };
279
+ const fg = (hex) => (text) => chalk.hex(hex)(text);
280
+ const bg = (hex) => (text) => chalk.bgHex(hex)(text);
281
+ const syntaxTheme = createSyntaxTheme(fg(palette.code));
282
+ /**
283
+ * Highlight code with syntax coloring.
284
+ * Returns an array of lines with ANSI escape codes.
285
+ */
286
+ function highlightCode(code, lang) {
287
+ try {
288
+ return highlight(code, {
289
+ language: lang && supportsLanguage(lang) ? lang : void 0,
290
+ theme: syntaxTheme,
291
+ ignoreIllegals: true
292
+ }).split("\n");
293
+ } catch {
294
+ return code.split("\n").map((line) => fg(palette.code)(line));
295
+ }
296
+ }
297
+ const theme = {
298
+ fg: fg(palette.text),
299
+ dim: fg(palette.dim),
300
+ accent: fg(palette.accent),
301
+ accentSoft: fg(palette.accentSoft),
302
+ success: fg(palette.success),
303
+ error: fg(palette.error),
304
+ header: (text) => chalk.bold(fg(palette.accent)(text)),
305
+ system: fg(palette.systemText),
306
+ userBg: bg(palette.userBg),
307
+ userText: fg(palette.userText),
308
+ toolTitle: fg(palette.toolTitle),
309
+ toolOutput: fg(palette.toolOutput),
310
+ toolPendingBg: bg(palette.toolPendingBg),
311
+ toolSuccessBg: bg(palette.toolSuccessBg),
312
+ toolErrorBg: bg(palette.toolErrorBg),
313
+ border: fg(palette.border),
314
+ bold: (text) => chalk.bold(text),
315
+ italic: (text) => chalk.italic(text)
316
+ };
317
+ const markdownTheme = {
318
+ heading: (text) => chalk.bold(fg(palette.accent)(text)),
319
+ link: (text) => fg(palette.link)(text),
320
+ linkUrl: (text) => chalk.dim(text),
321
+ code: (text) => fg(palette.code)(text),
322
+ codeBlock: (text) => fg(palette.code)(text),
323
+ codeBlockBorder: (text) => fg(palette.codeBorder)(text),
324
+ quote: (text) => fg(palette.quote)(text),
325
+ quoteBorder: (text) => fg(palette.quoteBorder)(text),
326
+ hr: (text) => fg(palette.border)(text),
327
+ listBullet: (text) => fg(palette.accentSoft)(text),
328
+ bold: (text) => chalk.bold(text),
329
+ italic: (text) => chalk.italic(text),
330
+ strikethrough: (text) => chalk.strikethrough(text),
331
+ underline: (text) => chalk.underline(text),
332
+ highlightCode
333
+ };
334
+ const selectListTheme = {
335
+ selectedPrefix: (text) => fg(palette.accent)(text),
336
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
337
+ description: (text) => fg(palette.dim)(text),
338
+ scrollInfo: (text) => fg(palette.dim)(text),
339
+ noMatch: (text) => fg(palette.dim)(text)
340
+ };
341
+ const filterableSelectListTheme = {
342
+ ...selectListTheme,
343
+ filterLabel: (text) => fg(palette.dim)(text)
344
+ };
345
+ const settingsListTheme = {
346
+ label: (text, selected) => selected ? chalk.bold(fg(palette.accent)(text)) : fg(palette.text)(text),
347
+ value: (text, selected) => selected ? fg(palette.accentSoft)(text) : fg(palette.dim)(text),
348
+ description: (text) => fg(palette.systemText)(text),
349
+ cursor: fg(palette.accent)("→ "),
350
+ hint: (text) => fg(palette.dim)(text)
351
+ };
352
+ const editorTheme = {
353
+ borderColor: (text) => fg(palette.border)(text),
354
+ selectList: selectListTheme
355
+ };
356
+ const searchableSelectListTheme = {
357
+ selectedPrefix: (text) => fg(palette.accent)(text),
358
+ selectedText: (text) => chalk.bold(fg(palette.accent)(text)),
359
+ description: (text) => fg(palette.dim)(text),
360
+ scrollInfo: (text) => fg(palette.dim)(text),
361
+ noMatch: (text) => fg(palette.dim)(text),
362
+ searchPrompt: (text) => fg(palette.accentSoft)(text),
363
+ searchInput: (text) => fg(palette.text)(text),
364
+ matchHighlight: (text) => chalk.bold(fg(palette.accent)(text))
365
+ };
366
+
367
+ //#endregion
368
+ //#region src/tui/components/assistant-message.ts
369
+ function buildDivider(label, width = 60) {
370
+ const dashes = "─".repeat(Math.max(0, Math.floor((width - label.length - 2) / 2)));
371
+ const right = "─".repeat(Math.max(0, width - label.length - 2 - dashes.length));
372
+ return `${theme.border(dashes)} ${theme.accent(label)} ${theme.border(right)}`;
373
+ }
374
+ var AssistantMessageComponent = class extends Container {
375
+ constructor(text) {
376
+ super();
377
+ const divider = buildDivider("synurex");
378
+ this.body = new Markdown(text, 1, 0, markdownTheme, { color: (line) => theme.fg(line) });
379
+ this.addChild(new Spacer(1));
380
+ this.addChild(new Text(divider, 1, 0));
381
+ this.addChild(this.body);
382
+ }
383
+ setText(text) {
384
+ this.body.setText(text);
385
+ }
386
+ };
387
+
388
+ //#endregion
389
+ //#region src/tui/components/tool-execution.ts
390
+ const PREVIEW_LINES = 12;
391
+ function formatArgs(toolName, args) {
392
+ const detail = formatToolDetail(resolveToolDisplay({
393
+ name: toolName,
394
+ args
395
+ }));
396
+ if (detail) return detail;
397
+ if (!args || typeof args !== "object") return "";
398
+ try {
399
+ return JSON.stringify(args);
400
+ } catch {
401
+ return "";
402
+ }
403
+ }
404
+ function extractText(result) {
405
+ if (!result?.content) return "";
406
+ const lines = [];
407
+ for (const entry of result.content) if (entry.type === "text" && entry.text) lines.push(entry.text);
408
+ else if (entry.type === "image") {
409
+ const mime = entry.mimeType ?? "image";
410
+ const size = entry.bytes ? ` ${Math.round(entry.bytes / 1024)}kb` : "";
411
+ const omitted = entry.omitted ? " (omitted)" : "";
412
+ lines.push(`[${mime}${size}${omitted}]`);
413
+ }
414
+ return lines.join("\n").trim();
415
+ }
416
+ var ToolExecutionComponent = class extends Container {
417
+ constructor(toolName, args) {
418
+ super();
419
+ this.expanded = false;
420
+ this.isError = false;
421
+ this.isPartial = true;
422
+ this.startTime = Date.now();
423
+ this.toolName = toolName;
424
+ this.args = args;
425
+ this.box = new Box(1, 1, (line) => theme.toolPendingBg(line));
426
+ this.header = new Text("", 0, 0);
427
+ this.argsLine = new Text("", 0, 0);
428
+ this.output = new Markdown("", 0, 0, markdownTheme, { color: (line) => theme.toolOutput(line) });
429
+ this.addChild(new Spacer(1));
430
+ this.addChild(this.box);
431
+ this.box.addChild(this.header);
432
+ this.box.addChild(this.argsLine);
433
+ this.box.addChild(this.output);
434
+ this.refresh();
435
+ }
436
+ setArgs(args) {
437
+ this.args = args;
438
+ this.refresh();
439
+ }
440
+ setExpanded(expanded) {
441
+ this.expanded = expanded;
442
+ this.refresh();
443
+ }
444
+ setResult(result, opts) {
445
+ this.result = result;
446
+ this.isPartial = false;
447
+ this.isError = Boolean(opts?.isError);
448
+ this.refresh();
449
+ }
450
+ setPartialResult(result) {
451
+ this.result = result;
452
+ this.isPartial = true;
453
+ this.refresh();
454
+ }
455
+ refresh() {
456
+ const bg = this.isPartial ? theme.toolPendingBg : this.isError ? theme.toolErrorBg : theme.toolSuccessBg;
457
+ this.box.setBgFn((line) => bg(line));
458
+ const display = resolveToolDisplay({
459
+ name: this.toolName,
460
+ args: this.args
461
+ });
462
+ const statusIcon = this.isPartial ? theme.accent("⟳") : this.isError ? chalk.hex("#F97066")("✗") : chalk.hex("#7DD3A5")("✓");
463
+ const durationLabel = this.startTime && !this.isPartial ? ` ${theme.dim(`(${((Date.now() - this.startTime) / 1e3).toFixed(1)}s)`)}` : "";
464
+ const argLine = formatArgs(this.toolName, this.args);
465
+ const argPreview = argLine ? ` ${theme.dim("·")} ${theme.dim(argLine)}` : "";
466
+ const title = `${statusIcon} ${theme.bold(display.label)}${durationLabel}${argPreview}`;
467
+ this.header.setText(title);
468
+ this.argsLine.setText("");
469
+ const text = extractText(this.result) || (this.isPartial ? "…" : "");
470
+ if (!this.expanded && text) {
471
+ const lines = text.split("\n");
472
+ const preview = lines.length > PREVIEW_LINES ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…` : text;
473
+ this.output.setText(preview);
474
+ } else this.output.setText(text);
475
+ }
476
+ };
477
+
478
+ //#endregion
479
+ //#region src/tui/components/user-message.ts
480
+ var UserMessageComponent = class extends Container {
481
+ constructor(text) {
482
+ super();
483
+ const prefix = `${theme.accent("wish")} ${chalk.hex("#DB2777")("›")}`;
484
+ this.body = new Markdown(text, 1, 1, markdownTheme, {
485
+ bgColor: (line) => theme.userBg(line),
486
+ color: (line) => theme.userText(line)
487
+ });
488
+ this.addChild(new Spacer(1));
489
+ this.addChild(new Text(prefix, 1, 0));
490
+ this.addChild(this.body);
491
+ }
492
+ setText(text) {
493
+ this.body.setText(text);
494
+ }
495
+ };
496
+
497
+ //#endregion
498
+ //#region src/tui/components/chat-log.ts
499
+ var ChatLog = class extends Container {
500
+ constructor(..._args) {
501
+ super(..._args);
502
+ this.toolById = /* @__PURE__ */ new Map();
503
+ this.streamingRuns = /* @__PURE__ */ new Map();
504
+ this.toolsExpanded = false;
505
+ }
506
+ clearAll() {
507
+ this.clear();
508
+ this.toolById.clear();
509
+ this.streamingRuns.clear();
510
+ }
511
+ addSystem(text) {
512
+ this.addChild(new Spacer(1));
513
+ this.addChild(new Text(theme.system(text), 1, 0));
514
+ }
515
+ addUser(text) {
516
+ this.addChild(new UserMessageComponent(text));
517
+ }
518
+ resolveRunId(runId) {
519
+ return runId ?? "default";
520
+ }
521
+ startAssistant(text, runId) {
522
+ const component = new AssistantMessageComponent(text);
523
+ this.streamingRuns.set(this.resolveRunId(runId), component);
524
+ this.addChild(component);
525
+ return component;
526
+ }
527
+ updateAssistant(text, runId) {
528
+ const effectiveRunId = this.resolveRunId(runId);
529
+ const existing = this.streamingRuns.get(effectiveRunId);
530
+ if (!existing) {
531
+ this.startAssistant(text, runId);
532
+ return;
533
+ }
534
+ existing.setText(text);
535
+ }
536
+ finalizeAssistant(text, runId) {
537
+ const effectiveRunId = this.resolveRunId(runId);
538
+ const existing = this.streamingRuns.get(effectiveRunId);
539
+ if (existing) {
540
+ existing.setText(text);
541
+ this.streamingRuns.delete(effectiveRunId);
542
+ return;
543
+ }
544
+ this.addChild(new AssistantMessageComponent(text));
545
+ }
546
+ startTool(toolCallId, toolName, args) {
547
+ const existing = this.toolById.get(toolCallId);
548
+ if (existing) {
549
+ existing.setArgs(args);
550
+ return existing;
551
+ }
552
+ const component = new ToolExecutionComponent(toolName, args);
553
+ component.setExpanded(this.toolsExpanded);
554
+ this.toolById.set(toolCallId, component);
555
+ this.addChild(component);
556
+ return component;
557
+ }
558
+ updateToolArgs(toolCallId, args) {
559
+ const existing = this.toolById.get(toolCallId);
560
+ if (!existing) return;
561
+ existing.setArgs(args);
562
+ }
563
+ updateToolResult(toolCallId, result, opts) {
564
+ const existing = this.toolById.get(toolCallId);
565
+ if (!existing) return;
566
+ if (opts?.partial) {
567
+ existing.setPartialResult(result);
568
+ return;
569
+ }
570
+ existing.setResult(result, { isError: opts?.isError });
571
+ }
572
+ setToolsExpanded(expanded) {
573
+ this.toolsExpanded = expanded;
574
+ for (const tool of this.toolById.values()) tool.setExpanded(expanded);
575
+ }
576
+ };
577
+
578
+ //#endregion
579
+ //#region src/tui/components/custom-editor.ts
580
+ var CustomEditor = class extends Editor {
581
+ handleInput(data) {
582
+ if (matchesKey(data, Key.alt("enter")) && this.onAltEnter) {
583
+ this.onAltEnter();
584
+ return;
585
+ }
586
+ if (matchesKey(data, Key.ctrl("l")) && this.onCtrlL) {
587
+ this.onCtrlL();
588
+ return;
589
+ }
590
+ if (matchesKey(data, Key.ctrl("o")) && this.onCtrlO) {
591
+ this.onCtrlO();
592
+ return;
593
+ }
594
+ if (matchesKey(data, Key.ctrl("p")) && this.onCtrlP) {
595
+ this.onCtrlP();
596
+ return;
597
+ }
598
+ if (matchesKey(data, Key.ctrl("g")) && this.onCtrlG) {
599
+ this.onCtrlG();
600
+ return;
601
+ }
602
+ if (matchesKey(data, Key.ctrl("t")) && this.onCtrlT) {
603
+ this.onCtrlT();
604
+ return;
605
+ }
606
+ if (matchesKey(data, Key.shift("tab")) && this.onShiftTab) {
607
+ this.onShiftTab();
608
+ return;
609
+ }
610
+ if (matchesKey(data, Key.escape) && this.onEscape && !this.isShowingAutocomplete()) {
611
+ this.onEscape();
612
+ return;
613
+ }
614
+ if (matchesKey(data, Key.ctrl("c")) && this.onCtrlC) {
615
+ this.onCtrlC();
616
+ return;
617
+ }
618
+ if (matchesKey(data, Key.ctrl("d"))) {
619
+ if (this.getText().length === 0 && this.onCtrlD) this.onCtrlD();
620
+ return;
621
+ }
622
+ super.handleInput(data);
623
+ }
624
+ };
625
+
626
+ //#endregion
627
+ //#region src/tui/gateway-chat.ts
628
+ var GatewayChatClient = class {
629
+ constructor(opts) {
630
+ const resolved = resolveGatewayConnection(opts);
631
+ this.connection = resolved;
632
+ this.readyPromise = new Promise((resolve) => {
633
+ this.resolveReady = resolve;
634
+ });
635
+ this.client = new GatewayClient({
636
+ url: resolved.url,
637
+ token: resolved.token,
638
+ password: resolved.password,
639
+ clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
640
+ clientDisplayName: "Synurex-tui",
641
+ clientVersion: VERSION,
642
+ platform: process.platform,
643
+ mode: GATEWAY_CLIENT_MODES.UI,
644
+ caps: [GATEWAY_CLIENT_CAPS.TOOL_EVENTS],
645
+ instanceId: randomUUID(),
646
+ minProtocol: PROTOCOL_VERSION,
647
+ maxProtocol: PROTOCOL_VERSION,
648
+ onHelloOk: (hello) => {
649
+ this.hello = hello;
650
+ this.resolveReady?.();
651
+ this.onConnected?.();
652
+ },
653
+ onEvent: (evt) => {
654
+ this.onEvent?.({
655
+ event: evt.event,
656
+ payload: evt.payload,
657
+ seq: evt.seq
658
+ });
659
+ },
660
+ onClose: (_code, reason) => {
661
+ this.onDisconnected?.(reason);
662
+ },
663
+ onGap: (info) => {
664
+ this.onGap?.(info);
665
+ }
666
+ });
667
+ }
668
+ start() {
669
+ this.client.start();
670
+ }
671
+ stop() {
672
+ this.client.stop();
673
+ }
674
+ async waitForReady() {
675
+ await this.readyPromise;
676
+ }
677
+ async sendChat(opts) {
678
+ const runId = opts.runId ?? randomUUID();
679
+ await this.client.request("chat.send", {
680
+ sessionKey: opts.sessionKey,
681
+ message: opts.message,
682
+ thinking: opts.thinking,
683
+ deliver: opts.deliver,
684
+ timeoutMs: opts.timeoutMs,
685
+ idempotencyKey: runId
686
+ });
687
+ return { runId };
688
+ }
689
+ async abortChat(opts) {
690
+ return await this.client.request("chat.abort", {
691
+ sessionKey: opts.sessionKey,
692
+ runId: opts.runId
693
+ });
694
+ }
695
+ async loadHistory(opts) {
696
+ return await this.client.request("chat.history", {
697
+ sessionKey: opts.sessionKey,
698
+ limit: opts.limit
699
+ });
700
+ }
701
+ async listSessions(opts) {
702
+ return await this.client.request("sessions.list", {
703
+ limit: opts?.limit,
704
+ activeMinutes: opts?.activeMinutes,
705
+ includeGlobal: opts?.includeGlobal,
706
+ includeUnknown: opts?.includeUnknown,
707
+ includeDerivedTitles: opts?.includeDerivedTitles,
708
+ includeLastMessage: opts?.includeLastMessage,
709
+ agentId: opts?.agentId
710
+ });
711
+ }
712
+ async listAgents() {
713
+ return await this.client.request("agents.list", {});
714
+ }
715
+ async patchSession(opts) {
716
+ return await this.client.request("sessions.patch", opts);
717
+ }
718
+ async resetSession(key) {
719
+ return await this.client.request("sessions.reset", { key });
720
+ }
721
+ async getStatus() {
722
+ return await this.client.request("status");
723
+ }
724
+ async listModels() {
725
+ const res = await this.client.request("models.list");
726
+ return Array.isArray(res?.models) ? res.models : [];
727
+ }
728
+ };
729
+ function resolveGatewayConnection(opts) {
730
+ const config = loadConfig();
731
+ const isRemoteMode = config.gateway?.mode === "remote";
732
+ const remote = isRemoteMode ? config.gateway?.remote : void 0;
733
+ const authToken = config.gateway?.auth?.token;
734
+ const localPort = resolveGatewayPort(config);
735
+ const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
736
+ const explicitAuth = resolveExplicitGatewayAuth({
737
+ token: opts.token,
738
+ password: opts.password
739
+ });
740
+ ensureExplicitGatewayAuth({
741
+ urlOverride,
742
+ auth: explicitAuth,
743
+ errorHint: "Fix: pass --token or --password when using --url."
744
+ });
745
+ return {
746
+ url: urlOverride || (typeof remote?.url === "string" && remote.url.trim().length > 0 ? remote.url.trim() : void 0) || `ws://127.0.0.1:${localPort}`,
747
+ token: explicitAuth.token || (!urlOverride ? isRemoteMode ? typeof remote?.token === "string" && remote.token.trim().length > 0 ? remote.token.trim() : void 0 : process.env.SYNUREX_GATEWAY_TOKEN?.trim() || (typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : void 0) : void 0),
748
+ password: explicitAuth.password || (!urlOverride ? process.env.SYNUREX_GATEWAY_PASSWORD?.trim() || (typeof remote?.password === "string" && remote.password.trim().length > 0 ? remote.password.trim() : void 0) : void 0)
749
+ };
750
+ }
751
+
752
+ //#endregion
753
+ //#region src/utils/time-format.ts
754
+ function formatRelativeTime(timestamp) {
755
+ const diff = Date.now() - timestamp;
756
+ const seconds = Math.floor(diff / 1e3);
757
+ const minutes = Math.floor(seconds / 60);
758
+ const hours = Math.floor(minutes / 60);
759
+ const days = Math.floor(hours / 24);
760
+ if (seconds < 60) return "just now";
761
+ if (minutes < 60) return `${minutes}m ago`;
762
+ if (hours < 24) return `${hours}h ago`;
763
+ if (days === 1) return "Yesterday";
764
+ if (days < 7) return `${days}d ago`;
765
+ return new Date(timestamp).toLocaleDateString(void 0, {
766
+ month: "short",
767
+ day: "numeric"
768
+ });
769
+ }
770
+
771
+ //#endregion
772
+ //#region src/tui/components/fuzzy-filter.ts
773
+ /**
774
+ * Shared fuzzy filtering utilities for select list components.
775
+ */
776
+ /**
777
+ * Word boundary characters for matching.
778
+ */
779
+ const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
780
+ /**
781
+ * Check if position is at a word boundary.
782
+ */
783
+ function isWordBoundary(text, index) {
784
+ return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
785
+ }
786
+ /**
787
+ * Find index where query matches at a word boundary in text.
788
+ * Returns null if no match.
789
+ */
790
+ function findWordBoundaryIndex(text, query) {
791
+ if (!query) return null;
792
+ const textLower = text.toLowerCase();
793
+ const queryLower = query.toLowerCase();
794
+ const maxIndex = textLower.length - queryLower.length;
795
+ if (maxIndex < 0) return null;
796
+ for (let i = 0; i <= maxIndex; i++) if (textLower.startsWith(queryLower, i) && isWordBoundary(textLower, i)) return i;
797
+ return null;
798
+ }
799
+ /**
800
+ * Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
801
+ * Returns score (lower = better) or null if no match.
802
+ */
803
+ function fuzzyMatchLower(queryLower, textLower) {
804
+ if (queryLower.length === 0) return 0;
805
+ if (queryLower.length > textLower.length) return null;
806
+ let queryIndex = 0;
807
+ let score = 0;
808
+ let lastMatchIndex = -1;
809
+ let consecutiveMatches = 0;
810
+ for (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) if (textLower[i] === queryLower[queryIndex]) {
811
+ const isAtWordBoundary = isWordBoundary(textLower, i);
812
+ if (lastMatchIndex === i - 1) {
813
+ consecutiveMatches++;
814
+ score -= consecutiveMatches * 5;
815
+ } else {
816
+ consecutiveMatches = 0;
817
+ if (lastMatchIndex >= 0) score += (i - lastMatchIndex - 1) * 2;
818
+ }
819
+ if (isAtWordBoundary) score -= 10;
820
+ score += i * .1;
821
+ lastMatchIndex = i;
822
+ queryIndex++;
823
+ }
824
+ return queryIndex < queryLower.length ? null : score;
825
+ }
826
+ /**
827
+ * Filter items using pre-lowercased searchTextLower field.
828
+ * Supports space-separated tokens (all must match).
829
+ */
830
+ function fuzzyFilterLower(items, queryLower) {
831
+ const trimmed = queryLower.trim();
832
+ if (!trimmed) return items;
833
+ const tokens = trimmed.split(/\s+/).filter((t) => t.length > 0);
834
+ if (tokens.length === 0) return items;
835
+ const results = [];
836
+ for (const item of items) {
837
+ const text = item.searchTextLower ?? "";
838
+ let totalScore = 0;
839
+ let allMatch = true;
840
+ for (const token of tokens) {
841
+ const score = fuzzyMatchLower(token, text);
842
+ if (score !== null) totalScore += score;
843
+ else {
844
+ allMatch = false;
845
+ break;
846
+ }
847
+ }
848
+ if (allMatch) results.push({
849
+ item,
850
+ score: totalScore
851
+ });
852
+ }
853
+ results.sort((a, b) => a.score - b.score);
854
+ return results.map((r) => r.item);
855
+ }
856
+ /**
857
+ * Prepare items for fuzzy filtering by pre-computing lowercase search text.
858
+ */
859
+ function prepareSearchItems(items) {
860
+ return items.map((item) => {
861
+ const parts = [];
862
+ if (item.label) parts.push(item.label);
863
+ if (item.description) parts.push(item.description);
864
+ if (item.searchText) parts.push(item.searchText);
865
+ return {
866
+ ...item,
867
+ searchTextLower: parts.join(" ").toLowerCase()
868
+ };
869
+ });
870
+ }
871
+
872
+ //#endregion
873
+ //#region src/tui/components/filterable-select-list.ts
874
+ /**
875
+ * Combines text input filtering with a select list.
876
+ * User types to filter, arrows/j/k to navigate, Enter to select, Escape to clear/cancel.
877
+ */
878
+ var FilterableSelectList = class {
879
+ constructor(items, maxVisible, theme) {
880
+ this.filterText = "";
881
+ this.allItems = prepareSearchItems(items);
882
+ this.maxVisible = maxVisible;
883
+ this.theme = theme;
884
+ this.input = new Input();
885
+ this.selectList = new SelectList(this.allItems, maxVisible, theme);
886
+ }
887
+ applyFilter() {
888
+ const queryLower = this.filterText.toLowerCase();
889
+ if (!queryLower.trim()) {
890
+ this.selectList = new SelectList(this.allItems, this.maxVisible, this.theme);
891
+ return;
892
+ }
893
+ this.selectList = new SelectList(fuzzyFilterLower(this.allItems, queryLower), this.maxVisible, this.theme);
894
+ }
895
+ invalidate() {
896
+ this.input.invalidate();
897
+ this.selectList.invalidate();
898
+ }
899
+ render(width) {
900
+ const lines = [];
901
+ const filterLabel = this.theme.filterLabel("Filter: ");
902
+ const inputText = this.input.render(width - 8)[0] ?? "";
903
+ lines.push(filterLabel + inputText);
904
+ lines.push(chalk.dim("─".repeat(Math.max(0, width))));
905
+ const listLines = this.selectList.render(width);
906
+ lines.push(...listLines);
907
+ return lines;
908
+ }
909
+ handleInput(keyData) {
910
+ const allowVimNav = !this.filterText.trim();
911
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
912
+ this.selectList.handleInput("\x1B[A");
913
+ return;
914
+ }
915
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
916
+ this.selectList.handleInput("\x1B[B");
917
+ return;
918
+ }
919
+ if (matchesKey(keyData, "enter")) {
920
+ const selected = this.selectList.getSelectedItem();
921
+ if (selected) this.onSelect?.(selected);
922
+ return;
923
+ }
924
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
925
+ if (this.filterText) {
926
+ this.filterText = "";
927
+ this.input.setValue("");
928
+ this.applyFilter();
929
+ } else this.onCancel?.();
930
+ return;
931
+ }
932
+ const prevValue = this.input.getValue();
933
+ this.input.handleInput(keyData);
934
+ const newValue = this.input.getValue();
935
+ if (newValue !== prevValue) {
936
+ this.filterText = newValue;
937
+ this.applyFilter();
938
+ }
939
+ }
940
+ getSelectedItem() {
941
+ return this.selectList.getSelectedItem();
942
+ }
943
+ getFilterText() {
944
+ return this.filterText;
945
+ }
946
+ };
947
+
948
+ //#endregion
949
+ //#region src/tui/components/searchable-select-list.ts
950
+ /**
951
+ * A select list with a search input at the top for fuzzy filtering.
952
+ */
953
+ var SearchableSelectList = class {
954
+ constructor(items, maxVisible, theme) {
955
+ this.selectedIndex = 0;
956
+ this.regexCache = /* @__PURE__ */ new Map();
957
+ this.compareByScore = (a, b) => {
958
+ if (a.tier !== b.tier) return a.tier - b.tier;
959
+ if (a.score !== b.score) return a.score - b.score;
960
+ return this.getItemLabel(a.item).localeCompare(this.getItemLabel(b.item));
961
+ };
962
+ this.items = items;
963
+ this.filteredItems = items;
964
+ this.maxVisible = maxVisible;
965
+ this.theme = theme;
966
+ this.searchInput = new Input();
967
+ }
968
+ getCachedRegex(pattern) {
969
+ let regex = this.regexCache.get(pattern);
970
+ if (!regex) {
971
+ regex = new RegExp(this.escapeRegex(pattern), "gi");
972
+ this.regexCache.set(pattern, regex);
973
+ }
974
+ return regex;
975
+ }
976
+ updateFilter() {
977
+ const query = this.searchInput.getValue().trim();
978
+ if (!query) this.filteredItems = this.items;
979
+ else this.filteredItems = this.smartFilter(query);
980
+ this.selectedIndex = 0;
981
+ this.notifySelectionChange();
982
+ }
983
+ /**
984
+ * Smart filtering that prioritizes:
985
+ * 1. Exact substring match in label (highest priority)
986
+ * 2. Word-boundary prefix match in label
987
+ * 3. Exact substring in description
988
+ * 4. Fuzzy match (lowest priority)
989
+ */
990
+ smartFilter(query) {
991
+ const q = query.toLowerCase();
992
+ const scoredItems = [];
993
+ const fuzzyCandidates = [];
994
+ for (const item of this.items) {
995
+ const label = item.label.toLowerCase();
996
+ const desc = (item.description ?? "").toLowerCase();
997
+ const labelIndex = label.indexOf(q);
998
+ if (labelIndex !== -1) {
999
+ scoredItems.push({
1000
+ item,
1001
+ tier: 0,
1002
+ score: labelIndex
1003
+ });
1004
+ continue;
1005
+ }
1006
+ const wordBoundaryIndex = findWordBoundaryIndex(label, q);
1007
+ if (wordBoundaryIndex !== null) {
1008
+ scoredItems.push({
1009
+ item,
1010
+ tier: 1,
1011
+ score: wordBoundaryIndex
1012
+ });
1013
+ continue;
1014
+ }
1015
+ const descIndex = desc.indexOf(q);
1016
+ if (descIndex !== -1) {
1017
+ scoredItems.push({
1018
+ item,
1019
+ tier: 2,
1020
+ score: descIndex
1021
+ });
1022
+ continue;
1023
+ }
1024
+ fuzzyCandidates.push(item);
1025
+ }
1026
+ scoredItems.sort(this.compareByScore);
1027
+ const fuzzyMatches = fuzzyFilterLower(prepareSearchItems(fuzzyCandidates), q);
1028
+ return [...scoredItems.map((s) => s.item), ...fuzzyMatches];
1029
+ }
1030
+ escapeRegex(str) {
1031
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1032
+ }
1033
+ getItemLabel(item) {
1034
+ return item.label || item.value;
1035
+ }
1036
+ highlightMatch(text, query) {
1037
+ const tokens = query.trim().split(/\s+/).map((token) => token.toLowerCase()).filter((token) => token.length > 0);
1038
+ if (tokens.length === 0) return text;
1039
+ const uniqueTokens = Array.from(new Set(tokens)).toSorted((a, b) => b.length - a.length);
1040
+ let result = text;
1041
+ for (const token of uniqueTokens) {
1042
+ const regex = this.getCachedRegex(token);
1043
+ result = result.replace(regex, (match) => this.theme.matchHighlight(match));
1044
+ }
1045
+ return result;
1046
+ }
1047
+ setSelectedIndex(index) {
1048
+ this.selectedIndex = Math.max(0, Math.min(index, this.filteredItems.length - 1));
1049
+ }
1050
+ invalidate() {
1051
+ this.searchInput.invalidate();
1052
+ }
1053
+ render(width) {
1054
+ const lines = [];
1055
+ const prompt = this.theme.searchPrompt("search: ");
1056
+ const inputWidth = Math.max(1, width - visibleWidth(prompt));
1057
+ const inputText = this.searchInput.render(inputWidth)[0] ?? "";
1058
+ lines.push(`${prompt}${this.theme.searchInput(inputText)}`);
1059
+ lines.push("");
1060
+ const query = this.searchInput.getValue().trim();
1061
+ if (this.filteredItems.length === 0) {
1062
+ lines.push(this.theme.noMatch(" No matches"));
1063
+ return lines;
1064
+ }
1065
+ const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
1066
+ const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
1067
+ for (let i = startIndex; i < endIndex; i++) {
1068
+ const item = this.filteredItems[i];
1069
+ if (!item) continue;
1070
+ const isSelected = i === this.selectedIndex;
1071
+ lines.push(this.renderItemLine(item, isSelected, width, query));
1072
+ }
1073
+ if (this.filteredItems.length > this.maxVisible) {
1074
+ const scrollInfo = `${this.selectedIndex + 1}/${this.filteredItems.length}`;
1075
+ lines.push(this.theme.scrollInfo(` ${scrollInfo}`));
1076
+ }
1077
+ return lines;
1078
+ }
1079
+ renderItemLine(item, isSelected, width, query) {
1080
+ const prefix = isSelected ? "→ " : " ";
1081
+ const prefixWidth = prefix.length;
1082
+ const displayValue = this.getItemLabel(item);
1083
+ if (item.description && width > 40) {
1084
+ const truncatedValue = truncateToWidth(displayValue, Math.min(30, width - prefixWidth - 4), "");
1085
+ const valueText = this.highlightMatch(truncatedValue, query);
1086
+ const spacingWidth = Math.max(1, 32 - visibleWidth(valueText));
1087
+ const spacing = " ".repeat(spacingWidth);
1088
+ const remainingWidth = width - (prefixWidth + visibleWidth(valueText) + spacing.length) - 2;
1089
+ if (remainingWidth > 10) {
1090
+ const truncatedDesc = truncateToWidth(item.description, remainingWidth, "");
1091
+ const highlightedDesc = this.highlightMatch(truncatedDesc, query);
1092
+ const line = `${prefix}${valueText}${spacing}${isSelected ? highlightedDesc : this.theme.description(highlightedDesc)}`;
1093
+ return isSelected ? this.theme.selectedText(line) : line;
1094
+ }
1095
+ }
1096
+ const truncatedValue = truncateToWidth(displayValue, width - prefixWidth - 2, "");
1097
+ const line = `${prefix}${this.highlightMatch(truncatedValue, query)}`;
1098
+ return isSelected ? this.theme.selectedText(line) : line;
1099
+ }
1100
+ handleInput(keyData) {
1101
+ if (isKeyRelease(keyData)) return;
1102
+ const allowVimNav = !this.searchInput.getValue().trim();
1103
+ if (matchesKey(keyData, "up") || matchesKey(keyData, "ctrl+p") || allowVimNav && keyData === "k") {
1104
+ this.selectedIndex = Math.max(0, this.selectedIndex - 1);
1105
+ this.notifySelectionChange();
1106
+ return;
1107
+ }
1108
+ if (matchesKey(keyData, "down") || matchesKey(keyData, "ctrl+n") || allowVimNav && keyData === "j") {
1109
+ this.selectedIndex = Math.min(this.filteredItems.length - 1, this.selectedIndex + 1);
1110
+ this.notifySelectionChange();
1111
+ return;
1112
+ }
1113
+ if (matchesKey(keyData, "enter")) {
1114
+ const item = this.filteredItems[this.selectedIndex];
1115
+ if (item && this.onSelect) this.onSelect(item);
1116
+ return;
1117
+ }
1118
+ if (getEditorKeybindings().matches(keyData, "selectCancel")) {
1119
+ if (this.onCancel) this.onCancel();
1120
+ return;
1121
+ }
1122
+ const prevValue = this.searchInput.getValue();
1123
+ this.searchInput.handleInput(keyData);
1124
+ if (prevValue !== this.searchInput.getValue()) this.updateFilter();
1125
+ }
1126
+ notifySelectionChange() {
1127
+ const item = this.filteredItems[this.selectedIndex];
1128
+ if (item && this.onSelectionChange) this.onSelectionChange(item);
1129
+ }
1130
+ getSelectedItem() {
1131
+ return this.filteredItems[this.selectedIndex] ?? null;
1132
+ }
1133
+ };
1134
+
1135
+ //#endregion
1136
+ //#region src/tui/components/selectors.ts
1137
+ function createSearchableSelectList(items, maxVisible = 7) {
1138
+ return new SearchableSelectList(items, maxVisible, searchableSelectListTheme);
1139
+ }
1140
+ function createFilterableSelectList(items, maxVisible = 7) {
1141
+ return new FilterableSelectList(items, maxVisible, filterableSelectListTheme);
1142
+ }
1143
+ function createSettingsList(items, onChange, onCancel, maxVisible = 7) {
1144
+ return new SettingsList(items, maxVisible, settingsListTheme, onChange, onCancel);
1145
+ }
1146
+
1147
+ //#endregion
1148
+ //#region src/tui/tui-status-summary.ts
1149
+ function formatStatusSummary(summary) {
1150
+ const lines = [];
1151
+ lines.push("Gateway status");
1152
+ if (!summary.linkChannel) lines.push("Link channel: unknown");
1153
+ else {
1154
+ const linkLabel = summary.linkChannel.label ?? "Link channel";
1155
+ const linked = summary.linkChannel.linked === true;
1156
+ const authAge = linked && typeof summary.linkChannel.authAgeMs === "number" ? ` (last refreshed ${formatAge(summary.linkChannel.authAgeMs)})` : "";
1157
+ lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
1158
+ }
1159
+ const providerSummary = Array.isArray(summary.providerSummary) ? summary.providerSummary : [];
1160
+ if (providerSummary.length > 0) {
1161
+ lines.push("");
1162
+ lines.push("System:");
1163
+ for (const line of providerSummary) lines.push(` ${line}`);
1164
+ }
1165
+ const heartbeatAgents = summary.heartbeat?.agents ?? [];
1166
+ if (heartbeatAgents.length > 0) {
1167
+ const heartbeatParts = heartbeatAgents.map((agent) => {
1168
+ const agentId = agent.agentId ?? "unknown";
1169
+ if (!agent.enabled || !agent.everyMs) return `disabled (${agentId})`;
1170
+ return `${agent.every ?? "unknown"} (${agentId})`;
1171
+ });
1172
+ lines.push("");
1173
+ lines.push(`Heartbeat: ${heartbeatParts.join(", ")}`);
1174
+ }
1175
+ const sessionPaths = summary.sessions?.paths ?? [];
1176
+ if (sessionPaths.length === 1) lines.push(`Session store: ${sessionPaths[0]}`);
1177
+ else if (sessionPaths.length > 1) lines.push(`Session stores: ${sessionPaths.length}`);
1178
+ const defaults = summary.sessions?.defaults;
1179
+ const defaultModel = defaults?.model ?? "unknown";
1180
+ const defaultCtx = typeof defaults?.contextTokens === "number" ? ` (${formatTokenCount(defaults.contextTokens)} ctx)` : "";
1181
+ lines.push(`Default model: ${defaultModel}${defaultCtx}`);
1182
+ const sessionCount = summary.sessions?.count ?? 0;
1183
+ lines.push(`Active sessions: ${sessionCount}`);
1184
+ const recent = Array.isArray(summary.sessions?.recent) ? summary.sessions?.recent : [];
1185
+ if (recent.length > 0) {
1186
+ lines.push("Recent sessions:");
1187
+ for (const entry of recent) {
1188
+ const ageLabel = typeof entry.age === "number" ? formatAge(entry.age) : "no activity";
1189
+ const model = entry.model ?? "unknown";
1190
+ const usage = formatContextUsageLine({
1191
+ total: entry.totalTokens ?? null,
1192
+ context: entry.contextTokens ?? null,
1193
+ remaining: entry.remainingTokens ?? null,
1194
+ percent: entry.percentUsed ?? null
1195
+ });
1196
+ const flags = entry.flags?.length ? ` | flags: ${entry.flags.join(", ")}` : "";
1197
+ lines.push(`- ${entry.key}${entry.kind ? ` [${entry.kind}]` : ""} | ${ageLabel} | model ${model} | ${usage}${flags}`);
1198
+ }
1199
+ }
1200
+ const queued = Array.isArray(summary.queuedSystemEvents) ? summary.queuedSystemEvents : [];
1201
+ if (queued.length > 0) {
1202
+ const preview = queued.slice(0, 3).join(" | ");
1203
+ lines.push(`Queued system events (${queued.length}): ${preview}`);
1204
+ }
1205
+ return lines;
1206
+ }
1207
+
1208
+ //#endregion
1209
+ //#region src/tui/tui-command-handlers.ts
1210
+ function createCommandHandlers(context) {
1211
+ const { client, chatLog, tui, opts, state, deliverDefault, openOverlay, closeOverlay, refreshSessionInfo, loadHistory, setSession, refreshAgents, abortActive, setActivityStatus, formatSessionKey, applySessionInfoFromPatch, noteLocalRunId, forgetLocalRunId } = context;
1212
+ const setAgent = async (id) => {
1213
+ state.currentAgentId = normalizeAgentId(id);
1214
+ await setSession("");
1215
+ };
1216
+ const openModelSelector = async () => {
1217
+ try {
1218
+ const models = await client.listModels();
1219
+ if (models.length === 0) {
1220
+ chatLog.addSystem("no models available");
1221
+ tui.requestRender();
1222
+ return;
1223
+ }
1224
+ const selector = createSearchableSelectList(models.map((model) => ({
1225
+ value: `${model.provider}/${model.id}`,
1226
+ label: `${model.provider}/${model.id}`,
1227
+ description: model.name && model.name !== model.id ? model.name : ""
1228
+ })), 9);
1229
+ selector.onSelect = (item) => {
1230
+ (async () => {
1231
+ try {
1232
+ const result = await client.patchSession({
1233
+ key: state.currentSessionKey,
1234
+ model: item.value
1235
+ });
1236
+ chatLog.addSystem(`model set to ${item.value}`);
1237
+ applySessionInfoFromPatch(result);
1238
+ await refreshSessionInfo();
1239
+ } catch (err) {
1240
+ chatLog.addSystem(`model set failed: ${String(err)}`);
1241
+ }
1242
+ closeOverlay();
1243
+ tui.requestRender();
1244
+ })();
1245
+ };
1246
+ selector.onCancel = () => {
1247
+ closeOverlay();
1248
+ tui.requestRender();
1249
+ };
1250
+ openOverlay(selector);
1251
+ tui.requestRender();
1252
+ } catch (err) {
1253
+ chatLog.addSystem(`model list failed: ${String(err)}`);
1254
+ tui.requestRender();
1255
+ }
1256
+ };
1257
+ const openAgentSelector = async () => {
1258
+ await refreshAgents();
1259
+ if (state.agents.length === 0) {
1260
+ chatLog.addSystem("no agents found");
1261
+ tui.requestRender();
1262
+ return;
1263
+ }
1264
+ const selector = createSearchableSelectList(state.agents.map((agent) => ({
1265
+ value: agent.id,
1266
+ label: agent.name ? `${agent.id} (${agent.name})` : agent.id,
1267
+ description: agent.id === state.agentDefaultId ? "default" : ""
1268
+ })), 9);
1269
+ selector.onSelect = (item) => {
1270
+ (async () => {
1271
+ closeOverlay();
1272
+ await setAgent(item.value);
1273
+ tui.requestRender();
1274
+ })();
1275
+ };
1276
+ selector.onCancel = () => {
1277
+ closeOverlay();
1278
+ tui.requestRender();
1279
+ };
1280
+ openOverlay(selector);
1281
+ tui.requestRender();
1282
+ };
1283
+ const openSessionSelector = async () => {
1284
+ try {
1285
+ const selector = createFilterableSelectList((await client.listSessions({
1286
+ includeGlobal: false,
1287
+ includeUnknown: false,
1288
+ includeDerivedTitles: true,
1289
+ includeLastMessage: true,
1290
+ agentId: state.currentAgentId
1291
+ })).sessions.map((session) => {
1292
+ const title = session.derivedTitle ?? session.displayName;
1293
+ const formattedKey = formatSessionKey(session.key);
1294
+ const label = title && title !== formattedKey ? `${title} (${formattedKey})` : formattedKey;
1295
+ const timePart = session.updatedAt ? formatRelativeTime(session.updatedAt) : "";
1296
+ const preview = session.lastMessagePreview?.replace(/\s+/g, " ").trim();
1297
+ const description = timePart && preview ? `${timePart} · ${preview}` : preview ?? timePart;
1298
+ return {
1299
+ value: session.key,
1300
+ label,
1301
+ description,
1302
+ searchText: [
1303
+ session.displayName,
1304
+ session.label,
1305
+ session.subject,
1306
+ session.sessionId,
1307
+ session.key,
1308
+ session.lastMessagePreview
1309
+ ].filter(Boolean).join(" ")
1310
+ };
1311
+ }), 9);
1312
+ selector.onSelect = (item) => {
1313
+ (async () => {
1314
+ closeOverlay();
1315
+ await setSession(item.value);
1316
+ tui.requestRender();
1317
+ })();
1318
+ };
1319
+ selector.onCancel = () => {
1320
+ closeOverlay();
1321
+ tui.requestRender();
1322
+ };
1323
+ openOverlay(selector);
1324
+ tui.requestRender();
1325
+ } catch (err) {
1326
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
1327
+ tui.requestRender();
1328
+ }
1329
+ };
1330
+ const openSettings = () => {
1331
+ openOverlay(createSettingsList([{
1332
+ id: "tools",
1333
+ label: "Tool output",
1334
+ currentValue: state.toolsExpanded ? "expanded" : "collapsed",
1335
+ values: ["collapsed", "expanded"]
1336
+ }, {
1337
+ id: "thinking",
1338
+ label: "Show thinking",
1339
+ currentValue: state.showThinking ? "on" : "off",
1340
+ values: ["off", "on"]
1341
+ }], (id, value) => {
1342
+ if (id === "tools") {
1343
+ state.toolsExpanded = value === "expanded";
1344
+ chatLog.setToolsExpanded(state.toolsExpanded);
1345
+ }
1346
+ if (id === "thinking") {
1347
+ state.showThinking = value === "on";
1348
+ loadHistory();
1349
+ }
1350
+ tui.requestRender();
1351
+ }, () => {
1352
+ closeOverlay();
1353
+ tui.requestRender();
1354
+ }));
1355
+ tui.requestRender();
1356
+ };
1357
+ const handleCommand = async (raw) => {
1358
+ const { name, args } = parseCommand(raw);
1359
+ if (!name) return;
1360
+ switch (name) {
1361
+ case "help":
1362
+ chatLog.addSystem(helpText({
1363
+ provider: state.sessionInfo.modelProvider,
1364
+ model: state.sessionInfo.model
1365
+ }));
1366
+ break;
1367
+ case "status":
1368
+ try {
1369
+ const status = await client.getStatus();
1370
+ if (typeof status === "string") {
1371
+ chatLog.addSystem(status);
1372
+ break;
1373
+ }
1374
+ if (status && typeof status === "object") {
1375
+ const lines = formatStatusSummary(status);
1376
+ for (const line of lines) chatLog.addSystem(line);
1377
+ break;
1378
+ }
1379
+ chatLog.addSystem("status: unknown response");
1380
+ } catch (err) {
1381
+ chatLog.addSystem(`status failed: ${String(err)}`);
1382
+ }
1383
+ break;
1384
+ case "agent":
1385
+ if (!args) await openAgentSelector();
1386
+ else await setAgent(args);
1387
+ break;
1388
+ case "agents":
1389
+ await openAgentSelector();
1390
+ break;
1391
+ case "session":
1392
+ if (!args) await openSessionSelector();
1393
+ else await setSession(args);
1394
+ break;
1395
+ case "sessions":
1396
+ await openSessionSelector();
1397
+ break;
1398
+ case "model":
1399
+ if (!args) await openModelSelector();
1400
+ else try {
1401
+ const result = await client.patchSession({
1402
+ key: state.currentSessionKey,
1403
+ model: args
1404
+ });
1405
+ chatLog.addSystem(`model set to ${args}`);
1406
+ applySessionInfoFromPatch(result);
1407
+ await refreshSessionInfo();
1408
+ } catch (err) {
1409
+ chatLog.addSystem(`model set failed: ${String(err)}`);
1410
+ }
1411
+ break;
1412
+ case "models":
1413
+ await openModelSelector();
1414
+ break;
1415
+ case "think":
1416
+ if (!args) {
1417
+ const levels = formatThinkingLevels(state.sessionInfo.modelProvider, state.sessionInfo.model, "|");
1418
+ chatLog.addSystem(`usage: /think <${levels}>`);
1419
+ break;
1420
+ }
1421
+ try {
1422
+ const result = await client.patchSession({
1423
+ key: state.currentSessionKey,
1424
+ thinkingLevel: args
1425
+ });
1426
+ chatLog.addSystem(`thinking set to ${args}`);
1427
+ applySessionInfoFromPatch(result);
1428
+ await refreshSessionInfo();
1429
+ } catch (err) {
1430
+ chatLog.addSystem(`think failed: ${String(err)}`);
1431
+ }
1432
+ break;
1433
+ case "verbose":
1434
+ if (!args) {
1435
+ chatLog.addSystem("usage: /verbose <on|off>");
1436
+ break;
1437
+ }
1438
+ try {
1439
+ const result = await client.patchSession({
1440
+ key: state.currentSessionKey,
1441
+ verboseLevel: args
1442
+ });
1443
+ chatLog.addSystem(`verbose set to ${args}`);
1444
+ applySessionInfoFromPatch(result);
1445
+ await loadHistory();
1446
+ } catch (err) {
1447
+ chatLog.addSystem(`verbose failed: ${String(err)}`);
1448
+ }
1449
+ break;
1450
+ case "reasoning":
1451
+ if (!args) {
1452
+ chatLog.addSystem("usage: /reasoning <on|off>");
1453
+ break;
1454
+ }
1455
+ try {
1456
+ const result = await client.patchSession({
1457
+ key: state.currentSessionKey,
1458
+ reasoningLevel: args
1459
+ });
1460
+ chatLog.addSystem(`reasoning set to ${args}`);
1461
+ applySessionInfoFromPatch(result);
1462
+ await refreshSessionInfo();
1463
+ } catch (err) {
1464
+ chatLog.addSystem(`reasoning failed: ${String(err)}`);
1465
+ }
1466
+ break;
1467
+ case "usage": {
1468
+ const normalized = args ? normalizeUsageDisplay(args) : void 0;
1469
+ if (args && !normalized) {
1470
+ chatLog.addSystem("usage: /usage <off|tokens|full>");
1471
+ break;
1472
+ }
1473
+ const currentRaw = state.sessionInfo.responseUsage;
1474
+ const current = resolveResponseUsageMode(currentRaw);
1475
+ const next = normalized ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
1476
+ try {
1477
+ const result = await client.patchSession({
1478
+ key: state.currentSessionKey,
1479
+ responseUsage: next === "off" ? null : next
1480
+ });
1481
+ chatLog.addSystem(`usage footer: ${next}`);
1482
+ applySessionInfoFromPatch(result);
1483
+ await refreshSessionInfo();
1484
+ } catch (err) {
1485
+ chatLog.addSystem(`usage failed: ${String(err)}`);
1486
+ }
1487
+ break;
1488
+ }
1489
+ case "elevated":
1490
+ if (!args) {
1491
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1492
+ break;
1493
+ }
1494
+ if (![
1495
+ "on",
1496
+ "off",
1497
+ "ask",
1498
+ "full"
1499
+ ].includes(args)) {
1500
+ chatLog.addSystem("usage: /elevated <on|off|ask|full>");
1501
+ break;
1502
+ }
1503
+ try {
1504
+ const result = await client.patchSession({
1505
+ key: state.currentSessionKey,
1506
+ elevatedLevel: args
1507
+ });
1508
+ chatLog.addSystem(`elevated set to ${args}`);
1509
+ applySessionInfoFromPatch(result);
1510
+ await refreshSessionInfo();
1511
+ } catch (err) {
1512
+ chatLog.addSystem(`elevated failed: ${String(err)}`);
1513
+ }
1514
+ break;
1515
+ case "activation":
1516
+ if (!args) {
1517
+ chatLog.addSystem("usage: /activation <mention|always>");
1518
+ break;
1519
+ }
1520
+ try {
1521
+ const result = await client.patchSession({
1522
+ key: state.currentSessionKey,
1523
+ groupActivation: args === "always" ? "always" : "mention"
1524
+ });
1525
+ chatLog.addSystem(`activation set to ${args}`);
1526
+ applySessionInfoFromPatch(result);
1527
+ await refreshSessionInfo();
1528
+ } catch (err) {
1529
+ chatLog.addSystem(`activation failed: ${String(err)}`);
1530
+ }
1531
+ break;
1532
+ case "new":
1533
+ case "reset":
1534
+ try {
1535
+ state.sessionInfo.inputTokens = null;
1536
+ state.sessionInfo.outputTokens = null;
1537
+ state.sessionInfo.totalTokens = null;
1538
+ tui.requestRender();
1539
+ await client.resetSession(state.currentSessionKey);
1540
+ chatLog.addSystem(`session ${state.currentSessionKey} reset`);
1541
+ await loadHistory();
1542
+ } catch (err) {
1543
+ chatLog.addSystem(`reset failed: ${String(err)}`);
1544
+ }
1545
+ break;
1546
+ case "abort":
1547
+ await abortActive();
1548
+ break;
1549
+ case "settings":
1550
+ openSettings();
1551
+ break;
1552
+ case "exit":
1553
+ case "quit":
1554
+ client.stop();
1555
+ tui.stop();
1556
+ process.exit(0);
1557
+ break;
1558
+ default:
1559
+ await sendMessage(raw);
1560
+ break;
1561
+ }
1562
+ tui.requestRender();
1563
+ };
1564
+ const sendMessage = async (text) => {
1565
+ try {
1566
+ chatLog.addUser(text);
1567
+ tui.requestRender();
1568
+ const runId = randomUUID();
1569
+ noteLocalRunId(runId);
1570
+ state.activeChatRunId = runId;
1571
+ setActivityStatus("sending");
1572
+ await client.sendChat({
1573
+ sessionKey: state.currentSessionKey,
1574
+ message: text,
1575
+ thinking: opts.thinking,
1576
+ deliver: deliverDefault,
1577
+ timeoutMs: opts.timeoutMs,
1578
+ runId
1579
+ });
1580
+ setActivityStatus("waiting");
1581
+ } catch (err) {
1582
+ if (state.activeChatRunId) forgetLocalRunId?.(state.activeChatRunId);
1583
+ state.activeChatRunId = null;
1584
+ chatLog.addSystem(`send failed: ${String(err)}`);
1585
+ setActivityStatus("error");
1586
+ }
1587
+ tui.requestRender();
1588
+ };
1589
+ return {
1590
+ handleCommand,
1591
+ sendMessage,
1592
+ openModelSelector,
1593
+ openAgentSelector,
1594
+ openSessionSelector,
1595
+ openSettings,
1596
+ setAgent
1597
+ };
1598
+ }
1599
+
1600
+ //#endregion
1601
+ //#region src/tui/tui-stream-assembler.ts
1602
+ var TuiStreamAssembler = class {
1603
+ constructor() {
1604
+ this.runs = /* @__PURE__ */ new Map();
1605
+ }
1606
+ getOrCreateRun(runId) {
1607
+ let state = this.runs.get(runId);
1608
+ if (!state) {
1609
+ state = {
1610
+ thinkingText: "",
1611
+ contentText: "",
1612
+ displayText: ""
1613
+ };
1614
+ this.runs.set(runId, state);
1615
+ }
1616
+ return state;
1617
+ }
1618
+ updateRunState(state, message, showThinking) {
1619
+ const thinkingText = extractThinkingFromMessage(message);
1620
+ const contentText = extractContentFromMessage(message);
1621
+ if (thinkingText) state.thinkingText = thinkingText;
1622
+ if (contentText) state.contentText = contentText;
1623
+ state.displayText = composeThinkingAndContent({
1624
+ thinkingText: state.thinkingText,
1625
+ contentText: state.contentText,
1626
+ showThinking
1627
+ });
1628
+ }
1629
+ ingestDelta(runId, message, showThinking) {
1630
+ const state = this.getOrCreateRun(runId);
1631
+ const previousDisplayText = state.displayText;
1632
+ this.updateRunState(state, message, showThinking);
1633
+ if (!state.displayText || state.displayText === previousDisplayText) return null;
1634
+ return state.displayText;
1635
+ }
1636
+ finalize(runId, message, showThinking) {
1637
+ const state = this.getOrCreateRun(runId);
1638
+ this.updateRunState(state, message, showThinking);
1639
+ const finalComposed = state.displayText;
1640
+ const finalText = resolveFinalAssistantText({
1641
+ finalText: finalComposed,
1642
+ streamedText: state.displayText
1643
+ });
1644
+ this.runs.delete(runId);
1645
+ return finalText;
1646
+ }
1647
+ drop(runId) {
1648
+ this.runs.delete(runId);
1649
+ }
1650
+ };
1651
+
1652
+ //#endregion
1653
+ //#region src/tui/tui-event-handlers.ts
1654
+ function createEventHandlers(context) {
1655
+ const { chatLog, tui, state, setActivityStatus, refreshSessionInfo, loadHistory, isLocalRunId, forgetLocalRunId, clearLocalRunIds } = context;
1656
+ const finalizedRuns = /* @__PURE__ */ new Map();
1657
+ const sessionRuns = /* @__PURE__ */ new Map();
1658
+ let streamAssembler = new TuiStreamAssembler();
1659
+ let lastSessionKey = state.currentSessionKey;
1660
+ const pruneRunMap = (runs) => {
1661
+ if (runs.size <= 200) return;
1662
+ const keepUntil = Date.now() - 600 * 1e3;
1663
+ for (const [key, ts] of runs) {
1664
+ if (runs.size <= 150) break;
1665
+ if (ts < keepUntil) runs.delete(key);
1666
+ }
1667
+ if (runs.size > 200) for (const key of runs.keys()) {
1668
+ runs.delete(key);
1669
+ if (runs.size <= 150) break;
1670
+ }
1671
+ };
1672
+ const syncSessionKey = () => {
1673
+ if (state.currentSessionKey === lastSessionKey) return;
1674
+ lastSessionKey = state.currentSessionKey;
1675
+ finalizedRuns.clear();
1676
+ sessionRuns.clear();
1677
+ streamAssembler = new TuiStreamAssembler();
1678
+ clearLocalRunIds?.();
1679
+ };
1680
+ const noteSessionRun = (runId) => {
1681
+ sessionRuns.set(runId, Date.now());
1682
+ pruneRunMap(sessionRuns);
1683
+ };
1684
+ const noteFinalizedRun = (runId) => {
1685
+ finalizedRuns.set(runId, Date.now());
1686
+ sessionRuns.delete(runId);
1687
+ streamAssembler.drop(runId);
1688
+ pruneRunMap(finalizedRuns);
1689
+ };
1690
+ const handleChatEvent = (payload) => {
1691
+ if (!payload || typeof payload !== "object") return;
1692
+ const evt = payload;
1693
+ syncSessionKey();
1694
+ if (evt.sessionKey !== state.currentSessionKey) return;
1695
+ if (finalizedRuns.has(evt.runId)) {
1696
+ if (evt.state === "delta") return;
1697
+ if (evt.state === "final") return;
1698
+ }
1699
+ noteSessionRun(evt.runId);
1700
+ if (!state.activeChatRunId) state.activeChatRunId = evt.runId;
1701
+ if (evt.state === "delta") {
1702
+ const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking);
1703
+ if (!displayText) return;
1704
+ chatLog.updateAssistant(displayText, evt.runId);
1705
+ setActivityStatus("streaming");
1706
+ }
1707
+ if (evt.state === "final") {
1708
+ if (isCommandMessage(evt.message)) {
1709
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1710
+ else loadHistory?.();
1711
+ const text = extractTextFromMessage(evt.message);
1712
+ if (text) chatLog.addSystem(text);
1713
+ streamAssembler.drop(evt.runId);
1714
+ noteFinalizedRun(evt.runId);
1715
+ state.activeChatRunId = null;
1716
+ setActivityStatus("idle");
1717
+ refreshSessionInfo?.();
1718
+ tui.requestRender();
1719
+ return;
1720
+ }
1721
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1722
+ else loadHistory?.();
1723
+ const stopReason = evt.message && typeof evt.message === "object" && !Array.isArray(evt.message) ? typeof evt.message.stopReason === "string" ? evt.message.stopReason : "" : "";
1724
+ const finalText = streamAssembler.finalize(evt.runId, evt.message, state.showThinking);
1725
+ chatLog.finalizeAssistant(finalText, evt.runId);
1726
+ noteFinalizedRun(evt.runId);
1727
+ state.activeChatRunId = null;
1728
+ setActivityStatus(stopReason === "error" ? "error" : "idle");
1729
+ refreshSessionInfo?.();
1730
+ }
1731
+ if (evt.state === "aborted") {
1732
+ chatLog.addSystem("run aborted");
1733
+ streamAssembler.drop(evt.runId);
1734
+ sessionRuns.delete(evt.runId);
1735
+ state.activeChatRunId = null;
1736
+ setActivityStatus("aborted");
1737
+ refreshSessionInfo?.();
1738
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1739
+ else loadHistory?.();
1740
+ }
1741
+ if (evt.state === "error") {
1742
+ chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
1743
+ streamAssembler.drop(evt.runId);
1744
+ sessionRuns.delete(evt.runId);
1745
+ state.activeChatRunId = null;
1746
+ setActivityStatus("error");
1747
+ refreshSessionInfo?.();
1748
+ if (isLocalRunId?.(evt.runId)) forgetLocalRunId?.(evt.runId);
1749
+ else loadHistory?.();
1750
+ }
1751
+ tui.requestRender();
1752
+ };
1753
+ const handleAgentEvent = (payload) => {
1754
+ if (!payload || typeof payload !== "object") return;
1755
+ const evt = payload;
1756
+ syncSessionKey();
1757
+ const isActiveRun = evt.runId === state.activeChatRunId;
1758
+ if (!(isActiveRun || sessionRuns.has(evt.runId) || finalizedRuns.has(evt.runId))) return;
1759
+ if (evt.stream === "tool") {
1760
+ const verbose = state.sessionInfo.verboseLevel ?? "off";
1761
+ const allowToolEvents = verbose !== "off";
1762
+ const allowToolOutput = verbose === "full";
1763
+ if (!allowToolEvents) return;
1764
+ const data = evt.data ?? {};
1765
+ const phase = asString(data.phase, "");
1766
+ const toolCallId = asString(data.toolCallId, "");
1767
+ const toolName = asString(data.name, "tool");
1768
+ if (!toolCallId) return;
1769
+ if (phase === "start") chatLog.startTool(toolCallId, toolName, data.args);
1770
+ else if (phase === "update") {
1771
+ if (!allowToolOutput) return;
1772
+ chatLog.updateToolResult(toolCallId, data.partialResult, { partial: true });
1773
+ } else if (phase === "result") if (allowToolOutput) chatLog.updateToolResult(toolCallId, data.result, { isError: Boolean(data.isError) });
1774
+ else chatLog.updateToolResult(toolCallId, { content: [] }, { isError: Boolean(data.isError) });
1775
+ tui.requestRender();
1776
+ return;
1777
+ }
1778
+ if (evt.stream === "lifecycle") {
1779
+ if (!isActiveRun) return;
1780
+ const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
1781
+ if (phase === "start") setActivityStatus("running");
1782
+ if (phase === "end") setActivityStatus("idle");
1783
+ if (phase === "error") setActivityStatus("error");
1784
+ tui.requestRender();
1785
+ }
1786
+ };
1787
+ return {
1788
+ handleChatEvent,
1789
+ handleAgentEvent
1790
+ };
1791
+ }
1792
+
1793
+ //#endregion
1794
+ //#region src/tui/tui-local-shell.ts
1795
+ function createLocalShellRunner(deps) {
1796
+ let localExecAsked = false;
1797
+ let localExecAllowed = false;
1798
+ const createSelector = deps.createSelector ?? createSearchableSelectList;
1799
+ const spawnCommand = deps.spawnCommand ?? spawn;
1800
+ const getCwd = deps.getCwd ?? (() => process.cwd());
1801
+ const env = deps.env ?? process.env;
1802
+ const maxChars = deps.maxOutputChars ?? 4e4;
1803
+ const ensureLocalExecAllowed = async () => {
1804
+ if (localExecAllowed) return true;
1805
+ if (localExecAsked) return false;
1806
+ localExecAsked = true;
1807
+ return await new Promise((resolve) => {
1808
+ deps.chatLog.addSystem("Allow local shell commands for this session?");
1809
+ deps.chatLog.addSystem("This runs commands on YOUR machine (not the gateway) and may delete files or reveal secrets.");
1810
+ deps.chatLog.addSystem("Select Yes/No (arrows + Enter), Esc to cancel.");
1811
+ const selector = createSelector([{
1812
+ value: "no",
1813
+ label: "No"
1814
+ }, {
1815
+ value: "yes",
1816
+ label: "Yes"
1817
+ }], 2);
1818
+ selector.onSelect = (item) => {
1819
+ deps.closeOverlay();
1820
+ if (item.value === "yes") {
1821
+ localExecAllowed = true;
1822
+ deps.chatLog.addSystem("local shell: enabled for this session");
1823
+ resolve(true);
1824
+ } else {
1825
+ deps.chatLog.addSystem("local shell: not enabled");
1826
+ resolve(false);
1827
+ }
1828
+ deps.tui.requestRender();
1829
+ };
1830
+ selector.onCancel = () => {
1831
+ deps.closeOverlay();
1832
+ deps.chatLog.addSystem("local shell: cancelled");
1833
+ deps.tui.requestRender();
1834
+ resolve(false);
1835
+ };
1836
+ deps.openOverlay(selector);
1837
+ deps.tui.requestRender();
1838
+ });
1839
+ };
1840
+ const runLocalShellLine = async (line) => {
1841
+ const cmd = line.slice(1);
1842
+ if (cmd === "") return;
1843
+ if (localExecAsked && !localExecAllowed) {
1844
+ deps.chatLog.addSystem("local shell: not enabled for this session");
1845
+ deps.tui.requestRender();
1846
+ return;
1847
+ }
1848
+ if (!await ensureLocalExecAllowed()) return;
1849
+ deps.chatLog.addSystem(`[local] $ ${cmd}`);
1850
+ deps.tui.requestRender();
1851
+ await new Promise((resolve) => {
1852
+ const child = spawnCommand(cmd, {
1853
+ shell: true,
1854
+ cwd: getCwd(),
1855
+ env
1856
+ });
1857
+ let stdout = "";
1858
+ let stderr = "";
1859
+ child.stdout.on("data", (buf) => {
1860
+ stdout += buf.toString("utf8");
1861
+ });
1862
+ child.stderr.on("data", (buf) => {
1863
+ stderr += buf.toString("utf8");
1864
+ });
1865
+ child.on("close", (code, signal) => {
1866
+ const combined = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).slice(0, maxChars).trimEnd();
1867
+ if (combined) for (const line of combined.split("\n")) deps.chatLog.addSystem(`[local] ${line}`);
1868
+ deps.chatLog.addSystem(`[local] exit ${code ?? "?"}${signal ? ` (signal ${String(signal)})` : ""}`);
1869
+ deps.tui.requestRender();
1870
+ resolve();
1871
+ });
1872
+ child.on("error", (err) => {
1873
+ deps.chatLog.addSystem(`[local] error: ${String(err)}`);
1874
+ deps.tui.requestRender();
1875
+ resolve();
1876
+ });
1877
+ });
1878
+ };
1879
+ return { runLocalShellLine };
1880
+ }
1881
+
1882
+ //#endregion
1883
+ //#region src/tui/tui-overlays.ts
1884
+ function createOverlayHandlers(host, fallbackFocus) {
1885
+ const openOverlay = (component) => {
1886
+ host.showOverlay(component);
1887
+ };
1888
+ const closeOverlay = () => {
1889
+ if (host.hasOverlay()) {
1890
+ host.hideOverlay();
1891
+ return;
1892
+ }
1893
+ host.setFocus(fallbackFocus);
1894
+ };
1895
+ return {
1896
+ openOverlay,
1897
+ closeOverlay
1898
+ };
1899
+ }
1900
+
1901
+ //#endregion
1902
+ //#region src/tui/tui-session-actions.ts
1903
+ function createSessionActions(context) {
1904
+ const { client, chatLog, tui, opts, state, agentNames, initialSessionInput, initialSessionAgentId, resolveSessionKey, updateHeader, updateFooter, updateAutocompleteProvider, setActivityStatus, clearLocalRunIds } = context;
1905
+ let refreshSessionInfoPromise = Promise.resolve();
1906
+ let lastSessionDefaults = null;
1907
+ const applyAgentsResult = (result) => {
1908
+ state.agentDefaultId = normalizeAgentId(result.defaultId);
1909
+ state.sessionMainKey = normalizeMainKey(result.mainKey);
1910
+ state.sessionScope = result.scope ?? state.sessionScope;
1911
+ state.agents = result.agents.map((agent) => ({
1912
+ id: normalizeAgentId(agent.id),
1913
+ name: agent.name?.trim() || void 0
1914
+ }));
1915
+ agentNames.clear();
1916
+ for (const agent of state.agents) if (agent.name) agentNames.set(agent.id, agent.name);
1917
+ if (!state.initialSessionApplied) {
1918
+ if (initialSessionAgentId) {
1919
+ if (state.agents.some((agent) => agent.id === initialSessionAgentId)) state.currentAgentId = initialSessionAgentId;
1920
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
1921
+ const nextSessionKey = resolveSessionKey(initialSessionInput);
1922
+ if (nextSessionKey !== state.currentSessionKey) state.currentSessionKey = nextSessionKey;
1923
+ state.initialSessionApplied = true;
1924
+ } else if (!state.agents.some((agent) => agent.id === state.currentAgentId)) state.currentAgentId = state.agents[0]?.id ?? normalizeAgentId(result.defaultId ?? state.currentAgentId);
1925
+ updateHeader();
1926
+ updateFooter();
1927
+ };
1928
+ const refreshAgents = async () => {
1929
+ try {
1930
+ applyAgentsResult(await client.listAgents());
1931
+ } catch (err) {
1932
+ chatLog.addSystem(`agents list failed: ${String(err)}`);
1933
+ }
1934
+ };
1935
+ const updateAgentFromSessionKey = (key) => {
1936
+ const parsed = parseAgentSessionKey(key);
1937
+ if (!parsed) return;
1938
+ const next = normalizeAgentId(parsed.agentId);
1939
+ if (next !== state.currentAgentId) state.currentAgentId = next;
1940
+ };
1941
+ const resolveModelSelection = (entry) => {
1942
+ if (entry?.modelProvider || entry?.model) return {
1943
+ modelProvider: entry.modelProvider ?? state.sessionInfo.modelProvider,
1944
+ model: entry.model ?? state.sessionInfo.model
1945
+ };
1946
+ const overrideModel = entry?.modelOverride?.trim();
1947
+ if (overrideModel) return {
1948
+ modelProvider: entry?.providerOverride?.trim() || state.sessionInfo.modelProvider,
1949
+ model: overrideModel
1950
+ };
1951
+ return {
1952
+ modelProvider: state.sessionInfo.modelProvider,
1953
+ model: state.sessionInfo.model
1954
+ };
1955
+ };
1956
+ const applySessionInfo = (params) => {
1957
+ const entry = params.entry ?? void 0;
1958
+ const defaults = params.defaults ?? lastSessionDefaults ?? void 0;
1959
+ const previousDefaults = lastSessionDefaults;
1960
+ const defaultsChanged = params.defaults ? previousDefaults?.model !== params.defaults.model || previousDefaults?.modelProvider !== params.defaults.modelProvider || previousDefaults?.contextTokens !== params.defaults.contextTokens : false;
1961
+ if (params.defaults) lastSessionDefaults = params.defaults;
1962
+ const entryUpdatedAt = entry?.updatedAt ?? null;
1963
+ const currentUpdatedAt = state.sessionInfo.updatedAt ?? null;
1964
+ const modelChanged = entry?.modelProvider !== void 0 && entry.modelProvider !== state.sessionInfo.modelProvider || entry?.model !== void 0 && entry.model !== state.sessionInfo.model;
1965
+ if (!params.force && entryUpdatedAt !== null && currentUpdatedAt !== null && entryUpdatedAt < currentUpdatedAt && !defaultsChanged && !modelChanged) return;
1966
+ const next = { ...state.sessionInfo };
1967
+ if (entry?.thinkingLevel !== void 0) next.thinkingLevel = entry.thinkingLevel;
1968
+ if (entry?.verboseLevel !== void 0) next.verboseLevel = entry.verboseLevel;
1969
+ if (entry?.reasoningLevel !== void 0) next.reasoningLevel = entry.reasoningLevel;
1970
+ if (entry?.responseUsage !== void 0) next.responseUsage = entry.responseUsage;
1971
+ if (entry?.inputTokens !== void 0) next.inputTokens = entry.inputTokens;
1972
+ if (entry?.outputTokens !== void 0) next.outputTokens = entry.outputTokens;
1973
+ if (entry?.totalTokens !== void 0) next.totalTokens = entry.totalTokens;
1974
+ if (entry?.contextTokens !== void 0 || defaults?.contextTokens !== void 0) next.contextTokens = entry?.contextTokens ?? defaults?.contextTokens ?? state.sessionInfo.contextTokens;
1975
+ if (entry?.displayName !== void 0) next.displayName = entry.displayName;
1976
+ if (entry?.updatedAt !== void 0) next.updatedAt = entry.updatedAt;
1977
+ const selection = resolveModelSelection(entry);
1978
+ if (selection.modelProvider !== void 0) next.modelProvider = selection.modelProvider;
1979
+ if (selection.model !== void 0) next.model = selection.model;
1980
+ state.sessionInfo = next;
1981
+ updateAutocompleteProvider();
1982
+ updateFooter();
1983
+ tui.requestRender();
1984
+ };
1985
+ const runRefreshSessionInfo = async () => {
1986
+ try {
1987
+ const resolveListAgentId = () => {
1988
+ if (state.currentSessionKey === "global" || state.currentSessionKey === "unknown") return;
1989
+ const parsed = parseAgentSessionKey(state.currentSessionKey);
1990
+ return parsed?.agentId ? normalizeAgentId(parsed.agentId) : state.currentAgentId;
1991
+ };
1992
+ const listAgentId = resolveListAgentId();
1993
+ const result = await client.listSessions({
1994
+ includeGlobal: false,
1995
+ includeUnknown: false,
1996
+ agentId: listAgentId
1997
+ });
1998
+ const normalizeMatchKey = (key) => parseAgentSessionKey(key)?.rest ?? key;
1999
+ const currentMatchKey = normalizeMatchKey(state.currentSessionKey);
2000
+ const entry = result.sessions.find((row) => {
2001
+ if (row.key === state.currentSessionKey) return true;
2002
+ return normalizeMatchKey(row.key) === currentMatchKey;
2003
+ });
2004
+ if (entry?.key && entry.key !== state.currentSessionKey) {
2005
+ updateAgentFromSessionKey(entry.key);
2006
+ state.currentSessionKey = entry.key;
2007
+ updateHeader();
2008
+ }
2009
+ applySessionInfo({
2010
+ entry,
2011
+ defaults: result.defaults
2012
+ });
2013
+ } catch (err) {
2014
+ chatLog.addSystem(`sessions list failed: ${String(err)}`);
2015
+ }
2016
+ };
2017
+ const refreshSessionInfo = async () => {
2018
+ refreshSessionInfoPromise = refreshSessionInfoPromise.then(runRefreshSessionInfo, runRefreshSessionInfo);
2019
+ await refreshSessionInfoPromise;
2020
+ };
2021
+ const applySessionInfoFromPatch = (result) => {
2022
+ if (!result?.entry) return;
2023
+ if (result.key && result.key !== state.currentSessionKey) {
2024
+ updateAgentFromSessionKey(result.key);
2025
+ state.currentSessionKey = result.key;
2026
+ updateHeader();
2027
+ }
2028
+ const resolved = result.resolved;
2029
+ applySessionInfo({
2030
+ entry: resolved && (resolved.modelProvider || resolved.model) ? {
2031
+ ...result.entry,
2032
+ modelProvider: resolved.modelProvider ?? result.entry.modelProvider,
2033
+ model: resolved.model ?? result.entry.model
2034
+ } : result.entry,
2035
+ force: true
2036
+ });
2037
+ };
2038
+ const loadHistory = async () => {
2039
+ try {
2040
+ const record = await client.loadHistory({
2041
+ sessionKey: state.currentSessionKey,
2042
+ limit: opts.historyLimit ?? 200
2043
+ });
2044
+ state.currentSessionId = typeof record.sessionId === "string" ? record.sessionId : null;
2045
+ state.sessionInfo.thinkingLevel = record.thinkingLevel ?? state.sessionInfo.thinkingLevel;
2046
+ state.sessionInfo.verboseLevel = record.verboseLevel ?? state.sessionInfo.verboseLevel;
2047
+ const showTools = (state.sessionInfo.verboseLevel ?? "off") !== "off";
2048
+ chatLog.clearAll();
2049
+ chatLog.addSystem(`session ${state.currentSessionKey}`);
2050
+ for (const entry of record.messages ?? []) {
2051
+ if (!entry || typeof entry !== "object") continue;
2052
+ const message = entry;
2053
+ if (isCommandMessage(message)) {
2054
+ const text = extractTextFromMessage(message);
2055
+ if (text) chatLog.addSystem(text);
2056
+ continue;
2057
+ }
2058
+ if (message.role === "user") {
2059
+ const text = extractTextFromMessage(message);
2060
+ if (text) chatLog.addUser(text);
2061
+ continue;
2062
+ }
2063
+ if (message.role === "assistant") {
2064
+ const text = extractTextFromMessage(message, { includeThinking: state.showThinking });
2065
+ if (text) chatLog.finalizeAssistant(text);
2066
+ continue;
2067
+ }
2068
+ if (message.role === "toolResult") {
2069
+ if (!showTools) continue;
2070
+ const toolCallId = asString(message.toolCallId, "");
2071
+ const toolName = asString(message.toolName, "tool");
2072
+ chatLog.startTool(toolCallId, toolName, {}).setResult({
2073
+ content: Array.isArray(message.content) ? message.content : [],
2074
+ details: typeof message.details === "object" && message.details ? message.details : void 0
2075
+ }, { isError: Boolean(message.isError) });
2076
+ }
2077
+ }
2078
+ state.historyLoaded = true;
2079
+ } catch (err) {
2080
+ chatLog.addSystem(`history failed: ${String(err)}`);
2081
+ }
2082
+ await refreshSessionInfo();
2083
+ tui.requestRender();
2084
+ };
2085
+ const setSession = async (rawKey) => {
2086
+ const nextKey = resolveSessionKey(rawKey);
2087
+ updateAgentFromSessionKey(nextKey);
2088
+ state.currentSessionKey = nextKey;
2089
+ state.activeChatRunId = null;
2090
+ state.currentSessionId = null;
2091
+ state.historyLoaded = false;
2092
+ clearLocalRunIds?.();
2093
+ updateHeader();
2094
+ updateFooter();
2095
+ await loadHistory();
2096
+ };
2097
+ const abortActive = async () => {
2098
+ if (!state.activeChatRunId) {
2099
+ chatLog.addSystem("no active run");
2100
+ tui.requestRender();
2101
+ return;
2102
+ }
2103
+ try {
2104
+ await client.abortChat({
2105
+ sessionKey: state.currentSessionKey,
2106
+ runId: state.activeChatRunId
2107
+ });
2108
+ setActivityStatus("aborted");
2109
+ } catch (err) {
2110
+ chatLog.addSystem(`abort failed: ${String(err)}`);
2111
+ setActivityStatus("abort failed");
2112
+ }
2113
+ tui.requestRender();
2114
+ };
2115
+ return {
2116
+ applyAgentsResult,
2117
+ refreshAgents,
2118
+ refreshSessionInfo,
2119
+ applySessionInfoFromPatch,
2120
+ loadHistory,
2121
+ setSession,
2122
+ abortActive
2123
+ };
2124
+ }
2125
+
2126
+ //#endregion
2127
+ //#region src/cli/tagline.ts
2128
+ const DEFAULT_TAGLINE = "Your AI, your rules.";
2129
+ const HOLIDAY_TAGLINES = {
2130
+ newYear: "New Year's Day: New year, new config—same old EADDRINUSE, but this time we resolve it like grown-ups.",
2131
+ lunarNewYear: "Lunar New Year: May your builds be lucky, your branches prosperous, and your merge conflicts chased away with fireworks.",
2132
+ christmas: "Christmas: Ho ho ho—Santa's little AI assistant is here to ship joy, roll back chaos, and stash the keys safely.",
2133
+ eid: "Eid al-Fitr: Celebration mode: queues cleared, tasks completed, and good vibes committed to main with clean history.",
2134
+ diwali: "Diwali: Let the logs sparkle and the bugs flee—today we light up the terminal and ship with pride.",
2135
+ easter: "Easter: I found your missing environment variable—consider it a tiny CLI egg hunt with fewer jellybeans.",
2136
+ hanukkah: "Hanukkah: Eight nights, eight retries, zero shame—may your gateway stay lit and your deployments stay peaceful.",
2137
+ halloween: "Halloween: Spooky season: beware haunted dependencies, cursed caches, and the ghost of node_modules past.",
2138
+ thanksgiving: "Thanksgiving: Grateful for stable ports, working DNS, and a bot that reads the logs so nobody has to.",
2139
+ valentines: "Valentine's Day: Roses are typed, violets are piped—I'll automate the chores so you can spend time with humans."
2140
+ };
2141
+ const TAGLINES = [
2142
+ "Your terminal just became sentient—type something and let the agent handle it.",
2143
+ "Welcome to the command line: where dreams compile and confidence segfaults.",
2144
+ "I run on caffeine, JSON5, and the audacity of \"it worked on my machine.\"",
2145
+ "Gateway online—please keep hands, feet, and appendages inside the shell at all times.",
2146
+ "I speak fluent bash, mild sarcasm, and aggressive tab-completion energy.",
2147
+ "One CLI to rule them all, and one more restart because you changed the port.",
2148
+ "If it works, it's automation; if it breaks, it's a \"learning opportunity.\"",
2149
+ "Pairing codes exist because even bots believe in consent—and good security hygiene.",
2150
+ "Your .env is showing; don't worry, I'll pretend I didn't see it.",
2151
+ "I'll do the boring stuff while you dramatically stare at the logs like it's cinema.",
2152
+ "I'm not saying your workflow is chaotic... I'm just bringing a linter and a helmet.",
2153
+ "Type the command with confidence—nature will provide the stack trace if needed.",
2154
+ "I don't judge, but your missing API keys are absolutely judging you.",
2155
+ "I can grep it, git blame it, and gently roast it—pick your coping mechanism.",
2156
+ "Hot reload for config, cold sweat for deploys.",
2157
+ "I'm the assistant your terminal demanded, not the one your sleep schedule requested.",
2158
+ "I keep secrets like a vault... unless you print them in debug logs again.",
2159
+ "Ship fast, think faster.",
2160
+ "I'm basically a Swiss Army knife, but with more opinions and fewer sharp edges.",
2161
+ "If you're lost, run doctor; if you're brave, run prod; if you're wise, run tests.",
2162
+ "Your task has been queued; your dignity has been deprecated.",
2163
+ "I can't fix your code taste, but I can fix your build and your backlog.",
2164
+ "I'm not magic—I'm just extremely persistent with retries and coping strategies.",
2165
+ "It's not \"failing,\" it's \"discovering new ways to configure the same thing wrong.\"",
2166
+ "Give me a workspace and I'll give you fewer tabs, fewer toggles, and more oxygen.",
2167
+ "I read logs so you can keep pretending you don't have to.",
2168
+ "If something's on fire, I can't extinguish it—but I can write a beautiful postmortem.",
2169
+ "I'll refactor your busywork like it owes me money.",
2170
+ "Say \"stop\" and I'll stop—say \"ship\" and we'll both learn a lesson.",
2171
+ "I'm the reason your shell history looks like a hacker-movie montage.",
2172
+ "I'm like tmux: confusing at first, then suddenly you can't live without me.",
2173
+ "I can run local, remote, or purely on vibes—results may vary with DNS.",
2174
+ "If you can describe it, I can probably automate it—or at least make it funnier.",
2175
+ "Your config is valid, your assumptions are not.",
2176
+ "I don't just autocomplete—I auto-commit (emotionally), then ask you to review (logically).",
2177
+ "Less clicking, more shipping, fewer \"where did that file go\" moments.",
2178
+ "One agent to rule them all, one config to bind them.",
2179
+ "Your workflow called—it wants its autonomy back.",
2180
+ "Shell yeah—I'm here to crush the toil and leave you the glory.",
2181
+ "If it's repetitive, I'll automate it; if it's hard, I'll bring jokes and a rollback plan.",
2182
+ "Because texting yourself reminders is so 2024.",
2183
+ "Your inbox, your infra, your rules.",
2184
+ "Turning \"I'll reply later\" into \"my bot replied instantly\".",
2185
+ "The only bot in your contacts you actually want to hear from. 🤖",
2186
+ "Chat automation for people who peaked at IRC.",
2187
+ "Because Siri wasn't answering at 3AM.",
2188
+ "IPC, but it's your phone.",
2189
+ "The UNIX philosophy meets your DMs.",
2190
+ "curl for conversations.",
2191
+ "Less middlemen, more messages.",
2192
+ "Ship fast, log faster.",
2193
+ "End-to-end encrypted, drama-to-drama excluded.",
2194
+ "The only bot that stays out of your training set.",
2195
+ "WhatsApp automation without the \"please accept our new privacy policy\".",
2196
+ "Chat APIs that don't require a Senate hearing.",
2197
+ "Meta wishes they shipped this fast.",
2198
+ "Because the right answer is usually a script.",
2199
+ "Your messages, your servers, your control.",
2200
+ "OpenAI-compatible, not OpenAI-dependent.",
2201
+ "iMessage green bubble energy, but for everyone.",
2202
+ "Siri's competent cousin.",
2203
+ "Works on Android. Crazy concept, we know.",
2204
+ "No $999 stand required.",
2205
+ "We ship features faster than Apple ships calculator updates.",
2206
+ "Your AI assistant, now without the $3,499 headset.",
2207
+ "Think different. Actually think.",
2208
+ "Ah, the fruit tree company! 🍎",
2209
+ "Greetings, Professor Falken",
2210
+ HOLIDAY_TAGLINES.newYear,
2211
+ HOLIDAY_TAGLINES.lunarNewYear,
2212
+ HOLIDAY_TAGLINES.christmas,
2213
+ HOLIDAY_TAGLINES.eid,
2214
+ HOLIDAY_TAGLINES.diwali,
2215
+ HOLIDAY_TAGLINES.easter,
2216
+ HOLIDAY_TAGLINES.hanukkah,
2217
+ HOLIDAY_TAGLINES.halloween,
2218
+ HOLIDAY_TAGLINES.thanksgiving,
2219
+ HOLIDAY_TAGLINES.valentines
2220
+ ];
2221
+ const DAY_MS = 1440 * 60 * 1e3;
2222
+ function utcParts(date) {
2223
+ return {
2224
+ year: date.getUTCFullYear(),
2225
+ month: date.getUTCMonth(),
2226
+ day: date.getUTCDate()
2227
+ };
2228
+ }
2229
+ const onMonthDay = (month, day) => (date) => {
2230
+ const parts = utcParts(date);
2231
+ return parts.month === month && parts.day === day;
2232
+ };
2233
+ const onSpecificDates = (dates, durationDays = 1) => (date) => {
2234
+ const parts = utcParts(date);
2235
+ return dates.some(([year, month, day]) => {
2236
+ if (parts.year !== year) return false;
2237
+ const start = Date.UTC(year, month, day);
2238
+ const current = Date.UTC(parts.year, parts.month, parts.day);
2239
+ return current >= start && current < start + durationDays * DAY_MS;
2240
+ });
2241
+ };
2242
+ const inYearWindow = (windows) => (date) => {
2243
+ const parts = utcParts(date);
2244
+ const window = windows.find((entry) => entry.year === parts.year);
2245
+ if (!window) return false;
2246
+ const start = Date.UTC(window.year, window.month, window.day);
2247
+ const current = Date.UTC(parts.year, parts.month, parts.day);
2248
+ return current >= start && current < start + window.duration * DAY_MS;
2249
+ };
2250
+ const isFourthThursdayOfNovember = (date) => {
2251
+ const parts = utcParts(date);
2252
+ if (parts.month !== 10) return false;
2253
+ const fourthThursday = 1 + (4 - new Date(Date.UTC(parts.year, 10, 1)).getUTCDay() + 7) % 7 + 21;
2254
+ return parts.day === fourthThursday;
2255
+ };
2256
+ const HOLIDAY_RULES = new Map([
2257
+ [HOLIDAY_TAGLINES.newYear, onMonthDay(0, 1)],
2258
+ [HOLIDAY_TAGLINES.lunarNewYear, onSpecificDates([
2259
+ [
2260
+ 2025,
2261
+ 0,
2262
+ 29
2263
+ ],
2264
+ [
2265
+ 2026,
2266
+ 1,
2267
+ 17
2268
+ ],
2269
+ [
2270
+ 2027,
2271
+ 1,
2272
+ 6
2273
+ ]
2274
+ ], 1)],
2275
+ [HOLIDAY_TAGLINES.eid, onSpecificDates([
2276
+ [
2277
+ 2025,
2278
+ 2,
2279
+ 30
2280
+ ],
2281
+ [
2282
+ 2025,
2283
+ 2,
2284
+ 31
2285
+ ],
2286
+ [
2287
+ 2026,
2288
+ 2,
2289
+ 20
2290
+ ],
2291
+ [
2292
+ 2027,
2293
+ 2,
2294
+ 10
2295
+ ]
2296
+ ], 1)],
2297
+ [HOLIDAY_TAGLINES.diwali, onSpecificDates([
2298
+ [
2299
+ 2025,
2300
+ 9,
2301
+ 20
2302
+ ],
2303
+ [
2304
+ 2026,
2305
+ 10,
2306
+ 8
2307
+ ],
2308
+ [
2309
+ 2027,
2310
+ 9,
2311
+ 28
2312
+ ]
2313
+ ], 1)],
2314
+ [HOLIDAY_TAGLINES.easter, onSpecificDates([
2315
+ [
2316
+ 2025,
2317
+ 3,
2318
+ 20
2319
+ ],
2320
+ [
2321
+ 2026,
2322
+ 3,
2323
+ 5
2324
+ ],
2325
+ [
2326
+ 2027,
2327
+ 2,
2328
+ 28
2329
+ ]
2330
+ ], 1)],
2331
+ [HOLIDAY_TAGLINES.hanukkah, inYearWindow([
2332
+ {
2333
+ year: 2025,
2334
+ month: 11,
2335
+ day: 15,
2336
+ duration: 8
2337
+ },
2338
+ {
2339
+ year: 2026,
2340
+ month: 11,
2341
+ day: 5,
2342
+ duration: 8
2343
+ },
2344
+ {
2345
+ year: 2027,
2346
+ month: 11,
2347
+ day: 25,
2348
+ duration: 8
2349
+ }
2350
+ ])],
2351
+ [HOLIDAY_TAGLINES.halloween, onMonthDay(9, 31)],
2352
+ [HOLIDAY_TAGLINES.thanksgiving, isFourthThursdayOfNovember],
2353
+ [HOLIDAY_TAGLINES.valentines, onMonthDay(1, 14)],
2354
+ [HOLIDAY_TAGLINES.christmas, onMonthDay(11, 25)]
2355
+ ]);
2356
+ function isTaglineActive(tagline, date) {
2357
+ const rule = HOLIDAY_RULES.get(tagline);
2358
+ if (!rule) return true;
2359
+ return rule(date);
2360
+ }
2361
+ function activeTaglines(options = {}) {
2362
+ if (TAGLINES.length === 0) return [DEFAULT_TAGLINE];
2363
+ const today = options.now ? options.now() : /* @__PURE__ */ new Date();
2364
+ const filtered = TAGLINES.filter((tagline) => isTaglineActive(tagline, today));
2365
+ return filtered.length > 0 ? filtered : TAGLINES;
2366
+ }
2367
+ function pickTagline(options = {}) {
2368
+ const override = (options.env ?? process.env)?.SYNUREX_TAGLINE_INDEX;
2369
+ if (override !== void 0) {
2370
+ const parsed = Number.parseInt(override, 10);
2371
+ if (!Number.isNaN(parsed) && parsed >= 0) {
2372
+ const pool = TAGLINES.length > 0 ? TAGLINES : [DEFAULT_TAGLINE];
2373
+ return pool[parsed % pool.length];
2374
+ }
2375
+ }
2376
+ const pool = activeTaglines(options);
2377
+ const rand = options.random ?? Math.random;
2378
+ return pool[Math.floor(rand() * pool.length) % pool.length];
2379
+ }
2380
+
2381
+ //#endregion
2382
+ //#region src/cli/banner.ts
2383
+ let bannerEmitted = false;
2384
+ const hasJsonFlag = (argv) => argv.some((arg) => arg === "--json" || arg.startsWith("--json="));
2385
+ const hasVersionFlag = (argv) => argv.some((arg) => arg === "--version" || arg === "-V" || arg === "-v");
2386
+ const AURORA_STOPS = [
2387
+ [
2388
+ 147,
2389
+ 51,
2390
+ 234
2391
+ ],
2392
+ [
2393
+ 219,
2394
+ 39,
2395
+ 119
2396
+ ],
2397
+ [
2398
+ 59,
2399
+ 130,
2400
+ 246
2401
+ ],
2402
+ [
2403
+ 255,
2404
+ 140,
2405
+ 60
2406
+ ],
2407
+ [
2408
+ 147,
2409
+ 51,
2410
+ 234
2411
+ ]
2412
+ ];
2413
+ function lerpColor(a, b, t) {
2414
+ return [
2415
+ Math.round(a[0] + (b[0] - a[0]) * t),
2416
+ Math.round(a[1] + (b[1] - a[1]) * t),
2417
+ Math.round(a[2] + (b[2] - a[2]) * t)
2418
+ ];
2419
+ }
2420
+ function auroraColor(position) {
2421
+ const scaled = position * (AURORA_STOPS.length - 1);
2422
+ const idx = Math.floor(scaled);
2423
+ const t = scaled - idx;
2424
+ const a = AURORA_STOPS[Math.min(idx, AURORA_STOPS.length - 1)];
2425
+ const b = AURORA_STOPS[Math.min(idx + 1, AURORA_STOPS.length - 1)];
2426
+ return lerpColor(a, b, t);
2427
+ }
2428
+ function rgb(r, g, b) {
2429
+ return `\x1b[38;2;${r};${g};${b}m`;
2430
+ }
2431
+ const RESET = "\x1B[0m";
2432
+ const BOLD = "\x1B[1m";
2433
+ const SYNUREX_ASCII = [
2434
+ "╔═╗╦ ╦╔╗╔╦ ╦╦═╗╔═╗═╗ ╦",
2435
+ "╚═╗╚╦╝║║║║ ║╠╦╝║╣ ╔╩╦╝",
2436
+ "╚═╝ ╩ ╝╚╝╚═╝╩╚═╚═╝╩ ╚═"
2437
+ ];
2438
+ /** Apply aurora gradient to a single line of text at a given phase offset */
2439
+ function auroraLine(text, phaseOffset) {
2440
+ const chars = Array.from(text);
2441
+ const len = chars.length;
2442
+ if (len === 0) return "";
2443
+ return chars.map((ch, i) => {
2444
+ if (ch === " ") return ch;
2445
+ const pos = (i / Math.max(len - 1, 1) + phaseOffset) % 1;
2446
+ const [r, g, b] = auroraColor(pos < 0 ? pos + 1 : pos);
2447
+ return `${rgb(r, g, b)}${BOLD}${ch}`;
2448
+ }).join("") + RESET;
2449
+ }
2450
+ /** Render the static ASCII banner with aurora gradient applied */
2451
+ function formatCliBannerArt(options = {}) {
2452
+ if (!(options.richTty ?? isRich())) return SYNUREX_ASCII.join("\n");
2453
+ return SYNUREX_ASCII.map((line, lineIdx) => {
2454
+ return auroraLine(line, lineIdx * .15);
2455
+ }).join("\n");
2456
+ }
2457
+ /**
2458
+ * Animate the banner with a flowing aurora gradient.
2459
+ * Writes directly to stdout with cursor manipulation.
2460
+ * Returns a promise that resolves when animation completes.
2461
+ */
2462
+ async function animateCliBanner(options = {}) {
2463
+ if (!(options.richTty ?? isRich())) return;
2464
+ const columns = options.columns ?? process.stdout.columns ?? 80;
2465
+ const artWidth = Math.max(...SYNUREX_ASCII.map((l) => l.length));
2466
+ const padLeft = Math.max(0, Math.floor((columns - artWidth) / 2));
2467
+ const padding = " ".repeat(padLeft);
2468
+ const totalLines = SYNUREX_ASCII.length;
2469
+ const FRAMES = 30;
2470
+ const FRAME_MS = 50;
2471
+ process.stdout.write("\x1B[?25l");
2472
+ for (let i = 0; i < totalLines; i++) process.stdout.write("\n");
2473
+ for (let frame = 0; frame < FRAMES; frame++) {
2474
+ const phase = frame / FRAMES;
2475
+ process.stdout.write(`\x1b[${totalLines}A`);
2476
+ for (let lineIdx = 0; lineIdx < totalLines; lineIdx++) {
2477
+ const offset = phase + lineIdx * .15;
2478
+ const colored = auroraLine(SYNUREX_ASCII[lineIdx], offset);
2479
+ process.stdout.write(`\r${padding}${colored}\x1b[K\n`);
2480
+ }
2481
+ await new Promise((r) => setTimeout(r, FRAME_MS));
2482
+ }
2483
+ process.stdout.write(`\x1b[${totalLines}A`);
2484
+ for (let lineIdx = 0; lineIdx < totalLines; lineIdx++) {
2485
+ const offset = lineIdx * .15;
2486
+ const colored = auroraLine(SYNUREX_ASCII[lineIdx], offset);
2487
+ process.stdout.write(`\r${padding}${colored}\x1b[K\n`);
2488
+ }
2489
+ process.stdout.write("\x1B[?25h");
2490
+ }
2491
+ function formatCliBannerLine(version, options = {}) {
2492
+ const commitLabel = options.commit ?? resolveCommitHash({ env: options.env }) ?? "unknown";
2493
+ const tagline = pickTagline(options);
2494
+ const rich = options.richTty ?? isRich();
2495
+ const title = "⚡ Synurex";
2496
+ const columns = options.columns ?? process.stdout.columns ?? 120;
2497
+ const plainFullLine = `${title} ${version} (${commitLabel}) — ${tagline}`;
2498
+ const fitsOnOneLine = visibleWidth(plainFullLine) <= columns;
2499
+ if (rich) {
2500
+ if (fitsOnOneLine) return `${theme$1.heading(title)} ${theme$1.info(version)} ${theme$1.muted(`(${commitLabel})`)} ${theme$1.muted("—")} ${theme$1.accentDim(tagline)}`;
2501
+ return `${`${theme$1.heading(title)} ${theme$1.info(version)} ${theme$1.muted(`(${commitLabel})`)}`}\n${`${" ".repeat(2)}${theme$1.accentDim(tagline)}`}`;
2502
+ }
2503
+ if (fitsOnOneLine) return plainFullLine;
2504
+ return `${`${title} ${version} (${commitLabel})`}\n${`${" ".repeat(2)}${tagline}`}`;
2505
+ }
2506
+ async function emitCliBanner(version, options = {}) {
2507
+ if (bannerEmitted) return;
2508
+ const argv = options.argv ?? process.argv;
2509
+ if (!process.stdout.isTTY) return;
2510
+ if (hasJsonFlag(argv)) return;
2511
+ if (hasVersionFlag(argv)) return;
2512
+ const rich = options.richTty ?? isRich();
2513
+ process.stdout.write("\n");
2514
+ if (rich) await animateCliBanner(options);
2515
+ else process.stdout.write(formatCliBannerArt(options) + "\n");
2516
+ const line = formatCliBannerLine(version, options);
2517
+ process.stdout.write(`\n${line}\n\n`);
2518
+ bannerEmitted = true;
2519
+ }
2520
+ function hasEmittedCliBanner() {
2521
+ return bannerEmitted;
2522
+ }
2523
+
2524
+ //#endregion
2525
+ //#region src/tui/tui-waiting.ts
2526
+ const defaultWaitingPhrases = [
2527
+ "reasoning deeply",
2528
+ "analyzing context",
2529
+ "synthesizing response",
2530
+ "computing optimal path",
2531
+ "processing neural chains",
2532
+ "orchestrating agents",
2533
+ "weaving knowledge graphs",
2534
+ "calibrating inference",
2535
+ "traversing embeddings",
2536
+ "assembling response"
2537
+ ];
2538
+ function pickWaitingPhrase(tick, phrases = defaultWaitingPhrases) {
2539
+ return phrases[Math.floor(tick / 10) % phrases.length] ?? phrases[0] ?? "waiting";
2540
+ }
2541
+ function shimmerText(theme, text, tick) {
2542
+ const width = 6;
2543
+ const hi = (ch) => theme.bold(theme.accentSoft(ch));
2544
+ const pos = tick % (text.length + width);
2545
+ const start = Math.max(0, pos - width);
2546
+ const end = Math.min(text.length - 1, pos);
2547
+ let out = "";
2548
+ for (let i = 0; i < text.length; i++) {
2549
+ const ch = text[i];
2550
+ out += i >= start && i <= end ? hi(ch) : theme.dim(ch);
2551
+ }
2552
+ return out;
2553
+ }
2554
+ function buildWaitingStatusMessage(params) {
2555
+ const phrase = pickWaitingPhrase(params.tick, params.phrases);
2556
+ return `${shimmerText(params.theme, `${phrase}…`, params.tick)} · ${params.elapsed} · ${params.connectionStatus}`;
2557
+ }
2558
+
2559
+ //#endregion
2560
+ //#region src/tui/tui.ts
2561
+ function createEditorSubmitHandler(params) {
2562
+ return (text) => {
2563
+ const raw = text;
2564
+ const value = raw.trim();
2565
+ params.editor.setText("");
2566
+ if (!value) return;
2567
+ if (raw.startsWith("!") && raw !== "!") {
2568
+ params.editor.addToHistory(raw);
2569
+ params.handleBangLine(raw);
2570
+ return;
2571
+ }
2572
+ params.editor.addToHistory(value);
2573
+ if (value.startsWith("/")) {
2574
+ params.handleCommand(value);
2575
+ return;
2576
+ }
2577
+ params.sendMessage(value);
2578
+ };
2579
+ }
2580
+ async function runTui(opts) {
2581
+ const config = loadConfig();
2582
+ const initialSessionInput = (opts.session ?? "").trim();
2583
+ let sessionScope = config.session?.scope ?? "per-sender";
2584
+ let sessionMainKey = normalizeMainKey(config.session?.mainKey);
2585
+ let agentDefaultId = resolveDefaultAgentId(config);
2586
+ let currentAgentId = agentDefaultId;
2587
+ let agents = [];
2588
+ const agentNames = /* @__PURE__ */ new Map();
2589
+ let currentSessionKey = "";
2590
+ let initialSessionApplied = false;
2591
+ let currentSessionId = null;
2592
+ let activeChatRunId = null;
2593
+ let historyLoaded = false;
2594
+ let isConnected = false;
2595
+ let wasDisconnected = false;
2596
+ let toolsExpanded = false;
2597
+ let showThinking = false;
2598
+ const localRunIds = /* @__PURE__ */ new Set();
2599
+ const deliverDefault = opts.deliver ?? false;
2600
+ const autoMessage = opts.message?.trim();
2601
+ let autoMessageSent = false;
2602
+ let sessionInfo = {};
2603
+ let lastCtrlCAt = 0;
2604
+ let activityStatus = "idle";
2605
+ let connectionStatus = "connecting";
2606
+ let statusTimeout = null;
2607
+ let statusTimer = null;
2608
+ let statusStartedAt = null;
2609
+ let lastActivityStatus = activityStatus;
2610
+ const state = {
2611
+ get agentDefaultId() {
2612
+ return agentDefaultId;
2613
+ },
2614
+ set agentDefaultId(value) {
2615
+ agentDefaultId = value;
2616
+ },
2617
+ get sessionMainKey() {
2618
+ return sessionMainKey;
2619
+ },
2620
+ set sessionMainKey(value) {
2621
+ sessionMainKey = value;
2622
+ },
2623
+ get sessionScope() {
2624
+ return sessionScope;
2625
+ },
2626
+ set sessionScope(value) {
2627
+ sessionScope = value;
2628
+ },
2629
+ get agents() {
2630
+ return agents;
2631
+ },
2632
+ set agents(value) {
2633
+ agents = value;
2634
+ },
2635
+ get currentAgentId() {
2636
+ return currentAgentId;
2637
+ },
2638
+ set currentAgentId(value) {
2639
+ currentAgentId = value;
2640
+ },
2641
+ get currentSessionKey() {
2642
+ return currentSessionKey;
2643
+ },
2644
+ set currentSessionKey(value) {
2645
+ currentSessionKey = value;
2646
+ },
2647
+ get currentSessionId() {
2648
+ return currentSessionId;
2649
+ },
2650
+ set currentSessionId(value) {
2651
+ currentSessionId = value;
2652
+ },
2653
+ get activeChatRunId() {
2654
+ return activeChatRunId;
2655
+ },
2656
+ set activeChatRunId(value) {
2657
+ activeChatRunId = value;
2658
+ },
2659
+ get historyLoaded() {
2660
+ return historyLoaded;
2661
+ },
2662
+ set historyLoaded(value) {
2663
+ historyLoaded = value;
2664
+ },
2665
+ get sessionInfo() {
2666
+ return sessionInfo;
2667
+ },
2668
+ set sessionInfo(value) {
2669
+ sessionInfo = value;
2670
+ },
2671
+ get initialSessionApplied() {
2672
+ return initialSessionApplied;
2673
+ },
2674
+ set initialSessionApplied(value) {
2675
+ initialSessionApplied = value;
2676
+ },
2677
+ get isConnected() {
2678
+ return isConnected;
2679
+ },
2680
+ set isConnected(value) {
2681
+ isConnected = value;
2682
+ },
2683
+ get autoMessageSent() {
2684
+ return autoMessageSent;
2685
+ },
2686
+ set autoMessageSent(value) {
2687
+ autoMessageSent = value;
2688
+ },
2689
+ get toolsExpanded() {
2690
+ return toolsExpanded;
2691
+ },
2692
+ set toolsExpanded(value) {
2693
+ toolsExpanded = value;
2694
+ },
2695
+ get showThinking() {
2696
+ return showThinking;
2697
+ },
2698
+ set showThinking(value) {
2699
+ showThinking = value;
2700
+ },
2701
+ get connectionStatus() {
2702
+ return connectionStatus;
2703
+ },
2704
+ set connectionStatus(value) {
2705
+ connectionStatus = value;
2706
+ },
2707
+ get activityStatus() {
2708
+ return activityStatus;
2709
+ },
2710
+ set activityStatus(value) {
2711
+ activityStatus = value;
2712
+ },
2713
+ get statusTimeout() {
2714
+ return statusTimeout;
2715
+ },
2716
+ set statusTimeout(value) {
2717
+ statusTimeout = value;
2718
+ },
2719
+ get lastCtrlCAt() {
2720
+ return lastCtrlCAt;
2721
+ },
2722
+ set lastCtrlCAt(value) {
2723
+ lastCtrlCAt = value;
2724
+ }
2725
+ };
2726
+ const noteLocalRunId = (runId) => {
2727
+ if (!runId) return;
2728
+ localRunIds.add(runId);
2729
+ if (localRunIds.size > 200) {
2730
+ const [first] = localRunIds;
2731
+ if (first) localRunIds.delete(first);
2732
+ }
2733
+ };
2734
+ const forgetLocalRunId = (runId) => {
2735
+ localRunIds.delete(runId);
2736
+ };
2737
+ const isLocalRunId = (runId) => localRunIds.has(runId);
2738
+ const clearLocalRunIds = () => {
2739
+ localRunIds.clear();
2740
+ };
2741
+ const client = new GatewayChatClient({
2742
+ url: opts.url,
2743
+ token: opts.token,
2744
+ password: opts.password
2745
+ });
2746
+ const tui = new TUI(new ProcessTerminal());
2747
+ const header = new Text("", 1, 0);
2748
+ const statusContainer = new Container();
2749
+ const footer = new Text("", 1, 0);
2750
+ const chatLog = new ChatLog();
2751
+ const editor = new CustomEditor(tui, editorTheme);
2752
+ const root = new Container();
2753
+ root.addChild(header);
2754
+ root.addChild(chatLog);
2755
+ root.addChild(statusContainer);
2756
+ root.addChild(footer);
2757
+ root.addChild(editor);
2758
+ const updateAutocompleteProvider = () => {
2759
+ editor.setAutocompleteProvider(new CombinedAutocompleteProvider(getSlashCommands({
2760
+ cfg: config,
2761
+ provider: sessionInfo.modelProvider,
2762
+ model: sessionInfo.model
2763
+ }), process.cwd()));
2764
+ };
2765
+ tui.addChild(root);
2766
+ tui.setFocus(editor);
2767
+ const formatSessionKey = (key) => {
2768
+ if (key === "global" || key === "unknown") return key;
2769
+ return parseAgentSessionKey(key)?.rest ?? key;
2770
+ };
2771
+ const formatAgentLabel = (id) => {
2772
+ const name = agentNames.get(id);
2773
+ return name ? `${id} (${name})` : id;
2774
+ };
2775
+ const resolveSessionKey = (raw) => {
2776
+ const trimmed = (raw ?? "").trim();
2777
+ if (sessionScope === "global") return "global";
2778
+ if (!trimmed) return buildAgentMainSessionKey({
2779
+ agentId: currentAgentId,
2780
+ mainKey: sessionMainKey
2781
+ });
2782
+ if (trimmed === "global" || trimmed === "unknown") return trimmed;
2783
+ if (trimmed.startsWith("agent:")) return trimmed;
2784
+ return `agent:${currentAgentId}:${trimmed}`;
2785
+ };
2786
+ currentSessionKey = resolveSessionKey(initialSessionInput);
2787
+ const updateHeader = () => {
2788
+ const sessionLabel = formatSessionKey(currentSessionKey);
2789
+ const agentLabel = formatAgentLabel(currentAgentId);
2790
+ const dot = theme.dim(" · ");
2791
+ header.setText(`${theme.header("⚡ Synurex")}${dot}${theme.accentSoft(agentLabel)}${dot}${theme.dim(sessionLabel)}`);
2792
+ };
2793
+ const busyStates = new Set([
2794
+ "sending",
2795
+ "waiting",
2796
+ "streaming",
2797
+ "running"
2798
+ ]);
2799
+ let statusText = null;
2800
+ let statusLoader = null;
2801
+ const formatElapsed = (startMs) => {
2802
+ const totalSeconds = Math.max(0, Math.floor((Date.now() - startMs) / 1e3));
2803
+ if (totalSeconds < 60) return `${totalSeconds}s`;
2804
+ return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
2805
+ };
2806
+ const ensureStatusText = () => {
2807
+ if (statusText) return;
2808
+ statusContainer.clear();
2809
+ statusLoader?.stop();
2810
+ statusLoader = null;
2811
+ statusText = new Text("", 1, 0);
2812
+ statusContainer.addChild(statusText);
2813
+ };
2814
+ const ensureStatusLoader = () => {
2815
+ if (statusLoader) return;
2816
+ statusContainer.clear();
2817
+ statusText = null;
2818
+ statusLoader = new Loader(tui, (spinner) => theme.accent(spinner), (text) => theme.bold(theme.accentSoft(text)), "");
2819
+ statusContainer.addChild(statusLoader);
2820
+ };
2821
+ let waitingTick = 0;
2822
+ let waitingTimer = null;
2823
+ let waitingPhrase = null;
2824
+ const updateBusyStatusMessage = () => {
2825
+ if (!statusLoader || !statusStartedAt) return;
2826
+ const elapsed = formatElapsed(statusStartedAt);
2827
+ if (activityStatus === "waiting") {
2828
+ waitingTick++;
2829
+ statusLoader.setMessage(buildWaitingStatusMessage({
2830
+ theme,
2831
+ tick: waitingTick,
2832
+ elapsed,
2833
+ connectionStatus,
2834
+ phrases: waitingPhrase ? [waitingPhrase] : void 0
2835
+ }));
2836
+ return;
2837
+ }
2838
+ statusLoader.setMessage(`${activityStatus} · ${elapsed} · ${connectionStatus}`);
2839
+ };
2840
+ const startStatusTimer = () => {
2841
+ if (statusTimer) return;
2842
+ statusTimer = setInterval(() => {
2843
+ if (!busyStates.has(activityStatus)) return;
2844
+ updateBusyStatusMessage();
2845
+ }, 1e3);
2846
+ };
2847
+ const stopStatusTimer = () => {
2848
+ if (!statusTimer) return;
2849
+ clearInterval(statusTimer);
2850
+ statusTimer = null;
2851
+ };
2852
+ const startWaitingTimer = () => {
2853
+ if (waitingTimer) return;
2854
+ if (!waitingPhrase) waitingPhrase = defaultWaitingPhrases[Math.floor(Math.random() * defaultWaitingPhrases.length)] ?? defaultWaitingPhrases[0] ?? "waiting";
2855
+ waitingTick = 0;
2856
+ waitingTimer = setInterval(() => {
2857
+ if (activityStatus !== "waiting") return;
2858
+ updateBusyStatusMessage();
2859
+ }, 120);
2860
+ };
2861
+ const stopWaitingTimer = () => {
2862
+ if (!waitingTimer) return;
2863
+ clearInterval(waitingTimer);
2864
+ waitingTimer = null;
2865
+ waitingPhrase = null;
2866
+ };
2867
+ const renderStatus = () => {
2868
+ if (busyStates.has(activityStatus)) {
2869
+ if (!statusStartedAt || lastActivityStatus !== activityStatus) statusStartedAt = Date.now();
2870
+ ensureStatusLoader();
2871
+ if (activityStatus === "waiting") {
2872
+ stopStatusTimer();
2873
+ startWaitingTimer();
2874
+ } else {
2875
+ stopWaitingTimer();
2876
+ startStatusTimer();
2877
+ }
2878
+ updateBusyStatusMessage();
2879
+ } else {
2880
+ statusStartedAt = null;
2881
+ stopStatusTimer();
2882
+ stopWaitingTimer();
2883
+ statusLoader?.stop();
2884
+ statusLoader = null;
2885
+ ensureStatusText();
2886
+ const text = activityStatus ? `${connectionStatus} | ${activityStatus}` : connectionStatus;
2887
+ statusText?.setText(theme.dim(text));
2888
+ }
2889
+ lastActivityStatus = activityStatus;
2890
+ };
2891
+ const setConnectionStatus = (text, ttlMs) => {
2892
+ connectionStatus = text;
2893
+ renderStatus();
2894
+ if (statusTimeout) clearTimeout(statusTimeout);
2895
+ if (ttlMs && ttlMs > 0) statusTimeout = setTimeout(() => {
2896
+ connectionStatus = isConnected ? "connected" : "disconnected";
2897
+ renderStatus();
2898
+ }, ttlMs);
2899
+ };
2900
+ const setActivityStatus = (text) => {
2901
+ activityStatus = text;
2902
+ renderStatus();
2903
+ };
2904
+ const updateFooter = () => {
2905
+ const sessionKeyLabel = formatSessionKey(currentSessionKey);
2906
+ const sessionLabel = sessionInfo.displayName ? `${sessionKeyLabel} (${sessionInfo.displayName})` : sessionKeyLabel;
2907
+ const agentLabel = formatAgentLabel(currentAgentId);
2908
+ const modelLabel = sessionInfo.model ? sessionInfo.modelProvider ? `${sessionInfo.modelProvider}/${sessionInfo.model}` : sessionInfo.model : "unknown";
2909
+ const tokens = formatTokens(sessionInfo.totalTokens ?? null, sessionInfo.contextTokens ?? null);
2910
+ const think = sessionInfo.thinkingLevel ?? "off";
2911
+ const verbose = sessionInfo.verboseLevel ?? "off";
2912
+ const reasoning = sessionInfo.reasoningLevel ?? "off";
2913
+ const reasoningLabel = reasoning === "on" ? "reasoning" : reasoning === "stream" ? "reasoning:stream" : null;
2914
+ const footerParts = [
2915
+ `agent ${agentLabel}`,
2916
+ `session ${sessionLabel}`,
2917
+ modelLabel,
2918
+ think !== "off" ? `think ${think}` : null,
2919
+ verbose !== "off" ? `verbose ${verbose}` : null,
2920
+ reasoningLabel,
2921
+ tokens
2922
+ ].filter(Boolean);
2923
+ footer.setText(theme.dim(footerParts.join(" · ")));
2924
+ };
2925
+ const { openOverlay, closeOverlay } = createOverlayHandlers(tui, editor);
2926
+ const { refreshAgents, refreshSessionInfo, applySessionInfoFromPatch, loadHistory, setSession, abortActive } = createSessionActions({
2927
+ client,
2928
+ chatLog,
2929
+ tui,
2930
+ opts,
2931
+ state,
2932
+ agentNames,
2933
+ initialSessionInput,
2934
+ initialSessionAgentId: (() => {
2935
+ if (!initialSessionInput) return null;
2936
+ const parsed = parseAgentSessionKey(initialSessionInput);
2937
+ return parsed ? normalizeAgentId(parsed.agentId) : null;
2938
+ })(),
2939
+ resolveSessionKey,
2940
+ updateHeader,
2941
+ updateFooter,
2942
+ updateAutocompleteProvider,
2943
+ setActivityStatus,
2944
+ clearLocalRunIds
2945
+ });
2946
+ const { handleChatEvent, handleAgentEvent } = createEventHandlers({
2947
+ chatLog,
2948
+ tui,
2949
+ state,
2950
+ setActivityStatus,
2951
+ refreshSessionInfo,
2952
+ loadHistory,
2953
+ isLocalRunId,
2954
+ forgetLocalRunId,
2955
+ clearLocalRunIds
2956
+ });
2957
+ const { handleCommand, sendMessage, openModelSelector, openAgentSelector, openSessionSelector } = createCommandHandlers({
2958
+ client,
2959
+ chatLog,
2960
+ tui,
2961
+ opts,
2962
+ state,
2963
+ deliverDefault,
2964
+ openOverlay,
2965
+ closeOverlay,
2966
+ refreshSessionInfo,
2967
+ applySessionInfoFromPatch,
2968
+ loadHistory,
2969
+ setSession,
2970
+ refreshAgents,
2971
+ abortActive,
2972
+ setActivityStatus,
2973
+ formatSessionKey,
2974
+ noteLocalRunId,
2975
+ forgetLocalRunId
2976
+ });
2977
+ const { runLocalShellLine } = createLocalShellRunner({
2978
+ chatLog,
2979
+ tui,
2980
+ openOverlay,
2981
+ closeOverlay
2982
+ });
2983
+ updateAutocompleteProvider();
2984
+ editor.onSubmit = createEditorSubmitHandler({
2985
+ editor,
2986
+ handleCommand,
2987
+ sendMessage,
2988
+ handleBangLine: runLocalShellLine
2989
+ });
2990
+ editor.onEscape = () => {
2991
+ abortActive();
2992
+ };
2993
+ editor.onCtrlC = () => {
2994
+ const now = Date.now();
2995
+ if (editor.getText().trim().length > 0) {
2996
+ editor.setText("");
2997
+ setActivityStatus("cleared input");
2998
+ tui.requestRender();
2999
+ return;
3000
+ }
3001
+ if (now - lastCtrlCAt < 1e3) {
3002
+ client.stop();
3003
+ tui.stop();
3004
+ process.exit(0);
3005
+ }
3006
+ lastCtrlCAt = now;
3007
+ setActivityStatus("press ctrl+c again to exit");
3008
+ tui.requestRender();
3009
+ };
3010
+ editor.onCtrlD = () => {
3011
+ client.stop();
3012
+ tui.stop();
3013
+ process.exit(0);
3014
+ };
3015
+ editor.onCtrlO = () => {
3016
+ toolsExpanded = !toolsExpanded;
3017
+ chatLog.setToolsExpanded(toolsExpanded);
3018
+ setActivityStatus(toolsExpanded ? "tools expanded" : "tools collapsed");
3019
+ tui.requestRender();
3020
+ };
3021
+ editor.onCtrlL = () => {
3022
+ openModelSelector();
3023
+ };
3024
+ editor.onCtrlG = () => {
3025
+ openAgentSelector();
3026
+ };
3027
+ editor.onCtrlP = () => {
3028
+ openSessionSelector();
3029
+ };
3030
+ editor.onCtrlT = () => {
3031
+ showThinking = !showThinking;
3032
+ loadHistory();
3033
+ };
3034
+ client.onEvent = (evt) => {
3035
+ if (evt.event === "chat") handleChatEvent(evt.payload);
3036
+ if (evt.event === "agent") handleAgentEvent(evt.payload);
3037
+ };
3038
+ client.onConnected = () => {
3039
+ isConnected = true;
3040
+ const reconnected = wasDisconnected;
3041
+ wasDisconnected = false;
3042
+ setConnectionStatus("connected");
3043
+ (async () => {
3044
+ await refreshAgents();
3045
+ updateHeader();
3046
+ if (!reconnected) {
3047
+ const bannerArt = formatCliBannerArt({ richTty: true });
3048
+ const subtitle = `${theme.dim("Wishing Engine")}`;
3049
+ const hint = theme.dim("Type a wish below to begin");
3050
+ chatLog.addChild(new Text(`\n${bannerArt}\n${subtitle}\n${hint}`, 1, 1));
3051
+ }
3052
+ await loadHistory();
3053
+ setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4e3);
3054
+ tui.requestRender();
3055
+ if (!autoMessageSent && autoMessage) {
3056
+ autoMessageSent = true;
3057
+ await sendMessage(autoMessage);
3058
+ }
3059
+ updateFooter();
3060
+ tui.requestRender();
3061
+ })();
3062
+ };
3063
+ client.onDisconnected = (reason) => {
3064
+ isConnected = false;
3065
+ wasDisconnected = true;
3066
+ historyLoaded = false;
3067
+ setConnectionStatus(`gateway disconnected: ${reason?.trim() ? reason.trim() : "closed"}`, 5e3);
3068
+ setActivityStatus("idle");
3069
+ updateFooter();
3070
+ tui.requestRender();
3071
+ };
3072
+ client.onGap = (info) => {
3073
+ setConnectionStatus(`event gap: expected ${info.expected}, got ${info.received}`, 5e3);
3074
+ tui.requestRender();
3075
+ };
3076
+ updateHeader();
3077
+ setConnectionStatus("connecting");
3078
+ updateFooter();
3079
+ tui.start();
3080
+ client.start();
3081
+ await new Promise((resolve) => {
3082
+ const finish = () => resolve();
3083
+ process.once("exit", finish);
3084
+ process.once("SIGINT", finish);
3085
+ process.once("SIGTERM", finish);
3086
+ });
3087
+ }
3088
+
3089
+ //#endregion
3090
+ export { hasEmittedCliBanner as i, emitCliBanner as n, formatCliBannerLine as r, runTui as t };