@pixelzx/genesis 2026.6.13-beta.3 → 2026.6.13

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 (1009) hide show
  1. package/dist/.buildstamp +1 -1
  2. package/dist/abort-CUEXCdsZ.js +201 -0
  3. package/dist/abort.runtime-pbOgDldP.js +2 -0
  4. package/dist/abort.runtime.js +1 -1
  5. package/dist/accounts-BtjI3Z72.js +2 -0
  6. package/dist/accounts-CgGxrOwS.js +107 -0
  7. package/dist/accounts-Ddm5_DS5.js +104 -0
  8. package/dist/acp-cli-Llxb5ymk.js +2217 -0
  9. package/dist/acp-spawn-BTb-KXxB.js +1093 -0
  10. package/dist/acp-spawn-DHriTNXb.js +2 -0
  11. package/dist/acp-stateful-target-driver-DBVhWBrt.js +89 -0
  12. package/dist/action-agents-CGlVq0bn.js +67 -0
  13. package/dist/action-focus-X9cJX3UC.js +132 -0
  14. package/dist/action-help-D1M6mIWb.js +7 -0
  15. package/dist/action-info-fCoEt-Rn.js +101 -0
  16. package/dist/action-kill-DP4EEnxt.js +33 -0
  17. package/dist/action-list-CcjpvN9N.js +21 -0
  18. package/dist/action-log-YUvfBfxP.js +30 -0
  19. package/dist/action-send-B92BNjlE.js +39 -0
  20. package/dist/action-spawn-CTVbxHB8.js +47 -0
  21. package/dist/action-unfocus-CCvrRtpz.js +29 -0
  22. package/dist/actions.runtime-CoSzf-df.js +5 -0
  23. package/dist/actions.runtime-DcqD6Le-.js +18 -0
  24. package/dist/actions.runtime.js +1 -1
  25. package/dist/agent-CQEBS9pS.js +2 -0
  26. package/dist/agent-command-KS0kk4R_.js +874 -0
  27. package/dist/agent-harness-runtime-DpgQTWHS.js +144 -0
  28. package/dist/agent-runner-utils-Bfjw1bSj.js +239 -0
  29. package/dist/agent-runner.runtime-BmWGZi8Z.js +3455 -0
  30. package/dist/agent-runner.runtime.js +1 -1
  31. package/dist/agent-runtime-Cju2h7Dd.js +18 -0
  32. package/dist/agents-6HPmn29e.js +5 -0
  33. package/dist/agents-ZkvxBcii.js +954 -0
  34. package/dist/aliases-BpgQEAi2.js +2 -0
  35. package/dist/aliases-CK0aIskI.js +96 -0
  36. package/dist/api-BxjlJBf7.js +3 -0
  37. package/dist/api-CalF94xg.js +5 -0
  38. package/dist/api-D_GKjzfN.js +139 -0
  39. package/dist/approval-gateway-resolver-Dxycea4Z.js +29 -0
  40. package/dist/approval-gateway-runtime-D3X-ZiqD.js +2 -0
  41. package/dist/approval-handler-runtime-CRqE_cXp.js +439 -0
  42. package/dist/approval-native-runtime-zR041zyJ.js +729 -0
  43. package/dist/attempt-execution.runtime-1Wa08yf1.js +509 -0
  44. package/dist/attempt-execution.runtime.js +1 -1
  45. package/dist/attempt.prompt-helpers-z-6VGwRW.js +221 -0
  46. package/dist/attempt.tool-run-context-C70C_cPM.js +933 -0
  47. package/dist/audit-DfIX2KwE.js +939 -0
  48. package/dist/audit.runtime-BNH37U5T.js +7 -0
  49. package/dist/audit.runtime.js +1 -1
  50. package/dist/auth-DkcLHjkF.js +2 -0
  51. package/dist/auth-order-B9P_KybB.js +2 -0
  52. package/dist/auth-order-ozs0zLmu.js +139 -0
  53. package/dist/auth-vKHIBjC8.js +550 -0
  54. package/dist/bash-tools-CLGCvCUP.js +2824 -0
  55. package/dist/bash-tools-CaBEBURe.js +3 -0
  56. package/dist/binding-routing-D4HA2ved.js +85 -0
  57. package/dist/binding-targets-DA9ecVsr.js +121 -0
  58. package/dist/bridge-server-gnPeACBa.js +113 -0
  59. package/dist/browser-control-auth-CM8pNt8J.js +2 -0
  60. package/dist/browser-node-runtime-C-mstNpu.js +12 -0
  61. package/dist/browser-profiles-Dg-k95aL.js +2 -0
  62. package/dist/browser-runtime-DirlsYmK.js +387 -0
  63. package/dist/browser-setup-tools-BXWUuJ6m.js +13 -0
  64. package/dist/build-CijTB8Fi.js +550 -0
  65. package/dist/build-info.json +3 -3
  66. package/dist/bundled/boot-md/handler.js +2 -2
  67. package/dist/bundled/session-memory/handler.js +1 -1
  68. package/dist/call-85RWmQAH.js +3 -0
  69. package/dist/call-CL7Keh1p.js +331 -0
  70. package/dist/call.runtime-xbzyWzEi.js +2 -0
  71. package/dist/call.runtime.js +1 -1
  72. package/dist/capability-cli-DLY0EugY.js +1401 -0
  73. package/dist/catchup-pqyBQ6UZ.js +300 -0
  74. package/dist/channel-B-_yLOuX.js +1320 -0
  75. package/dist/channel-BMRnqh3W.js +840 -0
  76. package/dist/channel-BrrfXNkf.js +297 -0
  77. package/dist/channel-C1VXF6vY.js +595 -0
  78. package/dist/channel-C6MisWnA.js +350 -0
  79. package/dist/channel-C7Y0GD7W.js +1100 -0
  80. package/dist/channel-C9Kr__RL.js +226 -0
  81. package/dist/channel-CJFK3uRJ.js +1802 -0
  82. package/dist/channel-Crm7UunT.js +453 -0
  83. package/dist/channel-M5ZFW6rv.js +491 -0
  84. package/dist/channel-VL7FJNyb.js +1174 -0
  85. package/dist/channel-core-DB2nzAkT.js +5 -0
  86. package/dist/channel-inbound-CATPKMen.js +31 -0
  87. package/dist/channel-plugin-runtime-DhEHiW41.js +771 -0
  88. package/dist/channel-runtime-CE1xTvWZ.js +425 -0
  89. package/dist/channel.runtime-3APLcE-1.js +42398 -0
  90. package/dist/channel.runtime-B8slMR61.js +89 -0
  91. package/dist/channel.runtime-BKjTINZH.js +4 -0
  92. package/dist/channel.runtime-DHfGxcjG.js +2364 -0
  93. package/dist/channel.runtime-DVnkA8AL.js +576 -0
  94. package/dist/channel.runtime-DaFfPWdI.js +430 -0
  95. package/dist/channel.setup-C3Ag76tq.js +10 -0
  96. package/dist/channel2.runtime-DUB2QEK1.js +109 -0
  97. package/dist/channel2.runtime.js +1 -1
  98. package/dist/channels-CBvXY2t_.js +733 -0
  99. package/dist/channels-cli-CkoeG5y5.js +268 -0
  100. package/dist/chat-DbvGOpf-.js +2830 -0
  101. package/dist/clawbot-cli-CLuaKcyW.js +9 -0
  102. package/dist/cli/daemon-cli.js +3 -3
  103. package/dist/cli-B5Ub8Cgn.js +2 -0
  104. package/dist/cli-BDH4ZbeI.js +2 -0
  105. package/dist/cli-CWOy2CsV.js +219 -0
  106. package/dist/cli-DyG2YLBa.js +72 -0
  107. package/dist/cli-runner-D8mL6FWu.js +286 -0
  108. package/dist/cli-runner.runtime-BCrZn2CL.js +4 -0
  109. package/dist/cli-runner.runtime-ChQ6WYTw.js +3 -0
  110. package/dist/cli-runner.runtime.js +1 -1
  111. package/dist/cli-startup-metadata.json +2 -2
  112. package/dist/cli.runtime-c5SW-DVR.js +1261 -0
  113. package/dist/cli.runtime.js +1 -1
  114. package/dist/client-BdWZGAKV.js +713 -0
  115. package/dist/client-G9bp9IBR.js +138 -0
  116. package/dist/command-auth-C6emi1Rr.js +76 -0
  117. package/dist/command-config-resolution-CY8Uap6U.js +2 -0
  118. package/dist/command-config-resolution-Dkkd_zz7.js +23 -0
  119. package/dist/command-config-resolution.runtime-B03wRV-i.js +2 -0
  120. package/dist/command-config-resolution.runtime.js +1 -1
  121. package/dist/command-registry-BdXEbnVK.js +9 -0
  122. package/dist/command-registry-BwJ8YzAH.js +4 -0
  123. package/dist/command-registry-core-X1IeFtlC.js +106 -0
  124. package/dist/command-secret-gateway-BxGIG8ny.js +528 -0
  125. package/dist/command-status.runtime-5QfAs_4U.js +87 -0
  126. package/dist/command-status.runtime.js +1 -1
  127. package/dist/commands-acp-15kfWcgC.js +77 -0
  128. package/dist/commands-compact.runtime-GdDN_EbV.js +10 -0
  129. package/dist/commands-compact.runtime.js +1 -1
  130. package/dist/commands-handlers.runtime-Cb8uy-yp.js +4599 -0
  131. package/dist/commands-handlers.runtime.js +1 -1
  132. package/dist/commands-status-BfvtgMfw.js +16 -0
  133. package/dist/commands-status.runtime-C4UOWuC1.js +3 -0
  134. package/dist/commands-status.runtime.js +1 -1
  135. package/dist/commands-subagents-control.runtime-CU9SGNdt.js +3 -0
  136. package/dist/commands-subagents-control.runtime-DnTa6bzF.js +2 -0
  137. package/dist/commands-subagents-control.runtime.js +1 -1
  138. package/dist/commands-system-prompt-B1VTjT7j.js +2 -0
  139. package/dist/commands-system-prompt-BpBKEr8Y.js +158 -0
  140. package/dist/commands.runtime-Dpj2M0X6.js +167 -0
  141. package/dist/commands.runtime.js +1 -1
  142. package/dist/compact-CW1IbeBL.js +1118 -0
  143. package/dist/compact.runtime-BML0MjKx.js +12 -0
  144. package/dist/compact.runtime.js +1 -1
  145. package/dist/completion-cli-DfjmvVEd.js +328 -0
  146. package/dist/config-Cs1RBMvI.js +252 -0
  147. package/dist/config-cli-B4sSTkyr.js +1078 -0
  148. package/dist/configure-DR8rchLE.js +1252 -0
  149. package/dist/configure-arK50J-8.js +2 -0
  150. package/dist/connect-options-eEG6omnx.js +699 -0
  151. package/dist/control-auth-D6O4ILiF.js +125 -0
  152. package/dist/control-service-DtnOpS8v.js +156 -0
  153. package/dist/conversation-id-CF4M7Rh_.js +38 -0
  154. package/dist/conversation-id-lrCRurjf.js +235 -0
  155. package/dist/conversation-runtime-CmrgJq5s.js +31 -0
  156. package/dist/core-cFPca6I1.js +275 -0
  157. package/dist/cron-cli-BZw_Pb_X.js +713 -0
  158. package/dist/daemon-cli-CBs3tlnX.js +12 -0
  159. package/dist/dashboard-DOnBYDVr.js +2 -0
  160. package/dist/dashboard-Xsq0BOfY.js +81 -0
  161. package/dist/delegate-YTxameSy.js +64 -0
  162. package/dist/detached-task-runtime-DG_5Cqxs.js +73 -0
  163. package/dist/devices-cli-DkhwpYb8.js +498 -0
  164. package/dist/diagnostics-C_w66y4V.js +154 -0
  165. package/dist/direct-dm-DIod6mar.js +64 -0
  166. package/dist/dispatch-BDQe80zG.js +1131 -0
  167. package/dist/dispatch-acp-jOkMwRPa.js +981 -0
  168. package/dist/dispatch-acp-manager.runtime-Cys6AkDd.js +3 -0
  169. package/dist/dispatch-acp-manager.runtime.js +1 -1
  170. package/dist/dispatch-acp.runtime-BCFY7UOj.js +19 -0
  171. package/dist/dispatch-acp.runtime.js +1 -1
  172. package/dist/doctor-device-pairing-CpGyVqbv.js +307 -0
  173. package/dist/doctor-gateway-daemon-flow-Dt447a03.js +250 -0
  174. package/dist/doctor-gateway-health-BOgr3ZTP.js +63 -0
  175. package/dist/doctor-health-CM9WRrKn.js +59 -0
  176. package/dist/doctor-health-contributions-Dp96BnoL.js +493 -0
  177. package/dist/doctor-prompter-DSrAf0qq.js +56 -0
  178. package/dist/doctor-workspace-status-BcV9YZTP.js +75 -0
  179. package/dist/dreaming-DzWUr8i3.js +1582 -0
  180. package/dist/dreaming-narrative-BFfAvouy.js +596 -0
  181. package/dist/embedded-gateway-stub.runtime-BwG8b1xF.js +9 -0
  182. package/dist/embedded-gateway-stub.runtime.js +1 -1
  183. package/dist/entry.js +2 -2
  184. package/dist/exec-approvals-cli-WT6PMw5I.js +498 -0
  185. package/dist/extensionAPI.js +1 -1
  186. package/dist/extensions/active-memory/index.js +1 -1
  187. package/dist/extensions/bluebubbles/api.js +3 -3
  188. package/dist/extensions/bluebubbles/channel-plugin-api.js +1 -1
  189. package/dist/extensions/browser/browser-bridge.js +1 -1
  190. package/dist/extensions/browser/browser-config.js +4 -4
  191. package/dist/extensions/browser/browser-control-auth.js +2 -2
  192. package/dist/extensions/browser/browser-doctor.js +2 -2
  193. package/dist/extensions/browser/browser-maintenance.js +2 -2
  194. package/dist/extensions/browser/browser-profiles.js +2 -2
  195. package/dist/extensions/browser/browser-runtime-api.js +10 -10
  196. package/dist/extensions/browser/index.js +1 -1
  197. package/dist/extensions/browser/plugin-registration.js +1 -1
  198. package/dist/extensions/browser/register.runtime.js +3 -3
  199. package/dist/extensions/browser/runtime-api.js +11 -11
  200. package/dist/extensions/browser/test-support.js +1 -1
  201. package/dist/extensions/device-pair/api.js +1 -1
  202. package/dist/extensions/device-pair/index.js +3 -3
  203. package/dist/extensions/device-pair/notify.js +1 -1
  204. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  205. package/dist/extensions/google-meet/index.js +2 -2
  206. package/dist/extensions/imessage/api.js +3 -3
  207. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  208. package/dist/extensions/imessage/runtime-api.js +3 -3
  209. package/dist/extensions/irc/api.js +2 -2
  210. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  211. package/dist/extensions/line/api.js +2 -2
  212. package/dist/extensions/line/channel-plugin-api.js +1 -1
  213. package/dist/extensions/line/contract-api.js +1 -1
  214. package/dist/extensions/line/runtime-api.js +4 -4
  215. package/dist/extensions/line/setup-api.js +1 -1
  216. package/dist/extensions/llm-task/index.js +2 -2
  217. package/dist/extensions/lobster/index.js +3 -3
  218. package/dist/extensions/lobster/runtime-api.js +1 -1
  219. package/dist/extensions/mattermost/api.js +1 -1
  220. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  221. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  222. package/dist/extensions/mattermost/policy-api.js +1 -1
  223. package/dist/extensions/mattermost/runtime-api.js +4 -4
  224. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  225. package/dist/extensions/memory-core/api.js +1 -1
  226. package/dist/extensions/memory-core/cli-metadata.js +2 -2
  227. package/dist/extensions/memory-core/index.js +3 -3
  228. package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
  229. package/dist/extensions/msteams/api.js +1 -1
  230. package/dist/extensions/msteams/channel-plugin-api.js +1 -1
  231. package/dist/extensions/msteams/runtime-api.js +3 -3
  232. package/dist/extensions/msteams/test-api.js +1 -1
  233. package/dist/extensions/nextcloud-talk/api.js +1 -1
  234. package/dist/extensions/nextcloud-talk/channel-plugin-api.js +1 -1
  235. package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
  236. package/dist/extensions/openshell/index.js +2 -2
  237. package/dist/extensions/signal/api.js +6 -6
  238. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  239. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  240. package/dist/extensions/signal/runtime-api.js +7 -7
  241. package/dist/extensions/skill-workshop/api.js +1 -1
  242. package/dist/extensions/skill-workshop/index.js +1 -1
  243. package/dist/extensions/synology-chat/api.js +1 -1
  244. package/dist/extensions/synology-chat/channel-plugin-api.js +1 -1
  245. package/dist/extensions/tlon/api.js +2 -2
  246. package/dist/extensions/tlon/channel-plugin-api.js +1 -1
  247. package/dist/extensions/tlon/runtime-api.js +1 -1
  248. package/dist/extensions/tlon/test-api.js +1 -1
  249. package/dist/extensions/twitch/api.js +1 -1
  250. package/dist/extensions/twitch/channel-plugin-api.js +1 -1
  251. package/dist/extensions/twitch/setup-plugin-api.js +1 -1
  252. package/dist/extensions/zalo/api.js +3 -3
  253. package/dist/extensions/zalo/channel-plugin-api.js +1 -1
  254. package/dist/extensions/zalo/runtime-api.js +2 -2
  255. package/dist/extensions/zalo/setup-api.js +2 -2
  256. package/dist/extensions/zalouser/api.js +3 -3
  257. package/dist/extensions/zalouser/channel-plugin-api.js +1 -1
  258. package/dist/extensions/zalouser/runtime-api.js +6 -6
  259. package/dist/extensions/zalouser/setup-plugin-api.js +1 -1
  260. package/dist/extensions/zalouser/test-api.js +1 -1
  261. package/dist/fallbacks-BVWn3y-0.js +31 -0
  262. package/dist/fallbacks-Dw_bkoWB.js +2 -0
  263. package/dist/fallbacks-shared-BEsBzsm3.js +111 -0
  264. package/dist/gateway-cli-BUxyZoGn.js +1283 -0
  265. package/dist/gateway-p2LteXL8.js +115 -0
  266. package/dist/gateway-rpc-D8q7ZQDi.js +14 -0
  267. package/dist/gateway-rpc.runtime-D_0TNej1.js +23 -0
  268. package/dist/gateway-rpc.runtime.js +1 -1
  269. package/dist/gateway-runtime-DYUdOqYz.js +15 -0
  270. package/dist/gateway-status-ZBWKhThd.js +584 -0
  271. package/dist/genesis-tools-oUxtX0O2.js +9166 -0
  272. package/dist/genesis-tools.runtime-Cx-FIdJQ.js +2 -0
  273. package/dist/genesis-tools.runtime.js +1 -1
  274. package/dist/get-reply-BPIG7KcY.js +3897 -0
  275. package/dist/get-reply-from-config.runtime-CnHudoiv.js +2 -0
  276. package/dist/get-reply-from-config.runtime.js +1 -1
  277. package/dist/graph-users-DwHoVTRw.js +1337 -0
  278. package/dist/health-B2JkLr-g.js +3 -0
  279. package/dist/health-Db30zfNX.js +469 -0
  280. package/dist/health-route--Oa3RIgW.js +2 -0
  281. package/dist/health-route-CUCmtqv5.js +41 -0
  282. package/dist/heartbeat-runner-BZp7aZ2w.js +5 -0
  283. package/dist/heartbeat-runner-C1VMkjRh.js +1292 -0
  284. package/dist/heartbeat-runner.runtime-ChAITmTa.js +4 -0
  285. package/dist/heartbeat-runner.runtime.js +1 -1
  286. package/dist/hooks-cli-NPBiUXrV.js +433 -0
  287. package/dist/image-fallbacks-CgnkUGl-.js +31 -0
  288. package/dist/image-fallbacks-CkcfrgGr.js +2 -0
  289. package/dist/inbound-reply-dispatch-DatqwKdH.js +73 -0
  290. package/dist/index.js +2 -2
  291. package/dist/infra-runtime-DF5DBM7E.js +39 -0
  292. package/dist/init-H9ZKfvws.js +59 -0
  293. package/dist/library-B7YkN7SI.js +45 -0
  294. package/dist/lifecycle-BclPLGGp.js +229 -0
  295. package/dist/lifecycle-C_3bV3nu.js +571 -0
  296. package/dist/lifecycle.runtime-WNsFm3uq.js +2 -0
  297. package/dist/lifecycle.runtime.js +1 -1
  298. package/dist/list-C4LkHj9E.js +2 -0
  299. package/dist/list-Co85YbCS.js +2 -0
  300. package/dist/list-D8pfqTNx.js +131 -0
  301. package/dist/list-oJMN_3OD.js +1212 -0
  302. package/dist/list.probe-DZjGof7G.js +419 -0
  303. package/dist/llm-slug-generator-knfnn0mT.js +79 -0
  304. package/dist/llm-slug-generator.js +1 -1
  305. package/dist/load-config-BPbDzvCY.js +35 -0
  306. package/dist/local-dispatch.runtime-BtylNF8x.js +8 -0
  307. package/dist/local-dispatch.runtime.js +1 -1
  308. package/dist/logs-cli-BWGb1in_.js +265 -0
  309. package/dist/logs-cli.runtime-DBp3UCcP.js +2 -0
  310. package/dist/logs-cli.runtime.js +1 -1
  311. package/dist/main-session-restart-recovery-BJt-saEI.js +206 -0
  312. package/dist/managed-image-attachments-BuO0SCpc.js +635 -0
  313. package/dist/managed-image-attachments-C4QYz3yC.js +2 -0
  314. package/dist/manager-C0c4DxXa.js +2 -0
  315. package/dist/manager-DmLckyN1.js +2057 -0
  316. package/dist/markdown-to-line-BVs9RDRe.js +790 -0
  317. package/dist/mcp/plugin-tools-serve.js +1 -1
  318. package/dist/mcp-cli-Cq3kJYFy.js +725 -0
  319. package/dist/mcp-http-C8sBBMH1.js +529 -0
  320. package/dist/memory-core-host-runtime-cli-DYW7bPF_.js +9 -0
  321. package/dist/message-Bec0oyM4.js +232 -0
  322. package/dist/message-action-runner-BIvqB_FI.js +2 -0
  323. package/dist/message-action-runner-D66_Fo-V.js +1407 -0
  324. package/dist/message-actions-BJs-Awr8.js +143 -0
  325. package/dist/message.gateway.runtime-BxKiFLPu.js +2 -0
  326. package/dist/message.gateway.runtime.js +1 -1
  327. package/dist/models-auth-status-BKHvtTwP.js +217 -0
  328. package/dist/models-cli-CoqcvJz5.js +271 -0
  329. package/dist/monitor-BO_gZrgs.js +1459 -0
  330. package/dist/monitor-C_4tbG4E.js +671 -0
  331. package/dist/monitor-DVTKLiFb.js +2 -0
  332. package/dist/monitor-P35vmooh.js +1237 -0
  333. package/dist/monitor-auth-DkTEAzy7.js +207 -0
  334. package/dist/monitor-gaiYvZ-I.js +788 -0
  335. package/dist/monitor-processing-BpjusT5o.js +1974 -0
  336. package/dist/monitor-uCqIYno8.js +1661 -0
  337. package/dist/monitor.runtime-CbMSQBgz.js +2 -0
  338. package/dist/monitor.runtime.js +1 -1
  339. package/dist/monitor.webhook-z4zhNHYy.js +180 -0
  340. package/dist/msteams-ChjqyPxy.js +35 -0
  341. package/dist/native-hook-relay-hOpMhOTR.js +519 -0
  342. package/dist/nextcloud-talk-BfJltkau.js +17 -0
  343. package/dist/node-cli-NXEXoWYg.js +2276 -0
  344. package/dist/nodes-cli-Dlq3ORXy.js +1046 -0
  345. package/dist/nodes-utils-o8KC_0Ci.js +84 -0
  346. package/dist/nodes.helpers-B2jPrnEd.js +34 -0
  347. package/dist/notify-VSv6I2dB.js +315 -0
  348. package/dist/onboard-I72X1v1y.js +70 -0
  349. package/dist/onboard-WRT3rbQo.js +2 -0
  350. package/dist/onboard-helpers-BnbqaUN2.js +6 -0
  351. package/dist/onboard-helpers-Kt5u4yMJ.js +204 -0
  352. package/dist/onboard-interactive-CIhTNhiD.js +24 -0
  353. package/dist/onboard-non-interactive-Hk6vLQCB.js +635 -0
  354. package/dist/onboard-remote-CQo_tQNa.js +193 -0
  355. package/dist/onboard-remote-DyRv7tdE.js +2 -0
  356. package/dist/onboard-skills-BRv5-6Ke.js +2 -0
  357. package/dist/onboard-skills-CeXPYTFg.js +134 -0
  358. package/dist/openai-http-kgzRj9Fg.js +500 -0
  359. package/dist/openresponses-http-DnJSiUa4.js +1128 -0
  360. package/dist/operator-approvals-client-B8dLxxFu.js +68 -0
  361. package/dist/outbound.runtime-CDrYtbmY.js +2 -0
  362. package/dist/outbound.runtime.js +1 -1
  363. package/dist/pair-command-approve-CFU4_I15.js +44 -0
  364. package/dist/persistent-bindings.lifecycle-5_yxfyfG.js +85 -0
  365. package/dist/persistent-bindings.lifecycle-DtFnl1yI.js +2 -0
  366. package/dist/pi-embedded-DPKqHoG9.js +2905 -0
  367. package/dist/pi-embedded-YM1PXjPH.js +4 -0
  368. package/dist/pi-embedded.runtime-FRv5dWIr.js +4 -0
  369. package/dist/pi-embedded.runtime.js +1 -1
  370. package/dist/pi-tool-definition-adapter-DAVcmPPg.js +229 -0
  371. package/dist/pi-tools-pgCF9tvm.js +1057 -0
  372. package/dist/pi-tools.before-tool-call-Blvjro7X.js +2 -0
  373. package/dist/pi-tools.before-tool-call-CMEGGnv-.js +433 -0
  374. package/dist/plugin-DoJ_IM72.js +12195 -0
  375. package/dist/plugin-enabled-C9PNEsMB.js +140 -0
  376. package/dist/plugin-registration-CPGTZRDF.js +23 -0
  377. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  378. package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
  379. package/dist/plugin-sdk/acp-runtime.js +2 -2
  380. package/dist/plugin-sdk/agent-harness-runtime.js +5 -5
  381. package/dist/plugin-sdk/agent-harness.js +6 -6
  382. package/dist/plugin-sdk/agent-runtime.js +2 -2
  383. package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
  384. package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
  385. package/dist/plugin-sdk/approval-runtime.js +1 -1
  386. package/dist/plugin-sdk/browser-node-runtime.js +4 -4
  387. package/dist/plugin-sdk/browser-setup-tools.js +3 -3
  388. package/dist/plugin-sdk/browser-support.js +7 -7
  389. package/dist/plugin-sdk/channel-core.js +2 -2
  390. package/dist/plugin-sdk/channel-inbound.js +2 -2
  391. package/dist/plugin-sdk/command-auth.js +1 -1
  392. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  393. package/dist/plugin-sdk/compat.js +1 -1
  394. package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
  395. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  396. package/dist/plugin-sdk/core.js +2 -2
  397. package/dist/plugin-sdk/direct-dm.js +1 -1
  398. package/dist/plugin-sdk/gateway-runtime.js +3 -3
  399. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  400. package/dist/plugin-sdk/index.js +1 -1
  401. package/dist/plugin-sdk/infra-runtime.js +2 -2
  402. package/dist/plugin-sdk/irc.js +2 -2
  403. package/dist/plugin-sdk/matrix.js +1 -1
  404. package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
  405. package/dist/plugin-sdk/memory-core.js +2 -2
  406. package/dist/plugin-sdk/msteams.js +2 -2
  407. package/dist/plugin-sdk/nextcloud-talk.js +2 -2
  408. package/dist/plugin-sdk/nostr.js +1 -1
  409. package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
  410. package/dist/plugin-sdk/reply-runtime.js +4 -4
  411. package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
  412. package/dist/plugin-sdk/runtime.js +2 -2
  413. package/dist/plugin-sdk/session-visibility.js +1 -1
  414. package/dist/plugin-sdk/testing.js +4 -4
  415. package/dist/plugin-sdk/tlon.js +1 -1
  416. package/dist/plugin-sdk/zalo.js +1 -1
  417. package/dist/plugin-sdk/zalouser.js +1 -1
  418. package/dist/plugin-service-c09KhFRA.js +2893 -0
  419. package/dist/plugins/runtime/index.js +1 -1
  420. package/dist/policy-DxSwu86T.js +328 -0
  421. package/dist/postinstall-inventory.json +414 -414
  422. package/dist/prepare.runtime-BIEQIV8L.js +815 -0
  423. package/dist/prepare.runtime.js +1 -1
  424. package/dist/probe-6HwDlk5s.js +2 -0
  425. package/dist/probe-BbvEHYyJ.js +2 -0
  426. package/dist/probe-COR7fP_v.js +2205 -0
  427. package/dist/probe-DE9JjGqN.js +241 -0
  428. package/dist/probe-DLS0a8fK.js +74 -0
  429. package/dist/probe-D_l_otos.js +45 -0
  430. package/dist/probe-ZtUbt8f-.js +1443 -0
  431. package/dist/program-DfQvGH1d.js +111 -0
  432. package/dist/prompt-select-styled-DM6haaKV.js +20 -0
  433. package/dist/protocol-CqddCqi8.js +2479 -0
  434. package/dist/provider-dispatcher-BR6UQE4t.js +22 -0
  435. package/dist/provider-dispatcher-CbwCRQ43.js +2 -0
  436. package/dist/qr-cli-D51XKVJW.js +349 -0
  437. package/dist/qr-cli-i4TjyLtW.js +2 -0
  438. package/dist/reaction-runtime-api-DDV-gubE.js +116 -0
  439. package/dist/reactions-BvXn-qBP.js +998 -0
  440. package/dist/register-service-commands-B6ZQumi9.js +71 -0
  441. package/dist/register.agent-CtzP54VE.js +248 -0
  442. package/dist/register.configure-BLcph6ME.js +15 -0
  443. package/dist/register.maintenance-CPYg-yEz.js +363 -0
  444. package/dist/register.message-CficlkIg.js +329 -0
  445. package/dist/register.onboard-1xQPe7tH.js +88 -0
  446. package/dist/register.runtime-CCeTiEB_.js +81 -0
  447. package/dist/register.runtime.js +1 -1
  448. package/dist/register.setup-DAoIkDtN.js +150 -0
  449. package/dist/register.status-health-sessions-0WKthgEo.js +1215 -0
  450. package/dist/register.subclis-DLvpHAI3.js +29 -0
  451. package/dist/register.subclis-JxfqEla5.js +3 -0
  452. package/dist/register.subclis-core-DuiCves5.js +249 -0
  453. package/dist/reply-dispatch-runtime-C9_ukgcR.js +13 -0
  454. package/dist/reply-runtime-OPe17s80.js +11 -0
  455. package/dist/reply.runtime-DDlQ67N1.js +2 -0
  456. package/dist/reply.runtime.js +1 -1
  457. package/dist/restart-health-CL-01acN.js +202 -0
  458. package/dist/restart-health-YEV65VfM.js +2 -0
  459. package/dist/root-help-BJQSVoY8.js +44 -0
  460. package/dist/routes-BmkmbLoX.js +3341 -0
  461. package/dist/routes-Bnind2jW.js +2 -0
  462. package/dist/rpc-DY2jvCMf.js +61 -0
  463. package/dist/rpc.runtime-ChyBZELh.js +21 -0
  464. package/dist/rpc.runtime.js +1 -1
  465. package/dist/run-delivery.runtime-Dz-12Zd4.js +530 -0
  466. package/dist/run-delivery.runtime.js +1 -1
  467. package/dist/run-embedded.runtime-BpU5lMNC.js +4 -0
  468. package/dist/run-embedded.runtime.js +1 -1
  469. package/dist/run-execution-cli.runtime-DAFehfXH.js +4 -0
  470. package/dist/run-execution-cli.runtime.js +1 -1
  471. package/dist/run-executor.runtime-rpu8onA8.js +277 -0
  472. package/dist/run-executor.runtime.js +1 -1
  473. package/dist/run-main-C_inhxnF.js +567 -0
  474. package/dist/run-subagent-registry.runtime-B6k7yCGg.js +2 -0
  475. package/dist/run-subagent-registry.runtime.js +1 -1
  476. package/dist/run-wait-CFzlGkj_.js +135 -0
  477. package/dist/runtime-Dhl_rNom.js +9 -0
  478. package/dist/runtime-OHV6waIC.js +973 -0
  479. package/dist/runtime-api-BWNiBA3c.js +9 -0
  480. package/dist/runtime-api-BfIyvgB_.js +14 -0
  481. package/dist/runtime-api-D424hB_J.js +4 -0
  482. package/dist/runtime-api-DtKgDipG.js +9 -0
  483. package/dist/runtime-embedded-pi.runtime-DFWGcHwZ.js +2 -0
  484. package/dist/runtime-embedded-pi.runtime.js +1 -1
  485. package/dist/runtime-internal-CaCnQ02a.js +2 -0
  486. package/dist/runtime-options-D4BvjWB8.js +275 -0
  487. package/dist/runtime-schema-pjSPEOAs.js +28588 -0
  488. package/dist/scan--Q_WB1Hw.js +2 -0
  489. package/dist/scan-B62XQB6F.js +523 -0
  490. package/dist/secrets-cli-BGEY6lbE.js +2101 -0
  491. package/dist/security-cli-Dcjib0xt.js +486 -0
  492. package/dist/selection-DnBlD3ri.js +7764 -0
  493. package/dist/selection-DtFOwoyl.js +2 -0
  494. package/dist/send-DQ2jC-kR.js +156 -0
  495. package/dist/send-DqkSZeSs.js +102 -0
  496. package/dist/send.runtime-np7_gr25.js +2 -0
  497. package/dist/send.runtime.js +1 -1
  498. package/dist/server-CDV_YyCz.js +77 -0
  499. package/dist/server-Dyzhwdln.js +13 -0
  500. package/dist/server-context-C1If0B6s.js +2 -0
  501. package/dist/server-context-DwGUOfrl.js +847 -0
  502. package/dist/server-node-events-DUpSxyRf.js +481 -0
  503. package/dist/server-plugin-bootstrap-CFpMAmvv.js +2 -0
  504. package/dist/server-plugin-bootstrap-D86uxpDr.js +13176 -0
  505. package/dist/server-restart-sentinel-CKsgDiab.js +697 -0
  506. package/dist/server.impl-BYjxobzs.js +12894 -0
  507. package/dist/session-kill-http-phKXyTTy.js +110 -0
  508. package/dist/session-reset-service-CwvaVami.js +497 -0
  509. package/dist/session-route-BTgIfE1c.js +93 -0
  510. package/dist/session-status.runtime-ChCTEeUR.js +2 -0
  511. package/dist/session-status.runtime.js +1 -1
  512. package/dist/session-subagent-reactivation.runtime-BpZtYfkl.js +2 -0
  513. package/dist/session-subagent-reactivation.runtime.js +1 -1
  514. package/dist/session-tab-registry-BqpCfcjM.js +581 -0
  515. package/dist/session-visibility-CedNChjb.js +147 -0
  516. package/dist/sessions-helpers-Drc1RiQe.js +305 -0
  517. package/dist/sessions-history-http-B3R_-kZs.js +383 -0
  518. package/dist/sessions-patch-DxL9yDsS.js +309 -0
  519. package/dist/sessions-resolve-BGCm2THO.js +174 -0
  520. package/dist/sessions.runtime-BiIsLfCP.js +2 -0
  521. package/dist/sessions.runtime.js +1 -1
  522. package/dist/setup-Cz1lcHMi.js +636 -0
  523. package/dist/setup-api-C_6auH7A.js +29 -0
  524. package/dist/setup-core-BcqeRlfc.js +171 -0
  525. package/dist/setup-core-BfpSQ1D1.js +176 -0
  526. package/dist/setup-surface-BI4jBqI52.js +403 -0
  527. package/dist/setup-surface-DIuPs4Hz.js +219 -0
  528. package/dist/setup-surface-ncxzGn0K.js +286 -0
  529. package/dist/setup.finalize-_eGrewCd.js +547 -0
  530. package/dist/setup.gateway-config-mG-DCNXx.js +250 -0
  531. package/dist/shared-BJcmJyRx.js +198 -0
  532. package/dist/shared-C2dlYHIW.js +76 -0
  533. package/dist/shared-C_hL6o63.js +121 -0
  534. package/dist/slash-state-CzVTgrEK.js +1911 -0
  535. package/dist/src-CDovn7A6.js +3974 -0
  536. package/dist/startup-context-Ck87weqi.js +312 -0
  537. package/dist/status-48dYtpoR.js +397 -0
  538. package/dist/status-CE7dpR6j.js +3 -0
  539. package/dist/status-CJoIf5CR.js +209 -0
  540. package/dist/status-D1Biv4_a.js +2 -0
  541. package/dist/status-DGJGZyGO.js +2 -0
  542. package/dist/status-all-2bHb-vgG.js +498 -0
  543. package/dist/status-dw3o_qPe.js +190 -0
  544. package/dist/status-json-Bxacm8Qn.js +14 -0
  545. package/dist/status-json-command-DF2B2_V3.js +84 -0
  546. package/dist/status-runtime-shared-BA95v5iK.js +257 -0
  547. package/dist/status-subagents.runtime-DPc9mqPe.js +18 -0
  548. package/dist/status-subagents.runtime.js +1 -1
  549. package/dist/status-text-BP3KeCtU.js +237 -0
  550. package/dist/status.gateway-connection.runtime-CrsJrehG.js +2 -0
  551. package/dist/status.gateway-connection.runtime.js +1 -1
  552. package/dist/status.gather-BCK6tC0P.js +292 -0
  553. package/dist/status.gather-DW_bdDUs.js +2 -0
  554. package/dist/status.runtime-DWTaiT7K.js +2 -0
  555. package/dist/status.runtime.js +1 -1
  556. package/dist/status.scan-CD7orpWm.js +65 -0
  557. package/dist/status.scan-overview-BnY_9pPZ.js +379 -0
  558. package/dist/status.scan.fast-json-CLKyp_FZ.js +132 -0
  559. package/dist/status.scan.fast-json-D9-5RUQW.js +2 -0
  560. package/dist/status.summary-3kMOvohJ.js +2 -0
  561. package/dist/status.summary-CBGC6YG3.js +214 -0
  562. package/dist/subagent-announce-delivery-DgJVgXOr.js +726 -0
  563. package/dist/subagent-announce-output-CP427cvY.js +364 -0
  564. package/dist/subagent-announce-zjeNVFwd.js +351 -0
  565. package/dist/subagent-control-mN0oIWjm.js +506 -0
  566. package/dist/subagent-followup.runtime-BPQyuQoe.js +68 -0
  567. package/dist/subagent-followup.runtime.js +1 -1
  568. package/dist/subagent-orphan-recovery-BBkBb0Nh.js +305 -0
  569. package/dist/subagent-registry-BZkG7d3G.js +3 -0
  570. package/dist/subagent-registry-C2eAtERw.js +1753 -0
  571. package/dist/subagent-registry.runtime.js +1 -1
  572. package/dist/subagent-spawn-BHDR5zLE.js +1005 -0
  573. package/dist/system-cli-DapxyBIC.js +59 -0
  574. package/dist/targets-gkyN5pq8.js +67 -0
  575. package/dist/task-executor-McS2BJQg.js +360 -0
  576. package/dist/task-owner-access-Cp_o7LQs.js +74 -0
  577. package/dist/task-registry-Bc22zUFJ.js +2366 -0
  578. package/dist/task-registry-delivery-runtime-FGvxeA51.js +3 -0
  579. package/dist/task-registry-delivery-runtime-kjDlxgnl.js +2 -0
  580. package/dist/task-registry.maintenance-CdawPjmw.js +416 -0
  581. package/dist/task-registry.maintenance-D_uzodyG.js +2 -0
  582. package/dist/telegram/token.js +1 -1
  583. package/dist/testing-A7m9v7qS.js +575 -0
  584. package/dist/text-report-CSDchBUA.js +587 -0
  585. package/dist/tool-resolution-CMwLa1lc.js +90 -0
  586. package/dist/tools-effective-inventory-CXM5GV6s.js +152 -0
  587. package/dist/tools-invoke-http-qItYoiC6.js +206 -0
  588. package/dist/trash-B00EIdks.js +24 -0
  589. package/dist/tui-cli-BbHQkFbp.js +4595 -0
  590. package/dist/update-cli-hHkP1wu2.js +1759 -0
  591. package/dist/upgrade-Tmp-2Squ.js +1226 -0
  592. package/dist/video-generation-task-status-BWWBuC1d.js +163 -0
  593. package/dist/wait-for-idle-before-flush-CJcOqYwe.js +5986 -0
  594. package/dist/wizard-models-CsM6dV5g.js +334 -0
  595. package/package.json +1 -1
  596. package/dist/abort-Cngo_sE6.js +0 -201
  597. package/dist/abort.runtime-l03tKy6q.js +0 -2
  598. package/dist/accounts-D5dnjCYz.js +0 -104
  599. package/dist/accounts-DJVB8Dzg.js +0 -107
  600. package/dist/accounts-I2j8KUfU.js +0 -2
  601. package/dist/acp-cli-CVXcm2Uf.js +0 -2217
  602. package/dist/acp-spawn-BF1zb7_s.js +0 -2
  603. package/dist/acp-spawn-CCcWxuoD.js +0 -1093
  604. package/dist/acp-stateful-target-driver-CLTnT3_3.js +0 -89
  605. package/dist/action-agents-hVUqBNdo.js +0 -67
  606. package/dist/action-focus-8xIhNSsO.js +0 -132
  607. package/dist/action-help-BGvrhiaU.js +0 -7
  608. package/dist/action-info-DOI0dCt_.js +0 -101
  609. package/dist/action-kill-KvzLsRue.js +0 -33
  610. package/dist/action-list-L4kdOLkV.js +0 -21
  611. package/dist/action-log-xyFooSSU.js +0 -30
  612. package/dist/action-send-za_v6IfP.js +0 -39
  613. package/dist/action-spawn-CqMlG6rs.js +0 -47
  614. package/dist/action-unfocus-4viCl85L.js +0 -29
  615. package/dist/actions.runtime-BQnRcY0z.js +0 -18
  616. package/dist/actions.runtime-DAsDM3FC.js +0 -5
  617. package/dist/agent-BAcZ_9MS.js +0 -2
  618. package/dist/agent-command-CThfmSfK.js +0 -874
  619. package/dist/agent-harness-runtime-DQWpmoRH.js +0 -144
  620. package/dist/agent-runner-utils-BgI3qeCs.js +0 -239
  621. package/dist/agent-runner.runtime-C-6mqnGR.js +0 -3455
  622. package/dist/agent-runtime-DIWgC8MC.js +0 -18
  623. package/dist/agents-BAWL0dPv.js +0 -5
  624. package/dist/agents-CtrLQf-J.js +0 -954
  625. package/dist/aliases-Cd330u5w.js +0 -2
  626. package/dist/aliases-D9gd4KZs.js +0 -96
  627. package/dist/api-6P3OWTH5.js +0 -5
  628. package/dist/api-DpXopE7P.js +0 -3
  629. package/dist/api-oOooMZhP.js +0 -139
  630. package/dist/approval-gateway-resolver-BjqCdv8k.js +0 -29
  631. package/dist/approval-gateway-runtime-vc_h56PW.js +0 -2
  632. package/dist/approval-handler-runtime-CyvEyKDy.js +0 -439
  633. package/dist/approval-native-runtime-BIKGBkwL.js +0 -729
  634. package/dist/attempt-execution.runtime-CCvoOmmC.js +0 -509
  635. package/dist/attempt.prompt-helpers-BQ-1KYxC.js +0 -221
  636. package/dist/attempt.tool-run-context-Cxbblhky.js +0 -933
  637. package/dist/audit-Bo8UTCyc.js +0 -939
  638. package/dist/audit.runtime-CPxgYz9W.js +0 -7
  639. package/dist/auth-4FzYl8sz.js +0 -550
  640. package/dist/auth-Bj3QjORN.js +0 -2
  641. package/dist/auth-order-BVHFh3Fe.js +0 -139
  642. package/dist/auth-order-CiBq-B8C.js +0 -2
  643. package/dist/bash-tools-Csgatugk.js +0 -3
  644. package/dist/bash-tools-D5Qgrlkj.js +0 -2824
  645. package/dist/binding-routing-Cr2BJdII.js +0 -85
  646. package/dist/binding-targets-Du0vm2-F.js +0 -121
  647. package/dist/bridge-server-Cpvt4nNc.js +0 -113
  648. package/dist/browser-control-auth-DsUqVw9Y.js +0 -2
  649. package/dist/browser-node-runtime-CuGRBA2N.js +0 -12
  650. package/dist/browser-profiles-FqYFsUPt.js +0 -2
  651. package/dist/browser-runtime-C_MYMBwN.js +0 -387
  652. package/dist/browser-setup-tools-75eBLdGG.js +0 -13
  653. package/dist/build--GUIQMqV.js +0 -550
  654. package/dist/call-Cwg6CEat.js +0 -331
  655. package/dist/call-hnk56UiT.js +0 -3
  656. package/dist/call.runtime-C8KSEM5A.js +0 -2
  657. package/dist/capability-cli-ly3sH38y.js +0 -1401
  658. package/dist/catchup-DNRHXY1y.js +0 -300
  659. package/dist/channel-3WhZIXYU.js +0 -1100
  660. package/dist/channel-Ad3bImu-.js +0 -226
  661. package/dist/channel-BNY1gK9J.js +0 -1320
  662. package/dist/channel-BetO9AUJ.js +0 -595
  663. package/dist/channel-C2IaZUYL.js +0 -350
  664. package/dist/channel-C8jmE7N2.js +0 -297
  665. package/dist/channel-CDElDIH4.js +0 -453
  666. package/dist/channel-DHZhJnt4.js +0 -1174
  667. package/dist/channel-DJbljYq-.js +0 -840
  668. package/dist/channel-Dd3R7L4E.js +0 -1802
  669. package/dist/channel-Dpdizjhh.js +0 -491
  670. package/dist/channel-core-ByqezGK-.js +0 -5
  671. package/dist/channel-inbound-CfC-5Hqh.js +0 -31
  672. package/dist/channel-plugin-runtime-B-FoOCHe.js +0 -771
  673. package/dist/channel-runtime-CTz-Npx2.js +0 -425
  674. package/dist/channel.runtime-BO17VYXq.js +0 -430
  675. package/dist/channel.runtime-BOIxt4yC.js +0 -4
  676. package/dist/channel.runtime-BhxyxvkT.js +0 -576
  677. package/dist/channel.runtime-DTqynpub.js +0 -42398
  678. package/dist/channel.runtime-DU698Mtp.js +0 -2364
  679. package/dist/channel.runtime-Dfq_FjtT.js +0 -89
  680. package/dist/channel.setup-Cklnh2gh.js +0 -10
  681. package/dist/channel2.runtime-ClW7cdHK.js +0 -109
  682. package/dist/channels-CP6Kp445.js +0 -733
  683. package/dist/channels-cli-DaJwTe-V.js +0 -268
  684. package/dist/chat-ov9pIV1w.js +0 -2830
  685. package/dist/clawbot-cli-BRy4Hm77.js +0 -9
  686. package/dist/cli-BPwABYWL.js +0 -2
  687. package/dist/cli-BsSw7UYX.js +0 -72
  688. package/dist/cli-DM1LzJBx.js +0 -219
  689. package/dist/cli-DPAPYa_s.js +0 -2
  690. package/dist/cli-runner-END8ND2M.js +0 -286
  691. package/dist/cli-runner.runtime-C69OSvpN.js +0 -4
  692. package/dist/cli-runner.runtime-DZi9acPF.js +0 -3
  693. package/dist/cli.runtime-CAl2BRM8.js +0 -1261
  694. package/dist/client-BtyYQE4I.js +0 -713
  695. package/dist/client-DwOhUvZq.js +0 -138
  696. package/dist/command-auth-BC4dzkDE.js +0 -76
  697. package/dist/command-config-resolution-Bu94VaHH.js +0 -2
  698. package/dist/command-config-resolution-CDIZsyXz.js +0 -23
  699. package/dist/command-config-resolution.runtime-D6U--833.js +0 -2
  700. package/dist/command-registry-CP6Flbyr.js +0 -4
  701. package/dist/command-registry-DyA5n5Y2.js +0 -9
  702. package/dist/command-registry-core-D6wfuVBH.js +0 -106
  703. package/dist/command-secret-gateway-U8oc85O3.js +0 -528
  704. package/dist/command-status.runtime-BlV8RkuN.js +0 -87
  705. package/dist/commands-acp-DogyhRxV.js +0 -77
  706. package/dist/commands-compact.runtime-C9CwEQ9d.js +0 -10
  707. package/dist/commands-handlers.runtime-BKVTB3af.js +0 -4599
  708. package/dist/commands-status-Ck7yAveR.js +0 -16
  709. package/dist/commands-status.runtime-C64rfIgv.js +0 -3
  710. package/dist/commands-subagents-control.runtime-BQ9IJ-PN.js +0 -2
  711. package/dist/commands-subagents-control.runtime-DzuYqXYM.js +0 -3
  712. package/dist/commands-system-prompt-DrO5Ktab.js +0 -158
  713. package/dist/commands-system-prompt-OZnWRUU4.js +0 -2
  714. package/dist/commands.runtime-Cz5m7UHd.js +0 -167
  715. package/dist/compact-Bm6Ue8PM.js +0 -1118
  716. package/dist/compact.runtime-DUnPpPlz.js +0 -12
  717. package/dist/completion-cli-CQV8Edld.js +0 -328
  718. package/dist/config-CvQPjE0Q.js +0 -252
  719. package/dist/config-cli-hPAERXVD.js +0 -1078
  720. package/dist/configure-CNDv9ji5.js +0 -1252
  721. package/dist/configure-Dw-YeOYz.js +0 -2
  722. package/dist/connect-options-5yQEkag7.js +0 -699
  723. package/dist/control-auth-BZ3jwW_b.js +0 -125
  724. package/dist/control-service-CVq5rWGF.js +0 -156
  725. package/dist/conversation-id-B7oXZBrx.js +0 -235
  726. package/dist/conversation-id-DEFcpkdn.js +0 -38
  727. package/dist/conversation-runtime-Di95kTti.js +0 -31
  728. package/dist/core-BbuI1nb2.js +0 -275
  729. package/dist/cron-cli-UIR4I5Eo.js +0 -713
  730. package/dist/daemon-cli-BqTT84vc.js +0 -12
  731. package/dist/dashboard-DORB5lWl.js +0 -81
  732. package/dist/dashboard-iCpchE4h.js +0 -2
  733. package/dist/delegate-DKyLT2Oh.js +0 -64
  734. package/dist/detached-task-runtime-B3Y6ddy3.js +0 -73
  735. package/dist/devices-cli-Cyiv4_7A.js +0 -498
  736. package/dist/diagnostics-BMdHyN8V.js +0 -154
  737. package/dist/direct-dm-CgMzHsLT.js +0 -64
  738. package/dist/dispatch-DIRZA2cy.js +0 -1131
  739. package/dist/dispatch-acp-1zk6S0I_.js +0 -981
  740. package/dist/dispatch-acp-manager.runtime-C7yW8oCJ.js +0 -3
  741. package/dist/dispatch-acp.runtime-CTRthZvU.js +0 -19
  742. package/dist/doctor-device-pairing-CNyJpHYP.js +0 -307
  743. package/dist/doctor-gateway-daemon-flow-BeOcm1lk.js +0 -250
  744. package/dist/doctor-gateway-health-DHGy54St.js +0 -63
  745. package/dist/doctor-health-D8Zx1Kxy.js +0 -59
  746. package/dist/doctor-health-contributions-fMT-eUkx.js +0 -493
  747. package/dist/doctor-prompter-Cr1NyTHN.js +0 -56
  748. package/dist/doctor-workspace-status-af2Bd95y.js +0 -75
  749. package/dist/dreaming-BNV8bPzi.js +0 -1582
  750. package/dist/dreaming-narrative-DrIvIgwX.js +0 -596
  751. package/dist/embedded-gateway-stub.runtime-CB0tG8-G.js +0 -9
  752. package/dist/exec-approvals-cli-1ipccPsH.js +0 -498
  753. package/dist/fallbacks-BZsnJYQ9.js +0 -2
  754. package/dist/fallbacks-DEDU9fM9.js +0 -31
  755. package/dist/fallbacks-shared-Bi9LfHSP.js +0 -111
  756. package/dist/gateway-cli-DhMqYIPl.js +0 -1283
  757. package/dist/gateway-rpc-DPTkm_sv.js +0 -14
  758. package/dist/gateway-rpc.runtime-BVlT2xPp.js +0 -23
  759. package/dist/gateway-runtime-DNBHtXEc.js +0 -15
  760. package/dist/gateway-status-C-vkewIw.js +0 -584
  761. package/dist/gateway-tRBsGvCm.js +0 -115
  762. package/dist/genesis-tools-5NSdlOTl.js +0 -9166
  763. package/dist/genesis-tools.runtime-AZkoDSZn.js +0 -2
  764. package/dist/get-reply-CyMVoBga.js +0 -3897
  765. package/dist/get-reply-from-config.runtime-DWfXY6kp.js +0 -2
  766. package/dist/graph-users-CeE20CJr.js +0 -1337
  767. package/dist/health-C-yFJe9m.js +0 -469
  768. package/dist/health-D5WYplmn.js +0 -3
  769. package/dist/health-route-C_njQhJj.js +0 -41
  770. package/dist/health-route-otTelRS8.js +0 -2
  771. package/dist/heartbeat-runner-9IsW8Xo7.js +0 -1292
  772. package/dist/heartbeat-runner-CUhmhWre.js +0 -5
  773. package/dist/heartbeat-runner.runtime-D-jqThKI.js +0 -4
  774. package/dist/hooks-cli-g0yKwqEG.js +0 -433
  775. package/dist/image-fallbacks-BZBfLjnm.js +0 -2
  776. package/dist/image-fallbacks-DauDOGEM.js +0 -31
  777. package/dist/inbound-reply-dispatch-2dA1_zqi.js +0 -73
  778. package/dist/infra-runtime-B7wP6gFI.js +0 -39
  779. package/dist/init-CbE2VqbJ.js +0 -59
  780. package/dist/library-BPRe1zEN.js +0 -45
  781. package/dist/lifecycle-29UzYVEZ.js +0 -229
  782. package/dist/lifecycle-BCpBPa5D.js +0 -571
  783. package/dist/lifecycle.runtime-3cCF_4AU.js +0 -2
  784. package/dist/list-B9lCYvDl.js +0 -1212
  785. package/dist/list-CV1Woixl.js +0 -2
  786. package/dist/list-D0yDvc4W.js +0 -2
  787. package/dist/list-DKY6QJ2V.js +0 -131
  788. package/dist/list.probe-BXvTngHv.js +0 -419
  789. package/dist/llm-slug-generator-DFEyGish.js +0 -79
  790. package/dist/load-config-Cw7kShkf.js +0 -35
  791. package/dist/local-dispatch.runtime-C8_YEk3p.js +0 -8
  792. package/dist/logs-cli-BrAFUk9w.js +0 -265
  793. package/dist/logs-cli.runtime-CUmu5b1C.js +0 -2
  794. package/dist/main-session-restart-recovery-DsRbypTW.js +0 -206
  795. package/dist/managed-image-attachments-BjaVhVEa.js +0 -2
  796. package/dist/managed-image-attachments-Cqy3EaEE.js +0 -635
  797. package/dist/manager-Cro57kFq.js +0 -2057
  798. package/dist/manager-DzFdCc4J.js +0 -2
  799. package/dist/markdown-to-line-BZuI0r-M.js +0 -790
  800. package/dist/mcp-cli-0WTvaoIg.js +0 -725
  801. package/dist/mcp-http-CeMRRWUu.js +0 -529
  802. package/dist/memory-core-host-runtime-cli-bOlGS396.js +0 -9
  803. package/dist/message-C7RIxkrZ.js +0 -232
  804. package/dist/message-action-runner-a01PfbVY.js +0 -1407
  805. package/dist/message-action-runner-bvmUIIVf.js +0 -2
  806. package/dist/message-actions-DjS0VVCy.js +0 -143
  807. package/dist/message.gateway.runtime-nt-TPAqA.js +0 -2
  808. package/dist/models-auth-status-BS_caq_x.js +0 -217
  809. package/dist/models-cli-DUrC7-c6.js +0 -271
  810. package/dist/monitor-BZNZ1ygG.js +0 -2
  811. package/dist/monitor-BlZsUodW.js +0 -788
  812. package/dist/monitor-CO_t3tSA.js +0 -1237
  813. package/dist/monitor-CexHU09e.js +0 -1661
  814. package/dist/monitor-DBFGvWm8.js +0 -671
  815. package/dist/monitor-auth-WUJo8zX5.js +0 -207
  816. package/dist/monitor-fK0HzOeR.js +0 -1459
  817. package/dist/monitor-processing-v0Oqdm83.js +0 -1974
  818. package/dist/monitor.runtime-B4COiD9M.js +0 -2
  819. package/dist/monitor.webhook-BrXwPWIb.js +0 -180
  820. package/dist/msteams-C0lsusC7.js +0 -35
  821. package/dist/native-hook-relay-DxLDo0kf.js +0 -519
  822. package/dist/nextcloud-talk-CDxdDhEa.js +0 -17
  823. package/dist/node-cli-BNQi7BfE.js +0 -2276
  824. package/dist/nodes-cli-Dfsc0scS.js +0 -1046
  825. package/dist/nodes-utils-CetwNv8w.js +0 -84
  826. package/dist/nodes.helpers-B4Yy3f8X.js +0 -34
  827. package/dist/notify-Bg4ukXOy.js +0 -315
  828. package/dist/onboard-BlzYtu39.js +0 -70
  829. package/dist/onboard-DZqeGCuM.js +0 -2
  830. package/dist/onboard-helpers-CFVEw4kg.js +0 -204
  831. package/dist/onboard-helpers-R0vTUoOE.js +0 -6
  832. package/dist/onboard-interactive-CTiy9p3b.js +0 -24
  833. package/dist/onboard-non-interactive-SC-UFDrb.js +0 -635
  834. package/dist/onboard-remote-0UXttO3s.js +0 -2
  835. package/dist/onboard-remote-BmUiJKba.js +0 -193
  836. package/dist/onboard-skills-855xT260.js +0 -2
  837. package/dist/onboard-skills-CF2ndciI.js +0 -134
  838. package/dist/openai-http-CE7y7YiI.js +0 -500
  839. package/dist/openresponses-http-DK86gsJO.js +0 -1128
  840. package/dist/operator-approvals-client-gp0A73Qi.js +0 -68
  841. package/dist/outbound.runtime-DP8BPmuN.js +0 -2
  842. package/dist/pair-command-approve-BtOQZGwa.js +0 -44
  843. package/dist/persistent-bindings.lifecycle-B0AshYYA.js +0 -2
  844. package/dist/persistent-bindings.lifecycle-DvTYe8mB.js +0 -85
  845. package/dist/pi-embedded-Be4Onpze.js +0 -4
  846. package/dist/pi-embedded-CGy7Dtnw.js +0 -2905
  847. package/dist/pi-embedded.runtime-BWPKSg0B.js +0 -4
  848. package/dist/pi-tool-definition-adapter-Jf9zETiY.js +0 -229
  849. package/dist/pi-tools-BQA19P3-.js +0 -1057
  850. package/dist/pi-tools.before-tool-call-Cz_axNf5.js +0 -2
  851. package/dist/pi-tools.before-tool-call-DCG_FnG8.js +0 -433
  852. package/dist/plugin-PXgxA053.js +0 -12195
  853. package/dist/plugin-enabled-sOFPFfw1.js +0 -140
  854. package/dist/plugin-registration-OrraXjhN.js +0 -23
  855. package/dist/plugin-service-CD-TC2TU.js +0 -2893
  856. package/dist/policy-Bu7soiqW.js +0 -328
  857. package/dist/prepare.runtime-CVPtWq-3.js +0 -815
  858. package/dist/probe--ur8kCb3.js +0 -241
  859. package/dist/probe-Afcq8e2r.js +0 -2
  860. package/dist/probe-B1Dp2K5f.js +0 -74
  861. package/dist/probe-CQxc5e0e.js +0 -1443
  862. package/dist/probe-D7acsevr.js +0 -45
  863. package/dist/probe-DC5E8AK5.js +0 -2
  864. package/dist/probe-HDLJLw4c.js +0 -2205
  865. package/dist/program-CmLQupJ3.js +0 -111
  866. package/dist/prompt-select-styled-DWw74syc.js +0 -20
  867. package/dist/protocol-D2Tvt0kQ.js +0 -2479
  868. package/dist/provider-dispatcher-CLjWHk-J.js +0 -2
  869. package/dist/provider-dispatcher-Cmgqznex.js +0 -22
  870. package/dist/qr-cli-BpSufxl3.js +0 -349
  871. package/dist/qr-cli-CNlU9tQo.js +0 -2
  872. package/dist/reaction-runtime-api-CgscWHaw.js +0 -116
  873. package/dist/reactions-CUuxlTLk.js +0 -998
  874. package/dist/register-service-commands-CVw_0FOU.js +0 -71
  875. package/dist/register.agent-D83zxSDT.js +0 -248
  876. package/dist/register.configure-CHoOiqzO.js +0 -15
  877. package/dist/register.maintenance-CV8Y0-GO.js +0 -363
  878. package/dist/register.message-B0eHsfLQ.js +0 -329
  879. package/dist/register.onboard-CbIO5sFl.js +0 -88
  880. package/dist/register.runtime-DDACHKw5.js +0 -81
  881. package/dist/register.setup-BrDiZ87w.js +0 -150
  882. package/dist/register.status-health-sessions-3PB3gA8Z.js +0 -1215
  883. package/dist/register.subclis-CaXmqTjH.js +0 -3
  884. package/dist/register.subclis-DXHaFVAj.js +0 -29
  885. package/dist/register.subclis-core-oPBkaD2j.js +0 -249
  886. package/dist/reply-dispatch-runtime-s8iIcsY4.js +0 -13
  887. package/dist/reply-runtime-CdbXuP0k.js +0 -11
  888. package/dist/reply.runtime-B8O4Za3t.js +0 -2
  889. package/dist/restart-health-C8OVhvQ6.js +0 -2
  890. package/dist/restart-health-DdG71XEk.js +0 -202
  891. package/dist/root-help-Dat5PidP.js +0 -44
  892. package/dist/routes--OomJzMJ.js +0 -2
  893. package/dist/routes-C9ddA05X.js +0 -3341
  894. package/dist/rpc-hYySaHuW.js +0 -61
  895. package/dist/rpc.runtime-xFzxQvGM.js +0 -21
  896. package/dist/run-delivery.runtime-pD6AAEFj.js +0 -530
  897. package/dist/run-embedded.runtime-BGCrB5dE.js +0 -4
  898. package/dist/run-execution-cli.runtime-Cm0qb1Jx.js +0 -4
  899. package/dist/run-executor.runtime-DmGdXgNE.js +0 -277
  900. package/dist/run-main-BhKIYDDS.js +0 -567
  901. package/dist/run-subagent-registry.runtime-BrCnLsaJ.js +0 -2
  902. package/dist/run-wait-V95b_owe.js +0 -135
  903. package/dist/runtime-BPcw5wKu.js +0 -973
  904. package/dist/runtime-CVtzoEXz.js +0 -9
  905. package/dist/runtime-api-C7SvtCrz.js +0 -4
  906. package/dist/runtime-api-D7kMb4r-.js +0 -9
  907. package/dist/runtime-api-GmwL5agC.js +0 -9
  908. package/dist/runtime-api-NZdHXq65.js +0 -14
  909. package/dist/runtime-embedded-pi.runtime-CiFf7LLh.js +0 -2
  910. package/dist/runtime-internal-9DTzq40y.js +0 -2
  911. package/dist/runtime-options-BABByM27.js +0 -275
  912. package/dist/runtime-schema-CQFcWgw7.js +0 -28588
  913. package/dist/scan-C-7SLtpq.js +0 -523
  914. package/dist/scan-DW5OMHlc.js +0 -2
  915. package/dist/secrets-cli-BWgJDRGu.js +0 -2101
  916. package/dist/security-cli-CVScUBAh.js +0 -486
  917. package/dist/selection-BJhGK0Gg.js +0 -2
  918. package/dist/selection-C8GY4Sin.js +0 -7764
  919. package/dist/send-CH0zRgEY.js +0 -102
  920. package/dist/send-gStK80j4.js +0 -156
  921. package/dist/send.runtime-D5GAmGpy.js +0 -2
  922. package/dist/server-BamjooS9.js +0 -77
  923. package/dist/server-DOlUxe29.js +0 -13
  924. package/dist/server-context-BHGn60Nv.js +0 -2
  925. package/dist/server-context-D0DCL0Yr.js +0 -847
  926. package/dist/server-node-events-CKfJMKY6.js +0 -481
  927. package/dist/server-plugin-bootstrap-CgdqnkvH.js +0 -13176
  928. package/dist/server-plugin-bootstrap-Dqa8MSb3.js +0 -2
  929. package/dist/server-restart-sentinel-D5NKTQlr.js +0 -697
  930. package/dist/server.impl-CaBpcCte.js +0 -12894
  931. package/dist/session-kill-http-Dkyu6aeK.js +0 -110
  932. package/dist/session-reset-service-bUkkZbtS.js +0 -497
  933. package/dist/session-route-osDI35ex.js +0 -93
  934. package/dist/session-status.runtime-XUwfwKYy.js +0 -2
  935. package/dist/session-subagent-reactivation.runtime-DIrxFxhQ.js +0 -2
  936. package/dist/session-tab-registry-DMcC2sO-.js +0 -581
  937. package/dist/session-visibility-BE4lf4vj.js +0 -147
  938. package/dist/sessions-helpers-qYgG99le.js +0 -305
  939. package/dist/sessions-history-http-B6Tw9U6o.js +0 -383
  940. package/dist/sessions-patch-C2VfpT6N.js +0 -309
  941. package/dist/sessions-resolve-Dgj16ung.js +0 -174
  942. package/dist/sessions.runtime-De075L9O.js +0 -2
  943. package/dist/setup-IZ8-o496.js +0 -636
  944. package/dist/setup-api-Brg9D0Et.js +0 -29
  945. package/dist/setup-core-DBNJOXUe.js +0 -176
  946. package/dist/setup-core-YMlDym-t.js +0 -171
  947. package/dist/setup-surface-B8zw_Iry.js +0 -286
  948. package/dist/setup-surface-DiER1ybG2.js +0 -403
  949. package/dist/setup-surface-ZQJE1d97.js +0 -219
  950. package/dist/setup.finalize-DV7-ttFc.js +0 -547
  951. package/dist/setup.gateway-config-CeiELioQ.js +0 -250
  952. package/dist/shared-BddlhgtM.js +0 -198
  953. package/dist/shared-C9Fg93Nk.js +0 -76
  954. package/dist/shared-rY0Q3SUO.js +0 -121
  955. package/dist/slash-state-BXsMm6Ug.js +0 -1911
  956. package/dist/src-2iJPePTa.js +0 -3974
  957. package/dist/startup-context-L7eFlMGe.js +0 -312
  958. package/dist/status-2mHKLi_8.js +0 -2
  959. package/dist/status-4QVSRSC2.js +0 -3
  960. package/dist/status-Bpg8pFBH.js +0 -2
  961. package/dist/status-CYWc74qO.js +0 -397
  962. package/dist/status-EKvbpCYq.js +0 -190
  963. package/dist/status-all-vTJtEeTs.js +0 -498
  964. package/dist/status-json-82GOaBg2.js +0 -14
  965. package/dist/status-json-command-DE1OsrKi.js +0 -84
  966. package/dist/status-okdvu7xW.js +0 -209
  967. package/dist/status-runtime-shared--i8Snuyb.js +0 -257
  968. package/dist/status-subagents.runtime-D9r3_cd8.js +0 -18
  969. package/dist/status-text-Csq9CBHh.js +0 -237
  970. package/dist/status.gateway-connection.runtime-D4Z7cUpS.js +0 -2
  971. package/dist/status.gather-DjPsPYjd.js +0 -2
  972. package/dist/status.gather-GYO4n_GF.js +0 -292
  973. package/dist/status.runtime-BnkekTYc.js +0 -2
  974. package/dist/status.scan-CGZs2gNK.js +0 -65
  975. package/dist/status.scan-overview-CvMmc4_9.js +0 -379
  976. package/dist/status.scan.fast-json-BuLGkMEu.js +0 -132
  977. package/dist/status.scan.fast-json-DbPM0LbX.js +0 -2
  978. package/dist/status.summary-DNjIEj7M.js +0 -214
  979. package/dist/status.summary-thyeq75l.js +0 -2
  980. package/dist/subagent-announce-BXNGQkca.js +0 -351
  981. package/dist/subagent-announce-delivery-CssdaIK0.js +0 -726
  982. package/dist/subagent-announce-output-DK4zF_4-.js +0 -364
  983. package/dist/subagent-control-8V6C3iHm.js +0 -506
  984. package/dist/subagent-followup.runtime-DiBrlbMB.js +0 -68
  985. package/dist/subagent-orphan-recovery-DF-RlZbs.js +0 -305
  986. package/dist/subagent-registry-B7roWOkp.js +0 -1753
  987. package/dist/subagent-registry-C0Vew-3L.js +0 -3
  988. package/dist/subagent-spawn-DO4jFMOF.js +0 -1005
  989. package/dist/system-cli-CxuvHMmE.js +0 -59
  990. package/dist/targets-BrIxxqDm.js +0 -67
  991. package/dist/task-executor-B3GpI_R_.js +0 -360
  992. package/dist/task-owner-access-oQnQP_b3.js +0 -74
  993. package/dist/task-registry-EHbmFqsi.js +0 -2366
  994. package/dist/task-registry-delivery-runtime-DkQoAcL3.js +0 -3
  995. package/dist/task-registry-delivery-runtime-XqEQlx86.js +0 -2
  996. package/dist/task-registry.maintenance-BpI-YUOA.js +0 -2
  997. package/dist/task-registry.maintenance-D6WzGM5R.js +0 -416
  998. package/dist/testing-CY7YdvFP.js +0 -575
  999. package/dist/text-report-Cu-Drg33.js +0 -587
  1000. package/dist/tool-resolution-BIa_L_eS.js +0 -90
  1001. package/dist/tools-effective-inventory-DdF_gXu6.js +0 -152
  1002. package/dist/tools-invoke-http-Dhrho-XH.js +0 -206
  1003. package/dist/trash-DDT5xMIb.js +0 -24
  1004. package/dist/tui-cli-DqAyUsXV.js +0 -4595
  1005. package/dist/update-cli-DzUvmsG8.js +0 -1759
  1006. package/dist/upgrade-CXPGf4xq.js +0 -1226
  1007. package/dist/video-generation-task-status-Ccbv5_ls.js +0 -163
  1008. package/dist/wait-for-idle-before-flush-_1jKR3ID.js +0 -5986
  1009. package/dist/wizard-models-CQwA3L3M.js +0 -334
