@spacebar_ai/moldclaw-core 2026.3.14 → 2026.3.16

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 (1074) hide show
  1. package/README.md +108 -3
  2. package/dist/account-id-plS5L20e.d.ts +1 -0
  3. package/dist/accounts-BAYVGC2k.js +109 -0
  4. package/dist/accounts-DrjRgReV.d.ts +103 -0
  5. package/dist/acp-cli-at_UYEOS.js +2088 -0
  6. package/dist/acpx-Chy1GQ_k.d.ts +5 -0
  7. package/dist/actions.runtime-C0F7dMfO.js +114 -0
  8. package/dist/actions.runtime-caI2LG9o.js +128 -0
  9. package/dist/agent-media-payload-CkpAqaOh.d.ts +16 -0
  10. package/dist/agents-B98yPGc5.js +853 -0
  11. package/dist/agents-BrLr08L3.js +217 -0
  12. package/dist/allow-from-BIwT4dl7.d.ts +42 -0
  13. package/dist/allow-list-CHt7yvAf.js +81 -0
  14. package/dist/allowlist-CxQo2wQc.js +142 -0
  15. package/dist/allowlist-resolution-B7ib7gye.d.ts +17 -0
  16. package/dist/api-Co7TNHbL.js +6953 -0
  17. package/dist/api-cEQ_ql_8.js +112 -0
  18. package/dist/audit-AnKnnlaZ.js +787 -0
  19. package/dist/audit-channel.collect.runtime-CAk1DFQ3.js +600 -0
  20. package/dist/audit-channel.runtime-5phdZp_m.js +116 -0
  21. package/dist/audit-extra.async-B8ZXFxic.js +813 -0
  22. package/dist/audit-hdKa3D-u.js +54 -0
  23. package/dist/audit-membership-runtime-CJV5XvGU.js +157 -0
  24. package/dist/audit.deep.runtime-DNMcRQrp.js +24 -0
  25. package/dist/audit.nondeep.runtime-DhNDL6yM.js +831 -0
  26. package/dist/audit.runtime-Bx7uWEh8.js +113 -0
  27. package/dist/auth-choice-C37W9MA7.js +268 -0
  28. package/dist/auth-choice-CNppOY_V.js +117 -0
  29. package/dist/auth-choice-XYFnp6fI.js +502 -0
  30. package/dist/auth-choice-options-D6oZY4Xo.js +123 -0
  31. package/dist/auth-choice-prompt-BhRqchJx.js +110 -0
  32. package/dist/auth-choice-prompt-C1xv0N08.js +36 -0
  33. package/dist/auth-choice.plugin-providers.runtime-DhLEtbmR.js +114 -0
  34. package/dist/auth-profiles-9zZdaXJK.js +127756 -0
  35. package/dist/auth-profiles.runtime-HONFDgiu.js +111 -0
  36. package/dist/bluebubbles-BY8JhO4y.js +64 -0
  37. package/dist/bluebubbles-CQjEnzK_.d.ts +6 -0
  38. package/dist/bluebubbles-RmcKgkBa.d.ts +45 -0
  39. package/dist/boolean-param-F1sMwnPu.d.ts +5 -0
  40. package/dist/bot-BGh-ATV7.d.ts +478 -0
  41. package/dist/brave-CljenznH.js +24 -0
  42. package/dist/browser-cli-CX8i0wf0.js +1492 -0
  43. package/dist/build-info.json +3 -3
  44. package/dist/bundled/boot-md/handler.d.ts +6 -0
  45. package/dist/bundled/boot-md/handler.js +26 -26
  46. package/dist/bundled/bootstrap-extra-files/handler.d.ts +6 -0
  47. package/dist/bundled/command-logger/handler.d.ts +9 -0
  48. package/dist/bundled/session-memory/handler.d.ts +9 -0
  49. package/dist/bundled/session-memory/handler.js +27 -27
  50. package/dist/call-Bc257L16.js +37 -0
  51. package/dist/call-DYFR7oGy.js +639 -0
  52. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  53. package/dist/channel-Bd-igGEW.js +803 -0
  54. package/dist/channel-BgRMb6bZ.js +575 -0
  55. package/dist/channel-BtcLrU6J.js +1598 -0
  56. package/dist/channel-Bwf6m_hD.js +538 -0
  57. package/dist/channel-C7-kgDBd.js +562 -0
  58. package/dist/channel-CEXOAxIc.js +949 -0
  59. package/dist/channel-CpZ3p9MJ.js +226 -0
  60. package/dist/channel-CqBlN6A2.js +619 -0
  61. package/dist/channel-DKhfHW4U.js +352 -0
  62. package/dist/channel-DS3t_KdJ2.js +316 -0
  63. package/dist/channel-DY24FA1v.js +4681 -0
  64. package/dist/channel-DYFGmImJ.js +542 -0
  65. package/dist/channel-DcyIqX5p.js +207 -0
  66. package/dist/channel-J-2XcAli.js +214 -0
  67. package/dist/channel-N616f4gZ.js +306 -0
  68. package/dist/channel-NY7aU2Gj.js +397 -0
  69. package/dist/channel-PNI8BOmm.js +1321 -0
  70. package/dist/channel-UcXepDJs.js +943 -0
  71. package/dist/channel-account-context-CL3hEq1j.js +103 -0
  72. package/dist/channel-config-schema-Q2nzcCCR.d.ts +1 -0
  73. package/dist/channel-jA_jodJo.js +920 -0
  74. package/dist/channel-options-CtgU5qkG.js +50 -0
  75. package/dist/channel-policy-7wXDp6d3.d.ts +1 -0
  76. package/dist/channel-rGI8uig4.js +497 -0
  77. package/dist/channel-summary-DGJZXo0r.js +106 -0
  78. package/dist/channel.runtime--WZvlNJM.js +413 -0
  79. package/dist/channel.runtime-B0ct42DL.js +122 -0
  80. package/dist/channel.runtime-BEZUZrYB.js +177 -0
  81. package/dist/channel.runtime-BMuWmsIC.js +166 -0
  82. package/dist/channel.runtime-BtvHP0po.js +4006 -0
  83. package/dist/channel.runtime-Cwf993pX.js +194 -0
  84. package/dist/channel.runtime-Cy4lEpTX.js +174 -0
  85. package/dist/channel.runtime-DAz6axda.js +865 -0
  86. package/dist/channel.runtime-DdQ2mOVh.js +236 -0
  87. package/dist/channel.runtime-Dy3HPgOU.js +399 -0
  88. package/dist/channel.runtime-iqfC25k7.js +213 -0
  89. package/dist/channel.setup-B4VYMZlQ.js +9 -0
  90. package/dist/channel.setup-BohGbCbI.js +57 -0
  91. package/dist/channel.setup-Bq2AQqqc.js +6 -0
  92. package/dist/channel.setup-BxiSfLp1.js +8 -0
  93. package/dist/channel.setup-DOUS6fjO.js +8 -0
  94. package/dist/channel.setup-DXhdYU3g.js +9 -0
  95. package/dist/channel.setup-N51CgfNy.js +11 -0
  96. package/dist/channels/plugins/actions/discord.d.ts +3 -0
  97. package/dist/channels/plugins/actions/discord.js +26 -26
  98. package/dist/channels/plugins/actions/signal.d.ts +2 -0
  99. package/dist/channels/plugins/actions/signal.js +26 -26
  100. package/dist/channels/plugins/actions/telegram.d.ts +3 -0
  101. package/dist/channels/plugins/actions/telegram.js +26 -26
  102. package/dist/channels/plugins/agent-tools/whatsapp-login.d.ts +4 -0
  103. package/dist/channels/plugins/agent-tools/whatsapp-login.js +26 -26
  104. package/dist/channels-CueeFf0q.js +404 -0
  105. package/dist/channels-PheAd73E.js +1113 -0
  106. package/dist/channels-cli-CXzVF84v.js +286 -0
  107. package/dist/channels-status-issues-BjWBQHhU.js +16 -0
  108. package/dist/chat-type-BlSN0vo4.d.ts +5 -0
  109. package/dist/clawbot-cli-BBehDXW1.js +113 -0
  110. package/dist/cli/daemon-cli.d.ts +58 -0
  111. package/dist/cli/daemon-cli.js +1 -1
  112. package/dist/cli-CIm7d5Id.js +149 -0
  113. package/dist/command-format-pq3tS8t2.d.ts +4 -0
  114. package/dist/command-registry-CDkp__KH.js +13 -0
  115. package/dist/command-registry-DSEkUBW1.js +212 -0
  116. package/dist/command-secret-gateway-CqP_o0n8.js +106 -0
  117. package/dist/compact.runtime-Qm_csEtG.js +111 -0
  118. package/dist/completion-cli-Ch1sgSLQ.js +445 -0
  119. package/dist/completion-cli-vF067Tso.js +16 -0
  120. package/dist/config-B2W1zTP1.js +44 -0
  121. package/dist/config-CMhKplgO.js +938 -0
  122. package/dist/config-DchtRsvs.js +30 -0
  123. package/dist/config-cli-C41d88_c.js +428 -0
  124. package/dist/config-guard-B_vjkXCQ.js +117 -0
  125. package/dist/config-schema-pPBCF4hz.js +31 -0
  126. package/dist/config-validation-6om9cBUx.js +262 -0
  127. package/dist/config-value-Dl3XEpA6.js +132 -0
  128. package/dist/configure-BxzvDSzu.js +1100 -0
  129. package/dist/configure-CLMLoWAn.js +238 -0
  130. package/dist/control-ui-shared-E8Nz6uKZ.js +29 -0
  131. package/dist/core-Cd3fMFKq.d.ts +87 -0
  132. package/dist/credentials-yYt6VWCq.js +268 -0
  133. package/dist/cron-cli-CA3lV3kh.js +634 -0
  134. package/dist/daemon-cli-BtQuIXEk.js +339 -0
  135. package/dist/daemon-install-BWKGzgMm.js +175 -0
  136. package/dist/deliver-CgMNmfTy.js +106 -0
  137. package/dist/deliver-runtime-Bn1KWoiQ.js +106 -0
  138. package/dist/devices-cli-D601npiL.js +340 -0
  139. package/dist/diagnostic-CkiYEGqt.js +310 -0
  140. package/dist/diffs-B5tZ8Coj.d.ts +1 -0
  141. package/dist/directory-cli-skEV8MT7.js +306 -0
  142. package/dist/directory-config-helpers-B-tiBKIv.d.ts +38 -0
  143. package/dist/directory-runtime-BEJ2fCIR.d.ts +1 -0
  144. package/dist/directory.static-CnyzoWbV.js +44 -0
  145. package/dist/discord-B_gbzPti.js +109 -0
  146. package/dist/discovery-CqI-e_Mv.js +48 -0
  147. package/dist/dm-policy-shared-nybkS1uP.d.ts +95 -0
  148. package/dist/dns-cli-Cjes3Ruw.js +216 -0
  149. package/dist/docs-cli-C3g3Gi_d.js +173 -0
  150. package/dist/doctor-completion-TvgV4SZH.js +90 -0
  151. package/dist/doctor-config-flow-0w9Ux7V8.js +107 -0
  152. package/dist/doctor-config-flow-DLzr8W7Y.js +2437 -0
  153. package/dist/enable-VYzv8b2z.js +24 -0
  154. package/dist/entry.d.ts +7 -0
  155. package/dist/entry.js +1 -1
  156. package/dist/env-overrides-DYVIkuvN.js +434 -0
  157. package/dist/env-overrides.runtime-6kijpIuu.js +17 -0
  158. package/dist/exec-approvals-cli-D_lkTG-l.js +419 -0
  159. package/dist/exec-sVmouhA9.d.ts +39 -0
  160. package/dist/extensions/acpx/index.d.ts +11 -0
  161. package/dist/extensions/acpx/index.js +1 -1
  162. package/dist/extensions/amazon-bedrock/index.d.ts +11 -0
  163. package/dist/extensions/anthropic/index.d.ts +11 -0
  164. package/dist/extensions/anthropic/index.js +26 -26
  165. package/dist/extensions/bluebubbles/index.d.ts +11 -0
  166. package/dist/extensions/bluebubbles/index.js +30 -30
  167. package/dist/extensions/bluebubbles/setup-entry.d.ts +59 -0
  168. package/dist/extensions/bluebubbles/setup-entry.js +30 -30
  169. package/dist/extensions/brave/index.d.ts +11 -0
  170. package/dist/extensions/brave/index.js +2 -2
  171. package/dist/extensions/byteplus/index.d.ts +11 -0
  172. package/dist/extensions/byteplus/index.js +26 -26
  173. package/dist/extensions/cloudflare-ai-gateway/index.d.ts +11 -0
  174. package/dist/extensions/cloudflare-ai-gateway/index.js +27 -27
  175. package/dist/extensions/copilot-proxy/index.d.ts +11 -0
  176. package/dist/extensions/device-pair/index.d.ts +12 -0
  177. package/dist/extensions/diagnostics-otel/index.d.ts +11 -0
  178. package/dist/extensions/diffs/index.d.ts +11 -0
  179. package/dist/extensions/discord/index.d.ts +11 -0
  180. package/dist/extensions/discord/index.js +31 -31
  181. package/dist/extensions/discord/setup-entry.d.ts +7 -0
  182. package/dist/extensions/discord/setup-entry.js +29 -29
  183. package/dist/extensions/elevenlabs/index.d.ts +11 -0
  184. package/dist/extensions/elevenlabs/index.js +26 -26
  185. package/dist/extensions/feishu/index.d.ts +229 -0
  186. package/dist/extensions/feishu/index.js +31 -31
  187. package/dist/extensions/feishu/setup-entry.d.ts +9 -0
  188. package/dist/extensions/feishu/setup-entry.js +28 -28
  189. package/dist/extensions/firecrawl/index.d.ts +11 -0
  190. package/dist/extensions/firecrawl/index.js +26 -26
  191. package/dist/extensions/github-copilot/index.d.ts +11 -0
  192. package/dist/extensions/github-copilot/index.js +27 -27
  193. package/dist/extensions/google/index.d.ts +11 -0
  194. package/dist/extensions/google/index.js +26 -26
  195. package/dist/extensions/googlechat/index.d.ts +11 -0
  196. package/dist/extensions/googlechat/index.js +30 -30
  197. package/dist/extensions/googlechat/setup-entry.d.ts +19 -0
  198. package/dist/extensions/googlechat/setup-entry.js +30 -30
  199. package/dist/extensions/huggingface/index.d.ts +11 -0
  200. package/dist/extensions/huggingface/index.js +26 -26
  201. package/dist/extensions/imessage/index.d.ts +11 -0
  202. package/dist/extensions/imessage/index.js +30 -30
  203. package/dist/extensions/imessage/setup-entry.d.ts +7 -0
  204. package/dist/extensions/imessage/setup-entry.js +30 -30
  205. package/dist/extensions/irc/index.d.ts +11 -0
  206. package/dist/extensions/irc/index.js +29 -29
  207. package/dist/extensions/irc/setup-entry.d.ts +8 -0
  208. package/dist/extensions/irc/setup-entry.js +29 -29
  209. package/dist/extensions/kakao-talkchannel/index.d.ts +19 -0
  210. package/dist/extensions/kakao-talkchannel/index.js +1762 -0
  211. package/dist/extensions/kakao-talkchannel/moldclaw.plugin.json +111 -0
  212. package/dist/extensions/kakao-talkchannel/package.json +12 -0
  213. package/dist/extensions/kilocode/index.d.ts +11 -0
  214. package/dist/extensions/kilocode/index.js +26 -26
  215. package/dist/extensions/kimi-coding/index.d.ts +11 -0
  216. package/dist/extensions/kimi-coding/index.js +26 -26
  217. package/dist/extensions/line/index.d.ts +11 -0
  218. package/dist/extensions/line/index.js +28 -28
  219. package/dist/extensions/line/setup-entry.d.ts +7 -0
  220. package/dist/extensions/line/setup-entry.js +28 -28
  221. package/dist/extensions/llm-task/index.d.ts +11 -0
  222. package/dist/extensions/llm-task/index.js +28 -28
  223. package/dist/extensions/lobster/index.d.ts +11 -0
  224. package/dist/extensions/matrix/index.d.ts +11 -0
  225. package/dist/extensions/matrix/index.js +31 -31
  226. package/dist/extensions/matrix/setup-entry.d.ts +20 -0
  227. package/dist/extensions/matrix/setup-entry.js +31 -31
  228. package/dist/extensions/mattermost/index.d.ts +11 -0
  229. package/dist/extensions/mattermost/index.js +28 -28
  230. package/dist/extensions/mattermost/setup-entry.d.ts +88 -0
  231. package/dist/extensions/mattermost/setup-entry.js +28 -28
  232. package/dist/extensions/memory-core/index.d.ts +11 -0
  233. package/dist/extensions/memory-lancedb/index.d.ts +25 -0
  234. package/dist/extensions/microsoft/index.d.ts +11 -0
  235. package/dist/extensions/microsoft/index.js +26 -26
  236. package/dist/extensions/minimax/index.d.ts +11 -0
  237. package/dist/extensions/minimax/index.js +26 -26
  238. package/dist/extensions/mistral/index.d.ts +11 -0
  239. package/dist/extensions/mistral/index.js +26 -26
  240. package/dist/extensions/modelstudio/index.d.ts +11 -0
  241. package/dist/extensions/modelstudio/index.js +26 -26
  242. package/dist/extensions/moonshot/index.d.ts +11 -0
  243. package/dist/extensions/moonshot/index.js +26 -26
  244. package/dist/extensions/msteams/index.d.ts +11 -0
  245. package/dist/extensions/msteams/index.js +31 -31
  246. package/dist/extensions/msteams/setup-entry.d.ts +11 -0
  247. package/dist/extensions/msteams/setup-entry.js +31 -31
  248. package/dist/extensions/nextcloud-talk/index.d.ts +11 -0
  249. package/dist/extensions/nextcloud-talk/index.js +28 -28
  250. package/dist/extensions/nextcloud-talk/setup-entry.d.ts +60 -0
  251. package/dist/extensions/nextcloud-talk/setup-entry.js +28 -28
  252. package/dist/extensions/nostr/index.d.ts +11 -0
  253. package/dist/extensions/nostr/index.js +28 -28
  254. package/dist/extensions/nostr/setup-entry.d.ts +49 -0
  255. package/dist/extensions/nostr/setup-entry.js +28 -28
  256. package/dist/extensions/nvidia/index.d.ts +11 -0
  257. package/dist/extensions/ollama/index.d.ts +11 -0
  258. package/dist/extensions/open-prose/index.d.ts +11 -0
  259. package/dist/extensions/openai/index.d.ts +11 -0
  260. package/dist/extensions/openai/index.js +26 -26
  261. package/dist/extensions/opencode/index.d.ts +11 -0
  262. package/dist/extensions/opencode/index.js +26 -26
  263. package/dist/extensions/opencode-go/index.d.ts +11 -0
  264. package/dist/extensions/opencode-go/index.js +26 -26
  265. package/dist/extensions/openrouter/index.d.ts +11 -0
  266. package/dist/extensions/openrouter/index.js +26 -26
  267. package/dist/extensions/openshell/index.d.ts +11 -0
  268. package/dist/extensions/openshell/index.js +26 -26
  269. package/dist/extensions/perplexity/index.d.ts +11 -0
  270. package/dist/extensions/perplexity/index.js +2 -2
  271. package/dist/extensions/phone-control/index.d.ts +12 -0
  272. package/dist/extensions/qianfan/index.d.ts +11 -0
  273. package/dist/extensions/qianfan/index.js +26 -26
  274. package/dist/extensions/qwen-portal-auth/index.d.ts +12 -0
  275. package/dist/extensions/qwen-portal-auth/index.js +26 -26
  276. package/dist/extensions/sglang/index.d.ts +11 -0
  277. package/dist/extensions/sglang/index.js +26 -26
  278. package/dist/extensions/signal/index.d.ts +11 -0
  279. package/dist/extensions/signal/index.js +29 -29
  280. package/dist/extensions/signal/setup-entry.d.ts +7 -0
  281. package/dist/extensions/signal/setup-entry.js +29 -29
  282. package/dist/extensions/slack/index.d.ts +11 -0
  283. package/dist/extensions/slack/index.js +30 -30
  284. package/dist/extensions/slack/setup-entry.d.ts +7 -0
  285. package/dist/extensions/slack/setup-entry.js +29 -29
  286. package/dist/extensions/synology-chat/index.d.ts +11 -0
  287. package/dist/extensions/synology-chat/index.js +28 -28
  288. package/dist/extensions/synology-chat/setup-entry.d.ts +138 -0
  289. package/dist/extensions/synology-chat/setup-entry.js +28 -28
  290. package/dist/extensions/synthetic/index.d.ts +11 -0
  291. package/dist/extensions/synthetic/index.js +26 -26
  292. package/dist/extensions/talk-voice/index.d.ts +12 -0
  293. package/dist/extensions/talk-voice/index.js +26 -26
  294. package/dist/extensions/telegram/index.d.ts +11 -0
  295. package/dist/extensions/telegram/index.js +29 -29
  296. package/dist/extensions/telegram/setup-entry.d.ts +7 -0
  297. package/dist/extensions/telegram/setup-entry.js +28 -28
  298. package/dist/extensions/thread-ownership/index.d.ts +12 -0
  299. package/dist/extensions/tlon/index.d.ts +11 -0
  300. package/dist/extensions/tlon/index.js +28 -28
  301. package/dist/extensions/tlon/setup-entry.d.ts +7 -0
  302. package/dist/extensions/tlon/setup-entry.js +28 -28
  303. package/dist/extensions/together/index.d.ts +11 -0
  304. package/dist/extensions/together/index.js +26 -26
  305. package/dist/extensions/twitch/index.d.ts +39 -0
  306. package/dist/extensions/twitch/index.js +28 -28
  307. package/dist/extensions/venice/index.d.ts +11 -0
  308. package/dist/extensions/venice/index.js +26 -26
  309. package/dist/extensions/vercel-ai-gateway/index.d.ts +11 -0
  310. package/dist/extensions/vercel-ai-gateway/index.js +26 -26
  311. package/dist/extensions/vllm/index.d.ts +11 -0
  312. package/dist/extensions/vllm/index.js +26 -26
  313. package/dist/extensions/voice-call/index.d.ts +11 -0
  314. package/dist/extensions/voice-call/index.js +26 -26
  315. package/dist/extensions/volcengine/index.d.ts +11 -0
  316. package/dist/extensions/volcengine/index.js +26 -26
  317. package/dist/extensions/whatsapp/index.d.ts +11 -0
  318. package/dist/extensions/whatsapp/index.js +29 -29
  319. package/dist/extensions/whatsapp/setup-entry.d.ts +7 -0
  320. package/dist/extensions/whatsapp/setup-entry.js +29 -29
  321. package/dist/extensions/xai/index.d.ts +11 -0
  322. package/dist/extensions/xai/index.js +26 -26
  323. package/dist/extensions/xiaomi/index.d.ts +11 -0
  324. package/dist/extensions/xiaomi/index.js +26 -26
  325. package/dist/extensions/zai/index.d.ts +11 -0
  326. package/dist/extensions/zai/index.js +26 -26
  327. package/dist/extensions/zalo/index.d.ts +11 -0
  328. package/dist/extensions/zalo/index.js +30 -30
  329. package/dist/extensions/zalo/setup-entry.d.ts +34 -0
  330. package/dist/extensions/zalo/setup-entry.js +30 -30
  331. package/dist/extensions/zalouser/index.d.ts +11 -0
  332. package/dist/extensions/zalouser/index.js +31 -31
  333. package/dist/extensions/zalouser/setup-entry.d.ts +42 -0
  334. package/dist/extensions/zalouser/setup-entry.js +31 -31
  335. package/dist/feishu-DCKEC3ao.d.ts +36 -0
  336. package/dist/gateway-cli-DN1Ii6J-.js +26432 -0
  337. package/dist/gateway-install-token-CJYFJBaC.js +163 -0
  338. package/dist/gateway-rpc-CroQg9MB.js +26 -0
  339. package/dist/gateway-runtime-D9FRZqKP.js +69 -0
  340. package/dist/googlechat-CBCkerAy.js +307 -0
  341. package/dist/googlechat-CSUNieHX.d.ts +12 -0
  342. package/dist/group-access-rSvkIglb.d.ts +61 -0
  343. package/dist/health-B6WwLJp4.js +570 -0
  344. package/dist/health-CAlJydXv.js +108 -0
  345. package/dist/history-BwNxb0sJ.d.ts +75 -0
  346. package/dist/hooks-BYlfU3Nf.d.ts +6 -0
  347. package/dist/hooks-cli-DuKmdo_H.js +995 -0
  348. package/dist/http-registry-DX_LVtuK.d.ts +20 -0
  349. package/dist/image-generation-DKkdRpve.d.ts +9 -0
  350. package/dist/imessage-7abjbe2Q.js +31 -0
  351. package/dist/imessage-DOH1yaDE.js +110 -0
  352. package/dist/inbound-envelope-CmvweL6U.d.ts +78 -0
  353. package/dist/inbound-reply-dispatch-BvnKTOec.js +71 -0
  354. package/dist/inbound-reply-dispatch-C7LjHRZN.d.ts +72 -0
  355. package/dist/index-DTQqfqj9.d.ts +1 -0
  356. package/dist/index.d.ts +27 -0
  357. package/dist/index.js +2 -2
  358. package/dist/infra/warning-filter.d.ts +10 -0
  359. package/dist/install-target-tXRD7VkM.js +574 -0
  360. package/dist/installs-C8fz8sm3.js +532 -0
  361. package/dist/io-C6XifaT4.js +9737 -0
  362. package/dist/io-C8awRnSW.js +28 -0
  363. package/dist/ipv4-d88_Jn2p.js +82 -0
  364. package/dist/irc-DpR6FXjN.js +672 -0
  365. package/dist/json-store-Sr_kk-II.d.ts +14 -0
  366. package/dist/keyed-async-queue-BA3BKukE.d.ts +19 -0
  367. package/dist/library-DOwowAGN.js +107 -0
  368. package/dist/lifecycle-core-BHHBoRTY.js +382 -0
  369. package/dist/line/accounts.d.ts +3 -0
  370. package/dist/line/send.d.ts +2 -0
  371. package/dist/line/send.js +4 -4
  372. package/dist/line/template-messages.d.ts +2 -0
  373. package/dist/line-8rsNbJCP.js +530 -0
  374. package/dist/line-D_cvIf6B.d.ts +75 -0
  375. package/dist/links-BOnvOj1z.d.ts +7 -0
  376. package/dist/llm-slug-generator-D9HjWtJT.js +67 -0
  377. package/dist/llm-slug-generator.d.ts +12 -0
  378. package/dist/llm-slug-generator.js +27 -27
  379. package/dist/logging-BhqLWxTD.js +13 -0
  380. package/dist/logging-DfaiL4OX.js +29 -0
  381. package/dist/login-qr-COBYR52w.js +233 -0
  382. package/dist/login-qr-xK4QIpPc.js +107 -0
  383. package/dist/logs-cli-RSSTw8L_.js +254 -0
  384. package/dist/manager-runtime-DL6JoSj9.js +106 -0
  385. package/dist/manager.runtime-Cbyhg1vB.js +710 -0
  386. package/dist/markdown-to-line-BTlEkOls.d.ts +91 -0
  387. package/dist/matrix-DX-jaB88.js +1490 -0
  388. package/dist/matrix-H6Yyj1QZ.d.ts +68 -0
  389. package/dist/matrix-J8s45tRw.js +1269 -0
  390. package/dist/mattermost-D75n6bRI.d.ts +6 -0
  391. package/dist/mcp-cli-CLc3_yCO.js +86 -0
  392. package/dist/media-understanding.runtime-BI0Lljbl.js +111 -0
  393. package/dist/memory-cli-CTp2cYrf.js +106 -0
  394. package/dist/method-scopes-Du8ODGFW.js +2586 -0
  395. package/dist/model-auth-markers-DEDakSUW.d.ts +20 -0
  396. package/dist/model-picker-CDBs7LJF.js +390 -0
  397. package/dist/model-picker-CRix4Wwv.js +107 -0
  398. package/dist/model-picker.runtime-CITyy3Rn.js +120 -0
  399. package/dist/model-suppression.runtime-Ce7D6QUT.js +111 -0
  400. package/dist/models-BK1eanuP.js +113 -0
  401. package/dist/models-X4Czy3uE.js +2514 -0
  402. package/dist/models-cli-C79Ulviy.js +304 -0
  403. package/dist/models-config-DALlu3S9.js +106 -0
  404. package/dist/models-config.providers.discovery-CSJ1STM1.d.ts +18 -0
  405. package/dist/monitor-B45a_RpX.js +3468 -0
  406. package/dist/monitor-C8KbJ-i0.js +767 -0
  407. package/dist/monitor-CIhrvegZ.js +3076 -0
  408. package/dist/monitor-CQut7klP.js +6823 -0
  409. package/dist/monitor-DZb5IJle.js +777 -0
  410. package/dist/monitor-DaFkdD27.js +108 -0
  411. package/dist/monitor-Do9Tp2Ii.js +110 -0
  412. package/dist/monitor-shared-CMK9cDOb.js +444 -0
  413. package/dist/msteams-A6H_wv5F.js +852 -0
  414. package/dist/net-DpMJgN-o.d.ts +19 -0
  415. package/dist/nextcloud-talk-f1pZ5Bge.d.ts +1 -0
  416. package/dist/node-cli-BXnmsjzL.js +2498 -0
  417. package/dist/node-resolve-CupmrA0Y.js +835 -0
  418. package/dist/nodes-cli-DZVrah_8.js +1375 -0
  419. package/dist/nostr-DMV534Ks.d.ts +7 -0
  420. package/dist/nostr-SAk3tjtR.js +8744 -0
  421. package/dist/npm-resolution-Dr9wssCY.js +60 -0
  422. package/dist/oauth-utils-DnyXdWU9.d.ts +10 -0
  423. package/dist/onboard-BE5pmb1g.js +589 -0
  424. package/dist/onboard-channels-3hNVY0E7.js +1241 -0
  425. package/dist/onboard-channels-vaO3nWLL.js +200 -0
  426. package/dist/onboard-custom-CI5uFyWH.js +571 -0
  427. package/dist/onboard-custom-eIvRswgv.js +109 -0
  428. package/dist/onboard-helpers-ChMWfUnl.js +335 -0
  429. package/dist/onboard-helpers-DRFi9oaD.js +108 -0
  430. package/dist/onboard-remote-BTspTgA4.js +112 -0
  431. package/dist/onboard-remote-so38yXlX.js +181 -0
  432. package/dist/onboard-search-DS0tZS24.js +297 -0
  433. package/dist/onboard-skills-B9DxCCiU.js +133 -0
  434. package/dist/onboard-skills-so0a_BJV.js +112 -0
  435. package/dist/outbound-media-BiJscGlR.js +11 -0
  436. package/dist/outbound-media-DJF-TuJu.d.ts +11 -0
  437. package/dist/pairing-access-CuiJP9xN.d.ts +21 -0
  438. package/dist/pairing-cli-DN0u1Cez.js +212 -0
  439. package/dist/parse-finite-number-B3FJTjyQ.d.ts +5 -0
  440. package/dist/perplexity-Bw1u3CAF.js +24 -0
  441. package/dist/persistent-dedupe-DR5Ka6BX.d.ts +26 -0
  442. package/dist/pi-model-discovery-runtime-iwKNCaYu.js +106 -0
  443. package/dist/pi-tools.before-tool-call.runtime-BM_N-JZe.js +380 -0
  444. package/dist/plugin-install--KVul05Z.js +184 -0
  445. package/dist/plugin-install-DVpPsLkS.js +112 -0
  446. package/dist/plugin-install-plan-Dwc6-coz.js +49 -0
  447. package/dist/plugin-registry-XRswugE9.js +108 -0
  448. package/dist/plugin-registry-jozQafRo.js +49 -0
  449. package/dist/plugin-sdk/account-resolution.js +26 -26
  450. package/dist/plugin-sdk/acp-runtime.js +26 -26
  451. package/dist/plugin-sdk/acpx.js +1 -1
  452. package/dist/plugin-sdk/agent-runtime.js +26 -26
  453. package/dist/plugin-sdk/bluebubbles.js +29 -29
  454. package/dist/plugin-sdk/channel-config-helpers.js +26 -26
  455. package/dist/plugin-sdk/channel-config-schema.js +2 -2
  456. package/dist/plugin-sdk/channel-policy.js +26 -26
  457. package/dist/plugin-sdk/channel-runtime.js +26 -26
  458. package/dist/plugin-sdk/compat.js +27 -27
  459. package/dist/plugin-sdk/config-runtime.js +28 -28
  460. package/dist/plugin-sdk/conversation-runtime.js +26 -26
  461. package/dist/plugin-sdk/discord.js +26 -26
  462. package/dist/plugin-sdk/feishu.js +27 -27
  463. package/dist/plugin-sdk/gateway-runtime.js +8 -8
  464. package/dist/plugin-sdk/googlechat.js +29 -29
  465. package/dist/plugin-sdk/image-generation-runtime.js +26 -26
  466. package/dist/plugin-sdk/image-generation.js +26 -26
  467. package/dist/plugin-sdk/imessage.js +27 -27
  468. package/dist/plugin-sdk/index.js +26 -26
  469. package/dist/plugin-sdk/infra-runtime.js +26 -26
  470. package/dist/plugin-sdk/irc.js +29 -29
  471. package/dist/plugin-sdk/line.js +27 -27
  472. package/dist/plugin-sdk/llm-task.js +26 -26
  473. package/dist/plugin-sdk/matrix.js +29 -29
  474. package/dist/plugin-sdk/mattermost.js +28 -28
  475. package/dist/plugin-sdk/media-runtime.js +26 -26
  476. package/dist/plugin-sdk/media-understanding-runtime.js +26 -26
  477. package/dist/plugin-sdk/media-understanding.js +26 -26
  478. package/dist/plugin-sdk/msteams.js +30 -30
  479. package/dist/plugin-sdk/nextcloud-talk.js +28 -28
  480. package/dist/plugin-sdk/nostr.js +27 -27
  481. package/dist/plugin-sdk/plugin-runtime.js +26 -26
  482. package/dist/plugin-sdk/provider-auth.js +28 -28
  483. package/dist/plugin-sdk/provider-setup.js +27 -27
  484. package/dist/plugin-sdk/provider-web-search.js +1 -1
  485. package/dist/plugin-sdk/qwen-portal-auth.js +26 -26
  486. package/dist/plugin-sdk/reply-history.js +26 -26
  487. package/dist/plugin-sdk/reply-runtime.js +26 -26
  488. package/dist/plugin-sdk/sandbox.js +26 -26
  489. package/dist/plugin-sdk/security-runtime.js +26 -26
  490. package/dist/plugin-sdk/self-hosted-provider-setup.js +27 -27
  491. package/dist/plugin-sdk/setup.js +27 -27
  492. package/dist/plugin-sdk/signal.js +26 -26
  493. package/dist/plugin-sdk/slack.js +26 -26
  494. package/dist/plugin-sdk/speech-runtime.js +26 -26
  495. package/dist/plugin-sdk/speech.js +26 -26
  496. package/dist/plugin-sdk/src/channels/plugins/setup-wizard-helpers.d.ts +3 -0
  497. package/dist/plugin-sdk/src/config/config-lock.d.ts +38 -0
  498. package/dist/plugin-sdk/src/config/config.d.ts +1 -1
  499. package/dist/plugin-sdk/src/config/io.d.ts +39 -0
  500. package/dist/plugin-sdk/src/config/types.gateway.d.ts +12 -0
  501. package/dist/plugin-sdk/src/config/types.secrets.d.ts +10 -0
  502. package/dist/plugin-sdk/src/config/zod-schema.d.ts +2 -0
  503. package/dist/plugin-sdk/src/gateway/credential-planner.d.ts +3 -1
  504. package/dist/plugin-sdk/src/secrets/provider-env-vars.d.ts +61 -0
  505. package/dist/plugin-sdk/src/secrets/sec1-placeholder.d.ts +181 -0
  506. package/dist/plugin-sdk/src/secrets/sec1-utils.d.ts +57 -0
  507. package/dist/plugin-sdk/synology-chat.js +27 -27
  508. package/dist/plugin-sdk/telegram.js +26 -26
  509. package/dist/plugin-sdk/text-runtime.js +4 -4
  510. package/dist/plugin-sdk/tlon.js +27 -27
  511. package/dist/plugin-sdk/twitch.js +26 -26
  512. package/dist/plugin-sdk/voice-call.js +26 -26
  513. package/dist/plugin-sdk/whatsapp.js +26 -26
  514. package/dist/plugin-sdk/zalo.js +30 -30
  515. package/dist/plugin-sdk/zalouser.js +29 -29
  516. package/dist/plugins/runtime/index.d.ts +22 -0
  517. package/dist/plugins/runtime/index.js +26 -26
  518. package/dist/plugins-C4PiDdjc.js +106 -0
  519. package/dist/plugins-cli-zhmliYNU.js +912 -0
  520. package/dist/policy-CcSolumc.js +143 -0
  521. package/dist/preflight-audio.runtime-BAbfqqzW.js +111 -0
  522. package/dist/probe-Bgt5c-cr.js +129 -0
  523. package/dist/probe-CPk5iGcg.js +47 -0
  524. package/dist/probe-DR4KRKXz.js +19 -0
  525. package/dist/probe-DnoCyJ_m.js +1793 -0
  526. package/dist/probe-VsLtK3vQ.js +6328 -0
  527. package/dist/probe-auth-BnsKrQt7.js +38 -0
  528. package/dist/probe-auth-DYdUG8l1.js +48 -0
  529. package/dist/program-8enYYBsc.js +247 -0
  530. package/dist/prompt-select-styled-DxBcUasv.js +2673 -0
  531. package/dist/provider-api-key-auth.runtime-DsLZyt6h.js +116 -0
  532. package/dist/provider-auth-choice-30EvRxqc.js +126 -0
  533. package/dist/provider-auth-choice-preference-DMr1WmRg.js +189 -0
  534. package/dist/provider-auth-choice.runtime-CI98BgQF.js +118 -0
  535. package/dist/provider-auth-guidance-WKDIi_wk.js +34 -0
  536. package/dist/provider-auth-result-Cs8wguSI.d.ts +18 -0
  537. package/dist/provider-models-EOys_Nvi.d.ts +867 -0
  538. package/dist/provider-ollama-setup-D89zlm9C.d.ts +32 -0
  539. package/dist/provider-onboard-BzOpgCLu.d.ts +40 -0
  540. package/dist/provider-runtime.runtime-Cm4as2KG.js +106 -0
  541. package/dist/provider-self-hosted-setup-Bmv_AQmw.d.ts +61 -0
  542. package/dist/provider-self-hosted-setup-CJwFVVB4.js +182 -0
  543. package/dist/provider-usage-CVNyLLDb.js +106 -0
  544. package/dist/provider-usage.types-CdTymHNu.d.ts +16 -0
  545. package/dist/provider-web-search-BJhXD5dH.js +2392 -0
  546. package/dist/provider-wizard-DMMYXjlW.js +152 -0
  547. package/dist/push-apns-BnWTdTEk.js +1038 -0
  548. package/dist/pw-ai-CtK_7Cy2.js +1866 -0
  549. package/dist/qr-cli-CA-BF0--.js +108 -0
  550. package/dist/qr-cli-D18HiUkh.js +369 -0
  551. package/dist/reactions-Df7XG8Uh.js +281 -0
  552. package/dist/read-only-account-inspect.discord.runtime-B-FP0mwb.js +111 -0
  553. package/dist/read-only-account-inspect.slack.runtime-DkWZ2ccW.js +111 -0
  554. package/dist/read-only-account-inspect.telegram.runtime-BnlTkn_e.js +111 -0
  555. package/dist/redact-snapshot-DVdstBvO.js +2661 -0
  556. package/dist/ref-contract-RPkB754Q.js +53 -0
  557. package/dist/register.agent-DVAxXQKW.js +434 -0
  558. package/dist/register.backup-CUuL5KUZ.js +624 -0
  559. package/dist/register.configure-bC0UEwfU.js +247 -0
  560. package/dist/register.maintenance-iIqvl_eT.js +569 -0
  561. package/dist/register.message-CEDd4z07.js +704 -0
  562. package/dist/register.onboard-Cejfnysy.js +187 -0
  563. package/dist/register.setup-DU7uHdYt.js +207 -0
  564. package/dist/register.status-health-sessions-BWphMXNR.js +493 -0
  565. package/dist/register.subclis-DnIweTEG.js +315 -0
  566. package/dist/register.subclis-gJX_Pbub.js +12 -0
  567. package/dist/registry-Dgwc-7eS.js +1183 -0
  568. package/dist/replies-D9PEZ8yn.js +110 -0
  569. package/dist/reply-history-lHgoC4l3.d.ts +1 -0
  570. package/dist/reply-payload-Bd2HuR4g.d.ts +46 -0
  571. package/dist/request-url-BcSJaiiu.d.ts +5 -0
  572. package/dist/resolve-BbsCHGLY.js +660 -0
  573. package/dist/resolve-channels-BtrGC95o.js +262 -0
  574. package/dist/resolve-channels-C1SthO1N.js +226 -0
  575. package/dist/resolve-users-CgSxHrU0.js +143 -0
  576. package/dist/routes-BZtqNrBf.js +7097 -0
  577. package/dist/rpc-D3KMxG4J.js +67 -0
  578. package/dist/run-command-C8b3dCZV.d.ts +16 -0
  579. package/dist/run-main-BlWJVotF.js +423 -0
  580. package/dist/runtime-RWGbO5Qy.d.ts +26 -0
  581. package/dist/runtime-discord-ops.runtime-DUXIYvQr.js +9073 -0
  582. package/dist/runtime-slack-ops.runtime-n1yFfyp1.js +4551 -0
  583. package/dist/runtime-telegram-ops.runtime-PZUWchjT.js +128 -0
  584. package/dist/runtime-whatsapp-login.runtime-xsuNyvGz.js +109 -0
  585. package/dist/runtime-whatsapp-outbound.runtime-5EfEyCsO.js +112 -0
  586. package/dist/sandbox-cli-Dw1nWNmQ.js +530 -0
  587. package/dist/search-manager-BJoRxOaf.js +15 -0
  588. package/dist/search-manager-DxkQvUrW.js +386 -0
  589. package/dist/secret-input-schema-Cp_La9qv.d.ts +19 -0
  590. package/dist/secrets-cli-BPyV2gSq.js +2065 -0
  591. package/dist/security-cli-EK4sSRfG.js +570 -0
  592. package/dist/send-B01Gvh9m.js +629 -0
  593. package/dist/send-B4L4wRJO.js +100 -0
  594. package/dist/send-BDcGrXt0.js +1025 -0
  595. package/dist/send-BRRtHxyR.js +283 -0
  596. package/dist/send-DU6dmMXW.js +631 -0
  597. package/dist/server-CWw5GFEg.js +106 -0
  598. package/dist/server-node-events-92cDVswC.js +501 -0
  599. package/dist/session-key-DbkfhOjM.d.ts +46 -0
  600. package/dist/sessions-B052uHA3.js +218 -0
  601. package/dist/sessions-Cef4dZNP.js +107 -0
  602. package/dist/setup-BlQPyDPy.js +387 -0
  603. package/dist/setup-DcSZ_pTn.d.ts +37 -0
  604. package/dist/setup-core-B9mdZYnU.js +166 -0
  605. package/dist/setup-core-Cj0sLkpP.js +47 -0
  606. package/dist/setup-core-CkZbebOv.js +143 -0
  607. package/dist/setup-core-MRNjnrJl.js +205 -0
  608. package/dist/setup-surface-3ZY0JtWE.js +490 -0
  609. package/dist/setup-wizard-helpers-Dwzb9Dcz.d.ts +203 -0
  610. package/dist/setup.finalize-B5ETm3Ui.js +517 -0
  611. package/dist/setup.gateway-config-C8hdtlbw.js +338 -0
  612. package/dist/setup.secret-input-BZSIeiqy.js +25 -0
  613. package/dist/shared--9_eQ_lc.js +75 -0
  614. package/dist/shared-CxkH3H0U.js +102 -0
  615. package/dist/shared-DTNL0hA9.js +298 -0
  616. package/dist/shared-HSP1OV-Q.js +96 -0
  617. package/dist/shared-UIjWb_3B.js +182 -0
  618. package/dist/signal-CTI6bSmB.js +109 -0
  619. package/dist/skills-4-r1mfJM.js +853 -0
  620. package/dist/skills-RNm54CBO.js +19 -0
  621. package/dist/skills-cli-te7dSs5p.js +291 -0
  622. package/dist/skills-install-Del-Ogv8.js +763 -0
  623. package/dist/skills-status-BZpoMXrR.js +169 -0
  624. package/dist/skills-status-Dq61Sz8U.js +20 -0
  625. package/dist/slack-oc-viUtl.js +109 -0
  626. package/dist/slash-commands.runtime-NdkD2LZV.js +123 -0
  627. package/dist/slash-dispatch.runtime-DQgeaF3J.js +136 -0
  628. package/dist/slash-skill-commands.runtime-DmOl2DnL.js +111 -0
  629. package/dist/src-0wtt7seR.js +1696 -0
  630. package/dist/status-5oR_gqv_.js +121 -0
  631. package/dist/status-BO8LY0hC.js +1599 -0
  632. package/dist/status-D_oHA9yO.js +126 -0
  633. package/dist/status-IrMacJRj.js +606 -0
  634. package/dist/status-Prdeg53E.js +43 -0
  635. package/dist/status-json-Da0hR-1Z.js +286 -0
  636. package/dist/status.link-channel-BgUJEZAz.js +138 -0
  637. package/dist/status.scan.deps.runtime-D9vHTxOW.js +121 -0
  638. package/dist/status.scan.runtime-D-EdD5CW.js +114 -0
  639. package/dist/status.summary--i6xduWH.js +592 -0
  640. package/dist/status.summary.runtime-BqMXjaBc.js +113 -0
  641. package/dist/subagent-orphan-recovery-DiRJcFQc.js +302 -0
  642. package/dist/subagent-registry-runtime-B66EYEYm.js +106 -0
  643. package/dist/synology-chat-BemXqdzG.js +297 -0
  644. package/dist/system-cli-CSuiia4-.js +92 -0
  645. package/dist/telegram/audit.d.ts +2 -0
  646. package/dist/telegram/audit.js +1 -1
  647. package/dist/telegram/token.d.ts +2 -0
  648. package/dist/telegram/token.js +26 -26
  649. package/dist/telegram-DLFcRv5a.js +109 -0
  650. package/dist/testing-DZrulv-n.d.ts +1755 -0
  651. package/dist/text-chunking-BaYBIUoR.d.ts +79 -0
  652. package/dist/text-chunking-C8kmbNfa.js +84 -0
  653. package/dist/thinking-D8aqmr3o.d.ts +13 -0
  654. package/dist/tlon-Bpr4f3yF.js +433 -0
  655. package/dist/tool-send-BHKm5ztm.d.ts +9 -0
  656. package/dist/tui-BY3QRgC1.js +3834 -0
  657. package/dist/tui-cli-CCfZOlV0.js +132 -0
  658. package/dist/types-CKx5nDZB.d.ts +45 -0
  659. package/dist/types-DBhDdMQd.d.ts +22670 -0
  660. package/dist/types.base-B_TkkSS8.d.ts +188 -0
  661. package/dist/types.secrets-Bojc4omL.js +92 -0
  662. package/dist/ui-1UpZZyI3.js +31 -0
  663. package/dist/update-BR4JvFpV.js +1036 -0
  664. package/dist/update-cli-BZv44lFq.js +1498 -0
  665. package/dist/update-offset-store-DGdBotIW.js +107 -0
  666. package/dist/update-runner-D34sooPe.js +1496 -0
  667. package/dist/vllm-defaults-BCGSJ7K0.d.ts +13 -0
  668. package/dist/wait-BU9vJv22.d.ts +4 -0
  669. package/dist/web-CXpU2D41.js +107 -0
  670. package/dist/web-shared-B4sL45ah.d.ts +45 -0
  671. package/dist/webhook-memory-guards-B7oLVseG.d.ts +43 -0
  672. package/dist/webhook-request-guards-CqIH7equ.d.ts +76 -0
  673. package/dist/webhook-targets-CAAGATtk.js +181 -0
  674. package/dist/webhook-targets-oQ0jd4r0.d.ts +106 -0
  675. package/dist/webhooks-cli-B46t2VT5.js +349 -0
  676. package/dist/whatsapp-Dniwd4Rv.js +109 -0
  677. package/dist/whatsapp-actions-fL46PsNs.js +162 -0
  678. package/dist/windows-spawn-DGeE98SH.d.ts +43 -0
  679. package/dist/workspace-dirs-d3Ms_ryk.js +2002 -0
  680. package/dist/zalo-Csulx0XK.d.ts +9 -0
  681. package/dist/zalo-gh0yAWmS.js +415 -0
  682. package/dist/zalouser-CuxRvztM.js +30911 -0
  683. package/dist/zod-schema.agent-runtime-B4MkB-_3.d.ts +10 -0
  684. package/dist/zod-schema.core-D5reNip6.js +541 -0
  685. package/dist/zod-schema.core-DN3RhEUG.d.ts +173 -0
  686. package/docs/SEC1.md +523 -0
  687. package/docs/SEC1_IMPLEMENTATION/CHANNELS_REPORT.md +173 -0
  688. package/docs/SEC1_IMPLEMENTATION/CORE_UTIL_REPORT.md +139 -0
  689. package/docs/SEC1_IMPLEMENTATION/DOCS_REPORT.md +134 -0
  690. package/docs/SEC1_IMPLEMENTATION/ENV_MAP_DRAFT.md +148 -0
  691. package/docs/SEC1_IMPLEMENTATION/INTEGRATION_REPORT.md +170 -0
  692. package/docs/SEC1_IMPLEMENTATION/PROVIDERS_REPORT.md +291 -0
  693. package/docs/SEC1_IMPLEMENTATION/QA_REPORT.md +249 -0
  694. package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-channels.md +317 -0
  695. package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-docs.md +212 -0
  696. package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave1-security.md +368 -0
  697. package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave2-critic-consolidated.md +195 -0
  698. package/docs/SEC1_IMPLEMENTATION/RECURSIVE_QA/wave3-fix-report.md +105 -0
  699. package/docs/SEC1_IMPLEMENTATION/STRATEGY.md +451 -0
  700. package/docs/SEC1_IMPLEMENTATION/TEST_REPORT.md +156 -0
  701. package/docs/pipeline-sdk/CLI_SPEC.md +609 -0
  702. package/docs/pipeline-sdk/PIPELINE_SDK_DESIGN.md +1372 -0
  703. package/extensions/kakao-talkchannel/MIGRATION_ARCH_ANALYSIS.md +455 -0
  704. package/extensions/kakao-talkchannel/MIGRATION_CODE_ANALYSIS.md +383 -0
  705. package/extensions/kakao-talkchannel/MIGRATION_STRATEGY.md +115 -0
  706. package/extensions/kakao-talkchannel/README.md +50 -0
  707. package/extensions/kakao-talkchannel/index.ts +20 -0
  708. package/extensions/kakao-talkchannel/moldclaw.plugin.json +98 -0
  709. package/extensions/kakao-talkchannel/package.json +12 -0
  710. package/extensions/kakao-talkchannel/src/adapters/config.ts +132 -0
  711. package/extensions/kakao-talkchannel/src/adapters/gateway.ts +974 -0
  712. package/extensions/kakao-talkchannel/src/adapters/outbound.ts +52 -0
  713. package/extensions/kakao-talkchannel/src/adapters/pairing.ts +35 -0
  714. package/extensions/kakao-talkchannel/src/adapters/security.ts +57 -0
  715. package/extensions/kakao-talkchannel/src/adapters/setup.ts +105 -0
  716. package/extensions/kakao-talkchannel/src/adapters/status.ts +117 -0
  717. package/extensions/kakao-talkchannel/src/channel.ts +58 -0
  718. package/extensions/kakao-talkchannel/src/commands/card.ts +413 -0
  719. package/extensions/kakao-talkchannel/src/config/schema.ts +129 -0
  720. package/extensions/kakao-talkchannel/src/kakao/callback.ts +133 -0
  721. package/extensions/kakao-talkchannel/src/kakao/limits.ts +129 -0
  722. package/extensions/kakao-talkchannel/src/kakao/payload.ts +138 -0
  723. package/extensions/kakao-talkchannel/src/kakao/response.ts +373 -0
  724. package/extensions/kakao-talkchannel/src/relay/client.ts +146 -0
  725. package/extensions/kakao-talkchannel/src/relay/session.ts +137 -0
  726. package/extensions/kakao-talkchannel/src/relay/sse.ts +258 -0
  727. package/extensions/kakao-talkchannel/src/relay/stream.ts +149 -0
  728. package/extensions/kakao-talkchannel/src/runtime.ts +21 -0
  729. package/extensions/kakao-talkchannel/src/types.ts +447 -0
  730. package/extensions/kakao-talkchannel/src/version.ts +3 -0
  731. package/extensions/kakao-talkchannel/tsconfig.json +19 -0
  732. package/package.json +23 -8
  733. package/skills/meshy/SKILL.md +69 -0
  734. package/skills/meshy/scripts/__pycache__/check_status.cpython-312.pyc +0 -0
  735. package/skills/meshy/scripts/__pycache__/image_to_3d.cpython-312.pyc +0 -0
  736. package/skills/meshy/scripts/__pycache__/text_to_3d.cpython-312.pyc +0 -0
  737. package/skills/meshy/scripts/check_status.py +147 -0
  738. package/skills/meshy/scripts/image_to_3d.py +229 -0
  739. package/skills/meshy/scripts/text_to_3d.py +214 -0
  740. package/skills/nano-banana-pro/scripts/generate_image.py +1 -1
  741. package/skills/openai-whisper-api/scripts/transcribe.sh +0 -0
  742. package/skills/tavily-search/SKILL.md +61 -0
  743. package/skills/tavily-search/scripts/__pycache__/search.cpython-312.pyc +0 -0
  744. package/skills/tavily-search/scripts/search.py +238 -0
  745. package/skills/video-frames/scripts/frame.sh +0 -0
  746. package/LICENSE +0 -21
  747. package/dist/accounts-UcSvD34O.js +0 -109
  748. package/dist/acp-cli-BPb8PgHP.js +0 -2088
  749. package/dist/actions.runtime-BL5QRooG.js +0 -114
  750. package/dist/actions.runtime-DSdfSo40.js +0 -128
  751. package/dist/agents-CHeX_5-H.js +0 -217
  752. package/dist/agents-DQRL9XKP.js +0 -853
  753. package/dist/allow-list-Boi79v-U.js +0 -81
  754. package/dist/allowlist-B2eBBeMF.js +0 -142
  755. package/dist/api-CFAtRSYL.js +0 -6953
  756. package/dist/api-D5JNJj8n.js +0 -112
  757. package/dist/audit-BM0GsdzV.js +0 -787
  758. package/dist/audit-BqRK9OSj.js +0 -54
  759. package/dist/audit-channel.collect.runtime-BPvDB8aq.js +0 -600
  760. package/dist/audit-channel.runtime-D3fzHiAo.js +0 -116
  761. package/dist/audit-extra.async-NveNIzX0.js +0 -813
  762. package/dist/audit-membership-runtime-mu470WFO.js +0 -157
  763. package/dist/audit.deep.runtime-RdxvW8Tj.js +0 -24
  764. package/dist/audit.nondeep.runtime-DDu8vA9Z.js +0 -831
  765. package/dist/audit.runtime-Y8C9W7s9.js +0 -113
  766. package/dist/auth-choice-C1CIxRsi.js +0 -268
  767. package/dist/auth-choice-CTvqWiDI.js +0 -117
  768. package/dist/auth-choice-Ddzko1B8.js +0 -502
  769. package/dist/auth-choice-options-BIAmAiCe.js +0 -123
  770. package/dist/auth-choice-prompt-B815kArz.js +0 -110
  771. package/dist/auth-choice-prompt-CGhTNCJx.js +0 -36
  772. package/dist/auth-choice.plugin-providers.runtime-AvAZ6S5W.js +0 -114
  773. package/dist/auth-profiles-BJcHzwPy.js +0 -127650
  774. package/dist/auth-profiles.runtime-CieFilK5.js +0 -111
  775. package/dist/bluebubbles-F8FGE9cH.js +0 -64
  776. package/dist/brave-BG5Yopn8.js +0 -24
  777. package/dist/browser-cli-Co7PJGZF.js +0 -1492
  778. package/dist/call-CoaQYq7c.js +0 -639
  779. package/dist/call-D3eu5Jjh.js +0 -37
  780. package/dist/channel-BftWD6yu.js +0 -1321
  781. package/dist/channel-Bub9U5Xg.js +0 -214
  782. package/dist/channel-C0oDs7TO.js +0 -4681
  783. package/dist/channel-C8CnEdkZ.js +0 -352
  784. package/dist/channel-CI-RC-xf.js +0 -497
  785. package/dist/channel-CY-hZCOJ.js +0 -397
  786. package/dist/channel-CbtGJB2x.js +0 -943
  787. package/dist/channel-CcfK3wP8.js +0 -803
  788. package/dist/channel-DBoDIeVj.js +0 -619
  789. package/dist/channel-DEq6Ecs-.js +0 -920
  790. package/dist/channel-DH4dhW1n.js +0 -226
  791. package/dist/channel-DQ_wdKg_.js +0 -575
  792. package/dist/channel-DT6qD1Ic.js +0 -207
  793. package/dist/channel-DZNAyxwr.js +0 -542
  794. package/dist/channel-DtakwAEe.js +0 -538
  795. package/dist/channel-DuYgH6p1.js +0 -562
  796. package/dist/channel-Hn-AN-d52.js +0 -316
  797. package/dist/channel-_R4hbD5h.js +0 -1598
  798. package/dist/channel-account-context-DXq8dlvI.js +0 -103
  799. package/dist/channel-kQmEVn3I.js +0 -306
  800. package/dist/channel-options-DHfxaklg.js +0 -50
  801. package/dist/channel-summary-DUpnoYhI.js +0 -106
  802. package/dist/channel-t-JxCWk6.js +0 -949
  803. package/dist/channel.runtime--GYriaXU.js +0 -213
  804. package/dist/channel.runtime-BJtn3GOH.js +0 -174
  805. package/dist/channel.runtime-BV7t_oNz.js +0 -166
  806. package/dist/channel.runtime-Bi8a3n9S.js +0 -865
  807. package/dist/channel.runtime-BjsYF0NN.js +0 -122
  808. package/dist/channel.runtime-BnI6YtmI.js +0 -413
  809. package/dist/channel.runtime-CQOftcCd.js +0 -194
  810. package/dist/channel.runtime-CuIAcPjZ.js +0 -4006
  811. package/dist/channel.runtime-DH1Q1G4k.js +0 -399
  812. package/dist/channel.runtime-DYYUPKxr.js +0 -236
  813. package/dist/channel.runtime-U5Gszsr5.js +0 -177
  814. package/dist/channel.setup-BQFHmgki.js +0 -9
  815. package/dist/channel.setup-BVoDwklu.js +0 -8
  816. package/dist/channel.setup-Bf73HsXr.js +0 -57
  817. package/dist/channel.setup-CblD4flM.js +0 -11
  818. package/dist/channel.setup-DgxlrPgz.js +0 -6
  819. package/dist/channel.setup-GLIAEVKL.js +0 -8
  820. package/dist/channel.setup-YTy5R1sz.js +0 -9
  821. package/dist/channels-CTL8iR9J.js +0 -404
  822. package/dist/channels-DBGvnjHY.js +0 -1113
  823. package/dist/channels-cli-BmVO5-sq.js +0 -286
  824. package/dist/channels-status-issues-kDtsWzA-.js +0 -16
  825. package/dist/clawbot-cli-DtcMJHqX.js +0 -113
  826. package/dist/cli-BNGECGVY.js +0 -149
  827. package/dist/command-registry-1SDrWgER.js +0 -13
  828. package/dist/command-registry-DNorYU4w.js +0 -212
  829. package/dist/command-secret-gateway-DqDZparO.js +0 -106
  830. package/dist/compact.runtime-C1ZN8UGb.js +0 -111
  831. package/dist/completion-cli-Q_Jt5Foc.js +0 -16
  832. package/dist/completion-cli-QkTXhuJh.js +0 -445
  833. package/dist/config-BbxrRaLf.js +0 -938
  834. package/dist/config-CkD8DJ7L.js +0 -44
  835. package/dist/config-cli-BoPrlYTp.js +0 -428
  836. package/dist/config-guard-CEhCvr_u.js +0 -117
  837. package/dist/config-schema-GQ6uWjXe.js +0 -31
  838. package/dist/config-validation-woE2_LpC.js +0 -262
  839. package/dist/config-value-Dh8m-CFf.js +0 -132
  840. package/dist/config-y4i5g7s4.js +0 -30
  841. package/dist/configure-DGRzwdFN.js +0 -1100
  842. package/dist/configure-S4AHE3k_.js +0 -238
  843. package/dist/control-ui-shared-kLBp4YlS.js +0 -29
  844. package/dist/credentials-D5uBf_C5.js +0 -265
  845. package/dist/cron-cli-lGupeVCW.js +0 -634
  846. package/dist/daemon-cli-Cs_edi0I.js +0 -339
  847. package/dist/daemon-install-DIFpP_qv.js +0 -175
  848. package/dist/deliver-DYa_DFZU.js +0 -106
  849. package/dist/deliver-runtime-DCW_o2Ot.js +0 -106
  850. package/dist/devices-cli-YsGOW2-w.js +0 -340
  851. package/dist/diagnostic-vMghIesG.js +0 -310
  852. package/dist/directory-cli-DtjMQjU5.js +0 -306
  853. package/dist/directory.static-DBZGvsdF.js +0 -44
  854. package/dist/discord-DYCu19HT.js +0 -109
  855. package/dist/discovery-DZYAoDF_.js +0 -48
  856. package/dist/dns-cli-DqW4pNgW.js +0 -216
  857. package/dist/docs-cli-Bu9TBlDU.js +0 -173
  858. package/dist/doctor-completion-B5hcQD5c.js +0 -90
  859. package/dist/doctor-config-flow-BBB2ZKfT.js +0 -107
  860. package/dist/doctor-config-flow-DDBYUS9f.js +0 -2437
  861. package/dist/enable-Tmsp8QuB.js +0 -24
  862. package/dist/env-overrides-BHxqjYZG.js +0 -434
  863. package/dist/env-overrides.runtime-Cz98bf-l.js +0 -17
  864. package/dist/exec-approvals-cli-wO5cYfMa.js +0 -419
  865. package/dist/gateway-cli-CFvDGhB9.js +0 -26429
  866. package/dist/gateway-install-token-CskJfo_N.js +0 -163
  867. package/dist/gateway-rpc-srYfBID9.js +0 -26
  868. package/dist/gateway-runtime-C76hUmUV.js +0 -69
  869. package/dist/googlechat-Cha5utST.js +0 -307
  870. package/dist/health-DDQYYsJy.js +0 -108
  871. package/dist/health-DXZykGaX.js +0 -570
  872. package/dist/hooks-cli-DfkurPYP.js +0 -995
  873. package/dist/imessage-B26k39pl.js +0 -110
  874. package/dist/imessage-Bp1_6cws.js +0 -31
  875. package/dist/inbound-reply-dispatch-DoIJLztA.js +0 -71
  876. package/dist/install-target-BjOuS4I8.js +0 -574
  877. package/dist/installs-Cz4k0W1Y.js +0 -532
  878. package/dist/io-B0OKifLZ.js +0 -28
  879. package/dist/io-DcoxdH6t.js +0 -9570
  880. package/dist/ipv4-CTQQ4_IW.js +0 -82
  881. package/dist/irc-B8vBDigm.js +0 -672
  882. package/dist/library-VCM_cQY4.js +0 -107
  883. package/dist/lifecycle-core-Ctz36PdQ.js +0 -382
  884. package/dist/line-B_uTLrdI.js +0 -530
  885. package/dist/llm-slug-generator-YWg0g2pj.js +0 -67
  886. package/dist/logging-S-5LPdfQ.js +0 -13
  887. package/dist/logging-ueBMCGMR.js +0 -29
  888. package/dist/login-qr-pcACm2Ng.js +0 -107
  889. package/dist/login-qr-pv-kxMfF.js +0 -233
  890. package/dist/logs-cli-RgADgSMO.js +0 -254
  891. package/dist/manager-runtime-BhTkoKmb.js +0 -106
  892. package/dist/manager.runtime-BjHzikoK.js +0 -710
  893. package/dist/matrix-C4EEu2Qp.js +0 -1490
  894. package/dist/matrix-Dfzcc5nV.js +0 -1269
  895. package/dist/mcp-cli-CJmOm9Oj.js +0 -86
  896. package/dist/media-understanding.runtime-DCETFCw_.js +0 -111
  897. package/dist/memory-cli-DFqd6tYx.js +0 -106
  898. package/dist/method-scopes-D-Q9dvbj.js +0 -2586
  899. package/dist/model-picker-Z-CUcuMr.js +0 -390
  900. package/dist/model-picker-v5mUsZ4J.js +0 -107
  901. package/dist/model-picker.runtime-A_z0dHfS.js +0 -120
  902. package/dist/model-suppression.runtime-QVWVJRr-.js +0 -111
  903. package/dist/models-Bbj0xV4F.js +0 -2514
  904. package/dist/models-D-OIjZqU.js +0 -113
  905. package/dist/models-cli-Bpn-5i4h.js +0 -304
  906. package/dist/models-config-Cwa5cJbC.js +0 -106
  907. package/dist/monitor-BchfCAaU.js +0 -6823
  908. package/dist/monitor-BydV44SP.js +0 -3076
  909. package/dist/monitor-CT8axwfm.js +0 -767
  910. package/dist/monitor-CZGWNOvn.js +0 -777
  911. package/dist/monitor-DN62r69g.js +0 -3468
  912. package/dist/monitor-DZ0fzJku.js +0 -110
  913. package/dist/monitor-DvNjzWFu.js +0 -108
  914. package/dist/monitor-shared-B-DBSlkQ.js +0 -444
  915. package/dist/msteams-Bf-wk2Rp.js +0 -852
  916. package/dist/node-cli-kH16TQI7.js +0 -2498
  917. package/dist/node-resolve-DfOpQmxm.js +0 -835
  918. package/dist/nodes-cli-CkAMXW5u.js +0 -1375
  919. package/dist/nostr-B8UGHclZ.js +0 -8744
  920. package/dist/npm-resolution-DmjlifII.js +0 -60
  921. package/dist/onboard-C883nfyw.js +0 -589
  922. package/dist/onboard-channels-Dc-BxN7p.js +0 -200
  923. package/dist/onboard-channels-j5EENtum.js +0 -1241
  924. package/dist/onboard-custom-0atne0C5.js +0 -571
  925. package/dist/onboard-custom-CWMqwjJx.js +0 -109
  926. package/dist/onboard-helpers-D3wWfH8F.js +0 -335
  927. package/dist/onboard-helpers-DZmRCe8l.js +0 -108
  928. package/dist/onboard-remote-Cn6kW-p0.js +0 -112
  929. package/dist/onboard-remote-Cx4w5VAk.js +0 -181
  930. package/dist/onboard-search-Ck9HRh2M.js +0 -297
  931. package/dist/onboard-skills-BtqrGioT.js +0 -133
  932. package/dist/onboard-skills-Dnw19Os8.js +0 -112
  933. package/dist/outbound-media-C5Nv4o18.js +0 -11
  934. package/dist/pairing-cli-Cwy9QZ_4.js +0 -212
  935. package/dist/perplexity-Brhpb45X.js +0 -24
  936. package/dist/pi-model-discovery-runtime-DIOdo6D8.js +0 -106
  937. package/dist/pi-tools.before-tool-call.runtime-CFM4gsDF.js +0 -380
  938. package/dist/plugin-install-BOV00hia.js +0 -112
  939. package/dist/plugin-install-Bak8fUBv.js +0 -184
  940. package/dist/plugin-install-plan-bKkEefRf.js +0 -49
  941. package/dist/plugin-registry-DxAXQUlZ.js +0 -108
  942. package/dist/plugin-registry-n0p3phem.js +0 -49
  943. package/dist/plugins-Ca3RK8Fi.js +0 -106
  944. package/dist/plugins-cli-BnC51H2R.js +0 -912
  945. package/dist/policy-BJv97w9e.js +0 -143
  946. package/dist/preflight-audio.runtime-BrFcf-6_.js +0 -111
  947. package/dist/probe-063xvvZc.js +0 -19
  948. package/dist/probe-BJEb2wGv.js +0 -1793
  949. package/dist/probe-CJQlxgsl.js +0 -47
  950. package/dist/probe-Caa2HznF.js +0 -6328
  951. package/dist/probe-CfL4tnJ6.js +0 -129
  952. package/dist/probe-auth-DN2Ec83-.js +0 -38
  953. package/dist/probe-auth-D_UKzu4m.js +0 -48
  954. package/dist/program-BOMdC7MC.js +0 -247
  955. package/dist/prompt-select-styled-DDnCfM3j.js +0 -2673
  956. package/dist/provider-api-key-auth.runtime-DUns3fwX.js +0 -116
  957. package/dist/provider-auth-choice-B_j1ctT2.js +0 -126
  958. package/dist/provider-auth-choice-preference-BaOBZ_Xn.js +0 -189
  959. package/dist/provider-auth-choice.runtime-DOako_zV.js +0 -118
  960. package/dist/provider-auth-guidance-CrjxnoNZ.js +0 -34
  961. package/dist/provider-runtime.runtime-BkOkgmTw.js +0 -106
  962. package/dist/provider-self-hosted-setup-BFDU6dRa.js +0 -182
  963. package/dist/provider-usage-CaDE0mqq.js +0 -106
  964. package/dist/provider-web-search-BR7etTjJ.js +0 -2392
  965. package/dist/provider-wizard-DCPdKUvb.js +0 -152
  966. package/dist/push-apns-B_OZjm4v.js +0 -1038
  967. package/dist/pw-ai-dG60P0hQ.js +0 -1866
  968. package/dist/qr-cli-DWfiw79I.js +0 -369
  969. package/dist/qr-cli-DwuKtyZQ.js +0 -108
  970. package/dist/reactions-CIGAPBn8.js +0 -281
  971. package/dist/read-only-account-inspect.discord.runtime-D54mnq8l.js +0 -111
  972. package/dist/read-only-account-inspect.slack.runtime-Bxs9ObMC.js +0 -111
  973. package/dist/read-only-account-inspect.telegram.runtime-UoVuf_Yo.js +0 -111
  974. package/dist/redact-snapshot-DZ3Vq-SC.js +0 -2657
  975. package/dist/ref-contract-D96lSYLs.js +0 -53
  976. package/dist/register.agent-2KmeahEL.js +0 -434
  977. package/dist/register.backup-ECBnWVR7.js +0 -624
  978. package/dist/register.configure-Doz1daCp.js +0 -247
  979. package/dist/register.maintenance-C33cV-WM.js +0 -569
  980. package/dist/register.message-CnL0NiF6.js +0 -704
  981. package/dist/register.onboard-BrYGZeQA.js +0 -187
  982. package/dist/register.setup-Bx6gEg6X.js +0 -207
  983. package/dist/register.status-health-sessions-FLb0CUOO.js +0 -493
  984. package/dist/register.subclis-BuqgaeIf.js +0 -12
  985. package/dist/register.subclis-DwdgfdnT.js +0 -315
  986. package/dist/registry-xhgvU89y.js +0 -1107
  987. package/dist/replies-hB2aipLu.js +0 -110
  988. package/dist/resolve-3ErMOltL.js +0 -660
  989. package/dist/resolve-channels-BV8GXuPe.js +0 -226
  990. package/dist/resolve-channels-CTY_XRIP.js +0 -262
  991. package/dist/resolve-users-DQ4Ne4Zc.js +0 -143
  992. package/dist/routes-BNDsNO_e.js +0 -7097
  993. package/dist/rpc-BLGTBWXq.js +0 -67
  994. package/dist/run-main-COAE4GlI.js +0 -423
  995. package/dist/runtime-discord-ops.runtime-Dxg-nlgd.js +0 -9073
  996. package/dist/runtime-slack-ops.runtime-Di474LJr.js +0 -4551
  997. package/dist/runtime-telegram-ops.runtime-Da8vgf3O.js +0 -128
  998. package/dist/runtime-whatsapp-login.runtime-DcouP4iF.js +0 -109
  999. package/dist/runtime-whatsapp-outbound.runtime-CYamaEJX.js +0 -112
  1000. package/dist/sandbox-cli-U5ZTxhxL.js +0 -530
  1001. package/dist/search-manager-CfizyEMk.js +0 -386
  1002. package/dist/search-manager-DaF2QP4s.js +0 -15
  1003. package/dist/secrets-cli-C0gytFip.js +0 -2065
  1004. package/dist/security-cli-C74EuLUO.js +0 -570
  1005. package/dist/send-BTLVBf_E.js +0 -631
  1006. package/dist/send-BlWWCEZE.js +0 -1025
  1007. package/dist/send-CfypD1B_.js +0 -100
  1008. package/dist/send-Cm9v3uhF.js +0 -283
  1009. package/dist/send-g2odQuYI.js +0 -629
  1010. package/dist/server-C8b5QJ2s.js +0 -106
  1011. package/dist/server-node-events-xqQe5xiu.js +0 -501
  1012. package/dist/sessions-CSSzvgPQ.js +0 -107
  1013. package/dist/sessions-z0GIvdKa.js +0 -218
  1014. package/dist/setup-D9XTmlF8.js +0 -387
  1015. package/dist/setup-core-BDrLOwYO.js +0 -143
  1016. package/dist/setup-core-CM7cY7_i.js +0 -166
  1017. package/dist/setup-core-CnmgANY-.js +0 -205
  1018. package/dist/setup-core-DgcjCKmG.js +0 -47
  1019. package/dist/setup-surface-DzRrVKYj.js +0 -490
  1020. package/dist/setup.finalize-UaPu_adv.js +0 -517
  1021. package/dist/setup.gateway-config-Djc1ceEh.js +0 -338
  1022. package/dist/setup.secret-input-BkczghbR.js +0 -25
  1023. package/dist/shared-BHizGoNk.js +0 -298
  1024. package/dist/shared-CUfYhQkP.js +0 -96
  1025. package/dist/shared-DYYqr9EC.js +0 -75
  1026. package/dist/shared-DthOxMRQ.js +0 -182
  1027. package/dist/shared-On_A5_hW.js +0 -102
  1028. package/dist/signal-D6px9PGZ.js +0 -109
  1029. package/dist/skills-B4h1k-SP.js +0 -853
  1030. package/dist/skills-Bto10BGB.js +0 -19
  1031. package/dist/skills-cli-CXGR3Y5j.js +0 -291
  1032. package/dist/skills-install-B1AlkK8C.js +0 -763
  1033. package/dist/skills-status-BsmJ_iSg.js +0 -20
  1034. package/dist/skills-status-DGdxY3OI.js +0 -169
  1035. package/dist/slack-B7vWFmxP.js +0 -109
  1036. package/dist/slash-commands.runtime-DXdAT84n.js +0 -123
  1037. package/dist/slash-dispatch.runtime-CNf2-9Aj.js +0 -136
  1038. package/dist/slash-skill-commands.runtime-CBjffHRX.js +0 -111
  1039. package/dist/src-Cp7P7T08.js +0 -1696
  1040. package/dist/status-158fWh4A.js +0 -43
  1041. package/dist/status-BJIVLJnb.js +0 -1599
  1042. package/dist/status-BQiBI6N9.js +0 -126
  1043. package/dist/status-CZipXGUu.js +0 -121
  1044. package/dist/status-ZZIVFLI-.js +0 -606
  1045. package/dist/status-json-BNUy5Mem.js +0 -286
  1046. package/dist/status.link-channel-B694y1Xu.js +0 -138
  1047. package/dist/status.scan.deps.runtime-BcoKEzQD.js +0 -121
  1048. package/dist/status.scan.runtime-CqScDt-p.js +0 -114
  1049. package/dist/status.summary-AMek7qvI.js +0 -592
  1050. package/dist/status.summary.runtime-XgkcQ_kr.js +0 -113
  1051. package/dist/subagent-orphan-recovery-CrCYTmFC.js +0 -302
  1052. package/dist/subagent-registry-runtime-Cg-YvLx3.js +0 -106
  1053. package/dist/synology-chat-0G85jIqQ.js +0 -297
  1054. package/dist/system-cli-kZtSxKNm.js +0 -92
  1055. package/dist/telegram-DV0Wy89w.js +0 -109
  1056. package/dist/text-chunking-C2J2Oeul.js +0 -84
  1057. package/dist/tlon-DmK1NUVP.js +0 -433
  1058. package/dist/tui-D3bNPLG7.js +0 -3834
  1059. package/dist/tui-cli-DtMp9k_s.js +0 -132
  1060. package/dist/types.secrets-DuSPmmWB.js +0 -80
  1061. package/dist/ui-CeGztSEL.js +0 -31
  1062. package/dist/update-De7VudzP.js +0 -1036
  1063. package/dist/update-cli-BH8Pb-So.js +0 -1498
  1064. package/dist/update-offset-store-syELkdEW.js +0 -107
  1065. package/dist/update-runner-Cq-Q40T9.js +0 -1496
  1066. package/dist/web-CjMtvfSq.js +0 -107
  1067. package/dist/webhook-targets-_jTR0Bb_.js +0 -181
  1068. package/dist/webhooks-cli-DQ6u2Qau.js +0 -349
  1069. package/dist/whatsapp-CyLk16SZ.js +0 -109
  1070. package/dist/whatsapp-actions-Dzr2Wzqw.js +0 -162
  1071. package/dist/workspace-dirs-L1_QQ9mB.js +0 -2002
  1072. package/dist/zalo-CrehfXvK.js +0 -415
  1073. package/dist/zalouser-D1QD-O-I.js +0 -30911
  1074. package/dist/zod-schema.core-CWxzqcUs.js +0 -541
