@pixelzx/genesis 2026.6.6-1 → 2026.6.7

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 (1890) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/.buildstamp +1 -1
  3. package/dist/abort-FuQvBD6U.js +201 -0
  4. package/dist/abort-cutoff.runtime-DhhkmUom.js +20 -0
  5. package/dist/abort-cutoff.runtime.js +1 -1
  6. package/dist/abort.runtime-B3IgkoFt.js +2 -0
  7. package/dist/abort.runtime.js +1 -1
  8. package/dist/accounts-BPUJOLhQ.js +66 -0
  9. package/dist/accounts-CAneScu8.js +104 -0
  10. package/dist/accounts-CHR1oSF7.js +43 -0
  11. package/dist/accounts-CJ6NSXHe.js +2 -0
  12. package/dist/accounts-DIkEzenx.js +365 -0
  13. package/dist/accounts-DSBZWK21.js +107 -0
  14. package/dist/accounts.runtime-CbxAqfkd.js +2 -0
  15. package/dist/accounts.runtime.js +1 -1
  16. package/dist/acp-cli-ogRPWqZT.js +2217 -0
  17. package/dist/acp-spawn-8dy4yT3V.js +2 -0
  18. package/dist/acp-spawn-BjYzM6z-.js +1093 -0
  19. package/dist/acp-stateful-target-driver-BycE6-83.js +89 -0
  20. package/dist/action-agents-l7277wqt.js +67 -0
  21. package/dist/action-focus-Dl60p5pD.js +132 -0
  22. package/dist/action-help-DxLv4lVR.js +7 -0
  23. package/dist/action-info-DL9E3-WR.js +101 -0
  24. package/dist/action-kill-D9o9OmhF.js +33 -0
  25. package/dist/action-list-CHZdMgmX.js +21 -0
  26. package/dist/action-log-CU2gXtSM.js +30 -0
  27. package/dist/action-send-Bh6VyKBO.js +39 -0
  28. package/dist/action-spawn-CRh30i-w.js +47 -0
  29. package/dist/action-unfocus-DWfvqVUr.js +29 -0
  30. package/dist/actions.runtime-CSqrY29N.js +18 -0
  31. package/dist/actions.runtime-DfxS3edG.js +5 -0
  32. package/dist/actions.runtime.js +1 -1
  33. package/dist/agent-command-VhOY45sc.js +874 -0
  34. package/dist/agent-delivery-KWJUVuVh.js +76 -0
  35. package/dist/agent-harness-runtime-BMQd9IQM.js +144 -0
  36. package/dist/agent-rstdDGqC.js +2 -0
  37. package/dist/agent-runner-utils-B6emOCxL.js +239 -0
  38. package/dist/agent-runner.runtime-Dt9pfuFv.js +3455 -0
  39. package/dist/agent-runner.runtime.js +1 -1
  40. package/dist/agent-runtime-D5sio5gj.js +18 -0
  41. package/dist/agents-DETbymgH.js +5 -0
  42. package/dist/agents-JnpGV0Mg.js +954 -0
  43. package/dist/agents.command-shared-DP-GYkQM.js +40 -0
  44. package/dist/aliases-CjpePDVQ.js +96 -0
  45. package/dist/aliases-Doxg0x1v.js +2 -0
  46. package/dist/api-3RLMm-sv.js +48 -0
  47. package/dist/api-BFMX7Y4G.js +139 -0
  48. package/dist/api-DNZZlJ9_.js +3 -0
  49. package/dist/api-DT7zQn5K.js +5 -0
  50. package/dist/api-Dg7zYoZ_.js +3 -0
  51. package/dist/api-cghJ3F6o.js +4 -0
  52. package/dist/apply-DfMBIGyY.js +508 -0
  53. package/dist/apply.runtime-C0oOWIW8.js +2 -0
  54. package/dist/apply.runtime.js +1 -1
  55. package/dist/approval-client-helpers-D2LpKFDf.js +82 -0
  56. package/dist/approval-delivery-helpers-CmhRlLZJ.js +134 -0
  57. package/dist/approval-gateway-resolver-BjqCdv8k.js +29 -0
  58. package/dist/approval-gateway-runtime-vc_h56PW.js +2 -0
  59. package/dist/approval-handler-runtime-CLi8o4N6.js +439 -0
  60. package/dist/approval-native-helpers-BJTvZT00.js +33 -0
  61. package/dist/approval-native-runtime-BCglJkGQ.js +729 -0
  62. package/dist/approval-renderers-B2Vy1H8m.js +64 -0
  63. package/dist/attempt-execution.runtime-BJ2ggQLO.js +509 -0
  64. package/dist/attempt-execution.runtime.js +1 -1
  65. package/dist/attempt-execution.shared-drVqEuBX.js +22 -0
  66. package/dist/attempt.prompt-helpers-CPOKGBRq.js +221 -0
  67. package/dist/attempt.tool-run-context-b245l8XM.js +933 -0
  68. package/dist/audit-DTHRJzg2.js +939 -0
  69. package/dist/audit-membership-runtime-BJqpONbJ.js +550 -0
  70. package/dist/audit.runtime-CX2MkQvJ.js +7 -0
  71. package/dist/audit.runtime.js +1 -1
  72. package/dist/auth-4Bm-1bcd.js +177 -0
  73. package/dist/auth-BZdTw_F-.js +56 -0
  74. package/dist/auth-CuwCoyT1.js +550 -0
  75. package/dist/auth-DIgzPDDK.js +2 -0
  76. package/dist/auth-order-BY3KAiKC.js +2 -0
  77. package/dist/auth-order-Dg56giIe.js +139 -0
  78. package/dist/base-url-C558HJO5.js +15 -0
  79. package/dist/bash-tools-CfDemvWu.js +2824 -0
  80. package/dist/bash-tools-Dn5gcYvt.js +3 -0
  81. package/dist/bash-tools.exec-runtime-dke732lC.js +829 -0
  82. package/dist/best-effort-delivery-DljQXVME.js +22 -0
  83. package/dist/binding-routing-DR_67bg0.js +85 -0
  84. package/dist/binding-targets-DTa463kX.js +121 -0
  85. package/dist/block-streaming-CSQXIKzf.js +103 -0
  86. package/dist/bluebubbles-Ct06wUcN.js +77 -0
  87. package/dist/brave-web-search-provider-CXpJbGgI.js +111 -0
  88. package/dist/brave-web-search-provider.runtime-wY0sclse.js +229 -0
  89. package/dist/brave-web-search-provider.runtime.js +1 -1
  90. package/dist/brave-web-search-provider.shared-CRDSDuDf.js +174 -0
  91. package/dist/bridge-auth-registry-BorAQxuW.js +23 -0
  92. package/dist/bridge-server-BjsnFWH5.js +113 -0
  93. package/dist/browser-control-auth-K_ABcymZ.js +2 -0
  94. package/dist/browser-node-runtime-Djr0LEX4.js +12 -0
  95. package/dist/browser-profiles-D-JVGcFQ.js +2 -0
  96. package/dist/browser-runtime-Dtu4pSLX.js +387 -0
  97. package/dist/browser-setup-tools-DOMK1dxP.js +13 -0
  98. package/dist/build-DIqCC9wY.js +550 -0
  99. package/dist/build-info.json +3 -3
  100. package/dist/bundled/boot-md/handler.js +3 -3
  101. package/dist/bundled/session-memory/handler.js +1 -1
  102. package/dist/call-CBwbz0Y_.js +3 -0
  103. package/dist/call-CMzLsAeQ.js +331 -0
  104. package/dist/call-status-D_PRqurB.js +33 -0
  105. package/dist/call.runtime-TShzrwtE.js +2 -0
  106. package/dist/call.runtime.js +1 -1
  107. package/dist/capability-cli-eqSRFvPG.js +1401 -0
  108. package/dist/card-command-DgCNU0bS.js +241 -0
  109. package/dist/catalog-provider-BQCfbyPd.js +40 -0
  110. package/dist/catchup-B0RMVns9.js +300 -0
  111. package/dist/channel-35I4A3FQ.js +1802 -0
  112. package/dist/channel-B68Jn_67.js +491 -0
  113. package/dist/channel-BpHCHrCO.js +350 -0
  114. package/dist/channel-CLV2rd5J.js +1174 -0
  115. package/dist/channel-COt8yEeA.js +226 -0
  116. package/dist/channel-CQOr5HA2.js +595 -0
  117. package/dist/channel-CY88u47q.js +1100 -0
  118. package/dist/channel-Cz5FQxuV.js +1320 -0
  119. package/dist/channel-_FIMA_4n.js +840 -0
  120. package/dist/channel-core-DH_fXGdB.js +5 -0
  121. package/dist/channel-inbound-DsSKYRQk.js +31 -0
  122. package/dist/channel-kbFJLAok.js +453 -0
  123. package/dist/channel-plugin-runtime-1zw5fP7e.js +771 -0
  124. package/dist/channel-resolution-BQCJwoVA.js +39 -0
  125. package/dist/channel-runtime-DKTzKZrY.js +425 -0
  126. package/dist/channel-selection-CfVNh5Ma.js +126 -0
  127. package/dist/channel-selection.runtime-5JjJNFm5.js +2 -0
  128. package/dist/channel-selection.runtime.js +1 -1
  129. package/dist/channel-t7y5VhIk.js +297 -0
  130. package/dist/channel.runtime-BxFS1fqc.js +26 -0
  131. package/dist/channel.runtime-C4vTK1SO.js +576 -0
  132. package/dist/channel.runtime-Cb5xElcA.js +42398 -0
  133. package/dist/channel.runtime-Cg2IHutr.js +89 -0
  134. package/dist/channel.runtime-CuDcjlCH.js +4 -0
  135. package/dist/channel.runtime-DhuYxzU_.js +67 -0
  136. package/dist/channel.runtime-LtoAmHpA.js +2364 -0
  137. package/dist/channel.runtime-fe2tuhl7.js +430 -0
  138. package/dist/channel.runtime.js +1 -1
  139. package/dist/channel.setup-De742gXr.js +10 -0
  140. package/dist/channel2.runtime-D0-Q3OqX.js +109 -0
  141. package/dist/channel2.runtime.js +1 -1
  142. package/dist/channels-Dg381GJl.js +733 -0
  143. package/dist/channels-cli-C4Mv5lRD.js +268 -0
  144. package/dist/chat-DraQ_Vnc.js +2830 -0
  145. package/dist/chrome-NuBBXoKP.js +1430 -0
  146. package/dist/chrome-mcp-Bzn6x9ZE.js +2 -0
  147. package/dist/chrome-mcp-JcJrSyd_.js +600 -0
  148. package/dist/chrome.executables-B2fHBMhv.js +541 -0
  149. package/dist/chunk-nFZYBJd4.js +268 -0
  150. package/dist/clawbot-cli-BZ5Ho8RJ.js +9 -0
  151. package/dist/cli/daemon-cli.js +3 -3
  152. package/dist/cli-B8D7xwgW.js +2 -0
  153. package/dist/cli-BbCsXDcy.js +2 -0
  154. package/dist/cli-Ct2Cgbp8.js +154 -0
  155. package/dist/cli-D1e_2N91.js +3726 -0
  156. package/dist/cli-D8pyHyFi.js +72 -0
  157. package/dist/cli-eRz4BLSt.js +2 -0
  158. package/dist/cli-mD8ZWE4Y.js +219 -0
  159. package/dist/cli-runner-BVFPfETV.js +286 -0
  160. package/dist/cli-runner.runtime-CcxMMyO0.js +3 -0
  161. package/dist/cli-runner.runtime-MmlDBELB.js +4 -0
  162. package/dist/cli-runner.runtime.js +1 -1
  163. package/dist/cli-startup-metadata.json +2 -2
  164. package/dist/cli.runtime-CG9Epd6c.js +1261 -0
  165. package/dist/cli.runtime.js +1 -1
  166. package/dist/client-BtyYQE4I.js +713 -0
  167. package/dist/client-XqW1gKEi.js +138 -0
  168. package/dist/client-info-DeQMz3zN.js +52 -0
  169. package/dist/command-auth-C8YZ7xNT.js +409 -0
  170. package/dist/command-auth-CZjLC0A5.js +76 -0
  171. package/dist/command-config-resolution-C42_gG_b.js +2 -0
  172. package/dist/command-config-resolution-DGrpZjql.js +23 -0
  173. package/dist/command-config-resolution.runtime-D8PGJbcf.js +2 -0
  174. package/dist/command-config-resolution.runtime.js +1 -1
  175. package/dist/command-execution-startup-LCePq-pd.js +324 -0
  176. package/dist/command-gates-C1GpyUaI.js +47 -0
  177. package/dist/command-registry-Brd-fdF6.js +9 -0
  178. package/dist/command-registry-C9XhD-0z.js +4 -0
  179. package/dist/command-registry-core-BBFaOPyw.js +106 -0
  180. package/dist/command-secret-gateway-_i9GgsPE.js +528 -0
  181. package/dist/command-status.runtime-C-azOR6K.js +87 -0
  182. package/dist/command-status.runtime.js +1 -1
  183. package/dist/commands-acp-cpGZ404g.js +77 -0
  184. package/dist/commands-compact.runtime-CXWGv2V6.js +10 -0
  185. package/dist/commands-compact.runtime.js +1 -1
  186. package/dist/commands-context-DZzZWgOe.js +38 -0
  187. package/dist/commands-core.runtime-BqbYtFGd.js +2 -0
  188. package/dist/commands-core.runtime.js +1 -1
  189. package/dist/commands-handlers.runtime-BcIJeLbE.js +4599 -0
  190. package/dist/commands-handlers.runtime.js +1 -1
  191. package/dist/commands-models-BScPCL8E.js +327 -0
  192. package/dist/commands-reset-hooks-5uvV2mDE.js +135 -0
  193. package/dist/commands-status-CIyza-rp.js +16 -0
  194. package/dist/commands-status.runtime-CqMsNHJz.js +3 -0
  195. package/dist/commands-status.runtime.js +1 -1
  196. package/dist/commands-subagents-control.runtime-BVTHxVDG.js +2 -0
  197. package/dist/commands-subagents-control.runtime-DdiL_B5Y.js +3 -0
  198. package/dist/commands-subagents-control.runtime.js +1 -1
  199. package/dist/commands-system-prompt-DCmABzHv.js +158 -0
  200. package/dist/commands-system-prompt-DsWVuYqh.js +2 -0
  201. package/dist/commands.runtime-CBu1iNc5.js +167 -0
  202. package/dist/commands.runtime.js +1 -1
  203. package/dist/compact-OC23uUnx.js +1118 -0
  204. package/dist/compact.runtime-BnEUkxbT.js +12 -0
  205. package/dist/compact.runtime.js +1 -1
  206. package/dist/completion-cli-Dazyh2sJ.js +328 -0
  207. package/dist/config-BQkNdc69.js +252 -0
  208. package/dist/config-api-BKYSOnnY.js +2 -0
  209. package/dist/config-cli-DLlHp2db.js +1078 -0
  210. package/dist/config-compat-BIX-j6Si.js +130 -0
  211. package/dist/config-compat-BwlAvvWb.js +126 -0
  212. package/dist/config-guard-MokLrRXO.js +96 -0
  213. package/dist/config-runtime-EDLCUCSu.js +32 -0
  214. package/dist/configure-Bb8n7ry_.js +1252 -0
  215. package/dist/configure-_pHM_yQw.js +2 -0
  216. package/dist/connect-options-3xkNjdH1.js +699 -0
  217. package/dist/control-auth-BXNajQ4N.js +125 -0
  218. package/dist/control-service-89oBONRk.js +156 -0
  219. package/dist/control-ui/assets/agents-BQsvYsmp.js +1052 -0
  220. package/dist/control-ui/assets/canvas-D92UKk4C.js +269 -0
  221. package/dist/control-ui/assets/channels-B23D1XmP.js +463 -0
  222. package/dist/control-ui/assets/cron-CYzrBBv6.js +933 -0
  223. package/dist/control-ui/assets/debug-C8av-vpc.js +94 -0
  224. package/dist/control-ui/assets/index-ChL66WCS.js +6238 -0
  225. package/dist/control-ui/assets/index-Dq9zdUBj.css +1 -0
  226. package/dist/control-ui/assets/instances-qfDdYtE0.js +57 -0
  227. package/dist/control-ui/assets/mcp-CipBqkHK.js +373 -0
  228. package/dist/control-ui/assets/nodes-WP7e87Mm.js +618 -0
  229. package/dist/control-ui/assets/plugins-BZGJKpWs.js +273 -0
  230. package/dist/control-ui/assets/sessions-7NbJpVyg.js +306 -0
  231. package/dist/control-ui/assets/skills-hW_GTRp3.js +323 -0
  232. package/dist/control-ui/assets/wallet-Bga18qp4.js +285 -0
  233. package/dist/control-ui/index.html +2 -2
  234. package/dist/control-ui-nxEuCu7Y.js +1043 -0
  235. package/dist/conversation-id-BXdEWBuk.js +38 -0
  236. package/dist/conversation-id-HnQrCUJb.js +235 -0
  237. package/dist/conversation-runtime-DOPjHG-D.js +31 -0
  238. package/dist/core-BglliBki.js +275 -0
  239. package/dist/create-DcvM0ElD.js +80 -0
  240. package/dist/cron-cli-DbZllbTi.js +713 -0
  241. package/dist/daemon-cli-BCP6oYnN.js +12 -0
  242. package/dist/dashboard-74d-EIMB.js +81 -0
  243. package/dist/dashboard-C0aOhuxv.js +2 -0
  244. package/dist/ddg-client-DUe6RTVg.js +147 -0
  245. package/dist/ddg-search-provider-Bm0jAm4h.js +54 -0
  246. package/dist/delegate-0l_cL2en.js +64 -0
  247. package/dist/deliver-BbAfYPEn.js +3 -0
  248. package/dist/deliver-DmZnoo4L.js +747 -0
  249. package/dist/deliver-runtime-5H2EYniG.js +2 -0
  250. package/dist/delivery-context-DP5JLMHJ.js +40 -0
  251. package/dist/delivery-outbound.runtime-DQEeDEsu.js +6 -0
  252. package/dist/delivery-outbound.runtime.js +1 -1
  253. package/dist/delivery.runtime-Bi7HZGxD.js +253 -0
  254. package/dist/delivery.runtime.js +1 -1
  255. package/dist/detached-task-runtime-DlQ3fJk5.js +73 -0
  256. package/dist/devices-cli-BLCk402O.js +498 -0
  257. package/dist/diagnostics-Ccv6wIwn.js +154 -0
  258. package/dist/direct-dm-lEcFUgjs.js +64 -0
  259. package/dist/directive-handling.fast-lane-Cp4AUlKY.js +66 -0
  260. package/dist/directive-handling.impl-5h27Bn7L.js +703 -0
  261. package/dist/directive-handling.impl-XC63bDbc.js +2 -0
  262. package/dist/directive-handling.model-selection-D0aMABmk.js +114 -0
  263. package/dist/directive-handling.persist.runtime-DDNAkC4Z.js +215 -0
  264. package/dist/directive-handling.persist.runtime.js +1 -1
  265. package/dist/directive-handling.shared-DyVSHQBC.js +56 -0
  266. package/dist/directory-cli-CDvyD_lg.js +240 -0
  267. package/dist/dispatch-Dd327enz.js +1131 -0
  268. package/dist/dispatch-acp-6k3pJubU.js +981 -0
  269. package/dist/dispatch-acp-manager.runtime-B7qhOTmA.js +3 -0
  270. package/dist/dispatch-acp-manager.runtime.js +1 -1
  271. package/dist/dispatch-acp-media.runtime-Dh6QaiKm.js +4 -0
  272. package/dist/dispatch-acp-media.runtime.js +1 -1
  273. package/dist/dispatch-acp-session.runtime-DIcbAze4.js +2 -0
  274. package/dist/dispatch-acp-session.runtime.js +1 -1
  275. package/dist/dispatch-acp.runtime-25XWZDxg.js +19 -0
  276. package/dist/dispatch-acp.runtime.js +1 -1
  277. package/dist/doctor-config-flow-sE-lNSad.js +420 -0
  278. package/dist/doctor-config-preflight-VYCO67J4.js +63 -0
  279. package/dist/doctor-config-preflight-qSk2JNLg.js +2 -0
  280. package/dist/doctor-contract-BAsLLlR_.js +26 -0
  281. package/dist/doctor-device-pairing-BXDxtsmA.js +307 -0
  282. package/dist/doctor-gateway-daemon-flow-CHRWhGJG.js +250 -0
  283. package/dist/doctor-gateway-health-B04Kph1-.js +63 -0
  284. package/dist/doctor-health-contributions-Di1lbh4V.js +493 -0
  285. package/dist/doctor-health-vZ_aKkfh.js +59 -0
  286. package/dist/doctor-prompter-Cr1NyTHN.js +56 -0
  287. package/dist/doctor-sandbox-CrC9AbfL.js +194 -0
  288. package/dist/doctor-state-migrations-tkILPnwB.js +2 -0
  289. package/dist/doctor-workspace-status-CPUsFX3w.js +75 -0
  290. package/dist/dreaming-CeLuSaLi.js +1582 -0
  291. package/dist/dreaming-narrative-gKfNqC2s.js +596 -0
  292. package/dist/dreaming-shared-BLs-EJbE.js +21 -0
  293. package/dist/embedded-gateway-stub.runtime-8jv6iwO4.js +9 -0
  294. package/dist/embedded-gateway-stub.runtime.js +1 -1
  295. package/dist/embeddings-CSeRG-6f.js +215 -0
  296. package/dist/embeddings-http-9k11WSE6.js +205 -0
  297. package/dist/entry.js +2 -2
  298. package/dist/exa-web-search-provider-DeSQ1lkN.js +80 -0
  299. package/dist/exa-web-search-provider.runtime-BHWIPnmu.js +302 -0
  300. package/dist/exa-web-search-provider.runtime-C84CVfco.js +2 -0
  301. package/dist/exa-web-search-provider.runtime.js +1 -1
  302. package/dist/exec-approval-forwarder.runtime-BMw0YxXn.js +3 -0
  303. package/dist/exec-approval-forwarder.runtime.js +1 -1
  304. package/dist/exec-approval-reply-BTNXbvSi.js +2 -0
  305. package/dist/exec-approval-reply-BVINNdDT.js +296 -0
  306. package/dist/exec-approval-session-target-BclZJwRq.js +176 -0
  307. package/dist/exec-approvals-cli-BvRs9Hvl.js +498 -0
  308. package/dist/exec-defaults-BzfzJhdd.js +2 -0
  309. package/dist/exec-defaults-DJtYK-Wg.js +67 -0
  310. package/dist/execute.runtime-C-v-Cnhl.js +1363 -0
  311. package/dist/execute.runtime.js +1 -1
  312. package/dist/extensionAPI.js +3 -3
  313. package/dist/extensions/active-memory/index.js +3 -3
  314. package/dist/extensions/bluebubbles/api.js +3 -3
  315. package/dist/extensions/bluebubbles/channel-plugin-api.js +1 -1
  316. package/dist/extensions/brave/index.js +1 -1
  317. package/dist/extensions/brave/test-api.js +1 -1
  318. package/dist/extensions/brave/web-search-provider.js +1 -1
  319. package/dist/extensions/browser/browser-bridge.js +1 -1
  320. package/dist/extensions/browser/browser-config.js +4 -4
  321. package/dist/extensions/browser/browser-control-auth.js +2 -2
  322. package/dist/extensions/browser/browser-doctor.js +5 -5
  323. package/dist/extensions/browser/browser-host-inspection.js +1 -1
  324. package/dist/extensions/browser/browser-maintenance.js +2 -2
  325. package/dist/extensions/browser/browser-profiles.js +2 -2
  326. package/dist/extensions/browser/browser-runtime-api.js +14 -14
  327. package/dist/extensions/browser/index.js +1 -1
  328. package/dist/extensions/browser/plugin-registration.js +1 -1
  329. package/dist/extensions/browser/register.runtime.js +3 -3
  330. package/dist/extensions/browser/runtime-api.js +15 -15
  331. package/dist/extensions/browser/setup-api.js +2 -2
  332. package/dist/extensions/browser/test-support.js +1 -1
  333. package/dist/extensions/byteplus/index.js +1 -1
  334. package/dist/extensions/byteplus/video-generation-provider.js +1 -1
  335. package/dist/extensions/chutes/api.js +3 -3
  336. package/dist/extensions/chutes/index.js +4 -4
  337. package/dist/extensions/chutes/models.js +1 -1
  338. package/dist/extensions/chutes/onboard.js +2 -2
  339. package/dist/extensions/chutes/provider-catalog.js +1 -1
  340. package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
  341. package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
  342. package/dist/extensions/cloudflare-ai-gateway/index.js +2 -2
  343. package/dist/extensions/comfy/image-generation-provider.js +2 -2
  344. package/dist/extensions/comfy/index.js +3 -3
  345. package/dist/extensions/comfy/music-generation-provider.js +1 -1
  346. package/dist/extensions/comfy/video-generation-provider.js +2 -2
  347. package/dist/extensions/comfy/workflow-runtime.js +1 -1
  348. package/dist/extensions/deepgram/index.js +1 -1
  349. package/dist/extensions/deepgram/realtime-transcription-provider.js +1 -1
  350. package/dist/extensions/deepgram/test-api.js +1 -1
  351. package/dist/extensions/device-pair/api.js +2 -2
  352. package/dist/extensions/device-pair/index.js +5 -5
  353. package/dist/extensions/device-pair/notify.js +1 -1
  354. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  355. package/dist/extensions/device-pair/qr-image.js +2 -2
  356. package/dist/extensions/duckduckgo/index.js +1 -1
  357. package/dist/extensions/duckduckgo/web-search-provider.js +1 -1
  358. package/dist/extensions/elevenlabs/config-compat.js +1 -1
  359. package/dist/extensions/elevenlabs/contract-api.js +2 -2
  360. package/dist/extensions/elevenlabs/doctor-contract.js +2 -2
  361. package/dist/extensions/elevenlabs/index.js +2 -2
  362. package/dist/extensions/elevenlabs/realtime-transcription-provider.js +1 -1
  363. package/dist/extensions/elevenlabs/setup-api.js +1 -1
  364. package/dist/extensions/elevenlabs/speech-provider.js +1 -1
  365. package/dist/extensions/elevenlabs/test-api.js +2 -2
  366. package/dist/extensions/exa/index.js +1 -1
  367. package/dist/extensions/exa/test-api.js +1 -1
  368. package/dist/extensions/exa/web-search-provider.js +1 -1
  369. package/dist/extensions/fal/image-generation-provider.js +1 -1
  370. package/dist/extensions/fal/index.js +2 -2
  371. package/dist/extensions/fal/test-api.js +2 -2
  372. package/dist/extensions/fal/video-generation-provider.js +1 -1
  373. package/dist/extensions/firecrawl/api.js +1 -1
  374. package/dist/extensions/github-copilot/api.js +1 -1
  375. package/dist/extensions/github-copilot/auth.js +1 -1
  376. package/dist/extensions/github-copilot/embeddings.js +1 -1
  377. package/dist/extensions/github-copilot/index.js +6 -6
  378. package/dist/extensions/github-copilot/login.js +1 -1
  379. package/dist/extensions/github-copilot/models-defaults.js +1 -1
  380. package/dist/extensions/github-copilot/models.js +1 -1
  381. package/dist/extensions/github-copilot/register.runtime.js +1 -1
  382. package/dist/extensions/github-copilot/replay-policy.js +1 -1
  383. package/dist/extensions/google-meet/index.js +5 -5
  384. package/dist/extensions/huggingface/api.js +3 -3
  385. package/dist/extensions/huggingface/index.js +2 -2
  386. package/dist/extensions/huggingface/models.js +1 -1
  387. package/dist/extensions/huggingface/onboard.js +1 -1
  388. package/dist/extensions/huggingface/provider-catalog.js +2 -2
  389. package/dist/extensions/imessage/api.js +5 -5
  390. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  391. package/dist/extensions/imessage/contract-api.js +2 -2
  392. package/dist/extensions/imessage/media-contract-api.js +2 -2
  393. package/dist/extensions/imessage/runtime-api.js +5 -5
  394. package/dist/extensions/imessage/test-api.js +2 -2
  395. package/dist/extensions/irc/api.js +2 -2
  396. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  397. package/dist/extensions/kilocode/api.js +2 -2
  398. package/dist/extensions/kilocode/index.js +3 -3
  399. package/dist/extensions/kilocode/onboard.js +2 -2
  400. package/dist/extensions/kilocode/provider-catalog.js +1 -1
  401. package/dist/extensions/kilocode/provider-models.js +1 -1
  402. package/dist/extensions/kilocode/shared.js +1 -1
  403. package/dist/extensions/kimi-coding/index.js +2 -2
  404. package/dist/extensions/kimi-coding/stream.js +1 -1
  405. package/dist/extensions/line/api.js +2 -2
  406. package/dist/extensions/line/channel-plugin-api.js +1 -1
  407. package/dist/extensions/line/contract-api.js +1 -1
  408. package/dist/extensions/line/index.js +1 -1
  409. package/dist/extensions/line/runtime-api.js +7 -7
  410. package/dist/extensions/line/setup-api.js +1 -1
  411. package/dist/extensions/llm-task/index.js +1 -1
  412. package/dist/extensions/lmstudio/api.js +1 -1
  413. package/dist/extensions/lmstudio/index.js +2 -2
  414. package/dist/extensions/lmstudio/memory-embedding-adapter.js +1 -1
  415. package/dist/extensions/lmstudio/runtime-api.js +1 -1
  416. package/dist/extensions/lobster/runtime-api.js +1 -1
  417. package/dist/extensions/mattermost/api.js +1 -1
  418. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  419. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  420. package/dist/extensions/mattermost/policy-api.js +1 -1
  421. package/dist/extensions/mattermost/runtime-api.js +9 -9
  422. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  423. package/dist/extensions/memory-core/api.js +1 -1
  424. package/dist/extensions/memory-core/cli-metadata.js +2 -2
  425. package/dist/extensions/memory-core/index.js +9 -9
  426. package/dist/extensions/memory-core/manager-runtime.js +1 -1
  427. package/dist/extensions/memory-core/runtime-api.js +4 -4
  428. package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
  429. package/dist/extensions/memory-lancedb/index.js +2 -2
  430. package/dist/extensions/memory-wiki/cli-metadata.js +1 -1
  431. package/dist/extensions/memory-wiki/index.js +1 -1
  432. package/dist/extensions/microsoft/index.js +1 -1
  433. package/dist/extensions/microsoft/speech-provider.js +1 -1
  434. package/dist/extensions/microsoft/test-api.js +1 -1
  435. package/dist/extensions/microsoft/tts.js +1 -1
  436. package/dist/extensions/microsoft-foundry/auth.js +1 -1
  437. package/dist/extensions/microsoft-foundry/cli.js +1 -1
  438. package/dist/extensions/microsoft-foundry/index.js +1 -1
  439. package/dist/extensions/microsoft-foundry/onboard.js +2 -2
  440. package/dist/extensions/microsoft-foundry/provider.js +1 -1
  441. package/dist/extensions/microsoft-foundry/runtime.js +1 -1
  442. package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
  443. package/dist/extensions/microsoft-foundry/shared.js +1 -1
  444. package/dist/extensions/minimax/index.js +5 -5
  445. package/dist/extensions/minimax/music-generation-provider.js +1 -1
  446. package/dist/extensions/minimax/provider-registration.js +1 -1
  447. package/dist/extensions/minimax/speech-provider.js +1 -1
  448. package/dist/extensions/minimax/test-api.js +3 -3
  449. package/dist/extensions/minimax/video-generation-provider.js +1 -1
  450. package/dist/extensions/minimax/web-search-provider.js +1 -1
  451. package/dist/extensions/mistral/index.js +2 -2
  452. package/dist/extensions/mistral/provider-compat.js +1 -1
  453. package/dist/extensions/mistral/realtime-transcription-provider.js +1 -1
  454. package/dist/extensions/mistral/test-api.js +1 -1
  455. package/dist/extensions/moonshot/index.js +1 -1
  456. package/dist/extensions/moonshot/test-api.js +1 -1
  457. package/dist/extensions/moonshot/web-search-provider.js +1 -1
  458. package/dist/extensions/msteams/api.js +1 -1
  459. package/dist/extensions/msteams/channel-plugin-api.js +1 -1
  460. package/dist/extensions/msteams/runtime-api.js +4 -4
  461. package/dist/extensions/msteams/test-api.js +1 -1
  462. package/dist/extensions/nextcloud-talk/api.js +1 -1
  463. package/dist/extensions/nextcloud-talk/channel-plugin-api.js +1 -1
  464. package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
  465. package/dist/extensions/ollama/api.js +3 -3
  466. package/dist/extensions/ollama/index.js +5 -5
  467. package/dist/extensions/ollama/runtime-api.js +1 -1
  468. package/dist/extensions/ollama/web-search-provider.js +1 -1
  469. package/dist/extensions/openai/api.js +4 -4
  470. package/dist/extensions/openai/base-url.js +1 -1
  471. package/dist/extensions/openai/image-generation-provider.js +1 -1
  472. package/dist/extensions/openai/index.js +8 -8
  473. package/dist/extensions/openai/native-web-search.js +1 -1
  474. package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
  475. package/dist/extensions/openai/openai-codex-device-code.js +1 -1
  476. package/dist/extensions/openai/openai-codex-provider.js +1 -1
  477. package/dist/extensions/openai/openai-codex-shared.js +1 -1
  478. package/dist/extensions/openai/openai-provider.js +1 -1
  479. package/dist/extensions/openai/realtime-provider-shared.js +1 -1
  480. package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
  481. package/dist/extensions/openai/realtime-voice-provider.js +1 -1
  482. package/dist/extensions/openai/register.runtime.js +6 -6
  483. package/dist/extensions/openai/shared.js +1 -1
  484. package/dist/extensions/openai/speech-provider.js +1 -1
  485. package/dist/extensions/openai/test-api.js +5 -5
  486. package/dist/extensions/openai/transport-policy.js +1 -1
  487. package/dist/extensions/openai/video-generation-provider.js +1 -1
  488. package/dist/extensions/opencode/index.js +1 -1
  489. package/dist/extensions/openrouter/api.js +2 -2
  490. package/dist/extensions/openrouter/image-generation-provider.js +1 -1
  491. package/dist/extensions/openrouter/index.js +2 -2
  492. package/dist/extensions/openrouter/register.runtime.js +1 -1
  493. package/dist/extensions/openrouter/speech-provider.js +1 -1
  494. package/dist/extensions/openrouter/test-api.js +2 -2
  495. package/dist/extensions/openshell/index.js +4 -4
  496. package/dist/extensions/perplexity/index.js +1 -1
  497. package/dist/extensions/perplexity/test-api.js +1 -1
  498. package/dist/extensions/perplexity/web-search-provider.js +1 -1
  499. package/dist/extensions/phone-control/index.js +1 -1
  500. package/dist/extensions/runway/index.js +1 -1
  501. package/dist/extensions/runway/video-generation-provider.js +1 -1
  502. package/dist/extensions/signal/api.js +11 -11
  503. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  504. package/dist/extensions/signal/contract-api.js +2 -2
  505. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  506. package/dist/extensions/signal/runtime-api.js +14 -14
  507. package/dist/extensions/skill-workshop/api.js +1 -1
  508. package/dist/extensions/skill-workshop/index.js +2 -2
  509. package/dist/extensions/speech-core/runtime-api.js +2 -2
  510. package/dist/extensions/stepfun/index.js +1 -1
  511. package/dist/extensions/synology-chat/api.js +1 -1
  512. package/dist/extensions/synology-chat/channel-plugin-api.js +1 -1
  513. package/dist/extensions/talk-voice/index.js +2 -2
  514. package/dist/extensions/tavily/index.js +2 -2
  515. package/dist/extensions/tavily/web-search-provider.js +1 -1
  516. package/dist/extensions/thread-ownership/index.js +2 -2
  517. package/dist/extensions/tlon/api.js +2 -2
  518. package/dist/extensions/tlon/channel-plugin-api.js +1 -1
  519. package/dist/extensions/tlon/runtime-api.js +1 -1
  520. package/dist/extensions/tlon/setup-api.js +2 -2
  521. package/dist/extensions/tlon/test-api.js +1 -1
  522. package/dist/extensions/together/index.js +1 -1
  523. package/dist/extensions/together/video-generation-provider.js +1 -1
  524. package/dist/extensions/twitch/api.js +1 -1
  525. package/dist/extensions/twitch/channel-plugin-api.js +1 -1
  526. package/dist/extensions/twitch/setup-plugin-api.js +1 -1
  527. package/dist/extensions/venice/api.js +3 -3
  528. package/dist/extensions/venice/index.js +4 -4
  529. package/dist/extensions/venice/models.js +1 -1
  530. package/dist/extensions/venice/onboard.js +2 -2
  531. package/dist/extensions/venice/provider-catalog.js +1 -1
  532. package/dist/extensions/voice-call/index.js +3 -3
  533. package/dist/extensions/voice-call/runtime-entry.js +1 -1
  534. package/dist/extensions/voice-call/setup-api.js +2 -2
  535. package/dist/extensions/vydra/image-generation-provider.js +1 -1
  536. package/dist/extensions/vydra/index.js +3 -3
  537. package/dist/extensions/vydra/shared.js +1 -1
  538. package/dist/extensions/vydra/speech-provider.js +1 -1
  539. package/dist/extensions/vydra/video-generation-provider.js +1 -1
  540. package/dist/extensions/xai/api.js +6 -6
  541. package/dist/extensions/xai/code-execution.js +2 -2
  542. package/dist/extensions/xai/image-generation-provider.js +1 -1
  543. package/dist/extensions/xai/index.js +11 -11
  544. package/dist/extensions/xai/model-definitions.js +1 -1
  545. package/dist/extensions/xai/onboard.js +1 -1
  546. package/dist/extensions/xai/provider-catalog.js +1 -1
  547. package/dist/extensions/xai/provider-models.js +1 -1
  548. package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
  549. package/dist/extensions/xai/setup-api.js +1 -1
  550. package/dist/extensions/xai/speech-provider.js +1 -1
  551. package/dist/extensions/xai/stt.js +1 -1
  552. package/dist/extensions/xai/test-api.js +1 -1
  553. package/dist/extensions/xai/tts.js +2 -2
  554. package/dist/extensions/xai/video-generation-provider.js +1 -1
  555. package/dist/extensions/xai/web-search.js +1 -1
  556. package/dist/extensions/xai/x-search.js +3 -3
  557. package/dist/extensions/zai/api.js +1 -1
  558. package/dist/extensions/zai/index.js +2 -2
  559. package/dist/extensions/zai/onboard.js +1 -1
  560. package/dist/extensions/zalo/api.js +3 -3
  561. package/dist/extensions/zalo/channel-plugin-api.js +1 -1
  562. package/dist/extensions/zalo/runtime-api.js +2 -2
  563. package/dist/extensions/zalo/setup-api.js +2 -2
  564. package/dist/extensions/zalouser/api.js +4 -4
  565. package/dist/extensions/zalouser/channel-plugin-api.js +1 -1
  566. package/dist/extensions/zalouser/runtime-api.js +9 -9
  567. package/dist/extensions/zalouser/setup-plugin-api.js +1 -1
  568. package/dist/extensions/zalouser/test-api.js +4 -4
  569. package/dist/fallbacks-B-hX8uqx.js +2 -0
  570. package/dist/fallbacks-C5ybxGTK.js +31 -0
  571. package/dist/fallbacks-shared-CH3k_pWW.js +111 -0
  572. package/dist/format-DUJSy56G.js +176 -0
  573. package/dist/gateway-BIOe8buh.js +115 -0
  574. package/dist/gateway-cli-DwcS5o3b.js +1283 -0
  575. package/dist/gateway-rpc-DE9eTnTH.js +14 -0
  576. package/dist/gateway-rpc.runtime-BYzSLXq5.js +23 -0
  577. package/dist/gateway-rpc.runtime.js +1 -1
  578. package/dist/gateway-runtime-DNBHtXEc.js +15 -0
  579. package/dist/gateway-status-DQ3SCRP6.js +584 -0
  580. package/dist/genesis-tools-B4E1Wx5r.js +9166 -0
  581. package/dist/genesis-tools.runtime-CvLAzIWm.js +2 -0
  582. package/dist/genesis-tools.runtime.js +1 -1
  583. package/dist/get-reply-D9iaq0Co.js +3897 -0
  584. package/dist/get-reply-from-config.runtime-BFrLyjaS.js +2 -0
  585. package/dist/get-reply-from-config.runtime.js +1 -1
  586. package/dist/graph-users-K6q63hQH.js +1337 -0
  587. package/dist/guarded-json-api-BSwHtzk5.js +594 -0
  588. package/dist/health-BLmYYjhC.js +3 -0
  589. package/dist/health-jQBhWAEn.js +469 -0
  590. package/dist/health-route-ByzzS8xk.js +2 -0
  591. package/dist/health-route-CE-2wbny.js +41 -0
  592. package/dist/heartbeat-runner-D4-13meQ.js +5 -0
  593. package/dist/heartbeat-runner-DIprw7jS.js +1292 -0
  594. package/dist/heartbeat-runner.runtime-B_nY5Qgm.js +4 -0
  595. package/dist/heartbeat-runner.runtime.js +1 -1
  596. package/dist/helpers-DEG_RuMc.js +320 -0
  597. package/dist/hooks-cli-DQay0wq5.js +433 -0
  598. package/dist/http-endpoint-helpers-Cj3QINzs.js +41 -0
  599. package/dist/http-headers-CxAw5CS4.js +11 -0
  600. package/dist/http-utils-BdoY-Nqt.js +924 -0
  601. package/dist/identity-DImc-ABG.js +140 -0
  602. package/dist/image-fallbacks-BPxIecDg.js +31 -0
  603. package/dist/image-fallbacks-C9f2oqy9.js +2 -0
  604. package/dist/image-generation-provider-D1MVlkMK.js +529 -0
  605. package/dist/image-generation-provider-D1xp4B37.js +228 -0
  606. package/dist/image-generation-provider-D78SYbpg.js +274 -0
  607. package/dist/image-generation-provider-KrI_cq7u.js +95 -0
  608. package/dist/image-generation-provider-eiDfurMp.js +157 -0
  609. package/dist/image-generation-provider-iM6hlpJY.js +63 -0
  610. package/dist/inbound-reply-dispatch-Cj041nYj.js +73 -0
  611. package/dist/inbound.runtime-BFDKTetv.js +3 -0
  612. package/dist/inbound.runtime-C9MPsVfj.js +4 -0
  613. package/dist/inbound.runtime.js +1 -1
  614. package/dist/index.js +2 -2
  615. package/dist/infra-runtime-D9uudHda.js +39 -0
  616. package/dist/init-BIbgrtP4.js +59 -0
  617. package/dist/install-signal-cli-DX67z7U-.js +202 -0
  618. package/dist/jobs-DWEXUnGc.js +734 -0
  619. package/dist/kimi-web-search-provider-B199pS24.js +80 -0
  620. package/dist/kimi-web-search-provider.runtime-DHuvlTlx.js +261 -0
  621. package/dist/kimi-web-search-provider.runtime-DPkmvLDS.js +2 -0
  622. package/dist/kimi-web-search-provider.runtime.js +1 -1
  623. package/dist/library-B5XEbilF.js +45 -0
  624. package/dist/lifecycle-Cf5XvG8O.js +229 -0
  625. package/dist/lifecycle-CnQRwenx.js +571 -0
  626. package/dist/lifecycle.runtime-CMl4KKk8.js +2 -0
  627. package/dist/lifecycle.runtime.js +1 -1
  628. package/dist/list-AHy8re_f.js +1212 -0
  629. package/dist/list-BTKCVZuV.js +2 -0
  630. package/dist/list-DGTx2Wqw.js +131 -0
  631. package/dist/list-YvfcGz15.js +2 -0
  632. package/dist/list.probe-DG5_xRHp.js +419 -0
  633. package/dist/live-model-switch-CuTctEKz.js +336 -0
  634. package/dist/llm-slug-generator-BruS9kif.js +79 -0
  635. package/dist/llm-slug-generator.js +1 -1
  636. package/dist/load-config-CM6Gosov.js +35 -0
  637. package/dist/local-dispatch.runtime-ZYo4KwzE.js +8 -0
  638. package/dist/local-dispatch.runtime.js +1 -1
  639. package/dist/login-3MD7cKlo.js +108 -0
  640. package/dist/logs-cli-OVNQM7ua.js +265 -0
  641. package/dist/logs-cli.runtime-BxiLcJ_M.js +2 -0
  642. package/dist/logs-cli.runtime.js +1 -1
  643. package/dist/main-session-restart-recovery-DPOV5jrb.js +206 -0
  644. package/dist/managed-image-attachments-6nAXGlI1.js +635 -0
  645. package/dist/managed-image-attachments-DilVoOYk.js +2 -0
  646. package/dist/manager-BtvzSKtj.js +2057 -0
  647. package/dist/manager-DyNLzWfD.js +2 -0
  648. package/dist/manager-Q2pBimx1.js +3114 -0
  649. package/dist/markdown-to-line-BXIakLn2.js +790 -0
  650. package/dist/mcp/plugin-tools-serve.js +1 -1
  651. package/dist/mcp-cli-lQKoKrr8.js +725 -0
  652. package/dist/mcp-http-Bkk3yw83.js +529 -0
  653. package/dist/media-contract-Bc8hq_Hg.js +49 -0
  654. package/dist/media-contract-api-U4NbSFNP.js +2 -0
  655. package/dist/media-runtime-BNkgBOI3.js +329 -0
  656. package/dist/memory-DwnILZlh.js +342 -0
  657. package/dist/memory-core-host-runtime-cli-C8dM34aV.js +9 -0
  658. package/dist/memory-embedding-adapter-B2PHR9-b.js +123 -0
  659. package/dist/message-action-runner-BKUGlEq0.js +2 -0
  660. package/dist/message-action-runner-CXfdJWof.js +1407 -0
  661. package/dist/message-actions-BPS9joyx.js +143 -0
  662. package/dist/message-channel-DGBKBihv.js +56 -0
  663. package/dist/message-gek1bdc3.js +232 -0
  664. package/dist/message-secret-scope-BmZJslJs.js +103 -0
  665. package/dist/message.gateway.runtime-B35cFF_N.js +2 -0
  666. package/dist/message.gateway.runtime.js +1 -1
  667. package/dist/method-scopes-BJj0ofY0.js +233 -0
  668. package/dist/minimax-web-search-provider-C79WAduN.js +53 -0
  669. package/dist/minimax-web-search-provider.runtime-D94jFB6v.js +2 -0
  670. package/dist/minimax-web-search-provider.runtime-ttvn1re5.js +140 -0
  671. package/dist/minimax-web-search-provider.runtime.js +1 -1
  672. package/dist/mock-C9dpEyJ8.js +136 -0
  673. package/dist/model-definitions-taVnM0qU.js +260 -0
  674. package/dist/model-overrides-Hnlrxnm3.js +104 -0
  675. package/dist/model-selection-C0kCM--d.js +213 -0
  676. package/dist/models-C6lJZiG_.js +569 -0
  677. package/dist/models-CQmyBH-d.js +760 -0
  678. package/dist/models-CzCQpmVW.js +157 -0
  679. package/dist/models-DJQoC4Xz.js +47 -0
  680. package/dist/models-auth-status-CUuto1-z.js +217 -0
  681. package/dist/models-cli-DFYsfHFi.js +271 -0
  682. package/dist/models-http-KluTqvju.js +92 -0
  683. package/dist/models.fetch-CUcQFhk9.js +518 -0
  684. package/dist/monitor-Amuhcll1.js +1237 -0
  685. package/dist/monitor-BHYjSOgh.js +671 -0
  686. package/dist/monitor-BNMwiGBd.js +1459 -0
  687. package/dist/monitor-C8QQd5Eg.js +295 -0
  688. package/dist/monitor-DHQTgUJC.js +1661 -0
  689. package/dist/monitor-DrTPiOoO.js +2 -0
  690. package/dist/monitor-Dupjc8yV.js +788 -0
  691. package/dist/monitor-auth-BGCRXS08.js +207 -0
  692. package/dist/monitor-processing-dLJEKLkr.js +1974 -0
  693. package/dist/monitor.runtime-CFCau0j2.js +2 -0
  694. package/dist/monitor.runtime.js +1 -1
  695. package/dist/monitor.webhook-rWET0HrG.js +180 -0
  696. package/dist/msteams-96MqCc3R.js +35 -0
  697. package/dist/music-generation-provider-Bilj-8Yj.js +63 -0
  698. package/dist/music-generation-provider-CHWj4bCX.js +170 -0
  699. package/dist/native-hook-relay-BFWKVZgm.js +519 -0
  700. package/dist/native-web-search-BVgO5cS-.js +64 -0
  701. package/dist/nextcloud-talk-D-FHP_4q.js +17 -0
  702. package/dist/node-cli-COaDl9Gb.js +2276 -0
  703. package/dist/nodes-cli-CdiC2uij.js +1046 -0
  704. package/dist/nodes-utils-Bz4wEuS8.js +84 -0
  705. package/dist/nodes.helpers-B4Yy3f8X.js +34 -0
  706. package/dist/notify-DnBLOswJ.js +315 -0
  707. package/dist/onboard-3Bl_PtFG.js +25 -0
  708. package/dist/onboard-CKxpPa1J.js +25 -0
  709. package/dist/onboard-CnHnAYQA.js +2 -0
  710. package/dist/onboard-DgcU4LaA.js +58 -0
  711. package/dist/onboard-Dgq86QR9.js +29 -0
  712. package/dist/onboard-NAMvzIMs2.js +49 -0
  713. package/dist/onboard-a4m7JstV.js +316 -0
  714. package/dist/onboard-fjFU-IEN.js +70 -0
  715. package/dist/onboard-helpers-CFVEw4kg.js +204 -0
  716. package/dist/onboard-helpers-R0vTUoOE.js +6 -0
  717. package/dist/onboard-interactive-D4Hr2vB6.js +24 -0
  718. package/dist/onboard-non-interactive-DjfjLqF7.js +635 -0
  719. package/dist/onboard-ppjrxdQn.js +25 -0
  720. package/dist/onboard-remote-0UXttO3s.js +2 -0
  721. package/dist/onboard-remote-BmUiJKba.js +193 -0
  722. package/dist/onboard-skills-855xT260.js +2 -0
  723. package/dist/onboard-skills-CF2ndciI.js +134 -0
  724. package/dist/openai-codex-auth-identity-Dxbuu2cd.js +45 -0
  725. package/dist/openai-codex-device-code-CEOVyUYq.js +164 -0
  726. package/dist/openai-codex-provider-B0mTbWAC.js +472 -0
  727. package/dist/openai-codex-shared-DO75K1fy.js +6 -0
  728. package/dist/openai-http-BU5AQc8x.js +500 -0
  729. package/dist/openai-provider-DUFOP6VM.js +313 -0
  730. package/dist/openresponses-http-D1GGTOop.js +1128 -0
  731. package/dist/operator-approvals-client-gp0A73Qi.js +68 -0
  732. package/dist/outbound-media-CYrmm6RY.js +57 -0
  733. package/dist/outbound-runtime-DM3TzNhA.js +5 -0
  734. package/dist/outbound.runtime-DHLRWzbo.js +2 -0
  735. package/dist/outbound.runtime.js +1 -1
  736. package/dist/pair-command-approve-LJICPdqB.js +44 -0
  737. package/dist/perplexity-web-search-provider-ONjsnI0T.js +92 -0
  738. package/dist/perplexity-web-search-provider.runtime-C9SpRyYz.js +324 -0
  739. package/dist/perplexity-web-search-provider.runtime-pVuMPAol.js +2 -0
  740. package/dist/perplexity-web-search-provider.runtime.js +1 -1
  741. package/dist/persistent-bindings.lifecycle-CEOa_phk.js +85 -0
  742. package/dist/persistent-bindings.lifecycle-DACYiSaR.js +2 -0
  743. package/dist/pi-embedded-BlOiwW3D.js +4 -0
  744. package/dist/pi-embedded-mC-TYW4O.js +2905 -0
  745. package/dist/pi-embedded-subscribe.handlers.compaction.runtime-CzPjo_JC.js +23 -0
  746. package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
  747. package/dist/pi-embedded.runtime-DjmvqZCN.js +4 -0
  748. package/dist/pi-embedded.runtime.js +1 -1
  749. package/dist/pi-tool-definition-adapter-CwT_smG_.js +229 -0
  750. package/dist/pi-tools-10IsGyci.js +1057 -0
  751. package/dist/pi-tools.before-tool-call-CX2Ew8CP.js +433 -0
  752. package/dist/pi-tools.before-tool-call-V6qF1pL1.js +2 -0
  753. package/dist/plivo-CAlO-SXr.js +394 -0
  754. package/dist/plugin-DUiUdK8L.js +12195 -0
  755. package/dist/plugin-enabled-Md173mY1.js +140 -0
  756. package/dist/plugin-registration-BUZ1GI8e.js +23 -0
  757. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  758. package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
  759. package/dist/plugin-sdk/acp-runtime.js +3 -3
  760. package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
  761. package/dist/plugin-sdk/agent-harness.js +7 -7
  762. package/dist/plugin-sdk/agent-runtime.js +2 -2
  763. package/dist/plugin-sdk/approval-client-runtime.js +2 -2
  764. package/dist/plugin-sdk/approval-delivery-runtime.js +1 -1
  765. package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
  766. package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
  767. package/dist/plugin-sdk/approval-native-runtime.js +2 -2
  768. package/dist/plugin-sdk/approval-reply-runtime.js +2 -2
  769. package/dist/plugin-sdk/approval-runtime.js +7 -7
  770. package/dist/plugin-sdk/bluebubbles.js +2 -2
  771. package/dist/plugin-sdk/browser-node-runtime.js +4 -4
  772. package/dist/plugin-sdk/browser-setup-tools.js +3 -3
  773. package/dist/plugin-sdk/browser-support.js +7 -7
  774. package/dist/plugin-sdk/channel-core.js +2 -2
  775. package/dist/plugin-sdk/channel-inbound.js +3 -3
  776. package/dist/plugin-sdk/command-auth-native.js +1 -1
  777. package/dist/plugin-sdk/command-auth.js +4 -4
  778. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  779. package/dist/plugin-sdk/compat.js +2 -2
  780. package/dist/plugin-sdk/config-runtime.js +5 -5
  781. package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
  782. package/dist/plugin-sdk/conversation-runtime.js +4 -4
  783. package/dist/plugin-sdk/core.js +2 -2
  784. package/dist/plugin-sdk/direct-dm.js +1 -1
  785. package/dist/plugin-sdk/gateway-runtime.js +3 -3
  786. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  787. package/dist/plugin-sdk/index.js +1 -1
  788. package/dist/plugin-sdk/infra-runtime.js +4 -4
  789. package/dist/plugin-sdk/irc.js +2 -2
  790. package/dist/plugin-sdk/markdown-table-runtime.js +1 -1
  791. package/dist/plugin-sdk/matrix.js +1 -1
  792. package/dist/plugin-sdk/mattermost.js +3 -3
  793. package/dist/plugin-sdk/media-runtime.js +1 -1
  794. package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
  795. package/dist/plugin-sdk/memory-core.js +2 -2
  796. package/dist/plugin-sdk/models-provider-runtime.js +1 -1
  797. package/dist/plugin-sdk/msteams.js +3 -3
  798. package/dist/plugin-sdk/nextcloud-talk.js +2 -2
  799. package/dist/plugin-sdk/nostr.js +1 -1
  800. package/dist/plugin-sdk/outbound-runtime.js +2 -2
  801. package/dist/plugin-sdk/reply-chunking.js +2 -2
  802. package/dist/plugin-sdk/reply-dispatch-runtime.js +2 -2
  803. package/dist/plugin-sdk/reply-runtime.js +5 -5
  804. package/dist/plugin-sdk/routing.js +2 -2
  805. package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
  806. package/dist/plugin-sdk/runtime.js +2 -2
  807. package/dist/plugin-sdk/sandbox.js +1 -1
  808. package/dist/plugin-sdk/session-store-runtime.js +1 -1
  809. package/dist/plugin-sdk/session-visibility.js +1 -1
  810. package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
  811. package/dist/plugin-sdk/src/gateway/protocol/client-info.d.ts +8 -0
  812. package/dist/plugin-sdk/src/gateway/protocol/schema/logs-chat.d.ts +2 -0
  813. package/dist/plugin-sdk/src/gateway/protocol/schema/protocol-schemas.d.ts +2 -0
  814. package/dist/plugin-sdk/src/gateway/server-broadcast-types.d.ts +11 -0
  815. package/dist/plugin-sdk/testing.js +4 -4
  816. package/dist/plugin-sdk/text-runtime.js +2 -2
  817. package/dist/plugin-sdk/tlon.js +1 -1
  818. package/dist/plugin-sdk/zalo.js +1 -1
  819. package/dist/plugin-sdk/zalouser.js +1 -1
  820. package/dist/plugin-service-ClKtlbqz.js +2893 -0
  821. package/dist/plugins/runtime/index.js +1 -1
  822. package/dist/policy-BxXVdy5R.js +328 -0
  823. package/dist/postinstall-inventory.json +732 -732
  824. package/dist/prepare.runtime-CgeJiFh8.js +815 -0
  825. package/dist/prepare.runtime.js +1 -1
  826. package/dist/probe--ur8kCb3.js +241 -0
  827. package/dist/probe-Afcq8e2r.js +2 -0
  828. package/dist/probe-Bh8UIug9.js +32 -0
  829. package/dist/probe-CY6MUE10.js +1443 -0
  830. package/dist/probe-Cfbju7hl.js +243 -0
  831. package/dist/probe-DHojHKeB.js +2 -0
  832. package/dist/probe-DZZtfovp.js +2205 -0
  833. package/dist/probe-KiWC2F6a.js +45 -0
  834. package/dist/probe-QqjmFXeC.js +74 -0
  835. package/dist/probe.runtime-BYxgJ6xl.js +2 -0
  836. package/dist/probe.runtime.js +1 -1
  837. package/dist/program-BjA_aj2i.js +111 -0
  838. package/dist/prompt-select-styled-D_Li5ANb.js +20 -0
  839. package/dist/protocol-D2Tvt0kQ.js +2479 -0
  840. package/dist/provider-MaVAUyxk.js +70 -0
  841. package/dist/provider-catalog-BATfNRJI.js +11 -0
  842. package/dist/provider-catalog-BqmZljQJ.js +11 -0
  843. package/dist/provider-catalog-DIiNG8du.js +12 -0
  844. package/dist/provider-catalog-aWreWBr_.js +24 -0
  845. package/dist/provider-catalog-k2xN6Dmi.js +26 -0
  846. package/dist/provider-compat-DEtCjlVO.js +37 -0
  847. package/dist/provider-dispatcher-BOzs2ZGG.js +2 -0
  848. package/dist/provider-dispatcher-CLzXvOtY.js +22 -0
  849. package/dist/provider-models-Dr7Yl3OU.js +119 -0
  850. package/dist/provider-models-LgIFG7w_.js +35 -0
  851. package/dist/provider-registration-Ce1hYnYT.js +218 -0
  852. package/dist/pw-ai-qc3NEEdy.js +2511 -0
  853. package/dist/pw-role-snapshot-BDIJ0VPo.js +380 -0
  854. package/dist/qmd-manager-B2ly9K3H.js +1921 -0
  855. package/dist/qr-cli-D2qc34ak.js +349 -0
  856. package/dist/qr-cli-r8cz7XBw.js +2 -0
  857. package/dist/qr-image-DNn2cBT5.js +2 -0
  858. package/dist/queue-BbE1ctBI.js +409 -0
  859. package/dist/reaction-runtime-api-DNwfR7k6.js +116 -0
  860. package/dist/reactions-B8Os6MyX.js +998 -0
  861. package/dist/read-capability-BcetMuEi.js +412 -0
  862. package/dist/realtime-provider-shared-RvhVjejL.js +37 -0
  863. package/dist/realtime-transcription-provider-BbBn8N0w.js +184 -0
  864. package/dist/realtime-transcription-provider-C08pMeeY.js +183 -0
  865. package/dist/realtime-transcription-provider-CB0qNn9C.js +184 -0
  866. package/dist/realtime-transcription-provider-DYOqgmgZ.js +120 -0
  867. package/dist/realtime-transcription-provider-ySxyV6W0.js +172 -0
  868. package/dist/realtime-voice-provider-ByH_v5-M.js +489 -0
  869. package/dist/record-shared-DVnkFx9W.js +10 -0
  870. package/dist/register-service-commands-BXfMmQsa.js +71 -0
  871. package/dist/register.agent-CUXMbAb4.js +248 -0
  872. package/dist/register.configure-B29Tv6Ec.js +15 -0
  873. package/dist/register.maintenance-ePgwbzKN.js +363 -0
  874. package/dist/register.message-BmgFYhw_.js +329 -0
  875. package/dist/register.onboard-BL8ZSfVl.js +88 -0
  876. package/dist/register.runtime-Z_9jSH_w.js +81 -0
  877. package/dist/register.runtime.js +1 -1
  878. package/dist/register.setup-BAQ-rre0.js +150 -0
  879. package/dist/register.status-health-sessions-D5CTwglK.js +1215 -0
  880. package/dist/register.subclis-BAzWCN2M.js +3 -0
  881. package/dist/register.subclis-CMhZ_wr2.js +29 -0
  882. package/dist/register.subclis-core-D_uA6Vtg.js +249 -0
  883. package/dist/replay-policy-Be3VAzMj.js +8 -0
  884. package/dist/reply-chunking-DsNT8-zW.js +3 -0
  885. package/dist/reply-dispatch-runtime-C8Tjbie9.js +13 -0
  886. package/dist/reply-media-paths.runtime-Sf21IJNk.js +146 -0
  887. package/dist/reply-media-paths.runtime-oSGMjdni.js +2 -0
  888. package/dist/reply-media-paths.runtime.js +1 -1
  889. package/dist/reply-payload-transform-DxOTphts.js +720 -0
  890. package/dist/reply-runtime-9GCZm66h.js +11 -0
  891. package/dist/reply.runtime-Ck_EqPGO.js +2 -0
  892. package/dist/reply.runtime.js +1 -1
  893. package/dist/reset-BMP05zhP.js +84 -0
  894. package/dist/reset-authorization-AdwO29Il.js +34 -0
  895. package/dist/response-generator-BKL4tpDF.js +175 -0
  896. package/dist/restart-health-C8OVhvQ6.js +2 -0
  897. package/dist/restart-health-DdG71XEk.js +202 -0
  898. package/dist/root-help-_8BuPuC8.js +44 -0
  899. package/dist/route-reply-C4YpHgPi.js +162 -0
  900. package/dist/route-reply.runtime-hioDUgsc.js +2 -0
  901. package/dist/route-reply.runtime.js +1 -1
  902. package/dist/routes-BbR9Kf9O.js +3341 -0
  903. package/dist/routes-DSDrrbg7.js +2 -0
  904. package/dist/routing-CMekdi78.js +5 -0
  905. package/dist/rpc-B32bpIT7.js +61 -0
  906. package/dist/rpc-context-88y3DNdl.js +17 -0
  907. package/dist/rpc.runtime-BWtvlfeD.js +21 -0
  908. package/dist/rpc.runtime.js +1 -1
  909. package/dist/run-auth-profile.runtime-x8Hbrp4n.js +2 -0
  910. package/dist/run-auth-profile.runtime.js +1 -1
  911. package/dist/run-delivery.runtime-BEhoJYec.js +530 -0
  912. package/dist/run-delivery.runtime.js +1 -1
  913. package/dist/run-embedded.runtime-DtE5YonB.js +4 -0
  914. package/dist/run-embedded.runtime.js +1 -1
  915. package/dist/run-execution-cli.runtime-B7TsaFkb.js +4 -0
  916. package/dist/run-execution-cli.runtime.js +1 -1
  917. package/dist/run-executor.runtime-C6GU_OdI.js +277 -0
  918. package/dist/run-executor.runtime.js +1 -1
  919. package/dist/run-main-DlCyw-yJ.js +567 -0
  920. package/dist/run-subagent-registry.runtime-N6lG2N8U.js +2 -0
  921. package/dist/run-subagent-registry.runtime.js +1 -1
  922. package/dist/run-wait-CT1ADSXM.js +135 -0
  923. package/dist/runtime-BMgYgoRw.js +973 -0
  924. package/dist/runtime-BZIHCyP6.js +9 -0
  925. package/dist/runtime-BfclzCOK.js +72 -0
  926. package/dist/runtime-C5HCPXpN.js +107 -0
  927. package/dist/runtime-api-BwnU0Us4.js +14 -0
  928. package/dist/runtime-api-CTCWdq7l.js +4 -0
  929. package/dist/runtime-api-DEKfCisk.js +9 -0
  930. package/dist/runtime-api-DuV0VsXW.js +9 -0
  931. package/dist/runtime-embedded-pi.runtime-BYOaO_Od.js +2 -0
  932. package/dist/runtime-embedded-pi.runtime.js +1 -1
  933. package/dist/runtime-entry-BIQCiau_.js +2769 -0
  934. package/dist/runtime-internal-CatNPRWm.js +2 -0
  935. package/dist/runtime-options-VPF2fIbl.js +275 -0
  936. package/dist/runtime-provider-CKxDlld3.js +21 -0
  937. package/dist/runtime-schema-C5kNPI-T.js +28588 -0
  938. package/dist/sandbox-24Qv41cI.js +3 -0
  939. package/dist/sandbox-Dl4VHMsp.js +1156 -0
  940. package/dist/sandbox-cli-DKdlzfGK.js +450 -0
  941. package/dist/scan-CsLHQzrX.js +2 -0
  942. package/dist/scan-Db3o5_vf.js +523 -0
  943. package/dist/secrets-cli-DRs2TyS0.js +2101 -0
  944. package/dist/security-cli-Ddj_11Zr.js +486 -0
  945. package/dist/selection-BTcDg98i.js +2 -0
  946. package/dist/selection-CDq8O7Fx.js +7764 -0
  947. package/dist/send-C3Q0rOZU.js +102 -0
  948. package/dist/send-CMRoV9D3.js +534 -0
  949. package/dist/send-DLyeTfOT.js +156 -0
  950. package/dist/send.runtime-11PTjSXY.js +2 -0
  951. package/dist/send.runtime.js +1 -1
  952. package/dist/server-DpmjtgBd.js +77 -0
  953. package/dist/server-context-BuRVihwJ.js +2 -0
  954. package/dist/server-context-Dxt5bPO1.js +847 -0
  955. package/dist/server-iR310jYD.js +13 -0
  956. package/dist/server-middleware-XZQHvHoT.js +120 -0
  957. package/dist/server-node-events-EECL-zPp.js +481 -0
  958. package/dist/server-plugin-bootstrap-BeyQQP6e.js +13176 -0
  959. package/dist/server-plugin-bootstrap-Du2JCynD.js +2 -0
  960. package/dist/server-restart-sentinel-D16NkJS9.js +697 -0
  961. package/dist/server.impl-jeGX0yfZ.js +12894 -0
  962. package/dist/session-DQJLw1_T.js +48 -0
  963. package/dist/session-envelope-BzLkljLE.js +18 -0
  964. package/dist/session-key-B9ng1tKQ.js +65 -0
  965. package/dist/session-kill-http-CrVogPTY.js +110 -0
  966. package/dist/session-meta-Cf_igX65.js +109 -0
  967. package/dist/session-override-tYPL0kPi.js +106 -0
  968. package/dist/session-reset-model.runtime-Bksk4sN9.js +133 -0
  969. package/dist/session-reset-model.runtime.js +1 -1
  970. package/dist/session-reset-service-Coa2y7Dc.js +497 -0
  971. package/dist/session-route-C__jEVZM.js +93 -0
  972. package/dist/session-status.runtime-DGvtIYsy.js +2 -0
  973. package/dist/session-status.runtime.js +1 -1
  974. package/dist/session-store-C7BvEOyw.js +126 -0
  975. package/dist/session-store.runtime-CTnaK0eA.js +2 -0
  976. package/dist/session-store.runtime.js +1 -1
  977. package/dist/session-subagent-reactivation.runtime-CpvLz2Zl.js +2 -0
  978. package/dist/session-subagent-reactivation.runtime.js +1 -1
  979. package/dist/session-tab-registry-9PAkEJgt.js +581 -0
  980. package/dist/session-updates-DFsCLKMJ.js +236 -0
  981. package/dist/session-updates.runtime-GJ8kEPly.js +2 -0
  982. package/dist/session-updates.runtime.js +1 -1
  983. package/dist/session-utils-B1COXii1.js +1009 -0
  984. package/dist/session-visibility-D3BOamfE.js +147 -0
  985. package/dist/sessions-BNIruiEi.js +48 -0
  986. package/dist/sessions-B_sLzSKh.js +281 -0
  987. package/dist/sessions-ChHWG6bX.js +16 -0
  988. package/dist/sessions-helpers-BhxVyCeC.js +305 -0
  989. package/dist/sessions-history-http-Cat6NIOM.js +383 -0
  990. package/dist/sessions-patch-C2VfpT6N.js +309 -0
  991. package/dist/sessions-resolve-CU-TrVC5.js +174 -0
  992. package/dist/sessions-u8wkO5OX.js +2 -0
  993. package/dist/sessions.runtime-B6j-Iope.js +2 -0
  994. package/dist/sessions.runtime.js +1 -1
  995. package/dist/setup-BUlom6Vi.js +421 -0
  996. package/dist/setup-CcVU94hA.js +636 -0
  997. package/dist/setup-api-B7VRJ8uG.js +29 -0
  998. package/dist/setup-core-BSgdsKqw.js +393 -0
  999. package/dist/setup-core-BlfMhY40.js +184 -0
  1000. package/dist/setup-core-ClqXCwnQ.js +176 -0
  1001. package/dist/setup-core-DnkRgrw-.js +171 -0
  1002. package/dist/setup-surface-5pyyPLuU.js +351 -0
  1003. package/dist/setup-surface-6kf03Wwh.js +72 -0
  1004. package/dist/setup-surface-C-CfXHbT.js +286 -0
  1005. package/dist/setup-surface-C2ZP0qfU.js +3 -0
  1006. package/dist/setup-surface-DKyYG10Q2.js +403 -0
  1007. package/dist/setup-surface-DbpW4B-_.js +219 -0
  1008. package/dist/setup.finalize-skT8Gm-r.js +547 -0
  1009. package/dist/setup.gateway-config-CeiELioQ.js +250 -0
  1010. package/dist/shared--LL8Q1-r.js +60 -0
  1011. package/dist/shared-B48XWnaj.js +121 -0
  1012. package/dist/shared-CTrgq8xV.js +217 -0
  1013. package/dist/shared-D7wq6pQ0.js +186 -0
  1014. package/dist/shared-DSeBkiR2.js +198 -0
  1015. package/dist/shared-DWDavHPp.js +76 -0
  1016. package/dist/shared-runtime-D-p9L46W.js +7 -0
  1017. package/dist/short-term-promotion-CkPsM3JU.js +1543 -0
  1018. package/dist/skill-commands-GmJ-uKh9.js +83 -0
  1019. package/dist/skill-commands.runtime-B2kGq_R_.js +2 -0
  1020. package/dist/skill-commands.runtime.js +1 -1
  1021. package/dist/skills-snapshot.runtime-niF0JCHr.js +7 -0
  1022. package/dist/skills-snapshot.runtime.js +1 -1
  1023. package/dist/slash-state-D0qRQzb9.js +1911 -0
  1024. package/dist/speech-provider-CZ0DIWHC.js +209 -0
  1025. package/dist/speech-provider-D01WzRM7.js +216 -0
  1026. package/dist/speech-provider-D4dWoX5q.js +395 -0
  1027. package/dist/speech-provider-DQjPn8BG.js +170 -0
  1028. package/dist/speech-provider-DTfG7isC.js +184 -0
  1029. package/dist/speech-provider-DVMPFaU6.js +103 -0
  1030. package/dist/speech-provider-Jnc9vcw3.js +209 -0
  1031. package/dist/src-DLW1D_bM.js +3974 -0
  1032. package/dist/stage-sandbox-media.runtime-DeLGFWqT.js +232 -0
  1033. package/dist/stage-sandbox-media.runtime.js +1 -1
  1034. package/dist/startup-context-DKWBYxjm.js +312 -0
  1035. package/dist/state-migrations-DdRavjjK.js +820 -0
  1036. package/dist/status-BGTYuDnT.js +397 -0
  1037. package/dist/status-BYp9Gu83.js +209 -0
  1038. package/dist/status-BqydDBcZ.js +3 -0
  1039. package/dist/status-Bx1yRRTV.js +190 -0
  1040. package/dist/status-C6gdYeLs.js +2 -0
  1041. package/dist/status-Cl8Otyr4.js +62 -0
  1042. package/dist/status-DWucT0mf.js +2 -0
  1043. package/dist/status-all-TjyzzieW.js +498 -0
  1044. package/dist/status-json-C6WIXSpl.js +14 -0
  1045. package/dist/status-json-command-CgXgvQow.js +84 -0
  1046. package/dist/status-message-D6O4-pti.js +466 -0
  1047. package/dist/status-message.runtime-CNShQeZy.js +6 -0
  1048. package/dist/status-message.runtime.js +1 -1
  1049. package/dist/status-queue.runtime-K8_F9zMn.js +2 -0
  1050. package/dist/status-queue.runtime.js +1 -1
  1051. package/dist/status-runtime-shared-Be7bmVcF.js +257 -0
  1052. package/dist/status-subagents.runtime-BRV0GKxR.js +18 -0
  1053. package/dist/status-subagents.runtime.js +1 -1
  1054. package/dist/status-text-BIGdXi_0.js +237 -0
  1055. package/dist/status.gateway-connection.runtime-C1Eg5lPs.js +2 -0
  1056. package/dist/status.gateway-connection.runtime.js +1 -1
  1057. package/dist/status.gather-C91OSvDe.js +292 -0
  1058. package/dist/status.gather-DOJX68XV.js +2 -0
  1059. package/dist/status.runtime-BM4ZMHfF.js +2 -0
  1060. package/dist/status.runtime-JhkaEpRc.js +2 -0
  1061. package/dist/status.runtime.js +1 -1
  1062. package/dist/status.scan-36oLz1Hh.js +65 -0
  1063. package/dist/status.scan-overview-CsDwq0xR.js +379 -0
  1064. package/dist/status.scan.fast-json-CS8ga0yM.js +132 -0
  1065. package/dist/status.scan.fast-json-DYvUCNqQ.js +2 -0
  1066. package/dist/status.summary-1hoR3rVk.js +214 -0
  1067. package/dist/status.summary-Bl1Fw7SD.js +2 -0
  1068. package/dist/store-3hbb4lSJ.js +4 -0
  1069. package/dist/store-CEFH-fGo.js +910 -0
  1070. package/dist/store.runtime-ugP7_1Zf.js +2 -0
  1071. package/dist/store.runtime.js +1 -1
  1072. package/dist/stream-CukCyjCc.js +664 -0
  1073. package/dist/stream-Dj22sbqm.js +134 -0
  1074. package/dist/stt-CRYwE4f3.js +66 -0
  1075. package/dist/subagent-announce-Dnuw09in.js +351 -0
  1076. package/dist/subagent-announce-delivery-cCFWE0et.js +726 -0
  1077. package/dist/subagent-announce-output-BtmzvU1a.js +364 -0
  1078. package/dist/subagent-capabilities-Btyd8tu0.js +251 -0
  1079. package/dist/subagent-control-Dlc3kJMb.js +506 -0
  1080. package/dist/subagent-control.runtime-g5fkwkOu.js +3 -0
  1081. package/dist/subagent-control.runtime.js +1 -1
  1082. package/dist/subagent-followup.runtime-CtU5LNEN.js +68 -0
  1083. package/dist/subagent-followup.runtime.js +1 -1
  1084. package/dist/subagent-orphan-recovery-kbEEIccA.js +305 -0
  1085. package/dist/subagent-registry-B5bQOpDI.js +3 -0
  1086. package/dist/subagent-registry-CBu4eX0s.js +1753 -0
  1087. package/dist/subagent-registry.runtime.js +1 -1
  1088. package/dist/subagent-spawn-DhjzC5gY.js +1005 -0
  1089. package/dist/system-cli-A9ux7HV2.js +59 -0
  1090. package/dist/system-prompt-DJq4MtoS.js +640 -0
  1091. package/dist/tables-BStv8EET.js +829 -0
  1092. package/dist/target-id-RoVbMf8U.js +107 -0
  1093. package/dist/targets-RMCdeJGZ.js +207 -0
  1094. package/dist/targets-cmfGv2Db.js +67 -0
  1095. package/dist/targets.runtime-DurrSDqM.js +2 -0
  1096. package/dist/targets.runtime.js +1 -1
  1097. package/dist/task-executor-CtdGnYvb.js +360 -0
  1098. package/dist/task-owner-access-C_gF3pGm.js +74 -0
  1099. package/dist/task-registry-CFNty_H1.js +2366 -0
  1100. package/dist/task-registry-delivery-runtime-C1c7pN3i.js +2 -0
  1101. package/dist/task-registry-delivery-runtime-F6HIzLFD.js +3 -0
  1102. package/dist/task-registry.maintenance-BSO3Pttk.js +2 -0
  1103. package/dist/task-registry.maintenance-Bzw1Ot4Y.js +416 -0
  1104. package/dist/tavily-client-DmRSbaLh.js +2 -0
  1105. package/dist/tavily-client-DyAtAOpD.js +193 -0
  1106. package/dist/tavily-search-provider-Bbgsl7mb.js +62 -0
  1107. package/dist/telegram/audit.js +2 -2
  1108. package/dist/telegram/token.js +2 -2
  1109. package/dist/telnyx-nMo1MXA1.js +260 -0
  1110. package/dist/testing-DLeFUMTf.js +575 -0
  1111. package/dist/text-report-Dr4OMS_k.js +587 -0
  1112. package/dist/text-runtime-Dd2bva2m.js +290 -0
  1113. package/dist/tool-config-shared-DlMaBB10.js +19 -0
  1114. package/dist/tool-policy-pipeline-0FWDoYYr.js +109 -0
  1115. package/dist/tool-resolution-DQTRVob0.js +90 -0
  1116. package/dist/tools-effective-inventory-GNGRMlm8.js +152 -0
  1117. package/dist/tools-invoke-http-IeTKKDtc.js +206 -0
  1118. package/dist/tools.runtime-DNLELnRr.js +4 -0
  1119. package/dist/tools.runtime.js +1 -1
  1120. package/dist/transcript-DWg4ZUcm.js +312 -0
  1121. package/dist/transcript-resolve.runtime-xACsMpzb.js +2 -0
  1122. package/dist/transcript-resolve.runtime.js +1 -1
  1123. package/dist/transcript.runtime-BEXMCmRi.js +2 -0
  1124. package/dist/transcript.runtime.js +1 -1
  1125. package/dist/transport-policy-BzTvyOmg.js +75 -0
  1126. package/dist/trash-EJIRdEEW.js +24 -0
  1127. package/dist/tts-AMFKvIil.js +64 -0
  1128. package/dist/tts-D7c_mBQr.js +183 -0
  1129. package/dist/tui-cli-CeXEjZVR.js +4595 -0
  1130. package/dist/twilio-Bq0EHjSs.js +609 -0
  1131. package/dist/typing-policy-D-cwir-6.js +12 -0
  1132. package/dist/update-cli-6cN0AU-H.js +1759 -0
  1133. package/dist/upgrade-E9pk_ETn.js +1226 -0
  1134. package/dist/video-generation-provider-B2ydEHoH.js +271 -0
  1135. package/dist/video-generation-provider-BIhzvg3t.js +78 -0
  1136. package/dist/video-generation-provider-BiGET6PL.js +187 -0
  1137. package/dist/video-generation-provider-BvIYYRHt.js +254 -0
  1138. package/dist/video-generation-provider-CDMIArvG.js +118 -0
  1139. package/dist/video-generation-provider-CZc8AIXp.js +221 -0
  1140. package/dist/video-generation-provider-DKQZcort.js +281 -0
  1141. package/dist/video-generation-provider-DdGhJ9-8.js +287 -0
  1142. package/dist/video-generation-provider-XpVuorb7.js +264 -0
  1143. package/dist/video-generation-task-status-D44fagYk.js +163 -0
  1144. package/dist/voice-mapping-Ltp5aeXQ.js +41 -0
  1145. package/dist/wait-for-idle-before-flush-B5QDOp0b.js +5986 -0
  1146. package/dist/web-search-gDoNQc1M.js +61 -0
  1147. package/dist/web-search-provider-DI1P7u12.js +163 -0
  1148. package/dist/web-search-provider.runtime-BLHcU_Q5.js +2 -0
  1149. package/dist/web-search-provider.runtime-CExn2tm8.js +185 -0
  1150. package/dist/web-search-provider.runtime.js +1 -1
  1151. package/dist/webhook-shared-1XHBMLp6.js +12 -0
  1152. package/dist/wizard-models-CLDwUX2-.js +334 -0
  1153. package/dist/workflow-runtime-BrBSvDJz.js +485 -0
  1154. package/dist/workspace-run-CQ9bvprq.js +70 -0
  1155. package/dist/x-search-config-COc9ynlq.js +36 -0
  1156. package/dist/x-search-shared-D-WVgH0q.js +75 -0
  1157. package/dist/zalo-js-kA38HR6N.js +1157 -0
  1158. package/package.json +1 -1
  1159. package/dist/abort-D7Eb5Pfs.js +0 -201
  1160. package/dist/abort-cutoff.runtime-W1jPHD1l.js +0 -20
  1161. package/dist/abort.runtime-Uk-fNOr0.js +0 -2
  1162. package/dist/accounts-B0U5s6Hn.js +0 -2
  1163. package/dist/accounts-BuQEZI1m.js +0 -365
  1164. package/dist/accounts-BxrhItqg.js +0 -107
  1165. package/dist/accounts-CJuvMKsE.js +0 -66
  1166. package/dist/accounts-DAo-x54e.js +0 -104
  1167. package/dist/accounts-DoMkWpQd.js +0 -43
  1168. package/dist/accounts.runtime-B4AMDwXM.js +0 -2
  1169. package/dist/acp-cli-Dj3nYrtM.js +0 -2193
  1170. package/dist/acp-spawn-DVm7VQrm.js +0 -1093
  1171. package/dist/acp-spawn-DfcG2y_Y.js +0 -2
  1172. package/dist/acp-stateful-target-driver-BYeTpciM.js +0 -89
  1173. package/dist/action-agents-B9hNk5lN.js +0 -67
  1174. package/dist/action-focus-B6pqXNJ2.js +0 -132
  1175. package/dist/action-help-CPcU40vC.js +0 -7
  1176. package/dist/action-info-D_yE--lC.js +0 -101
  1177. package/dist/action-kill-BJ0225YA.js +0 -33
  1178. package/dist/action-list-BLyN0cUw.js +0 -21
  1179. package/dist/action-log-_sI8lmxG.js +0 -30
  1180. package/dist/action-send-C2RZKCaN.js +0 -39
  1181. package/dist/action-spawn-DtZrqOf-.js +0 -47
  1182. package/dist/action-unfocus-D90uQGIM.js +0 -29
  1183. package/dist/actions.runtime-CwqOsby1.js +0 -5
  1184. package/dist/actions.runtime-DL7IkUaC.js +0 -18
  1185. package/dist/agent-command-ChguXtvw.js +0 -874
  1186. package/dist/agent-delivery-BwzZnRgC.js +0 -76
  1187. package/dist/agent-eujROEra.js +0 -2
  1188. package/dist/agent-harness-runtime-KWYqsYTk.js +0 -144
  1189. package/dist/agent-runner-utils-DyLXFJim.js +0 -239
  1190. package/dist/agent-runner.runtime-Tm2znb5I.js +0 -3455
  1191. package/dist/agent-runtime-DYyI3OTz.js +0 -18
  1192. package/dist/agents-CaKEB08m.js +0 -5
  1193. package/dist/agents-D0LjQ71R.js +0 -954
  1194. package/dist/agents.command-shared-DnntyPTT.js +0 -40
  1195. package/dist/aliases-C1J5Hl0k.js +0 -96
  1196. package/dist/aliases-DE2DzUaH.js +0 -2
  1197. package/dist/api-9ms9Td4v.js +0 -3
  1198. package/dist/api-BgtDxBwP.js +0 -5
  1199. package/dist/api-BpBoWeil.js +0 -3
  1200. package/dist/api-CKbGCnWb.js +0 -139
  1201. package/dist/api-D1axzMqP.js +0 -4
  1202. package/dist/api-j3Hir2UT.js +0 -48
  1203. package/dist/apply-CIz-od94.js +0 -508
  1204. package/dist/apply.runtime-CN-vA6G-.js +0 -2
  1205. package/dist/approval-client-helpers-Dp5QM59V.js +0 -82
  1206. package/dist/approval-delivery-helpers-BS-VOhZN.js +0 -134
  1207. package/dist/approval-gateway-resolver-DIPFgTnx.js +0 -29
  1208. package/dist/approval-gateway-runtime-i0yziXk2.js +0 -2
  1209. package/dist/approval-handler-runtime-7ttgBfc_.js +0 -439
  1210. package/dist/approval-native-helpers-DbgPq2Af.js +0 -33
  1211. package/dist/approval-native-runtime-DT2b3zaN.js +0 -729
  1212. package/dist/approval-renderers-CxKF90_M.js +0 -64
  1213. package/dist/attempt-execution.runtime-CzM8MDim.js +0 -509
  1214. package/dist/attempt-execution.shared-BeCuaCMe.js +0 -22
  1215. package/dist/attempt.prompt-helpers-DfcGwj0J.js +0 -221
  1216. package/dist/attempt.tool-run-context-4cCwC6FC.js +0 -933
  1217. package/dist/audit-EYwFJUbn.js +0 -939
  1218. package/dist/audit-membership-runtime-AIbmS8yN.js +0 -550
  1219. package/dist/audit.runtime-OucPhZPU.js +0 -7
  1220. package/dist/auth-BPy3ID3D.js +0 -2
  1221. package/dist/auth-CYd5Phr-.js +0 -56
  1222. package/dist/auth-D0kGHo1j.js +0 -177
  1223. package/dist/auth-DTPcbxn6.js +0 -550
  1224. package/dist/auth-order-8O0b16i_.js +0 -139
  1225. package/dist/auth-order-CW2AQyNL.js +0 -2
  1226. package/dist/base-url-h8Mhif7l.js +0 -15
  1227. package/dist/bash-tools-8bn5C7K0.js +0 -2824
  1228. package/dist/bash-tools-DZpkBFMY.js +0 -3
  1229. package/dist/bash-tools.exec-runtime-DQVwPD43.js +0 -829
  1230. package/dist/best-effort-delivery-B6BoLJdq.js +0 -22
  1231. package/dist/binding-routing-BMMSo2KY.js +0 -85
  1232. package/dist/binding-targets-Wm55iFsz.js +0 -121
  1233. package/dist/block-streaming-CcRmZONP.js +0 -103
  1234. package/dist/bluebubbles-Cm2jWoAr.js +0 -77
  1235. package/dist/brave-web-search-provider-DXyLEuRX.js +0 -111
  1236. package/dist/brave-web-search-provider.runtime-CH2Ro8gV.js +0 -229
  1237. package/dist/brave-web-search-provider.shared-2wgQI-qy.js +0 -174
  1238. package/dist/bridge-auth-registry-1QsmDpYF.js +0 -23
  1239. package/dist/bridge-server-D3Mo-BM6.js +0 -113
  1240. package/dist/browser-control-auth-BiuDMNP7.js +0 -2
  1241. package/dist/browser-node-runtime-CrigB5UH.js +0 -12
  1242. package/dist/browser-profiles-BJjsWlQ8.js +0 -2
  1243. package/dist/browser-runtime-Dc5sMewB.js +0 -387
  1244. package/dist/browser-setup-tools-CM1H6l0K.js +0 -13
  1245. package/dist/build-8Hzi5z0_.js +0 -550
  1246. package/dist/call-B3rCzXN7.js +0 -3
  1247. package/dist/call-Cmd-rlC2.js +0 -331
  1248. package/dist/call-status-tDrmri32.js +0 -33
  1249. package/dist/call.runtime-B3Hufiov.js +0 -2
  1250. package/dist/capability-cli-Ce3qNXsw.js +0 -1401
  1251. package/dist/card-command-CJdI6sGe.js +0 -241
  1252. package/dist/catalog-provider-DY1ugTDc.js +0 -40
  1253. package/dist/catchup-CPt_Xs3R.js +0 -300
  1254. package/dist/channel-9VLlWEI1.js +0 -350
  1255. package/dist/channel-B-414Az-.js +0 -1100
  1256. package/dist/channel-BEuRg3eQ.js +0 -297
  1257. package/dist/channel-BlN_kpiT.js +0 -840
  1258. package/dist/channel-Bz03tu1a.js +0 -1174
  1259. package/dist/channel-C5Tp1ocZ.js +0 -595
  1260. package/dist/channel-Cp6PItXu.js +0 -1320
  1261. package/dist/channel-CzXZ2Wlv.js +0 -226
  1262. package/dist/channel-DIkT4jcM.js +0 -491
  1263. package/dist/channel-DcywMc0l.js +0 -1802
  1264. package/dist/channel-Dt2V2WJc.js +0 -453
  1265. package/dist/channel-core-BqZwOpId.js +0 -5
  1266. package/dist/channel-inbound-B7Bv-zk9.js +0 -31
  1267. package/dist/channel-plugin-runtime-D2c6-qG7.js +0 -771
  1268. package/dist/channel-resolution-DE2qIsKy.js +0 -39
  1269. package/dist/channel-runtime-CL6Do8kd.js +0 -425
  1270. package/dist/channel-selection-BVycf9oD.js +0 -126
  1271. package/dist/channel-selection.runtime-6URJ5YTl.js +0 -2
  1272. package/dist/channel.runtime-BvuS-PzM.js +0 -2364
  1273. package/dist/channel.runtime-CCct0AmO.js +0 -89
  1274. package/dist/channel.runtime-CSr_Q-Ki.js +0 -26
  1275. package/dist/channel.runtime-DC7FilE-.js +0 -576
  1276. package/dist/channel.runtime-MbysJwT_.js +0 -42398
  1277. package/dist/channel.runtime-RfnLhIct.js +0 -430
  1278. package/dist/channel.runtime-klwS5eJC.js +0 -4
  1279. package/dist/channel.runtime-srmPwBlw.js +0 -67
  1280. package/dist/channel.setup-B2dTQgdm.js +0 -10
  1281. package/dist/channel2.runtime-DPjdUdWe.js +0 -109
  1282. package/dist/channels-Dv75fvTN.js +0 -733
  1283. package/dist/channels-cli-CdOO74YS.js +0 -268
  1284. package/dist/chat-RXBcjTu0.js +0 -2830
  1285. package/dist/chrome-BXAOdA_f.js +0 -1430
  1286. package/dist/chrome-mcp-BxYER6mx.js +0 -600
  1287. package/dist/chrome-mcp-DBAP4O7j.js +0 -2
  1288. package/dist/chrome.executables-DUG48PkZ.js +0 -541
  1289. package/dist/chunk-CW9jTwFk.js +0 -268
  1290. package/dist/clawbot-cli-CFMt_3zm.js +0 -9
  1291. package/dist/cli-BPiKrd4S.js +0 -219
  1292. package/dist/cli-BaH_mH3N.js +0 -154
  1293. package/dist/cli-Bnlo8CdT.js +0 -2
  1294. package/dist/cli-Bv1HNRJ5.js +0 -72
  1295. package/dist/cli-CJjDYqsm.js +0 -3726
  1296. package/dist/cli-D1HCyEF2.js +0 -2
  1297. package/dist/cli-LrPyoM0F.js +0 -2
  1298. package/dist/cli-runner-G69QIenA.js +0 -286
  1299. package/dist/cli-runner.runtime-BLh4ORZH.js +0 -3
  1300. package/dist/cli-runner.runtime-DboAnzrp.js +0 -4
  1301. package/dist/cli.runtime-GlOBpTyx.js +0 -1261
  1302. package/dist/client-ClJyHgmq.js +0 -713
  1303. package/dist/client-PBXIhvrx.js +0 -138
  1304. package/dist/client-info-DZtBR4jU.js +0 -49
  1305. package/dist/command-auth-9KsVrUS6.js +0 -409
  1306. package/dist/command-auth-D11sIoiZ.js +0 -76
  1307. package/dist/command-config-resolution-B9-W4ET0.js +0 -2
  1308. package/dist/command-config-resolution-Wl8868is.js +0 -23
  1309. package/dist/command-config-resolution.runtime-CwcIQOXb.js +0 -2
  1310. package/dist/command-execution-startup-BqLYlG3n.js +0 -324
  1311. package/dist/command-gates-BCh2pNFa.js +0 -47
  1312. package/dist/command-registry-B7IhcWl6.js +0 -4
  1313. package/dist/command-registry-DPR9uz9j.js +0 -9
  1314. package/dist/command-registry-core-B5gwwfVK.js +0 -106
  1315. package/dist/command-secret-gateway-D2Lx9Ky-.js +0 -528
  1316. package/dist/command-status.runtime-CDDbtrG8.js +0 -87
  1317. package/dist/commands-acp-Bt7M70te.js +0 -77
  1318. package/dist/commands-compact.runtime-D5D8CApN.js +0 -10
  1319. package/dist/commands-context-ojGcHTsc.js +0 -38
  1320. package/dist/commands-core.runtime-J-hrpY-n.js +0 -2
  1321. package/dist/commands-handlers.runtime-DQBNyeLG.js +0 -4599
  1322. package/dist/commands-models-83LvrT6B.js +0 -327
  1323. package/dist/commands-reset-hooks-BJ-tN_wz.js +0 -135
  1324. package/dist/commands-status-DWJdDC46.js +0 -16
  1325. package/dist/commands-status.runtime-BwwPceyy.js +0 -3
  1326. package/dist/commands-subagents-control.runtime-DJ396mVU.js +0 -3
  1327. package/dist/commands-subagents-control.runtime-u0Q05DrT.js +0 -2
  1328. package/dist/commands-system-prompt-B2QE_VCG.js +0 -2
  1329. package/dist/commands-system-prompt-amkj1mZm.js +0 -158
  1330. package/dist/commands.runtime-DtaJzRBS.js +0 -167
  1331. package/dist/compact-D0swO4Yn.js +0 -1118
  1332. package/dist/compact.runtime-DoEPFAkB.js +0 -12
  1333. package/dist/completion-cli-Y2gWpjun.js +0 -328
  1334. package/dist/config-Bt-fMiqG.js +0 -252
  1335. package/dist/config-api-DAsbCIov.js +0 -2
  1336. package/dist/config-cli-vQiFMkMf.js +0 -1078
  1337. package/dist/config-compat-B5zS8b4Z.js +0 -130
  1338. package/dist/config-compat-Bc51fcbM.js +0 -126
  1339. package/dist/config-guard-DkhDBkW2.js +0 -96
  1340. package/dist/config-runtime-o9UzLknt.js +0 -32
  1341. package/dist/configure-4GGf_X5o.js +0 -1252
  1342. package/dist/configure-DXNuDvJ5.js +0 -2
  1343. package/dist/connect-options-D4mbwxwf.js +0 -699
  1344. package/dist/control-auth-CW8eEClz.js +0 -125
  1345. package/dist/control-service-v2GS08H6.js +0 -156
  1346. package/dist/control-ui/assets/agents-BskHTW81.js +0 -1052
  1347. package/dist/control-ui/assets/canvas-C0aRpEGd.js +0 -269
  1348. package/dist/control-ui/assets/channels-Cou3VPB8.js +0 -463
  1349. package/dist/control-ui/assets/cron-BTOQWH3p.js +0 -933
  1350. package/dist/control-ui/assets/debug-DFlkgaJr.js +0 -94
  1351. package/dist/control-ui/assets/index-BSKZQZqm.css +0 -1
  1352. package/dist/control-ui/assets/index-yB7WOhLR.js +0 -6210
  1353. package/dist/control-ui/assets/instances-LZGly20d.js +0 -57
  1354. package/dist/control-ui/assets/mcp-D0PCi1zE.js +0 -373
  1355. package/dist/control-ui/assets/nodes-BGzTN7_8.js +0 -618
  1356. package/dist/control-ui/assets/plugins-kalk3SHa.js +0 -273
  1357. package/dist/control-ui/assets/sessions-3I2s2QvS.js +0 -306
  1358. package/dist/control-ui/assets/skills-CVXfvdtq.js +0 -323
  1359. package/dist/control-ui/assets/wallet-0oCbcesL.js +0 -285
  1360. package/dist/control-ui-969zq03L.js +0 -1043
  1361. package/dist/conversation-id-CRePZnKh.js +0 -235
  1362. package/dist/conversation-id-CYPpQ2b_.js +0 -38
  1363. package/dist/conversation-runtime-CsNLbytB.js +0 -31
  1364. package/dist/core-CE92oVKC.js +0 -275
  1365. package/dist/create-5gsvOUrW.js +0 -80
  1366. package/dist/cron-cli-iwMQSWts.js +0 -713
  1367. package/dist/daemon-cli-B2_mPKtr.js +0 -12
  1368. package/dist/dashboard-BgppT7jE.js +0 -2
  1369. package/dist/dashboard-BvirXUKT.js +0 -81
  1370. package/dist/ddg-client-C2_vfwll.js +0 -147
  1371. package/dist/ddg-search-provider-B5vfg-3L.js +0 -54
  1372. package/dist/delegate-CUa3SE1o.js +0 -64
  1373. package/dist/deliver-B8OtkCTN.js +0 -3
  1374. package/dist/deliver-EzzwtNdH.js +0 -747
  1375. package/dist/deliver-runtime-CSD1urwa.js +0 -2
  1376. package/dist/delivery-context-DWhGyo59.js +0 -40
  1377. package/dist/delivery-outbound.runtime-CuQHxHy1.js +0 -6
  1378. package/dist/delivery.runtime-2U6XvLON.js +0 -253
  1379. package/dist/detached-task-runtime-CLeXceLH.js +0 -73
  1380. package/dist/devices-cli-BhL3A8cJ.js +0 -498
  1381. package/dist/diagnostics-CYkTN8yr.js +0 -154
  1382. package/dist/direct-dm-B7BKDOTt.js +0 -64
  1383. package/dist/directive-handling.fast-lane-hTmCaN4B.js +0 -66
  1384. package/dist/directive-handling.impl-CLfhAB3s.js +0 -2
  1385. package/dist/directive-handling.impl-DQCYdyq3.js +0 -703
  1386. package/dist/directive-handling.model-selection-r1oi_Z5Q.js +0 -114
  1387. package/dist/directive-handling.persist.runtime-CKVn6kNl.js +0 -215
  1388. package/dist/directive-handling.shared-DLVXjKip.js +0 -56
  1389. package/dist/directory-cli-Cp5qe7Tb.js +0 -240
  1390. package/dist/dispatch-Dy7iNSXe.js +0 -1131
  1391. package/dist/dispatch-acp-TiM2Vzfh.js +0 -981
  1392. package/dist/dispatch-acp-manager.runtime-IOMdfbvN.js +0 -3
  1393. package/dist/dispatch-acp-media.runtime-D8ZRAL_i.js +0 -4
  1394. package/dist/dispatch-acp-session.runtime-BNf4E79J.js +0 -2
  1395. package/dist/dispatch-acp.runtime-D-O-_uwA.js +0 -19
  1396. package/dist/doctor-config-flow-REpgyGT1.js +0 -420
  1397. package/dist/doctor-config-preflight-DCEuxKBd.js +0 -2
  1398. package/dist/doctor-config-preflight-_gjxioW4.js +0 -63
  1399. package/dist/doctor-contract-U3opYPeO.js +0 -26
  1400. package/dist/doctor-device-pairing-NWw3fVhm.js +0 -307
  1401. package/dist/doctor-gateway-daemon-flow-ciZuB3_y.js +0 -250
  1402. package/dist/doctor-gateway-health-Clb9pKDM.js +0 -63
  1403. package/dist/doctor-health-Dz0Uo3ey.js +0 -59
  1404. package/dist/doctor-health-contributions-B36IgdyB.js +0 -493
  1405. package/dist/doctor-prompter-D6cxwaM6.js +0 -56
  1406. package/dist/doctor-sandbox-CnGh8PIF.js +0 -194
  1407. package/dist/doctor-state-migrations-DlFzkEz6.js +0 -2
  1408. package/dist/doctor-workspace-status-CBsmvySn.js +0 -75
  1409. package/dist/dreaming-CzDMTkOn.js +0 -1582
  1410. package/dist/dreaming-narrative-y806xcaM.js +0 -596
  1411. package/dist/dreaming-shared-C4dysoA0.js +0 -21
  1412. package/dist/embedded-gateway-stub.runtime-CHJcdIyH.js +0 -9
  1413. package/dist/embeddings-CWCkXHbh.js +0 -215
  1414. package/dist/embeddings-http-CdI7ktv7.js +0 -205
  1415. package/dist/exa-web-search-provider-Duy7AQi9.js +0 -80
  1416. package/dist/exa-web-search-provider.runtime-BFsoURiN.js +0 -302
  1417. package/dist/exa-web-search-provider.runtime-DL0X8Ct2.js +0 -2
  1418. package/dist/exec-approval-forwarder.runtime-DTz08HhE.js +0 -3
  1419. package/dist/exec-approval-reply-CKpq6yzn.js +0 -296
  1420. package/dist/exec-approval-reply-CuNQhfNe.js +0 -2
  1421. package/dist/exec-approval-session-target-VmakwuWi.js +0 -176
  1422. package/dist/exec-approvals-cli-D-xC3sec.js +0 -498
  1423. package/dist/exec-defaults-BwOKAzOq.js +0 -2
  1424. package/dist/exec-defaults-C58y025t.js +0 -67
  1425. package/dist/execute.runtime-DOUF94B3.js +0 -1363
  1426. package/dist/fallbacks-5pUORVnh.js +0 -31
  1427. package/dist/fallbacks-WXR5Obc4.js +0 -2
  1428. package/dist/fallbacks-shared-CLY3SckB.js +0 -111
  1429. package/dist/format-Z6ci0mN3.js +0 -176
  1430. package/dist/gateway-Bh4zysny.js +0 -115
  1431. package/dist/gateway-cli-Cn8UyxHT.js +0 -1283
  1432. package/dist/gateway-rpc-DWqAmWHZ.js +0 -14
  1433. package/dist/gateway-rpc.runtime-8RQQdisU.js +0 -23
  1434. package/dist/gateway-runtime-CqSQCYo0.js +0 -15
  1435. package/dist/gateway-status-CRk9P_mQ.js +0 -584
  1436. package/dist/genesis-tools-Bczkn4pa.js +0 -9166
  1437. package/dist/genesis-tools.runtime-DybZ3Sbd.js +0 -2
  1438. package/dist/get-reply-BFleeJ4f.js +0 -3897
  1439. package/dist/get-reply-from-config.runtime-D3inD3tz.js +0 -2
  1440. package/dist/graph-users-6xhmlyu_.js +0 -1337
  1441. package/dist/guarded-json-api-BzmpX7Bh.js +0 -594
  1442. package/dist/health-CMBrLjD5.js +0 -3
  1443. package/dist/health-CYhGu11X.js +0 -469
  1444. package/dist/health-route-C6jiKkgE.js +0 -41
  1445. package/dist/health-route-C6s6ENKx.js +0 -2
  1446. package/dist/heartbeat-runner-Dh9Xx9YU.js +0 -1292
  1447. package/dist/heartbeat-runner-zDpniJi_.js +0 -5
  1448. package/dist/heartbeat-runner.runtime-D4lSdsnQ.js +0 -4
  1449. package/dist/helpers-DZTamQ-L.js +0 -320
  1450. package/dist/hooks-cli-DWDRPcaF.js +0 -433
  1451. package/dist/http-endpoint-helpers-BYmpbInx.js +0 -41
  1452. package/dist/http-headers-BWJ-wWSB.js +0 -11
  1453. package/dist/http-utils-DFEeaWER.js +0 -924
  1454. package/dist/identity-JQch7avk.js +0 -140
  1455. package/dist/image-fallbacks-BdpPq4o8.js +0 -2
  1456. package/dist/image-fallbacks-GxUehr7F.js +0 -31
  1457. package/dist/image-generation-provider-Bs8dan-F.js +0 -95
  1458. package/dist/image-generation-provider-Ca75_MHL.js +0 -63
  1459. package/dist/image-generation-provider-Cumlkwcm.js +0 -228
  1460. package/dist/image-generation-provider-DAAncrN2.js +0 -529
  1461. package/dist/image-generation-provider-LZz_eWeh.js +0 -157
  1462. package/dist/image-generation-provider-xE4TSEUN.js +0 -274
  1463. package/dist/inbound-reply-dispatch-DRjQ7qlQ.js +0 -73
  1464. package/dist/inbound.runtime-B3E6TUQ-.js +0 -4
  1465. package/dist/inbound.runtime-BsJCJ9wE.js +0 -3
  1466. package/dist/infra-runtime-pY0nhq7P.js +0 -39
  1467. package/dist/init-BFVKFRp9.js +0 -59
  1468. package/dist/install-signal-cli-Aj1HHG57.js +0 -202
  1469. package/dist/jobs-CzIiEiXa.js +0 -734
  1470. package/dist/kimi-web-search-provider-g6k5oyqw.js +0 -80
  1471. package/dist/kimi-web-search-provider.runtime-B5Y_iP-w.js +0 -2
  1472. package/dist/kimi-web-search-provider.runtime-D9mGNz4w.js +0 -261
  1473. package/dist/library-BpP85Umq.js +0 -45
  1474. package/dist/lifecycle-C69VoOuS.js +0 -229
  1475. package/dist/lifecycle-zC5_kLvH.js +0 -571
  1476. package/dist/lifecycle.runtime-DN9n10Ar.js +0 -2
  1477. package/dist/list-CZePHMYk.js +0 -2
  1478. package/dist/list-D-39rkJG.js +0 -2
  1479. package/dist/list-D9R6bffC.js +0 -1212
  1480. package/dist/list-J_MIp9Cf.js +0 -131
  1481. package/dist/list.probe-BJI7RpM4.js +0 -419
  1482. package/dist/live-model-switch-1UTJZ5QI.js +0 -336
  1483. package/dist/llm-slug-generator-CB-9wD87.js +0 -79
  1484. package/dist/load-config-Cokd9aKd.js +0 -35
  1485. package/dist/local-dispatch.runtime-DfmGw3hN.js +0 -8
  1486. package/dist/login-Ca9f5om9.js +0 -108
  1487. package/dist/logs-cli-Dz0aORYp.js +0 -265
  1488. package/dist/logs-cli.runtime-DgpP6kgG.js +0 -2
  1489. package/dist/main-session-restart-recovery-BdWx2-Ig.js +0 -206
  1490. package/dist/managed-image-attachments-BTEZZFPC.js +0 -2
  1491. package/dist/managed-image-attachments-BXwFe_hB.js +0 -635
  1492. package/dist/manager-49WINgRB.js +0 -3114
  1493. package/dist/manager-CKWINDnN.js +0 -2
  1494. package/dist/manager-DXquZHPE.js +0 -2057
  1495. package/dist/markdown-to-line-DuPPNWHb.js +0 -790
  1496. package/dist/mcp-cli-BgjBxFLB.js +0 -725
  1497. package/dist/mcp-http-CXz6iTV9.js +0 -529
  1498. package/dist/media-contract-api-Dn7Z9fVR.js +0 -2
  1499. package/dist/media-contract-g0U7MSOk.js +0 -49
  1500. package/dist/media-runtime-DKL6xud8.js +0 -329
  1501. package/dist/memory-Cvmtd7SS.js +0 -342
  1502. package/dist/memory-core-host-runtime-cli-DZAsYda3.js +0 -9
  1503. package/dist/memory-embedding-adapter-D58z4Hjn.js +0 -123
  1504. package/dist/message-DqFmV6vo.js +0 -232
  1505. package/dist/message-action-runner-B-6rT67S.js +0 -1407
  1506. package/dist/message-action-runner-Ds9MNZPn.js +0 -2
  1507. package/dist/message-actions-Bvs23y8w.js +0 -143
  1508. package/dist/message-channel-bhWoqTRw.js +0 -56
  1509. package/dist/message-secret-scope-CEVGxySq.js +0 -103
  1510. package/dist/message.gateway.runtime-CT0DJ45B.js +0 -2
  1511. package/dist/method-scopes-DZxEwSC9.js +0 -228
  1512. package/dist/minimax-web-search-provider-4scwuRzS.js +0 -53
  1513. package/dist/minimax-web-search-provider.runtime-Bc1tLmEn.js +0 -140
  1514. package/dist/minimax-web-search-provider.runtime-DirtikTO.js +0 -2
  1515. package/dist/mock-DjlwRj77.js +0 -136
  1516. package/dist/model-definitions-DAfZ2fCD.js +0 -260
  1517. package/dist/model-overrides-C47kuXVC.js +0 -104
  1518. package/dist/model-selection-B0e0JNhN.js +0 -213
  1519. package/dist/models-CEyQw90_.js +0 -47
  1520. package/dist/models-CQV1b487.js +0 -760
  1521. package/dist/models-CXOS_VP1.js +0 -157
  1522. package/dist/models-CfTF8Fbp.js +0 -569
  1523. package/dist/models-auth-status-CtbfpiLe.js +0 -217
  1524. package/dist/models-cli-DKlGXayC.js +0 -271
  1525. package/dist/models-http-DWu9XkAU.js +0 -92
  1526. package/dist/models.fetch-BVY3QlcA.js +0 -518
  1527. package/dist/monitor-BrQZ38sV.js +0 -1661
  1528. package/dist/monitor-C2olcPaB.js +0 -1237
  1529. package/dist/monitor-C32pQJf0.js +0 -788
  1530. package/dist/monitor-DWDZx3af.js +0 -2
  1531. package/dist/monitor-DuB8d2_N.js +0 -671
  1532. package/dist/monitor-DwAHrb0v.js +0 -295
  1533. package/dist/monitor-auth-ym3-n10B.js +0 -207
  1534. package/dist/monitor-fV4pkrv-.js +0 -1459
  1535. package/dist/monitor-processing-Cnjt-86E.js +0 -1974
  1536. package/dist/monitor.runtime-m4hyBv5_.js +0 -2
  1537. package/dist/monitor.webhook-DpQqy92z.js +0 -180
  1538. package/dist/msteams-CEC38YQX.js +0 -35
  1539. package/dist/music-generation-provider-DR8TlAd7.js +0 -63
  1540. package/dist/music-generation-provider-UU2xosmd.js +0 -170
  1541. package/dist/native-hook-relay-ALDxVrJR.js +0 -519
  1542. package/dist/native-web-search-DE6wKTD7.js +0 -64
  1543. package/dist/nextcloud-talk-D6l_ncY6.js +0 -17
  1544. package/dist/node-cli-B4fFzsbt.js +0 -2276
  1545. package/dist/nodes-cli-DPOCIMd6.js +0 -1046
  1546. package/dist/nodes-utils-DXJ9uuER.js +0 -84
  1547. package/dist/nodes.helpers-DYpGCFer.js +0 -34
  1548. package/dist/notify-CDGsB-f1.js +0 -315
  1549. package/dist/onboard-BAKpU8Hh2.js +0 -49
  1550. package/dist/onboard-BPXard5r.js +0 -316
  1551. package/dist/onboard-BhyqJz5g.js +0 -2
  1552. package/dist/onboard-CYwvwcjK.js +0 -25
  1553. package/dist/onboard-DEkkXwRP.js +0 -58
  1554. package/dist/onboard-DcPiUfS6.js +0 -70
  1555. package/dist/onboard-UUvy9YwT.js +0 -29
  1556. package/dist/onboard-g4ijsx6R.js +0 -25
  1557. package/dist/onboard-helpers-DD5g-FbW.js +0 -204
  1558. package/dist/onboard-helpers-DRudISKo.js +0 -6
  1559. package/dist/onboard-iJRhJj4E.js +0 -25
  1560. package/dist/onboard-interactive-DxupaeWe.js +0 -24
  1561. package/dist/onboard-non-interactive-BCIl9AIV.js +0 -635
  1562. package/dist/onboard-remote-By9HP4eT.js +0 -193
  1563. package/dist/onboard-remote-r9H76BMI.js +0 -2
  1564. package/dist/onboard-skills-BbXkZVWi.js +0 -2
  1565. package/dist/onboard-skills-Bj6v5Fc2.js +0 -134
  1566. package/dist/openai-codex-auth-identity-DDVrnkGx.js +0 -45
  1567. package/dist/openai-codex-device-code-vaMr3ktu.js +0 -164
  1568. package/dist/openai-codex-provider-BgIrfq5f.js +0 -472
  1569. package/dist/openai-codex-shared-i8zMv9Wn.js +0 -6
  1570. package/dist/openai-http-3hSjTiC9.js +0 -500
  1571. package/dist/openai-provider-BRJBMcdJ.js +0 -313
  1572. package/dist/openresponses-http-DCEEmL6J.js +0 -1128
  1573. package/dist/operator-approvals-client-gaflvETF.js +0 -68
  1574. package/dist/outbound-media-Bh4sEXyv.js +0 -57
  1575. package/dist/outbound-runtime-CNL02KHG.js +0 -5
  1576. package/dist/outbound.runtime-DNeZz0qd.js +0 -2
  1577. package/dist/pair-command-approve-DVG9ZQOz.js +0 -44
  1578. package/dist/perplexity-web-search-provider-CIwymV16.js +0 -92
  1579. package/dist/perplexity-web-search-provider.runtime-CIrANP8t.js +0 -324
  1580. package/dist/perplexity-web-search-provider.runtime-GuZxipp7.js +0 -2
  1581. package/dist/persistent-bindings.lifecycle-DO0CXQku.js +0 -2
  1582. package/dist/persistent-bindings.lifecycle-yyMTI5wL.js +0 -85
  1583. package/dist/pi-embedded-G_7qiYrd.js +0 -2905
  1584. package/dist/pi-embedded-RNv_18Ql.js +0 -4
  1585. package/dist/pi-embedded-subscribe.handlers.compaction.runtime-B0obozHf.js +0 -23
  1586. package/dist/pi-embedded.runtime-DgLkukEn.js +0 -4
  1587. package/dist/pi-tool-definition-adapter-CAxVoliV.js +0 -229
  1588. package/dist/pi-tools-DLzCdu_A.js +0 -1057
  1589. package/dist/pi-tools.before-tool-call-CXqyPFQ7.js +0 -2
  1590. package/dist/pi-tools.before-tool-call-DgEuyrNS.js +0 -433
  1591. package/dist/plivo-B2yZjL-u.js +0 -394
  1592. package/dist/plugin--KkHkZKl.js +0 -12195
  1593. package/dist/plugin-enabled-DOVricci.js +0 -140
  1594. package/dist/plugin-registration-BsNMVImp.js +0 -23
  1595. package/dist/plugin-service-CAdEnLLQ.js +0 -2892
  1596. package/dist/policy-6PXLgKPZ.js +0 -328
  1597. package/dist/prepare.runtime-asu7nymR.js +0 -815
  1598. package/dist/probe-8nNaZ33e.js +0 -45
  1599. package/dist/probe-BOlTfbzG.js +0 -2
  1600. package/dist/probe-BicpMUHr.js +0 -74
  1601. package/dist/probe-BoAfs3v0.js +0 -243
  1602. package/dist/probe-C2UYvuU1.js +0 -1443
  1603. package/dist/probe-D3-S54s4.js +0 -2
  1604. package/dist/probe-D7gHyiZV.js +0 -241
  1605. package/dist/probe-Dauysr9a.js +0 -32
  1606. package/dist/probe-DqbaFZ8U.js +0 -2205
  1607. package/dist/probe.runtime-D1TENrHH.js +0 -2
  1608. package/dist/program-C_hsOWv5.js +0 -111
  1609. package/dist/prompt-select-styled-CuuJ3YZI.js +0 -20
  1610. package/dist/protocol-DxLbSF2J.js +0 -2477
  1611. package/dist/provider-3GpsNTSy.js +0 -70
  1612. package/dist/provider-catalog-BSXiLKUb.js +0 -24
  1613. package/dist/provider-catalog-BfrRkDb6.js +0 -26
  1614. package/dist/provider-catalog-CQOOAKUd.js +0 -11
  1615. package/dist/provider-catalog-DuplUDCj.js +0 -12
  1616. package/dist/provider-catalog-nmYuB55e.js +0 -11
  1617. package/dist/provider-compat-Cmc7Dpb2.js +0 -37
  1618. package/dist/provider-dispatcher-C98nuGtx.js +0 -2
  1619. package/dist/provider-dispatcher-U0bjp31x.js +0 -22
  1620. package/dist/provider-models-CQ8YMhIq.js +0 -35
  1621. package/dist/provider-models-xoUb7pnU.js +0 -119
  1622. package/dist/provider-registration-B5Xbkn85.js +0 -218
  1623. package/dist/pw-ai-B0xjo-Hb.js +0 -2511
  1624. package/dist/pw-role-snapshot-DfdV7JMN.js +0 -380
  1625. package/dist/qmd-manager-DtShFCys.js +0 -1921
  1626. package/dist/qr-cli-D38r9mtY.js +0 -2
  1627. package/dist/qr-cli-Wbrc0tcy.js +0 -349
  1628. package/dist/qr-image-BQhzr3CC.js +0 -2
  1629. package/dist/queue-DyWzQqJh.js +0 -409
  1630. package/dist/reaction-runtime-api-BZCWmrll.js +0 -116
  1631. package/dist/reactions-BmhlLeFI.js +0 -998
  1632. package/dist/read-capability-B0mVFrNe.js +0 -412
  1633. package/dist/realtime-provider-shared-CKounRGH.js +0 -37
  1634. package/dist/realtime-transcription-provider-BjwZyKME.js +0 -120
  1635. package/dist/realtime-transcription-provider-CSQuayAt.js +0 -183
  1636. package/dist/realtime-transcription-provider-Cr86v5pA.js +0 -184
  1637. package/dist/realtime-transcription-provider-DFdWvvWN.js +0 -184
  1638. package/dist/realtime-transcription-provider-Da6Yg9O_.js +0 -172
  1639. package/dist/realtime-voice-provider-DP4ad0L4.js +0 -489
  1640. package/dist/record-shared-B5MzAU-n.js +0 -10
  1641. package/dist/register-service-commands-B2Ky9P6l.js +0 -71
  1642. package/dist/register.agent-C9UIPMzI.js +0 -248
  1643. package/dist/register.configure-DlvVdJGK.js +0 -15
  1644. package/dist/register.maintenance-4q078BpS.js +0 -363
  1645. package/dist/register.message-Dyafa7wU.js +0 -329
  1646. package/dist/register.onboard-R4VgPeqI.js +0 -88
  1647. package/dist/register.runtime-Eju4Gltw.js +0 -81
  1648. package/dist/register.setup-DCnMQggx.js +0 -150
  1649. package/dist/register.status-health-sessions-DrZEX_C3.js +0 -1215
  1650. package/dist/register.subclis-C8MYnxZ0.js +0 -29
  1651. package/dist/register.subclis-DXRcUQY-.js +0 -3
  1652. package/dist/register.subclis-core-CKrFtMnT.js +0 -249
  1653. package/dist/replay-policy-BXxBsUQj.js +0 -8
  1654. package/dist/reply-chunking-CQ-Mda9f.js +0 -3
  1655. package/dist/reply-dispatch-runtime-DrCMM_h6.js +0 -13
  1656. package/dist/reply-media-paths.runtime-Dm7QsGx1.js +0 -146
  1657. package/dist/reply-media-paths.runtime-N1vQKI2t.js +0 -2
  1658. package/dist/reply-payload-transform-DXQFdUjX.js +0 -720
  1659. package/dist/reply-runtime-BEbR4D-L.js +0 -11
  1660. package/dist/reply.runtime-k1wfQvE8.js +0 -2
  1661. package/dist/reset-PRwf7E1a.js +0 -84
  1662. package/dist/reset-authorization-DnCXXdJm.js +0 -34
  1663. package/dist/response-generator-CfYnwr-R.js +0 -175
  1664. package/dist/restart-health-BjmfJCUM.js +0 -202
  1665. package/dist/restart-health-hw909zlD.js +0 -2
  1666. package/dist/root-help-DetBH1U3.js +0 -44
  1667. package/dist/route-reply-DCdEIaJm.js +0 -162
  1668. package/dist/route-reply.runtime-CCoWkbHJ.js +0 -2
  1669. package/dist/routes-CBHvnNAn.js +0 -3341
  1670. package/dist/routes-CM5XFUol.js +0 -2
  1671. package/dist/routing-DB6Hmk1m.js +0 -5
  1672. package/dist/rpc-DejtQFPW.js +0 -61
  1673. package/dist/rpc-context-C-K-u97k.js +0 -17
  1674. package/dist/rpc.runtime-CvFF6IfX.js +0 -21
  1675. package/dist/run-auth-profile.runtime-CBF7l6AJ.js +0 -2
  1676. package/dist/run-delivery.runtime-mrFGIUBn.js +0 -530
  1677. package/dist/run-embedded.runtime-Bi_aGXZl.js +0 -4
  1678. package/dist/run-execution-cli.runtime-CJ5bRUst.js +0 -4
  1679. package/dist/run-executor.runtime-C2nEQ7H5.js +0 -277
  1680. package/dist/run-main-C4eOl9O3.js +0 -567
  1681. package/dist/run-subagent-registry.runtime-Wv4vcMON.js +0 -2
  1682. package/dist/run-wait-J2xqMO0Y.js +0 -135
  1683. package/dist/runtime-BWI1Yc19.js +0 -9
  1684. package/dist/runtime-BvrYBFWw.js +0 -107
  1685. package/dist/runtime-YN3DqmXj.js +0 -72
  1686. package/dist/runtime-api-B7_47clB.js +0 -9
  1687. package/dist/runtime-api-CCSSXW6u.js +0 -4
  1688. package/dist/runtime-api-CHqMki_k.js +0 -9
  1689. package/dist/runtime-api-FyNFEQa6.js +0 -14
  1690. package/dist/runtime-embedded-pi.runtime-CKKAqNJ9.js +0 -2
  1691. package/dist/runtime-entry-T6UII6Wf.js +0 -2769
  1692. package/dist/runtime-internal-BsETZzZr.js +0 -2
  1693. package/dist/runtime-lZ_xBQn6.js +0 -973
  1694. package/dist/runtime-options-DYh6T1p4.js +0 -275
  1695. package/dist/runtime-provider-C0RXuzkp.js +0 -21
  1696. package/dist/runtime-schema-DjdB9Mgh.js +0 -28588
  1697. package/dist/sandbox-Ctv6fRri.js +0 -3
  1698. package/dist/sandbox-cli-DlgKqSYU.js +0 -450
  1699. package/dist/sandbox-xqJ6gg8T.js +0 -1156
  1700. package/dist/scan-C4AL0vV5.js +0 -2
  1701. package/dist/scan-CiyGLsBp.js +0 -523
  1702. package/dist/secrets-cli-BzZc1dlc.js +0 -2101
  1703. package/dist/security-cli-D7WSpDIp.js +0 -486
  1704. package/dist/selection-BTj1orBr.js +0 -2
  1705. package/dist/selection-Bj9s46tI.js +0 -7764
  1706. package/dist/send-D1BQp5zh.js +0 -102
  1707. package/dist/send-KwF2Hkrg.js +0 -534
  1708. package/dist/send-pMWIOnb1.js +0 -156
  1709. package/dist/send.runtime-BY-fpUGh.js +0 -2
  1710. package/dist/server-4wSXAqKZ.js +0 -77
  1711. package/dist/server-CM6IcXrJ.js +0 -13
  1712. package/dist/server-context-LGN_v6Pr.js +0 -847
  1713. package/dist/server-context-uC_sh4Qx.js +0 -2
  1714. package/dist/server-middleware-DlVw3WGo.js +0 -120
  1715. package/dist/server-node-events-DRqk_sSG.js +0 -481
  1716. package/dist/server-plugin-bootstrap-DT7hMrEB.js +0 -12989
  1717. package/dist/server-plugin-bootstrap-DbgT8s3b.js +0 -2
  1718. package/dist/server-restart-sentinel-DJg1jibz.js +0 -697
  1719. package/dist/server.impl-KfCHHYM3.js +0 -12869
  1720. package/dist/session-D4GawBOc.js +0 -48
  1721. package/dist/session-envelope-BuDz-uci.js +0 -18
  1722. package/dist/session-key-BDzsY9ry.js +0 -65
  1723. package/dist/session-kill-http-BtXfgdg5.js +0 -110
  1724. package/dist/session-meta-DSbdkLPg.js +0 -109
  1725. package/dist/session-override-DvpYNjEy.js +0 -106
  1726. package/dist/session-reset-model.runtime-TJuluskH.js +0 -133
  1727. package/dist/session-reset-service-hc2O1o2q.js +0 -497
  1728. package/dist/session-route-dSc-ZfJV.js +0 -93
  1729. package/dist/session-status.runtime-DBOWNGE0.js +0 -2
  1730. package/dist/session-store-CH0Ic73R.js +0 -126
  1731. package/dist/session-store.runtime-BLzP0kKb.js +0 -2
  1732. package/dist/session-subagent-reactivation.runtime-DLwmbVAj.js +0 -2
  1733. package/dist/session-tab-registry-C30tFUHP.js +0 -581
  1734. package/dist/session-updates-CNv8yQTZ.js +0 -236
  1735. package/dist/session-updates.runtime-BI1pPG-y.js +0 -2
  1736. package/dist/session-utils-BtcpsVXK.js +0 -1009
  1737. package/dist/session-visibility-mu61Cazj.js +0 -147
  1738. package/dist/sessions-BY-N1ODJ.js +0 -2
  1739. package/dist/sessions-BaBnI48b.js +0 -48
  1740. package/dist/sessions-DgCDR090.js +0 -16
  1741. package/dist/sessions-DwbTRE7z.js +0 -281
  1742. package/dist/sessions-helpers-Boau-Mgl.js +0 -305
  1743. package/dist/sessions-history-http-JaZfsaow.js +0 -383
  1744. package/dist/sessions-patch-CGza9U1J.js +0 -309
  1745. package/dist/sessions-resolve-CxsMxrnz.js +0 -174
  1746. package/dist/sessions.runtime-B-dhGJmG.js +0 -2
  1747. package/dist/setup-Dld60Kw0.js +0 -636
  1748. package/dist/setup-XAAowspF.js +0 -421
  1749. package/dist/setup-api-qytGcCw9.js +0 -29
  1750. package/dist/setup-core-4RX2I3E7.js +0 -176
  1751. package/dist/setup-core-BDZ0GEn7.js +0 -171
  1752. package/dist/setup-core-BagQlOhA.js +0 -184
  1753. package/dist/setup-core-DFDx-2sA.js +0 -393
  1754. package/dist/setup-surface-BFIZR2UD.js +0 -286
  1755. package/dist/setup-surface-BNFYOzmc.js +0 -3
  1756. package/dist/setup-surface-C5F8cr6e2.js +0 -403
  1757. package/dist/setup-surface-CArOZxWv.js +0 -72
  1758. package/dist/setup-surface-D5kQP_5C.js +0 -219
  1759. package/dist/setup-surface-uNLwReGA.js +0 -351
  1760. package/dist/setup.finalize-DanHcKdm.js +0 -547
  1761. package/dist/setup.gateway-config-BfYDHl2S.js +0 -250
  1762. package/dist/shared-CHz0sVK9.js +0 -186
  1763. package/dist/shared-CaYwmZh_.js +0 -76
  1764. package/dist/shared-DZLuHh9i.js +0 -121
  1765. package/dist/shared-Doh9gWDF.js +0 -198
  1766. package/dist/shared-IhxU1SqF.js +0 -60
  1767. package/dist/shared-Xx-lZLWj.js +0 -217
  1768. package/dist/shared-runtime-BtwYWnp-.js +0 -7
  1769. package/dist/short-term-promotion-B_3UbQd-.js +0 -1543
  1770. package/dist/skill-commands-X1-SuzeM.js +0 -83
  1771. package/dist/skill-commands.runtime-DtDW-HM9.js +0 -2
  1772. package/dist/skills-snapshot.runtime-CA04_tLs.js +0 -7
  1773. package/dist/slash-state-C5V_rwuh.js +0 -1911
  1774. package/dist/speech-provider-Bs22xK7f.js +0 -216
  1775. package/dist/speech-provider-DH35IJrp.js +0 -395
  1776. package/dist/speech-provider-DJhp-WGc.js +0 -170
  1777. package/dist/speech-provider-TuMZXjYA.js +0 -209
  1778. package/dist/speech-provider-bfFcbOuQ.js +0 -184
  1779. package/dist/speech-provider-eDdGrCL3.js +0 -209
  1780. package/dist/speech-provider-hFc3R_JS.js +0 -103
  1781. package/dist/src-CbvReXTF.js +0 -3974
  1782. package/dist/stage-sandbox-media.runtime-BBZVC4gy.js +0 -232
  1783. package/dist/startup-context-BhbpkDRe.js +0 -312
  1784. package/dist/state-migrations-BcK6CUBE.js +0 -820
  1785. package/dist/status-6TVRvc0X.js +0 -2
  1786. package/dist/status-BXUtOoXd.js +0 -190
  1787. package/dist/status-BYxVnJ4t.js +0 -62
  1788. package/dist/status-CASjTsed.js +0 -3
  1789. package/dist/status-CozhtuYB.js +0 -2
  1790. package/dist/status-DtWC4gU2.js +0 -397
  1791. package/dist/status-all-RMu-gp_i.js +0 -498
  1792. package/dist/status-json-C05vJFn8.js +0 -14
  1793. package/dist/status-json-command-CM9ioz3P.js +0 -84
  1794. package/dist/status-message-CqkaBWzr.js +0 -466
  1795. package/dist/status-message.runtime-qXxrcsiN.js +0 -6
  1796. package/dist/status-queue.runtime-C7PIZ71w.js +0 -2
  1797. package/dist/status-runtime-shared-CilAS_RU.js +0 -257
  1798. package/dist/status-subagents.runtime-_MQiX_ZF.js +0 -18
  1799. package/dist/status-text-Cbbo5gTy.js +0 -237
  1800. package/dist/status-xCBvRTwU.js +0 -209
  1801. package/dist/status.gateway-connection.runtime-CpCUmiCK.js +0 -2
  1802. package/dist/status.gather-B_e7gqcb.js +0 -2
  1803. package/dist/status.gather-DeoHK2V7.js +0 -292
  1804. package/dist/status.runtime-CCrtR3yP.js +0 -2
  1805. package/dist/status.runtime-IgA-WP26.js +0 -2
  1806. package/dist/status.scan-BywaTUGM.js +0 -65
  1807. package/dist/status.scan-overview-Bg0PxIss.js +0 -379
  1808. package/dist/status.scan.fast-json-Bf3f1o0d.js +0 -2
  1809. package/dist/status.scan.fast-json-D7_WMvuZ.js +0 -132
  1810. package/dist/status.summary-BoGDDE4X.js +0 -214
  1811. package/dist/status.summary-b0S78Iju.js +0 -2
  1812. package/dist/store-BXDBdpSq.js +0 -4
  1813. package/dist/store-DOwpgFxf.js +0 -910
  1814. package/dist/store.runtime-1QGWUWou.js +0 -2
  1815. package/dist/stream-BsnsNxOA.js +0 -664
  1816. package/dist/stream-DEH1-1Is.js +0 -134
  1817. package/dist/stt-CJtlkVDc.js +0 -66
  1818. package/dist/subagent-announce-delivery-DwS6sI24.js +0 -726
  1819. package/dist/subagent-announce-gxWOuvuY.js +0 -351
  1820. package/dist/subagent-announce-output-C5ButdYI.js +0 -364
  1821. package/dist/subagent-capabilities-DIIDgPnB.js +0 -251
  1822. package/dist/subagent-control-C-Am1OtB.js +0 -506
  1823. package/dist/subagent-control.runtime-BK2jtN2v.js +0 -3
  1824. package/dist/subagent-followup.runtime-DoLAbwOo.js +0 -68
  1825. package/dist/subagent-orphan-recovery-BzDS5O1i.js +0 -305
  1826. package/dist/subagent-registry-BIgNPHJQ.js +0 -1753
  1827. package/dist/subagent-registry-an_oHM4b.js +0 -3
  1828. package/dist/subagent-spawn-BKFMuv1y.js +0 -1005
  1829. package/dist/system-cli-IAtoOtwN.js +0 -59
  1830. package/dist/system-prompt-D-MqNnG1.js +0 -640
  1831. package/dist/tables-Bfl7YTbb.js +0 -829
  1832. package/dist/target-id-BbLPfw0-.js +0 -107
  1833. package/dist/targets-DWXe3mQm.js +0 -67
  1834. package/dist/targets-bhZeEbJG.js +0 -207
  1835. package/dist/targets.runtime-By8N_Qv0.js +0 -2
  1836. package/dist/task-executor-CL1pQUmi.js +0 -360
  1837. package/dist/task-owner-access-B2tFCiT1.js +0 -74
  1838. package/dist/task-registry-CGDnoG_A.js +0 -2366
  1839. package/dist/task-registry-delivery-runtime-DOHFM4em.js +0 -3
  1840. package/dist/task-registry-delivery-runtime-DSl-VyA2.js +0 -2
  1841. package/dist/task-registry.maintenance-BJzi71wn.js +0 -416
  1842. package/dist/task-registry.maintenance-BxKAIJuE.js +0 -2
  1843. package/dist/tavily-client-CJtIuNuZ.js +0 -193
  1844. package/dist/tavily-client-cnGyIHjo.js +0 -2
  1845. package/dist/tavily-search-provider-BGV8D2VZ.js +0 -62
  1846. package/dist/telnyx-fGTIDZqb.js +0 -260
  1847. package/dist/testing-CqUqcJNQ.js +0 -575
  1848. package/dist/text-report-Cky4UA35.js +0 -587
  1849. package/dist/text-runtime-BOpYwhuR.js +0 -290
  1850. package/dist/tool-config-shared-C0rslp8t.js +0 -19
  1851. package/dist/tool-policy-pipeline-qhEZzHB-.js +0 -109
  1852. package/dist/tool-resolution-CjbwGHcJ.js +0 -90
  1853. package/dist/tools-effective-inventory-C70Ug651.js +0 -152
  1854. package/dist/tools-invoke-http-DcRsw9EO.js +0 -206
  1855. package/dist/tools.runtime-B-fcXtvL.js +0 -4
  1856. package/dist/transcript-CTF8zJ2t.js +0 -312
  1857. package/dist/transcript-resolve.runtime-C41xgFnA.js +0 -2
  1858. package/dist/transcript.runtime-DNBFm0LS.js +0 -2
  1859. package/dist/transport-policy-Ivm5ArSd.js +0 -75
  1860. package/dist/trash-CVoAJSAx.js +0 -24
  1861. package/dist/tts-B5G7JHka.js +0 -64
  1862. package/dist/tts-CWykD0rc.js +0 -183
  1863. package/dist/tui-cli-CNanJyFI.js +0 -4575
  1864. package/dist/twilio-B-dBW4_4.js +0 -609
  1865. package/dist/typing-policy-CCK9_cHb.js +0 -12
  1866. package/dist/update-cli-D-uofyXb.js +0 -1759
  1867. package/dist/upgrade-gspO3C-l.js +0 -1226
  1868. package/dist/video-generation-provider-BoKNqi7G.js +0 -254
  1869. package/dist/video-generation-provider-C2PI4-Wg.js +0 -271
  1870. package/dist/video-generation-provider-CDTvRCSr.js +0 -287
  1871. package/dist/video-generation-provider-CDxxol9M.js +0 -281
  1872. package/dist/video-generation-provider-CgDT1u2M.js +0 -187
  1873. package/dist/video-generation-provider-CtC5lXew.js +0 -78
  1874. package/dist/video-generation-provider-DTD47wPw.js +0 -118
  1875. package/dist/video-generation-provider-DqaWr1z8.js +0 -264
  1876. package/dist/video-generation-provider-yuS2SQIL.js +0 -221
  1877. package/dist/video-generation-task-status-BFReBMsX.js +0 -163
  1878. package/dist/voice-mapping-D2aNmRet.js +0 -41
  1879. package/dist/wait-for-idle-before-flush-BFfZxSMK.js +0 -5986
  1880. package/dist/web-search-njsvDPGV.js +0 -61
  1881. package/dist/web-search-provider-Bb1jo3tv.js +0 -163
  1882. package/dist/web-search-provider.runtime-B8p_cAp6.js +0 -185
  1883. package/dist/web-search-provider.runtime-xlnZGUCc.js +0 -2
  1884. package/dist/webhook-shared-CZt-kRIg.js +0 -12
  1885. package/dist/wizard-models-YsngRy_Q.js +0 -334
  1886. package/dist/workflow-runtime-Be-w_Xn7.js +0 -485
  1887. package/dist/workspace-run-CHsJxomp.js +0 -70
  1888. package/dist/x-search-config-ikE_9hVQ.js +0 -36
  1889. package/dist/x-search-shared-Cl-mTkkU.js +0 -75
  1890. package/dist/zalo-js-D6IiDKzH.js +0 -1157
@@ -0,0 +1,4599 @@
1
+ import { i as formatErrorMessage } from "./errors-CufR9eHH.js";
2
+ import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, i as normalizeFastMode, s as normalizeOptionalLowercaseString } from "./string-coerce-DPP_aYVc.js";
3
+ import { m as resolveUserPath, r as clampInt } from "./utils-CWrkFsp0.js";
4
+ import { _ as resolveStateDir } from "./paths-Bv2rGpO9.js";
5
+ import { r as logVerbose } from "./globals-wYf9_gv5.js";
6
+ import { s as normalizeStringEntries } from "./string-normalization-Bsx26hdl.js";
7
+ import { a as clearPluginManifestRegistryCache } from "./manifest-registry-CUSRRX5s.js";
8
+ import { E as validateConfigObjectWithPlugins, F as setConfigOverride, I as unsetConfigOverride, N as getConfigOverrides, P as resetConfigOverrides, u as readConfigFileSnapshot, y as writeConfigFile } from "./io-BbxW7tf4.js";
9
+ import { r as normalizeOptionalAccountId } from "./account-id-CTXHUezn.js";
10
+ import { u as resolveAgentIdFromSessionKey } from "./session-key-Cj8Hd5K-.js";
11
+ import { o as normalizeChannelId } from "./registry-CdBbOzac.js";
12
+ import { i as normalizeChannelId$1, t as getChannelPlugin } from "./registry-BHSrOwSF.js";
13
+ import { i as unsetConfigValueAtPath, n as parseConfigPath, r as setConfigValueAtPath, t as getConfigValueAtPath } from "./config-paths-s_8tbgaF.js";
14
+ import { b as resolveAgentWorkspaceDir, p as resolveSessionAgentId, y as resolveAgentDir } from "./agent-scope-Duyu_T59.js";
15
+ import { t as parseDurationMs } from "./parse-duration-CkHLPGPv.js";
16
+ import { n as isMcpCommandEnabled, r as isRestartEnabled, t as isCommandFlagEnabled } from "./commands.flags-CIvSlgUV.js";
17
+ import "./config-De9ZYLYC.js";
18
+ import { i as GATEWAY_CLIENT_NAMES, r as GATEWAY_CLIENT_MODES } from "./client-info-DeQMz3zN.js";
19
+ import { r as isInternalMessageChannel, u as normalizeMessageChannel } from "./message-channel-DGBKBihv.js";
20
+ import { n as resolveChannelApprovalCapability } from "./plugins-vNuCzel8.js";
21
+ import { m as triggerInternalHook, n as createInternalHookEvent } from "./internal-hooks-NxTc8JXb.js";
22
+ import { x as prepareProviderRuntimeAuth } from "./provider-runtime-C7wYnk77.js";
23
+ import { t as ensureGenesisModelsJson } from "./models-config-CeUPFAD0.js";
24
+ import { g as resolveResponseUsageMode, m as normalizeUsageDisplay } from "./thinking-ItWMrRTh.js";
25
+ import { t as requireApiKey } from "./model-auth-runtime-shared-Czq1-Ajx.js";
26
+ import { i as discoverModels, r as discoverAuthStorage } from "./pi-model-discovery-C2fdTlnx.js";
27
+ import { a as resolveSessionFilePathOptions, i as resolveSessionFilePath, r as resolveDefaultSessionStorePath } from "./paths-CV1IubzZ.js";
28
+ import { t as loadSessionStore } from "./store-load-DaPvctit.js";
29
+ import { o as resolveFreshSessionTotalTokens } from "./types-DhjMRs-U.js";
30
+ import { o as updateSessionStore } from "./store-CEFH-fGo.js";
31
+ import { t as extractDeliveryInfo } from "./sessions-BNIruiEi.js";
32
+ import { i as formatUsd, r as formatTokenCount } from "./usage-format-CIQnyi1o.js";
33
+ import { n as stripInboundMetadata } from "./strip-inbound-meta-CQZop7I_.js";
34
+ import { t as diagnosticLogger } from "./diagnostic-runtime-BUG34enQ.js";
35
+ import { n as redactSupportString } from "./diagnostic-support-redaction-CSXpfKpo.js";
36
+ import { C as safeJsonStringify, S as safeTrajectorySessionFileName, b as resolveTrajectoryFilePath, w as sanitizeDiagnosticPayload, x as resolveTrajectoryPointerFilePath, y as TRAJECTORY_RUNTIME_FILE_MAX_BYTES } from "./selection-CDq8O7Fx.js";
37
+ import { S as setTtsProvider, _ as setLastTtsAttempt, a as getTtsMaxLength, b as setTtsEnabled, c as isTtsEnabled, h as resolveTtsPrefsPath, i as getResolvedSpeechProviderConfig, l as isTtsProviderConfigured, m as resolveTtsConfig, o as getTtsProvider, r as getLastTtsAttempt, s as isSummarizationEnabled, v as setSummarizationEnabled, w as textToSpeech, x as setTtsMaxLength } from "./tts-Dk_Qpk02.js";
38
+ import { t as analyzeBootstrapBudget } from "./bootstrap-budget-AwPM5SCG.js";
39
+ import { h as resolveBootstrapTotalMaxChars, p as resolveBootstrapMaxChars } from "./pi-embedded-helpers-DGOg4B7z.js";
40
+ import { n as resolveSandboxRuntimeStatus } from "./runtime-status-D1e_kpiA.js";
41
+ import { i as resolveImageSanitizationLimits, n as sanitizeImageBlocks } from "./tool-images-F6n-h6v3.js";
42
+ import { r as getApiKeyForModel } from "./model-auth-CoigzqTY.js";
43
+ import { t as registerProviderStreamForModel } from "./provider-stream-dEkzo263.js";
44
+ import { m as stripToolResultDetails } from "./transport-stream-shared-CPOJy5ri.js";
45
+ import { i as unsetConfiguredMcpServer, r as setConfiguredMcpServer, t as listConfiguredMcpServers } from "./mcp-config-DFe3ZLVN.js";
46
+ import { t as EmbeddedBlockChunker } from "./pi-embedded-block-chunker-B5DAl_Mk.js";
47
+ import { r as callGateway } from "./call-CMzLsAeQ.js";
48
+ import { d as writeRestartSentinel, n as buildRestartSuccessContinuation, r as formatDoctorNonInteractiveHint, s as removeRestartSentinelFile } from "./restart-sentinel-BWLOu2lg.js";
49
+ import { l as triggerGenesisRestart, o as scheduleGatewaySigusr1Restart } from "./restart-CffIiAfZ.js";
50
+ import { i as resolveReplyToMode } from "./reply-threading-B4F3M7Yp.js";
51
+ import { _ as authorizeConfigWriteShared, b as resolveConfigWriteTargetFromPathShared, v as canBypassConfigWritePolicyShared, y as formatConfigWriteDeniedMessageShared } from "./channel-config-helpers-9w5_d8wL.js";
52
+ import { n as formatTaskStatusDetail, r as formatTaskStatusTitle, t as buildTaskStatusSnapshot } from "./task-status-DPdgYJLA.js";
53
+ import { a as clearSessionQueues } from "./queue-BbE1ctBI.js";
54
+ import { r as getSessionBindingService } from "./session-binding-service-UsMQYRwd.js";
55
+ import { h as replyRunRegistry, i as getActiveEmbeddedRunSnapshot } from "./runs-D9bo-xhY.js";
56
+ import "./diagnostic-PhK_GodL.js";
57
+ import { t as formatDurationCompact } from "./format-duration-FMBoWUPM.js";
58
+ import "./sandbox-Dl4VHMsp.js";
59
+ import { t as buildSystemPromptReport } from "./system-prompt-report-Od6CKNNx.js";
60
+ import { n as estimateTokensFromChars } from "./cjk-chars-XdqLsEKS.js";
61
+ import { i as streamWithPayloadPatch } from "./moonshot-thinking-stream-wrappers-BfVsvTBX.js";
62
+ import { r as resolveModelWithRegistry } from "./model-CwJ7wzMP.js";
63
+ import { i as matchPluginCommand, n as executePluginCommand } from "./commands-BeClgUw6.js";
64
+ import { t as isApprovalNotFoundError } from "./approval-errors-DRLdl7Rx.js";
65
+ import { r as normalizeCommandBody } from "./commands-registry-normalize-y3pw00Jl.js";
66
+ import { i as setAbortMemory, r as isAbortTrigger } from "./abort-primitives-iywT5nzF.js";
67
+ import "./commands-registry-uwVdlY7n.js";
68
+ import { n as formatTimeAgo } from "./format-relative-CkCeIUFz.js";
69
+ import { o as stripMentions, s as stripStructuralPrefixes } from "./mentions-C-JNJVfc.js";
70
+ import { n as setChannelConversationBindingMaxAgeBySessionKey, t as setChannelConversationBindingIdleTimeoutBySessionKey } from "./conversation-bindings-D4jbP5Y4.js";
71
+ import { a as readChannelAllowFromStore, l as removeChannelAllowFromStoreEntry, t as addChannelAllowFromStoreEntry } from "./pairing-store-xFuJRU7P.js";
72
+ import { i as installPluginFromPath, r as installPluginFromNpmSpec } from "./install-Bm0Djb5X.js";
73
+ import { l as resolveArchiveKind } from "./archive-DQTlkN3s.js";
74
+ import { n as isImplicitSameChatApprovalAuthorization } from "./approval-auth-helpers-yVj8aTGb.js";
75
+ import { n as parseActivationCommand } from "./group-activation-C-Ka3ubh.js";
76
+ import { t as resolveFastModeState } from "./fast-mode-Wj1tPkPb.js";
77
+ import { n as resolveSessionAuthProfileOverride } from "./session-override-tYPL0kPi.js";
78
+ import { n as extractExplicitGroupId, t as formatElevatedUnavailableMessage } from "./elevated-unavailable-D_F1Qi1Z.js";
79
+ import { t as resolveRuntimePolicySessionKey } from "./runtime-policy-session-key-C4bUGX5a.js";
80
+ import { a as shouldPersistAbortCutoff, i as resolveAbortCutoffFromContext, t as applyAbortCutoffToSessionEntry } from "./abort-cutoff-DKNuhGko.js";
81
+ import { t as resolveEffectiveToolInventory } from "./tools-effective-inventory-GNGRMlm8.js";
82
+ import { r as resolveConversationBindingContextFromAcpCommand } from "./conversation-binding-input-SYpr95JJ.js";
83
+ import { n as resolveSessionEntryForKey, r as stopSubagentsForRequester, t as formatAbortReplyText } from "./abort-FuQvBD6U.js";
84
+ import { t as extractBtwQuestion } from "./btw-command-ZN5xOJYU.js";
85
+ import { t as formatThreadBindingDurationLabel } from "./thread-bindings-messages-5WoR01mB.js";
86
+ import { n as getSpeechProvider, r as listSpeechProviders, t as canonicalizeSpeechProviderId } from "./provider-registry-BRCZYpEW.js";
87
+ import { a as requireGatewayClientScopeForInternalChannel, i as requireCommandFlagEnabled, n as rejectNonOwnerCommand, r as rejectUnauthorizedCommand, t as buildDisabledCommandReply } from "./command-gates-C1GpyUaI.js";
88
+ import { t as handleAcpCommand } from "./commands-acp-cpGZ404g.js";
89
+ import { n as buildCommandsMessagePaginated, r as buildHelpMessage, t as buildCommandsMessage } from "./command-status-builders-D-B587D9.js";
90
+ import { _ as getFinishedSession, v as getSession } from "./bash-tools.exec-runtime-dke732lC.js";
91
+ import { t as listSkillCommandsForAgents } from "./skill-commands-GmJ-uKh9.js";
92
+ import { r as handleModelsCommand } from "./commands-models-BScPCL8E.js";
93
+ import { n as setPluginEnabledInConfig } from "./enable-DnHQsOLE.js";
94
+ import { r as createExecTool } from "./bash-tools-CfDemvWu.js";
95
+ import { n as listTasksForAgentIdForStatus, r as listTasksForSessionKeyForStatus } from "./status-text-BIGdXi_0.js";
96
+ import { n as buildThreadingToolContext } from "./agent-runner-utils-B6emOCxL.js";
97
+ import { d as resolveChannelAccountId, f as resolveCommandSurfaceChannel, l as resolveSubagentsAction, o as resolveHandledPrefix, s as resolveRequesterSessionKey, u as stopWithText } from "./shared-DSeBkiR2.js";
98
+ import { t as buildToolsMessage } from "./status-Cl8Otyr4.js";
99
+ import { t as parseConfigValue } from "./config-value-DWXWt-dW.js";
100
+ import { t as resolveCommandsSystemPromptBundle } from "./commands-system-prompt-DCmABzHv.js";
101
+ import { a as writeSupportBundleDirectory, i as textSupportBundleFile, n as jsonlSupportBundleFile, r as supportBundleContents, t as jsonSupportBundleFile } from "./diagnostic-support-bundle-BfmmCrPb.js";
102
+ import { t as buildStatusReply } from "./commands-status-CIyza-rp.js";
103
+ import { i as buildNpmInstallRecordFields, n as persistPluginInstall } from "./plugins-install-persist-etgRtkn9.js";
104
+ import { h as parseClawHubPluginSpec } from "./clawhub-BWMVQ8_R.js";
105
+ import { r as installPluginFromClawHub } from "./clawhub-Ct4kunKN.js";
106
+ import { a as buildPluginDiagnosticsReport, c as formatPluginCompatibilityNotice, o as buildPluginInspectReport, s as buildPluginSnapshotReport, t as buildAllPluginInspectReports } from "./status-D58fF0Wc.js";
107
+ import { a as decidePreferredClawHubFallback, i as createPluginInstallLogger, n as buildPreferredClawHubSpec, u as resolveFileNpmSpecToLocalPath } from "./plugins-command-helpers-BjlP9kID.js";
108
+ import { n as loadCostUsageSummary, r as loadSessionCostSummary } from "./session-cost-usage-DlEKMk1Y.js";
109
+ import { fileURLToPath } from "node:url";
110
+ import fs from "node:fs";
111
+ import path from "node:path";
112
+ import { SessionManager } from "@earendil-works/pi-coding-agent";
113
+ import { streamSimple } from "@earendil-works/pi-ai";
114
+ //#region src/channels/plugins/config-writes.ts
115
+ function isInternalConfigWriteMessageChannel(channel) {
116
+ return normalizeLowercaseStringOrEmpty(channel) === "webchat";
117
+ }
118
+ function authorizeConfigWrite(params) {
119
+ return authorizeConfigWriteShared(params);
120
+ }
121
+ function resolveConfigWriteTargetFromPath(path) {
122
+ return resolveConfigWriteTargetFromPathShared({
123
+ path,
124
+ normalizeChannelId: (raw) => normalizeLowercaseStringOrEmpty(raw)
125
+ });
126
+ }
127
+ function canBypassConfigWritePolicy(params) {
128
+ return canBypassConfigWritePolicyShared({
129
+ ...params,
130
+ isInternalMessageChannel: isInternalConfigWriteMessageChannel
131
+ });
132
+ }
133
+ function formatConfigWriteDeniedMessage(params) {
134
+ return formatConfigWriteDeniedMessageShared(params);
135
+ }
136
+ //#endregion
137
+ //#region src/auto-reply/reply/config-write-authorization.ts
138
+ function resolveConfigWriteDeniedText(params) {
139
+ const writeAuth = authorizeConfigWrite({
140
+ cfg: params.cfg,
141
+ origin: {
142
+ channelId: params.channelId,
143
+ accountId: params.accountId
144
+ },
145
+ target: params.target,
146
+ allowBypass: canBypassConfigWritePolicy({
147
+ channel: params.channel ?? "",
148
+ gatewayClientScopes: params.gatewayClientScopes
149
+ })
150
+ });
151
+ if (writeAuth.allowed) return null;
152
+ return formatConfigWriteDeniedMessage({
153
+ result: writeAuth,
154
+ fallbackChannelId: params.channelId
155
+ });
156
+ }
157
+ //#endregion
158
+ //#region src/auto-reply/reply/commands-allowlist.ts
159
+ const ACTIONS = new Set([
160
+ "list",
161
+ "add",
162
+ "remove"
163
+ ]);
164
+ const SCOPES = new Set([
165
+ "dm",
166
+ "group",
167
+ "all"
168
+ ]);
169
+ function resolveAllowlistAccountId(params) {
170
+ const explicitAccountId = normalizeOptionalAccountId(params.parsedAccount);
171
+ if (explicitAccountId) return explicitAccountId;
172
+ const configuredDefaultAccountId = normalizeOptionalString(getChannelPlugin(params.channelId)?.config.defaultAccountId?.(params.cfg));
173
+ const ctxAccountId = normalizeOptionalAccountId(params.ctxAccountId);
174
+ return configuredDefaultAccountId || ctxAccountId || "default";
175
+ }
176
+ function parseAllowlistCommand(raw) {
177
+ const trimmed = raw.trim();
178
+ if (!(normalizeOptionalLowercaseString(trimmed) ?? "").startsWith("/allowlist")) return null;
179
+ const rest = trimmed.slice(10).trim();
180
+ if (!rest) return {
181
+ action: "list",
182
+ scope: "dm"
183
+ };
184
+ const tokens = rest.split(/\s+/);
185
+ let action = "list";
186
+ let scope = "dm";
187
+ let resolve = false;
188
+ let target = "both";
189
+ let channel;
190
+ let account;
191
+ const entryTokens = [];
192
+ let i = 0;
193
+ const firstAction = normalizeOptionalLowercaseString(tokens[i]);
194
+ if (firstAction && ACTIONS.has(firstAction)) {
195
+ action = firstAction;
196
+ i += 1;
197
+ }
198
+ const firstScope = normalizeOptionalLowercaseString(tokens[i]);
199
+ if (firstScope && SCOPES.has(firstScope)) {
200
+ scope = firstScope;
201
+ i += 1;
202
+ }
203
+ for (; i < tokens.length; i += 1) {
204
+ const token = tokens[i];
205
+ const lowered = normalizeOptionalLowercaseString(token) ?? "";
206
+ if (lowered === "--resolve" || lowered === "resolve") {
207
+ resolve = true;
208
+ continue;
209
+ }
210
+ if (lowered === "--config" || lowered === "config") {
211
+ target = "config";
212
+ continue;
213
+ }
214
+ if (lowered === "--store" || lowered === "store") {
215
+ target = "store";
216
+ continue;
217
+ }
218
+ if (lowered === "--channel" && tokens[i + 1]) {
219
+ channel = tokens[i + 1];
220
+ i += 1;
221
+ continue;
222
+ }
223
+ if (lowered === "--account" && tokens[i + 1]) {
224
+ account = tokens[i + 1];
225
+ i += 1;
226
+ continue;
227
+ }
228
+ const kv = token.split("=");
229
+ if (kv.length === 2) {
230
+ const key = normalizeOptionalLowercaseString(kv[0]);
231
+ const value = normalizeOptionalString(kv[1]);
232
+ if (key === "channel") {
233
+ if (value) channel = value;
234
+ continue;
235
+ }
236
+ if (key === "account") {
237
+ if (value) account = value;
238
+ continue;
239
+ }
240
+ const normalizedValue = normalizeOptionalLowercaseString(value);
241
+ if (key === "scope" && normalizedValue && SCOPES.has(normalizedValue)) {
242
+ scope = normalizedValue;
243
+ continue;
244
+ }
245
+ }
246
+ entryTokens.push(token);
247
+ }
248
+ if (action === "add" || action === "remove") {
249
+ const entry = entryTokens.join(" ").trim();
250
+ if (!entry) return {
251
+ action: "error",
252
+ message: "Usage: /allowlist add|remove <entry>"
253
+ };
254
+ return {
255
+ action,
256
+ scope,
257
+ entry,
258
+ channel,
259
+ account,
260
+ resolve,
261
+ target
262
+ };
263
+ }
264
+ return {
265
+ action: "list",
266
+ scope,
267
+ channel,
268
+ account,
269
+ resolve
270
+ };
271
+ }
272
+ function normalizeAllowFrom(params) {
273
+ const plugin = getChannelPlugin(params.channelId);
274
+ if (plugin?.config.formatAllowFrom) return plugin.config.formatAllowFrom({
275
+ cfg: params.cfg,
276
+ accountId: params.accountId,
277
+ allowFrom: params.values
278
+ });
279
+ return normalizeStringEntries(params.values);
280
+ }
281
+ function formatEntryList(entries, resolved) {
282
+ if (entries.length === 0) return "(none)";
283
+ return entries.map((entry) => {
284
+ const name = resolved?.get(entry);
285
+ return name ? `${entry} (${name})` : entry;
286
+ }).join(", ");
287
+ }
288
+ async function updatePairingStoreAllowlist(params) {
289
+ const storeEntry = {
290
+ channel: params.channelId,
291
+ entry: params.entry,
292
+ accountId: params.accountId
293
+ };
294
+ if (params.action === "add") {
295
+ await addChannelAllowFromStoreEntry(storeEntry);
296
+ return;
297
+ }
298
+ await removeChannelAllowFromStoreEntry(storeEntry);
299
+ if (params.accountId === "default") await removeChannelAllowFromStoreEntry({
300
+ channel: params.channelId,
301
+ entry: params.entry
302
+ });
303
+ }
304
+ function mapResolvedAllowlistNames(entries) {
305
+ const map = /* @__PURE__ */ new Map();
306
+ for (const entry of entries) if (entry.resolved && entry.name) map.set(entry.input, entry.name);
307
+ return map;
308
+ }
309
+ async function resolveAllowlistNames(params) {
310
+ return mapResolvedAllowlistNames(await getChannelPlugin(params.channelId)?.allowlist?.resolveNames?.({
311
+ cfg: params.cfg,
312
+ accountId: params.accountId,
313
+ scope: params.scope,
314
+ entries: params.entries
315
+ }) ?? []);
316
+ }
317
+ async function readAllowlistConfig(params) {
318
+ return await getChannelPlugin(params.channelId)?.allowlist?.readConfig?.({
319
+ cfg: params.cfg,
320
+ accountId: params.accountId
321
+ }) ?? {};
322
+ }
323
+ const handleAllowlistCommand = async (params, allowTextCommands) => {
324
+ if (!allowTextCommands) return null;
325
+ const parsed = parseAllowlistCommand(params.command.commandBodyNormalized);
326
+ if (!parsed) return null;
327
+ if (parsed.action === "error") return {
328
+ shouldContinue: false,
329
+ reply: { text: `āš ļø ${parsed.message}` }
330
+ };
331
+ const unauthorized = rejectUnauthorizedCommand(params, "/allowlist");
332
+ if (unauthorized) return unauthorized;
333
+ if (parsed.action !== "list") {
334
+ const nonOwner = rejectNonOwnerCommand(params, "/allowlist");
335
+ if (nonOwner) return nonOwner;
336
+ }
337
+ const channelId = normalizeChannelId(parsed.channel) ?? params.command.channelId ?? normalizeChannelId(params.command.channel);
338
+ if (!channelId) return {
339
+ shouldContinue: false,
340
+ reply: { text: "āš ļø Unknown channel. Add channel=<id> to the command." }
341
+ };
342
+ if (normalizeOptionalString(parsed.account) && !normalizeOptionalAccountId(parsed.account)) return {
343
+ shouldContinue: false,
344
+ reply: { text: "āš ļø Invalid account id. Reserved keys (__proto__, constructor, prototype) are blocked." }
345
+ };
346
+ const accountId = resolveAllowlistAccountId({
347
+ cfg: params.cfg,
348
+ channelId,
349
+ parsedAccount: parsed.account,
350
+ ctxAccountId: params.ctx.AccountId
351
+ });
352
+ const plugin = getChannelPlugin(channelId);
353
+ if (parsed.action === "list") {
354
+ const supportsStore = Boolean(plugin?.pairing);
355
+ if (!plugin?.allowlist?.readConfig && !supportsStore) return {
356
+ shouldContinue: false,
357
+ reply: { text: `āš ļø ${channelId} does not expose allowlist configuration.` }
358
+ };
359
+ const storeAllowFrom = supportsStore ? await readChannelAllowFromStore(channelId, process.env, accountId).catch(() => []) : [];
360
+ const configState = await readAllowlistConfig({
361
+ cfg: params.cfg,
362
+ channelId,
363
+ accountId
364
+ });
365
+ const dmAllowFrom = (configState.dmAllowFrom ?? []).map(String);
366
+ const groupAllowFrom = (configState.groupAllowFrom ?? []).map(String);
367
+ const groupOverrides = (configState.groupOverrides ?? []).map((entry) => ({
368
+ label: entry.label,
369
+ entries: entry.entries.map(String).filter(Boolean)
370
+ }));
371
+ const dmDisplay = normalizeAllowFrom({
372
+ cfg: params.cfg,
373
+ channelId,
374
+ accountId,
375
+ values: dmAllowFrom
376
+ });
377
+ const groupDisplay = normalizeAllowFrom({
378
+ cfg: params.cfg,
379
+ channelId,
380
+ accountId,
381
+ values: groupAllowFrom
382
+ });
383
+ const groupOverrideEntries = groupOverrides.flatMap((entry) => entry.entries);
384
+ const groupOverrideDisplay = normalizeAllowFrom({
385
+ cfg: params.cfg,
386
+ channelId,
387
+ accountId,
388
+ values: groupOverrideEntries
389
+ });
390
+ const resolvedDm = parsed.resolve && dmDisplay.length > 0 ? await resolveAllowlistNames({
391
+ cfg: params.cfg,
392
+ channelId,
393
+ accountId,
394
+ scope: "dm",
395
+ entries: dmDisplay
396
+ }) : void 0;
397
+ const resolvedGroup = parsed.resolve && groupOverrideDisplay.length > 0 ? await resolveAllowlistNames({
398
+ cfg: params.cfg,
399
+ channelId,
400
+ accountId,
401
+ scope: "group",
402
+ entries: groupOverrideDisplay
403
+ }) : void 0;
404
+ const lines = ["🧾 Allowlist"];
405
+ lines.push(`Channel: ${channelId}${accountId ? ` (account ${accountId})` : ""}`);
406
+ if (configState.dmPolicy) lines.push(`DM policy: ${configState.dmPolicy}`);
407
+ if (configState.groupPolicy) lines.push(`Group policy: ${configState.groupPolicy}`);
408
+ const showDm = parsed.scope === "dm" || parsed.scope === "all";
409
+ const showGroup = parsed.scope === "group" || parsed.scope === "all";
410
+ if (showDm) lines.push(`DM allowFrom (config): ${formatEntryList(dmDisplay, resolvedDm)}`);
411
+ if (supportsStore && storeAllowFrom.length > 0) {
412
+ const storeLabel = normalizeAllowFrom({
413
+ cfg: params.cfg,
414
+ channelId,
415
+ accountId,
416
+ values: storeAllowFrom
417
+ });
418
+ lines.push(`Paired allowFrom (store): ${formatEntryList(storeLabel)}`);
419
+ }
420
+ if (showGroup) {
421
+ if (groupAllowFrom.length > 0) lines.push(`Group allowFrom (config): ${formatEntryList(groupDisplay, resolvedGroup)}`);
422
+ if (groupOverrides.length > 0) {
423
+ lines.push("Group overrides:");
424
+ for (const entry of groupOverrides) {
425
+ const normalized = normalizeAllowFrom({
426
+ cfg: params.cfg,
427
+ channelId,
428
+ accountId,
429
+ values: entry.entries
430
+ });
431
+ lines.push(`- ${entry.label}: ${formatEntryList(normalized, resolvedGroup)}`);
432
+ }
433
+ }
434
+ }
435
+ return {
436
+ shouldContinue: false,
437
+ reply: { text: lines.join("\n") }
438
+ };
439
+ }
440
+ const missingAdminScope = requireGatewayClientScopeForInternalChannel(params, {
441
+ label: "/allowlist write",
442
+ allowedScopes: ["operator.admin"],
443
+ missingText: "āŒ /allowlist add|remove requires operator.admin for gateway clients."
444
+ });
445
+ if (missingAdminScope) return missingAdminScope;
446
+ const disabled = requireCommandFlagEnabled(params.cfg, {
447
+ label: "/allowlist edits",
448
+ configKey: "config",
449
+ disabledVerb: "are"
450
+ });
451
+ if (disabled) return disabled;
452
+ const shouldUpdateConfig = parsed.target !== "store";
453
+ const shouldTouchStore = parsed.target !== "config" && Boolean(plugin?.pairing);
454
+ if (shouldUpdateConfig) {
455
+ if (parsed.scope === "all") return {
456
+ shouldContinue: false,
457
+ reply: { text: "āš ļø /allowlist add|remove requires scope dm or group." }
458
+ };
459
+ if (!plugin?.allowlist?.applyConfigEdit) return {
460
+ shouldContinue: false,
461
+ reply: { text: `āš ļø ${channelId} does not support ${parsed.scope} allowlist edits via /allowlist.` }
462
+ };
463
+ const snapshot = await readConfigFileSnapshot();
464
+ if (!snapshot.valid || !snapshot.parsed || typeof snapshot.parsed !== "object") return {
465
+ shouldContinue: false,
466
+ reply: { text: "āš ļø Config file is invalid; fix it before using /allowlist." }
467
+ };
468
+ const parsedConfig = structuredClone(snapshot.parsed);
469
+ const editResult = await plugin.allowlist.applyConfigEdit({
470
+ cfg: params.cfg,
471
+ parsedConfig,
472
+ accountId,
473
+ scope: parsed.scope,
474
+ action: parsed.action,
475
+ entry: parsed.entry
476
+ });
477
+ if (!editResult) return {
478
+ shouldContinue: false,
479
+ reply: { text: `āš ļø ${channelId} does not support ${parsed.scope} allowlist edits via /allowlist.` }
480
+ };
481
+ if (editResult.kind === "invalid-entry") return {
482
+ shouldContinue: false,
483
+ reply: { text: "āš ļø Invalid allowlist entry." }
484
+ };
485
+ const deniedText = resolveConfigWriteDeniedText({
486
+ cfg: params.cfg,
487
+ channel: params.command.channel,
488
+ channelId,
489
+ accountId,
490
+ gatewayClientScopes: params.ctx.GatewayClientScopes,
491
+ target: editResult.writeTarget
492
+ });
493
+ if (deniedText) return {
494
+ shouldContinue: false,
495
+ reply: { text: deniedText }
496
+ };
497
+ const configChanged = editResult.changed;
498
+ if (configChanged) {
499
+ const validated = validateConfigObjectWithPlugins(parsedConfig);
500
+ if (!validated.ok) {
501
+ const issue = validated.issues[0];
502
+ return {
503
+ shouldContinue: false,
504
+ reply: { text: `āš ļø Config invalid after update (${issue.path}: ${issue.message}).` }
505
+ };
506
+ }
507
+ await writeConfigFile(validated.config);
508
+ }
509
+ if (!configChanged && !shouldTouchStore) return {
510
+ shouldContinue: false,
511
+ reply: { text: parsed.action === "add" ? "āœ… Already allowlisted." : "āš ļø Entry not found." }
512
+ };
513
+ if (shouldTouchStore) await updatePairingStoreAllowlist({
514
+ action: parsed.action,
515
+ channelId,
516
+ accountId,
517
+ entry: parsed.entry
518
+ });
519
+ const actionLabel = parsed.action === "add" ? "added" : "removed";
520
+ const scopeLabel = parsed.scope === "dm" ? "DM" : "group";
521
+ const locations = [];
522
+ if (configChanged) locations.push(editResult.pathLabel);
523
+ if (shouldTouchStore) locations.push("pairing store");
524
+ return {
525
+ shouldContinue: false,
526
+ reply: { text: `āœ… ${scopeLabel} allowlist ${actionLabel}: ${locations.length > 0 ? locations.join(" + ") : "no-op"}.` }
527
+ };
528
+ }
529
+ if (!shouldTouchStore) return {
530
+ shouldContinue: false,
531
+ reply: { text: "āš ļø This channel does not support allowlist storage." }
532
+ };
533
+ await updatePairingStoreAllowlist({
534
+ action: parsed.action,
535
+ channelId,
536
+ accountId,
537
+ entry: parsed.entry
538
+ });
539
+ const actionLabel = parsed.action === "add" ? "added" : "removed";
540
+ return {
541
+ shouldContinue: false,
542
+ reply: { text: `āœ… ${parsed.scope === "dm" ? "DM" : "group"} allowlist ${actionLabel} in pairing store.` }
543
+ };
544
+ };
545
+ //#endregion
546
+ //#region src/infra/channel-approval-auth.ts
547
+ function resolveApprovalCommandAuthorization(params) {
548
+ const channel = normalizeMessageChannel(params.channel);
549
+ if (!channel) return {
550
+ authorized: true,
551
+ explicit: false
552
+ };
553
+ const approvalCapability = resolveChannelApprovalCapability(getChannelPlugin(channel));
554
+ const resolved = approvalCapability?.authorizeActorAction?.({
555
+ cfg: params.cfg,
556
+ accountId: params.accountId,
557
+ senderId: params.senderId,
558
+ action: "approve",
559
+ approvalKind: params.kind
560
+ });
561
+ if (!resolved) return {
562
+ authorized: true,
563
+ explicit: false
564
+ };
565
+ const implicitSameChatAuthorization = isImplicitSameChatApprovalAuthorization(resolved);
566
+ const availability = approvalCapability?.getActionAvailabilityState?.({
567
+ cfg: params.cfg,
568
+ accountId: params.accountId,
569
+ action: "approve",
570
+ approvalKind: params.kind
571
+ });
572
+ return {
573
+ authorized: resolved.authorized,
574
+ reason: resolved.reason,
575
+ explicit: resolved.authorized ? !implicitSameChatAuthorization && availability?.kind !== "disabled" : true
576
+ };
577
+ }
578
+ //#endregion
579
+ //#region src/auto-reply/reply/commands-approve.ts
580
+ const COMMAND_REGEX = /^\/?approve(?:\s|$)/i;
581
+ const FOREIGN_COMMAND_MENTION_REGEX = /^\/approve@([^\s]+)(?:\s|$)/i;
582
+ const DECISION_ALIASES = {
583
+ allow: "allow-once",
584
+ once: "allow-once",
585
+ "allow-once": "allow-once",
586
+ allowonce: "allow-once",
587
+ always: "allow-always",
588
+ "allow-always": "allow-always",
589
+ allowalways: "allow-always",
590
+ deny: "deny",
591
+ reject: "deny",
592
+ block: "deny"
593
+ };
594
+ const APPROVE_USAGE_TEXT = "Usage: /approve <id> <decision> (see the pending approval message for available decisions)";
595
+ function parseApproveCommand(raw) {
596
+ const trimmed = raw.trim();
597
+ if (FOREIGN_COMMAND_MENTION_REGEX.test(trimmed)) return {
598
+ ok: false,
599
+ error: "āŒ This /approve command targets a different Telegram bot."
600
+ };
601
+ const commandMatch = trimmed.match(COMMAND_REGEX);
602
+ if (!commandMatch) return null;
603
+ const rest = trimmed.slice(commandMatch[0].length).trim();
604
+ if (!rest) return {
605
+ ok: false,
606
+ error: APPROVE_USAGE_TEXT
607
+ };
608
+ const tokens = rest.split(/\s+/).filter(Boolean);
609
+ if (tokens.length < 2) return {
610
+ ok: false,
611
+ error: APPROVE_USAGE_TEXT
612
+ };
613
+ const first = normalizeLowercaseStringOrEmpty(tokens[0]);
614
+ const second = normalizeLowercaseStringOrEmpty(tokens[1]);
615
+ if (DECISION_ALIASES[first]) return {
616
+ ok: true,
617
+ decision: DECISION_ALIASES[first],
618
+ id: tokens.slice(1).join(" ").trim()
619
+ };
620
+ if (DECISION_ALIASES[second]) return {
621
+ ok: true,
622
+ decision: DECISION_ALIASES[second],
623
+ id: tokens[0]
624
+ };
625
+ return {
626
+ ok: false,
627
+ error: APPROVE_USAGE_TEXT
628
+ };
629
+ }
630
+ function buildResolvedByLabel(params) {
631
+ return `${params.command.channel}:${params.command.senderId ?? "unknown"}`;
632
+ }
633
+ function formatApprovalSubmitError(error) {
634
+ return formatErrorMessage(error);
635
+ }
636
+ function resolveApprovalMethods(params) {
637
+ if (params.approvalId.startsWith("plugin:")) return params.pluginAuthorization.authorized ? ["plugin.approval.resolve"] : [];
638
+ if (params.execAuthorization.authorized && params.pluginAuthorization.authorized) return ["exec.approval.resolve", "plugin.approval.resolve"];
639
+ if (params.execAuthorization.authorized) return ["exec.approval.resolve"];
640
+ if (params.pluginAuthorization.authorized) return ["plugin.approval.resolve"];
641
+ return [];
642
+ }
643
+ function resolveApprovalAuthorizationError(params) {
644
+ if (params.approvalId.startsWith("plugin:")) return params.pluginAuthorization.reason ?? "āŒ You are not authorized to approve this request.";
645
+ return params.execAuthorization.reason ?? params.pluginAuthorization.reason ?? "āŒ You are not authorized to approve this request.";
646
+ }
647
+ const handleApproveCommand = async (params, allowTextCommands) => {
648
+ if (!allowTextCommands) return null;
649
+ const normalized = params.command.commandBodyNormalized;
650
+ const parsed = parseApproveCommand(normalized);
651
+ if (!parsed) return null;
652
+ if (!parsed.ok) return {
653
+ shouldContinue: false,
654
+ reply: { text: parsed.error }
655
+ };
656
+ const isPluginId = parsed.id.startsWith("plugin:");
657
+ const effectiveAccountId = resolveChannelAccountId({
658
+ cfg: params.cfg,
659
+ ctx: params.ctx,
660
+ command: params.command
661
+ });
662
+ const approveCommandBehavior = resolveChannelApprovalCapability(getChannelPlugin(params.command.channel))?.resolveApproveCommandBehavior?.({
663
+ cfg: params.cfg,
664
+ accountId: effectiveAccountId,
665
+ senderId: params.command.senderId,
666
+ approvalKind: isPluginId ? "plugin" : "exec"
667
+ });
668
+ if (approveCommandBehavior?.kind === "ignore") return { shouldContinue: false };
669
+ if (approveCommandBehavior?.kind === "reply") return {
670
+ shouldContinue: false,
671
+ reply: { text: approveCommandBehavior.text }
672
+ };
673
+ const execApprovalAuthorization = resolveApprovalCommandAuthorization({
674
+ cfg: params.cfg,
675
+ channel: params.command.channel,
676
+ accountId: effectiveAccountId,
677
+ senderId: params.command.senderId,
678
+ kind: "exec"
679
+ });
680
+ const pluginApprovalAuthorization = resolveApprovalCommandAuthorization({
681
+ cfg: params.cfg,
682
+ channel: params.command.channel,
683
+ accountId: effectiveAccountId,
684
+ senderId: params.command.senderId,
685
+ kind: "plugin"
686
+ });
687
+ const hasExplicitApprovalAuthorization = execApprovalAuthorization.explicit && execApprovalAuthorization.authorized || pluginApprovalAuthorization.explicit && pluginApprovalAuthorization.authorized;
688
+ if (!params.command.isAuthorizedSender && !hasExplicitApprovalAuthorization) {
689
+ logVerbose(`Ignoring /approve from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
690
+ return { shouldContinue: false };
691
+ }
692
+ const missingScope = requireGatewayClientScopeForInternalChannel(params, {
693
+ label: "/approve",
694
+ allowedScopes: ["operator.approvals", "operator.admin"],
695
+ missingText: "āŒ /approve requires operator.approvals for gateway clients."
696
+ });
697
+ if (missingScope) return missingScope;
698
+ const resolvedBy = buildResolvedByLabel(params);
699
+ const callApprovalMethod = async (method) => {
700
+ await callGateway({
701
+ method,
702
+ params: {
703
+ id: parsed.id,
704
+ decision: parsed.decision
705
+ },
706
+ clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
707
+ clientDisplayName: `Chat approval (${resolvedBy})`,
708
+ mode: GATEWAY_CLIENT_MODES.BACKEND
709
+ });
710
+ };
711
+ const methods = resolveApprovalMethods({
712
+ approvalId: parsed.id,
713
+ execAuthorization: execApprovalAuthorization,
714
+ pluginAuthorization: pluginApprovalAuthorization
715
+ });
716
+ if (methods.length === 0) return {
717
+ shouldContinue: false,
718
+ reply: { text: resolveApprovalAuthorizationError({
719
+ approvalId: parsed.id,
720
+ execAuthorization: execApprovalAuthorization,
721
+ pluginAuthorization: pluginApprovalAuthorization
722
+ }) }
723
+ };
724
+ let lastError = null;
725
+ for (const [index, method] of methods.entries()) try {
726
+ await callApprovalMethod(method);
727
+ lastError = null;
728
+ break;
729
+ } catch (error) {
730
+ lastError = error;
731
+ const isLastMethod = index === methods.length - 1;
732
+ if (!isApprovalNotFoundError(error) || isLastMethod) return {
733
+ shouldContinue: false,
734
+ reply: { text: `āŒ Failed to submit approval: ${formatApprovalSubmitError(error)}` }
735
+ };
736
+ }
737
+ if (lastError) return {
738
+ shouldContinue: false,
739
+ reply: { text: `āŒ Failed to submit approval: ${formatApprovalSubmitError(lastError)}` }
740
+ };
741
+ return {
742
+ shouldContinue: false,
743
+ reply: { text: `āœ… Approval ${parsed.decision} submitted for ${parsed.id}.` }
744
+ };
745
+ };
746
+ //#endregion
747
+ //#region src/auto-reply/reply/bash-command.ts
748
+ const CHAT_BASH_SCOPE_KEY = "chat:bash";
749
+ const DEFAULT_FOREGROUND_MS = 2e3;
750
+ const MAX_FOREGROUND_MS = 3e4;
751
+ let activeJob = null;
752
+ function resolveForegroundMs(cfg) {
753
+ const raw = cfg.commands?.bashForegroundMs;
754
+ if (typeof raw !== "number" || Number.isNaN(raw)) return DEFAULT_FOREGROUND_MS;
755
+ return clampInt(raw, 0, MAX_FOREGROUND_MS);
756
+ }
757
+ function formatSessionSnippet(sessionId) {
758
+ const trimmed = sessionId.trim();
759
+ if (trimmed.length <= 12) return trimmed;
760
+ return `${trimmed.slice(0, 8)}…`;
761
+ }
762
+ function formatOutputBlock(text) {
763
+ const trimmed = text.trim();
764
+ if (!trimmed) return "(no output)";
765
+ return `\`\`\`txt\n${trimmed}\n\`\`\``;
766
+ }
767
+ function parseBashRequest(raw) {
768
+ const trimmed = raw.trimStart();
769
+ let restSource = "";
770
+ if (normalizeLowercaseStringOrEmpty(trimmed).startsWith("/bash")) {
771
+ const match = trimmed.match(/^\/bash(?:\s*:\s*|\s+|$)([\s\S]*)$/i);
772
+ if (!match) return null;
773
+ restSource = match[1] ?? "";
774
+ } else if (trimmed.startsWith("!")) {
775
+ restSource = trimmed.slice(1);
776
+ if (restSource.trimStart().startsWith(":")) restSource = restSource.trimStart().slice(1);
777
+ } else return null;
778
+ const rest = restSource.trimStart();
779
+ if (!rest) return { action: "help" };
780
+ const tokenMatch = rest.match(/^(\S+)(?:\s+([\s\S]+))?$/);
781
+ const token = normalizeOptionalString(tokenMatch?.[1]) ?? "";
782
+ const remainder = normalizeOptionalString(tokenMatch?.[2]) ?? "";
783
+ const lowered = normalizeLowercaseStringOrEmpty(token);
784
+ if (lowered === "poll") return {
785
+ action: "poll",
786
+ sessionId: remainder || void 0
787
+ };
788
+ if (lowered === "stop") return {
789
+ action: "stop",
790
+ sessionId: remainder || void 0
791
+ };
792
+ if (lowered === "help") return { action: "help" };
793
+ return {
794
+ action: "run",
795
+ command: rest
796
+ };
797
+ }
798
+ function resolveRawCommandBody(params) {
799
+ const stripped = stripStructuralPrefixes(params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body ?? "");
800
+ return params.isGroup ? stripMentions(stripped, params.ctx, params.cfg, params.agentId) : stripped;
801
+ }
802
+ function getScopedSession(sessionId) {
803
+ const running = getSession(sessionId);
804
+ if (running && running.scopeKey === CHAT_BASH_SCOPE_KEY) return { running };
805
+ const finished = getFinishedSession(sessionId);
806
+ if (finished && finished.scopeKey === CHAT_BASH_SCOPE_KEY) return { finished };
807
+ return {};
808
+ }
809
+ function ensureActiveJobState() {
810
+ if (!activeJob) return null;
811
+ if (activeJob.state === "starting") return activeJob;
812
+ const { running, finished } = getScopedSession(activeJob.sessionId);
813
+ if (running) return activeJob;
814
+ if (finished) {
815
+ activeJob = null;
816
+ return null;
817
+ }
818
+ activeJob = null;
819
+ return null;
820
+ }
821
+ function attachActiveWatcher(sessionId) {
822
+ if (!activeJob || activeJob.state !== "running") return;
823
+ if (activeJob.sessionId !== sessionId) return;
824
+ if (activeJob.watcherAttached) return;
825
+ const { running } = getScopedSession(sessionId);
826
+ const child = running?.child;
827
+ if (!child) return;
828
+ activeJob.watcherAttached = true;
829
+ child.once("close", () => {
830
+ if (activeJob?.state === "running" && activeJob.sessionId === sessionId) activeJob = null;
831
+ });
832
+ }
833
+ function buildUsageReply() {
834
+ return { text: [
835
+ "āš™ļø Usage:",
836
+ "- ! <command>",
837
+ "- !poll | ! poll",
838
+ "- !stop | ! stop",
839
+ "- /bash ... (alias; same subcommands as !)"
840
+ ].join("\n") };
841
+ }
842
+ async function handleBashChatCommand(params) {
843
+ if (!isCommandFlagEnabled(params.cfg, "bash")) return buildDisabledCommandReply({
844
+ label: "bash",
845
+ configKey: "bash",
846
+ docsUrl: "https://genesis.pixelzx.com/docs/tools/slash-commands#config"
847
+ });
848
+ const agentId = params.agentId ?? resolveSessionAgentId({
849
+ sessionKey: params.sessionKey,
850
+ config: params.cfg
851
+ });
852
+ if (!params.elevated.enabled || !params.elevated.allowed) {
853
+ const runtimeSandboxed = resolveSandboxRuntimeStatus({
854
+ cfg: params.cfg,
855
+ sessionKey: resolveRuntimePolicySessionKey({
856
+ cfg: params.cfg,
857
+ ctx: params.ctx,
858
+ sessionKey: params.sessionKey
859
+ })
860
+ }).sandboxed;
861
+ return { text: formatElevatedUnavailableMessage({
862
+ runtimeSandboxed,
863
+ failures: params.elevated.failures,
864
+ sessionKey: params.sessionKey
865
+ }) };
866
+ }
867
+ const request = parseBashRequest(resolveRawCommandBody({
868
+ ctx: params.ctx,
869
+ cfg: params.cfg,
870
+ agentId,
871
+ isGroup: params.isGroup
872
+ }).trim());
873
+ if (!request) return { text: "āš ļø Unrecognized bash request." };
874
+ const liveJob = ensureActiveJobState();
875
+ if (request.action === "help") return buildUsageReply();
876
+ if (request.action === "poll") {
877
+ const sessionId = normalizeOptionalString(request.sessionId) || (liveJob?.state === "running" ? liveJob.sessionId : "");
878
+ if (!sessionId) return { text: "āš™ļø No active bash job." };
879
+ const { running, finished } = getScopedSession(sessionId);
880
+ if (running) {
881
+ attachActiveWatcher(sessionId);
882
+ const runtimeSec = Math.max(0, Math.floor((Date.now() - running.startedAt) / 1e3));
883
+ const tail = running.tail || "(no output yet)";
884
+ return { text: [
885
+ `āš™ļø bash still running (session ${formatSessionSnippet(sessionId)}, ${runtimeSec}s).`,
886
+ formatOutputBlock(tail),
887
+ "Hint: !stop (or /bash stop)"
888
+ ].join("\n") };
889
+ }
890
+ if (finished) {
891
+ if (activeJob?.state === "running" && activeJob.sessionId === sessionId) activeJob = null;
892
+ const exitLabel = finished.exitSignal ? `signal ${String(finished.exitSignal)}` : `code ${String(finished.exitCode ?? 0)}`;
893
+ return { text: [
894
+ `${finished.status === "completed" ? "āš™ļø" : "āš ļø"} bash finished (session ${formatSessionSnippet(sessionId)}).`,
895
+ `Exit: ${exitLabel}`,
896
+ formatOutputBlock(finished.aggregated || finished.tail)
897
+ ].join("\n") };
898
+ }
899
+ if (activeJob?.state === "running" && activeJob.sessionId === sessionId) activeJob = null;
900
+ return { text: `āš™ļø No bash session found for ${formatSessionSnippet(sessionId)}.` };
901
+ }
902
+ if (request.action === "stop") {
903
+ const sessionId = normalizeOptionalString(request.sessionId) || (liveJob?.state === "running" ? liveJob.sessionId : "");
904
+ if (!sessionId) return { text: "āš™ļø No active bash job." };
905
+ const { running } = getScopedSession(sessionId);
906
+ if (!running) {
907
+ if (activeJob?.state === "running" && activeJob.sessionId === sessionId) activeJob = null;
908
+ return { text: `āš™ļø No running bash job found for ${formatSessionSnippet(sessionId)}.` };
909
+ }
910
+ if (!running.backgrounded) return { text: `āš ļø Session ${formatSessionSnippet(sessionId)} is not backgrounded.` };
911
+ const pid = running.pid ?? running.child?.pid;
912
+ if (!pid) return { text: `āš ļø Unable to stop bash session ${formatSessionSnippet(sessionId)} because no process ID is available. Use !poll ${sessionId} to check whether it exits on its own.` };
913
+ const { killProcessTree } = await import("./kill-tree-BRbowqSh.js");
914
+ killProcessTree(pid);
915
+ return { text: `āš™ļø bash stopping (session ${formatSessionSnippet(sessionId)}). Use !poll ${sessionId} to confirm exit.` };
916
+ }
917
+ if (liveJob) return { text: `āš ļø A bash job is already running (${liveJob.state === "running" ? formatSessionSnippet(liveJob.sessionId) : "starting"}). Use !poll / !stop (or /bash poll / /bash stop).` };
918
+ const commandText = request.command.trim();
919
+ if (!commandText) return buildUsageReply();
920
+ activeJob = {
921
+ state: "starting",
922
+ startedAt: Date.now(),
923
+ command: commandText
924
+ };
925
+ try {
926
+ const foregroundMs = resolveForegroundMs(params.cfg);
927
+ const shouldBackgroundImmediately = foregroundMs <= 0;
928
+ const timeoutSec = params.cfg.tools?.exec?.timeoutSec;
929
+ const notifyOnExit = params.cfg.tools?.exec?.notifyOnExit;
930
+ const notifyOnExitEmptySuccess = params.cfg.tools?.exec?.notifyOnExitEmptySuccess;
931
+ const result = await createExecTool({
932
+ scopeKey: CHAT_BASH_SCOPE_KEY,
933
+ allowBackground: true,
934
+ timeoutSec,
935
+ sessionKey: params.sessionKey,
936
+ notifyOnExit,
937
+ notifyOnExitEmptySuccess,
938
+ elevated: {
939
+ enabled: params.elevated.enabled,
940
+ allowed: params.elevated.allowed,
941
+ defaultLevel: "on"
942
+ }
943
+ }).execute("chat-bash", {
944
+ command: commandText,
945
+ background: shouldBackgroundImmediately,
946
+ yieldMs: shouldBackgroundImmediately ? void 0 : foregroundMs,
947
+ timeout: timeoutSec,
948
+ elevated: true
949
+ });
950
+ if (result.details?.status === "running") {
951
+ const sessionId = result.details.sessionId;
952
+ activeJob = {
953
+ state: "running",
954
+ sessionId,
955
+ startedAt: result.details.startedAt,
956
+ command: commandText,
957
+ watcherAttached: false
958
+ };
959
+ attachActiveWatcher(sessionId);
960
+ logVerbose(`Started bash session ${formatSessionSnippet(sessionId)}: ${commandText}`);
961
+ return { text: `āš™ļø bash started (session ${sessionId}). Still running; use !poll / !stop (or /bash poll / /bash stop).` };
962
+ }
963
+ activeJob = null;
964
+ const exitCode = result.details?.status === "completed" ? result.details.exitCode : 0;
965
+ const output = result.details?.status === "completed" ? result.details.aggregated : result.content.map((chunk) => chunk.type === "text" ? chunk.text : "").join("\n");
966
+ return { text: [
967
+ `āš™ļø bash: ${commandText}`,
968
+ `Exit: ${exitCode}`,
969
+ formatOutputBlock(output || "(no output)")
970
+ ].join("\n") };
971
+ } catch (err) {
972
+ activeJob = null;
973
+ const message = formatErrorMessage(err);
974
+ return { text: [`āš ļø bash failed: ${commandText}`, formatOutputBlock(message)].join("\n") };
975
+ }
976
+ }
977
+ //#endregion
978
+ //#region src/auto-reply/reply/commands-bash.ts
979
+ const handleBashCommand = async (params, allowTextCommands) => {
980
+ if (!allowTextCommands) return null;
981
+ const { command } = params;
982
+ const bashSlashRequested = command.commandBodyNormalized === "/bash" || command.commandBodyNormalized.startsWith("/bash ");
983
+ const bashBangRequested = command.commandBodyNormalized.startsWith("!");
984
+ if (!bashSlashRequested && !(bashBangRequested && command.isAuthorizedSender)) return null;
985
+ const unauthorized = rejectUnauthorizedCommand(params, "/bash");
986
+ if (unauthorized) return unauthorized;
987
+ const agentId = params.sessionKey ? resolveSessionAgentId({
988
+ sessionKey: params.sessionKey,
989
+ config: params.cfg
990
+ }) : params.agentId;
991
+ return {
992
+ shouldContinue: false,
993
+ reply: await handleBashChatCommand({
994
+ ctx: params.ctx,
995
+ cfg: params.cfg,
996
+ agentId,
997
+ sessionKey: params.sessionKey,
998
+ isGroup: params.isGroup,
999
+ elevated: params.elevated
1000
+ })
1001
+ };
1002
+ };
1003
+ //#endregion
1004
+ //#region src/agents/btw.ts
1005
+ function collectTextContent(content) {
1006
+ return content.filter((part) => part.type === "text").map((part) => part.text).join("");
1007
+ }
1008
+ function collectThinkingContent(content) {
1009
+ return content.filter((part) => part.type === "thinking").map((part) => part.thinking).join("");
1010
+ }
1011
+ function buildBtwSystemPrompt() {
1012
+ return [
1013
+ "You are answering an ephemeral /btw side question about the current conversation.",
1014
+ "Use the conversation only as background context.",
1015
+ "Answer only the side question in the last user message.",
1016
+ "Do not continue, resume, or complete any unfinished task from the conversation.",
1017
+ "Do not emit tool calls, pseudo-tool calls, shell commands, file writes, patches, or code unless the side question explicitly asks for them.",
1018
+ "Do not say you will continue the main task after answering.",
1019
+ "If the question can be answered briefly, answer briefly."
1020
+ ].join("\n");
1021
+ }
1022
+ function buildBtwQuestionPrompt(question, inFlightPrompt) {
1023
+ const lines = ["Answer this side question only.", "Ignore any unfinished task in the conversation while answering it."];
1024
+ const trimmedPrompt = inFlightPrompt?.trim();
1025
+ if (trimmedPrompt) lines.push("", "Current in-flight main task request for background context only:", "<in_flight_main_task>", trimmedPrompt, "</in_flight_main_task>", "Do not continue or complete that task while answering the side question.");
1026
+ lines.push("", "<btw_side_question>", question.trim(), "</btw_side_question>");
1027
+ return lines.join("\n");
1028
+ }
1029
+ function normalizeBtwContentBlocks(content) {
1030
+ if (Array.isArray(content)) return content;
1031
+ if (content && typeof content === "object") return [content];
1032
+ }
1033
+ function isBtwTextBlock(block) {
1034
+ if (!block || typeof block !== "object") return false;
1035
+ const record = block;
1036
+ return normalizeLowercaseStringOrEmpty(record.type) === "text" && typeof record.text === "string";
1037
+ }
1038
+ function isBtwImageBlock(block) {
1039
+ if (!block || typeof block !== "object") return false;
1040
+ const record = block;
1041
+ return normalizeLowercaseStringOrEmpty(record.type) === "image" && typeof record.data === "string" && typeof record.mimeType === "string";
1042
+ }
1043
+ async function sanitizeBtwUserMessage(params) {
1044
+ if (typeof params.message.content === "string") return params.message;
1045
+ const blocks = normalizeBtwContentBlocks(params.message.content);
1046
+ if (!blocks) return;
1047
+ const content = [];
1048
+ for (const block of blocks) {
1049
+ if (isBtwTextBlock(block)) {
1050
+ content.push({
1051
+ type: "text",
1052
+ text: block.text
1053
+ });
1054
+ continue;
1055
+ }
1056
+ if (!isBtwImageBlock(block)) continue;
1057
+ const { images } = await sanitizeImageBlocks([block], "btw:context", params.imageLimits);
1058
+ const image = images[0];
1059
+ if (image) content.push(image);
1060
+ }
1061
+ if (content.length === 0) return;
1062
+ return {
1063
+ ...params.message,
1064
+ content
1065
+ };
1066
+ }
1067
+ function sanitizeBtwAssistantMessage(message) {
1068
+ const rawContent = message.content;
1069
+ if (typeof rawContent === "string") {
1070
+ const trimmed = rawContent.trim();
1071
+ return trimmed.length > 0 ? {
1072
+ ...message,
1073
+ content: [{
1074
+ type: "text",
1075
+ text: trimmed
1076
+ }]
1077
+ } : void 0;
1078
+ }
1079
+ const blocks = normalizeBtwContentBlocks(rawContent);
1080
+ if (!blocks) return;
1081
+ const content = blocks.flatMap((block) => isBtwTextBlock(block) ? [{
1082
+ type: "text",
1083
+ text: block.text
1084
+ }] : []);
1085
+ if (content.length === 0) return;
1086
+ return {
1087
+ ...message,
1088
+ content
1089
+ };
1090
+ }
1091
+ async function toSimpleContextMessages(params) {
1092
+ const contextMessages = [];
1093
+ for (const message of params.messages) {
1094
+ if (!message || typeof message !== "object") continue;
1095
+ const role = message.role;
1096
+ if (role === "user") {
1097
+ const sanitizedMessage = await sanitizeBtwUserMessage({
1098
+ message,
1099
+ imageLimits: params.imageLimits
1100
+ });
1101
+ if (sanitizedMessage) contextMessages.push(sanitizedMessage);
1102
+ continue;
1103
+ }
1104
+ if (role !== "assistant") continue;
1105
+ const sanitizedMessage = sanitizeBtwAssistantMessage(message);
1106
+ if (sanitizedMessage) contextMessages.push(sanitizedMessage);
1107
+ }
1108
+ return stripToolResultDetails(contextMessages);
1109
+ }
1110
+ function resolveSessionTranscriptPath(params) {
1111
+ try {
1112
+ const agentId = params.sessionKey?.split(":")[1];
1113
+ const pathOpts = resolveSessionFilePathOptions({
1114
+ agentId,
1115
+ storePath: params.storePath
1116
+ });
1117
+ return resolveSessionFilePath(params.sessionId, params.sessionEntry, pathOpts);
1118
+ } catch (error) {
1119
+ diagnosticLogger.debug(`resolveSessionTranscriptPath failed: sessionId=${params.sessionId} err=${String(error)}`);
1120
+ return;
1121
+ }
1122
+ }
1123
+ async function resolveRuntimeModel(params) {
1124
+ await ensureGenesisModelsJson(params.cfg, params.agentDir);
1125
+ const modelRegistry = discoverModels(discoverAuthStorage(params.agentDir), params.agentDir);
1126
+ const model = resolveModelWithRegistry({
1127
+ provider: params.provider,
1128
+ modelId: params.model,
1129
+ modelRegistry,
1130
+ cfg: params.cfg
1131
+ });
1132
+ if (!model) throw new Error(`Unknown model: ${params.provider}/${params.model}`);
1133
+ return {
1134
+ model,
1135
+ authProfileId: await resolveSessionAuthProfileOverride({
1136
+ cfg: params.cfg,
1137
+ provider: params.provider,
1138
+ agentDir: params.agentDir,
1139
+ sessionEntry: params.sessionEntry,
1140
+ sessionStore: params.sessionStore,
1141
+ sessionKey: params.sessionKey,
1142
+ storePath: params.storePath,
1143
+ isNewSession: params.isNewSession
1144
+ }),
1145
+ authProfileIdSource: params.sessionEntry?.authProfileOverrideSource
1146
+ };
1147
+ }
1148
+ async function runBtwSideQuestion(params) {
1149
+ const sessionId = params.sessionEntry.sessionId?.trim();
1150
+ if (!sessionId) throw new Error("No active session context.");
1151
+ const sessionFile = resolveSessionTranscriptPath({
1152
+ sessionId,
1153
+ sessionEntry: params.sessionEntry,
1154
+ sessionKey: params.sessionKey,
1155
+ storePath: params.storePath
1156
+ });
1157
+ if (!sessionFile) throw new Error("No active session transcript.");
1158
+ const sessionManager = SessionManager.open(sessionFile);
1159
+ const activeRunSnapshot = getActiveEmbeddedRunSnapshot(sessionId);
1160
+ const imageLimits = resolveImageSanitizationLimits(params.cfg);
1161
+ let messages = [];
1162
+ let inFlightPrompt;
1163
+ if (Array.isArray(activeRunSnapshot?.messages) && activeRunSnapshot.messages.length > 0) {
1164
+ messages = await toSimpleContextMessages({
1165
+ messages: activeRunSnapshot.messages,
1166
+ imageLimits
1167
+ });
1168
+ inFlightPrompt = activeRunSnapshot.inFlightPrompt;
1169
+ } else if (activeRunSnapshot) {
1170
+ inFlightPrompt = activeRunSnapshot.inFlightPrompt;
1171
+ if (activeRunSnapshot.transcriptLeafId && sessionManager.branch) try {
1172
+ sessionManager.branch(activeRunSnapshot.transcriptLeafId);
1173
+ } catch (error) {
1174
+ diagnosticLogger.debug(`btw snapshot leaf unavailable: sessionId=${sessionId} leaf=${activeRunSnapshot.transcriptLeafId} err=${String(error)}`);
1175
+ sessionManager.resetLeaf?.();
1176
+ }
1177
+ else sessionManager.resetLeaf?.();
1178
+ } else {
1179
+ const leafEntry = sessionManager.getLeafEntry?.();
1180
+ if (leafEntry?.type === "message" && leafEntry.message?.role === "user") if (leafEntry.parentId && sessionManager.branch) sessionManager.branch(leafEntry.parentId);
1181
+ else sessionManager.resetLeaf?.();
1182
+ }
1183
+ if (messages.length === 0) {
1184
+ const sessionContext = sessionManager.buildSessionContext();
1185
+ messages = await toSimpleContextMessages({
1186
+ messages: Array.isArray(sessionContext.messages) ? sessionContext.messages : [],
1187
+ imageLimits
1188
+ });
1189
+ }
1190
+ if (messages.length === 0 && !inFlightPrompt?.trim()) throw new Error("No active session context.");
1191
+ const { model, authProfileId } = await resolveRuntimeModel({
1192
+ cfg: params.cfg,
1193
+ provider: params.provider,
1194
+ model: params.model,
1195
+ agentDir: params.agentDir,
1196
+ sessionEntry: params.sessionEntry,
1197
+ sessionStore: params.sessionStore,
1198
+ sessionKey: params.sessionKey,
1199
+ storePath: params.storePath,
1200
+ isNewSession: params.isNewSession
1201
+ });
1202
+ const apiKeyInfo = await getApiKeyForModel({
1203
+ model,
1204
+ cfg: params.cfg,
1205
+ profileId: authProfileId,
1206
+ agentDir: params.agentDir
1207
+ });
1208
+ let runtimeModel = model;
1209
+ let apiKey = apiKeyInfo.mode === "aws-sdk" && !apiKeyInfo.apiKey ? void 0 : requireApiKey(apiKeyInfo, model.provider);
1210
+ const sessionAgentId = resolveSessionAgentId({
1211
+ sessionKey: params.sessionKey,
1212
+ config: params.cfg
1213
+ });
1214
+ const workspaceDir = resolveAgentWorkspaceDir(params.cfg, sessionAgentId);
1215
+ if (apiKey) {
1216
+ const preparedAuth = await prepareProviderRuntimeAuth({
1217
+ provider: model.provider,
1218
+ config: params.cfg,
1219
+ workspaceDir,
1220
+ env: process.env,
1221
+ context: {
1222
+ config: params.cfg,
1223
+ agentDir: params.agentDir,
1224
+ workspaceDir,
1225
+ env: process.env,
1226
+ provider: model.provider,
1227
+ modelId: model.id,
1228
+ model,
1229
+ apiKey,
1230
+ authMode: apiKeyInfo.mode,
1231
+ profileId: authProfileId
1232
+ }
1233
+ });
1234
+ if (preparedAuth?.baseUrl) runtimeModel = {
1235
+ ...runtimeModel,
1236
+ baseUrl: preparedAuth.baseUrl
1237
+ };
1238
+ if (preparedAuth?.apiKey) apiKey = preparedAuth.apiKey;
1239
+ }
1240
+ const providerStreamFn = registerProviderStreamForModel({
1241
+ model: runtimeModel,
1242
+ cfg: params.cfg,
1243
+ agentDir: params.agentDir,
1244
+ workspaceDir,
1245
+ env: process.env
1246
+ });
1247
+ const chunker = params.opts?.onBlockReply && params.blockReplyChunking ? new EmbeddedBlockChunker(params.blockReplyChunking) : void 0;
1248
+ let emittedBlocks = 0;
1249
+ let blockEmitChain = Promise.resolve();
1250
+ let answerText = "";
1251
+ let reasoningText = "";
1252
+ let assistantStarted = false;
1253
+ let sawTextEvent = false;
1254
+ const emitBlockChunk = async (text) => {
1255
+ if (!text.trim() || !params.opts?.onBlockReply) return;
1256
+ emittedBlocks += 1;
1257
+ blockEmitChain = blockEmitChain.then(async () => {
1258
+ await params.opts?.onBlockReply?.({
1259
+ text,
1260
+ btw: { question: params.question }
1261
+ });
1262
+ });
1263
+ await blockEmitChain;
1264
+ };
1265
+ const stream = await streamWithPayloadPatch(providerStreamFn ?? streamSimple, runtimeModel, {
1266
+ systemPrompt: buildBtwSystemPrompt(),
1267
+ messages: [...messages, {
1268
+ role: "user",
1269
+ content: [{
1270
+ type: "text",
1271
+ text: buildBtwQuestionPrompt(params.question, inFlightPrompt)
1272
+ }],
1273
+ timestamp: Date.now()
1274
+ }]
1275
+ }, {
1276
+ apiKey,
1277
+ reasoning: void 0,
1278
+ signal: params.opts?.abortSignal
1279
+ }, (payloadObj) => {
1280
+ if (Array.isArray(payloadObj.tools) && payloadObj.tools.length === 0) delete payloadObj.tools;
1281
+ });
1282
+ let finalEvent;
1283
+ for await (const event of stream) {
1284
+ finalEvent = event.type === "done" || event.type === "error" ? event : finalEvent;
1285
+ if (!assistantStarted && (event.type === "text_start" || event.type === "start")) {
1286
+ assistantStarted = true;
1287
+ await params.opts?.onAssistantMessageStart?.();
1288
+ }
1289
+ if (event.type === "text_delta") {
1290
+ sawTextEvent = true;
1291
+ answerText += event.delta;
1292
+ chunker?.append(event.delta);
1293
+ if (chunker && params.resolvedBlockStreamingBreak === "text_end") chunker.drain({
1294
+ force: false,
1295
+ emit: (chunk) => void emitBlockChunk(chunk)
1296
+ });
1297
+ continue;
1298
+ }
1299
+ if (event.type === "text_end" && chunker && params.resolvedBlockStreamingBreak === "text_end") {
1300
+ chunker.drain({
1301
+ force: true,
1302
+ emit: (chunk) => void emitBlockChunk(chunk)
1303
+ });
1304
+ continue;
1305
+ }
1306
+ if (event.type === "thinking_delta") {
1307
+ reasoningText += event.delta;
1308
+ if (params.resolvedReasoningLevel !== "off") await params.opts?.onReasoningStream?.({
1309
+ text: reasoningText,
1310
+ isReasoning: true
1311
+ });
1312
+ continue;
1313
+ }
1314
+ if (event.type === "thinking_end" && params.resolvedReasoningLevel !== "off") await params.opts?.onReasoningEnd?.();
1315
+ }
1316
+ if (chunker && params.resolvedBlockStreamingBreak !== "text_end" && chunker.hasBuffered()) chunker.drain({
1317
+ force: true,
1318
+ emit: (chunk) => void emitBlockChunk(chunk)
1319
+ });
1320
+ await blockEmitChain;
1321
+ if (finalEvent?.type === "error") {
1322
+ const message = collectTextContent(finalEvent.error.content);
1323
+ throw new Error(message || finalEvent.error.errorMessage || "BTW failed.");
1324
+ }
1325
+ const finalMessage = finalEvent?.type === "done" ? finalEvent.message : void 0;
1326
+ if (finalMessage) {
1327
+ if (!sawTextEvent) answerText = collectTextContent(finalMessage.content);
1328
+ if (!reasoningText) reasoningText = collectThinkingContent(finalMessage.content);
1329
+ }
1330
+ const answer = answerText.trim();
1331
+ if (!answer) throw new Error("No BTW response generated.");
1332
+ if (emittedBlocks > 0) return;
1333
+ return { text: answer };
1334
+ }
1335
+ //#endregion
1336
+ //#region src/auto-reply/reply/commands-btw.ts
1337
+ const BTW_USAGE = "Usage: /btw <side question>";
1338
+ const handleBtwCommand = async (params, allowTextCommands) => {
1339
+ if (!allowTextCommands) return null;
1340
+ const question = extractBtwQuestion(params.command.commandBodyNormalized);
1341
+ if (question === null) return null;
1342
+ const unauthorized = rejectUnauthorizedCommand(params, "/btw");
1343
+ if (unauthorized) return unauthorized;
1344
+ if (!question) return {
1345
+ shouldContinue: false,
1346
+ reply: { text: BTW_USAGE }
1347
+ };
1348
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
1349
+ if (!targetSessionEntry?.sessionId) return {
1350
+ shouldContinue: false,
1351
+ reply: { text: "āš ļø /btw requires an active session with existing context." }
1352
+ };
1353
+ const sessionAgentId = params.sessionKey ? resolveSessionAgentId({
1354
+ sessionKey: params.sessionKey,
1355
+ config: params.cfg
1356
+ }) : params.agentId;
1357
+ const agentDir = (sessionAgentId ? resolveAgentDir(params.cfg, sessionAgentId) : void 0) ?? params.agentDir;
1358
+ if (!agentDir) return {
1359
+ shouldContinue: false,
1360
+ reply: { text: "āš ļø /btw is unavailable because the active agent directory could not be resolved." }
1361
+ };
1362
+ try {
1363
+ await params.typing?.startTypingLoop();
1364
+ const reply = await runBtwSideQuestion({
1365
+ cfg: params.cfg,
1366
+ agentDir,
1367
+ provider: params.provider,
1368
+ model: params.model,
1369
+ question,
1370
+ sessionEntry: targetSessionEntry,
1371
+ sessionStore: params.sessionStore,
1372
+ sessionKey: params.sessionKey,
1373
+ storePath: params.storePath,
1374
+ resolvedThinkLevel: "off",
1375
+ resolvedReasoningLevel: "off",
1376
+ blockReplyChunking: params.blockReplyChunking,
1377
+ resolvedBlockStreamingBreak: params.resolvedBlockStreamingBreak,
1378
+ opts: params.opts,
1379
+ isNewSession: false
1380
+ });
1381
+ return {
1382
+ shouldContinue: false,
1383
+ reply: reply ? {
1384
+ ...reply,
1385
+ btw: { question }
1386
+ } : reply
1387
+ };
1388
+ } catch (error) {
1389
+ const message = error instanceof Error ? error.message.trim() : "";
1390
+ return {
1391
+ shouldContinue: false,
1392
+ reply: {
1393
+ text: `āš ļø /btw failed${message ? `: ${message}` : "."}`,
1394
+ btw: { question },
1395
+ isError: true
1396
+ }
1397
+ };
1398
+ }
1399
+ };
1400
+ //#endregion
1401
+ //#region src/auto-reply/reply/commands-compact.ts
1402
+ let compactRuntimePromise = null;
1403
+ function loadCompactRuntime() {
1404
+ compactRuntimePromise ??= import("./commands-compact.runtime-CXWGv2V6.js");
1405
+ return compactRuntimePromise;
1406
+ }
1407
+ function extractCompactInstructions(params) {
1408
+ const raw = stripStructuralPrefixes(params.rawBody ?? "");
1409
+ const trimmed = (params.isGroup ? stripMentions(raw, params.ctx, params.cfg, params.agentId) : raw).trim();
1410
+ if (!trimmed) return;
1411
+ const prefix = normalizeLowercaseStringOrEmpty(trimmed).startsWith("/compact") ? "/compact" : null;
1412
+ if (!prefix) return;
1413
+ let rest = trimmed.slice(prefix.length).trimStart();
1414
+ if (rest.startsWith(":")) rest = rest.slice(1).trimStart();
1415
+ return rest.length ? rest : void 0;
1416
+ }
1417
+ function isCompactionSkipReason(reason) {
1418
+ const text = normalizeOptionalLowercaseString(reason) ?? "";
1419
+ return text.includes("nothing to compact") || text.includes("below threshold") || text.includes("already compacted") || text.includes("no real conversation messages");
1420
+ }
1421
+ function formatCompactionReason(reason) {
1422
+ const text = normalizeOptionalString(reason);
1423
+ if (!text) return;
1424
+ const lower = normalizeLowercaseStringOrEmpty(text);
1425
+ if (lower.includes("nothing to compact")) return "nothing compactable in this session yet";
1426
+ if (lower.includes("below threshold")) return "context is below the compaction threshold";
1427
+ if (lower.includes("already compacted")) return "session was already compacted recently";
1428
+ if (lower.includes("no real conversation messages")) return "no real conversation messages yet";
1429
+ return text;
1430
+ }
1431
+ const handleCompactCommand = async (params) => {
1432
+ if (!(params.command.commandBodyNormalized === "/compact" || params.command.commandBodyNormalized.startsWith("/compact "))) return null;
1433
+ if (!params.command.isAuthorizedSender) {
1434
+ logVerbose(`Ignoring /compact from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
1435
+ return { shouldContinue: false };
1436
+ }
1437
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
1438
+ if (!targetSessionEntry?.sessionId) return {
1439
+ shouldContinue: false,
1440
+ reply: { text: "āš™ļø Compaction unavailable (missing session id)." }
1441
+ };
1442
+ const runtime = await loadCompactRuntime();
1443
+ const sessionId = targetSessionEntry.sessionId;
1444
+ if (runtime.isEmbeddedPiRunActive(sessionId)) {
1445
+ runtime.abortEmbeddedPiRun(sessionId);
1446
+ await runtime.waitForEmbeddedPiRunEnd(sessionId, 15e3);
1447
+ }
1448
+ const sessionAgentId = params.sessionKey ? resolveSessionAgentId({
1449
+ sessionKey: params.sessionKey,
1450
+ config: params.cfg
1451
+ }) : params.agentId ?? "main";
1452
+ const sessionAgentDir = sessionAgentId === (params.agentId ?? "main") && params.agentDir ? params.agentDir : resolveAgentDir(params.cfg, sessionAgentId);
1453
+ const customInstructions = extractCompactInstructions({
1454
+ rawBody: params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body,
1455
+ ctx: params.ctx,
1456
+ cfg: params.cfg,
1457
+ agentId: sessionAgentId,
1458
+ isGroup: params.isGroup
1459
+ });
1460
+ const result = await runtime.compactEmbeddedPiSession({
1461
+ sessionId,
1462
+ sessionKey: params.sessionKey,
1463
+ allowGatewaySubagentBinding: true,
1464
+ messageChannel: params.command.channel,
1465
+ groupId: targetSessionEntry.groupId,
1466
+ groupChannel: targetSessionEntry.groupChannel,
1467
+ groupSpace: targetSessionEntry.space,
1468
+ spawnedBy: targetSessionEntry.spawnedBy,
1469
+ senderId: params.command.senderId,
1470
+ senderName: params.ctx.SenderName,
1471
+ senderUsername: params.ctx.SenderUsername,
1472
+ senderE164: params.ctx.SenderE164,
1473
+ sessionFile: runtime.resolveSessionFilePath(sessionId, targetSessionEntry, runtime.resolveSessionFilePathOptions({
1474
+ agentId: sessionAgentId,
1475
+ storePath: params.storePath
1476
+ })),
1477
+ workspaceDir: params.workspaceDir,
1478
+ agentDir: sessionAgentDir,
1479
+ config: params.cfg,
1480
+ skillsSnapshot: targetSessionEntry.skillsSnapshot,
1481
+ provider: params.provider,
1482
+ model: params.model,
1483
+ agentHarnessId: targetSessionEntry.sessionId === sessionId ? targetSessionEntry.agentHarnessId : void 0,
1484
+ thinkLevel: params.resolvedThinkLevel ?? await params.resolveDefaultThinkingLevel(),
1485
+ bashElevated: {
1486
+ enabled: false,
1487
+ allowed: false,
1488
+ defaultLevel: "off"
1489
+ },
1490
+ customInstructions,
1491
+ trigger: "manual",
1492
+ senderIsOwner: params.command.senderIsOwner,
1493
+ ownerNumbers: params.command.ownerList.length > 0 ? params.command.ownerList : void 0
1494
+ });
1495
+ const compactLabel = result.ok || isCompactionSkipReason(result.reason) ? result.compacted ? result.result?.tokensBefore != null && result.result?.tokensAfter != null ? `Compacted (${runtime.formatTokenCount(result.result.tokensBefore)} → ${runtime.formatTokenCount(result.result.tokensAfter)})` : result.result?.tokensBefore ? `Compacted (${runtime.formatTokenCount(result.result.tokensBefore)} before)` : "Compacted" : "Compaction skipped" : "Compaction failed";
1496
+ if (result.ok && result.compacted) await runtime.incrementCompactionCount({
1497
+ cfg: params.cfg,
1498
+ sessionEntry: targetSessionEntry,
1499
+ sessionStore: params.sessionStore,
1500
+ sessionKey: params.sessionKey,
1501
+ storePath: params.storePath,
1502
+ tokensAfter: result.result?.tokensAfter
1503
+ });
1504
+ const totalTokens = result.result?.tokensAfter ?? runtime.resolveFreshSessionTotalTokens(targetSessionEntry);
1505
+ const contextSummary = runtime.formatContextUsageShort(typeof totalTokens === "number" && totalTokens > 0 ? totalTokens : null, params.contextTokens ?? targetSessionEntry.contextTokens ?? null);
1506
+ const reason = formatCompactionReason(result.reason);
1507
+ const line = reason ? `${compactLabel}: ${reason} • ${contextSummary}` : `${compactLabel} • ${contextSummary}`;
1508
+ runtime.enqueueSystemEvent(line, { sessionKey: params.sessionKey });
1509
+ return {
1510
+ shouldContinue: false,
1511
+ reply: { text: `āš™ļø ${line}` }
1512
+ };
1513
+ };
1514
+ //#endregion
1515
+ //#region src/auto-reply/reply/commands-slash-parse.ts
1516
+ function parseSlashCommandActionArgs(raw, slash) {
1517
+ const trimmed = raw.trim();
1518
+ const slashLower = normalizeLowercaseStringOrEmpty(slash);
1519
+ if (!normalizeLowercaseStringOrEmpty(trimmed).startsWith(slashLower)) return { kind: "no-match" };
1520
+ const rest = trimmed.slice(slash.length).trim();
1521
+ if (!rest) return { kind: "empty" };
1522
+ const match = rest.match(/^(\S+)(?:\s+([\s\S]+))?$/);
1523
+ if (!match) return { kind: "invalid" };
1524
+ return {
1525
+ kind: "parsed",
1526
+ action: normalizeLowercaseStringOrEmpty(match[1]),
1527
+ args: (match[2] ?? "").trim()
1528
+ };
1529
+ }
1530
+ function parseSlashCommandOrNull(raw, slash, opts) {
1531
+ const parsed = parseSlashCommandActionArgs(raw, slash);
1532
+ if (parsed.kind === "no-match") return null;
1533
+ if (parsed.kind === "invalid") return {
1534
+ ok: false,
1535
+ message: opts.invalidMessage
1536
+ };
1537
+ if (parsed.kind === "empty") return {
1538
+ ok: true,
1539
+ action: opts.defaultAction ?? "show",
1540
+ args: ""
1541
+ };
1542
+ return {
1543
+ ok: true,
1544
+ action: parsed.action,
1545
+ args: parsed.args
1546
+ };
1547
+ }
1548
+ //#endregion
1549
+ //#region src/auto-reply/reply/commands-setunset.ts
1550
+ function parseSetUnsetCommand(params) {
1551
+ const action = params.action;
1552
+ const args = params.args.trim();
1553
+ if (action === "unset") {
1554
+ if (!args) return {
1555
+ kind: "error",
1556
+ message: `Usage: ${params.slash} unset path`
1557
+ };
1558
+ return {
1559
+ kind: "unset",
1560
+ path: args
1561
+ };
1562
+ }
1563
+ if (!args) return {
1564
+ kind: "error",
1565
+ message: `Usage: ${params.slash} set path=value`
1566
+ };
1567
+ const eqIndex = args.indexOf("=");
1568
+ if (eqIndex <= 0) return {
1569
+ kind: "error",
1570
+ message: `Usage: ${params.slash} set path=value`
1571
+ };
1572
+ const path = args.slice(0, eqIndex).trim();
1573
+ const rawValue = args.slice(eqIndex + 1);
1574
+ if (!path) return {
1575
+ kind: "error",
1576
+ message: `Usage: ${params.slash} set path=value`
1577
+ };
1578
+ const parsed = parseConfigValue(rawValue);
1579
+ if (parsed.error) return {
1580
+ kind: "error",
1581
+ message: parsed.error
1582
+ };
1583
+ return {
1584
+ kind: "set",
1585
+ path,
1586
+ value: parsed.value
1587
+ };
1588
+ }
1589
+ function parseSetUnsetCommandAction(params) {
1590
+ if (params.action !== "set" && params.action !== "unset") return null;
1591
+ const parsed = parseSetUnsetCommand({
1592
+ slash: params.slash,
1593
+ action: params.action,
1594
+ args: params.args
1595
+ });
1596
+ if (parsed.kind === "error") return params.onError(parsed.message);
1597
+ return parsed.kind === "set" ? params.onSet(parsed.path, parsed.value) : params.onUnset(parsed.path);
1598
+ }
1599
+ function parseSlashCommandWithSetUnset(params) {
1600
+ const parsed = parseSlashCommandOrNull(params.raw, params.slash, { invalidMessage: params.invalidMessage });
1601
+ if (!parsed) return null;
1602
+ if (!parsed.ok) return params.onError(parsed.message);
1603
+ const { action, args } = parsed;
1604
+ const setUnset = parseSetUnsetCommandAction({
1605
+ slash: params.slash,
1606
+ action,
1607
+ args,
1608
+ onSet: params.onSet,
1609
+ onUnset: params.onUnset,
1610
+ onError: params.onError
1611
+ });
1612
+ if (setUnset) return setUnset;
1613
+ const knownAction = params.onKnownAction(action, args);
1614
+ if (knownAction) return knownAction;
1615
+ return params.onError(params.usageMessage);
1616
+ }
1617
+ //#endregion
1618
+ //#region src/auto-reply/reply/commands-setunset-standard.ts
1619
+ function parseStandardSetUnsetSlashCommand(params) {
1620
+ return parseSlashCommandWithSetUnset({
1621
+ raw: params.raw,
1622
+ slash: params.slash,
1623
+ invalidMessage: params.invalidMessage,
1624
+ usageMessage: params.usageMessage,
1625
+ onKnownAction: params.onKnownAction,
1626
+ onSet: params.onSet ?? ((path, value) => ({
1627
+ action: "set",
1628
+ path,
1629
+ value
1630
+ })),
1631
+ onUnset: params.onUnset ?? ((path) => ({
1632
+ action: "unset",
1633
+ path
1634
+ })),
1635
+ onError: params.onError ?? ((message) => ({
1636
+ action: "error",
1637
+ message
1638
+ }))
1639
+ });
1640
+ }
1641
+ //#endregion
1642
+ //#region src/auto-reply/reply/config-commands.ts
1643
+ function parseConfigCommand(raw) {
1644
+ return parseStandardSetUnsetSlashCommand({
1645
+ raw,
1646
+ slash: "/config",
1647
+ invalidMessage: "Invalid /config syntax.",
1648
+ usageMessage: "Usage: /config show|set|unset",
1649
+ onKnownAction: (action, args) => {
1650
+ if (action === "show" || action === "get") return {
1651
+ action: "show",
1652
+ path: args || void 0
1653
+ };
1654
+ }
1655
+ });
1656
+ }
1657
+ //#endregion
1658
+ //#region src/auto-reply/reply/debug-commands.ts
1659
+ function parseDebugCommand(raw) {
1660
+ return parseStandardSetUnsetSlashCommand({
1661
+ raw,
1662
+ slash: "/debug",
1663
+ invalidMessage: "Invalid /debug syntax.",
1664
+ usageMessage: "Usage: /debug show|set|unset|reset",
1665
+ onKnownAction: (action) => {
1666
+ if (action === "show") return { action: "show" };
1667
+ if (action === "reset") return { action: "reset" };
1668
+ }
1669
+ });
1670
+ }
1671
+ //#endregion
1672
+ //#region src/auto-reply/reply/commands-config.ts
1673
+ const handleConfigCommand = async (params, allowTextCommands) => {
1674
+ if (!allowTextCommands) return null;
1675
+ const configCommand = parseConfigCommand(params.command.commandBodyNormalized);
1676
+ if (!configCommand) return null;
1677
+ const unauthorized = rejectUnauthorizedCommand(params, "/config");
1678
+ if (unauthorized) return unauthorized;
1679
+ const nonOwner = configCommand.action === "show" && isInternalMessageChannel(params.command.channel) ? null : rejectNonOwnerCommand(params, "/config");
1680
+ if (nonOwner) return nonOwner;
1681
+ const disabled = requireCommandFlagEnabled(params.cfg, {
1682
+ label: "/config",
1683
+ configKey: "config"
1684
+ });
1685
+ if (disabled) return disabled;
1686
+ if (configCommand.action === "error") return {
1687
+ shouldContinue: false,
1688
+ reply: { text: `āš ļø ${configCommand.message}` }
1689
+ };
1690
+ let parsedWritePath;
1691
+ if (configCommand.action === "set" || configCommand.action === "unset") {
1692
+ const missingAdminScope = requireGatewayClientScopeForInternalChannel(params, {
1693
+ label: "/config write",
1694
+ allowedScopes: ["operator.admin"],
1695
+ missingText: "āŒ /config set|unset requires operator.admin for gateway clients."
1696
+ });
1697
+ if (missingAdminScope) return missingAdminScope;
1698
+ const parsedPath = parseConfigPath(configCommand.path);
1699
+ if (!parsedPath.ok || !parsedPath.path) return {
1700
+ shouldContinue: false,
1701
+ reply: { text: `āš ļø ${parsedPath.error ?? "Invalid path."}` }
1702
+ };
1703
+ parsedWritePath = parsedPath.path;
1704
+ const channelId = params.command.channelId ?? normalizeChannelId(params.command.channel);
1705
+ const deniedText = resolveConfigWriteDeniedText({
1706
+ cfg: params.cfg,
1707
+ channel: params.command.channel,
1708
+ channelId,
1709
+ accountId: resolveChannelAccountId({
1710
+ cfg: params.cfg,
1711
+ ctx: params.ctx,
1712
+ command: params.command
1713
+ }),
1714
+ gatewayClientScopes: params.ctx.GatewayClientScopes,
1715
+ target: resolveConfigWriteTargetFromPath(parsedWritePath)
1716
+ });
1717
+ if (deniedText) return {
1718
+ shouldContinue: false,
1719
+ reply: { text: deniedText }
1720
+ };
1721
+ }
1722
+ const snapshot = await readConfigFileSnapshot();
1723
+ if (!snapshot.valid || !snapshot.parsed || typeof snapshot.parsed !== "object") return {
1724
+ shouldContinue: false,
1725
+ reply: { text: "āš ļø Config file is invalid; fix it before using /config." }
1726
+ };
1727
+ const parsedBase = structuredClone(snapshot.parsed);
1728
+ if (configCommand.action === "show") {
1729
+ const pathRaw = normalizeOptionalString(configCommand.path);
1730
+ if (pathRaw) {
1731
+ const parsedPath = parseConfigPath(pathRaw);
1732
+ if (!parsedPath.ok || !parsedPath.path) return {
1733
+ shouldContinue: false,
1734
+ reply: { text: `āš ļø ${parsedPath.error ?? "Invalid path."}` }
1735
+ };
1736
+ const value = getConfigValueAtPath(parsedBase, parsedPath.path);
1737
+ return {
1738
+ shouldContinue: false,
1739
+ reply: { text: `āš™ļø Config ${pathRaw}:\n\`\`\`json\n${JSON.stringify(value ?? null, null, 2)}\n\`\`\`` }
1740
+ };
1741
+ }
1742
+ return {
1743
+ shouldContinue: false,
1744
+ reply: { text: `āš™ļø Config (raw):\n\`\`\`json\n${JSON.stringify(parsedBase, null, 2)}\n\`\`\`` }
1745
+ };
1746
+ }
1747
+ if (configCommand.action === "unset") {
1748
+ if (!unsetConfigValueAtPath(parsedBase, parsedWritePath ?? [])) return {
1749
+ shouldContinue: false,
1750
+ reply: { text: `āš™ļø No config value found for ${configCommand.path}.` }
1751
+ };
1752
+ const validated = validateConfigObjectWithPlugins(parsedBase);
1753
+ if (!validated.ok) {
1754
+ const issue = validated.issues[0];
1755
+ return {
1756
+ shouldContinue: false,
1757
+ reply: { text: `āš ļø Config invalid after unset (${issue.path}: ${issue.message}).` }
1758
+ };
1759
+ }
1760
+ await writeConfigFile(validated.config);
1761
+ return {
1762
+ shouldContinue: false,
1763
+ reply: { text: `āš™ļø Config updated: ${configCommand.path} removed.` }
1764
+ };
1765
+ }
1766
+ if (configCommand.action === "set") {
1767
+ setConfigValueAtPath(parsedBase, parsedWritePath ?? [], configCommand.value);
1768
+ const validated = validateConfigObjectWithPlugins(parsedBase);
1769
+ if (!validated.ok) {
1770
+ const issue = validated.issues[0];
1771
+ return {
1772
+ shouldContinue: false,
1773
+ reply: { text: `āš ļø Config invalid after set (${issue.path}: ${issue.message}).` }
1774
+ };
1775
+ }
1776
+ await writeConfigFile(validated.config);
1777
+ const valueLabel = typeof configCommand.value === "string" ? `"${configCommand.value}"` : JSON.stringify(configCommand.value);
1778
+ return {
1779
+ shouldContinue: false,
1780
+ reply: { text: `āš™ļø Config updated: ${configCommand.path}=${valueLabel ?? "null"}` }
1781
+ };
1782
+ }
1783
+ return null;
1784
+ };
1785
+ const handleDebugCommand = async (params, allowTextCommands) => {
1786
+ if (!allowTextCommands) return null;
1787
+ const debugCommand = parseDebugCommand(params.command.commandBodyNormalized);
1788
+ if (!debugCommand) return null;
1789
+ const unauthorized = rejectUnauthorizedCommand(params, "/debug");
1790
+ if (unauthorized) return unauthorized;
1791
+ const nonOwner = rejectNonOwnerCommand(params, "/debug");
1792
+ if (nonOwner) return nonOwner;
1793
+ const disabled = requireCommandFlagEnabled(params.cfg, {
1794
+ label: "/debug",
1795
+ configKey: "debug"
1796
+ });
1797
+ if (disabled) return disabled;
1798
+ if (debugCommand.action === "error") return {
1799
+ shouldContinue: false,
1800
+ reply: { text: `āš ļø ${debugCommand.message}` }
1801
+ };
1802
+ if (debugCommand.action === "show") {
1803
+ const overrides = getConfigOverrides();
1804
+ if (!(Object.keys(overrides).length > 0)) return {
1805
+ shouldContinue: false,
1806
+ reply: { text: "āš™ļø Debug overrides: (none)" }
1807
+ };
1808
+ return {
1809
+ shouldContinue: false,
1810
+ reply: { text: `āš™ļø Debug overrides (memory-only):\n\`\`\`json\n${JSON.stringify(overrides, null, 2)}\n\`\`\`` }
1811
+ };
1812
+ }
1813
+ if (debugCommand.action === "reset") {
1814
+ resetConfigOverrides();
1815
+ return {
1816
+ shouldContinue: false,
1817
+ reply: { text: "āš™ļø Debug overrides cleared; using config on disk." }
1818
+ };
1819
+ }
1820
+ if (debugCommand.action === "unset") {
1821
+ const result = unsetConfigOverride(debugCommand.path);
1822
+ if (!result.ok) return {
1823
+ shouldContinue: false,
1824
+ reply: { text: `āš ļø ${result.error ?? "Invalid path."}` }
1825
+ };
1826
+ if (!result.removed) return {
1827
+ shouldContinue: false,
1828
+ reply: { text: `āš™ļø No debug override found for ${debugCommand.path}.` }
1829
+ };
1830
+ return {
1831
+ shouldContinue: false,
1832
+ reply: { text: `āš™ļø Debug override removed for ${debugCommand.path}.` }
1833
+ };
1834
+ }
1835
+ if (debugCommand.action === "set") {
1836
+ const result = setConfigOverride(debugCommand.path, debugCommand.value);
1837
+ if (!result.ok) return {
1838
+ shouldContinue: false,
1839
+ reply: { text: `āš ļø ${result.error ?? "Invalid override."}` }
1840
+ };
1841
+ const valueLabel = typeof debugCommand.value === "string" ? `"${debugCommand.value}"` : JSON.stringify(debugCommand.value);
1842
+ return {
1843
+ shouldContinue: false,
1844
+ reply: { text: `āš™ļø Debug override set: ${debugCommand.path}=${valueLabel ?? "null"}` }
1845
+ };
1846
+ }
1847
+ return null;
1848
+ };
1849
+ //#endregion
1850
+ //#region src/auto-reply/reply/commands-context-report.ts
1851
+ function formatInt(n) {
1852
+ return new Intl.NumberFormat("en-US").format(n);
1853
+ }
1854
+ function formatCharsAndTokens(chars) {
1855
+ return `${formatInt(chars)} chars (~${formatInt(estimateTokensFromChars(chars))} tok)`;
1856
+ }
1857
+ function parseContextArgs(commandBodyNormalized) {
1858
+ if (commandBodyNormalized === "/context") return "";
1859
+ if (commandBodyNormalized.startsWith("/context ")) return commandBodyNormalized.slice(8).trim();
1860
+ return "";
1861
+ }
1862
+ function formatListTop(entries, cap) {
1863
+ const sorted = [...entries].toSorted((a, b) => b.value - a.value);
1864
+ const top = sorted.slice(0, cap);
1865
+ const omitted = Math.max(0, sorted.length - top.length);
1866
+ return {
1867
+ lines: top.map((e) => `- ${e.name}: ${formatCharsAndTokens(e.value)}`),
1868
+ omitted
1869
+ };
1870
+ }
1871
+ async function resolveContextReport(params) {
1872
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
1873
+ const existing = targetSessionEntry?.systemPromptReport;
1874
+ if (existing && existing.source === "run") return existing;
1875
+ const bootstrapMaxChars = resolveBootstrapMaxChars(params.cfg);
1876
+ const bootstrapTotalMaxChars = resolveBootstrapTotalMaxChars(params.cfg);
1877
+ const { resolveCommandsSystemPromptBundle } = await import("./commands-system-prompt-DsWVuYqh.js");
1878
+ const { systemPrompt, tools, skillsPrompt, bootstrapFiles, injectedFiles, sandboxRuntime } = await resolveCommandsSystemPromptBundle(params);
1879
+ return buildSystemPromptReport({
1880
+ source: "estimate",
1881
+ generatedAt: Date.now(),
1882
+ sessionId: targetSessionEntry?.sessionId,
1883
+ sessionKey: params.sessionKey,
1884
+ provider: params.provider,
1885
+ model: params.model,
1886
+ workspaceDir: params.workspaceDir,
1887
+ bootstrapMaxChars,
1888
+ bootstrapTotalMaxChars,
1889
+ sandbox: {
1890
+ mode: sandboxRuntime.mode,
1891
+ sandboxed: sandboxRuntime.sandboxed
1892
+ },
1893
+ systemPrompt,
1894
+ bootstrapFiles,
1895
+ injectedFiles,
1896
+ skillsPrompt,
1897
+ tools
1898
+ });
1899
+ }
1900
+ async function buildContextReply(params) {
1901
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
1902
+ const sub = normalizeLowercaseStringOrEmpty(parseContextArgs(params.command.commandBodyNormalized).split(/\s+/).find(Boolean));
1903
+ if (!sub || sub === "help") return { text: [
1904
+ "🧠 /context",
1905
+ "",
1906
+ "What counts as context (high-level), plus a breakdown mode.",
1907
+ "",
1908
+ "Try:",
1909
+ "- /context list (short breakdown)",
1910
+ "- /context detail (per-file + per-tool + per-skill + system prompt size)",
1911
+ "- /context json (same, machine-readable)",
1912
+ "",
1913
+ "Inline shortcut = a command token inside a normal message (e.g. ā€œhey /statusā€). It runs immediately (allowlisted senders only) and is stripped before the model sees the remaining text."
1914
+ ].join("\n") };
1915
+ const report = await resolveContextReport(params);
1916
+ const cachedContextUsageTokens = resolveFreshSessionTotalTokens(targetSessionEntry);
1917
+ const session = {
1918
+ totalTokens: targetSessionEntry?.totalTokens ?? null,
1919
+ totalTokensFresh: targetSessionEntry?.totalTokensFresh ?? null,
1920
+ inputTokens: targetSessionEntry?.inputTokens ?? null,
1921
+ outputTokens: targetSessionEntry?.outputTokens ?? null,
1922
+ contextTokens: params.contextTokens ?? null
1923
+ };
1924
+ if (sub === "json") return { text: JSON.stringify({
1925
+ report,
1926
+ session
1927
+ }, null, 2) };
1928
+ if (sub !== "list" && sub !== "show" && sub !== "detail" && sub !== "deep") return { text: ["Unknown /context mode.", "Use: /context, /context list, /context detail, or /context json"].join("\n") };
1929
+ const fileLines = report.injectedWorkspaceFiles.map((f) => {
1930
+ const status = f.missing ? "MISSING" : f.truncated ? "TRUNCATED" : "OK";
1931
+ const raw = f.missing ? "0" : formatCharsAndTokens(f.rawChars);
1932
+ const injected = f.missing ? "0" : formatCharsAndTokens(f.injectedChars);
1933
+ return `- ${f.name}: ${status} | raw ${raw} | injected ${injected}`;
1934
+ });
1935
+ const sandboxLine = `Sandbox: mode=${report.sandbox?.mode ?? "unknown"} sandboxed=${report.sandbox?.sandboxed ?? false}`;
1936
+ const toolSchemaLine = `Tool schemas (JSON): ${formatCharsAndTokens(report.tools.schemaChars)} (counts toward context; not shown as text)`;
1937
+ const toolListLine = `Tool list (system prompt text): ${formatCharsAndTokens(report.tools.listChars)}`;
1938
+ const skillNameSet = new Set(report.skills.entries.map((s) => s.name));
1939
+ const skillNames = Array.from(skillNameSet);
1940
+ const toolNames = report.tools.entries.map((t) => t.name);
1941
+ const formatNameList = (names, cap) => names.length <= cap ? names.join(", ") : `${names.slice(0, cap).join(", ")}, … (+${names.length - cap} more)`;
1942
+ const skillsLine = `Skills list (system prompt text): ${formatCharsAndTokens(report.skills.promptChars)} (${skillNameSet.size} skills)`;
1943
+ const skillsNamesLine = skillNameSet.size ? `Skills: ${formatNameList(skillNames, 20)}` : "Skills: (none)";
1944
+ const toolsNamesLine = toolNames.length ? `Tools: ${formatNameList(toolNames, 30)}` : "Tools: (none)";
1945
+ const systemPromptLine = `System prompt (${report.source}): ${formatCharsAndTokens(report.systemPrompt.chars)} (Project Context ${formatCharsAndTokens(report.systemPrompt.projectContextChars)})`;
1946
+ const workspaceLabel = report.workspaceDir ?? params.workspaceDir;
1947
+ const bootstrapMaxChars = typeof report.bootstrapMaxChars === "number" && Number.isFinite(report.bootstrapMaxChars) && report.bootstrapMaxChars > 0 ? report.bootstrapMaxChars : resolveBootstrapMaxChars(params.cfg);
1948
+ const bootstrapTotalMaxChars = typeof report.bootstrapTotalMaxChars === "number" && Number.isFinite(report.bootstrapTotalMaxChars) && report.bootstrapTotalMaxChars > 0 ? report.bootstrapTotalMaxChars : resolveBootstrapTotalMaxChars(params.cfg);
1949
+ const bootstrapMaxLabel = `${formatInt(bootstrapMaxChars)} chars`;
1950
+ const bootstrapTotalLabel = `${formatInt(bootstrapTotalMaxChars)} chars`;
1951
+ const bootstrapAnalysis = analyzeBootstrapBudget({
1952
+ files: report.injectedWorkspaceFiles,
1953
+ bootstrapMaxChars,
1954
+ bootstrapTotalMaxChars
1955
+ });
1956
+ const truncatedBootstrapFiles = bootstrapAnalysis.truncatedFiles;
1957
+ const truncationCauseCounts = truncatedBootstrapFiles.reduce((acc, file) => {
1958
+ for (const cause of file.causes) if (cause === "per-file-limit") acc.perFile += 1;
1959
+ else if (cause === "total-limit") acc.total += 1;
1960
+ return acc;
1961
+ }, {
1962
+ perFile: 0,
1963
+ total: 0
1964
+ });
1965
+ const truncationCauseParts = [truncationCauseCounts.perFile > 0 ? `${truncationCauseCounts.perFile} file(s) exceeded max/file` : null, truncationCauseCounts.total > 0 ? `${truncationCauseCounts.total} file(s) hit max/total` : null].filter(Boolean);
1966
+ const bootstrapWarningLines = truncatedBootstrapFiles.length > 0 ? [
1967
+ `⚠ Bootstrap context is over configured limits: ${truncatedBootstrapFiles.length} file(s) truncated (${formatInt(bootstrapAnalysis.totals.rawChars)} raw chars -> ${formatInt(bootstrapAnalysis.totals.injectedChars)} injected chars).`,
1968
+ ...truncationCauseParts.length ? [`Causes: ${truncationCauseParts.join("; ")}.`] : [],
1969
+ "Tip: increase `agents.defaults.bootstrapMaxChars` and/or `agents.defaults.bootstrapTotalMaxChars` if this truncation is not intentional."
1970
+ ] : [];
1971
+ const contextWindowLabel = session.contextTokens != null ? formatInt(session.contextTokens) : "?";
1972
+ const totalsLine = cachedContextUsageTokens != null ? `Session tokens (cached): ${formatInt(cachedContextUsageTokens)} total / ctx=${contextWindowLabel}` : `Session tokens (cached): unknown / ctx=${contextWindowLabel}`;
1973
+ const sharedContextLines = [
1974
+ `Workspace: ${workspaceLabel}`,
1975
+ `Bootstrap max/file: ${bootstrapMaxLabel}`,
1976
+ `Bootstrap max/total: ${bootstrapTotalLabel}`,
1977
+ sandboxLine,
1978
+ systemPromptLine,
1979
+ ...bootstrapWarningLines.length ? ["", ...bootstrapWarningLines] : [],
1980
+ "",
1981
+ "Injected workspace files:",
1982
+ ...fileLines,
1983
+ "",
1984
+ skillsLine,
1985
+ skillsNamesLine
1986
+ ];
1987
+ if (sub === "detail" || sub === "deep") {
1988
+ const perSkill = formatListTop(report.skills.entries.map((s) => ({
1989
+ name: s.name,
1990
+ value: s.blockChars
1991
+ })), 30);
1992
+ const perToolSchema = formatListTop(report.tools.entries.map((t) => ({
1993
+ name: t.name,
1994
+ value: t.schemaChars
1995
+ })), 30);
1996
+ const perToolSummary = formatListTop(report.tools.entries.map((t) => ({
1997
+ name: t.name,
1998
+ value: t.summaryChars
1999
+ })), 30);
2000
+ const toolPropsLines = report.tools.entries.filter((t) => t.propertiesCount != null).toSorted((a, b) => (b.propertiesCount ?? 0) - (a.propertiesCount ?? 0)).slice(0, 30).map((t) => `- ${t.name}: ${t.propertiesCount} params`);
2001
+ const trackedPromptChars = report.systemPrompt.chars + report.tools.schemaChars;
2002
+ const trackedPromptLine = `Tracked prompt estimate: ${formatCharsAndTokens(trackedPromptChars)}`;
2003
+ const actualContextLine = cachedContextUsageTokens != null ? `Actual context usage (cached): ${formatInt(cachedContextUsageTokens)} tok` : "Actual context usage (cached): unavailable";
2004
+ const overheadTokens = cachedContextUsageTokens != null ? cachedContextUsageTokens - estimateTokensFromChars(trackedPromptChars) : null;
2005
+ const overheadLine = overheadTokens == null ? null : overheadTokens > 0 ? `Untracked provider/runtime overhead: ~${formatInt(overheadTokens)} tok` : "Untracked provider/runtime overhead: not observed in cached usage";
2006
+ return { text: [
2007
+ "🧠 Context breakdown (detailed)",
2008
+ ...sharedContextLines,
2009
+ ...perSkill.lines.length ? ["Top skills (prompt entry size):", ...perSkill.lines] : [],
2010
+ ...perSkill.omitted ? [`… (+${perSkill.omitted} more skills)`] : [],
2011
+ "",
2012
+ toolListLine,
2013
+ toolSchemaLine,
2014
+ toolsNamesLine,
2015
+ "Top tools (schema size):",
2016
+ ...perToolSchema.lines,
2017
+ ...perToolSchema.omitted ? [`… (+${perToolSchema.omitted} more tools)`] : [],
2018
+ "",
2019
+ "Top tools (summary text size):",
2020
+ ...perToolSummary.lines,
2021
+ ...perToolSummary.omitted ? [`… (+${perToolSummary.omitted} more tools)`] : [],
2022
+ ...toolPropsLines.length ? [
2023
+ "",
2024
+ "Tools (param count):",
2025
+ ...toolPropsLines
2026
+ ] : [],
2027
+ "",
2028
+ trackedPromptLine,
2029
+ actualContextLine,
2030
+ ...overheadLine ? [overheadLine] : [],
2031
+ "",
2032
+ totalsLine,
2033
+ "",
2034
+ "Inline shortcut: a command token inside normal text (e.g. ā€œhey /statusā€) that runs immediately (allowlisted senders only) and is stripped before the model sees the remaining message."
2035
+ ].filter(Boolean).join("\n") };
2036
+ }
2037
+ return { text: [
2038
+ "🧠 Context breakdown",
2039
+ ...sharedContextLines,
2040
+ toolListLine,
2041
+ toolSchemaLine,
2042
+ toolsNamesLine,
2043
+ "",
2044
+ totalsLine,
2045
+ "",
2046
+ "Inline shortcut: a command token inside normal text (e.g. ā€œhey /statusā€) that runs immediately (allowlisted senders only) and is stripped before the model sees the remaining message."
2047
+ ].join("\n") };
2048
+ }
2049
+ //#endregion
2050
+ //#region src/auto-reply/reply/commands-context-command.ts
2051
+ const handleContextCommand = async (params, allowTextCommands) => {
2052
+ if (!allowTextCommands) return null;
2053
+ const normalized = params.command.commandBodyNormalized;
2054
+ if (normalized !== "/context" && !normalized.startsWith("/context ")) return null;
2055
+ if (!params.command.isAuthorizedSender) {
2056
+ logVerbose(`Ignoring /context from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
2057
+ return { shouldContinue: false };
2058
+ }
2059
+ return {
2060
+ shouldContinue: false,
2061
+ reply: await buildContextReply(params)
2062
+ };
2063
+ };
2064
+ //#endregion
2065
+ //#region src/auto-reply/reply/commands-export-common.ts
2066
+ function escapeRegExp(value) {
2067
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2068
+ }
2069
+ function parseExportCommandOutputPath(commandBodyNormalized, aliases) {
2070
+ const normalized = commandBodyNormalized.trim();
2071
+ if (aliases.some((alias) => normalized === `/${alias}`)) return {};
2072
+ const aliasPattern = aliases.map(escapeRegExp).join("|");
2073
+ return { outputPath: normalized.replace(new RegExp(`^/(${aliasPattern})\\s*`), "").trim().split(/\s+/).find((part) => !part.startsWith("-")) };
2074
+ }
2075
+ function resolveExportCommandSessionTarget(params) {
2076
+ const targetAgentId = resolveAgentIdFromSessionKey(params.sessionKey) || params.agentId;
2077
+ const storePath = params.storePath ?? resolveDefaultSessionStorePath(targetAgentId);
2078
+ const entry = loadSessionStore(storePath, { skipCache: true })[params.sessionKey];
2079
+ if (!entry?.sessionId) return { text: `āŒ Session not found: ${params.sessionKey}` };
2080
+ try {
2081
+ return {
2082
+ entry,
2083
+ sessionFile: resolveSessionFilePath(entry.sessionId, entry, resolveSessionFilePathOptions({
2084
+ agentId: targetAgentId,
2085
+ storePath
2086
+ }))
2087
+ };
2088
+ } catch (err) {
2089
+ return { text: `āŒ Failed to resolve session file: ${formatErrorMessage(err)}` };
2090
+ }
2091
+ }
2092
+ function isReplyPayload(value) {
2093
+ return "text" in value;
2094
+ }
2095
+ //#endregion
2096
+ //#region src/auto-reply/reply/commands-export-session.ts
2097
+ const EXPORT_HTML_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "export-html");
2098
+ function loadTemplate(fileName) {
2099
+ return fs.readFileSync(path.join(EXPORT_HTML_DIR, fileName), "utf-8");
2100
+ }
2101
+ function generateHtml(sessionData) {
2102
+ const template = loadTemplate("template.html");
2103
+ const templateCss = loadTemplate("template.css");
2104
+ const templateJs = loadTemplate("template.js");
2105
+ const markedJs = loadTemplate(path.join("vendor", "marked.min.js"));
2106
+ const hljsJs = loadTemplate(path.join("vendor", "highlight.min.js"));
2107
+ const themeVars = `
2108
+ --cyan: #00d7ff;
2109
+ --blue: #5f87ff;
2110
+ --green: #b5bd68;
2111
+ --red: #cc6666;
2112
+ --yellow: #ffff00;
2113
+ --gray: #808080;
2114
+ --dimGray: #666666;
2115
+ --darkGray: #505050;
2116
+ --accent: #8abeb7;
2117
+ --selectedBg: #3a3a4a;
2118
+ --userMsgBg: #343541;
2119
+ --toolPendingBg: #282832;
2120
+ --toolSuccessBg: #283228;
2121
+ --toolErrorBg: #3c2828;
2122
+ --customMsgBg: #2d2838;
2123
+ --text: #e0e0e0;
2124
+ --dim: #666666;
2125
+ --muted: #808080;
2126
+ --border: #5f87ff;
2127
+ --borderAccent: #00d7ff;
2128
+ --borderMuted: #505050;
2129
+ --success: #b5bd68;
2130
+ --error: #cc6666;
2131
+ --warning: #ffff00;
2132
+ --thinkingText: #808080;
2133
+ --userMessageBg: #343541;
2134
+ --userMessageText: #e0e0e0;
2135
+ --customMessageBg: #2d2838;
2136
+ --customMessageText: #e0e0e0;
2137
+ --customMessageLabel: #9575cd;
2138
+ --toolTitle: #e0e0e0;
2139
+ --toolOutput: #808080;
2140
+ --mdHeading: #f0c674;
2141
+ --mdLink: #81a2be;
2142
+ --mdLinkUrl: #666666;
2143
+ --mdCode: #8abeb7;
2144
+ --mdCodeBlock: #b5bd68;
2145
+ `;
2146
+ const bodyBg = "#1e1e28";
2147
+ const containerBg = "#282832";
2148
+ const infoBg = "#343541";
2149
+ const sessionDataBase64 = Buffer.from(JSON.stringify(sessionData)).toString("base64");
2150
+ const css = templateCss.replace("/* {{THEME_VARS}} */", themeVars.trim()).replace("/* {{BODY_BG_DECL}} */", `--body-bg: ${bodyBg};`).replace("/* {{CONTAINER_BG_DECL}} */", `--container-bg: ${containerBg};`).replace("/* {{INFO_BG_DECL}} */", `--info-bg: ${infoBg};`);
2151
+ return template.replace("{{CSS}}", css).replace("{{JS}}", templateJs).replace("{{SESSION_DATA}}", sessionDataBase64).replace("{{MARKED_JS}}", markedJs).replace("{{HIGHLIGHT_JS}}", hljsJs);
2152
+ }
2153
+ async function buildExportSessionReply(params) {
2154
+ const args = parseExportCommandOutputPath(params.command.commandBodyNormalized, ["export-session", "export"]);
2155
+ const sessionTarget = resolveExportCommandSessionTarget(params);
2156
+ if (isReplyPayload(sessionTarget)) return sessionTarget;
2157
+ const { entry, sessionFile } = sessionTarget;
2158
+ if (!fs.existsSync(sessionFile)) return { text: `āŒ Session file not found: ${sessionFile}` };
2159
+ const sessionManager = SessionManager.open(sessionFile);
2160
+ const entries = sessionManager.getEntries();
2161
+ const header = sessionManager.getHeader();
2162
+ const leafId = sessionManager.getLeafId();
2163
+ const { systemPrompt, tools } = await resolveCommandsSystemPromptBundle({
2164
+ ...params,
2165
+ sessionEntry: entry
2166
+ });
2167
+ const html = generateHtml({
2168
+ header,
2169
+ entries,
2170
+ leafId,
2171
+ systemPrompt,
2172
+ tools: tools.map((t) => ({
2173
+ name: t.name,
2174
+ description: t.description,
2175
+ parameters: t.parameters
2176
+ }))
2177
+ });
2178
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
2179
+ const defaultFileName = `genesis-session-${entry.sessionId.slice(0, 8)}-${timestamp}.html`;
2180
+ const outputPath = args.outputPath ? path.resolve(args.outputPath.startsWith("~") ? args.outputPath.replace("~", process.env.HOME ?? "") : args.outputPath) : path.join(params.workspaceDir, defaultFileName);
2181
+ const outputDir = path.dirname(outputPath);
2182
+ if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
2183
+ fs.writeFileSync(outputPath, html, "utf-8");
2184
+ const relativePath = path.relative(params.workspaceDir, outputPath);
2185
+ return { text: [
2186
+ "āœ… Session exported!",
2187
+ "",
2188
+ `šŸ“„ File: ${relativePath.startsWith("..") ? outputPath : relativePath}`,
2189
+ `šŸ“Š Entries: ${entries.length}`,
2190
+ `🧠 System prompt: ${systemPrompt.length.toLocaleString()} chars`,
2191
+ `šŸ”§ Tools: ${tools.length}`
2192
+ ].join("\n") };
2193
+ }
2194
+ //#endregion
2195
+ //#region src/trajectory/export.ts
2196
+ const MAX_TRAJECTORY_RUNTIME_EVENTS = 2e5;
2197
+ const MAX_TRAJECTORY_TOTAL_EVENTS = 25e4;
2198
+ const MAX_TRAJECTORY_SESSION_FILE_BYTES = 50 * 1024 * 1024;
2199
+ function parseSessionEntries(content) {
2200
+ return content.split(/\r?\n/u).map((line) => line.trim()).filter(Boolean).flatMap((line) => {
2201
+ try {
2202
+ return [JSON.parse(line)];
2203
+ } catch {
2204
+ return [];
2205
+ }
2206
+ });
2207
+ }
2208
+ function migrateLegacySessionEntries(entries) {
2209
+ const version = entries.find((entry) => entry.type === "session")?.version ?? 1;
2210
+ if (version < 2) {
2211
+ let previousId = null;
2212
+ let index = 0;
2213
+ for (const entry of entries) {
2214
+ if (entry.type === "session") {
2215
+ entry.version = 2;
2216
+ continue;
2217
+ }
2218
+ const mutable = entry;
2219
+ if (typeof mutable.id !== "string") mutable.id = `legacy-${index++}`;
2220
+ mutable.parentId = previousId;
2221
+ const entryId = mutable.id;
2222
+ previousId = typeof entryId === "string" ? entryId : null;
2223
+ if (entry.type === "compaction" && typeof mutable.firstKeptEntryIndex === "number") {
2224
+ const target = entries[mutable.firstKeptEntryIndex];
2225
+ if (target && target.type !== "session") mutable.firstKeptEntryId = target.id;
2226
+ delete mutable.firstKeptEntryIndex;
2227
+ }
2228
+ }
2229
+ }
2230
+ if (version < 3) for (const entry of entries) {
2231
+ if (entry.type === "session") {
2232
+ entry.version = 3;
2233
+ continue;
2234
+ }
2235
+ if (entry.type === "message") {
2236
+ const message = entry.message;
2237
+ if (message?.role === "hookMessage") message.role = "custom";
2238
+ }
2239
+ }
2240
+ }
2241
+ function readSessionBranch(filePath) {
2242
+ const fileEntries = parseSessionEntries(fs.readFileSync(filePath, "utf8"));
2243
+ migrateLegacySessionEntries(fileEntries);
2244
+ const header = fileEntries.find((entry) => entry.type === "session") ?? null;
2245
+ const entries = fileEntries.filter((entry) => entry.type !== "session" && typeof entry.id === "string" && (typeof entry.timestamp === "string" || typeof entry.timestamp === "number"));
2246
+ const byId = new Map(entries.map((entry) => [entry.id, entry]));
2247
+ const leafId = entries.at(-1)?.id ?? null;
2248
+ const branchEntries = [];
2249
+ let current = leafId ? byId.get(leafId) : void 0;
2250
+ while (current) {
2251
+ branchEntries.unshift(current);
2252
+ current = current.parentId ? byId.get(current.parentId) : void 0;
2253
+ }
2254
+ return {
2255
+ header,
2256
+ leafId,
2257
+ branchEntries
2258
+ };
2259
+ }
2260
+ function parseJsonlFile(filePath, params) {
2261
+ if (!fs.existsSync(filePath)) return [];
2262
+ const stat = fs.statSync(filePath);
2263
+ if (stat.size > params.maxBytes) throw new Error(`Trajectory runtime file is too large to export (${stat.size} bytes; limit ${params.maxBytes})`);
2264
+ const rows = fs.readFileSync(filePath, "utf8").split(/\r?\n/u).map((line) => line.trim()).filter(Boolean);
2265
+ const parsed = [];
2266
+ for (const row of rows) {
2267
+ if (parsed.length >= params.maxEvents) throw new Error(`Trajectory runtime file has too many events to export (limit ${params.maxEvents})`);
2268
+ try {
2269
+ const value = JSON.parse(row);
2270
+ if (!params.validate || params.validate(value)) parsed.push(value);
2271
+ } catch {}
2272
+ }
2273
+ return parsed;
2274
+ }
2275
+ function isFiniteNumber(value) {
2276
+ return typeof value === "number" && Number.isFinite(value);
2277
+ }
2278
+ function isRecord(value) {
2279
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
2280
+ }
2281
+ function isRuntimeTrajectoryEventForSession(value, sessionId) {
2282
+ if (!isRecord(value)) return false;
2283
+ return value.traceSchema === "genesis-trajectory" && value.schemaVersion === 1 && value.source === "runtime" && typeof value.type === "string" && typeof value.ts === "string" && !Number.isNaN(Date.parse(value.ts)) && isFiniteNumber(value.seq) && value.sessionId === sessionId && (!("data" in value) || value.data === void 0 || isRecord(value.data));
2284
+ }
2285
+ function isRegularNonSymlinkFile(filePath) {
2286
+ try {
2287
+ const linkStat = fs.lstatSync(filePath);
2288
+ if (linkStat.isSymbolicLink() || !linkStat.isFile()) return false;
2289
+ const stat = fs.statSync(filePath);
2290
+ return stat.isFile() && stat.dev === linkStat.dev && stat.ino === linkStat.ino;
2291
+ } catch {
2292
+ return false;
2293
+ }
2294
+ }
2295
+ function readRuntimePointerFile(sessionFile, sessionId) {
2296
+ const pointerPath = resolveTrajectoryPointerFilePath(sessionFile);
2297
+ if (!isRegularNonSymlinkFile(pointerPath)) return;
2298
+ try {
2299
+ const parsed = JSON.parse(fs.readFileSync(pointerPath, "utf8"));
2300
+ if (!isRecord(parsed)) return;
2301
+ if (parsed.sessionId !== sessionId || typeof parsed.runtimeFile !== "string") return;
2302
+ const runtimeFile = path.resolve(parsed.runtimeFile);
2303
+ const safeRuntimeFileName = `${safeTrajectorySessionFileName(sessionId)}.jsonl`;
2304
+ if (runtimeFile !== path.resolve(resolveTrajectoryFilePath({
2305
+ env: {},
2306
+ sessionFile,
2307
+ sessionId
2308
+ })) && path.basename(runtimeFile) !== safeRuntimeFileName) return;
2309
+ return runtimeFile;
2310
+ } catch {
2311
+ return;
2312
+ }
2313
+ }
2314
+ function resolveTrajectoryRuntimeFile(params) {
2315
+ if (params.runtimeFile) return params.runtimeFile;
2316
+ return [
2317
+ readRuntimePointerFile(params.sessionFile, params.sessionId),
2318
+ resolveTrajectoryFilePath({
2319
+ env: {},
2320
+ sessionFile: params.sessionFile,
2321
+ sessionId: params.sessionId
2322
+ }),
2323
+ resolveTrajectoryFilePath({
2324
+ sessionFile: params.sessionFile,
2325
+ sessionId: params.sessionId
2326
+ })
2327
+ ].filter((candidate) => Boolean(candidate)).find((candidate) => isRegularNonSymlinkFile(candidate));
2328
+ }
2329
+ function normalizeTimestamp(value) {
2330
+ if (typeof value === "number" && Number.isFinite(value)) {
2331
+ const parsed = new Date(value);
2332
+ if (!Number.isNaN(parsed.getTime())) return parsed.toISOString();
2333
+ }
2334
+ if (typeof value === "string") {
2335
+ const parsed = new Date(value);
2336
+ if (!Number.isNaN(parsed.getTime())) return parsed.toISOString();
2337
+ }
2338
+ return (/* @__PURE__ */ new Date(0)).toISOString();
2339
+ }
2340
+ function resolveMessageEventType(message) {
2341
+ if (message.role === "user") return "user.message";
2342
+ if (message.role === "assistant") return "assistant.message";
2343
+ if (message.role === "toolResult") return "tool.result";
2344
+ return `message.${message.role}`;
2345
+ }
2346
+ function extractAssistantToolCalls(message) {
2347
+ if (message.role !== "assistant" || !Array.isArray(message.content)) return [];
2348
+ return message.content.flatMap((block, index) => {
2349
+ if (!block || typeof block !== "object") return [];
2350
+ const typedBlock = block;
2351
+ const blockType = typeof typedBlock.type === "string" ? typedBlock.type.trim().toLowerCase() : "";
2352
+ if (blockType !== "toolcall" && blockType !== "tooluse" && blockType !== "functioncall") return [];
2353
+ return [{
2354
+ id: typeof typedBlock.id === "string" ? typedBlock.id : void 0,
2355
+ name: typeof typedBlock.name === "string" ? typedBlock.name : void 0,
2356
+ arguments: typedBlock.arguments ?? typedBlock.input ?? typedBlock.parameters,
2357
+ index
2358
+ }];
2359
+ });
2360
+ }
2361
+ function buildTranscriptEvents(params) {
2362
+ const events = [];
2363
+ let seq = 0;
2364
+ for (const entry of params.entries) {
2365
+ const push = (type, data) => {
2366
+ events.push({
2367
+ traceSchema: "genesis-trajectory",
2368
+ schemaVersion: 1,
2369
+ traceId: params.traceId,
2370
+ source: "transcript",
2371
+ type,
2372
+ ts: normalizeTimestamp(entry.timestamp),
2373
+ seq: 0,
2374
+ sourceSeq: seq += 1,
2375
+ sessionId: params.sessionId,
2376
+ sessionKey: params.sessionKey,
2377
+ workspaceDir: params.workspaceDir,
2378
+ entryId: entry.id,
2379
+ parentEntryId: entry.parentId,
2380
+ data
2381
+ });
2382
+ };
2383
+ switch (entry.type) {
2384
+ case "message":
2385
+ push(resolveMessageEventType(entry.message), { message: sanitizeDiagnosticPayload(entry.message) });
2386
+ for (const toolCall of extractAssistantToolCalls(entry.message)) push("tool.call", {
2387
+ toolCallId: toolCall.id,
2388
+ name: toolCall.name,
2389
+ arguments: sanitizeDiagnosticPayload(toolCall.arguments),
2390
+ assistantEntryId: entry.id,
2391
+ blockIndex: toolCall.index
2392
+ });
2393
+ break;
2394
+ case "compaction":
2395
+ push("session.compaction", {
2396
+ summary: entry.summary,
2397
+ firstKeptEntryId: entry.firstKeptEntryId,
2398
+ tokensBefore: entry.tokensBefore,
2399
+ details: sanitizeDiagnosticPayload(entry.details),
2400
+ fromHook: entry.fromHook ?? false
2401
+ });
2402
+ break;
2403
+ case "branch_summary":
2404
+ push("session.branch_summary", {
2405
+ fromId: entry.fromId,
2406
+ summary: entry.summary,
2407
+ details: sanitizeDiagnosticPayload(entry.details),
2408
+ fromHook: entry.fromHook ?? false
2409
+ });
2410
+ break;
2411
+ case "custom":
2412
+ push("session.custom", {
2413
+ customType: entry.customType,
2414
+ data: sanitizeDiagnosticPayload(entry.data)
2415
+ });
2416
+ break;
2417
+ case "custom_message":
2418
+ push("session.custom_message", {
2419
+ customType: entry.customType,
2420
+ content: sanitizeDiagnosticPayload(entry.content),
2421
+ details: sanitizeDiagnosticPayload(entry.details),
2422
+ display: entry.display
2423
+ });
2424
+ break;
2425
+ case "thinking_level_change":
2426
+ push("session.thinking_level_change", { thinkingLevel: entry.thinkingLevel });
2427
+ break;
2428
+ case "model_change":
2429
+ push("session.model_change", {
2430
+ provider: entry.provider,
2431
+ modelId: entry.modelId
2432
+ });
2433
+ break;
2434
+ case "label":
2435
+ push("session.label", {
2436
+ targetId: entry.targetId,
2437
+ label: entry.label
2438
+ });
2439
+ break;
2440
+ case "session_info":
2441
+ push("session.info", { name: entry.name });
2442
+ break;
2443
+ }
2444
+ }
2445
+ return events;
2446
+ }
2447
+ function sortTrajectoryEvents(events) {
2448
+ const sourceOrder = {
2449
+ runtime: 0,
2450
+ transcript: 1,
2451
+ export: 2
2452
+ };
2453
+ const sorted = events.toSorted((left, right) => {
2454
+ const byTs = left.ts.localeCompare(right.ts);
2455
+ if (byTs !== 0) return byTs;
2456
+ const bySource = sourceOrder[left.source] - sourceOrder[right.source];
2457
+ if (bySource !== 0) return bySource;
2458
+ return (left.sourceSeq ?? left.seq) - (right.sourceSeq ?? right.seq);
2459
+ });
2460
+ for (const [index, event] of sorted.entries()) event.seq = index + 1;
2461
+ return sorted;
2462
+ }
2463
+ function trajectoryJsonlFile(pathName, events) {
2464
+ return jsonlSupportBundleFile(pathName, events.map((event) => safeJsonStringify(event)).filter((line) => Boolean(line)));
2465
+ }
2466
+ function buildTrajectoryExportRedaction(params) {
2467
+ const env = process.env;
2468
+ return {
2469
+ env,
2470
+ stateDir: resolveStateDir(env),
2471
+ workspaceDir: path.resolve(params.workspaceDir)
2472
+ };
2473
+ }
2474
+ function redactWorkspacePathString(value, redaction) {
2475
+ const workspaceDir = redaction.workspaceDir;
2476
+ if (!workspaceDir) return value;
2477
+ const normalizedWorkspaceDir = workspaceDir.replaceAll("\\", "/");
2478
+ let next = value;
2479
+ for (const candidate of new Set([workspaceDir, normalizedWorkspaceDir])) {
2480
+ if (!candidate) continue;
2481
+ const escaped = candidate.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
2482
+ next = next.replace(new RegExp(`${escaped}(?=$|[\\\\/])`, "gu"), "$WORKSPACE_DIR");
2483
+ }
2484
+ return next;
2485
+ }
2486
+ function maybeRedactPathString(value, redaction) {
2487
+ const workspaceRedacted = redactWorkspacePathString(value, redaction);
2488
+ if (workspaceRedacted !== value || path.isAbsolute(workspaceRedacted) || workspaceRedacted.includes(redaction.stateDir) || (redaction.env.HOME ? workspaceRedacted.includes(redaction.env.HOME) : false) || (redaction.env.USERPROFILE ? workspaceRedacted.includes(redaction.env.USERPROFILE) : false)) return redactSupportString(workspaceRedacted, redaction);
2489
+ return workspaceRedacted;
2490
+ }
2491
+ function redactLocalPathValues(value, redaction) {
2492
+ if (typeof value === "string") return maybeRedactPathString(value, redaction);
2493
+ if (Array.isArray(value)) return value.map((entry) => redactLocalPathValues(entry, redaction));
2494
+ if (!value || typeof value !== "object") return value;
2495
+ const record = value;
2496
+ const next = {};
2497
+ for (const [key, entry] of Object.entries(record)) next[key] = redactLocalPathValues(entry, redaction);
2498
+ return next;
2499
+ }
2500
+ function redactEventForExport(event, redaction) {
2501
+ return {
2502
+ ...event,
2503
+ workspaceDir: event.workspaceDir ? maybeRedactPathString(event.workspaceDir, redaction) : void 0,
2504
+ data: event.data ? redactLocalPathValues(event.data, redaction) : void 0
2505
+ };
2506
+ }
2507
+ function resolveRuntimeContext(runtimeEvents) {
2508
+ const runtimeData = runtimeEvents.slice().toReversed().find((event) => event.type === "context.compiled")?.data;
2509
+ const toolsValue = Array.isArray(runtimeData?.tools) ? runtimeData.tools : void 0;
2510
+ return {
2511
+ systemPrompt: typeof runtimeData?.systemPrompt === "string" ? runtimeData.systemPrompt : void 0,
2512
+ tools: toolsValue
2513
+ };
2514
+ }
2515
+ function resolveLatestRuntimeEventData(runtimeEvents, type) {
2516
+ return runtimeEvents.slice().toReversed().find((candidate) => candidate.type === type)?.data;
2517
+ }
2518
+ function normalizePathForMatch(value) {
2519
+ return value.replaceAll("\\", "/").trim().toLowerCase();
2520
+ }
2521
+ function collectPotentialPathStrings(value) {
2522
+ const found = /* @__PURE__ */ new Set();
2523
+ const visit = (input) => {
2524
+ if (!input || typeof input !== "object") return;
2525
+ if (Array.isArray(input)) {
2526
+ for (const entry of input) visit(entry);
2527
+ return;
2528
+ }
2529
+ for (const [key, entry] of Object.entries(input)) if (typeof entry === "string" && (key.toLowerCase().includes("path") || entry.endsWith("SKILL.md") || entry.endsWith("skill.md"))) found.add(entry);
2530
+ else visit(entry);
2531
+ };
2532
+ visit(value);
2533
+ return [...found];
2534
+ }
2535
+ function markInvokedSkills(params) {
2536
+ if (!params.skills || typeof params.skills !== "object") return params.skills;
2537
+ const skillsRecord = params.skills;
2538
+ if (!Array.isArray(skillsRecord.entries) || skillsRecord.entries.length === 0) return params.skills;
2539
+ const invokedPaths = new Set(params.events.flatMap((event) => {
2540
+ if (event.type !== "tool.call") return [];
2541
+ return collectPotentialPathStrings(event.data?.arguments);
2542
+ }));
2543
+ const normalizedInvokedPaths = new Set([...invokedPaths].map((value) => normalizePathForMatch(value)));
2544
+ const entries = skillsRecord.entries.map((entry) => {
2545
+ const rawPath = typeof entry.filePath === "string" ? entry.filePath : void 0;
2546
+ const normalizedPath = rawPath ? normalizePathForMatch(rawPath) : void 0;
2547
+ const skillDirName = rawPath?.replaceAll("\\", "/").split("/").slice(-2, -1)[0]?.toLowerCase() ?? void 0;
2548
+ const invoked = normalizedPath ? [...normalizedInvokedPaths].some((candidate) => candidate === normalizedPath || candidate.endsWith(normalizedPath) || (skillDirName ? candidate.endsWith(`/${skillDirName}/skill.md`) : false)) : false;
2549
+ return invoked ? {
2550
+ ...entry,
2551
+ invoked,
2552
+ invocationDetectedBy: "tool-call-file-path"
2553
+ } : {
2554
+ ...entry,
2555
+ invoked: false
2556
+ };
2557
+ });
2558
+ return {
2559
+ ...skillsRecord,
2560
+ entries
2561
+ };
2562
+ }
2563
+ function buildMetadataCapture(params) {
2564
+ const runtimeMetadata = resolveLatestRuntimeEventData(params.runtimeEvents, "trace.metadata");
2565
+ if (!runtimeMetadata) return;
2566
+ const modelFallback = (() => {
2567
+ const latest = params.runtimeEvents.slice().toReversed().find((event) => event.provider || event.modelId || event.modelApi);
2568
+ if (!latest?.provider && !latest?.modelId && !latest?.modelApi) return;
2569
+ return {
2570
+ provider: latest.provider,
2571
+ name: latest.modelId,
2572
+ api: latest.modelApi
2573
+ };
2574
+ })();
2575
+ return {
2576
+ traceSchema: "genesis-trajectory",
2577
+ schemaVersion: 1,
2578
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2579
+ traceId: params.manifest.traceId,
2580
+ sessionId: params.manifest.sessionId,
2581
+ sessionKey: params.manifest.sessionKey,
2582
+ harness: runtimeMetadata.harness,
2583
+ model: runtimeMetadata.model ?? modelFallback,
2584
+ config: runtimeMetadata.config,
2585
+ plugins: runtimeMetadata.plugins,
2586
+ skills: markInvokedSkills({
2587
+ skills: runtimeMetadata.skills,
2588
+ events: params.events
2589
+ }),
2590
+ prompting: runtimeMetadata.prompting,
2591
+ redaction: runtimeMetadata.redaction,
2592
+ metadata: runtimeMetadata.metadata
2593
+ };
2594
+ }
2595
+ function buildArtifactsCapture(params) {
2596
+ const runtimeArtifacts = resolveLatestRuntimeEventData(params.runtimeEvents, "trace.artifacts");
2597
+ const runtimeCompletion = resolveLatestRuntimeEventData(params.runtimeEvents, "model.completed");
2598
+ const runtimeEnd = resolveLatestRuntimeEventData(params.runtimeEvents, "session.ended");
2599
+ if (!runtimeArtifacts && !runtimeCompletion && !runtimeEnd) return;
2600
+ return {
2601
+ traceSchema: "genesis-trajectory",
2602
+ schemaVersion: 1,
2603
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2604
+ traceId: params.manifest.traceId,
2605
+ sessionId: params.manifest.sessionId,
2606
+ sessionKey: params.manifest.sessionKey,
2607
+ finalStatus: runtimeArtifacts?.finalStatus ?? runtimeEnd?.status,
2608
+ aborted: runtimeArtifacts?.aborted ?? runtimeEnd?.aborted,
2609
+ externalAbort: runtimeArtifacts?.externalAbort ?? runtimeEnd?.externalAbort,
2610
+ timedOut: runtimeArtifacts?.timedOut ?? runtimeEnd?.timedOut,
2611
+ idleTimedOut: runtimeArtifacts?.idleTimedOut ?? runtimeEnd?.idleTimedOut,
2612
+ timedOutDuringCompaction: runtimeArtifacts?.timedOutDuringCompaction ?? runtimeEnd?.timedOutDuringCompaction,
2613
+ promptError: runtimeArtifacts?.promptError ?? runtimeEnd?.promptError ?? runtimeCompletion?.promptError,
2614
+ promptErrorSource: runtimeArtifacts?.promptErrorSource ?? runtimeCompletion?.promptErrorSource,
2615
+ usage: runtimeArtifacts?.usage ?? runtimeCompletion?.usage,
2616
+ promptCache: runtimeArtifacts?.promptCache ?? runtimeCompletion?.promptCache,
2617
+ compactionCount: runtimeArtifacts?.compactionCount ?? runtimeCompletion?.compactionCount,
2618
+ assistantTexts: runtimeArtifacts?.assistantTexts ?? runtimeCompletion?.assistantTexts,
2619
+ finalPromptText: runtimeArtifacts?.finalPromptText ?? runtimeCompletion?.finalPromptText,
2620
+ itemLifecycle: runtimeArtifacts?.itemLifecycle,
2621
+ toolMetas: runtimeArtifacts?.toolMetas,
2622
+ didSendViaMessagingTool: runtimeArtifacts?.didSendViaMessagingTool,
2623
+ successfulCronAdds: runtimeArtifacts?.successfulCronAdds,
2624
+ messagingToolSentTexts: runtimeArtifacts?.messagingToolSentTexts,
2625
+ messagingToolSentMediaUrls: runtimeArtifacts?.messagingToolSentMediaUrls,
2626
+ messagingToolSentTargets: runtimeArtifacts?.messagingToolSentTargets,
2627
+ lastToolError: runtimeArtifacts?.lastToolError
2628
+ };
2629
+ }
2630
+ function buildPromptsCapture(params) {
2631
+ const runtimeMetadata = resolveLatestRuntimeEventData(params.runtimeEvents, "trace.metadata");
2632
+ const latestCompiled = resolveLatestRuntimeEventData(params.runtimeEvents, "context.compiled");
2633
+ const submittedPrompts = params.runtimeEvents.filter((event) => event.type === "prompt.submitted").map((event) => event.data?.prompt).filter((prompt) => typeof prompt === "string");
2634
+ const systemPrompt = (typeof latestCompiled?.systemPrompt === "string" ? latestCompiled.systemPrompt : void 0) ?? params.runtimeContext.systemPrompt;
2635
+ const skillsPrompt = runtimeMetadata?.prompting && typeof runtimeMetadata.prompting === "object" && typeof runtimeMetadata.prompting.skillsPrompt === "string" ? runtimeMetadata.prompting.skillsPrompt : void 0;
2636
+ const userPromptPrefixText = runtimeMetadata?.prompting && typeof runtimeMetadata.prompting === "object" && typeof runtimeMetadata.prompting.userPromptPrefixText === "string" ? runtimeMetadata.prompting.userPromptPrefixText : void 0;
2637
+ const promptReport = runtimeMetadata?.prompting && typeof runtimeMetadata.prompting === "object" && typeof runtimeMetadata.prompting.systemPromptReport === "object" ? runtimeMetadata.prompting.systemPromptReport : void 0;
2638
+ if (!systemPrompt && submittedPrompts.length === 0 && !skillsPrompt && !userPromptPrefixText) return;
2639
+ return {
2640
+ traceSchema: "genesis-trajectory",
2641
+ schemaVersion: 1,
2642
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2643
+ traceId: params.manifest.traceId,
2644
+ sessionId: params.manifest.sessionId,
2645
+ sessionKey: params.manifest.sessionKey,
2646
+ system: systemPrompt,
2647
+ submittedPrompts,
2648
+ latestSubmittedPrompt: submittedPrompts.at(-1),
2649
+ skillsPrompt,
2650
+ userPromptPrefixText,
2651
+ systemPromptReport: promptReport
2652
+ };
2653
+ }
2654
+ function resolveDefaultTrajectoryExportDir(params) {
2655
+ const timestamp = (params.now ?? /* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
2656
+ const sessionFileName = safeTrajectorySessionFileName(params.sessionId);
2657
+ return path.join(params.workspaceDir, ".genesis", "trajectory-exports", `genesis-trajectory-${sessionFileName.slice(0, 8)}-${timestamp}`);
2658
+ }
2659
+ function exportTrajectoryBundle(params) {
2660
+ const redaction = buildTrajectoryExportRedaction({ workspaceDir: params.workspaceDir });
2661
+ const sessionStat = fs.statSync(params.sessionFile);
2662
+ if (sessionStat.size > MAX_TRAJECTORY_SESSION_FILE_BYTES) throw new Error(`Trajectory session file is too large to export (${sessionStat.size} bytes; limit ${MAX_TRAJECTORY_SESSION_FILE_BYTES})`);
2663
+ const { header, leafId, branchEntries } = readSessionBranch(params.sessionFile);
2664
+ const runtimeFile = resolveTrajectoryRuntimeFile({
2665
+ runtimeFile: params.runtimeFile,
2666
+ sessionFile: params.sessionFile,
2667
+ sessionId: params.sessionId
2668
+ });
2669
+ const runtimeEvents = runtimeFile ? parseJsonlFile(runtimeFile, {
2670
+ maxBytes: TRAJECTORY_RUNTIME_FILE_MAX_BYTES,
2671
+ maxEvents: MAX_TRAJECTORY_RUNTIME_EVENTS,
2672
+ validate: (value) => isRuntimeTrajectoryEventForSession(value, params.sessionId)
2673
+ }) : [];
2674
+ const transcriptEvents = buildTranscriptEvents({
2675
+ entries: branchEntries,
2676
+ sessionId: params.sessionId,
2677
+ sessionKey: params.sessionKey,
2678
+ workspaceDir: params.workspaceDir,
2679
+ traceId: params.sessionId
2680
+ });
2681
+ const maxTotalEvents = params.maxTotalEvents ?? MAX_TRAJECTORY_TOTAL_EVENTS;
2682
+ const totalEventCount = runtimeEvents.length + transcriptEvents.length;
2683
+ if (totalEventCount > maxTotalEvents) throw new Error(`Trajectory export has too many events (${totalEventCount}; limit ${maxTotalEvents})`);
2684
+ const rawEvents = sortTrajectoryEvents([...runtimeEvents, ...transcriptEvents]);
2685
+ const events = rawEvents.map((event) => redactEventForExport(event, redaction));
2686
+ const manifest = {
2687
+ traceSchema: "genesis-trajectory",
2688
+ schemaVersion: 1,
2689
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2690
+ traceId: params.sessionId,
2691
+ sessionId: params.sessionId,
2692
+ sessionKey: params.sessionKey,
2693
+ workspaceDir: maybeRedactPathString(params.workspaceDir, redaction),
2694
+ leafId,
2695
+ eventCount: events.length,
2696
+ runtimeEventCount: runtimeEvents.length,
2697
+ transcriptEventCount: transcriptEvents.length,
2698
+ sourceFiles: {
2699
+ session: maybeRedactPathString(params.sessionFile, redaction),
2700
+ runtime: runtimeFile && isRegularNonSymlinkFile(runtimeFile) ? maybeRedactPathString(runtimeFile, redaction) : void 0
2701
+ }
2702
+ };
2703
+ const bundleRuntimeContext = resolveRuntimeContext(runtimeEvents);
2704
+ const files = [];
2705
+ const supplementalFiles = [];
2706
+ const metadataCapture = buildMetadataCapture({
2707
+ manifest,
2708
+ runtimeEvents,
2709
+ events: rawEvents
2710
+ });
2711
+ const artifactsCapture = buildArtifactsCapture({
2712
+ manifest,
2713
+ runtimeEvents
2714
+ });
2715
+ const promptsCapture = buildPromptsCapture({
2716
+ manifest,
2717
+ runtimeEvents,
2718
+ runtimeContext: bundleRuntimeContext
2719
+ });
2720
+ if (metadataCapture) {
2721
+ files.push(jsonSupportBundleFile("metadata.json", redactLocalPathValues(metadataCapture, redaction)));
2722
+ supplementalFiles.push("metadata.json");
2723
+ }
2724
+ if (artifactsCapture) {
2725
+ files.push(jsonSupportBundleFile("artifacts.json", redactLocalPathValues(artifactsCapture, redaction)));
2726
+ supplementalFiles.push("artifacts.json");
2727
+ }
2728
+ if (promptsCapture) {
2729
+ files.push(jsonSupportBundleFile("prompts.json", redactLocalPathValues(promptsCapture, redaction)));
2730
+ supplementalFiles.push("prompts.json");
2731
+ }
2732
+ if (supplementalFiles.length > 0) manifest.supplementalFiles = supplementalFiles;
2733
+ files.push(trajectoryJsonlFile("events.jsonl", events));
2734
+ files.push(jsonSupportBundleFile("session-branch.json", redactLocalPathValues(sanitizeDiagnosticPayload({
2735
+ header,
2736
+ leafId,
2737
+ entries: branchEntries
2738
+ }), redaction)));
2739
+ if (bundleRuntimeContext.systemPrompt) files.push(textSupportBundleFile("system-prompt.txt", redactLocalPathValues(bundleRuntimeContext.systemPrompt, redaction)));
2740
+ if (bundleRuntimeContext.tools) files.push(jsonSupportBundleFile("tools.json", redactLocalPathValues(bundleRuntimeContext.tools, redaction)));
2741
+ manifest.contents = [...supportBundleContents(files)];
2742
+ writeSupportBundleDirectory({
2743
+ outputDir: params.outputDir,
2744
+ files: [jsonSupportBundleFile("manifest.json", manifest), ...files]
2745
+ });
2746
+ return {
2747
+ manifest,
2748
+ outputDir: params.outputDir,
2749
+ events,
2750
+ header,
2751
+ runtimeFile: runtimeFile && isRegularNonSymlinkFile(runtimeFile) ? runtimeFile : void 0,
2752
+ supplementalFiles
2753
+ };
2754
+ }
2755
+ //#endregion
2756
+ //#region src/auto-reply/reply/commands-export-trajectory.ts
2757
+ function isPathInsideOrEqual(baseDir, candidate) {
2758
+ const relative = path.relative(baseDir, candidate);
2759
+ return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
2760
+ }
2761
+ function validateExistingExportDirectory(params) {
2762
+ const linkStat = fs.lstatSync(params.dir);
2763
+ if (linkStat.isSymbolicLink() || !linkStat.isDirectory()) throw new Error(`${params.label} must be a real directory inside the workspace`);
2764
+ const realDir = fs.realpathSync(params.dir);
2765
+ if (!isPathInsideOrEqual(params.realWorkspace, realDir)) throw new Error("Trajectory exports directory must stay inside the workspace");
2766
+ return realDir;
2767
+ }
2768
+ function mkdirIfMissingThenValidate(params) {
2769
+ if (!fs.existsSync(params.dir)) try {
2770
+ fs.mkdirSync(params.dir, { mode: 448 });
2771
+ } catch (error) {
2772
+ if (error.code !== "EEXIST") throw error;
2773
+ }
2774
+ return validateExistingExportDirectory(params);
2775
+ }
2776
+ function resolveTrajectoryExportBaseDir(workspaceDir) {
2777
+ const workspacePath = path.resolve(workspaceDir);
2778
+ const realWorkspace = fs.realpathSync(workspacePath);
2779
+ const stateDir = path.join(workspacePath, ".genesis");
2780
+ mkdirIfMissingThenValidate({
2781
+ dir: stateDir,
2782
+ label: "Genesis state directory",
2783
+ realWorkspace
2784
+ });
2785
+ const baseDir = path.join(stateDir, "trajectory-exports");
2786
+ const realBase = mkdirIfMissingThenValidate({
2787
+ dir: baseDir,
2788
+ label: "Trajectory exports directory",
2789
+ realWorkspace
2790
+ });
2791
+ return {
2792
+ baseDir: path.resolve(baseDir),
2793
+ realBase
2794
+ };
2795
+ }
2796
+ function resolveTrajectoryCommandOutputDir(params) {
2797
+ const { baseDir, realBase } = resolveTrajectoryExportBaseDir(params.workspaceDir);
2798
+ const raw = params.outputPath?.trim();
2799
+ if (!raw) {
2800
+ const defaultDir = resolveDefaultTrajectoryExportDir({
2801
+ workspaceDir: params.workspaceDir,
2802
+ sessionId: params.sessionId
2803
+ });
2804
+ return path.join(baseDir, path.basename(defaultDir));
2805
+ }
2806
+ if (path.isAbsolute(raw) || raw.startsWith("~")) throw new Error("Output path must be relative to the workspace trajectory exports directory");
2807
+ const resolvedBase = path.resolve(baseDir);
2808
+ const outputDir = path.resolve(resolvedBase, raw);
2809
+ const relative = path.relative(resolvedBase, outputDir);
2810
+ if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) throw new Error("Output path must stay inside the workspace trajectory exports directory");
2811
+ let existingParent = outputDir;
2812
+ while (!fs.existsSync(existingParent)) {
2813
+ const next = path.dirname(existingParent);
2814
+ if (next === existingParent) break;
2815
+ existingParent = next;
2816
+ }
2817
+ if (!isPathInsideOrEqual(realBase, fs.realpathSync(existingParent))) throw new Error("Output path must stay inside the real trajectory exports directory");
2818
+ return outputDir;
2819
+ }
2820
+ async function buildExportTrajectoryReply(params) {
2821
+ const args = parseExportCommandOutputPath(params.command.commandBodyNormalized, ["export-trajectory", "trajectory"]);
2822
+ const sessionTarget = resolveExportCommandSessionTarget(params);
2823
+ if (isReplyPayload(sessionTarget)) return sessionTarget;
2824
+ const { entry, sessionFile } = sessionTarget;
2825
+ if (!fs.existsSync(sessionFile)) return { text: "āŒ Session file not found." };
2826
+ let outputDir;
2827
+ try {
2828
+ outputDir = resolveTrajectoryCommandOutputDir({
2829
+ outputPath: args.outputPath,
2830
+ workspaceDir: params.workspaceDir,
2831
+ sessionId: entry.sessionId
2832
+ });
2833
+ } catch (err) {
2834
+ return { text: `āŒ Failed to resolve output path: ${formatErrorMessage(err)}` };
2835
+ }
2836
+ let bundle;
2837
+ try {
2838
+ bundle = exportTrajectoryBundle({
2839
+ outputDir,
2840
+ sessionFile,
2841
+ sessionId: entry.sessionId,
2842
+ sessionKey: params.sessionKey,
2843
+ workspaceDir: params.workspaceDir
2844
+ });
2845
+ } catch (err) {
2846
+ return { text: `āŒ Failed to export trajectory: ${formatErrorMessage(err)}` };
2847
+ }
2848
+ const relativePath = path.relative(params.workspaceDir, bundle.outputDir);
2849
+ const displayPath = relativePath && !relativePath.startsWith("..") && !path.isAbsolute(relativePath) ? relativePath : path.basename(bundle.outputDir);
2850
+ const files = [
2851
+ "manifest.json",
2852
+ "events.jsonl",
2853
+ "session-branch.json"
2854
+ ];
2855
+ if (bundle.events.some((event) => event.type === "context.compiled")) files.push("system-prompt.txt", "tools.json");
2856
+ files.push(...bundle.supplementalFiles);
2857
+ return { text: [
2858
+ "āœ… Trajectory exported!",
2859
+ "",
2860
+ `šŸ“¦ Bundle: ${displayPath}`,
2861
+ `🧵 Session: ${entry.sessionId}`,
2862
+ `šŸ“Š Events: ${bundle.manifest.eventCount}`,
2863
+ `🧪 Runtime events: ${bundle.manifest.runtimeEventCount}`,
2864
+ `šŸ“ Transcript events: ${bundle.manifest.transcriptEventCount}`,
2865
+ `šŸ“ Files: ${files.join(", ")}`
2866
+ ].join("\n") };
2867
+ }
2868
+ //#endregion
2869
+ //#region src/auto-reply/reply/commands-whoami.ts
2870
+ const handleWhoamiCommand = async (params, allowTextCommands) => {
2871
+ if (!allowTextCommands) return null;
2872
+ if (params.command.commandBodyNormalized !== "/whoami") return null;
2873
+ if (!params.command.isAuthorizedSender) {
2874
+ logVerbose(`Ignoring /whoami from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
2875
+ return { shouldContinue: false };
2876
+ }
2877
+ const senderId = params.ctx.SenderId ?? "";
2878
+ const senderUsername = params.ctx.SenderUsername ?? "";
2879
+ const lines = ["🧭 Identity", `Channel: ${params.command.channel}`];
2880
+ if (senderId) lines.push(`User id: ${senderId}`);
2881
+ if (senderUsername) {
2882
+ const handle = senderUsername.startsWith("@") ? senderUsername : `@${senderUsername}`;
2883
+ lines.push(`Username: ${handle}`);
2884
+ }
2885
+ if (params.ctx.ChatType === "group" && params.ctx.From) lines.push(`Chat: ${params.ctx.From}`);
2886
+ if (params.ctx.MessageThreadId != null) lines.push(`Thread: ${params.ctx.MessageThreadId}`);
2887
+ const allowFromSender = params.command.senderId ?? "";
2888
+ if (allowFromSender) lines.push(`AllowFrom: ${allowFromSender}`);
2889
+ return {
2890
+ shouldContinue: false,
2891
+ reply: { text: lines.join("\n") }
2892
+ };
2893
+ };
2894
+ //#endregion
2895
+ //#region src/auto-reply/reply/commands-info.ts
2896
+ const handleHelpCommand = async (params, allowTextCommands) => {
2897
+ if (!allowTextCommands) return null;
2898
+ if (params.command.commandBodyNormalized !== "/help") return null;
2899
+ if (!params.command.isAuthorizedSender) {
2900
+ logVerbose(`Ignoring /help from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
2901
+ return { shouldContinue: false };
2902
+ }
2903
+ return {
2904
+ shouldContinue: false,
2905
+ reply: { text: buildHelpMessage(params.cfg) }
2906
+ };
2907
+ };
2908
+ const handleCommandsListCommand = async (params, allowTextCommands) => {
2909
+ if (!allowTextCommands) return null;
2910
+ if (params.command.commandBodyNormalized !== "/commands") return null;
2911
+ if (!params.command.isAuthorizedSender) {
2912
+ logVerbose(`Ignoring /commands from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
2913
+ return { shouldContinue: false };
2914
+ }
2915
+ const agentId = params.sessionKey ? resolveSessionAgentId({
2916
+ sessionKey: params.sessionKey,
2917
+ config: params.cfg
2918
+ }) : params.agentId;
2919
+ const skillCommands = params.skillCommands ?? listSkillCommandsForAgents({
2920
+ cfg: params.cfg,
2921
+ agentIds: agentId ? [agentId] : void 0
2922
+ });
2923
+ const surface = params.ctx.Surface;
2924
+ const commandPlugin = surface ? getChannelPlugin(surface) : null;
2925
+ const paginated = buildCommandsMessagePaginated(params.cfg, skillCommands, {
2926
+ page: 1,
2927
+ surface
2928
+ });
2929
+ const channelData = commandPlugin?.commands?.buildCommandsListChannelData?.({
2930
+ currentPage: paginated.currentPage,
2931
+ totalPages: paginated.totalPages,
2932
+ agentId
2933
+ });
2934
+ if (channelData) return {
2935
+ shouldContinue: false,
2936
+ reply: {
2937
+ text: paginated.text,
2938
+ channelData
2939
+ }
2940
+ };
2941
+ return {
2942
+ shouldContinue: false,
2943
+ reply: { text: buildCommandsMessage(params.cfg, skillCommands, { surface }) }
2944
+ };
2945
+ };
2946
+ const handleToolsCommand = async (params, allowTextCommands) => {
2947
+ if (!allowTextCommands) return null;
2948
+ const normalized = params.command.commandBodyNormalized;
2949
+ let verbose = false;
2950
+ if (normalized === "/tools" || normalized === "/tools compact") verbose = false;
2951
+ else if (normalized === "/tools verbose") verbose = true;
2952
+ else if (normalized.startsWith("/tools ")) return {
2953
+ shouldContinue: false,
2954
+ reply: { text: "Usage: /tools [compact|verbose]" }
2955
+ };
2956
+ else return null;
2957
+ if (!params.command.isAuthorizedSender) {
2958
+ logVerbose(`Ignoring /tools from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
2959
+ return { shouldContinue: false };
2960
+ }
2961
+ try {
2962
+ const effectiveAccountId = resolveChannelAccountId({
2963
+ cfg: params.cfg,
2964
+ ctx: params.ctx,
2965
+ command: params.command
2966
+ });
2967
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
2968
+ const sessionBound = Boolean(params.sessionKey);
2969
+ const agentId = sessionBound ? resolveSessionAgentId({
2970
+ sessionKey: params.sessionKey,
2971
+ config: params.cfg
2972
+ }) : params.agentId;
2973
+ const threadingContext = buildThreadingToolContext({
2974
+ sessionCtx: params.ctx,
2975
+ config: params.cfg,
2976
+ hasRepliedRef: void 0
2977
+ });
2978
+ return {
2979
+ shouldContinue: false,
2980
+ reply: { text: buildToolsMessage(resolveEffectiveToolInventory({
2981
+ cfg: params.cfg,
2982
+ agentId,
2983
+ sessionKey: params.sessionKey,
2984
+ workspaceDir: params.workspaceDir,
2985
+ agentDir: sessionBound ? void 0 : params.agentDir,
2986
+ modelProvider: params.provider,
2987
+ modelId: params.model,
2988
+ messageProvider: params.command.channel,
2989
+ senderIsOwner: params.command.senderIsOwner,
2990
+ senderId: params.command.senderId,
2991
+ senderName: params.ctx.SenderName,
2992
+ senderUsername: params.ctx.SenderUsername,
2993
+ senderE164: params.ctx.SenderE164,
2994
+ accountId: effectiveAccountId,
2995
+ currentChannelId: threadingContext.currentChannelId,
2996
+ currentThreadTs: typeof params.ctx.MessageThreadId === "string" || typeof params.ctx.MessageThreadId === "number" ? String(params.ctx.MessageThreadId) : void 0,
2997
+ currentMessageId: threadingContext.currentMessageId,
2998
+ groupId: targetSessionEntry?.groupId ?? extractExplicitGroupId(params.ctx.From),
2999
+ groupChannel: targetSessionEntry?.groupChannel ?? params.ctx.GroupChannel ?? params.ctx.GroupSubject,
3000
+ groupSpace: targetSessionEntry?.space ?? params.ctx.GroupSpace,
3001
+ replyToMode: resolveReplyToMode(params.cfg, params.ctx.OriginatingChannel ?? params.ctx.Provider, effectiveAccountId, params.ctx.ChatType)
3002
+ }), { verbose }) }
3003
+ };
3004
+ } catch (err) {
3005
+ return {
3006
+ shouldContinue: false,
3007
+ reply: { text: String(err).includes("missing scope:") ? "You do not have permission to view available tools." : "Couldn't load available tools right now. Try again in a moment." }
3008
+ };
3009
+ }
3010
+ };
3011
+ const handleStatusCommand = async (params, allowTextCommands) => {
3012
+ if (!allowTextCommands) return null;
3013
+ if (!(params.directives.hasStatusDirective || params.command.commandBodyNormalized === "/status")) return null;
3014
+ if (!params.command.isAuthorizedSender) {
3015
+ logVerbose(`Ignoring /status from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
3016
+ return { shouldContinue: false };
3017
+ }
3018
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
3019
+ return {
3020
+ shouldContinue: false,
3021
+ reply: await buildStatusReply({
3022
+ cfg: params.cfg,
3023
+ command: params.command,
3024
+ sessionEntry: targetSessionEntry,
3025
+ sessionKey: params.sessionKey,
3026
+ parentSessionKey: targetSessionEntry?.parentSessionKey ?? params.ctx.ParentSessionKey,
3027
+ sessionScope: params.sessionScope,
3028
+ storePath: params.storePath,
3029
+ provider: params.provider,
3030
+ model: params.model,
3031
+ contextTokens: params.contextTokens,
3032
+ resolvedThinkLevel: params.resolvedThinkLevel,
3033
+ resolvedFastMode: params.resolvedFastMode,
3034
+ resolvedVerboseLevel: params.resolvedVerboseLevel,
3035
+ resolvedReasoningLevel: params.resolvedReasoningLevel,
3036
+ resolvedElevatedLevel: params.resolvedElevatedLevel,
3037
+ resolveDefaultThinkingLevel: params.resolveDefaultThinkingLevel,
3038
+ isGroup: params.isGroup,
3039
+ defaultGroupActivation: params.defaultGroupActivation,
3040
+ mediaDecisions: params.ctx.MediaUnderstandingDecisions
3041
+ })
3042
+ };
3043
+ };
3044
+ const handleExportSessionCommand = async (params, allowTextCommands) => {
3045
+ if (!allowTextCommands) return null;
3046
+ const normalized = params.command.commandBodyNormalized;
3047
+ if (normalized !== "/export-session" && !normalized.startsWith("/export-session ") && normalized !== "/export" && !normalized.startsWith("/export ")) return null;
3048
+ if (!params.command.isAuthorizedSender) {
3049
+ logVerbose(`Ignoring /export-session from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
3050
+ return { shouldContinue: false };
3051
+ }
3052
+ return {
3053
+ shouldContinue: false,
3054
+ reply: await buildExportSessionReply(params)
3055
+ };
3056
+ };
3057
+ const handleExportTrajectoryCommand = async (params, allowTextCommands) => {
3058
+ if (!allowTextCommands) return null;
3059
+ const normalized = params.command.commandBodyNormalized;
3060
+ if (normalized !== "/export-trajectory" && !normalized.startsWith("/export-trajectory ") && normalized !== "/trajectory" && !normalized.startsWith("/trajectory ")) return null;
3061
+ const unauthorized = rejectUnauthorizedCommand(params, "/export-trajectory");
3062
+ if (unauthorized) return unauthorized;
3063
+ const nonOwner = rejectNonOwnerCommand(params, "/export-trajectory");
3064
+ if (nonOwner) return nonOwner;
3065
+ return {
3066
+ shouldContinue: false,
3067
+ reply: await buildExportTrajectoryReply(params)
3068
+ };
3069
+ };
3070
+ //#endregion
3071
+ //#region src/auto-reply/reply/mcp-commands.ts
3072
+ function parseMcpCommand(raw) {
3073
+ return parseStandardSetUnsetSlashCommand({
3074
+ raw,
3075
+ slash: "/mcp",
3076
+ invalidMessage: "Invalid /mcp syntax.",
3077
+ usageMessage: "Usage: /mcp show|set|unset",
3078
+ onKnownAction: (action, args) => {
3079
+ if (action === "show" || action === "get") return {
3080
+ action: "show",
3081
+ name: args || void 0
3082
+ };
3083
+ },
3084
+ onSet: (name, value) => ({
3085
+ action: "set",
3086
+ name,
3087
+ value
3088
+ }),
3089
+ onUnset: (name) => ({
3090
+ action: "unset",
3091
+ name
3092
+ })
3093
+ });
3094
+ }
3095
+ //#endregion
3096
+ //#region src/auto-reply/reply/commands-mcp.ts
3097
+ function renderJsonBlock$1(label, value) {
3098
+ return `${label}\n\`\`\`json\n${JSON.stringify(value, null, 2)}\n\`\`\``;
3099
+ }
3100
+ const handleMcpCommand = async (params, allowTextCommands) => {
3101
+ if (!allowTextCommands) return null;
3102
+ const mcpCommand = parseMcpCommand(params.command.commandBodyNormalized);
3103
+ if (!mcpCommand) return null;
3104
+ const unauthorized = rejectUnauthorizedCommand(params, "/mcp");
3105
+ if (unauthorized) return unauthorized;
3106
+ const nonOwner = mcpCommand.action === "show" && isInternalMessageChannel(params.command.channel) ? null : rejectNonOwnerCommand(params, "/mcp");
3107
+ if (nonOwner) return nonOwner;
3108
+ if (!isMcpCommandEnabled(params.cfg)) return {
3109
+ shouldContinue: false,
3110
+ reply: buildDisabledCommandReply({
3111
+ label: "/mcp",
3112
+ configKey: "mcp"
3113
+ })
3114
+ };
3115
+ if (mcpCommand.action === "error") return {
3116
+ shouldContinue: false,
3117
+ reply: { text: `āš ļø ${mcpCommand.message}` }
3118
+ };
3119
+ if (mcpCommand.action === "show") {
3120
+ const loaded = await listConfiguredMcpServers();
3121
+ if (!loaded.ok) return {
3122
+ shouldContinue: false,
3123
+ reply: { text: `āš ļø ${loaded.error}` }
3124
+ };
3125
+ if (mcpCommand.name) {
3126
+ const server = loaded.mcpServers[mcpCommand.name];
3127
+ if (!server) return {
3128
+ shouldContinue: false,
3129
+ reply: { text: `šŸ”Œ No MCP server named "${mcpCommand.name}" in ${loaded.path}.` }
3130
+ };
3131
+ return {
3132
+ shouldContinue: false,
3133
+ reply: { text: renderJsonBlock$1(`šŸ”Œ MCP server "${mcpCommand.name}" (${loaded.path})`, server) }
3134
+ };
3135
+ }
3136
+ if (Object.keys(loaded.mcpServers).length === 0) return {
3137
+ shouldContinue: false,
3138
+ reply: { text: `šŸ”Œ No MCP servers configured in ${loaded.path}.` }
3139
+ };
3140
+ return {
3141
+ shouldContinue: false,
3142
+ reply: { text: renderJsonBlock$1(`šŸ”Œ MCP servers (${loaded.path})`, loaded.mcpServers) }
3143
+ };
3144
+ }
3145
+ const missingAdminScope = requireGatewayClientScopeForInternalChannel(params, {
3146
+ label: "/mcp write",
3147
+ allowedScopes: ["operator.admin"],
3148
+ missingText: "āŒ /mcp set|unset requires operator.admin for gateway clients."
3149
+ });
3150
+ if (missingAdminScope) return missingAdminScope;
3151
+ if (mcpCommand.action === "set") {
3152
+ const result = await setConfiguredMcpServer({
3153
+ name: mcpCommand.name,
3154
+ server: mcpCommand.value
3155
+ });
3156
+ if (!result.ok) return {
3157
+ shouldContinue: false,
3158
+ reply: { text: `āš ļø ${result.error}` }
3159
+ };
3160
+ return {
3161
+ shouldContinue: false,
3162
+ reply: { text: `šŸ”Œ MCP server "${mcpCommand.name}" saved to ${result.path}.` }
3163
+ };
3164
+ }
3165
+ const result = await unsetConfiguredMcpServer({ name: mcpCommand.name });
3166
+ if (!result.ok) return {
3167
+ shouldContinue: false,
3168
+ reply: { text: `āš ļø ${result.error}` }
3169
+ };
3170
+ if (!result.removed) return {
3171
+ shouldContinue: false,
3172
+ reply: { text: `šŸ”Œ No MCP server named "${mcpCommand.name}" in ${result.path}.` }
3173
+ };
3174
+ return {
3175
+ shouldContinue: false,
3176
+ reply: { text: `šŸ”Œ MCP server "${mcpCommand.name}" removed from ${result.path}.` }
3177
+ };
3178
+ };
3179
+ //#endregion
3180
+ //#region src/auto-reply/reply/commands-plugin.ts
3181
+ /**
3182
+ * Plugin Command Handler
3183
+ *
3184
+ * Handles commands registered by plugins, bypassing the LLM agent.
3185
+ * This handler is called before built-in command handlers.
3186
+ */
3187
+ /**
3188
+ * Handle plugin-registered commands.
3189
+ * Returns a result if a plugin command was matched and executed,
3190
+ * or null to continue to the next handler.
3191
+ */
3192
+ const handlePluginCommand = async (params, allowTextCommands) => {
3193
+ const { command, cfg } = params;
3194
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
3195
+ if (!allowTextCommands) return null;
3196
+ const match = matchPluginCommand(command.commandBodyNormalized);
3197
+ if (!match) return null;
3198
+ return {
3199
+ shouldContinue: false,
3200
+ reply: await executePluginCommand({
3201
+ command: match.command,
3202
+ args: match.args,
3203
+ senderId: command.senderId,
3204
+ channel: command.channel,
3205
+ channelId: command.channelId,
3206
+ isAuthorizedSender: command.isAuthorizedSender,
3207
+ gatewayClientScopes: params.ctx.GatewayClientScopes,
3208
+ sessionKey: params.sessionKey,
3209
+ sessionId: targetSessionEntry?.sessionId,
3210
+ sessionFile: targetSessionEntry?.sessionFile,
3211
+ commandBody: command.commandBodyNormalized,
3212
+ config: cfg,
3213
+ from: command.from,
3214
+ to: command.to,
3215
+ accountId: params.ctx.AccountId ?? void 0,
3216
+ messageThreadId: typeof params.ctx.MessageThreadId === "string" || typeof params.ctx.MessageThreadId === "number" ? params.ctx.MessageThreadId : void 0,
3217
+ threadParentId: normalizeOptionalString(params.ctx.ThreadParentId)
3218
+ })
3219
+ };
3220
+ };
3221
+ //#endregion
3222
+ //#region src/auto-reply/reply/plugins-commands.ts
3223
+ function parsePluginsCommand(raw) {
3224
+ const match = raw.match(/^\/plugins?(?:\s+(.*))?$/i);
3225
+ if (!match) return null;
3226
+ const tail = normalizeOptionalString(match?.[1]) ?? "";
3227
+ if (!tail) return { action: "list" };
3228
+ const [rawAction, ...rest] = tail.split(/\s+/);
3229
+ const action = normalizeOptionalLowercaseString(rawAction);
3230
+ const name = rest.join(" ").trim();
3231
+ if (action === "list") return name ? {
3232
+ action: "error",
3233
+ message: "Usage: /plugins list|inspect|show|get|enable|disable [plugin]"
3234
+ } : { action: "list" };
3235
+ if (action === "inspect" || action === "show" || action === "get") return {
3236
+ action: "inspect",
3237
+ name: name || void 0
3238
+ };
3239
+ if (action === "install" || action === "add") {
3240
+ if (!name) return {
3241
+ action: "error",
3242
+ message: "Usage: /plugins install <path|archive|npm-spec|clawhub:pkg>"
3243
+ };
3244
+ return {
3245
+ action: "install",
3246
+ spec: name
3247
+ };
3248
+ }
3249
+ if (action === "enable" || action === "disable") {
3250
+ if (!name) return {
3251
+ action: "error",
3252
+ message: `Usage: /plugins ${action} <plugin-id-or-name>`
3253
+ };
3254
+ return {
3255
+ action,
3256
+ name
3257
+ };
3258
+ }
3259
+ return {
3260
+ action: "error",
3261
+ message: "Usage: /plugins list|inspect|show|get|install|enable|disable [plugin]"
3262
+ };
3263
+ }
3264
+ //#endregion
3265
+ //#region src/auto-reply/reply/commands-plugins.ts
3266
+ function renderJsonBlock(label, value) {
3267
+ return `${label}\n\`\`\`json\n${JSON.stringify(value, null, 2)}\n\`\`\``;
3268
+ }
3269
+ function buildPluginInspectJson(params) {
3270
+ const inspect = buildPluginInspectReport({
3271
+ id: params.id,
3272
+ config: params.config,
3273
+ report: params.report
3274
+ });
3275
+ if (!inspect) return null;
3276
+ return {
3277
+ inspect,
3278
+ compatibilityWarnings: inspect.compatibility.map((warning) => ({
3279
+ code: warning.code,
3280
+ severity: warning.severity,
3281
+ message: formatPluginCompatibilityNotice(warning)
3282
+ })),
3283
+ install: params.config.plugins?.installs?.[inspect.plugin.id] ?? null
3284
+ };
3285
+ }
3286
+ function buildAllPluginInspectJson(params) {
3287
+ return buildAllPluginInspectReports({
3288
+ config: params.config,
3289
+ report: params.report
3290
+ }).map((inspect) => ({
3291
+ inspect,
3292
+ compatibilityWarnings: inspect.compatibility.map((warning) => ({
3293
+ code: warning.code,
3294
+ severity: warning.severity,
3295
+ message: formatPluginCompatibilityNotice(warning)
3296
+ })),
3297
+ install: params.config.plugins?.installs?.[inspect.plugin.id] ?? null
3298
+ }));
3299
+ }
3300
+ function formatPluginLabel(plugin) {
3301
+ if (!plugin.name || plugin.name === plugin.id) return plugin.id;
3302
+ return `${plugin.name} (${plugin.id})`;
3303
+ }
3304
+ function formatPluginsList(report) {
3305
+ if (report.plugins.length === 0) return `šŸ”Œ No plugins found for workspace ${report.workspaceDir ?? "(unknown workspace)"}.`;
3306
+ return [`šŸ”Œ Plugins (${report.plugins.filter((plugin) => plugin.status === "loaded").length}/${report.plugins.length} loaded)`, ...report.plugins.map((plugin) => {
3307
+ const format = plugin.bundleFormat ? `${plugin.format ?? "genesis"}/${plugin.bundleFormat}` : plugin.format ?? "genesis";
3308
+ return `- ${formatPluginLabel(plugin)} [${plugin.status}] ${format}`;
3309
+ })].join("\n");
3310
+ }
3311
+ function findPlugin(report, rawName) {
3312
+ const target = normalizeOptionalLowercaseString(rawName);
3313
+ if (!target) return;
3314
+ return report.plugins.find((plugin) => normalizeOptionalLowercaseString(plugin.id) === target || normalizeOptionalLowercaseString(plugin.name) === target);
3315
+ }
3316
+ function looksLikeLocalPluginInstallSpec(raw) {
3317
+ return raw.startsWith(".") || raw.startsWith("~") || raw.startsWith("/") || raw.endsWith(".ts") || raw.endsWith(".js") || raw.endsWith(".mjs") || raw.endsWith(".cjs") || raw.endsWith(".tgz") || raw.endsWith(".tar.gz") || raw.endsWith(".tar") || raw.endsWith(".zip");
3318
+ }
3319
+ async function installPluginFromPluginsCommand(params) {
3320
+ const fileSpec = resolveFileNpmSpecToLocalPath(params.raw);
3321
+ if (fileSpec && !fileSpec.ok) return {
3322
+ ok: false,
3323
+ error: fileSpec.error
3324
+ };
3325
+ const resolved = resolveUserPath(fileSpec && fileSpec.ok ? fileSpec.path : params.raw);
3326
+ if (fs.existsSync(resolved)) {
3327
+ const result = await installPluginFromPath({
3328
+ path: resolved,
3329
+ logger: createPluginInstallLogger()
3330
+ });
3331
+ if (!result.ok) return {
3332
+ ok: false,
3333
+ error: result.error
3334
+ };
3335
+ clearPluginManifestRegistryCache();
3336
+ const source = resolveArchiveKind(resolved) ? "archive" : "path";
3337
+ await persistPluginInstall({
3338
+ config: params.config,
3339
+ pluginId: result.pluginId,
3340
+ install: {
3341
+ source,
3342
+ sourcePath: resolved,
3343
+ installPath: result.targetDir,
3344
+ version: result.version
3345
+ }
3346
+ });
3347
+ return {
3348
+ ok: true,
3349
+ pluginId: result.pluginId
3350
+ };
3351
+ }
3352
+ if (looksLikeLocalPluginInstallSpec(params.raw)) return {
3353
+ ok: false,
3354
+ error: `Path not found: ${resolved}`
3355
+ };
3356
+ if (parseClawHubPluginSpec(params.raw)) {
3357
+ const result = await installPluginFromClawHub({
3358
+ spec: params.raw,
3359
+ logger: createPluginInstallLogger()
3360
+ });
3361
+ if (!result.ok) return {
3362
+ ok: false,
3363
+ error: result.error
3364
+ };
3365
+ clearPluginManifestRegistryCache();
3366
+ await persistPluginInstall({
3367
+ config: params.config,
3368
+ pluginId: result.pluginId,
3369
+ install: {
3370
+ source: "clawhub",
3371
+ spec: params.raw,
3372
+ installPath: result.targetDir,
3373
+ version: result.version,
3374
+ integrity: result.clawhub.integrity,
3375
+ resolvedAt: result.clawhub.resolvedAt,
3376
+ clawhubUrl: result.clawhub.clawhubUrl,
3377
+ clawhubPackage: result.clawhub.clawhubPackage,
3378
+ clawhubFamily: result.clawhub.clawhubFamily,
3379
+ clawhubChannel: result.clawhub.clawhubChannel
3380
+ }
3381
+ });
3382
+ return {
3383
+ ok: true,
3384
+ pluginId: result.pluginId
3385
+ };
3386
+ }
3387
+ const preferredClawHubSpec = buildPreferredClawHubSpec(params.raw);
3388
+ if (preferredClawHubSpec) {
3389
+ const clawhubResult = await installPluginFromClawHub({
3390
+ spec: preferredClawHubSpec,
3391
+ logger: createPluginInstallLogger()
3392
+ });
3393
+ if (clawhubResult.ok) {
3394
+ clearPluginManifestRegistryCache();
3395
+ await persistPluginInstall({
3396
+ config: params.config,
3397
+ pluginId: clawhubResult.pluginId,
3398
+ install: {
3399
+ source: "clawhub",
3400
+ spec: preferredClawHubSpec,
3401
+ installPath: clawhubResult.targetDir,
3402
+ version: clawhubResult.version,
3403
+ integrity: clawhubResult.clawhub.integrity,
3404
+ resolvedAt: clawhubResult.clawhub.resolvedAt,
3405
+ clawhubUrl: clawhubResult.clawhub.clawhubUrl,
3406
+ clawhubPackage: clawhubResult.clawhub.clawhubPackage,
3407
+ clawhubFamily: clawhubResult.clawhub.clawhubFamily,
3408
+ clawhubChannel: clawhubResult.clawhub.clawhubChannel
3409
+ }
3410
+ });
3411
+ return {
3412
+ ok: true,
3413
+ pluginId: clawhubResult.pluginId
3414
+ };
3415
+ }
3416
+ if (decidePreferredClawHubFallback(clawhubResult) !== "fallback_to_npm") return {
3417
+ ok: false,
3418
+ error: clawhubResult.error
3419
+ };
3420
+ }
3421
+ const result = await installPluginFromNpmSpec({
3422
+ spec: params.raw,
3423
+ logger: createPluginInstallLogger()
3424
+ });
3425
+ if (!result.ok) return {
3426
+ ok: false,
3427
+ error: result.error
3428
+ };
3429
+ clearPluginManifestRegistryCache();
3430
+ const installRecord = buildNpmInstallRecordFields({
3431
+ spec: params.raw,
3432
+ installPath: result.targetDir,
3433
+ version: result.version,
3434
+ resolution: result.npmResolution
3435
+ });
3436
+ await persistPluginInstall({
3437
+ config: params.config,
3438
+ pluginId: result.pluginId,
3439
+ install: installRecord
3440
+ });
3441
+ return {
3442
+ ok: true,
3443
+ pluginId: result.pluginId
3444
+ };
3445
+ }
3446
+ async function loadPluginCommandState(workspaceDir, options) {
3447
+ const snapshot = await readConfigFileSnapshot();
3448
+ if (!snapshot.valid) return {
3449
+ ok: false,
3450
+ path: snapshot.path,
3451
+ error: "Config file is invalid; fix it before using /plugins."
3452
+ };
3453
+ const config = structuredClone(snapshot.resolved);
3454
+ return {
3455
+ ok: true,
3456
+ path: snapshot.path,
3457
+ config,
3458
+ report: options?.loadModules === true ? buildPluginDiagnosticsReport({
3459
+ config,
3460
+ workspaceDir
3461
+ }) : buildPluginSnapshotReport({
3462
+ config,
3463
+ workspaceDir
3464
+ })
3465
+ };
3466
+ }
3467
+ async function loadPluginCommandConfig() {
3468
+ const snapshot = await readConfigFileSnapshot();
3469
+ if (!snapshot.valid) return {
3470
+ ok: false,
3471
+ path: snapshot.path,
3472
+ error: "Config file is invalid; fix it before using /plugins."
3473
+ };
3474
+ return {
3475
+ ok: true,
3476
+ path: snapshot.path,
3477
+ config: structuredClone(snapshot.resolved)
3478
+ };
3479
+ }
3480
+ const handlePluginsCommand = async (params, allowTextCommands) => {
3481
+ if (!allowTextCommands) return null;
3482
+ const pluginsCommand = parsePluginsCommand(params.command.commandBodyNormalized);
3483
+ if (!pluginsCommand) return null;
3484
+ const unauthorized = rejectUnauthorizedCommand(params, "/plugins");
3485
+ if (unauthorized) return unauthorized;
3486
+ const nonOwner = (pluginsCommand.action === "list" || pluginsCommand.action === "inspect") && isInternalMessageChannel(params.command.channel) ? null : rejectNonOwnerCommand(params, "/plugins");
3487
+ if (nonOwner) return nonOwner;
3488
+ const disabled = requireCommandFlagEnabled(params.cfg, {
3489
+ label: "/plugins",
3490
+ configKey: "plugins"
3491
+ });
3492
+ if (disabled) return disabled;
3493
+ if (pluginsCommand.action === "error") return {
3494
+ shouldContinue: false,
3495
+ reply: { text: `āš ļø ${pluginsCommand.message}` }
3496
+ };
3497
+ const missingAdminScope = requireGatewayClientScopeForInternalChannel(params, {
3498
+ label: "/plugins write",
3499
+ allowedScopes: ["operator.admin"],
3500
+ missingText: "āŒ /plugins install|enable|disable requires operator.admin for gateway clients."
3501
+ });
3502
+ if (missingAdminScope) return missingAdminScope;
3503
+ if (pluginsCommand.action === "install") {
3504
+ const loadedConfig = await loadPluginCommandConfig();
3505
+ if (!loadedConfig.ok) return {
3506
+ shouldContinue: false,
3507
+ reply: { text: `āš ļø ${loadedConfig.error}` }
3508
+ };
3509
+ const installed = await installPluginFromPluginsCommand({
3510
+ raw: pluginsCommand.spec,
3511
+ config: loadedConfig.config
3512
+ });
3513
+ if (!installed.ok) return {
3514
+ shouldContinue: false,
3515
+ reply: { text: `āš ļø ${installed.error}` }
3516
+ };
3517
+ return {
3518
+ shouldContinue: false,
3519
+ reply: { text: `šŸ”Œ Installed plugin "${installed.pluginId}". Restart the gateway to load plugins.` }
3520
+ };
3521
+ }
3522
+ const loaded = await loadPluginCommandState(params.workspaceDir, { loadModules: pluginsCommand.action !== "list" });
3523
+ if (!loaded.ok) return {
3524
+ shouldContinue: false,
3525
+ reply: { text: `āš ļø ${loaded.error}` }
3526
+ };
3527
+ if (pluginsCommand.action === "list") return {
3528
+ shouldContinue: false,
3529
+ reply: { text: formatPluginsList(loaded.report) }
3530
+ };
3531
+ if (pluginsCommand.action === "inspect") {
3532
+ if (!pluginsCommand.name) return {
3533
+ shouldContinue: false,
3534
+ reply: { text: formatPluginsList(loaded.report) }
3535
+ };
3536
+ if (normalizeOptionalLowercaseString(pluginsCommand.name) === "all") return {
3537
+ shouldContinue: false,
3538
+ reply: { text: renderJsonBlock("šŸ”Œ Plugins", buildAllPluginInspectJson(loaded)) }
3539
+ };
3540
+ const payload = buildPluginInspectJson({
3541
+ id: pluginsCommand.name,
3542
+ config: loaded.config,
3543
+ report: loaded.report
3544
+ });
3545
+ if (!payload) return {
3546
+ shouldContinue: false,
3547
+ reply: { text: `šŸ”Œ No plugin named "${pluginsCommand.name}" found.` }
3548
+ };
3549
+ return {
3550
+ shouldContinue: false,
3551
+ reply: { text: renderJsonBlock(`šŸ”Œ Plugin "${payload.inspect.plugin.id}"`, {
3552
+ ...payload.inspect,
3553
+ compatibilityWarnings: payload.compatibilityWarnings,
3554
+ install: payload.install
3555
+ }) }
3556
+ };
3557
+ }
3558
+ const plugin = findPlugin(loaded.report, pluginsCommand.name);
3559
+ if (!plugin) return {
3560
+ shouldContinue: false,
3561
+ reply: { text: `šŸ”Œ No plugin named "${pluginsCommand.name}" found.` }
3562
+ };
3563
+ const validated = validateConfigObjectWithPlugins(setPluginEnabledInConfig(structuredClone(loaded.config), plugin.id, pluginsCommand.action === "enable"));
3564
+ if (!validated.ok) {
3565
+ const issue = validated.issues[0];
3566
+ return {
3567
+ shouldContinue: false,
3568
+ reply: { text: `āš ļø Config invalid after /plugins ${pluginsCommand.action} (${issue.path}: ${issue.message}).` }
3569
+ };
3570
+ }
3571
+ await writeConfigFile(validated.config);
3572
+ return {
3573
+ shouldContinue: false,
3574
+ reply: { text: `šŸ”Œ Plugin "${plugin.id}" ${pluginsCommand.action}d in ${loaded.path}. Restart the gateway to apply.` }
3575
+ };
3576
+ };
3577
+ //#endregion
3578
+ //#region src/auto-reply/send-policy.ts
3579
+ function normalizeSendPolicyOverride(raw) {
3580
+ const value = normalizeOptionalLowercaseString(raw);
3581
+ if (!value) return;
3582
+ if (value === "allow" || value === "on") return "allow";
3583
+ if (value === "deny" || value === "off") return "deny";
3584
+ }
3585
+ function parseSendPolicyCommand(raw) {
3586
+ if (!raw) return { hasCommand: false };
3587
+ const trimmed = raw.trim();
3588
+ if (!trimmed) return { hasCommand: false };
3589
+ const match = normalizeCommandBody(stripInboundMetadata(trimmed)).match(/^\/send(?:\s+([a-zA-Z]+))?\s*$/i);
3590
+ if (!match) return { hasCommand: false };
3591
+ const token = normalizeOptionalLowercaseString(match[1]);
3592
+ if (!token) return { hasCommand: true };
3593
+ if (token === "inherit" || token === "default" || token === "reset") return {
3594
+ hasCommand: true,
3595
+ mode: "inherit"
3596
+ };
3597
+ return {
3598
+ hasCommand: true,
3599
+ mode: normalizeSendPolicyOverride(token)
3600
+ };
3601
+ }
3602
+ //#endregion
3603
+ //#region src/auto-reply/reply/commands-session-store.ts
3604
+ async function persistSessionEntry(params) {
3605
+ if (!params.sessionEntry || !params.sessionStore || !params.sessionKey) return false;
3606
+ params.sessionEntry.updatedAt = Date.now();
3607
+ params.sessionStore[params.sessionKey] = params.sessionEntry;
3608
+ if (params.storePath) await updateSessionStore(params.storePath, (store) => {
3609
+ store[params.sessionKey] = params.sessionEntry;
3610
+ });
3611
+ return true;
3612
+ }
3613
+ async function persistAbortTargetEntry(params) {
3614
+ const { entry, key, sessionStore, storePath, abortCutoff } = params;
3615
+ if (!entry || !key || !sessionStore) return false;
3616
+ entry.abortedLastRun = true;
3617
+ applyAbortCutoffToSessionEntry(entry, abortCutoff);
3618
+ entry.updatedAt = Date.now();
3619
+ sessionStore[key] = entry;
3620
+ if (storePath) await updateSessionStore(storePath, (store) => {
3621
+ const nextEntry = store[key] ?? entry;
3622
+ if (!nextEntry) return;
3623
+ nextEntry.abortedLastRun = true;
3624
+ applyAbortCutoffToSessionEntry(nextEntry, abortCutoff);
3625
+ nextEntry.updatedAt = Date.now();
3626
+ store[key] = nextEntry;
3627
+ });
3628
+ return true;
3629
+ }
3630
+ //#endregion
3631
+ //#region src/auto-reply/reply/commands-session-abort.ts
3632
+ async function abortEmbeddedPiRunForSession(sessionId) {
3633
+ const { abortEmbeddedPiRun } = await import("./runs-CI-9dImN.js");
3634
+ abortEmbeddedPiRun(sessionId);
3635
+ }
3636
+ function resolveAbortTarget(params) {
3637
+ const targetSessionKey = normalizeOptionalString(params.ctx.CommandTargetSessionKey) || params.sessionKey;
3638
+ const { entry, key } = resolveSessionEntryForKey(params.sessionStore, targetSessionKey);
3639
+ if (entry && key) return {
3640
+ entry,
3641
+ key,
3642
+ sessionId: replyRunRegistry.resolveSessionId(key) ?? entry.sessionId
3643
+ };
3644
+ if (params.sessionEntry && params.sessionKey && (!targetSessionKey || targetSessionKey === params.sessionKey)) return {
3645
+ entry: params.sessionEntry,
3646
+ key: params.sessionKey,
3647
+ sessionId: replyRunRegistry.resolveSessionId(params.sessionKey) ?? params.sessionEntry.sessionId
3648
+ };
3649
+ return {
3650
+ entry: void 0,
3651
+ key: targetSessionKey,
3652
+ sessionId: targetSessionKey ? replyRunRegistry.resolveSessionId(targetSessionKey) : void 0
3653
+ };
3654
+ }
3655
+ function resolveAbortCutoffForTarget(params) {
3656
+ if (!shouldPersistAbortCutoff({
3657
+ commandSessionKey: params.commandSessionKey,
3658
+ targetSessionKey: params.targetSessionKey
3659
+ })) return;
3660
+ return resolveAbortCutoffFromContext(params.ctx);
3661
+ }
3662
+ async function applyAbortTarget(params) {
3663
+ const { abortTarget } = params;
3664
+ if (abortTarget.key) replyRunRegistry.abort(abortTarget.key);
3665
+ if (abortTarget.sessionId) await abortEmbeddedPiRunForSession(abortTarget.sessionId);
3666
+ if (!await persistAbortTargetEntry({
3667
+ entry: abortTarget.entry,
3668
+ key: abortTarget.key,
3669
+ sessionStore: params.sessionStore,
3670
+ storePath: params.storePath,
3671
+ abortCutoff: params.abortCutoff
3672
+ }) && params.abortKey) setAbortMemory(params.abortKey, true);
3673
+ }
3674
+ function buildAbortTargetApplyParams(params, abortTarget) {
3675
+ return {
3676
+ abortTarget,
3677
+ sessionStore: params.sessionStore,
3678
+ storePath: params.storePath,
3679
+ abortKey: params.command.abortKey,
3680
+ abortCutoff: resolveAbortCutoffForTarget({
3681
+ ctx: params.ctx,
3682
+ commandSessionKey: params.sessionKey,
3683
+ targetSessionKey: abortTarget.key
3684
+ })
3685
+ };
3686
+ }
3687
+ const handleStopCommand = async (params, allowTextCommands) => {
3688
+ if (!allowTextCommands) return null;
3689
+ if (params.command.commandBodyNormalized !== "/stop") return null;
3690
+ const unauthorizedStop = rejectUnauthorizedCommand(params, "/stop");
3691
+ if (unauthorizedStop) return unauthorizedStop;
3692
+ const abortTarget = resolveAbortTarget({
3693
+ ctx: params.ctx,
3694
+ sessionKey: params.sessionKey,
3695
+ sessionEntry: params.sessionEntry,
3696
+ sessionStore: params.sessionStore
3697
+ });
3698
+ const cleared = clearSessionQueues([abortTarget.key, abortTarget.sessionId]);
3699
+ if (cleared.followupCleared > 0 || cleared.laneCleared > 0) logVerbose(`stop: cleared followups=${cleared.followupCleared} lane=${cleared.laneCleared} keys=${cleared.keys.join(",")}`);
3700
+ await applyAbortTarget(buildAbortTargetApplyParams(params, abortTarget));
3701
+ await triggerInternalHook(createInternalHookEvent("command", "stop", abortTarget.key ?? params.sessionKey ?? "", {
3702
+ sessionEntry: abortTarget.entry,
3703
+ sessionId: abortTarget.sessionId,
3704
+ commandSource: params.command.surface,
3705
+ senderId: params.command.senderId
3706
+ }));
3707
+ const { stopped } = stopSubagentsForRequester({
3708
+ cfg: params.cfg,
3709
+ requesterSessionKey: abortTarget.key ?? params.sessionKey
3710
+ });
3711
+ return {
3712
+ shouldContinue: false,
3713
+ reply: { text: formatAbortReplyText(stopped) }
3714
+ };
3715
+ };
3716
+ const handleAbortTrigger = async (params, allowTextCommands) => {
3717
+ if (!allowTextCommands) return null;
3718
+ if (!isAbortTrigger(params.command.rawBodyNormalized)) return null;
3719
+ const unauthorizedAbortTrigger = rejectUnauthorizedCommand(params, "abort trigger");
3720
+ if (unauthorizedAbortTrigger) return unauthorizedAbortTrigger;
3721
+ await applyAbortTarget(buildAbortTargetApplyParams(params, resolveAbortTarget({
3722
+ ctx: params.ctx,
3723
+ sessionKey: params.sessionKey,
3724
+ sessionEntry: params.sessionEntry,
3725
+ sessionStore: params.sessionStore
3726
+ })));
3727
+ return {
3728
+ shouldContinue: false,
3729
+ reply: { text: "āš™ļø Agent was aborted." }
3730
+ };
3731
+ };
3732
+ //#endregion
3733
+ //#region src/auto-reply/reply/commands-session.ts
3734
+ const SESSION_DURATION_OFF_VALUES = new Set([
3735
+ "off",
3736
+ "disable",
3737
+ "disabled",
3738
+ "none",
3739
+ "0"
3740
+ ]);
3741
+ const SESSION_ACTION_IDLE = "idle";
3742
+ const SESSION_ACTION_MAX_AGE = "max-age";
3743
+ function buildRestartCommandSentinel(params) {
3744
+ const sessionKey = normalizeOptionalString(params.sessionKey);
3745
+ if (!sessionKey) return null;
3746
+ const { deliveryContext, threadId } = extractDeliveryInfo(sessionKey);
3747
+ return {
3748
+ kind: "restart",
3749
+ status: "ok",
3750
+ ts: Date.now(),
3751
+ sessionKey,
3752
+ deliveryContext,
3753
+ threadId,
3754
+ message: "/restart",
3755
+ continuation: buildRestartSuccessContinuation({ sessionKey }),
3756
+ doctorHint: formatDoctorNonInteractiveHint(),
3757
+ stats: {
3758
+ mode: "gateway.restart",
3759
+ reason: "/restart"
3760
+ }
3761
+ };
3762
+ }
3763
+ function resolveSessionCommandUsage() {
3764
+ return "Usage: /session idle <duration|off> | /session max-age <duration|off> (example: /session idle 24h)";
3765
+ }
3766
+ function parseSessionDurationMs(raw) {
3767
+ const normalized = normalizeOptionalLowercaseString(raw);
3768
+ if (!normalized) throw new Error("missing duration");
3769
+ if (SESSION_DURATION_OFF_VALUES.has(normalized)) return 0;
3770
+ if (/^\d+(?:\.\d+)?$/.test(normalized)) {
3771
+ const hours = Number(normalized);
3772
+ if (!Number.isFinite(hours) || hours < 0) throw new Error("invalid duration");
3773
+ return Math.round(hours * 60 * 60 * 1e3);
3774
+ }
3775
+ return parseDurationMs(normalized, { defaultUnit: "h" });
3776
+ }
3777
+ function formatSessionExpiry(expiresAt) {
3778
+ return new Date(expiresAt).toISOString();
3779
+ }
3780
+ function resolveSessionBindingDurationMs(binding, key, fallbackMs) {
3781
+ const raw = binding.metadata?.[key];
3782
+ if (typeof raw !== "number" || !Number.isFinite(raw)) return fallbackMs;
3783
+ return Math.max(0, Math.floor(raw));
3784
+ }
3785
+ function resolveSessionBindingLastActivityAt(binding) {
3786
+ const raw = binding.metadata?.lastActivityAt;
3787
+ if (typeof raw !== "number" || !Number.isFinite(raw)) return binding.boundAt;
3788
+ return Math.max(Math.floor(raw), binding.boundAt);
3789
+ }
3790
+ function resolveSessionBindingBoundBy(binding) {
3791
+ const raw = binding.metadata?.boundBy;
3792
+ return normalizeOptionalString(raw) ?? "";
3793
+ }
3794
+ function isSessionBindingRecord(binding) {
3795
+ return "bindingId" in binding;
3796
+ }
3797
+ function resolveUpdatedLifecycleDurationMs(binding, key) {
3798
+ if (!isSessionBindingRecord(binding)) {
3799
+ const raw = binding[key];
3800
+ if (typeof raw === "number" && Number.isFinite(raw)) return Math.max(0, Math.floor(raw));
3801
+ }
3802
+ if (!isSessionBindingRecord(binding)) return;
3803
+ const raw = binding.metadata?.[key];
3804
+ if (typeof raw !== "number" || !Number.isFinite(raw)) return;
3805
+ return Math.max(0, Math.floor(raw));
3806
+ }
3807
+ function toUpdatedLifecycleBinding(binding) {
3808
+ const lastActivityAt = isSessionBindingRecord(binding) ? resolveSessionBindingLastActivityAt(binding) : Math.max(Math.floor(binding.lastActivityAt), binding.boundAt);
3809
+ return {
3810
+ boundAt: binding.boundAt,
3811
+ lastActivityAt,
3812
+ idleTimeoutMs: resolveUpdatedLifecycleDurationMs(binding, "idleTimeoutMs"),
3813
+ maxAgeMs: resolveUpdatedLifecycleDurationMs(binding, "maxAgeMs")
3814
+ };
3815
+ }
3816
+ function resolveUpdatedBindingExpiry(params) {
3817
+ const expiries = params.bindings.map((binding) => {
3818
+ if (params.action === SESSION_ACTION_IDLE) {
3819
+ const idleTimeoutMs = typeof binding.idleTimeoutMs === "number" && Number.isFinite(binding.idleTimeoutMs) ? Math.max(0, Math.floor(binding.idleTimeoutMs)) : 0;
3820
+ if (idleTimeoutMs <= 0) return;
3821
+ return Math.max(binding.lastActivityAt, binding.boundAt) + idleTimeoutMs;
3822
+ }
3823
+ const maxAgeMs = typeof binding.maxAgeMs === "number" && Number.isFinite(binding.maxAgeMs) ? Math.max(0, Math.floor(binding.maxAgeMs)) : 0;
3824
+ if (maxAgeMs <= 0) return;
3825
+ return binding.boundAt + maxAgeMs;
3826
+ }).filter((expiresAt) => typeof expiresAt === "number");
3827
+ if (expiries.length === 0) return;
3828
+ return Math.min(...expiries);
3829
+ }
3830
+ const handleActivationCommand = async (params, allowTextCommands) => {
3831
+ if (!allowTextCommands) return null;
3832
+ const activationCommand = parseActivationCommand(params.command.commandBodyNormalized);
3833
+ if (!activationCommand.hasCommand) return null;
3834
+ if (!params.isGroup) return {
3835
+ shouldContinue: false,
3836
+ reply: { text: "āš™ļø Group activation only applies to group chats." }
3837
+ };
3838
+ if (!params.command.isAuthorizedSender) {
3839
+ logVerbose(`Ignoring /activation from unauthorized sender in group: ${params.command.senderId || "<unknown>"}`);
3840
+ return { shouldContinue: false };
3841
+ }
3842
+ if (!activationCommand.mode) return {
3843
+ shouldContinue: false,
3844
+ reply: { text: "āš™ļø Usage: /activation mention|always" }
3845
+ };
3846
+ if (params.sessionEntry && params.sessionStore && params.sessionKey) {
3847
+ params.sessionEntry.groupActivation = activationCommand.mode;
3848
+ params.sessionEntry.groupActivationNeedsSystemIntro = true;
3849
+ await persistSessionEntry(params);
3850
+ }
3851
+ return {
3852
+ shouldContinue: false,
3853
+ reply: { text: `āš™ļø Group activation set to ${activationCommand.mode}.` }
3854
+ };
3855
+ };
3856
+ const handleSendPolicyCommand = async (params, allowTextCommands) => {
3857
+ if (!allowTextCommands) return null;
3858
+ const sendPolicyCommand = parseSendPolicyCommand(params.command.commandBodyNormalized);
3859
+ if (!sendPolicyCommand.hasCommand) return null;
3860
+ const unauthorizedResult = rejectUnauthorizedCommand(params, "/send");
3861
+ if (unauthorizedResult) return unauthorizedResult;
3862
+ const nonOwnerResult = rejectNonOwnerCommand(params, "/send");
3863
+ if (nonOwnerResult) return nonOwnerResult;
3864
+ if (!sendPolicyCommand.mode) return {
3865
+ shouldContinue: false,
3866
+ reply: { text: "āš™ļø Usage: /send on|off|inherit" }
3867
+ };
3868
+ if (params.sessionEntry && params.sessionStore && params.sessionKey) {
3869
+ if (sendPolicyCommand.mode === "inherit") delete params.sessionEntry.sendPolicy;
3870
+ else params.sessionEntry.sendPolicy = sendPolicyCommand.mode;
3871
+ await persistSessionEntry(params);
3872
+ }
3873
+ return {
3874
+ shouldContinue: false,
3875
+ reply: { text: `āš™ļø Send policy set to ${sendPolicyCommand.mode === "inherit" ? "inherit" : sendPolicyCommand.mode === "allow" ? "on" : "off"}.` }
3876
+ };
3877
+ };
3878
+ const handleUsageCommand = async (params, allowTextCommands) => {
3879
+ if (!allowTextCommands) return null;
3880
+ const normalized = params.command.commandBodyNormalized;
3881
+ if (normalized !== "/usage" && !normalized.startsWith("/usage ")) return null;
3882
+ if (!params.command.isAuthorizedSender) {
3883
+ logVerbose(`Ignoring /usage from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
3884
+ return { shouldContinue: false };
3885
+ }
3886
+ const rawArgs = normalized === "/usage" ? "" : normalized.slice(6).trim();
3887
+ const requested = rawArgs ? normalizeUsageDisplay(rawArgs) : void 0;
3888
+ if (normalizeLowercaseStringOrEmpty(rawArgs).startsWith("cost")) {
3889
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
3890
+ const sessionAgentId = params.sessionKey ? resolveSessionAgentId({
3891
+ sessionKey: params.sessionKey,
3892
+ config: params.cfg
3893
+ }) : params.agentId;
3894
+ const sessionSummary = await loadSessionCostSummary({
3895
+ sessionId: targetSessionEntry?.sessionId,
3896
+ sessionEntry: targetSessionEntry,
3897
+ sessionFile: targetSessionEntry?.sessionFile,
3898
+ config: params.cfg,
3899
+ agentId: sessionAgentId
3900
+ });
3901
+ const summary = await loadCostUsageSummary({
3902
+ days: 30,
3903
+ config: params.cfg
3904
+ });
3905
+ const sessionCost = formatUsd(sessionSummary?.totalCost);
3906
+ const sessionTokens = sessionSummary?.totalTokens ? formatTokenCount(sessionSummary.totalTokens) : void 0;
3907
+ const sessionSuffix = (sessionSummary?.missingCostEntries ?? 0) > 0 ? " (partial)" : "";
3908
+ const sessionLine = sessionCost || sessionTokens ? `Session ${sessionCost ?? "n/a"}${sessionSuffix}${sessionTokens ? ` Ā· ${sessionTokens} tokens` : ""}` : "Session n/a";
3909
+ const todayKey = (/* @__PURE__ */ new Date()).toLocaleDateString("en-CA");
3910
+ const todayEntry = summary.daily.find((entry) => entry.date === todayKey);
3911
+ const todayCost = formatUsd(todayEntry?.totalCost);
3912
+ const todaySuffix = (todayEntry?.missingCostEntries ?? 0) > 0 ? " (partial)" : "";
3913
+ const todayLine = `Today ${todayCost ?? "n/a"}${todaySuffix}`;
3914
+ const last30Cost = formatUsd(summary.totals.totalCost);
3915
+ const last30Suffix = summary.totals.missingCostEntries > 0 ? " (partial)" : "";
3916
+ return {
3917
+ shouldContinue: false,
3918
+ reply: { text: `šŸ’ø Usage cost\n${sessionLine}\n${todayLine}\n${`Last 30d ${last30Cost ?? "n/a"}${last30Suffix}`}` }
3919
+ };
3920
+ }
3921
+ if (rawArgs && !requested) return {
3922
+ shouldContinue: false,
3923
+ reply: { text: "āš™ļø Usage: /usage off|tokens|full|cost" }
3924
+ };
3925
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
3926
+ const currentRaw = targetSessionEntry?.responseUsage;
3927
+ const current = resolveResponseUsageMode(currentRaw);
3928
+ const next = requested ?? (current === "off" ? "tokens" : current === "tokens" ? "full" : "off");
3929
+ if (targetSessionEntry && params.sessionStore && params.sessionKey) {
3930
+ if (next === "off") delete targetSessionEntry.responseUsage;
3931
+ else targetSessionEntry.responseUsage = next;
3932
+ params.sessionStore[params.sessionKey] = targetSessionEntry;
3933
+ await persistSessionEntry({
3934
+ ...params,
3935
+ sessionEntry: targetSessionEntry
3936
+ });
3937
+ }
3938
+ return {
3939
+ shouldContinue: false,
3940
+ reply: { text: `āš™ļø Usage footer: ${next}.` }
3941
+ };
3942
+ };
3943
+ const handleFastCommand = async (params, allowTextCommands) => {
3944
+ if (!allowTextCommands) return null;
3945
+ const normalized = params.command.commandBodyNormalized;
3946
+ if (normalized !== "/fast" && !normalized.startsWith("/fast ")) return null;
3947
+ if (!params.command.isAuthorizedSender) {
3948
+ logVerbose(`Ignoring /fast from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
3949
+ return { shouldContinue: false };
3950
+ }
3951
+ const rawMode = normalizeLowercaseStringOrEmpty(normalized === "/fast" ? "" : normalized.slice(5).trim());
3952
+ if (!rawMode || rawMode === "status") {
3953
+ const targetSessionEntry = params.sessionStore?.[params.sessionKey] ?? params.sessionEntry;
3954
+ const sessionAgentId = params.sessionKey ? resolveSessionAgentId({
3955
+ sessionKey: params.sessionKey,
3956
+ config: params.cfg
3957
+ }) : params.agentId;
3958
+ const state = resolveFastModeState({
3959
+ cfg: params.cfg,
3960
+ provider: params.provider,
3961
+ model: params.model,
3962
+ agentId: sessionAgentId,
3963
+ sessionEntry: targetSessionEntry
3964
+ });
3965
+ const suffix = state.source === "agent" ? " (agent)" : state.source === "config" ? " (config)" : state.source === "default" ? " (default)" : "";
3966
+ return {
3967
+ shouldContinue: false,
3968
+ reply: { text: `āš™ļø Current fast mode: ${state.enabled ? "on" : "off"}${suffix}.` }
3969
+ };
3970
+ }
3971
+ const nextMode = normalizeFastMode(rawMode);
3972
+ if (nextMode === void 0) return {
3973
+ shouldContinue: false,
3974
+ reply: { text: "āš™ļø Usage: /fast status|on|off" }
3975
+ };
3976
+ if (params.sessionEntry && params.sessionStore && params.sessionKey) {
3977
+ params.sessionEntry.fastMode = nextMode;
3978
+ await persistSessionEntry(params);
3979
+ }
3980
+ return {
3981
+ shouldContinue: false,
3982
+ reply: { text: `āš™ļø Fast mode ${nextMode ? "enabled" : "disabled"}.` }
3983
+ };
3984
+ };
3985
+ const handleSessionCommand = async (params, allowTextCommands) => {
3986
+ if (!allowTextCommands) return null;
3987
+ const normalized = params.command.commandBodyNormalized;
3988
+ if (!/^\/session(?:\s|$)/.test(normalized)) return null;
3989
+ if (!params.command.isAuthorizedSender) {
3990
+ logVerbose(`Ignoring /session from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
3991
+ return { shouldContinue: false };
3992
+ }
3993
+ const tokens = normalized.slice(8).trim().split(/\s+/).filter(Boolean);
3994
+ const action = normalizeOptionalLowercaseString(tokens[0]);
3995
+ if (action !== SESSION_ACTION_IDLE && action !== SESSION_ACTION_MAX_AGE) return {
3996
+ shouldContinue: false,
3997
+ reply: { text: resolveSessionCommandUsage() }
3998
+ };
3999
+ const channelId = params.command.channelId ?? normalizeChannelId$1(resolveCommandSurfaceChannel(params)) ?? void 0;
4000
+ const commandConversationBindings = channelId ? getChannelPlugin(channelId)?.conversationBindings : void 0;
4001
+ const commandSupportsCurrentConversationBinding = Boolean(commandConversationBindings?.supportsCurrentConversationBinding);
4002
+ const commandSupportsLifecycleUpdate = action === SESSION_ACTION_IDLE ? typeof commandConversationBindings?.setIdleTimeoutBySessionKey === "function" : typeof commandConversationBindings?.setMaxAgeBySessionKey === "function";
4003
+ const bindingContext = resolveConversationBindingContextFromAcpCommand(params);
4004
+ if (!bindingContext) {
4005
+ if (!channelId || !commandSupportsCurrentConversationBinding || !commandSupportsLifecycleUpdate) return {
4006
+ shouldContinue: false,
4007
+ reply: { text: "āš ļø /session idle and /session max-age are currently available only on channels that support focused conversation bindings." }
4008
+ };
4009
+ return {
4010
+ shouldContinue: false,
4011
+ reply: { text: "āš ļø /session idle and /session max-age must be run inside a focused conversation." }
4012
+ };
4013
+ }
4014
+ const resolvedChannelId = bindingContext.channel || channelId;
4015
+ const conversationBindings = resolvedChannelId ? getChannelPlugin(resolvedChannelId)?.conversationBindings : void 0;
4016
+ const supportsCurrentConversationBinding = Boolean(conversationBindings?.supportsCurrentConversationBinding);
4017
+ const supportsLifecycleUpdate = action === SESSION_ACTION_IDLE ? typeof conversationBindings?.setIdleTimeoutBySessionKey === "function" : typeof conversationBindings?.setMaxAgeBySessionKey === "function";
4018
+ if (!resolvedChannelId || !supportsCurrentConversationBinding || !supportsLifecycleUpdate) return {
4019
+ shouldContinue: false,
4020
+ reply: { text: "āš ļø /session idle and /session max-age are currently available only on channels that support focused conversation bindings." }
4021
+ };
4022
+ const activeBinding = getSessionBindingService().resolveByConversation(bindingContext);
4023
+ if (!activeBinding) return {
4024
+ shouldContinue: false,
4025
+ reply: { text: "ā„¹ļø This conversation is not currently focused." }
4026
+ };
4027
+ const idleTimeoutMs = resolveSessionBindingDurationMs(activeBinding, "idleTimeoutMs", 1440 * 60 * 1e3);
4028
+ const idleExpiresAt = idleTimeoutMs > 0 ? resolveSessionBindingLastActivityAt(activeBinding) + idleTimeoutMs : void 0;
4029
+ const maxAgeMs = resolveSessionBindingDurationMs(activeBinding, "maxAgeMs", 0);
4030
+ const maxAgeExpiresAt = maxAgeMs > 0 ? activeBinding.boundAt + maxAgeMs : void 0;
4031
+ const durationArgRaw = tokens.slice(1).join("");
4032
+ if (!durationArgRaw) {
4033
+ if (action === SESSION_ACTION_IDLE) {
4034
+ if (typeof idleExpiresAt === "number" && Number.isFinite(idleExpiresAt) && idleExpiresAt > Date.now()) return {
4035
+ shouldContinue: false,
4036
+ reply: { text: `ā„¹ļø Idle timeout active (${formatThreadBindingDurationLabel(idleTimeoutMs)}, next auto-unfocus at ${formatSessionExpiry(idleExpiresAt)}).` }
4037
+ };
4038
+ return {
4039
+ shouldContinue: false,
4040
+ reply: { text: "ā„¹ļø Idle timeout is currently disabled for this focused session." }
4041
+ };
4042
+ }
4043
+ if (typeof maxAgeExpiresAt === "number" && Number.isFinite(maxAgeExpiresAt) && maxAgeExpiresAt > Date.now()) return {
4044
+ shouldContinue: false,
4045
+ reply: { text: `ā„¹ļø Max age active (${formatThreadBindingDurationLabel(maxAgeMs)}, hard auto-unfocus at ${formatSessionExpiry(maxAgeExpiresAt)}).` }
4046
+ };
4047
+ return {
4048
+ shouldContinue: false,
4049
+ reply: { text: "ā„¹ļø Max age is currently disabled for this focused session." }
4050
+ };
4051
+ }
4052
+ const senderId = normalizeOptionalString(params.command.senderId) ?? "";
4053
+ const boundBy = resolveSessionBindingBoundBy(activeBinding);
4054
+ if (boundBy && boundBy !== "system" && senderId && senderId !== boundBy) return {
4055
+ shouldContinue: false,
4056
+ reply: { text: `āš ļø Only ${boundBy} can update session lifecycle settings for this conversation.` }
4057
+ };
4058
+ let durationMs;
4059
+ try {
4060
+ durationMs = parseSessionDurationMs(durationArgRaw);
4061
+ } catch {
4062
+ return {
4063
+ shouldContinue: false,
4064
+ reply: { text: resolveSessionCommandUsage() }
4065
+ };
4066
+ }
4067
+ const updatedBindings = action === SESSION_ACTION_IDLE ? setChannelConversationBindingIdleTimeoutBySessionKey({
4068
+ channelId: bindingContext.channel,
4069
+ targetSessionKey: activeBinding.targetSessionKey,
4070
+ accountId: bindingContext.accountId,
4071
+ idleTimeoutMs: durationMs
4072
+ }) : setChannelConversationBindingMaxAgeBySessionKey({
4073
+ channelId: bindingContext.channel,
4074
+ targetSessionKey: activeBinding.targetSessionKey,
4075
+ accountId: bindingContext.accountId,
4076
+ maxAgeMs: durationMs
4077
+ });
4078
+ if (updatedBindings.length === 0) return {
4079
+ shouldContinue: false,
4080
+ reply: { text: action === SESSION_ACTION_IDLE ? "āš ļø Failed to update idle timeout for the current binding." : "āš ļø Failed to update max age for the current binding." }
4081
+ };
4082
+ if (durationMs <= 0) return {
4083
+ shouldContinue: false,
4084
+ reply: { text: action === SESSION_ACTION_IDLE ? `āœ… Idle timeout disabled for ${updatedBindings.length} binding${updatedBindings.length === 1 ? "" : "s"}.` : `āœ… Max age disabled for ${updatedBindings.length} binding${updatedBindings.length === 1 ? "" : "s"}.` }
4085
+ };
4086
+ const nextExpiry = resolveUpdatedBindingExpiry({
4087
+ action,
4088
+ bindings: updatedBindings.map((binding) => toUpdatedLifecycleBinding(binding))
4089
+ });
4090
+ const expiryLabel = typeof nextExpiry === "number" && Number.isFinite(nextExpiry) ? formatSessionExpiry(nextExpiry) : "n/a";
4091
+ return {
4092
+ shouldContinue: false,
4093
+ reply: { text: action === SESSION_ACTION_IDLE ? `āœ… Idle timeout set to ${formatThreadBindingDurationLabel(durationMs)} for ${updatedBindings.length} binding${updatedBindings.length === 1 ? "" : "s"} (next auto-unfocus at ${expiryLabel}).` : `āœ… Max age set to ${formatThreadBindingDurationLabel(durationMs)} for ${updatedBindings.length} binding${updatedBindings.length === 1 ? "" : "s"} (hard auto-unfocus at ${expiryLabel}).` }
4094
+ };
4095
+ };
4096
+ const handleRestartCommand = async (params, allowTextCommands) => {
4097
+ if (!allowTextCommands) return null;
4098
+ if (params.command.commandBodyNormalized !== "/restart") return null;
4099
+ if (!params.command.isAuthorizedSender) {
4100
+ logVerbose(`Ignoring /restart from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
4101
+ return { shouldContinue: false };
4102
+ }
4103
+ const nonOwner = rejectNonOwnerCommand(params, "/restart");
4104
+ if (nonOwner) return nonOwner;
4105
+ if (!isRestartEnabled(params.cfg)) return {
4106
+ shouldContinue: false,
4107
+ reply: { text: "āš ļø /restart is disabled (commands.restart=false)." }
4108
+ };
4109
+ const hasSigusr1Listener = process.listenerCount("SIGUSR1") > 0;
4110
+ const sentinelPayload = buildRestartCommandSentinel(params);
4111
+ if (hasSigusr1Listener) {
4112
+ let sentinelPath = null;
4113
+ scheduleGatewaySigusr1Restart({
4114
+ reason: "/restart",
4115
+ emitHooks: sentinelPayload ? {
4116
+ beforeEmit: async () => {
4117
+ sentinelPath = await writeRestartSentinel(sentinelPayload);
4118
+ },
4119
+ afterEmitRejected: async () => {
4120
+ await removeRestartSentinelFile(sentinelPath);
4121
+ }
4122
+ } : void 0
4123
+ });
4124
+ return {
4125
+ shouldContinue: false,
4126
+ reply: { text: "āš™ļø Restarting Genesis in-process (SIGUSR1); back in a few seconds." }
4127
+ };
4128
+ }
4129
+ let sentinelPath = null;
4130
+ try {
4131
+ if (sentinelPayload) sentinelPath = await writeRestartSentinel(sentinelPayload);
4132
+ } catch (err) {
4133
+ logVerbose(`failed to write /restart sentinel: ${String(err)}`);
4134
+ return {
4135
+ shouldContinue: false,
4136
+ reply: { text: "āš ļø Restart failed: could not persist the post-restart acknowledgement." }
4137
+ };
4138
+ }
4139
+ const restartMethod = triggerGenesisRestart();
4140
+ if (!restartMethod.ok) {
4141
+ await removeRestartSentinelFile(sentinelPath);
4142
+ const detail = restartMethod.detail ? ` Details: ${restartMethod.detail}` : "";
4143
+ return {
4144
+ shouldContinue: false,
4145
+ reply: { text: `āš ļø Restart failed (${restartMethod.method}).${detail}` }
4146
+ };
4147
+ }
4148
+ return {
4149
+ shouldContinue: false,
4150
+ reply: { text: `āš™ļø Restarting Genesis via ${restartMethod.method}; give me a few seconds to come back online.` }
4151
+ };
4152
+ };
4153
+ //#endregion
4154
+ //#region src/auto-reply/reply/commands-subagents.ts
4155
+ let actionAgentsPromise = null;
4156
+ let actionFocusPromise = null;
4157
+ let actionHelpPromise = null;
4158
+ let actionInfoPromise = null;
4159
+ let actionKillPromise = null;
4160
+ let actionListPromise = null;
4161
+ let actionLogPromise = null;
4162
+ let actionSendPromise = null;
4163
+ let actionSpawnPromise = null;
4164
+ let actionUnfocusPromise = null;
4165
+ let controlRuntimePromise = null;
4166
+ function loadAgentsAction() {
4167
+ actionAgentsPromise ??= import("./action-agents-l7277wqt.js");
4168
+ return actionAgentsPromise;
4169
+ }
4170
+ function loadFocusAction() {
4171
+ actionFocusPromise ??= import("./action-focus-Dl60p5pD.js");
4172
+ return actionFocusPromise;
4173
+ }
4174
+ function loadHelpAction() {
4175
+ actionHelpPromise ??= import("./action-help-DxLv4lVR.js");
4176
+ return actionHelpPromise;
4177
+ }
4178
+ function loadInfoAction() {
4179
+ actionInfoPromise ??= import("./action-info-DL9E3-WR.js");
4180
+ return actionInfoPromise;
4181
+ }
4182
+ function loadKillAction() {
4183
+ actionKillPromise ??= import("./action-kill-D9o9OmhF.js");
4184
+ return actionKillPromise;
4185
+ }
4186
+ function loadListAction() {
4187
+ actionListPromise ??= import("./action-list-CHZdMgmX.js");
4188
+ return actionListPromise;
4189
+ }
4190
+ function loadLogAction() {
4191
+ actionLogPromise ??= import("./action-log-CU2gXtSM.js");
4192
+ return actionLogPromise;
4193
+ }
4194
+ function loadSendAction() {
4195
+ actionSendPromise ??= import("./action-send-Bh6VyKBO.js");
4196
+ return actionSendPromise;
4197
+ }
4198
+ function loadSpawnAction() {
4199
+ actionSpawnPromise ??= import("./action-spawn-CRh30i-w.js");
4200
+ return actionSpawnPromise;
4201
+ }
4202
+ function loadUnfocusAction() {
4203
+ actionUnfocusPromise ??= import("./action-unfocus-DWfvqVUr.js");
4204
+ return actionUnfocusPromise;
4205
+ }
4206
+ function loadControlRuntime() {
4207
+ controlRuntimePromise ??= import("./commands-subagents-control.runtime-DdiL_B5Y.js");
4208
+ return controlRuntimePromise;
4209
+ }
4210
+ const handleSubagentsCommand = async (params, allowTextCommands) => {
4211
+ if (!allowTextCommands) return null;
4212
+ const normalized = params.command.commandBodyNormalized;
4213
+ const handledPrefix = resolveHandledPrefix(normalized);
4214
+ if (!handledPrefix) return null;
4215
+ if (!params.command.isAuthorizedSender) {
4216
+ logVerbose(`Ignoring ${handledPrefix} from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
4217
+ return { shouldContinue: false };
4218
+ }
4219
+ const restTokens = normalized.slice(handledPrefix.length).trim().split(/\s+/).filter(Boolean);
4220
+ const action = resolveSubagentsAction({
4221
+ handledPrefix,
4222
+ restTokens
4223
+ });
4224
+ if (!action) return (await loadHelpAction()).handleSubagentsHelpAction();
4225
+ const requesterKey = action === "spawn" ? resolveRequesterSessionKey(params, { preferCommandTarget: true }) : resolveRequesterSessionKey(params);
4226
+ if (!requesterKey) return stopWithText("āš ļø Missing session key.");
4227
+ const ctx = {
4228
+ params,
4229
+ handledPrefix,
4230
+ requesterKey,
4231
+ runs: (await loadControlRuntime()).listControlledSubagentRuns(requesterKey),
4232
+ restTokens
4233
+ };
4234
+ switch (action) {
4235
+ case "help": return (await loadHelpAction()).handleSubagentsHelpAction();
4236
+ case "agents": return (await loadAgentsAction()).handleSubagentsAgentsAction(ctx);
4237
+ case "focus": return await (await loadFocusAction()).handleSubagentsFocusAction(ctx);
4238
+ case "unfocus": return await (await loadUnfocusAction()).handleSubagentsUnfocusAction(ctx);
4239
+ case "list": return (await loadListAction()).handleSubagentsListAction(ctx);
4240
+ case "kill": return await (await loadKillAction()).handleSubagentsKillAction(ctx);
4241
+ case "info": return (await loadInfoAction()).handleSubagentsInfoAction(ctx);
4242
+ case "log": return await (await loadLogAction()).handleSubagentsLogAction(ctx);
4243
+ case "send": return await (await loadSendAction()).handleSubagentsSendAction(ctx, false);
4244
+ case "steer": return await (await loadSendAction()).handleSubagentsSendAction(ctx, true);
4245
+ case "spawn": return await (await loadSpawnAction()).handleSubagentsSpawnAction(ctx);
4246
+ default: return (await loadHelpAction()).handleSubagentsHelpAction();
4247
+ }
4248
+ };
4249
+ //#endregion
4250
+ //#region src/auto-reply/reply/commands-tasks.ts
4251
+ const MAX_VISIBLE_TASKS = 5;
4252
+ const TASK_STATUS_ICONS = {
4253
+ queued: "🟔",
4254
+ running: "🟢",
4255
+ succeeded: "āœ…",
4256
+ failed: "šŸ”“",
4257
+ timed_out: "ā±ļø",
4258
+ cancelled: "āšŖļø",
4259
+ lost: "āš ļø"
4260
+ };
4261
+ const TASK_RUNTIME_LABELS = {
4262
+ subagent: "Subagent",
4263
+ acp: "ACP",
4264
+ cli: "CLI",
4265
+ cron: "Cron"
4266
+ };
4267
+ function formatTaskHeadline(snapshot) {
4268
+ if (snapshot.totalCount === 0) return "All clear - nothing linked to this session right now.";
4269
+ return `Current session: ${snapshot.activeCount} active Ā· ${snapshot.totalCount} total`;
4270
+ }
4271
+ function formatAgentFallbackLine(agentId) {
4272
+ const snapshot = buildTaskStatusSnapshot(listTasksForAgentIdForStatus(agentId));
4273
+ if (snapshot.totalCount === 0) return;
4274
+ return `Agent-local: ${snapshot.activeCount} active Ā· ${snapshot.totalCount} total`;
4275
+ }
4276
+ function formatTaskTiming(task) {
4277
+ if (task.status === "running") {
4278
+ const startedAt = task.startedAt ?? task.createdAt;
4279
+ return `elapsed ${formatDurationCompact(Date.now() - startedAt, { spaced: true }) ?? "0s"}`;
4280
+ }
4281
+ if (task.status === "queued") return `queued ${formatTimeAgo(Date.now() - task.createdAt)}`;
4282
+ const endedAt = task.endedAt ?? task.lastEventAt ?? task.createdAt;
4283
+ return `finished ${formatTimeAgo(Date.now() - endedAt)}`;
4284
+ }
4285
+ function formatTaskDetail(task) {
4286
+ return formatTaskStatusDetail(task);
4287
+ }
4288
+ function formatVisibleTask(task, index) {
4289
+ const title = formatTaskStatusTitle(task);
4290
+ const status = task.status.replaceAll("_", " ");
4291
+ const timing = formatTaskTiming(task);
4292
+ const detail = formatTaskDetail(task);
4293
+ const meta = [
4294
+ TASK_RUNTIME_LABELS[task.runtime],
4295
+ status,
4296
+ timing
4297
+ ].filter(Boolean).join(" Ā· ");
4298
+ const lines = [`${index + 1}. ${TASK_STATUS_ICONS[task.status]} ${title}`, ` ${meta}`];
4299
+ if (detail) lines.push(` ${detail}`);
4300
+ return lines.join("\n");
4301
+ }
4302
+ function buildTasksText(params) {
4303
+ const sessionSnapshot = buildTaskStatusSnapshot(listTasksForSessionKeyForStatus(params.sessionKey));
4304
+ const lines = ["šŸ“‹ Tasks", formatTaskHeadline(sessionSnapshot)];
4305
+ if (sessionSnapshot.totalCount > 0) {
4306
+ const visible = sessionSnapshot.visible.slice(0, MAX_VISIBLE_TASKS);
4307
+ lines.push("");
4308
+ for (const [index, task] of visible.entries()) {
4309
+ lines.push(formatVisibleTask(task, index));
4310
+ if (index < visible.length - 1) lines.push("");
4311
+ }
4312
+ const hiddenCount = sessionSnapshot.visible.length - visible.length;
4313
+ if (hiddenCount > 0) lines.push("", `+${hiddenCount} more recent task${hiddenCount === 1 ? "" : "s"}`);
4314
+ return lines.join("\n");
4315
+ }
4316
+ const agentFallback = formatAgentFallbackLine(params.agentId);
4317
+ if (agentFallback) lines.push(agentFallback);
4318
+ return lines.join("\n");
4319
+ }
4320
+ async function buildTasksReply(params) {
4321
+ const agentId = resolveSessionAgentId({
4322
+ sessionKey: params.sessionKey,
4323
+ config: params.cfg
4324
+ });
4325
+ return { text: buildTasksText({
4326
+ sessionKey: params.sessionKey,
4327
+ agentId
4328
+ }) };
4329
+ }
4330
+ const handleTasksCommand = async (params, allowTextCommands) => {
4331
+ if (!allowTextCommands) return null;
4332
+ const normalized = params.command.commandBodyNormalized;
4333
+ if (normalized !== "/tasks" && !normalized.startsWith("/tasks ")) return null;
4334
+ if (!params.command.isAuthorizedSender) {
4335
+ logVerbose(`Ignoring /tasks from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
4336
+ return { shouldContinue: false };
4337
+ }
4338
+ if (normalized !== "/tasks") return {
4339
+ shouldContinue: false,
4340
+ reply: { text: "Usage: /tasks" }
4341
+ };
4342
+ return {
4343
+ shouldContinue: false,
4344
+ reply: await buildTasksReply(params)
4345
+ };
4346
+ };
4347
+ //#endregion
4348
+ //#region src/auto-reply/reply/commands-tts.ts
4349
+ function parseTtsCommand(normalized) {
4350
+ if (normalized === "/tts") return {
4351
+ action: "status",
4352
+ args: ""
4353
+ };
4354
+ if (!normalized.startsWith("/tts ")) return null;
4355
+ const rest = normalized.slice(5).trim();
4356
+ if (!rest) return {
4357
+ action: "status",
4358
+ args: ""
4359
+ };
4360
+ const [action, ...tail] = rest.split(/\s+/);
4361
+ return {
4362
+ action: normalizeOptionalLowercaseString(action) ?? "",
4363
+ args: normalizeOptionalString(tail.join(" ")) ?? ""
4364
+ };
4365
+ }
4366
+ function formatAttemptDetails(attempts) {
4367
+ if (!attempts || attempts.length === 0) return;
4368
+ return attempts.map((attempt) => {
4369
+ const reason = attempt.reasonCode === "success" ? "ok" : attempt.reasonCode;
4370
+ const latency = Number.isFinite(attempt.latencyMs) ? ` ${attempt.latencyMs}ms` : "";
4371
+ return `${attempt.provider}:${attempt.outcome}(${reason})${latency}`;
4372
+ }).join(", ");
4373
+ }
4374
+ function ttsUsage() {
4375
+ return { text: "šŸ”Š **TTS (Text-to-Speech) Help**\n\n**Commands:**\n• /tts on — Enable automatic TTS for replies\n• /tts off — Disable TTS\n• /tts status — Show current settings\n• /tts provider [name] — View/change provider\n• /tts limit [number] — View/change text limit\n• /tts summary [on|off] — View/change auto-summary\n• /tts audio <text> — Generate audio from text\n\n**Providers:**\nUse /tts provider to list the registered speech providers and their status.\n\n**Text Limit (default: 1500, max: 4096):**\nWhen text exceeds the limit:\n• Summary ON: AI summarizes, then generates audio\n• Summary OFF: Truncates text, then generates audio\n\n**Examples:**\n/tts provider <id>\n/tts limit 2000\n/tts audio Hello, this is a test!" };
4376
+ }
4377
+ const handleTtsCommands = async (params, allowTextCommands) => {
4378
+ if (!allowTextCommands) return null;
4379
+ const parsed = parseTtsCommand(params.command.commandBodyNormalized);
4380
+ if (!parsed) return null;
4381
+ if (!params.command.isAuthorizedSender) {
4382
+ logVerbose(`Ignoring TTS command from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
4383
+ return { shouldContinue: false };
4384
+ }
4385
+ const config = resolveTtsConfig(params.cfg);
4386
+ const prefsPath = resolveTtsPrefsPath(config);
4387
+ const action = parsed.action;
4388
+ const args = parsed.args;
4389
+ if (action === "help") return {
4390
+ shouldContinue: false,
4391
+ reply: ttsUsage()
4392
+ };
4393
+ if (action === "on") {
4394
+ setTtsEnabled(prefsPath, true);
4395
+ return {
4396
+ shouldContinue: false,
4397
+ reply: { text: "šŸ”Š TTS enabled." }
4398
+ };
4399
+ }
4400
+ if (action === "off") {
4401
+ setTtsEnabled(prefsPath, false);
4402
+ return {
4403
+ shouldContinue: false,
4404
+ reply: { text: "šŸ”‡ TTS disabled." }
4405
+ };
4406
+ }
4407
+ if (action === "audio") {
4408
+ if (!args.trim()) return {
4409
+ shouldContinue: false,
4410
+ reply: { text: "šŸŽ¤ Generate audio from text.\n\nUsage: /tts audio <text>\nExample: /tts audio Hello, this is a test!" }
4411
+ };
4412
+ const start = Date.now();
4413
+ const result = await textToSpeech({
4414
+ text: args,
4415
+ cfg: params.cfg,
4416
+ channel: params.command.channel,
4417
+ prefsPath
4418
+ });
4419
+ if (result.success && result.audioPath) {
4420
+ setLastTtsAttempt({
4421
+ timestamp: Date.now(),
4422
+ success: true,
4423
+ textLength: args.length,
4424
+ summarized: false,
4425
+ provider: result.provider,
4426
+ fallbackFrom: result.fallbackFrom,
4427
+ attemptedProviders: result.attemptedProviders,
4428
+ attempts: result.attempts,
4429
+ latencyMs: result.latencyMs
4430
+ });
4431
+ return {
4432
+ shouldContinue: false,
4433
+ reply: {
4434
+ mediaUrl: result.audioPath,
4435
+ audioAsVoice: result.voiceCompatible === true,
4436
+ trustedLocalMedia: true,
4437
+ spokenText: args
4438
+ }
4439
+ };
4440
+ }
4441
+ setLastTtsAttempt({
4442
+ timestamp: Date.now(),
4443
+ success: false,
4444
+ textLength: args.length,
4445
+ summarized: false,
4446
+ attemptedProviders: result.attemptedProviders,
4447
+ attempts: result.attempts,
4448
+ error: result.error,
4449
+ latencyMs: Date.now() - start
4450
+ });
4451
+ return {
4452
+ shouldContinue: false,
4453
+ reply: { text: `āŒ Error generating audio: ${result.error ?? "unknown error"}` }
4454
+ };
4455
+ }
4456
+ if (action === "provider") {
4457
+ const currentProvider = getTtsProvider(config, prefsPath);
4458
+ if (!args.trim()) {
4459
+ const providers = listSpeechProviders(params.cfg);
4460
+ return {
4461
+ shouldContinue: false,
4462
+ reply: { text: `šŸŽ™ļø TTS provider\nPrimary: ${currentProvider}\n` + providers.map((provider) => `${provider.label}: ${provider.isConfigured({
4463
+ cfg: params.cfg,
4464
+ providerConfig: getResolvedSpeechProviderConfig(config, provider.id, params.cfg),
4465
+ timeoutMs: config.timeoutMs
4466
+ }) ? "āœ…" : "āŒ"}`).join("\n") + `\nUsage: /tts provider <id>` }
4467
+ };
4468
+ }
4469
+ const requested = normalizeOptionalLowercaseString(args) ?? "";
4470
+ const resolvedProvider = getSpeechProvider(requested, params.cfg);
4471
+ if (!resolvedProvider) return {
4472
+ shouldContinue: false,
4473
+ reply: ttsUsage()
4474
+ };
4475
+ const nextProvider = canonicalizeSpeechProviderId(requested, params.cfg) ?? resolvedProvider.id;
4476
+ setTtsProvider(prefsPath, nextProvider);
4477
+ return {
4478
+ shouldContinue: false,
4479
+ reply: { text: `āœ… TTS provider set to ${nextProvider}.` }
4480
+ };
4481
+ }
4482
+ if (action === "limit") {
4483
+ if (!args.trim()) return {
4484
+ shouldContinue: false,
4485
+ reply: { text: `šŸ“ TTS limit: ${getTtsMaxLength(prefsPath)} characters.\n\nText longer than this triggers summary (if enabled).\nRange: 100-4096 chars (Telegram max).\n\nTo change: /tts limit <number>\nExample: /tts limit 2000` }
4486
+ };
4487
+ const next = Number.parseInt(args.trim(), 10);
4488
+ if (!Number.isFinite(next) || next < 100 || next > 4096) return {
4489
+ shouldContinue: false,
4490
+ reply: { text: "āŒ Limit must be between 100 and 4096 characters." }
4491
+ };
4492
+ setTtsMaxLength(prefsPath, next);
4493
+ return {
4494
+ shouldContinue: false,
4495
+ reply: { text: `āœ… TTS limit set to ${next} characters.` }
4496
+ };
4497
+ }
4498
+ if (action === "summary") {
4499
+ if (!args.trim()) {
4500
+ const enabled = isSummarizationEnabled(prefsPath);
4501
+ const maxLen = getTtsMaxLength(prefsPath);
4502
+ return {
4503
+ shouldContinue: false,
4504
+ reply: { text: `šŸ“ TTS auto-summary: ${enabled ? "on" : "off"}.\n\nWhen text exceeds ${maxLen} chars:\n• ON: summarizes text, then generates audio\n• OFF: truncates text, then generates audio\n\nTo change: /tts summary on | off` }
4505
+ };
4506
+ }
4507
+ const requested = normalizeOptionalLowercaseString(args) ?? "";
4508
+ if (requested !== "on" && requested !== "off") return {
4509
+ shouldContinue: false,
4510
+ reply: ttsUsage()
4511
+ };
4512
+ setSummarizationEnabled(prefsPath, requested === "on");
4513
+ return {
4514
+ shouldContinue: false,
4515
+ reply: { text: requested === "on" ? "āœ… TTS auto-summary enabled." : "āŒ TTS auto-summary disabled." }
4516
+ };
4517
+ }
4518
+ if (action === "status") {
4519
+ const enabled = isTtsEnabled(config, prefsPath);
4520
+ const provider = getTtsProvider(config, prefsPath);
4521
+ const hasKey = isTtsProviderConfigured(config, provider, params.cfg);
4522
+ const maxLength = getTtsMaxLength(prefsPath);
4523
+ const summarize = isSummarizationEnabled(prefsPath);
4524
+ const last = getLastTtsAttempt();
4525
+ const lines = [
4526
+ "šŸ“Š TTS status",
4527
+ `State: ${enabled ? "āœ… enabled" : "āŒ disabled"}`,
4528
+ `Provider: ${provider} (${hasKey ? "āœ… configured" : "āŒ not configured"})`,
4529
+ `Text limit: ${maxLength} chars`,
4530
+ `Auto-summary: ${summarize ? "on" : "off"}`
4531
+ ];
4532
+ if (last) {
4533
+ const timeAgo = Math.round((Date.now() - last.timestamp) / 1e3);
4534
+ lines.push("");
4535
+ lines.push(`Last attempt (${timeAgo}s ago): ${last.success ? "āœ…" : "āŒ"}`);
4536
+ lines.push(`Text: ${last.textLength} chars${last.summarized ? " (summarized)" : ""}`);
4537
+ if (last.success) {
4538
+ lines.push(`Provider: ${last.provider ?? "unknown"}`);
4539
+ if (last.fallbackFrom && last.provider && last.fallbackFrom !== last.provider) lines.push(`Fallback: ${last.fallbackFrom} -> ${last.provider}`);
4540
+ if (last.attemptedProviders && last.attemptedProviders.length > 1) lines.push(`Attempts: ${last.attemptedProviders.join(" -> ")}`);
4541
+ const details = formatAttemptDetails(last.attempts);
4542
+ if (details) lines.push(`Attempt details: ${details}`);
4543
+ lines.push(`Latency: ${last.latencyMs ?? 0}ms`);
4544
+ } else if (last.error) {
4545
+ lines.push(`Error: ${last.error}`);
4546
+ if (last.attemptedProviders && last.attemptedProviders.length > 0) lines.push(`Attempts: ${last.attemptedProviders.join(" -> ")}`);
4547
+ const details = formatAttemptDetails(last.attempts);
4548
+ if (details) lines.push(`Attempt details: ${details}`);
4549
+ }
4550
+ }
4551
+ return {
4552
+ shouldContinue: false,
4553
+ reply: { text: lines.join("\n") }
4554
+ };
4555
+ }
4556
+ return {
4557
+ shouldContinue: false,
4558
+ reply: ttsUsage()
4559
+ };
4560
+ };
4561
+ //#endregion
4562
+ //#region src/auto-reply/reply/commands-handlers.runtime.ts
4563
+ function loadCommandHandlers() {
4564
+ return [
4565
+ handlePluginCommand,
4566
+ handleBtwCommand,
4567
+ handleBashCommand,
4568
+ handleActivationCommand,
4569
+ handleSendPolicyCommand,
4570
+ handleFastCommand,
4571
+ handleUsageCommand,
4572
+ handleSessionCommand,
4573
+ handleRestartCommand,
4574
+ handleTtsCommands,
4575
+ handleHelpCommand,
4576
+ handleCommandsListCommand,
4577
+ handleToolsCommand,
4578
+ handleStatusCommand,
4579
+ handleTasksCommand,
4580
+ handleAllowlistCommand,
4581
+ handleApproveCommand,
4582
+ handleContextCommand,
4583
+ handleExportSessionCommand,
4584
+ handleExportTrajectoryCommand,
4585
+ handleWhoamiCommand,
4586
+ handleSubagentsCommand,
4587
+ handleAcpCommand,
4588
+ handleMcpCommand,
4589
+ handlePluginsCommand,
4590
+ handleConfigCommand,
4591
+ handleDebugCommand,
4592
+ handleModelsCommand,
4593
+ handleStopCommand,
4594
+ handleCompactCommand,
4595
+ handleAbortTrigger
4596
+ ];
4597
+ }
4598
+ //#endregion
4599
+ export { loadCommandHandlers };