@@ -1,2893 +0,0 @@
1
- import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, f as readStringValue, s as normalizeOptionalLowercaseString } from "./string-coerce-DPP_aYVc.js";
2
- import { _ as shortenHomePath } from "./utils-CWrkFsp0.js";
3
- import { n as defaultRuntime } from "./runtime-DDkDH9fa.js";
4
- import { t as formatDocsLink } from "./links-C1-jbHJx.js";
5
- import { r as theme } from "./theme-DD6pQv2_.js";
6
- import { n as inheritOptionFromParent } from "./command-options-BAeBeFgJ.js";
7
- import { t as formatCliCommand } from "./command-format-B3Q5KD9o.js";
8
- import { n as info, t as danger } from "./globals-wYf9_gv5.js";
9
- import { a as loadConfig } from "./io-lNN4Levs.js";
10
- import { En as errorShape, Tn as ErrorCodes } from "./protocol-D2Tvt0kQ.js";
11
- import { t as parseBooleanValue } from "./boolean-X_ITY8mk.js";
12
- import { c as imageResultFromFile, g as readStringParam, l as jsonResult } from "./common-BtK-bRqD.js";
13
- import { t as callGatewayTool } from "./gateway-tRBsGvCm.js";
14
- import { i as stringEnum, r as optionalStringEnum } from "./typebox-Id7rcapj.js";
15
- import { a as selectDefaultNodeFromList, i as resolveNodeIdFromList, t as listNodes } from "./nodes-utils-CetwNv8w.js";
16
- import { i as wrapExternalContent } from "./external-content-Dmoxx-Ic.js";
17
- import { t as withTimeout } from "./with-timeout-CFh4cUs-.js";
18
- import "./text-runtime-CFgLIdKf.js";
19
- import { t as startLazyPluginServiceModule } from "./lazy-service-module-DP9zBTob.js";
20
- import "./browser-config-runtime-BUvF2HCY.js";
21
- import { n as callGatewayFromCli, t as addGatewayClientOptions } from "./gateway-rpc-DPTkm_sv.js";
22
- import { n as runCommandWithRuntime } from "./cli-utils-C80mOHVm.js";
23
- import { i as resolveNodeCommandAllowlist, n as isNodeCommandAllowed } from "./node-command-policy-BaEyd8HH.js";
24
- import { i as safeParseJson, n as respondUnavailableOnNodeInvokeError } from "./nodes.helpers-B4Yy3f8X.js";
25
- import "./browser-node-runtime-CuGRBA2N.js";
26
- import "./browser-security-runtime-bMw-CyNH.js";
27
- import { t as formatHelpExamples } from "./help-format-DziqFQ8a.js";
28
- import "./browser-setup-tools-75eBLdGG.js";
29
- import "./channel-actions-SJNm6c99.js";
30
- import { _ as browserStop, a as untrackSessionBrowserTab, d as browserOpenTab, f as browserProfiles, g as browserStatus, h as browserStart, i as trackSessionBrowserTab, l as browserDoctor, m as browserSnapshot, o as browserCloseTab, r as touchSessionBrowserTab, u as browserFocusTab, y as browserTabs } from "./session-tab-registry-DMcC2sO-.js";
31
- import { c as DEFAULT_AI_SNAPSHOT_MAX_CHARS, i as resolveExistingPathsWithinRoot, r as DEFAULT_UPLOAD_DIR } from "./paths-CQ_G-HVX.js";
32
- import { a as applyBrowserProxyPaths, c as browserPdfSave, d as browserArmFileChooser, f as browserNavigate, i as resolveRequestedBrowserProfile, l as browserAct, n as isPersistentBrowserProfileMutation, o as persistBrowserProxyFiles, p as browserScreenshotAction, s as browserConsoleMessages, u as browserArmDialog } from "./browser-runtime-C_MYMBwN.js";
33
- import { n as resolveProfile, t as resolveBrowserConfig } from "./config-CvQPjE0Q.js";
34
- import { f as redactCdpUrl } from "./cdp.helpers-Ch0SX_4B.js";
35
- import { r as getBrowserProfileCapabilities } from "./target-id-C3xU4Nxn.js";
36
- import { l as normalizeBrowserFormField, u as normalizeBrowserFormFieldValue } from "./pw-role-snapshot-FLhbl4C2.js";
37
- import { a as createBrowserRouteDispatcher, r as startBrowserControlServiceFromConfig, t as createBrowserControlContext } from "./control-service-CVq5rWGF.js";
38
- import fs from "node:fs/promises";
39
- import crypto from "node:crypto";
40
- import { Type } from "typebox";
41
- //#region extensions/browser/src/browser-tool.schema.ts
42
- const BROWSER_ACT_KINDS = [
43
- "click",
44
- "clickCoords",
45
- "type",
46
- "press",
47
- "hover",
48
- "drag",
49
- "select",
50
- "fill",
51
- "resize",
52
- "wait",
53
- "evaluate",
54
- "close"
55
- ];
56
- const BROWSER_TOOL_ACTIONS = [
57
- "doctor",
58
- "status",
59
- "start",
60
- "stop",
61
- "profiles",
62
- "tabs",
63
- "open",
64
- "focus",
65
- "close",
66
- "snapshot",
67
- "screenshot",
68
- "navigate",
69
- "console",
70
- "pdf",
71
- "upload",
72
- "dialog",
73
- "act"
74
- ];
75
- const BROWSER_TARGETS = [
76
- "sandbox",
77
- "host",
78
- "node"
79
- ];
80
- const BROWSER_SNAPSHOT_FORMATS = ["aria", "ai"];
81
- const BROWSER_SNAPSHOT_MODES = ["efficient"];
82
- const BROWSER_SNAPSHOT_REFS = ["role", "aria"];
83
- const BROWSER_IMAGE_TYPES = ["png", "jpeg"];
84
- const BrowserActSchema = Type.Object({
85
- kind: stringEnum(BROWSER_ACT_KINDS),
86
- targetId: Type.Optional(Type.String()),
87
- ref: Type.Optional(Type.String()),
88
- doubleClick: Type.Optional(Type.Boolean()),
89
- button: Type.Optional(Type.String()),
90
- modifiers: Type.Optional(Type.Array(Type.String())),
91
- x: Type.Optional(Type.Number()),
92
- y: Type.Optional(Type.Number()),
93
- text: Type.Optional(Type.String()),
94
- submit: Type.Optional(Type.Boolean()),
95
- slowly: Type.Optional(Type.Boolean()),
96
- key: Type.Optional(Type.String()),
97
- delayMs: Type.Optional(Type.Number()),
98
- startRef: Type.Optional(Type.String()),
99
- endRef: Type.Optional(Type.String()),
100
- values: Type.Optional(Type.Array(Type.String())),
101
- fields: Type.Optional(Type.Array(Type.Object({}, { additionalProperties: true }))),
102
- width: Type.Optional(Type.Number()),
103
- height: Type.Optional(Type.Number()),
104
- timeMs: Type.Optional(Type.Number()),
105
- selector: Type.Optional(Type.String()),
106
- url: Type.Optional(Type.String()),
107
- loadState: Type.Optional(Type.String()),
108
- textGone: Type.Optional(Type.String()),
109
- timeoutMs: Type.Optional(Type.Number()),
110
- fn: Type.Optional(Type.String())
111
- });
112
- const BrowserToolSchema = Type.Object({
113
- action: stringEnum(BROWSER_TOOL_ACTIONS),
114
- target: optionalStringEnum(BROWSER_TARGETS),
115
- node: Type.Optional(Type.String()),
116
- profile: Type.Optional(Type.String()),
117
- targetUrl: Type.Optional(Type.String()),
118
- url: Type.Optional(Type.String()),
119
- targetId: Type.Optional(Type.String()),
120
- label: Type.Optional(Type.String()),
121
- limit: Type.Optional(Type.Number()),
122
- maxChars: Type.Optional(Type.Number()),
123
- mode: optionalStringEnum(BROWSER_SNAPSHOT_MODES),
124
- snapshotFormat: optionalStringEnum(BROWSER_SNAPSHOT_FORMATS),
125
- refs: optionalStringEnum(BROWSER_SNAPSHOT_REFS),
126
- interactive: Type.Optional(Type.Boolean()),
127
- compact: Type.Optional(Type.Boolean()),
128
- depth: Type.Optional(Type.Number()),
129
- selector: Type.Optional(Type.String()),
130
- frame: Type.Optional(Type.String()),
131
- labels: Type.Optional(Type.Boolean()),
132
- urls: Type.Optional(Type.Boolean()),
133
- fullPage: Type.Optional(Type.Boolean()),
134
- ref: Type.Optional(Type.String()),
135
- element: Type.Optional(Type.String()),
136
- type: optionalStringEnum(BROWSER_IMAGE_TYPES),
137
- level: Type.Optional(Type.String()),
138
- paths: Type.Optional(Type.Array(Type.String())),
139
- inputRef: Type.Optional(Type.String()),
140
- timeoutMs: Type.Optional(Type.Number()),
141
- accept: Type.Optional(Type.Boolean()),
142
- promptText: Type.Optional(Type.String()),
143
- kind: Type.Optional(stringEnum(BROWSER_ACT_KINDS)),
144
- doubleClick: Type.Optional(Type.Boolean()),
145
- button: Type.Optional(Type.String()),
146
- modifiers: Type.Optional(Type.Array(Type.String())),
147
- x: Type.Optional(Type.Number()),
148
- y: Type.Optional(Type.Number()),
149
- text: Type.Optional(Type.String()),
150
- submit: Type.Optional(Type.Boolean()),
151
- slowly: Type.Optional(Type.Boolean()),
152
- key: Type.Optional(Type.String()),
153
- delayMs: Type.Optional(Type.Number()),
154
- startRef: Type.Optional(Type.String()),
155
- endRef: Type.Optional(Type.String()),
156
- values: Type.Optional(Type.Array(Type.String())),
157
- fields: Type.Optional(Type.Array(Type.Object({}, { additionalProperties: true }))),
158
- width: Type.Optional(Type.Number()),
159
- height: Type.Optional(Type.Number()),
160
- timeMs: Type.Optional(Type.Number()),
161
- textGone: Type.Optional(Type.String()),
162
- loadState: Type.Optional(Type.String()),
163
- fn: Type.Optional(Type.String()),
164
- request: Type.Optional(BrowserActSchema)
165
- });
166
- //#endregion
167
- //#region extensions/browser/src/browser-tool.actions.ts
168
- const browserToolActionDeps = {
169
- browserAct,
170
- browserConsoleMessages,
171
- browserSnapshot,
172
- browserTabs,
173
- imageResultFromFile,
174
- loadConfig
175
- };
176
- const BROWSER_ACT_REQUEST_TIMEOUT_SLACK_MS = 5e3;
177
- function normalizePositiveTimeoutMs(value) {
178
- return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
179
- }
180
- function supportsBrowserActTimeout(request) {
181
- switch (request.kind) {
182
- case "click":
183
- case "type":
184
- case "hover":
185
- case "scrollIntoView":
186
- case "drag":
187
- case "select":
188
- case "fill":
189
- case "evaluate":
190
- case "wait": return true;
191
- default: return false;
192
- }
193
- }
194
- function existingSessionRejectsActTimeout(request) {
195
- switch (request.kind) {
196
- case "type":
197
- case "hover":
198
- case "scrollIntoView":
199
- case "drag":
200
- case "select":
201
- case "fill":
202
- case "evaluate": return true;
203
- default: return false;
204
- }
205
- }
206
- function usesExistingSessionProfile(profileName) {
207
- const cfg = browserToolActionDeps.loadConfig();
208
- const resolved = resolveBrowserConfig(cfg.browser, cfg);
209
- const profile = resolveProfile(resolved, profileName ?? resolved.defaultProfile);
210
- return profile ? getBrowserProfileCapabilities(profile).usesChromeMcp : false;
211
- }
212
- function withConfiguredActTimeout(request, profileName) {
213
- const typedRequest = request;
214
- if (normalizePositiveTimeoutMs(typedRequest.timeoutMs) !== void 0) return request;
215
- if (!supportsBrowserActTimeout(request)) return request;
216
- if (existingSessionRejectsActTimeout(request) && usesExistingSessionProfile(profileName)) return request;
217
- const configuredTimeout = normalizePositiveTimeoutMs(browserToolActionDeps.loadConfig().browser?.actionTimeoutMs) ?? 6e4;
218
- return {
219
- ...typedRequest,
220
- timeoutMs: configuredTimeout
221
- };
222
- }
223
- function resolveActProxyTimeoutMs(request) {
224
- const candidateTimeouts = [];
225
- const explicitTimeout = normalizePositiveTimeoutMs(request.timeoutMs);
226
- if (explicitTimeout !== void 0) candidateTimeouts.push(explicitTimeout + BROWSER_ACT_REQUEST_TIMEOUT_SLACK_MS);
227
- if (request.kind === "wait") {
228
- const waitDuration = normalizePositiveTimeoutMs(request.timeMs);
229
- if (waitDuration !== void 0) candidateTimeouts.push(waitDuration + BROWSER_ACT_REQUEST_TIMEOUT_SLACK_MS);
230
- }
231
- return candidateTimeouts.length ? Math.max(...candidateTimeouts) : void 0;
232
- }
233
- function formatAgentTab(tab) {
234
- if (!tab || typeof tab !== "object") return { value: tab };
235
- const source = tab;
236
- const targetId = readStringValue(source.targetId);
237
- const tabId = readStringValue(source.tabId);
238
- const label = readStringValue(source.label);
239
- const suggestedTargetId = readStringValue(source.suggestedTargetId) ?? label ?? tabId ?? targetId;
240
- return {
241
- ...suggestedTargetId ? { suggestedTargetId } : {},
242
- ...tabId ? { tabId } : {},
243
- ...label ? { label } : {},
244
- title: source.title,
245
- url: source.url,
246
- type: source.type,
247
- ...targetId ? { targetId } : {},
248
- ...source.wsUrl ? { wsUrl: source.wsUrl } : {}
249
- };
250
- }
251
- function wrapBrowserExternalJson(params) {
252
- return {
253
- wrappedText: wrapExternalContent(JSON.stringify(params.payload, null, 2), {
254
- source: "browser",
255
- includeWarning: params.includeWarning ?? true
256
- }),
257
- safeDetails: {
258
- ok: true,
259
- externalContent: {
260
- untrusted: true,
261
- source: "browser",
262
- kind: params.kind,
263
- wrapped: true
264
- }
265
- }
266
- };
267
- }
268
- function formatTabsToolResult(tabs) {
269
- const formattedTabs = tabs.map((tab) => formatAgentTab(tab));
270
- const wrapped = wrapBrowserExternalJson({
271
- kind: "tabs",
272
- payload: { tabs: formattedTabs },
273
- includeWarning: false
274
- });
275
- return {
276
- content: [{
277
- type: "text",
278
- text: wrapped.wrappedText
279
- }],
280
- details: {
281
- ...wrapped.safeDetails,
282
- tabCount: tabs.length,
283
- tabs: formattedTabs
284
- }
285
- };
286
- }
287
- function formatConsoleToolResult(result) {
288
- const wrapped = wrapBrowserExternalJson({
289
- kind: "console",
290
- payload: result,
291
- includeWarning: false
292
- });
293
- return {
294
- content: [{
295
- type: "text",
296
- text: wrapped.wrappedText
297
- }],
298
- details: {
299
- ...wrapped.safeDetails,
300
- targetId: readStringValue(result.targetId),
301
- messageCount: Array.isArray(result.messages) ? result.messages.length : void 0
302
- }
303
- };
304
- }
305
- function isChromeStaleTargetError(profile, err) {
306
- if (!profile) return false;
307
- if (profile === "user") {
308
- const msg = String(err);
309
- return msg.includes("404:") && msg.includes("tab not found");
310
- }
311
- const cfg = browserToolActionDeps.loadConfig();
312
- const browserProfile = resolveProfile(resolveBrowserConfig(cfg.browser, cfg), profile);
313
- if (!browserProfile || !getBrowserProfileCapabilities(browserProfile).usesChromeMcp) return false;
314
- const msg = String(err);
315
- return msg.includes("404:") && msg.includes("tab not found");
316
- }
317
- function stripTargetIdFromActRequest(request) {
318
- if (!normalizeOptionalString(request.targetId)) return null;
319
- const retryRequest = { ...request };
320
- delete retryRequest.targetId;
321
- return retryRequest;
322
- }
323
- function canRetryChromeActWithoutTargetId(request) {
324
- const typedRequest = request;
325
- const kind = typeof typedRequest.kind === "string" ? typedRequest.kind : typeof typedRequest.action === "string" ? typedRequest.action : "";
326
- return kind === "hover" || kind === "scrollIntoView" || kind === "wait";
327
- }
328
- function isAriaRefsUnsupportedError(err) {
329
- const msg = String(err).toLowerCase();
330
- return msg.includes("refs=aria") && msg.includes("not support");
331
- }
332
- function withRoleRefsFallback(snapshotQuery) {
333
- return {
334
- ...snapshotQuery,
335
- refs: "role"
336
- };
337
- }
338
- async function executeTabsAction(params) {
339
- const { baseUrl, profile, timeoutMs, proxyRequest } = params;
340
- if (proxyRequest) return formatTabsToolResult((await proxyRequest({
341
- method: "GET",
342
- path: "/tabs",
343
- profile,
344
- timeoutMs
345
- })).tabs ?? []);
346
- return formatTabsToolResult(await browserToolActionDeps.browserTabs(baseUrl, {
347
- profile,
348
- timeoutMs
349
- }));
350
- }
351
- async function executeSnapshotAction(params) {
352
- const { input, baseUrl, profile, proxyRequest } = params;
353
- const snapshotDefaults = browserToolActionDeps.loadConfig().browser?.snapshotDefaults;
354
- const format = input.snapshotFormat === "ai" ? "ai" : input.snapshotFormat === "aria" ? "aria" : void 0;
355
- const formatExplicit = format !== void 0;
356
- const mode = input.mode === "efficient" ? "efficient" : !formatExplicit && format !== "aria" && snapshotDefaults?.mode === "efficient" ? "efficient" : void 0;
357
- const labels = typeof input.labels === "boolean" ? input.labels : void 0;
358
- const urls = typeof input.urls === "boolean" ? input.urls : void 0;
359
- const refs = input.refs === "aria" || input.refs === "role" ? input.refs : void 0;
360
- const hasMaxChars = Object.hasOwn(input, "maxChars");
361
- const targetId = normalizeOptionalString(input.targetId);
362
- const limit = typeof input.limit === "number" && Number.isFinite(input.limit) ? input.limit : void 0;
363
- const maxChars = typeof input.maxChars === "number" && Number.isFinite(input.maxChars) && input.maxChars > 0 ? Math.floor(input.maxChars) : void 0;
364
- const interactive = typeof input.interactive === "boolean" ? input.interactive : void 0;
365
- const compact = typeof input.compact === "boolean" ? input.compact : void 0;
366
- const depth = typeof input.depth === "number" && Number.isFinite(input.depth) ? input.depth : void 0;
367
- const selector = normalizeOptionalString(input.selector);
368
- const frame = normalizeOptionalString(input.frame);
369
- const resolvedMaxChars = format === "ai" ? hasMaxChars ? maxChars : mode === "efficient" ? void 0 : DEFAULT_AI_SNAPSHOT_MAX_CHARS : hasMaxChars ? maxChars : void 0;
370
- const snapshotQuery = {
371
- ...format ? { format } : {},
372
- targetId,
373
- limit,
374
- ...typeof resolvedMaxChars === "number" ? { maxChars: resolvedMaxChars } : {},
375
- refs,
376
- interactive,
377
- compact,
378
- depth,
379
- selector,
380
- frame,
381
- labels,
382
- urls,
383
- mode
384
- };
385
- let refsFallback;
386
- const readSnapshot = async (query) => proxyRequest ? await proxyRequest({
387
- method: "GET",
388
- path: "/snapshot",
389
- profile,
390
- query
391
- }) : await browserToolActionDeps.browserSnapshot(baseUrl, {
392
- ...query,
393
- profile
394
- });
395
- let snapshot;
396
- try {
397
- snapshot = await readSnapshot(snapshotQuery);
398
- } catch (err) {
399
- if (refs !== "aria" || !isAriaRefsUnsupportedError(err)) throw err;
400
- refsFallback = "role";
401
- snapshot = await readSnapshot(withRoleRefsFallback(snapshotQuery));
402
- }
403
- params.onTabActivity?.(readStringValue(snapshot.targetId) ?? targetId, snapshot.url);
404
- if (snapshot.format === "ai") {
405
- const wrappedSnapshot = wrapExternalContent(snapshot.snapshot ?? "", {
406
- source: "browser",
407
- includeWarning: true
408
- });
409
- const safeDetails = {
410
- ok: true,
411
- format: snapshot.format,
412
- targetId: snapshot.targetId,
413
- url: snapshot.url,
414
- truncated: snapshot.truncated,
415
- stats: snapshot.stats,
416
- refs: snapshot.refs ? Object.keys(snapshot.refs).length : void 0,
417
- labels: snapshot.labels,
418
- labelsCount: snapshot.labelsCount,
419
- labelsSkipped: snapshot.labelsSkipped,
420
- imagePath: snapshot.imagePath,
421
- imageType: snapshot.imageType,
422
- refsFallback,
423
- externalContent: {
424
- untrusted: true,
425
- source: "browser",
426
- kind: "snapshot",
427
- format: "ai",
428
- wrapped: true
429
- }
430
- };
431
- if (labels && snapshot.imagePath) return await browserToolActionDeps.imageResultFromFile({
432
- label: "browser:snapshot",
433
- path: snapshot.imagePath,
434
- extraText: wrappedSnapshot,
435
- details: safeDetails
436
- });
437
- return {
438
- content: [{
439
- type: "text",
440
- text: wrappedSnapshot
441
- }],
442
- details: safeDetails
443
- };
444
- }
445
- {
446
- const wrapped = wrapBrowserExternalJson({
447
- kind: "snapshot",
448
- payload: snapshot
449
- });
450
- return {
451
- content: [{
452
- type: "text",
453
- text: wrapped.wrappedText
454
- }],
455
- details: {
456
- ...wrapped.safeDetails,
457
- format: "aria",
458
- targetId: snapshot.targetId,
459
- url: snapshot.url,
460
- nodeCount: snapshot.nodes.length,
461
- externalContent: {
462
- untrusted: true,
463
- source: "browser",
464
- kind: "snapshot",
465
- format: "aria",
466
- wrapped: true
467
- }
468
- }
469
- };
470
- }
471
- }
472
- async function executeConsoleAction(params) {
473
- const { input, baseUrl, profile, proxyRequest } = params;
474
- const level = normalizeOptionalString(input.level);
475
- const targetId = normalizeOptionalString(input.targetId);
476
- if (proxyRequest) return formatConsoleToolResult(await proxyRequest({
477
- method: "GET",
478
- path: "/console",
479
- profile,
480
- query: {
481
- level,
482
- targetId
483
- }
484
- }));
485
- return formatConsoleToolResult(await browserToolActionDeps.browserConsoleMessages(baseUrl, {
486
- level,
487
- targetId,
488
- profile
489
- }));
490
- }
491
- async function executeActAction(params) {
492
- const { request, baseUrl, profile, proxyRequest } = params;
493
- const effectiveRequest = withConfiguredActTimeout(request, profile);
494
- try {
495
- const result = proxyRequest ? await proxyRequest({
496
- method: "POST",
497
- path: "/act",
498
- profile,
499
- body: effectiveRequest,
500
- timeoutMs: resolveActProxyTimeoutMs(effectiveRequest)
501
- }) : await browserToolActionDeps.browserAct(baseUrl, effectiveRequest, { profile });
502
- params.onTabActivity?.(readStringValue(result.targetId) ?? readStringValue(effectiveRequest.targetId), readStringValue(result.url));
503
- return jsonResult(result);
504
- } catch (err) {
505
- if (isChromeStaleTargetError(profile, err)) {
506
- const retryRequest = stripTargetIdFromActRequest(effectiveRequest);
507
- const tabs = proxyRequest ? (await proxyRequest({
508
- method: "GET",
509
- path: "/tabs",
510
- profile
511
- })).tabs ?? [] : await browserToolActionDeps.browserTabs(baseUrl, { profile }).catch(() => []);
512
- if (retryRequest && canRetryChromeActWithoutTargetId(effectiveRequest) && tabs.length === 1) try {
513
- const retryResult = proxyRequest ? await proxyRequest({
514
- method: "POST",
515
- path: "/act",
516
- profile,
517
- body: retryRequest,
518
- timeoutMs: resolveActProxyTimeoutMs(retryRequest)
519
- }) : await browserToolActionDeps.browserAct(baseUrl, retryRequest, { profile });
520
- params.onTabActivity?.(readStringValue(retryResult.targetId) ?? readStringValue(retryRequest.targetId), readStringValue(retryResult.url));
521
- return jsonResult(retryResult);
522
- } catch {}
523
- if (!tabs.length) throw new Error(`No browser tabs found for profile="${profile}". Make sure the configured Chromium-based browser (v144+) is running and has open tabs, then retry.`, { cause: err });
524
- throw new Error(`Chrome tab not found (stale targetId?). Run action=tabs profile="${profile}" and use one of the returned targetIds.`, { cause: err });
525
- }
526
- throw err;
527
- }
528
- }
529
- //#endregion
530
- //#region extensions/browser/src/browser-tool.ts
531
- const browserToolDeps = {
532
- browserAct,
533
- browserArmDialog,
534
- browserArmFileChooser,
535
- browserCloseTab,
536
- browserDoctor,
537
- browserFocusTab,
538
- browserNavigate,
539
- browserOpenTab,
540
- browserPdfSave,
541
- browserProfiles,
542
- browserScreenshotAction,
543
- browserStart,
544
- browserStatus,
545
- browserStop,
546
- imageResultFromFile,
547
- loadConfig,
548
- listNodes,
549
- callGatewayTool,
550
- touchSessionBrowserTab,
551
- trackSessionBrowserTab,
552
- untrackSessionBrowserTab
553
- };
554
- function readOptionalTargetAndTimeout(params) {
555
- return {
556
- targetId: normalizeOptionalString(params.targetId),
557
- timeoutMs: typeof params.timeoutMs === "number" && Number.isFinite(params.timeoutMs) ? params.timeoutMs : void 0
558
- };
559
- }
560
- function readTargetUrlParam(params) {
561
- return readStringParam(params, "targetUrl") ?? readStringParam(params, "url", {
562
- required: true,
563
- label: "targetUrl"
564
- });
565
- }
566
- const LEGACY_BROWSER_ACT_REQUEST_KEYS = [
567
- "targetId",
568
- "ref",
569
- "doubleClick",
570
- "button",
571
- "modifiers",
572
- "x",
573
- "y",
574
- "text",
575
- "submit",
576
- "slowly",
577
- "key",
578
- "delayMs",
579
- "startRef",
580
- "endRef",
581
- "values",
582
- "fields",
583
- "width",
584
- "height",
585
- "timeMs",
586
- "textGone",
587
- "selector",
588
- "url",
589
- "loadState",
590
- "fn",
591
- "timeoutMs"
592
- ];
593
- function readActRequestParam(params) {
594
- const requestParam = params.request;
595
- if (requestParam && typeof requestParam === "object") return requestParam;
596
- const kind = readStringParam(params, "kind");
597
- if (!kind) return;
598
- const request = { kind };
599
- for (const key of LEGACY_BROWSER_ACT_REQUEST_KEYS) {
600
- if (!Object.hasOwn(params, key)) continue;
601
- request[key] = params[key];
602
- }
603
- return request;
604
- }
605
- const DEFAULT_BROWSER_PROXY_TIMEOUT_MS = 2e4;
606
- const BROWSER_PROXY_GATEWAY_TIMEOUT_SLACK_MS = 5e3;
607
- function isBrowserNode$1(node) {
608
- const caps = Array.isArray(node.caps) ? node.caps : [];
609
- const commands = Array.isArray(node.commands) ? node.commands : [];
610
- return caps.includes("browser") || commands.includes("browser.proxy");
611
- }
612
- async function resolveBrowserNodeTarget$1(params) {
613
- const policy = browserToolDeps.loadConfig().gateway?.nodes?.browser;
614
- const mode = policy?.mode ?? "auto";
615
- if (mode === "off") {
616
- if (params.target === "node" || params.requestedNode) throw new Error("Node browser proxy is disabled (gateway.nodes.browser.mode=off).");
617
- return null;
618
- }
619
- if (params.sandboxBridgeUrl?.trim() && params.target !== "node" && !params.requestedNode) return null;
620
- if (params.target && params.target !== "node") return null;
621
- if (mode === "manual" && params.target !== "node" && !params.requestedNode) return null;
622
- const browserNodes = (await browserToolDeps.listNodes({})).filter((node) => node.connected && isBrowserNode$1(node));
623
- if (browserNodes.length === 0) {
624
- if (params.target === "node" || params.requestedNode) throw new Error("No connected browser-capable nodes.");
625
- return null;
626
- }
627
- const requested = params.requestedNode?.trim() || policy?.node?.trim();
628
- if (requested) {
629
- const nodeId = resolveNodeIdFromList(browserNodes, requested, false);
630
- const node = browserNodes.find((entry) => entry.nodeId === nodeId);
631
- return {
632
- nodeId,
633
- label: node?.displayName ?? node?.remoteIp ?? nodeId
634
- };
635
- }
636
- const selected = selectDefaultNodeFromList(browserNodes, {
637
- preferLocalMac: false,
638
- fallback: "none"
639
- });
640
- if (params.target === "node") {
641
- if (selected) return {
642
- nodeId: selected.nodeId,
643
- label: selected.displayName ?? selected.remoteIp ?? selected.nodeId
644
- };
645
- throw new Error(`Multiple browser-capable nodes connected (${browserNodes.length}). Set gateway.nodes.browser.node or pass node=<id>.`);
646
- }
647
- if (mode === "manual") return null;
648
- if (selected) return {
649
- nodeId: selected.nodeId,
650
- label: selected.displayName ?? selected.remoteIp ?? selected.nodeId
651
- };
652
- return null;
653
- }
654
- async function callBrowserProxy(params) {
655
- const proxyTimeoutMs = typeof params.timeoutMs === "number" && Number.isFinite(params.timeoutMs) ? Math.max(1, Math.floor(params.timeoutMs)) : DEFAULT_BROWSER_PROXY_TIMEOUT_MS;
656
- const gatewayTimeoutMs = proxyTimeoutMs + BROWSER_PROXY_GATEWAY_TIMEOUT_SLACK_MS;
657
- const payload = await browserToolDeps.callGatewayTool("node.invoke", { timeoutMs: gatewayTimeoutMs }, {
658
- nodeId: params.nodeId,
659
- command: "browser.proxy",
660
- params: {
661
- method: params.method,
662
- path: params.path,
663
- query: params.query,
664
- body: params.body,
665
- timeoutMs: proxyTimeoutMs,
666
- profile: params.profile
667
- },
668
- idempotencyKey: crypto.randomUUID()
669
- });
670
- const parsed = payload?.payload ?? (typeof payload?.payloadJSON === "string" && payload.payloadJSON ? JSON.parse(payload.payloadJSON) : null);
671
- if (!parsed || typeof parsed !== "object" || !("result" in parsed)) throw new Error("browser proxy failed");
672
- return parsed;
673
- }
674
- async function persistProxyFiles$1(files) {
675
- return await persistBrowserProxyFiles(files);
676
- }
677
- function applyProxyPaths$1(result, mapping) {
678
- applyBrowserProxyPaths(result, mapping);
679
- }
680
- function resolveBrowserBaseUrl(params) {
681
- const cfg = loadConfig();
682
- const resolved = resolveBrowserConfig(cfg.browser, cfg);
683
- const normalizedSandbox = params.sandboxBridgeUrl?.trim() ?? "";
684
- if ((params.target ?? (normalizedSandbox ? "sandbox" : "host")) === "sandbox") {
685
- if (!normalizedSandbox) throw new Error("Sandbox browser is unavailable. Enable agents.defaults.sandbox.browser.enabled or use target=\"host\" if allowed.");
686
- return normalizedSandbox.replace(/\/$/, "");
687
- }
688
- if (params.allowHostControl === false) throw new Error("Host browser control is disabled by sandbox policy.");
689
- if (!resolved.enabled) throw new Error("Browser control is disabled. Set browser.enabled=true in ~/.genesis/genesis.json.");
690
- }
691
- function shouldPreferHostForProfile(profileName) {
692
- if (!profileName) return false;
693
- const cfg = browserToolDeps.loadConfig();
694
- const profile = resolveProfile(resolveBrowserConfig(cfg.browser, cfg), profileName);
695
- if (!profile) return false;
696
- return getBrowserProfileCapabilities(profile).usesChromeMcp;
697
- }
698
- const DEFAULT_EXISTING_SESSION_MANAGE_TIMEOUT_MS = 45e3;
699
- const EXISTING_SESSION_MANAGE_ACTIONS = new Set([
700
- "status",
701
- "start",
702
- "stop",
703
- "profiles",
704
- "tabs",
705
- "open",
706
- "focus",
707
- "close"
708
- ]);
709
- function usesExistingSessionManageFlow(params) {
710
- if (!EXISTING_SESSION_MANAGE_ACTIONS.has(params.action)) return false;
711
- const cfg = browserToolDeps.loadConfig();
712
- const resolved = resolveBrowserConfig(cfg.browser, cfg);
713
- const profile = resolveProfile(resolved, params.profileName ?? resolved.defaultProfile);
714
- if (profile && getBrowserProfileCapabilities(profile).usesChromeMcp) return true;
715
- if (params.action !== "profiles") return false;
716
- return Object.keys(resolved.profiles).some((name) => {
717
- const candidate = resolveProfile(resolved, name);
718
- return candidate ? getBrowserProfileCapabilities(candidate).usesChromeMcp : false;
719
- });
720
- }
721
- function readToolTimeoutMs(params) {
722
- return typeof params.timeoutMs === "number" && Number.isFinite(params.timeoutMs) ? Math.max(1, Math.floor(params.timeoutMs)) : void 0;
723
- }
724
- function createBrowserTool(opts) {
725
- const targetDefault = opts?.sandboxBridgeUrl ? "sandbox" : "host";
726
- const hostHint = opts?.allowHostControl === false ? "Host target blocked by policy." : "Host target allowed.";
727
- return {
728
- label: "Browser",
729
- name: "browser",
730
- description: [
731
- "Control the browser via Genesis's browser control server (status/start/stop/profiles/tabs/open/snapshot/screenshot/actions).",
732
- "Browser choice: omit profile by default for the isolated Genesis-managed browser (`genesis`).",
733
- "For the logged-in user browser, use profile=\"user\". A supported Chromium-based browser (v144+) must be running on the selected host or browser node. Use only when existing logins/cookies matter and the user is present.",
734
- "For profile=\"user\" or other existing-session profiles, omit timeoutMs on act:type, evaluate, hover, scrollIntoView, drag, select, and fill; that driver rejects per-call timeout overrides for those actions.",
735
- "When a node-hosted browser proxy is available, the tool may auto-route to it. Pin a node with node=<id|name> or target=\"node\".",
736
- "When using refs from snapshot (e.g. e12), keep the same tab: prefer passing targetId from the snapshot response into subsequent actions (act/click/type/etc). For tab operations, targetId also accepts tabId handles (t1) and labels from action=tabs.",
737
- "For multi-step browser work, login checks, stale refs, duplicate tabs, or Google Meet flows, use the bundled browser-automation skill when it is available.",
738
- "Tor routing is on by default for local managed profiles: `.onion` HTTP(S) URLs go through a managed Tor sidecar, regular domains/IPs stay direct (default `routeMode: \"onion-only\"`). Use a dedicated headless profile (e.g. `profile=\"onion\"`) for onion-service work; `profile=\"user\"` and other existing-session profiles never use Tor. Set `browser.tor.enabled=false` (or `browser.profiles.<name>.tor.enabled=false` per profile) to opt out, or `routeMode: \"all\"` to route every browser HTTP(S) request through Tor.",
739
- "For stable, self-resolving refs across calls, use snapshot with refs=\"aria\" (Playwright aria-ref ids). Default refs=\"role\" are role+name-based.",
740
- "Use snapshot+act for UI automation. Avoid act:wait by default; use only in exceptional cases when no reliable UI state exists.",
741
- `target selects browser location (sandbox|host|node). Default: ${targetDefault}.`,
742
- hostHint
743
- ].join(" "),
744
- parameters: BrowserToolSchema,
745
- execute: async (_toolCallId, args) => {
746
- const params = args;
747
- const action = readStringParam(params, "action", { required: true });
748
- const profile = readStringParam(params, "profile");
749
- const requestedNode = readStringParam(params, "node");
750
- const requestedTimeoutMs = readToolTimeoutMs(params);
751
- let target = readStringParam(params, "target");
752
- const configuredNode = browserToolDeps.loadConfig().gateway?.nodes?.browser?.node?.trim();
753
- if (requestedNode && target && target !== "node") throw new Error("node is only supported with target=\"node\".");
754
- const isUserBrowserProfile = shouldPreferHostForProfile(profile);
755
- if (isUserBrowserProfile) {
756
- if (target === "sandbox") throw new Error(`profile="${profile}" cannot use the sandbox browser; use target="host" or omit target.`);
757
- }
758
- let nodeTarget = null;
759
- try {
760
- nodeTarget = await resolveBrowserNodeTarget$1({
761
- requestedNode: requestedNode ?? void 0,
762
- target,
763
- sandboxBridgeUrl: opts?.sandboxBridgeUrl
764
- });
765
- } catch (error) {
766
- if (!(isUserBrowserProfile && !target && !requestedNode && !configuredNode)) throw error;
767
- }
768
- if (isUserBrowserProfile && !target && !requestedNode && !nodeTarget) target = "host";
769
- const baseUrl = nodeTarget ? void 0 : resolveBrowserBaseUrl({
770
- target: target === "node" ? void 0 : target,
771
- sandboxBridgeUrl: opts?.sandboxBridgeUrl,
772
- allowHostControl: opts?.allowHostControl
773
- });
774
- const proxyRequest = nodeTarget ? async (opts) => {
775
- const proxy = await callBrowserProxy({
776
- nodeId: nodeTarget.nodeId,
777
- method: opts.method,
778
- path: opts.path,
779
- query: opts.query,
780
- body: opts.body,
781
- timeoutMs: opts.timeoutMs,
782
- profile: opts.profile
783
- });
784
- const mapping = await persistProxyFiles$1(proxy.files);
785
- applyProxyPaths$1(proxy.result, mapping);
786
- return proxy.result;
787
- } : null;
788
- const toolTimeoutMs = requestedTimeoutMs ?? (usesExistingSessionManageFlow({
789
- action,
790
- profileName: profile
791
- }) ? DEFAULT_EXISTING_SESSION_MANAGE_TIMEOUT_MS : void 0);
792
- const touchTrackedTab = (targetId, url) => {
793
- if (proxyRequest || !targetId) return;
794
- browserToolDeps.touchSessionBrowserTab({
795
- sessionKey: opts?.agentSessionKey,
796
- targetId,
797
- baseUrl,
798
- profile,
799
- url
800
- });
801
- };
802
- switch (action) {
803
- case "doctor":
804
- if (proxyRequest) return jsonResult(await proxyRequest({
805
- method: "GET",
806
- path: "/doctor",
807
- profile
808
- }));
809
- return jsonResult(await browserToolDeps.browserDoctor(baseUrl, { profile }));
810
- case "status":
811
- if (proxyRequest) return jsonResult(await proxyRequest({
812
- method: "GET",
813
- path: "/",
814
- profile,
815
- timeoutMs: toolTimeoutMs
816
- }));
817
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
818
- profile,
819
- timeoutMs: toolTimeoutMs
820
- }));
821
- case "start":
822
- if (proxyRequest) {
823
- await proxyRequest({
824
- method: "POST",
825
- path: "/start",
826
- profile,
827
- timeoutMs: toolTimeoutMs
828
- });
829
- return jsonResult(await proxyRequest({
830
- method: "GET",
831
- path: "/",
832
- profile,
833
- timeoutMs: toolTimeoutMs
834
- }));
835
- }
836
- await browserToolDeps.browserStart(baseUrl, {
837
- profile,
838
- timeoutMs: toolTimeoutMs
839
- });
840
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
841
- profile,
842
- timeoutMs: toolTimeoutMs
843
- }));
844
- case "stop":
845
- if (proxyRequest) {
846
- await proxyRequest({
847
- method: "POST",
848
- path: "/stop",
849
- profile,
850
- timeoutMs: toolTimeoutMs
851
- });
852
- return jsonResult(await proxyRequest({
853
- method: "GET",
854
- path: "/",
855
- profile,
856
- timeoutMs: toolTimeoutMs
857
- }));
858
- }
859
- await browserToolDeps.browserStop(baseUrl, {
860
- profile,
861
- timeoutMs: toolTimeoutMs
862
- });
863
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
864
- profile,
865
- timeoutMs: toolTimeoutMs
866
- }));
867
- case "profiles":
868
- if (proxyRequest) return jsonResult(await proxyRequest({
869
- method: "GET",
870
- path: "/profiles",
871
- timeoutMs: toolTimeoutMs
872
- }));
873
- return jsonResult({ profiles: await browserToolDeps.browserProfiles(baseUrl, { timeoutMs: toolTimeoutMs }) });
874
- case "tabs": return await executeTabsAction({
875
- baseUrl,
876
- profile,
877
- timeoutMs: toolTimeoutMs,
878
- proxyRequest
879
- });
880
- case "open": {
881
- const targetUrl = readTargetUrlParam(params);
882
- const label = normalizeOptionalString(params.label);
883
- if (proxyRequest) return jsonResult(await proxyRequest({
884
- method: "POST",
885
- path: "/tabs/open",
886
- profile,
887
- body: {
888
- url: targetUrl,
889
- ...label ? { label } : {}
890
- },
891
- timeoutMs: toolTimeoutMs
892
- }));
893
- const opened = await browserToolDeps.browserOpenTab(baseUrl, targetUrl, {
894
- profile,
895
- label,
896
- timeoutMs: toolTimeoutMs
897
- });
898
- browserToolDeps.trackSessionBrowserTab({
899
- sessionKey: opts?.agentSessionKey,
900
- targetId: opened.targetId,
901
- baseUrl,
902
- profile,
903
- url: readStringValue(opened.url) ?? targetUrl
904
- });
905
- return jsonResult(opened);
906
- }
907
- case "focus": {
908
- const targetId = readStringParam(params, "targetId", { required: true });
909
- if (proxyRequest) return jsonResult(await proxyRequest({
910
- method: "POST",
911
- path: "/tabs/focus",
912
- profile,
913
- body: { targetId },
914
- timeoutMs: toolTimeoutMs
915
- }));
916
- await browserToolDeps.browserFocusTab(baseUrl, targetId, {
917
- profile,
918
- timeoutMs: toolTimeoutMs
919
- });
920
- touchTrackedTab(targetId);
921
- return jsonResult({ ok: true });
922
- }
923
- case "close": {
924
- const targetId = readStringParam(params, "targetId");
925
- if (proxyRequest) return jsonResult(targetId ? await proxyRequest({
926
- method: "DELETE",
927
- path: `/tabs/${encodeURIComponent(targetId)}`,
928
- profile,
929
- timeoutMs: toolTimeoutMs
930
- }) : await proxyRequest({
931
- method: "POST",
932
- path: "/act",
933
- profile,
934
- body: { kind: "close" },
935
- timeoutMs: toolTimeoutMs
936
- }));
937
- if (targetId) {
938
- await browserToolDeps.browserCloseTab(baseUrl, targetId, {
939
- profile,
940
- timeoutMs: toolTimeoutMs
941
- });
942
- browserToolDeps.untrackSessionBrowserTab({
943
- sessionKey: opts?.agentSessionKey,
944
- targetId,
945
- baseUrl,
946
- profile
947
- });
948
- } else await browserToolDeps.browserAct(baseUrl, { kind: "close" }, {
949
- profile,
950
- timeoutMs: toolTimeoutMs
951
- });
952
- return jsonResult({ ok: true });
953
- }
954
- case "snapshot": return await executeSnapshotAction({
955
- input: params,
956
- baseUrl,
957
- profile,
958
- proxyRequest,
959
- onTabActivity: touchTrackedTab
960
- });
961
- case "screenshot": {
962
- const targetId = readStringParam(params, "targetId");
963
- const fullPage = Boolean(params.fullPage);
964
- const ref = readStringParam(params, "ref");
965
- const element = readStringParam(params, "element");
966
- const labels = typeof params.labels === "boolean" ? params.labels : void 0;
967
- const type = params.type === "jpeg" ? "jpeg" : "png";
968
- const effectiveTimeoutMs = (typeof params.timeoutMs === "number" && Number.isFinite(params.timeoutMs) ? Math.max(1, Math.floor(params.timeoutMs)) : void 0) ?? 2e4;
969
- const result = proxyRequest ? await proxyRequest({
970
- method: "POST",
971
- path: "/screenshot",
972
- profile,
973
- timeoutMs: effectiveTimeoutMs,
974
- body: {
975
- targetId,
976
- fullPage,
977
- ref,
978
- element,
979
- type,
980
- labels,
981
- timeoutMs: effectiveTimeoutMs
982
- }
983
- }) : await browserToolDeps.browserScreenshotAction(baseUrl, {
984
- targetId,
985
- fullPage,
986
- ref,
987
- element,
988
- type,
989
- labels,
990
- timeoutMs: effectiveTimeoutMs,
991
- profile
992
- });
993
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
994
- return await browserToolDeps.imageResultFromFile({
995
- label: "browser:screenshot",
996
- path: result.path,
997
- details: result
998
- });
999
- }
1000
- case "navigate": {
1001
- const targetUrl = readTargetUrlParam(params);
1002
- const targetId = readStringParam(params, "targetId");
1003
- if (proxyRequest) return jsonResult(await proxyRequest({
1004
- method: "POST",
1005
- path: "/navigate",
1006
- profile,
1007
- body: {
1008
- url: targetUrl,
1009
- targetId
1010
- }
1011
- }));
1012
- const result = await browserToolDeps.browserNavigate(baseUrl, {
1013
- url: targetUrl,
1014
- targetId,
1015
- profile
1016
- });
1017
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url) ?? targetUrl);
1018
- return jsonResult(result);
1019
- }
1020
- case "console": return await executeConsoleAction({
1021
- input: params,
1022
- baseUrl,
1023
- profile,
1024
- proxyRequest
1025
- });
1026
- case "pdf": {
1027
- const targetId = normalizeOptionalString(params.targetId);
1028
- const result = proxyRequest ? await proxyRequest({
1029
- method: "POST",
1030
- path: "/pdf",
1031
- profile,
1032
- body: { targetId }
1033
- }) : await browserToolDeps.browserPdfSave(baseUrl, {
1034
- targetId,
1035
- profile
1036
- });
1037
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1038
- return {
1039
- content: [{
1040
- type: "text",
1041
- text: `FILE:${result.path}`
1042
- }],
1043
- details: result
1044
- };
1045
- }
1046
- case "upload": {
1047
- const paths = Array.isArray(params.paths) ? params.paths.map((p) => String(p)) : [];
1048
- if (paths.length === 0) throw new Error("paths required");
1049
- const uploadPathsResult = await resolveExistingPathsWithinRoot({
1050
- rootDir: DEFAULT_UPLOAD_DIR,
1051
- requestedPaths: paths,
1052
- scopeLabel: `uploads directory (${DEFAULT_UPLOAD_DIR})`
1053
- });
1054
- if (!uploadPathsResult.ok) throw new Error(uploadPathsResult.error);
1055
- const normalizedPaths = uploadPathsResult.paths;
1056
- const ref = readStringParam(params, "ref");
1057
- const inputRef = readStringParam(params, "inputRef");
1058
- const element = readStringParam(params, "element");
1059
- const { targetId, timeoutMs } = readOptionalTargetAndTimeout(params);
1060
- if (proxyRequest) return jsonResult(await proxyRequest({
1061
- method: "POST",
1062
- path: "/hooks/file-chooser",
1063
- profile,
1064
- body: {
1065
- paths: normalizedPaths,
1066
- ref,
1067
- inputRef,
1068
- element,
1069
- targetId,
1070
- timeoutMs
1071
- }
1072
- }));
1073
- const result = await browserToolDeps.browserArmFileChooser(baseUrl, {
1074
- paths: normalizedPaths,
1075
- ref,
1076
- inputRef,
1077
- element,
1078
- targetId,
1079
- timeoutMs,
1080
- profile
1081
- });
1082
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1083
- return jsonResult(result);
1084
- }
1085
- case "dialog": {
1086
- const accept = Boolean(params.accept);
1087
- const promptText = readStringValue(params.promptText);
1088
- const { targetId, timeoutMs } = readOptionalTargetAndTimeout(params);
1089
- if (proxyRequest) return jsonResult(await proxyRequest({
1090
- method: "POST",
1091
- path: "/hooks/dialog",
1092
- profile,
1093
- body: {
1094
- accept,
1095
- promptText,
1096
- targetId,
1097
- timeoutMs
1098
- }
1099
- }));
1100
- const result = await browserToolDeps.browserArmDialog(baseUrl, {
1101
- accept,
1102
- promptText,
1103
- targetId,
1104
- timeoutMs,
1105
- profile
1106
- });
1107
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1108
- return jsonResult(result);
1109
- }
1110
- case "act": {
1111
- const request = readActRequestParam(params);
1112
- if (!request) throw new Error("request required");
1113
- return await executeActAction({
1114
- request,
1115
- baseUrl,
1116
- profile,
1117
- proxyRequest,
1118
- onTabActivity: touchTrackedTab
1119
- });
1120
- }
1121
- default: throw new Error(`Unknown action: ${action}`);
1122
- }
1123
- }
1124
- };
1125
- }
1126
- //#endregion
1127
- //#region extensions/browser/src/cli/browser-cli-shared.ts
1128
- function normalizeQuery(query) {
1129
- if (!query) return;
1130
- const out = {};
1131
- for (const [key, value] of Object.entries(query)) {
1132
- if (value === void 0) continue;
1133
- out[key] = String(value);
1134
- }
1135
- return Object.keys(out).length ? out : void 0;
1136
- }
1137
- async function callBrowserRequest(opts, params, extra) {
1138
- const resolvedTimeoutMs = typeof extra?.timeoutMs === "number" && Number.isFinite(extra.timeoutMs) ? Math.max(1, Math.floor(extra.timeoutMs)) : typeof opts.timeout === "string" ? Number.parseInt(opts.timeout, 10) : void 0;
1139
- const resolvedTimeout = typeof resolvedTimeoutMs === "number" && Number.isFinite(resolvedTimeoutMs) ? resolvedTimeoutMs : void 0;
1140
- const timeout = typeof resolvedTimeout === "number" ? String(resolvedTimeout) : opts.timeout;
1141
- const payload = await callGatewayFromCli("browser.request", {
1142
- ...opts,
1143
- timeout
1144
- }, {
1145
- method: params.method,
1146
- path: params.path,
1147
- query: normalizeQuery(params.query),
1148
- body: params.body,
1149
- timeoutMs: resolvedTimeout
1150
- }, { progress: extra?.progress });
1151
- if (payload === void 0) throw new Error("Unexpected browser.request response");
1152
- return payload;
1153
- }
1154
- async function callBrowserResize(opts, params, extra) {
1155
- return callBrowserRequest(opts, {
1156
- method: "POST",
1157
- path: "/act",
1158
- query: params.profile ? { profile: params.profile } : void 0,
1159
- body: {
1160
- kind: "resize",
1161
- width: params.width,
1162
- height: params.height,
1163
- targetId: normalizeOptionalString(params.targetId)
1164
- }
1165
- }, extra);
1166
- }
1167
- //#endregion
1168
- //#region extensions/browser/src/cli/browser-cli-actions-input/shared.ts
1169
- function resolveBrowserActionContext(cmd, parentOpts) {
1170
- const parent = parentOpts(cmd);
1171
- return {
1172
- parent,
1173
- profile: parent?.browserProfile
1174
- };
1175
- }
1176
- async function callBrowserAct(params) {
1177
- return await callBrowserRequest(params.parent, {
1178
- method: "POST",
1179
- path: "/act",
1180
- query: params.profile ? { profile: params.profile } : void 0,
1181
- body: params.body
1182
- }, { timeoutMs: params.timeoutMs ?? 2e4 });
1183
- }
1184
- function logBrowserActionResult(parent, result, successMessage) {
1185
- if (parent?.json) {
1186
- defaultRuntime.writeJson(result);
1187
- return;
1188
- }
1189
- defaultRuntime.log(successMessage);
1190
- }
1191
- function requireRef(ref) {
1192
- const refValue = typeof ref === "string" ? ref.trim() : "";
1193
- if (!refValue) {
1194
- defaultRuntime.error(danger("ref is required"));
1195
- defaultRuntime.exit(1);
1196
- return null;
1197
- }
1198
- return refValue;
1199
- }
1200
- async function readFile$1(path) {
1201
- return await fs.readFile(path, "utf8");
1202
- }
1203
- async function readFields(opts) {
1204
- const payload = opts.fieldsFile ? await readFile$1(opts.fieldsFile) : opts.fields ?? "";
1205
- if (!payload.trim()) throw new Error("fields are required");
1206
- const parsed = JSON.parse(payload);
1207
- if (!Array.isArray(parsed)) throw new Error("fields must be an array");
1208
- return parsed.map((entry, index) => {
1209
- if (!entry || typeof entry !== "object") throw new Error(`fields[${index}] must be an object`);
1210
- const rec = entry;
1211
- const parsedField = normalizeBrowserFormField(rec);
1212
- if (!parsedField) throw new Error(`fields[${index}] must include ref`);
1213
- if (rec.value === void 0 || rec.value === null || normalizeBrowserFormFieldValue(rec.value) !== void 0) return parsedField;
1214
- throw new Error(`fields[${index}].value must be string, number, boolean, or null`);
1215
- });
1216
- }
1217
- //#endregion
1218
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.element.ts
1219
- function registerBrowserElementCommands(browser, parentOpts) {
1220
- const runElementAction = async (params) => {
1221
- const { parent, profile } = resolveBrowserActionContext(params.cmd, parentOpts);
1222
- try {
1223
- const result = await callBrowserAct({
1224
- parent,
1225
- profile,
1226
- body: params.body,
1227
- timeoutMs: params.timeoutMs
1228
- });
1229
- logBrowserActionResult(parent, result, typeof params.successMessage === "function" ? params.successMessage(result) : params.successMessage);
1230
- } catch (err) {
1231
- defaultRuntime.error(danger(String(err)));
1232
- defaultRuntime.exit(1);
1233
- }
1234
- };
1235
- browser.command("click").description("Click an element by ref from snapshot").argument("<ref>", "Ref id from snapshot").option("--target-id <id>", "CDP target id (or unique prefix)").option("--double", "Double click", false).option("--button <left|right|middle>", "Mouse button to use").option("--modifiers <list>", "Comma-separated modifiers (Shift,Alt,Meta)").action(async (ref, opts, cmd) => {
1236
- const refValue = requireRef(ref);
1237
- if (!refValue) return;
1238
- const modifiers = opts.modifiers ? String(opts.modifiers).split(",").map((v) => v.trim()).filter(Boolean) : void 0;
1239
- await runElementAction({
1240
- cmd,
1241
- body: {
1242
- kind: "click",
1243
- ref: refValue,
1244
- targetId: normalizeOptionalString(opts.targetId),
1245
- doubleClick: Boolean(opts.double),
1246
- button: normalizeOptionalString(opts.button),
1247
- modifiers
1248
- },
1249
- successMessage: (result) => {
1250
- const url = result.url;
1251
- return `clicked ref ${refValue}${typeof url === "string" && url ? ` on ${url}` : ""}`;
1252
- }
1253
- });
1254
- });
1255
- browser.command("click-coords").description("Click viewport coordinates").argument("<x>", "Viewport x coordinate").argument("<y>", "Viewport y coordinate").option("--target-id <id>", "CDP target id (or unique prefix)").option("--double", "Double click", false).option("--button <left|right|middle>", "Mouse button to use").option("--delay-ms <ms>", "Delay between mouse down/up", (v) => Number(v)).action(async (xRaw, yRaw, opts, cmd) => {
1256
- const x = Number(xRaw);
1257
- const y = Number(yRaw);
1258
- await runElementAction({
1259
- cmd,
1260
- body: {
1261
- kind: "clickCoords",
1262
- x,
1263
- y,
1264
- targetId: normalizeOptionalString(opts.targetId),
1265
- doubleClick: Boolean(opts.double),
1266
- button: normalizeOptionalString(opts.button),
1267
- delayMs: Number.isFinite(opts.delayMs) ? opts.delayMs : void 0
1268
- },
1269
- successMessage: (result) => {
1270
- const url = result.url;
1271
- return `clicked ${x},${y}${typeof url === "string" && url ? ` on ${url}` : ""}`;
1272
- }
1273
- });
1274
- });
1275
- browser.command("type").description("Type into an element by ref from snapshot").argument("<ref>", "Ref id from snapshot").argument("<text>", "Text to type").option("--submit", "Press Enter after typing", false).option("--slowly", "Type slowly (human-like)", false).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (ref, text, opts, cmd) => {
1276
- const refValue = requireRef(ref);
1277
- if (!refValue) return;
1278
- await runElementAction({
1279
- cmd,
1280
- body: {
1281
- kind: "type",
1282
- ref: refValue,
1283
- text,
1284
- submit: Boolean(opts.submit),
1285
- slowly: Boolean(opts.slowly),
1286
- targetId: normalizeOptionalString(opts.targetId)
1287
- },
1288
- successMessage: `typed into ref ${refValue}`
1289
- });
1290
- });
1291
- browser.command("press").description("Press a key").argument("<key>", "Key to press (e.g. Enter)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (key, opts, cmd) => {
1292
- await runElementAction({
1293
- cmd,
1294
- body: {
1295
- kind: "press",
1296
- key,
1297
- targetId: normalizeOptionalString(opts.targetId)
1298
- },
1299
- successMessage: `pressed ${key}`
1300
- });
1301
- });
1302
- browser.command("hover").description("Hover an element by ai ref").argument("<ref>", "Ref id from snapshot").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (ref, opts, cmd) => {
1303
- await runElementAction({
1304
- cmd,
1305
- body: {
1306
- kind: "hover",
1307
- ref,
1308
- targetId: normalizeOptionalString(opts.targetId)
1309
- },
1310
- successMessage: `hovered ref ${ref}`
1311
- });
1312
- });
1313
- browser.command("scrollintoview").description("Scroll an element into view by ref from snapshot").argument("<ref>", "Ref id from snapshot").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for scroll (default: 20000)", (v) => Number(v)).action(async (ref, opts, cmd) => {
1314
- const refValue = requireRef(ref);
1315
- if (!refValue) return;
1316
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1317
- await runElementAction({
1318
- cmd,
1319
- body: {
1320
- kind: "scrollIntoView",
1321
- ref: refValue,
1322
- targetId: normalizeOptionalString(opts.targetId),
1323
- timeoutMs
1324
- },
1325
- timeoutMs,
1326
- successMessage: `scrolled into view: ${refValue}`
1327
- });
1328
- });
1329
- browser.command("drag").description("Drag from one ref to another").argument("<startRef>", "Start ref id").argument("<endRef>", "End ref id").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (startRef, endRef, opts, cmd) => {
1330
- await runElementAction({
1331
- cmd,
1332
- body: {
1333
- kind: "drag",
1334
- startRef,
1335
- endRef,
1336
- targetId: normalizeOptionalString(opts.targetId)
1337
- },
1338
- successMessage: `dragged ${startRef} → ${endRef}`
1339
- });
1340
- });
1341
- browser.command("select").description("Select option(s) in a select element").argument("<ref>", "Ref id from snapshot").argument("<values...>", "Option values to select").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (ref, values, opts, cmd) => {
1342
- await runElementAction({
1343
- cmd,
1344
- body: {
1345
- kind: "select",
1346
- ref,
1347
- values,
1348
- targetId: normalizeOptionalString(opts.targetId)
1349
- },
1350
- successMessage: `selected ${values.join(", ")}`
1351
- });
1352
- });
1353
- }
1354
- //#endregion
1355
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.files-downloads.ts
1356
- async function normalizeUploadPaths(paths) {
1357
- const result = await resolveExistingPathsWithinRoot({
1358
- rootDir: DEFAULT_UPLOAD_DIR,
1359
- requestedPaths: paths,
1360
- scopeLabel: `uploads directory (${DEFAULT_UPLOAD_DIR})`
1361
- });
1362
- if (!result.ok) throw new Error(result.error);
1363
- return result.paths;
1364
- }
1365
- async function runBrowserPostAction(params) {
1366
- try {
1367
- const result = await callBrowserRequest(params.parent, {
1368
- method: "POST",
1369
- path: params.path,
1370
- query: params.profile ? { profile: params.profile } : void 0,
1371
- body: params.body
1372
- }, { timeoutMs: params.timeoutMs });
1373
- if (params.parent?.json) {
1374
- defaultRuntime.writeJson(result);
1375
- return;
1376
- }
1377
- defaultRuntime.log(params.describeSuccess(result));
1378
- } catch (err) {
1379
- defaultRuntime.error(danger(String(err)));
1380
- defaultRuntime.exit(1);
1381
- }
1382
- }
1383
- function registerBrowserFilesAndDownloadsCommands(browser, parentOpts) {
1384
- const resolveTimeoutAndTarget = (opts) => {
1385
- return {
1386
- timeoutMs: Number.isFinite(opts.timeoutMs) ? Number(opts.timeoutMs) : void 0,
1387
- targetId: normalizeOptionalString(opts.targetId)
1388
- };
1389
- };
1390
- const runDownloadCommand = async (cmd, opts, request) => {
1391
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1392
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1393
- await runBrowserPostAction({
1394
- parent,
1395
- profile,
1396
- path: request.path,
1397
- body: {
1398
- ...request.body,
1399
- targetId,
1400
- timeoutMs
1401
- },
1402
- timeoutMs: timeoutMs ?? 2e4,
1403
- describeSuccess: (result) => `downloaded: ${shortenHomePath(result.download.path)}`
1404
- });
1405
- };
1406
- browser.command("upload").description("Arm file upload for the next file chooser").argument("<paths...>", "File paths to upload (must be within Genesis temp uploads dir, e.g. /tmp/genesis/uploads/file.pdf)").option("--ref <ref>", "Ref id from snapshot to click after arming").option("--input-ref <ref>", "Ref id for <input type=file> to set directly").option("--element <selector>", "CSS selector for <input type=file>").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for the next file chooser (default: 120000)", (v) => Number(v)).action(async (paths, opts, cmd) => {
1407
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1408
- const normalizedPaths = await normalizeUploadPaths(paths);
1409
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1410
- await runBrowserPostAction({
1411
- parent,
1412
- profile,
1413
- path: "/hooks/file-chooser",
1414
- body: {
1415
- paths: normalizedPaths,
1416
- ref: normalizeOptionalString(opts.ref),
1417
- inputRef: normalizeOptionalString(opts.inputRef),
1418
- element: normalizeOptionalString(opts.element),
1419
- targetId,
1420
- timeoutMs
1421
- },
1422
- timeoutMs: timeoutMs ?? 2e4,
1423
- describeSuccess: () => `upload armed for ${paths.length} file(s)`
1424
- });
1425
- });
1426
- browser.command("waitfordownload").description("Wait for the next download (and save it)").argument("[path]", "Save path within genesis temp downloads dir (default: /tmp/genesis/downloads/...; fallback: os.tmpdir()/genesis/downloads/...)").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for the next download (default: 120000)", (v) => Number(v)).action(async (outPath, opts, cmd) => {
1427
- await runDownloadCommand(cmd, opts, {
1428
- path: "/wait/download",
1429
- body: { path: normalizeOptionalString(outPath) }
1430
- });
1431
- });
1432
- browser.command("download").description("Click a ref and save the resulting download").argument("<ref>", "Ref id from snapshot to click").argument("<path>", "Save path within genesis temp downloads dir (e.g. report.pdf or /tmp/genesis/downloads/report.pdf)").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for the download to start (default: 120000)", (v) => Number(v)).action(async (ref, outPath, opts, cmd) => {
1433
- await runDownloadCommand(cmd, opts, {
1434
- path: "/download",
1435
- body: {
1436
- ref,
1437
- path: outPath
1438
- }
1439
- });
1440
- });
1441
- browser.command("dialog").description("Arm the next modal dialog (alert/confirm/prompt)").option("--accept", "Accept the dialog", false).option("--dismiss", "Dismiss the dialog", false).option("--prompt <text>", "Prompt response text").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for the next dialog (default: 120000)", (v) => Number(v)).action(async (opts, cmd) => {
1442
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1443
- const accept = opts.accept ? true : opts.dismiss ? false : void 0;
1444
- if (accept === void 0) {
1445
- defaultRuntime.error(danger("Specify --accept or --dismiss"));
1446
- defaultRuntime.exit(1);
1447
- return;
1448
- }
1449
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1450
- await runBrowserPostAction({
1451
- parent,
1452
- profile,
1453
- path: "/hooks/dialog",
1454
- body: {
1455
- accept,
1456
- promptText: normalizeOptionalString(opts.prompt),
1457
- targetId,
1458
- timeoutMs
1459
- },
1460
- timeoutMs: timeoutMs ?? 2e4,
1461
- describeSuccess: () => "dialog armed"
1462
- });
1463
- });
1464
- }
1465
- //#endregion
1466
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.form-wait-eval.ts
1467
- function registerBrowserFormWaitEvalCommands(browser, parentOpts) {
1468
- browser.command("fill").description("Fill a form with JSON field descriptors").option("--fields <json>", "JSON array of field objects").option("--fields-file <path>", "Read JSON array from a file").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1469
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1470
- try {
1471
- const fields = await readFields({
1472
- fields: opts.fields,
1473
- fieldsFile: opts.fieldsFile
1474
- });
1475
- logBrowserActionResult(parent, await callBrowserAct({
1476
- parent,
1477
- profile,
1478
- body: {
1479
- kind: "fill",
1480
- fields,
1481
- targetId: normalizeOptionalString(opts.targetId)
1482
- }
1483
- }), `filled ${fields.length} field(s)`);
1484
- } catch (err) {
1485
- defaultRuntime.error(danger(String(err)));
1486
- defaultRuntime.exit(1);
1487
- }
1488
- });
1489
- browser.command("wait").description("Wait for time, selector, URL, load state, or JS conditions").argument("[selector]", "CSS selector to wait for (visible)").option("--time <ms>", "Wait for N milliseconds", (v) => Number(v)).option("--text <value>", "Wait for text to appear").option("--text-gone <value>", "Wait for text to disappear").option("--url <pattern>", "Wait for URL (supports globs like **/dash)").option("--load <load|domcontentloaded|networkidle>", "Wait for load state").option("--fn <js>", "Wait for JS condition (passed to waitForFunction)").option("--timeout-ms <ms>", "How long to wait for each condition (default: 20000)", (v) => Number(v)).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (selector, opts, cmd) => {
1490
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1491
- try {
1492
- const sel = normalizeOptionalString(selector);
1493
- const load = opts.load === "load" || opts.load === "domcontentloaded" || opts.load === "networkidle" ? opts.load : void 0;
1494
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1495
- logBrowserActionResult(parent, await callBrowserAct({
1496
- parent,
1497
- profile,
1498
- body: {
1499
- kind: "wait",
1500
- timeMs: Number.isFinite(opts.time) ? opts.time : void 0,
1501
- text: normalizeOptionalString(opts.text),
1502
- textGone: normalizeOptionalString(opts.textGone),
1503
- selector: sel,
1504
- url: normalizeOptionalString(opts.url),
1505
- loadState: load,
1506
- fn: normalizeOptionalString(opts.fn),
1507
- targetId: normalizeOptionalString(opts.targetId),
1508
- timeoutMs
1509
- },
1510
- timeoutMs
1511
- }), "wait complete");
1512
- } catch (err) {
1513
- defaultRuntime.error(danger(String(err)));
1514
- defaultRuntime.exit(1);
1515
- }
1516
- });
1517
- browser.command("evaluate").description("Evaluate a function against the page or a ref").option("--fn <code>", "Function source, e.g. (el) => el.textContent").option("--ref <id>", "Ref from snapshot").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1518
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1519
- if (!opts.fn) {
1520
- defaultRuntime.error(danger("Missing --fn"));
1521
- defaultRuntime.exit(1);
1522
- return;
1523
- }
1524
- try {
1525
- const result = await callBrowserAct({
1526
- parent,
1527
- profile,
1528
- body: {
1529
- kind: "evaluate",
1530
- fn: opts.fn,
1531
- ref: normalizeOptionalString(opts.ref),
1532
- targetId: normalizeOptionalString(opts.targetId)
1533
- }
1534
- });
1535
- if (parent?.json) {
1536
- defaultRuntime.writeJson(result);
1537
- return;
1538
- }
1539
- defaultRuntime.writeJson(result.result ?? null);
1540
- } catch (err) {
1541
- defaultRuntime.error(danger(String(err)));
1542
- defaultRuntime.exit(1);
1543
- }
1544
- });
1545
- }
1546
- //#endregion
1547
- //#region extensions/browser/src/cli/browser-cli-resize.ts
1548
- async function runBrowserResizeWithOutput(params) {
1549
- const { width, height } = params;
1550
- if (!Number.isFinite(width) || !Number.isFinite(height)) {
1551
- defaultRuntime.error(danger("width and height must be numbers"));
1552
- defaultRuntime.exit(1);
1553
- return;
1554
- }
1555
- const result = await callBrowserResize(params.parent, {
1556
- profile: params.profile,
1557
- width,
1558
- height,
1559
- targetId: params.targetId
1560
- }, { timeoutMs: params.timeoutMs ?? 2e4 });
1561
- if (params.parent?.json) {
1562
- defaultRuntime.writeJson(result);
1563
- return;
1564
- }
1565
- defaultRuntime.log(params.successMessage);
1566
- }
1567
- //#endregion
1568
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.navigation.ts
1569
- function registerBrowserNavigationCommands(browser, parentOpts) {
1570
- browser.command("navigate").description("Navigate the current tab to a URL").argument("<url>", "URL to navigate to").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (url, opts, cmd) => {
1571
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1572
- try {
1573
- const result = await callBrowserRequest(parent, {
1574
- method: "POST",
1575
- path: "/navigate",
1576
- query: profile ? { profile } : void 0,
1577
- body: {
1578
- url,
1579
- targetId: normalizeOptionalString(opts.targetId)
1580
- }
1581
- }, { timeoutMs: 2e4 });
1582
- if (parent?.json) {
1583
- defaultRuntime.writeJson(result);
1584
- return;
1585
- }
1586
- defaultRuntime.log(`navigated to ${result.url ?? url}`);
1587
- } catch (err) {
1588
- defaultRuntime.error(danger(String(err)));
1589
- defaultRuntime.exit(1);
1590
- }
1591
- });
1592
- browser.command("resize").description("Resize the viewport").argument("<width>", "Viewport width", (v) => Number(v)).argument("<height>", "Viewport height", (v) => Number(v)).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (width, height, opts, cmd) => {
1593
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1594
- try {
1595
- await runBrowserResizeWithOutput({
1596
- parent,
1597
- profile,
1598
- width,
1599
- height,
1600
- targetId: opts.targetId,
1601
- timeoutMs: 2e4,
1602
- successMessage: `resized to ${width}x${height}`
1603
- });
1604
- } catch (err) {
1605
- defaultRuntime.error(danger(String(err)));
1606
- defaultRuntime.exit(1);
1607
- }
1608
- });
1609
- }
1610
- //#endregion
1611
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.ts
1612
- function registerBrowserActionInputCommands(browser, parentOpts) {
1613
- registerBrowserNavigationCommands(browser, parentOpts);
1614
- registerBrowserElementCommands(browser, parentOpts);
1615
- registerBrowserFilesAndDownloadsCommands(browser, parentOpts);
1616
- registerBrowserFormWaitEvalCommands(browser, parentOpts);
1617
- }
1618
- //#endregion
1619
- //#region extensions/browser/src/cli/browser-cli-actions-observe.ts
1620
- function runBrowserObserve(action) {
1621
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1622
- defaultRuntime.error(danger(String(err)));
1623
- defaultRuntime.exit(1);
1624
- });
1625
- }
1626
- function registerBrowserActionObserveCommands(browser, parentOpts) {
1627
- browser.command("console").description("Get recent console messages").option("--level <level>", "Filter by level (error, warn, info)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1628
- const parent = parentOpts(cmd);
1629
- const profile = parent?.browserProfile;
1630
- await runBrowserObserve(async () => {
1631
- const result = await callBrowserRequest(parent, {
1632
- method: "GET",
1633
- path: "/console",
1634
- query: {
1635
- level: normalizeOptionalString(opts.level),
1636
- targetId: normalizeOptionalString(opts.targetId),
1637
- profile
1638
- }
1639
- }, { timeoutMs: 2e4 });
1640
- if (parent?.json) {
1641
- defaultRuntime.writeJson(result);
1642
- return;
1643
- }
1644
- defaultRuntime.writeJson(result.messages);
1645
- });
1646
- });
1647
- browser.command("pdf").description("Save page as PDF").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1648
- const parent = parentOpts(cmd);
1649
- const profile = parent?.browserProfile;
1650
- await runBrowserObserve(async () => {
1651
- const result = await callBrowserRequest(parent, {
1652
- method: "POST",
1653
- path: "/pdf",
1654
- query: profile ? { profile } : void 0,
1655
- body: { targetId: normalizeOptionalString(opts.targetId) }
1656
- }, { timeoutMs: 2e4 });
1657
- if (parent?.json) {
1658
- defaultRuntime.writeJson(result);
1659
- return;
1660
- }
1661
- defaultRuntime.log(`PDF: ${shortenHomePath(result.path)}`);
1662
- });
1663
- });
1664
- browser.command("responsebody").description("Wait for a network response and return its body").argument("<url>", "URL (exact, substring, or glob like **/api)").option("--target-id <id>", "CDP target id (or unique prefix)").option("--timeout-ms <ms>", "How long to wait for the response (default: 20000)", (v) => Number(v)).option("--max-chars <n>", "Max body chars to return (default: 200000)", (v) => Number(v)).action(async (url, opts, cmd) => {
1665
- const parent = parentOpts(cmd);
1666
- const profile = parent?.browserProfile;
1667
- await runBrowserObserve(async () => {
1668
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1669
- const maxChars = Number.isFinite(opts.maxChars) ? opts.maxChars : void 0;
1670
- const result = await callBrowserRequest(parent, {
1671
- method: "POST",
1672
- path: "/response/body",
1673
- query: profile ? { profile } : void 0,
1674
- body: {
1675
- url,
1676
- targetId: normalizeOptionalString(opts.targetId),
1677
- timeoutMs,
1678
- maxChars
1679
- }
1680
- }, { timeoutMs: timeoutMs ?? 2e4 });
1681
- if (parent?.json) {
1682
- defaultRuntime.writeJson(result);
1683
- return;
1684
- }
1685
- defaultRuntime.log(result.response.body);
1686
- });
1687
- });
1688
- }
1689
- //#endregion
1690
- //#region extensions/browser/src/cli/browser-cli-debug.ts
1691
- const BROWSER_DEBUG_TIMEOUT_MS = 2e4;
1692
- function runBrowserDebug(action) {
1693
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1694
- defaultRuntime.error(danger(String(err)));
1695
- defaultRuntime.exit(1);
1696
- });
1697
- }
1698
- async function withDebugContext(cmd, parentOpts, action) {
1699
- const parent = parentOpts(cmd);
1700
- await runBrowserDebug(() => action({
1701
- parent,
1702
- profile: parent.browserProfile
1703
- }));
1704
- }
1705
- function printJsonResult$1(parent, result) {
1706
- if (!parent.json) return false;
1707
- defaultRuntime.writeJson(result);
1708
- return true;
1709
- }
1710
- async function callDebugRequest(parent, params) {
1711
- return callBrowserRequest(parent, params, { timeoutMs: BROWSER_DEBUG_TIMEOUT_MS });
1712
- }
1713
- function resolveProfileQuery$1(profile) {
1714
- return profile ? { profile } : void 0;
1715
- }
1716
- function resolveDebugQuery(params) {
1717
- return {
1718
- targetId: normalizeOptionalString(params.targetId),
1719
- filter: normalizeOptionalString(params.filter),
1720
- clear: Boolean(params.clear),
1721
- profile: params.profile
1722
- };
1723
- }
1724
- function registerBrowserDebugCommands(browser, parentOpts) {
1725
- browser.command("highlight").description("Highlight an element by ref").argument("<ref>", "Ref id from snapshot").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (ref, opts, cmd) => {
1726
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1727
- if (printJsonResult$1(parent, await callDebugRequest(parent, {
1728
- method: "POST",
1729
- path: "/highlight",
1730
- query: resolveProfileQuery$1(profile),
1731
- body: {
1732
- ref: ref.trim(),
1733
- targetId: normalizeOptionalString(opts.targetId)
1734
- }
1735
- }))) return;
1736
- defaultRuntime.log(`highlighted ${ref.trim()}`);
1737
- });
1738
- });
1739
- browser.command("errors").description("Get recent page errors").option("--clear", "Clear stored errors after reading", false).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1740
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1741
- const result = await callDebugRequest(parent, {
1742
- method: "GET",
1743
- path: "/errors",
1744
- query: resolveDebugQuery({
1745
- targetId: opts.targetId,
1746
- clear: opts.clear,
1747
- profile
1748
- })
1749
- });
1750
- if (printJsonResult$1(parent, result)) return;
1751
- if (!result.errors.length) {
1752
- defaultRuntime.log("No page errors.");
1753
- return;
1754
- }
1755
- defaultRuntime.log(result.errors.map((e) => `${e.timestamp} ${e.name ? `${e.name}: ` : ""}${e.message}`).join("\n"));
1756
- });
1757
- });
1758
- browser.command("requests").description("Get recent network requests (best-effort)").option("--filter <text>", "Only show URLs that contain this substring").option("--clear", "Clear stored requests after reading", false).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1759
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1760
- const result = await callDebugRequest(parent, {
1761
- method: "GET",
1762
- path: "/requests",
1763
- query: resolveDebugQuery({
1764
- targetId: opts.targetId,
1765
- filter: opts.filter,
1766
- clear: opts.clear,
1767
- profile
1768
- })
1769
- });
1770
- if (printJsonResult$1(parent, result)) return;
1771
- if (!result.requests.length) {
1772
- defaultRuntime.log("No requests recorded.");
1773
- return;
1774
- }
1775
- defaultRuntime.log(result.requests.map((r) => {
1776
- const status = typeof r.status === "number" ? ` ${r.status}` : "";
1777
- const ok = r.ok === true ? " ok" : r.ok === false ? " fail" : "";
1778
- const fail = r.failureText ? ` (${r.failureText})` : "";
1779
- return `${r.timestamp} ${r.method}${status}${ok} ${r.url}${fail}`;
1780
- }).join("\n"));
1781
- });
1782
- });
1783
- const trace = browser.command("trace").description("Record a Playwright trace");
1784
- trace.command("start").description("Start trace recording").option("--target-id <id>", "CDP target id (or unique prefix)").option("--no-screenshots", "Disable screenshots").option("--no-snapshots", "Disable snapshots").option("--sources", "Include sources (bigger traces)", false).action(async (opts, cmd) => {
1785
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1786
- if (printJsonResult$1(parent, await callDebugRequest(parent, {
1787
- method: "POST",
1788
- path: "/trace/start",
1789
- query: resolveProfileQuery$1(profile),
1790
- body: {
1791
- targetId: normalizeOptionalString(opts.targetId),
1792
- screenshots: Boolean(opts.screenshots),
1793
- snapshots: Boolean(opts.snapshots),
1794
- sources: Boolean(opts.sources)
1795
- }
1796
- }))) return;
1797
- defaultRuntime.log("trace started");
1798
- });
1799
- });
1800
- trace.command("stop").description("Stop trace recording and write a .zip").option("--out <path>", "Output path within genesis temp dir (e.g. trace.zip or /tmp/genesis/trace.zip)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1801
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1802
- const result = await callDebugRequest(parent, {
1803
- method: "POST",
1804
- path: "/trace/stop",
1805
- query: resolveProfileQuery$1(profile),
1806
- body: {
1807
- targetId: normalizeOptionalString(opts.targetId),
1808
- path: normalizeOptionalString(opts.out)
1809
- }
1810
- });
1811
- if (printJsonResult$1(parent, result)) return;
1812
- defaultRuntime.log(`TRACE:${shortenHomePath(result.path)}`);
1813
- });
1814
- });
1815
- }
1816
- //#endregion
1817
- //#region extensions/browser/src/cli/browser-cli-examples.ts
1818
- const browserCoreExamples = [
1819
- "genesis browser status",
1820
- "genesis browser start",
1821
- "genesis browser stop",
1822
- "genesis browser tabs",
1823
- "genesis browser open https://example.com",
1824
- "genesis browser focus abcd1234",
1825
- "genesis browser close abcd1234",
1826
- "genesis browser screenshot",
1827
- "genesis browser screenshot --full-page",
1828
- "genesis browser screenshot --ref 12",
1829
- "genesis browser snapshot",
1830
- "genesis browser snapshot --format aria --limit 200",
1831
- "genesis browser snapshot --efficient",
1832
- "genesis browser snapshot --labels"
1833
- ];
1834
- const browserActionExamples = [
1835
- "genesis browser navigate https://example.com",
1836
- "genesis browser resize 1280 720",
1837
- "genesis browser click 12 --double",
1838
- "genesis browser click-coords 120 340",
1839
- "genesis browser type 23 \"hello\" --submit",
1840
- "genesis browser press Enter",
1841
- "genesis browser hover 44",
1842
- "genesis browser drag 10 11",
1843
- "genesis browser select 9 OptionA OptionB",
1844
- "genesis browser upload /tmp/genesis/uploads/file.pdf",
1845
- "genesis browser fill --fields '[{\"ref\":\"1\",\"value\":\"Ada\"}]'",
1846
- "genesis browser dialog --accept",
1847
- "genesis browser wait --text \"Done\"",
1848
- "genesis browser evaluate --fn '(el) => el.textContent' --ref 7",
1849
- "genesis browser console --level error",
1850
- "genesis browser pdf"
1851
- ];
1852
- //#endregion
1853
- //#region extensions/browser/src/cli/browser-cli-inspect.ts
1854
- function registerBrowserInspectCommands(browser, parentOpts) {
1855
- browser.command("screenshot").description("Capture a screenshot (MEDIA:<path>)").argument("[targetId]", "CDP target id (or unique prefix)").option("--full-page", "Capture full scrollable page", false).option("--ref <ref>", "ARIA ref from ai snapshot").option("--element <selector>", "CSS selector for element screenshot").option("--labels", "Overlay role refs on the screenshot", false).option("--type <png|jpeg>", "Output type (default: png)", "png").action(async (targetId, opts, cmd) => {
1856
- const parent = parentOpts(cmd);
1857
- const profile = parent?.browserProfile;
1858
- try {
1859
- const result = await callBrowserRequest(parent, {
1860
- method: "POST",
1861
- path: "/screenshot",
1862
- query: profile ? { profile } : void 0,
1863
- body: {
1864
- targetId: normalizeOptionalString(targetId),
1865
- fullPage: Boolean(opts.fullPage),
1866
- ref: normalizeOptionalString(opts.ref),
1867
- element: normalizeOptionalString(opts.element),
1868
- labels: Boolean(opts.labels),
1869
- type: opts.type === "jpeg" ? "jpeg" : "png"
1870
- }
1871
- }, { timeoutMs: 2e4 });
1872
- if (parent?.json) {
1873
- defaultRuntime.writeJson(result);
1874
- return;
1875
- }
1876
- defaultRuntime.log(`MEDIA:${shortenHomePath(result.path)}`);
1877
- } catch (err) {
1878
- defaultRuntime.error(danger(String(err)));
1879
- defaultRuntime.exit(1);
1880
- }
1881
- });
1882
- browser.command("snapshot").description("Capture a snapshot (default: ai; aria is the accessibility tree)").option("--format <aria|ai>", "Snapshot format (default: ai)", "ai").option("--target-id <id>", "CDP target id (or unique prefix)").option("--limit <n>", "Max nodes (default: 500/800)", (v) => Number(v)).option("--mode <efficient>", "Snapshot preset (efficient)").option("--efficient", "Use the efficient snapshot preset", false).option("--interactive", "Role snapshot: interactive elements only", false).option("--compact", "Role snapshot: compact output", false).option("--depth <n>", "Role snapshot: max depth", (v) => Number(v)).option("--selector <sel>", "Role snapshot: scope to CSS selector").option("--frame <sel>", "Role snapshot: scope to an iframe selector").option("--labels", "Include viewport label overlay screenshot", false).option("--urls", "Append discovered link URLs to AI snapshots", false).option("--out <path>", "Write snapshot to a file").action(async (opts, cmd) => {
1883
- const parent = parentOpts(cmd);
1884
- const profile = parent?.browserProfile;
1885
- const format = opts.format === "aria" ? "aria" : "ai";
1886
- const configMode = !(typeof cmd.getOptionValueSource === "function" && cmd.getOptionValueSource("format") === "cli") && format === "ai" && loadConfig().browser?.snapshotDefaults?.mode === "efficient" ? "efficient" : void 0;
1887
- const mode = opts.efficient === true || opts.mode === "efficient" ? "efficient" : configMode;
1888
- try {
1889
- const result = await callBrowserRequest(parent, {
1890
- method: "GET",
1891
- path: "/snapshot",
1892
- query: {
1893
- format,
1894
- targetId: normalizeOptionalString(opts.targetId),
1895
- limit: Number.isFinite(opts.limit) ? opts.limit : void 0,
1896
- interactive: opts.interactive ? true : void 0,
1897
- compact: opts.compact ? true : void 0,
1898
- depth: Number.isFinite(opts.depth) ? opts.depth : void 0,
1899
- selector: normalizeOptionalString(opts.selector),
1900
- frame: normalizeOptionalString(opts.frame),
1901
- labels: opts.labels ? true : void 0,
1902
- urls: opts.urls ? true : void 0,
1903
- mode,
1904
- profile
1905
- }
1906
- }, { timeoutMs: 2e4 });
1907
- if (opts.out) {
1908
- if (result.format === "ai") await fs.writeFile(opts.out, result.snapshot, "utf8");
1909
- else {
1910
- const payload = JSON.stringify(result, null, 2);
1911
- await fs.writeFile(opts.out, payload, "utf8");
1912
- }
1913
- if (parent?.json) defaultRuntime.writeJson({
1914
- ok: true,
1915
- out: opts.out,
1916
- ...result.format === "ai" && result.imagePath ? { imagePath: result.imagePath } : {}
1917
- });
1918
- else {
1919
- defaultRuntime.log(shortenHomePath(opts.out));
1920
- if (result.format === "ai" && result.imagePath) defaultRuntime.log(`MEDIA:${shortenHomePath(result.imagePath)}`);
1921
- }
1922
- return;
1923
- }
1924
- if (parent?.json) {
1925
- defaultRuntime.writeJson(result);
1926
- return;
1927
- }
1928
- if (result.format === "ai") {
1929
- defaultRuntime.log(result.snapshot);
1930
- if (result.imagePath) defaultRuntime.log(`MEDIA:${shortenHomePath(result.imagePath)}`);
1931
- return;
1932
- }
1933
- const nodes = "nodes" in result ? result.nodes : [];
1934
- defaultRuntime.log(nodes.map((n) => {
1935
- const indent = " ".repeat(Math.min(20, n.depth));
1936
- const name = n.name ? ` "${n.name}"` : "";
1937
- const value = n.value ? ` = "${n.value}"` : "";
1938
- return `${indent}- ${n.role}${name}${value}`;
1939
- }).join("\n"));
1940
- } catch (err) {
1941
- defaultRuntime.error(danger(String(err)));
1942
- defaultRuntime.exit(1);
1943
- }
1944
- });
1945
- }
1946
- //#endregion
1947
- //#region extensions/browser/src/cli/browser-cli-manage.ts
1948
- const BROWSER_MANAGE_REQUEST_TIMEOUT_MS = 45e3;
1949
- function resolveProfileQuery(profile) {
1950
- return profile ? { profile } : void 0;
1951
- }
1952
- function printJsonResult(parent, payload) {
1953
- if (!parent?.json) return false;
1954
- defaultRuntime.writeJson(payload);
1955
- return true;
1956
- }
1957
- async function callTabAction(parent, profile, body) {
1958
- return callBrowserRequest(parent, {
1959
- method: "POST",
1960
- path: "/tabs/action",
1961
- query: resolveProfileQuery(profile),
1962
- body
1963
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
1964
- }
1965
- async function fetchBrowserStatus(parent, profile) {
1966
- return await callBrowserRequest(parent, {
1967
- method: "GET",
1968
- path: "/",
1969
- query: resolveProfileQuery(profile)
1970
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
1971
- }
1972
- async function runBrowserToggle(parent, params) {
1973
- await callBrowserRequest(parent, {
1974
- method: "POST",
1975
- path: params.path,
1976
- query: resolveProfileQuery(params.profile)
1977
- });
1978
- const status = await fetchBrowserStatus(parent, params.profile);
1979
- if (printJsonResult(parent, status)) return;
1980
- const name = status.profile ?? "genesis";
1981
- defaultRuntime.log(info(`🦞 browser [${name}] running: ${status.running}`));
1982
- }
1983
- function runBrowserCommand$1(action) {
1984
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1985
- defaultRuntime.error(danger(String(err)));
1986
- defaultRuntime.exit(1);
1987
- });
1988
- }
1989
- function logBrowserTabs(tabs, json) {
1990
- if (json) {
1991
- defaultRuntime.writeJson({ tabs });
1992
- return;
1993
- }
1994
- if (tabs.length === 0) {
1995
- defaultRuntime.log("No tabs (browser closed or no targets).");
1996
- return;
1997
- }
1998
- defaultRuntime.log(tabs.map((t, i) => {
1999
- const alias = [t.tabId, t.label ? `label:${t.label}` : void 0].filter(Boolean).join(" ");
2000
- return `${i + 1}. ${t.title || "(untitled)"}${alias ? ` [${alias}]` : ""}\n ${t.url}\n id: ${t.targetId}`;
2001
- }).join("\n"));
2002
- }
2003
- function formatDoctorLine(check) {
2004
- return `${check.ok ? "OK" : "FAIL"} ${check.name}${check.detail ? `: ${check.detail}` : ""}`;
2005
- }
2006
- async function runBrowserDoctor(parent, profile) {
2007
- const checks = [];
2008
- let status = null;
2009
- try {
2010
- status = await fetchBrowserStatus(parent, profile);
2011
- checks.push({
2012
- name: "gateway",
2013
- ok: true,
2014
- detail: "browser control endpoint reachable"
2015
- });
2016
- } catch (err) {
2017
- checks.push({
2018
- name: "gateway",
2019
- ok: false,
2020
- detail: String(err)
2021
- });
2022
- return {
2023
- ok: false,
2024
- checks
2025
- };
2026
- }
2027
- checks.push({
2028
- name: "plugin",
2029
- ok: status.enabled,
2030
- detail: status.enabled ? "enabled" : "disabled in config"
2031
- });
2032
- checks.push({
2033
- name: "profile",
2034
- ok: true,
2035
- detail: `${status.profile ?? "genesis"} (${usesChromeMcpTransport(status) ? "chrome-mcp" : status.transport ?? "cdp"})`
2036
- });
2037
- checks.push({
2038
- name: "browser",
2039
- ok: status.running,
2040
- detail: status.running ? `running${status.cdpReady === false ? ", CDP not ready" : ""}` : "not running; run `genesis browser start`"
2041
- });
2042
- try {
2043
- const profiles = await callBrowserRequest(parent, {
2044
- method: "GET",
2045
- path: "/profiles"
2046
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2047
- checks.push({
2048
- name: "profiles",
2049
- ok: true,
2050
- detail: `${profiles.profiles?.length ?? 0} configured`
2051
- });
2052
- } catch (err) {
2053
- checks.push({
2054
- name: "profiles",
2055
- ok: false,
2056
- detail: String(err)
2057
- });
2058
- }
2059
- if (status.running) try {
2060
- const tabs = (await callBrowserRequest(parent, {
2061
- method: "GET",
2062
- path: "/tabs",
2063
- query: resolveProfileQuery(profile)
2064
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [];
2065
- checks.push({
2066
- name: "tabs",
2067
- ok: true,
2068
- detail: `${tabs.length} visible${tabs.length > 0 && tabs[0]?.suggestedTargetId ? `, use target ${tabs[0].suggestedTargetId}` : ""}`
2069
- });
2070
- } catch (err) {
2071
- checks.push({
2072
- name: "tabs",
2073
- ok: false,
2074
- detail: String(err)
2075
- });
2076
- }
2077
- return {
2078
- ok: checks.every((check) => check.ok),
2079
- checks,
2080
- status
2081
- };
2082
- }
2083
- function usesChromeMcpTransport(params) {
2084
- return params.transport === "chrome-mcp" || params.driver === "existing-session";
2085
- }
2086
- function formatBrowserConnectionSummary(params) {
2087
- if (usesChromeMcpTransport(params)) {
2088
- const userDataDir = params.userDataDir ? shortenHomePath(params.userDataDir) : null;
2089
- return userDataDir ? `transport: chrome-mcp, userDataDir: ${userDataDir}` : "transport: chrome-mcp";
2090
- }
2091
- if (params.isRemote) return `cdpUrl: ${params.cdpUrl ?? "(unset)"}`;
2092
- return `port: ${params.cdpPort ?? "(unset)"}`;
2093
- }
2094
- function registerBrowserManageCommands(browser, parentOpts) {
2095
- browser.command("status").description("Show browser status").action(async (_opts, cmd) => {
2096
- const parent = parentOpts(cmd);
2097
- await runBrowserCommand$1(async () => {
2098
- const status = await fetchBrowserStatus(parent, parent?.browserProfile);
2099
- if (printJsonResult(parent, status)) return;
2100
- const detectedPath = status.detectedExecutablePath ?? status.executablePath;
2101
- const detectedDisplay = detectedPath ? shortenHomePath(detectedPath) : "auto";
2102
- defaultRuntime.log([
2103
- `profile: ${status.profile ?? "genesis"}`,
2104
- `enabled: ${status.enabled}`,
2105
- `running: ${status.running}`,
2106
- `transport: ${usesChromeMcpTransport(status) ? "chrome-mcp" : status.transport ?? "cdp"}`,
2107
- ...!usesChromeMcpTransport(status) ? [`cdpPort: ${status.cdpPort ?? "(unset)"}`, `cdpUrl: ${redactCdpUrl(status.cdpUrl ?? `http://127.0.0.1:${status.cdpPort}`)}`] : status.userDataDir ? [`userDataDir: ${shortenHomePath(status.userDataDir)}`] : [],
2108
- `browser: ${status.chosenBrowser ?? "unknown"}`,
2109
- `detectedBrowser: ${status.detectedBrowser ?? "unknown"}`,
2110
- `detectedPath: ${detectedDisplay}`,
2111
- `profileColor: ${status.color}`,
2112
- ...status.tor ? [`tor: ${status.tor.mode}/${status.tor.routeMode} ${status.tor.socksHost}:${status.tor.socksPort}${status.tor.running === true ? " (running)" : ""}`] : [],
2113
- ...status.detectError ? [`detectError: ${status.detectError}`] : []
2114
- ].join("\n"));
2115
- });
2116
- });
2117
- browser.command("doctor").description("Check browser plugin readiness").action(async (_opts, cmd) => {
2118
- const parent = parentOpts(cmd);
2119
- const profile = parent?.browserProfile;
2120
- await runBrowserCommand$1(async () => {
2121
- const result = await runBrowserDoctor(parent, profile);
2122
- if (printJsonResult(parent, result)) return;
2123
- defaultRuntime.log(result.checks.map(formatDoctorLine).join("\n"));
2124
- if (!result.ok) defaultRuntime.exit(1);
2125
- });
2126
- });
2127
- browser.command("start").description("Start the browser (no-op if already running)").action(async (_opts, cmd) => {
2128
- const parent = parentOpts(cmd);
2129
- const profile = parent?.browserProfile;
2130
- await runBrowserCommand$1(async () => {
2131
- await runBrowserToggle(parent, {
2132
- profile,
2133
- path: "/start"
2134
- });
2135
- });
2136
- });
2137
- browser.command("stop").description("Stop the browser (best-effort)").action(async (_opts, cmd) => {
2138
- const parent = parentOpts(cmd);
2139
- const profile = parent?.browserProfile;
2140
- await runBrowserCommand$1(async () => {
2141
- await runBrowserToggle(parent, {
2142
- profile,
2143
- path: "/stop"
2144
- });
2145
- });
2146
- });
2147
- browser.command("reset-profile").description("Reset browser profile (moves it to Trash)").action(async (_opts, cmd) => {
2148
- const parent = parentOpts(cmd);
2149
- const profile = parent?.browserProfile;
2150
- await runBrowserCommand$1(async () => {
2151
- const result = await callBrowserRequest(parent, {
2152
- method: "POST",
2153
- path: "/reset-profile",
2154
- query: resolveProfileQuery(profile)
2155
- }, { timeoutMs: 2e4 });
2156
- if (printJsonResult(parent, result)) return;
2157
- if (!result.moved) {
2158
- defaultRuntime.log(info(`🦞 browser profile already missing.`));
2159
- return;
2160
- }
2161
- const dest = result.to ?? result.from;
2162
- defaultRuntime.log(info(`🦞 browser profile moved to Trash (${dest})`));
2163
- });
2164
- });
2165
- browser.command("tabs").description("List open tabs").action(async (_opts, cmd) => {
2166
- const parent = parentOpts(cmd);
2167
- const profile = parent?.browserProfile;
2168
- await runBrowserCommand$1(async () => {
2169
- logBrowserTabs((await callBrowserRequest(parent, {
2170
- method: "GET",
2171
- path: "/tabs",
2172
- query: resolveProfileQuery(profile)
2173
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [], parent?.json);
2174
- });
2175
- });
2176
- const tab = browser.command("tab").description("Tab shortcuts (index-based)").action(async (_opts, cmd) => {
2177
- const parent = parentOpts(cmd);
2178
- const profile = parent?.browserProfile;
2179
- await runBrowserCommand$1(async () => {
2180
- logBrowserTabs((await callBrowserRequest(parent, {
2181
- method: "POST",
2182
- path: "/tabs/action",
2183
- query: resolveProfileQuery(profile),
2184
- body: { action: "list" }
2185
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [], parent?.json);
2186
- });
2187
- });
2188
- tab.command("new").description("Open a new tab (about:blank)").option("--label <label>", "Assign a friendly tab label").action(async (opts, cmd) => {
2189
- const parent = parentOpts(cmd);
2190
- const profile = parent?.browserProfile;
2191
- await runBrowserCommand$1(async () => {
2192
- const result = await callTabAction(parent, profile, {
2193
- action: "new",
2194
- label: opts.label
2195
- });
2196
- if (printJsonResult(parent, result)) return;
2197
- const opened = result.tab;
2198
- defaultRuntime.log(opened?.tabId ? `opened new tab ${opened.tabId}${opened.label ? ` (${opened.label})` : ""}` : "opened new tab");
2199
- });
2200
- });
2201
- tab.command("label").description("Assign a friendly label to a tab").argument("<targetId>", "Target id, tab id, label, or unique target id prefix").argument("<label>", "Friendly label").action(async (targetId, label, _opts, cmd) => {
2202
- const parent = parentOpts(cmd);
2203
- const profile = parent?.browserProfile;
2204
- await runBrowserCommand$1(async () => {
2205
- const result = await callTabAction(parent, profile, {
2206
- action: "label",
2207
- targetId,
2208
- label
2209
- });
2210
- if (printJsonResult(parent, result)) return;
2211
- const tab = result.tab;
2212
- defaultRuntime.log(`labeled tab ${tab?.tabId ?? targetId} as ${tab?.label ?? label}`);
2213
- });
2214
- });
2215
- tab.command("select").description("Focus tab by index (1-based)").argument("<index>", "Tab index (1-based)", (v) => Number(v)).action(async (index, _opts, cmd) => {
2216
- const parent = parentOpts(cmd);
2217
- const profile = parent?.browserProfile;
2218
- if (!Number.isFinite(index) || index < 1) {
2219
- defaultRuntime.error(danger("index must be a positive number"));
2220
- defaultRuntime.exit(1);
2221
- return;
2222
- }
2223
- await runBrowserCommand$1(async () => {
2224
- if (printJsonResult(parent, await callTabAction(parent, profile, {
2225
- action: "select",
2226
- index: Math.floor(index) - 1
2227
- }))) return;
2228
- defaultRuntime.log(`selected tab ${Math.floor(index)}`);
2229
- });
2230
- });
2231
- tab.command("close").description("Close tab by index (1-based); default: first tab").argument("[index]", "Tab index (1-based)", (v) => Number(v)).action(async (index, _opts, cmd) => {
2232
- const parent = parentOpts(cmd);
2233
- const profile = parent?.browserProfile;
2234
- const idx = typeof index === "number" && Number.isFinite(index) ? Math.floor(index) - 1 : void 0;
2235
- if (typeof idx === "number" && idx < 0) {
2236
- defaultRuntime.error(danger("index must be >= 1"));
2237
- defaultRuntime.exit(1);
2238
- return;
2239
- }
2240
- await runBrowserCommand$1(async () => {
2241
- if (printJsonResult(parent, await callTabAction(parent, profile, {
2242
- action: "close",
2243
- index: idx
2244
- }))) return;
2245
- defaultRuntime.log("closed tab");
2246
- });
2247
- });
2248
- browser.command("open").description("Open a URL in a new tab").argument("<url>", "URL to open").option("--label <label>", "Assign a friendly tab label").action(async (url, opts, cmd) => {
2249
- const parent = parentOpts(cmd);
2250
- const profile = parent?.browserProfile;
2251
- await runBrowserCommand$1(async () => {
2252
- const tab = await callBrowserRequest(parent, {
2253
- method: "POST",
2254
- path: "/tabs/open",
2255
- query: resolveProfileQuery(profile),
2256
- body: {
2257
- url,
2258
- ...opts.label ? { label: opts.label } : {}
2259
- }
2260
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2261
- if (printJsonResult(parent, tab)) return;
2262
- defaultRuntime.log(`opened: ${tab.url}\n${tab.tabId ? `tab: ${tab.tabId}\n` : ""}${tab.label ? `label: ${tab.label}\n` : ""}id: ${tab.targetId}`);
2263
- });
2264
- });
2265
- browser.command("focus").description("Focus a tab by target id, tab id, label, or unique target id prefix").argument("<targetId>", "Target id, tab id, label, or unique target id prefix").action(async (targetId, _opts, cmd) => {
2266
- const parent = parentOpts(cmd);
2267
- const profile = parent?.browserProfile;
2268
- await runBrowserCommand$1(async () => {
2269
- await callBrowserRequest(parent, {
2270
- method: "POST",
2271
- path: "/tabs/focus",
2272
- query: resolveProfileQuery(profile),
2273
- body: { targetId }
2274
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2275
- if (printJsonResult(parent, { ok: true })) return;
2276
- defaultRuntime.log(`focused tab ${targetId}`);
2277
- });
2278
- });
2279
- browser.command("close").description("Close a tab (target id optional)").argument("[targetId]", "Target id, tab id, label, or unique target id prefix (optional)").action(async (targetId, _opts, cmd) => {
2280
- const parent = parentOpts(cmd);
2281
- const profile = parent?.browserProfile;
2282
- await runBrowserCommand$1(async () => {
2283
- if (targetId?.trim()) await callBrowserRequest(parent, {
2284
- method: "DELETE",
2285
- path: `/tabs/${encodeURIComponent(targetId.trim())}`,
2286
- query: resolveProfileQuery(profile)
2287
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2288
- else await callBrowserRequest(parent, {
2289
- method: "POST",
2290
- path: "/act",
2291
- query: resolveProfileQuery(profile),
2292
- body: { kind: "close" }
2293
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2294
- if (printJsonResult(parent, { ok: true })) return;
2295
- defaultRuntime.log("closed tab");
2296
- });
2297
- });
2298
- browser.command("profiles").description("List all browser profiles").action(async (_opts, cmd) => {
2299
- const parent = parentOpts(cmd);
2300
- await runBrowserCommand$1(async () => {
2301
- const profiles = (await callBrowserRequest(parent, {
2302
- method: "GET",
2303
- path: "/profiles"
2304
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).profiles ?? [];
2305
- if (printJsonResult(parent, { profiles })) return;
2306
- if (profiles.length === 0) {
2307
- defaultRuntime.log("No profiles configured.");
2308
- return;
2309
- }
2310
- defaultRuntime.log(profiles.map((p) => {
2311
- const status = p.running ? "running" : "stopped";
2312
- const tabs = p.running ? ` (${p.tabCount} tabs)` : "";
2313
- const def = p.isDefault ? " [default]" : "";
2314
- const loc = formatBrowserConnectionSummary(p);
2315
- const remote = p.isRemote ? " [remote]" : "";
2316
- const driver = p.driver !== "genesis" ? ` [${p.driver}]` : "";
2317
- const tor = p.tor ? `\n tor: ${p.tor.mode}/${p.tor.routeMode} ${p.tor.socksHost}:${p.tor.socksPort}${p.tor.running === true ? " (running)" : ""}` : "";
2318
- return `${p.name}: ${status}${tabs}${def}${remote}${driver}\n ${loc}, color: ${p.color}${tor}`;
2319
- }).join("\n"));
2320
- });
2321
- });
2322
- browser.command("create-profile").description("Create a new browser profile").requiredOption("--name <name>", "Profile name (lowercase, numbers, hyphens)").option("--color <hex>", "Profile color (hex format, e.g. #0066CC)").option("--cdp-url <url>", "CDP URL for remote Chrome (http/https)").option("--user-data-dir <path>", "User data dir for existing-session Chromium attach").option("--driver <driver>", "Profile driver (genesis|existing-session). Default: genesis").option("--tor", "Route this managed headless profile through a Tor SOCKS sidecar").action(async (opts, cmd) => {
2323
- const parent = parentOpts(cmd);
2324
- await runBrowserCommand$1(async () => {
2325
- const result = await callBrowserRequest(parent, {
2326
- method: "POST",
2327
- path: "/profiles/create",
2328
- body: {
2329
- name: opts.name,
2330
- color: opts.color,
2331
- cdpUrl: opts.cdpUrl,
2332
- userDataDir: opts.userDataDir,
2333
- tor: opts.tor === true,
2334
- driver: opts.driver === "existing-session" ? "existing-session" : void 0
2335
- }
2336
- }, { timeoutMs: 1e4 });
2337
- if (printJsonResult(parent, result)) return;
2338
- const loc = ` ${formatBrowserConnectionSummary(result)}`;
2339
- defaultRuntime.log(info(`🦞 Created profile "${result.profile}"\n${loc}\n color: ${result.color}${result.userDataDir ? `\n userDataDir: ${shortenHomePath(result.userDataDir)}` : ""}${opts.driver === "existing-session" ? "\n driver: existing-session" : ""}${opts.tor ? "\n tor: managed" : ""}`));
2340
- });
2341
- });
2342
- browser.command("delete-profile").description("Delete a browser profile").requiredOption("--name <name>", "Profile name to delete").action(async (opts, cmd) => {
2343
- const parent = parentOpts(cmd);
2344
- await runBrowserCommand$1(async () => {
2345
- const result = await callBrowserRequest(parent, {
2346
- method: "DELETE",
2347
- path: `/profiles/${encodeURIComponent(opts.name)}`
2348
- }, { timeoutMs: 2e4 });
2349
- if (printJsonResult(parent, result)) return;
2350
- const msg = result.deleted ? `🦞 Deleted profile "${result.profile}" (user data removed)` : `🦞 Deleted profile "${result.profile}" (no user data found)`;
2351
- defaultRuntime.log(info(msg));
2352
- });
2353
- });
2354
- }
2355
- //#endregion
2356
- //#region extensions/browser/src/cli/browser-cli-state.cookies-storage.ts
2357
- function resolveUrl(opts, command) {
2358
- return normalizeOptionalString(opts.url) ?? normalizeOptionalString(inheritOptionFromParent(command, "url"));
2359
- }
2360
- function resolveTargetId(rawTargetId, command) {
2361
- return normalizeOptionalString(rawTargetId) ?? normalizeOptionalString(inheritOptionFromParent(command, "targetId"));
2362
- }
2363
- async function runMutationRequest(params) {
2364
- try {
2365
- const result = await callBrowserRequest(params.parent, params.request, { timeoutMs: 2e4 });
2366
- if (params.parent?.json) {
2367
- defaultRuntime.writeJson(result);
2368
- return;
2369
- }
2370
- defaultRuntime.log(params.successMessage);
2371
- } catch (err) {
2372
- defaultRuntime.error(danger(String(err)));
2373
- defaultRuntime.exit(1);
2374
- }
2375
- }
2376
- function registerBrowserCookiesAndStorageCommands(browser, parentOpts) {
2377
- const cookies = browser.command("cookies").description("Read/write cookies");
2378
- cookies.option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
2379
- const parent = parentOpts(cmd);
2380
- const profile = parent?.browserProfile;
2381
- const targetId = resolveTargetId(opts.targetId, cmd);
2382
- try {
2383
- const result = await callBrowserRequest(parent, {
2384
- method: "GET",
2385
- path: "/cookies",
2386
- query: {
2387
- targetId,
2388
- profile
2389
- }
2390
- }, { timeoutMs: 2e4 });
2391
- if (parent?.json) {
2392
- defaultRuntime.writeJson(result);
2393
- return;
2394
- }
2395
- defaultRuntime.writeJson(result.cookies ?? []);
2396
- } catch (err) {
2397
- defaultRuntime.error(danger(String(err)));
2398
- defaultRuntime.exit(1);
2399
- }
2400
- });
2401
- cookies.command("set").description("Set a cookie (requires --url or domain+path)").argument("<name>", "Cookie name").argument("<value>", "Cookie value").option("--url <url>", "Cookie URL scope (recommended)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (name, value, opts, cmd) => {
2402
- const parent = parentOpts(cmd);
2403
- const profile = parent?.browserProfile;
2404
- const targetId = resolveTargetId(opts.targetId, cmd);
2405
- const url = resolveUrl(opts, cmd);
2406
- if (!url) {
2407
- defaultRuntime.error(danger("Missing required --url option for cookies set"));
2408
- defaultRuntime.exit(1);
2409
- return;
2410
- }
2411
- await runMutationRequest({
2412
- parent,
2413
- request: {
2414
- method: "POST",
2415
- path: "/cookies/set",
2416
- query: profile ? { profile } : void 0,
2417
- body: {
2418
- targetId,
2419
- cookie: {
2420
- name,
2421
- value,
2422
- url
2423
- }
2424
- }
2425
- },
2426
- successMessage: `cookie set: ${name}`
2427
- });
2428
- });
2429
- cookies.command("clear").description("Clear all cookies").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
2430
- const parent = parentOpts(cmd);
2431
- const profile = parent?.browserProfile;
2432
- const targetId = resolveTargetId(opts.targetId, cmd);
2433
- await runMutationRequest({
2434
- parent,
2435
- request: {
2436
- method: "POST",
2437
- path: "/cookies/clear",
2438
- query: profile ? { profile } : void 0,
2439
- body: { targetId }
2440
- },
2441
- successMessage: "cookies cleared"
2442
- });
2443
- });
2444
- const storage = browser.command("storage").description("Read/write localStorage/sessionStorage");
2445
- function registerStorageKind(kind) {
2446
- const cmd = storage.command(kind).description(`${kind}Storage commands`);
2447
- cmd.command("get").description(`Get ${kind}Storage (all keys or one key)`).argument("[key]", "Key (optional)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (key, opts, cmd2) => {
2448
- const parent = parentOpts(cmd2);
2449
- const profile = parent?.browserProfile;
2450
- const targetId = resolveTargetId(opts.targetId, cmd2);
2451
- try {
2452
- const result = await callBrowserRequest(parent, {
2453
- method: "GET",
2454
- path: `/storage/${kind}`,
2455
- query: {
2456
- key: normalizeOptionalString(key),
2457
- targetId,
2458
- profile
2459
- }
2460
- }, { timeoutMs: 2e4 });
2461
- if (parent?.json) {
2462
- defaultRuntime.writeJson(result);
2463
- return;
2464
- }
2465
- defaultRuntime.writeJson(result.values ?? {});
2466
- } catch (err) {
2467
- defaultRuntime.error(danger(String(err)));
2468
- defaultRuntime.exit(1);
2469
- }
2470
- });
2471
- cmd.command("set").description(`Set a ${kind}Storage key`).argument("<key>", "Key").argument("<value>", "Value").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (key, value, opts, cmd2) => {
2472
- const parent = parentOpts(cmd2);
2473
- const profile = parent?.browserProfile;
2474
- const targetId = resolveTargetId(opts.targetId, cmd2);
2475
- await runMutationRequest({
2476
- parent,
2477
- request: {
2478
- method: "POST",
2479
- path: `/storage/${kind}/set`,
2480
- query: profile ? { profile } : void 0,
2481
- body: {
2482
- key,
2483
- value,
2484
- targetId
2485
- }
2486
- },
2487
- successMessage: `${kind}Storage set: ${key}`
2488
- });
2489
- });
2490
- cmd.command("clear").description(`Clear all ${kind}Storage keys`).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd2) => {
2491
- const parent = parentOpts(cmd2);
2492
- const profile = parent?.browserProfile;
2493
- const targetId = resolveTargetId(opts.targetId, cmd2);
2494
- await runMutationRequest({
2495
- parent,
2496
- request: {
2497
- method: "POST",
2498
- path: `/storage/${kind}/clear`,
2499
- query: profile ? { profile } : void 0,
2500
- body: { targetId }
2501
- },
2502
- successMessage: `${kind}Storage cleared`
2503
- });
2504
- });
2505
- }
2506
- registerStorageKind("local");
2507
- registerStorageKind("session");
2508
- }
2509
- //#endregion
2510
- //#region extensions/browser/src/cli/browser-cli-state.ts
2511
- function parseOnOff(raw) {
2512
- const parsed = parseBooleanValue(raw);
2513
- return parsed === void 0 ? null : parsed;
2514
- }
2515
- function runBrowserCommand(action) {
2516
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
2517
- defaultRuntime.error(danger(String(err)));
2518
- defaultRuntime.exit(1);
2519
- });
2520
- }
2521
- async function runBrowserSetRequest(params) {
2522
- await runBrowserCommand(async () => {
2523
- const profile = params.parent?.browserProfile;
2524
- const result = await callBrowserRequest(params.parent, {
2525
- method: "POST",
2526
- path: params.path,
2527
- query: profile ? { profile } : void 0,
2528
- body: params.body
2529
- }, { timeoutMs: 2e4 });
2530
- if (params.parent?.json) {
2531
- defaultRuntime.writeJson(result);
2532
- return;
2533
- }
2534
- defaultRuntime.log(params.successMessage);
2535
- });
2536
- }
2537
- function registerBrowserStateCommands(browser, parentOpts) {
2538
- registerBrowserCookiesAndStorageCommands(browser, parentOpts);
2539
- const set = browser.command("set").description("Browser environment settings");
2540
- set.command("viewport").description("Set viewport size (alias for resize)").argument("<width>", "Viewport width", (v) => Number(v)).argument("<height>", "Viewport height", (v) => Number(v)).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (width, height, opts, cmd) => {
2541
- const parent = parentOpts(cmd);
2542
- const profile = parent?.browserProfile;
2543
- await runBrowserCommand(async () => {
2544
- await runBrowserResizeWithOutput({
2545
- parent,
2546
- profile,
2547
- width,
2548
- height,
2549
- targetId: opts.targetId,
2550
- timeoutMs: 2e4,
2551
- successMessage: `viewport set: ${width}x${height}`
2552
- });
2553
- });
2554
- });
2555
- set.command("offline").description("Toggle offline mode").argument("<on|off>", "on/off").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (value, opts, cmd) => {
2556
- const parent = parentOpts(cmd);
2557
- const offline = parseOnOff(value);
2558
- if (offline === null) {
2559
- defaultRuntime.error(danger("Expected on|off"));
2560
- defaultRuntime.exit(1);
2561
- return;
2562
- }
2563
- await runBrowserSetRequest({
2564
- parent,
2565
- path: "/set/offline",
2566
- body: {
2567
- offline,
2568
- targetId: normalizeOptionalString(opts.targetId)
2569
- },
2570
- successMessage: `offline: ${offline}`
2571
- });
2572
- });
2573
- set.command("headers").description("Set extra HTTP headers (JSON object)").argument("[headersJson]", "JSON object of headers (alternative to --headers-json)").option("--headers-json <json>", "JSON object of headers").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (headersJson, opts, cmd) => {
2574
- const parent = parentOpts(cmd);
2575
- await runBrowserCommand(async () => {
2576
- const headersJsonValue = normalizeOptionalString(opts.headersJson) ?? normalizeOptionalString(headersJson);
2577
- if (!headersJsonValue) throw new Error("Missing headers JSON (pass --headers-json or positional JSON argument)");
2578
- const parsed = JSON.parse(headersJsonValue);
2579
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Headers JSON must be a JSON object");
2580
- const headers = {};
2581
- for (const [k, v] of Object.entries(parsed)) if (typeof v === "string") headers[k] = v;
2582
- const profile = parent?.browserProfile;
2583
- const result = await callBrowserRequest(parent, {
2584
- method: "POST",
2585
- path: "/set/headers",
2586
- query: profile ? { profile } : void 0,
2587
- body: {
2588
- headers,
2589
- targetId: normalizeOptionalString(opts.targetId)
2590
- }
2591
- }, { timeoutMs: 2e4 });
2592
- if (parent?.json) {
2593
- defaultRuntime.writeJson(result);
2594
- return;
2595
- }
2596
- defaultRuntime.log("headers set");
2597
- });
2598
- });
2599
- set.command("credentials").description("Set HTTP basic auth credentials").option("--clear", "Clear credentials", false).argument("[username]", "Username").argument("[password]", "Password").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (username, password, opts, cmd) => {
2600
- await runBrowserSetRequest({
2601
- parent: parentOpts(cmd),
2602
- path: "/set/credentials",
2603
- body: {
2604
- username: normalizeOptionalString(username),
2605
- password,
2606
- clear: Boolean(opts.clear),
2607
- targetId: normalizeOptionalString(opts.targetId)
2608
- },
2609
- successMessage: opts.clear ? "credentials cleared" : "credentials set"
2610
- });
2611
- });
2612
- set.command("geo").description("Set geolocation (and grant permission)").option("--clear", "Clear geolocation + permissions", false).argument("[latitude]", "Latitude", (v) => Number(v)).argument("[longitude]", "Longitude", (v) => Number(v)).option("--accuracy <m>", "Accuracy in meters", (v) => Number(v)).option("--origin <origin>", "Origin to grant permissions for").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (latitude, longitude, opts, cmd) => {
2613
- await runBrowserSetRequest({
2614
- parent: parentOpts(cmd),
2615
- path: "/set/geolocation",
2616
- body: {
2617
- latitude: Number.isFinite(latitude) ? latitude : void 0,
2618
- longitude: Number.isFinite(longitude) ? longitude : void 0,
2619
- accuracy: Number.isFinite(opts.accuracy) ? opts.accuracy : void 0,
2620
- origin: normalizeOptionalString(opts.origin),
2621
- clear: Boolean(opts.clear),
2622
- targetId: normalizeOptionalString(opts.targetId)
2623
- },
2624
- successMessage: opts.clear ? "geolocation cleared" : "geolocation set"
2625
- });
2626
- });
2627
- set.command("media").description("Emulate prefers-color-scheme").argument("<dark|light|none>", "dark/light/none").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (value, opts, cmd) => {
2628
- const parent = parentOpts(cmd);
2629
- const v = normalizeOptionalLowercaseString(value);
2630
- const colorScheme = v === "dark" ? "dark" : v === "light" ? "light" : v === "none" ? "none" : null;
2631
- if (!colorScheme) {
2632
- defaultRuntime.error(danger("Expected dark|light|none"));
2633
- defaultRuntime.exit(1);
2634
- return;
2635
- }
2636
- await runBrowserSetRequest({
2637
- parent,
2638
- path: "/set/media",
2639
- body: {
2640
- colorScheme,
2641
- targetId: normalizeOptionalString(opts.targetId)
2642
- },
2643
- successMessage: `media colorScheme: ${colorScheme}`
2644
- });
2645
- });
2646
- set.command("timezone").description("Override timezone (CDP)").argument("<timezoneId>", "Timezone ID (e.g. America/New_York)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (timezoneId, opts, cmd) => {
2647
- await runBrowserSetRequest({
2648
- parent: parentOpts(cmd),
2649
- path: "/set/timezone",
2650
- body: {
2651
- timezoneId,
2652
- targetId: normalizeOptionalString(opts.targetId)
2653
- },
2654
- successMessage: `timezone: ${timezoneId}`
2655
- });
2656
- });
2657
- set.command("locale").description("Override locale (CDP)").argument("<locale>", "Locale (e.g. en-US)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (locale, opts, cmd) => {
2658
- await runBrowserSetRequest({
2659
- parent: parentOpts(cmd),
2660
- path: "/set/locale",
2661
- body: {
2662
- locale,
2663
- targetId: normalizeOptionalString(opts.targetId)
2664
- },
2665
- successMessage: `locale: ${locale}`
2666
- });
2667
- });
2668
- set.command("device").description("Apply a Playwright device descriptor (e.g. \"iPhone 14\")").argument("<name>", "Device name (Playwright devices)").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (name, opts, cmd) => {
2669
- await runBrowserSetRequest({
2670
- parent: parentOpts(cmd),
2671
- path: "/set/device",
2672
- body: {
2673
- name,
2674
- targetId: normalizeOptionalString(opts.targetId)
2675
- },
2676
- successMessage: `device: ${name}`
2677
- });
2678
- });
2679
- }
2680
- //#endregion
2681
- //#region extensions/browser/src/cli/browser-cli.ts
2682
- function registerBrowserCli(program) {
2683
- const browser = program.command("browser").description("Manage Genesis's dedicated browser (Chrome/Chromium)").option("--browser-profile <name>", "Browser profile name (default from config)").option("--json", "Output machine-readable JSON", false).addHelpText("after", () => `\n${theme.heading("Examples:")}\n${formatHelpExamples([...browserCoreExamples, ...browserActionExamples].map((cmd) => [cmd, ""]), true)}\n\n${theme.muted("Docs:")} ${formatDocsLink("/cli/browser", "genesis.pixelzx.com/docs/cli/browser")}\n`).action(() => {
2684
- browser.outputHelp();
2685
- defaultRuntime.error(danger(`Missing subcommand. Try: "${formatCliCommand("genesis browser status")}"`));
2686
- defaultRuntime.exit(1);
2687
- });
2688
- addGatewayClientOptions(browser);
2689
- const parentOpts = (cmd) => cmd.parent?.opts?.();
2690
- registerBrowserManageCommands(browser, parentOpts);
2691
- registerBrowserInspectCommands(browser, parentOpts);
2692
- registerBrowserActionInputCommands(browser, parentOpts);
2693
- registerBrowserActionObserveCommands(browser, parentOpts);
2694
- registerBrowserDebugCommands(browser, parentOpts);
2695
- registerBrowserStateCommands(browser, parentOpts);
2696
- }
2697
- //#endregion
2698
- //#region extensions/browser/src/gateway/browser-request.ts
2699
- function isBrowserNode(node) {
2700
- const caps = Array.isArray(node.caps) ? node.caps : [];
2701
- const commands = Array.isArray(node.commands) ? node.commands : [];
2702
- return caps.includes("browser") || commands.includes("browser.proxy");
2703
- }
2704
- function normalizeNodeKey(value) {
2705
- return normalizeLowercaseStringOrEmpty(value).replace(/[^a-z0-9]+/g, "");
2706
- }
2707
- function resolveBrowserNode(nodes, query) {
2708
- const q = normalizeOptionalString(query) ?? "";
2709
- if (!q) return null;
2710
- const qNorm = normalizeNodeKey(q);
2711
- const matches = nodes.filter((node) => {
2712
- if (node.nodeId === q) return true;
2713
- if (typeof node.remoteIp === "string" && node.remoteIp === q) return true;
2714
- const name = typeof node.displayName === "string" ? node.displayName : "";
2715
- if (name && normalizeNodeKey(name) === qNorm) return true;
2716
- if (q.length >= 6 && node.nodeId.startsWith(q)) return true;
2717
- return false;
2718
- });
2719
- if (matches.length === 1) return matches[0] ?? null;
2720
- if (matches.length === 0) return null;
2721
- throw new Error(`ambiguous node: ${q} (matches: ${matches.map((node) => node.displayName || node.remoteIp || node.nodeId).join(", ")})`);
2722
- }
2723
- function resolveBrowserNodeTarget(params) {
2724
- const policy = params.cfg.gateway?.nodes?.browser;
2725
- const mode = policy?.mode ?? "auto";
2726
- if (mode === "off") return null;
2727
- const browserNodes = params.nodes.filter((node) => isBrowserNode(node));
2728
- if (browserNodes.length === 0) {
2729
- if (normalizeOptionalString(policy?.node)) throw new Error("No connected browser-capable nodes.");
2730
- return null;
2731
- }
2732
- const requested = normalizeOptionalString(policy?.node) ?? "";
2733
- if (requested) {
2734
- const resolved = resolveBrowserNode(browserNodes, requested);
2735
- if (!resolved) throw new Error(`Configured browser node not connected: ${requested}`);
2736
- return resolved;
2737
- }
2738
- if (mode === "manual") return null;
2739
- if (browserNodes.length === 1) return browserNodes[0] ?? null;
2740
- return null;
2741
- }
2742
- async function persistProxyFiles(files) {
2743
- return await persistBrowserProxyFiles(files);
2744
- }
2745
- function applyProxyPaths(result, mapping) {
2746
- applyBrowserProxyPaths(result, mapping);
2747
- }
2748
- async function handleBrowserGatewayRequest({ params, respond, context }) {
2749
- const typed = params;
2750
- const methodRaw = (normalizeOptionalString(typed.method) ?? "").toUpperCase();
2751
- const path = normalizeOptionalString(typed.path) ?? "";
2752
- const query = typed.query && typeof typed.query === "object" ? typed.query : void 0;
2753
- const body = typed.body;
2754
- const timeoutMs = typeof typed.timeoutMs === "number" && Number.isFinite(typed.timeoutMs) ? Math.max(1, Math.floor(typed.timeoutMs)) : void 0;
2755
- if (!methodRaw || !path) {
2756
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "method and path are required"));
2757
- return;
2758
- }
2759
- if (methodRaw !== "GET" && methodRaw !== "POST" && methodRaw !== "DELETE") {
2760
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "method must be GET, POST, or DELETE"));
2761
- return;
2762
- }
2763
- if (isPersistentBrowserProfileMutation(methodRaw, path)) {
2764
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "browser.request cannot mutate persistent browser profiles"));
2765
- return;
2766
- }
2767
- const cfg = loadConfig();
2768
- let nodeTarget = null;
2769
- try {
2770
- nodeTarget = resolveBrowserNodeTarget({
2771
- cfg,
2772
- nodes: context.nodeRegistry.listConnected()
2773
- });
2774
- } catch (err) {
2775
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2776
- return;
2777
- }
2778
- if (nodeTarget) {
2779
- const allowlist = resolveNodeCommandAllowlist(cfg, nodeTarget);
2780
- const allowed = isNodeCommandAllowed({
2781
- command: "browser.proxy",
2782
- declaredCommands: nodeTarget.commands,
2783
- allowlist
2784
- });
2785
- if (!allowed.ok) {
2786
- const platform = nodeTarget.platform ?? "unknown";
2787
- const hint = `node command not allowed: ${allowed.reason} (platform: ${platform}, command: browser.proxy)`;
2788
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, hint, { details: {
2789
- reason: allowed.reason,
2790
- command: "browser.proxy"
2791
- } }));
2792
- return;
2793
- }
2794
- const proxyParams = {
2795
- method: methodRaw,
2796
- path,
2797
- query,
2798
- body,
2799
- timeoutMs,
2800
- profile: resolveRequestedBrowserProfile({
2801
- query,
2802
- body
2803
- })
2804
- };
2805
- const res = await context.nodeRegistry.invoke({
2806
- nodeId: nodeTarget.nodeId,
2807
- command: "browser.proxy",
2808
- params: proxyParams,
2809
- timeoutMs,
2810
- idempotencyKey: crypto.randomUUID()
2811
- });
2812
- if (!respondUnavailableOnNodeInvokeError(respond, res)) return;
2813
- const payload = res.payloadJSON ? safeParseJson(res.payloadJSON) : res.payload;
2814
- const proxy = payload && typeof payload === "object" ? payload : null;
2815
- if (!proxy || !("result" in proxy)) {
2816
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, "browser proxy failed"));
2817
- return;
2818
- }
2819
- const mapping = await persistProxyFiles(proxy.files);
2820
- applyProxyPaths(proxy.result, mapping);
2821
- respond(true, proxy.result);
2822
- return;
2823
- }
2824
- if (!await startBrowserControlServiceFromConfig()) {
2825
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, "browser control is disabled"));
2826
- return;
2827
- }
2828
- let dispatcher;
2829
- try {
2830
- dispatcher = createBrowserRouteDispatcher(createBrowserControlContext());
2831
- } catch (err) {
2832
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2833
- return;
2834
- }
2835
- let result;
2836
- try {
2837
- result = timeoutMs ? await withTimeout((signal) => dispatcher.dispatch({
2838
- method: methodRaw,
2839
- path,
2840
- query,
2841
- body,
2842
- signal
2843
- }), timeoutMs, "browser request") : await dispatcher.dispatch({
2844
- method: methodRaw,
2845
- path,
2846
- query,
2847
- body
2848
- });
2849
- } catch (err) {
2850
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2851
- return;
2852
- }
2853
- if (result.status >= 400) {
2854
- const message = result.body && typeof result.body === "object" && "error" in result.body ? String(result.body.error) : `browser request failed (${result.status})`;
2855
- respond(false, void 0, errorShape(result.status >= 500 ? ErrorCodes.UNAVAILABLE : ErrorCodes.INVALID_REQUEST, message, { details: result.body }));
2856
- return;
2857
- }
2858
- respond(true, result.body);
2859
- }
2860
- const browserHandlers = { "browser.request": handleBrowserGatewayRequest };
2861
- //#endregion
2862
- //#region extensions/browser/src/plugin-service.ts
2863
- const UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER = /^(?:data|http|https|node):/i;
2864
- function validateBrowserControlOverrideSpecifier(specifier) {
2865
- const trimmed = specifier.trim();
2866
- if (UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER.test(trimmed)) throw new Error(`Refusing unsafe browser control override specifier: ${trimmed}`);
2867
- return trimmed;
2868
- }
2869
- function createBrowserPluginService() {
2870
- let handle = null;
2871
- return {
2872
- id: "browser-control",
2873
- start: async () => {
2874
- if (handle) return;
2875
- handle = await startLazyPluginServiceModule({
2876
- skipEnvVar: "GENESIS_SKIP_BROWSER_CONTROL_SERVER",
2877
- overrideEnvVar: "GENESIS_BROWSER_CONTROL_MODULE",
2878
- validateOverrideSpecifier: validateBrowserControlOverrideSpecifier,
2879
- loadDefaultModule: async () => await import("./server-BamjooS9.js"),
2880
- startExportNames: ["startBrowserControlServiceFromConfig", "startBrowserControlServerFromConfig"],
2881
- stopExportNames: ["stopBrowserControlService", "stopBrowserControlServer"]
2882
- });
2883
- },
2884
- stop: async () => {
2885
- const current = handle;
2886
- handle = null;
2887
- if (!current) return;
2888
- await current.stop().catch(() => {});
2889
- }
2890
- };
2891
- }
2892
- //#endregion
2893
- export { createBrowserTool as a, registerBrowserCli as i, browserHandlers as n, handleBrowserGatewayRequest as r, createBrowserPluginService as t };