@pixelzx/genesis 2026.6.4-1 → 2026.6.5

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 (1010) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/.buildstamp +1 -1
  3. package/dist/abort-CcNxEsSq.js +201 -0
  4. package/dist/abort.runtime-DZJDSf0d.js +2 -0
  5. package/dist/abort.runtime.js +1 -1
  6. package/dist/accounts-B7M6y8l8.js +107 -0
  7. package/dist/accounts-DddcYo7u.js +2 -0
  8. package/dist/accounts-v0Cqfnse.js +104 -0
  9. package/dist/acp-cli-D_2_Nim8.js +2193 -0
  10. package/dist/acp-spawn-BZPupfsZ.js +2 -0
  11. package/dist/acp-spawn-CWfIrbK7.js +1093 -0
  12. package/dist/acp-stateful-target-driver-DpCTjH5T.js +89 -0
  13. package/dist/action-agents-fjIM4rpc.js +67 -0
  14. package/dist/action-focus-cx1pm1ym.js +132 -0
  15. package/dist/action-help-DtyAnULB.js +7 -0
  16. package/dist/action-info-DF30-xZl.js +101 -0
  17. package/dist/action-kill-rsSdXzvX.js +33 -0
  18. package/dist/action-list-4VN835m2.js +21 -0
  19. package/dist/action-log-L032mq5B.js +30 -0
  20. package/dist/action-send-Dm62UP-n.js +39 -0
  21. package/dist/action-spawn-BuZHKlpL.js +47 -0
  22. package/dist/action-unfocus-CTIWf8WX.js +29 -0
  23. package/dist/actions.runtime-0ezEcm7K.js +18 -0
  24. package/dist/actions.runtime-DKsCTTnH.js +5 -0
  25. package/dist/actions.runtime.js +1 -1
  26. package/dist/agent-BTOBOCIw.js +2 -0
  27. package/dist/agent-command-C-_EFUUu.js +874 -0
  28. package/dist/agent-harness-runtime-Bye6j3EL.js +144 -0
  29. package/dist/agent-runner-utils-CX2vCMkx.js +239 -0
  30. package/dist/agent-runner.runtime-BBqrjZv4.js +3455 -0
  31. package/dist/agent-runner.runtime.js +1 -1
  32. package/dist/agent-runtime-D1LIGcNj.js +18 -0
  33. package/dist/agents-CME2O1l9.js +5 -0
  34. package/dist/agents-DsDQvAPy.js +954 -0
  35. package/dist/aliases-C807OidC.js +2 -0
  36. package/dist/aliases-jq1ap6Dz.js +96 -0
  37. package/dist/api-BbxKoRkD.js +3 -0
  38. package/dist/api-CwJPCW9U.js +139 -0
  39. package/dist/api-N5Kaaq64.js +5 -0
  40. package/dist/approval-gateway-resolver-DIPFgTnx.js +29 -0
  41. package/dist/approval-gateway-runtime-i0yziXk2.js +2 -0
  42. package/dist/approval-handler-runtime-Cdm-10f9.js +439 -0
  43. package/dist/approval-native-runtime-BRjeBoqL.js +729 -0
  44. package/dist/attempt-execution.runtime-NFTF7Cbt.js +509 -0
  45. package/dist/attempt-execution.runtime.js +1 -1
  46. package/dist/attempt.prompt-helpers-DuBXv46v.js +221 -0
  47. package/dist/attempt.tool-run-context-Qf-tbC-C.js +933 -0
  48. package/dist/audit-DsDfRhB8.js +939 -0
  49. package/dist/audit.runtime-ComjcUGJ.js +7 -0
  50. package/dist/audit.runtime.js +1 -1
  51. package/dist/auth-BT_gqC-D.js +2 -0
  52. package/dist/auth-DeUz_8w8.js +383 -0
  53. package/dist/auth-order-DM7UkPDa.js +96 -0
  54. package/dist/auth-order-yS8hXrXh.js +2 -0
  55. package/dist/bash-tools-D0M9gBDu.js +3 -0
  56. package/dist/bash-tools-tnj1gSbO.js +2824 -0
  57. package/dist/binding-routing-C7atXiTD.js +85 -0
  58. package/dist/binding-targets-CCv7agx9.js +121 -0
  59. package/dist/bridge-server-C5O9rTJg.js +113 -0
  60. package/dist/browser-control-auth-GGN_kbqE.js +2 -0
  61. package/dist/browser-node-runtime-B-uTSVqP.js +12 -0
  62. package/dist/browser-profiles-Dex2eaLH.js +2 -0
  63. package/dist/browser-runtime-BPocB6yO.js +387 -0
  64. package/dist/browser-setup-tools-gHfYeDWA.js +13 -0
  65. package/dist/build-BqG7RkBz.js +550 -0
  66. package/dist/build-info.json +3 -3
  67. package/dist/bundled/boot-md/handler.js +2 -2
  68. package/dist/bundled/session-memory/handler.js +1 -1
  69. package/dist/call-BI4JvjcR.js +3 -0
  70. package/dist/call-wY43fzOF.js +331 -0
  71. package/dist/call.runtime-Dh61oVeL.js +2 -0
  72. package/dist/call.runtime.js +1 -1
  73. package/dist/capability-cli-BHz-2Stx.js +1401 -0
  74. package/dist/catchup-Be7tHJwK.js +300 -0
  75. package/dist/channel-B-6VmF4-.js +840 -0
  76. package/dist/channel-BCJccV-O.js +226 -0
  77. package/dist/channel-BDZqLbod.js +1100 -0
  78. package/dist/channel-BQDNgTea.js +1174 -0
  79. package/dist/channel-BwjThGwK.js +453 -0
  80. package/dist/channel-CPoThmda.js +595 -0
  81. package/dist/channel-CUT8NJ-B.js +350 -0
  82. package/dist/channel-C_Y7lv8v.js +491 -0
  83. package/dist/channel-Ck7-C-lB.js +297 -0
  84. package/dist/channel-DOpVjq4i.js +1802 -0
  85. package/dist/channel-core-QV9-eAtb.js +5 -0
  86. package/dist/channel-inbound-D_tebgdx.js +31 -0
  87. package/dist/channel-plugin-runtime-DXcBwNNM.js +771 -0
  88. package/dist/channel-runtime-D4ci0o4V.js +425 -0
  89. package/dist/channel-sAdF_zH-.js +1320 -0
  90. package/dist/channel.runtime-1swLIpNV.js +89 -0
  91. package/dist/channel.runtime-B9hljdNF.js +4 -0
  92. package/dist/channel.runtime-CSbR2pni.js +430 -0
  93. package/dist/channel.runtime-CdpqhnLO.js +2364 -0
  94. package/dist/channel.runtime-DOx6WROg.js +40130 -0
  95. package/dist/channel.runtime-H5Kb2LbC.js +109 -0
  96. package/dist/channel.runtime-V7boBc_e.js +576 -0
  97. package/dist/channel.runtime.js +1 -1
  98. package/dist/channel.setup-BXyeNJ2_.js +10 -0
  99. package/dist/channels-KU7bwUUs.js +733 -0
  100. package/dist/channels-cli-CTX6_5z3.js +268 -0
  101. package/dist/chat-C_i6Wp50.js +2830 -0
  102. package/dist/clawbot-cli-CLGPtbt-.js +9 -0
  103. package/dist/cli/daemon-cli.js +3 -3
  104. package/dist/cli-BhwHu1dK.js +72 -0
  105. package/dist/cli-CFsq8f2H.js +2 -0
  106. package/dist/cli-CNVlwurq.js +219 -0
  107. package/dist/cli-DLP8hKbi.js +2 -0
  108. package/dist/cli-runner-BbNBHV6v.js +286 -0
  109. package/dist/cli-runner.runtime-CfPaauuM.js +4 -0
  110. package/dist/cli-runner.runtime-MxBlCOO2.js +3 -0
  111. package/dist/cli-runner.runtime.js +1 -1
  112. package/dist/cli-startup-metadata.json +2 -2
  113. package/dist/cli.runtime-3cD-pSyn.js +1261 -0
  114. package/dist/cli.runtime.js +1 -1
  115. package/dist/client-Bl0d_7ak.js +138 -0
  116. package/dist/client-ClJyHgmq.js +713 -0
  117. package/dist/command-auth-DO32coey.js +76 -0
  118. package/dist/command-config-resolution-CAsa4fGg.js +2 -0
  119. package/dist/command-config-resolution-D6YcwuRh.js +23 -0
  120. package/dist/command-config-resolution.runtime-CSHDu35A.js +2 -0
  121. package/dist/command-config-resolution.runtime.js +1 -1
  122. package/dist/command-registry-BJEQrMqR.js +4 -0
  123. package/dist/command-registry-DI9i95nj.js +9 -0
  124. package/dist/command-registry-core-BpF1mggD.js +106 -0
  125. package/dist/command-secret-gateway-DDNHxysD.js +528 -0
  126. package/dist/command-status.runtime-DqYUCcEA.js +87 -0
  127. package/dist/command-status.runtime.js +1 -1
  128. package/dist/commands-acp-C_zCJPvL.js +77 -0
  129. package/dist/commands-compact.runtime-B6e3kwMS.js +10 -0
  130. package/dist/commands-compact.runtime.js +1 -1
  131. package/dist/commands-handlers.runtime-B0gTkAC0.js +4599 -0
  132. package/dist/commands-handlers.runtime.js +1 -1
  133. package/dist/commands-status-BgZ64sA8.js +16 -0
  134. package/dist/commands-status.runtime-JI89gIEU.js +3 -0
  135. package/dist/commands-status.runtime.js +1 -1
  136. package/dist/commands-subagents-control.runtime-B0hdcBxr.js +2 -0
  137. package/dist/commands-subagents-control.runtime-DUeSQ5j4.js +3 -0
  138. package/dist/commands-subagents-control.runtime.js +1 -1
  139. package/dist/commands-system-prompt-B7moUaCI.js +158 -0
  140. package/dist/commands-system-prompt-DTUkp9TH.js +2 -0
  141. package/dist/commands.runtime-BjCVVqol.js +167 -0
  142. package/dist/commands.runtime.js +1 -1
  143. package/dist/compact-BNJH56SX.js +1118 -0
  144. package/dist/compact.runtime-CYI8Yi9d.js +12 -0
  145. package/dist/compact.runtime.js +1 -1
  146. package/dist/completion-cli-Bb1Tk-vM.js +328 -0
  147. package/dist/config-DxkleHmo.js +252 -0
  148. package/dist/config-cli-CtaRB_f8.js +1078 -0
  149. package/dist/configure-Bp8WFryM.js +1252 -0
  150. package/dist/configure-DQ_X5zyT.js +2 -0
  151. package/dist/connect-options-BkWD0Wvv.js +699 -0
  152. package/dist/control-auth-Iqyldslx.js +125 -0
  153. package/dist/control-service-xIhkqyZE.js +156 -0
  154. package/dist/conversation-id-BZtOqHIz.js +38 -0
  155. package/dist/conversation-id-D1Q9qPFH.js +235 -0
  156. package/dist/conversation-runtime-B1QZ-DEM.js +31 -0
  157. package/dist/core-BdVAy0Wv.js +275 -0
  158. package/dist/cron-cli-BWM2kRKU.js +713 -0
  159. package/dist/daemon-cli-MRl5nyuF.js +12 -0
  160. package/dist/dashboard-BkdlJrnf.js +2 -0
  161. package/dist/dashboard-C9m86rHv.js +81 -0
  162. package/dist/delegate-BjUvKQlo.js +64 -0
  163. package/dist/detached-task-runtime-BAEzkNB8.js +73 -0
  164. package/dist/devices-cli-B1n6tl9f.js +498 -0
  165. package/dist/diagnostics-DZxWkW3i.js +154 -0
  166. package/dist/direct-dm-qw-uk31C.js +64 -0
  167. package/dist/dispatch-D0xiJ6Up.js +1131 -0
  168. package/dist/dispatch-acp-DVN58m9G.js +981 -0
  169. package/dist/dispatch-acp-manager.runtime-C8t1i5Wt.js +3 -0
  170. package/dist/dispatch-acp-manager.runtime.js +1 -1
  171. package/dist/dispatch-acp.runtime-FR0DUPpn.js +19 -0
  172. package/dist/dispatch-acp.runtime.js +1 -1
  173. package/dist/doctor-device-pairing-DIbiBPlL.js +307 -0
  174. package/dist/doctor-gateway-daemon-flow-BFjRlXvA.js +250 -0
  175. package/dist/doctor-gateway-health-uZrukX3c.js +63 -0
  176. package/dist/doctor-health-DKpg1bxM.js +59 -0
  177. package/dist/doctor-health-contributions-BoXX8ubw.js +493 -0
  178. package/dist/doctor-prompter-CLf5Uf10.js +56 -0
  179. package/dist/doctor-workspace-status-Cw61BbGy.js +75 -0
  180. package/dist/dreaming-Bk8dVfGi.js +1574 -0
  181. package/dist/dreaming-narrative-DGSQa-0N.js +595 -0
  182. package/dist/embedded-gateway-stub.runtime-sokWrs6B.js +9 -0
  183. package/dist/embedded-gateway-stub.runtime.js +1 -1
  184. package/dist/entry.js +2 -2
  185. package/dist/exec-approvals-cli-CnNETs_u.js +498 -0
  186. package/dist/extensionAPI.js +1 -1
  187. package/dist/extensions/active-memory/index.js +1 -1
  188. package/dist/extensions/bluebubbles/api.js +3 -3
  189. package/dist/extensions/bluebubbles/channel-plugin-api.js +1 -1
  190. package/dist/extensions/browser/browser-bridge.js +1 -1
  191. package/dist/extensions/browser/browser-config.js +4 -4
  192. package/dist/extensions/browser/browser-control-auth.js +2 -2
  193. package/dist/extensions/browser/browser-doctor.js +2 -2
  194. package/dist/extensions/browser/browser-maintenance.js +2 -2
  195. package/dist/extensions/browser/browser-profiles.js +2 -2
  196. package/dist/extensions/browser/browser-runtime-api.js +10 -10
  197. package/dist/extensions/browser/index.js +1 -1
  198. package/dist/extensions/browser/plugin-registration.js +1 -1
  199. package/dist/extensions/browser/register.runtime.js +3 -3
  200. package/dist/extensions/browser/runtime-api.js +11 -11
  201. package/dist/extensions/browser/test-support.js +1 -1
  202. package/dist/extensions/device-pair/api.js +1 -1
  203. package/dist/extensions/device-pair/index.js +3 -3
  204. package/dist/extensions/device-pair/notify.js +1 -1
  205. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  206. package/dist/extensions/google-meet/index.js +2 -2
  207. package/dist/extensions/imessage/api.js +3 -3
  208. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  209. package/dist/extensions/imessage/runtime-api.js +3 -3
  210. package/dist/extensions/irc/api.js +2 -2
  211. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  212. package/dist/extensions/line/api.js +2 -2
  213. package/dist/extensions/line/channel-plugin-api.js +1 -1
  214. package/dist/extensions/line/contract-api.js +1 -1
  215. package/dist/extensions/line/runtime-api.js +4 -4
  216. package/dist/extensions/line/setup-api.js +1 -1
  217. package/dist/extensions/llm-task/index.js +2 -2
  218. package/dist/extensions/lobster/index.js +3 -3
  219. package/dist/extensions/lobster/runtime-api.js +1 -1
  220. package/dist/extensions/mattermost/api.js +1 -1
  221. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  222. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  223. package/dist/extensions/mattermost/policy-api.js +1 -1
  224. package/dist/extensions/mattermost/runtime-api.js +4 -4
  225. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  226. package/dist/extensions/memory-core/api.js +1 -1
  227. package/dist/extensions/memory-core/cli-metadata.js +2 -2
  228. package/dist/extensions/memory-core/index.js +3 -3
  229. package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
  230. package/dist/extensions/msteams/api.js +1 -1
  231. package/dist/extensions/msteams/channel-plugin-api.js +1 -1
  232. package/dist/extensions/msteams/runtime-api.js +3 -3
  233. package/dist/extensions/msteams/test-api.js +1 -1
  234. package/dist/extensions/nextcloud-talk/api.js +1 -1
  235. package/dist/extensions/nextcloud-talk/channel-plugin-api.js +1 -1
  236. package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
  237. package/dist/extensions/openshell/index.js +2 -2
  238. package/dist/extensions/signal/api.js +6 -6
  239. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  240. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  241. package/dist/extensions/signal/runtime-api.js +7 -7
  242. package/dist/extensions/skill-workshop/api.js +1 -1
  243. package/dist/extensions/skill-workshop/index.js +1 -1
  244. package/dist/extensions/synology-chat/api.js +1 -1
  245. package/dist/extensions/synology-chat/channel-plugin-api.js +1 -1
  246. package/dist/extensions/tlon/api.js +2 -2
  247. package/dist/extensions/tlon/channel-plugin-api.js +1 -1
  248. package/dist/extensions/tlon/runtime-api.js +1 -1
  249. package/dist/extensions/tlon/test-api.js +1 -1
  250. package/dist/extensions/twitch/api.js +1 -1
  251. package/dist/extensions/twitch/channel-plugin-api.js +1 -1
  252. package/dist/extensions/twitch/setup-plugin-api.js +1 -1
  253. package/dist/extensions/zalo/api.js +3 -3
  254. package/dist/extensions/zalo/channel-plugin-api.js +1 -1
  255. package/dist/extensions/zalo/runtime-api.js +2 -2
  256. package/dist/extensions/zalo/setup-api.js +2 -2
  257. package/dist/extensions/zalouser/api.js +3 -3
  258. package/dist/extensions/zalouser/channel-plugin-api.js +1 -1
  259. package/dist/extensions/zalouser/runtime-api.js +6 -6
  260. package/dist/extensions/zalouser/setup-plugin-api.js +1 -1
  261. package/dist/extensions/zalouser/test-api.js +1 -1
  262. package/dist/fallbacks-BwNexEVP.js +31 -0
  263. package/dist/fallbacks-GwVAaFt5.js +2 -0
  264. package/dist/fallbacks-shared-DmepG9Mq.js +111 -0
  265. package/dist/gateway-BB4hdlYm.js +115 -0
  266. package/dist/gateway-cli-Bzz62NC8.js +1283 -0
  267. package/dist/gateway-rpc-dyJV2osv.js +14 -0
  268. package/dist/gateway-rpc.runtime-DYVOEv4W.js +23 -0
  269. package/dist/gateway-rpc.runtime.js +1 -1
  270. package/dist/gateway-runtime-CqSQCYo0.js +15 -0
  271. package/dist/gateway-status-DdCiwrPt.js +584 -0
  272. package/dist/genesis-tools-Bh6dAUhK.js +9166 -0
  273. package/dist/genesis-tools.runtime-CiIUponP.js +2 -0
  274. package/dist/genesis-tools.runtime.js +1 -1
  275. package/dist/get-reply-from-config.runtime-Cu2DcwOW.js +2 -0
  276. package/dist/get-reply-from-config.runtime.js +1 -1
  277. package/dist/get-reply-qVmTjhwr.js +3897 -0
  278. package/dist/graph-users-kkSJYBNX.js +1337 -0
  279. package/dist/health-CFyVDYng.js +469 -0
  280. package/dist/health-Cl371mu8.js +3 -0
  281. package/dist/health-route-D0IspgUK.js +41 -0
  282. package/dist/health-route-D2tFKCLv.js +2 -0
  283. package/dist/heartbeat-runner-Bmi8YsXz.js +5 -0
  284. package/dist/heartbeat-runner-FSCWra2R.js +1292 -0
  285. package/dist/heartbeat-runner.runtime-QF8dg4j-.js +4 -0
  286. package/dist/heartbeat-runner.runtime.js +1 -1
  287. package/dist/hooks-cli-DYoG7Dz1.js +433 -0
  288. package/dist/image-fallbacks-5ckuJ46I.js +31 -0
  289. package/dist/image-fallbacks-DYnqzK01.js +2 -0
  290. package/dist/inbound-reply-dispatch-D5pqDZRa.js +73 -0
  291. package/dist/index.js +2 -2
  292. package/dist/infra-runtime-D08WIqN2.js +39 -0
  293. package/dist/init-BCgwiSZj.js +59 -0
  294. package/dist/library-CP9n_7AP.js +45 -0
  295. package/dist/lifecycle-BYam90xH.js +229 -0
  296. package/dist/lifecycle-DS58sNmu.js +571 -0
  297. package/dist/lifecycle.runtime-DMwss7xM.js +2 -0
  298. package/dist/lifecycle.runtime.js +1 -1
  299. package/dist/list-CASc4IWz.js +131 -0
  300. package/dist/list-CBPrBS2u.js +1212 -0
  301. package/dist/list-Cf7fcqQd.js +2 -0
  302. package/dist/list-Dqd2QyTH.js +2 -0
  303. package/dist/list.probe-BWcMSWDF.js +419 -0
  304. package/dist/llm-slug-generator-4LADFhXT.js +79 -0
  305. package/dist/llm-slug-generator.js +1 -1
  306. package/dist/load-config-DI-LDL6p.js +35 -0
  307. package/dist/local-dispatch.runtime-WDgraH3j.js +8 -0
  308. package/dist/local-dispatch.runtime.js +1 -1
  309. package/dist/logs-cli-zoBIelUH.js +265 -0
  310. package/dist/logs-cli.runtime-DxKNxXAz.js +2 -0
  311. package/dist/logs-cli.runtime.js +1 -1
  312. package/dist/main-session-restart-recovery-DWZfkOzH.js +206 -0
  313. package/dist/managed-image-attachments-DLDa1aE2.js +2 -0
  314. package/dist/managed-image-attachments-a4v60Bk3.js +635 -0
  315. package/dist/manager-CfUcsSI9.js +2057 -0
  316. package/dist/manager-DmBBLCOg.js +2 -0
  317. package/dist/markdown-to-line-B0mPruD_.js +790 -0
  318. package/dist/mcp/plugin-tools-serve.js +1 -1
  319. package/dist/mcp-cli-CLL9nfvE.js +725 -0
  320. package/dist/mcp-http-p7GbtbMx.js +529 -0
  321. package/dist/memory-core-host-runtime-cli-CZNYkDoE.js +9 -0
  322. package/dist/message-CRyNLXch.js +232 -0
  323. package/dist/message-action-runner-5Y4EFpWh.js +1407 -0
  324. package/dist/message-action-runner-Dxv-GXkn.js +2 -0
  325. package/dist/message-actions-DtoR6Mr2.js +143 -0
  326. package/dist/message.gateway.runtime-RI4cvk_E.js +2 -0
  327. package/dist/message.gateway.runtime.js +1 -1
  328. package/dist/models-auth-status-DsheCXaS.js +201 -0
  329. package/dist/models-cli-CQQG1U-p.js +219 -0
  330. package/dist/monitor-BRRSjPQY.js +1459 -0
  331. package/dist/monitor-Ch-cG7Si.js +1661 -0
  332. package/dist/monitor-ChBhfnC-.js +788 -0
  333. package/dist/monitor-CsvCTpjq.js +671 -0
  334. package/dist/monitor-DjemBuVh.js +1237 -0
  335. package/dist/monitor-LyGEO-KI.js +2 -0
  336. package/dist/monitor-auth-DVCdDwlp.js +207 -0
  337. package/dist/monitor-processing-Cib3ZjUe.js +1974 -0
  338. package/dist/monitor.runtime-DLBFALbV.js +2 -0
  339. package/dist/monitor.runtime.js +1 -1
  340. package/dist/monitor.webhook-Dktr8JA-.js +180 -0
  341. package/dist/msteams-G5I2CO13.js +35 -0
  342. package/dist/native-hook-relay-B1ArNeG5.js +519 -0
  343. package/dist/nextcloud-talk-DimOAfaR.js +17 -0
  344. package/dist/node-cli-RIjV0id4.js +2276 -0
  345. package/dist/nodes-cli-Cke-B80I.js +1046 -0
  346. package/dist/nodes-utils-CsTqKwN9.js +84 -0
  347. package/dist/nodes.helpers-DYpGCFer.js +34 -0
  348. package/dist/notify-zBChwf0-.js +315 -0
  349. package/dist/onboard-D6UawRld.js +2 -0
  350. package/dist/onboard-DfoCtk3_.js +70 -0
  351. package/dist/onboard-helpers-BKQMe3RX.js +6 -0
  352. package/dist/onboard-helpers-BLBJlQ50.js +204 -0
  353. package/dist/onboard-interactive-GAbQD437.js +24 -0
  354. package/dist/onboard-non-interactive-Bqi-JXh3.js +635 -0
  355. package/dist/onboard-remote-CNpTyVws.js +193 -0
  356. package/dist/onboard-remote-GFp2lT6Y.js +2 -0
  357. package/dist/onboard-skills-BQneolfo.js +2 -0
  358. package/dist/onboard-skills-BipqJ48b.js +134 -0
  359. package/dist/openai-http-CLDWjSKC.js +500 -0
  360. package/dist/openresponses-http-DNvXNiw_.js +1128 -0
  361. package/dist/operator-approvals-client-gaflvETF.js +68 -0
  362. package/dist/outbound.runtime-ByVsvEri.js +2 -0
  363. package/dist/outbound.runtime.js +1 -1
  364. package/dist/pair-command-approve-Dzkubc-8.js +44 -0
  365. package/dist/persistent-bindings.lifecycle-BhdRK7Lp.js +2 -0
  366. package/dist/persistent-bindings.lifecycle-DQ0AiHuy.js +85 -0
  367. package/dist/pi-embedded-C789hs31.js +4 -0
  368. package/dist/pi-embedded-CXLkrOwv.js +2905 -0
  369. package/dist/pi-embedded.runtime-BaHYLgKa.js +4 -0
  370. package/dist/pi-embedded.runtime.js +1 -1
  371. package/dist/pi-tool-definition-adapter-DFutc0D4.js +229 -0
  372. package/dist/pi-tools-k60jrAVq.js +1057 -0
  373. package/dist/pi-tools.before-tool-call-CFy20GCz.js +2 -0
  374. package/dist/pi-tools.before-tool-call-DJmPOVfQ.js +433 -0
  375. package/dist/plugin-BfFuIgXQ.js +12195 -0
  376. package/dist/plugin-enabled-dXOUnZwX.js +140 -0
  377. package/dist/plugin-registration-CEAozQhV.js +23 -0
  378. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  379. package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
  380. package/dist/plugin-sdk/acp-runtime.js +2 -2
  381. package/dist/plugin-sdk/agent-harness-runtime.js +5 -5
  382. package/dist/plugin-sdk/agent-harness.js +6 -6
  383. package/dist/plugin-sdk/agent-runtime.js +2 -2
  384. package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
  385. package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
  386. package/dist/plugin-sdk/approval-runtime.js +1 -1
  387. package/dist/plugin-sdk/browser-node-runtime.js +4 -4
  388. package/dist/plugin-sdk/browser-setup-tools.js +3 -3
  389. package/dist/plugin-sdk/browser-support.js +7 -7
  390. package/dist/plugin-sdk/channel-core.js +2 -2
  391. package/dist/plugin-sdk/channel-inbound.js +2 -2
  392. package/dist/plugin-sdk/command-auth.js +1 -1
  393. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  394. package/dist/plugin-sdk/compat.js +1 -1
  395. package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
  396. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  397. package/dist/plugin-sdk/core.js +2 -2
  398. package/dist/plugin-sdk/direct-dm.js +1 -1
  399. package/dist/plugin-sdk/gateway-runtime.js +3 -3
  400. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  401. package/dist/plugin-sdk/index.js +1 -1
  402. package/dist/plugin-sdk/infra-runtime.js +2 -2
  403. package/dist/plugin-sdk/irc.js +2 -2
  404. package/dist/plugin-sdk/matrix.js +1 -1
  405. package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
  406. package/dist/plugin-sdk/memory-core.js +2 -2
  407. package/dist/plugin-sdk/msteams.js +2 -2
  408. package/dist/plugin-sdk/nextcloud-talk.js +2 -2
  409. package/dist/plugin-sdk/nostr.js +1 -1
  410. package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
  411. package/dist/plugin-sdk/reply-runtime.js +4 -4
  412. package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
  413. package/dist/plugin-sdk/runtime.js +2 -2
  414. package/dist/plugin-sdk/session-visibility.js +1 -1
  415. package/dist/plugin-sdk/testing.js +4 -4
  416. package/dist/plugin-sdk/tlon.js +1 -1
  417. package/dist/plugin-sdk/zalo.js +1 -1
  418. package/dist/plugin-sdk/zalouser.js +1 -1
  419. package/dist/plugin-service-BOpLQ8BU.js +2892 -0
  420. package/dist/plugins/runtime/index.js +1 -1
  421. package/dist/policy-DiIlt2yW.js +328 -0
  422. package/dist/postinstall-inventory.json +414 -414
  423. package/dist/prepare.runtime-Bd8adOy3.js +815 -0
  424. package/dist/prepare.runtime.js +1 -1
  425. package/dist/probe-BOlTfbzG.js +2 -0
  426. package/dist/probe-BSRvsN95.js +2205 -0
  427. package/dist/probe-CDfjQSnz.js +74 -0
  428. package/dist/probe-D7gHyiZV.js +241 -0
  429. package/dist/probe-DTNKTWSs.js +2 -0
  430. package/dist/probe-DcryDdZh.js +45 -0
  431. package/dist/probe-nyesoHxj.js +1443 -0
  432. package/dist/program-BFGavenz.js +111 -0
  433. package/dist/prompt-select-styled-BhY1zahx.js +20 -0
  434. package/dist/protocol-DxLbSF2J.js +2477 -0
  435. package/dist/provider-dispatcher-C-yy1D7r.js +22 -0
  436. package/dist/provider-dispatcher-ErSjESTP.js +2 -0
  437. package/dist/qr-cli-C1-oy_ho.js +349 -0
  438. package/dist/qr-cli-DmEs63Sb.js +2 -0
  439. package/dist/reaction-runtime-api-gua650a7.js +116 -0
  440. package/dist/reactions-R-rA7cXz.js +998 -0
  441. package/dist/register-service-commands-DkbqNKVB.js +71 -0
  442. package/dist/register.agent-C3nW9wDn.js +248 -0
  443. package/dist/register.configure-BzLHCu95.js +15 -0
  444. package/dist/register.maintenance-BHFQo4gr.js +363 -0
  445. package/dist/register.message-CsYRdfKi.js +329 -0
  446. package/dist/register.onboard-DltySQ6C.js +88 -0
  447. package/dist/register.runtime-6Sk1Njnp.js +81 -0
  448. package/dist/register.runtime.js +1 -1
  449. package/dist/register.setup-CDvVQJuj.js +150 -0
  450. package/dist/register.status-health-sessions-B8lorJ2x.js +1215 -0
  451. package/dist/register.subclis-BD4fuAci.js +3 -0
  452. package/dist/register.subclis-CbRd3F_m.js +29 -0
  453. package/dist/register.subclis-core-Dtq9dAjI.js +249 -0
  454. package/dist/reply-dispatch-runtime-DldslKSK.js +13 -0
  455. package/dist/reply-runtime-2EGTfk-1.js +11 -0
  456. package/dist/reply.runtime-OaHntzIS.js +2 -0
  457. package/dist/reply.runtime.js +1 -1
  458. package/dist/restart-health-BjmfJCUM.js +202 -0
  459. package/dist/restart-health-hw909zlD.js +2 -0
  460. package/dist/root-help-_hHiERsR.js +44 -0
  461. package/dist/routes-BxCk7Pue.js +3341 -0
  462. package/dist/routes-C1_6oFmZ.js +2 -0
  463. package/dist/rpc-zRbkEo6W.js +61 -0
  464. package/dist/rpc.runtime-BZSYNDPa.js +21 -0
  465. package/dist/rpc.runtime.js +1 -1
  466. package/dist/run-delivery.runtime-D6YDo67d.js +530 -0
  467. package/dist/run-delivery.runtime.js +1 -1
  468. package/dist/run-embedded.runtime-BsgPrPDa.js +4 -0
  469. package/dist/run-embedded.runtime.js +1 -1
  470. package/dist/run-execution-cli.runtime-CggaHhrJ.js +4 -0
  471. package/dist/run-execution-cli.runtime.js +1 -1
  472. package/dist/run-executor.runtime-CKkLEr_T.js +277 -0
  473. package/dist/run-executor.runtime.js +1 -1
  474. package/dist/run-main-CJYYkV6H.js +567 -0
  475. package/dist/run-subagent-registry.runtime-B0sgf_oy.js +2 -0
  476. package/dist/run-subagent-registry.runtime.js +1 -1
  477. package/dist/run-wait-DHizeptL.js +135 -0
  478. package/dist/runtime-EtV_ChXX.js +9 -0
  479. package/dist/runtime-api-6H864Pmt.js +9 -0
  480. package/dist/runtime-api-CbZqRBZQ.js +14 -0
  481. package/dist/runtime-api-ZxEgu8cW.js +4 -0
  482. package/dist/runtime-api-j9A6jYUr.js +9 -0
  483. package/dist/runtime-embedded-pi.runtime-BHjCPnxo.js +2 -0
  484. package/dist/runtime-embedded-pi.runtime.js +1 -1
  485. package/dist/runtime-hvRzTSAZ.js +973 -0
  486. package/dist/runtime-internal-C_KZYzFK.js +2 -0
  487. package/dist/runtime-options-BZEOCnMg.js +275 -0
  488. package/dist/runtime-schema-R7LWe58K.js +28576 -0
  489. package/dist/scan-BNDE3dSE.js +523 -0
  490. package/dist/scan-TG6lVEQ2.js +2 -0
  491. package/dist/secrets-cli-twD2FWoZ.js +2101 -0
  492. package/dist/security-cli-Cd1A5yhL.js +486 -0
  493. package/dist/selection-CqqmU0Hi.js +7764 -0
  494. package/dist/selection-CsM62vcz.js +2 -0
  495. package/dist/send-D-EgB64m.js +156 -0
  496. package/dist/send-DPk5hW1W.js +102 -0
  497. package/dist/send.runtime-3QDkKN71.js +2 -0
  498. package/dist/send.runtime.js +1 -1
  499. package/dist/server-C94r_Qff.js +77 -0
  500. package/dist/server-Ceiopn_v.js +13 -0
  501. package/dist/server-context-BFJlu5HY.js +2 -0
  502. package/dist/server-context-PNEqhnTM.js +847 -0
  503. package/dist/server-node-events-QOAWLsDC.js +481 -0
  504. package/dist/server-plugin-bootstrap-CgsjzB17.js +2 -0
  505. package/dist/server-plugin-bootstrap-Dfuf75EN.js +12728 -0
  506. package/dist/server-restart-sentinel-BMPqZ7Jw.js +697 -0
  507. package/dist/server.impl-CCoQpvB7.js +12864 -0
  508. package/dist/session-kill-http-oPi3ajEp.js +110 -0
  509. package/dist/session-reset-service-CzDd6PBK.js +497 -0
  510. package/dist/session-route-DUOQE8-f.js +93 -0
  511. package/dist/session-status.runtime-W5tlGbXw.js +2 -0
  512. package/dist/session-status.runtime.js +1 -1
  513. package/dist/session-subagent-reactivation.runtime-yoYn1awK.js +2 -0
  514. package/dist/session-subagent-reactivation.runtime.js +1 -1
  515. package/dist/session-tab-registry-DkeCaT-2.js +581 -0
  516. package/dist/session-visibility-B4CFjv43.js +147 -0
  517. package/dist/sessions-helpers-CDfOVWe3.js +305 -0
  518. package/dist/sessions-history-http-QXeTdxXM.js +383 -0
  519. package/dist/sessions-patch-xb4bXPwh.js +309 -0
  520. package/dist/sessions-resolve-BPlrW8C3.js +174 -0
  521. package/dist/sessions.runtime-yYJXudA9.js +2 -0
  522. package/dist/sessions.runtime.js +1 -1
  523. package/dist/setup-0Im0LL1d.js +636 -0
  524. package/dist/setup-api-BxwfqXN-.js +29 -0
  525. package/dist/setup-core-BWwXgEuM.js +171 -0
  526. package/dist/setup-core-DzHNbQLG.js +176 -0
  527. package/dist/setup-surface-BVnqDsfU.js +286 -0
  528. package/dist/setup-surface-BajZWmKz2.js +403 -0
  529. package/dist/setup-surface-rDO3YjSb.js +219 -0
  530. package/dist/setup.finalize-BsnPbdwc.js +547 -0
  531. package/dist/setup.gateway-config-BFawSWHL.js +250 -0
  532. package/dist/shared-52tFSlVk.js +121 -0
  533. package/dist/shared-C8ENgtxM.js +198 -0
  534. package/dist/shared-DbXvU7JV.js +76 -0
  535. package/dist/slash-state-CMuPwgKt.js +1911 -0
  536. package/dist/src-IzaHgU6a.js +3974 -0
  537. package/dist/startup-context-xJS8ckSG.js +312 -0
  538. package/dist/status-BO4LMTER.js +2 -0
  539. package/dist/status-BwY1tASe.js +3 -0
  540. package/dist/status-BxG6n-ko.js +397 -0
  541. package/dist/status-Co_cq2vy.js +2 -0
  542. package/dist/status-DKNeRGzW.js +190 -0
  543. package/dist/status-DzlIHiTS.js +209 -0
  544. package/dist/status-all-DF7qaWjo.js +498 -0
  545. package/dist/status-json-CgCilobT.js +14 -0
  546. package/dist/status-json-command-DAa78z3e.js +84 -0
  547. package/dist/status-runtime-shared-CRCuxXn_.js +257 -0
  548. package/dist/status-subagents.runtime-hUsBd4C5.js +18 -0
  549. package/dist/status-subagents.runtime.js +1 -1
  550. package/dist/status-text-BdbRrl1G.js +237 -0
  551. package/dist/status.gateway-connection.runtime-BmSTYFFO.js +2 -0
  552. package/dist/status.gateway-connection.runtime.js +1 -1
  553. package/dist/status.gather-CItmFIHS.js +292 -0
  554. package/dist/status.gather-qB6WOoH7.js +2 -0
  555. package/dist/status.runtime-ClZCgYx1.js +2 -0
  556. package/dist/status.runtime.js +1 -1
  557. package/dist/status.scan-overview-B0b0Mvng.js +379 -0
  558. package/dist/status.scan-xY7nUi9N.js +65 -0
  559. package/dist/status.scan.fast-json-BANGHOys.js +132 -0
  560. package/dist/status.scan.fast-json-M-DmMy2l.js +2 -0
  561. package/dist/status.summary-B3PlFnWw.js +2 -0
  562. package/dist/status.summary-adB75FOM.js +214 -0
  563. package/dist/subagent-announce-B4w7Mcpr.js +351 -0
  564. package/dist/subagent-announce-delivery-Dma0A4gL.js +726 -0
  565. package/dist/subagent-announce-output-sUPLcge-.js +364 -0
  566. package/dist/subagent-control-CxR0WRrx.js +506 -0
  567. package/dist/subagent-followup.runtime-XeFe_LA0.js +68 -0
  568. package/dist/subagent-followup.runtime.js +1 -1
  569. package/dist/subagent-orphan-recovery-CJPHy8JV.js +305 -0
  570. package/dist/subagent-registry-CjMWjRCE.js +1753 -0
  571. package/dist/subagent-registry-H20VxEu0.js +3 -0
  572. package/dist/subagent-registry.runtime.js +1 -1
  573. package/dist/subagent-spawn-CRM5x6cV.js +1005 -0
  574. package/dist/system-cli-BJ5mMirj.js +59 -0
  575. package/dist/targets-CUnlEj96.js +67 -0
  576. package/dist/task-executor-DKnEwQ6v.js +360 -0
  577. package/dist/task-owner-access-CfypP1Yc.js +74 -0
  578. package/dist/task-registry-delivery-runtime-BB6ZzpqH.js +2 -0
  579. package/dist/task-registry-delivery-runtime-CvHa0gv-.js +3 -0
  580. package/dist/task-registry-pQuAfAL9.js +2366 -0
  581. package/dist/task-registry.maintenance-Bfd87wEV.js +416 -0
  582. package/dist/task-registry.maintenance-VgfbW0yt.js +2 -0
  583. package/dist/telegram/token.js +1 -1
  584. package/dist/testing-C_mngO0u.js +575 -0
  585. package/dist/text-report-Ct6t3he6.js +587 -0
  586. package/dist/tool-resolution-C4KGgPH-.js +90 -0
  587. package/dist/tools-effective-inventory-Bo2QC-m8.js +152 -0
  588. package/dist/tools-invoke-http-CBZPFh5L.js +206 -0
  589. package/dist/trash-DhZow3jd.js +24 -0
  590. package/dist/tui-cli-BPdQPozP.js +4575 -0
  591. package/dist/update-cli-BRi3mVAU.js +1759 -0
  592. package/dist/upgrade-D9zejtCk.js +1226 -0
  593. package/dist/video-generation-task-status-BSBQ0_FO.js +163 -0
  594. package/dist/wait-for-idle-before-flush-D1dTT9th.js +5986 -0
  595. package/dist/wizard-models-ysyV_WWR.js +334 -0
  596. package/package.json +1 -1
  597. package/dist/abort-DaihtnYj.js +0 -201
  598. package/dist/abort.runtime-BUT9L_5l.js +0 -2
  599. package/dist/accounts-BY5wsBnV.js +0 -104
  600. package/dist/accounts-DGth1vsM.js +0 -107
  601. package/dist/accounts-Do6Ir-q3.js +0 -2
  602. package/dist/acp-cli-BHgjn8rh.js +0 -2193
  603. package/dist/acp-spawn-BAM_Jrft.js +0 -2
  604. package/dist/acp-spawn-DyBD_Y_t.js +0 -1093
  605. package/dist/acp-stateful-target-driver-DKGnfjWu.js +0 -89
  606. package/dist/action-agents-CzMSNQdc.js +0 -67
  607. package/dist/action-focus-CpjIrZFe.js +0 -132
  608. package/dist/action-help-BhE9UosK.js +0 -7
  609. package/dist/action-info-CH2j6dKT.js +0 -101
  610. package/dist/action-kill-CB4AnLIf.js +0 -33
  611. package/dist/action-list-CQ8LbzvR.js +0 -21
  612. package/dist/action-log-DZblh247.js +0 -30
  613. package/dist/action-send-DMe0B4FG.js +0 -39
  614. package/dist/action-spawn-CkKMESb5.js +0 -47
  615. package/dist/action-unfocus-DjQzPZwU.js +0 -29
  616. package/dist/actions.runtime-CUdRdpLB.js +0 -5
  617. package/dist/actions.runtime-CxRstWdN.js +0 -18
  618. package/dist/agent-command-Nh_kPL3z.js +0 -874
  619. package/dist/agent-harness-runtime-BEb7Wk1m.js +0 -144
  620. package/dist/agent-q6U-cKJn.js +0 -2
  621. package/dist/agent-runner-utils-x_qJ6xYC.js +0 -239
  622. package/dist/agent-runner.runtime-DRvTfUPd.js +0 -3455
  623. package/dist/agent-runtime-jSYYQd6f.js +0 -18
  624. package/dist/agents-BKOpsZXw.js +0 -5
  625. package/dist/agents-BY34ViPX.js +0 -954
  626. package/dist/aliases-CD5YlX7d.js +0 -2
  627. package/dist/aliases-Dq31zANx.js +0 -96
  628. package/dist/api-BhxN9fxJ.js +0 -139
  629. package/dist/api-DjL_3olO.js +0 -5
  630. package/dist/api-jIYND-S5.js +0 -3
  631. package/dist/approval-gateway-resolver-BfvdJW5s.js +0 -29
  632. package/dist/approval-gateway-runtime-BBf976nt.js +0 -2
  633. package/dist/approval-handler-runtime-Bq4p5wvg.js +0 -439
  634. package/dist/approval-native-runtime-IrisOZrU.js +0 -729
  635. package/dist/attempt-execution.runtime-BXGalt-_.js +0 -509
  636. package/dist/attempt.prompt-helpers-A-pc2LfL.js +0 -221
  637. package/dist/attempt.tool-run-context-Ukna4ck-.js +0 -933
  638. package/dist/audit-CVUpfDvE.js +0 -939
  639. package/dist/audit.runtime-CsuGXvud.js +0 -7
  640. package/dist/auth-CjcZyRUW.js +0 -383
  641. package/dist/auth-order-DIkyTpW4.js +0 -2
  642. package/dist/auth-order-Dpt1K1rT.js +0 -96
  643. package/dist/auth-sVuL2xeZ.js +0 -2
  644. package/dist/bash-tools-DDv0zQh9.js +0 -2824
  645. package/dist/bash-tools-s-QSvRmt.js +0 -3
  646. package/dist/binding-routing-Cz5R2kFK.js +0 -85
  647. package/dist/binding-targets-D4j2hdQh.js +0 -121
  648. package/dist/bridge-server-X8SdeAI3.js +0 -113
  649. package/dist/browser-control-auth-BrF3DZxC.js +0 -2
  650. package/dist/browser-node-runtime-BecPmKOx.js +0 -12
  651. package/dist/browser-profiles-BxAKEG3x.js +0 -2
  652. package/dist/browser-runtime-D9fTDscJ.js +0 -387
  653. package/dist/browser-setup-tools--AQGWGvl.js +0 -13
  654. package/dist/build-B0nbyXrw.js +0 -550
  655. package/dist/call-BvqN9kay.js +0 -3
  656. package/dist/call-Dk5rTl-p.js +0 -331
  657. package/dist/call.runtime-Bx1hKDwO.js +0 -2
  658. package/dist/capability-cli-286Z3Bq3.js +0 -1401
  659. package/dist/catchup-DyeQ6GNj.js +0 -300
  660. package/dist/channel-B5m01jSZ.js +0 -1802
  661. package/dist/channel-BE26v3WU.js +0 -840
  662. package/dist/channel-BS7r_Zt1.js +0 -226
  663. package/dist/channel-BUWCqkGh.js +0 -1320
  664. package/dist/channel-BhgKqvZn.js +0 -453
  665. package/dist/channel-Bx703sxQ.js +0 -297
  666. package/dist/channel-CDjlEQAM.js +0 -491
  667. package/dist/channel-ChrqAgRS.js +0 -595
  668. package/dist/channel-Crmp3BHh.js +0 -1100
  669. package/dist/channel-D7GdDfBl.js +0 -1174
  670. package/dist/channel-DqSzRIul.js +0 -350
  671. package/dist/channel-core-DIwclC34.js +0 -5
  672. package/dist/channel-inbound-DPW1gRUU.js +0 -31
  673. package/dist/channel-plugin-runtime-BJhRSlBI.js +0 -771
  674. package/dist/channel-runtime-sV_Sg0EO.js +0 -425
  675. package/dist/channel.runtime-4BaNapRW.js +0 -89
  676. package/dist/channel.runtime-Bk2w0Yzd.js +0 -2364
  677. package/dist/channel.runtime-Bo5_2imz.js +0 -109
  678. package/dist/channel.runtime-CdYWlMyL.js +0 -40130
  679. package/dist/channel.runtime-CrYmCmSw.js +0 -4
  680. package/dist/channel.runtime-D3APPhVs.js +0 -430
  681. package/dist/channel.runtime-DjF1Gg6N.js +0 -576
  682. package/dist/channel.setup-BxXrmAYb.js +0 -10
  683. package/dist/channels-DHcJgMnw.js +0 -733
  684. package/dist/channels-cli-Dnq08u4r.js +0 -268
  685. package/dist/chat-BGU3UVKD.js +0 -2830
  686. package/dist/clawbot-cli-C-rqJUW-.js +0 -9
  687. package/dist/cli-BlnGJbLJ.js +0 -219
  688. package/dist/cli-D0RU1q0-.js +0 -2
  689. package/dist/cli-DBw79G2t.js +0 -72
  690. package/dist/cli-Dul37_xp.js +0 -2
  691. package/dist/cli-runner-DY8BKEmu.js +0 -286
  692. package/dist/cli-runner.runtime-5JMuegF9.js +0 -3
  693. package/dist/cli-runner.runtime-DQROn9Ve.js +0 -4
  694. package/dist/cli.runtime-CGOUREQg.js +0 -1261
  695. package/dist/client-CCBN1ydB.js +0 -138
  696. package/dist/client-PHLyQ8il.js +0 -713
  697. package/dist/command-auth-79QKQZZ3.js +0 -76
  698. package/dist/command-config-resolution-BKAgMItc.js +0 -2
  699. package/dist/command-config-resolution-BUCAmCZ_.js +0 -23
  700. package/dist/command-config-resolution.runtime-BVtfeARM.js +0 -2
  701. package/dist/command-registry-CBBqTuqk.js +0 -4
  702. package/dist/command-registry-core-D4BBKYaw.js +0 -106
  703. package/dist/command-registry-nztgeSim.js +0 -9
  704. package/dist/command-secret-gateway-g0alGmKz.js +0 -528
  705. package/dist/command-status.runtime-Dw6Zj5hL.js +0 -87
  706. package/dist/commands-acp-De-XFc40.js +0 -77
  707. package/dist/commands-compact.runtime-6gixR2a8.js +0 -10
  708. package/dist/commands-handlers.runtime-DCmZAlRN.js +0 -4599
  709. package/dist/commands-status-CION7GYY.js +0 -16
  710. package/dist/commands-status.runtime-FBwoHftv.js +0 -3
  711. package/dist/commands-subagents-control.runtime-C2xgOYKM.js +0 -2
  712. package/dist/commands-subagents-control.runtime-CgIEblx3.js +0 -3
  713. package/dist/commands-system-prompt-B-jC-KV-.js +0 -158
  714. package/dist/commands-system-prompt-DeK5Jhy_.js +0 -2
  715. package/dist/commands.runtime-CHSb1kYa.js +0 -167
  716. package/dist/compact-Dwchggv2.js +0 -1118
  717. package/dist/compact.runtime-jDUYMSjR.js +0 -12
  718. package/dist/completion-cli-DLHh5B2t.js +0 -328
  719. package/dist/config-Bnb9qa1S.js +0 -252
  720. package/dist/config-cli-DReWqAE2.js +0 -1078
  721. package/dist/configure-BLNGlWh0.js +0 -1252
  722. package/dist/configure-nPzsEeOb.js +0 -2
  723. package/dist/connect-options-C9cvS-bh.js +0 -699
  724. package/dist/control-auth-D2-P54fW.js +0 -125
  725. package/dist/control-service-CqUPgxlx.js +0 -156
  726. package/dist/conversation-id-BAzJOKBB.js +0 -235
  727. package/dist/conversation-id-WJLKuyy9.js +0 -38
  728. package/dist/conversation-runtime-D8fK5aI0.js +0 -31
  729. package/dist/core-DywmHt1k.js +0 -275
  730. package/dist/cron-cli-CeEJRkfR.js +0 -713
  731. package/dist/daemon-cli-BZZOjJHx.js +0 -12
  732. package/dist/dashboard-C0NRxmP3.js +0 -81
  733. package/dist/dashboard-DqhPgQv-.js +0 -2
  734. package/dist/delegate-DwVbOeR5.js +0 -64
  735. package/dist/detached-task-runtime-DiDRj-v-.js +0 -73
  736. package/dist/devices-cli-BKVbpwVc.js +0 -498
  737. package/dist/diagnostics-gh3UN_iV.js +0 -154
  738. package/dist/direct-dm-CwHHUkHV.js +0 -64
  739. package/dist/dispatch-B5af8_1v.js +0 -1131
  740. package/dist/dispatch-acp-DgOnUWBl.js +0 -981
  741. package/dist/dispatch-acp-manager.runtime-XWNjVh_M.js +0 -3
  742. package/dist/dispatch-acp.runtime-BdYL_ZqM.js +0 -19
  743. package/dist/doctor-device-pairing-CtGzWmXB.js +0 -307
  744. package/dist/doctor-gateway-daemon-flow-CCBI0jL4.js +0 -250
  745. package/dist/doctor-gateway-health-CkjqPFDl.js +0 -63
  746. package/dist/doctor-health-BOhuy1vP.js +0 -59
  747. package/dist/doctor-health-contributions-ChEuyLAY.js +0 -493
  748. package/dist/doctor-prompter-9nOTFD0Q.js +0 -56
  749. package/dist/doctor-workspace-status-CO5Ocwlt.js +0 -75
  750. package/dist/dreaming-GOPEFPio.js +0 -1574
  751. package/dist/dreaming-narrative-DfxHaxOU.js +0 -595
  752. package/dist/embedded-gateway-stub.runtime-B2OWcbsK.js +0 -9
  753. package/dist/exec-approvals-cli-CGeFtFbB.js +0 -498
  754. package/dist/fallbacks-CdfWAgNP.js +0 -2
  755. package/dist/fallbacks-eXbQ8TBp.js +0 -31
  756. package/dist/fallbacks-shared-akcCu5CD.js +0 -111
  757. package/dist/gateway-D-dDKqwi.js +0 -115
  758. package/dist/gateway-cli-NlsKGnqx.js +0 -1283
  759. package/dist/gateway-rpc-Cxa8dVW5.js +0 -14
  760. package/dist/gateway-rpc.runtime-D76s-oxs.js +0 -23
  761. package/dist/gateway-runtime-Dhm_gLh1.js +0 -15
  762. package/dist/gateway-status-C_L_CdOg.js +0 -584
  763. package/dist/genesis-tools-rRJB3JXY.js +0 -9166
  764. package/dist/genesis-tools.runtime-6oKokqaA.js +0 -2
  765. package/dist/get-reply-BkiDsDVY.js +0 -3897
  766. package/dist/get-reply-from-config.runtime-CHKCcj9D.js +0 -2
  767. package/dist/graph-users-BnXIYyC5.js +0 -1337
  768. package/dist/health-ZsJNENSY.js +0 -3
  769. package/dist/health-osa9LOJf.js +0 -469
  770. package/dist/health-route-8TdKOYLp.js +0 -2
  771. package/dist/health-route-BdLtX2Bg.js +0 -41
  772. package/dist/heartbeat-runner-BCbkAprr.js +0 -1292
  773. package/dist/heartbeat-runner-Dc1K8S94.js +0 -5
  774. package/dist/heartbeat-runner.runtime-pJaAsgLY.js +0 -4
  775. package/dist/hooks-cli-C3ggAz0i.js +0 -433
  776. package/dist/image-fallbacks-CiSae-lb.js +0 -2
  777. package/dist/image-fallbacks-vI8KUh6N.js +0 -31
  778. package/dist/inbound-reply-dispatch-DLM60UDh.js +0 -73
  779. package/dist/infra-runtime-CrHVeejV.js +0 -39
  780. package/dist/init-BKeEiV2q.js +0 -59
  781. package/dist/library-CHB7yTo5.js +0 -45
  782. package/dist/lifecycle-CUULToPr.js +0 -229
  783. package/dist/lifecycle-DCMpTRD2.js +0 -571
  784. package/dist/lifecycle.runtime-CP4gRxWv.js +0 -2
  785. package/dist/list-0zDFAWTF.js +0 -2
  786. package/dist/list-BaxVHTAN.js +0 -131
  787. package/dist/list-CMRMgrPs.js +0 -1212
  788. package/dist/list-DSrBtnKI.js +0 -2
  789. package/dist/list.probe-BJYSCsJY.js +0 -419
  790. package/dist/llm-slug-generator-Bn_wrWYw.js +0 -79
  791. package/dist/load-config-qC2BWt8E.js +0 -35
  792. package/dist/local-dispatch.runtime-DyU7urGc.js +0 -8
  793. package/dist/logs-cli-zK71r_PE.js +0 -265
  794. package/dist/logs-cli.runtime-k0UtiaRP.js +0 -2
  795. package/dist/main-session-restart-recovery-DMT0Oj9a.js +0 -206
  796. package/dist/managed-image-attachments-B6XXE4--.js +0 -635
  797. package/dist/managed-image-attachments-BTzWoDWE.js +0 -2
  798. package/dist/manager-BCKuWA67.js +0 -2057
  799. package/dist/manager-rGwNUzMp.js +0 -2
  800. package/dist/markdown-to-line-DmPbXQA1.js +0 -790
  801. package/dist/mcp-cli-CYpPNMcE.js +0 -725
  802. package/dist/mcp-http-wiE81iKg.js +0 -529
  803. package/dist/memory-core-host-runtime-cli-BOSQRX1T.js +0 -9
  804. package/dist/message-CUDzVGD8.js +0 -232
  805. package/dist/message-action-runner-Dy0IpKa4.js +0 -1407
  806. package/dist/message-action-runner-KkBFzZdg.js +0 -2
  807. package/dist/message-actions-Dcdb5aSR.js +0 -143
  808. package/dist/message.gateway.runtime-D86fFO99.js +0 -2
  809. package/dist/models-auth-status-DkiX4s0b.js +0 -201
  810. package/dist/models-cli-CSUot1R3.js +0 -219
  811. package/dist/monitor-BA8ByMKR.js +0 -2
  812. package/dist/monitor-Bv1GIHW5.js +0 -1661
  813. package/dist/monitor-DTFY0ruF.js +0 -788
  814. package/dist/monitor-DXH-vNGn.js +0 -1459
  815. package/dist/monitor-Df5k8NGk.js +0 -671
  816. package/dist/monitor-Dk2YRF26.js +0 -1237
  817. package/dist/monitor-auth-CZOW753A.js +0 -207
  818. package/dist/monitor-processing-Clta8N4C.js +0 -1974
  819. package/dist/monitor.runtime-3ORbPT0X.js +0 -2
  820. package/dist/monitor.webhook-CRyTxENk.js +0 -180
  821. package/dist/msteams-BE0VieXF.js +0 -35
  822. package/dist/native-hook-relay-DAwGGuEx.js +0 -519
  823. package/dist/nextcloud-talk-DfYlTFsm.js +0 -17
  824. package/dist/node-cli-Bzyci_X_.js +0 -2276
  825. package/dist/nodes-cli-Er3OZkuk.js +0 -1046
  826. package/dist/nodes-utils-Cp8QZO8-.js +0 -84
  827. package/dist/nodes.helpers-CwKAAnRA.js +0 -34
  828. package/dist/notify-D_5n_vEJ.js +0 -315
  829. package/dist/onboard-BE82RudQ.js +0 -2
  830. package/dist/onboard-Bk4xL8X7.js +0 -70
  831. package/dist/onboard-helpers-D4WYa-6g.js +0 -204
  832. package/dist/onboard-helpers-MuFxPZg5.js +0 -6
  833. package/dist/onboard-interactive-0zmI-9ia.js +0 -24
  834. package/dist/onboard-non-interactive-DIRB95mT.js +0 -635
  835. package/dist/onboard-remote-7qR1knbU.js +0 -2
  836. package/dist/onboard-remote-CLmoySkk.js +0 -193
  837. package/dist/onboard-skills-C_873OK_.js +0 -134
  838. package/dist/onboard-skills-DrlBYc0t.js +0 -2
  839. package/dist/openai-http-DzCBqW6b.js +0 -500
  840. package/dist/openresponses-http-B2zgO5hQ.js +0 -1128
  841. package/dist/operator-approvals-client-mGBl4ptH.js +0 -68
  842. package/dist/outbound.runtime--HS-MxM_.js +0 -2
  843. package/dist/pair-command-approve-CCTSQKJH.js +0 -44
  844. package/dist/persistent-bindings.lifecycle-CnmqGsQf.js +0 -85
  845. package/dist/persistent-bindings.lifecycle-Dav1TX9E.js +0 -2
  846. package/dist/pi-embedded-BSKL8IgF.js +0 -4
  847. package/dist/pi-embedded-DMM8Pfp7.js +0 -2905
  848. package/dist/pi-embedded.runtime-Bv_roBVx.js +0 -4
  849. package/dist/pi-tool-definition-adapter-OrxjlSIM.js +0 -229
  850. package/dist/pi-tools-DD1YegeL.js +0 -1057
  851. package/dist/pi-tools.before-tool-call-J9ujp9Wp.js +0 -433
  852. package/dist/pi-tools.before-tool-call-hGEgKGZQ.js +0 -2
  853. package/dist/plugin-Cg3pHepG.js +0 -12195
  854. package/dist/plugin-enabled-wEQ8BQNw.js +0 -140
  855. package/dist/plugin-registration-DLcLJgqz.js +0 -23
  856. package/dist/plugin-service-BogBl5qk.js +0 -2892
  857. package/dist/policy-Bkh8Xtnb.js +0 -328
  858. package/dist/prepare.runtime-Cd31ie7u.js +0 -815
  859. package/dist/probe-9IM22Rkf.js +0 -2
  860. package/dist/probe-ButCyV3d.js +0 -1443
  861. package/dist/probe-D7QBUio1.js +0 -45
  862. package/dist/probe-DV6CWm0r.js +0 -74
  863. package/dist/probe-DkfetvwA.js +0 -2
  864. package/dist/probe-Dxo-LQjn.js +0 -2205
  865. package/dist/probe-nil3qQAV.js +0 -241
  866. package/dist/program-DHxyOl81.js +0 -111
  867. package/dist/prompt-select-styled-BSf77q2T.js +0 -20
  868. package/dist/protocol-C4I0nfuT.js +0 -2477
  869. package/dist/provider-dispatcher-CkiPxKIr.js +0 -22
  870. package/dist/provider-dispatcher-PmsHJlUO.js +0 -2
  871. package/dist/qr-cli-BHY0TO2W.js +0 -2
  872. package/dist/qr-cli-BbjDJSKp.js +0 -349
  873. package/dist/reaction-runtime-api-DOigJrbq.js +0 -116
  874. package/dist/reactions-CogkrjNr.js +0 -998
  875. package/dist/register-service-commands-IA3Nfza5.js +0 -71
  876. package/dist/register.agent-DD0aSYye.js +0 -248
  877. package/dist/register.configure-BOy4i7Ah.js +0 -15
  878. package/dist/register.maintenance-CUp6FEOF.js +0 -363
  879. package/dist/register.message-DezTIpNI.js +0 -329
  880. package/dist/register.onboard-Brpxl9p3.js +0 -88
  881. package/dist/register.runtime-BfH5rSb_.js +0 -81
  882. package/dist/register.setup-CIt4FVv0.js +0 -150
  883. package/dist/register.status-health-sessions-IbGZwSaG.js +0 -1215
  884. package/dist/register.subclis-BFQii-42.js +0 -29
  885. package/dist/register.subclis-DlYCyoMp.js +0 -3
  886. package/dist/register.subclis-core-DcfC_0CS.js +0 -249
  887. package/dist/reply-dispatch-runtime-Lu4Metex.js +0 -13
  888. package/dist/reply-runtime-CgPzru94.js +0 -11
  889. package/dist/reply.runtime-sw14BA5F.js +0 -2
  890. package/dist/restart-health-1MNBua3p.js +0 -202
  891. package/dist/restart-health-BWGpwgPv.js +0 -2
  892. package/dist/root-help-B3zoC2OP.js +0 -44
  893. package/dist/routes-BM6fbday.js +0 -3341
  894. package/dist/routes-pVc_QLiP.js +0 -2
  895. package/dist/rpc-BGOWS7nj.js +0 -61
  896. package/dist/rpc.runtime-Ca9K3sx8.js +0 -21
  897. package/dist/run-delivery.runtime-CabntI64.js +0 -530
  898. package/dist/run-embedded.runtime-Q7wrP6Qn.js +0 -4
  899. package/dist/run-execution-cli.runtime-CtRUFc-M.js +0 -4
  900. package/dist/run-executor.runtime-Nm38xsKA.js +0 -277
  901. package/dist/run-main-UT0zTwCg.js +0 -567
  902. package/dist/run-subagent-registry.runtime-D9_scMUr.js +0 -2
  903. package/dist/run-wait-B2K_6JNL.js +0 -135
  904. package/dist/runtime-BZ296jTK.js +0 -9
  905. package/dist/runtime-DnZsw7MB.js +0 -973
  906. package/dist/runtime-api-BL9vpbvb.js +0 -14
  907. package/dist/runtime-api-BbsLJB4C.js +0 -9
  908. package/dist/runtime-api-ChwFrQRw.js +0 -9
  909. package/dist/runtime-api-_fH7M3Qh.js +0 -4
  910. package/dist/runtime-embedded-pi.runtime-TOdW-E-2.js +0 -2
  911. package/dist/runtime-internal-DGwOFi_E.js +0 -2
  912. package/dist/runtime-options-CSPfxkb1.js +0 -275
  913. package/dist/runtime-schema-DtNq1-Zd.js +0 -28576
  914. package/dist/scan-D6gkNpKl.js +0 -523
  915. package/dist/scan-_9J5-5L6.js +0 -2
  916. package/dist/secrets-cli-DlVSRQPM.js +0 -2101
  917. package/dist/security-cli-DtzNOYL2.js +0 -486
  918. package/dist/selection-CBJZE_FL.js +0 -7764
  919. package/dist/selection-XsoEF2p2.js +0 -2
  920. package/dist/send-BAaDBRfi.js +0 -156
  921. package/dist/send-BB-M1afy.js +0 -102
  922. package/dist/send.runtime-CI_75KUP.js +0 -2
  923. package/dist/server-D58E1Cua.js +0 -77
  924. package/dist/server-D6rXK0fF.js +0 -13
  925. package/dist/server-context-D5AnCc1E.js +0 -2
  926. package/dist/server-context-bt09wrJu.js +0 -847
  927. package/dist/server-node-events-CUx4-7FL.js +0 -481
  928. package/dist/server-plugin-bootstrap-CBcQpYIR.js +0 -12708
  929. package/dist/server-plugin-bootstrap-CfkBsGUg.js +0 -2
  930. package/dist/server-restart-sentinel-ByFI_0MB.js +0 -697
  931. package/dist/server.impl-DzntNeH-.js +0 -12864
  932. package/dist/session-kill-http-9MoO6FXC.js +0 -110
  933. package/dist/session-reset-service-redPsOs-.js +0 -497
  934. package/dist/session-route-C8oB2UYs.js +0 -93
  935. package/dist/session-status.runtime-D3bYBPJe.js +0 -2
  936. package/dist/session-subagent-reactivation.runtime-aat7tUag.js +0 -2
  937. package/dist/session-tab-registry-CAJ_oDsb.js +0 -581
  938. package/dist/session-visibility-Dq88jJYB.js +0 -147
  939. package/dist/sessions-helpers-C8-IkqhO.js +0 -305
  940. package/dist/sessions-history-http-4Ftuwnes.js +0 -383
  941. package/dist/sessions-patch-BsyNHOaz.js +0 -309
  942. package/dist/sessions-resolve-gKLz2Bup.js +0 -174
  943. package/dist/sessions.runtime-C1W59rQY.js +0 -2
  944. package/dist/setup-DhvXyU_5.js +0 -636
  945. package/dist/setup-api-B9Y4qPgq.js +0 -29
  946. package/dist/setup-core-CdFQ6ZXC.js +0 -176
  947. package/dist/setup-core-kXUD3Kat.js +0 -171
  948. package/dist/setup-surface-BFL9WfBs.js +0 -219
  949. package/dist/setup-surface-Cxg_nSWc.js +0 -286
  950. package/dist/setup-surface-DbooMj782.js +0 -403
  951. package/dist/setup.finalize-CKxukDYi.js +0 -547
  952. package/dist/setup.gateway-config-BhEtXwaB.js +0 -250
  953. package/dist/shared-BNVKrp5y.js +0 -76
  954. package/dist/shared-CM3mnx7z.js +0 -198
  955. package/dist/shared-CfrsSVhL.js +0 -121
  956. package/dist/slash-state-2Z-om57Q.js +0 -1911
  957. package/dist/src-DAoKvK_N.js +0 -3974
  958. package/dist/startup-context-CtYAdYwd.js +0 -312
  959. package/dist/status-B2M0Imij.js +0 -3
  960. package/dist/status-Bd-BNmiE.js +0 -2
  961. package/dist/status-D6nbpHFi.js +0 -397
  962. package/dist/status-MByUxUGu.js +0 -209
  963. package/dist/status-QUjO1tkz.js +0 -2
  964. package/dist/status-all-DPa-BiHk.js +0 -498
  965. package/dist/status-erNo8YmW.js +0 -190
  966. package/dist/status-json-command-C9rbAyj-.js +0 -84
  967. package/dist/status-json-tO3CQXIQ.js +0 -14
  968. package/dist/status-runtime-shared-DmBB_gmT.js +0 -257
  969. package/dist/status-subagents.runtime-BXAZr5y0.js +0 -18
  970. package/dist/status-text-BCeYk0-q.js +0 -237
  971. package/dist/status.gateway-connection.runtime-bt35dapy.js +0 -2
  972. package/dist/status.gather-B9a-CEev.js +0 -292
  973. package/dist/status.gather-ahBLFzk6.js +0 -2
  974. package/dist/status.runtime-BrErwtfc.js +0 -2
  975. package/dist/status.scan-D2mvM4II.js +0 -65
  976. package/dist/status.scan-overview-uOOaqp1t.js +0 -379
  977. package/dist/status.scan.fast-json-C9dkN28s.js +0 -2
  978. package/dist/status.scan.fast-json-DY3Or8S4.js +0 -132
  979. package/dist/status.summary-Cf4p2BPK.js +0 -2
  980. package/dist/status.summary-DxfZCcNa.js +0 -214
  981. package/dist/subagent-announce-CyQZsAIm.js +0 -351
  982. package/dist/subagent-announce-delivery-CgdPNjMA.js +0 -726
  983. package/dist/subagent-announce-output-D1xi4Tk1.js +0 -364
  984. package/dist/subagent-control-D-O6I8Mt.js +0 -506
  985. package/dist/subagent-followup.runtime-BbA7NPAq.js +0 -68
  986. package/dist/subagent-orphan-recovery-C6_cmAyE.js +0 -305
  987. package/dist/subagent-registry-Dn_XpDh0.js +0 -1753
  988. package/dist/subagent-registry-DodFw3pu.js +0 -3
  989. package/dist/subagent-spawn-Dw5lttXp.js +0 -1005
  990. package/dist/system-cli-CSqO2Z4K.js +0 -59
  991. package/dist/targets-CMdwh9lR.js +0 -67
  992. package/dist/task-executor-DgZSfcBk.js +0 -360
  993. package/dist/task-owner-access-9c38idlo.js +0 -74
  994. package/dist/task-registry-Z-lBPkNj.js +0 -2366
  995. package/dist/task-registry-delivery-runtime-DOV4qoj4.js +0 -2
  996. package/dist/task-registry-delivery-runtime-EATr0C3C.js +0 -3
  997. package/dist/task-registry.maintenance-C1YMEwhk.js +0 -416
  998. package/dist/task-registry.maintenance-CBfaUWcp.js +0 -2
  999. package/dist/testing-CFk04o9M.js +0 -575
  1000. package/dist/text-report-QhVG354o.js +0 -587
  1001. package/dist/tool-resolution-D6V4tg-G.js +0 -90
  1002. package/dist/tools-effective-inventory-DFU7yYvD.js +0 -152
  1003. package/dist/tools-invoke-http-y6WIa3Ku.js +0 -206
  1004. package/dist/trash-rhbwNhfQ.js +0 -24
  1005. package/dist/tui-cli-BfxeO4YM.js +0 -4575
  1006. package/dist/update-cli-DaN9bvPV.js +0 -1759
  1007. package/dist/upgrade-f5dlIxir.js +0 -1226
  1008. package/dist/video-generation-task-status-yX54iO8n.js +0 -163
  1009. package/dist/wait-for-idle-before-flush-mZrBNr5z.js +0 -5986
  1010. package/dist/wizard-models-D_avLyHR.js +0 -334
