remoteclaw 0.1.0-next.cd6ddde → 0.1.0-next.cf9ccbe

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 (1054) hide show
  1. package/dist/accounts-79XhjwAj.js +32 -0
  2. package/dist/accounts-B1M3fOxL.js +272 -0
  3. package/dist/accounts-BwbvnKsW.js +205 -0
  4. package/dist/accounts-CIVjmTg9.js +270 -0
  5. package/dist/accounts-D1awQXKu.js +36 -0
  6. package/dist/accounts-DHkGVGUR.js +36 -0
  7. package/dist/accounts-P7cmIXUM.js +206 -0
  8. package/dist/accounts-XFgBY644.js +47 -0
  9. package/dist/accounts-_ZuNC5bz.js +47 -0
  10. package/dist/ack-reactions-BGJ9Vigf.js +621 -0
  11. package/dist/ack-reactions-Diu9O24z.js +621 -0
  12. package/dist/acp-cli-BwZ-va2P.js +1316 -0
  13. package/dist/acp-cli-eVKByz-j.js +1311 -0
  14. package/dist/active-listener--jrUO-8L.js +37 -0
  15. package/dist/active-listener-C7SyMcNY.js +37 -0
  16. package/dist/agent-BAxK2KQW.js +688 -0
  17. package/dist/agent-Dd5Yfhmq.js +687 -0
  18. package/dist/agent-helpers-5F0tdxud.js +400 -0
  19. package/dist/agent-scope-BA1HP4K6.js +114 -0
  20. package/dist/agent-scope-CAQLm3LP.js +116 -0
  21. package/dist/agents-2VlLHxv-.js +754 -0
  22. package/dist/agents.config-CmyzLYqW.js +116 -0
  23. package/dist/agents.config-DerBqRzk.js +116 -0
  24. package/dist/audio-ClIuKwkl.js +43 -0
  25. package/dist/audio-DqlIYYTb.js +43 -0
  26. package/dist/audit-Cn0cNCE4.js +3114 -0
  27. package/dist/audit-DXY4NHBC.js +3114 -0
  28. package/dist/auth-B-QK8JhI.js +315 -0
  29. package/dist/auth-C1zx1O24.js +314 -0
  30. package/dist/auth-DDmNYVMW.js +448 -0
  31. package/dist/auth-DH1wEw0w.js +448 -0
  32. package/dist/banner-CBWZhANO.js +294 -0
  33. package/dist/binaries-CYwLdubd.js +13 -0
  34. package/dist/bindings-DFAFatwT.js +69 -0
  35. package/dist/bindings-GUKIzFCp.js +69 -0
  36. package/dist/bonjour-discovery-AQMJqY4V.js +378 -0
  37. package/dist/bonjour-discovery-BLcPWHFJ.js +378 -0
  38. package/dist/boot/handler.js +28 -28
  39. package/dist/browser-cli-8Dv5ogFT.js +1690 -0
  40. package/dist/browser-cli-wNLo8SOy.js +1694 -0
  41. package/dist/build-info.json +3 -3
  42. package/dist/call-BTHzKFbN.js +518 -0
  43. package/dist/call-D_NchaCs.js +517 -0
  44. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  45. package/dist/catalog-DgpN5jxU.js +186 -0
  46. package/dist/catalog-k056Nh93.js +186 -0
  47. package/dist/channel-account-context-BHIy71Yh.js +133 -0
  48. package/dist/channel-account-context-DXU_-EkJ.js +133 -0
  49. package/dist/channel-activity-BatlvP_U.js +292 -0
  50. package/dist/channel-activity-BhT7NQ_v.js +94 -0
  51. package/dist/channel-activity-CvjEwpJz.js +94 -0
  52. package/dist/channel-options-BCccA2WC.js +32 -0
  53. package/dist/channel-options-VPR_pNyS.js +33 -0
  54. package/dist/channel-selection-AH6_y6RS.js +51 -0
  55. package/dist/channel-selection-ovohyJQZ.js +51 -0
  56. package/dist/channel-web-APDaQ_wp.js +2134 -0
  57. package/dist/channel-web-BW_YuNlT.js +2132 -0
  58. package/dist/channels-cli-BBkHQtBI.js +1440 -0
  59. package/dist/channels-cli-CKcOwL-Q.js +1436 -0
  60. package/dist/channels-status-issues-BbYNzwLp.js +18 -0
  61. package/dist/channels-status-issues-DRybAijg.js +18 -0
  62. package/dist/chat-envelope-AJFUAuBM.js +248 -0
  63. package/dist/chat-envelope-BrfcPlDM.js +248 -0
  64. package/dist/chrome-Bv2UtAMQ.js +1732 -0
  65. package/dist/chrome-C6Vc_7su.js +1733 -0
  66. package/dist/chunk-BzVoFUZL.js +341 -0
  67. package/dist/clack-prompter-C6mBTOzE.js +122 -0
  68. package/dist/clack-prompter-DKcYqv3o.js +121 -0
  69. package/dist/cleanup-utils-Cb-leJcy.js +94 -0
  70. package/dist/cli/daemon-cli.js +1 -1
  71. package/dist/cli-Cs1n6-eD.js +135 -0
  72. package/dist/cli-Di3p1tLN.js +131 -0
  73. package/dist/client-B6h7bgbF.js +2311 -0
  74. package/dist/client-CMtdm9Ii.js +2311 -0
  75. package/dist/clipboard-A06eV_5C.js +31 -0
  76. package/dist/clipboard-DQBl3coj.js +31 -0
  77. package/dist/command-format-BiiNHkWG.js +18 -0
  78. package/dist/command-format-Dntg_tnC.js +32 -0
  79. package/dist/command-logger/handler.js +1 -1
  80. package/dist/command-registry-BV2MH_iw.js +215 -0
  81. package/dist/commands-D93TXYhv.js +41 -0
  82. package/dist/commands-UD7V7QC9.js +41 -0
  83. package/dist/commands-registry-CCbTtSSK.js +891 -0
  84. package/dist/commands-registry-De8JhZLG.js +890 -0
  85. package/dist/common-D4fL3S2m.js +156 -0
  86. package/dist/common-DXNisGxw.js +156 -0
  87. package/dist/completion-cli-319xyosV.js +452 -0
  88. package/dist/completion-cli-B6Zimnek.js +452 -0
  89. package/dist/config-BTH7fB_v.js +3345 -0
  90. package/dist/config-DwuBnd6D.js +3347 -0
  91. package/dist/config-cli-c_Itt86J.js +247 -0
  92. package/dist/config-cli-rcMB3A3B.js +243 -0
  93. package/dist/config-guard-BcT7soTj.js +92 -0
  94. package/dist/config-guard-Bqak3bDc.js +75 -0
  95. package/dist/config-validation-CHEjSJ5K.js +18 -0
  96. package/dist/config-validation-CvgqLhyG.js +18 -0
  97. package/dist/configure-Cb3bbYnh.js +891 -0
  98. package/dist/configure-R2gWNv5y.js +889 -0
  99. package/dist/control-auth-DrGYtMJM.js +397 -0
  100. package/dist/control-auth-KY4Qdr2I.js +397 -0
  101. package/dist/control-ui-assets-DO1L6M0S.js +186 -0
  102. package/dist/control-ui-assets-S_TLo6Fs.js +186 -0
  103. package/dist/conversation-label-CMOfgCVl.js +36 -0
  104. package/dist/cron-cli-C7h_hLHu.js +495 -0
  105. package/dist/cron-cli-DTNg0Uvl.js +499 -0
  106. package/dist/daemon-cli-BlJS9zWM.js +737 -0
  107. package/dist/daemon-cli-Cfc1yszp.js +735 -0
  108. package/dist/daemon-cli.js +124 -1071
  109. package/dist/daemon-install-BbBLuLWg.js +60 -0
  110. package/dist/daemon-install-WEBvqVOj.js +56 -0
  111. package/dist/daemon-install-helpers-BVtPC2TK.js +504 -0
  112. package/dist/daemon-install-helpers-DVr51zvE.js +504 -0
  113. package/dist/deliver-EB272zWh.js +481 -0
  114. package/dist/deliver-iGD_woru.js +481 -0
  115. package/dist/delivery-queue-BDvalA10.js +244 -0
  116. package/dist/delivery-queue-BimvYz5E.js +244 -0
  117. package/dist/devices-cli-BXCOsNFc.js +323 -0
  118. package/dist/devices-cli-CHGdYfrz.js +319 -0
  119. package/dist/diagnostics-BzzhTQzK.js +35 -0
  120. package/dist/diagnostics-DILtxtcE.js +35 -0
  121. package/dist/directory-cli-COS40yI9.js +221 -0
  122. package/dist/directory-cli-Cb5j1JTC.js +225 -0
  123. package/dist/dispatcher-BUqxh_mA.js +174 -0
  124. package/dist/dispatcher-By-KZRWZ.js +173 -0
  125. package/dist/dm-policy-shared-BCp9_z3w.js +22 -0
  126. package/dist/dm-policy-shared-DgeKqjOu.js +22 -0
  127. package/dist/dns-cli-B8yyXB2N.js +203 -0
  128. package/dist/dns-cli-DAkTk-gM.js +199 -0
  129. package/dist/dock-B0bIIDS3.js +906 -0
  130. package/dist/dock-C3PzQ6CS.js +907 -0
  131. package/dist/doctor-completion-B_Zp4fZk.js +92 -0
  132. package/dist/doctor-completion-CZ1P5laQ.js +92 -0
  133. package/dist/doctor-config-flow-BDDsR2J1.js +978 -0
  134. package/dist/doctor-config-flow-CwFFRUic.js +979 -0
  135. package/dist/enable-C3I9dWel.js +59 -0
  136. package/dist/enable-DnwKeWnR.js +59 -0
  137. package/dist/entry.js +62 -6
  138. package/dist/env-DyyqmxSM.js +60 -0
  139. package/dist/errors-0dfGxeYQ.js +35 -0
  140. package/dist/errors-C1kDByVU.js +35 -0
  141. package/dist/exec-CAk1dxq_.js +164 -0
  142. package/dist/exec-epNpA1aU.js +164 -0
  143. package/dist/extensionAPI.js +263 -1088
  144. package/dist/fetch-BMQq41sB.js +281 -0
  145. package/dist/fetch-Cky99wYB.js +281 -0
  146. package/dist/fetch-D3tw4B4n.js +67 -0
  147. package/dist/fetch-Dgm9ZHFm.js +67 -0
  148. package/dist/file-lock-DWH0TfVu.js +107 -0
  149. package/dist/file-lock-DXW9h9ek.js +107 -0
  150. package/dist/fs-safe-BjSd07M4.js +115 -0
  151. package/dist/fs-safe-aWIhCWlb.js +125 -0
  152. package/dist/gateway-cli-BLeY_1DX.js +24154 -0
  153. package/dist/gateway-cli-Cu4vwhmi.js +24150 -0
  154. package/dist/gateway-rpc-B92CH0D3.js +28 -0
  155. package/dist/gateway-rpc-DZNlWapO.js +28 -0
  156. package/dist/gmail-setup-utils-CKyh29_R.js +422 -0
  157. package/dist/gmail-setup-utils-DquflkMR.js +423 -0
  158. package/dist/health-BYl7T-4m.js +1417 -0
  159. package/dist/health-DdviISKg.js +1414 -0
  160. package/dist/health-format-BE5TK5bs.js +28 -0
  161. package/dist/heartbeat-visibility-BO3iRpB6.js +125 -0
  162. package/dist/heartbeat-visibility-Cwp4TrTv.js +125 -0
  163. package/dist/help-format-D3JhWp1E.js +17 -0
  164. package/dist/hook-runner-global-C1thol1d.js +527 -0
  165. package/dist/hooks-cli-BKS9uZ0H.js +1221 -0
  166. package/dist/hooks-cli-FLWcCr9q.js +1217 -0
  167. package/dist/image-ops-CX41n0v5.js +354 -0
  168. package/dist/image-ops-DSL3eFfQ.js +354 -0
  169. package/dist/import-BSFgt760.js +604 -0
  170. package/dist/import-Da1CHJJg.js +606 -0
  171. package/dist/inbound-context-a5bzQvRt.js +68 -0
  172. package/dist/index.js +127 -101
  173. package/dist/inspect-BEpFbi0c.js +286 -0
  174. package/dist/inspect-BeNNpWna.js +286 -0
  175. package/dist/installs-CH7Qq_m_.js +319 -0
  176. package/dist/installs-CcM8H2YA.js +319 -0
  177. package/dist/ipv4-DNo9AFDu.js +46 -0
  178. package/dist/ipv4-VfoVR5uR.js +46 -0
  179. package/dist/ir-BPwP8hIc.js +972 -0
  180. package/dist/lifecycle-core-5Zxqwa6V.js +476 -0
  181. package/dist/lifecycle-core-C1bGeLby.js +474 -0
  182. package/dist/links-CtGBIrG8.js +15 -0
  183. package/dist/loader-BoP3JA-r.js +22411 -0
  184. package/dist/loader-DXbpue-L.js +22414 -0
  185. package/dist/logger-ASsO5Nz-.js +49 -0
  186. package/dist/logging-Cd9y2AdQ.js +20 -0
  187. package/dist/login-B2UXzgaB.js +61 -0
  188. package/dist/login-BEFL3xY9.js +62 -0
  189. package/dist/login-qr-C7wAz2fe.js +329 -0
  190. package/dist/login-qr-DWpUP1Ud.js +325 -0
  191. package/dist/logs-cli-CAcd-pXA.js +240 -0
  192. package/dist/logs-cli-D7Bzarht.js +236 -0
  193. package/dist/markdown-tables-BBNUZp4n.js +29 -0
  194. package/dist/markdown-tables-NgPcfXoF.js +29 -0
  195. package/dist/media-4-qOIjO-.js +971 -0
  196. package/dist/media-DTwJhAbE.js +9481 -0
  197. package/dist/message-action-names-BsNTjuBE.js +2520 -0
  198. package/dist/message-action-names-ocKcq8_3.js +2520 -0
  199. package/dist/message-channel-CtcVHawF.js +91 -0
  200. package/dist/mime-CAqaK3kp.js +146 -0
  201. package/dist/mime-ViuhRuMM.js +146 -0
  202. package/dist/net-DSkFMHJ8.js +225 -0
  203. package/dist/net-DTqfFYzt.js +225 -0
  204. package/dist/node-cli-BeXU67eQ.js +1458 -0
  205. package/dist/node-cli-i2aCtnmM.js +1462 -0
  206. package/dist/node-service-RyMlWp8N.js +67 -0
  207. package/dist/node-service-TL9b6Qfz.js +67 -0
  208. package/dist/nodes-cli-CtqnXBMD.js +1346 -0
  209. package/dist/nodes-cli-DgQU3LrG.js +1350 -0
  210. package/dist/nodes-screen-B7HJugJ0.js +250 -0
  211. package/dist/nodes-screen-nCRd71Mk.js +250 -0
  212. package/dist/note-B6142LyJ.js +92 -0
  213. package/dist/note-D-EI0czq.js +92 -0
  214. package/dist/npm-registry-spec-PPyRXSpx.js +786 -0
  215. package/dist/npm-registry-spec-uUmDWe6v.js +786 -0
  216. package/dist/npm-resolution-BC1LqCm2.js +86 -0
  217. package/dist/npm-resolution-DhlhUmRF.js +86 -0
  218. package/dist/onboard-CHowLVEG.js +647 -0
  219. package/dist/onboard-D_eCnKjt.js +649 -0
  220. package/dist/onboard-auth-cNtb3FTP.js +211 -0
  221. package/dist/onboard-auth-gwz-0mZ6.js +207 -0
  222. package/dist/onboard-channels-CFsUIDWq.js +2618 -0
  223. package/dist/onboard-channels-ZCML5CWb.js +2619 -0
  224. package/dist/onboard-helpers-8afRV_Tm.js +364 -0
  225. package/dist/onboard-helpers-DTRrJLj-.js +363 -0
  226. package/dist/onboard-remote-CFkvVAYg.js +127 -0
  227. package/dist/onboard-remote-JfBnmK70.js +127 -0
  228. package/dist/onboarding-DIxNghyi.js +586 -0
  229. package/dist/onboarding-Dhh0bjrb.js +588 -0
  230. package/dist/onboarding.finalize-5uipJuOl.js +403 -0
  231. package/dist/onboarding.finalize-De4etQul.js +405 -0
  232. package/dist/onboarding.gateway-config-DolBTXWT.js +196 -0
  233. package/dist/onboarding.gateway-config-rJkIamlG.js +202 -0
  234. package/dist/outbound-CPMaDtgC.js +220 -0
  235. package/dist/outbound-CYSuCMiW.js +221 -0
  236. package/dist/outbound-attachment-Ci02LXoq.js +18 -0
  237. package/dist/outbound-attachment-CqZ7Qc_o.js +18 -0
  238. package/dist/outbound-attachment-CuqWdsdV.js +18 -0
  239. package/dist/pairing-cli-B9JKvvST.js +126 -0
  240. package/dist/pairing-cli-C4HrfIHe.js +130 -0
  241. package/dist/pairing-labels-CBmGQ31P.js +9 -0
  242. package/dist/pairing-labels-D0xwC7Xb.js +9 -0
  243. package/dist/pairing-store-BoF0g-iN.js +459 -0
  244. package/dist/pairing-store-CseXj-5p.js +460 -0
  245. package/dist/path-env-CPZbb7me.js +89 -0
  246. package/dist/path-safety-BFE0XmGC.js +14 -0
  247. package/dist/path-safety-BJ8ge6Ho.js +14 -0
  248. package/dist/paths-DHuXVC00.js +229 -0
  249. package/dist/plugin-auto-enable-B_9J1XED.js +302 -0
  250. package/dist/plugin-auto-enable-DghjlFCL.js +301 -0
  251. package/dist/plugin-registry-68h2T8vi.js +33 -0
  252. package/dist/plugin-registry-BitdVPb4.js +33 -0
  253. package/dist/plugin-sdk/agents/subagent-registry.store.d.ts +0 -1
  254. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +0 -11
  255. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +1 -4
  256. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/shared.d.ts +1 -1
  257. package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +1 -10
  258. package/dist/plugin-sdk/auto-reply/reply/directive-handling.levels.d.ts +1 -4
  259. package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +1 -8
  260. package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +1 -23
  261. package/dist/plugin-sdk/auto-reply/reply/directive-handling.persist.d.ts +0 -2
  262. package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +0 -22
  263. package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +2 -29
  264. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-apply.d.ts +0 -8
  265. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-utils.d.ts +0 -1
  266. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -15
  267. package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +1 -8
  268. package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +1 -11
  269. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +1 -13
  270. package/dist/plugin-sdk/auto-reply/reply.d.ts +1 -1
  271. package/dist/plugin-sdk/auto-reply/status.d.ts +1 -4
  272. package/dist/plugin-sdk/auto-reply/templating.d.ts +0 -4
  273. package/dist/plugin-sdk/auto-reply/thinking.d.ts +0 -4
  274. package/dist/plugin-sdk/channels/dock.d.ts +1 -2
  275. package/dist/plugin-sdk/channels/plugins/types.adapters.d.ts +0 -6
  276. package/dist/plugin-sdk/channels/plugins/types.d.ts +1 -1
  277. package/dist/plugin-sdk/channels/plugins/types.plugin.d.ts +1 -2
  278. package/dist/plugin-sdk/commands/onboard-helpers.d.ts +0 -1
  279. package/dist/plugin-sdk/commands/onboard-types.d.ts +0 -2
  280. package/dist/plugin-sdk/config/legacy.migrations.d.ts +2 -1
  281. package/dist/plugin-sdk/config/legacy.shared.d.ts +0 -9
  282. package/dist/plugin-sdk/config/sessions/types.d.ts +0 -7
  283. package/dist/plugin-sdk/config/types.agent-defaults.d.ts +0 -8
  284. package/dist/plugin-sdk/config/types.base.d.ts +0 -1
  285. package/dist/plugin-sdk/config/types.messages.d.ts +0 -4
  286. package/dist/plugin-sdk/config/types.tools.d.ts +0 -73
  287. package/dist/plugin-sdk/config/types.tts.d.ts +2 -1
  288. package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +0 -4
  289. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +7 -197
  290. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +2 -10
  291. package/dist/plugin-sdk/config/zod-schema.core.d.ts +6 -234
  292. package/dist/plugin-sdk/config/zod-schema.d.ts +98 -301
  293. package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +148 -160
  294. package/dist/plugin-sdk/config/zod-schema.providers-whatsapp.d.ts +12 -12
  295. package/dist/plugin-sdk/config/zod-schema.providers.d.ts +88 -96
  296. package/dist/plugin-sdk/config/zod-schema.session.d.ts +4 -10
  297. package/dist/plugin-sdk/gateway/protocol/index.d.ts +11 -16
  298. package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +0 -5
  299. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +0 -1
  300. package/dist/plugin-sdk/index.js +295 -1236
  301. package/dist/plugin-sdk/line/config-schema.d.ts +4 -4
  302. package/dist/plugin-sdk/logging/levels.d.ts +1 -1
  303. package/dist/plugin-sdk/middleware/cli-runtime-base.d.ts +6 -0
  304. package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +6 -0
  305. package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +2 -2
  306. package/dist/plugin-sdk/middleware/runtimes/gemini.d.ts +8 -1
  307. package/dist/plugin-sdk/plugin-sdk/index.d.ts +3 -1
  308. package/dist/plugin-sdk/plugins/manifest-registry.d.ts +2 -0
  309. package/dist/plugin-sdk/plugins/manifest.d.ts +4 -4
  310. package/dist/plugin-sdk/plugins/registry.d.ts +18 -0
  311. package/dist/plugin-sdk/plugins/types.d.ts +4 -0
  312. package/dist/plugin-sdk/slack/manifest.d.ts +17 -0
  313. package/dist/plugin-sdk/stt/preflight.d.ts +2 -4
  314. package/dist/plugin-sdk/stt/providers/index.d.ts +1 -1
  315. package/dist/plugin-sdk/stt/providers/shared.d.ts +20 -1
  316. package/dist/plugin-sdk/tts/providers/edge.d.ts +2 -0
  317. package/dist/plugin-sdk/tts/providers/elevenlabs.d.ts +2 -0
  318. package/dist/plugin-sdk/tts/providers/index.d.ts +4 -0
  319. package/dist/plugin-sdk/tts/providers/openai.d.ts +2 -0
  320. package/dist/plugin-sdk/tts/tts.d.ts +13 -5
  321. package/dist/plugin-sdk/tts/types.d.ts +21 -0
  322. package/dist/plugins-BviLFPLV.js +255 -0
  323. package/dist/plugins-CaudBUbl.js +254 -0
  324. package/dist/plugins-cli-CsLhphNr.js +803 -0
  325. package/dist/plugins-cli-CujSP9NS.js +807 -0
  326. package/dist/ports-BtuzUQHl.js +370 -0
  327. package/dist/ports-CMcHia07.js +96 -0
  328. package/dist/ports-gRBeuUtp.js +316 -0
  329. package/dist/preflight-Bq8rimP-.js +667 -0
  330. package/dist/preflight-DyYbEp9X.js +667 -0
  331. package/dist/program-G8cGMPuz.js +250 -0
  332. package/dist/program-context-B9BwrbSx.js +474 -0
  333. package/dist/progress-BcwxtM9Q.js +124 -0
  334. package/dist/prompt-DtWGd43j.js +21 -0
  335. package/dist/prompt-select-styled-CpOsmtZi.js +1672 -0
  336. package/dist/prompt-select-styled-D-qBqrEJ.js +1669 -0
  337. package/dist/prompt-style-BpUMhEHC.js +9 -0
  338. package/dist/provider-auth-B7QgxlKt.js +187 -0
  339. package/dist/provider-auth-j-EQvvIk.js +187 -0
  340. package/dist/provider-dispatcher-Bx6CaIoV.js +660 -0
  341. package/dist/provider-dispatcher-DhkvjhO5.js +659 -0
  342. package/dist/push-apns--nEiZmEN.js +711 -0
  343. package/dist/push-apns-BtS6B6lb.js +713 -0
  344. package/dist/pw-ai-BpCsXF-x.js +1908 -0
  345. package/dist/pw-ai-ud_Kbn5S.js +1911 -0
  346. package/dist/qr-cli-BCeVLGfz.js +353 -0
  347. package/dist/qr-cli-Crsqtw01.js +349 -0
  348. package/dist/redact-Ci96Gj0O.js +191 -0
  349. package/dist/redact-snapshot-B9nof-Pb.js +1952 -0
  350. package/dist/redact-snapshot-BKiS91Mj.js +1952 -0
  351. package/dist/register.agent-GnCbOS2U.js +1014 -0
  352. package/dist/register.agent-Mwu5hgjA.js +292 -0
  353. package/dist/register.configure-By-Re240.js +130 -0
  354. package/dist/register.configure-rB-Q0WKu.js +135 -0
  355. package/dist/register.import-B83Dn36B.js +29 -0
  356. package/dist/register.import-wIYU2cVW.js +31 -0
  357. package/dist/register.maintenance-D5KctP9K.js +503 -0
  358. package/dist/register.maintenance-Er88Oxcm.js +501 -0
  359. package/dist/register.message-BQhRoEQQ.js +687 -0
  360. package/dist/register.message-CvZKWeGb.js +691 -0
  361. package/dist/register.onboard-BG064oHg.js +94 -0
  362. package/dist/register.onboard-CAKyc1Fc.js +98 -0
  363. package/dist/register.setup-C9sZLS_P.js +114 -0
  364. package/dist/register.setup-CVsZdhkJ.js +118 -0
  365. package/dist/register.status-health-sessions-BZJ0wTSa.js +429 -0
  366. package/dist/register.status-health-sessions-CyrUwwtB.js +667 -0
  367. package/dist/register.subclis-CQ_Pjkyv.js +267 -0
  368. package/dist/replies-BIx-MbQ7.js +136 -0
  369. package/dist/replies-DVU655H4.js +136 -0
  370. package/dist/reply-CL5VMSKN.js +12372 -0
  371. package/dist/reply-XKyfU3rS.js +12375 -0
  372. package/dist/reply-directives-DQfJ001O.js +182 -0
  373. package/dist/reply-directives-DfUITt7C.js +182 -0
  374. package/dist/reply-payloads-ZHo6kfTS.js +527 -0
  375. package/dist/reply-prefix-BSf3PC0x.js +37 -0
  376. package/dist/reply-prefix-DBTlMHLK.js +37 -0
  377. package/dist/resolve-route-B-_IgETc.js +249 -0
  378. package/dist/resolve-route-C8ZsgWDQ.js +249 -0
  379. package/dist/response-prefix-template-3LeqJx2X.js +134 -0
  380. package/dist/response-prefix-template-DBrUVx5V.js +134 -0
  381. package/dist/retry-CDrH81GP.js +77 -0
  382. package/dist/retry-Dar_7pCv.js +77 -0
  383. package/dist/run-main-DBFpx1kt.js +308 -0
  384. package/dist/secure-random-CLWSvf8A.js +44 -0
  385. package/dist/security-cli-B8lXw9ke.js +488 -0
  386. package/dist/security-cli-CRkS3VAf.js +483 -0
  387. package/dist/send-6g8QKfWj.js +374 -0
  388. package/dist/send-B5Hz1PIn.js +29 -0
  389. package/dist/send-B8eIlA1u.js +349 -0
  390. package/dist/send-BFZPQE4j.js +492 -0
  391. package/dist/send-BpTDvE0D.js +1779 -0
  392. package/dist/send-BxOrO1Wv.js +1776 -0
  393. package/dist/send-C6gPJu-Z.js +11 -0
  394. package/dist/send-C7MoKtkN.js +426 -0
  395. package/dist/send-CXzq2LI6.js +2245 -0
  396. package/dist/send-CYOZoObr.js +547 -0
  397. package/dist/send-CfQyIvcC.js +332 -0
  398. package/dist/send-DUtuuwhw.js +492 -0
  399. package/dist/send-DbafVwxp.js +2245 -0
  400. package/dist/send-DeZg8K7y.js +349 -0
  401. package/dist/send-DwkjxJlv.js +547 -0
  402. package/dist/send-iX9xbxlU.js +1178 -0
  403. package/dist/server-BKfCzEzd.js +206 -0
  404. package/dist/server-fmO4eo7K.js +202 -0
  405. package/dist/server-lifecycle-CgPpP10P.js +2437 -0
  406. package/dist/server-lifecycle-Cn8yY5MW.js +2437 -0
  407. package/dist/server-node-events-C-ZzSBYh.js +391 -0
  408. package/dist/server-node-events-DYlyfDHM.js +395 -0
  409. package/dist/service-C2j81L86.js +670 -0
  410. package/dist/service-C8a0SXHD.js +670 -0
  411. package/dist/session-AulYhqOb.js +170 -0
  412. package/dist/session-C6VKWvx6.js +170 -0
  413. package/dist/session-cost-usage-0Vs4hgMe.js +627 -0
  414. package/dist/session-cost-usage-C-DsaOfN.js +627 -0
  415. package/dist/session-dirs-CO1f2ArM.js +318 -0
  416. package/dist/session-dirs-DoboH7Oy.js +318 -0
  417. package/dist/session-utils-CRK8ToKG.js +621 -0
  418. package/dist/session-utils-DWlkmCX8.js +621 -0
  419. package/dist/sessions-DtqrmUJS.js +2553 -0
  420. package/dist/sessions-gT-4fcX-.js +245 -0
  421. package/dist/shell-env-c3j5zcU9.js +163 -0
  422. package/dist/ssrf-8wNqPNzN.js +183 -0
  423. package/dist/ssrf-CJIdPXuS.js +183 -0
  424. package/dist/status-BI_-xpDt.js +1947 -0
  425. package/dist/status-PZVwjKjl.js +1943 -0
  426. package/dist/status.update-BmuDZ7E7.js +449 -0
  427. package/dist/status.update-Mf6HSRvU.js +449 -0
  428. package/dist/store-B7PGEdFf.js +2555 -0
  429. package/dist/store-CzhBjUCN.js +64 -0
  430. package/dist/store-YkSxKAey.js +53 -0
  431. package/dist/store-ZNeFv2Q7.js +64 -0
  432. package/dist/subagent-registry-R1DiAM4R.js +4839 -0
  433. package/dist/subagent-registry-xLRXC8Bg.js +4841 -0
  434. package/dist/subsystem-BAW_f3DI.js +1195 -0
  435. package/dist/subsystem-DGSHVL8I.js +1081 -0
  436. package/dist/system-cli-9SvRrT9D.js +77 -0
  437. package/dist/system-cli-yCa5Q1YM.js +73 -0
  438. package/dist/systemd-40Rij3QR.js +547 -0
  439. package/dist/systemd-5C97CSzd.js +547 -0
  440. package/dist/systemd-hints-3iQteJw-.js +278 -0
  441. package/dist/systemd-hints-CyQqHq1i.js +278 -0
  442. package/dist/systemd-linger-B2rPbnAi.js +75 -0
  443. package/dist/systemd-linger-DDvkfxH-.js +75 -0
  444. package/dist/table-DFx25vNb.js +279 -0
  445. package/dist/tables-C5fI0PmT.js +55 -0
  446. package/dist/tables-Cm9qvQ9D.js +55 -0
  447. package/dist/tables-fRe01eP1.js +55 -0
  448. package/dist/tailnet-Da-_9e8E.js +40 -0
  449. package/dist/tailnet-xt92Yaop.js +40 -0
  450. package/dist/tailscale-CnV0JWca.js +230 -0
  451. package/dist/tailscale-VkEC8dzj.js +230 -0
  452. package/dist/targets-C99szk_e.js +114 -0
  453. package/dist/targets-CPaTjbpp.js +2607 -0
  454. package/dist/targets-CmC5m7Ey.js +53 -0
  455. package/dist/targets-D-p4rJVS.js +650 -0
  456. package/dist/targets-D2OQt8-7.js +650 -0
  457. package/dist/targets-D94MtTiZ.js +2606 -0
  458. package/dist/targets-RajrXTl7.js +220 -0
  459. package/dist/targets-_UWmnyI9.js +53 -0
  460. package/dist/thinking-4nOZPunr.js +60 -0
  461. package/dist/thinking-ZfH2V9Os.js +60 -0
  462. package/dist/tokens-TtJJxzRr.js +21 -0
  463. package/dist/tool-display-Bxs_1jIn.js +785 -0
  464. package/dist/tool-display-D9p_Ttkq.js +785 -0
  465. package/dist/tool-images-9Ron321Q.js +263 -0
  466. package/dist/tool-images-BWhy6WRN.js +263 -0
  467. package/dist/trash-B5xyvBDf.js +125 -0
  468. package/dist/trash-BpB96kHe.js +125 -0
  469. package/dist/tui-Ba0uZDrg.js +3237 -0
  470. package/dist/tui-Biz0HqDj.js +3237 -0
  471. package/dist/tui-cli-C-UV6o2v.js +63 -0
  472. package/dist/tui-cli-Ds_bLT-h.js +67 -0
  473. package/dist/types.tools-BBb2rl3g.js +23 -0
  474. package/dist/types.tools-BDJw1yFx.js +23 -0
  475. package/dist/update-Barj5dsg.js +349 -0
  476. package/dist/update-D839Q8su.js +349 -0
  477. package/dist/update-cli-2I4hm0Gy.js +1150 -0
  478. package/dist/update-cli-CcwXmMKB.js +1148 -0
  479. package/dist/usage-BI9kergH.js +5465 -0
  480. package/dist/utils-DPoNpP7D.js +631 -0
  481. package/dist/voice-credentials-64XAMSJm.js +46 -0
  482. package/dist/voice-credentials-v-CQkTpD.js +46 -0
  483. package/dist/web-63IbbidQ.js +3051 -0
  484. package/dist/web-D9N764Da.js +80 -0
  485. package/dist/web-DUvNYLzr.js +75 -0
  486. package/dist/webhooks-cli-owhVNNkz.js +334 -0
  487. package/dist/webhooks-cli-zlvka6QD.js +330 -0
  488. package/dist/whatsapp-actions-8DejyRG5.js +126 -0
  489. package/dist/whatsapp-actions-DCzp5LKe.js +131 -0
  490. package/dist/widearea-dns-CQqZIeu8.js +127 -0
  491. package/dist/workspace-CB7pVojf.js +441 -0
  492. package/dist/workspace-DWEyzM0F.js +439 -0
  493. package/dist/zod-schema-CvFqwpNE.js +2719 -0
  494. package/dist/zod-schema-Y5SQgJLm.js +2719 -0
  495. package/package.json +1 -1
  496. package/dist/accounts-Aqbb2_Fn.js +0 -270
  497. package/dist/accounts-Bo2bX8jP.js +0 -272
  498. package/dist/accounts-CJUdvsIZ.js +0 -32
  499. package/dist/accounts-D3fAPVzU.js +0 -36
  500. package/dist/accounts-DZmv4bXS.js +0 -47
  501. package/dist/accounts-DmB4SVPK.js +0 -47
  502. package/dist/accounts-DtkyfvwR.js +0 -36
  503. package/dist/ack-reactions-BqcZUQJ3.js +0 -446
  504. package/dist/ack-reactions-DXHaDBH-.js +0 -446
  505. package/dist/acp-cli-DVXhDMc6.js +0 -1324
  506. package/dist/acp-cli-QBL4_qcW.js +0 -1319
  507. package/dist/active-listener-CwxZ24bZ.js +0 -37
  508. package/dist/active-listener-v2sItamh.js +0 -37
  509. package/dist/agent-C5PZDKE1.js +0 -687
  510. package/dist/agent-helpers-BSGqeJr-.js +0 -400
  511. package/dist/agent-qCBPcUcF.js +0 -688
  512. package/dist/agent-scope-CJW7vnF8.js +0 -114
  513. package/dist/agent-scope-_ND_-bJy.js +0 -116
  514. package/dist/agents-Byc39Y4A.js +0 -760
  515. package/dist/agents.config-BgDBcY4h.js +0 -116
  516. package/dist/agents.config-D8gLHPWo.js +0 -116
  517. package/dist/audio-BIvUsncf.js +0 -43
  518. package/dist/audio-CQ8TfmVN.js +0 -43
  519. package/dist/audit-C0x7Cm6K.js +0 -3150
  520. package/dist/audit-CAY-uzWP.js +0 -3150
  521. package/dist/auth-DGqCLaQq.js +0 -448
  522. package/dist/auth-DLTRySEi.js +0 -314
  523. package/dist/auth-Drf91ntw.js +0 -315
  524. package/dist/auth-ku2khJyQ.js +0 -448
  525. package/dist/banner-CGI3XOm4.js +0 -294
  526. package/dist/binaries-BTvHIrCr.js +0 -13
  527. package/dist/bindings-Dr0bGRst.js +0 -69
  528. package/dist/bindings-DsWJQVKh.js +0 -69
  529. package/dist/bonjour-discovery-BElR62fH.js +0 -378
  530. package/dist/bonjour-discovery-C8XyVsjb.js +0 -378
  531. package/dist/browser-cli-DxJew43l.js +0 -1694
  532. package/dist/browser-cli-p0nakrjO.js +0 -1690
  533. package/dist/call-BrTmlOx3.js +0 -518
  534. package/dist/call-ChdUdwb4.js +0 -517
  535. package/dist/catalog-DTlcfTT9.js +0 -185
  536. package/dist/catalog-PixZqhZK.js +0 -185
  537. package/dist/channel-account-context-BO245Tcn.js +0 -133
  538. package/dist/channel-account-context-BgK0hm-I.js +0 -133
  539. package/dist/channel-activity-B0qlUR5e.js +0 -292
  540. package/dist/channel-activity-C-L6rDrQ.js +0 -94
  541. package/dist/channel-activity-DdgLBZ7M.js +0 -94
  542. package/dist/channel-options-C1Q9SUhv.js +0 -33
  543. package/dist/channel-options-zANFhRx_.js +0 -32
  544. package/dist/channel-selection-DW21dXB1.js +0 -51
  545. package/dist/channel-selection-wK_6S2Ku.js +0 -51
  546. package/dist/channel-web-DCSjrtlh.js +0 -2136
  547. package/dist/channel-web-JCgegBgG.js +0 -2134
  548. package/dist/channels-cli-D48ytzLq.js +0 -1438
  549. package/dist/channels-cli-hZbUcB3G.js +0 -1434
  550. package/dist/channels-status-issues-B6I2l7Sm.js +0 -18
  551. package/dist/channels-status-issues-DhDH2fWp.js +0 -18
  552. package/dist/chat-envelope-BIujl9Cj.js +0 -248
  553. package/dist/chat-envelope-CrM0X4sl.js +0 -248
  554. package/dist/chrome-Dqtq7zCc.js +0 -1733
  555. package/dist/chrome-XeSY99Z_.js +0 -1732
  556. package/dist/chunk-LUabyS9k.js +0 -341
  557. package/dist/clack-prompter-fAgbvPW4.js +0 -122
  558. package/dist/clack-prompter-kf9qTN5p.js +0 -121
  559. package/dist/cleanup-utils-CNwlTKyR.js +0 -94
  560. package/dist/cli-BTLaY8q4.js +0 -133
  561. package/dist/cli-CZV23GbW.js +0 -129
  562. package/dist/client-B9u3JdT_.js +0 -2316
  563. package/dist/client-DEEOhx0w.js +0 -2316
  564. package/dist/clipboard-B2nstLx7.js +0 -31
  565. package/dist/clipboard-C8QI9fes.js +0 -31
  566. package/dist/command-format-D0vKipG9.js +0 -32
  567. package/dist/command-format-LFmgWzKJ.js +0 -18
  568. package/dist/command-registry-BPXqH4ST.js +0 -215
  569. package/dist/commands-BAYwlS3d.js +0 -41
  570. package/dist/commands-D842kCjj.js +0 -41
  571. package/dist/commands-registry-Cg2GTT2J.js +0 -892
  572. package/dist/commands-registry-Yz-uV5oG.js +0 -891
  573. package/dist/common-B67cBSew.js +0 -156
  574. package/dist/common-DEoiTqOr.js +0 -156
  575. package/dist/completion-cli-D5J3fPka.js +0 -452
  576. package/dist/completion-cli-Dd1g-p7S.js +0 -452
  577. package/dist/config-CAa0rZSx.js +0 -4225
  578. package/dist/config-W0w-gi2j.js +0 -4223
  579. package/dist/config-cli-Ddz-yCdQ.js +0 -247
  580. package/dist/config-cli-shgSFYig.js +0 -243
  581. package/dist/config-guard-BI85dxHR.js +0 -99
  582. package/dist/config-guard-DQqnigKh.js +0 -75
  583. package/dist/config-validation-D-h4LHyA.js +0 -18
  584. package/dist/config-validation-Df_kroIQ.js +0 -18
  585. package/dist/configure-BnFwpZ3l.js +0 -891
  586. package/dist/configure-Cj4mlKSH.js +0 -889
  587. package/dist/control-auth-BrBr2xb8.js +0 -397
  588. package/dist/control-auth-CehjYKnL.js +0 -397
  589. package/dist/control-ui-assets-D8F383Mo.js +0 -186
  590. package/dist/control-ui-assets-DYKtRIm0.js +0 -186
  591. package/dist/conversation-label-Bn5j3lUT.js +0 -36
  592. package/dist/cron-cli-DVzDHzAX.js +0 -494
  593. package/dist/cron-cli-gkH2qKM4.js +0 -498
  594. package/dist/daemon-cli-BTdNO1vH.js +0 -737
  595. package/dist/daemon-cli-DNNqI2LD.js +0 -735
  596. package/dist/daemon-install-CaEHG92p.js +0 -56
  597. package/dist/daemon-install-DbpDSDfW.js +0 -60
  598. package/dist/daemon-install-helpers-DjE_WnlY.js +0 -504
  599. package/dist/daemon-install-helpers-DocTUxqQ.js +0 -504
  600. package/dist/deliver-CDcL8ok6.js +0 -481
  601. package/dist/deliver-CS8JsevV.js +0 -481
  602. package/dist/delivery-queue-CTaYZQ_8.js +0 -244
  603. package/dist/delivery-queue-DMZ7mH8P.js +0 -244
  604. package/dist/devices-cli-BBJ4His-.js +0 -319
  605. package/dist/devices-cli-DHSJSFW1.js +0 -323
  606. package/dist/diagnostics-BSvCaLNs.js +0 -35
  607. package/dist/diagnostics-mWFAsFeo.js +0 -35
  608. package/dist/directory-cli-C-oHD_XE.js +0 -224
  609. package/dist/directory-cli-Cw99VGvr.js +0 -220
  610. package/dist/dispatcher-C8d1NNLZ.js +0 -174
  611. package/dist/dispatcher-DY6Ga60j.js +0 -173
  612. package/dist/dm-policy-shared-CRQ-Wr5g.js +0 -22
  613. package/dist/dm-policy-shared-CXXf2ltd.js +0 -22
  614. package/dist/dns-cli-BOqx9qo1.js +0 -199
  615. package/dist/dns-cli-WfqSC3JU.js +0 -203
  616. package/dist/dock-Big-J2VN.js +0 -929
  617. package/dist/dock-Cj4PKiUh.js +0 -928
  618. package/dist/doctor-completion-B9RsNJKh.js +0 -92
  619. package/dist/doctor-completion-DhNvADTs.js +0 -92
  620. package/dist/doctor-config-flow-BUuADMDa.js +0 -1935
  621. package/dist/doctor-config-flow-yOUpQC2B.js +0 -1934
  622. package/dist/enable-DC9V0nTO.js +0 -59
  623. package/dist/enable-DzXMQJ-o.js +0 -59
  624. package/dist/env-B3zr72vQ.js +0 -60
  625. package/dist/errors-CdmXrBic.js +0 -35
  626. package/dist/errors-Cr_NbOb4.js +0 -35
  627. package/dist/exec-D_s-zAtY.js +0 -164
  628. package/dist/exec-Zz6eJ6YU.js +0 -164
  629. package/dist/fetch-C8pdlo4-.js +0 -67
  630. package/dist/fetch-DRVdxxEj.js +0 -67
  631. package/dist/file-lock-6NXMPZTT.js +0 -107
  632. package/dist/file-lock-C_KRlR7M.js +0 -107
  633. package/dist/fs-safe-DZHpH7TI.js +0 -98
  634. package/dist/fs-safe-vm3JMUkq.js +0 -88
  635. package/dist/gateway-cli-CebjflhZ.js +0 -24337
  636. package/dist/gateway-cli-Y9U6rbPB.js +0 -24333
  637. package/dist/gateway-rpc-BCFkQPa2.js +0 -28
  638. package/dist/gateway-rpc-DOgYbsOG.js +0 -28
  639. package/dist/gmail-setup-utils-DMeA1UM1.js +0 -423
  640. package/dist/gmail-setup-utils-FHWSAur3.js +0 -422
  641. package/dist/health-CXWQZGNz.js +0 -1414
  642. package/dist/health-DCC6hoLO.js +0 -1417
  643. package/dist/health-format-CVgQD-z9.js +0 -28
  644. package/dist/heartbeat-visibility-Cv0ejWJ-.js +0 -125
  645. package/dist/heartbeat-visibility-Da3TDQp2.js +0 -125
  646. package/dist/help-format-DM6-OBt-.js +0 -17
  647. package/dist/hook-runner-global-C0DFQmQw.js +0 -527
  648. package/dist/hooks-cli-CB5rKhHe.js +0 -1221
  649. package/dist/hooks-cli-Dy7m9hzM.js +0 -1225
  650. package/dist/image-ops-B9ofmzSq.js +0 -354
  651. package/dist/image-ops-CMuvRsMY.js +0 -354
  652. package/dist/import-BH13F5mT.js +0 -606
  653. package/dist/import-D8HVcDqO.js +0 -604
  654. package/dist/inbound-context-CmmmT8IP.js +0 -68
  655. package/dist/inbound-path-policy-BdmTOUka.js +0 -90
  656. package/dist/inbound-path-policy-BurOAu44.js +0 -90
  657. package/dist/inspect-nW8LAukU.js +0 -286
  658. package/dist/inspect-xy2EHy8G.js +0 -286
  659. package/dist/installs-CpfHmKY1.js +0 -325
  660. package/dist/installs-DebiMrGj.js +0 -325
  661. package/dist/ipv4-ysiNGssl.js +0 -46
  662. package/dist/ipv4-zc_Hfvbp.js +0 -46
  663. package/dist/ir-CaxTklDC.js +0 -940
  664. package/dist/lifecycle-core-Z5SScMlU.js +0 -476
  665. package/dist/lifecycle-core-pPwYSt7m.js +0 -474
  666. package/dist/links-D5vtq30Q.js +0 -15
  667. package/dist/loader-BVHaRcP7.js +0 -22404
  668. package/dist/loader-CxSGgugQ.js +0 -22401
  669. package/dist/local-roots-CrJ_Jv_G.js +0 -314
  670. package/dist/local-roots-n_Y4iYwb.js +0 -313
  671. package/dist/logger-B8yHnzPl.js +0 -49
  672. package/dist/logging-FctZEleJ.js +0 -20
  673. package/dist/login-C99fsB0N.js +0 -61
  674. package/dist/login-cLvGPjeO.js +0 -62
  675. package/dist/login-qr-CGqRFwgl.js +0 -329
  676. package/dist/login-qr-dnY5DC2C.js +0 -325
  677. package/dist/logs-cli-Bda7xY4N.js +0 -236
  678. package/dist/logs-cli-HzR-vnpD.js +0 -240
  679. package/dist/markdown-tables-58Hq__7K.js +0 -29
  680. package/dist/markdown-tables-GFEX0OR6.js +0 -29
  681. package/dist/media-C1SIfGTn.js +0 -10452
  682. package/dist/media-CFsyXs3H.js +0 -940
  683. package/dist/message-action-names-BgsKGLDS.js +0 -2521
  684. package/dist/message-action-names-DkZwEFhU.js +0 -2521
  685. package/dist/message-channel-FMNRI5Ax.js +0 -91
  686. package/dist/mime-AuIDUZPG.js +0 -149
  687. package/dist/mime-Cqg1jjia.js +0 -149
  688. package/dist/net-BEFkF-nI.js +0 -225
  689. package/dist/net-CNsUGiSw.js +0 -225
  690. package/dist/node-cli-Bu-InsO9.js +0 -1462
  691. package/dist/node-cli-DE7Pm7Fr.js +0 -1458
  692. package/dist/node-service-CumFZc9L.js +0 -67
  693. package/dist/node-service-DY1gG06I.js +0 -67
  694. package/dist/nodes-cli-B5aAExN0.js +0 -1350
  695. package/dist/nodes-cli-eKRqlKuO.js +0 -1346
  696. package/dist/nodes-screen-B3Sij1uT.js +0 -250
  697. package/dist/nodes-screen-DEvpoFmH.js +0 -250
  698. package/dist/note-CPFJCWJJ.js +0 -92
  699. package/dist/note-DHUJACHE.js +0 -92
  700. package/dist/npm-registry-spec-BgMtTHvq.js +0 -786
  701. package/dist/npm-registry-spec-Dz3z1Zpd.js +0 -786
  702. package/dist/npm-resolution-BXiQH99t.js +0 -86
  703. package/dist/npm-resolution-CqE0nhxJ.js +0 -86
  704. package/dist/onboard-DK2z3w1P.js +0 -649
  705. package/dist/onboard-auth-C_wHkop1.js +0 -207
  706. package/dist/onboard-auth-CkCBLvTg.js +0 -211
  707. package/dist/onboard-channels-C8_OLbPk.js +0 -2547
  708. package/dist/onboard-channels-w_tnOhVu.js +0 -2548
  709. package/dist/onboard-helpers-Q7M6vdzh.js +0 -363
  710. package/dist/onboard-helpers-SCO3k5Y8.js +0 -364
  711. package/dist/onboard-remote-Co2hv1AD.js +0 -127
  712. package/dist/onboard-remote-Dl3BFSg2.js +0 -127
  713. package/dist/onboard-rioH3DW6.js +0 -647
  714. package/dist/onboarding-CsXVuzFP.js +0 -586
  715. package/dist/onboarding-r5RCkc-Z.js +0 -588
  716. package/dist/onboarding.finalize-BY8uN1nD.js +0 -402
  717. package/dist/onboarding.finalize-C-kfj-aR.js +0 -404
  718. package/dist/onboarding.gateway-config-BL0Q7Wpg.js +0 -201
  719. package/dist/onboarding.gateway-config-D2QsXMYO.js +0 -195
  720. package/dist/outbound-CcaPcetn.js +0 -220
  721. package/dist/outbound-CeiW8z3a.js +0 -221
  722. package/dist/outbound-attachment-BLSGI2dJ.js +0 -18
  723. package/dist/outbound-attachment-Bfm5-JYe.js +0 -18
  724. package/dist/outbound-attachment-CZ7zoYxB.js +0 -18
  725. package/dist/pairing-cli-CgX79ujL.js +0 -125
  726. package/dist/pairing-cli-DvbbXFgC.js +0 -129
  727. package/dist/pairing-labels-3wDxaApH.js +0 -9
  728. package/dist/pairing-labels-DCbWnbWk.js +0 -9
  729. package/dist/pairing-store-CdY7iRS0.js +0 -459
  730. package/dist/pairing-store-DykkYpQ7.js +0 -460
  731. package/dist/path-env-Cqo5LZmw.js +0 -89
  732. package/dist/path-guards-DOpzcMXz.js +0 -31
  733. package/dist/path-guards-DipYoPVw.js +0 -31
  734. package/dist/path-safety-CXKAVpMp.js +0 -14
  735. package/dist/path-safety-DGB91qBk.js +0 -14
  736. package/dist/paths-BTaH3rLn.js +0 -232
  737. package/dist/plugin-auto-enable-C6FPGg_-.js +0 -301
  738. package/dist/plugin-auto-enable-L8eOc8iC.js +0 -302
  739. package/dist/plugin-registry-BTycBIix.js +0 -33
  740. package/dist/plugin-registry-CFty9Gym.js +0 -33
  741. package/dist/plugin-sdk/auto-reply/reply/elevated-allowlist-matcher.d.ts +0 -20
  742. package/dist/plugin-sdk/auto-reply/reply/elevated-unavailable.d.ts +0 -8
  743. package/dist/plugin-sdk/auto-reply/reply/reply-elevated.d.ts +0 -16
  744. package/dist/plugin-sdk/compat/legacy-names.d.ts +0 -8
  745. package/dist/plugin-sdk/config/legacy.migrations.part-1.d.ts +0 -2
  746. package/dist/plugin-sdk/config/legacy.migrations.part-2.d.ts +0 -2
  747. package/dist/plugin-sdk/config/legacy.migrations.part-3.d.ts +0 -2
  748. package/dist/plugin-sdk/cron/legacy-delivery.d.ts +0 -3
  749. package/dist/plugin-sdk/cron/payload-migration.d.ts +0 -3
  750. package/dist/plugin-sdk/link-understanding/apply.d.ts +0 -10
  751. package/dist/plugin-sdk/link-understanding/defaults.d.ts +0 -2
  752. package/dist/plugin-sdk/link-understanding/detect.d.ts +0 -3
  753. package/dist/plugin-sdk/link-understanding/format.d.ts +0 -4
  754. package/dist/plugin-sdk/link-understanding/runner.d.ts +0 -11
  755. package/dist/plugin-sdk/media/input-files.d.ts +0 -95
  756. package/dist/plugin-sdk/media-understanding/apply.d.ts +0 -19
  757. package/dist/plugin-sdk/media-understanding/attachments.d.ts +0 -49
  758. package/dist/plugin-sdk/media-understanding/concurrency.d.ts +0 -1
  759. package/dist/plugin-sdk/media-understanding/defaults.d.ts +0 -11
  760. package/dist/plugin-sdk/media-understanding/errors.d.ts +0 -6
  761. package/dist/plugin-sdk/media-understanding/format.d.ts +0 -7
  762. package/dist/plugin-sdk/media-understanding/fs.d.ts +0 -1
  763. package/dist/plugin-sdk/media-understanding/output-extract.d.ts +0 -2
  764. package/dist/plugin-sdk/media-understanding/providers/anthropic/index.d.ts +0 -2
  765. package/dist/plugin-sdk/media-understanding/providers/deepgram/audio.d.ts +0 -1
  766. package/dist/plugin-sdk/media-understanding/providers/deepgram/index.d.ts +0 -2
  767. package/dist/plugin-sdk/media-understanding/providers/google/audio.d.ts +0 -1
  768. package/dist/plugin-sdk/media-understanding/providers/google/index.d.ts +0 -2
  769. package/dist/plugin-sdk/media-understanding/providers/google/video.d.ts +0 -3
  770. package/dist/plugin-sdk/media-understanding/providers/groq/index.d.ts +0 -2
  771. package/dist/plugin-sdk/media-understanding/providers/index.d.ts +0 -4
  772. package/dist/plugin-sdk/media-understanding/providers/minimax/index.d.ts +0 -2
  773. package/dist/plugin-sdk/media-understanding/providers/mistral/index.d.ts +0 -2
  774. package/dist/plugin-sdk/media-understanding/providers/moonshot/index.d.ts +0 -2
  775. package/dist/plugin-sdk/media-understanding/providers/moonshot/video.d.ts +0 -3
  776. package/dist/plugin-sdk/media-understanding/providers/openai/audio.d.ts +0 -1
  777. package/dist/plugin-sdk/media-understanding/providers/openai/index.d.ts +0 -2
  778. package/dist/plugin-sdk/media-understanding/providers/shared.d.ts +0 -20
  779. package/dist/plugin-sdk/media-understanding/providers/zai/index.d.ts +0 -2
  780. package/dist/plugin-sdk/media-understanding/resolve.d.ts +0 -44
  781. package/dist/plugin-sdk/media-understanding/runner.d.ts +0 -34
  782. package/dist/plugin-sdk/media-understanding/runner.entries.d.ts +0 -33
  783. package/dist/plugin-sdk/media-understanding/scope.d.ts +0 -9
  784. package/dist/plugin-sdk/media-understanding/types.d.ts +0 -59
  785. package/dist/plugin-sdk/media-understanding/video.d.ts +0 -2
  786. package/dist/plugin-sdk/utils/run-with-concurrency.d.ts +0 -11
  787. package/dist/plugins-7B167wIj.js +0 -453
  788. package/dist/plugins-BRHOfy1Z.js +0 -455
  789. package/dist/plugins-cli-CQGW40I-.js +0 -797
  790. package/dist/plugins-cli-D-ZfWRTw.js +0 -801
  791. package/dist/ports-CAqyeQYZ.js +0 -316
  792. package/dist/ports-CTUgXF2d.js +0 -96
  793. package/dist/ports-DqfnVnCw.js +0 -370
  794. package/dist/preflight-CJqKHCYa.js +0 -64
  795. package/dist/preflight-TR92sc61.js +0 -68
  796. package/dist/program-_SGrjcuG.js +0 -248
  797. package/dist/program-context-B6yIPfYd.js +0 -474
  798. package/dist/progress-BOdRbOHD.js +0 -124
  799. package/dist/prompt-WEkXwIMT.js +0 -21
  800. package/dist/prompt-select-styled-BiBnOTh8.js +0 -1669
  801. package/dist/prompt-select-styled-DQacku67.js +0 -1672
  802. package/dist/prompt-style-B4Cq4PyQ.js +0 -9
  803. package/dist/provider-dispatcher-BjsUFEpi.js +0 -659
  804. package/dist/provider-dispatcher-BxNDRVIT.js +0 -660
  805. package/dist/push-apns-Cj0Ryn18.js +0 -713
  806. package/dist/push-apns-fFfYCqda.js +0 -711
  807. package/dist/pw-ai-CnN2sITD.js +0 -1908
  808. package/dist/pw-ai-fnX3cecw.js +0 -1911
  809. package/dist/qr-cli-CriPg41m.js +0 -349
  810. package/dist/qr-cli-DSURqD0D.js +0 -353
  811. package/dist/redact-gXuh8MFk.js +0 -191
  812. package/dist/redact-snapshot-BecRL_h6.js +0 -2016
  813. package/dist/redact-snapshot-pTdzSrex.js +0 -2016
  814. package/dist/register.agent-Bpwvc5By.js +0 -1018
  815. package/dist/register.agent-DQFcnOVQ.js +0 -290
  816. package/dist/register.configure-C5CK8tgd.js +0 -133
  817. package/dist/register.configure-CEJ5Wrkl.js +0 -128
  818. package/dist/register.import-CPQqqdje.js +0 -31
  819. package/dist/register.import-D1UaH1QV.js +0 -29
  820. package/dist/register.maintenance-Bpz-NOhG.js +0 -499
  821. package/dist/register.maintenance-DDwlfAfw.js +0 -501
  822. package/dist/register.message-BoNswT8e.js +0 -685
  823. package/dist/register.message-pvz70g_-.js +0 -689
  824. package/dist/register.onboard-BvcVLNp3.js +0 -93
  825. package/dist/register.onboard-CZV7LvZI.js +0 -97
  826. package/dist/register.setup-Cgv2uSPG.js +0 -117
  827. package/dist/register.setup-yTqvTinY.js +0 -113
  828. package/dist/register.status-health-sessions-LK50hWDT.js +0 -428
  829. package/dist/register.status-health-sessions-kDGDihye.js +0 -668
  830. package/dist/register.subclis-DSr7AHAr.js +0 -267
  831. package/dist/replies-IpiCq1Ht.js +0 -136
  832. package/dist/replies-LSx_XhsP.js +0 -136
  833. package/dist/reply-B8It91bP.js +0 -13652
  834. package/dist/reply-CbgHVTv2.js +0 -13649
  835. package/dist/reply-directives-Cz7622Qx.js +0 -182
  836. package/dist/reply-directives-ssnaPNiU.js +0 -182
  837. package/dist/reply-payloads-CQMtrphw.js +0 -527
  838. package/dist/reply-prefix-CWcAZKhE.js +0 -37
  839. package/dist/reply-prefix-Drq7Pf3A.js +0 -37
  840. package/dist/resolve-route-B8uIc2H3.js +0 -249
  841. package/dist/resolve-route-C8ooNlI4.js +0 -249
  842. package/dist/response-prefix-template-D3ZcJP4E.js +0 -134
  843. package/dist/response-prefix-template-DPOggmPO.js +0 -134
  844. package/dist/retry-B19gMxS7.js +0 -77
  845. package/dist/retry-BdhJlZQI.js +0 -77
  846. package/dist/run-main-BP3UHEJa.js +0 -306
  847. package/dist/runner-CD3YycXx.js +0 -2365
  848. package/dist/runner-D74Wiza_.js +0 -2365
  849. package/dist/secure-random-CQa3H-OL.js +0 -44
  850. package/dist/security-cli-05blEYyC.js +0 -482
  851. package/dist/security-cli-DYbt8duB.js +0 -487
  852. package/dist/send-7O3-bRtl.js +0 -547
  853. package/dist/send-9Huf62k3.js +0 -2245
  854. package/dist/send-B0C42B2A.js +0 -426
  855. package/dist/send-B9mIJdUo.js +0 -547
  856. package/dist/send-BHm9dk6D.js +0 -1178
  857. package/dist/send-BetMntNc.js +0 -11
  858. package/dist/send-Bj0RXr-a.js +0 -492
  859. package/dist/send-COuVtZ4b.js +0 -374
  860. package/dist/send-CXNuhYA-.js +0 -332
  861. package/dist/send-Ce_BDa8P.js +0 -349
  862. package/dist/send-ChvasRSh.js +0 -1779
  863. package/dist/send-DNVRlTEF.js +0 -29
  864. package/dist/send-DWf7BCPe.js +0 -492
  865. package/dist/send-Dd2_MykI.js +0 -2245
  866. package/dist/send-IJaUAa8H.js +0 -1776
  867. package/dist/send-vvZXksNU.js +0 -349
  868. package/dist/server-BrzR9JmX.js +0 -206
  869. package/dist/server-_h27-uP_.js +0 -202
  870. package/dist/server-lifecycle-CUdA6Far.js +0 -2437
  871. package/dist/server-lifecycle-DQZWL8iP.js +0 -2437
  872. package/dist/server-node-events-DSefRBGC.js +0 -394
  873. package/dist/server-node-events-jDiG1-M2.js +0 -390
  874. package/dist/service-9le8AnC-.js +0 -670
  875. package/dist/service-Drb0kx6I.js +0 -670
  876. package/dist/session-BIAOl5QR.js +0 -170
  877. package/dist/session-Wu00pCn_.js +0 -170
  878. package/dist/session-cost-usage-7plmOKbs.js +0 -627
  879. package/dist/session-cost-usage-CPFxBFUg.js +0 -627
  880. package/dist/session-dirs-CfIrIJxG.js +0 -318
  881. package/dist/session-dirs-DlPpWt5Q.js +0 -318
  882. package/dist/session-utils-Sd9w4vc1.js +0 -622
  883. package/dist/session-utils-iL47hYmZ.js +0 -622
  884. package/dist/sessions-6pKQ3gN3.js +0 -247
  885. package/dist/sessions-ZRmCDdj1.js +0 -2569
  886. package/dist/shell-env-DYZq9PqC.js +0 -163
  887. package/dist/ssrf-B-rF_tZB.js +0 -183
  888. package/dist/ssrf-DJW14Wkh.js +0 -183
  889. package/dist/status-BGM-EJGk.js +0 -1983
  890. package/dist/status-CGkrO9om.js +0 -1979
  891. package/dist/status.update-DlBReI5-.js +0 -449
  892. package/dist/status.update-v7fEQ7R9.js +0 -449
  893. package/dist/store-B5989JkX.js +0 -64
  894. package/dist/store-BpXxa0Uf.js +0 -53
  895. package/dist/store-DCrrxHyS.js +0 -2571
  896. package/dist/store-Ql6vAcsg.js +0 -64
  897. package/dist/subagent-registry-BGknZEUI.js +0 -4856
  898. package/dist/subagent-registry-CWeRBjfn.js +0 -4854
  899. package/dist/subsystem-Ct6qOOqZ.js +0 -1079
  900. package/dist/subsystem-PQ64_nsu.js +0 -1136
  901. package/dist/system-cli-CmO-4Rju.js +0 -77
  902. package/dist/system-cli-VBsa18K6.js +0 -73
  903. package/dist/systemd-CqFpK30Y.js +0 -547
  904. package/dist/systemd-fK9AV5bP.js +0 -547
  905. package/dist/systemd-hints-D3rr0j14.js +0 -278
  906. package/dist/systemd-hints-DNOSRaqA.js +0 -278
  907. package/dist/systemd-linger-B907NVVy.js +0 -75
  908. package/dist/systemd-linger-wYksBbM7.js +0 -75
  909. package/dist/table-C-dba-5-.js +0 -279
  910. package/dist/tables-CO_kxD0e.js +0 -55
  911. package/dist/tables-Rd6ZUH0u.js +0 -55
  912. package/dist/tables-WZp8Vt9n.js +0 -55
  913. package/dist/tailnet-CfZhpSnt.js +0 -40
  914. package/dist/tailnet-D0NV0tRJ.js +0 -40
  915. package/dist/tailscale-B__xvMjA.js +0 -230
  916. package/dist/tailscale-q_ZrxUCc.js +0 -230
  917. package/dist/targets-B4rMyQFJ.js +0 -53
  918. package/dist/targets-BEBzTa22.js +0 -114
  919. package/dist/targets-BjWhDMJM.js +0 -650
  920. package/dist/targets-BlEVuFSt.js +0 -2474
  921. package/dist/targets-CHwGDIgO.js +0 -650
  922. package/dist/targets-CbbmgMRV.js +0 -2473
  923. package/dist/targets-SpN-MPBH.js +0 -220
  924. package/dist/targets-mqj9GNg1.js +0 -53
  925. package/dist/thinking-BqJmU6Zp.js +0 -88
  926. package/dist/thinking-l-rrvZwu.js +0 -88
  927. package/dist/tokens-DAFBx5qr.js +0 -21
  928. package/dist/tool-display-C0hpLmkw.js +0 -785
  929. package/dist/tool-display-CQTRHo3Z.js +0 -785
  930. package/dist/tool-images-BYY11Gw3.js +0 -263
  931. package/dist/tool-images-CnJ0R8Fo.js +0 -263
  932. package/dist/trash-C0mjnHuW.js +0 -125
  933. package/dist/trash-Cgwc9mLD.js +0 -125
  934. package/dist/tui-9cJnR1dN.js +0 -3282
  935. package/dist/tui-BR3egaFJ.js +0 -3282
  936. package/dist/tui-cli-BYpkhE6J.js +0 -66
  937. package/dist/tui-cli-DndeZyup.js +0 -62
  938. package/dist/update-BJVdkzk7.js +0 -349
  939. package/dist/update-DjI6KTA5.js +0 -349
  940. package/dist/update-cli-DR-zFdCm.js +0 -1146
  941. package/dist/update-cli-EuHV_AUf.js +0 -1148
  942. package/dist/usage-BQUMGgBj.js +0 -5350
  943. package/dist/utils-C5daYcFn.js +0 -631
  944. package/dist/voice-credentials-CXdoE4IF.js +0 -45
  945. package/dist/voice-credentials-Cu7htUQq.js +0 -45
  946. package/dist/web-6WVkqhtO.js +0 -3087
  947. package/dist/web-BfSXKISl.js +0 -74
  948. package/dist/web-Cngqu3vs.js +0 -79
  949. package/dist/webhooks-cli-0yQha2yj.js +0 -334
  950. package/dist/webhooks-cli-ula0bTX-.js +0 -330
  951. package/dist/whatsapp-actions-3NdzsNg1.js +0 -130
  952. package/dist/whatsapp-actions-y_1vjkYY.js +0 -125
  953. package/dist/widearea-dns-C-0P7TRi.js +0 -127
  954. package/dist/workspace-BT3X-qCZ.js +0 -449
  955. package/dist/workspace-D5hHXubL.js +0 -447
  956. package/dist/zod-schema-CbqZAIYy.js +0 -2696
  957. package/dist/zod-schema-YGQJEcnj.js +0 -2696
  958. /package/dist/{account-lookup-BOCzCnir.js → account-lookup-CIY_RKhi.js} +0 -0
  959. /package/dist/{agent-helpers-eEHy5uX2.js → agent-helpers-Bs2nBXeI.js} +0 -0
  960. /package/dist/{api-Cd_7aESj.js → api-BE4ZCWWB.js} +0 -0
  961. /package/dist/{api-DJ_oWYus.js → api-wsk9zRVi.js} +0 -0
  962. /package/dist/{chat-type-DyovJwCt.js → chat-type-BP9akbag.js} +0 -0
  963. /package/dist/{chunk-CWD_zrz_.js → chunk-BAMyFYtF.js} +0 -0
  964. /package/dist/{cleanup-utils-gNzIs9yk.js → cleanup-utils-ZC2zvntc.js} +0 -0
  965. /package/dist/{cli-name-3MdfbvIR.js → cli-name-BZsYSp9l.js} +0 -0
  966. /package/dist/{cli-name-CRLBidNP.js → cli-name-CRe5Ow_t.js} +0 -0
  967. /package/dist/{cli-utils-5ZIfXAfM.js → cli-utils-CGB3cBZm.js} +0 -0
  968. /package/dist/{client-D5m46AuY.js → client-9dK56xly.js} +0 -0
  969. /package/dist/{client-DFyI5I0n.js → client-D-R1YdRD.js} +0 -0
  970. /package/dist/{command-options-Cn2fc1Of.js → command-options-CnHA4TzR.js} +0 -0
  971. /package/dist/{config-eval-BCKpAS_K.js → config-eval-BQIR-wSg.js} +0 -0
  972. /package/dist/{config-eval-CU2G7a83.js → config-eval-Bh82JoXK.js} +0 -0
  973. /package/dist/{constants-CRGAZ2ow.js → constants-C7j1VA2S.js} +0 -0
  974. /package/dist/{constants-BAZuhSRm.js → constants-PMRtHBHU.js} +0 -0
  975. /package/dist/{credentials-DMAWNZdV.js → credentials-C_RoJFmK.js} +0 -0
  976. /package/dist/{credentials-Dmc3H-jd.js → credentials-DM_Dj0m8.js} +0 -0
  977. /package/dist/{daemon-runtime-aQhinwSL.js → daemon-runtime-9oDBR7YW.js} +0 -0
  978. /package/dist/{dangerous-name-matching-BCaPvXy_.js → dangerous-name-matching-CSq9sJDG.js} +0 -0
  979. /package/dist/{dangerous-tools-E1i3IoxZ.js → dangerous-tools-D4jtl72G.js} +0 -0
  980. /package/dist/{fetch-DTR2MlOk.js → fetch-DTsU2XnC.js} +0 -0
  981. /package/dist/{fetch-timeout-l_6RdoMw.js → fetch-timeout-CytN1wiO.js} +0 -0
  982. /package/dist/{file-identity-BnGA6wyc.js → file-identity-CeRK5CJC.js} +0 -0
  983. /package/dist/{format-relative-Cywx6ldk.js → format-relative-Czf5fUjn.js} +0 -0
  984. /package/dist/{format-relative-DcQZUAYl.js → format-relative-zwkkXJvs.js} +0 -0
  985. /package/dist/{health-format-CL2Xq92A.js → health-format-DF54wvUU.js} +0 -0
  986. /package/dist/{heartbeat-wake-DjsTDzF3.js → heartbeat-wake-CvHncCjP.js} +0 -0
  987. /package/dist/{helpers-D-r6yhnI.js → helpers-DAEoFkbn.js} +0 -0
  988. /package/dist/{helpers-DSMIGYx2.js → helpers-n2CtWpm9.js} +0 -0
  989. /package/dist/{helpers-CRrn7Err.js → helpers-ndPQWl6m.js} +0 -0
  990. /package/dist/{input-provenance-BgfeDgck.js → input-provenance-gIfDn1ki.js} +0 -0
  991. /package/dist/{input-provenance-xUsSMOsz.js → input-provenance-wkso1o5V.js} +0 -0
  992. /package/dist/{ip-BAhS4rY2.js → ip-D4VG5EJO.js} +0 -0
  993. /package/dist/{ip-BUhsZdJu.js → ip-MwCwRA7c.js} +0 -0
  994. /package/dist/{json-file-Dbg7nZg1.js → json-file-BW22hGtf.js} +0 -0
  995. /package/dist/{json-file-B5WEJJye.js → json-file-DwRAfAAy.js} +0 -0
  996. /package/dist/{json-files-CfhnuGaC.js → json-files-BI20PLIm.js} +0 -0
  997. /package/dist/{json-files-BFGbyEzL.js → json-files-Dy52honG.js} +0 -0
  998. /package/dist/{lanes-4FoQemog.js → lanes-1CBKdsiR.js} +0 -0
  999. /package/dist/{lanes-BhdzrAIa.js → lanes-DqVYfPRG.js} +0 -0
  1000. /package/dist/{logger-IA_Dr_BT.js → logger-B8BE0PyS.js} +0 -0
  1001. /package/dist/{logger-nEdVxm5D.js → logger-CPvz-aPM.js} +0 -0
  1002. /package/dist/{logger-O6JX52kK.js → logger-cL0D2DCr.js} +0 -0
  1003. /package/dist/{logging-BiuZwq5D.js → logging-DRwtiLIS.js} +0 -0
  1004. /package/dist/{logging-Bs1VqVFL.js → logging-DTEoeoa3.js} +0 -0
  1005. /package/dist/{logging-JZEg5nDp.js → logging-fywhKCmE.js} +0 -0
  1006. /package/dist/{mutable-allowlist-detectors-TCG6mnbz.js → mutable-allowlist-detectors-BXE7Hr7F.js} +0 -0
  1007. /package/dist/{onboard-config-BxfgUqk6.js → onboard-config-DOmXYEvJ.js} +0 -0
  1008. /package/dist/{onboard-config-DNzlo8Cg.js → onboard-config-JmR21VYa.js} +0 -0
  1009. /package/dist/{parse-log-line-CT0H1-oQ.js → parse-log-line-GisaZn5H.js} +0 -0
  1010. /package/dist/{parse-log-line-pij_xhtE.js → parse-log-line-ZsbwG_u7.js} +0 -0
  1011. /package/dist/{parse-timeout-CvODy9RC.js → parse-timeout-BpphuwYl.js} +0 -0
  1012. /package/dist/{parse-timeout-CxYHsZWc.js → parse-timeout-CE6BjmGU.js} +0 -0
  1013. /package/dist/plugin-sdk/{media-understanding → stt}/providers/google/inline-data.d.ts +0 -0
  1014. /package/dist/{plugins-allowlist-Bcqe9Gd8.js → plugins-allowlist-A38nxBRG.js} +0 -0
  1015. /package/dist/{plugins-allowlist-ptAp-oPY.js → plugins-allowlist-D2tS9tcu.js} +0 -0
  1016. /package/dist/{polls-DQrR-qT3.js → polls-BLyT08ZI.js} +0 -0
  1017. /package/dist/{polls-ybwcqkWt.js → polls-BmymsJEe.js} +0 -0
  1018. /package/dist/{ports-BS8kQkd9.js → ports-DALdfBQy.js} +0 -0
  1019. /package/dist/{process-scoped-map-BwUkYFQV.js → process-scoped-map-BCJR56ZB.js} +0 -0
  1020. /package/dist/{process-scoped-map-_zxf_kLz.js → process-scoped-map-Cb1EHPyN.js} +0 -0
  1021. /package/dist/{program-context-CG-t6Yp-.js → program-context-DlXnmuB7.js} +0 -0
  1022. /package/dist/{prompt-style-B1740PBl.js → prompt-style-CUuA6OCy.js} +0 -0
  1023. /package/dist/{proxy-BdjLhNln.js → proxy-D-qGA1vm.js} +0 -0
  1024. /package/dist/{pw-ai-state-DaISdsXY.js → pw-ai-state--TxTVwRW.js} +0 -0
  1025. /package/dist/{redact-CqWx9rpK.js → redact-BW8tobyp.js} +0 -0
  1026. /package/dist/{redact-identifier-DR54qsoT.js → redact-identifier-Bv5SUUw-.js} +0 -0
  1027. /package/dist/{remoteclaw-root-u8dAeHID.js → remoteclaw-root-BfPjgewe.js} +0 -0
  1028. /package/dist/{remoteclaw-root-CgNyrbxc.js → remoteclaw-root-E4-hmb4E.js} +0 -0
  1029. /package/dist/{render-CDCvpfhh.js → render-BhKzKdV0.js} +0 -0
  1030. /package/dist/{render-CJl4GK1B.js → render-e7fENCYH.js} +0 -0
  1031. /package/dist/{retry-cXXk2j6_.js → retry-BWv_fy4u.js} +0 -0
  1032. /package/dist/{runtime-guard-BS55uiSW.js → runtime-guard-Bhx-pb8_.js} +0 -0
  1033. /package/dist/{runtime-status-BhW7hP_U.js → runtime-status-CR9445g5.js} +0 -0
  1034. /package/dist/{secret-equal-CJzes24Z.js → secret-equal-D6AoXne1.js} +0 -0
  1035. /package/dist/{secret-equal-CQAmGfGc.js → secret-equal-DLnUuWM3.js} +0 -0
  1036. /package/dist/{secure-random-B3f7Ri2X.js → secure-random-CJtykx_p.js} +0 -0
  1037. /package/dist/{secure-random-BkZFG9cd.js → secure-random-CRVHgtmO.js} +0 -0
  1038. /package/dist/{stagger-B-_Wnofy.js → stagger--wvODnNe.js} +0 -0
  1039. /package/dist/{stagger-B2ORDHsP.js → stagger-BLmTO4cK.js} +0 -0
  1040. /package/dist/{status-C6YNwimj.js → status-1zVD-Clq.js} +0 -0
  1041. /package/dist/{status-yrDGXYZM.js → status-BtRY0nXQ.js} +0 -0
  1042. /package/dist/{strip-inbound-meta-0cvL6itU.js → strip-inbound-meta-zmUXypSS.js} +0 -0
  1043. /package/dist/{strip-inbound-meta-DjKcSFaW.js → strip-inbound-meta-zqtN9FTK.js} +0 -0
  1044. /package/dist/{table-ByMyHTh_.js → table-On3hkCqi.js} +0 -0
  1045. /package/dist/{targets-DOJXjN1U.js → targets-B46m7u5J.js} +0 -0
  1046. /package/dist/{targets-WSwPflb6.js → targets-D7PT_rdO.js} +0 -0
  1047. /package/dist/{text-format-mr5bZq0f.js → text-format-Ds92M9UT.js} +0 -0
  1048. /package/dist/{tokens-C8yGxAcR.js → tokens-Dw7ZdYwT.js} +0 -0
  1049. /package/dist/{usage-BXi79Rq6.js → usage-BIzKZ5dT.js} +0 -0
  1050. /package/dist/{usage-C1lHaofV.js → usage-BvZOzIC7.js} +0 -0
  1051. /package/dist/{usage-format-CD5jsZY1.js → usage-format-CmniSPCG.js} +0 -0
  1052. /package/dist/{usage-format-CRVpDVj1.js → usage-format-D_KQYQ-w.js} +0 -0
  1053. /package/dist/{widearea-dns-DFZMcfLf.js → widearea-dns-D01FFYZ8.js} +0 -0
  1054. /package/dist/{wsl-D28w2jQC.js → wsl-PDLKeX04.js} +0 -0