@@ -1,2498 +0,0 @@
1
- import "./redact-fatrROh9.js";
2
- import "./errors-DOJWZqNo.js";
3
- import "./unhandled-rejections-CTvNvnT0.js";
4
- import "./logger-BFfIIIKH.js";
5
- import { _ as resolveStateDir } from "./paths-D6AgsMTU.js";
6
- import "./tmp-moldclaw-dir-DWF-d8qD.js";
7
- import { r as theme, t as colorize } from "./theme-BSXzMzAA.js";
8
- import "./globals-DESrFYmC.js";
9
- import { m as defaultRuntime } from "./subsystem-S4LNMNHd.js";
10
- import "./ansi-BPhP6LBZ.js";
11
- import "./boolean-D8Ha5nYV.js";
12
- import "./env-Dgex_t9p.js";
13
- import "./warning-filter-gJuwHM7C.js";
14
- import "./utils-rjVNXUns.js";
15
- import { t as formatDocsLink } from "./links-C5I443Xb.js";
16
- import "./setup-binary-Fw3cCSWL.js";
17
- import { Gd as formatExecCommand, Kd as resolveSystemRunCommandRequest, Zd as normalizeSystemRunApprovalPlan, df as resolveExecSafeBinRuntimePolicy, lf as isInterpreterLikeSafeBin, lh as getMachineDisplayName, tl as withTimeout } from "./auth-profiles-BJcHzwPy.js";
18
- import "./model-selection-DfA4esOK.js";
19
- import { i as resolveAgentConfig } from "./agent-scope-DA7O8MVG.js";
20
- import "./boundary-file-read-Y1cMjPlu.js";
21
- import { n as sameFileIdentity } from "./safe-open-sync-BlMTEZMw.js";
22
- import { a as logWarn } from "./logger-wrbK9-ju.js";
23
- import "./exec-CoBTyh8B.js";
24
- import "./workspace-CxNKYS0V.js";
25
- import { Bt as normalizeExecutableToken, Ht as unwrapKnownDispatchWrapperInvocation, Kt as resolveInlineCommandMatch, Mt as resolveCommandResolutionFromArgv, Nt as resolveExecutableFromPathEnv, Pt as POSIX_SHELL_WRAPPERS, Ut as unwrapKnownShellMultiplexerInvocation, Wt as POSIX_INLINE_COMMAND_FLAGS, s as loadConfig, vt as analyzeArgvCommand, wt as resolvePlannedSegmentArgv } from "./io-DcoxdH6t.js";
26
- import { a as sanitizeSystemRunEnvOverrides, i as sanitizeHostExecEnv } from "./host-env-security-xy11yVnm.js";
27
- import "./safe-text-BcUvBreN.js";
28
- import { n as VERSION } from "./version-rW_3ob2o.js";
29
- import "./env-substitution-C9xZMTDL.js";
30
- import "./config-state-D1JkXt39.js";
31
- import "./network-mode-CE-ihBf6.js";
32
- import { t as splitShellArgs } from "./shell-argv-C1FHz2HS.js";
33
- import "./registry-DcDGl2X7.js";
34
- import "./manifest-registry-_0xclaVY.js";
35
- import "./ip-w605xvSx.js";
36
- import "./zod-schema.core-CWxzqcUs.js";
37
- import "./config-CkD8DJ7L.js";
38
- import "./audit-fs-SjcfoPO7.js";
39
- import "./resolve-3ErMOltL.js";
40
- import "./provider-web-search-BR7etTjJ.js";
41
- import "./text-runtime-CgEQ9Y9_.js";
42
- import "./workspace-dirs-L1_QQ9mB.js";
43
- import { n as resolveBrowserConfig } from "./config-BbxrRaLf.js";
44
- import { t as formatCliCommand } from "./command-format-DIDjlImI.js";
45
- import "./tailnet-KyAU6tj_.js";
46
- import "./net-B_Iq_SVP.js";
47
- import "./credentials-D5uBf_C5.js";
48
- import { _ as startBrowserControlServiceFromConfig, f as redactCdpUrl, g as createBrowserControlContext, h as createBrowserRouteDispatcher } from "./routes-BNDsNO_e.js";
49
- import "./frontmatter-BTDAgsA3.js";
50
- import "./env-overrides-BHxqjYZG.js";
51
- import "./path-alias-guards-B3ZKrId1.js";
52
- import "./skills-B4h1k-SP.js";
53
- import { r as writeJsonAtomic } from "./json-files-BhLX9wE7.js";
54
- import "./ports-BVwQuCIR.js";
55
- import "./ports-lsof-DiY6GaAf.js";
56
- import "./ssh-tunnel-BaHTFPzH.js";
57
- import "./image-ops-Uw4rEShL.js";
58
- import "./fs-safe-Da4H0IOU.js";
59
- import { t as detectMime } from "./mime-_IkgFMS2.js";
60
- import "./server-middleware-BPq4bu3A.js";
61
- import { _ as GATEWAY_CLIENT_MODES, v as GATEWAY_CLIENT_NAMES } from "./message-channel-CKeDAoOT.js";
62
- import "./resolve-route-IkBfMjBz.js";
63
- import "./internal-hooks-0x1JiQ5f.js";
64
- import "./lazy-runtime-DdzFA4b9.js";
65
- import "./config-schema-GQ6uWjXe.js";
66
- import { nn as loadOrCreateDeviceIdentity, u as GatewayClient } from "./method-scopes-D-Q9dvbj.js";
67
- import "./session-cost-usage-B-57mlS8.js";
68
- import "./paths-CDWV-9nX.js";
69
- import "./routing-3o2D0ix4.js";
70
- import "./send-Cm9v3uhF.js";
71
- import { E as evaluateShellAllowlist, T as evaluateExecAllowlist, _ as recordAllowlistUse, b as resolveExecApprovals, f as normalizeExecApprovals, g as readExecApprovalsSnapshot, j as requestJsonlSocket, k as resolveAllowAlwaysPatterns, o as addAllowlistEntry, s as ensureExecApprovals, u as mergeExecApprovalsSocketDefaults, w as saveExecApprovals, y as requiresExecApproval } from "./node-resolve-DfOpQmxm.js";
72
- import "./provider-stream-gVymYPmd.js";
73
- import "./identity-file-DM4N5_7H.js";
74
- import "./provider-models-BA3hqqPq.js";
75
- import "./secret-file-Bjh19aoH.js";
76
- import "./logging-BdFqMomc.js";
77
- import "./runtime-env-CT-voxYE.js";
78
- import "./registry-xhgvU89y.js";
79
- import "./provider-onboard-CBC3kdk_.js";
80
- import "./model-definitions-DwehIMlw.js";
81
- import "./diagnostic-vMghIesG.js";
82
- import "./message-hook-mappers-DORrSLHM.js";
83
- import "./json-store-DlpyvQXN.js";
84
- import "./call-CoaQYq7c.js";
85
- import "./multimodal-BWF8MRkz.js";
86
- import "./memory-search-BBG2BKIh.js";
87
- import "./query-expansion-8R79qExs.js";
88
- import "./search-manager-CfizyEMk.js";
89
- import "./core-EKuk2FxR.js";
90
- import "./issue-format-i6sEuV4a.js";
91
- import "./logging-S-5LPdfQ.js";
92
- import "./note-z78_JyNp.js";
93
- import "./state-paths-C7dX__ql.js";
94
- import "./config-value-Dh8m-CFf.js";
95
- import "./command-secret-targets-CO_lZ_ZZ.js";
96
- import "./brave-BG5Yopn8.js";
97
- import "./provider-usage-DzuzbNBv.js";
98
- import "./perplexity-Brhpb45X.js";
99
- import { _ as resolveNodeWindowsTaskName, c as formatNodeServiceDescription, g as resolveNodeSystemdServiceName, h as resolveNodeLaunchAgentLabel } from "./constants-WvU01Mp_.js";
100
- import "./restart-stale-pids-CN9ElYwR.js";
101
- import "./delivery-queue-DLjFP-0C.js";
102
- import "./pairing-token-ANLRyJSu.js";
103
- import "./accounts-BCaV8MsT.js";
104
- import "./process-runtime-CicRKAFe.js";
105
- import "./audit-BqRK9OSj.js";
106
- import "./cli-runtime-DtIDS2w7.js";
107
- import "./cli-utils-FHeUZLsT.js";
108
- import { t as formatHelpExamples } from "./help-format-1yV2Xzq7.js";
109
- import "./progress-BQSTKUhd.js";
110
- import { n as resolveGatewayConnectionAuth } from "./gateway-runtime-C76hUmUV.js";
111
- import { i as resolveNodeProgramArguments, n as resolveDaemonInstallRuntimeInputs, t as emitDaemonInstallRuntimeWarning } from "./daemon-install-plan.shared-B0aOTaiV.js";
112
- import { c as buildNodeServiceEnvironment } from "./runtime-paths-DPdaWILN.js";
113
- import "./runtime-guard-CcWejJVQ.js";
114
- import { r as isGatewayDaemonRuntime, t as DEFAULT_GATEWAY_DAEMON_RUNTIME } from "./daemon-runtime-BPknjyQD.js";
115
- import "./runtime-parse-BmC9qo9I.js";
116
- import "./launchd-C1YgvbKp.js";
117
- import "./service-DLhEn8sS.js";
118
- import "./systemd-BD-XXrY3.js";
119
- import { f as buildDaemonServiceSnapshot, h as installDaemonServiceAndEmit, n as createDaemonInstallActionContext, r as failIfNixDaemonInstallMode, t as createCliStatusTextStyles, u as resolveRuntimeStatusColor } from "./shared-DMm9TCU6.js";
120
- import { c as buildPlatformRuntimeLogHints, l as buildPlatformServiceStartHints, u as formatRuntimeStatus } from "./systemd-hints-LWwXTYeY.js";
121
- import { t as parsePort } from "./parse-port-BZ2l6YzE.js";
122
- import { i as runServiceUninstall, r as runServiceStop, t as runServiceRestart } from "./lifecycle-core-Ctz36PdQ.js";
123
- import { t as ensuremoldClawCliOnPath } from "./path-env-JKt31Dxc.js";
124
- import { i as NODE_SYSTEM_RUN_COMMANDS, n as NODE_EXEC_APPROVALS_COMMANDS, t as NODE_BROWSER_PROXY_COMMAND } from "./node-commands-CJPr3qAo.js";
125
- import { t as resolveNodeService } from "./node-service-DnHU1_vE.js";
126
- import fs from "node:fs";
127
- import path from "node:path";
128
- import { spawn, spawnSync } from "node:child_process";
129
- import fs$1 from "node:fs/promises";
130
- import crypto from "node:crypto";
131
- //#region src/node-host/config.ts
132
- const NODE_HOST_FILE = "node.json";
133
- function resolveNodeHostConfigPath() {
134
- return path.join(resolveStateDir(), NODE_HOST_FILE);
135
- }
136
- function normalizeConfig(config) {
137
- const base = {
138
- version: 1,
139
- nodeId: "",
140
- token: config?.token,
141
- displayName: config?.displayName,
142
- gateway: config?.gateway
143
- };
144
- if (config?.version === 1 && typeof config.nodeId === "string") base.nodeId = config.nodeId.trim();
145
- if (!base.nodeId) base.nodeId = crypto.randomUUID();
146
- return base;
147
- }
148
- async function loadNodeHostConfig() {
149
- const filePath = resolveNodeHostConfigPath();
150
- try {
151
- const raw = await fs$1.readFile(filePath, "utf8");
152
- return normalizeConfig(JSON.parse(raw));
153
- } catch {
154
- return null;
155
- }
156
- }
157
- async function saveNodeHostConfig(config) {
158
- await writeJsonAtomic(resolveNodeHostConfigPath(), config, { mode: 384 });
159
- }
160
- async function ensureNodeHostConfig() {
161
- const normalized = normalizeConfig(await loadNodeHostConfig());
162
- await saveNodeHostConfig(normalized);
163
- return normalized;
164
- }
165
- //#endregion
166
- //#region src/infra/exec-host.ts
167
- async function requestExecHostViaSocket(params) {
168
- const { socketPath, token, request } = params;
169
- if (!socketPath || !token) return null;
170
- const timeoutMs = params.timeoutMs ?? 2e4;
171
- const requestJson = JSON.stringify(request);
172
- const nonce = crypto.randomBytes(16).toString("hex");
173
- const ts = Date.now();
174
- const hmac = crypto.createHmac("sha256", token).update(`${nonce}:${ts}:${requestJson}`).digest("hex");
175
- return await requestJsonlSocket({
176
- socketPath,
177
- payload: JSON.stringify({
178
- type: "exec",
179
- id: crypto.randomUUID(),
180
- nonce,
181
- ts,
182
- hmac,
183
- requestJson
184
- }),
185
- timeoutMs,
186
- accept: (value) => {
187
- const msg = value;
188
- if (msg?.type !== "exec-res") return;
189
- if (msg.ok === true && msg.payload) return {
190
- ok: true,
191
- payload: msg.payload
192
- };
193
- if (msg.ok === false && msg.error) return {
194
- ok: false,
195
- error: msg.error
196
- };
197
- return null;
198
- }
199
- });
200
- }
201
- //#endregion
202
- //#region src/node-host/invoke-browser.ts
203
- const BROWSER_PROXY_MAX_FILE_BYTES = 10 * 1024 * 1024;
204
- const DEFAULT_BROWSER_PROXY_TIMEOUT_MS = 2e4;
205
- const BROWSER_PROXY_STATUS_TIMEOUT_MS = 750;
206
- function normalizeProfileAllowlist(raw) {
207
- return Array.isArray(raw) ? raw.map((entry) => entry.trim()).filter(Boolean) : [];
208
- }
209
- function resolveBrowserProxyConfig() {
210
- const proxy = loadConfig().nodeHost?.browserProxy;
211
- const allowProfiles = normalizeProfileAllowlist(proxy?.allowProfiles);
212
- return {
213
- enabled: proxy?.enabled !== false,
214
- allowProfiles
215
- };
216
- }
217
- let browserControlReady = null;
218
- async function ensureBrowserControlService() {
219
- if (browserControlReady) return browserControlReady;
220
- browserControlReady = (async () => {
221
- const cfg = loadConfig();
222
- if (!resolveBrowserConfig(cfg.browser, cfg).enabled) throw new Error("browser control disabled");
223
- if (!await startBrowserControlServiceFromConfig()) throw new Error("browser control disabled");
224
- })();
225
- return browserControlReady;
226
- }
227
- function isProfileAllowed(params) {
228
- const { allowProfiles, profile } = params;
229
- if (!allowProfiles.length) return true;
230
- if (!profile) return false;
231
- return allowProfiles.includes(profile.trim());
232
- }
233
- function collectBrowserProxyPaths(payload) {
234
- const paths = /* @__PURE__ */ new Set();
235
- const obj = typeof payload === "object" && payload !== null ? payload : null;
236
- if (!obj) return [];
237
- if (typeof obj.path === "string" && obj.path.trim()) paths.add(obj.path.trim());
238
- if (typeof obj.imagePath === "string" && obj.imagePath.trim()) paths.add(obj.imagePath.trim());
239
- const download = obj.download;
240
- if (download && typeof download === "object") {
241
- const dlPath = download.path;
242
- if (typeof dlPath === "string" && dlPath.trim()) paths.add(dlPath.trim());
243
- }
244
- return [...paths];
245
- }
246
- async function readBrowserProxyFile(filePath) {
247
- const stat = await fs$1.stat(filePath).catch(() => null);
248
- if (!stat || !stat.isFile()) return null;
249
- if (stat.size > BROWSER_PROXY_MAX_FILE_BYTES) throw new Error(`browser proxy file exceeds ${Math.round(BROWSER_PROXY_MAX_FILE_BYTES / (1024 * 1024))}MB`);
250
- const buffer = await fs$1.readFile(filePath);
251
- const mimeType = await detectMime({
252
- buffer,
253
- filePath
254
- });
255
- return {
256
- path: filePath,
257
- base64: buffer.toString("base64"),
258
- mimeType
259
- };
260
- }
261
- function decodeParams$1(raw) {
262
- if (!raw) throw new Error("INVALID_REQUEST: paramsJSON required");
263
- return JSON.parse(raw);
264
- }
265
- function resolveBrowserProxyTimeout(timeoutMs) {
266
- return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) ? Math.max(1, Math.floor(timeoutMs)) : DEFAULT_BROWSER_PROXY_TIMEOUT_MS;
267
- }
268
- function isBrowserProxyTimeoutError(err) {
269
- return String(err).includes("browser proxy request timed out");
270
- }
271
- function isWsBackedBrowserProxyPath(path) {
272
- return path === "/act" || path === "/navigate" || path === "/pdf" || path === "/screenshot" || path === "/snapshot";
273
- }
274
- async function readBrowserProxyStatus(params) {
275
- const query = params.profile ? { profile: params.profile } : {};
276
- try {
277
- const response = await withTimeout((signal) => params.dispatcher.dispatch({
278
- method: "GET",
279
- path: "/",
280
- query,
281
- signal
282
- }), BROWSER_PROXY_STATUS_TIMEOUT_MS, "browser proxy status");
283
- if (response.status >= 400 || !response.body || typeof response.body !== "object") return null;
284
- const body = response.body;
285
- return {
286
- running: body.running,
287
- transport: body.transport,
288
- cdpHttp: body.cdpHttp,
289
- cdpReady: body.cdpReady,
290
- cdpUrl: body.cdpUrl
291
- };
292
- } catch {
293
- return null;
294
- }
295
- }
296
- function formatBrowserProxyTimeoutMessage(params) {
297
- const parts = [`browser proxy timed out for ${params.method} ${params.path} after ${params.timeoutMs}ms`, params.wsBacked ? "ws-backed browser action" : "browser action"];
298
- if (params.profile) parts.push(`profile=${params.profile}`);
299
- if (params.status) {
300
- const statusParts = [
301
- `running=${String(params.status.running)}`,
302
- `cdpHttp=${String(params.status.cdpHttp)}`,
303
- `cdpReady=${String(params.status.cdpReady)}`
304
- ];
305
- if (typeof params.status.transport === "string" && params.status.transport.trim()) statusParts.push(`transport=${params.status.transport}`);
306
- if (typeof params.status.cdpUrl === "string" && params.status.cdpUrl.trim()) statusParts.push(`cdpUrl=${redactCdpUrl(params.status.cdpUrl)}`);
307
- parts.push(`status(${statusParts.join(", ")})`);
308
- }
309
- return parts.join("; ");
310
- }
311
- async function runBrowserProxyCommand(paramsJSON) {
312
- const params = decodeParams$1(paramsJSON);
313
- const pathValue = typeof params.path === "string" ? params.path.trim() : "";
314
- if (!pathValue) throw new Error("INVALID_REQUEST: path required");
315
- const proxyConfig = resolveBrowserProxyConfig();
316
- if (!proxyConfig.enabled) throw new Error("UNAVAILABLE: node browser proxy disabled");
317
- await ensureBrowserControlService();
318
- const cfg = loadConfig();
319
- const resolved = resolveBrowserConfig(cfg.browser, cfg);
320
- const requestedProfile = typeof params.profile === "string" ? params.profile.trim() : "";
321
- const allowedProfiles = proxyConfig.allowProfiles;
322
- if (allowedProfiles.length > 0) {
323
- if (pathValue !== "/profiles") {
324
- if (!isProfileAllowed({
325
- allowProfiles: allowedProfiles,
326
- profile: requestedProfile || resolved.defaultProfile
327
- })) throw new Error("INVALID_REQUEST: browser profile not allowed");
328
- } else if (requestedProfile) {
329
- if (!isProfileAllowed({
330
- allowProfiles: allowedProfiles,
331
- profile: requestedProfile
332
- })) throw new Error("INVALID_REQUEST: browser profile not allowed");
333
- }
334
- }
335
- const method = typeof params.method === "string" ? params.method.toUpperCase() : "GET";
336
- const path = pathValue.startsWith("/") ? pathValue : `/${pathValue}`;
337
- const body = params.body;
338
- const timeoutMs = resolveBrowserProxyTimeout(params.timeoutMs);
339
- const query = {};
340
- if (requestedProfile) query.profile = requestedProfile;
341
- const rawQuery = params.query ?? {};
342
- for (const [key, value] of Object.entries(rawQuery)) {
343
- if (value === void 0 || value === null) continue;
344
- query[key] = typeof value === "string" ? value : String(value);
345
- }
346
- const dispatcher = createBrowserRouteDispatcher(createBrowserControlContext());
347
- let response;
348
- try {
349
- response = await withTimeout((signal) => dispatcher.dispatch({
350
- method: method === "DELETE" ? "DELETE" : method === "POST" ? "POST" : "GET",
351
- path,
352
- query,
353
- body,
354
- signal
355
- }), timeoutMs, "browser proxy request");
356
- } catch (err) {
357
- if (!isBrowserProxyTimeoutError(err)) throw err;
358
- const profileForStatus = requestedProfile || resolved.defaultProfile;
359
- const status = await readBrowserProxyStatus({
360
- dispatcher,
361
- profile: path === "/profiles" ? void 0 : profileForStatus
362
- });
363
- throw new Error(formatBrowserProxyTimeoutMessage({
364
- method,
365
- path,
366
- profile: path === "/profiles" ? void 0 : profileForStatus || void 0,
367
- timeoutMs,
368
- wsBacked: isWsBackedBrowserProxyPath(path),
369
- status
370
- }), { cause: err });
371
- }
372
- if (response.status >= 400) {
373
- const message = response.body && typeof response.body === "object" && "error" in response.body ? String(response.body.error) : `HTTP ${response.status}`;
374
- throw new Error(message);
375
- }
376
- const result = response.body;
377
- if (allowedProfiles.length > 0 && path === "/profiles") {
378
- const obj = typeof result === "object" && result !== null ? result : {};
379
- obj.profiles = (Array.isArray(obj.profiles) ? obj.profiles : []).filter((entry) => {
380
- if (!entry || typeof entry !== "object") return false;
381
- const name = entry.name;
382
- return typeof name === "string" && allowedProfiles.includes(name);
383
- });
384
- }
385
- let files;
386
- const paths = collectBrowserProxyPaths(result);
387
- if (paths.length > 0) {
388
- const loaded = await Promise.all(paths.map(async (p) => {
389
- try {
390
- const file = await readBrowserProxyFile(p);
391
- if (!file) throw new Error("file not found");
392
- return file;
393
- } catch (err) {
394
- throw new Error(`browser proxy file read failed for ${p}: ${String(err)}`, { cause: err });
395
- }
396
- }));
397
- if (loaded.length > 0) files = loaded;
398
- }
399
- const payload = files ? {
400
- result,
401
- files
402
- } : { result };
403
- return JSON.stringify(payload);
404
- }
405
- //#endregion
406
- //#region src/node-host/exec-policy.ts
407
- function resolveExecApprovalDecision(value) {
408
- if (value === "allow-once" || value === "allow-always") return value;
409
- return null;
410
- }
411
- function formatSystemRunAllowlistMissMessage(params) {
412
- if (params?.windowsShellWrapperBlocked) return "SYSTEM_RUN_DENIED: allowlist miss (Windows shell wrappers like cmd.exe /c require approval; approve once/always or run with --ask on-miss|always)";
413
- if (params?.shellWrapperBlocked) return "SYSTEM_RUN_DENIED: allowlist miss (shell wrappers like sh/bash/zsh -c require approval; approve once/always or run with --ask on-miss|always)";
414
- return "SYSTEM_RUN_DENIED: allowlist miss";
415
- }
416
- function evaluateSystemRunPolicy(params) {
417
- const shellWrapperBlocked = params.security === "allowlist" && params.shellWrapperInvocation;
418
- const windowsShellWrapperBlocked = shellWrapperBlocked && params.isWindows && params.cmdInvocation;
419
- const analysisOk = shellWrapperBlocked ? false : params.analysisOk;
420
- const allowlistSatisfied = shellWrapperBlocked ? false : params.allowlistSatisfied;
421
- const approvedByAsk = params.approvalDecision !== null || params.approved === true;
422
- if (params.security === "deny") return {
423
- allowed: false,
424
- eventReason: "security=deny",
425
- errorMessage: "SYSTEM_RUN_DISABLED: security=deny",
426
- analysisOk,
427
- allowlistSatisfied,
428
- shellWrapperBlocked,
429
- windowsShellWrapperBlocked,
430
- requiresAsk: false,
431
- approvalDecision: params.approvalDecision,
432
- approvedByAsk
433
- };
434
- const requiresAsk = requiresExecApproval({
435
- ask: params.ask,
436
- security: params.security,
437
- analysisOk,
438
- allowlistSatisfied
439
- });
440
- if (requiresAsk && !approvedByAsk) return {
441
- allowed: false,
442
- eventReason: "approval-required",
443
- errorMessage: "SYSTEM_RUN_DENIED: approval required",
444
- analysisOk,
445
- allowlistSatisfied,
446
- shellWrapperBlocked,
447
- windowsShellWrapperBlocked,
448
- requiresAsk,
449
- approvalDecision: params.approvalDecision,
450
- approvedByAsk
451
- };
452
- if (params.security === "allowlist" && (!analysisOk || !allowlistSatisfied) && !approvedByAsk) return {
453
- allowed: false,
454
- eventReason: "allowlist-miss",
455
- errorMessage: formatSystemRunAllowlistMissMessage({
456
- shellWrapperBlocked,
457
- windowsShellWrapperBlocked
458
- }),
459
- analysisOk,
460
- allowlistSatisfied,
461
- shellWrapperBlocked,
462
- windowsShellWrapperBlocked,
463
- requiresAsk,
464
- approvalDecision: params.approvalDecision,
465
- approvedByAsk
466
- };
467
- return {
468
- allowed: true,
469
- analysisOk,
470
- allowlistSatisfied,
471
- shellWrapperBlocked,
472
- windowsShellWrapperBlocked,
473
- requiresAsk,
474
- approvalDecision: params.approvalDecision,
475
- approvedByAsk
476
- };
477
- }
478
- //#endregion
479
- //#region src/node-host/invoke-system-run-allowlist.ts
480
- function evaluateSystemRunAllowlist(params) {
481
- if (params.shellCommand) {
482
- const allowlistEval = evaluateShellAllowlist({
483
- command: params.shellCommand,
484
- allowlist: params.approvals.allowlist,
485
- safeBins: params.safeBins,
486
- safeBinProfiles: params.safeBinProfiles,
487
- cwd: params.cwd,
488
- env: params.env,
489
- trustedSafeBinDirs: params.trustedSafeBinDirs,
490
- skillBins: params.skillBins,
491
- autoAllowSkills: params.autoAllowSkills,
492
- platform: process.platform
493
- });
494
- return {
495
- analysisOk: allowlistEval.analysisOk,
496
- allowlistMatches: allowlistEval.allowlistMatches,
497
- allowlistSatisfied: params.security === "allowlist" && allowlistEval.analysisOk ? allowlistEval.allowlistSatisfied : false,
498
- segments: allowlistEval.segments
499
- };
500
- }
501
- const analysis = analyzeArgvCommand({
502
- argv: params.argv,
503
- cwd: params.cwd,
504
- env: params.env
505
- });
506
- const allowlistEval = evaluateExecAllowlist({
507
- analysis,
508
- allowlist: params.approvals.allowlist,
509
- safeBins: params.safeBins,
510
- safeBinProfiles: params.safeBinProfiles,
511
- cwd: params.cwd,
512
- trustedSafeBinDirs: params.trustedSafeBinDirs,
513
- skillBins: params.skillBins,
514
- autoAllowSkills: params.autoAllowSkills
515
- });
516
- return {
517
- analysisOk: analysis.ok,
518
- allowlistMatches: allowlistEval.allowlistMatches,
519
- allowlistSatisfied: params.security === "allowlist" && analysis.ok ? allowlistEval.allowlistSatisfied : false,
520
- segments: analysis.segments
521
- };
522
- }
523
- function resolvePlannedAllowlistArgv(params) {
524
- if (params.security !== "allowlist" || params.policy.approvedByAsk || params.shellCommand || !params.policy.analysisOk || !params.policy.allowlistSatisfied || params.segments.length !== 1) return;
525
- const plannedAllowlistArgv = resolvePlannedSegmentArgv(params.segments[0]);
526
- return plannedAllowlistArgv && plannedAllowlistArgv.length > 0 ? plannedAllowlistArgv : null;
527
- }
528
- function resolveSystemRunExecArgv(params) {
529
- let execArgv = params.plannedAllowlistArgv ?? params.argv;
530
- if (params.security === "allowlist" && params.isWindows && !params.policy.approvedByAsk && params.shellCommand && params.policy.analysisOk && params.policy.allowlistSatisfied && params.segments.length === 1 && params.segments[0]?.argv.length > 0) execArgv = params.segments[0].argv;
531
- return execArgv;
532
- }
533
- function applyOutputTruncation(result) {
534
- if (!result.truncated) return;
535
- const suffix = "... (truncated)";
536
- if (result.stderr.trim().length > 0) result.stderr = `${result.stderr}\n${suffix}`;
537
- else result.stdout = `${result.stdout}\n${suffix}`;
538
- }
539
- //#endregion
540
- //#region src/node-host/invoke-system-run-plan.ts
541
- const MUTABLE_ARGV1_INTERPRETER_PATTERNS = [
542
- /^(?:node|nodejs)$/,
543
- /^perl$/,
544
- /^php$/,
545
- /^python(?:\d+(?:\.\d+)*)?$/,
546
- /^ruby$/
547
- ];
548
- const GENERIC_MUTABLE_SCRIPT_RUNNERS = new Set([
549
- "esno",
550
- "jiti",
551
- "ts-node",
552
- "ts-node-esm",
553
- "tsx",
554
- "vite-node"
555
- ]);
556
- const BUN_SUBCOMMANDS = new Set([
557
- "add",
558
- "audit",
559
- "completions",
560
- "create",
561
- "exec",
562
- "help",
563
- "init",
564
- "install",
565
- "link",
566
- "outdated",
567
- "patch",
568
- "pm",
569
- "publish",
570
- "remove",
571
- "repl",
572
- "run",
573
- "test",
574
- "unlink",
575
- "update",
576
- "upgrade",
577
- "x"
578
- ]);
579
- const BUN_OPTIONS_WITH_VALUE = new Set([
580
- "--backend",
581
- "--bunfig",
582
- "--conditions",
583
- "--config",
584
- "--console-depth",
585
- "--cwd",
586
- "--define",
587
- "--elide-lines",
588
- "--env-file",
589
- "--extension-order",
590
- "--filter",
591
- "--hot",
592
- "--inspect",
593
- "--inspect-brk",
594
- "--inspect-wait",
595
- "--install",
596
- "--jsx-factory",
597
- "--jsx-fragment",
598
- "--jsx-import-source",
599
- "--loader",
600
- "--origin",
601
- "--port",
602
- "--preload",
603
- "--smol",
604
- "--tsconfig-override",
605
- "-c",
606
- "-e",
607
- "-p",
608
- "-r"
609
- ]);
610
- const DENO_RUN_OPTIONS_WITH_VALUE = new Set([
611
- "--cached-only",
612
- "--cert",
613
- "--config",
614
- "--env-file",
615
- "--ext",
616
- "--harmony-import-attributes",
617
- "--import-map",
618
- "--inspect",
619
- "--inspect-brk",
620
- "--inspect-wait",
621
- "--location",
622
- "--log-level",
623
- "--lock",
624
- "--node-modules-dir",
625
- "--no-check",
626
- "--preload",
627
- "--reload",
628
- "--seed",
629
- "--strace-ops",
630
- "--unstable-bare-node-builtins",
631
- "--v8-flags",
632
- "--watch",
633
- "--watch-exclude",
634
- "-L"
635
- ]);
636
- const NODE_OPTIONS_WITH_FILE_VALUE = new Set([
637
- "-r",
638
- "--experimental-loader",
639
- "--import",
640
- "--loader",
641
- "--require"
642
- ]);
643
- const RUBY_UNSAFE_APPROVAL_FLAGS = new Set([
644
- "-I",
645
- "-r",
646
- "--require"
647
- ]);
648
- const PERL_UNSAFE_APPROVAL_FLAGS = new Set([
649
- "-I",
650
- "-M",
651
- "-m"
652
- ]);
653
- const POSIX_SHELL_OPTIONS_WITH_VALUE = new Set([
654
- "--init-file",
655
- "--rcfile",
656
- "--startup-script",
657
- "-o"
658
- ]);
659
- const NPM_EXEC_OPTIONS_WITH_VALUE = new Set([
660
- "--cache",
661
- "--package",
662
- "--prefix",
663
- "--script-shell",
664
- "--userconfig",
665
- "--workspace",
666
- "-p",
667
- "-w"
668
- ]);
669
- const NPM_EXEC_FLAG_OPTIONS = new Set([
670
- "--no",
671
- "--quiet",
672
- "--ws",
673
- "--workspaces",
674
- "--yes",
675
- "-q",
676
- "-y"
677
- ]);
678
- const PNPM_OPTIONS_WITH_VALUE = new Set([
679
- "--config",
680
- "--dir",
681
- "--filter",
682
- "--reporter",
683
- "--stream",
684
- "--test-pattern",
685
- "--workspace-concurrency",
686
- "-C"
687
- ]);
688
- const PNPM_FLAG_OPTIONS = new Set([
689
- "--aggregate-output",
690
- "--color",
691
- "--recursive",
692
- "--silent",
693
- "--workspace-root",
694
- "-r"
695
- ]);
696
- function normalizeString(value) {
697
- if (typeof value !== "string") return null;
698
- const trimmed = value.trim();
699
- return trimmed ? trimmed : null;
700
- }
701
- function pathComponentsFromRootSync(targetPath) {
702
- const absolute = path.resolve(targetPath);
703
- const parts = [];
704
- let cursor = absolute;
705
- while (true) {
706
- parts.unshift(cursor);
707
- const parent = path.dirname(cursor);
708
- if (parent === cursor) return parts;
709
- cursor = parent;
710
- }
711
- }
712
- function isWritableByCurrentProcessSync(candidate) {
713
- try {
714
- fs.accessSync(candidate, fs.constants.W_OK);
715
- return true;
716
- } catch {
717
- return false;
718
- }
719
- }
720
- function hasMutableSymlinkPathComponentSync(targetPath) {
721
- for (const component of pathComponentsFromRootSync(targetPath)) try {
722
- if (!fs.lstatSync(component).isSymbolicLink()) continue;
723
- if (isWritableByCurrentProcessSync(path.dirname(component))) return true;
724
- } catch {
725
- return true;
726
- }
727
- return false;
728
- }
729
- function shouldPinExecutableForApproval(params) {
730
- if (params.shellCommand !== null) return false;
731
- return (params.wrapperChain?.length ?? 0) === 0;
732
- }
733
- function hashFileContentsSync(filePath) {
734
- return crypto.createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
735
- }
736
- function looksLikePathToken(token) {
737
- return token.startsWith(".") || token.startsWith("/") || token.startsWith("\\") || token.includes("/") || token.includes("\\") || path.extname(token).length > 0;
738
- }
739
- function resolvesToExistingFileSync(rawOperand, cwd) {
740
- if (!rawOperand) return false;
741
- try {
742
- return fs.statSync(path.resolve(cwd ?? process.cwd(), rawOperand)).isFile();
743
- } catch {
744
- return false;
745
- }
746
- }
747
- function unwrapArgvForMutableOperand(argv) {
748
- let current = argv;
749
- let baseIndex = 0;
750
- while (true) {
751
- const dispatchUnwrap = unwrapKnownDispatchWrapperInvocation(current);
752
- if (dispatchUnwrap.kind === "unwrapped") {
753
- baseIndex += current.length - dispatchUnwrap.argv.length;
754
- current = dispatchUnwrap.argv;
755
- continue;
756
- }
757
- const shellMultiplexerUnwrap = unwrapKnownShellMultiplexerInvocation(current);
758
- if (shellMultiplexerUnwrap.kind === "unwrapped") {
759
- baseIndex += current.length - shellMultiplexerUnwrap.argv.length;
760
- current = shellMultiplexerUnwrap.argv;
761
- continue;
762
- }
763
- const packageManagerUnwrap = unwrapKnownPackageManagerExecInvocation(current);
764
- if (packageManagerUnwrap) {
765
- baseIndex += current.length - packageManagerUnwrap.length;
766
- current = packageManagerUnwrap;
767
- continue;
768
- }
769
- return {
770
- argv: current,
771
- baseIndex
772
- };
773
- }
774
- }
775
- function unwrapKnownPackageManagerExecInvocation(argv) {
776
- switch (normalizePackageManagerExecToken(argv[0] ?? "")) {
777
- case "npm": return unwrapNpmExecInvocation(argv);
778
- case "npx":
779
- case "bunx": return unwrapDirectPackageExecInvocation(argv);
780
- case "pnpm": return unwrapPnpmExecInvocation(argv);
781
- default: return null;
782
- }
783
- }
784
- function normalizePackageManagerExecToken(token) {
785
- const normalized = normalizeExecutableToken(token);
786
- if (!normalized) return normalized;
787
- return normalized.replace(/\.(?:c|m)?js$/i, "");
788
- }
789
- function unwrapPnpmExecInvocation(argv) {
790
- let idx = 1;
791
- while (idx < argv.length) {
792
- const token = argv[idx]?.trim() ?? "";
793
- if (!token) {
794
- idx += 1;
795
- continue;
796
- }
797
- if (token === "--") {
798
- idx += 1;
799
- continue;
800
- }
801
- if (!token.startsWith("-")) {
802
- if (token === "exec") {
803
- if (idx + 1 >= argv.length) return null;
804
- const tail = argv.slice(idx + 1);
805
- return tail[0] === "--" ? tail.length > 1 ? tail.slice(1) : null : tail;
806
- }
807
- if (token === "node") {
808
- const tail = argv.slice(idx + 1);
809
- return ["node", ...tail[0] === "--" ? tail.slice(1) : tail];
810
- }
811
- return null;
812
- }
813
- const [flag] = token.toLowerCase().split("=", 2);
814
- if (PNPM_OPTIONS_WITH_VALUE.has(flag)) {
815
- idx += token.includes("=") ? 1 : 2;
816
- continue;
817
- }
818
- if (PNPM_FLAG_OPTIONS.has(flag)) {
819
- idx += 1;
820
- continue;
821
- }
822
- return null;
823
- }
824
- return null;
825
- }
826
- function unwrapDirectPackageExecInvocation(argv) {
827
- let idx = 1;
828
- while (idx < argv.length) {
829
- const token = argv[idx]?.trim() ?? "";
830
- if (!token) {
831
- idx += 1;
832
- continue;
833
- }
834
- if (!token.startsWith("-")) return argv.slice(idx);
835
- const [flag] = token.toLowerCase().split("=", 2);
836
- if (flag === "-c" || flag === "--call") return null;
837
- if (NPM_EXEC_OPTIONS_WITH_VALUE.has(flag)) {
838
- idx += token.includes("=") ? 1 : 2;
839
- continue;
840
- }
841
- if (NPM_EXEC_FLAG_OPTIONS.has(flag)) {
842
- idx += 1;
843
- continue;
844
- }
845
- return null;
846
- }
847
- return null;
848
- }
849
- function unwrapNpmExecInvocation(argv) {
850
- let idx = 1;
851
- while (idx < argv.length) {
852
- const token = argv[idx]?.trim() ?? "";
853
- if (!token) {
854
- idx += 1;
855
- continue;
856
- }
857
- if (!token.startsWith("-")) {
858
- if (token !== "exec") return null;
859
- idx += 1;
860
- break;
861
- }
862
- if ((token === "-C" || token === "--prefix" || token === "--userconfig") && !token.includes("=")) {
863
- idx += 2;
864
- continue;
865
- }
866
- idx += 1;
867
- }
868
- if (idx >= argv.length) return null;
869
- const tail = argv.slice(idx);
870
- if (tail[0] === "--") return tail.length > 1 ? tail.slice(1) : null;
871
- return unwrapDirectPackageExecInvocation(["npx", ...tail]);
872
- }
873
- function resolvePosixShellScriptOperandIndex(argv) {
874
- if (resolveInlineCommandMatch(argv, POSIX_INLINE_COMMAND_FLAGS, { allowCombinedC: true }).valueTokenIndex !== null) return null;
875
- let afterDoubleDash = false;
876
- for (let i = 1; i < argv.length; i += 1) {
877
- const token = argv[i]?.trim() ?? "";
878
- if (!token) continue;
879
- if (token === "-") return null;
880
- if (!afterDoubleDash && token === "--") {
881
- afterDoubleDash = true;
882
- continue;
883
- }
884
- if (!afterDoubleDash && token === "-s") return null;
885
- if (!afterDoubleDash && token.startsWith("-")) {
886
- const [flag] = token.toLowerCase().split("=", 2);
887
- if (POSIX_SHELL_OPTIONS_WITH_VALUE.has(flag)) {
888
- if (!token.includes("=")) i += 1;
889
- continue;
890
- }
891
- continue;
892
- }
893
- return i;
894
- }
895
- return null;
896
- }
897
- function resolveOptionFilteredFileOperandIndex(params) {
898
- let afterDoubleDash = false;
899
- for (let i = params.startIndex; i < params.argv.length; i += 1) {
900
- const token = params.argv[i]?.trim() ?? "";
901
- if (!token) continue;
902
- if (afterDoubleDash) return resolvesToExistingFileSync(token, params.cwd) ? i : null;
903
- if (token === "--") {
904
- afterDoubleDash = true;
905
- continue;
906
- }
907
- if (token === "-") return null;
908
- if (token.startsWith("-")) {
909
- if (!token.includes("=") && params.optionsWithValue?.has(token)) i += 1;
910
- continue;
911
- }
912
- return resolvesToExistingFileSync(token, params.cwd) ? i : null;
913
- }
914
- return null;
915
- }
916
- function resolveOptionFilteredPositionalIndex(params) {
917
- let afterDoubleDash = false;
918
- for (let i = params.startIndex; i < params.argv.length; i += 1) {
919
- const token = params.argv[i]?.trim() ?? "";
920
- if (!token) continue;
921
- if (afterDoubleDash) return i;
922
- if (token === "--") {
923
- afterDoubleDash = true;
924
- continue;
925
- }
926
- if (token === "-") return null;
927
- if (token.startsWith("-")) {
928
- if (!token.includes("=") && params.optionsWithValue?.has(token)) i += 1;
929
- continue;
930
- }
931
- return i;
932
- }
933
- return null;
934
- }
935
- function collectExistingFileOperandIndexes(params) {
936
- let afterDoubleDash = false;
937
- const hits = [];
938
- for (let i = params.startIndex; i < params.argv.length; i += 1) {
939
- const token = params.argv[i]?.trim() ?? "";
940
- if (!token) continue;
941
- if (afterDoubleDash) {
942
- if (resolvesToExistingFileSync(token, params.cwd)) hits.push(i);
943
- continue;
944
- }
945
- if (token === "--") {
946
- afterDoubleDash = true;
947
- continue;
948
- }
949
- if (token === "-") return {
950
- hits: [],
951
- sawOptionValueFile: false
952
- };
953
- if (token.startsWith("-")) {
954
- const [flag, inlineValue] = token.split("=", 2);
955
- if (params.optionsWithFileValue?.has(flag.toLowerCase())) {
956
- if (inlineValue && resolvesToExistingFileSync(inlineValue, params.cwd)) {
957
- hits.push(i);
958
- return {
959
- hits,
960
- sawOptionValueFile: true
961
- };
962
- }
963
- const nextToken = params.argv[i + 1]?.trim() ?? "";
964
- if (!inlineValue && nextToken && resolvesToExistingFileSync(nextToken, params.cwd)) {
965
- hits.push(i + 1);
966
- return {
967
- hits,
968
- sawOptionValueFile: true
969
- };
970
- }
971
- }
972
- continue;
973
- }
974
- if (resolvesToExistingFileSync(token, params.cwd)) hits.push(i);
975
- }
976
- return {
977
- hits,
978
- sawOptionValueFile: false
979
- };
980
- }
981
- function resolveGenericInterpreterScriptOperandIndex(params) {
982
- const collection = collectExistingFileOperandIndexes({
983
- argv: params.argv,
984
- startIndex: 1,
985
- cwd: params.cwd,
986
- optionsWithFileValue: params.optionsWithFileValue
987
- });
988
- if (collection.sawOptionValueFile) return null;
989
- return collection.hits.length === 1 ? collection.hits[0] : null;
990
- }
991
- function resolveBunScriptOperandIndex(params) {
992
- const directIndex = resolveOptionFilteredPositionalIndex({
993
- argv: params.argv,
994
- startIndex: 1,
995
- optionsWithValue: BUN_OPTIONS_WITH_VALUE
996
- });
997
- if (directIndex === null) return null;
998
- const directToken = params.argv[directIndex]?.trim() ?? "";
999
- if (directToken === "run") return resolveOptionFilteredFileOperandIndex({
1000
- argv: params.argv,
1001
- startIndex: directIndex + 1,
1002
- cwd: params.cwd,
1003
- optionsWithValue: BUN_OPTIONS_WITH_VALUE
1004
- });
1005
- if (BUN_SUBCOMMANDS.has(directToken)) return null;
1006
- if (!looksLikePathToken(directToken)) return null;
1007
- return directIndex;
1008
- }
1009
- function resolveDenoRunScriptOperandIndex(params) {
1010
- if ((params.argv[1]?.trim() ?? "") !== "run") return null;
1011
- return resolveOptionFilteredFileOperandIndex({
1012
- argv: params.argv,
1013
- startIndex: 2,
1014
- cwd: params.cwd,
1015
- optionsWithValue: DENO_RUN_OPTIONS_WITH_VALUE
1016
- });
1017
- }
1018
- function hasRubyUnsafeApprovalFlag(argv) {
1019
- let afterDoubleDash = false;
1020
- for (let i = 1; i < argv.length; i += 1) {
1021
- const token = argv[i]?.trim() ?? "";
1022
- if (!token) continue;
1023
- if (afterDoubleDash) return false;
1024
- if (token === "--") {
1025
- afterDoubleDash = true;
1026
- continue;
1027
- }
1028
- if (token === "-I" || token === "-r") return true;
1029
- if (token.startsWith("-I") || token.startsWith("-r")) return true;
1030
- if (RUBY_UNSAFE_APPROVAL_FLAGS.has(token.toLowerCase())) return true;
1031
- }
1032
- return false;
1033
- }
1034
- function hasPerlUnsafeApprovalFlag(argv) {
1035
- let afterDoubleDash = false;
1036
- for (let i = 1; i < argv.length; i += 1) {
1037
- const token = argv[i]?.trim() ?? "";
1038
- if (!token) continue;
1039
- if (afterDoubleDash) return false;
1040
- if (token === "--") {
1041
- afterDoubleDash = true;
1042
- continue;
1043
- }
1044
- if (token === "-I" || token === "-M" || token === "-m") return true;
1045
- if (token.startsWith("-I") || token.startsWith("-M") || token.startsWith("-m")) return true;
1046
- if (PERL_UNSAFE_APPROVAL_FLAGS.has(token)) return true;
1047
- }
1048
- return false;
1049
- }
1050
- function isMutableScriptRunner(executable) {
1051
- return GENERIC_MUTABLE_SCRIPT_RUNNERS.has(executable) || isInterpreterLikeSafeBin(executable);
1052
- }
1053
- function resolveMutableFileOperandIndex(argv, cwd) {
1054
- const unwrapped = unwrapArgvForMutableOperand(argv);
1055
- const executable = normalizeExecutableToken(unwrapped.argv[0] ?? "");
1056
- if (!executable) return null;
1057
- if (POSIX_SHELL_WRAPPERS.has(executable)) {
1058
- const shellIndex = resolvePosixShellScriptOperandIndex(unwrapped.argv);
1059
- return shellIndex === null ? null : unwrapped.baseIndex + shellIndex;
1060
- }
1061
- if (MUTABLE_ARGV1_INTERPRETER_PATTERNS.some((pattern) => pattern.test(executable))) {
1062
- const operand = unwrapped.argv[1]?.trim() ?? "";
1063
- if (operand && operand !== "-" && !operand.startsWith("-")) return unwrapped.baseIndex + 1;
1064
- }
1065
- if (executable === "bun") {
1066
- const bunIndex = resolveBunScriptOperandIndex({
1067
- argv: unwrapped.argv,
1068
- cwd
1069
- });
1070
- if (bunIndex !== null) return unwrapped.baseIndex + bunIndex;
1071
- }
1072
- if (executable === "deno") {
1073
- const denoIndex = resolveDenoRunScriptOperandIndex({
1074
- argv: unwrapped.argv,
1075
- cwd
1076
- });
1077
- if (denoIndex !== null) return unwrapped.baseIndex + denoIndex;
1078
- }
1079
- if (executable === "ruby" && hasRubyUnsafeApprovalFlag(unwrapped.argv)) return null;
1080
- if (executable === "perl" && hasPerlUnsafeApprovalFlag(unwrapped.argv)) return null;
1081
- if (!isMutableScriptRunner(executable)) return null;
1082
- const genericIndex = resolveGenericInterpreterScriptOperandIndex({
1083
- argv: unwrapped.argv,
1084
- cwd,
1085
- optionsWithFileValue: executable === "node" || executable === "nodejs" ? NODE_OPTIONS_WITH_FILE_VALUE : void 0
1086
- });
1087
- return genericIndex === null ? null : unwrapped.baseIndex + genericIndex;
1088
- }
1089
- function shellPayloadNeedsStableBinding(shellCommand, cwd) {
1090
- const argv = splitShellArgs(shellCommand);
1091
- if (!argv || argv.length === 0) return false;
1092
- const snapshot = resolveMutableFileOperandSnapshotSync({
1093
- argv,
1094
- cwd,
1095
- shellCommand: null
1096
- });
1097
- if (!snapshot.ok) return true;
1098
- if (snapshot.snapshot) return true;
1099
- return resolvesToExistingFileSync(argv[0]?.trim() ?? "", cwd);
1100
- }
1101
- function requiresStableInterpreterApprovalBindingWithShellCommand(params) {
1102
- if (params.shellCommand !== null) return shellPayloadNeedsStableBinding(params.shellCommand, params.cwd);
1103
- const executable = normalizeExecutableToken(unwrapArgvForMutableOperand(params.argv).argv[0] ?? "");
1104
- if (!executable) return false;
1105
- if (POSIX_SHELL_WRAPPERS.has(executable)) return false;
1106
- return isMutableScriptRunner(executable);
1107
- }
1108
- function resolveMutableFileOperandSnapshotSync(params) {
1109
- const argvIndex = resolveMutableFileOperandIndex(params.argv, params.cwd);
1110
- if (argvIndex === null) {
1111
- if (requiresStableInterpreterApprovalBindingWithShellCommand({
1112
- argv: params.argv,
1113
- shellCommand: params.shellCommand,
1114
- cwd: params.cwd
1115
- })) return {
1116
- ok: false,
1117
- message: "SYSTEM_RUN_DENIED: approval cannot safely bind this interpreter/runtime command"
1118
- };
1119
- return {
1120
- ok: true,
1121
- snapshot: null
1122
- };
1123
- }
1124
- const rawOperand = params.argv[argvIndex]?.trim();
1125
- if (!rawOperand) return {
1126
- ok: false,
1127
- message: "SYSTEM_RUN_DENIED: approval requires a stable script operand"
1128
- };
1129
- const resolvedPath = path.resolve(params.cwd ?? process.cwd(), rawOperand);
1130
- let realPath;
1131
- let stat;
1132
- try {
1133
- realPath = fs.realpathSync(resolvedPath);
1134
- stat = fs.statSync(realPath);
1135
- } catch {
1136
- return {
1137
- ok: false,
1138
- message: "SYSTEM_RUN_DENIED: approval requires an existing script operand"
1139
- };
1140
- }
1141
- if (!stat.isFile()) return {
1142
- ok: false,
1143
- message: "SYSTEM_RUN_DENIED: approval requires a file script operand"
1144
- };
1145
- return {
1146
- ok: true,
1147
- snapshot: {
1148
- argvIndex,
1149
- path: realPath,
1150
- sha256: hashFileContentsSync(realPath)
1151
- }
1152
- };
1153
- }
1154
- function resolveCanonicalApprovalCwdSync(cwd) {
1155
- const requestedCwd = path.resolve(cwd);
1156
- let cwdLstat;
1157
- let cwdStat;
1158
- let cwdReal;
1159
- let cwdRealStat;
1160
- try {
1161
- cwdLstat = fs.lstatSync(requestedCwd);
1162
- cwdStat = fs.statSync(requestedCwd);
1163
- cwdReal = fs.realpathSync(requestedCwd);
1164
- cwdRealStat = fs.statSync(cwdReal);
1165
- } catch {
1166
- return {
1167
- ok: false,
1168
- message: "SYSTEM_RUN_DENIED: approval requires an existing canonical cwd"
1169
- };
1170
- }
1171
- if (!cwdStat.isDirectory()) return {
1172
- ok: false,
1173
- message: "SYSTEM_RUN_DENIED: approval requires cwd to be a directory"
1174
- };
1175
- if (hasMutableSymlinkPathComponentSync(requestedCwd)) return {
1176
- ok: false,
1177
- message: "SYSTEM_RUN_DENIED: approval requires canonical cwd (no symlink path components)"
1178
- };
1179
- if (cwdLstat.isSymbolicLink()) return {
1180
- ok: false,
1181
- message: "SYSTEM_RUN_DENIED: approval requires canonical cwd (no symlink cwd)"
1182
- };
1183
- if (!sameFileIdentity(cwdStat, cwdLstat) || !sameFileIdentity(cwdStat, cwdRealStat) || !sameFileIdentity(cwdLstat, cwdRealStat)) return {
1184
- ok: false,
1185
- message: "SYSTEM_RUN_DENIED: approval cwd identity mismatch"
1186
- };
1187
- return {
1188
- ok: true,
1189
- snapshot: {
1190
- cwd: cwdReal,
1191
- stat: cwdStat
1192
- }
1193
- };
1194
- }
1195
- function revalidateApprovedCwdSnapshot(params) {
1196
- const current = resolveCanonicalApprovalCwdSync(params.snapshot.cwd);
1197
- if (!current.ok) return false;
1198
- return sameFileIdentity(params.snapshot.stat, current.snapshot.stat);
1199
- }
1200
- function revalidateApprovedMutableFileOperand(params) {
1201
- const operand = params.argv[params.snapshot.argvIndex]?.trim();
1202
- if (!operand) return false;
1203
- const resolvedPath = path.resolve(params.cwd ?? process.cwd(), operand);
1204
- let realPath;
1205
- try {
1206
- realPath = fs.realpathSync(resolvedPath);
1207
- } catch {
1208
- return false;
1209
- }
1210
- if (realPath !== params.snapshot.path) return false;
1211
- try {
1212
- return hashFileContentsSync(realPath) === params.snapshot.sha256;
1213
- } catch {
1214
- return false;
1215
- }
1216
- }
1217
- function hardenApprovedExecutionPaths(params) {
1218
- if (!params.approvedByAsk) return {
1219
- ok: true,
1220
- argv: params.argv,
1221
- argvChanged: false,
1222
- cwd: params.cwd,
1223
- approvedCwdSnapshot: void 0
1224
- };
1225
- let hardenedCwd = params.cwd;
1226
- let approvedCwdSnapshot;
1227
- if (hardenedCwd) {
1228
- const canonicalCwd = resolveCanonicalApprovalCwdSync(hardenedCwd);
1229
- if (!canonicalCwd.ok) return canonicalCwd;
1230
- hardenedCwd = canonicalCwd.snapshot.cwd;
1231
- approvedCwdSnapshot = canonicalCwd.snapshot;
1232
- }
1233
- if (params.argv.length === 0) return {
1234
- ok: true,
1235
- argv: params.argv,
1236
- argvChanged: false,
1237
- cwd: hardenedCwd,
1238
- approvedCwdSnapshot
1239
- };
1240
- const resolution = resolveCommandResolutionFromArgv(params.argv, hardenedCwd);
1241
- if (!shouldPinExecutableForApproval({
1242
- shellCommand: params.shellCommand,
1243
- wrapperChain: resolution?.wrapperChain
1244
- })) return {
1245
- ok: true,
1246
- argv: params.argv,
1247
- argvChanged: false,
1248
- cwd: hardenedCwd,
1249
- approvedCwdSnapshot
1250
- };
1251
- const pinnedExecutable = resolution?.resolvedRealPath ?? resolution?.resolvedPath;
1252
- if (!pinnedExecutable) return {
1253
- ok: false,
1254
- message: "SYSTEM_RUN_DENIED: approval requires a stable executable path"
1255
- };
1256
- if (pinnedExecutable === params.argv[0]) return {
1257
- ok: true,
1258
- argv: params.argv,
1259
- argvChanged: false,
1260
- cwd: hardenedCwd,
1261
- approvedCwdSnapshot
1262
- };
1263
- const argv = [...params.argv];
1264
- argv[0] = pinnedExecutable;
1265
- return {
1266
- ok: true,
1267
- argv,
1268
- argvChanged: true,
1269
- cwd: hardenedCwd,
1270
- approvedCwdSnapshot
1271
- };
1272
- }
1273
- function buildSystemRunApprovalPlan(params) {
1274
- const command = resolveSystemRunCommandRequest({
1275
- command: params.command,
1276
- rawCommand: params.rawCommand
1277
- });
1278
- if (!command.ok) return {
1279
- ok: false,
1280
- message: command.message
1281
- };
1282
- if (command.argv.length === 0) return {
1283
- ok: false,
1284
- message: "command required"
1285
- };
1286
- const hardening = hardenApprovedExecutionPaths({
1287
- approvedByAsk: true,
1288
- argv: command.argv,
1289
- shellCommand: command.shellPayload,
1290
- cwd: normalizeString(params.cwd) ?? void 0
1291
- });
1292
- if (!hardening.ok) return {
1293
- ok: false,
1294
- message: hardening.message
1295
- };
1296
- const commandText = formatExecCommand(hardening.argv);
1297
- const commandPreview = command.previewText?.trim() && command.previewText.trim() !== commandText ? command.previewText.trim() : null;
1298
- const mutableFileOperand = resolveMutableFileOperandSnapshotSync({
1299
- argv: hardening.argv,
1300
- cwd: hardening.cwd,
1301
- shellCommand: command.shellPayload
1302
- });
1303
- if (!mutableFileOperand.ok) return {
1304
- ok: false,
1305
- message: mutableFileOperand.message
1306
- };
1307
- return {
1308
- ok: true,
1309
- plan: {
1310
- argv: hardening.argv,
1311
- cwd: hardening.cwd ?? null,
1312
- commandText,
1313
- commandPreview,
1314
- agentId: normalizeString(params.agentId),
1315
- sessionKey: normalizeString(params.sessionKey),
1316
- mutableFileOperand: mutableFileOperand.snapshot ?? void 0
1317
- }
1318
- };
1319
- }
1320
- //#endregion
1321
- //#region src/node-host/invoke-system-run.ts
1322
- const safeBinTrustedDirWarningCache = /* @__PURE__ */ new Set();
1323
- const APPROVAL_CWD_DRIFT_DENIED_MESSAGE = "SYSTEM_RUN_DENIED: approval cwd changed before execution";
1324
- const APPROVAL_SCRIPT_OPERAND_BINDING_DENIED_MESSAGE = "SYSTEM_RUN_DENIED: approval missing script operand binding";
1325
- const APPROVAL_SCRIPT_OPERAND_DRIFT_DENIED_MESSAGE = "SYSTEM_RUN_DENIED: approval script operand changed before execution";
1326
- function warnWritableTrustedDirOnce(message) {
1327
- if (safeBinTrustedDirWarningCache.has(message)) return;
1328
- safeBinTrustedDirWarningCache.add(message);
1329
- logWarn(message);
1330
- }
1331
- function normalizeDeniedReason(reason) {
1332
- switch (reason) {
1333
- case "security=deny":
1334
- case "approval-required":
1335
- case "allowlist-miss":
1336
- case "execution-plan-miss":
1337
- case "companion-unavailable":
1338
- case "permission:screenRecording": return reason;
1339
- default: return "approval-required";
1340
- }
1341
- }
1342
- async function sendSystemRunDenied(opts, execution, params) {
1343
- await opts.sendNodeEvent(opts.client, "exec.denied", opts.buildExecEventPayload({
1344
- sessionKey: execution.sessionKey,
1345
- runId: execution.runId,
1346
- host: "node",
1347
- command: execution.commandText,
1348
- reason: params.reason,
1349
- suppressNotifyOnExit: execution.suppressNotifyOnExit
1350
- }));
1351
- await opts.sendInvokeResult({
1352
- ok: false,
1353
- error: {
1354
- code: "UNAVAILABLE",
1355
- message: params.message
1356
- }
1357
- });
1358
- }
1359
- async function sendSystemRunCompleted(opts, execution, result, payloadJSON) {
1360
- await opts.sendExecFinishedEvent({
1361
- sessionKey: execution.sessionKey,
1362
- runId: execution.runId,
1363
- commandText: execution.commandText,
1364
- result,
1365
- suppressNotifyOnExit: execution.suppressNotifyOnExit
1366
- });
1367
- await opts.sendInvokeResult({
1368
- ok: true,
1369
- payloadJSON
1370
- });
1371
- }
1372
- async function parseSystemRunPhase(opts) {
1373
- const command = resolveSystemRunCommandRequest({
1374
- command: opts.params.command,
1375
- rawCommand: opts.params.rawCommand
1376
- });
1377
- if (!command.ok) {
1378
- await opts.sendInvokeResult({
1379
- ok: false,
1380
- error: {
1381
- code: "INVALID_REQUEST",
1382
- message: command.message
1383
- }
1384
- });
1385
- return null;
1386
- }
1387
- if (command.argv.length === 0) {
1388
- await opts.sendInvokeResult({
1389
- ok: false,
1390
- error: {
1391
- code: "INVALID_REQUEST",
1392
- message: "command required"
1393
- }
1394
- });
1395
- return null;
1396
- }
1397
- const shellPayload = command.shellPayload;
1398
- const commandText = command.commandText;
1399
- const approvalPlan = opts.params.systemRunPlan === void 0 ? null : normalizeSystemRunApprovalPlan(opts.params.systemRunPlan);
1400
- if (opts.params.systemRunPlan !== void 0 && !approvalPlan) {
1401
- await opts.sendInvokeResult({
1402
- ok: false,
1403
- error: {
1404
- code: "INVALID_REQUEST",
1405
- message: "systemRunPlan invalid"
1406
- }
1407
- });
1408
- return null;
1409
- }
1410
- const agentId = opts.params.agentId?.trim() || void 0;
1411
- const sessionKey = opts.params.sessionKey?.trim() || "node";
1412
- const runId = opts.params.runId?.trim() || crypto.randomUUID();
1413
- const suppressNotifyOnExit = opts.params.suppressNotifyOnExit === true;
1414
- const envOverrides = sanitizeSystemRunEnvOverrides({
1415
- overrides: opts.params.env ?? void 0,
1416
- shellWrapper: shellPayload !== null
1417
- });
1418
- return {
1419
- argv: command.argv,
1420
- shellPayload,
1421
- commandText,
1422
- commandPreview: command.previewText,
1423
- approvalPlan,
1424
- agentId,
1425
- sessionKey,
1426
- runId,
1427
- execution: {
1428
- sessionKey,
1429
- runId,
1430
- commandText,
1431
- suppressNotifyOnExit
1432
- },
1433
- approvalDecision: resolveExecApprovalDecision(opts.params.approvalDecision),
1434
- envOverrides,
1435
- env: opts.sanitizeEnv(envOverrides),
1436
- cwd: opts.params.cwd?.trim() || void 0,
1437
- timeoutMs: opts.params.timeoutMs ?? void 0,
1438
- needsScreenRecording: opts.params.needsScreenRecording === true,
1439
- approved: opts.params.approved === true,
1440
- suppressNotifyOnExit
1441
- };
1442
- }
1443
- async function evaluateSystemRunPolicyPhase(opts, parsed) {
1444
- const cfg = loadConfig();
1445
- const agentExec = parsed.agentId ? resolveAgentConfig(cfg, parsed.agentId)?.tools?.exec : void 0;
1446
- const configuredSecurity = opts.resolveExecSecurity(agentExec?.security ?? cfg.tools?.exec?.security);
1447
- const configuredAsk = opts.resolveExecAsk(agentExec?.ask ?? cfg.tools?.exec?.ask);
1448
- const approvals = resolveExecApprovals(parsed.agentId, {
1449
- security: configuredSecurity,
1450
- ask: configuredAsk
1451
- });
1452
- const security = approvals.agent.security;
1453
- const ask = approvals.agent.ask;
1454
- const autoAllowSkills = approvals.agent.autoAllowSkills;
1455
- const { safeBins, safeBinProfiles, trustedSafeBinDirs } = resolveExecSafeBinRuntimePolicy({
1456
- global: cfg.tools?.exec,
1457
- local: agentExec,
1458
- onWarning: warnWritableTrustedDirOnce
1459
- });
1460
- const bins = autoAllowSkills ? await opts.skillBins.current() : [];
1461
- let { analysisOk, allowlistMatches, allowlistSatisfied, segments } = evaluateSystemRunAllowlist({
1462
- shellCommand: parsed.shellPayload,
1463
- argv: parsed.argv,
1464
- approvals,
1465
- security,
1466
- safeBins,
1467
- safeBinProfiles,
1468
- trustedSafeBinDirs,
1469
- cwd: parsed.cwd,
1470
- env: parsed.env,
1471
- skillBins: bins,
1472
- autoAllowSkills
1473
- });
1474
- const isWindows = process.platform === "win32";
1475
- const cmdInvocation = parsed.shellPayload ? opts.isCmdExeInvocation(segments[0]?.argv ?? []) : opts.isCmdExeInvocation(parsed.argv);
1476
- const policy = evaluateSystemRunPolicy({
1477
- security,
1478
- ask,
1479
- analysisOk,
1480
- allowlistSatisfied,
1481
- approvalDecision: parsed.approvalDecision,
1482
- approved: parsed.approved,
1483
- isWindows,
1484
- cmdInvocation,
1485
- shellWrapperInvocation: parsed.shellPayload !== null
1486
- });
1487
- analysisOk = policy.analysisOk;
1488
- allowlistSatisfied = policy.allowlistSatisfied;
1489
- if (!policy.allowed) {
1490
- await sendSystemRunDenied(opts, parsed.execution, {
1491
- reason: policy.eventReason,
1492
- message: policy.errorMessage
1493
- });
1494
- return null;
1495
- }
1496
- if (security === "allowlist" && parsed.shellPayload && !policy.approvedByAsk) {
1497
- await sendSystemRunDenied(opts, parsed.execution, {
1498
- reason: "approval-required",
1499
- message: "SYSTEM_RUN_DENIED: approval required"
1500
- });
1501
- return null;
1502
- }
1503
- const hardenedPaths = hardenApprovedExecutionPaths({
1504
- approvedByAsk: policy.approvedByAsk,
1505
- argv: parsed.argv,
1506
- shellCommand: parsed.shellPayload,
1507
- cwd: parsed.cwd
1508
- });
1509
- if (!hardenedPaths.ok) {
1510
- await sendSystemRunDenied(opts, parsed.execution, {
1511
- reason: "approval-required",
1512
- message: hardenedPaths.message
1513
- });
1514
- return null;
1515
- }
1516
- const approvedCwdSnapshot = policy.approvedByAsk ? hardenedPaths.approvedCwdSnapshot : void 0;
1517
- if (policy.approvedByAsk && hardenedPaths.cwd && !approvedCwdSnapshot) {
1518
- await sendSystemRunDenied(opts, parsed.execution, {
1519
- reason: "approval-required",
1520
- message: APPROVAL_CWD_DRIFT_DENIED_MESSAGE
1521
- });
1522
- return null;
1523
- }
1524
- const plannedAllowlistArgv = resolvePlannedAllowlistArgv({
1525
- security,
1526
- shellCommand: parsed.shellPayload,
1527
- policy,
1528
- segments
1529
- });
1530
- if (plannedAllowlistArgv === null) {
1531
- await sendSystemRunDenied(opts, parsed.execution, {
1532
- reason: "execution-plan-miss",
1533
- message: "SYSTEM_RUN_DENIED: execution plan mismatch"
1534
- });
1535
- return null;
1536
- }
1537
- return {
1538
- ...parsed,
1539
- argv: hardenedPaths.argv,
1540
- cwd: hardenedPaths.cwd,
1541
- approvals,
1542
- security,
1543
- policy,
1544
- allowlistMatches,
1545
- analysisOk,
1546
- allowlistSatisfied,
1547
- segments,
1548
- plannedAllowlistArgv: plannedAllowlistArgv ?? void 0,
1549
- isWindows,
1550
- approvedCwdSnapshot
1551
- };
1552
- }
1553
- async function executeSystemRunPhase(opts, phase) {
1554
- if (phase.approvedCwdSnapshot && !revalidateApprovedCwdSnapshot({ snapshot: phase.approvedCwdSnapshot })) {
1555
- logWarn(`security: system.run approval cwd drift blocked (runId=${phase.runId})`);
1556
- await sendSystemRunDenied(opts, phase.execution, {
1557
- reason: "approval-required",
1558
- message: APPROVAL_CWD_DRIFT_DENIED_MESSAGE
1559
- });
1560
- return;
1561
- }
1562
- const expectedMutableFileOperand = phase.approvalPlan ? resolveMutableFileOperandSnapshotSync({
1563
- argv: phase.argv,
1564
- cwd: phase.cwd,
1565
- shellCommand: phase.shellPayload
1566
- }) : null;
1567
- if (expectedMutableFileOperand && !expectedMutableFileOperand.ok) {
1568
- logWarn(`security: system.run approval script binding blocked (runId=${phase.runId})`);
1569
- await sendSystemRunDenied(opts, phase.execution, {
1570
- reason: "approval-required",
1571
- message: expectedMutableFileOperand.message
1572
- });
1573
- return;
1574
- }
1575
- if (expectedMutableFileOperand?.snapshot && !phase.approvalPlan?.mutableFileOperand) {
1576
- logWarn(`security: system.run approval script binding missing (runId=${phase.runId})`);
1577
- await sendSystemRunDenied(opts, phase.execution, {
1578
- reason: "approval-required",
1579
- message: APPROVAL_SCRIPT_OPERAND_BINDING_DENIED_MESSAGE
1580
- });
1581
- return;
1582
- }
1583
- if (phase.approvalPlan?.mutableFileOperand && !revalidateApprovedMutableFileOperand({
1584
- snapshot: phase.approvalPlan.mutableFileOperand,
1585
- argv: phase.argv,
1586
- cwd: phase.cwd
1587
- })) {
1588
- logWarn(`security: system.run approval script drift blocked (runId=${phase.runId})`);
1589
- await sendSystemRunDenied(opts, phase.execution, {
1590
- reason: "approval-required",
1591
- message: APPROVAL_SCRIPT_OPERAND_DRIFT_DENIED_MESSAGE
1592
- });
1593
- return;
1594
- }
1595
- if (opts.preferMacAppExecHost) {
1596
- const execRequest = {
1597
- command: phase.plannedAllowlistArgv ?? phase.argv,
1598
- rawCommand: phase.commandText || null,
1599
- cwd: phase.cwd ?? null,
1600
- env: phase.envOverrides ?? null,
1601
- timeoutMs: phase.timeoutMs ?? null,
1602
- needsScreenRecording: phase.needsScreenRecording,
1603
- agentId: phase.agentId ?? null,
1604
- sessionKey: phase.sessionKey ?? null,
1605
- approvalDecision: phase.approvalDecision
1606
- };
1607
- const response = await opts.runViaMacAppExecHost({
1608
- approvals: phase.approvals,
1609
- request: execRequest
1610
- });
1611
- if (!response) {
1612
- if (opts.execHostEnforced || !opts.execHostFallbackAllowed) {
1613
- await sendSystemRunDenied(opts, phase.execution, {
1614
- reason: "companion-unavailable",
1615
- message: "COMPANION_APP_UNAVAILABLE: macOS app exec host unreachable"
1616
- });
1617
- return;
1618
- }
1619
- } else if (!response.ok) {
1620
- await sendSystemRunDenied(opts, phase.execution, {
1621
- reason: normalizeDeniedReason(response.error.reason),
1622
- message: response.error.message
1623
- });
1624
- return;
1625
- } else {
1626
- const result = response.payload;
1627
- await sendSystemRunCompleted(opts, phase.execution, result, JSON.stringify(result));
1628
- return;
1629
- }
1630
- }
1631
- if (phase.policy.approvalDecision === "allow-always" && phase.security === "allowlist") {
1632
- if (phase.policy.analysisOk) {
1633
- const patterns = resolveAllowAlwaysPatterns({
1634
- segments: phase.segments,
1635
- cwd: phase.cwd,
1636
- env: phase.env,
1637
- platform: process.platform
1638
- });
1639
- for (const pattern of patterns) if (pattern) addAllowlistEntry(phase.approvals.file, phase.agentId, pattern);
1640
- }
1641
- }
1642
- if (phase.allowlistMatches.length > 0) {
1643
- const seen = /* @__PURE__ */ new Set();
1644
- for (const match of phase.allowlistMatches) {
1645
- if (!match?.pattern || seen.has(match.pattern)) continue;
1646
- seen.add(match.pattern);
1647
- recordAllowlistUse(phase.approvals.file, phase.agentId, match, phase.commandText, phase.segments[0]?.resolution?.resolvedPath);
1648
- }
1649
- }
1650
- if (phase.needsScreenRecording) {
1651
- await sendSystemRunDenied(opts, phase.execution, {
1652
- reason: "permission:screenRecording",
1653
- message: "PERMISSION_MISSING: screenRecording"
1654
- });
1655
- return;
1656
- }
1657
- const execArgv = resolveSystemRunExecArgv({
1658
- plannedAllowlistArgv: phase.plannedAllowlistArgv,
1659
- argv: phase.argv,
1660
- security: phase.security,
1661
- isWindows: phase.isWindows,
1662
- policy: phase.policy,
1663
- shellCommand: phase.shellPayload,
1664
- segments: phase.segments
1665
- });
1666
- const result = await opts.runCommand(execArgv, phase.cwd, phase.env, phase.timeoutMs);
1667
- applyOutputTruncation(result);
1668
- await sendSystemRunCompleted(opts, phase.execution, result, JSON.stringify({
1669
- exitCode: result.exitCode,
1670
- timedOut: result.timedOut,
1671
- success: result.success,
1672
- stdout: result.stdout,
1673
- stderr: result.stderr,
1674
- error: result.error ?? null
1675
- }));
1676
- }
1677
- async function handleSystemRunInvoke(opts) {
1678
- const parsed = await parseSystemRunPhase(opts);
1679
- if (!parsed) return;
1680
- const policyPhase = await evaluateSystemRunPolicyPhase(opts, parsed);
1681
- if (!policyPhase) return;
1682
- await executeSystemRunPhase(opts, policyPhase);
1683
- }
1684
- //#endregion
1685
- //#region src/node-host/invoke.ts
1686
- const OUTPUT_CAP = 2e5;
1687
- const OUTPUT_EVENT_TAIL = 2e4;
1688
- const DEFAULT_NODE_PATH$1 = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
1689
- const WINDOWS_CODEPAGE_ENCODING_MAP = {
1690
- 65001: "utf-8",
1691
- 54936: "gb18030",
1692
- 936: "gbk",
1693
- 950: "big5",
1694
- 932: "shift_jis",
1695
- 949: "euc-kr",
1696
- 1252: "windows-1252"
1697
- };
1698
- let cachedWindowsConsoleEncoding;
1699
- const execHostEnforced = process.env.MOLDCLAW_NODE_EXEC_HOST?.trim().toLowerCase() === "app";
1700
- const execHostFallbackAllowed = process.env.MOLDCLAW_NODE_EXEC_FALLBACK?.trim().toLowerCase() !== "0";
1701
- const preferMacAppExecHost = process.platform === "darwin" && execHostEnforced;
1702
- function resolveExecSecurity(value) {
1703
- return value === "deny" || value === "allowlist" || value === "full" ? value : "allowlist";
1704
- }
1705
- function isCmdExeInvocation(argv) {
1706
- const token = argv[0]?.trim();
1707
- if (!token) return false;
1708
- const base = path.win32.basename(token).toLowerCase();
1709
- return base === "cmd.exe" || base === "cmd";
1710
- }
1711
- function resolveExecAsk(value) {
1712
- return value === "off" || value === "on-miss" || value === "always" ? value : "on-miss";
1713
- }
1714
- function sanitizeEnv(overrides) {
1715
- return sanitizeHostExecEnv({
1716
- overrides,
1717
- blockPathOverrides: true
1718
- });
1719
- }
1720
- function truncateOutput(raw, maxChars) {
1721
- if (raw.length <= maxChars) return {
1722
- text: raw,
1723
- truncated: false
1724
- };
1725
- return {
1726
- text: `... (truncated) ${raw.slice(raw.length - maxChars)}`,
1727
- truncated: true
1728
- };
1729
- }
1730
- function parseWindowsCodePage(raw) {
1731
- if (!raw) return null;
1732
- const match = raw.match(/\b(\d{3,5})\b/);
1733
- if (!match?.[1]) return null;
1734
- const codePage = Number.parseInt(match[1], 10);
1735
- if (!Number.isFinite(codePage) || codePage <= 0) return null;
1736
- return codePage;
1737
- }
1738
- function resolveWindowsConsoleEncoding() {
1739
- if (process.platform !== "win32") return null;
1740
- if (cachedWindowsConsoleEncoding !== void 0) return cachedWindowsConsoleEncoding;
1741
- try {
1742
- const result = spawnSync("cmd.exe", [
1743
- "/d",
1744
- "/s",
1745
- "/c",
1746
- "chcp"
1747
- ], {
1748
- windowsHide: true,
1749
- encoding: "utf8",
1750
- stdio: [
1751
- "ignore",
1752
- "pipe",
1753
- "pipe"
1754
- ]
1755
- });
1756
- const codePage = parseWindowsCodePage(`${result.stdout ?? ""}\n${result.stderr ?? ""}`);
1757
- cachedWindowsConsoleEncoding = codePage !== null ? WINDOWS_CODEPAGE_ENCODING_MAP[codePage] ?? null : null;
1758
- } catch {
1759
- cachedWindowsConsoleEncoding = null;
1760
- }
1761
- return cachedWindowsConsoleEncoding;
1762
- }
1763
- function decodeCapturedOutputBuffer(params) {
1764
- const utf8 = params.buffer.toString("utf8");
1765
- if ((params.platform ?? process.platform) !== "win32") return utf8;
1766
- const encoding = params.windowsEncoding ?? resolveWindowsConsoleEncoding();
1767
- if (!encoding || encoding.toLowerCase() === "utf-8") return utf8;
1768
- try {
1769
- return new TextDecoder(encoding).decode(params.buffer);
1770
- } catch {
1771
- return utf8;
1772
- }
1773
- }
1774
- function redactExecApprovals(file) {
1775
- const socketPath = file.socket?.path?.trim();
1776
- return {
1777
- ...file,
1778
- socket: socketPath ? { path: socketPath } : void 0
1779
- };
1780
- }
1781
- function requireExecApprovalsBaseHash(params, snapshot) {
1782
- if (!snapshot.exists) return;
1783
- if (!snapshot.hash) throw new Error("INVALID_REQUEST: exec approvals base hash unavailable; reload and retry");
1784
- const baseHash = typeof params.baseHash === "string" ? params.baseHash.trim() : "";
1785
- if (!baseHash) throw new Error("INVALID_REQUEST: exec approvals base hash required; reload and retry");
1786
- if (baseHash !== snapshot.hash) throw new Error("INVALID_REQUEST: exec approvals changed; reload and retry");
1787
- }
1788
- async function runCommand(argv, cwd, env, timeoutMs) {
1789
- return await new Promise((resolve) => {
1790
- const stdoutChunks = [];
1791
- const stderrChunks = [];
1792
- let outputLen = 0;
1793
- let truncated = false;
1794
- let timedOut = false;
1795
- let settled = false;
1796
- const windowsEncoding = resolveWindowsConsoleEncoding();
1797
- const child = spawn(argv[0], argv.slice(1), {
1798
- cwd,
1799
- env,
1800
- stdio: [
1801
- "ignore",
1802
- "pipe",
1803
- "pipe"
1804
- ],
1805
- windowsHide: true
1806
- });
1807
- const onChunk = (chunk, target) => {
1808
- if (outputLen >= OUTPUT_CAP) {
1809
- truncated = true;
1810
- return;
1811
- }
1812
- const remaining = OUTPUT_CAP - outputLen;
1813
- const slice = chunk.length > remaining ? chunk.subarray(0, remaining) : chunk;
1814
- outputLen += slice.length;
1815
- if (target === "stdout") stdoutChunks.push(slice);
1816
- else stderrChunks.push(slice);
1817
- if (chunk.length > remaining) truncated = true;
1818
- };
1819
- child.stdout?.on("data", (chunk) => onChunk(chunk, "stdout"));
1820
- child.stderr?.on("data", (chunk) => onChunk(chunk, "stderr"));
1821
- let timer;
1822
- if (timeoutMs && timeoutMs > 0) timer = setTimeout(() => {
1823
- timedOut = true;
1824
- try {
1825
- child.kill("SIGKILL");
1826
- } catch {}
1827
- }, timeoutMs);
1828
- const finalize = (exitCode, error) => {
1829
- if (settled) return;
1830
- settled = true;
1831
- if (timer) clearTimeout(timer);
1832
- const stdout = decodeCapturedOutputBuffer({
1833
- buffer: Buffer.concat(stdoutChunks),
1834
- windowsEncoding
1835
- });
1836
- const stderr = decodeCapturedOutputBuffer({
1837
- buffer: Buffer.concat(stderrChunks),
1838
- windowsEncoding
1839
- });
1840
- resolve({
1841
- exitCode,
1842
- timedOut,
1843
- success: exitCode === 0 && !timedOut && !error,
1844
- stdout,
1845
- stderr,
1846
- error: error ?? null,
1847
- truncated
1848
- });
1849
- };
1850
- child.on("error", (err) => {
1851
- finalize(void 0, err.message);
1852
- });
1853
- child.on("exit", (code) => {
1854
- finalize(code === null ? void 0 : code, null);
1855
- });
1856
- });
1857
- }
1858
- function resolveEnvPath(env) {
1859
- return (env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path ?? DEFAULT_NODE_PATH$1).split(path.delimiter).filter(Boolean);
1860
- }
1861
- function resolveExecutable(bin, env) {
1862
- if (bin.includes("/") || bin.includes("\\")) return null;
1863
- const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? process.env.PathExt ?? ".EXE;.CMD;.BAT;.COM").split(";").map((ext) => ext.toLowerCase()) : [""];
1864
- for (const dir of resolveEnvPath(env)) for (const ext of extensions) {
1865
- const candidate = path.join(dir, bin + ext);
1866
- if (fs.existsSync(candidate)) return candidate;
1867
- }
1868
- return null;
1869
- }
1870
- async function handleSystemWhich(params, env) {
1871
- const bins = params.bins.map((bin) => bin.trim()).filter(Boolean);
1872
- const found = {};
1873
- for (const bin of bins) {
1874
- const path = resolveExecutable(bin, env);
1875
- if (path) found[bin] = path;
1876
- }
1877
- return { bins: found };
1878
- }
1879
- function buildExecEventPayload(payload) {
1880
- if (!payload.output) return payload;
1881
- const trimmed = payload.output.trim();
1882
- if (!trimmed) return payload;
1883
- const { text } = truncateOutput(trimmed, OUTPUT_EVENT_TAIL);
1884
- return {
1885
- ...payload,
1886
- output: text
1887
- };
1888
- }
1889
- async function sendExecFinishedEvent(params) {
1890
- const combined = [
1891
- params.result.stdout,
1892
- params.result.stderr,
1893
- params.result.error
1894
- ].filter(Boolean).join("\n");
1895
- await sendNodeEvent(params.client, "exec.finished", buildExecEventPayload({
1896
- sessionKey: params.sessionKey,
1897
- runId: params.runId,
1898
- host: "node",
1899
- command: params.commandText,
1900
- exitCode: params.result.exitCode ?? void 0,
1901
- timedOut: params.result.timedOut,
1902
- success: params.result.success,
1903
- output: combined,
1904
- suppressNotifyOnExit: params.suppressNotifyOnExit
1905
- }));
1906
- }
1907
- async function runViaMacAppExecHost(params) {
1908
- const { approvals, request } = params;
1909
- return await requestExecHostViaSocket({
1910
- socketPath: approvals.socketPath,
1911
- token: approvals.token,
1912
- request
1913
- });
1914
- }
1915
- async function sendJsonPayloadResult(client, frame, payload) {
1916
- await sendInvokeResult(client, frame, {
1917
- ok: true,
1918
- payloadJSON: JSON.stringify(payload)
1919
- });
1920
- }
1921
- async function sendRawPayloadResult(client, frame, payloadJSON) {
1922
- await sendInvokeResult(client, frame, {
1923
- ok: true,
1924
- payloadJSON
1925
- });
1926
- }
1927
- async function sendErrorResult(client, frame, code, message) {
1928
- await sendInvokeResult(client, frame, {
1929
- ok: false,
1930
- error: {
1931
- code,
1932
- message
1933
- }
1934
- });
1935
- }
1936
- async function sendInvalidRequestResult(client, frame, err) {
1937
- await sendErrorResult(client, frame, "INVALID_REQUEST", String(err));
1938
- }
1939
- async function handleInvoke(frame, client, skillBins) {
1940
- const command = String(frame.command ?? "");
1941
- if (command === "system.execApprovals.get") {
1942
- try {
1943
- ensureExecApprovals();
1944
- const snapshot = readExecApprovalsSnapshot();
1945
- await sendJsonPayloadResult(client, frame, {
1946
- path: snapshot.path,
1947
- exists: snapshot.exists,
1948
- hash: snapshot.hash,
1949
- file: redactExecApprovals(snapshot.file)
1950
- });
1951
- } catch (err) {
1952
- const message = String(err);
1953
- await sendErrorResult(client, frame, message.toLowerCase().includes("timed out") ? "TIMEOUT" : "INVALID_REQUEST", message);
1954
- }
1955
- return;
1956
- }
1957
- if (command === "system.execApprovals.set") {
1958
- try {
1959
- const params = decodeParams(frame.paramsJSON);
1960
- if (!params.file || typeof params.file !== "object") throw new Error("INVALID_REQUEST: exec approvals file required");
1961
- ensureExecApprovals();
1962
- const snapshot = readExecApprovalsSnapshot();
1963
- requireExecApprovalsBaseHash(params, snapshot);
1964
- saveExecApprovals(mergeExecApprovalsSocketDefaults({
1965
- normalized: normalizeExecApprovals(params.file),
1966
- current: snapshot.file
1967
- }));
1968
- const nextSnapshot = readExecApprovalsSnapshot();
1969
- await sendJsonPayloadResult(client, frame, {
1970
- path: nextSnapshot.path,
1971
- exists: nextSnapshot.exists,
1972
- hash: nextSnapshot.hash,
1973
- file: redactExecApprovals(nextSnapshot.file)
1974
- });
1975
- } catch (err) {
1976
- await sendInvalidRequestResult(client, frame, err);
1977
- }
1978
- return;
1979
- }
1980
- if (command === "system.which") {
1981
- try {
1982
- const params = decodeParams(frame.paramsJSON);
1983
- if (!Array.isArray(params.bins)) throw new Error("INVALID_REQUEST: bins required");
1984
- await sendJsonPayloadResult(client, frame, await handleSystemWhich(params, sanitizeEnv(void 0)));
1985
- } catch (err) {
1986
- await sendInvalidRequestResult(client, frame, err);
1987
- }
1988
- return;
1989
- }
1990
- if (command === "browser.proxy") {
1991
- try {
1992
- await sendRawPayloadResult(client, frame, await runBrowserProxyCommand(frame.paramsJSON));
1993
- } catch (err) {
1994
- await sendInvalidRequestResult(client, frame, err);
1995
- }
1996
- return;
1997
- }
1998
- if (command === "system.run.prepare") {
1999
- try {
2000
- const prepared = buildSystemRunApprovalPlan(decodeParams(frame.paramsJSON));
2001
- if (!prepared.ok) {
2002
- await sendErrorResult(client, frame, "INVALID_REQUEST", prepared.message);
2003
- return;
2004
- }
2005
- await sendJsonPayloadResult(client, frame, { plan: prepared.plan });
2006
- } catch (err) {
2007
- await sendInvalidRequestResult(client, frame, err);
2008
- }
2009
- return;
2010
- }
2011
- if (command !== "system.run") {
2012
- await sendErrorResult(client, frame, "UNAVAILABLE", "command not supported");
2013
- return;
2014
- }
2015
- let params;
2016
- try {
2017
- params = decodeParams(frame.paramsJSON);
2018
- } catch (err) {
2019
- await sendInvalidRequestResult(client, frame, err);
2020
- return;
2021
- }
2022
- if (!Array.isArray(params.command) || params.command.length === 0) {
2023
- await sendErrorResult(client, frame, "INVALID_REQUEST", "command required");
2024
- return;
2025
- }
2026
- await handleSystemRunInvoke({
2027
- client,
2028
- params,
2029
- skillBins,
2030
- execHostEnforced,
2031
- execHostFallbackAllowed,
2032
- resolveExecSecurity,
2033
- resolveExecAsk,
2034
- isCmdExeInvocation,
2035
- sanitizeEnv,
2036
- runCommand,
2037
- runViaMacAppExecHost,
2038
- sendNodeEvent,
2039
- buildExecEventPayload,
2040
- sendInvokeResult: async (result) => {
2041
- await sendInvokeResult(client, frame, result);
2042
- },
2043
- sendExecFinishedEvent: async ({ sessionKey, runId, commandText, result }) => {
2044
- await sendExecFinishedEvent({
2045
- client,
2046
- sessionKey,
2047
- runId,
2048
- commandText,
2049
- result
2050
- });
2051
- },
2052
- preferMacAppExecHost
2053
- });
2054
- }
2055
- function decodeParams(raw) {
2056
- if (!raw) throw new Error("INVALID_REQUEST: paramsJSON required");
2057
- return JSON.parse(raw);
2058
- }
2059
- function coerceNodeInvokePayload(payload) {
2060
- if (!payload || typeof payload !== "object") return null;
2061
- const obj = payload;
2062
- const id = typeof obj.id === "string" ? obj.id.trim() : "";
2063
- const nodeId = typeof obj.nodeId === "string" ? obj.nodeId.trim() : "";
2064
- const command = typeof obj.command === "string" ? obj.command.trim() : "";
2065
- if (!id || !nodeId || !command) return null;
2066
- return {
2067
- id,
2068
- nodeId,
2069
- command,
2070
- paramsJSON: typeof obj.paramsJSON === "string" ? obj.paramsJSON : obj.params !== void 0 ? JSON.stringify(obj.params) : null,
2071
- timeoutMs: typeof obj.timeoutMs === "number" ? obj.timeoutMs : null,
2072
- idempotencyKey: typeof obj.idempotencyKey === "string" ? obj.idempotencyKey : null
2073
- };
2074
- }
2075
- async function sendInvokeResult(client, frame, result) {
2076
- try {
2077
- await client.request("node.invoke.result", buildNodeInvokeResultParams(frame, result));
2078
- } catch {}
2079
- }
2080
- function buildNodeInvokeResultParams(frame, result) {
2081
- const params = {
2082
- id: frame.id,
2083
- nodeId: frame.nodeId,
2084
- ok: result.ok
2085
- };
2086
- if (result.payload !== void 0) params.payload = result.payload;
2087
- if (typeof result.payloadJSON === "string") params.payloadJSON = result.payloadJSON;
2088
- if (result.error) params.error = result.error;
2089
- return params;
2090
- }
2091
- async function sendNodeEvent(client, event, payload) {
2092
- try {
2093
- await client.request("node.event", {
2094
- event,
2095
- payloadJSON: payload ? JSON.stringify(payload) : null
2096
- });
2097
- } catch {}
2098
- }
2099
- //#endregion
2100
- //#region src/node-host/runner.ts
2101
- const DEFAULT_NODE_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
2102
- function resolveExecutablePathFromEnv(bin, pathEnv) {
2103
- if (bin.includes("/") || bin.includes("\\")) return null;
2104
- return resolveExecutableFromPathEnv(bin, pathEnv) ?? null;
2105
- }
2106
- function resolveSkillBinTrustEntries(bins, pathEnv) {
2107
- const trustEntries = [];
2108
- const seen = /* @__PURE__ */ new Set();
2109
- for (const bin of bins) {
2110
- const name = bin.trim();
2111
- if (!name) continue;
2112
- const resolvedPath = resolveExecutablePathFromEnv(name, pathEnv);
2113
- if (!resolvedPath) continue;
2114
- const key = `${name}\u0000${resolvedPath}`;
2115
- if (seen.has(key)) continue;
2116
- seen.add(key);
2117
- trustEntries.push({
2118
- name,
2119
- resolvedPath
2120
- });
2121
- }
2122
- return trustEntries.toSorted((left, right) => left.name.localeCompare(right.name) || left.resolvedPath.localeCompare(right.resolvedPath));
2123
- }
2124
- var SkillBinsCache = class {
2125
- constructor(fetch, pathEnv) {
2126
- this.bins = [];
2127
- this.lastRefresh = 0;
2128
- this.ttlMs = 9e4;
2129
- this.fetch = fetch;
2130
- this.pathEnv = pathEnv;
2131
- }
2132
- async current(force = false) {
2133
- if (force || Date.now() - this.lastRefresh > this.ttlMs) await this.refresh();
2134
- return this.bins;
2135
- }
2136
- async refresh() {
2137
- try {
2138
- this.bins = resolveSkillBinTrustEntries(await this.fetch(), this.pathEnv);
2139
- this.lastRefresh = Date.now();
2140
- } catch {
2141
- if (!this.lastRefresh) this.bins = [];
2142
- }
2143
- }
2144
- };
2145
- function ensureNodePathEnv() {
2146
- ensuremoldClawCliOnPath({ pathEnv: process.env.PATH ?? "" });
2147
- const current = process.env.PATH ?? "";
2148
- if (current.trim()) return current;
2149
- process.env.PATH = DEFAULT_NODE_PATH;
2150
- return DEFAULT_NODE_PATH;
2151
- }
2152
- async function resolveNodeHostGatewayCredentials(params) {
2153
- return await resolveGatewayConnectionAuth({
2154
- config: (params.config.gateway?.mode === "remote" ? "remote" : "local") === "local" ? buildNodeHostLocalAuthConfig(params.config) : params.config,
2155
- env: params.env,
2156
- includeLegacyEnv: false,
2157
- localTokenPrecedence: "env-first",
2158
- localPasswordPrecedence: "env-first",
2159
- remoteTokenPrecedence: "env-first",
2160
- remotePasswordPrecedence: "env-first"
2161
- });
2162
- }
2163
- function buildNodeHostLocalAuthConfig(config) {
2164
- if (!config.gateway?.remote?.token && !config.gateway?.remote?.password) return config;
2165
- const nextConfig = structuredClone(config);
2166
- if (nextConfig.gateway?.remote) {
2167
- nextConfig.gateway.remote.token = void 0;
2168
- nextConfig.gateway.remote.password = void 0;
2169
- }
2170
- return nextConfig;
2171
- }
2172
- async function runNodeHost(opts) {
2173
- const config = await ensureNodeHostConfig();
2174
- const nodeId = opts.nodeId?.trim() || config.nodeId;
2175
- if (nodeId !== config.nodeId) config.nodeId = nodeId;
2176
- const displayName = opts.displayName?.trim() || config.displayName || await getMachineDisplayName();
2177
- config.displayName = displayName;
2178
- const gateway = {
2179
- host: opts.gatewayHost,
2180
- port: opts.gatewayPort,
2181
- tls: opts.gatewayTls ?? loadConfig().gateway?.tls?.enabled ?? false,
2182
- tlsFingerprint: opts.gatewayTlsFingerprint
2183
- };
2184
- config.gateway = gateway;
2185
- await saveNodeHostConfig(config);
2186
- const cfg = loadConfig();
2187
- const resolvedBrowser = resolveBrowserConfig(cfg.browser, cfg);
2188
- const browserProxyEnabled = cfg.nodeHost?.browserProxy?.enabled !== false && resolvedBrowser.enabled;
2189
- const { token, password } = await resolveNodeHostGatewayCredentials({
2190
- config: cfg,
2191
- env: process.env
2192
- });
2193
- const host = gateway.host ?? "127.0.0.1";
2194
- const port = gateway.port ?? 28789;
2195
- const url = `${gateway.tls ? "wss" : "ws"}://${host}:${port}`;
2196
- const pathEnv = ensureNodePathEnv();
2197
- const client = new GatewayClient({
2198
- url,
2199
- token: token || void 0,
2200
- password: password || void 0,
2201
- instanceId: nodeId,
2202
- clientName: GATEWAY_CLIENT_NAMES.NODE_HOST,
2203
- clientDisplayName: displayName,
2204
- clientVersion: VERSION,
2205
- platform: process.platform,
2206
- mode: GATEWAY_CLIENT_MODES.NODE,
2207
- role: "node",
2208
- scopes: [],
2209
- caps: ["system", ...browserProxyEnabled ? ["browser"] : []],
2210
- commands: [
2211
- ...NODE_SYSTEM_RUN_COMMANDS,
2212
- ...NODE_EXEC_APPROVALS_COMMANDS,
2213
- ...browserProxyEnabled ? [NODE_BROWSER_PROXY_COMMAND] : []
2214
- ],
2215
- pathEnv,
2216
- permissions: void 0,
2217
- deviceIdentity: loadOrCreateDeviceIdentity(),
2218
- tlsFingerprint: gateway.tlsFingerprint,
2219
- onEvent: (evt) => {
2220
- if (evt.event !== "node.invoke.request") return;
2221
- const payload = coerceNodeInvokePayload(evt.payload);
2222
- if (!payload) return;
2223
- handleInvoke(payload, client, skillBins);
2224
- },
2225
- onConnectError: (err) => {
2226
- console.error(`node host gateway connect failed: ${err.message}`);
2227
- },
2228
- onClose: (code, reason) => {
2229
- console.error(`node host gateway closed (${code}): ${reason}`);
2230
- }
2231
- });
2232
- const skillBins = new SkillBinsCache(async () => {
2233
- const res = await client.request("skills.bins", {});
2234
- return Array.isArray(res?.bins) ? res.bins.map((bin) => String(bin)) : [];
2235
- }, pathEnv);
2236
- client.start();
2237
- await new Promise(() => {});
2238
- }
2239
- //#endregion
2240
- //#region src/commands/node-daemon-install-helpers.ts
2241
- async function buildNodeInstallPlan(params) {
2242
- const { devMode, nodePath } = await resolveDaemonInstallRuntimeInputs({
2243
- env: params.env,
2244
- runtime: params.runtime,
2245
- devMode: params.devMode,
2246
- nodePath: params.nodePath
2247
- });
2248
- const { programArguments, workingDirectory } = await resolveNodeProgramArguments({
2249
- host: params.host,
2250
- port: params.port,
2251
- tls: params.tls,
2252
- tlsFingerprint: params.tlsFingerprint,
2253
- nodeId: params.nodeId,
2254
- displayName: params.displayName,
2255
- dev: devMode,
2256
- runtime: params.runtime,
2257
- nodePath
2258
- });
2259
- await emitDaemonInstallRuntimeWarning({
2260
- env: params.env,
2261
- runtime: params.runtime,
2262
- programArguments,
2263
- warn: params.warn,
2264
- title: "Node daemon runtime"
2265
- });
2266
- const environment = buildNodeServiceEnvironment({ env: params.env });
2267
- return {
2268
- programArguments,
2269
- workingDirectory,
2270
- environment,
2271
- description: formatNodeServiceDescription({ version: environment.MOLDCLAW_SERVICE_VERSION })
2272
- };
2273
- }
2274
- //#endregion
2275
- //#region src/commands/node-daemon-runtime.ts
2276
- const DEFAULT_NODE_DAEMON_RUNTIME = DEFAULT_GATEWAY_DAEMON_RUNTIME;
2277
- function isNodeDaemonRuntime(value) {
2278
- return isGatewayDaemonRuntime(value);
2279
- }
2280
- //#endregion
2281
- //#region src/cli/node-cli/daemon.ts
2282
- function renderNodeServiceStartHints() {
2283
- return buildPlatformServiceStartHints({
2284
- installCommand: formatCliCommand("moldclaw node install"),
2285
- startCommand: formatCliCommand("moldclaw node start"),
2286
- launchAgentPlistPath: `~/Library/LaunchAgents/${resolveNodeLaunchAgentLabel()}.plist`,
2287
- systemdServiceName: resolveNodeSystemdServiceName(),
2288
- windowsTaskName: resolveNodeWindowsTaskName()
2289
- });
2290
- }
2291
- function buildNodeRuntimeHints(env = process.env) {
2292
- return buildPlatformRuntimeLogHints({
2293
- env,
2294
- systemdServiceName: resolveNodeSystemdServiceName(),
2295
- windowsTaskName: resolveNodeWindowsTaskName()
2296
- });
2297
- }
2298
- function resolveNodeDefaults(opts, config) {
2299
- const host = opts.host?.trim() || config?.gateway?.host || "127.0.0.1";
2300
- const portOverride = parsePort(opts.port);
2301
- if (opts.port !== void 0 && portOverride === null) return {
2302
- host,
2303
- port: null
2304
- };
2305
- return {
2306
- host,
2307
- port: portOverride ?? config?.gateway?.port ?? 28789
2308
- };
2309
- }
2310
- async function runNodeDaemonInstall(opts) {
2311
- const { json, stdout, warnings, emit, fail } = createDaemonInstallActionContext(opts.json);
2312
- if (failIfNixDaemonInstallMode(fail)) return;
2313
- const config = await loadNodeHostConfig();
2314
- const { host, port } = resolveNodeDefaults(opts, config);
2315
- if (!Number.isFinite(port ?? NaN) || (port ?? 0) <= 0) {
2316
- fail("Invalid port");
2317
- return;
2318
- }
2319
- const runtimeRaw = opts.runtime ? String(opts.runtime) : DEFAULT_NODE_DAEMON_RUNTIME;
2320
- if (!isNodeDaemonRuntime(runtimeRaw)) {
2321
- fail("Invalid --runtime (use \"node\" or \"bun\")");
2322
- return;
2323
- }
2324
- const service = resolveNodeService();
2325
- let loaded = false;
2326
- try {
2327
- loaded = await service.isLoaded({ env: process.env });
2328
- } catch (err) {
2329
- fail(`Node service check failed: ${String(err)}`);
2330
- return;
2331
- }
2332
- if (loaded && !opts.force) {
2333
- emit({
2334
- ok: true,
2335
- result: "already-installed",
2336
- message: `Node service already ${service.loadedText}.`,
2337
- service: buildDaemonServiceSnapshot(service, loaded),
2338
- warnings: warnings.length ? warnings : void 0
2339
- });
2340
- if (!json) {
2341
- defaultRuntime.log(`Node service already ${service.loadedText}.`);
2342
- defaultRuntime.log(`Reinstall with: ${formatCliCommand("moldclaw node install --force")}`);
2343
- }
2344
- return;
2345
- }
2346
- const tlsFingerprint = opts.tlsFingerprint?.trim() || config?.gateway?.tlsFingerprint;
2347
- const tls = Boolean(opts.tls) || Boolean(tlsFingerprint) || Boolean(config?.gateway?.tls);
2348
- const { programArguments, workingDirectory, environment, description } = await buildNodeInstallPlan({
2349
- env: process.env,
2350
- host,
2351
- port: port ?? 28789,
2352
- tls,
2353
- tlsFingerprint: tlsFingerprint || void 0,
2354
- nodeId: opts.nodeId,
2355
- displayName: opts.displayName,
2356
- runtime: runtimeRaw,
2357
- warn: (message) => {
2358
- if (json) warnings.push(message);
2359
- else defaultRuntime.log(message);
2360
- }
2361
- });
2362
- await installDaemonServiceAndEmit({
2363
- serviceNoun: "Node",
2364
- service,
2365
- warnings,
2366
- emit,
2367
- fail,
2368
- install: async () => {
2369
- await service.install({
2370
- env: process.env,
2371
- stdout,
2372
- programArguments,
2373
- workingDirectory,
2374
- environment,
2375
- description
2376
- });
2377
- }
2378
- });
2379
- }
2380
- async function runNodeDaemonUninstall(opts = {}) {
2381
- return await runServiceUninstall({
2382
- serviceNoun: "Node",
2383
- service: resolveNodeService(),
2384
- opts,
2385
- stopBeforeUninstall: false,
2386
- assertNotLoadedAfterUninstall: false
2387
- });
2388
- }
2389
- async function runNodeDaemonRestart(opts = {}) {
2390
- await runServiceRestart({
2391
- serviceNoun: "Node",
2392
- service: resolveNodeService(),
2393
- renderStartHints: renderNodeServiceStartHints,
2394
- opts
2395
- });
2396
- }
2397
- async function runNodeDaemonStop(opts = {}) {
2398
- return await runServiceStop({
2399
- serviceNoun: "Node",
2400
- service: resolveNodeService(),
2401
- opts
2402
- });
2403
- }
2404
- async function runNodeDaemonStatus(opts = {}) {
2405
- const json = Boolean(opts.json);
2406
- const service = resolveNodeService();
2407
- const [loaded, command, runtime] = await Promise.all([
2408
- service.isLoaded({ env: process.env }).catch(() => false),
2409
- service.readCommand(process.env).catch(() => null),
2410
- service.readRuntime(process.env).catch((err) => ({
2411
- status: "unknown",
2412
- detail: String(err)
2413
- }))
2414
- ]);
2415
- const payload = { service: {
2416
- ...buildDaemonServiceSnapshot(service, loaded),
2417
- command,
2418
- runtime
2419
- } };
2420
- if (json) {
2421
- defaultRuntime.log(JSON.stringify(payload, null, 2));
2422
- return;
2423
- }
2424
- const { rich, label, accent, infoText, okText, warnText, errorText } = createCliStatusTextStyles();
2425
- const serviceStatus = loaded ? okText(service.loadedText) : warnText(service.notLoadedText);
2426
- defaultRuntime.log(`${label("Service:")} ${accent(service.label)} (${serviceStatus})`);
2427
- if (command?.programArguments?.length) defaultRuntime.log(`${label("Command:")} ${infoText(command.programArguments.join(" "))}`);
2428
- if (command?.sourcePath) defaultRuntime.log(`${label("Service file:")} ${infoText(command.sourcePath)}`);
2429
- if (command?.workingDirectory) defaultRuntime.log(`${label("Working dir:")} ${infoText(command.workingDirectory)}`);
2430
- const runtimeLine = formatRuntimeStatus(runtime);
2431
- if (runtimeLine) {
2432
- const runtimeColor = resolveRuntimeStatusColor(runtime?.status);
2433
- defaultRuntime.log(`${label("Runtime:")} ${colorize(rich, runtimeColor, runtimeLine)}`);
2434
- }
2435
- if (!loaded) {
2436
- defaultRuntime.log("");
2437
- for (const hint of renderNodeServiceStartHints()) defaultRuntime.log(`${warnText("Start with:")} ${infoText(hint)}`);
2438
- return;
2439
- }
2440
- const baseEnv = {
2441
- ...process.env,
2442
- ...command?.environment ?? void 0
2443
- };
2444
- const hintEnv = {
2445
- ...baseEnv,
2446
- MOLDCLAW_LOG_PREFIX: baseEnv.MOLDCLAW_LOG_PREFIX ?? "node"
2447
- };
2448
- if (runtime?.missingUnit) {
2449
- defaultRuntime.error(errorText("Service unit not found."));
2450
- for (const hint of buildNodeRuntimeHints(hintEnv)) defaultRuntime.error(errorText(hint));
2451
- return;
2452
- }
2453
- if (runtime?.status === "stopped") {
2454
- defaultRuntime.error(errorText("Service is loaded but not running."));
2455
- for (const hint of buildNodeRuntimeHints(hintEnv)) defaultRuntime.error(errorText(hint));
2456
- }
2457
- }
2458
- //#endregion
2459
- //#region src/cli/node-cli/register.ts
2460
- function parsePortWithFallback(value, fallback) {
2461
- return parsePort(value) ?? fallback;
2462
- }
2463
- function registerNodeCli(program) {
2464
- const node = program.command("node").description("Run and manage the headless node host service").addHelpText("after", () => `\n${theme.heading("Examples:")}\n${formatHelpExamples([
2465
- ["moldclaw node run --host 127.0.0.1 --port 28789", "Run the node host in the foreground."],
2466
- ["moldclaw node status", "Check node host service status."],
2467
- ["moldclaw node install", "Install the node host service."],
2468
- ["moldclaw node restart", "Restart the installed node host service."]
2469
- ])}\n\n${theme.muted("Docs:")} ${formatDocsLink("/cli/node", "docs.moldclaw.ai/cli/node")}\n`);
2470
- node.command("run").description("Run the headless node host (foreground)").option("--host <host>", "Gateway host").option("--port <port>", "Gateway port").option("--tls", "Use TLS for the gateway connection", false).option("--tls-fingerprint <sha256>", "Expected TLS certificate fingerprint (sha256)").option("--node-id <id>", "Override node id (clears pairing token)").option("--display-name <name>", "Override node display name").action(async (opts) => {
2471
- const existing = await loadNodeHostConfig();
2472
- await runNodeHost({
2473
- gatewayHost: opts.host?.trim() || existing?.gateway?.host || "127.0.0.1",
2474
- gatewayPort: parsePortWithFallback(opts.port, existing?.gateway?.port ?? 28789),
2475
- gatewayTls: Boolean(opts.tls) || Boolean(opts.tlsFingerprint),
2476
- gatewayTlsFingerprint: opts.tlsFingerprint,
2477
- nodeId: opts.nodeId,
2478
- displayName: opts.displayName
2479
- });
2480
- });
2481
- node.command("status").description("Show node host status").option("--json", "Output JSON", false).action(async (opts) => {
2482
- await runNodeDaemonStatus(opts);
2483
- });
2484
- node.command("install").description("Install the node host service (launchd/systemd/schtasks)").option("--host <host>", "Gateway host").option("--port <port>", "Gateway port").option("--tls", "Use TLS for the gateway connection", false).option("--tls-fingerprint <sha256>", "Expected TLS certificate fingerprint (sha256)").option("--node-id <id>", "Override node id (clears pairing token)").option("--display-name <name>", "Override node display name").option("--runtime <runtime>", "Service runtime (node|bun). Default: node").option("--force", "Reinstall/overwrite if already installed", false).option("--json", "Output JSON", false).action(async (opts) => {
2485
- await runNodeDaemonInstall(opts);
2486
- });
2487
- node.command("uninstall").description("Uninstall the node host service (launchd/systemd/schtasks)").option("--json", "Output JSON", false).action(async (opts) => {
2488
- await runNodeDaemonUninstall(opts);
2489
- });
2490
- node.command("stop").description("Stop the node host service (launchd/systemd/schtasks)").option("--json", "Output JSON", false).action(async (opts) => {
2491
- await runNodeDaemonStop(opts);
2492
- });
2493
- node.command("restart").description("Restart the node host service (launchd/systemd/schtasks)").option("--json", "Output JSON", false).action(async (opts) => {
2494
- await runNodeDaemonRestart(opts);
2495
- });
2496
- }
2497
- //#endregion
2498
- export { registerNodeCli };