@@ -1,2892 +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-B1sv_bx7.js";
10
- import { En as errorShape, Tn as ErrorCodes } from "./protocol-C4I0nfuT.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-D-dDKqwi.js";
14
- import { i as stringEnum, r as optionalStringEnum } from "./typebox-DZB5krxi.js";
15
- import { a as selectDefaultNodeFromList, i as resolveNodeIdFromList, t as listNodes } from "./nodes-utils-Cp8QZO8-.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-DuYzmNnc.js";
19
- import { t as startLazyPluginServiceModule } from "./lazy-service-module-DP9zBTob.js";
20
- import "./browser-config-runtime-B1v_5K97.js";
21
- import { n as callGatewayFromCli, t as addGatewayClientOptions } from "./gateway-rpc-Cxa8dVW5.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-CwKAAnRA.js";
25
- import "./browser-node-runtime-BecPmKOx.js";
26
- import "./browser-security-runtime-bMw-CyNH.js";
27
- import { t as formatHelpExamples } from "./help-format-DziqFQ8a.js";
28
- import "./browser-setup-tools--AQGWGvl.js";
29
- import "./channel-actions-JVR1YG7X.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-CAJ_oDsb.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-D9fTDscJ.js";
33
- import { n as resolveProfile, t as resolveBrowserConfig } from "./config-Bnb9qa1S.js";
34
- import { f as redactCdpUrl } from "./cdp.helpers-Ch0SX_4B.js";
35
- import { r as getBrowserProfileCapabilities } from "./target-id-2b0JJ9TC.js";
36
- import { l as normalizeBrowserFormField, u as normalizeBrowserFormFieldValue } from "./pw-role-snapshot-CWu8vOvM.js";
37
- import { a as createBrowserRouteDispatcher, r as startBrowserControlServiceFromConfig, t as createBrowserControlContext } from "./control-service-CqUPgxlx.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
- "For stable, self-resolving refs across calls, use snapshot with refs=\"aria\" (Playwright aria-ref ids). Default refs=\"role\" are role+name-based.",
739
- "Use snapshot+act for UI automation. Avoid act:wait by default; use only in exceptional cases when no reliable UI state exists.",
740
- `target selects browser location (sandbox|host|node). Default: ${targetDefault}.`,
741
- hostHint
742
- ].join(" "),
743
- parameters: BrowserToolSchema,
744
- execute: async (_toolCallId, args) => {
745
- const params = args;
746
- const action = readStringParam(params, "action", { required: true });
747
- const profile = readStringParam(params, "profile");
748
- const requestedNode = readStringParam(params, "node");
749
- const requestedTimeoutMs = readToolTimeoutMs(params);
750
- let target = readStringParam(params, "target");
751
- const configuredNode = browserToolDeps.loadConfig().gateway?.nodes?.browser?.node?.trim();
752
- if (requestedNode && target && target !== "node") throw new Error("node is only supported with target=\"node\".");
753
- const isUserBrowserProfile = shouldPreferHostForProfile(profile);
754
- if (isUserBrowserProfile) {
755
- if (target === "sandbox") throw new Error(`profile="${profile}" cannot use the sandbox browser; use target="host" or omit target.`);
756
- }
757
- let nodeTarget = null;
758
- try {
759
- nodeTarget = await resolveBrowserNodeTarget$1({
760
- requestedNode: requestedNode ?? void 0,
761
- target,
762
- sandboxBridgeUrl: opts?.sandboxBridgeUrl
763
- });
764
- } catch (error) {
765
- if (!(isUserBrowserProfile && !target && !requestedNode && !configuredNode)) throw error;
766
- }
767
- if (isUserBrowserProfile && !target && !requestedNode && !nodeTarget) target = "host";
768
- const baseUrl = nodeTarget ? void 0 : resolveBrowserBaseUrl({
769
- target: target === "node" ? void 0 : target,
770
- sandboxBridgeUrl: opts?.sandboxBridgeUrl,
771
- allowHostControl: opts?.allowHostControl
772
- });
773
- const proxyRequest = nodeTarget ? async (opts) => {
774
- const proxy = await callBrowserProxy({
775
- nodeId: nodeTarget.nodeId,
776
- method: opts.method,
777
- path: opts.path,
778
- query: opts.query,
779
- body: opts.body,
780
- timeoutMs: opts.timeoutMs,
781
- profile: opts.profile
782
- });
783
- const mapping = await persistProxyFiles$1(proxy.files);
784
- applyProxyPaths$1(proxy.result, mapping);
785
- return proxy.result;
786
- } : null;
787
- const toolTimeoutMs = requestedTimeoutMs ?? (usesExistingSessionManageFlow({
788
- action,
789
- profileName: profile
790
- }) ? DEFAULT_EXISTING_SESSION_MANAGE_TIMEOUT_MS : void 0);
791
- const touchTrackedTab = (targetId, url) => {
792
- if (proxyRequest || !targetId) return;
793
- browserToolDeps.touchSessionBrowserTab({
794
- sessionKey: opts?.agentSessionKey,
795
- targetId,
796
- baseUrl,
797
- profile,
798
- url
799
- });
800
- };
801
- switch (action) {
802
- case "doctor":
803
- if (proxyRequest) return jsonResult(await proxyRequest({
804
- method: "GET",
805
- path: "/doctor",
806
- profile
807
- }));
808
- return jsonResult(await browserToolDeps.browserDoctor(baseUrl, { profile }));
809
- case "status":
810
- if (proxyRequest) return jsonResult(await proxyRequest({
811
- method: "GET",
812
- path: "/",
813
- profile,
814
- timeoutMs: toolTimeoutMs
815
- }));
816
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
817
- profile,
818
- timeoutMs: toolTimeoutMs
819
- }));
820
- case "start":
821
- if (proxyRequest) {
822
- await proxyRequest({
823
- method: "POST",
824
- path: "/start",
825
- profile,
826
- timeoutMs: toolTimeoutMs
827
- });
828
- return jsonResult(await proxyRequest({
829
- method: "GET",
830
- path: "/",
831
- profile,
832
- timeoutMs: toolTimeoutMs
833
- }));
834
- }
835
- await browserToolDeps.browserStart(baseUrl, {
836
- profile,
837
- timeoutMs: toolTimeoutMs
838
- });
839
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
840
- profile,
841
- timeoutMs: toolTimeoutMs
842
- }));
843
- case "stop":
844
- if (proxyRequest) {
845
- await proxyRequest({
846
- method: "POST",
847
- path: "/stop",
848
- profile,
849
- timeoutMs: toolTimeoutMs
850
- });
851
- return jsonResult(await proxyRequest({
852
- method: "GET",
853
- path: "/",
854
- profile,
855
- timeoutMs: toolTimeoutMs
856
- }));
857
- }
858
- await browserToolDeps.browserStop(baseUrl, {
859
- profile,
860
- timeoutMs: toolTimeoutMs
861
- });
862
- return jsonResult(await browserToolDeps.browserStatus(baseUrl, {
863
- profile,
864
- timeoutMs: toolTimeoutMs
865
- }));
866
- case "profiles":
867
- if (proxyRequest) return jsonResult(await proxyRequest({
868
- method: "GET",
869
- path: "/profiles",
870
- timeoutMs: toolTimeoutMs
871
- }));
872
- return jsonResult({ profiles: await browserToolDeps.browserProfiles(baseUrl, { timeoutMs: toolTimeoutMs }) });
873
- case "tabs": return await executeTabsAction({
874
- baseUrl,
875
- profile,
876
- timeoutMs: toolTimeoutMs,
877
- proxyRequest
878
- });
879
- case "open": {
880
- const targetUrl = readTargetUrlParam(params);
881
- const label = normalizeOptionalString(params.label);
882
- if (proxyRequest) return jsonResult(await proxyRequest({
883
- method: "POST",
884
- path: "/tabs/open",
885
- profile,
886
- body: {
887
- url: targetUrl,
888
- ...label ? { label } : {}
889
- },
890
- timeoutMs: toolTimeoutMs
891
- }));
892
- const opened = await browserToolDeps.browserOpenTab(baseUrl, targetUrl, {
893
- profile,
894
- label,
895
- timeoutMs: toolTimeoutMs
896
- });
897
- browserToolDeps.trackSessionBrowserTab({
898
- sessionKey: opts?.agentSessionKey,
899
- targetId: opened.targetId,
900
- baseUrl,
901
- profile,
902
- url: readStringValue(opened.url) ?? targetUrl
903
- });
904
- return jsonResult(opened);
905
- }
906
- case "focus": {
907
- const targetId = readStringParam(params, "targetId", { required: true });
908
- if (proxyRequest) return jsonResult(await proxyRequest({
909
- method: "POST",
910
- path: "/tabs/focus",
911
- profile,
912
- body: { targetId },
913
- timeoutMs: toolTimeoutMs
914
- }));
915
- await browserToolDeps.browserFocusTab(baseUrl, targetId, {
916
- profile,
917
- timeoutMs: toolTimeoutMs
918
- });
919
- touchTrackedTab(targetId);
920
- return jsonResult({ ok: true });
921
- }
922
- case "close": {
923
- const targetId = readStringParam(params, "targetId");
924
- if (proxyRequest) return jsonResult(targetId ? await proxyRequest({
925
- method: "DELETE",
926
- path: `/tabs/${encodeURIComponent(targetId)}`,
927
- profile,
928
- timeoutMs: toolTimeoutMs
929
- }) : await proxyRequest({
930
- method: "POST",
931
- path: "/act",
932
- profile,
933
- body: { kind: "close" },
934
- timeoutMs: toolTimeoutMs
935
- }));
936
- if (targetId) {
937
- await browserToolDeps.browserCloseTab(baseUrl, targetId, {
938
- profile,
939
- timeoutMs: toolTimeoutMs
940
- });
941
- browserToolDeps.untrackSessionBrowserTab({
942
- sessionKey: opts?.agentSessionKey,
943
- targetId,
944
- baseUrl,
945
- profile
946
- });
947
- } else await browserToolDeps.browserAct(baseUrl, { kind: "close" }, {
948
- profile,
949
- timeoutMs: toolTimeoutMs
950
- });
951
- return jsonResult({ ok: true });
952
- }
953
- case "snapshot": return await executeSnapshotAction({
954
- input: params,
955
- baseUrl,
956
- profile,
957
- proxyRequest,
958
- onTabActivity: touchTrackedTab
959
- });
960
- case "screenshot": {
961
- const targetId = readStringParam(params, "targetId");
962
- const fullPage = Boolean(params.fullPage);
963
- const ref = readStringParam(params, "ref");
964
- const element = readStringParam(params, "element");
965
- const labels = typeof params.labels === "boolean" ? params.labels : void 0;
966
- const type = params.type === "jpeg" ? "jpeg" : "png";
967
- const effectiveTimeoutMs = (typeof params.timeoutMs === "number" && Number.isFinite(params.timeoutMs) ? Math.max(1, Math.floor(params.timeoutMs)) : void 0) ?? 2e4;
968
- const result = proxyRequest ? await proxyRequest({
969
- method: "POST",
970
- path: "/screenshot",
971
- profile,
972
- timeoutMs: effectiveTimeoutMs,
973
- body: {
974
- targetId,
975
- fullPage,
976
- ref,
977
- element,
978
- type,
979
- labels,
980
- timeoutMs: effectiveTimeoutMs
981
- }
982
- }) : await browserToolDeps.browserScreenshotAction(baseUrl, {
983
- targetId,
984
- fullPage,
985
- ref,
986
- element,
987
- type,
988
- labels,
989
- timeoutMs: effectiveTimeoutMs,
990
- profile
991
- });
992
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
993
- return await browserToolDeps.imageResultFromFile({
994
- label: "browser:screenshot",
995
- path: result.path,
996
- details: result
997
- });
998
- }
999
- case "navigate": {
1000
- const targetUrl = readTargetUrlParam(params);
1001
- const targetId = readStringParam(params, "targetId");
1002
- if (proxyRequest) return jsonResult(await proxyRequest({
1003
- method: "POST",
1004
- path: "/navigate",
1005
- profile,
1006
- body: {
1007
- url: targetUrl,
1008
- targetId
1009
- }
1010
- }));
1011
- const result = await browserToolDeps.browserNavigate(baseUrl, {
1012
- url: targetUrl,
1013
- targetId,
1014
- profile
1015
- });
1016
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url) ?? targetUrl);
1017
- return jsonResult(result);
1018
- }
1019
- case "console": return await executeConsoleAction({
1020
- input: params,
1021
- baseUrl,
1022
- profile,
1023
- proxyRequest
1024
- });
1025
- case "pdf": {
1026
- const targetId = normalizeOptionalString(params.targetId);
1027
- const result = proxyRequest ? await proxyRequest({
1028
- method: "POST",
1029
- path: "/pdf",
1030
- profile,
1031
- body: { targetId }
1032
- }) : await browserToolDeps.browserPdfSave(baseUrl, {
1033
- targetId,
1034
- profile
1035
- });
1036
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1037
- return {
1038
- content: [{
1039
- type: "text",
1040
- text: `FILE:${result.path}`
1041
- }],
1042
- details: result
1043
- };
1044
- }
1045
- case "upload": {
1046
- const paths = Array.isArray(params.paths) ? params.paths.map((p) => String(p)) : [];
1047
- if (paths.length === 0) throw new Error("paths required");
1048
- const uploadPathsResult = await resolveExistingPathsWithinRoot({
1049
- rootDir: DEFAULT_UPLOAD_DIR,
1050
- requestedPaths: paths,
1051
- scopeLabel: `uploads directory (${DEFAULT_UPLOAD_DIR})`
1052
- });
1053
- if (!uploadPathsResult.ok) throw new Error(uploadPathsResult.error);
1054
- const normalizedPaths = uploadPathsResult.paths;
1055
- const ref = readStringParam(params, "ref");
1056
- const inputRef = readStringParam(params, "inputRef");
1057
- const element = readStringParam(params, "element");
1058
- const { targetId, timeoutMs } = readOptionalTargetAndTimeout(params);
1059
- if (proxyRequest) return jsonResult(await proxyRequest({
1060
- method: "POST",
1061
- path: "/hooks/file-chooser",
1062
- profile,
1063
- body: {
1064
- paths: normalizedPaths,
1065
- ref,
1066
- inputRef,
1067
- element,
1068
- targetId,
1069
- timeoutMs
1070
- }
1071
- }));
1072
- const result = await browserToolDeps.browserArmFileChooser(baseUrl, {
1073
- paths: normalizedPaths,
1074
- ref,
1075
- inputRef,
1076
- element,
1077
- targetId,
1078
- timeoutMs,
1079
- profile
1080
- });
1081
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1082
- return jsonResult(result);
1083
- }
1084
- case "dialog": {
1085
- const accept = Boolean(params.accept);
1086
- const promptText = readStringValue(params.promptText);
1087
- const { targetId, timeoutMs } = readOptionalTargetAndTimeout(params);
1088
- if (proxyRequest) return jsonResult(await proxyRequest({
1089
- method: "POST",
1090
- path: "/hooks/dialog",
1091
- profile,
1092
- body: {
1093
- accept,
1094
- promptText,
1095
- targetId,
1096
- timeoutMs
1097
- }
1098
- }));
1099
- const result = await browserToolDeps.browserArmDialog(baseUrl, {
1100
- accept,
1101
- promptText,
1102
- targetId,
1103
- timeoutMs,
1104
- profile
1105
- });
1106
- touchTrackedTab(readStringValue(result.targetId) ?? targetId, readStringValue(result.url));
1107
- return jsonResult(result);
1108
- }
1109
- case "act": {
1110
- const request = readActRequestParam(params);
1111
- if (!request) throw new Error("request required");
1112
- return await executeActAction({
1113
- request,
1114
- baseUrl,
1115
- profile,
1116
- proxyRequest,
1117
- onTabActivity: touchTrackedTab
1118
- });
1119
- }
1120
- default: throw new Error(`Unknown action: ${action}`);
1121
- }
1122
- }
1123
- };
1124
- }
1125
- //#endregion
1126
- //#region extensions/browser/src/cli/browser-cli-shared.ts
1127
- function normalizeQuery(query) {
1128
- if (!query) return;
1129
- const out = {};
1130
- for (const [key, value] of Object.entries(query)) {
1131
- if (value === void 0) continue;
1132
- out[key] = String(value);
1133
- }
1134
- return Object.keys(out).length ? out : void 0;
1135
- }
1136
- async function callBrowserRequest(opts, params, extra) {
1137
- 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;
1138
- const resolvedTimeout = typeof resolvedTimeoutMs === "number" && Number.isFinite(resolvedTimeoutMs) ? resolvedTimeoutMs : void 0;
1139
- const timeout = typeof resolvedTimeout === "number" ? String(resolvedTimeout) : opts.timeout;
1140
- const payload = await callGatewayFromCli("browser.request", {
1141
- ...opts,
1142
- timeout
1143
- }, {
1144
- method: params.method,
1145
- path: params.path,
1146
- query: normalizeQuery(params.query),
1147
- body: params.body,
1148
- timeoutMs: resolvedTimeout
1149
- }, { progress: extra?.progress });
1150
- if (payload === void 0) throw new Error("Unexpected browser.request response");
1151
- return payload;
1152
- }
1153
- async function callBrowserResize(opts, params, extra) {
1154
- return callBrowserRequest(opts, {
1155
- method: "POST",
1156
- path: "/act",
1157
- query: params.profile ? { profile: params.profile } : void 0,
1158
- body: {
1159
- kind: "resize",
1160
- width: params.width,
1161
- height: params.height,
1162
- targetId: normalizeOptionalString(params.targetId)
1163
- }
1164
- }, extra);
1165
- }
1166
- //#endregion
1167
- //#region extensions/browser/src/cli/browser-cli-actions-input/shared.ts
1168
- function resolveBrowserActionContext(cmd, parentOpts) {
1169
- const parent = parentOpts(cmd);
1170
- return {
1171
- parent,
1172
- profile: parent?.browserProfile
1173
- };
1174
- }
1175
- async function callBrowserAct(params) {
1176
- return await callBrowserRequest(params.parent, {
1177
- method: "POST",
1178
- path: "/act",
1179
- query: params.profile ? { profile: params.profile } : void 0,
1180
- body: params.body
1181
- }, { timeoutMs: params.timeoutMs ?? 2e4 });
1182
- }
1183
- function logBrowserActionResult(parent, result, successMessage) {
1184
- if (parent?.json) {
1185
- defaultRuntime.writeJson(result);
1186
- return;
1187
- }
1188
- defaultRuntime.log(successMessage);
1189
- }
1190
- function requireRef(ref) {
1191
- const refValue = typeof ref === "string" ? ref.trim() : "";
1192
- if (!refValue) {
1193
- defaultRuntime.error(danger("ref is required"));
1194
- defaultRuntime.exit(1);
1195
- return null;
1196
- }
1197
- return refValue;
1198
- }
1199
- async function readFile$1(path) {
1200
- return await fs.readFile(path, "utf8");
1201
- }
1202
- async function readFields(opts) {
1203
- const payload = opts.fieldsFile ? await readFile$1(opts.fieldsFile) : opts.fields ?? "";
1204
- if (!payload.trim()) throw new Error("fields are required");
1205
- const parsed = JSON.parse(payload);
1206
- if (!Array.isArray(parsed)) throw new Error("fields must be an array");
1207
- return parsed.map((entry, index) => {
1208
- if (!entry || typeof entry !== "object") throw new Error(`fields[${index}] must be an object`);
1209
- const rec = entry;
1210
- const parsedField = normalizeBrowserFormField(rec);
1211
- if (!parsedField) throw new Error(`fields[${index}] must include ref`);
1212
- if (rec.value === void 0 || rec.value === null || normalizeBrowserFormFieldValue(rec.value) !== void 0) return parsedField;
1213
- throw new Error(`fields[${index}].value must be string, number, boolean, or null`);
1214
- });
1215
- }
1216
- //#endregion
1217
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.element.ts
1218
- function registerBrowserElementCommands(browser, parentOpts) {
1219
- const runElementAction = async (params) => {
1220
- const { parent, profile } = resolveBrowserActionContext(params.cmd, parentOpts);
1221
- try {
1222
- const result = await callBrowserAct({
1223
- parent,
1224
- profile,
1225
- body: params.body,
1226
- timeoutMs: params.timeoutMs
1227
- });
1228
- logBrowserActionResult(parent, result, typeof params.successMessage === "function" ? params.successMessage(result) : params.successMessage);
1229
- } catch (err) {
1230
- defaultRuntime.error(danger(String(err)));
1231
- defaultRuntime.exit(1);
1232
- }
1233
- };
1234
- 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) => {
1235
- const refValue = requireRef(ref);
1236
- if (!refValue) return;
1237
- const modifiers = opts.modifiers ? String(opts.modifiers).split(",").map((v) => v.trim()).filter(Boolean) : void 0;
1238
- await runElementAction({
1239
- cmd,
1240
- body: {
1241
- kind: "click",
1242
- ref: refValue,
1243
- targetId: normalizeOptionalString(opts.targetId),
1244
- doubleClick: Boolean(opts.double),
1245
- button: normalizeOptionalString(opts.button),
1246
- modifiers
1247
- },
1248
- successMessage: (result) => {
1249
- const url = result.url;
1250
- return `clicked ref ${refValue}${typeof url === "string" && url ? ` on ${url}` : ""}`;
1251
- }
1252
- });
1253
- });
1254
- 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) => {
1255
- const x = Number(xRaw);
1256
- const y = Number(yRaw);
1257
- await runElementAction({
1258
- cmd,
1259
- body: {
1260
- kind: "clickCoords",
1261
- x,
1262
- y,
1263
- targetId: normalizeOptionalString(opts.targetId),
1264
- doubleClick: Boolean(opts.double),
1265
- button: normalizeOptionalString(opts.button),
1266
- delayMs: Number.isFinite(opts.delayMs) ? opts.delayMs : void 0
1267
- },
1268
- successMessage: (result) => {
1269
- const url = result.url;
1270
- return `clicked ${x},${y}${typeof url === "string" && url ? ` on ${url}` : ""}`;
1271
- }
1272
- });
1273
- });
1274
- 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) => {
1275
- const refValue = requireRef(ref);
1276
- if (!refValue) return;
1277
- await runElementAction({
1278
- cmd,
1279
- body: {
1280
- kind: "type",
1281
- ref: refValue,
1282
- text,
1283
- submit: Boolean(opts.submit),
1284
- slowly: Boolean(opts.slowly),
1285
- targetId: normalizeOptionalString(opts.targetId)
1286
- },
1287
- successMessage: `typed into ref ${refValue}`
1288
- });
1289
- });
1290
- 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) => {
1291
- await runElementAction({
1292
- cmd,
1293
- body: {
1294
- kind: "press",
1295
- key,
1296
- targetId: normalizeOptionalString(opts.targetId)
1297
- },
1298
- successMessage: `pressed ${key}`
1299
- });
1300
- });
1301
- 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) => {
1302
- await runElementAction({
1303
- cmd,
1304
- body: {
1305
- kind: "hover",
1306
- ref,
1307
- targetId: normalizeOptionalString(opts.targetId)
1308
- },
1309
- successMessage: `hovered ref ${ref}`
1310
- });
1311
- });
1312
- 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) => {
1313
- const refValue = requireRef(ref);
1314
- if (!refValue) return;
1315
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1316
- await runElementAction({
1317
- cmd,
1318
- body: {
1319
- kind: "scrollIntoView",
1320
- ref: refValue,
1321
- targetId: normalizeOptionalString(opts.targetId),
1322
- timeoutMs
1323
- },
1324
- timeoutMs,
1325
- successMessage: `scrolled into view: ${refValue}`
1326
- });
1327
- });
1328
- 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) => {
1329
- await runElementAction({
1330
- cmd,
1331
- body: {
1332
- kind: "drag",
1333
- startRef,
1334
- endRef,
1335
- targetId: normalizeOptionalString(opts.targetId)
1336
- },
1337
- successMessage: `dragged ${startRef} → ${endRef}`
1338
- });
1339
- });
1340
- 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) => {
1341
- await runElementAction({
1342
- cmd,
1343
- body: {
1344
- kind: "select",
1345
- ref,
1346
- values,
1347
- targetId: normalizeOptionalString(opts.targetId)
1348
- },
1349
- successMessage: `selected ${values.join(", ")}`
1350
- });
1351
- });
1352
- }
1353
- //#endregion
1354
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.files-downloads.ts
1355
- async function normalizeUploadPaths(paths) {
1356
- const result = await resolveExistingPathsWithinRoot({
1357
- rootDir: DEFAULT_UPLOAD_DIR,
1358
- requestedPaths: paths,
1359
- scopeLabel: `uploads directory (${DEFAULT_UPLOAD_DIR})`
1360
- });
1361
- if (!result.ok) throw new Error(result.error);
1362
- return result.paths;
1363
- }
1364
- async function runBrowserPostAction(params) {
1365
- try {
1366
- const result = await callBrowserRequest(params.parent, {
1367
- method: "POST",
1368
- path: params.path,
1369
- query: params.profile ? { profile: params.profile } : void 0,
1370
- body: params.body
1371
- }, { timeoutMs: params.timeoutMs });
1372
- if (params.parent?.json) {
1373
- defaultRuntime.writeJson(result);
1374
- return;
1375
- }
1376
- defaultRuntime.log(params.describeSuccess(result));
1377
- } catch (err) {
1378
- defaultRuntime.error(danger(String(err)));
1379
- defaultRuntime.exit(1);
1380
- }
1381
- }
1382
- function registerBrowserFilesAndDownloadsCommands(browser, parentOpts) {
1383
- const resolveTimeoutAndTarget = (opts) => {
1384
- return {
1385
- timeoutMs: Number.isFinite(opts.timeoutMs) ? Number(opts.timeoutMs) : void 0,
1386
- targetId: normalizeOptionalString(opts.targetId)
1387
- };
1388
- };
1389
- const runDownloadCommand = async (cmd, opts, request) => {
1390
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1391
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1392
- await runBrowserPostAction({
1393
- parent,
1394
- profile,
1395
- path: request.path,
1396
- body: {
1397
- ...request.body,
1398
- targetId,
1399
- timeoutMs
1400
- },
1401
- timeoutMs: timeoutMs ?? 2e4,
1402
- describeSuccess: (result) => `downloaded: ${shortenHomePath(result.download.path)}`
1403
- });
1404
- };
1405
- 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) => {
1406
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1407
- const normalizedPaths = await normalizeUploadPaths(paths);
1408
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1409
- await runBrowserPostAction({
1410
- parent,
1411
- profile,
1412
- path: "/hooks/file-chooser",
1413
- body: {
1414
- paths: normalizedPaths,
1415
- ref: normalizeOptionalString(opts.ref),
1416
- inputRef: normalizeOptionalString(opts.inputRef),
1417
- element: normalizeOptionalString(opts.element),
1418
- targetId,
1419
- timeoutMs
1420
- },
1421
- timeoutMs: timeoutMs ?? 2e4,
1422
- describeSuccess: () => `upload armed for ${paths.length} file(s)`
1423
- });
1424
- });
1425
- 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) => {
1426
- await runDownloadCommand(cmd, opts, {
1427
- path: "/wait/download",
1428
- body: { path: normalizeOptionalString(outPath) }
1429
- });
1430
- });
1431
- 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) => {
1432
- await runDownloadCommand(cmd, opts, {
1433
- path: "/download",
1434
- body: {
1435
- ref,
1436
- path: outPath
1437
- }
1438
- });
1439
- });
1440
- 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) => {
1441
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1442
- const accept = opts.accept ? true : opts.dismiss ? false : void 0;
1443
- if (accept === void 0) {
1444
- defaultRuntime.error(danger("Specify --accept or --dismiss"));
1445
- defaultRuntime.exit(1);
1446
- return;
1447
- }
1448
- const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
1449
- await runBrowserPostAction({
1450
- parent,
1451
- profile,
1452
- path: "/hooks/dialog",
1453
- body: {
1454
- accept,
1455
- promptText: normalizeOptionalString(opts.prompt),
1456
- targetId,
1457
- timeoutMs
1458
- },
1459
- timeoutMs: timeoutMs ?? 2e4,
1460
- describeSuccess: () => "dialog armed"
1461
- });
1462
- });
1463
- }
1464
- //#endregion
1465
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.form-wait-eval.ts
1466
- function registerBrowserFormWaitEvalCommands(browser, parentOpts) {
1467
- 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) => {
1468
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1469
- try {
1470
- const fields = await readFields({
1471
- fields: opts.fields,
1472
- fieldsFile: opts.fieldsFile
1473
- });
1474
- logBrowserActionResult(parent, await callBrowserAct({
1475
- parent,
1476
- profile,
1477
- body: {
1478
- kind: "fill",
1479
- fields,
1480
- targetId: normalizeOptionalString(opts.targetId)
1481
- }
1482
- }), `filled ${fields.length} field(s)`);
1483
- } catch (err) {
1484
- defaultRuntime.error(danger(String(err)));
1485
- defaultRuntime.exit(1);
1486
- }
1487
- });
1488
- 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) => {
1489
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1490
- try {
1491
- const sel = normalizeOptionalString(selector);
1492
- const load = opts.load === "load" || opts.load === "domcontentloaded" || opts.load === "networkidle" ? opts.load : void 0;
1493
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1494
- logBrowserActionResult(parent, await callBrowserAct({
1495
- parent,
1496
- profile,
1497
- body: {
1498
- kind: "wait",
1499
- timeMs: Number.isFinite(opts.time) ? opts.time : void 0,
1500
- text: normalizeOptionalString(opts.text),
1501
- textGone: normalizeOptionalString(opts.textGone),
1502
- selector: sel,
1503
- url: normalizeOptionalString(opts.url),
1504
- loadState: load,
1505
- fn: normalizeOptionalString(opts.fn),
1506
- targetId: normalizeOptionalString(opts.targetId),
1507
- timeoutMs
1508
- },
1509
- timeoutMs
1510
- }), "wait complete");
1511
- } catch (err) {
1512
- defaultRuntime.error(danger(String(err)));
1513
- defaultRuntime.exit(1);
1514
- }
1515
- });
1516
- 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) => {
1517
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1518
- if (!opts.fn) {
1519
- defaultRuntime.error(danger("Missing --fn"));
1520
- defaultRuntime.exit(1);
1521
- return;
1522
- }
1523
- try {
1524
- const result = await callBrowserAct({
1525
- parent,
1526
- profile,
1527
- body: {
1528
- kind: "evaluate",
1529
- fn: opts.fn,
1530
- ref: normalizeOptionalString(opts.ref),
1531
- targetId: normalizeOptionalString(opts.targetId)
1532
- }
1533
- });
1534
- if (parent?.json) {
1535
- defaultRuntime.writeJson(result);
1536
- return;
1537
- }
1538
- defaultRuntime.writeJson(result.result ?? null);
1539
- } catch (err) {
1540
- defaultRuntime.error(danger(String(err)));
1541
- defaultRuntime.exit(1);
1542
- }
1543
- });
1544
- }
1545
- //#endregion
1546
- //#region extensions/browser/src/cli/browser-cli-resize.ts
1547
- async function runBrowserResizeWithOutput(params) {
1548
- const { width, height } = params;
1549
- if (!Number.isFinite(width) || !Number.isFinite(height)) {
1550
- defaultRuntime.error(danger("width and height must be numbers"));
1551
- defaultRuntime.exit(1);
1552
- return;
1553
- }
1554
- const result = await callBrowserResize(params.parent, {
1555
- profile: params.profile,
1556
- width,
1557
- height,
1558
- targetId: params.targetId
1559
- }, { timeoutMs: params.timeoutMs ?? 2e4 });
1560
- if (params.parent?.json) {
1561
- defaultRuntime.writeJson(result);
1562
- return;
1563
- }
1564
- defaultRuntime.log(params.successMessage);
1565
- }
1566
- //#endregion
1567
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.navigation.ts
1568
- function registerBrowserNavigationCommands(browser, parentOpts) {
1569
- 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) => {
1570
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1571
- try {
1572
- const result = await callBrowserRequest(parent, {
1573
- method: "POST",
1574
- path: "/navigate",
1575
- query: profile ? { profile } : void 0,
1576
- body: {
1577
- url,
1578
- targetId: normalizeOptionalString(opts.targetId)
1579
- }
1580
- }, { timeoutMs: 2e4 });
1581
- if (parent?.json) {
1582
- defaultRuntime.writeJson(result);
1583
- return;
1584
- }
1585
- defaultRuntime.log(`navigated to ${result.url ?? url}`);
1586
- } catch (err) {
1587
- defaultRuntime.error(danger(String(err)));
1588
- defaultRuntime.exit(1);
1589
- }
1590
- });
1591
- 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) => {
1592
- const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
1593
- try {
1594
- await runBrowserResizeWithOutput({
1595
- parent,
1596
- profile,
1597
- width,
1598
- height,
1599
- targetId: opts.targetId,
1600
- timeoutMs: 2e4,
1601
- successMessage: `resized to ${width}x${height}`
1602
- });
1603
- } catch (err) {
1604
- defaultRuntime.error(danger(String(err)));
1605
- defaultRuntime.exit(1);
1606
- }
1607
- });
1608
- }
1609
- //#endregion
1610
- //#region extensions/browser/src/cli/browser-cli-actions-input/register.ts
1611
- function registerBrowserActionInputCommands(browser, parentOpts) {
1612
- registerBrowserNavigationCommands(browser, parentOpts);
1613
- registerBrowserElementCommands(browser, parentOpts);
1614
- registerBrowserFilesAndDownloadsCommands(browser, parentOpts);
1615
- registerBrowserFormWaitEvalCommands(browser, parentOpts);
1616
- }
1617
- //#endregion
1618
- //#region extensions/browser/src/cli/browser-cli-actions-observe.ts
1619
- function runBrowserObserve(action) {
1620
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1621
- defaultRuntime.error(danger(String(err)));
1622
- defaultRuntime.exit(1);
1623
- });
1624
- }
1625
- function registerBrowserActionObserveCommands(browser, parentOpts) {
1626
- 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) => {
1627
- const parent = parentOpts(cmd);
1628
- const profile = parent?.browserProfile;
1629
- await runBrowserObserve(async () => {
1630
- const result = await callBrowserRequest(parent, {
1631
- method: "GET",
1632
- path: "/console",
1633
- query: {
1634
- level: normalizeOptionalString(opts.level),
1635
- targetId: normalizeOptionalString(opts.targetId),
1636
- profile
1637
- }
1638
- }, { timeoutMs: 2e4 });
1639
- if (parent?.json) {
1640
- defaultRuntime.writeJson(result);
1641
- return;
1642
- }
1643
- defaultRuntime.writeJson(result.messages);
1644
- });
1645
- });
1646
- browser.command("pdf").description("Save page as PDF").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
1647
- const parent = parentOpts(cmd);
1648
- const profile = parent?.browserProfile;
1649
- await runBrowserObserve(async () => {
1650
- const result = await callBrowserRequest(parent, {
1651
- method: "POST",
1652
- path: "/pdf",
1653
- query: profile ? { profile } : void 0,
1654
- body: { targetId: normalizeOptionalString(opts.targetId) }
1655
- }, { timeoutMs: 2e4 });
1656
- if (parent?.json) {
1657
- defaultRuntime.writeJson(result);
1658
- return;
1659
- }
1660
- defaultRuntime.log(`PDF: ${shortenHomePath(result.path)}`);
1661
- });
1662
- });
1663
- 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) => {
1664
- const parent = parentOpts(cmd);
1665
- const profile = parent?.browserProfile;
1666
- await runBrowserObserve(async () => {
1667
- const timeoutMs = Number.isFinite(opts.timeoutMs) ? opts.timeoutMs : void 0;
1668
- const maxChars = Number.isFinite(opts.maxChars) ? opts.maxChars : void 0;
1669
- const result = await callBrowserRequest(parent, {
1670
- method: "POST",
1671
- path: "/response/body",
1672
- query: profile ? { profile } : void 0,
1673
- body: {
1674
- url,
1675
- targetId: normalizeOptionalString(opts.targetId),
1676
- timeoutMs,
1677
- maxChars
1678
- }
1679
- }, { timeoutMs: timeoutMs ?? 2e4 });
1680
- if (parent?.json) {
1681
- defaultRuntime.writeJson(result);
1682
- return;
1683
- }
1684
- defaultRuntime.log(result.response.body);
1685
- });
1686
- });
1687
- }
1688
- //#endregion
1689
- //#region extensions/browser/src/cli/browser-cli-debug.ts
1690
- const BROWSER_DEBUG_TIMEOUT_MS = 2e4;
1691
- function runBrowserDebug(action) {
1692
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1693
- defaultRuntime.error(danger(String(err)));
1694
- defaultRuntime.exit(1);
1695
- });
1696
- }
1697
- async function withDebugContext(cmd, parentOpts, action) {
1698
- const parent = parentOpts(cmd);
1699
- await runBrowserDebug(() => action({
1700
- parent,
1701
- profile: parent.browserProfile
1702
- }));
1703
- }
1704
- function printJsonResult$1(parent, result) {
1705
- if (!parent.json) return false;
1706
- defaultRuntime.writeJson(result);
1707
- return true;
1708
- }
1709
- async function callDebugRequest(parent, params) {
1710
- return callBrowserRequest(parent, params, { timeoutMs: BROWSER_DEBUG_TIMEOUT_MS });
1711
- }
1712
- function resolveProfileQuery$1(profile) {
1713
- return profile ? { profile } : void 0;
1714
- }
1715
- function resolveDebugQuery(params) {
1716
- return {
1717
- targetId: normalizeOptionalString(params.targetId),
1718
- filter: normalizeOptionalString(params.filter),
1719
- clear: Boolean(params.clear),
1720
- profile: params.profile
1721
- };
1722
- }
1723
- function registerBrowserDebugCommands(browser, parentOpts) {
1724
- 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) => {
1725
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1726
- if (printJsonResult$1(parent, await callDebugRequest(parent, {
1727
- method: "POST",
1728
- path: "/highlight",
1729
- query: resolveProfileQuery$1(profile),
1730
- body: {
1731
- ref: ref.trim(),
1732
- targetId: normalizeOptionalString(opts.targetId)
1733
- }
1734
- }))) return;
1735
- defaultRuntime.log(`highlighted ${ref.trim()}`);
1736
- });
1737
- });
1738
- 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) => {
1739
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1740
- const result = await callDebugRequest(parent, {
1741
- method: "GET",
1742
- path: "/errors",
1743
- query: resolveDebugQuery({
1744
- targetId: opts.targetId,
1745
- clear: opts.clear,
1746
- profile
1747
- })
1748
- });
1749
- if (printJsonResult$1(parent, result)) return;
1750
- if (!result.errors.length) {
1751
- defaultRuntime.log("No page errors.");
1752
- return;
1753
- }
1754
- defaultRuntime.log(result.errors.map((e) => `${e.timestamp} ${e.name ? `${e.name}: ` : ""}${e.message}`).join("\n"));
1755
- });
1756
- });
1757
- 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) => {
1758
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1759
- const result = await callDebugRequest(parent, {
1760
- method: "GET",
1761
- path: "/requests",
1762
- query: resolveDebugQuery({
1763
- targetId: opts.targetId,
1764
- filter: opts.filter,
1765
- clear: opts.clear,
1766
- profile
1767
- })
1768
- });
1769
- if (printJsonResult$1(parent, result)) return;
1770
- if (!result.requests.length) {
1771
- defaultRuntime.log("No requests recorded.");
1772
- return;
1773
- }
1774
- defaultRuntime.log(result.requests.map((r) => {
1775
- const status = typeof r.status === "number" ? ` ${r.status}` : "";
1776
- const ok = r.ok === true ? " ok" : r.ok === false ? " fail" : "";
1777
- const fail = r.failureText ? ` (${r.failureText})` : "";
1778
- return `${r.timestamp} ${r.method}${status}${ok} ${r.url}${fail}`;
1779
- }).join("\n"));
1780
- });
1781
- });
1782
- const trace = browser.command("trace").description("Record a Playwright trace");
1783
- 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) => {
1784
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1785
- if (printJsonResult$1(parent, await callDebugRequest(parent, {
1786
- method: "POST",
1787
- path: "/trace/start",
1788
- query: resolveProfileQuery$1(profile),
1789
- body: {
1790
- targetId: normalizeOptionalString(opts.targetId),
1791
- screenshots: Boolean(opts.screenshots),
1792
- snapshots: Boolean(opts.snapshots),
1793
- sources: Boolean(opts.sources)
1794
- }
1795
- }))) return;
1796
- defaultRuntime.log("trace started");
1797
- });
1798
- });
1799
- 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) => {
1800
- await withDebugContext(cmd, parentOpts, async ({ parent, profile }) => {
1801
- const result = await callDebugRequest(parent, {
1802
- method: "POST",
1803
- path: "/trace/stop",
1804
- query: resolveProfileQuery$1(profile),
1805
- body: {
1806
- targetId: normalizeOptionalString(opts.targetId),
1807
- path: normalizeOptionalString(opts.out)
1808
- }
1809
- });
1810
- if (printJsonResult$1(parent, result)) return;
1811
- defaultRuntime.log(`TRACE:${shortenHomePath(result.path)}`);
1812
- });
1813
- });
1814
- }
1815
- //#endregion
1816
- //#region extensions/browser/src/cli/browser-cli-examples.ts
1817
- const browserCoreExamples = [
1818
- "genesis browser status",
1819
- "genesis browser start",
1820
- "genesis browser stop",
1821
- "genesis browser tabs",
1822
- "genesis browser open https://example.com",
1823
- "genesis browser focus abcd1234",
1824
- "genesis browser close abcd1234",
1825
- "genesis browser screenshot",
1826
- "genesis browser screenshot --full-page",
1827
- "genesis browser screenshot --ref 12",
1828
- "genesis browser snapshot",
1829
- "genesis browser snapshot --format aria --limit 200",
1830
- "genesis browser snapshot --efficient",
1831
- "genesis browser snapshot --labels"
1832
- ];
1833
- const browserActionExamples = [
1834
- "genesis browser navigate https://example.com",
1835
- "genesis browser resize 1280 720",
1836
- "genesis browser click 12 --double",
1837
- "genesis browser click-coords 120 340",
1838
- "genesis browser type 23 \"hello\" --submit",
1839
- "genesis browser press Enter",
1840
- "genesis browser hover 44",
1841
- "genesis browser drag 10 11",
1842
- "genesis browser select 9 OptionA OptionB",
1843
- "genesis browser upload /tmp/genesis/uploads/file.pdf",
1844
- "genesis browser fill --fields '[{\"ref\":\"1\",\"value\":\"Ada\"}]'",
1845
- "genesis browser dialog --accept",
1846
- "genesis browser wait --text \"Done\"",
1847
- "genesis browser evaluate --fn '(el) => el.textContent' --ref 7",
1848
- "genesis browser console --level error",
1849
- "genesis browser pdf"
1850
- ];
1851
- //#endregion
1852
- //#region extensions/browser/src/cli/browser-cli-inspect.ts
1853
- function registerBrowserInspectCommands(browser, parentOpts) {
1854
- 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) => {
1855
- const parent = parentOpts(cmd);
1856
- const profile = parent?.browserProfile;
1857
- try {
1858
- const result = await callBrowserRequest(parent, {
1859
- method: "POST",
1860
- path: "/screenshot",
1861
- query: profile ? { profile } : void 0,
1862
- body: {
1863
- targetId: normalizeOptionalString(targetId),
1864
- fullPage: Boolean(opts.fullPage),
1865
- ref: normalizeOptionalString(opts.ref),
1866
- element: normalizeOptionalString(opts.element),
1867
- labels: Boolean(opts.labels),
1868
- type: opts.type === "jpeg" ? "jpeg" : "png"
1869
- }
1870
- }, { timeoutMs: 2e4 });
1871
- if (parent?.json) {
1872
- defaultRuntime.writeJson(result);
1873
- return;
1874
- }
1875
- defaultRuntime.log(`MEDIA:${shortenHomePath(result.path)}`);
1876
- } catch (err) {
1877
- defaultRuntime.error(danger(String(err)));
1878
- defaultRuntime.exit(1);
1879
- }
1880
- });
1881
- 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) => {
1882
- const parent = parentOpts(cmd);
1883
- const profile = parent?.browserProfile;
1884
- const format = opts.format === "aria" ? "aria" : "ai";
1885
- const configMode = !(typeof cmd.getOptionValueSource === "function" && cmd.getOptionValueSource("format") === "cli") && format === "ai" && loadConfig().browser?.snapshotDefaults?.mode === "efficient" ? "efficient" : void 0;
1886
- const mode = opts.efficient === true || opts.mode === "efficient" ? "efficient" : configMode;
1887
- try {
1888
- const result = await callBrowserRequest(parent, {
1889
- method: "GET",
1890
- path: "/snapshot",
1891
- query: {
1892
- format,
1893
- targetId: normalizeOptionalString(opts.targetId),
1894
- limit: Number.isFinite(opts.limit) ? opts.limit : void 0,
1895
- interactive: opts.interactive ? true : void 0,
1896
- compact: opts.compact ? true : void 0,
1897
- depth: Number.isFinite(opts.depth) ? opts.depth : void 0,
1898
- selector: normalizeOptionalString(opts.selector),
1899
- frame: normalizeOptionalString(opts.frame),
1900
- labels: opts.labels ? true : void 0,
1901
- urls: opts.urls ? true : void 0,
1902
- mode,
1903
- profile
1904
- }
1905
- }, { timeoutMs: 2e4 });
1906
- if (opts.out) {
1907
- if (result.format === "ai") await fs.writeFile(opts.out, result.snapshot, "utf8");
1908
- else {
1909
- const payload = JSON.stringify(result, null, 2);
1910
- await fs.writeFile(opts.out, payload, "utf8");
1911
- }
1912
- if (parent?.json) defaultRuntime.writeJson({
1913
- ok: true,
1914
- out: opts.out,
1915
- ...result.format === "ai" && result.imagePath ? { imagePath: result.imagePath } : {}
1916
- });
1917
- else {
1918
- defaultRuntime.log(shortenHomePath(opts.out));
1919
- if (result.format === "ai" && result.imagePath) defaultRuntime.log(`MEDIA:${shortenHomePath(result.imagePath)}`);
1920
- }
1921
- return;
1922
- }
1923
- if (parent?.json) {
1924
- defaultRuntime.writeJson(result);
1925
- return;
1926
- }
1927
- if (result.format === "ai") {
1928
- defaultRuntime.log(result.snapshot);
1929
- if (result.imagePath) defaultRuntime.log(`MEDIA:${shortenHomePath(result.imagePath)}`);
1930
- return;
1931
- }
1932
- const nodes = "nodes" in result ? result.nodes : [];
1933
- defaultRuntime.log(nodes.map((n) => {
1934
- const indent = " ".repeat(Math.min(20, n.depth));
1935
- const name = n.name ? ` "${n.name}"` : "";
1936
- const value = n.value ? ` = "${n.value}"` : "";
1937
- return `${indent}- ${n.role}${name}${value}`;
1938
- }).join("\n"));
1939
- } catch (err) {
1940
- defaultRuntime.error(danger(String(err)));
1941
- defaultRuntime.exit(1);
1942
- }
1943
- });
1944
- }
1945
- //#endregion
1946
- //#region extensions/browser/src/cli/browser-cli-manage.ts
1947
- const BROWSER_MANAGE_REQUEST_TIMEOUT_MS = 45e3;
1948
- function resolveProfileQuery(profile) {
1949
- return profile ? { profile } : void 0;
1950
- }
1951
- function printJsonResult(parent, payload) {
1952
- if (!parent?.json) return false;
1953
- defaultRuntime.writeJson(payload);
1954
- return true;
1955
- }
1956
- async function callTabAction(parent, profile, body) {
1957
- return callBrowserRequest(parent, {
1958
- method: "POST",
1959
- path: "/tabs/action",
1960
- query: resolveProfileQuery(profile),
1961
- body
1962
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
1963
- }
1964
- async function fetchBrowserStatus(parent, profile) {
1965
- return await callBrowserRequest(parent, {
1966
- method: "GET",
1967
- path: "/",
1968
- query: resolveProfileQuery(profile)
1969
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
1970
- }
1971
- async function runBrowserToggle(parent, params) {
1972
- await callBrowserRequest(parent, {
1973
- method: "POST",
1974
- path: params.path,
1975
- query: resolveProfileQuery(params.profile)
1976
- });
1977
- const status = await fetchBrowserStatus(parent, params.profile);
1978
- if (printJsonResult(parent, status)) return;
1979
- const name = status.profile ?? "genesis";
1980
- defaultRuntime.log(info(`🦞 browser [${name}] running: ${status.running}`));
1981
- }
1982
- function runBrowserCommand$1(action) {
1983
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
1984
- defaultRuntime.error(danger(String(err)));
1985
- defaultRuntime.exit(1);
1986
- });
1987
- }
1988
- function logBrowserTabs(tabs, json) {
1989
- if (json) {
1990
- defaultRuntime.writeJson({ tabs });
1991
- return;
1992
- }
1993
- if (tabs.length === 0) {
1994
- defaultRuntime.log("No tabs (browser closed or no targets).");
1995
- return;
1996
- }
1997
- defaultRuntime.log(tabs.map((t, i) => {
1998
- const alias = [t.tabId, t.label ? `label:${t.label}` : void 0].filter(Boolean).join(" ");
1999
- return `${i + 1}. ${t.title || "(untitled)"}${alias ? ` [${alias}]` : ""}\n ${t.url}\n id: ${t.targetId}`;
2000
- }).join("\n"));
2001
- }
2002
- function formatDoctorLine(check) {
2003
- return `${check.ok ? "OK" : "FAIL"} ${check.name}${check.detail ? `: ${check.detail}` : ""}`;
2004
- }
2005
- async function runBrowserDoctor(parent, profile) {
2006
- const checks = [];
2007
- let status = null;
2008
- try {
2009
- status = await fetchBrowserStatus(parent, profile);
2010
- checks.push({
2011
- name: "gateway",
2012
- ok: true,
2013
- detail: "browser control endpoint reachable"
2014
- });
2015
- } catch (err) {
2016
- checks.push({
2017
- name: "gateway",
2018
- ok: false,
2019
- detail: String(err)
2020
- });
2021
- return {
2022
- ok: false,
2023
- checks
2024
- };
2025
- }
2026
- checks.push({
2027
- name: "plugin",
2028
- ok: status.enabled,
2029
- detail: status.enabled ? "enabled" : "disabled in config"
2030
- });
2031
- checks.push({
2032
- name: "profile",
2033
- ok: true,
2034
- detail: `${status.profile ?? "genesis"} (${usesChromeMcpTransport(status) ? "chrome-mcp" : status.transport ?? "cdp"})`
2035
- });
2036
- checks.push({
2037
- name: "browser",
2038
- ok: status.running,
2039
- detail: status.running ? `running${status.cdpReady === false ? ", CDP not ready" : ""}` : "not running; run `genesis browser start`"
2040
- });
2041
- try {
2042
- const profiles = await callBrowserRequest(parent, {
2043
- method: "GET",
2044
- path: "/profiles"
2045
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2046
- checks.push({
2047
- name: "profiles",
2048
- ok: true,
2049
- detail: `${profiles.profiles?.length ?? 0} configured`
2050
- });
2051
- } catch (err) {
2052
- checks.push({
2053
- name: "profiles",
2054
- ok: false,
2055
- detail: String(err)
2056
- });
2057
- }
2058
- if (status.running) try {
2059
- const tabs = (await callBrowserRequest(parent, {
2060
- method: "GET",
2061
- path: "/tabs",
2062
- query: resolveProfileQuery(profile)
2063
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [];
2064
- checks.push({
2065
- name: "tabs",
2066
- ok: true,
2067
- detail: `${tabs.length} visible${tabs.length > 0 && tabs[0]?.suggestedTargetId ? `, use target ${tabs[0].suggestedTargetId}` : ""}`
2068
- });
2069
- } catch (err) {
2070
- checks.push({
2071
- name: "tabs",
2072
- ok: false,
2073
- detail: String(err)
2074
- });
2075
- }
2076
- return {
2077
- ok: checks.every((check) => check.ok),
2078
- checks,
2079
- status
2080
- };
2081
- }
2082
- function usesChromeMcpTransport(params) {
2083
- return params.transport === "chrome-mcp" || params.driver === "existing-session";
2084
- }
2085
- function formatBrowserConnectionSummary(params) {
2086
- if (usesChromeMcpTransport(params)) {
2087
- const userDataDir = params.userDataDir ? shortenHomePath(params.userDataDir) : null;
2088
- return userDataDir ? `transport: chrome-mcp, userDataDir: ${userDataDir}` : "transport: chrome-mcp";
2089
- }
2090
- if (params.isRemote) return `cdpUrl: ${params.cdpUrl ?? "(unset)"}`;
2091
- return `port: ${params.cdpPort ?? "(unset)"}`;
2092
- }
2093
- function registerBrowserManageCommands(browser, parentOpts) {
2094
- browser.command("status").description("Show browser status").action(async (_opts, cmd) => {
2095
- const parent = parentOpts(cmd);
2096
- await runBrowserCommand$1(async () => {
2097
- const status = await fetchBrowserStatus(parent, parent?.browserProfile);
2098
- if (printJsonResult(parent, status)) return;
2099
- const detectedPath = status.detectedExecutablePath ?? status.executablePath;
2100
- const detectedDisplay = detectedPath ? shortenHomePath(detectedPath) : "auto";
2101
- defaultRuntime.log([
2102
- `profile: ${status.profile ?? "genesis"}`,
2103
- `enabled: ${status.enabled}`,
2104
- `running: ${status.running}`,
2105
- `transport: ${usesChromeMcpTransport(status) ? "chrome-mcp" : status.transport ?? "cdp"}`,
2106
- ...!usesChromeMcpTransport(status) ? [`cdpPort: ${status.cdpPort ?? "(unset)"}`, `cdpUrl: ${redactCdpUrl(status.cdpUrl ?? `http://127.0.0.1:${status.cdpPort}`)}`] : status.userDataDir ? [`userDataDir: ${shortenHomePath(status.userDataDir)}`] : [],
2107
- `browser: ${status.chosenBrowser ?? "unknown"}`,
2108
- `detectedBrowser: ${status.detectedBrowser ?? "unknown"}`,
2109
- `detectedPath: ${detectedDisplay}`,
2110
- `profileColor: ${status.color}`,
2111
- ...status.tor ? [`tor: ${status.tor.mode}/${status.tor.routeMode} ${status.tor.socksHost}:${status.tor.socksPort}${status.tor.running === true ? " (running)" : ""}`] : [],
2112
- ...status.detectError ? [`detectError: ${status.detectError}`] : []
2113
- ].join("\n"));
2114
- });
2115
- });
2116
- browser.command("doctor").description("Check browser plugin readiness").action(async (_opts, cmd) => {
2117
- const parent = parentOpts(cmd);
2118
- const profile = parent?.browserProfile;
2119
- await runBrowserCommand$1(async () => {
2120
- const result = await runBrowserDoctor(parent, profile);
2121
- if (printJsonResult(parent, result)) return;
2122
- defaultRuntime.log(result.checks.map(formatDoctorLine).join("\n"));
2123
- if (!result.ok) defaultRuntime.exit(1);
2124
- });
2125
- });
2126
- browser.command("start").description("Start the browser (no-op if already running)").action(async (_opts, cmd) => {
2127
- const parent = parentOpts(cmd);
2128
- const profile = parent?.browserProfile;
2129
- await runBrowserCommand$1(async () => {
2130
- await runBrowserToggle(parent, {
2131
- profile,
2132
- path: "/start"
2133
- });
2134
- });
2135
- });
2136
- browser.command("stop").description("Stop the browser (best-effort)").action(async (_opts, cmd) => {
2137
- const parent = parentOpts(cmd);
2138
- const profile = parent?.browserProfile;
2139
- await runBrowserCommand$1(async () => {
2140
- await runBrowserToggle(parent, {
2141
- profile,
2142
- path: "/stop"
2143
- });
2144
- });
2145
- });
2146
- browser.command("reset-profile").description("Reset browser profile (moves it to Trash)").action(async (_opts, cmd) => {
2147
- const parent = parentOpts(cmd);
2148
- const profile = parent?.browserProfile;
2149
- await runBrowserCommand$1(async () => {
2150
- const result = await callBrowserRequest(parent, {
2151
- method: "POST",
2152
- path: "/reset-profile",
2153
- query: resolveProfileQuery(profile)
2154
- }, { timeoutMs: 2e4 });
2155
- if (printJsonResult(parent, result)) return;
2156
- if (!result.moved) {
2157
- defaultRuntime.log(info(`🦞 browser profile already missing.`));
2158
- return;
2159
- }
2160
- const dest = result.to ?? result.from;
2161
- defaultRuntime.log(info(`🦞 browser profile moved to Trash (${dest})`));
2162
- });
2163
- });
2164
- browser.command("tabs").description("List open tabs").action(async (_opts, cmd) => {
2165
- const parent = parentOpts(cmd);
2166
- const profile = parent?.browserProfile;
2167
- await runBrowserCommand$1(async () => {
2168
- logBrowserTabs((await callBrowserRequest(parent, {
2169
- method: "GET",
2170
- path: "/tabs",
2171
- query: resolveProfileQuery(profile)
2172
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [], parent?.json);
2173
- });
2174
- });
2175
- const tab = browser.command("tab").description("Tab shortcuts (index-based)").action(async (_opts, cmd) => {
2176
- const parent = parentOpts(cmd);
2177
- const profile = parent?.browserProfile;
2178
- await runBrowserCommand$1(async () => {
2179
- logBrowserTabs((await callBrowserRequest(parent, {
2180
- method: "POST",
2181
- path: "/tabs/action",
2182
- query: resolveProfileQuery(profile),
2183
- body: { action: "list" }
2184
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).tabs ?? [], parent?.json);
2185
- });
2186
- });
2187
- tab.command("new").description("Open a new tab (about:blank)").option("--label <label>", "Assign a friendly tab label").action(async (opts, cmd) => {
2188
- const parent = parentOpts(cmd);
2189
- const profile = parent?.browserProfile;
2190
- await runBrowserCommand$1(async () => {
2191
- const result = await callTabAction(parent, profile, {
2192
- action: "new",
2193
- label: opts.label
2194
- });
2195
- if (printJsonResult(parent, result)) return;
2196
- const opened = result.tab;
2197
- defaultRuntime.log(opened?.tabId ? `opened new tab ${opened.tabId}${opened.label ? ` (${opened.label})` : ""}` : "opened new tab");
2198
- });
2199
- });
2200
- 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) => {
2201
- const parent = parentOpts(cmd);
2202
- const profile = parent?.browserProfile;
2203
- await runBrowserCommand$1(async () => {
2204
- const result = await callTabAction(parent, profile, {
2205
- action: "label",
2206
- targetId,
2207
- label
2208
- });
2209
- if (printJsonResult(parent, result)) return;
2210
- const tab = result.tab;
2211
- defaultRuntime.log(`labeled tab ${tab?.tabId ?? targetId} as ${tab?.label ?? label}`);
2212
- });
2213
- });
2214
- tab.command("select").description("Focus tab by index (1-based)").argument("<index>", "Tab index (1-based)", (v) => Number(v)).action(async (index, _opts, cmd) => {
2215
- const parent = parentOpts(cmd);
2216
- const profile = parent?.browserProfile;
2217
- if (!Number.isFinite(index) || index < 1) {
2218
- defaultRuntime.error(danger("index must be a positive number"));
2219
- defaultRuntime.exit(1);
2220
- return;
2221
- }
2222
- await runBrowserCommand$1(async () => {
2223
- if (printJsonResult(parent, await callTabAction(parent, profile, {
2224
- action: "select",
2225
- index: Math.floor(index) - 1
2226
- }))) return;
2227
- defaultRuntime.log(`selected tab ${Math.floor(index)}`);
2228
- });
2229
- });
2230
- 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) => {
2231
- const parent = parentOpts(cmd);
2232
- const profile = parent?.browserProfile;
2233
- const idx = typeof index === "number" && Number.isFinite(index) ? Math.floor(index) - 1 : void 0;
2234
- if (typeof idx === "number" && idx < 0) {
2235
- defaultRuntime.error(danger("index must be >= 1"));
2236
- defaultRuntime.exit(1);
2237
- return;
2238
- }
2239
- await runBrowserCommand$1(async () => {
2240
- if (printJsonResult(parent, await callTabAction(parent, profile, {
2241
- action: "close",
2242
- index: idx
2243
- }))) return;
2244
- defaultRuntime.log("closed tab");
2245
- });
2246
- });
2247
- 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) => {
2248
- const parent = parentOpts(cmd);
2249
- const profile = parent?.browserProfile;
2250
- await runBrowserCommand$1(async () => {
2251
- const tab = await callBrowserRequest(parent, {
2252
- method: "POST",
2253
- path: "/tabs/open",
2254
- query: resolveProfileQuery(profile),
2255
- body: {
2256
- url,
2257
- ...opts.label ? { label: opts.label } : {}
2258
- }
2259
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2260
- if (printJsonResult(parent, tab)) return;
2261
- defaultRuntime.log(`opened: ${tab.url}\n${tab.tabId ? `tab: ${tab.tabId}\n` : ""}${tab.label ? `label: ${tab.label}\n` : ""}id: ${tab.targetId}`);
2262
- });
2263
- });
2264
- 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) => {
2265
- const parent = parentOpts(cmd);
2266
- const profile = parent?.browserProfile;
2267
- await runBrowserCommand$1(async () => {
2268
- await callBrowserRequest(parent, {
2269
- method: "POST",
2270
- path: "/tabs/focus",
2271
- query: resolveProfileQuery(profile),
2272
- body: { targetId }
2273
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2274
- if (printJsonResult(parent, { ok: true })) return;
2275
- defaultRuntime.log(`focused tab ${targetId}`);
2276
- });
2277
- });
2278
- 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) => {
2279
- const parent = parentOpts(cmd);
2280
- const profile = parent?.browserProfile;
2281
- await runBrowserCommand$1(async () => {
2282
- if (targetId?.trim()) await callBrowserRequest(parent, {
2283
- method: "DELETE",
2284
- path: `/tabs/${encodeURIComponent(targetId.trim())}`,
2285
- query: resolveProfileQuery(profile)
2286
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2287
- else await callBrowserRequest(parent, {
2288
- method: "POST",
2289
- path: "/act",
2290
- query: resolveProfileQuery(profile),
2291
- body: { kind: "close" }
2292
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS });
2293
- if (printJsonResult(parent, { ok: true })) return;
2294
- defaultRuntime.log("closed tab");
2295
- });
2296
- });
2297
- browser.command("profiles").description("List all browser profiles").action(async (_opts, cmd) => {
2298
- const parent = parentOpts(cmd);
2299
- await runBrowserCommand$1(async () => {
2300
- const profiles = (await callBrowserRequest(parent, {
2301
- method: "GET",
2302
- path: "/profiles"
2303
- }, { timeoutMs: BROWSER_MANAGE_REQUEST_TIMEOUT_MS })).profiles ?? [];
2304
- if (printJsonResult(parent, { profiles })) return;
2305
- if (profiles.length === 0) {
2306
- defaultRuntime.log("No profiles configured.");
2307
- return;
2308
- }
2309
- defaultRuntime.log(profiles.map((p) => {
2310
- const status = p.running ? "running" : "stopped";
2311
- const tabs = p.running ? ` (${p.tabCount} tabs)` : "";
2312
- const def = p.isDefault ? " [default]" : "";
2313
- const loc = formatBrowserConnectionSummary(p);
2314
- const remote = p.isRemote ? " [remote]" : "";
2315
- const driver = p.driver !== "genesis" ? ` [${p.driver}]` : "";
2316
- const tor = p.tor ? `\n tor: ${p.tor.mode}/${p.tor.routeMode} ${p.tor.socksHost}:${p.tor.socksPort}${p.tor.running === true ? " (running)" : ""}` : "";
2317
- return `${p.name}: ${status}${tabs}${def}${remote}${driver}\n ${loc}, color: ${p.color}${tor}`;
2318
- }).join("\n"));
2319
- });
2320
- });
2321
- 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) => {
2322
- const parent = parentOpts(cmd);
2323
- await runBrowserCommand$1(async () => {
2324
- const result = await callBrowserRequest(parent, {
2325
- method: "POST",
2326
- path: "/profiles/create",
2327
- body: {
2328
- name: opts.name,
2329
- color: opts.color,
2330
- cdpUrl: opts.cdpUrl,
2331
- userDataDir: opts.userDataDir,
2332
- tor: opts.tor === true,
2333
- driver: opts.driver === "existing-session" ? "existing-session" : void 0
2334
- }
2335
- }, { timeoutMs: 1e4 });
2336
- if (printJsonResult(parent, result)) return;
2337
- const loc = ` ${formatBrowserConnectionSummary(result)}`;
2338
- 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" : ""}`));
2339
- });
2340
- });
2341
- browser.command("delete-profile").description("Delete a browser profile").requiredOption("--name <name>", "Profile name to delete").action(async (opts, cmd) => {
2342
- const parent = parentOpts(cmd);
2343
- await runBrowserCommand$1(async () => {
2344
- const result = await callBrowserRequest(parent, {
2345
- method: "DELETE",
2346
- path: `/profiles/${encodeURIComponent(opts.name)}`
2347
- }, { timeoutMs: 2e4 });
2348
- if (printJsonResult(parent, result)) return;
2349
- const msg = result.deleted ? `🦞 Deleted profile "${result.profile}" (user data removed)` : `🦞 Deleted profile "${result.profile}" (no user data found)`;
2350
- defaultRuntime.log(info(msg));
2351
- });
2352
- });
2353
- }
2354
- //#endregion
2355
- //#region extensions/browser/src/cli/browser-cli-state.cookies-storage.ts
2356
- function resolveUrl(opts, command) {
2357
- return normalizeOptionalString(opts.url) ?? normalizeOptionalString(inheritOptionFromParent(command, "url"));
2358
- }
2359
- function resolveTargetId(rawTargetId, command) {
2360
- return normalizeOptionalString(rawTargetId) ?? normalizeOptionalString(inheritOptionFromParent(command, "targetId"));
2361
- }
2362
- async function runMutationRequest(params) {
2363
- try {
2364
- const result = await callBrowserRequest(params.parent, params.request, { timeoutMs: 2e4 });
2365
- if (params.parent?.json) {
2366
- defaultRuntime.writeJson(result);
2367
- return;
2368
- }
2369
- defaultRuntime.log(params.successMessage);
2370
- } catch (err) {
2371
- defaultRuntime.error(danger(String(err)));
2372
- defaultRuntime.exit(1);
2373
- }
2374
- }
2375
- function registerBrowserCookiesAndStorageCommands(browser, parentOpts) {
2376
- const cookies = browser.command("cookies").description("Read/write cookies");
2377
- cookies.option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
2378
- const parent = parentOpts(cmd);
2379
- const profile = parent?.browserProfile;
2380
- const targetId = resolveTargetId(opts.targetId, cmd);
2381
- try {
2382
- const result = await callBrowserRequest(parent, {
2383
- method: "GET",
2384
- path: "/cookies",
2385
- query: {
2386
- targetId,
2387
- profile
2388
- }
2389
- }, { timeoutMs: 2e4 });
2390
- if (parent?.json) {
2391
- defaultRuntime.writeJson(result);
2392
- return;
2393
- }
2394
- defaultRuntime.writeJson(result.cookies ?? []);
2395
- } catch (err) {
2396
- defaultRuntime.error(danger(String(err)));
2397
- defaultRuntime.exit(1);
2398
- }
2399
- });
2400
- 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) => {
2401
- const parent = parentOpts(cmd);
2402
- const profile = parent?.browserProfile;
2403
- const targetId = resolveTargetId(opts.targetId, cmd);
2404
- const url = resolveUrl(opts, cmd);
2405
- if (!url) {
2406
- defaultRuntime.error(danger("Missing required --url option for cookies set"));
2407
- defaultRuntime.exit(1);
2408
- return;
2409
- }
2410
- await runMutationRequest({
2411
- parent,
2412
- request: {
2413
- method: "POST",
2414
- path: "/cookies/set",
2415
- query: profile ? { profile } : void 0,
2416
- body: {
2417
- targetId,
2418
- cookie: {
2419
- name,
2420
- value,
2421
- url
2422
- }
2423
- }
2424
- },
2425
- successMessage: `cookie set: ${name}`
2426
- });
2427
- });
2428
- cookies.command("clear").description("Clear all cookies").option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd) => {
2429
- const parent = parentOpts(cmd);
2430
- const profile = parent?.browserProfile;
2431
- const targetId = resolveTargetId(opts.targetId, cmd);
2432
- await runMutationRequest({
2433
- parent,
2434
- request: {
2435
- method: "POST",
2436
- path: "/cookies/clear",
2437
- query: profile ? { profile } : void 0,
2438
- body: { targetId }
2439
- },
2440
- successMessage: "cookies cleared"
2441
- });
2442
- });
2443
- const storage = browser.command("storage").description("Read/write localStorage/sessionStorage");
2444
- function registerStorageKind(kind) {
2445
- const cmd = storage.command(kind).description(`${kind}Storage commands`);
2446
- 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) => {
2447
- const parent = parentOpts(cmd2);
2448
- const profile = parent?.browserProfile;
2449
- const targetId = resolveTargetId(opts.targetId, cmd2);
2450
- try {
2451
- const result = await callBrowserRequest(parent, {
2452
- method: "GET",
2453
- path: `/storage/${kind}`,
2454
- query: {
2455
- key: normalizeOptionalString(key),
2456
- targetId,
2457
- profile
2458
- }
2459
- }, { timeoutMs: 2e4 });
2460
- if (parent?.json) {
2461
- defaultRuntime.writeJson(result);
2462
- return;
2463
- }
2464
- defaultRuntime.writeJson(result.values ?? {});
2465
- } catch (err) {
2466
- defaultRuntime.error(danger(String(err)));
2467
- defaultRuntime.exit(1);
2468
- }
2469
- });
2470
- 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) => {
2471
- const parent = parentOpts(cmd2);
2472
- const profile = parent?.browserProfile;
2473
- const targetId = resolveTargetId(opts.targetId, cmd2);
2474
- await runMutationRequest({
2475
- parent,
2476
- request: {
2477
- method: "POST",
2478
- path: `/storage/${kind}/set`,
2479
- query: profile ? { profile } : void 0,
2480
- body: {
2481
- key,
2482
- value,
2483
- targetId
2484
- }
2485
- },
2486
- successMessage: `${kind}Storage set: ${key}`
2487
- });
2488
- });
2489
- cmd.command("clear").description(`Clear all ${kind}Storage keys`).option("--target-id <id>", "CDP target id (or unique prefix)").action(async (opts, cmd2) => {
2490
- const parent = parentOpts(cmd2);
2491
- const profile = parent?.browserProfile;
2492
- const targetId = resolveTargetId(opts.targetId, cmd2);
2493
- await runMutationRequest({
2494
- parent,
2495
- request: {
2496
- method: "POST",
2497
- path: `/storage/${kind}/clear`,
2498
- query: profile ? { profile } : void 0,
2499
- body: { targetId }
2500
- },
2501
- successMessage: `${kind}Storage cleared`
2502
- });
2503
- });
2504
- }
2505
- registerStorageKind("local");
2506
- registerStorageKind("session");
2507
- }
2508
- //#endregion
2509
- //#region extensions/browser/src/cli/browser-cli-state.ts
2510
- function parseOnOff(raw) {
2511
- const parsed = parseBooleanValue(raw);
2512
- return parsed === void 0 ? null : parsed;
2513
- }
2514
- function runBrowserCommand(action) {
2515
- return runCommandWithRuntime(defaultRuntime, action, (err) => {
2516
- defaultRuntime.error(danger(String(err)));
2517
- defaultRuntime.exit(1);
2518
- });
2519
- }
2520
- async function runBrowserSetRequest(params) {
2521
- await runBrowserCommand(async () => {
2522
- const profile = params.parent?.browserProfile;
2523
- const result = await callBrowserRequest(params.parent, {
2524
- method: "POST",
2525
- path: params.path,
2526
- query: profile ? { profile } : void 0,
2527
- body: params.body
2528
- }, { timeoutMs: 2e4 });
2529
- if (params.parent?.json) {
2530
- defaultRuntime.writeJson(result);
2531
- return;
2532
- }
2533
- defaultRuntime.log(params.successMessage);
2534
- });
2535
- }
2536
- function registerBrowserStateCommands(browser, parentOpts) {
2537
- registerBrowserCookiesAndStorageCommands(browser, parentOpts);
2538
- const set = browser.command("set").description("Browser environment settings");
2539
- 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) => {
2540
- const parent = parentOpts(cmd);
2541
- const profile = parent?.browserProfile;
2542
- await runBrowserCommand(async () => {
2543
- await runBrowserResizeWithOutput({
2544
- parent,
2545
- profile,
2546
- width,
2547
- height,
2548
- targetId: opts.targetId,
2549
- timeoutMs: 2e4,
2550
- successMessage: `viewport set: ${width}x${height}`
2551
- });
2552
- });
2553
- });
2554
- 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) => {
2555
- const parent = parentOpts(cmd);
2556
- const offline = parseOnOff(value);
2557
- if (offline === null) {
2558
- defaultRuntime.error(danger("Expected on|off"));
2559
- defaultRuntime.exit(1);
2560
- return;
2561
- }
2562
- await runBrowserSetRequest({
2563
- parent,
2564
- path: "/set/offline",
2565
- body: {
2566
- offline,
2567
- targetId: normalizeOptionalString(opts.targetId)
2568
- },
2569
- successMessage: `offline: ${offline}`
2570
- });
2571
- });
2572
- 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) => {
2573
- const parent = parentOpts(cmd);
2574
- await runBrowserCommand(async () => {
2575
- const headersJsonValue = normalizeOptionalString(opts.headersJson) ?? normalizeOptionalString(headersJson);
2576
- if (!headersJsonValue) throw new Error("Missing headers JSON (pass --headers-json or positional JSON argument)");
2577
- const parsed = JSON.parse(headersJsonValue);
2578
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Headers JSON must be a JSON object");
2579
- const headers = {};
2580
- for (const [k, v] of Object.entries(parsed)) if (typeof v === "string") headers[k] = v;
2581
- const profile = parent?.browserProfile;
2582
- const result = await callBrowserRequest(parent, {
2583
- method: "POST",
2584
- path: "/set/headers",
2585
- query: profile ? { profile } : void 0,
2586
- body: {
2587
- headers,
2588
- targetId: normalizeOptionalString(opts.targetId)
2589
- }
2590
- }, { timeoutMs: 2e4 });
2591
- if (parent?.json) {
2592
- defaultRuntime.writeJson(result);
2593
- return;
2594
- }
2595
- defaultRuntime.log("headers set");
2596
- });
2597
- });
2598
- 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) => {
2599
- await runBrowserSetRequest({
2600
- parent: parentOpts(cmd),
2601
- path: "/set/credentials",
2602
- body: {
2603
- username: normalizeOptionalString(username),
2604
- password,
2605
- clear: Boolean(opts.clear),
2606
- targetId: normalizeOptionalString(opts.targetId)
2607
- },
2608
- successMessage: opts.clear ? "credentials cleared" : "credentials set"
2609
- });
2610
- });
2611
- 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) => {
2612
- await runBrowserSetRequest({
2613
- parent: parentOpts(cmd),
2614
- path: "/set/geolocation",
2615
- body: {
2616
- latitude: Number.isFinite(latitude) ? latitude : void 0,
2617
- longitude: Number.isFinite(longitude) ? longitude : void 0,
2618
- accuracy: Number.isFinite(opts.accuracy) ? opts.accuracy : void 0,
2619
- origin: normalizeOptionalString(opts.origin),
2620
- clear: Boolean(opts.clear),
2621
- targetId: normalizeOptionalString(opts.targetId)
2622
- },
2623
- successMessage: opts.clear ? "geolocation cleared" : "geolocation set"
2624
- });
2625
- });
2626
- 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) => {
2627
- const parent = parentOpts(cmd);
2628
- const v = normalizeOptionalLowercaseString(value);
2629
- const colorScheme = v === "dark" ? "dark" : v === "light" ? "light" : v === "none" ? "none" : null;
2630
- if (!colorScheme) {
2631
- defaultRuntime.error(danger("Expected dark|light|none"));
2632
- defaultRuntime.exit(1);
2633
- return;
2634
- }
2635
- await runBrowserSetRequest({
2636
- parent,
2637
- path: "/set/media",
2638
- body: {
2639
- colorScheme,
2640
- targetId: normalizeOptionalString(opts.targetId)
2641
- },
2642
- successMessage: `media colorScheme: ${colorScheme}`
2643
- });
2644
- });
2645
- 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) => {
2646
- await runBrowserSetRequest({
2647
- parent: parentOpts(cmd),
2648
- path: "/set/timezone",
2649
- body: {
2650
- timezoneId,
2651
- targetId: normalizeOptionalString(opts.targetId)
2652
- },
2653
- successMessage: `timezone: ${timezoneId}`
2654
- });
2655
- });
2656
- 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) => {
2657
- await runBrowserSetRequest({
2658
- parent: parentOpts(cmd),
2659
- path: "/set/locale",
2660
- body: {
2661
- locale,
2662
- targetId: normalizeOptionalString(opts.targetId)
2663
- },
2664
- successMessage: `locale: ${locale}`
2665
- });
2666
- });
2667
- 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) => {
2668
- await runBrowserSetRequest({
2669
- parent: parentOpts(cmd),
2670
- path: "/set/device",
2671
- body: {
2672
- name,
2673
- targetId: normalizeOptionalString(opts.targetId)
2674
- },
2675
- successMessage: `device: ${name}`
2676
- });
2677
- });
2678
- }
2679
- //#endregion
2680
- //#region extensions/browser/src/cli/browser-cli.ts
2681
- function registerBrowserCli(program) {
2682
- 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(() => {
2683
- browser.outputHelp();
2684
- defaultRuntime.error(danger(`Missing subcommand. Try: "${formatCliCommand("genesis browser status")}"`));
2685
- defaultRuntime.exit(1);
2686
- });
2687
- addGatewayClientOptions(browser);
2688
- const parentOpts = (cmd) => cmd.parent?.opts?.();
2689
- registerBrowserManageCommands(browser, parentOpts);
2690
- registerBrowserInspectCommands(browser, parentOpts);
2691
- registerBrowserActionInputCommands(browser, parentOpts);
2692
- registerBrowserActionObserveCommands(browser, parentOpts);
2693
- registerBrowserDebugCommands(browser, parentOpts);
2694
- registerBrowserStateCommands(browser, parentOpts);
2695
- }
2696
- //#endregion
2697
- //#region extensions/browser/src/gateway/browser-request.ts
2698
- function isBrowserNode(node) {
2699
- const caps = Array.isArray(node.caps) ? node.caps : [];
2700
- const commands = Array.isArray(node.commands) ? node.commands : [];
2701
- return caps.includes("browser") || commands.includes("browser.proxy");
2702
- }
2703
- function normalizeNodeKey(value) {
2704
- return normalizeLowercaseStringOrEmpty(value).replace(/[^a-z0-9]+/g, "");
2705
- }
2706
- function resolveBrowserNode(nodes, query) {
2707
- const q = normalizeOptionalString(query) ?? "";
2708
- if (!q) return null;
2709
- const qNorm = normalizeNodeKey(q);
2710
- const matches = nodes.filter((node) => {
2711
- if (node.nodeId === q) return true;
2712
- if (typeof node.remoteIp === "string" && node.remoteIp === q) return true;
2713
- const name = typeof node.displayName === "string" ? node.displayName : "";
2714
- if (name && normalizeNodeKey(name) === qNorm) return true;
2715
- if (q.length >= 6 && node.nodeId.startsWith(q)) return true;
2716
- return false;
2717
- });
2718
- if (matches.length === 1) return matches[0] ?? null;
2719
- if (matches.length === 0) return null;
2720
- throw new Error(`ambiguous node: ${q} (matches: ${matches.map((node) => node.displayName || node.remoteIp || node.nodeId).join(", ")})`);
2721
- }
2722
- function resolveBrowserNodeTarget(params) {
2723
- const policy = params.cfg.gateway?.nodes?.browser;
2724
- const mode = policy?.mode ?? "auto";
2725
- if (mode === "off") return null;
2726
- const browserNodes = params.nodes.filter((node) => isBrowserNode(node));
2727
- if (browserNodes.length === 0) {
2728
- if (normalizeOptionalString(policy?.node)) throw new Error("No connected browser-capable nodes.");
2729
- return null;
2730
- }
2731
- const requested = normalizeOptionalString(policy?.node) ?? "";
2732
- if (requested) {
2733
- const resolved = resolveBrowserNode(browserNodes, requested);
2734
- if (!resolved) throw new Error(`Configured browser node not connected: ${requested}`);
2735
- return resolved;
2736
- }
2737
- if (mode === "manual") return null;
2738
- if (browserNodes.length === 1) return browserNodes[0] ?? null;
2739
- return null;
2740
- }
2741
- async function persistProxyFiles(files) {
2742
- return await persistBrowserProxyFiles(files);
2743
- }
2744
- function applyProxyPaths(result, mapping) {
2745
- applyBrowserProxyPaths(result, mapping);
2746
- }
2747
- async function handleBrowserGatewayRequest({ params, respond, context }) {
2748
- const typed = params;
2749
- const methodRaw = (normalizeOptionalString(typed.method) ?? "").toUpperCase();
2750
- const path = normalizeOptionalString(typed.path) ?? "";
2751
- const query = typed.query && typeof typed.query === "object" ? typed.query : void 0;
2752
- const body = typed.body;
2753
- const timeoutMs = typeof typed.timeoutMs === "number" && Number.isFinite(typed.timeoutMs) ? Math.max(1, Math.floor(typed.timeoutMs)) : void 0;
2754
- if (!methodRaw || !path) {
2755
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "method and path are required"));
2756
- return;
2757
- }
2758
- if (methodRaw !== "GET" && methodRaw !== "POST" && methodRaw !== "DELETE") {
2759
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "method must be GET, POST, or DELETE"));
2760
- return;
2761
- }
2762
- if (isPersistentBrowserProfileMutation(methodRaw, path)) {
2763
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "browser.request cannot mutate persistent browser profiles"));
2764
- return;
2765
- }
2766
- const cfg = loadConfig();
2767
- let nodeTarget = null;
2768
- try {
2769
- nodeTarget = resolveBrowserNodeTarget({
2770
- cfg,
2771
- nodes: context.nodeRegistry.listConnected()
2772
- });
2773
- } catch (err) {
2774
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2775
- return;
2776
- }
2777
- if (nodeTarget) {
2778
- const allowlist = resolveNodeCommandAllowlist(cfg, nodeTarget);
2779
- const allowed = isNodeCommandAllowed({
2780
- command: "browser.proxy",
2781
- declaredCommands: nodeTarget.commands,
2782
- allowlist
2783
- });
2784
- if (!allowed.ok) {
2785
- const platform = nodeTarget.platform ?? "unknown";
2786
- const hint = `node command not allowed: ${allowed.reason} (platform: ${platform}, command: browser.proxy)`;
2787
- respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, hint, { details: {
2788
- reason: allowed.reason,
2789
- command: "browser.proxy"
2790
- } }));
2791
- return;
2792
- }
2793
- const proxyParams = {
2794
- method: methodRaw,
2795
- path,
2796
- query,
2797
- body,
2798
- timeoutMs,
2799
- profile: resolveRequestedBrowserProfile({
2800
- query,
2801
- body
2802
- })
2803
- };
2804
- const res = await context.nodeRegistry.invoke({
2805
- nodeId: nodeTarget.nodeId,
2806
- command: "browser.proxy",
2807
- params: proxyParams,
2808
- timeoutMs,
2809
- idempotencyKey: crypto.randomUUID()
2810
- });
2811
- if (!respondUnavailableOnNodeInvokeError(respond, res)) return;
2812
- const payload = res.payloadJSON ? safeParseJson(res.payloadJSON) : res.payload;
2813
- const proxy = payload && typeof payload === "object" ? payload : null;
2814
- if (!proxy || !("result" in proxy)) {
2815
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, "browser proxy failed"));
2816
- return;
2817
- }
2818
- const mapping = await persistProxyFiles(proxy.files);
2819
- applyProxyPaths(proxy.result, mapping);
2820
- respond(true, proxy.result);
2821
- return;
2822
- }
2823
- if (!await startBrowserControlServiceFromConfig()) {
2824
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, "browser control is disabled"));
2825
- return;
2826
- }
2827
- let dispatcher;
2828
- try {
2829
- dispatcher = createBrowserRouteDispatcher(createBrowserControlContext());
2830
- } catch (err) {
2831
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2832
- return;
2833
- }
2834
- let result;
2835
- try {
2836
- result = timeoutMs ? await withTimeout((signal) => dispatcher.dispatch({
2837
- method: methodRaw,
2838
- path,
2839
- query,
2840
- body,
2841
- signal
2842
- }), timeoutMs, "browser request") : await dispatcher.dispatch({
2843
- method: methodRaw,
2844
- path,
2845
- query,
2846
- body
2847
- });
2848
- } catch (err) {
2849
- respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
2850
- return;
2851
- }
2852
- if (result.status >= 400) {
2853
- const message = result.body && typeof result.body === "object" && "error" in result.body ? String(result.body.error) : `browser request failed (${result.status})`;
2854
- respond(false, void 0, errorShape(result.status >= 500 ? ErrorCodes.UNAVAILABLE : ErrorCodes.INVALID_REQUEST, message, { details: result.body }));
2855
- return;
2856
- }
2857
- respond(true, result.body);
2858
- }
2859
- const browserHandlers = { "browser.request": handleBrowserGatewayRequest };
2860
- //#endregion
2861
- //#region extensions/browser/src/plugin-service.ts
2862
- const UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER = /^(?:data|http|https|node):/i;
2863
- function validateBrowserControlOverrideSpecifier(specifier) {
2864
- const trimmed = specifier.trim();
2865
- if (UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER.test(trimmed)) throw new Error(`Refusing unsafe browser control override specifier: ${trimmed}`);
2866
- return trimmed;
2867
- }
2868
- function createBrowserPluginService() {
2869
- let handle = null;
2870
- return {
2871
- id: "browser-control",
2872
- start: async () => {
2873
- if (handle) return;
2874
- handle = await startLazyPluginServiceModule({
2875
- skipEnvVar: "GENESIS_SKIP_BROWSER_CONTROL_SERVER",
2876
- overrideEnvVar: "GENESIS_BROWSER_CONTROL_MODULE",
2877
- validateOverrideSpecifier: validateBrowserControlOverrideSpecifier,
2878
- loadDefaultModule: async () => await import("./server-D58E1Cua.js"),
2879
- startExportNames: ["startBrowserControlServiceFromConfig", "startBrowserControlServerFromConfig"],
2880
- stopExportNames: ["stopBrowserControlService", "stopBrowserControlServer"]
2881
- });
2882
- },
2883
- stop: async () => {
2884
- const current = handle;
2885
- handle = null;
2886
- if (!current) return;
2887
- await current.stop().catch(() => {});
2888
- }
2889
- };
2890
- }
2891
- //#endregion
2892
- export { createBrowserTool as a, registerBrowserCli as i, browserHandlers as n, handleBrowserGatewayRequest as r, createBrowserPluginService as t };