@@ -1,3150 +0,0 @@
1
- import { h as resolveStateDir, m as resolveOAuthDir, o as resolveConfigPath } from "./paths-BTaH3rLn.js";
2
- import { l as resolveAgentIdFromSessionKey, s as normalizeAgentId, w as resolveThreadParentSessionKey } from "./session-key-CgKWfjoZ.js";
3
- import { c as resolveDefaultAgentId, i as resolveAgentConfig } from "./agent-scope-_ND_-bJy.js";
4
- import { c as normalizeMessageChannel, f as GATEWAY_CLIENT_MODES, p as GATEWAY_CLIENT_NAMES } from "./message-channel-FMNRI5Ax.js";
5
- import { G as extensionUsesSkippedScannerPath, K as isPathInside, O as MANIFEST_KEY, U as INCLUDE_KEY, W as MAX_INCLUDE_DEPTH, Y as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, j as normalizePluginsConfig, r as createConfigIO } from "./config-CAa0rZSx.js";
6
- import { o as normalizeStringEntries, t as getChannelDock, u as resolveChannelGroupToolsPolicy } from "./dock-Big-J2VN.js";
7
- import { n as runExec } from "./exec-Zz6eJ6YU.js";
8
- import { n as formatErrorMessage } from "./errors-CdmXrBic.js";
9
- import { t as formatCliCommand } from "./command-format-D0vKipG9.js";
10
- import { n as listChannelPlugins } from "./plugins-BRHOfy1Z.js";
11
- import { i as resolveNativeCommandsEnabled } from "./commands-D842kCjj.js";
12
- import { i as readChannelAllowFromStore } from "./pairing-store-DykkYpQ7.js";
13
- import { t as GatewayClient } from "./client-B9u3JdT_.js";
14
- import { c as READ_SCOPE, t as buildGatewayConnectionDetails } from "./call-BrTmlOx3.js";
15
- import { t as resolveGatewayCredentialsFromConfig } from "./credentials-DMAWNZdV.js";
16
- import { n as isDangerousNameMatchingEnabled } from "./dangerous-name-matching-BlTBBZns.js";
17
- import { n as resolveBrowserControlAuth, o as resolveBrowserConfig, s as resolveProfile } from "./control-auth-CehjYKnL.js";
18
- import { a as resolveGatewayAuth } from "./auth-DGqCLaQq.js";
19
- import { n as DEFAULT_GATEWAY_HTTP_TOOL_DENY, r as CORE_TOOL_GROUPS, s as resolveCoreToolProfilePolicy } from "./dangerous-tools-E1i3IoxZ.js";
20
- import { t as resolveChannelDefaultAccountId } from "./helpers-D-r6yhnI.js";
21
- import { c as normalizeTelegramAllowFromEntry, s as isNumericTelegramUserId, t as isDiscordMutableAllowEntry } from "./mutable-allowlist-detectors-CtKavajp.js";
22
- import { t as resolveDmAllowState } from "./dm-policy-shared-CRQ-Wr5g.js";
23
- import os from "node:os";
24
- import path from "node:path";
25
- import JSON5 from "json5";
26
- import * as fs$1 from "node:fs/promises";
27
- import fs from "node:fs/promises";
28
- import { randomUUID } from "node:crypto";
29
- import { isIP } from "node:net";
30
-
31
- //#region src/gateway/probe.ts
32
- async function probeGateway(opts) {
33
- const startedAt = Date.now();
34
- const instanceId = randomUUID();
35
- let connectLatencyMs = null;
36
- let connectError = null;
37
- let close = null;
38
- return await new Promise((resolve) => {
39
- let settled = false;
40
- const settle = (result) => {
41
- if (settled) return;
42
- settled = true;
43
- clearTimeout(timer);
44
- client.stop();
45
- resolve({
46
- url: opts.url,
47
- ...result
48
- });
49
- };
50
- const client = new GatewayClient({
51
- url: opts.url,
52
- token: opts.auth?.token,
53
- password: opts.auth?.password,
54
- scopes: [READ_SCOPE],
55
- clientName: GATEWAY_CLIENT_NAMES.CLI,
56
- clientVersion: "dev",
57
- mode: GATEWAY_CLIENT_MODES.PROBE,
58
- instanceId,
59
- onConnectError: (err) => {
60
- connectError = formatErrorMessage(err);
61
- },
62
- onClose: (code, reason) => {
63
- close = {
64
- code,
65
- reason
66
- };
67
- },
68
- onHelloOk: async () => {
69
- connectLatencyMs = Date.now() - startedAt;
70
- try {
71
- const [health, status, presence, configSnapshot] = await Promise.all([
72
- client.request("health"),
73
- client.request("status"),
74
- client.request("system-presence"),
75
- client.request("config.get", {})
76
- ]);
77
- settle({
78
- ok: true,
79
- connectLatencyMs,
80
- error: null,
81
- close,
82
- health,
83
- status,
84
- presence: Array.isArray(presence) ? presence : null,
85
- configSnapshot
86
- });
87
- } catch (err) {
88
- settle({
89
- ok: false,
90
- connectLatencyMs,
91
- error: formatErrorMessage(err),
92
- close,
93
- health: null,
94
- status: null,
95
- presence: null,
96
- configSnapshot: null
97
- });
98
- }
99
- }
100
- });
101
- const timer = setTimeout(() => {
102
- settle({
103
- ok: false,
104
- connectLatencyMs,
105
- error: connectError ? `connect failed: ${connectError}` : "timeout",
106
- close,
107
- health: null,
108
- status: null,
109
- presence: null,
110
- configSnapshot: null
111
- });
112
- }, Math.max(250, opts.timeoutMs));
113
- client.start();
114
- });
115
- }
116
-
117
- //#endregion
118
- //#region src/gateway/node-command-policy.ts
119
- const CANVAS_COMMANDS = [
120
- "canvas.present",
121
- "canvas.hide",
122
- "canvas.navigate",
123
- "canvas.eval",
124
- "canvas.snapshot",
125
- "canvas.a2ui.push",
126
- "canvas.a2ui.pushJSONL",
127
- "canvas.a2ui.reset"
128
- ];
129
- const CAMERA_COMMANDS = ["camera.list"];
130
- const CAMERA_DANGEROUS_COMMANDS = ["camera.snap", "camera.clip"];
131
- const SCREEN_DANGEROUS_COMMANDS = ["screen.record"];
132
- const LOCATION_COMMANDS = ["location.get"];
133
- const DEVICE_COMMANDS = ["device.info", "device.status"];
134
- const CONTACTS_COMMANDS = ["contacts.search"];
135
- const CONTACTS_DANGEROUS_COMMANDS = ["contacts.add"];
136
- const CALENDAR_COMMANDS = ["calendar.events"];
137
- const CALENDAR_DANGEROUS_COMMANDS = ["calendar.add"];
138
- const REMINDERS_COMMANDS = ["reminders.list"];
139
- const REMINDERS_DANGEROUS_COMMANDS = ["reminders.add"];
140
- const PHOTOS_COMMANDS = ["photos.latest"];
141
- const MOTION_COMMANDS = ["motion.activity", "motion.pedometer"];
142
- const SMS_DANGEROUS_COMMANDS = ["sms.send"];
143
- const IOS_SYSTEM_COMMANDS = ["system.notify"];
144
- const SYSTEM_COMMANDS = [
145
- "system.run",
146
- "system.which",
147
- "system.notify",
148
- "browser.proxy"
149
- ];
150
- const DEFAULT_DANGEROUS_NODE_COMMANDS = [
151
- ...CAMERA_DANGEROUS_COMMANDS,
152
- ...SCREEN_DANGEROUS_COMMANDS,
153
- ...CONTACTS_DANGEROUS_COMMANDS,
154
- ...CALENDAR_DANGEROUS_COMMANDS,
155
- ...REMINDERS_DANGEROUS_COMMANDS,
156
- ...SMS_DANGEROUS_COMMANDS
157
- ];
158
- const PLATFORM_DEFAULTS = {
159
- ios: [
160
- ...CANVAS_COMMANDS,
161
- ...CAMERA_COMMANDS,
162
- ...LOCATION_COMMANDS,
163
- ...DEVICE_COMMANDS,
164
- ...CONTACTS_COMMANDS,
165
- ...CALENDAR_COMMANDS,
166
- ...REMINDERS_COMMANDS,
167
- ...PHOTOS_COMMANDS,
168
- ...MOTION_COMMANDS,
169
- ...IOS_SYSTEM_COMMANDS
170
- ],
171
- android: [
172
- ...CANVAS_COMMANDS,
173
- ...CAMERA_COMMANDS,
174
- ...LOCATION_COMMANDS,
175
- ...DEVICE_COMMANDS,
176
- ...CONTACTS_COMMANDS,
177
- ...CALENDAR_COMMANDS,
178
- ...REMINDERS_COMMANDS,
179
- ...PHOTOS_COMMANDS,
180
- ...MOTION_COMMANDS
181
- ],
182
- macos: [
183
- ...CANVAS_COMMANDS,
184
- ...CAMERA_COMMANDS,
185
- ...LOCATION_COMMANDS,
186
- ...DEVICE_COMMANDS,
187
- ...CONTACTS_COMMANDS,
188
- ...CALENDAR_COMMANDS,
189
- ...REMINDERS_COMMANDS,
190
- ...PHOTOS_COMMANDS,
191
- ...MOTION_COMMANDS,
192
- ...SYSTEM_COMMANDS
193
- ],
194
- linux: [...SYSTEM_COMMANDS],
195
- windows: [...SYSTEM_COMMANDS],
196
- unknown: [
197
- ...CANVAS_COMMANDS,
198
- ...CAMERA_COMMANDS,
199
- ...LOCATION_COMMANDS,
200
- ...SYSTEM_COMMANDS
201
- ]
202
- };
203
- function normalizePlatformId(platform, deviceFamily) {
204
- const raw = (platform ?? "").trim().toLowerCase();
205
- if (raw.startsWith("ios")) return "ios";
206
- if (raw.startsWith("android")) return "android";
207
- if (raw.startsWith("mac")) return "macos";
208
- if (raw.startsWith("darwin")) return "macos";
209
- if (raw.startsWith("win")) return "windows";
210
- if (raw.startsWith("linux")) return "linux";
211
- const family = (deviceFamily ?? "").trim().toLowerCase();
212
- if (family.includes("iphone") || family.includes("ipad") || family.includes("ios")) return "ios";
213
- if (family.includes("android")) return "android";
214
- if (family.includes("mac")) return "macos";
215
- if (family.includes("windows")) return "windows";
216
- if (family.includes("linux")) return "linux";
217
- return "unknown";
218
- }
219
- function resolveNodeCommandAllowlist(cfg, node) {
220
- const base = PLATFORM_DEFAULTS[normalizePlatformId(node?.platform, node?.deviceFamily)] ?? PLATFORM_DEFAULTS.unknown;
221
- const extra = cfg.gateway?.nodes?.allowCommands ?? [];
222
- const deny = new Set(cfg.gateway?.nodes?.denyCommands ?? []);
223
- const allow = new Set([...base, ...extra].map((cmd) => cmd.trim()).filter(Boolean));
224
- for (const blocked of deny) {
225
- const trimmed = blocked.trim();
226
- if (trimmed) allow.delete(trimmed);
227
- }
228
- return allow;
229
- }
230
- function isNodeCommandAllowed(params) {
231
- const command = params.command.trim();
232
- if (!command) return {
233
- ok: false,
234
- reason: "command required"
235
- };
236
- if (!params.allowlist.has(command)) return {
237
- ok: false,
238
- reason: "command not allowlisted"
239
- };
240
- if (Array.isArray(params.declaredCommands) && params.declaredCommands.length > 0) {
241
- if (!params.declaredCommands.includes(command)) return {
242
- ok: false,
243
- reason: "command not declared by node"
244
- };
245
- } else return {
246
- ok: false,
247
- reason: "node did not declare commands"
248
- };
249
- return { ok: true };
250
- }
251
-
252
- //#endregion
253
- //#region src/gateway/probe-auth.ts
254
- function resolveGatewayProbeAuth(params) {
255
- return resolveGatewayCredentialsFromConfig({
256
- cfg: params.cfg,
257
- env: params.env,
258
- modeOverride: params.mode,
259
- includeLegacyEnv: false,
260
- remoteTokenFallback: "remote-only"
261
- });
262
- }
263
-
264
- //#endregion
265
- //#region src/security/audit-channel.ts
266
- function normalizeAllowFromList$1(list) {
267
- return normalizeStringEntries(Array.isArray(list) ? list : void 0);
268
- }
269
- function addDiscordNameBasedEntries(params) {
270
- if (!Array.isArray(params.values)) return;
271
- for (const value of params.values) {
272
- if (!isDiscordMutableAllowEntry(String(value))) continue;
273
- const text = String(value).trim();
274
- if (!text) continue;
275
- params.target.add(`${params.source}:${text}`);
276
- }
277
- }
278
- function classifyChannelWarningSeverity(message) {
279
- const s = message.toLowerCase();
280
- if (s.includes("dms: open") || s.includes("grouppolicy=\"open\"") || s.includes("dmpolicy=\"open\"")) return "critical";
281
- if (s.includes("allows any") || s.includes("anyone can dm") || s.includes("public")) return "critical";
282
- if (s.includes("locked") || s.includes("disabled")) return "info";
283
- return "warn";
284
- }
285
- function dedupeFindings(findings) {
286
- const seen = /* @__PURE__ */ new Set();
287
- const out = [];
288
- for (const finding of findings) {
289
- const key = [
290
- finding.checkId,
291
- finding.severity,
292
- finding.title,
293
- finding.detail ?? "",
294
- finding.remediation ?? ""
295
- ].join("\n");
296
- if (seen.has(key)) continue;
297
- seen.add(key);
298
- out.push(finding);
299
- }
300
- return out;
301
- }
302
- function hasExplicitProviderAccountConfig(cfg, provider, accountId) {
303
- const channel = cfg.channels?.[provider];
304
- if (!channel || typeof channel !== "object") return false;
305
- const accounts = channel.accounts;
306
- if (!accounts || typeof accounts !== "object") return false;
307
- return accountId in accounts;
308
- }
309
- async function collectChannelSecurityFindings(params) {
310
- const findings = [];
311
- const coerceNativeSetting = (value) => {
312
- if (value === true) return true;
313
- if (value === false) return false;
314
- if (value === "auto") return "auto";
315
- };
316
- const warnDmPolicy = async (input) => {
317
- const policyPath = input.policyPath ?? `${input.allowFromPath}policy`;
318
- const { hasWildcard, isMultiUserDm } = await resolveDmAllowState({
319
- provider: input.provider,
320
- allowFrom: input.allowFrom,
321
- normalizeEntry: input.normalizeEntry
322
- });
323
- const dmScope = params.cfg.session?.dmScope ?? "main";
324
- if (input.dmPolicy === "open") {
325
- const allowFromKey = `${input.allowFromPath}allowFrom`;
326
- findings.push({
327
- checkId: `channels.${input.provider}.dm.open`,
328
- severity: "critical",
329
- title: `${input.label} DMs are open`,
330
- detail: `${policyPath}="open" allows anyone to DM the bot.`,
331
- remediation: `Use pairing/allowlist; if you really need open DMs, ensure ${allowFromKey} includes "*".`
332
- });
333
- if (!hasWildcard) findings.push({
334
- checkId: `channels.${input.provider}.dm.open_invalid`,
335
- severity: "warn",
336
- title: `${input.label} DM config looks inconsistent`,
337
- detail: `"open" requires ${allowFromKey} to include "*".`
338
- });
339
- }
340
- if (input.dmPolicy === "disabled") {
341
- findings.push({
342
- checkId: `channels.${input.provider}.dm.disabled`,
343
- severity: "info",
344
- title: `${input.label} DMs are disabled`,
345
- detail: `${policyPath}="disabled" ignores inbound DMs.`
346
- });
347
- return;
348
- }
349
- if (dmScope === "main" && isMultiUserDm) findings.push({
350
- checkId: `channels.${input.provider}.dm.scope_main_multiuser`,
351
- severity: "warn",
352
- title: `${input.label} DMs share the main session`,
353
- detail: "Multiple DM senders currently share the main session, which can leak context across users.",
354
- remediation: "Run: " + formatCliCommand("remoteclaw config set session.dmScope \"per-channel-peer\"") + " (or \"per-account-channel-peer\" for multi-account channels) to isolate DM sessions per sender."
355
- });
356
- };
357
- for (const plugin of params.plugins) {
358
- if (!plugin.security) continue;
359
- const accountIds = plugin.config.listAccountIds(params.cfg);
360
- const defaultAccountId = resolveChannelDefaultAccountId({
361
- plugin,
362
- cfg: params.cfg,
363
- accountIds
364
- });
365
- const orderedAccountIds = Array.from(new Set([defaultAccountId, ...accountIds]));
366
- for (const accountId of orderedAccountIds) {
367
- const hasExplicitAccountPath = hasExplicitProviderAccountConfig(params.cfg, plugin.id, accountId);
368
- const account = plugin.config.resolveAccount(params.cfg, accountId);
369
- if (!(plugin.config.isEnabled ? plugin.config.isEnabled(account, params.cfg) : true)) continue;
370
- if (!(plugin.config.isConfigured ? await plugin.config.isConfigured(account, params.cfg) : true)) continue;
371
- const accountConfig = account?.config;
372
- if (isDangerousNameMatchingEnabled(accountConfig)) {
373
- const accountNote = orderedAccountIds.length > 1 || hasExplicitAccountPath ? ` (account: ${accountId})` : "";
374
- findings.push({
375
- checkId: `channels.${plugin.id}.allowFrom.dangerous_name_matching_enabled`,
376
- severity: "info",
377
- title: `${plugin.meta.label ?? plugin.id} dangerous name matching is enabled${accountNote}`,
378
- detail: "dangerouslyAllowNameMatching=true re-enables mutable name/email/tag matching for sender authorization. This is a break-glass compatibility mode, not a hardened default.",
379
- remediation: "Prefer stable sender IDs in allowlists, then disable dangerouslyAllowNameMatching."
380
- });
381
- }
382
- if (plugin.id === "discord") {
383
- const discordCfg = account?.config ?? {};
384
- const dangerousNameMatchingEnabled = isDangerousNameMatchingEnabled(discordCfg);
385
- const storeAllowFrom = await readChannelAllowFromStore("discord").catch(() => []);
386
- const discordNameBasedAllowEntries = /* @__PURE__ */ new Set();
387
- const discordPathPrefix = orderedAccountIds.length > 1 || hasExplicitAccountPath ? `channels.discord.accounts.${accountId}` : "channels.discord";
388
- addDiscordNameBasedEntries({
389
- target: discordNameBasedAllowEntries,
390
- values: discordCfg.allowFrom,
391
- source: `${discordPathPrefix}.allowFrom`
392
- });
393
- addDiscordNameBasedEntries({
394
- target: discordNameBasedAllowEntries,
395
- values: discordCfg.dm?.allowFrom,
396
- source: `${discordPathPrefix}.dm.allowFrom`
397
- });
398
- addDiscordNameBasedEntries({
399
- target: discordNameBasedAllowEntries,
400
- values: storeAllowFrom,
401
- source: "~/.remoteclaw/credentials/discord-allowFrom.json"
402
- });
403
- const discordGuildEntries = discordCfg.guilds ?? {};
404
- for (const [guildKey, guildValue] of Object.entries(discordGuildEntries)) {
405
- if (!guildValue || typeof guildValue !== "object") continue;
406
- const guild = guildValue;
407
- addDiscordNameBasedEntries({
408
- target: discordNameBasedAllowEntries,
409
- values: guild.users,
410
- source: `${discordPathPrefix}.guilds.${guildKey}.users`
411
- });
412
- const channels = guild.channels;
413
- if (!channels || typeof channels !== "object") continue;
414
- for (const [channelKey, channelValue] of Object.entries(channels)) {
415
- if (!channelValue || typeof channelValue !== "object") continue;
416
- addDiscordNameBasedEntries({
417
- target: discordNameBasedAllowEntries,
418
- values: channelValue.users,
419
- source: `${discordPathPrefix}.guilds.${guildKey}.channels.${channelKey}.users`
420
- });
421
- }
422
- }
423
- if (discordNameBasedAllowEntries.size > 0) {
424
- const examples = Array.from(discordNameBasedAllowEntries).slice(0, 5);
425
- const more = discordNameBasedAllowEntries.size > examples.length ? ` (+${discordNameBasedAllowEntries.size - examples.length} more)` : "";
426
- findings.push({
427
- checkId: "channels.discord.allowFrom.name_based_entries",
428
- severity: dangerousNameMatchingEnabled ? "info" : "warn",
429
- title: dangerousNameMatchingEnabled ? "Discord allowlist uses break-glass name/tag matching" : "Discord allowlist contains name or tag entries",
430
- detail: dangerousNameMatchingEnabled ? `Discord name/tag allowlist matching is explicitly enabled via dangerouslyAllowNameMatching. This mutable-identity mode is operator-selected break-glass behavior and out-of-scope for vulnerability reports by itself. Found: ${examples.join(", ")}${more}.` : `Discord name/tag allowlist matching uses normalized slugs and can collide across users. Found: ${examples.join(", ")}${more}.`,
431
- remediation: dangerousNameMatchingEnabled ? "Prefer stable Discord IDs (or <@id>/user:<id>/pk:<id>), then disable dangerouslyAllowNameMatching." : "Prefer stable Discord IDs (or <@id>/user:<id>/pk:<id>) in channels.discord.allowFrom and channels.discord.guilds.*.users, or explicitly opt in with dangerouslyAllowNameMatching=true if you accept the risk."
432
- });
433
- }
434
- if (resolveNativeCommandsEnabled({
435
- providerId: "discord",
436
- providerSetting: coerceNativeSetting(discordCfg.commands?.native),
437
- globalSetting: params.cfg.commands?.native
438
- })) {
439
- const defaultGroupPolicy = params.cfg.channels?.defaults?.groupPolicy;
440
- const groupPolicy = discordCfg.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
441
- const guildEntries = discordGuildEntries;
442
- const guildsConfigured = Object.keys(guildEntries).length > 0;
443
- const hasAnyUserAllowlist = Object.values(guildEntries).some((guild) => {
444
- if (!guild || typeof guild !== "object") return false;
445
- const g = guild;
446
- if (Array.isArray(g.users) && g.users.length > 0) return true;
447
- const channels = g.channels;
448
- if (!channels || typeof channels !== "object") return false;
449
- return Object.values(channels).some((channel) => {
450
- if (!channel || typeof channel !== "object") return false;
451
- const c = channel;
452
- return Array.isArray(c.users) && c.users.length > 0;
453
- });
454
- });
455
- const dmAllowFromRaw = discordCfg.dm?.allowFrom;
456
- const ownerAllowFromConfigured = normalizeAllowFromList$1([...Array.isArray(dmAllowFromRaw) ? dmAllowFromRaw : [], ...storeAllowFrom]).length > 0;
457
- const useAccessGroups = params.cfg.commands?.useAccessGroups !== false;
458
- if (!useAccessGroups && groupPolicy !== "disabled" && guildsConfigured && !hasAnyUserAllowlist) findings.push({
459
- checkId: "channels.discord.commands.native.unrestricted",
460
- severity: "critical",
461
- title: "Discord slash commands are unrestricted",
462
- detail: "commands.useAccessGroups=false disables sender allowlists for Discord slash commands unless a per-guild/channel users allowlist is configured; with no users allowlist, any user in allowed guild channels can invoke /… commands.",
463
- remediation: "Set commands.useAccessGroups=true (recommended), or configure channels.discord.guilds.<id>.users (or channels.discord.guilds.<id>.channels.<channel>.users)."
464
- });
465
- else if (useAccessGroups && groupPolicy !== "disabled" && guildsConfigured && !ownerAllowFromConfigured && !hasAnyUserAllowlist) findings.push({
466
- checkId: "channels.discord.commands.native.no_allowlists",
467
- severity: "warn",
468
- title: "Discord slash commands have no allowlists",
469
- detail: "Discord slash commands are enabled, but neither an owner allowFrom list nor any per-guild/channel users allowlist is configured; /… commands will be rejected for everyone.",
470
- remediation: "Add your user id to channels.discord.allowFrom (or approve yourself via pairing), or configure channels.discord.guilds.<id>.users."
471
- });
472
- }
473
- }
474
- if (plugin.id === "slack") {
475
- const slackCfg = account?.config ?? {};
476
- if (resolveNativeCommandsEnabled({
477
- providerId: "slack",
478
- providerSetting: coerceNativeSetting(slackCfg.commands?.native),
479
- globalSetting: params.cfg.commands?.native
480
- }) || slackCfg.slashCommand?.enabled === true) if (!(params.cfg.commands?.useAccessGroups !== false)) findings.push({
481
- checkId: "channels.slack.commands.slash.useAccessGroups_off",
482
- severity: "critical",
483
- title: "Slack slash commands bypass access groups",
484
- detail: "Slack slash/native commands are enabled while commands.useAccessGroups=false; this can allow unrestricted /… command execution from channels/users you didn't explicitly authorize.",
485
- remediation: "Set commands.useAccessGroups=true (recommended)."
486
- });
487
- else {
488
- const allowFromRaw = account?.config?.allowFrom;
489
- const legacyAllowFromRaw = account?.dm?.allowFrom;
490
- const allowFrom = Array.isArray(allowFromRaw) ? allowFromRaw : Array.isArray(legacyAllowFromRaw) ? legacyAllowFromRaw : [];
491
- const storeAllowFrom = await readChannelAllowFromStore("slack").catch(() => []);
492
- const ownerAllowFromConfigured = normalizeAllowFromList$1([...allowFrom, ...storeAllowFrom]).length > 0;
493
- const channels = slackCfg.channels ?? {};
494
- const hasAnyChannelUsersAllowlist = Object.values(channels).some((value) => {
495
- if (!value || typeof value !== "object") return false;
496
- const channel = value;
497
- return Array.isArray(channel.users) && channel.users.length > 0;
498
- });
499
- if (!ownerAllowFromConfigured && !hasAnyChannelUsersAllowlist) findings.push({
500
- checkId: "channels.slack.commands.slash.no_allowlists",
501
- severity: "warn",
502
- title: "Slack slash commands have no allowlists",
503
- detail: "Slack slash/native commands are enabled, but neither an owner allowFrom list nor any channels.<id>.users allowlist is configured; /… commands will be rejected for everyone.",
504
- remediation: "Approve yourself via pairing (recommended), or set channels.slack.allowFrom and/or channels.slack.channels.<id>.users."
505
- });
506
- }
507
- }
508
- const dmPolicy = plugin.security.resolveDmPolicy?.({
509
- cfg: params.cfg,
510
- accountId,
511
- account
512
- });
513
- if (dmPolicy) await warnDmPolicy({
514
- label: plugin.meta.label ?? plugin.id,
515
- provider: plugin.id,
516
- dmPolicy: dmPolicy.policy,
517
- allowFrom: dmPolicy.allowFrom,
518
- policyPath: dmPolicy.policyPath,
519
- allowFromPath: dmPolicy.allowFromPath,
520
- normalizeEntry: dmPolicy.normalizeEntry
521
- });
522
- if (plugin.security.collectWarnings) {
523
- const warnings = await plugin.security.collectWarnings({
524
- cfg: params.cfg,
525
- accountId,
526
- account
527
- });
528
- for (const message of warnings ?? []) {
529
- const trimmed = String(message).trim();
530
- if (!trimmed) continue;
531
- findings.push({
532
- checkId: `channels.${plugin.id}.warning.${findings.length + 1}`,
533
- severity: classifyChannelWarningSeverity(trimmed),
534
- title: `${plugin.meta.label ?? plugin.id} security warning`,
535
- detail: trimmed.replace(/^-\s*/, "")
536
- });
537
- }
538
- }
539
- if (plugin.id !== "telegram") continue;
540
- if (!(params.cfg.commands?.text !== false)) continue;
541
- const telegramCfg = account?.config ?? {};
542
- const defaultGroupPolicy = params.cfg.channels?.defaults?.groupPolicy;
543
- const groupPolicy = telegramCfg.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
544
- const groups = telegramCfg.groups;
545
- const groupsConfigured = Boolean(groups) && Object.keys(groups ?? {}).length > 0;
546
- if (!(groupPolicy === "open" || groupPolicy === "allowlist" && groupsConfigured)) continue;
547
- const storeAllowFrom = await readChannelAllowFromStore("telegram").catch(() => []);
548
- const storeHasWildcard = storeAllowFrom.some((v) => String(v).trim() === "*");
549
- const invalidTelegramAllowFromEntries = /* @__PURE__ */ new Set();
550
- for (const entry of storeAllowFrom) {
551
- const normalized = normalizeTelegramAllowFromEntry(entry);
552
- if (!normalized || normalized === "*") continue;
553
- if (!isNumericTelegramUserId(normalized)) invalidTelegramAllowFromEntries.add(normalized);
554
- }
555
- const groupAllowFrom = Array.isArray(telegramCfg.groupAllowFrom) ? telegramCfg.groupAllowFrom : [];
556
- const groupAllowFromHasWildcard = groupAllowFrom.some((v) => String(v).trim() === "*");
557
- for (const entry of groupAllowFrom) {
558
- const normalized = normalizeTelegramAllowFromEntry(entry);
559
- if (!normalized || normalized === "*") continue;
560
- if (!isNumericTelegramUserId(normalized)) invalidTelegramAllowFromEntries.add(normalized);
561
- }
562
- const dmAllowFrom = Array.isArray(telegramCfg.allowFrom) ? telegramCfg.allowFrom : [];
563
- for (const entry of dmAllowFrom) {
564
- const normalized = normalizeTelegramAllowFromEntry(entry);
565
- if (!normalized || normalized === "*") continue;
566
- if (!isNumericTelegramUserId(normalized)) invalidTelegramAllowFromEntries.add(normalized);
567
- }
568
- const anyGroupOverride = Boolean(groups && Object.values(groups).some((value) => {
569
- if (!value || typeof value !== "object") return false;
570
- const group = value;
571
- const allowFrom = Array.isArray(group.allowFrom) ? group.allowFrom : [];
572
- if (allowFrom.length > 0) {
573
- for (const entry of allowFrom) {
574
- const normalized = normalizeTelegramAllowFromEntry(entry);
575
- if (!normalized || normalized === "*") continue;
576
- if (!isNumericTelegramUserId(normalized)) invalidTelegramAllowFromEntries.add(normalized);
577
- }
578
- return true;
579
- }
580
- const topics = group.topics;
581
- if (!topics || typeof topics !== "object") return false;
582
- return Object.values(topics).some((topicValue) => {
583
- if (!topicValue || typeof topicValue !== "object") return false;
584
- const topic = topicValue;
585
- const topicAllow = Array.isArray(topic.allowFrom) ? topic.allowFrom : [];
586
- for (const entry of topicAllow) {
587
- const normalized = normalizeTelegramAllowFromEntry(entry);
588
- if (!normalized || normalized === "*") continue;
589
- if (!isNumericTelegramUserId(normalized)) invalidTelegramAllowFromEntries.add(normalized);
590
- }
591
- return topicAllow.length > 0;
592
- });
593
- }));
594
- const hasAnySenderAllowlist = storeAllowFrom.length > 0 || groupAllowFrom.length > 0 || anyGroupOverride;
595
- if (invalidTelegramAllowFromEntries.size > 0) {
596
- const examples = Array.from(invalidTelegramAllowFromEntries).slice(0, 5);
597
- const more = invalidTelegramAllowFromEntries.size > examples.length ? ` (+${invalidTelegramAllowFromEntries.size - examples.length} more)` : "";
598
- findings.push({
599
- checkId: "channels.telegram.allowFrom.invalid_entries",
600
- severity: "warn",
601
- title: "Telegram allowlist contains non-numeric entries",
602
- detail: `Telegram sender authorization requires numeric Telegram user IDs. Found non-numeric allowFrom entries: ${examples.join(", ")}${more}.`,
603
- remediation: "Replace @username entries with numeric Telegram user IDs (use onboarding to resolve), then re-run the audit."
604
- });
605
- }
606
- if (storeHasWildcard || groupAllowFromHasWildcard) {
607
- findings.push({
608
- checkId: "channels.telegram.groups.allowFrom.wildcard",
609
- severity: "critical",
610
- title: "Telegram group allowlist contains wildcard",
611
- detail: "Telegram group sender allowlist contains \"*\", which allows any group member to run /… commands and control directives.",
612
- remediation: "Remove \"*\" from channels.telegram.groupAllowFrom and pairing store; prefer explicit numeric Telegram user IDs."
613
- });
614
- continue;
615
- }
616
- if (!hasAnySenderAllowlist) findings.push({
617
- checkId: "channels.telegram.groups.allowFrom.missing",
618
- severity: "critical",
619
- title: "Telegram group commands have no sender allowlist",
620
- detail: "Telegram group access is enabled but no sender allowlist is configured; this allows any group member to invoke /… commands.",
621
- remediation: "Approve yourself via pairing (recommended), or set channels.telegram.groupAllowFrom (or per-group groups.<id>.allowFrom)."
622
- });
623
- }
624
- }
625
- return dedupeFindings(findings);
626
- }
627
-
628
- //#endregion
629
- //#region src/agents/glob-pattern.ts
630
- function escapeRegex(value) {
631
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
632
- }
633
- function compileGlobPattern(params) {
634
- const normalized = params.normalize(params.raw);
635
- if (!normalized) return {
636
- kind: "exact",
637
- value: ""
638
- };
639
- if (normalized === "*") return { kind: "all" };
640
- if (!normalized.includes("*")) return {
641
- kind: "exact",
642
- value: normalized
643
- };
644
- return {
645
- kind: "regex",
646
- value: new RegExp(`^${escapeRegex(normalized).replaceAll("\\*", ".*")}$`)
647
- };
648
- }
649
- function compileGlobPatterns(params) {
650
- if (!Array.isArray(params.raw)) return [];
651
- return params.raw.map((raw) => compileGlobPattern({
652
- raw,
653
- normalize: params.normalize
654
- })).filter((pattern) => pattern.kind !== "exact" || pattern.value);
655
- }
656
- function matchesAnyGlobPattern(value, patterns) {
657
- for (const pattern of patterns) {
658
- if (pattern.kind === "all") return true;
659
- if (pattern.kind === "exact" && value === pattern.value) return true;
660
- if (pattern.kind === "regex" && pattern.value.test(value)) return true;
661
- }
662
- return false;
663
- }
664
-
665
- //#endregion
666
- //#region src/agents/tool-policy-shared.ts
667
- const TOOL_NAME_ALIASES = {};
668
- const TOOL_GROUPS = { ...CORE_TOOL_GROUPS };
669
- function normalizeToolName(name) {
670
- const normalized = name.trim().toLowerCase();
671
- return TOOL_NAME_ALIASES[normalized] ?? normalized;
672
- }
673
- function normalizeToolList(list) {
674
- if (!list) return [];
675
- return list.map(normalizeToolName).filter(Boolean);
676
- }
677
- function expandToolGroups(list) {
678
- const normalized = normalizeToolList(list);
679
- const expanded = [];
680
- for (const value of normalized) {
681
- const group = TOOL_GROUPS[value];
682
- if (group) {
683
- expanded.push(...group);
684
- continue;
685
- }
686
- expanded.push(value);
687
- }
688
- return Array.from(new Set(expanded));
689
- }
690
- function resolveToolProfilePolicy(profile) {
691
- return resolveCoreToolProfilePolicy(profile);
692
- }
693
-
694
- //#endregion
695
- //#region src/agents/tool-policy.ts
696
- function collectExplicitAllowlist(policies) {
697
- const entries = [];
698
- for (const policy of policies) {
699
- if (!policy?.allow) continue;
700
- for (const value of policy.allow) {
701
- if (typeof value !== "string") continue;
702
- const trimmed = value.trim();
703
- if (trimmed) entries.push(trimmed);
704
- }
705
- }
706
- return entries;
707
- }
708
- function buildPluginToolGroups(params) {
709
- const all = [];
710
- const byPlugin = /* @__PURE__ */ new Map();
711
- for (const tool of params.tools) {
712
- const meta = params.toolMeta(tool);
713
- if (!meta) continue;
714
- const name = normalizeToolName(tool.name);
715
- all.push(name);
716
- const pluginId = meta.pluginId.toLowerCase();
717
- const list = byPlugin.get(pluginId) ?? [];
718
- list.push(name);
719
- byPlugin.set(pluginId, list);
720
- }
721
- return {
722
- all,
723
- byPlugin
724
- };
725
- }
726
- function expandPluginGroups(list, groups) {
727
- if (!list || list.length === 0) return list;
728
- const expanded = [];
729
- for (const entry of list) {
730
- const normalized = normalizeToolName(entry);
731
- if (normalized === "group:plugins") {
732
- if (groups.all.length > 0) expanded.push(...groups.all);
733
- else expanded.push(normalized);
734
- continue;
735
- }
736
- const tools = groups.byPlugin.get(normalized);
737
- if (tools && tools.length > 0) {
738
- expanded.push(...tools);
739
- continue;
740
- }
741
- expanded.push(normalized);
742
- }
743
- return Array.from(new Set(expanded));
744
- }
745
- function expandPolicyWithPluginGroups(policy, groups) {
746
- if (!policy) return;
747
- return {
748
- allow: expandPluginGroups(policy.allow, groups),
749
- deny: expandPluginGroups(policy.deny, groups)
750
- };
751
- }
752
- function stripPluginOnlyAllowlist(policy, groups, coreTools) {
753
- if (!policy?.allow || policy.allow.length === 0) return {
754
- policy,
755
- unknownAllowlist: [],
756
- strippedAllowlist: false
757
- };
758
- const normalized = normalizeToolList(policy.allow);
759
- if (normalized.length === 0) return {
760
- policy,
761
- unknownAllowlist: [],
762
- strippedAllowlist: false
763
- };
764
- const pluginIds = new Set(groups.byPlugin.keys());
765
- const pluginTools = new Set(groups.all);
766
- const unknownAllowlist = [];
767
- let hasCoreEntry = false;
768
- for (const entry of normalized) {
769
- if (entry === "*") {
770
- hasCoreEntry = true;
771
- continue;
772
- }
773
- const isPluginEntry = entry === "group:plugins" || pluginIds.has(entry) || pluginTools.has(entry);
774
- const isCoreEntry = expandToolGroups([entry]).some((tool) => coreTools.has(tool));
775
- if (isCoreEntry) hasCoreEntry = true;
776
- if (!isCoreEntry && !isPluginEntry) unknownAllowlist.push(entry);
777
- }
778
- const strippedAllowlist = !hasCoreEntry;
779
- if (strippedAllowlist) {}
780
- return {
781
- policy: strippedAllowlist ? {
782
- ...policy,
783
- allow: void 0
784
- } : policy,
785
- unknownAllowlist: Array.from(new Set(unknownAllowlist)),
786
- strippedAllowlist
787
- };
788
- }
789
- function mergeAlsoAllowPolicy(policy, alsoAllow) {
790
- if (!policy?.allow || !Array.isArray(alsoAllow) || alsoAllow.length === 0) return policy;
791
- return {
792
- ...policy,
793
- allow: Array.from(new Set([...policy.allow, ...alsoAllow]))
794
- };
795
- }
796
-
797
- //#endregion
798
- //#region src/agents/tool-policy-resolution.ts
799
- function normalizeToolPolicy$2(config) {
800
- if (!config) return;
801
- const allow = Array.isArray(config.allow) ? config.allow : void 0;
802
- const deny = Array.isArray(config.deny) ? config.deny : void 0;
803
- if (!allow && !deny) return;
804
- return {
805
- allow,
806
- deny
807
- };
808
- }
809
- function makeToolPolicyMatcher(policy) {
810
- const deny = compileGlobPatterns({
811
- raw: expandToolGroups(policy.deny ?? []),
812
- normalize: normalizeToolName
813
- });
814
- const allow = compileGlobPatterns({
815
- raw: expandToolGroups(policy.allow ?? []),
816
- normalize: normalizeToolName
817
- });
818
- return (name) => {
819
- const normalized = normalizeToolName(name);
820
- if (matchesAnyGlobPattern(normalized, deny)) return false;
821
- if (allow.length === 0) return true;
822
- if (matchesAnyGlobPattern(normalized, allow)) return true;
823
- return false;
824
- };
825
- }
826
- /**
827
- * Tools always denied for sub-agents regardless of depth.
828
- * These are system-level or interactive tools that sub-agents should never use.
829
- */
830
- const SUBAGENT_TOOL_DENY_ALWAYS = [
831
- "gateway",
832
- "agents_list",
833
- "whatsapp_login",
834
- "session_status",
835
- "cron",
836
- "sessions_send"
837
- ];
838
- /**
839
- * Additional tools denied for leaf sub-agents (depth >= maxSpawnDepth).
840
- * These are tools that only make sense for orchestrator sub-agents that can spawn children.
841
- */
842
- const SUBAGENT_TOOL_DENY_LEAF = [
843
- "sessions_list",
844
- "sessions_history",
845
- "sessions_spawn"
846
- ];
847
- /**
848
- * Build the deny list for a sub-agent at a given depth.
849
- *
850
- * - Depth 1 with maxSpawnDepth >= 2 (orchestrator): allowed to use sessions_spawn,
851
- * subagents, sessions_list, sessions_history so it can manage its children.
852
- * - Depth >= maxSpawnDepth (leaf): denied sessions_spawn and
853
- * session management tools. Still allowed subagents (for list/status visibility).
854
- */
855
- function resolveSubagentDenyList(depth, maxSpawnDepth) {
856
- if (depth >= Math.max(1, Math.floor(maxSpawnDepth))) return [...SUBAGENT_TOOL_DENY_ALWAYS, ...SUBAGENT_TOOL_DENY_LEAF];
857
- return [...SUBAGENT_TOOL_DENY_ALWAYS];
858
- }
859
- function resolveSubagentToolPolicy(cfg, depth) {
860
- const configured = cfg?.tools?.subagents?.tools;
861
- const maxSpawnDepth = cfg?.agents?.defaults?.subagents?.maxSpawnDepth ?? DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH;
862
- const baseDeny = resolveSubagentDenyList(typeof depth === "number" && depth >= 0 ? depth : 1, maxSpawnDepth);
863
- const allow = Array.isArray(configured?.allow) ? configured.allow : void 0;
864
- const alsoAllow = Array.isArray(configured?.alsoAllow) ? configured.alsoAllow : void 0;
865
- const explicitAllow = new Set([...allow ?? [], ...alsoAllow ?? []].map((toolName) => normalizeToolName(toolName)));
866
- const deny = [...baseDeny.filter((toolName) => !explicitAllow.has(normalizeToolName(toolName))), ...Array.isArray(configured?.deny) ? configured.deny : []];
867
- return {
868
- allow: allow && alsoAllow ? Array.from(new Set([...allow, ...alsoAllow])) : allow,
869
- deny
870
- };
871
- }
872
- function isToolAllowedByPolicyName(name, policy) {
873
- if (!policy) return true;
874
- return makeToolPolicyMatcher(policy)(name);
875
- }
876
- function filterToolsByPolicy(tools, policy) {
877
- if (!policy) return tools;
878
- const matcher = makeToolPolicyMatcher(policy);
879
- return tools.filter((tool) => matcher(tool.name));
880
- }
881
- function normalizeProviderKey(value) {
882
- return value.trim().toLowerCase();
883
- }
884
- function resolveGroupContextFromSessionKey(sessionKey) {
885
- const raw = (sessionKey ?? "").trim();
886
- if (!raw) return {};
887
- const parts = (resolveThreadParentSessionKey(raw) ?? raw).split(":").filter(Boolean);
888
- let body = parts[0] === "agent" ? parts.slice(2) : parts;
889
- if (body[0] === "subagent") body = body.slice(1);
890
- if (body.length < 3) return {};
891
- const [channel, kind, ...rest] = body;
892
- if (kind !== "group" && kind !== "channel") return {};
893
- const groupId = rest.join(":").trim();
894
- if (!groupId) return {};
895
- return {
896
- channel: channel.trim().toLowerCase(),
897
- groupId
898
- };
899
- }
900
- function resolveProviderToolPolicy(params) {
901
- const provider = params.modelProvider?.trim();
902
- if (!provider || !params.byProvider) return;
903
- const entries = Object.entries(params.byProvider);
904
- if (entries.length === 0) return;
905
- const lookup = /* @__PURE__ */ new Map();
906
- for (const [key, value] of entries) {
907
- const normalized = normalizeProviderKey(key);
908
- if (!normalized) continue;
909
- lookup.set(normalized, value);
910
- }
911
- const normalizedProvider = normalizeProviderKey(provider);
912
- const rawModelId = params.modelId?.trim().toLowerCase();
913
- const fullModelId = rawModelId && !rawModelId.includes("/") ? `${normalizedProvider}/${rawModelId}` : rawModelId;
914
- const candidates = [...fullModelId ? [fullModelId] : [], normalizedProvider];
915
- for (const key of candidates) {
916
- const match = lookup.get(key);
917
- if (match) return match;
918
- }
919
- }
920
- function resolveEffectiveToolPolicy(params) {
921
- const agentId = (typeof params.agentId === "string" && params.agentId.trim() ? normalizeAgentId(params.agentId) : void 0) ?? (params.sessionKey ? resolveAgentIdFromSessionKey(params.sessionKey) : void 0);
922
- const agentTools = (params.config && agentId ? resolveAgentConfig(params.config, agentId) : void 0)?.tools;
923
- const globalTools = params.config?.tools;
924
- const profile = agentTools?.profile ?? globalTools?.profile;
925
- const providerPolicy = resolveProviderToolPolicy({
926
- byProvider: globalTools?.byProvider,
927
- modelProvider: params.modelProvider,
928
- modelId: params.modelId
929
- });
930
- const agentProviderPolicy = resolveProviderToolPolicy({
931
- byProvider: agentTools?.byProvider,
932
- modelProvider: params.modelProvider,
933
- modelId: params.modelId
934
- });
935
- return {
936
- agentId,
937
- globalPolicy: normalizeToolPolicy$2(globalTools),
938
- globalProviderPolicy: normalizeToolPolicy$2(providerPolicy),
939
- agentPolicy: normalizeToolPolicy$2(agentTools),
940
- agentProviderPolicy: normalizeToolPolicy$2(agentProviderPolicy),
941
- profile,
942
- providerProfile: agentProviderPolicy?.profile ?? providerPolicy?.profile,
943
- profileAlsoAllow: Array.isArray(agentTools?.alsoAllow) ? agentTools?.alsoAllow : Array.isArray(globalTools?.alsoAllow) ? globalTools?.alsoAllow : void 0,
944
- providerProfileAlsoAllow: Array.isArray(agentProviderPolicy?.alsoAllow) ? agentProviderPolicy?.alsoAllow : Array.isArray(providerPolicy?.alsoAllow) ? providerPolicy?.alsoAllow : void 0
945
- };
946
- }
947
- function resolveGroupToolPolicy(params) {
948
- if (!params.config) return;
949
- const sessionContext = resolveGroupContextFromSessionKey(params.sessionKey);
950
- const spawnedContext = resolveGroupContextFromSessionKey(params.spawnedBy);
951
- const groupId = params.groupId ?? sessionContext.groupId ?? spawnedContext.groupId;
952
- if (!groupId) return;
953
- const channel = normalizeMessageChannel(params.messageProvider ?? sessionContext.channel ?? spawnedContext.channel);
954
- if (!channel) return;
955
- let dock;
956
- try {
957
- dock = getChannelDock(channel);
958
- } catch {
959
- dock = void 0;
960
- }
961
- return normalizeToolPolicy$2(dock?.groups?.resolveToolPolicy?.({
962
- cfg: params.config,
963
- groupId,
964
- groupChannel: params.groupChannel,
965
- groupSpace: params.groupSpace,
966
- accountId: params.accountId,
967
- senderId: params.senderId,
968
- senderName: params.senderName,
969
- senderUsername: params.senderUsername,
970
- senderE164: params.senderE164
971
- }) ?? resolveChannelGroupToolsPolicy({
972
- cfg: params.config,
973
- channel,
974
- groupId,
975
- accountId: params.accountId,
976
- senderId: params.senderId,
977
- senderName: params.senderName,
978
- senderUsername: params.senderUsername,
979
- senderE164: params.senderE164
980
- }));
981
- }
982
- function isToolAllowedByPolicies(name, policies) {
983
- return policies.every((policy) => isToolAllowedByPolicyName(name, policy));
984
- }
985
-
986
- //#endregion
987
- //#region src/shared/model-param-b.ts
988
- function inferParamBFromIdOrName(text) {
989
- const matches = text.toLowerCase().matchAll(/(?:^|[^a-z0-9])[a-z]?(\d+(?:\.\d+)?)b(?:[^a-z0-9]|$)/g);
990
- let best = null;
991
- for (const match of matches) {
992
- const numRaw = match[1];
993
- if (!numRaw) continue;
994
- const value = Number(numRaw);
995
- if (!Number.isFinite(value) || value <= 0) continue;
996
- if (best === null || value > best) best = value;
997
- }
998
- return best;
999
- }
1000
-
1001
- //#endregion
1002
- //#region src/security/audit-extra.sync.ts
1003
- /**
1004
- * Synchronous security audit collector functions.
1005
- *
1006
- * These functions analyze config-based security properties without I/O.
1007
- */
1008
- const resolveSandboxConfigForAgent$1 = (_cfg, _agentId) => ({
1009
- mode: "off",
1010
- workspaceAccess: void 0,
1011
- docker: void 0,
1012
- browser: {
1013
- enabled: false,
1014
- network: "",
1015
- cdpSourceRange: void 0
1016
- },
1017
- prune: void 0,
1018
- scope: void 0
1019
- });
1020
- const resolveToolPolicyForAgent$1 = (_cfg, _agentId) => void 0;
1021
- const isDangerousNetworkMode = (_mode) => false;
1022
- const normalizeNetworkMode = (_mode) => void 0;
1023
- const getBlockedBindReason = (_bind) => void 0;
1024
- function normalizeToolPolicy$1(config) {
1025
- if (!config) return;
1026
- const allow = Array.isArray(config.allow) ? config.allow : void 0;
1027
- const deny = Array.isArray(config.deny) ? config.deny : void 0;
1028
- if (!allow && !deny) return;
1029
- return {
1030
- allow,
1031
- deny
1032
- };
1033
- }
1034
- const SMALL_MODEL_PARAM_B_MAX = 300;
1035
- function summarizeGroupPolicy(cfg) {
1036
- const channels = cfg.channels;
1037
- if (!channels || typeof channels !== "object") return {
1038
- open: 0,
1039
- allowlist: 0,
1040
- other: 0
1041
- };
1042
- let open = 0;
1043
- let allowlist = 0;
1044
- let other = 0;
1045
- for (const value of Object.values(channels)) {
1046
- if (!value || typeof value !== "object") continue;
1047
- const policy = value.groupPolicy;
1048
- if (policy === "open") open += 1;
1049
- else if (policy === "allowlist") allowlist += 1;
1050
- else other += 1;
1051
- }
1052
- return {
1053
- open,
1054
- allowlist,
1055
- other
1056
- };
1057
- }
1058
- function isProbablySyncedPath(p) {
1059
- const s = p.toLowerCase();
1060
- return s.includes("icloud") || s.includes("dropbox") || s.includes("google drive") || s.includes("googledrive") || s.includes("onedrive");
1061
- }
1062
- function looksLikeEnvRef(value) {
1063
- const v = value.trim();
1064
- return v.startsWith("${") && v.endsWith("}");
1065
- }
1066
- function isGatewayRemotelyExposed(cfg) {
1067
- if ((typeof cfg.gateway?.bind === "string" ? cfg.gateway.bind : "loopback") !== "loopback") return true;
1068
- const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off";
1069
- return tailscaleMode === "serve" || tailscaleMode === "funnel";
1070
- }
1071
- function addModel(models, raw, source) {
1072
- if (typeof raw !== "string") return;
1073
- const id = raw.trim();
1074
- if (!id) return;
1075
- models.push({
1076
- id,
1077
- source
1078
- });
1079
- }
1080
- function resolveModelPrimaryValue(model) {
1081
- if (typeof model === "string") return model.trim() || void 0;
1082
- if (!model || typeof model !== "object") return;
1083
- const primary = model.primary;
1084
- if (typeof primary !== "string") return;
1085
- return primary.trim() || void 0;
1086
- }
1087
- function resolveModelFallbackValues(model) {
1088
- if (!model || typeof model !== "object") return [];
1089
- return Array.isArray(model.fallbacks) ? model.fallbacks : [];
1090
- }
1091
- function collectModels(cfg) {
1092
- const out = [];
1093
- addModel(out, resolveModelPrimaryValue(cfg.agents?.defaults?.model), "agents.defaults.model.primary");
1094
- for (const f of resolveModelFallbackValues(cfg.agents?.defaults?.model)) addModel(out, f, "agents.defaults.model.fallbacks");
1095
- addModel(out, resolveModelPrimaryValue(cfg.agents?.defaults?.imageModel), "agents.defaults.imageModel.primary");
1096
- for (const f of resolveModelFallbackValues(cfg.agents?.defaults?.imageModel)) addModel(out, f, "agents.defaults.imageModel.fallbacks");
1097
- const list = Array.isArray(cfg.agents?.list) ? cfg.agents?.list : [];
1098
- for (const agent of list ?? []) {
1099
- if (!agent || typeof agent !== "object") continue;
1100
- const id = typeof agent.id === "string" ? agent.id : "";
1101
- const model = agent.model;
1102
- if (typeof model === "string") addModel(out, model, `agents.list.${id}.model`);
1103
- else if (model && typeof model === "object") {
1104
- addModel(out, model.primary, `agents.list.${id}.model.primary`);
1105
- const fallbacks = model.fallbacks;
1106
- if (Array.isArray(fallbacks)) for (const f of fallbacks) addModel(out, f, `agents.list.${id}.model.fallbacks`);
1107
- }
1108
- }
1109
- return out;
1110
- }
1111
- const LEGACY_MODEL_PATTERNS = [
1112
- {
1113
- id: "openai.gpt35",
1114
- re: /\bgpt-3\.5\b/i,
1115
- label: "GPT-3.5 family"
1116
- },
1117
- {
1118
- id: "anthropic.claude2",
1119
- re: /\bclaude-(instant|2)\b/i,
1120
- label: "Claude 2/Instant family"
1121
- },
1122
- {
1123
- id: "openai.gpt4_legacy",
1124
- re: /\bgpt-4-(0314|0613)\b/i,
1125
- label: "Legacy GPT-4 snapshots"
1126
- }
1127
- ];
1128
- const WEAK_TIER_MODEL_PATTERNS = [{
1129
- id: "anthropic.haiku",
1130
- re: /\bhaiku\b/i,
1131
- label: "Haiku tier (smaller model)"
1132
- }];
1133
- function isGptModel(id) {
1134
- return /\bgpt-/i.test(id);
1135
- }
1136
- function isGpt5OrHigher(id) {
1137
- return /\bgpt-5(?:\b|[.-])/i.test(id);
1138
- }
1139
- function isClaudeModel(id) {
1140
- return /\bclaude-/i.test(id);
1141
- }
1142
- function isClaude45OrHigher(id) {
1143
- return /\bclaude-[^\s/]*?(?:-4-?(?:[5-9]|[1-9]\d)\b|4\.(?:[5-9]|[1-9]\d)\b|-[5-9](?:\b|[.-]))/i.test(id);
1144
- }
1145
- function extractAgentIdFromSource(source) {
1146
- return source.match(/^agents\.list\.([^.]*)\./)?.[1] ?? null;
1147
- }
1148
- function hasConfiguredDockerConfig(docker) {
1149
- if (!docker || typeof docker !== "object") return false;
1150
- return Object.values(docker).some((value) => value !== void 0);
1151
- }
1152
- function normalizeNodeCommand(value) {
1153
- return typeof value === "string" ? value.trim() : "";
1154
- }
1155
- function listKnownNodeCommands(cfg) {
1156
- const baseCfg = {
1157
- ...cfg,
1158
- gateway: {
1159
- ...cfg.gateway,
1160
- nodes: {
1161
- ...cfg.gateway?.nodes,
1162
- denyCommands: []
1163
- }
1164
- }
1165
- };
1166
- const out = /* @__PURE__ */ new Set();
1167
- for (const platform of [
1168
- "ios",
1169
- "android",
1170
- "macos",
1171
- "linux",
1172
- "windows",
1173
- "unknown"
1174
- ]) {
1175
- const allow = resolveNodeCommandAllowlist(baseCfg, { platform });
1176
- for (const cmd of allow) {
1177
- const normalized = normalizeNodeCommand(cmd);
1178
- if (normalized) out.add(normalized);
1179
- }
1180
- }
1181
- return out;
1182
- }
1183
- function looksLikeNodeCommandPattern(value) {
1184
- if (!value) return false;
1185
- if (/[?*[\]{}(),|]/.test(value)) return true;
1186
- if (value.startsWith("/") || value.endsWith("/") || value.startsWith("^") || value.endsWith("$")) return true;
1187
- return /\s/.test(value) || value.includes("group:");
1188
- }
1189
- function resolveToolPolicies$1(params) {
1190
- const policies = [];
1191
- const profilePolicy = resolveToolProfilePolicy(params.agentTools?.profile ?? params.cfg.tools?.profile);
1192
- if (profilePolicy) policies.push(profilePolicy);
1193
- const globalPolicy = normalizeToolPolicy$1(params.cfg.tools ?? void 0);
1194
- if (globalPolicy) policies.push(globalPolicy);
1195
- const agentPolicy = normalizeToolPolicy$1(params.agentTools);
1196
- if (agentPolicy) policies.push(agentPolicy);
1197
- if (params.sandboxMode === "all") {
1198
- const sandboxPolicy = resolveToolPolicyForAgent$1(params.cfg, params.agentId ?? void 0);
1199
- if (sandboxPolicy) policies.push(sandboxPolicy);
1200
- }
1201
- return policies;
1202
- }
1203
- function isBrowserEnabled(cfg) {
1204
- try {
1205
- return resolveBrowserConfig(cfg.browser, cfg).enabled;
1206
- } catch {
1207
- return true;
1208
- }
1209
- }
1210
- function listGroupPolicyOpen(cfg) {
1211
- const out = [];
1212
- const channels = cfg.channels;
1213
- if (!channels || typeof channels !== "object") return out;
1214
- for (const [channelId, value] of Object.entries(channels)) {
1215
- if (!value || typeof value !== "object") continue;
1216
- const section = value;
1217
- if (section.groupPolicy === "open") out.push(`channels.${channelId}.groupPolicy`);
1218
- const accounts = section.accounts;
1219
- if (accounts && typeof accounts === "object") for (const [accountId, accountVal] of Object.entries(accounts)) {
1220
- if (!accountVal || typeof accountVal !== "object") continue;
1221
- if (accountVal.groupPolicy === "open") out.push(`channels.${channelId}.accounts.${accountId}.groupPolicy`);
1222
- }
1223
- }
1224
- return out;
1225
- }
1226
- function hasConfiguredGroupTargets(section) {
1227
- return [
1228
- "groups",
1229
- "guilds",
1230
- "channels",
1231
- "rooms"
1232
- ].some((key) => {
1233
- const value = section[key];
1234
- return Boolean(value && typeof value === "object" && Object.keys(value).length > 0);
1235
- });
1236
- }
1237
- function listPotentialMultiUserSignals(cfg) {
1238
- const out = /* @__PURE__ */ new Set();
1239
- const channels = cfg.channels;
1240
- if (!channels || typeof channels !== "object") return [];
1241
- const inspectSection = (section, basePath) => {
1242
- const groupPolicy = typeof section.groupPolicy === "string" ? section.groupPolicy : null;
1243
- if (groupPolicy === "open") out.add(`${basePath}.groupPolicy="open"`);
1244
- else if (groupPolicy === "allowlist" && hasConfiguredGroupTargets(section)) out.add(`${basePath}.groupPolicy="allowlist" with configured group targets`);
1245
- if ((typeof section.dmPolicy === "string" ? section.dmPolicy : null) === "open") out.add(`${basePath}.dmPolicy="open"`);
1246
- if ((Array.isArray(section.allowFrom) ? section.allowFrom : []).some((entry) => String(entry).trim() === "*")) out.add(`${basePath}.allowFrom includes "*"`);
1247
- if ((Array.isArray(section.groupAllowFrom) ? section.groupAllowFrom : []).some((entry) => String(entry).trim() === "*")) out.add(`${basePath}.groupAllowFrom includes "*"`);
1248
- const dm = section.dm;
1249
- if (dm && typeof dm === "object") {
1250
- const dmSection = dm;
1251
- if ((typeof dmSection.policy === "string" ? dmSection.policy : null) === "open") out.add(`${basePath}.dm.policy="open"`);
1252
- if ((Array.isArray(dmSection.allowFrom) ? dmSection.allowFrom : []).some((entry) => String(entry).trim() === "*")) out.add(`${basePath}.dm.allowFrom includes "*"`);
1253
- }
1254
- };
1255
- for (const [channelId, value] of Object.entries(channels)) {
1256
- if (!value || typeof value !== "object") continue;
1257
- const section = value;
1258
- inspectSection(section, `channels.${channelId}`);
1259
- const accounts = section.accounts;
1260
- if (!accounts || typeof accounts !== "object") continue;
1261
- for (const [accountId, accountValue] of Object.entries(accounts)) {
1262
- if (!accountValue || typeof accountValue !== "object") continue;
1263
- inspectSection(accountValue, `channels.${channelId}.accounts.${accountId}`);
1264
- }
1265
- }
1266
- return Array.from(out);
1267
- }
1268
- function collectRiskyToolExposureContexts(cfg) {
1269
- const contexts = [{ label: "agents.defaults" }];
1270
- for (const agent of cfg.agents?.list ?? []) {
1271
- if (!agent || typeof agent !== "object" || typeof agent.id !== "string") continue;
1272
- contexts.push({
1273
- label: `agents.list.${agent.id}`,
1274
- agentId: agent.id,
1275
- tools: agent.tools
1276
- });
1277
- }
1278
- const riskyContexts = [];
1279
- let hasRuntimeRisk = false;
1280
- for (const context of contexts) {
1281
- const sandboxMode = resolveSandboxConfigForAgent$1(cfg, context.agentId).mode;
1282
- const runtimeTools = [];
1283
- if (!(runtimeTools.length > 0 && sandboxMode !== "all")) continue;
1284
- hasRuntimeRisk = true;
1285
- riskyContexts.push(`${context.label} (sandbox=${sandboxMode}; runtime=[${runtimeTools.join(", ") || "off"}])`);
1286
- }
1287
- return {
1288
- riskyContexts,
1289
- hasRuntimeRisk
1290
- };
1291
- }
1292
- function collectAttackSurfaceSummaryFindings(cfg) {
1293
- const group = summarizeGroupPolicy(cfg);
1294
- const elevated = cfg.tools?.elevated?.enabled !== false;
1295
- const webhooksEnabled = cfg.hooks?.enabled === true;
1296
- const internalHooksEnabled = cfg.hooks?.internal?.enabled === true;
1297
- const browserEnabled = cfg.browser?.enabled ?? true;
1298
- return [{
1299
- checkId: "summary.attack_surface",
1300
- severity: "info",
1301
- title: "Attack surface summary",
1302
- detail: `groups: open=${group.open}, allowlist=${group.allowlist}\ntools.elevated: ${elevated ? "enabled" : "disabled"}\nhooks.webhooks: ${webhooksEnabled ? "enabled" : "disabled"}\nhooks.internal: ${internalHooksEnabled ? "enabled" : "disabled"}\nbrowser control: ${browserEnabled ? "enabled" : "disabled"}\ntrust model: personal assistant (one trusted operator boundary), not hostile multi-tenant on one shared gateway`
1303
- }];
1304
- }
1305
- function collectSyncedFolderFindings(params) {
1306
- const findings = [];
1307
- if (isProbablySyncedPath(params.stateDir) || isProbablySyncedPath(params.configPath)) findings.push({
1308
- checkId: "fs.synced_dir",
1309
- severity: "warn",
1310
- title: "State/config path looks like a synced folder",
1311
- detail: `stateDir=${params.stateDir}, configPath=${params.configPath}. Synced folders (iCloud/Dropbox/OneDrive/Google Drive) can leak tokens and transcripts onto other devices.`,
1312
- remediation: `Keep REMOTECLAW_STATE_DIR on a local-only volume and re-run "${formatCliCommand("remoteclaw security audit --fix")}".`
1313
- });
1314
- return findings;
1315
- }
1316
- function collectSecretsInConfigFindings(cfg) {
1317
- const findings = [];
1318
- const password = typeof cfg.gateway?.auth?.password === "string" ? cfg.gateway.auth.password.trim() : "";
1319
- if (password && !looksLikeEnvRef(password)) findings.push({
1320
- checkId: "config.secrets.gateway_password_in_config",
1321
- severity: "warn",
1322
- title: "Gateway password is stored in config",
1323
- detail: "gateway.auth.password is set in the config file; prefer environment variables for secrets when possible.",
1324
- remediation: "Prefer REMOTECLAW_GATEWAY_PASSWORD (env) and remove gateway.auth.password from disk."
1325
- });
1326
- const hooksToken = typeof cfg.hooks?.token === "string" ? cfg.hooks.token.trim() : "";
1327
- if (cfg.hooks?.enabled === true && hooksToken && !looksLikeEnvRef(hooksToken)) findings.push({
1328
- checkId: "config.secrets.hooks_token_in_config",
1329
- severity: "info",
1330
- title: "Hooks token is stored in config",
1331
- detail: "hooks.token is set in the config file; keep config perms tight and treat it like an API secret."
1332
- });
1333
- return findings;
1334
- }
1335
- function collectHooksHardeningFindings(cfg, env = process.env) {
1336
- const findings = [];
1337
- if (cfg.hooks?.enabled !== true) return findings;
1338
- const token = typeof cfg.hooks?.token === "string" ? cfg.hooks.token.trim() : "";
1339
- if (token && token.length < 24) findings.push({
1340
- checkId: "hooks.token_too_short",
1341
- severity: "warn",
1342
- title: "Hooks token looks short",
1343
- detail: `hooks.token is ${token.length} chars; prefer a long random token.`
1344
- });
1345
- const gatewayAuth = resolveGatewayAuth({
1346
- authConfig: cfg.gateway?.auth,
1347
- tailscaleMode: cfg.gateway?.tailscale?.mode ?? "off",
1348
- env
1349
- });
1350
- const remoteclawGatewayToken = typeof env.REMOTECLAW_GATEWAY_TOKEN === "string" && env.REMOTECLAW_GATEWAY_TOKEN.trim() ? env.REMOTECLAW_GATEWAY_TOKEN.trim() : null;
1351
- const gatewayToken = gatewayAuth.mode === "token" && typeof gatewayAuth.token === "string" && gatewayAuth.token.trim() ? gatewayAuth.token.trim() : remoteclawGatewayToken ? remoteclawGatewayToken : null;
1352
- if (token && gatewayToken && token === gatewayToken) findings.push({
1353
- checkId: "hooks.token_reuse_gateway_token",
1354
- severity: "critical",
1355
- title: "Hooks token reuses the Gateway token",
1356
- detail: "hooks.token matches gateway.auth token; compromise of hooks expands blast radius to the Gateway API.",
1357
- remediation: "Use a separate hooks.token dedicated to hook ingress."
1358
- });
1359
- if ((typeof cfg.hooks?.path === "string" ? cfg.hooks.path.trim() : "") === "/") findings.push({
1360
- checkId: "hooks.path_root",
1361
- severity: "critical",
1362
- title: "Hooks base path is '/'",
1363
- detail: "hooks.path='/' would shadow other HTTP endpoints and is unsafe.",
1364
- remediation: "Use a dedicated path like '/hooks'."
1365
- });
1366
- const allowRequestSessionKey = cfg.hooks?.allowRequestSessionKey === true;
1367
- const defaultSessionKey = typeof cfg.hooks?.defaultSessionKey === "string" ? cfg.hooks.defaultSessionKey.trim() : "";
1368
- const allowedPrefixes = Array.isArray(cfg.hooks?.allowedSessionKeyPrefixes) ? cfg.hooks.allowedSessionKeyPrefixes.map((prefix) => prefix.trim()).filter((prefix) => prefix.length > 0) : [];
1369
- const remoteExposure = isGatewayRemotelyExposed(cfg);
1370
- if (!defaultSessionKey) findings.push({
1371
- checkId: "hooks.default_session_key_unset",
1372
- severity: "warn",
1373
- title: "hooks.defaultSessionKey is not configured",
1374
- detail: "Hook agent runs without explicit sessionKey use generated per-request keys. Set hooks.defaultSessionKey to keep hook ingress scoped to a known session.",
1375
- remediation: "Set hooks.defaultSessionKey (for example, \"hook:ingress\")."
1376
- });
1377
- if (allowRequestSessionKey) findings.push({
1378
- checkId: "hooks.request_session_key_enabled",
1379
- severity: remoteExposure ? "critical" : "warn",
1380
- title: "External hook payloads may override sessionKey",
1381
- detail: "hooks.allowRequestSessionKey=true allows `/hooks/agent` callers to choose the session key. Treat hook token holders as full-trust unless you also restrict prefixes.",
1382
- remediation: "Set hooks.allowRequestSessionKey=false (recommended) or constrain hooks.allowedSessionKeyPrefixes."
1383
- });
1384
- if (allowRequestSessionKey && allowedPrefixes.length === 0) findings.push({
1385
- checkId: "hooks.request_session_key_prefixes_missing",
1386
- severity: remoteExposure ? "critical" : "warn",
1387
- title: "Request sessionKey override is enabled without prefix restrictions",
1388
- detail: "hooks.allowRequestSessionKey=true and hooks.allowedSessionKeyPrefixes is unset/empty, so request payloads can target arbitrary session key shapes.",
1389
- remediation: "Set hooks.allowedSessionKeyPrefixes (for example, [\"hook:\"]) or disable request overrides."
1390
- });
1391
- return findings;
1392
- }
1393
- function collectGatewayHttpSessionKeyOverrideFindings(cfg) {
1394
- const findings = [];
1395
- const chatCompletionsEnabled = cfg.gateway?.http?.endpoints?.chatCompletions?.enabled === true;
1396
- const responsesEnabled = cfg.gateway?.http?.endpoints?.responses?.enabled === true;
1397
- if (!chatCompletionsEnabled && !responsesEnabled) return findings;
1398
- const enabledEndpoints = [chatCompletionsEnabled ? "/v1/chat/completions" : null, responsesEnabled ? "/v1/responses" : null].filter((entry) => Boolean(entry));
1399
- findings.push({
1400
- checkId: "gateway.http.session_key_override_enabled",
1401
- severity: "info",
1402
- title: "HTTP API session-key override is enabled",
1403
- detail: `${enabledEndpoints.join(", ")} accept x-remoteclaw-session-key for per-request session routing. Treat API credential holders as trusted principals.`
1404
- });
1405
- return findings;
1406
- }
1407
- function collectGatewayHttpNoAuthFindings(cfg, env) {
1408
- const findings = [];
1409
- const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off";
1410
- if (resolveGatewayAuth({
1411
- authConfig: cfg.gateway?.auth,
1412
- tailscaleMode,
1413
- env
1414
- }).mode !== "none") return findings;
1415
- const chatCompletionsEnabled = cfg.gateway?.http?.endpoints?.chatCompletions?.enabled === true;
1416
- const responsesEnabled = cfg.gateway?.http?.endpoints?.responses?.enabled === true;
1417
- const enabledEndpoints = [
1418
- "/tools/invoke",
1419
- chatCompletionsEnabled ? "/v1/chat/completions" : null,
1420
- responsesEnabled ? "/v1/responses" : null
1421
- ].filter((entry) => Boolean(entry));
1422
- const remoteExposure = isGatewayRemotelyExposed(cfg);
1423
- findings.push({
1424
- checkId: "gateway.http.no_auth",
1425
- severity: remoteExposure ? "critical" : "warn",
1426
- title: "Gateway HTTP APIs are reachable without auth",
1427
- detail: `gateway.auth.mode="none" leaves ${enabledEndpoints.join(", ")} callable without a shared secret. Treat this as trusted-local only and avoid exposing the gateway beyond loopback.`,
1428
- remediation: "Set gateway.auth.mode to token/password (recommended). If you intentionally keep mode=none, keep gateway.bind=loopback and disable optional HTTP endpoints."
1429
- });
1430
- return findings;
1431
- }
1432
- function collectSandboxDockerNoopFindings(cfg) {
1433
- const findings = [];
1434
- const configuredPaths = [];
1435
- const agents = Array.isArray(cfg.agents?.list) ? cfg.agents.list : [];
1436
- const defaultsSandbox = cfg.agents?.defaults?.sandbox;
1437
- const hasDefaultDocker = hasConfiguredDockerConfig(defaultsSandbox?.docker);
1438
- const defaultMode = defaultsSandbox?.mode ?? "off";
1439
- const hasAnySandboxEnabledAgent = agents.some((entry) => {
1440
- if (!entry || typeof entry !== "object" || typeof entry.id !== "string") return false;
1441
- return resolveSandboxConfigForAgent$1(cfg, entry.id).mode !== "off";
1442
- });
1443
- if (hasDefaultDocker && defaultMode === "off" && !hasAnySandboxEnabledAgent) configuredPaths.push("agents.defaults.sandbox.docker");
1444
- for (const entry of agents) {
1445
- if (!entry || typeof entry !== "object" || typeof entry.id !== "string") continue;
1446
- if (!hasConfiguredDockerConfig(entry.sandbox?.docker)) continue;
1447
- if (resolveSandboxConfigForAgent$1(cfg, entry.id).mode === "off") configuredPaths.push(`agents.list.${entry.id}.sandbox.docker`);
1448
- }
1449
- if (configuredPaths.length === 0) return findings;
1450
- findings.push({
1451
- checkId: "sandbox.docker_config_mode_off",
1452
- severity: "warn",
1453
- title: "Sandbox docker settings configured while sandbox mode is off",
1454
- detail: "These docker settings will not take effect until sandbox mode is enabled:\n" + configuredPaths.map((entry) => `- ${entry}`).join("\n"),
1455
- remediation: "Enable sandbox mode (`agents.defaults.sandbox.mode=\"non-main\"` or `\"all\"`) where needed, or remove unused docker settings."
1456
- });
1457
- return findings;
1458
- }
1459
- function collectSandboxDangerousConfigFindings(cfg) {
1460
- const findings = [];
1461
- const agents = Array.isArray(cfg.agents?.list) ? cfg.agents.list : [];
1462
- const configs = [];
1463
- const defaultDocker = cfg.agents?.defaults?.sandbox?.docker;
1464
- if (defaultDocker && typeof defaultDocker === "object") configs.push({
1465
- source: "agents.defaults.sandbox.docker",
1466
- docker: defaultDocker
1467
- });
1468
- for (const entry of agents) {
1469
- if (!entry || typeof entry !== "object" || typeof entry.id !== "string") continue;
1470
- const agentDocker = entry.sandbox?.docker;
1471
- if (agentDocker && typeof agentDocker === "object") configs.push({
1472
- source: `agents.list.${entry.id}.sandbox.docker`,
1473
- docker: agentDocker
1474
- });
1475
- }
1476
- for (const { source, docker } of configs) {
1477
- const binds = Array.isArray(docker.binds) ? docker.binds : [];
1478
- for (const bind of binds) {
1479
- if (typeof bind !== "string") continue;
1480
- const blocked = getBlockedBindReason(bind);
1481
- if (!blocked) continue;
1482
- if (blocked.kind === "non_absolute") {
1483
- findings.push({
1484
- checkId: "sandbox.bind_mount_non_absolute",
1485
- severity: "warn",
1486
- title: "Sandbox bind mount uses a non-absolute source path",
1487
- detail: `${source}.binds contains "${bind}" which uses source path "${blocked.sourcePath}". Non-absolute bind sources are hard to validate safely and may resolve unexpectedly.`,
1488
- remediation: `Rewrite "${bind}" to use an absolute host path (for example: /home/user/project:/project:ro).`
1489
- });
1490
- continue;
1491
- }
1492
- if (blocked.kind !== "covers" && blocked.kind !== "targets") continue;
1493
- const verb = blocked.kind === "covers" ? "covers" : "targets";
1494
- findings.push({
1495
- checkId: "sandbox.dangerous_bind_mount",
1496
- severity: "critical",
1497
- title: "Dangerous bind mount in sandbox config",
1498
- detail: `${source}.binds contains "${bind}" which ${verb} blocked path "${blocked.blockedPath}". This can expose host system directories or the Docker socket to sandbox containers.`,
1499
- remediation: `Remove "${bind}" from ${source}.binds. Use project-specific paths instead.`
1500
- });
1501
- }
1502
- const network = typeof docker.network === "string" ? docker.network : void 0;
1503
- const normalizedNetwork = normalizeNetworkMode(network);
1504
- if (network && isDangerousNetworkMode(network)) {
1505
- const modeLabel = normalizedNetwork === "host" ? "\"host\"" : `"${network}"`;
1506
- const detail = normalizedNetwork === "host" ? `${source}.network is "host" which bypasses container network isolation entirely.` : `${source}.network is ${modeLabel} which joins another container namespace and can bypass sandbox network isolation.`;
1507
- findings.push({
1508
- checkId: "sandbox.dangerous_network_mode",
1509
- severity: "critical",
1510
- title: "Dangerous network mode in sandbox config",
1511
- detail,
1512
- remediation: `Set ${source}.network to "bridge", "none", or a custom bridge network name. Use ${source}.dangerouslyAllowContainerNamespaceJoin=true only as a break-glass override when you fully trust this runtime.`
1513
- });
1514
- }
1515
- const seccompProfile = typeof docker.seccompProfile === "string" ? docker.seccompProfile : void 0;
1516
- if (seccompProfile && seccompProfile.trim().toLowerCase() === "unconfined") findings.push({
1517
- checkId: "sandbox.dangerous_seccomp_profile",
1518
- severity: "critical",
1519
- title: "Seccomp unconfined in sandbox config",
1520
- detail: `${source}.seccompProfile is "unconfined" which disables syscall filtering.`,
1521
- remediation: `Remove ${source}.seccompProfile or use a custom seccomp profile file.`
1522
- });
1523
- const apparmorProfile = typeof docker.apparmorProfile === "string" ? docker.apparmorProfile : void 0;
1524
- if (apparmorProfile && apparmorProfile.trim().toLowerCase() === "unconfined") findings.push({
1525
- checkId: "sandbox.dangerous_apparmor_profile",
1526
- severity: "critical",
1527
- title: "AppArmor unconfined in sandbox config",
1528
- detail: `${source}.apparmorProfile is "unconfined" which disables AppArmor enforcement.`,
1529
- remediation: `Remove ${source}.apparmorProfile or use a named AppArmor profile.`
1530
- });
1531
- }
1532
- const browserExposurePaths = [];
1533
- const defaultBrowser = resolveSandboxConfigForAgent$1(cfg).browser;
1534
- if (defaultBrowser.enabled && defaultBrowser.network.trim().toLowerCase() === "bridge" && !defaultBrowser.cdpSourceRange?.trim()) browserExposurePaths.push("agents.defaults.sandbox.browser");
1535
- for (const entry of agents) {
1536
- if (!entry || typeof entry !== "object" || typeof entry.id !== "string") continue;
1537
- const browser = resolveSandboxConfigForAgent$1(cfg, entry.id).browser;
1538
- if (!browser.enabled) continue;
1539
- if (browser.network.trim().toLowerCase() !== "bridge") continue;
1540
- if (browser.cdpSourceRange?.trim()) continue;
1541
- browserExposurePaths.push(`agents.list.${entry.id}.sandbox.browser`);
1542
- }
1543
- if (browserExposurePaths.length > 0) findings.push({
1544
- checkId: "sandbox.browser_cdp_bridge_unrestricted",
1545
- severity: "warn",
1546
- title: "Sandbox browser CDP may be reachable by peer containers",
1547
- detail: "These sandbox browser configs use Docker bridge networking with no CDP source restriction:\n" + browserExposurePaths.map((entry) => `- ${entry}`).join("\n"),
1548
- remediation: "Set sandbox.browser.network to a dedicated bridge network (recommended default: remoteclaw-sandbox-browser), or set sandbox.browser.cdpSourceRange (for example 172.21.0.1/32) to restrict container-edge CDP ingress."
1549
- });
1550
- return findings;
1551
- }
1552
- function collectNodeDenyCommandPatternFindings(cfg) {
1553
- const findings = [];
1554
- const denyListRaw = cfg.gateway?.nodes?.denyCommands;
1555
- if (!Array.isArray(denyListRaw) || denyListRaw.length === 0) return findings;
1556
- const denyList = denyListRaw.map(normalizeNodeCommand).filter(Boolean);
1557
- if (denyList.length === 0) return findings;
1558
- const knownCommands = listKnownNodeCommands(cfg);
1559
- const patternLike = denyList.filter((entry) => looksLikeNodeCommandPattern(entry));
1560
- const unknownExact = denyList.filter((entry) => !looksLikeNodeCommandPattern(entry) && !knownCommands.has(entry));
1561
- if (patternLike.length === 0 && unknownExact.length === 0) return findings;
1562
- const detailParts = [];
1563
- if (patternLike.length > 0) detailParts.push(`Pattern-like entries (not supported by exact matching): ${patternLike.join(", ")}`);
1564
- if (unknownExact.length > 0) detailParts.push(`Unknown command names (not in defaults/allowCommands): ${unknownExact.join(", ")}`);
1565
- const examples = Array.from(knownCommands).slice(0, 8);
1566
- findings.push({
1567
- checkId: "gateway.nodes.deny_commands_ineffective",
1568
- severity: "warn",
1569
- title: "Some gateway.nodes.denyCommands entries are ineffective",
1570
- detail: "gateway.nodes.denyCommands uses exact command-name matching only.\n" + detailParts.map((entry) => `- ${entry}`).join("\n"),
1571
- remediation: `Use exact command names (for example: ${examples.join(", ")}). If you need broader restrictions, remove risky commands from allowCommands/default workflows.`
1572
- });
1573
- return findings;
1574
- }
1575
- function collectNodeDangerousAllowCommandFindings(cfg) {
1576
- const findings = [];
1577
- const allowRaw = cfg.gateway?.nodes?.allowCommands;
1578
- if (!Array.isArray(allowRaw) || allowRaw.length === 0) return findings;
1579
- const allow = new Set(allowRaw.map(normalizeNodeCommand).filter(Boolean));
1580
- if (allow.size === 0) return findings;
1581
- const deny = new Set((cfg.gateway?.nodes?.denyCommands ?? []).map(normalizeNodeCommand));
1582
- const dangerousAllowed = DEFAULT_DANGEROUS_NODE_COMMANDS.filter((cmd) => allow.has(cmd) && !deny.has(cmd));
1583
- if (dangerousAllowed.length === 0) return findings;
1584
- findings.push({
1585
- checkId: "gateway.nodes.allow_commands_dangerous",
1586
- severity: isGatewayRemotelyExposed(cfg) ? "critical" : "warn",
1587
- title: "Dangerous node commands explicitly enabled",
1588
- detail: `gateway.nodes.allowCommands includes: ${dangerousAllowed.join(", ")}. These commands can trigger high-impact device actions (camera/screen/contacts/calendar/reminders/SMS).`,
1589
- remediation: "Remove these entries from gateway.nodes.allowCommands (recommended). If you keep them, treat gateway auth as full operator access and keep gateway exposure local/tailnet-only."
1590
- });
1591
- return findings;
1592
- }
1593
- function collectMinimalProfileOverrideFindings(cfg) {
1594
- const findings = [];
1595
- if (cfg.tools?.profile !== "minimal") return findings;
1596
- const overrides = (cfg.agents?.list ?? []).filter((entry) => {
1597
- return Boolean(entry && typeof entry === "object" && typeof entry.id === "string" && entry.tools?.profile && entry.tools.profile !== "minimal");
1598
- }).map((entry) => `${entry.id}=${entry.tools?.profile}`);
1599
- if (overrides.length === 0) return findings;
1600
- findings.push({
1601
- checkId: "tools.profile_minimal_overridden",
1602
- severity: "warn",
1603
- title: "Global tools.profile=minimal is overridden by agent profiles",
1604
- detail: "Global minimal profile is set, but these agent profiles take precedence:\n" + overrides.map((entry) => `- agents.list.${entry}`).join("\n"),
1605
- remediation: "Set those agents to `tools.profile=\"minimal\"` (or remove the agent override) if you want minimal tools enforced globally."
1606
- });
1607
- return findings;
1608
- }
1609
- function collectModelHygieneFindings(cfg) {
1610
- const findings = [];
1611
- const models = collectModels(cfg);
1612
- if (models.length === 0) return findings;
1613
- const weakMatches = /* @__PURE__ */ new Map();
1614
- const addWeakMatch = (model, source, reason) => {
1615
- const key = `${model}@@${source}`;
1616
- const existing = weakMatches.get(key);
1617
- if (!existing) {
1618
- weakMatches.set(key, {
1619
- model,
1620
- source,
1621
- reasons: [reason]
1622
- });
1623
- return;
1624
- }
1625
- if (!existing.reasons.includes(reason)) existing.reasons.push(reason);
1626
- };
1627
- for (const entry of models) {
1628
- for (const pat of WEAK_TIER_MODEL_PATTERNS) if (pat.re.test(entry.id)) {
1629
- addWeakMatch(entry.id, entry.source, pat.label);
1630
- break;
1631
- }
1632
- if (isGptModel(entry.id) && !isGpt5OrHigher(entry.id)) addWeakMatch(entry.id, entry.source, "Below GPT-5 family");
1633
- if (isClaudeModel(entry.id) && !isClaude45OrHigher(entry.id)) addWeakMatch(entry.id, entry.source, "Below Claude 4.5");
1634
- }
1635
- const matches = [];
1636
- for (const entry of models) for (const pat of LEGACY_MODEL_PATTERNS) if (pat.re.test(entry.id)) {
1637
- matches.push({
1638
- model: entry.id,
1639
- source: entry.source,
1640
- reason: pat.label
1641
- });
1642
- break;
1643
- }
1644
- if (matches.length > 0) {
1645
- const lines = matches.slice(0, 12).map((m) => `- ${m.model} (${m.reason}) @ ${m.source}`).join("\n");
1646
- const more = matches.length > 12 ? `\n…${matches.length - 12} more` : "";
1647
- findings.push({
1648
- checkId: "models.legacy",
1649
- severity: "warn",
1650
- title: "Some configured models look legacy",
1651
- detail: "Older/legacy models can be less robust against prompt injection and tool misuse.\n" + lines + more,
1652
- remediation: "Prefer modern, instruction-hardened models for any bot that can run tools."
1653
- });
1654
- }
1655
- if (weakMatches.size > 0) {
1656
- const lines = Array.from(weakMatches.values()).slice(0, 12).map((m) => `- ${m.model} (${m.reasons.join("; ")}) @ ${m.source}`).join("\n");
1657
- const more = weakMatches.size > 12 ? `\n…${weakMatches.size - 12} more` : "";
1658
- findings.push({
1659
- checkId: "models.weak_tier",
1660
- severity: "warn",
1661
- title: "Some configured models are below recommended tiers",
1662
- detail: "Smaller/older models are generally more susceptible to prompt injection and tool misuse.\n" + lines + more,
1663
- remediation: "Use the latest, top-tier model for any bot with tools or untrusted inboxes. Avoid Haiku tiers; prefer GPT-5+ and Claude 4.5+."
1664
- });
1665
- }
1666
- return findings;
1667
- }
1668
- function collectSmallModelRiskFindings(params) {
1669
- const findings = [];
1670
- const models = collectModels(params.cfg).filter((entry) => !entry.source.includes("imageModel"));
1671
- if (models.length === 0) return findings;
1672
- const smallModels = models.map((entry) => {
1673
- const paramB = inferParamBFromIdOrName(entry.id);
1674
- if (!paramB || paramB > SMALL_MODEL_PARAM_B_MAX) return null;
1675
- return {
1676
- ...entry,
1677
- paramB
1678
- };
1679
- }).filter((entry) => Boolean(entry));
1680
- if (smallModels.length === 0) return findings;
1681
- let hasUnsafe = false;
1682
- const modelLines = [];
1683
- const exposureSet = /* @__PURE__ */ new Set();
1684
- for (const entry of smallModels) {
1685
- const agentId = extractAgentIdFromSource(entry.source);
1686
- const sandboxMode = resolveSandboxConfigForAgent$1(params.cfg, agentId ?? void 0).mode;
1687
- const agentTools = agentId && params.cfg.agents?.list ? params.cfg.agents.list.find((agent) => agent?.id === agentId)?.tools : void 0;
1688
- const policies = resolveToolPolicies$1({
1689
- cfg: params.cfg,
1690
- agentTools,
1691
- sandboxMode,
1692
- agentId
1693
- });
1694
- const exposed = [];
1695
- if (isBrowserEnabled(params.cfg)) {
1696
- if (isToolAllowedByPolicies("browser", policies)) exposed.push("browser");
1697
- }
1698
- for (const tool of exposed) exposureSet.add(tool);
1699
- const sandboxLabel = sandboxMode === "all" ? "sandbox=all" : `sandbox=${sandboxMode}`;
1700
- const exposureLabel = exposed.length > 0 ? ` web=[${exposed.join(", ")}]` : " web=[off]";
1701
- const safe = sandboxMode === "all" && exposed.length === 0;
1702
- if (!safe) hasUnsafe = true;
1703
- const statusLabel = safe ? "ok" : "unsafe";
1704
- modelLines.push(`- ${entry.id} (${entry.paramB}B) @ ${entry.source} (${statusLabel}; ${sandboxLabel};${exposureLabel})`);
1705
- }
1706
- const exposureList = Array.from(exposureSet);
1707
- const exposureDetail = exposureList.length > 0 ? `Uncontrolled input tools allowed: ${exposureList.join(", ")}.` : "No web/browser tools detected for these models.";
1708
- findings.push({
1709
- checkId: "models.small_params",
1710
- severity: hasUnsafe ? "critical" : "info",
1711
- title: "Small models require sandboxing and web tools disabled",
1712
- detail: `Small models (<=${SMALL_MODEL_PARAM_B_MAX}B params) detected:\n` + modelLines.join("\n") + `\n` + exposureDetail + "\nSmall models are not recommended for untrusted inputs.",
1713
- remediation: "If you must use small models, enable sandboxing for all sessions (agents.defaults.sandbox.mode=\"all\") and disable web_fetch/browser (tools.deny=[\"group:web\",\"browser\"])."
1714
- });
1715
- return findings;
1716
- }
1717
- function collectExposureMatrixFindings(cfg) {
1718
- const findings = [];
1719
- const openGroups = listGroupPolicyOpen(cfg);
1720
- if (openGroups.length === 0) return findings;
1721
- if (cfg.tools?.elevated?.enabled !== false) findings.push({
1722
- checkId: "security.exposure.open_groups_with_elevated",
1723
- severity: "critical",
1724
- title: "Open groupPolicy with elevated tools enabled",
1725
- detail: `Found groupPolicy="open" at:\n${openGroups.map((p) => `- ${p}`).join("\n")}\nWith tools.elevated enabled, a prompt injection in those rooms can become a high-impact incident.`,
1726
- remediation: `Set groupPolicy="allowlist" and keep elevated allowlists extremely tight.`
1727
- });
1728
- const { riskyContexts, hasRuntimeRisk } = collectRiskyToolExposureContexts(cfg);
1729
- if (riskyContexts.length > 0) findings.push({
1730
- checkId: "security.exposure.open_groups_with_runtime_or_fs",
1731
- severity: hasRuntimeRisk ? "critical" : "warn",
1732
- title: "Open groupPolicy with runtime/filesystem tools exposed",
1733
- detail: `Found groupPolicy="open" at:\n${openGroups.map((p) => `- ${p}`).join("\n")}\nRisky tool exposure contexts:\n${riskyContexts.map((line) => `- ${line}`).join("\n")}\nPrompt injection in open groups can trigger command/file actions in these contexts.`,
1734
- remediation: "For open groups, prefer tools.profile=\"messaging\" (or deny group:runtime/group:fs), set tools.fs.workspaceOnly=true, and use agents.defaults.sandbox.mode=\"all\" for exposed agents."
1735
- });
1736
- return findings;
1737
- }
1738
- function collectLikelyMultiUserSetupFindings(cfg) {
1739
- const findings = [];
1740
- const signals = listPotentialMultiUserSignals(cfg);
1741
- if (signals.length === 0) return findings;
1742
- const { riskyContexts, hasRuntimeRisk } = collectRiskyToolExposureContexts(cfg);
1743
- const impactLine = hasRuntimeRisk ? "Runtime/process tools are exposed without full sandboxing in at least one context." : "No unguarded runtime/process tools were detected by this heuristic.";
1744
- const riskyContextsDetail = riskyContexts.length > 0 ? `Potential high-impact tool exposure contexts:\n${riskyContexts.map((line) => `- ${line}`).join("\n")}` : "No unguarded runtime/filesystem contexts detected.";
1745
- findings.push({
1746
- checkId: "security.trust_model.multi_user_heuristic",
1747
- severity: "warn",
1748
- title: "Potential multi-user setup detected (personal-assistant model warning)",
1749
- detail: "Heuristic signals indicate this gateway may be reachable by multiple users:\n" + signals.map((signal) => `- ${signal}`).join("\n") + `\n${impactLine}\n${riskyContextsDetail}\nRemoteClaw's default security model is personal-assistant (one trusted operator boundary), not hostile multi-tenant isolation on one shared gateway.`,
1750
- remediation: "If users may be mutually untrusted, split trust boundaries (separate gateways + credentials, ideally separate OS users/hosts). If you intentionally run shared-user access, set agents.defaults.sandbox.mode=\"all\", keep tools.fs.workspaceOnly=true, deny runtime/fs/web tools unless required, and keep personal/private identities + credentials off that runtime."
1751
- });
1752
- return findings;
1753
- }
1754
-
1755
- //#endregion
1756
- //#region src/config/includes-scan.ts
1757
- function listDirectIncludes(parsed) {
1758
- const out = [];
1759
- const visit = (value) => {
1760
- if (!value) return;
1761
- if (Array.isArray(value)) {
1762
- for (const item of value) visit(item);
1763
- return;
1764
- }
1765
- if (typeof value !== "object") return;
1766
- const rec = value;
1767
- const includeVal = rec[INCLUDE_KEY];
1768
- if (typeof includeVal === "string") out.push(includeVal);
1769
- else if (Array.isArray(includeVal)) {
1770
- for (const item of includeVal) if (typeof item === "string") out.push(item);
1771
- }
1772
- for (const v of Object.values(rec)) visit(v);
1773
- };
1774
- visit(parsed);
1775
- return out;
1776
- }
1777
- function resolveIncludePath(baseConfigPath, includePath) {
1778
- return path.normalize(path.isAbsolute(includePath) ? includePath : path.resolve(path.dirname(baseConfigPath), includePath));
1779
- }
1780
- async function collectIncludePathsRecursive(params) {
1781
- const visited = /* @__PURE__ */ new Set();
1782
- const result = [];
1783
- const walk = async (basePath, parsed, depth) => {
1784
- if (depth > MAX_INCLUDE_DEPTH) return;
1785
- for (const raw of listDirectIncludes(parsed)) {
1786
- const resolved = resolveIncludePath(basePath, raw);
1787
- if (visited.has(resolved)) continue;
1788
- visited.add(resolved);
1789
- result.push(resolved);
1790
- const rawText = await fs$1.readFile(resolved, "utf-8").catch(() => null);
1791
- if (!rawText) continue;
1792
- const nestedParsed = (() => {
1793
- try {
1794
- return JSON5.parse(rawText);
1795
- } catch {
1796
- return null;
1797
- }
1798
- })();
1799
- if (nestedParsed) await walk(resolved, nestedParsed, depth + 1);
1800
- }
1801
- };
1802
- await walk(params.configPath, params.parsed, 0);
1803
- return result;
1804
- }
1805
-
1806
- //#endregion
1807
- //#region src/security/windows-acl.ts
1808
- const INHERIT_FLAGS = new Set([
1809
- "I",
1810
- "OI",
1811
- "CI",
1812
- "IO",
1813
- "NP"
1814
- ]);
1815
- const WORLD_PRINCIPALS = new Set([
1816
- "everyone",
1817
- "users",
1818
- "builtin\\users",
1819
- "authenticated users",
1820
- "nt authority\\authenticated users"
1821
- ]);
1822
- const TRUSTED_BASE = new Set([
1823
- "nt authority\\system",
1824
- "system",
1825
- "builtin\\administrators",
1826
- "creator owner"
1827
- ]);
1828
- const WORLD_SUFFIXES = ["\\users", "\\authenticated users"];
1829
- const TRUSTED_SUFFIXES = ["\\administrators", "\\system"];
1830
- const SID_RE = /^s-\d+-\d+(-\d+)+$/i;
1831
- const TRUSTED_SIDS = new Set([
1832
- "s-1-5-18",
1833
- "s-1-5-32-544",
1834
- "s-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464"
1835
- ]);
1836
- const STATUS_PREFIXES = [
1837
- "successfully processed",
1838
- "processed",
1839
- "failed processing",
1840
- "no mapping between account names"
1841
- ];
1842
- const normalize = (value) => value.trim().toLowerCase();
1843
- function resolveWindowsUserPrincipal(env) {
1844
- const username = env?.USERNAME?.trim() || os.userInfo().username?.trim();
1845
- if (!username) return null;
1846
- const domain = env?.USERDOMAIN?.trim();
1847
- return domain ? `${domain}\\${username}` : username;
1848
- }
1849
- function buildTrustedPrincipals(env) {
1850
- const trusted = new Set(TRUSTED_BASE);
1851
- const principal = resolveWindowsUserPrincipal(env);
1852
- if (principal) {
1853
- trusted.add(normalize(principal));
1854
- const userOnly = principal.split("\\").at(-1);
1855
- if (userOnly) trusted.add(normalize(userOnly));
1856
- }
1857
- const userSid = normalize(env?.USERSID ?? "");
1858
- if (userSid && SID_RE.test(userSid)) trusted.add(userSid);
1859
- return trusted;
1860
- }
1861
- function classifyPrincipal(principal, trustedPrincipals) {
1862
- const normalized = normalize(principal);
1863
- if (SID_RE.test(normalized)) return TRUSTED_SIDS.has(normalized) || trustedPrincipals.has(normalized) ? "trusted" : "group";
1864
- if (trustedPrincipals.has(normalized) || TRUSTED_SUFFIXES.some((suffix) => normalized.endsWith(suffix))) return "trusted";
1865
- if (WORLD_PRINCIPALS.has(normalized) || WORLD_SUFFIXES.some((suffix) => normalized.endsWith(suffix))) return "world";
1866
- return "group";
1867
- }
1868
- function rightsFromTokens(tokens) {
1869
- const upper = tokens.join("").toUpperCase();
1870
- const canWrite = upper.includes("F") || upper.includes("M") || upper.includes("W") || upper.includes("D");
1871
- return {
1872
- canRead: upper.includes("F") || upper.includes("M") || upper.includes("R"),
1873
- canWrite
1874
- };
1875
- }
1876
- function isStatusLine(lowerLine) {
1877
- return STATUS_PREFIXES.some((prefix) => lowerLine.startsWith(prefix));
1878
- }
1879
- function stripTargetPrefix(params) {
1880
- if (params.lowerLine.startsWith(params.lowerTarget)) return params.trimmedLine.slice(params.normalizedTarget.length).trim();
1881
- if (params.lowerLine.startsWith(params.quotedLower)) return params.trimmedLine.slice(params.quotedTarget.length).trim();
1882
- return params.trimmedLine;
1883
- }
1884
- function parseAceEntry(entry) {
1885
- if (!entry || !entry.includes("(")) return null;
1886
- const idx = entry.indexOf(":");
1887
- if (idx === -1) return null;
1888
- const principal = entry.slice(0, idx).trim();
1889
- const rawRights = entry.slice(idx + 1).trim();
1890
- const tokens = rawRights.match(/\(([^)]+)\)/g)?.map((token) => token.slice(1, -1).trim()).filter(Boolean) ?? [];
1891
- if (tokens.some((token) => token.toUpperCase() === "DENY")) return null;
1892
- const rights = tokens.filter((token) => !INHERIT_FLAGS.has(token.toUpperCase()));
1893
- if (rights.length === 0) return null;
1894
- const { canRead, canWrite } = rightsFromTokens(rights);
1895
- return {
1896
- principal,
1897
- rights,
1898
- rawRights,
1899
- canRead,
1900
- canWrite
1901
- };
1902
- }
1903
- function parseIcaclsOutput(output, targetPath) {
1904
- const entries = [];
1905
- const normalizedTarget = targetPath.trim();
1906
- const lowerTarget = normalizedTarget.toLowerCase();
1907
- const quotedTarget = `"${normalizedTarget}"`;
1908
- const quotedLower = quotedTarget.toLowerCase();
1909
- for (const rawLine of output.split(/\r?\n/)) {
1910
- const line = rawLine.trimEnd();
1911
- if (!line.trim()) continue;
1912
- const trimmed = line.trim();
1913
- const lower = trimmed.toLowerCase();
1914
- if (isStatusLine(lower)) continue;
1915
- const parsed = parseAceEntry(stripTargetPrefix({
1916
- trimmedLine: trimmed,
1917
- lowerLine: lower,
1918
- normalizedTarget,
1919
- lowerTarget,
1920
- quotedTarget,
1921
- quotedLower
1922
- }));
1923
- if (!parsed) continue;
1924
- entries.push(parsed);
1925
- }
1926
- return entries;
1927
- }
1928
- function summarizeWindowsAcl(entries, env) {
1929
- const trustedPrincipals = buildTrustedPrincipals(env);
1930
- const trusted = [];
1931
- const untrustedWorld = [];
1932
- const untrustedGroup = [];
1933
- for (const entry of entries) {
1934
- const classification = classifyPrincipal(entry.principal, trustedPrincipals);
1935
- if (classification === "trusted") trusted.push(entry);
1936
- else if (classification === "world") untrustedWorld.push(entry);
1937
- else untrustedGroup.push(entry);
1938
- }
1939
- return {
1940
- trusted,
1941
- untrustedWorld,
1942
- untrustedGroup
1943
- };
1944
- }
1945
- async function inspectWindowsAcl(targetPath, opts) {
1946
- const exec = opts?.exec ?? runExec;
1947
- try {
1948
- const { stdout, stderr } = await exec("icacls", [targetPath]);
1949
- const entries = parseIcaclsOutput(`${stdout}\n${stderr}`.trim(), targetPath);
1950
- const { trusted, untrustedWorld, untrustedGroup } = summarizeWindowsAcl(entries, opts?.env);
1951
- return {
1952
- ok: true,
1953
- entries,
1954
- trusted,
1955
- untrustedWorld,
1956
- untrustedGroup
1957
- };
1958
- } catch (err) {
1959
- return {
1960
- ok: false,
1961
- entries: [],
1962
- trusted: [],
1963
- untrustedWorld: [],
1964
- untrustedGroup: [],
1965
- error: String(err)
1966
- };
1967
- }
1968
- }
1969
- function formatWindowsAclSummary(summary) {
1970
- if (!summary.ok) return "unknown";
1971
- const untrusted = [...summary.untrustedWorld, ...summary.untrustedGroup];
1972
- if (untrusted.length === 0) return "trusted-only";
1973
- return untrusted.map((entry) => `${entry.principal}:${entry.rawRights}`).join(", ");
1974
- }
1975
- function formatIcaclsResetCommand(targetPath, opts) {
1976
- const user = resolveWindowsUserPrincipal(opts.env) ?? "%USERNAME%";
1977
- const grant = opts.isDir ? "(OI)(CI)F" : "F";
1978
- return `icacls "${targetPath}" /inheritance:r /grant:r "${user}:${grant}" /grant:r "SYSTEM:${grant}"`;
1979
- }
1980
- function createIcaclsResetCommand(targetPath, opts) {
1981
- const user = resolveWindowsUserPrincipal(opts.env);
1982
- if (!user) return null;
1983
- const grant = opts.isDir ? "(OI)(CI)F" : "F";
1984
- return {
1985
- command: "icacls",
1986
- args: [
1987
- targetPath,
1988
- "/inheritance:r",
1989
- "/grant:r",
1990
- `${user}:${grant}`,
1991
- "/grant:r",
1992
- `SYSTEM:${grant}`
1993
- ],
1994
- display: formatIcaclsResetCommand(targetPath, opts)
1995
- };
1996
- }
1997
-
1998
- //#endregion
1999
- //#region src/security/audit-fs.ts
2000
- async function safeStat(targetPath) {
2001
- try {
2002
- const lst = await fs.lstat(targetPath);
2003
- return {
2004
- ok: true,
2005
- isSymlink: lst.isSymbolicLink(),
2006
- isDir: lst.isDirectory(),
2007
- mode: typeof lst.mode === "number" ? lst.mode : null,
2008
- uid: typeof lst.uid === "number" ? lst.uid : null,
2009
- gid: typeof lst.gid === "number" ? lst.gid : null
2010
- };
2011
- } catch (err) {
2012
- return {
2013
- ok: false,
2014
- isSymlink: false,
2015
- isDir: false,
2016
- mode: null,
2017
- uid: null,
2018
- gid: null,
2019
- error: String(err)
2020
- };
2021
- }
2022
- }
2023
- async function inspectPathPermissions(targetPath, opts) {
2024
- const st = await safeStat(targetPath);
2025
- if (!st.ok) return {
2026
- ok: false,
2027
- isSymlink: false,
2028
- isDir: false,
2029
- mode: null,
2030
- bits: null,
2031
- source: "unknown",
2032
- worldWritable: false,
2033
- groupWritable: false,
2034
- worldReadable: false,
2035
- groupReadable: false,
2036
- error: st.error
2037
- };
2038
- let effectiveMode = st.mode;
2039
- let effectiveIsDir = st.isDir;
2040
- if (st.isSymlink) try {
2041
- const target = await fs.stat(targetPath);
2042
- effectiveMode = typeof target.mode === "number" ? target.mode : st.mode;
2043
- effectiveIsDir = target.isDirectory();
2044
- } catch {}
2045
- const bits = modeBits(effectiveMode);
2046
- if ((opts?.platform ?? process.platform) === "win32") {
2047
- const acl = await inspectWindowsAcl(targetPath, {
2048
- env: opts?.env,
2049
- exec: opts?.exec
2050
- });
2051
- if (!acl.ok) return {
2052
- ok: true,
2053
- isSymlink: st.isSymlink,
2054
- isDir: effectiveIsDir,
2055
- mode: effectiveMode,
2056
- bits,
2057
- source: "unknown",
2058
- worldWritable: false,
2059
- groupWritable: false,
2060
- worldReadable: false,
2061
- groupReadable: false,
2062
- error: acl.error
2063
- };
2064
- return {
2065
- ok: true,
2066
- isSymlink: st.isSymlink,
2067
- isDir: effectiveIsDir,
2068
- mode: effectiveMode,
2069
- bits,
2070
- source: "windows-acl",
2071
- worldWritable: acl.untrustedWorld.some((entry) => entry.canWrite),
2072
- groupWritable: acl.untrustedGroup.some((entry) => entry.canWrite),
2073
- worldReadable: acl.untrustedWorld.some((entry) => entry.canRead),
2074
- groupReadable: acl.untrustedGroup.some((entry) => entry.canRead),
2075
- aclSummary: formatWindowsAclSummary(acl)
2076
- };
2077
- }
2078
- return {
2079
- ok: true,
2080
- isSymlink: st.isSymlink,
2081
- isDir: effectiveIsDir,
2082
- mode: effectiveMode,
2083
- bits,
2084
- source: "posix",
2085
- worldWritable: isWorldWritable(bits),
2086
- groupWritable: isGroupWritable(bits),
2087
- worldReadable: isWorldReadable(bits),
2088
- groupReadable: isGroupReadable(bits)
2089
- };
2090
- }
2091
- function formatPermissionDetail(targetPath, perms) {
2092
- if (perms.source === "windows-acl") return `${targetPath} acl=${perms.aclSummary ?? "unknown"}`;
2093
- return `${targetPath} mode=${formatOctal(perms.bits)}`;
2094
- }
2095
- function formatPermissionRemediation(params) {
2096
- if (params.perms.source === "windows-acl") return formatIcaclsResetCommand(params.targetPath, {
2097
- isDir: params.isDir,
2098
- env: params.env
2099
- });
2100
- return `chmod ${params.posixMode.toString(8).padStart(3, "0")} ${params.targetPath}`;
2101
- }
2102
- function modeBits(mode) {
2103
- if (mode == null) return null;
2104
- return mode & 511;
2105
- }
2106
- function formatOctal(bits) {
2107
- if (bits == null) return "unknown";
2108
- return bits.toString(8).padStart(3, "0");
2109
- }
2110
- function isWorldWritable(bits) {
2111
- if (bits == null) return false;
2112
- return (bits & 2) !== 0;
2113
- }
2114
- function isGroupWritable(bits) {
2115
- if (bits == null) return false;
2116
- return (bits & 16) !== 0;
2117
- }
2118
- function isWorldReadable(bits) {
2119
- if (bits == null) return false;
2120
- return (bits & 4) !== 0;
2121
- }
2122
- function isGroupReadable(bits) {
2123
- if (bits == null) return false;
2124
- return (bits & 32) !== 0;
2125
- }
2126
-
2127
- //#endregion
2128
- //#region src/security/audit-extra.async.ts
2129
- /**
2130
- * Asynchronous security audit collector functions.
2131
- *
2132
- * These functions perform I/O (filesystem, config reads) to detect security issues.
2133
- */
2134
- const resolveSandboxConfigForAgent = (_cfg, _agentId) => ({ mode: "off" });
2135
- const resolveToolPolicyForAgent = (_cfg, _agentId) => void 0;
2136
- function normalizeToolPolicy(config) {
2137
- if (!config) return;
2138
- const allow = Array.isArray(config.allow) ? config.allow : void 0;
2139
- const deny = Array.isArray(config.deny) ? config.deny : void 0;
2140
- if (!allow && !deny) return;
2141
- return {
2142
- allow,
2143
- deny
2144
- };
2145
- }
2146
- function expandTilde(p, env) {
2147
- if (!p.startsWith("~")) return p;
2148
- const home = typeof env.HOME === "string" && env.HOME.trim() ? env.HOME.trim() : null;
2149
- if (!home) return null;
2150
- if (p === "~") return home;
2151
- if (p.startsWith("~/") || p.startsWith("~\\")) return path.join(home, p.slice(2));
2152
- return null;
2153
- }
2154
- async function readPluginManifestExtensions(pluginPath) {
2155
- const manifestPath = path.join(pluginPath, "package.json");
2156
- const raw = await fs.readFile(manifestPath, "utf-8").catch(() => "");
2157
- if (!raw.trim()) return [];
2158
- const extensions = JSON.parse(raw)?.[MANIFEST_KEY]?.extensions;
2159
- if (!Array.isArray(extensions)) return [];
2160
- return extensions.map((entry) => typeof entry === "string" ? entry.trim() : "").filter(Boolean);
2161
- }
2162
- async function listInstalledPluginDirs(params) {
2163
- const extensionsDir = path.join(params.stateDir, "extensions");
2164
- const st = await safeStat(extensionsDir);
2165
- if (!st.ok || !st.isDir) return {
2166
- extensionsDir,
2167
- pluginDirs: []
2168
- };
2169
- return {
2170
- extensionsDir,
2171
- pluginDirs: (await fs.readdir(extensionsDir, { withFileTypes: true }).catch((err) => {
2172
- params.onReadError?.(err);
2173
- return [];
2174
- })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter(Boolean)
2175
- };
2176
- }
2177
- function resolveToolPolicies(params) {
2178
- const policies = [
2179
- resolveToolProfilePolicy(params.agentTools?.profile ?? params.cfg.tools?.profile),
2180
- normalizeToolPolicy(params.cfg.tools ?? void 0),
2181
- normalizeToolPolicy(params.agentTools)
2182
- ];
2183
- if (params.sandboxMode === "all") policies.push(resolveToolPolicyForAgent(params.cfg, params.agentId ?? void 0));
2184
- return policies;
2185
- }
2186
- function normalizePluginIdSet(entries) {
2187
- return new Set(entries.map((entry) => entry.trim().toLowerCase()).filter(Boolean));
2188
- }
2189
- function resolveEnabledExtensionPluginIds(params) {
2190
- const normalized = normalizePluginsConfig(params.cfg.plugins);
2191
- if (!normalized.enabled) return [];
2192
- const allowSet = normalizePluginIdSet(normalized.allow);
2193
- const denySet = normalizePluginIdSet(normalized.deny);
2194
- const entryById = /* @__PURE__ */ new Map();
2195
- for (const [id, entry] of Object.entries(normalized.entries)) entryById.set(id.trim().toLowerCase(), entry);
2196
- const enabled = [];
2197
- for (const id of params.pluginDirs) {
2198
- const normalizedId = id.trim().toLowerCase();
2199
- if (!normalizedId) continue;
2200
- if (denySet.has(normalizedId)) continue;
2201
- if (allowSet.size > 0 && !allowSet.has(normalizedId)) continue;
2202
- if (entryById.get(normalizedId)?.enabled === false) continue;
2203
- enabled.push(normalizedId);
2204
- }
2205
- return enabled;
2206
- }
2207
- function collectAllowEntries(config) {
2208
- const out = [];
2209
- if (Array.isArray(config?.allow)) out.push(...config.allow);
2210
- if (Array.isArray(config?.alsoAllow)) out.push(...config.alsoAllow);
2211
- return out.map((entry) => entry.trim().toLowerCase()).filter(Boolean);
2212
- }
2213
- function hasExplicitPluginAllow(params) {
2214
- return params.allowEntries.some((entry) => entry === "group:plugins" || params.enabledPluginIds.has(entry));
2215
- }
2216
- function hasProviderPluginAllow(params) {
2217
- if (!params.byProvider) return false;
2218
- for (const policy of Object.values(params.byProvider)) if (hasExplicitPluginAllow({
2219
- allowEntries: collectAllowEntries(policy),
2220
- enabledPluginIds: params.enabledPluginIds
2221
- })) return true;
2222
- return false;
2223
- }
2224
- function isPinnedRegistrySpec(spec) {
2225
- const value = spec.trim();
2226
- if (!value) return false;
2227
- const at = value.lastIndexOf("@");
2228
- if (at <= 0 || at >= value.length - 1) return false;
2229
- const version = value.slice(at + 1).trim();
2230
- return /^v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(version);
2231
- }
2232
- async function readInstalledPackageVersion(dir) {
2233
- try {
2234
- const raw = await fs.readFile(path.join(dir, "package.json"), "utf-8");
2235
- const parsed = JSON.parse(raw);
2236
- return typeof parsed.version === "string" ? parsed.version : void 0;
2237
- } catch {
2238
- return;
2239
- }
2240
- }
2241
- async function collectPluginsTrustFindings(params) {
2242
- const findings = [];
2243
- const { extensionsDir, pluginDirs } = await listInstalledPluginDirs({ stateDir: params.stateDir });
2244
- if (pluginDirs.length > 0) {
2245
- const allow = params.cfg.plugins?.allow;
2246
- if (!(Array.isArray(allow) && allow.length > 0)) findings.push({
2247
- checkId: "plugins.extensions_no_allowlist",
2248
- severity: "warn",
2249
- title: "Extensions exist but plugins.allow is not set",
2250
- detail: `Found ${pluginDirs.length} extension(s) under ${extensionsDir}. Without plugins.allow, any discovered plugin id may load (depending on config and plugin behavior).`,
2251
- remediation: "Set plugins.allow to an explicit list of plugin ids you trust."
2252
- });
2253
- const enabledExtensionPluginIds = resolveEnabledExtensionPluginIds({
2254
- cfg: params.cfg,
2255
- pluginDirs
2256
- });
2257
- if (enabledExtensionPluginIds.length > 0) {
2258
- const enabledPluginSet = new Set(enabledExtensionPluginIds);
2259
- const contexts = [{ label: "default" }];
2260
- for (const entry of params.cfg.agents?.list ?? []) {
2261
- if (!entry || typeof entry !== "object" || typeof entry.id !== "string") continue;
2262
- contexts.push({
2263
- label: `agents.list.${entry.id}`,
2264
- agentId: entry.id,
2265
- tools: entry.tools
2266
- });
2267
- }
2268
- const permissiveContexts = [];
2269
- for (const context of contexts) {
2270
- const profile = context.tools?.profile ?? params.cfg.tools?.profile;
2271
- const restrictiveProfile = Boolean(resolveToolProfilePolicy(profile));
2272
- const sandboxMode = resolveSandboxConfigForAgent(params.cfg, context.agentId).mode;
2273
- const broadPolicy = isToolAllowedByPolicies("__remoteclaw_plugin_probe__", resolveToolPolicies({
2274
- cfg: params.cfg,
2275
- agentTools: context.tools,
2276
- sandboxMode,
2277
- agentId: context.agentId
2278
- }));
2279
- const explicitPluginAllow = !restrictiveProfile && (hasExplicitPluginAllow({
2280
- allowEntries: collectAllowEntries(params.cfg.tools),
2281
- enabledPluginIds: enabledPluginSet
2282
- }) || hasProviderPluginAllow({
2283
- byProvider: params.cfg.tools?.byProvider,
2284
- enabledPluginIds: enabledPluginSet
2285
- }) || hasExplicitPluginAllow({
2286
- allowEntries: collectAllowEntries(context.tools),
2287
- enabledPluginIds: enabledPluginSet
2288
- }) || hasProviderPluginAllow({
2289
- byProvider: context.tools?.byProvider,
2290
- enabledPluginIds: enabledPluginSet
2291
- }));
2292
- if (broadPolicy || explicitPluginAllow) permissiveContexts.push(context.label);
2293
- }
2294
- if (permissiveContexts.length > 0) findings.push({
2295
- checkId: "plugins.tools_reachable_permissive_policy",
2296
- severity: "warn",
2297
- title: "Extension plugin tools may be reachable under permissive tool policy",
2298
- detail: `Enabled extension plugins: ${enabledExtensionPluginIds.join(", ")}.\nPermissive tool policy contexts:\n${permissiveContexts.map((entry) => `- ${entry}`).join("\n")}`,
2299
- remediation: "Use restrictive profiles (`minimal`/`coding`) or explicit tool allowlists that exclude plugin tools for agents handling untrusted input."
2300
- });
2301
- }
2302
- }
2303
- const pluginInstalls = params.cfg.plugins?.installs ?? {};
2304
- const npmPluginInstalls = Object.entries(pluginInstalls).filter(([, record]) => record?.source === "npm");
2305
- if (npmPluginInstalls.length > 0) {
2306
- const unpinned = npmPluginInstalls.filter(([, record]) => typeof record.spec === "string" && !isPinnedRegistrySpec(record.spec)).map(([pluginId, record]) => `${pluginId} (${record.spec})`);
2307
- if (unpinned.length > 0) findings.push({
2308
- checkId: "plugins.installs_unpinned_npm_specs",
2309
- severity: "warn",
2310
- title: "Plugin installs include unpinned npm specs",
2311
- detail: `Unpinned plugin install records:\n${unpinned.map((entry) => `- ${entry}`).join("\n")}`,
2312
- remediation: "Pin install specs to exact versions (for example, `@scope/pkg@1.2.3`) for higher supply-chain stability."
2313
- });
2314
- const missingIntegrity = npmPluginInstalls.filter(([, record]) => typeof record.integrity !== "string" || record.integrity.trim() === "").map(([pluginId]) => pluginId);
2315
- if (missingIntegrity.length > 0) findings.push({
2316
- checkId: "plugins.installs_missing_integrity",
2317
- severity: "warn",
2318
- title: "Plugin installs are missing integrity metadata",
2319
- detail: `Plugin install records missing integrity:\n${missingIntegrity.map((entry) => `- ${entry}`).join("\n")}`,
2320
- remediation: "Reinstall or update plugins to refresh install metadata with resolved integrity hashes."
2321
- });
2322
- const pluginVersionDrift = [];
2323
- for (const [pluginId, record] of npmPluginInstalls) {
2324
- const recordedVersion = record.resolvedVersion ?? record.version;
2325
- if (!recordedVersion) continue;
2326
- const installedVersion = await readInstalledPackageVersion(record.installPath ?? path.join(params.stateDir, "extensions", pluginId));
2327
- if (!installedVersion || installedVersion === recordedVersion) continue;
2328
- pluginVersionDrift.push(`${pluginId} (recorded ${recordedVersion}, installed ${installedVersion})`);
2329
- }
2330
- if (pluginVersionDrift.length > 0) findings.push({
2331
- checkId: "plugins.installs_version_drift",
2332
- severity: "warn",
2333
- title: "Plugin install records drift from installed package versions",
2334
- detail: `Detected plugin install metadata drift:\n${pluginVersionDrift.map((entry) => `- ${entry}`).join("\n")}`,
2335
- remediation: "Run `remoteclaw plugins update --all` (or reinstall affected plugins) to refresh install metadata."
2336
- });
2337
- }
2338
- const hookInstalls = params.cfg.hooks?.internal?.installs ?? {};
2339
- const npmHookInstalls = Object.entries(hookInstalls).filter(([, record]) => record?.source === "npm");
2340
- if (npmHookInstalls.length > 0) {
2341
- const unpinned = npmHookInstalls.filter(([, record]) => typeof record.spec === "string" && !isPinnedRegistrySpec(record.spec)).map(([hookId, record]) => `${hookId} (${record.spec})`);
2342
- if (unpinned.length > 0) findings.push({
2343
- checkId: "hooks.installs_unpinned_npm_specs",
2344
- severity: "warn",
2345
- title: "Hook installs include unpinned npm specs",
2346
- detail: `Unpinned hook install records:\n${unpinned.map((entry) => `- ${entry}`).join("\n")}`,
2347
- remediation: "Pin hook install specs to exact versions (for example, `@scope/pkg@1.2.3`) for higher supply-chain stability."
2348
- });
2349
- const missingIntegrity = npmHookInstalls.filter(([, record]) => typeof record.integrity !== "string" || record.integrity.trim() === "").map(([hookId]) => hookId);
2350
- if (missingIntegrity.length > 0) findings.push({
2351
- checkId: "hooks.installs_missing_integrity",
2352
- severity: "warn",
2353
- title: "Hook installs are missing integrity metadata",
2354
- detail: `Hook install records missing integrity:\n${missingIntegrity.map((entry) => `- ${entry}`).join("\n")}`,
2355
- remediation: "Reinstall or update hooks to refresh install metadata with resolved integrity hashes."
2356
- });
2357
- const hookVersionDrift = [];
2358
- for (const [hookId, record] of npmHookInstalls) {
2359
- const recordedVersion = record.resolvedVersion ?? record.version;
2360
- if (!recordedVersion) continue;
2361
- const installedVersion = await readInstalledPackageVersion(record.installPath ?? path.join(params.stateDir, "hooks", hookId));
2362
- if (!installedVersion || installedVersion === recordedVersion) continue;
2363
- hookVersionDrift.push(`${hookId} (recorded ${recordedVersion}, installed ${installedVersion})`);
2364
- }
2365
- if (hookVersionDrift.length > 0) findings.push({
2366
- checkId: "hooks.installs_version_drift",
2367
- severity: "warn",
2368
- title: "Hook install records drift from installed package versions",
2369
- detail: `Detected hook install metadata drift:\n${hookVersionDrift.map((entry) => `- ${entry}`).join("\n")}`,
2370
- remediation: "Run `remoteclaw hooks update --all` (or reinstall affected hooks) to refresh install metadata."
2371
- });
2372
- }
2373
- return findings;
2374
- }
2375
- async function collectIncludeFilePermFindings(params) {
2376
- const findings = [];
2377
- if (!params.configSnapshot.exists) return findings;
2378
- const configPath = params.configSnapshot.path;
2379
- const includePaths = await collectIncludePathsRecursive({
2380
- configPath,
2381
- parsed: params.configSnapshot.parsed
2382
- });
2383
- if (includePaths.length === 0) return findings;
2384
- for (const p of includePaths) {
2385
- const perms = await inspectPathPermissions(p, {
2386
- env: params.env,
2387
- platform: params.platform,
2388
- exec: params.execIcacls
2389
- });
2390
- if (!perms.ok) continue;
2391
- if (perms.worldWritable || perms.groupWritable) findings.push({
2392
- checkId: "fs.config_include.perms_writable",
2393
- severity: "critical",
2394
- title: "Config include file is writable by others",
2395
- detail: `${formatPermissionDetail(p, perms)}; another user could influence your effective config.`,
2396
- remediation: formatPermissionRemediation({
2397
- targetPath: p,
2398
- perms,
2399
- isDir: false,
2400
- posixMode: 384,
2401
- env: params.env
2402
- })
2403
- });
2404
- else if (perms.worldReadable) findings.push({
2405
- checkId: "fs.config_include.perms_world_readable",
2406
- severity: "critical",
2407
- title: "Config include file is world-readable",
2408
- detail: `${formatPermissionDetail(p, perms)}; include files can contain tokens and private settings.`,
2409
- remediation: formatPermissionRemediation({
2410
- targetPath: p,
2411
- perms,
2412
- isDir: false,
2413
- posixMode: 384,
2414
- env: params.env
2415
- })
2416
- });
2417
- else if (perms.groupReadable) findings.push({
2418
- checkId: "fs.config_include.perms_group_readable",
2419
- severity: "warn",
2420
- title: "Config include file is group-readable",
2421
- detail: `${formatPermissionDetail(p, perms)}; include files can contain tokens and private settings.`,
2422
- remediation: formatPermissionRemediation({
2423
- targetPath: p,
2424
- perms,
2425
- isDir: false,
2426
- posixMode: 384,
2427
- env: params.env
2428
- })
2429
- });
2430
- }
2431
- return findings;
2432
- }
2433
- async function collectStateDeepFilesystemFindings(params) {
2434
- const findings = [];
2435
- const oauthDir = resolveOAuthDir(params.env, params.stateDir);
2436
- const oauthPerms = await inspectPathPermissions(oauthDir, {
2437
- env: params.env,
2438
- platform: params.platform,
2439
- exec: params.execIcacls
2440
- });
2441
- if (oauthPerms.ok && oauthPerms.isDir) {
2442
- if (oauthPerms.worldWritable || oauthPerms.groupWritable) findings.push({
2443
- checkId: "fs.credentials_dir.perms_writable",
2444
- severity: "critical",
2445
- title: "Credentials dir is writable by others",
2446
- detail: `${formatPermissionDetail(oauthDir, oauthPerms)}; another user could drop/modify credential files.`,
2447
- remediation: formatPermissionRemediation({
2448
- targetPath: oauthDir,
2449
- perms: oauthPerms,
2450
- isDir: true,
2451
- posixMode: 448,
2452
- env: params.env
2453
- })
2454
- });
2455
- else if (oauthPerms.groupReadable || oauthPerms.worldReadable) findings.push({
2456
- checkId: "fs.credentials_dir.perms_readable",
2457
- severity: "warn",
2458
- title: "Credentials dir is readable by others",
2459
- detail: `${formatPermissionDetail(oauthDir, oauthPerms)}; credentials and allowlists can be sensitive.`,
2460
- remediation: formatPermissionRemediation({
2461
- targetPath: oauthDir,
2462
- perms: oauthPerms,
2463
- isDir: true,
2464
- posixMode: 448,
2465
- env: params.env
2466
- })
2467
- });
2468
- }
2469
- const agentIds = Array.isArray(params.cfg.agents?.list) ? params.cfg.agents?.list.map((a) => a && typeof a === "object" && typeof a.id === "string" ? a.id.trim() : "").filter(Boolean) : [];
2470
- const defaultAgentId = resolveDefaultAgentId(params.cfg);
2471
- const ids = Array.from(new Set([defaultAgentId, ...agentIds])).map((id) => normalizeAgentId(id));
2472
- for (const agentId of ids) {
2473
- const agentDir = path.join(params.stateDir, "agents", agentId, "agent");
2474
- const authPath = path.join(agentDir, "auth-profiles.json");
2475
- const authPerms = await inspectPathPermissions(authPath, {
2476
- env: params.env,
2477
- platform: params.platform,
2478
- exec: params.execIcacls
2479
- });
2480
- if (authPerms.ok) {
2481
- if (authPerms.worldWritable || authPerms.groupWritable) findings.push({
2482
- checkId: "fs.auth_profiles.perms_writable",
2483
- severity: "critical",
2484
- title: "auth-profiles.json is writable by others",
2485
- detail: `${formatPermissionDetail(authPath, authPerms)}; another user could inject credentials.`,
2486
- remediation: formatPermissionRemediation({
2487
- targetPath: authPath,
2488
- perms: authPerms,
2489
- isDir: false,
2490
- posixMode: 384,
2491
- env: params.env
2492
- })
2493
- });
2494
- else if (authPerms.worldReadable || authPerms.groupReadable) findings.push({
2495
- checkId: "fs.auth_profiles.perms_readable",
2496
- severity: "warn",
2497
- title: "auth-profiles.json is readable by others",
2498
- detail: `${formatPermissionDetail(authPath, authPerms)}; auth-profiles.json contains API keys and OAuth tokens.`,
2499
- remediation: formatPermissionRemediation({
2500
- targetPath: authPath,
2501
- perms: authPerms,
2502
- isDir: false,
2503
- posixMode: 384,
2504
- env: params.env
2505
- })
2506
- });
2507
- }
2508
- const storePath = path.join(params.stateDir, "agents", agentId, "sessions", "sessions.json");
2509
- const storePerms = await inspectPathPermissions(storePath, {
2510
- env: params.env,
2511
- platform: params.platform,
2512
- exec: params.execIcacls
2513
- });
2514
- if (storePerms.ok) {
2515
- if (storePerms.worldReadable || storePerms.groupReadable) findings.push({
2516
- checkId: "fs.sessions_store.perms_readable",
2517
- severity: "warn",
2518
- title: "sessions.json is readable by others",
2519
- detail: `${formatPermissionDetail(storePath, storePerms)}; routing and transcript metadata can be sensitive.`,
2520
- remediation: formatPermissionRemediation({
2521
- targetPath: storePath,
2522
- perms: storePerms,
2523
- isDir: false,
2524
- posixMode: 384,
2525
- env: params.env
2526
- })
2527
- });
2528
- }
2529
- }
2530
- const logFile = typeof params.cfg.logging?.file === "string" ? params.cfg.logging.file.trim() : "";
2531
- if (logFile) {
2532
- const expanded = logFile.startsWith("~") ? expandTilde(logFile, params.env) : logFile;
2533
- if (expanded) {
2534
- const logPath = path.resolve(expanded);
2535
- const logPerms = await inspectPathPermissions(logPath, {
2536
- env: params.env,
2537
- platform: params.platform,
2538
- exec: params.execIcacls
2539
- });
2540
- if (logPerms.ok) {
2541
- if (logPerms.worldReadable || logPerms.groupReadable) findings.push({
2542
- checkId: "fs.log_file.perms_readable",
2543
- severity: "warn",
2544
- title: "Log file is readable by others",
2545
- detail: `${formatPermissionDetail(logPath, logPerms)}; logs can contain private messages and tool output.`,
2546
- remediation: formatPermissionRemediation({
2547
- targetPath: logPath,
2548
- perms: logPerms,
2549
- isDir: false,
2550
- posixMode: 384,
2551
- env: params.env
2552
- })
2553
- });
2554
- }
2555
- }
2556
- }
2557
- return findings;
2558
- }
2559
- async function readConfigSnapshotForAudit(params) {
2560
- return await createConfigIO({
2561
- env: params.env,
2562
- configPath: params.configPath
2563
- }).readConfigFileSnapshot();
2564
- }
2565
- async function collectPluginsCodeSafetyFindings(params) {
2566
- const findings = [];
2567
- const { extensionsDir, pluginDirs } = await listInstalledPluginDirs({
2568
- stateDir: params.stateDir,
2569
- onReadError: (err) => {
2570
- findings.push({
2571
- checkId: "plugins.code_safety.scan_failed",
2572
- severity: "warn",
2573
- title: "Plugin extensions directory scan failed",
2574
- detail: `Static code scan could not list extensions directory: ${String(err)}`,
2575
- remediation: "Check file permissions and plugin layout, then rerun `remoteclaw security audit --deep`."
2576
- });
2577
- }
2578
- });
2579
- for (const pluginName of pluginDirs) {
2580
- const pluginPath = path.join(extensionsDir, pluginName);
2581
- const extensionEntries = await readPluginManifestExtensions(pluginPath).catch(() => []);
2582
- const forcedScanEntries = [];
2583
- const escapedEntries = [];
2584
- for (const entry of extensionEntries) {
2585
- const resolvedEntry = path.resolve(pluginPath, entry);
2586
- if (!isPathInside(pluginPath, resolvedEntry)) {
2587
- escapedEntries.push(entry);
2588
- continue;
2589
- }
2590
- if (extensionUsesSkippedScannerPath(entry)) findings.push({
2591
- checkId: "plugins.code_safety.entry_path",
2592
- severity: "warn",
2593
- title: `Plugin "${pluginName}" entry path is hidden or node_modules`,
2594
- detail: `Extension entry "${entry}" points to a hidden or node_modules path. Deep code scan will cover this entry explicitly, but review this path choice carefully.`,
2595
- remediation: "Prefer extension entrypoints under normal source paths like dist/ or src/."
2596
- });
2597
- forcedScanEntries.push(resolvedEntry);
2598
- }
2599
- if (escapedEntries.length > 0) findings.push({
2600
- checkId: "plugins.code_safety.entry_escape",
2601
- severity: "critical",
2602
- title: `Plugin "${pluginName}" has extension entry path traversal`,
2603
- detail: `Found extension entries that escape the plugin directory:\n${escapedEntries.map((entry) => ` - ${entry}`).join("\n")}`,
2604
- remediation: "Update the plugin manifest so all remoteclaw.extensions entries stay inside the plugin directory."
2605
- });
2606
- }
2607
- return findings;
2608
- }
2609
-
2610
- //#endregion
2611
- //#region src/security/dangerous-config-flags.ts
2612
- function collectEnabledInsecureOrDangerousFlags(cfg) {
2613
- const enabledFlags = [];
2614
- if (cfg.gateway?.controlUi?.allowInsecureAuth === true) enabledFlags.push("gateway.controlUi.allowInsecureAuth=true");
2615
- if (cfg.gateway?.controlUi?.dangerouslyAllowHostHeaderOriginFallback === true) enabledFlags.push("gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true");
2616
- if (cfg.gateway?.controlUi?.dangerouslyDisableDeviceAuth === true) enabledFlags.push("gateway.controlUi.dangerouslyDisableDeviceAuth=true");
2617
- if (cfg.hooks?.gmail?.allowUnsafeExternalContent === true) enabledFlags.push("hooks.gmail.allowUnsafeExternalContent=true");
2618
- if (Array.isArray(cfg.hooks?.mappings)) {
2619
- for (const [index, mapping] of cfg.hooks.mappings.entries()) if (mapping?.allowUnsafeExternalContent === true) enabledFlags.push(`hooks.mappings[${index}].allowUnsafeExternalContent=true`);
2620
- }
2621
- return enabledFlags;
2622
- }
2623
-
2624
- //#endregion
2625
- //#region src/security/audit.ts
2626
- function countBySeverity(findings) {
2627
- let critical = 0;
2628
- let warn = 0;
2629
- let info = 0;
2630
- for (const f of findings) if (f.severity === "critical") critical += 1;
2631
- else if (f.severity === "warn") warn += 1;
2632
- else info += 1;
2633
- return {
2634
- critical,
2635
- warn,
2636
- info
2637
- };
2638
- }
2639
- function normalizeAllowFromList(list) {
2640
- if (!Array.isArray(list)) return [];
2641
- return list.map((v) => String(v).trim()).filter(Boolean);
2642
- }
2643
- async function collectFilesystemFindings(params) {
2644
- const findings = [];
2645
- const stateDirPerms = await inspectPathPermissions(params.stateDir, {
2646
- env: params.env,
2647
- platform: params.platform,
2648
- exec: params.execIcacls
2649
- });
2650
- if (stateDirPerms.ok) {
2651
- if (stateDirPerms.isSymlink) findings.push({
2652
- checkId: "fs.state_dir.symlink",
2653
- severity: "warn",
2654
- title: "State dir is a symlink",
2655
- detail: `${params.stateDir} is a symlink; treat this as an extra trust boundary.`
2656
- });
2657
- if (stateDirPerms.worldWritable) findings.push({
2658
- checkId: "fs.state_dir.perms_world_writable",
2659
- severity: "critical",
2660
- title: "State dir is world-writable",
2661
- detail: `${formatPermissionDetail(params.stateDir, stateDirPerms)}; other users can write into your RemoteClaw state.`,
2662
- remediation: formatPermissionRemediation({
2663
- targetPath: params.stateDir,
2664
- perms: stateDirPerms,
2665
- isDir: true,
2666
- posixMode: 448,
2667
- env: params.env
2668
- })
2669
- });
2670
- else if (stateDirPerms.groupWritable) findings.push({
2671
- checkId: "fs.state_dir.perms_group_writable",
2672
- severity: "warn",
2673
- title: "State dir is group-writable",
2674
- detail: `${formatPermissionDetail(params.stateDir, stateDirPerms)}; group users can write into your RemoteClaw state.`,
2675
- remediation: formatPermissionRemediation({
2676
- targetPath: params.stateDir,
2677
- perms: stateDirPerms,
2678
- isDir: true,
2679
- posixMode: 448,
2680
- env: params.env
2681
- })
2682
- });
2683
- else if (stateDirPerms.groupReadable || stateDirPerms.worldReadable) findings.push({
2684
- checkId: "fs.state_dir.perms_readable",
2685
- severity: "warn",
2686
- title: "State dir is readable by others",
2687
- detail: `${formatPermissionDetail(params.stateDir, stateDirPerms)}; consider restricting to 700.`,
2688
- remediation: formatPermissionRemediation({
2689
- targetPath: params.stateDir,
2690
- perms: stateDirPerms,
2691
- isDir: true,
2692
- posixMode: 448,
2693
- env: params.env
2694
- })
2695
- });
2696
- }
2697
- const configPerms = await inspectPathPermissions(params.configPath, {
2698
- env: params.env,
2699
- platform: params.platform,
2700
- exec: params.execIcacls
2701
- });
2702
- if (configPerms.ok) {
2703
- const skipReadablePermWarnings = configPerms.isSymlink;
2704
- if (configPerms.isSymlink) findings.push({
2705
- checkId: "fs.config.symlink",
2706
- severity: "warn",
2707
- title: "Config file is a symlink",
2708
- detail: `${params.configPath} is a symlink; make sure you trust its target.`
2709
- });
2710
- if (configPerms.worldWritable || configPerms.groupWritable) findings.push({
2711
- checkId: "fs.config.perms_writable",
2712
- severity: "critical",
2713
- title: "Config file is writable by others",
2714
- detail: `${formatPermissionDetail(params.configPath, configPerms)}; another user could change gateway/auth/tool policies.`,
2715
- remediation: formatPermissionRemediation({
2716
- targetPath: params.configPath,
2717
- perms: configPerms,
2718
- isDir: false,
2719
- posixMode: 384,
2720
- env: params.env
2721
- })
2722
- });
2723
- else if (!skipReadablePermWarnings && configPerms.worldReadable) findings.push({
2724
- checkId: "fs.config.perms_world_readable",
2725
- severity: "critical",
2726
- title: "Config file is world-readable",
2727
- detail: `${formatPermissionDetail(params.configPath, configPerms)}; config can contain tokens and private settings.`,
2728
- remediation: formatPermissionRemediation({
2729
- targetPath: params.configPath,
2730
- perms: configPerms,
2731
- isDir: false,
2732
- posixMode: 384,
2733
- env: params.env
2734
- })
2735
- });
2736
- else if (!skipReadablePermWarnings && configPerms.groupReadable) findings.push({
2737
- checkId: "fs.config.perms_group_readable",
2738
- severity: "warn",
2739
- title: "Config file is group-readable",
2740
- detail: `${formatPermissionDetail(params.configPath, configPerms)}; config can contain tokens and private settings.`,
2741
- remediation: formatPermissionRemediation({
2742
- targetPath: params.configPath,
2743
- perms: configPerms,
2744
- isDir: false,
2745
- posixMode: 384,
2746
- env: params.env
2747
- })
2748
- });
2749
- }
2750
- return findings;
2751
- }
2752
- function collectGatewayConfigFindings(cfg, env) {
2753
- const findings = [];
2754
- const bind = typeof cfg.gateway?.bind === "string" ? cfg.gateway.bind : "loopback";
2755
- const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off";
2756
- const auth = resolveGatewayAuth({
2757
- authConfig: cfg.gateway?.auth,
2758
- tailscaleMode,
2759
- env
2760
- });
2761
- const controlUiEnabled = cfg.gateway?.controlUi?.enabled !== false;
2762
- const controlUiAllowedOrigins = (cfg.gateway?.controlUi?.allowedOrigins ?? []).map((value) => value.trim()).filter(Boolean);
2763
- const dangerouslyAllowHostHeaderOriginFallback = cfg.gateway?.controlUi?.dangerouslyAllowHostHeaderOriginFallback === true;
2764
- const trustedProxies = Array.isArray(cfg.gateway?.trustedProxies) ? cfg.gateway.trustedProxies : [];
2765
- const hasToken = typeof auth.token === "string" && auth.token.trim().length > 0;
2766
- const hasPassword = typeof auth.password === "string" && auth.password.trim().length > 0;
2767
- const hasSharedSecret = auth.mode === "token" && hasToken || auth.mode === "password" && hasPassword;
2768
- const hasTailscaleAuth = auth.allowTailscale && tailscaleMode === "serve";
2769
- const hasGatewayAuth = hasSharedSecret || hasTailscaleAuth;
2770
- const allowRealIpFallback = cfg.gateway?.allowRealIpFallback === true;
2771
- const mdnsMode = cfg.discovery?.mdns?.mode ?? "minimal";
2772
- const gatewayToolsAllowRaw = Array.isArray(cfg.gateway?.tools?.allow) ? cfg.gateway?.tools?.allow : [];
2773
- const gatewayToolsAllow = new Set(gatewayToolsAllowRaw.map((v) => typeof v === "string" ? v.trim().toLowerCase() : "").filter(Boolean));
2774
- const reenabledOverHttp = DEFAULT_GATEWAY_HTTP_TOOL_DENY.filter((name) => gatewayToolsAllow.has(name));
2775
- if (reenabledOverHttp.length > 0) {
2776
- const extraRisk = bind !== "loopback" || tailscaleMode === "funnel";
2777
- findings.push({
2778
- checkId: "gateway.tools_invoke_http.dangerous_allow",
2779
- severity: extraRisk ? "critical" : "warn",
2780
- title: "Gateway HTTP /tools/invoke re-enables dangerous tools",
2781
- detail: `gateway.tools.allow includes ${reenabledOverHttp.join(", ")} which removes them from the default HTTP deny list. This can allow remote session spawning / control-plane actions via HTTP and increases RCE blast radius if the gateway is reachable.`,
2782
- remediation: "Remove these entries from gateway.tools.allow (recommended). If you keep them enabled, keep gateway.bind loopback-only (or tailnet-only), restrict network exposure, and treat the gateway token/password as full-admin."
2783
- });
2784
- }
2785
- if (bind !== "loopback" && !hasSharedSecret && auth.mode !== "trusted-proxy") findings.push({
2786
- checkId: "gateway.bind_no_auth",
2787
- severity: "critical",
2788
- title: "Gateway binds beyond loopback without auth",
2789
- detail: `gateway.bind="${bind}" but no gateway.auth token/password is configured.`,
2790
- remediation: `Set gateway.auth (token recommended) or bind to loopback.`
2791
- });
2792
- if (bind === "loopback" && controlUiEnabled && trustedProxies.length === 0) findings.push({
2793
- checkId: "gateway.trusted_proxies_missing",
2794
- severity: "warn",
2795
- title: "Reverse proxy headers are not trusted",
2796
- detail: "gateway.bind is loopback and gateway.trustedProxies is empty. If you expose the Control UI through a reverse proxy, configure trusted proxies so local-client checks cannot be spoofed.",
2797
- remediation: "Set gateway.trustedProxies to your proxy IPs or keep the Control UI local-only."
2798
- });
2799
- if (bind === "loopback" && controlUiEnabled && !hasGatewayAuth) findings.push({
2800
- checkId: "gateway.loopback_no_auth",
2801
- severity: "critical",
2802
- title: "Gateway auth missing on loopback",
2803
- detail: "gateway.bind is loopback but no gateway auth secret is configured. If the Control UI is exposed through a reverse proxy, unauthenticated access is possible.",
2804
- remediation: "Set gateway.auth (token recommended) or keep the Control UI local-only."
2805
- });
2806
- if (bind !== "loopback" && controlUiEnabled && controlUiAllowedOrigins.length === 0 && !dangerouslyAllowHostHeaderOriginFallback) findings.push({
2807
- checkId: "gateway.control_ui.allowed_origins_required",
2808
- severity: "critical",
2809
- title: "Non-loopback Control UI missing explicit allowed origins",
2810
- detail: "Control UI is enabled on a non-loopback bind but gateway.controlUi.allowedOrigins is empty. Strict origin policy requires explicit allowed origins for non-loopback deployments.",
2811
- remediation: "Set gateway.controlUi.allowedOrigins to full trusted origins (for example https://control.example.com). If your deployment intentionally relies on Host-header origin fallback, set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true."
2812
- });
2813
- if (dangerouslyAllowHostHeaderOriginFallback) {
2814
- const exposed = bind !== "loopback";
2815
- findings.push({
2816
- checkId: "gateway.control_ui.host_header_origin_fallback",
2817
- severity: exposed ? "critical" : "warn",
2818
- title: "DANGEROUS: Host-header origin fallback enabled",
2819
- detail: "gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true enables Host-header origin fallback for Control UI/WebChat websocket checks and weakens DNS rebinding protections.",
2820
- remediation: "Disable gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback and configure explicit gateway.controlUi.allowedOrigins."
2821
- });
2822
- }
2823
- if (allowRealIpFallback) {
2824
- const hasNonLoopbackTrustedProxy = trustedProxies.some((proxy) => !isStrictLoopbackTrustedProxyEntry(proxy));
2825
- const exposed = bind !== "loopback" || auth.mode === "trusted-proxy" && hasNonLoopbackTrustedProxy;
2826
- findings.push({
2827
- checkId: "gateway.real_ip_fallback_enabled",
2828
- severity: exposed ? "critical" : "warn",
2829
- title: "X-Real-IP fallback is enabled",
2830
- detail: "gateway.allowRealIpFallback=true trusts X-Real-IP when trusted proxies omit X-Forwarded-For. Misconfigured proxies that forward client-supplied X-Real-IP can spoof source IP and local-client checks.",
2831
- remediation: "Keep gateway.allowRealIpFallback=false (default). Only enable this when your trusted proxy always overwrites X-Real-IP and cannot provide X-Forwarded-For."
2832
- });
2833
- }
2834
- if (mdnsMode === "full") {
2835
- const exposed = bind !== "loopback";
2836
- findings.push({
2837
- checkId: "discovery.mdns_full_mode",
2838
- severity: exposed ? "critical" : "warn",
2839
- title: "mDNS full mode can leak host metadata",
2840
- detail: "discovery.mdns.mode=\"full\" publishes cliPath/sshPort in local-network TXT records. This can reveal usernames, filesystem layout, and management ports.",
2841
- remediation: "Prefer discovery.mdns.mode=\"minimal\" (recommended) or \"off\", especially when gateway.bind is not loopback."
2842
- });
2843
- }
2844
- if (tailscaleMode === "funnel") findings.push({
2845
- checkId: "gateway.tailscale_funnel",
2846
- severity: "critical",
2847
- title: "Tailscale Funnel exposure enabled",
2848
- detail: `gateway.tailscale.mode="funnel" exposes the Gateway publicly; keep auth strict and treat it as internet-facing.`,
2849
- remediation: `Prefer tailscale.mode="serve" (tailnet-only) or set tailscale.mode="off".`
2850
- });
2851
- else if (tailscaleMode === "serve") findings.push({
2852
- checkId: "gateway.tailscale_serve",
2853
- severity: "info",
2854
- title: "Tailscale Serve exposure enabled",
2855
- detail: `gateway.tailscale.mode="serve" exposes the Gateway to your tailnet (loopback behind Tailscale).`
2856
- });
2857
- if (cfg.gateway?.controlUi?.allowInsecureAuth === true) findings.push({
2858
- checkId: "gateway.control_ui.insecure_auth",
2859
- severity: "warn",
2860
- title: "Control UI insecure auth toggle enabled",
2861
- detail: "gateway.controlUi.allowInsecureAuth=true does not bypass secure context or device identity checks; only dangerouslyDisableDeviceAuth disables Control UI device identity checks.",
2862
- remediation: "Disable it or switch to HTTPS (Tailscale Serve) or localhost."
2863
- });
2864
- if (cfg.gateway?.controlUi?.dangerouslyDisableDeviceAuth === true) findings.push({
2865
- checkId: "gateway.control_ui.device_auth_disabled",
2866
- severity: "critical",
2867
- title: "DANGEROUS: Control UI device auth disabled",
2868
- detail: "gateway.controlUi.dangerouslyDisableDeviceAuth=true disables device identity checks for the Control UI.",
2869
- remediation: "Disable it unless you are in a short-lived break-glass scenario."
2870
- });
2871
- const enabledDangerousFlags = collectEnabledInsecureOrDangerousFlags(cfg);
2872
- if (enabledDangerousFlags.length > 0) findings.push({
2873
- checkId: "config.insecure_or_dangerous_flags",
2874
- severity: "warn",
2875
- title: "Insecure or dangerous config flags enabled",
2876
- detail: `Detected ${enabledDangerousFlags.length} enabled flag(s): ${enabledDangerousFlags.join(", ")}.`,
2877
- remediation: "Disable these flags when not actively debugging, or keep deployment scoped to trusted/local-only networks."
2878
- });
2879
- const token = typeof auth.token === "string" && auth.token.trim().length > 0 ? auth.token.trim() : null;
2880
- if (auth.mode === "token" && token && token.length < 24) findings.push({
2881
- checkId: "gateway.token_too_short",
2882
- severity: "warn",
2883
- title: "Gateway token looks short",
2884
- detail: `gateway auth token is ${token.length} chars; prefer a long random token.`
2885
- });
2886
- if (auth.mode === "trusted-proxy") {
2887
- const trustedProxies = cfg.gateway?.trustedProxies ?? [];
2888
- const trustedProxyConfig = cfg.gateway?.auth?.trustedProxy;
2889
- findings.push({
2890
- checkId: "gateway.trusted_proxy_auth",
2891
- severity: "critical",
2892
- title: "Trusted-proxy auth mode enabled",
2893
- detail: "gateway.auth.mode=\"trusted-proxy\" delegates authentication to a reverse proxy. Ensure your proxy (Pomerium, Caddy, nginx) handles auth correctly and that gateway.trustedProxies only contains IPs of your actual proxy servers.",
2894
- remediation: "Verify: (1) Your proxy terminates TLS and authenticates users. (2) gateway.trustedProxies is restricted to proxy IPs only. (3) Direct access to the Gateway port is blocked by firewall. See /gateway/trusted-proxy-auth for setup guidance."
2895
- });
2896
- if (trustedProxies.length === 0) findings.push({
2897
- checkId: "gateway.trusted_proxy_no_proxies",
2898
- severity: "critical",
2899
- title: "Trusted-proxy auth enabled but no trusted proxies configured",
2900
- detail: "gateway.auth.mode=\"trusted-proxy\" but gateway.trustedProxies is empty. All requests will be rejected.",
2901
- remediation: "Set gateway.trustedProxies to the IP(s) of your reverse proxy."
2902
- });
2903
- if (!trustedProxyConfig?.userHeader) findings.push({
2904
- checkId: "gateway.trusted_proxy_no_user_header",
2905
- severity: "critical",
2906
- title: "Trusted-proxy auth missing userHeader config",
2907
- detail: "gateway.auth.mode=\"trusted-proxy\" but gateway.auth.trustedProxy.userHeader is not configured.",
2908
- remediation: "Set gateway.auth.trustedProxy.userHeader to the header name your proxy uses (e.g., \"x-forwarded-user\", \"x-pomerium-claim-email\")."
2909
- });
2910
- if ((trustedProxyConfig?.allowUsers ?? []).length === 0) findings.push({
2911
- checkId: "gateway.trusted_proxy_no_allowlist",
2912
- severity: "warn",
2913
- title: "Trusted-proxy auth allows all authenticated users",
2914
- detail: "gateway.auth.trustedProxy.allowUsers is empty, so any user authenticated by your proxy can access the Gateway.",
2915
- remediation: "Consider setting gateway.auth.trustedProxy.allowUsers to restrict access to specific users (e.g., [\"nick@example.com\"])."
2916
- });
2917
- }
2918
- if (bind !== "loopback" && auth.mode !== "trusted-proxy" && !cfg.gateway?.auth?.rateLimit) findings.push({
2919
- checkId: "gateway.auth_no_rate_limit",
2920
- severity: "warn",
2921
- title: "No auth rate limiting configured",
2922
- detail: "gateway.bind is not loopback but no gateway.auth.rateLimit is configured. Without rate limiting, brute-force auth attacks are not mitigated.",
2923
- remediation: "Set gateway.auth.rateLimit (e.g. { maxAttempts: 10, windowMs: 60000, lockoutMs: 300000 })."
2924
- });
2925
- return findings;
2926
- }
2927
- function isStrictLoopbackTrustedProxyEntry(entry) {
2928
- const candidate = entry.trim();
2929
- if (!candidate) return false;
2930
- if (!candidate.includes("/")) return candidate === "127.0.0.1" || candidate.toLowerCase() === "::1";
2931
- const [rawIp, rawPrefix] = candidate.split("/", 2);
2932
- if (!rawIp || !rawPrefix) return false;
2933
- const ipVersion = isIP(rawIp.trim());
2934
- const prefix = Number.parseInt(rawPrefix.trim(), 10);
2935
- if (!Number.isInteger(prefix)) return false;
2936
- if (ipVersion === 4) return rawIp.trim() === "127.0.0.1" && prefix === 32;
2937
- if (ipVersion === 6) return prefix === 128 && rawIp.trim().toLowerCase() === "::1";
2938
- return false;
2939
- }
2940
- function collectBrowserControlFindings(cfg, env) {
2941
- const findings = [];
2942
- let resolved;
2943
- try {
2944
- resolved = resolveBrowserConfig(cfg.browser, cfg);
2945
- } catch (err) {
2946
- findings.push({
2947
- checkId: "browser.control_invalid_config",
2948
- severity: "warn",
2949
- title: "Browser control config looks invalid",
2950
- detail: String(err),
2951
- remediation: `Fix browser.cdpUrl in ${resolveConfigPath()} and re-run "${formatCliCommand("remoteclaw security audit --deep")}".`
2952
- });
2953
- return findings;
2954
- }
2955
- if (!resolved.enabled) return findings;
2956
- const browserAuth = resolveBrowserControlAuth(cfg, env);
2957
- if (!browserAuth.token && !browserAuth.password) findings.push({
2958
- checkId: "browser.control_no_auth",
2959
- severity: "critical",
2960
- title: "Browser control has no auth",
2961
- detail: "Browser control HTTP routes are enabled but no gateway.auth token/password is configured. Any local process (or SSRF to loopback) can call browser control endpoints.",
2962
- remediation: "Set gateway.auth.token (recommended) or gateway.auth.password so browser control HTTP routes require authentication. Restarting the gateway will auto-generate gateway.auth.token when browser control is enabled."
2963
- });
2964
- for (const name of Object.keys(resolved.profiles)) {
2965
- const profile = resolveProfile(resolved, name);
2966
- if (!profile || profile.cdpIsLoopback) continue;
2967
- let url;
2968
- try {
2969
- url = new URL(profile.cdpUrl);
2970
- } catch {
2971
- continue;
2972
- }
2973
- if (url.protocol === "http:") findings.push({
2974
- checkId: "browser.remote_cdp_http",
2975
- severity: "warn",
2976
- title: "Remote CDP uses HTTP",
2977
- detail: `browser profile "${name}" uses http CDP (${profile.cdpUrl}); this is OK only if it's tailnet-only or behind an encrypted tunnel.`,
2978
- remediation: `Prefer HTTPS/TLS or a tailnet-only endpoint for remote CDP.`
2979
- });
2980
- }
2981
- return findings;
2982
- }
2983
- function collectLoggingFindings(cfg) {
2984
- if (cfg.logging?.redactSensitive !== "off") return [];
2985
- return [{
2986
- checkId: "logging.redact_off",
2987
- severity: "warn",
2988
- title: "Tool summary redaction is disabled",
2989
- detail: `logging.redactSensitive="off" can leak secrets into logs and status output.`,
2990
- remediation: `Set logging.redactSensitive="tools".`
2991
- }];
2992
- }
2993
- function collectElevatedFindings(cfg) {
2994
- const findings = [];
2995
- const enabled = cfg.tools?.elevated?.enabled;
2996
- const allowFrom = cfg.tools?.elevated?.allowFrom ?? {};
2997
- const anyAllowFromKeys = Object.keys(allowFrom).length > 0;
2998
- if (enabled === false) return findings;
2999
- if (!anyAllowFromKeys) return findings;
3000
- for (const [provider, list] of Object.entries(allowFrom)) {
3001
- const normalized = normalizeAllowFromList(list);
3002
- if (normalized.includes("*")) findings.push({
3003
- checkId: `tools.elevated.allowFrom.${provider}.wildcard`,
3004
- severity: "critical",
3005
- title: "Elevated exec allowlist contains wildcard",
3006
- detail: `tools.elevated.allowFrom.${provider} includes "*" which effectively approves everyone on that channel for elevated mode.`
3007
- });
3008
- else if (normalized.length > 25) findings.push({
3009
- checkId: `tools.elevated.allowFrom.${provider}.large`,
3010
- severity: "warn",
3011
- title: "Elevated exec allowlist is large",
3012
- detail: `tools.elevated.allowFrom.${provider} has ${normalized.length} entries; consider tightening elevated access.`
3013
- });
3014
- }
3015
- return findings;
3016
- }
3017
- async function maybeProbeGateway(params) {
3018
- const url = buildGatewayConnectionDetails({ config: params.cfg }).url;
3019
- const isRemoteMode = params.cfg.gateway?.mode === "remote";
3020
- const remoteUrlRaw = typeof params.cfg.gateway?.remote?.url === "string" ? params.cfg.gateway.remote.url.trim() : "";
3021
- const auth = !isRemoteMode || isRemoteMode && !remoteUrlRaw ? resolveGatewayProbeAuth({
3022
- cfg: params.cfg,
3023
- env: params.env,
3024
- mode: "local"
3025
- }) : resolveGatewayProbeAuth({
3026
- cfg: params.cfg,
3027
- env: params.env,
3028
- mode: "remote"
3029
- });
3030
- const res = await params.probe({
3031
- url,
3032
- auth,
3033
- timeoutMs: params.timeoutMs
3034
- }).catch((err) => ({
3035
- ok: false,
3036
- url,
3037
- connectLatencyMs: null,
3038
- error: String(err),
3039
- close: null,
3040
- health: null,
3041
- status: null,
3042
- presence: null,
3043
- configSnapshot: null
3044
- }));
3045
- return { gateway: {
3046
- attempted: true,
3047
- url,
3048
- ok: res.ok,
3049
- error: res.ok ? null : res.error,
3050
- close: res.close ? {
3051
- code: res.close.code,
3052
- reason: res.close.reason
3053
- } : null
3054
- } };
3055
- }
3056
- async function runSecurityAudit(opts) {
3057
- const findings = [];
3058
- const cfg = opts.config;
3059
- const env = opts.env ?? process.env;
3060
- const platform = opts.platform ?? process.platform;
3061
- const execIcacls = opts.execIcacls;
3062
- const stateDir = opts.stateDir ?? resolveStateDir(env);
3063
- const configPath = opts.configPath ?? resolveConfigPath(env, stateDir);
3064
- findings.push(...collectAttackSurfaceSummaryFindings(cfg));
3065
- findings.push(...collectSyncedFolderFindings({
3066
- stateDir,
3067
- configPath
3068
- }));
3069
- findings.push(...collectGatewayConfigFindings(cfg, env));
3070
- findings.push(...collectBrowserControlFindings(cfg, env));
3071
- findings.push(...collectLoggingFindings(cfg));
3072
- findings.push(...collectElevatedFindings(cfg));
3073
- findings.push(...collectHooksHardeningFindings(cfg, env));
3074
- findings.push(...collectGatewayHttpNoAuthFindings(cfg, env));
3075
- findings.push(...collectGatewayHttpSessionKeyOverrideFindings(cfg));
3076
- findings.push(...collectSandboxDockerNoopFindings(cfg));
3077
- findings.push(...collectSandboxDangerousConfigFindings(cfg));
3078
- findings.push(...collectNodeDenyCommandPatternFindings(cfg));
3079
- findings.push(...collectNodeDangerousAllowCommandFindings(cfg));
3080
- findings.push(...collectMinimalProfileOverrideFindings(cfg));
3081
- findings.push(...collectSecretsInConfigFindings(cfg));
3082
- findings.push(...collectModelHygieneFindings(cfg));
3083
- findings.push(...collectSmallModelRiskFindings({
3084
- cfg,
3085
- env
3086
- }));
3087
- findings.push(...collectExposureMatrixFindings(cfg));
3088
- findings.push(...collectLikelyMultiUserSetupFindings(cfg));
3089
- const configSnapshot = opts.includeFilesystem !== false ? await readConfigSnapshotForAudit({
3090
- env,
3091
- configPath
3092
- }).catch(() => null) : null;
3093
- if (opts.includeFilesystem !== false) {
3094
- findings.push(...await collectFilesystemFindings({
3095
- stateDir,
3096
- configPath,
3097
- env,
3098
- platform,
3099
- execIcacls
3100
- }));
3101
- if (configSnapshot) findings.push(...await collectIncludeFilePermFindings({
3102
- configSnapshot,
3103
- env,
3104
- platform,
3105
- execIcacls
3106
- }));
3107
- findings.push(...await collectStateDeepFilesystemFindings({
3108
- cfg,
3109
- env,
3110
- stateDir,
3111
- platform,
3112
- execIcacls
3113
- }));
3114
- findings.push(...await collectPluginsTrustFindings({
3115
- cfg,
3116
- stateDir
3117
- }));
3118
- if (opts.deep === true) findings.push(...await collectPluginsCodeSafetyFindings({ stateDir }));
3119
- }
3120
- if (opts.includeChannelSecurity !== false) {
3121
- const plugins = opts.plugins ?? listChannelPlugins();
3122
- findings.push(...await collectChannelSecurityFindings({
3123
- cfg,
3124
- plugins
3125
- }));
3126
- }
3127
- const deep = opts.deep === true ? await maybeProbeGateway({
3128
- cfg,
3129
- env,
3130
- timeoutMs: Math.max(250, opts.deepTimeoutMs ?? 5e3),
3131
- probe: opts.probeGatewayFn ?? probeGateway
3132
- }) : void 0;
3133
- if (deep?.gateway?.attempted && !deep.gateway.ok) findings.push({
3134
- checkId: "gateway.probe_failed",
3135
- severity: "warn",
3136
- title: "Gateway probe failed (deep)",
3137
- detail: deep.gateway.error ?? "gateway unreachable",
3138
- remediation: `Run "${formatCliCommand("remoteclaw status --all")}" to debug connectivity/auth, then re-run "${formatCliCommand("remoteclaw security audit --deep")}".`
3139
- });
3140
- const summary = countBySeverity(findings);
3141
- return {
3142
- ts: Date.now(),
3143
- summary,
3144
- findings,
3145
- deep
3146
- };
3147
- }
3148
-
3149
- //#endregion
3150
- export { resolveGatewayProbeAuth as _, collectIncludePathsRecursive as a, probeGateway as b, resolveGroupToolPolicy as c, collectExplicitAllowlist as d, expandPolicyWithPluginGroups as f, resolveToolProfilePolicy as g, normalizeToolName as h, formatIcaclsResetCommand as i, resolveSubagentToolPolicy as l, stripPluginOnlyAllowlist as m, collectEnabledInsecureOrDangerousFlags as n, filterToolsByPolicy as o, mergeAlsoAllowPolicy as p, createIcaclsResetCommand as r, resolveEffectiveToolPolicy as s, runSecurityAudit as t, buildPluginToolGroups as u, isNodeCommandAllowed as v, resolveNodeCommandAllowlist as y };