@gaodefa/daocore 2026.5.86 → 2026.5.87

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 (1615) hide show
  1. package/dist/abort-DF_NBB7k.js +277 -0
  2. package/dist/abort.runtime-D4MkvEhQ.js +2 -0
  3. package/dist/abort.runtime.js +1 -1
  4. package/dist/account-inspect-BgTcq2xK.js +173 -0
  5. package/dist/accounts-B4A5OwEA.js +119 -0
  6. package/dist/accounts-BkS1Fh-0.js +107 -0
  7. package/dist/accounts-DF7-7Smq.js +107 -0
  8. package/dist/accounts-UL1OgSV7.js +2 -0
  9. package/dist/acp-runtime-Cx2ACvcD.js +26 -0
  10. package/dist/acp-spawn-BGd_lmtE.js +2 -0
  11. package/dist/acp-spawn-BV0aSrgH.js +1275 -0
  12. package/dist/acp-stateful-target-driver-BZXAtm9O.js +89 -0
  13. package/dist/action-kill-CrabJ-6-.js +33 -0
  14. package/dist/action-runtime-BWOfmJe3.js +469 -0
  15. package/dist/action-runtime-api-Fr0Pcsql.js +2 -0
  16. package/dist/action-send-Cpl-x8ro.js +39 -0
  17. package/dist/action-spawn-DceGvU1M.js +47 -0
  18. package/dist/actions-Dx4zHx1-.js +161 -0
  19. package/dist/actions.runtime-CXgc7_sE.js +5 -0
  20. package/dist/agent-6f80KcUH.js +2 -0
  21. package/dist/agent-B2kAd5xV.js +3 -0
  22. package/dist/agent-command-DwGwELK0.js +1367 -0
  23. package/dist/agent-components.runtime-DJYuGMFi.js +10 -0
  24. package/dist/agent-components.runtime.js +1 -1
  25. package/dist/agent-harness-Dya8_zFH.d.ts +146 -0
  26. package/dist/agent-harness-runtime-B18Zw6Rz.d.ts +691 -0
  27. package/dist/agent-harness-runtime-D_wIHJVe.js +180 -0
  28. package/dist/agent-harness-task-runtime-ol_ltjHi.js +140 -0
  29. package/dist/agent-runner-execution-D5wMRx5h.js +1713 -0
  30. package/dist/agent-runner-utils-CLCfaT2K.js +266 -0
  31. package/dist/agent-runner.runtime-Igsb-Us4.js +3455 -0
  32. package/dist/agent-runner.runtime.js +1 -1
  33. package/dist/agent-runtime-tAPmASEK.js +229 -0
  34. package/dist/agent-via-gateway-CmOOhHWf.js +463 -0
  35. package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
  36. package/dist/api-BGUYfA7u.js +639 -0
  37. package/dist/api-Bb3jRMVp.js +3 -0
  38. package/dist/api-CDGKNega.js +6 -0
  39. package/dist/api-D-TLdpx5.js +2 -0
  40. package/dist/api-DXDbFZ7W.js +134 -0
  41. package/dist/api-DYuUdqrI.d.ts +52 -0
  42. package/dist/api-o2EhTZRZ.js +2 -0
  43. package/dist/apply-BWXKR0_1.js +41 -0
  44. package/dist/apply-C3i3NucS.js +54 -0
  45. package/dist/approval-handler.runtime-DhzHxhOa.js +130 -0
  46. package/dist/assistant-SXZqrOD4.js +291 -0
  47. package/dist/attachment-normalize-DobdGk6t.js +225 -0
  48. package/dist/attempt-execution-BOV_h0-N.js +558 -0
  49. package/dist/attempt-execution.runtime-CXlw2E2H.js +3 -0
  50. package/dist/attempt-execution.runtime.js +1 -1
  51. package/dist/attempt-execution.shared-BUNB-ofJ.js +38 -0
  52. package/dist/attempt.prompt-helpers-DfgNBTYi.js +475 -0
  53. package/dist/attempt.tool-run-context-DdadqfC-.js +2094 -0
  54. package/dist/binding-routing-BYWsTgH4.js +113 -0
  55. package/dist/binding-targets-CDxkaXRY.js +121 -0
  56. package/dist/bot-BMJcaPAi.js +7894 -0
  57. package/dist/bot-deps-CNg_Zt2P.js +2 -0
  58. package/dist/bot-deps-FZotnMZO.js +747 -0
  59. package/dist/bot-message-context.runtime-C_OEKOE-.js +7 -0
  60. package/dist/bot-message-context.runtime.js +1 -1
  61. package/dist/bot-message-context.session.runtime-VbbwvU7y.js +12 -0
  62. package/dist/bot-message-context.session.runtime.js +1 -1
  63. package/dist/bot-native-commands.delivery.runtime-CuquGLAx.js +4 -0
  64. package/dist/bot-native-commands.delivery.runtime.js +1 -1
  65. package/dist/bot-native-commands.runtime-DtYCPjvW.js +13 -0
  66. package/dist/bot-native-commands.runtime.js +1 -1
  67. package/dist/bridge-server-B4pS54jd.js +113 -0
  68. package/dist/browser-cli-BHUdFJIS.js +230 -0
  69. package/dist/browser-cli-BWWH1Csp.js +2 -0
  70. package/dist/browser-cli-actions-input-1hfL1q3f.js +473 -0
  71. package/dist/browser-cli-actions-observe-Ctdz-Ocl.js +81 -0
  72. package/dist/browser-cli-debug-D4yOgAhy.js +137 -0
  73. package/dist/browser-cli-inspect-D6c28uLw.js +104 -0
  74. package/dist/browser-cli-manage-DoCDoOsO.js +443 -0
  75. package/dist/browser-cli-resize-Dgb5KdMO.js +26 -0
  76. package/dist/browser-cli-shared-C1LIiQyl.js +50 -0
  77. package/dist/browser-cli-state-CwIDB8-B.js +337 -0
  78. package/dist/browser-control-auth-COjZjE3L.js +2 -0
  79. package/dist/browser-profiles-D085C5gN.js +2 -0
  80. package/dist/browser-runtime-CKIOtwI9.js +384 -0
  81. package/dist/build-DHK6vRrC.js +257 -0
  82. package/dist/build-info.json +3 -3
  83. package/dist/bundled/boot-md/handler.js +2 -2
  84. package/dist/bundled/session-memory/handler.js +1 -1
  85. package/dist/bundled-channel-config-schema-BsHcx3wh.d.ts +3163 -0
  86. package/dist/call-D8ev9OI5.d.ts +43 -0
  87. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  88. package/dist/capability-cli-DRrPaB5q.js +1782 -0
  89. package/dist/channel-29833Q7U.d.ts +8 -0
  90. package/dist/channel-B0gFm2e0.d.ts +49 -0
  91. package/dist/channel-B4huj9Kp.js +362 -0
  92. package/dist/channel-B4wQxeHH.d.ts +14 -0
  93. package/dist/channel-BLs4RYYL.js +1777 -0
  94. package/dist/channel-BS3cqj-Z.d.ts +6 -0
  95. package/dist/channel-BU5YCSFs.d.ts +427 -0
  96. package/dist/channel-BXg8HDz6.d.ts +7 -0
  97. package/dist/channel-B_rnZ7-_.d.ts +26 -0
  98. package/dist/channel-BnSrEvQt.js +238 -0
  99. package/dist/channel-BuEQnzVg.js +1556 -0
  100. package/dist/channel-BvlX4grI.d.ts +106 -0
  101. package/dist/channel-C75uc-F0.d.ts +12 -0
  102. package/dist/channel-CMIcwlip.js +955 -0
  103. package/dist/channel-CTTRs_4Q.js +376 -0
  104. package/dist/channel-Ceh4DhGf.js +808 -0
  105. package/dist/channel-Cg78poCb.d.ts +7 -0
  106. package/dist/channel-CtVWvTxM.d.ts +8 -0
  107. package/dist/channel-CxzIiRo0.js +740 -0
  108. package/dist/channel-D3sCmweW.d.ts +64 -0
  109. package/dist/channel-DBe2Xwn9.js +1249 -0
  110. package/dist/channel-DOB2mltt.js +867 -0
  111. package/dist/channel-DU9qt3dX.js +481 -0
  112. package/dist/channel-DWCzQ-Po.js +562 -0
  113. package/dist/channel-Dha12xQd.js +2126 -0
  114. package/dist/channel-EAYFx_aX.d.ts +47 -0
  115. package/dist/channel-VJIcMa-M.js +508 -0
  116. package/dist/channel-WPOWimOu.js +1134 -0
  117. package/dist/channel-actions.runtime-bqHQHH3X.js +265 -0
  118. package/dist/channel-actions.runtime.js +1 -1
  119. package/dist/channel-core-DsmamxDL.d.ts +6 -0
  120. package/dist/channel-core-m0EI5nTB.js +5 -0
  121. package/dist/channel-entry-contract-DwsX3A32.d.ts +112 -0
  122. package/dist/channel-ez59JAzr.d.ts +114 -0
  123. package/dist/channel-inbound-hFEolyVo.js +80 -0
  124. package/dist/channel-l10cAz1Q.js +1496 -0
  125. package/dist/channel-oeyyvfIC.d.ts +104 -0
  126. package/dist/channel-plugin-runtime-BMtJ1Wgj.js +998 -0
  127. package/dist/channel-plugin-runtime-Cm532MRz.d.ts +7 -0
  128. package/dist/channel-runtime-TLiTFcI9.js +408 -0
  129. package/dist/channel-ryumzsaN.d.ts +28 -0
  130. package/dist/channel-uLv7YV-J.js +653 -0
  131. package/dist/channel-zfDQdZSM.d.ts +8 -0
  132. package/dist/channel.runtime-3Aev2p4z.js +88 -0
  133. package/dist/channel.runtime-BBoj-2rR.js +2528 -0
  134. package/dist/channel.runtime-BHW11124.js +254 -0
  135. package/dist/channel.runtime-BO5IrBIY.js +652 -0
  136. package/dist/channel.runtime-C8L4S2Y3.js +109 -0
  137. package/dist/channel.runtime-D55LFe_S.js +21009 -0
  138. package/dist/channel.runtime-DUVRcCkd.js +1008 -0
  139. package/dist/channel.runtime-eAjrNDCs.js +733 -0
  140. package/dist/channel.runtime-ek9gTQao.js +4 -0
  141. package/dist/channel.setup-BKCOmQ1R.d.ts +6 -0
  142. package/dist/channel.setup-C4kFVZ9n.js +1098 -0
  143. package/dist/channel.setup-CG4h40nr.js +10 -0
  144. package/dist/channel.setup-CIy_GOHl.d.ts +8 -0
  145. package/dist/channel.setup-DLoH7iov.d.ts +7 -0
  146. package/dist/channel.setup-t6GC0j9y.js +343 -0
  147. package/dist/chat-u7qZ4sNv.js +2666 -0
  148. package/dist/chrome-CcpklbxU.js +1503 -0
  149. package/dist/cli/run-main.js +5 -5
  150. package/dist/cli-DfMcB-YB.d.ts +20 -0
  151. package/dist/cli-DuN9_yOX.js +1341 -0
  152. package/dist/cli-backend-C3cY7GNo.d.ts +5 -0
  153. package/dist/cli-backend-Dq6pWbMI.d.ts +5 -0
  154. package/dist/cli-compaction-_t3h1d1Y.js +347 -0
  155. package/dist/cli-metadata-CuQDanWu.js +22 -0
  156. package/dist/cli-runner-BICDg94b.js +2 -0
  157. package/dist/cli-runner-CeaLhAdU.js +540 -0
  158. package/dist/cli-runner.runtime-Ckyx1-nO.js +4 -0
  159. package/dist/cli-runner.runtime-ZsfkXp6T.js +3 -0
  160. package/dist/cli-runner.runtime.js +1 -1
  161. package/dist/cli-shared-CLlJpRmc.d.ts +20 -0
  162. package/dist/cli-startup-metadata.json +8 -8
  163. package/dist/client-UnpX4vLL.js +650 -0
  164. package/dist/client-adapter-DXOFyLda.js +897 -0
  165. package/dist/client-factory-DvI4dWav.js +9 -0
  166. package/dist/command-auth--55vYozU.js +135 -0
  167. package/dist/command-handlers-luOY52Zj.js +1609 -0
  168. package/dist/command-registry-2ZPFOxQD.js +4 -0
  169. package/dist/command-registry-BnlVL4Z5.js +9 -0
  170. package/dist/command-registry-core-CY3_nsXj.js +110 -0
  171. package/dist/command-status.runtime-DlWcbk6f.js +90 -0
  172. package/dist/command-status.runtime.js +1 -1
  173. package/dist/commands-9rlXSaBn.d.ts +113 -0
  174. package/dist/commands-acp-1GcD7q5q.js +74 -0
  175. package/dist/commands-compact.runtime-DO9NBGsY.js +10 -0
  176. package/dist/commands-compact.runtime.js +1 -1
  177. package/dist/commands-handlers.runtime-CS9oLcTy.js +6154 -0
  178. package/dist/commands-handlers.runtime.js +1 -1
  179. package/dist/commands-status-B-VHaYH5.js +3 -0
  180. package/dist/commands-status-CD4lbvZe.js +16 -0
  181. package/dist/commands-status.runtime-B-VHaYH5.js +3 -0
  182. package/dist/commands-status.runtime.js +1 -1
  183. package/dist/commands-subagents-control.runtime-BW2wSGGB.js +2 -0
  184. package/dist/commands-subagents-control.runtime-DayCbQBi.js +3 -0
  185. package/dist/commands-subagents-control.runtime.js +1 -1
  186. package/dist/commands-system-prompt-Bu0-zdQV.js +162 -0
  187. package/dist/commands-system-prompt-DqzUrExG.js +2 -0
  188. package/dist/commands.runtime-Bi618hLG.js +176 -0
  189. package/dist/commands.runtime.js +1 -1
  190. package/dist/commitments/runtime.js +1 -1
  191. package/dist/compact-D6RF2ao-.js +480 -0
  192. package/dist/compact-DOHvJc9C.js +1141 -0
  193. package/dist/compact.runtime-BMV69fdx.js +12 -0
  194. package/dist/compact.runtime.js +1 -1
  195. package/dist/completion-cli-CKorRumh.js +315 -0
  196. package/dist/computer-use-QDwH-PSW.js +367 -0
  197. package/dist/config-D085C5gN.js +2 -0
  198. package/dist/config-kivtFwCd.js +373 -0
  199. package/dist/config-mutations-BEpZ3rYv.js +159 -0
  200. package/dist/config-schema-Bwgooc-v.d.ts +20 -0
  201. package/dist/config-schema-lIvqvlbL.d.ts +34 -0
  202. package/dist/context-engine-host-compat-BXoUGeB_.js +2 -0
  203. package/dist/context-engine-host-compat-CcCmD5o9.js +288 -0
  204. package/dist/context-engine-lifecycle-CwtbthA3.js +1274 -0
  205. package/dist/contracts-testkit-DC7MJzfa.d.ts +145 -0
  206. package/dist/control-auth-wsG-pObJ.js +114 -0
  207. package/dist/control-service-DoSyDuPZ.js +145 -0
  208. package/dist/conversation-binding-runtime-vZQ351Yx.js +4 -0
  209. package/dist/conversation-runtime-DZztdc11.js +31 -0
  210. package/dist/core-CcQCE1PE.js +282 -0
  211. package/dist/core-api-Cn9nxEQY.js +5 -0
  212. package/dist/core-api-DJttT99e.js +2 -0
  213. package/dist/core-loprAG73.d.ts +224 -0
  214. package/dist/crestodian/crestodian.js +1 -1
  215. package/dist/crestodian/rescue-message.js +1 -1
  216. package/dist/crestodian-B77mGOnM.js +55 -0
  217. package/dist/daocore-runtime-B-rzUpKx.d.ts +151 -0
  218. package/dist/daocore-tools-B2AoPxwu.js +11727 -0
  219. package/dist/delivery-DrO-hbmH.js +1002 -0
  220. package/dist/dialogue-xd9pIoHO.js +37 -0
  221. package/dist/dir-fetch-tool-CMJ9Pt6u.js +565 -0
  222. package/dist/dir-list-tool-BrTrO97I.js +100 -0
  223. package/dist/direct-dm-Dbxrg-M8.js +64 -0
  224. package/dist/directive-handling.fast-lane-Cm6q7myY.js +68 -0
  225. package/dist/directive-handling.impl-BW2_4S2v.js +818 -0
  226. package/dist/directive-handling.impl-DkMvyjSy.js +2 -0
  227. package/dist/directive-handling.model-selection-BBc-JgRD.js +122 -0
  228. package/dist/directive-handling.persist.runtime-ByZk594V.js +263 -0
  229. package/dist/directive-handling.persist.runtime.js +1 -1
  230. package/dist/dispatch-acp-transcript.runtime-t6_JeKwA.js +40 -0
  231. package/dist/dispatch-acp-transcript.runtime.js +1 -1
  232. package/dist/dispatch-acp.runtime-yf6pNdiB.js +18 -0
  233. package/dist/dispatch-acp.runtime.js +1 -1
  234. package/dist/dispatch-rpGfQmzk.js +1640 -0
  235. package/dist/doctor-Ce9osVgH.js +6 -0
  236. package/dist/doctor-Dl4rkbw8.js +2 -0
  237. package/dist/doctor-config-flow-IokiMPZL.js +1741 -0
  238. package/dist/doctor-core-checks-DPugZhrT.js +2 -0
  239. package/dist/doctor-core-checks-DTM0dPXV.js +573 -0
  240. package/dist/doctor-health-D9BF5XjZ.js +65 -0
  241. package/dist/doctor-health-contributions-CeAx5c5L.js +696 -0
  242. package/dist/doctor-lint-B3Ya8mmD.js +94 -0
  243. package/dist/doctor-state-integrity-B5aQjl2y.js +1231 -0
  244. package/dist/doctor-update-CGkyLrKv.js +58 -0
  245. package/dist/doctor-update-fix-CQ8qVhBX.js +107 -0
  246. package/dist/dynamic-tools-DZebai0O.js +486 -0
  247. package/dist/embedded-backend-BS79InDg.js +579 -0
  248. package/dist/embedded-gateway-stub.runtime-CsTs2-an.js +12 -0
  249. package/dist/embedded-gateway-stub.runtime.js +1 -1
  250. package/dist/embedding-provider-BKIXHvGl.d.ts +16 -0
  251. package/dist/embedding-provider-ZDZfzTLK.d.ts +65 -0
  252. package/dist/embedding-provider-uqWqn4wW.d.ts +21 -0
  253. package/dist/entry.d.ts +1 -1
  254. package/dist/exec-approvals-DSGilgX_.js +149 -0
  255. package/dist/extensionAPI.js +1 -1
  256. package/dist/extensions/active-memory/index.d.ts +1 -1
  257. package/dist/extensions/active-memory/index.js +1 -1
  258. package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
  259. package/dist/extensions/admin-http-rpc/index.js +1 -1
  260. package/dist/extensions/alibaba/index.d.ts +1 -1
  261. package/dist/extensions/anthropic/api.d.ts +3 -3
  262. package/dist/extensions/anthropic/cli-backend-api.d.ts +2 -2
  263. package/dist/extensions/anthropic/cli-backend.d.ts +1 -1
  264. package/dist/extensions/anthropic/cli-migration.d.ts +1 -1
  265. package/dist/extensions/anthropic/cli-shared.d.ts +1 -1
  266. package/dist/extensions/anthropic/contract-api.d.ts +1 -1
  267. package/dist/extensions/anthropic/index.d.ts +1 -1
  268. package/dist/extensions/anthropic/provider-contract-api.d.ts +1 -1
  269. package/dist/extensions/anthropic/provider-discovery.d.ts +1 -1
  270. package/dist/extensions/anthropic/provider-policy-api.d.ts +1 -1
  271. package/dist/extensions/anthropic/register.runtime.d.ts +1 -1
  272. package/dist/extensions/anthropic/replay-policy.d.ts +1 -1
  273. package/dist/extensions/anthropic/setup-api.d.ts +1 -1
  274. package/dist/extensions/anthropic/stream-wrappers.d.ts +1 -1
  275. package/dist/extensions/anthropic/test-api.d.ts +2 -2
  276. package/dist/extensions/arcee/index.d.ts +1 -1
  277. package/dist/extensions/azure-speech/index.d.ts +1 -1
  278. package/dist/extensions/azure-speech/speech-provider.d.ts +1 -1
  279. package/dist/extensions/bonjour/index.d.ts +1 -1
  280. package/dist/extensions/browser/browser-bridge.js +1 -1
  281. package/dist/extensions/browser/browser-config.js +4 -4
  282. package/dist/extensions/browser/browser-control-auth.js +2 -2
  283. package/dist/extensions/browser/browser-doctor.js +2 -2
  284. package/dist/extensions/browser/browser-maintenance.js +1 -1
  285. package/dist/extensions/browser/browser-profiles.js +2 -2
  286. package/dist/extensions/browser/browser-runtime-api.js +11 -11
  287. package/dist/extensions/browser/cli-metadata.d.ts +1 -1
  288. package/dist/extensions/browser/cli-metadata.js +1 -1
  289. package/dist/extensions/browser/index.d.ts +1 -1
  290. package/dist/extensions/browser/index.js +1 -1
  291. package/dist/extensions/browser/plugin-registration.d.ts +1 -1
  292. package/dist/extensions/browser/plugin-registration.js +1 -1
  293. package/dist/extensions/browser/register.runtime.d.ts +2 -2
  294. package/dist/extensions/browser/register.runtime.js +4 -4
  295. package/dist/extensions/browser/runtime-api.d.ts +3 -3
  296. package/dist/extensions/browser/runtime-api.js +13 -13
  297. package/dist/extensions/browser/setup-api.d.ts +1 -1
  298. package/dist/extensions/byteplus/index.d.ts +1 -1
  299. package/dist/extensions/byteplus/provider-discovery.d.ts +1 -1
  300. package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
  301. package/dist/extensions/canvas/index.d.ts +1 -1
  302. package/dist/extensions/canvas/index.js +1 -1
  303. package/dist/extensions/canvas/runtime-api.d.ts +2 -2
  304. package/dist/extensions/canvas/setup-api.d.ts +1 -1
  305. package/dist/extensions/cerebras/index.d.ts +1 -1
  306. package/dist/extensions/chutes/index.d.ts +1 -1
  307. package/dist/extensions/clickclack/api.d.ts +2 -2
  308. package/dist/extensions/clickclack/api.js +2 -2
  309. package/dist/extensions/clickclack/channel-plugin-api.d.ts +1 -1
  310. package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
  311. package/dist/extensions/clickclack/index.d.ts +2 -2
  312. package/dist/extensions/clickclack/runtime-api.d.ts +2 -2
  313. package/dist/extensions/clickclack/runtime-api.js +2 -2
  314. package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
  315. package/dist/extensions/cloudflare-ai-gateway/stream-wrappers.d.ts +1 -1
  316. package/dist/extensions/comfy/index.d.ts +1 -1
  317. package/dist/extensions/copilot-proxy/index.d.ts +1 -1
  318. package/dist/extensions/copilot-proxy/runtime-api.d.ts +2 -2
  319. package/dist/extensions/deepgram/index.d.ts +1 -1
  320. package/dist/extensions/deepgram/realtime-transcription-provider.d.ts +1 -1
  321. package/dist/extensions/deepgram/test-api.d.ts +1 -1
  322. package/dist/extensions/deepinfra/api.d.ts +2 -2
  323. package/dist/extensions/deepinfra/embedding-provider.d.ts +1 -1
  324. package/dist/extensions/deepinfra/index.d.ts +1 -1
  325. package/dist/extensions/deepinfra/memory-embedding-adapter.d.ts +1 -1
  326. package/dist/extensions/deepinfra/speech-provider.d.ts +1 -1
  327. package/dist/extensions/deepseek/api.d.ts +1 -1
  328. package/dist/extensions/deepseek/index.d.ts +1 -1
  329. package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
  330. package/dist/extensions/deepseek/provider-policy-api.d.ts +1 -1
  331. package/dist/extensions/deepseek/stream.d.ts +1 -1
  332. package/dist/extensions/deepseek/thinking.d.ts +1 -1
  333. package/dist/extensions/device-pair/api.d.ts +3 -3
  334. package/dist/extensions/device-pair/api.js +1 -1
  335. package/dist/extensions/device-pair/index.d.ts +1 -1
  336. package/dist/extensions/device-pair/notify.d.ts +1 -1
  337. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  338. package/dist/extensions/document-extract/index.d.ts +1 -1
  339. package/dist/extensions/duckduckgo/index.d.ts +1 -1
  340. package/dist/extensions/elevenlabs/index.d.ts +1 -1
  341. package/dist/extensions/elevenlabs/realtime-transcription-provider.d.ts +1 -1
  342. package/dist/extensions/elevenlabs/setup-api.d.ts +1 -1
  343. package/dist/extensions/elevenlabs/speech-provider.d.ts +1 -1
  344. package/dist/extensions/elevenlabs/test-api.d.ts +2 -2
  345. package/dist/extensions/exa/index.d.ts +1 -1
  346. package/dist/extensions/fal/index.d.ts +1 -1
  347. package/dist/extensions/fal/provider-contract-api.d.ts +1 -1
  348. package/dist/extensions/fal/provider-registration.d.ts +1 -1
  349. package/dist/extensions/file-transfer/index.d.ts +1 -1
  350. package/dist/extensions/file-transfer/index.js +4 -4
  351. package/dist/extensions/firecrawl/index.d.ts +1 -1
  352. package/dist/extensions/fireworks/index.d.ts +1 -1
  353. package/dist/extensions/fireworks/provider-policy-api.d.ts +1 -1
  354. package/dist/extensions/fireworks/stream.d.ts +1 -1
  355. package/dist/extensions/fireworks/thinking-policy.d.ts +1 -1
  356. package/dist/extensions/github-copilot/embeddings.d.ts +1 -1
  357. package/dist/extensions/github-copilot/index.d.ts +1 -1
  358. package/dist/extensions/github-copilot/models.d.ts +1 -1
  359. package/dist/extensions/github-copilot/register.runtime.d.ts +2 -2
  360. package/dist/extensions/github-copilot/stream.d.ts +1 -1
  361. package/dist/extensions/google/api.d.ts +5 -5
  362. package/dist/extensions/google/cli-backend.d.ts +1 -1
  363. package/dist/extensions/google/embedding-batch.d.ts +1 -1
  364. package/dist/extensions/google/embedding-provider.d.ts +1 -1
  365. package/dist/extensions/google/gemini-cli-provider.d.ts +1 -1
  366. package/dist/extensions/google/index.d.ts +1 -1
  367. package/dist/extensions/google/memory-embedding-adapter.d.ts +1 -1
  368. package/dist/extensions/google/provider-contract-api.d.ts +1 -1
  369. package/dist/extensions/google/provider-hooks.d.ts +2 -2
  370. package/dist/extensions/google/provider-models.d.ts +1 -1
  371. package/dist/extensions/google/provider-policy-api.d.ts +1 -1
  372. package/dist/extensions/google/provider-policy.d.ts +1 -1
  373. package/dist/extensions/google/provider-registration.d.ts +1 -1
  374. package/dist/extensions/google/realtime-voice-provider.d.ts +1 -1
  375. package/dist/extensions/google/runtime-api.d.ts +3 -3
  376. package/dist/extensions/google/setup-api.d.ts +1 -1
  377. package/dist/extensions/google/speech-provider.d.ts +1 -1
  378. package/dist/extensions/google/test-api.d.ts +2 -2
  379. package/dist/extensions/google/thinking-api.d.ts +1 -1
  380. package/dist/extensions/google/thinking.d.ts +1 -1
  381. package/dist/extensions/google/transport-stream.d.ts +1 -1
  382. package/dist/extensions/gradium/index.d.ts +1 -1
  383. package/dist/extensions/gradium/speech-provider.d.ts +1 -1
  384. package/dist/extensions/groq/index.d.ts +1 -1
  385. package/dist/extensions/huggingface/index.d.ts +1 -1
  386. package/dist/extensions/image-generation-core/api.d.ts +3 -3
  387. package/dist/extensions/image-generation-core/runtime-api.d.ts +1 -1
  388. package/dist/extensions/imessage/api.d.ts +2 -2
  389. package/dist/extensions/imessage/api.js +2 -2
  390. package/dist/extensions/imessage/channel-plugin-api.d.ts +1 -1
  391. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  392. package/dist/extensions/imessage/index.d.ts +2 -2
  393. package/dist/extensions/imessage/message-tool-api.d.ts +1 -1
  394. package/dist/extensions/imessage/runtime-api.d.ts +4 -4
  395. package/dist/extensions/imessage/runtime-api.js +3 -3
  396. package/dist/extensions/imessage/setup-entry.d.ts +2 -2
  397. package/dist/extensions/imessage/test-api.d.ts +1 -1
  398. package/dist/extensions/inworld/index.d.ts +1 -1
  399. package/dist/extensions/inworld/speech-provider.d.ts +1 -1
  400. package/dist/extensions/irc/api.d.ts +1 -1
  401. package/dist/extensions/irc/api.js +2 -2
  402. package/dist/extensions/irc/channel-plugin-api.d.ts +1 -1
  403. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  404. package/dist/extensions/irc/index.d.ts +2 -2
  405. package/dist/extensions/irc/setup-entry.d.ts +2 -2
  406. package/dist/extensions/kilocode/index.d.ts +1 -1
  407. package/dist/extensions/kimi-coding/index.d.ts +1 -1
  408. package/dist/extensions/kimi-coding/stream.d.ts +1 -1
  409. package/dist/extensions/litellm/index.d.ts +1 -1
  410. package/dist/extensions/llm-task/api.d.ts +2 -2
  411. package/dist/extensions/llm-task/index.d.ts +1 -1
  412. package/dist/extensions/llm-task/index.js +1 -1
  413. package/dist/extensions/lmstudio/api.d.ts +1 -1
  414. package/dist/extensions/lmstudio/index.d.ts +1 -1
  415. package/dist/extensions/lmstudio/memory-embedding-adapter.d.ts +1 -1
  416. package/dist/extensions/mattermost/api.js +1 -1
  417. package/dist/extensions/mattermost/channel-plugin-api.d.ts +2 -2
  418. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  419. package/dist/extensions/mattermost/channel-plugin-runtime.d.ts +1 -1
  420. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  421. package/dist/extensions/mattermost/index.d.ts +2 -2
  422. package/dist/extensions/mattermost/policy-api.js +1 -1
  423. package/dist/extensions/mattermost/runtime-api.d.ts +4 -4
  424. package/dist/extensions/mattermost/runtime-api.js +2 -2
  425. package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
  426. package/dist/extensions/mattermost/slash-route-api.d.ts +1 -1
  427. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  428. package/dist/extensions/memory-core/api.d.ts +1 -1
  429. package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
  430. package/dist/extensions/memory-core/cli-metadata.js +1 -1
  431. package/dist/extensions/memory-core/index.d.ts +1 -1
  432. package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
  433. package/dist/extensions/memory-core/runtime-api.d.ts +2 -2
  434. package/dist/extensions/memory-wiki/api.d.ts +3 -3
  435. package/dist/extensions/memory-wiki/cli-metadata.d.ts +1 -1
  436. package/dist/extensions/memory-wiki/index.d.ts +1 -1
  437. package/dist/extensions/memory-wiki/setup-api.d.ts +1 -1
  438. package/dist/extensions/microsoft/index.d.ts +1 -1
  439. package/dist/extensions/microsoft/speech-provider.d.ts +1 -1
  440. package/dist/extensions/microsoft/test-api.d.ts +1 -1
  441. package/dist/extensions/microsoft-foundry/auth.d.ts +1 -1
  442. package/dist/extensions/microsoft-foundry/cli.d.ts +1 -1
  443. package/dist/extensions/microsoft-foundry/index.d.ts +1 -1
  444. package/dist/extensions/microsoft-foundry/onboard.d.ts +3 -3
  445. package/dist/extensions/microsoft-foundry/provider.d.ts +1 -1
  446. package/dist/extensions/microsoft-foundry/runtime.d.ts +1 -1
  447. package/dist/extensions/microsoft-foundry/shared-runtime.d.ts +1 -1
  448. package/dist/extensions/microsoft-foundry/shared.d.ts +1 -1
  449. package/dist/extensions/migrate-claude/apply.d.ts +1 -1
  450. package/dist/extensions/migrate-claude/apply.js +1 -1
  451. package/dist/extensions/migrate-claude/config.d.ts +1 -1
  452. package/dist/extensions/migrate-claude/helpers.d.ts +1 -1
  453. package/dist/extensions/migrate-claude/index.d.ts +1 -1
  454. package/dist/extensions/migrate-claude/index.js +1 -1
  455. package/dist/extensions/migrate-claude/memory.d.ts +2 -2
  456. package/dist/extensions/migrate-claude/plan.d.ts +1 -1
  457. package/dist/extensions/migrate-claude/plan.js +1 -1
  458. package/dist/extensions/migrate-claude/provider.d.ts +1 -1
  459. package/dist/extensions/migrate-claude/provider.js +1 -1
  460. package/dist/extensions/migrate-claude/skills.d.ts +2 -2
  461. package/dist/extensions/migrate-claude/targets.d.ts +1 -1
  462. package/dist/extensions/migrate-claude/targets.js +1 -1
  463. package/dist/extensions/migrate-hermes/apply.d.ts +1 -1
  464. package/dist/extensions/migrate-hermes/apply.js +1 -1
  465. package/dist/extensions/migrate-hermes/config.d.ts +1 -1
  466. package/dist/extensions/migrate-hermes/helpers.d.ts +1 -1
  467. package/dist/extensions/migrate-hermes/index.d.ts +1 -1
  468. package/dist/extensions/migrate-hermes/index.js +1 -1
  469. package/dist/extensions/migrate-hermes/items.d.ts +1 -1
  470. package/dist/extensions/migrate-hermes/model.d.ts +1 -1
  471. package/dist/extensions/migrate-hermes/model.js +1 -1
  472. package/dist/extensions/migrate-hermes/plan.d.ts +1 -1
  473. package/dist/extensions/migrate-hermes/plan.js +1 -1
  474. package/dist/extensions/migrate-hermes/provider.d.ts +1 -1
  475. package/dist/extensions/migrate-hermes/provider.js +1 -1
  476. package/dist/extensions/migrate-hermes/secrets.d.ts +2 -2
  477. package/dist/extensions/migrate-hermes/secrets.js +1 -1
  478. package/dist/extensions/migrate-hermes/skills.d.ts +2 -2
  479. package/dist/extensions/migrate-hermes/targets.d.ts +1 -1
  480. package/dist/extensions/migrate-hermes/targets.js +1 -1
  481. package/dist/extensions/minimax/index.d.ts +1 -1
  482. package/dist/extensions/minimax/provider-contract-api.d.ts +1 -1
  483. package/dist/extensions/minimax/provider-registration.d.ts +1 -1
  484. package/dist/extensions/minimax/speech-provider.d.ts +1 -1
  485. package/dist/extensions/mistral/embedding-provider.d.ts +1 -1
  486. package/dist/extensions/mistral/index.d.ts +1 -1
  487. package/dist/extensions/mistral/memory-embedding-adapter.d.ts +1 -1
  488. package/dist/extensions/mistral/realtime-transcription-provider.d.ts +1 -1
  489. package/dist/extensions/mistral/test-api.d.ts +1 -1
  490. package/dist/extensions/moonshot/index.d.ts +1 -1
  491. package/dist/extensions/moonshot/provider-contract-api.d.ts +1 -1
  492. package/dist/extensions/moonshot/provider-discovery.d.ts +1 -1
  493. package/dist/extensions/nvidia/index.d.ts +1 -1
  494. package/dist/extensions/oc-path/cli-metadata.d.ts +1 -1
  495. package/dist/extensions/oc-path/cli-registration.d.ts +1 -1
  496. package/dist/extensions/oc-path/index.d.ts +1 -1
  497. package/dist/extensions/ollama/api.d.ts +1 -1
  498. package/dist/extensions/ollama/index.d.ts +1 -1
  499. package/dist/extensions/ollama/provider-discovery.d.ts +1 -1
  500. package/dist/extensions/ollama/provider-policy-api.d.ts +1 -1
  501. package/dist/extensions/ollama/runtime-api.d.ts +1 -1
  502. package/dist/extensions/open-prose/index.d.ts +1 -1
  503. package/dist/extensions/open-prose/runtime-api.d.ts +2 -2
  504. package/dist/extensions/openai/api.d.ts +4 -4
  505. package/dist/extensions/openai/embedding-batch.d.ts +1 -1
  506. package/dist/extensions/openai/embedding-provider.d.ts +1 -1
  507. package/dist/extensions/openai/index.d.ts +1 -1
  508. package/dist/extensions/openai/memory-embedding-adapter.d.ts +1 -1
  509. package/dist/extensions/openai/openai-codex-oauth.runtime.d.ts +1 -1
  510. package/dist/extensions/openai/openai-codex-provider.d.ts +1 -1
  511. package/dist/extensions/openai/openai-provider.d.ts +1 -1
  512. package/dist/extensions/openai/prompt-overlay.d.ts +1 -1
  513. package/dist/extensions/openai/provider-contract-api.d.ts +1 -1
  514. package/dist/extensions/openai/provider-policy-api.d.ts +1 -1
  515. package/dist/extensions/openai/realtime-transcription-provider.d.ts +1 -1
  516. package/dist/extensions/openai/realtime-voice-provider.d.ts +1 -1
  517. package/dist/extensions/openai/register.runtime.d.ts +6 -6
  518. package/dist/extensions/openai/replay-policy.d.ts +1 -1
  519. package/dist/extensions/openai/setup-api.d.ts +1 -1
  520. package/dist/extensions/openai/shared.d.ts +3 -3
  521. package/dist/extensions/openai/speech-provider.d.ts +1 -1
  522. package/dist/extensions/openai/test-api.d.ts +3 -3
  523. package/dist/extensions/openai/thinking-policy.d.ts +1 -1
  524. package/dist/extensions/openai/transport-policy.d.ts +1 -1
  525. package/dist/extensions/opencode/index.d.ts +1 -1
  526. package/dist/extensions/opencode/provider-policy-api.d.ts +1 -1
  527. package/dist/extensions/opencode-go/index.d.ts +1 -1
  528. package/dist/extensions/opencode-go/provider-catalog.d.ts +1 -1
  529. package/dist/extensions/opencode-go/stream.d.ts +1 -1
  530. package/dist/extensions/openrouter/api.d.ts +1 -1
  531. package/dist/extensions/openrouter/index.d.ts +1 -1
  532. package/dist/extensions/openrouter/provider-contract-api.d.ts +1 -1
  533. package/dist/extensions/openrouter/provider-policy-api.d.ts +1 -1
  534. package/dist/extensions/openrouter/speech-provider.d.ts +1 -1
  535. package/dist/extensions/openrouter/stream.d.ts +1 -1
  536. package/dist/extensions/openrouter/test-api.d.ts +1 -1
  537. package/dist/extensions/openrouter/thinking-policy.d.ts +1 -1
  538. package/dist/extensions/openrouter/video-generation-provider.d.ts +1 -1
  539. package/dist/extensions/openrouter/video-model-catalog.d.ts +1 -1
  540. package/dist/extensions/perplexity/index.d.ts +1 -1
  541. package/dist/extensions/phone-control/index.d.ts +1 -1
  542. package/dist/extensions/phone-control/runtime-api.d.ts +2 -2
  543. package/dist/extensions/policy/api.js +1 -1
  544. package/dist/extensions/policy/index.d.ts +1 -1
  545. package/dist/extensions/policy/index.js +2 -2
  546. package/dist/extensions/qianfan/index.d.ts +1 -1
  547. package/dist/extensions/qwen/api.d.ts +1 -1
  548. package/dist/extensions/qwen/index.d.ts +1 -1
  549. package/dist/extensions/qwen/stream.d.ts +1 -1
  550. package/dist/extensions/qwen-dashscope/index.d.ts +1 -1
  551. package/dist/extensions/runway/index.d.ts +1 -1
  552. package/dist/extensions/searxng/index.d.ts +1 -1
  553. package/dist/extensions/senseaudio/index.d.ts +1 -1
  554. package/dist/extensions/sglang/index.d.ts +1 -1
  555. package/dist/extensions/signal/api.d.ts +2 -2
  556. package/dist/extensions/signal/api.js +6 -6
  557. package/dist/extensions/signal/channel-entry.d.ts +2 -2
  558. package/dist/extensions/signal/channel-plugin-api.d.ts +1 -1
  559. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  560. package/dist/extensions/signal/index.d.ts +2 -2
  561. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  562. package/dist/extensions/signal/runtime-api.d.ts +6 -6
  563. package/dist/extensions/signal/runtime-api.js +7 -7
  564. package/dist/extensions/signal/setup-entry.d.ts +2 -2
  565. package/dist/extensions/skill-workshop/api.d.ts +2 -2
  566. package/dist/extensions/skill-workshop/api.js +1 -1
  567. package/dist/extensions/skill-workshop/index.d.ts +1 -1
  568. package/dist/extensions/skill-workshop/index.js +2 -2
  569. package/dist/extensions/speech-core/api.d.ts +3 -3
  570. package/dist/extensions/speech-core/runtime-api.d.ts +2 -2
  571. package/dist/extensions/stepfun/index.d.ts +1 -1
  572. package/dist/extensions/synthetic/index.d.ts +1 -1
  573. package/dist/extensions/talk-voice/api.d.ts +2 -2
  574. package/dist/extensions/talk-voice/index.d.ts +1 -1
  575. package/dist/extensions/tavily/index.d.ts +1 -1
  576. package/dist/extensions/telegram/account-inspect-api.js +1 -1
  577. package/dist/extensions/telegram/api.d.ts +4 -4
  578. package/dist/extensions/telegram/api.js +11 -11
  579. package/dist/extensions/telegram/channel-plugin-api.d.ts +2 -2
  580. package/dist/extensions/telegram/channel-plugin-api.js +2 -2
  581. package/dist/extensions/telegram/contract-api.d.ts +1 -1
  582. package/dist/extensions/telegram/contract-api.js +3 -3
  583. package/dist/extensions/telegram/index.d.ts +2 -2
  584. package/dist/extensions/telegram/runtime-api.d.ts +5 -5
  585. package/dist/extensions/telegram/runtime-api.js +7 -7
  586. package/dist/extensions/telegram/security-audit-contract-api.js +1 -1
  587. package/dist/extensions/telegram/setup-entry.d.ts +2 -2
  588. package/dist/extensions/telegram/setup-plugin-api.d.ts +1 -1
  589. package/dist/extensions/telegram/setup-plugin-api.js +1 -1
  590. package/dist/extensions/telegram/test-api.js +2 -2
  591. package/dist/extensions/tencent/index.d.ts +1 -1
  592. package/dist/extensions/tencent/provider-discovery.d.ts +1 -1
  593. package/dist/extensions/thread-ownership/api.d.ts +2 -2
  594. package/dist/extensions/thread-ownership/index.d.ts +1 -1
  595. package/dist/extensions/together/index.d.ts +1 -1
  596. package/dist/extensions/tokenjuice/index.d.ts +1 -1
  597. package/dist/extensions/tokenjuice/tool-result-middleware.d.ts +1 -1
  598. package/dist/extensions/tts-local-cli/index.d.ts +1 -1
  599. package/dist/extensions/tts-local-cli/speech-provider.d.ts +1 -1
  600. package/dist/extensions/venice/index.d.ts +1 -1
  601. package/dist/extensions/venice/stream.d.ts +1 -1
  602. package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
  603. package/dist/extensions/vercel-ai-gateway/thinking.d.ts +1 -1
  604. package/dist/extensions/video-generation-core/api.d.ts +2 -2
  605. package/dist/extensions/video-generation-core/runtime-api.d.ts +1 -1
  606. package/dist/extensions/vllm/api.d.ts +1 -1
  607. package/dist/extensions/vllm/index.d.ts +1 -1
  608. package/dist/extensions/vllm/stream.d.ts +1 -1
  609. package/dist/extensions/volcengine/index.d.ts +1 -1
  610. package/dist/extensions/volcengine/provider-discovery.d.ts +1 -1
  611. package/dist/extensions/volcengine/speech-provider.d.ts +1 -1
  612. package/dist/extensions/voyage/embedding-batch.d.ts +1 -1
  613. package/dist/extensions/voyage/embedding-provider.d.ts +1 -1
  614. package/dist/extensions/voyage/index.d.ts +1 -1
  615. package/dist/extensions/voyage/memory-embedding-adapter.d.ts +1 -1
  616. package/dist/extensions/vydra/index.d.ts +1 -1
  617. package/dist/extensions/vydra/speech-provider.d.ts +1 -1
  618. package/dist/extensions/web-readability/index.d.ts +1 -1
  619. package/dist/extensions/webhooks/api.d.ts +2 -2
  620. package/dist/extensions/webhooks/api.js +1 -1
  621. package/dist/extensions/webhooks/index.d.ts +1 -1
  622. package/dist/extensions/webhooks/index.js +1 -1
  623. package/dist/extensions/webhooks/runtime-api.d.ts +1 -1
  624. package/dist/extensions/xai/api.d.ts +1 -1
  625. package/dist/extensions/xai/index.d.ts +1 -1
  626. package/dist/extensions/xai/index.js +4 -4
  627. package/dist/extensions/xai/provider-contract-api.d.ts +1 -1
  628. package/dist/extensions/xai/provider-discovery.d.ts +1 -1
  629. package/dist/extensions/xai/provider-models.d.ts +1 -1
  630. package/dist/extensions/xai/provider-policy-api.d.ts +1 -1
  631. package/dist/extensions/xai/realtime-transcription-provider.d.ts +1 -1
  632. package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
  633. package/dist/extensions/xai/setup-api.d.ts +1 -1
  634. package/dist/extensions/xai/speech-provider.d.ts +1 -1
  635. package/dist/extensions/xai/speech-provider.js +1 -1
  636. package/dist/extensions/xai/stream.d.ts +1 -1
  637. package/dist/extensions/xai/test-api.js +1 -1
  638. package/dist/extensions/xai/tts.js +1 -1
  639. package/dist/extensions/xai/web-search.js +1 -1
  640. package/dist/extensions/xai/xai-oauth.d.ts +1 -1
  641. package/dist/extensions/xai/xai-oauth.js +1 -1
  642. package/dist/extensions/xiaomi/index.d.ts +1 -1
  643. package/dist/extensions/xiaomi/speech-provider.d.ts +1 -1
  644. package/dist/extensions/xiaomi/stream.d.ts +1 -1
  645. package/dist/extensions/xiaomi/thinking.d.ts +1 -1
  646. package/dist/extensions/zai/index.d.ts +1 -1
  647. package/dist/file-fetch-tool-QFQ7QZQ9.js +124 -0
  648. package/dist/file-write-tool-znIJ5MOE.js +127 -0
  649. package/dist/format-B3nq4sfa.js +1145 -0
  650. package/dist/gateway/protocol/index.d.ts +1 -1
  651. package/dist/gateway-cli-D5nQafQi.js +435 -0
  652. package/dist/gateway-method-runtime-BXmOAMxN.js +21 -0
  653. package/dist/gateway-runtime-BRfyNjsE.d.ts +163 -0
  654. package/dist/gemini-cli-provider-2RAshvHZ.d.ts +6 -0
  655. package/dist/get-reply-DZK53szF.js +4689 -0
  656. package/dist/get-reply-from-config.runtime-Kx4GwLAA.js +2 -0
  657. package/dist/get-reply-from-config.runtime.js +1 -1
  658. package/dist/graph-users-CNpoBMLI.js +1419 -0
  659. package/dist/group-access-B-lpiIoP.js +112 -0
  660. package/dist/handle-action.guild-admin-D7AInszH.js +288 -0
  661. package/dist/harness-BPTKe2TG.js +61 -0
  662. package/dist/health-BkXVkm2H.js +4 -0
  663. package/dist/heartbeat-runner-Dbddl21A.js +5 -0
  664. package/dist/heartbeat-runner.runtime-CDmb7D-Q.js +4 -0
  665. package/dist/heartbeat-runner.runtime.js +1 -1
  666. package/dist/hooks-90WH7Tva.js +534 -0
  667. package/dist/http-registry-DydRvucX.d.ts +23 -0
  668. package/dist/image-generation-runtime-CYSxJAy2.d.ts +21 -0
  669. package/dist/inbound-direct-dm-runtime-bXneq4t0.js +2 -0
  670. package/dist/inbound-reply-dispatch-BVzOSvZX.js +148 -0
  671. package/dist/index-BFhfE749.d.ts +3971 -0
  672. package/dist/index.js +1 -1
  673. package/dist/init-DWgLcXq7.js +59 -0
  674. package/dist/inline-buttons-DtcEDZIV.js +40 -0
  675. package/dist/interactive-dispatch-CNUK2pZt.d.ts +56 -0
  676. package/dist/interactive-dispatch-DuuOPzwD.d.ts +143 -0
  677. package/dist/internal-events-D3SdlwzM.js +90 -0
  678. package/dist/isolated-agent-B9qCvLC4.js +1118 -0
  679. package/dist/isolated-agent-DaBWyrzI.js +2 -0
  680. package/dist/lifecycle-CfcTMzLT.js +571 -0
  681. package/dist/list.probe-aXBUfusA.js +449 -0
  682. package/dist/list.status-command-xrFMny0R.js +789 -0
  683. package/dist/llm-slug-generator-D5FE5osT.js +78 -0
  684. package/dist/llm-slug-generator.js +1 -1
  685. package/dist/loader-BKopCdPY.d.ts +142 -0
  686. package/dist/local-dispatch.runtime-0dOK_rcW.js +9 -0
  687. package/dist/local-dispatch.runtime.js +1 -1
  688. package/dist/manager-BrS--u6G.d.ts +356 -0
  689. package/dist/manager.runtime-pUdntZ2i.js +2714 -0
  690. package/dist/manager.runtime.js +1 -1
  691. package/dist/markdown-to-line-Cv0Gm132.js +811 -0
  692. package/dist/mcp-http-CaliRokB.js +555 -0
  693. package/dist/mcp-http-Dgcmuypw.js +2 -0
  694. package/dist/media-understanding-provider-Cu7iRaWL.js +339 -0
  695. package/dist/memory-core-host-engine-storage-DsNomsw4.d.ts +54 -0
  696. package/dist/memory-embedding-adapter-Ba-UYpWr.d.ts +5 -0
  697. package/dist/message-actions-BBiWyHuJ.js +145 -0
  698. package/dist/message-handler-VnxCCjy7.js +384 -0
  699. package/dist/message-handler-dNRhdkX3.js +1715 -0
  700. package/dist/message-handler.preflight-CREgYCNj.js +1125 -0
  701. package/dist/message-handler.process-DN93vvas.js +1484 -0
  702. package/dist/migration-DOuQeJ7P.d.ts +45 -0
  703. package/dist/model-Bp-W7fVB.js +74 -0
  704. package/dist/model-eEpAu59T.d.ts +33 -0
  705. package/dist/model-selection-CXTwfi0m.js +272 -0
  706. package/dist/models-BF1vdgHr.js +2 -0
  707. package/dist/models-DepHj1G3.d.ts +24 -0
  708. package/dist/models-DvbokHz4.js +104 -0
  709. package/dist/models-cli-B_zT7frv.js +256 -0
  710. package/dist/monitor-BoW4qfGV.js +834 -0
  711. package/dist/monitor-Bs8KSKu7.js +60 -0
  712. package/dist/monitor-DHgHadUx.js +1370 -0
  713. package/dist/monitor-DX7Ya0rb.js +715 -0
  714. package/dist/monitor-DlzBuqhN.js +2788 -0
  715. package/dist/monitor-DnzcdtYh.js +1657 -0
  716. package/dist/monitor-DwwFCaSy.js +4377 -0
  717. package/dist/monitor-auth-BRF9yj8s.js +179 -0
  718. package/dist/monitor-m5zwJU51.js +2 -0
  719. package/dist/monitor-polling.runtime-DXMM7v9c.js +883 -0
  720. package/dist/monitor-polling.runtime.js +1 -1
  721. package/dist/monitor-webhook.runtime-vNDAo7Yq.js +387 -0
  722. package/dist/monitor-webhook.runtime.js +1 -1
  723. package/dist/monitor.account-DT1JC2fm.js +5233 -0
  724. package/dist/monitor.runtime-BUw4UbJN.js +2 -0
  725. package/dist/monitor.runtime.js +1 -1
  726. package/dist/monitor.webhook-IBx7ZFi4.js +180 -0
  727. package/dist/node-cli-sessions-BJW0oB3s.js +1228 -0
  728. package/dist/openai-codex-provider-LwMbKOK1.d.ts +5 -0
  729. package/dist/openai-http-BX-DFq23.js +824 -0
  730. package/dist/openai-provider-F0nEHs4l.d.ts +5 -0
  731. package/dist/openresponses-http-BN6ztKxO.js +1173 -0
  732. package/dist/operations-DmaD-gxv.js +805 -0
  733. package/dist/outbound-adapter-v9Q4K2Bl.js +543 -0
  734. package/dist/outbound-session-route-BxhErAps.js +45 -0
  735. package/dist/outbound.runtime-ClUOK-Ir.js +2 -0
  736. package/dist/outbound.runtime.js +1 -1
  737. package/dist/pi-embedded-CG0u988w.js +4 -0
  738. package/dist/pi-embedded-D7UoOQFj.js +3796 -0
  739. package/dist/pi-embedded.runtime-CKNVJdm9.js +4 -0
  740. package/dist/pi-embedded.runtime.js +1 -1
  741. package/dist/pi-tools-DP7eGHq-.js +2413 -0
  742. package/dist/plan-BD5JNOvV.js +81 -0
  743. package/dist/plan-BSDlELnX.js +112 -0
  744. package/dist/plugin-4bygXnMD.js +12396 -0
  745. package/dist/plugin-BW5kVZrl.d.ts +17 -0
  746. package/dist/plugin-app-cache-key-BfaJYLXl.js +46 -0
  747. package/dist/plugin-enabled-44kWBMek.js +233 -0
  748. package/dist/plugin-entry-oVFfOYI7.d.ts +47 -0
  749. package/dist/plugin-registration-DoD5ARyg.js +88 -0
  750. package/dist/plugin-runtime-Bx8TuYU5.d.ts +117 -0
  751. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  752. package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
  753. package/dist/plugin-sdk/acp-runtime.js +2 -2
  754. package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
  755. package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
  756. package/dist/plugin-sdk/agent-harness.js +7 -7
  757. package/dist/plugin-sdk/agent-runtime.js +2 -2
  758. package/dist/plugin-sdk/channel-core.js +2 -2
  759. package/dist/plugin-sdk/channel-inbound.js +2 -2
  760. package/dist/plugin-sdk/channel-test-helpers.js +1 -1
  761. package/dist/plugin-sdk/command-auth.js +1 -1
  762. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  763. package/dist/plugin-sdk/compat.js +1 -1
  764. package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
  765. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  766. package/dist/plugin-sdk/core.js +2 -2
  767. package/dist/plugin-sdk/direct-dm.js +1 -1
  768. package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
  769. package/dist/plugin-sdk/health.js +2 -2
  770. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  771. package/dist/plugin-sdk/index.js +1 -1
  772. package/dist/plugin-sdk/mattermost.js +1 -1
  773. package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
  774. package/dist/plugin-sdk/provider-test-contracts.js +4 -4
  775. package/dist/plugin-sdk/reply-runtime.js +4 -4
  776. package/dist/plugin-sdk/testing.js +2 -2
  777. package/dist/plugin-sdk/zalouser.js +1 -1
  778. package/dist/plugin-service-CJqwjPRa.js +1229 -0
  779. package/dist/plugin-service-W6IMgQjk.d.ts +24 -0
  780. package/dist/plugins/build-smoke-entry.d.ts +2 -2
  781. package/dist/plugins/loader.d.ts +1 -1
  782. package/dist/plugins/provider-discovery.runtime.d.ts +1 -1
  783. package/dist/plugins/provider-runtime.runtime.d.ts +1 -1
  784. package/dist/plugins/runtime/index.js +4 -4
  785. package/dist/policy-C2YDmnm2.js +138 -0
  786. package/dist/policy-CYBwtJmM.js +680 -0
  787. package/dist/prepare.runtime-B9SQyzSp.js +732 -0
  788. package/dist/prepare.runtime.js +1 -1
  789. package/dist/preview-warnings-DkMoGKdo.js +392 -0
  790. package/dist/probe-BYucGf4s.js +682 -0
  791. package/dist/probe-D8YoJ89r.js +2204 -0
  792. package/dist/probe-DKinNcah.js +47 -0
  793. package/dist/probe-DSYRrw81.js +2 -0
  794. package/dist/program-MtNU1_sG.js +131 -0
  795. package/dist/prompt-overlay-CaXYKmjI.d.ts +23 -0
  796. package/dist/provider-26ZZeAkw.js +32 -0
  797. package/dist/provider-BtNK1WFZ.js +8735 -0
  798. package/dist/provider-CfJzlnOm.js +32 -0
  799. package/dist/provider-Dl-E4_a8.js +152 -0
  800. package/dist/provider-api-key-auth-DOu4GJBt.d.ts +27 -0
  801. package/dist/provider-auth-result-CO9yqIJ_.d.ts +21 -0
  802. package/dist/provider-catalog-runtime-f_87intf.d.ts +23 -0
  803. package/dist/provider-catalog-shared-CXZnqdym.d.ts +62 -0
  804. package/dist/provider-dispatcher-CAaa54DQ.js +22 -0
  805. package/dist/provider-dispatcher.runtime.js +1 -1
  806. package/dist/provider-hook-runtime-o2J0hqhZ.d.ts +61 -0
  807. package/dist/provider-model-shared-CsZtXE0W.d.ts +143 -0
  808. package/dist/provider-models-BbjvK4gF.d.ts +12 -0
  809. package/dist/provider-policy-BwZykYqb.d.ts +30 -0
  810. package/dist/provider-registration-CytP1d9Y.d.ts +6 -0
  811. package/dist/provider-registry-Ct1dA5S3.d.ts +8 -0
  812. package/dist/provider-registry-DgEFqiK2.d.ts +30 -0
  813. package/dist/provider-registry-Dilmwbu_.d.ts +8 -0
  814. package/dist/provider-runtime-ChO01VYW.d.ts +359 -0
  815. package/dist/provider-self-hosted-setup-DCeKR5ZH.d.ts +74 -0
  816. package/dist/provider-session.runtime-DDMGL25I.js +9 -0
  817. package/dist/provider-session.runtime.js +1 -1
  818. package/dist/provider-stream-CrWY0s8C.d.ts +140 -0
  819. package/dist/provider-stream-shared-CgnrFxMf.d.ts +128 -0
  820. package/dist/provider.runtime-CUdlREry.js +2 -0
  821. package/dist/provider.runtime.js +1 -1
  822. package/dist/providers.runtime-CiX4UePR.d.ts +25 -0
  823. package/dist/public-surface-loader-iYUvHxzC.js +114 -0
  824. package/dist/pw-ai-DQjpZTSa.js +3029 -0
  825. package/dist/pw-role-snapshot-DgavoGdC.js +333 -0
  826. package/dist/reaction-level-uiCaLj0m.js +19 -0
  827. package/dist/reaction-runtime-api-ErmZKqXv.js +116 -0
  828. package/dist/realtime-transcription-abdbHd8R.d.ts +43 -0
  829. package/dist/realtime-transcription-provider-CPK7XYp9.d.ts +5 -0
  830. package/dist/realtime-transcription-provider-DC2AscwX.d.ts +32 -0
  831. package/dist/realtime-transcription-provider-Dg5t03mY.d.ts +28 -0
  832. package/dist/realtime-transcription-provider-UesXbEwy.d.ts +37 -0
  833. package/dist/realtime-transcription-provider-tLRMgcYk.js +205 -0
  834. package/dist/realtime-voice-D1aiUBBt.d.ts +333 -0
  835. package/dist/realtime-voice-provider-D5DZsLRA.d.ts +5 -0
  836. package/dist/register-DxldPhbz.js +2178 -0
  837. package/dist/register.agent-B9171wFk.js +156 -0
  838. package/dist/register.crestodian-plvra03q.js +24 -0
  839. package/dist/register.maintenance-BLH-PhXR.js +105 -0
  840. package/dist/register.runtime-CAW8ORTZ.d.ts +6 -0
  841. package/dist/register.runtime-CnuNQn65.js +54 -0
  842. package/dist/register.subclis-C9TqTF1g.js +3 -0
  843. package/dist/register.subclis-core-B4RLAWNE.js +273 -0
  844. package/dist/register.subclis-zvycA0fS.js +31 -0
  845. package/dist/registry-paAkM8At.d.ts +91 -0
  846. package/dist/registry-types-DSJvRhBP.d.ts +392 -0
  847. package/dist/repair-sequencing-3Q95ftKn.js +640 -0
  848. package/dist/reply-delivery-BYtyofYM.js +196 -0
  849. package/dist/reply-runtime-P6EiRGYz.js +11 -0
  850. package/dist/reply.runtime-Kx4GwLAA.js +2 -0
  851. package/dist/reply.runtime.js +1 -1
  852. package/dist/request-B8_J1Hk5.js +54 -0
  853. package/dist/resolve-allowlist-BHhr7pGG.js +220 -0
  854. package/dist/result-fallback-classifier-v1BgnJLN.js +79 -0
  855. package/dist/route-Dl0ZJvrW.js +469 -0
  856. package/dist/route-resolution-mVRyzqn_.js +274 -0
  857. package/dist/routes-B8uiTXHO.js +3602 -0
  858. package/dist/routes-Bjw1nWyB.js +2 -0
  859. package/dist/run-attempt-DKRsY7Xs.js +7704 -0
  860. package/dist/run-command-Bs2y31Ew.js +2 -0
  861. package/dist/run-command-CBDF_cGB.js +23 -0
  862. package/dist/run-embedded.runtime-2GWQN_Qf.js +4 -0
  863. package/dist/run-embedded.runtime.js +1 -1
  864. package/dist/run-execution-cli.runtime-BEXMdwL2.js +4 -0
  865. package/dist/run-execution-cli.runtime.js +1 -1
  866. package/dist/run-executor.runtime.js +1 -1
  867. package/dist/run-rMTtvEMF.js +1163 -0
  868. package/dist/run-subagent-registry.runtime-CBmgh09W.js +2 -0
  869. package/dist/run-subagent-registry.runtime.js +1 -1
  870. package/dist/runtime-DFBt4ZZw.js +1287 -0
  871. package/dist/runtime-DQV1yYF5.js +6179 -0
  872. package/dist/runtime-api-B6S-7TVS.js +3 -0
  873. package/dist/runtime-api-BLV9PO47.js +24 -0
  874. package/dist/runtime-api-BX1AvShq.js +17 -0
  875. package/dist/runtime-api-BnN22IWf.js +13 -0
  876. package/dist/runtime-api-BsmZgGnI.js +21 -0
  877. package/dist/runtime-api-CJ6x4Uuu.js +13 -0
  878. package/dist/runtime-api-DTdQMFV-.d.ts +3151 -0
  879. package/dist/runtime-api-DXCKXAYu.js +4 -0
  880. package/dist/runtime-api.actions-C9Jtoruo.js +3 -0
  881. package/dist/runtime-api.monitor-slWfxEgT.js +6 -0
  882. package/dist/runtime-api.send-D_auPJG_.js +4 -0
  883. package/dist/runtime-api.threads-BWzc1vrN.js +2 -0
  884. package/dist/runtime-channel-BOnbxldg.js +2 -0
  885. package/dist/runtime-channel-Dh45Bl_Q.js +150 -0
  886. package/dist/runtime-embedded-pi.runtime-BVjCGIqB.js +2 -0
  887. package/dist/runtime-embedded-pi.runtime.js +1 -1
  888. package/dist/runtime-hYOWxRKE.js +438 -0
  889. package/dist/runtime-taskflow-BYZsMg1i.d.ts +435 -0
  890. package/dist/sanitize-outbound-CP-twYgG.js +127 -0
  891. package/dist/sdk-setup-tools-Cfh-ATXD.js +8 -0
  892. package/dist/secrets-DcQ7WBB-.js +113 -0
  893. package/dist/security-audit-CwMh7ULQ.js +118 -0
  894. package/dist/security-audit-yRC5cfp1.js +122 -0
  895. package/dist/security-audit.runtime-COitYvaV.js +2 -0
  896. package/dist/security-audit.runtime.js +1 -1
  897. package/dist/selection-C_swgArS.js +3 -0
  898. package/dist/selection-Cud_xC6-.js +16157 -0
  899. package/dist/send-BXTj6QIe.js +143 -0
  900. package/dist/send-Be-rQ3Py.js +1631 -0
  901. package/dist/send-DrSo2pTm.js +192 -0
  902. package/dist/send-un_jKNYG.js +2 -0
  903. package/dist/send.components-C0ugXCvj.js +500 -0
  904. package/dist/send.components-CaHcQCve.js +2 -0
  905. package/dist/send.runtime-CcGjdPIe.js +2 -0
  906. package/dist/send.runtime.js +1 -1
  907. package/dist/server-Belw8J0P.js +24 -0
  908. package/dist/server-CbbbWl0g.js +73 -0
  909. package/dist/server-close.runtime.d.ts +1 -1
  910. package/dist/server-close.runtime.js +1 -1
  911. package/dist/server-context-D5PPz4pG.js +955 -0
  912. package/dist/server-context-DfiZrO39.js +2 -0
  913. package/dist/server-cron-B4uqojsc.js +2989 -0
  914. package/dist/server-cron-D5ofhC2R.js +2 -0
  915. package/dist/server-methods-BtrFcSCY.js +16499 -0
  916. package/dist/server-node-events-B7f6W47S.js +596 -0
  917. package/dist/server-plugin-bootstrap-CldF7ied.js +70 -0
  918. package/dist/server-plugins-BkRL48_Y.js +432 -0
  919. package/dist/server-reload-handlers-CmD463eg.js +714 -0
  920. package/dist/server-restart-sentinel-1-GltJOW.js +2 -0
  921. package/dist/server-restart-sentinel-BAc6ad7u.js +747 -0
  922. package/dist/server-runtime-services-DdDWPwwJ.js +2 -0
  923. package/dist/server-runtime-services-q4vtzdgR.js +267 -0
  924. package/dist/server-startup-plugins-RDIvIW1b.js +113 -0
  925. package/dist/server-startup-post-attach-B-Bcz1b8.js +716 -0
  926. package/dist/server-ws-runtime-ClfNa1gj.js +349 -0
  927. package/dist/server.impl-5A5eWz1g.js +2587 -0
  928. package/dist/service-BIi_LAz_.js +1446 -0
  929. package/dist/session-binding-DxgaaGZ8.js +219 -0
  930. package/dist/session-binding-SoSof-ir.js +2 -0
  931. package/dist/session-kill-http-CpA7WXXP.js +121 -0
  932. package/dist/session-reset-service-MBceWYbr.js +625 -0
  933. package/dist/session-route-SMerc1ZF.js +93 -0
  934. package/dist/session-status.runtime-C1MOnm-1.js +2 -0
  935. package/dist/session-status.runtime.js +1 -1
  936. package/dist/session-subagent-reactivation.runtime-Cca41-p8.js +2 -0
  937. package/dist/session-subagent-reactivation.runtime.js +1 -1
  938. package/dist/session-tab-registry-BL8A9tMR.js +521 -0
  939. package/dist/sessions-history-http-Cb21uPHU.js +430 -0
  940. package/dist/sessions.runtime-ClHkmNrd.js +2 -0
  941. package/dist/sessions.runtime.js +1 -1
  942. package/dist/setup-api-CwKuO7ZG.js +29 -0
  943. package/dist/setup-core-C8_XbMIV.js +174 -0
  944. package/dist/setup-surface-B3m7rAoM.js +405 -0
  945. package/dist/setup-surface-BstaBVou.js +320 -0
  946. package/dist/setup-surface-C5L8UmIu.js +221 -0
  947. package/dist/setup-surface-DwijXcOh.js +288 -0
  948. package/dist/shared-DdLk0hA6.d.ts +115 -0
  949. package/dist/shared-DemthgnG.js +121 -0
  950. package/dist/shared-client-CLvetNfK.js +2 -0
  951. package/dist/shared-client-CR88Qth4.js +629 -0
  952. package/dist/side-question-BKRlgFVG.js +683 -0
  953. package/dist/simple-completion-runtime-D3vYpwbZ.d.ts +73 -0
  954. package/dist/skill-tool-dispatch.runtime-Bsz4SNiK.js +143 -0
  955. package/dist/skill-tool-dispatch.runtime.js +1 -1
  956. package/dist/slash-state-Cbb2tkH9.js +2166 -0
  957. package/dist/speech-Cf7RmLix.d.ts +47 -0
  958. package/dist/speech-core-BWd27MY5.d.ts +36 -0
  959. package/dist/speech-provider-Csdu9pW1.d.ts +5 -0
  960. package/dist/speech-provider-D4v4Jv2s.d.ts +34 -0
  961. package/dist/speech-provider-Dj7nG9do.d.ts +5 -0
  962. package/dist/speech-provider-DnyUKHSU.d.ts +5 -0
  963. package/dist/speech-provider-MoJPg1gB.d.ts +8 -0
  964. package/dist/speech-provider-hT52upCX.d.ts +8 -0
  965. package/dist/speech-provider-hqhi426N.js +184 -0
  966. package/dist/src-wxYdKry6.js +4256 -0
  967. package/dist/startup-context-CidK9XK8.js +313 -0
  968. package/dist/status-subagents.runtime-DgYNfrbK.js +18 -0
  969. package/dist/status-subagents.runtime.js +1 -1
  970. package/dist/status-text-w43pGoDJ.js +296 -0
  971. package/dist/sticker-cache-BdIkkDGC.js +206 -0
  972. package/dist/sticker-vision.runtime-bmccn4BW.js +17 -0
  973. package/dist/sticker-vision.runtime.js +1 -1
  974. package/dist/stream-BVr9Y5Fk.d.ts +19 -0
  975. package/dist/stream-C5ugQLbM.d.ts +10 -0
  976. package/dist/stream-CDDV9-Wq.d.ts +5 -0
  977. package/dist/stream-D3ZhJVM7.d.ts +16 -0
  978. package/dist/stream-Dhh55ncO.d.ts +120 -0
  979. package/dist/stream-wrappers-PZu4IPG2.d.ts +21 -0
  980. package/dist/subagent-announce-Cig5R7bU.js +354 -0
  981. package/dist/subagent-announce-delivery-DElem-jW.js +958 -0
  982. package/dist/subagent-control-Dx1qbt2M.js +508 -0
  983. package/dist/subagent-hooks-03ne_B1P.js +2 -0
  984. package/dist/subagent-hooks-BW4tdl1N.js +116 -0
  985. package/dist/subagent-hooks-BdADgqQH.js +2 -0
  986. package/dist/subagent-hooks-D5ZUfS0C.js +146 -0
  987. package/dist/subagent-hooks-DKEWsBSa.js +230 -0
  988. package/dist/subagent-hooks-api-BNJpIv9Q.js +23 -0
  989. package/dist/subagent-hooks-api-BXE-a9iQ.js +22 -0
  990. package/dist/subagent-hooks-api-w7wOpXSR.js +23 -0
  991. package/dist/subagent-hooks-kf263oYw.js +2 -0
  992. package/dist/subagent-orphan-recovery-TGLIuI1K.js +352 -0
  993. package/dist/subagent-registry-Bai39rEv.js +3 -0
  994. package/dist/subagent-registry-vgjMT_I1.js +2351 -0
  995. package/dist/subagent-registry.runtime.js +1 -1
  996. package/dist/subagent-session-cleanup-PEEQtuLS.js +525 -0
  997. package/dist/subagent-spawn-2TTDQg5Y.js +1164 -0
  998. package/dist/target-id-BgSzF2Lk.js +107 -0
  999. package/dist/targets-Bd9-WGJt.js +19 -0
  1000. package/dist/targets-CdiGPFGr.d.ts +10 -0
  1001. package/dist/targets-DxKwMzNB.js +44 -0
  1002. package/dist/targets-DzdYRUSR.js +19 -0
  1003. package/dist/targets-ZJ1ZRt5L.d.ts +10 -0
  1004. package/dist/task-registry-control.runtime.js +1 -1
  1005. package/dist/telegram/token.js +1 -1
  1006. package/dist/testing-B6jLjq4r.js +267 -0
  1007. package/dist/thinking-policy-CAsew9b-.d.ts +5 -0
  1008. package/dist/thread-bindings-BumrOVO8.js +571 -0
  1009. package/dist/thread-bindings-C4yc8CZT.js +228 -0
  1010. package/dist/thread-bindings-Dkeit03N.js +8 -0
  1011. package/dist/thread-bindings-FVOv7g2T.js +232 -0
  1012. package/dist/thread-bindings.discord-api-D83vw86t.js +187 -0
  1013. package/dist/thread-bindings.manager-DEqfX4rc.js +2 -0
  1014. package/dist/thread-bindings.manager-LOMmQ1pN.js +536 -0
  1015. package/dist/thread-lifecycle-CGFgul5c.js +1614 -0
  1016. package/dist/token-CoB7XxKt.js +134 -0
  1017. package/dist/tool-CIfIAkxV.js +139 -0
  1018. package/dist/tool-actions.runtime-BrVxKuRd.js +534 -0
  1019. package/dist/tool-actions.runtime.js +1 -1
  1020. package/dist/tool-plugin-B18esZUX.d.ts +77 -0
  1021. package/dist/tool-resolution-BWdOXsX0.js +149 -0
  1022. package/dist/tool-split-_O9ZqSIU.d.ts +19 -0
  1023. package/dist/tools-effective-inventory-CW8_FJBN.js +204 -0
  1024. package/dist/tools-invoke-http-CYJCHpxL.js +67 -0
  1025. package/dist/tools-invoke-shared-SnaEXvuz.js +200 -0
  1026. package/dist/transport-stream-Piw1coFu.d.ts +42 -0
  1027. package/dist/tts-5p3qPz-P.js +66 -0
  1028. package/dist/tui-BYTSFA_c.js +4709 -0
  1029. package/dist/tui-LOGspKbe.js +2 -0
  1030. package/dist/tui-backend-C8nbqNLo.js +256 -0
  1031. package/dist/tui-cli-C91LywYY.js +37 -0
  1032. package/dist/types--mFsqUEV.d.ts +786 -0
  1033. package/dist/types-CcjGrBF52.d.ts +3650 -0
  1034. package/dist/types.public-rJrhXChy.d.ts +70 -0
  1035. package/dist/update-cli-DZuYe1aX.js +3665 -0
  1036. package/dist/update-global-ucSOAIga.js +606 -0
  1037. package/dist/update-runner-2pS-KlSn.js +1798 -0
  1038. package/dist/video-generation-runtime-CA2LiNwu.d.ts +21 -0
  1039. package/dist/video-model-catalog-BJ9GJKrw.d.ts +16 -0
  1040. package/dist/vision-tools-mJMJD3Yw.js +1409 -0
  1041. package/dist/web-search-BZgc3DQT.js +62 -0
  1042. package/dist/web-search-provider.runtime-BgoF9yna.js +328 -0
  1043. package/dist/web-search-provider.runtime-D1lmfAbp.js +2 -0
  1044. package/dist/web-search-provider.runtime.js +1 -1
  1045. package/dist/webhook-targets-B_syT8-q.d.ts +99 -0
  1046. package/dist/xai-oauth-B-LPhpsk.js +479 -0
  1047. package/dist/xai-user-agent-B0F4Hyt5.js +32 -0
  1048. package/dist/zod-schema.core-Bwbyyd_y.d.ts +166 -0
  1049. package/npm-shrinkwrap.json +2 -2
  1050. package/package.json +1 -1
  1051. package/dist/abort-BtS5AfJG.js +0 -277
  1052. package/dist/abort.runtime-D211494J.js +0 -2
  1053. package/dist/account-inspect-BqAxH1Q_.js +0 -173
  1054. package/dist/accounts-2VYKksau.js +0 -107
  1055. package/dist/accounts-B6aVCtty.js +0 -119
  1056. package/dist/accounts-CE6mvWMC.js +0 -2
  1057. package/dist/accounts-eprn8x0M.js +0 -107
  1058. package/dist/acp-runtime-C_0NA0CS.js +0 -26
  1059. package/dist/acp-spawn-CTmucfK5.js +0 -2
  1060. package/dist/acp-spawn-DcTgPZQB.js +0 -1275
  1061. package/dist/acp-stateful-target-driver-DVWNxIEX.js +0 -89
  1062. package/dist/action-kill-C6NRFglx.js +0 -33
  1063. package/dist/action-runtime-BaKOu7uV.js +0 -469
  1064. package/dist/action-runtime-api-QC43ZgvC.js +0 -2
  1065. package/dist/action-send-B790BH2g.js +0 -39
  1066. package/dist/action-spawn-Dgf97JGp.js +0 -47
  1067. package/dist/actions-DhY0Hqxd.js +0 -161
  1068. package/dist/actions.runtime-BfdjoY4f.js +0 -5
  1069. package/dist/agent-C1VC8waN.js +0 -3
  1070. package/dist/agent-DuLat04d.js +0 -2
  1071. package/dist/agent-command-BQ2JuYpP.js +0 -1367
  1072. package/dist/agent-components.runtime-BskyK1iq.js +0 -10
  1073. package/dist/agent-harness-Bt_1zRJ1.d.ts +0 -146
  1074. package/dist/agent-harness-runtime-CsWVHhWd.d.ts +0 -691
  1075. package/dist/agent-harness-runtime-l4d66klL.js +0 -180
  1076. package/dist/agent-harness-task-runtime-D5vhG7mw.js +0 -140
  1077. package/dist/agent-runner-execution-DKJ7YE9g.js +0 -1713
  1078. package/dist/agent-runner-utils-BOJEvwHI.js +0 -266
  1079. package/dist/agent-runner.runtime-BAC7XlZX.js +0 -3455
  1080. package/dist/agent-runtime-D8J3kngS.js +0 -229
  1081. package/dist/agent-via-gateway-BPZeOgET.js +0 -463
  1082. package/dist/api-2J3KsQlI.js +0 -2
  1083. package/dist/api-BNZFdrOx.js +0 -639
  1084. package/dist/api-CQY8p5l4.js +0 -134
  1085. package/dist/api-CdIYfiOh.js +0 -3
  1086. package/dist/api-D5uGvU4G.d.ts +0 -52
  1087. package/dist/api-DaLfnqrr.js +0 -2
  1088. package/dist/api-DzpDMEqm.js +0 -6
  1089. package/dist/apply-DTkOJDSZ.js +0 -54
  1090. package/dist/apply-DY6Ov6qF.js +0 -41
  1091. package/dist/approval-handler.runtime-9W6kSKLn.js +0 -130
  1092. package/dist/assistant-D338eQWk.js +0 -291
  1093. package/dist/attachment-normalize-BaGndElX.js +0 -225
  1094. package/dist/attempt-execution-aOkjnMht.js +0 -558
  1095. package/dist/attempt-execution.runtime-lKPuGjsg.js +0 -3
  1096. package/dist/attempt-execution.shared-lwEBnvQR.js +0 -38
  1097. package/dist/attempt.prompt-helpers-BVDwNazv.js +0 -475
  1098. package/dist/attempt.tool-run-context-DXgP_TxW.js +0 -2094
  1099. package/dist/binding-routing-CA-u9MaB.js +0 -113
  1100. package/dist/binding-targets-SGf9XyYl.js +0 -121
  1101. package/dist/bot-C0uHsCiq.js +0 -7894
  1102. package/dist/bot-deps-CfqgukPx.js +0 -747
  1103. package/dist/bot-deps-D0dGR0Um.js +0 -2
  1104. package/dist/bot-message-context.runtime-aqONyuCb.js +0 -7
  1105. package/dist/bot-message-context.session.runtime-CYJpmbne.js +0 -12
  1106. package/dist/bot-native-commands.delivery.runtime-DjCvDhXo.js +0 -4
  1107. package/dist/bot-native-commands.runtime-CNDOgqnt.js +0 -13
  1108. package/dist/bridge-server-DX39VTjh.js +0 -113
  1109. package/dist/browser-cli-BM0neIBN.js +0 -2
  1110. package/dist/browser-cli-TjkCzsOd.js +0 -230
  1111. package/dist/browser-cli-actions-input-Crdngwmz.js +0 -473
  1112. package/dist/browser-cli-actions-observe-CR0DTzDP.js +0 -81
  1113. package/dist/browser-cli-debug-CC9OYHxx.js +0 -137
  1114. package/dist/browser-cli-inspect-DVWu-CO3.js +0 -104
  1115. package/dist/browser-cli-manage-BfSgA18U.js +0 -443
  1116. package/dist/browser-cli-resize-ddNFsnFm.js +0 -26
  1117. package/dist/browser-cli-shared-B_5TDXXY.js +0 -50
  1118. package/dist/browser-cli-state-CnLWkvHn.js +0 -337
  1119. package/dist/browser-control-auth-1gcUHgnp.js +0 -2
  1120. package/dist/browser-profiles-BkIb0hYP.js +0 -2
  1121. package/dist/browser-runtime-RQ9H-pQ2.js +0 -384
  1122. package/dist/build-C3ote3YU.js +0 -257
  1123. package/dist/bundled-channel-config-schema-4eXcH-RE.d.ts +0 -3163
  1124. package/dist/call-DY6_VEa_.d.ts +0 -43
  1125. package/dist/capability-cli-D2fTtzuV.js +0 -1782
  1126. package/dist/channel-B0dtLI6U.d.ts +0 -49
  1127. package/dist/channel-B2MLRCOm.d.ts +0 -106
  1128. package/dist/channel-B4XBSqBl.d.ts +0 -7
  1129. package/dist/channel-BC3xWers.js +0 -808
  1130. package/dist/channel-BJFPY0Kt.js +0 -376
  1131. package/dist/channel-BMVs8cLm.js +0 -740
  1132. package/dist/channel-BNmekEHv.js +0 -508
  1133. package/dist/channel-BnPanYUC.js +0 -562
  1134. package/dist/channel-BompXOlb.js +0 -1134
  1135. package/dist/channel-Bq3wyp3c.d.ts +0 -8
  1136. package/dist/channel-BwdtLWWj.js +0 -1556
  1137. package/dist/channel-C1AEDysJ.d.ts +0 -47
  1138. package/dist/channel-CEH1dfVt.d.ts +0 -12
  1139. package/dist/channel-CQJHudhH.d.ts +0 -114
  1140. package/dist/channel-CUu3R9QU.d.ts +0 -14
  1141. package/dist/channel-CaugIi5d.js +0 -481
  1142. package/dist/channel-CsdkcuzU.d.ts +0 -7
  1143. package/dist/channel-D-QJ4LSf.d.ts +0 -28
  1144. package/dist/channel-D07QdL-Z.d.ts +0 -8
  1145. package/dist/channel-D1AKh1-N.d.ts +0 -6
  1146. package/dist/channel-D7LE0yXG.js +0 -653
  1147. package/dist/channel-DBucF-mL.js +0 -1496
  1148. package/dist/channel-DC98b13r.js +0 -238
  1149. package/dist/channel-DECcAIqn.d.ts +0 -104
  1150. package/dist/channel-DGWSLAgs.js +0 -1249
  1151. package/dist/channel-DHk6PKNy.js +0 -362
  1152. package/dist/channel-DZW76PDC.d.ts +0 -8
  1153. package/dist/channel-Dqyy2G9y.js +0 -955
  1154. package/dist/channel-DwSP9REc.d.ts +0 -64
  1155. package/dist/channel-LKyGksmz.d.ts +0 -26
  1156. package/dist/channel-Z-wTsii5.js +0 -1777
  1157. package/dist/channel-_B9ZXRPx.js +0 -867
  1158. package/dist/channel-actions.runtime-C3lWtJBL.js +0 -265
  1159. package/dist/channel-cGJKLfJe.d.ts +0 -427
  1160. package/dist/channel-core-B3Xqnnjw.js +0 -5
  1161. package/dist/channel-core-DshTARNf.d.ts +0 -6
  1162. package/dist/channel-entry-contract-DpdwxgOw.d.ts +0 -112
  1163. package/dist/channel-inbound-BnUDIbdQ.js +0 -80
  1164. package/dist/channel-plugin-runtime-CFKbI6Pu.js +0 -998
  1165. package/dist/channel-plugin-runtime-CS0_tyOZ.d.ts +0 -7
  1166. package/dist/channel-runtime-BLFYOC-l.js +0 -408
  1167. package/dist/channel-yBZ1hu-c.js +0 -2126
  1168. package/dist/channel.runtime-BMBFwVOB.js +0 -1008
  1169. package/dist/channel.runtime-BPaTa_4p.js +0 -4
  1170. package/dist/channel.runtime-BiOmO6NR.js +0 -254
  1171. package/dist/channel.runtime-BmwN1CYk.js +0 -652
  1172. package/dist/channel.runtime-C5JA3DOQ.js +0 -21009
  1173. package/dist/channel.runtime-CWmegcjl.js +0 -109
  1174. package/dist/channel.runtime-DDs1y218.js +0 -733
  1175. package/dist/channel.runtime-DJMJ7DxI.js +0 -88
  1176. package/dist/channel.runtime-Dr7_P-K2.js +0 -2528
  1177. package/dist/channel.setup-B03MiH5Q.d.ts +0 -6
  1178. package/dist/channel.setup-BRhsffda.js +0 -10
  1179. package/dist/channel.setup-ByuZMttY.d.ts +0 -8
  1180. package/dist/channel.setup-C74nA6R0.js +0 -343
  1181. package/dist/channel.setup-CIlbvWjW.d.ts +0 -7
  1182. package/dist/channel.setup-RbyDP1dD.js +0 -1098
  1183. package/dist/chat-CGdonziw.js +0 -2666
  1184. package/dist/chrome-BbE0579R.js +0 -1503
  1185. package/dist/cli-CJkC6ybf.js +0 -1341
  1186. package/dist/cli-backend-Dg9IEgrP.d.ts +0 -5
  1187. package/dist/cli-backend-DwmYGZX7.d.ts +0 -5
  1188. package/dist/cli-compaction-D7zwr6if.js +0 -347
  1189. package/dist/cli-metadata-gL02qQsZ.js +0 -22
  1190. package/dist/cli-pk6gIQfi.d.ts +0 -20
  1191. package/dist/cli-runner-DTqOC0Ap.js +0 -540
  1192. package/dist/cli-runner-DX7wbmT5.js +0 -2
  1193. package/dist/cli-runner.runtime-CMFns61M.js +0 -4
  1194. package/dist/cli-runner.runtime-DH0Kp9FZ.js +0 -3
  1195. package/dist/cli-shared-C_4_xNC-.d.ts +0 -20
  1196. package/dist/client-B763Tol6.js +0 -650
  1197. package/dist/client-adapter-WxKxH6x-.js +0 -897
  1198. package/dist/client-factory-00sxHiJF.js +0 -9
  1199. package/dist/command-auth-CXYQ5Z0j.js +0 -135
  1200. package/dist/command-handlers-D1Ac0Dkj.js +0 -1609
  1201. package/dist/command-registry-D2dsDDz5.js +0 -9
  1202. package/dist/command-registry-Dih3NQG-.js +0 -4
  1203. package/dist/command-registry-core-CjXOyB2J.js +0 -110
  1204. package/dist/command-status.runtime-B0-uERwh.js +0 -90
  1205. package/dist/commands-CLbV1tFt.d.ts +0 -113
  1206. package/dist/commands-acp-pD2JpUSj.js +0 -74
  1207. package/dist/commands-compact.runtime-V-TcIs65.js +0 -10
  1208. package/dist/commands-handlers.runtime-5M-A0jiA.js +0 -6154
  1209. package/dist/commands-status-Bm4dG6pI.js +0 -3
  1210. package/dist/commands-status-qm4EnRyE.js +0 -16
  1211. package/dist/commands-status.runtime-Bm4dG6pI.js +0 -3
  1212. package/dist/commands-subagents-control.runtime-DI46smsH.js +0 -2
  1213. package/dist/commands-subagents-control.runtime-rWDaFqzc.js +0 -3
  1214. package/dist/commands-system-prompt-B4F4MOEY.js +0 -162
  1215. package/dist/commands-system-prompt-jk5Mc_DP.js +0 -2
  1216. package/dist/commands.runtime-Bc23O5Mi.js +0 -176
  1217. package/dist/compact-CtN0DOvK.js +0 -480
  1218. package/dist/compact-D1ChSGOh.js +0 -1141
  1219. package/dist/compact.runtime-C7If8t90.js +0 -12
  1220. package/dist/completion-cli-gXouR92c.js +0 -315
  1221. package/dist/computer-use-CdO4BAyI.js +0 -367
  1222. package/dist/config-BkIb0hYP.js +0 -2
  1223. package/dist/config-dmYhst2s.js +0 -373
  1224. package/dist/config-mutations-D2ETKy_j.js +0 -159
  1225. package/dist/config-schema-BwKcspTI.d.ts +0 -20
  1226. package/dist/config-schema-Dx48Ud8L.d.ts +0 -34
  1227. package/dist/context-engine-host-compat-DgNqJwdY.js +0 -288
  1228. package/dist/context-engine-host-compat-OWTQLkIP.js +0 -2
  1229. package/dist/context-engine-lifecycle-CGVL8HdA.js +0 -1274
  1230. package/dist/contracts-testkit-CzhusazO.d.ts +0 -145
  1231. package/dist/control-auth-BFMiW_62.js +0 -114
  1232. package/dist/control-service-D7r7Quub.js +0 -145
  1233. package/dist/control-ui/sw.js +0 -133
  1234. package/dist/conversation-binding-runtime-BW_4K8cX.js +0 -4
  1235. package/dist/conversation-runtime-oIeuYAld.js +0 -31
  1236. package/dist/core-B7zb6eoz.d.ts +0 -224
  1237. package/dist/core-Cqwgrdgs.js +0 -282
  1238. package/dist/core-api-DI9CNhVz.js +0 -2
  1239. package/dist/core-api-Dcj6myhZ.js +0 -5
  1240. package/dist/crestodian-DVM5VVBT.js +0 -55
  1241. package/dist/daocore-runtime-DogaiqPT.d.ts +0 -151
  1242. package/dist/daocore-tools-bO6317PZ.js +0 -11727
  1243. package/dist/delivery-BCvDWVt-.js +0 -1002
  1244. package/dist/dialogue-D7jagbT_.js +0 -37
  1245. package/dist/dir-fetch-tool-BT5EPw-5.js +0 -565
  1246. package/dist/dir-list-tool-H_efDjDq.js +0 -100
  1247. package/dist/direct-dm-D0B-QMik.js +0 -64
  1248. package/dist/directive-handling.fast-lane-DsGCtBC-.js +0 -68
  1249. package/dist/directive-handling.impl-C-1mgd9g.js +0 -2
  1250. package/dist/directive-handling.impl-DumICYAp.js +0 -818
  1251. package/dist/directive-handling.model-selection-BJZn2fo_.js +0 -122
  1252. package/dist/directive-handling.persist.runtime-D62V2_9_.js +0 -263
  1253. package/dist/dispatch-CnOOlfPn.js +0 -1640
  1254. package/dist/dispatch-acp-transcript.runtime-DV_7Zl9P.js +0 -40
  1255. package/dist/dispatch-acp.runtime-ATTViG-t.js +0 -18
  1256. package/dist/doctor-8vhWy3Dw.js +0 -2
  1257. package/dist/doctor-CKYTXvU7.js +0 -6
  1258. package/dist/doctor-config-flow-B0Ilj0MM.js +0 -1741
  1259. package/dist/doctor-core-checks-B0DeLp7M.js +0 -2
  1260. package/dist/doctor-core-checks-NFFEe2qP.js +0 -573
  1261. package/dist/doctor-health-BQDkMVRf.js +0 -65
  1262. package/dist/doctor-health-contributions-BTtoe4Zy.js +0 -696
  1263. package/dist/doctor-lint-CtjiT5S1.js +0 -94
  1264. package/dist/doctor-state-integrity-C1p_aTX_.js +0 -1231
  1265. package/dist/doctor-update-Dzr9Vt00.js +0 -58
  1266. package/dist/doctor-update-fix-Dw80wTUs.js +0 -107
  1267. package/dist/dynamic-tools-Cb1BxOUV.js +0 -486
  1268. package/dist/embedded-backend-DIv3GabL.js +0 -579
  1269. package/dist/embedded-gateway-stub.runtime-DqgU4q-g.js +0 -12
  1270. package/dist/embedding-provider-B82QlZsy.d.ts +0 -21
  1271. package/dist/embedding-provider-Cmb3dgUf.d.ts +0 -65
  1272. package/dist/embedding-provider-w7EJz-DO.d.ts +0 -16
  1273. package/dist/exec-approvals-ClOFMgg8.js +0 -149
  1274. package/dist/file-fetch-tool-CIe7NhYV.js +0 -124
  1275. package/dist/file-write-tool-DBpMRVuc.js +0 -127
  1276. package/dist/format-DwlQcHW-.js +0 -1145
  1277. package/dist/gateway-cli-B-RpSgut.js +0 -435
  1278. package/dist/gateway-method-runtime-BblhHt-0.js +0 -21
  1279. package/dist/gateway-runtime-BcWCu-QH.d.ts +0 -163
  1280. package/dist/gemini-cli-provider-DtyOwxHA.d.ts +0 -6
  1281. package/dist/get-reply-HRNSgWtJ.js +0 -4689
  1282. package/dist/get-reply-from-config.runtime-D_IjyVEy.js +0 -2
  1283. package/dist/graph-users-xOkVRyWa.js +0 -1419
  1284. package/dist/group-access-5rOw40mA.js +0 -112
  1285. package/dist/handle-action.guild-admin-3izRlfhG.js +0 -288
  1286. package/dist/harness-DSATBx4q.js +0 -61
  1287. package/dist/health-gXf5LPQE.js +0 -4
  1288. package/dist/heartbeat-runner-BAl6rYJ4.js +0 -5
  1289. package/dist/heartbeat-runner.runtime-BwR4hXGN.js +0 -4
  1290. package/dist/hooks-Ds30xkRl.js +0 -534
  1291. package/dist/http-registry-D3Cdok5J.d.ts +0 -23
  1292. package/dist/image-generation-runtime-DhYgou3B.d.ts +0 -21
  1293. package/dist/inbound-direct-dm-runtime-VLA3Sl_Y.js +0 -2
  1294. package/dist/inbound-reply-dispatch-B1Yv-_Ol.js +0 -148
  1295. package/dist/index-ChRAMnH9.d.ts +0 -3971
  1296. package/dist/init-C94m6gc5.js +0 -59
  1297. package/dist/inline-buttons-B48KLvRY.js +0 -40
  1298. package/dist/interactive-dispatch-B-NLdr77.d.ts +0 -56
  1299. package/dist/interactive-dispatch-B66zssEF.d.ts +0 -143
  1300. package/dist/internal-events-DH1wKI3W.js +0 -90
  1301. package/dist/isolated-agent-BHtpDjQ3.js +0 -1118
  1302. package/dist/isolated-agent-CQ8xLCdA.js +0 -2
  1303. package/dist/lifecycle-J2_rGItq.js +0 -571
  1304. package/dist/list.probe-CQkRrePt.js +0 -449
  1305. package/dist/list.status-command-Dh4C_nmX.js +0 -789
  1306. package/dist/llm-slug-generator-CuTyqyw9.js +0 -78
  1307. package/dist/loader-Ben-RYnp.d.ts +0 -142
  1308. package/dist/local-dispatch.runtime-DMFlGKN5.js +0 -9
  1309. package/dist/manager-BDWyUfHJ.d.ts +0 -356
  1310. package/dist/manager.runtime-ChEFeq5B.js +0 -2714
  1311. package/dist/markdown-to-line-BXszL2cy.js +0 -811
  1312. package/dist/mcp-http-BfLRPB10.js +0 -555
  1313. package/dist/mcp-http-C4jMPkoA.js +0 -2
  1314. package/dist/media-understanding-provider-By_IYDJy.js +0 -339
  1315. package/dist/memory-core-host-engine-storage-BAq5Rf51.d.ts +0 -54
  1316. package/dist/memory-embedding-adapter-Cv87QsD0.d.ts +0 -5
  1317. package/dist/message-actions-CnGb9RhR.js +0 -145
  1318. package/dist/message-handler-BczaNv3J.js +0 -384
  1319. package/dist/message-handler-txIHUJJr.js +0 -1715
  1320. package/dist/message-handler.preflight-DQ_XIRJD.js +0 -1125
  1321. package/dist/message-handler.process-DW_BauDK.js +0 -1484
  1322. package/dist/migration-BOkhOT4K.d.ts +0 -45
  1323. package/dist/model-B4s-pIp8.d.ts +0 -33
  1324. package/dist/model-CzeDtlL2.js +0 -74
  1325. package/dist/model-selection-DISTEWT3.js +0 -272
  1326. package/dist/models-6NYWdsJM.d.ts +0 -24
  1327. package/dist/models-Cs632hpM.js +0 -104
  1328. package/dist/models-DFdDefW_.js +0 -2
  1329. package/dist/models-cli-CEJaAepl.js +0 -256
  1330. package/dist/monitor-1sdwxltF.js +0 -2788
  1331. package/dist/monitor-B3satZZM.js +0 -2
  1332. package/dist/monitor-BjTf4-1k.js +0 -715
  1333. package/dist/monitor-Blfd3oxm.js +0 -1370
  1334. package/dist/monitor-CTBBctRZ.js +0 -60
  1335. package/dist/monitor-DMs9Fc-I.js +0 -4377
  1336. package/dist/monitor-Jaf6yIPY.js +0 -1657
  1337. package/dist/monitor-QlSkTI6D.js +0 -834
  1338. package/dist/monitor-auth-C1tksIdC.js +0 -179
  1339. package/dist/monitor-polling.runtime-BfiQ9WKu.js +0 -883
  1340. package/dist/monitor-webhook.runtime-DaN0Z6_6.js +0 -387
  1341. package/dist/monitor.account-DXs-I96r.js +0 -5233
  1342. package/dist/monitor.runtime-CfhDXAnn.js +0 -2
  1343. package/dist/monitor.webhook-Dh2yCA0H.js +0 -180
  1344. package/dist/node-cli-sessions-BRSHPLpR.js +0 -1228
  1345. package/dist/openai-codex-provider-CByFL0Au.d.ts +0 -5
  1346. package/dist/openai-http-CJKcPRWW.js +0 -824
  1347. package/dist/openai-provider-DbEgHbfx.d.ts +0 -5
  1348. package/dist/openresponses-http-BhyRvqJ0.js +0 -1173
  1349. package/dist/operations-CL7dqxSs.js +0 -805
  1350. package/dist/outbound-adapter-BzLFym-i.js +0 -543
  1351. package/dist/outbound-session-route-do6mbRaF.js +0 -45
  1352. package/dist/outbound.runtime-ClwB5soC.js +0 -2
  1353. package/dist/pi-embedded-BtyxupRo.js +0 -3796
  1354. package/dist/pi-embedded-DC6txKUX.js +0 -4
  1355. package/dist/pi-embedded.runtime-CLGqbc8E.js +0 -4
  1356. package/dist/pi-tools-BNtGWzuL.js +0 -2413
  1357. package/dist/plan-BKvy4WrJ.js +0 -81
  1358. package/dist/plan-DwVlQpE1.js +0 -112
  1359. package/dist/plugin-BehbkTVr.d.ts +0 -17
  1360. package/dist/plugin-CY0rEF7s.js +0 -12396
  1361. package/dist/plugin-app-cache-key-DNUt0H7R.js +0 -46
  1362. package/dist/plugin-enabled-Cyd8634I.js +0 -233
  1363. package/dist/plugin-entry-feg_rkHL.d.ts +0 -47
  1364. package/dist/plugin-registration-B_-ymgPg.js +0 -88
  1365. package/dist/plugin-runtime-paqzXBLJ.d.ts +0 -117
  1366. package/dist/plugin-service-C0JwHvDr.d.ts +0 -24
  1367. package/dist/plugin-service-Dxx-FdeS.js +0 -1229
  1368. package/dist/policy-BXjjr3b_.js +0 -138
  1369. package/dist/policy-cKo9Yeux.js +0 -680
  1370. package/dist/prepare.runtime-DKbtJNij.js +0 -732
  1371. package/dist/preview-warnings-B_dB0-nc.js +0 -392
  1372. package/dist/probe-D02PTGyD.js +0 -47
  1373. package/dist/probe-DywFeNCV.js +0 -682
  1374. package/dist/probe-f3qP15_E.js +0 -2204
  1375. package/dist/probe-sSNH7OtW.js +0 -2
  1376. package/dist/program-CI-yGmHj.js +0 -131
  1377. package/dist/prompt-overlay-qLjnjnSK.d.ts +0 -23
  1378. package/dist/provider-0MTK_A59.js +0 -32
  1379. package/dist/provider-Bqz_XGo0.js +0 -8735
  1380. package/dist/provider-DguV0rAM.js +0 -32
  1381. package/dist/provider-Vf0kCR9H.js +0 -152
  1382. package/dist/provider-api-key-auth-CB8Tllmv.d.ts +0 -27
  1383. package/dist/provider-auth-result-Xze96yVn.d.ts +0 -21
  1384. package/dist/provider-catalog-runtime-Bo88wUpB.d.ts +0 -23
  1385. package/dist/provider-catalog-shared-rq7-Hkyg.d.ts +0 -62
  1386. package/dist/provider-dispatcher-DYgMXESe.js +0 -22
  1387. package/dist/provider-hook-runtime-bhgA4zLg.d.ts +0 -61
  1388. package/dist/provider-model-shared-Bv_vhH6i.d.ts +0 -143
  1389. package/dist/provider-models-DzbXgGDD.d.ts +0 -12
  1390. package/dist/provider-policy-Cx2IwhQ-.d.ts +0 -30
  1391. package/dist/provider-registration-D4DJp8vF.d.ts +0 -6
  1392. package/dist/provider-registry-BQ5DzWBt.d.ts +0 -8
  1393. package/dist/provider-registry-BrtezAkH.d.ts +0 -30
  1394. package/dist/provider-registry-DG571X-9.d.ts +0 -8
  1395. package/dist/provider-runtime-BJlV-8wH.d.ts +0 -359
  1396. package/dist/provider-self-hosted-setup-C5mGtzPJ.d.ts +0 -74
  1397. package/dist/provider-session.runtime-DPLsI_az.js +0 -9
  1398. package/dist/provider-stream-D-MYyujL.d.ts +0 -140
  1399. package/dist/provider-stream-shared-B6pQNRl4.d.ts +0 -128
  1400. package/dist/provider.runtime-Dqb234pz.js +0 -2
  1401. package/dist/providers.runtime-B9kfx6q8.d.ts +0 -25
  1402. package/dist/public-surface-loader-BFaumhij.js +0 -114
  1403. package/dist/pw-ai-G5xV3oAx.js +0 -3029
  1404. package/dist/pw-role-snapshot-Dx3HJBHP.js +0 -333
  1405. package/dist/reaction-level-cwg9IPV-.js +0 -19
  1406. package/dist/reaction-runtime-api-BO5tonA_.js +0 -116
  1407. package/dist/realtime-transcription-CAC89bnc.d.ts +0 -43
  1408. package/dist/realtime-transcription-provider-BPUt8lMk.js +0 -205
  1409. package/dist/realtime-transcription-provider-ChYQDNhv.d.ts +0 -5
  1410. package/dist/realtime-transcription-provider-DTYtMlJi.d.ts +0 -28
  1411. package/dist/realtime-transcription-provider-DirKeOjA.d.ts +0 -32
  1412. package/dist/realtime-transcription-provider-QHEXWhCJ.d.ts +0 -37
  1413. package/dist/realtime-voice-Bm0GBqnc.d.ts +0 -333
  1414. package/dist/realtime-voice-provider-NcUDkuN4.d.ts +0 -5
  1415. package/dist/register-hPi-PJ7K.js +0 -2178
  1416. package/dist/register.agent-C17wwmyB.js +0 -156
  1417. package/dist/register.crestodian-BgN2eNeU.js +0 -24
  1418. package/dist/register.maintenance-CZV43uUT.js +0 -105
  1419. package/dist/register.runtime-B6KhmuJw.js +0 -54
  1420. package/dist/register.runtime-CXLFfKiU.d.ts +0 -6
  1421. package/dist/register.subclis-By70wsLN.js +0 -31
  1422. package/dist/register.subclis-D_XDgsMy.js +0 -3
  1423. package/dist/register.subclis-core-CYi-wxpA.js +0 -273
  1424. package/dist/registry-DXBS27qE.d.ts +0 -91
  1425. package/dist/registry-types-DlO771W4.d.ts +0 -392
  1426. package/dist/repair-sequencing-ze6dXKp3.js +0 -640
  1427. package/dist/reply-delivery-BRsL-nIn.js +0 -196
  1428. package/dist/reply-runtime-hB7p7Uov.js +0 -11
  1429. package/dist/reply.runtime-D_IjyVEy.js +0 -2
  1430. package/dist/request-C6QBV_dA.js +0 -54
  1431. package/dist/resolve-allowlist-zmvmVPzW.js +0 -220
  1432. package/dist/result-fallback-classifier-hWTcOYyH.js +0 -79
  1433. package/dist/route-BMCrq1SN.js +0 -469
  1434. package/dist/route-resolution-nWgSniti.js +0 -274
  1435. package/dist/routes-BXyfYxi-.js +0 -2
  1436. package/dist/routes-CpMZFxzv.js +0 -3602
  1437. package/dist/run-Bzp1cq1J.js +0 -1163
  1438. package/dist/run-attempt-DMj1Q3oE.js +0 -7704
  1439. package/dist/run-command-CbDBts53.js +0 -23
  1440. package/dist/run-command-CrJ2mrht.js +0 -2
  1441. package/dist/run-embedded.runtime-sD3O3k2K.js +0 -4
  1442. package/dist/run-execution-cli.runtime-CG1zNse6.js +0 -4
  1443. package/dist/run-subagent-registry.runtime-CGzIerQZ.js +0 -2
  1444. package/dist/runtime-B0ZKPxxL.js +0 -6179
  1445. package/dist/runtime-Dh-KFKJv.js +0 -1287
  1446. package/dist/runtime-api-9Xxm9K2E.js +0 -21
  1447. package/dist/runtime-api-C2252PQ4.js +0 -4
  1448. package/dist/runtime-api-C7ToEUFX.d.ts +0 -3151
  1449. package/dist/runtime-api-Cl3W6JLB.js +0 -13
  1450. package/dist/runtime-api-CwyQGzrm.js +0 -24
  1451. package/dist/runtime-api-DQVZQ82e.js +0 -17
  1452. package/dist/runtime-api-Ksdts3J7.js +0 -13
  1453. package/dist/runtime-api-lHayJI0f.js +0 -3
  1454. package/dist/runtime-api.actions-CHH4JoFd.js +0 -3
  1455. package/dist/runtime-api.monitor-CuAnxOiA.js +0 -6
  1456. package/dist/runtime-api.send-C5Ndv4Sb.js +0 -4
  1457. package/dist/runtime-api.threads-Car1xuWI.js +0 -2
  1458. package/dist/runtime-channel-PhHAbE3P.js +0 -2
  1459. package/dist/runtime-channel-ehNPdqhp.js +0 -150
  1460. package/dist/runtime-embedded-pi.runtime-BExQEON7.js +0 -2
  1461. package/dist/runtime-l-x1mIPp.js +0 -438
  1462. package/dist/runtime-taskflow-PDIujF9q.d.ts +0 -435
  1463. package/dist/sanitize-outbound-CINW3wBb.js +0 -127
  1464. package/dist/sdk-setup-tools-DotzY-Ff.js +0 -8
  1465. package/dist/secrets-BdWCp_pg.js +0 -113
  1466. package/dist/security-audit-BMS02wuX.js +0 -122
  1467. package/dist/security-audit-BXupNbYa.js +0 -118
  1468. package/dist/security-audit.runtime-CONAKFRk.js +0 -2
  1469. package/dist/selection-8iOGMBPh.js +0 -16157
  1470. package/dist/selection-D9-GNcGp.js +0 -3
  1471. package/dist/send-BsqMC7vV.js +0 -143
  1472. package/dist/send-ChUpwNpF.js +0 -2
  1473. package/dist/send-D92kiCYa.js +0 -192
  1474. package/dist/send-LSm52k6p.js +0 -1631
  1475. package/dist/send.components-D_1vDkKM.js +0 -2
  1476. package/dist/send.components-Scs0rrDy.js +0 -500
  1477. package/dist/send.runtime-BJbljin6.js +0 -2
  1478. package/dist/server-BQ9wTpKB.js +0 -73
  1479. package/dist/server-CHWh_XGy.js +0 -24
  1480. package/dist/server-context-D42gG6GT.js +0 -2
  1481. package/dist/server-context-oRlMLKPz.js +0 -955
  1482. package/dist/server-cron-BpLzGXmi.js +0 -2
  1483. package/dist/server-cron-DFsVLz6k.js +0 -2989
  1484. package/dist/server-methods-CVgaE49L.js +0 -16499
  1485. package/dist/server-node-events-DmaGt81F.js +0 -596
  1486. package/dist/server-plugin-bootstrap-ypOUJ438.js +0 -70
  1487. package/dist/server-plugins-BZZxcYFZ.js +0 -432
  1488. package/dist/server-reload-handlers-Ccu2KW5E.js +0 -714
  1489. package/dist/server-restart-sentinel-Bud1fPG5.js +0 -2
  1490. package/dist/server-restart-sentinel-C4oYiDTT.js +0 -747
  1491. package/dist/server-runtime-services-BAlijw2O.js +0 -267
  1492. package/dist/server-runtime-services-BY8y-CAk.js +0 -2
  1493. package/dist/server-startup-plugins-utvxpVCl.js +0 -113
  1494. package/dist/server-startup-post-attach-C09QVu1D.js +0 -716
  1495. package/dist/server-ws-runtime-hgZQmILO.js +0 -349
  1496. package/dist/server.impl-btEzW7aF.js +0 -2587
  1497. package/dist/service-DYvUSJDx.js +0 -1446
  1498. package/dist/session-binding-Smi9h573.js +0 -219
  1499. package/dist/session-binding-vAzR408o.js +0 -2
  1500. package/dist/session-kill-http-HXI6hUDG.js +0 -121
  1501. package/dist/session-reset-service-CdqhH7XS.js +0 -625
  1502. package/dist/session-route-DX9HyYoG.js +0 -93
  1503. package/dist/session-status.runtime-B7dGtknj.js +0 -2
  1504. package/dist/session-subagent-reactivation.runtime-Dn-wvdjM.js +0 -2
  1505. package/dist/session-tab-registry-UN4VZE8a.js +0 -521
  1506. package/dist/sessions-history-http--Dgcvhb0.js +0 -430
  1507. package/dist/sessions.runtime-LnYxeKSP.js +0 -2
  1508. package/dist/setup-api-BfO7Ctmd.js +0 -29
  1509. package/dist/setup-core-DlCsv-9q.js +0 -174
  1510. package/dist/setup-surface-BDXmLycW.js +0 -221
  1511. package/dist/setup-surface-Bi-pZtB0.js +0 -405
  1512. package/dist/setup-surface-Bk9MdZ9I.js +0 -288
  1513. package/dist/setup-surface-m649hpou.js +0 -320
  1514. package/dist/shared-DwXuhcIz.js +0 -121
  1515. package/dist/shared-client-Cj3X4R8q.js +0 -2
  1516. package/dist/shared-client-D02xLLJg.js +0 -629
  1517. package/dist/shared-eYKaB8rP.d.ts +0 -115
  1518. package/dist/side-question-DbsrGTKR.js +0 -683
  1519. package/dist/simple-completion-runtime-D3SeEaWT.d.ts +0 -73
  1520. package/dist/skill-tool-dispatch.runtime-CswUeFQB.js +0 -143
  1521. package/dist/slash-state-Br7bOIIy.js +0 -2166
  1522. package/dist/speech-Dbhvhbdq.d.ts +0 -47
  1523. package/dist/speech-core-8X_D3HLF.d.ts +0 -36
  1524. package/dist/speech-provider-BHcOkoLn.js +0 -184
  1525. package/dist/speech-provider-BYm63_co.d.ts +0 -8
  1526. package/dist/speech-provider-BtJxZzKb.d.ts +0 -8
  1527. package/dist/speech-provider-CbneUhtJ.d.ts +0 -5
  1528. package/dist/speech-provider-DOAvAvlS.d.ts +0 -5
  1529. package/dist/speech-provider-DdfnOmrC.d.ts +0 -5
  1530. package/dist/speech-provider-ptNkD7Yf.d.ts +0 -34
  1531. package/dist/src-DcIZ_w7l.js +0 -4256
  1532. package/dist/startup-context-BU3ZwnPZ.js +0 -313
  1533. package/dist/status-subagents.runtime-U9cVRB6A.js +0 -18
  1534. package/dist/status-text-DlZ-OoHI.js +0 -296
  1535. package/dist/sticker-cache-BfgCFMo_.js +0 -206
  1536. package/dist/sticker-vision.runtime-DYSdlJUC.js +0 -17
  1537. package/dist/stream-BHkpDd1i.d.ts +0 -10
  1538. package/dist/stream-C6huJP_D.d.ts +0 -5
  1539. package/dist/stream-D4Pmcj3t.d.ts +0 -16
  1540. package/dist/stream-DpSe6hAE.d.ts +0 -19
  1541. package/dist/stream-DrRUuJ8m.d.ts +0 -120
  1542. package/dist/stream-wrappers-DLxwmPDI.d.ts +0 -21
  1543. package/dist/subagent-announce-BntptirO.js +0 -354
  1544. package/dist/subagent-announce-delivery-6GUsisag.js +0 -958
  1545. package/dist/subagent-control-C7DSvkWz.js +0 -508
  1546. package/dist/subagent-hooks-4aumktTW.js +0 -2
  1547. package/dist/subagent-hooks-COUrrxEC.js +0 -2
  1548. package/dist/subagent-hooks-DUGDXbSM.js +0 -146
  1549. package/dist/subagent-hooks-DjDgoKjj.js +0 -230
  1550. package/dist/subagent-hooks-DjvL3k1b.js +0 -2
  1551. package/dist/subagent-hooks-api-BxfHMA2E.js +0 -22
  1552. package/dist/subagent-hooks-api-Cn7QkuFW.js +0 -23
  1553. package/dist/subagent-hooks-api-_lgvYj20.js +0 -23
  1554. package/dist/subagent-hooks-gWxlJnmo.js +0 -116
  1555. package/dist/subagent-orphan-recovery-CcAPcsDk.js +0 -352
  1556. package/dist/subagent-registry-BsYF1Amv.js +0 -3
  1557. package/dist/subagent-registry-LC_Gic13.js +0 -2351
  1558. package/dist/subagent-session-cleanup-6AY_7hyu.js +0 -525
  1559. package/dist/subagent-spawn-C2IO1E1i.js +0 -1164
  1560. package/dist/target-id-By34AE0b.js +0 -107
  1561. package/dist/targets-B40DzW6Y.js +0 -44
  1562. package/dist/targets-BttGNxRs.js +0 -19
  1563. package/dist/targets-C6bpLZdS.js +0 -19
  1564. package/dist/targets-CZhlhiDN.d.ts +0 -10
  1565. package/dist/targets-HPytm6Z8.d.ts +0 -10
  1566. package/dist/testing-BzZIozrH.js +0 -267
  1567. package/dist/thinking-policy-wJH8MNPa.d.ts +0 -5
  1568. package/dist/thread-bindings-CBiuE4G4.js +0 -228
  1569. package/dist/thread-bindings-CTJq5UHl.js +0 -232
  1570. package/dist/thread-bindings-bN9Ad5r9.js +0 -571
  1571. package/dist/thread-bindings-kXHwWthg.js +0 -8
  1572. package/dist/thread-bindings.discord-api-C8jkPA0w.js +0 -187
  1573. package/dist/thread-bindings.manager-BsFmjrbx.js +0 -536
  1574. package/dist/thread-bindings.manager-DfJgNAl6.js +0 -2
  1575. package/dist/thread-lifecycle-gR5OSLzh.js +0 -1614
  1576. package/dist/token-B2FhcBoz.js +0 -134
  1577. package/dist/tool-47nHlaiR.js +0 -139
  1578. package/dist/tool-actions.runtime-DwQ1lVPo.js +0 -534
  1579. package/dist/tool-plugin-CmXn59FQ.d.ts +0 -77
  1580. package/dist/tool-resolution-DQej_E5w.js +0 -149
  1581. package/dist/tool-split-CaXOLBeI.d.ts +0 -19
  1582. package/dist/tools-effective-inventory-CyXaSANM.js +0 -204
  1583. package/dist/tools-invoke-http-yo3HU4V6.js +0 -67
  1584. package/dist/tools-invoke-shared-LpV_xD9g.js +0 -200
  1585. package/dist/transport-stream-lU_hAKuv.d.ts +0 -42
  1586. package/dist/tts-E7ULNzl4.js +0 -66
  1587. package/dist/tui-B-wyN6wJ.js +0 -4709
  1588. package/dist/tui-CdI6yMis.js +0 -2
  1589. package/dist/tui-backend-CXej-4Er.js +0 -256
  1590. package/dist/tui-cli-wboa0AnA.js +0 -37
  1591. package/dist/types-CD1xwSld.d.ts +0 -786
  1592. package/dist/types-Zj4Bq9h-2.d.ts +0 -3650
  1593. package/dist/types.public-B0VjJLe9.d.ts +0 -70
  1594. package/dist/update-cli-CGUsDh2T.js +0 -3665
  1595. package/dist/update-global-BbP9IhEf.js +0 -601
  1596. package/dist/update-runner-B54rgAmr.js +0 -1798
  1597. package/dist/video-generation-runtime-DsFG7djU.d.ts +0 -21
  1598. package/dist/video-model-catalog-CfhC-Mol.d.ts +0 -16
  1599. package/dist/vision-tools-wacIK5vr.js +0 -1409
  1600. package/dist/web-search-AMwc61Dr.js +0 -62
  1601. package/dist/web-search-provider.runtime-CNG2uQTF.js +0 -2
  1602. package/dist/web-search-provider.runtime-oBaJtm_S.js +0 -328
  1603. package/dist/webhook-targets-C9cJD_kB.d.ts +0 -99
  1604. package/dist/xai-oauth-DOqf2jTO.js +0 -479
  1605. package/dist/xai-user-agent-Dk71wEWd.js +0 -32
  1606. package/dist/zod-schema.core-BhLPa6BF.d.ts +0 -166
  1607. /package/dist/{acp-runtime-backend-4DfhM5M9.js → acp-runtime-backend-CxP454w8.js} +0 -0
  1608. /package/dist/{channel-actions-CYB0u2id.js → channel-actions-AudMk4Yk.js} +0 -0
  1609. /package/dist/{command-status-runtime-CPIRzAU6.js → command-status-runtime-BWRWzQv1.js} +0 -0
  1610. /package/dist/{delegate-DpQ2iXjn.js → delegate-CLZeP48P.js} +0 -0
  1611. /package/dist/{dispatch-acp-Bdp6i1Mz.js → dispatch-acp-BK0Zh3_p.js} +0 -0
  1612. /package/dist/{heartbeat-runner-Cx01gr5N.js → heartbeat-runner-BouutzYV.js} +0 -0
  1613. /package/dist/{library-BSsSuIcq.js → library-C-O719bG.js} +0 -0
  1614. /package/dist/{run-executor.runtime-DwZVL5h6.js → run-executor.runtime-DF1Wol1i.js} +0 -0
  1615. /package/dist/{shared-DJ7fJ5uN.js → shared-BqbJdmuE.js} +0 -0
@@ -1,3602 +0,0 @@
1
- import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString$4 } from "./string-coerce-DyL154ka.js";
2
- import { i as formatErrorMessage } from "./errors-D_oyTIw2.js";
3
- import { f as pathScope } from "./fs-safe-BFN3ftAo.js";
4
- import { p as resolveUserPath } from "./utils-CNnMhEDp.js";
5
- import { i as getRuntimeConfig } from "./io-BAMe9xIp.js";
6
- import { c as getImageMetadata, o as buildImageResizeSideGrid, p as resizeToJpeg, r as IMAGE_REDUCE_QUALITY_STEPS, u as isImageProcessorUnavailableError } from "./media-services-Dv6cSGAt.js";
7
- import { a as ensureMediaDir, u as saveMediaBuffer } from "./store-53qCOCD8.js";
8
- import "./string-coerce-runtime-DcopKqDR.js";
9
- import { C as BrowserTabNotFoundError, E as toBrowserErrorResponse, L as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, R as DEFAULT_AI_SNAPSHOT_MAX_CHARS, T as BrowserValidationError, W as DEFAULT_BROWSER_SCREENSHOT_TIMEOUT_MS, _ as BrowserConflictError, b as BrowserProfileUnavailableError, d as parseBrowserHttpUrl, f as redactCdpUrl, n as assertCdpEndpointAllowed, p as withCdpSocket, v as BrowserError, w as BrowserTargetAmbiguousError, y as BrowserProfileNotFoundError } from "./cdp.helpers-Buw9g4SP.js";
10
- import { a as DEFAULT_DOWNLOAD_DIR, i as resolveProfile, o as DEFAULT_TRACE_DIR, r as resolveManagedBrowserHeadlessMode, s as DEFAULT_UPLOAD_DIR } from "./config-dmYhst2s.js";
11
- import "./config-BkIb0hYP.js";
12
- import "./errors-Bw64Buth.js";
13
- import { i as isValidProfileName, n as deleteBrowserProfileConfig, t as createBrowserProfileConfig } from "./config-mutations-D2ETKy_j.js";
14
- import { r as resolveBrowserExecutableForPlatform } from "./chrome.executables-CeF4Du_1.js";
15
- import { t as movePathToTrash } from "./trash-zrJvy_yh.js";
16
- import { n as normalizeString } from "./record-shared-DnJBzWLH.js";
17
- import "./sdk-setup-tools-DotzY-Ff.js";
18
- import { E as uploadChromeMcpFile, T as takeChromeMcpSnapshot, _ as navigateChromeMcpPage, a as closeChromeMcpTab, c as evaluateChromeMcpScript, f as getChromeMcpPid, l as fillChromeMcpElement, m as hoverChromeMcpElement, n as clickChromeMcpCoords, o as dragChromeMcpElement, r as clickChromeMcpElement, u as fillChromeMcpForm, w as takeChromeMcpScreenshot, x as resizeChromeMcpPage, y as pressChromeMcpKey } from "./chrome-mcp-D1FfHbpc.js";
19
- import { E as withBrowserNavigationPolicy, S as assertBrowserNavigationAllowed, _ as INTERACTIVE_ROLES, a as resolveDaoCoreUserDataDir, b as resolveBrowserNavigationProxyMode, g as CONTENT_ROLES, h as snapshotRoleViaCdp, m as snapshotAria, t as getChromeWebSocketUrl, u as captureScreenshot, v as STRUCTURAL_ROLES, w as assertBrowserNavigationResultAllowed, y as ensureOutputDirectory } from "./chrome-BbE0579R.js";
20
- import { a as shouldUsePlaywrightForAriaSnapshot, i as resolveDefaultSnapshotFormat, n as getPwAiModule$1, o as shouldUsePlaywrightForScreenshot, r as getBrowserProfileCapabilities, t as resolveTargetIdFromTabs } from "./target-id-By34AE0b.js";
21
- import { c as ACT_MAX_CLICK_DELAY_MS, l as ACT_MAX_WAIT_TIME_MS, o as normalizeBrowserFormField, p as matchBrowserUrlPattern, r as getRoleSnapshotStats, u as normalizeActBoundedNonNegativeMs } from "./pw-role-snapshot-Dx3HJBHP.js";
22
- import fs from "node:fs";
23
- import path from "node:path";
24
- import crypto from "node:crypto";
25
- //#region extensions/browser/src/browser/routes/utils.ts
26
- function normalizeOptionalString$3(value) {
27
- return value.trim() || void 0;
28
- }
29
- function asyncBrowserRoute(handler) {
30
- return (req, res) => handler(req, res);
31
- }
32
- /**
33
- * Extract profile name from query string or body and get profile context.
34
- * Query string takes precedence over body for consistency with GET routes.
35
- */
36
- function getProfileContext(req, ctx) {
37
- let profileName;
38
- if (typeof req.query.profile === "string") profileName = normalizeOptionalString$3(req.query.profile);
39
- if (!profileName && req.body && typeof req.body === "object") {
40
- const body = req.body;
41
- if (typeof body.profile === "string") profileName = normalizeOptionalString$3(body.profile);
42
- }
43
- try {
44
- return ctx.forProfile(profileName);
45
- } catch (err) {
46
- return {
47
- error: String(err),
48
- status: 404
49
- };
50
- }
51
- }
52
- function jsonError(res, status, message) {
53
- res.status(status).json({ error: message });
54
- }
55
- function toStringOrEmpty(value) {
56
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return normalizeOptionalString$3(String(value)) ?? "";
57
- return "";
58
- }
59
- function toNumber(value) {
60
- if (typeof value === "number" && Number.isFinite(value)) return value;
61
- const normalized = typeof value === "string" ? normalizeOptionalString$3(value) : void 0;
62
- if (normalized) {
63
- const parsed = Number(normalized);
64
- return Number.isFinite(parsed) ? parsed : void 0;
65
- }
66
- }
67
- function toBoolean(value) {
68
- if (typeof value === "boolean") return value;
69
- if (typeof value !== "string" && typeof value !== "number") return;
70
- const normalized = String(value).trim().toLowerCase();
71
- if (normalized === "true" || normalized === "1" || normalized === "yes") return true;
72
- if (normalized === "false" || normalized === "0" || normalized === "no") return false;
73
- }
74
- function toStringArray(value) {
75
- if (!Array.isArray(value)) return;
76
- const strings = value.map((v) => toStringOrEmpty(v)).filter(Boolean);
77
- return strings.length ? strings : void 0;
78
- }
79
- //#endregion
80
- //#region extensions/browser/src/browser/routes/agent.shared.ts
81
- function normalizeOptionalString$2(value) {
82
- return typeof value === "string" ? value.trim() || void 0 : void 0;
83
- }
84
- const SELECTOR_UNSUPPORTED_MESSAGE = [
85
- "Error: 'selector' is not supported. Use 'ref' from snapshot instead.",
86
- "",
87
- "Example workflow:",
88
- "1. snapshot action to get page state with refs",
89
- "2. act with ref: \"e123\" to interact with element",
90
- "",
91
- "This is more reliable for modern SPAs."
92
- ].join("\n");
93
- function readBody(req) {
94
- const body = req.body;
95
- if (!body || typeof body !== "object" || Array.isArray(body)) return {};
96
- return body;
97
- }
98
- function resolveTargetIdFromBody(body) {
99
- return (normalizeOptionalString$2(body.targetId) ?? "") || void 0;
100
- }
101
- function resolveTargetIdFromQuery(query) {
102
- return (normalizeOptionalString$2(query.targetId) ?? "") || void 0;
103
- }
104
- function handleRouteError(ctx, res, err) {
105
- const mapped = ctx.mapTabError(err);
106
- if (mapped) return jsonError(res, mapped.status, mapped.message);
107
- const browserMapped = toBrowserErrorResponse(err);
108
- if (browserMapped) return jsonError(res, browserMapped.status, browserMapped.message);
109
- jsonError(res, 500, String(err));
110
- }
111
- function resolveProfileContext(req, res, ctx) {
112
- const profileCtx = getProfileContext(req, ctx);
113
- if ("error" in profileCtx) {
114
- jsonError(res, profileCtx.status, profileCtx.error);
115
- return null;
116
- }
117
- return profileCtx;
118
- }
119
- async function getPwAiModule() {
120
- return await getPwAiModule$1({ mode: "soft" });
121
- }
122
- async function requirePwAi(res, feature) {
123
- const mod = await getPwAiModule();
124
- if (mod) return mod;
125
- jsonError(res, 501, [
126
- `Playwright is not available in this gateway build; '${feature}' is unsupported.`,
127
- "Reinstall or update DaoCore so the core browser runtime dependency is present, then restart the gateway. In Docker, also install Chromium with the bundled playwright-core CLI.",
128
- "Docs: /tools/browser#playwright-requirement"
129
- ].join("\n"));
130
- return null;
131
- }
132
- async function withRouteTabContext(params) {
133
- const profileCtx = resolveProfileContext(params.req, params.res, params.ctx);
134
- if (!profileCtx) return;
135
- try {
136
- const tab = await profileCtx.ensureTabAvailable(params.targetId);
137
- if (params.enforceCurrentUrlAllowed) await assertBrowserNavigationResultAllowed({
138
- url: tab.url,
139
- ...withBrowserNavigationPolicy(params.ctx.state().resolved.ssrfPolicy, { browserProxyMode: resolveBrowserNavigationProxyMode({
140
- resolved: params.ctx.state().resolved,
141
- profile: profileCtx.profile
142
- }) })
143
- });
144
- return await params.run({
145
- profileCtx,
146
- tab,
147
- cdpUrl: profileCtx.profile.cdpUrl,
148
- resolveTabUrl: (fallbackUrl) => resolveSafeRouteTabUrl({
149
- ctx: params.ctx,
150
- profileCtx,
151
- targetId: tab.targetId,
152
- fallbackUrl
153
- })
154
- });
155
- } catch (err) {
156
- handleRouteError(params.ctx, params.res, err);
157
- return;
158
- }
159
- }
160
- /**
161
- * Response-only URL redaction. This swallows policy failures and must not be used as
162
- * an execution gate; use enforceCurrentUrlAllowed on the route helper instead.
163
- */
164
- async function resolveSafeRouteTabUrl(params) {
165
- const candidateUrl = (await params.profileCtx.listTabs().catch(() => [])).find((tab) => tab.targetId === params.targetId)?.url ?? params.fallbackUrl;
166
- if (!candidateUrl) return;
167
- try {
168
- await assertBrowserNavigationResultAllowed({
169
- url: candidateUrl,
170
- ...withBrowserNavigationPolicy(params.ctx.state().resolved.ssrfPolicy, { browserProxyMode: resolveBrowserNavigationProxyMode({
171
- resolved: params.ctx.state().resolved,
172
- profile: params.profileCtx.profile
173
- }) })
174
- });
175
- return candidateUrl;
176
- } catch {
177
- return;
178
- }
179
- }
180
- async function withPlaywrightRouteContext(params) {
181
- return await withRouteTabContext({
182
- req: params.req,
183
- res: params.res,
184
- ctx: params.ctx,
185
- targetId: params.targetId,
186
- enforceCurrentUrlAllowed: params.enforceCurrentUrlAllowed,
187
- run: async ({ profileCtx, tab, cdpUrl, resolveTabUrl }) => {
188
- const pw = await requirePwAi(params.res, params.feature);
189
- if (!pw) return;
190
- return await params.run({
191
- profileCtx,
192
- tab,
193
- cdpUrl,
194
- resolveTabUrl,
195
- pw
196
- });
197
- }
198
- });
199
- }
200
- //#endregion
201
- //#region extensions/browser/src/browser/routes/existing-session-limits.ts
202
- const EXISTING_SESSION_LIMITS = {
203
- act: {
204
- clickSelector: "existing-session click does not support selector targeting yet; use ref.",
205
- clickButtonOrModifiers: "existing-session click currently supports left-click only (no button overrides/modifiers).",
206
- typeSelector: "existing-session type does not support selector targeting yet; use ref.",
207
- typeSlowly: "existing-session type does not support slowly=true; use fill/press instead.",
208
- typeTimeout: "existing-session type does not support timeoutMs overrides.",
209
- pressDelay: "existing-session press does not support delayMs.",
210
- hoverSelector: "existing-session hover does not support selector targeting yet; use ref.",
211
- hoverTimeout: "existing-session hover does not support timeoutMs overrides.",
212
- scrollSelector: "existing-session scrollIntoView does not support selector targeting yet; use ref.",
213
- scrollTimeout: "existing-session scrollIntoView does not support timeoutMs overrides.",
214
- dragSelector: "existing-session drag does not support selector targeting yet; use startRef/endRef.",
215
- dragTimeout: "existing-session drag does not support timeoutMs overrides.",
216
- selectSelector: "existing-session select does not support selector targeting yet; use ref.",
217
- selectSingleValue: "existing-session select currently supports a single value only.",
218
- selectTimeout: "existing-session select does not support timeoutMs overrides.",
219
- fillTimeout: "existing-session fill does not support timeoutMs overrides.",
220
- waitNetworkIdle: "existing-session wait does not support loadState=networkidle yet.",
221
- evaluateTimeout: "existing-session evaluate does not support timeoutMs overrides.",
222
- batch: "existing-session batch is not supported yet; send actions individually."
223
- },
224
- hooks: {
225
- uploadElement: "existing-session file uploads do not support element selectors; use ref/inputRef.",
226
- uploadSingleFile: "existing-session file uploads currently support one file at a time.",
227
- uploadRefRequired: "existing-session file uploads require ref or inputRef.",
228
- dialogId: "existing-session dialog handling does not support dialogId.",
229
- dialogTimeout: "existing-session dialog handling does not support timeoutMs."
230
- },
231
- download: {
232
- waitUnsupported: "download waiting is not supported for existing-session profiles yet.",
233
- downloadUnsupported: "downloads are not supported for existing-session profiles yet."
234
- },
235
- snapshot: {
236
- pdfUnsupported: "pdf is not supported for existing-session profiles yet; use screenshot/snapshot instead.",
237
- screenshotElement: "element screenshots are not supported for existing-session profiles; use ref from snapshot.",
238
- snapshotSelector: "selector/frame snapshots are not supported for existing-session profiles; snapshot the whole page and use refs."
239
- },
240
- responseBody: "response body is not supported for existing-session profiles yet."
241
- };
242
- //#endregion
243
- //#region extensions/browser/src/browser/routes/output-paths.ts
244
- async function ensureOutputRootDir(rootDir) {
245
- await ensureOutputDirectory(rootDir);
246
- }
247
- async function resolveWritableOutputPathOrRespond(params) {
248
- if (params.ensureRootDir) await ensureOutputRootDir(params.rootDir);
249
- const pathResult = await pathScope(params.rootDir, { label: params.scopeLabel }).writable(params.requestedPath, { defaultName: params.defaultFileName });
250
- if (!pathResult.ok) {
251
- params.res.status(400).json({ error: pathResult.error });
252
- return null;
253
- }
254
- return pathResult.path;
255
- }
256
- //#endregion
257
- //#region extensions/browser/src/browser/routes/agent.act.download.ts
258
- function buildDownloadRequestBase(cdpUrl, targetId, timeoutMs) {
259
- return {
260
- cdpUrl,
261
- targetId,
262
- timeoutMs: timeoutMs ?? void 0
263
- };
264
- }
265
- function registerBrowserAgentActDownloadRoutes(app, ctx) {
266
- app.post("/wait/download", asyncBrowserRoute(async (req, res) => {
267
- const body = readBody(req);
268
- const targetId = resolveTargetIdFromBody(body);
269
- const out = toStringOrEmpty(body.path) || "";
270
- const timeoutMs = toNumber(body.timeoutMs);
271
- await withRouteTabContext({
272
- req,
273
- res,
274
- ctx,
275
- targetId,
276
- run: async ({ profileCtx, cdpUrl, tab }) => {
277
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) return jsonError(res, 501, EXISTING_SESSION_LIMITS.download.waitUnsupported);
278
- const pw = await requirePwAi(res, "wait for download");
279
- if (!pw) return;
280
- await ensureOutputRootDir(DEFAULT_DOWNLOAD_DIR);
281
- let downloadPath;
282
- if (out.trim()) {
283
- const resolvedDownloadPath = await resolveWritableOutputPathOrRespond({
284
- res,
285
- rootDir: DEFAULT_DOWNLOAD_DIR,
286
- requestedPath: out,
287
- scopeLabel: "downloads directory"
288
- });
289
- if (!resolvedDownloadPath) return;
290
- downloadPath = resolvedDownloadPath;
291
- }
292
- const requestBase = buildDownloadRequestBase(cdpUrl, tab.targetId, timeoutMs);
293
- const result = await pw.waitForDownloadViaPlaywright({
294
- ...requestBase,
295
- path: downloadPath,
296
- rootDir: DEFAULT_DOWNLOAD_DIR
297
- });
298
- res.json({
299
- ok: true,
300
- targetId: tab.targetId,
301
- download: result
302
- });
303
- }
304
- });
305
- }));
306
- app.post("/download", asyncBrowserRoute(async (req, res) => {
307
- const body = readBody(req);
308
- const targetId = resolveTargetIdFromBody(body);
309
- const ref = toStringOrEmpty(body.ref);
310
- const out = toStringOrEmpty(body.path);
311
- const timeoutMs = toNumber(body.timeoutMs);
312
- if (!ref) return jsonError(res, 400, "ref is required");
313
- if (!out) return jsonError(res, 400, "path is required");
314
- await withRouteTabContext({
315
- req,
316
- res,
317
- ctx,
318
- targetId,
319
- run: async ({ profileCtx, cdpUrl, tab }) => {
320
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) return jsonError(res, 501, EXISTING_SESSION_LIMITS.download.downloadUnsupported);
321
- const pw = await requirePwAi(res, "download");
322
- if (!pw) return;
323
- await ensureOutputRootDir(DEFAULT_DOWNLOAD_DIR);
324
- const downloadPath = await resolveWritableOutputPathOrRespond({
325
- res,
326
- rootDir: DEFAULT_DOWNLOAD_DIR,
327
- requestedPath: out,
328
- scopeLabel: "downloads directory"
329
- });
330
- if (!downloadPath) return;
331
- const requestBase = buildDownloadRequestBase(cdpUrl, tab.targetId, timeoutMs);
332
- const result = await pw.downloadViaPlaywright({
333
- ...requestBase,
334
- ref,
335
- path: downloadPath,
336
- rootDir: DEFAULT_DOWNLOAD_DIR
337
- });
338
- res.json({
339
- ok: true,
340
- targetId: tab.targetId,
341
- download: result
342
- });
343
- }
344
- });
345
- }));
346
- }
347
- //#endregion
348
- //#region extensions/browser/src/browser/routes/agent.act.errors.ts
349
- const ACT_ERROR_CODES = {
350
- kindRequired: "ACT_KIND_REQUIRED",
351
- invalidRequest: "ACT_INVALID_REQUEST",
352
- selectorUnsupported: "ACT_SELECTOR_UNSUPPORTED",
353
- evaluateDisabled: "ACT_EVALUATE_DISABLED",
354
- unsupportedForExistingSession: "ACT_EXISTING_SESSION_UNSUPPORTED",
355
- targetIdMismatch: "ACT_TARGET_ID_MISMATCH"
356
- };
357
- function jsonActError(res, status, code, message) {
358
- res.status(status).json({
359
- error: message,
360
- code
361
- });
362
- }
363
- function browserEvaluateDisabledMessage(action) {
364
- return [action === "wait" ? "wait --fn is disabled by config (browser.evaluateEnabled=false)." : "act:evaluate is disabled by config (browser.evaluateEnabled=false).", "Docs: /gateway/configuration#browser-daocore-managed-browser"].join("\n");
365
- }
366
- //#endregion
367
- //#region extensions/browser/src/browser/routes/agent.act.hooks.ts
368
- function registerBrowserAgentActHookRoutes(app, ctx) {
369
- app.post("/hooks/file-chooser", asyncBrowserRoute(async (req, res) => {
370
- const body = readBody(req);
371
- const targetId = resolveTargetIdFromBody(body);
372
- const ref = toStringOrEmpty(body.ref) || void 0;
373
- const inputRef = toStringOrEmpty(body.inputRef) || void 0;
374
- const element = toStringOrEmpty(body.element) || void 0;
375
- const paths = toStringArray(body.paths) ?? [];
376
- const timeoutMs = toNumber(body.timeoutMs);
377
- if (!paths.length) return jsonError(res, 400, "paths are required");
378
- await withRouteTabContext({
379
- req,
380
- res,
381
- ctx,
382
- targetId,
383
- run: async ({ profileCtx, cdpUrl, tab }) => {
384
- const uploadPathsResult = await pathScope(DEFAULT_UPLOAD_DIR, { label: `uploads directory (${DEFAULT_UPLOAD_DIR})` }).existing(paths);
385
- if (!uploadPathsResult.ok) {
386
- res.status(400).json({ error: uploadPathsResult.error });
387
- return;
388
- }
389
- const resolvedPaths = uploadPathsResult.paths;
390
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) {
391
- if (element) return jsonError(res, 501, EXISTING_SESSION_LIMITS.hooks.uploadElement);
392
- if (resolvedPaths.length !== 1) return jsonError(res, 501, EXISTING_SESSION_LIMITS.hooks.uploadSingleFile);
393
- const uid = inputRef || ref;
394
- if (!uid) return jsonError(res, 501, EXISTING_SESSION_LIMITS.hooks.uploadRefRequired);
395
- await uploadChromeMcpFile({
396
- profileName: profileCtx.profile.name,
397
- profile: profileCtx.profile,
398
- targetId: tab.targetId,
399
- uid,
400
- filePath: resolvedPaths[0] ?? ""
401
- });
402
- return res.json({ ok: true });
403
- }
404
- const pw = await requirePwAi(res, "file chooser hook");
405
- if (!pw) return;
406
- if (inputRef || element) {
407
- if (ref) return jsonError(res, 400, "ref cannot be combined with inputRef/element");
408
- await pw.setInputFilesViaPlaywright({
409
- cdpUrl,
410
- targetId: tab.targetId,
411
- inputRef,
412
- element,
413
- paths: resolvedPaths
414
- });
415
- } else {
416
- await pw.armFileUploadViaPlaywright({
417
- cdpUrl,
418
- targetId: tab.targetId,
419
- paths: resolvedPaths,
420
- timeoutMs: timeoutMs ?? void 0
421
- });
422
- if (ref) await pw.clickViaPlaywright({
423
- cdpUrl,
424
- targetId: tab.targetId,
425
- ssrfPolicy: ctx.state().resolved.ssrfPolicy,
426
- ref
427
- });
428
- }
429
- res.json({ ok: true });
430
- }
431
- });
432
- }));
433
- app.post("/hooks/dialog", asyncBrowserRoute(async (req, res) => {
434
- const body = readBody(req);
435
- const targetId = resolveTargetIdFromBody(body);
436
- const accept = toBoolean(body.accept);
437
- const promptText = toStringOrEmpty(body.promptText) || void 0;
438
- const timeoutMs = toNumber(body.timeoutMs);
439
- const dialogId = toStringOrEmpty(body.dialogId) || void 0;
440
- if (accept === void 0) return jsonError(res, 400, "accept is required");
441
- await withRouteTabContext({
442
- req,
443
- res,
444
- ctx,
445
- targetId,
446
- run: async ({ profileCtx, cdpUrl, tab }) => {
447
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) {
448
- if (dialogId) return jsonError(res, 501, EXISTING_SESSION_LIMITS.hooks.dialogId);
449
- if (timeoutMs) return jsonError(res, 501, EXISTING_SESSION_LIMITS.hooks.dialogTimeout);
450
- await evaluateChromeMcpScript({
451
- profileName: profileCtx.profile.name,
452
- profile: profileCtx.profile,
453
- targetId: tab.targetId,
454
- fn: `() => {
455
- const state = (window.__daocoreDialogHook ??= {});
456
- if (!state.originals) {
457
- state.originals = {
458
- alert: window.alert.bind(window),
459
- confirm: window.confirm.bind(window),
460
- prompt: window.prompt.bind(window),
461
- };
462
- }
463
- const originals = state.originals;
464
- const restore = () => {
465
- window.alert = originals.alert;
466
- window.confirm = originals.confirm;
467
- window.prompt = originals.prompt;
468
- delete window.__daocoreDialogHook;
469
- };
470
- window.alert = (...args) => {
471
- try {
472
- return undefined;
473
- } finally {
474
- restore();
475
- }
476
- };
477
- window.confirm = (...args) => {
478
- try {
479
- return ${accept ? "true" : "false"};
480
- } finally {
481
- restore();
482
- }
483
- };
484
- window.prompt = (...args) => {
485
- try {
486
- return ${accept ? JSON.stringify(promptText ?? "") : "null"};
487
- } finally {
488
- restore();
489
- }
490
- };
491
- return true;
492
- }`
493
- });
494
- return res.json({ ok: true });
495
- }
496
- const pw = await requirePwAi(res, "dialog hook");
497
- if (!pw) return;
498
- await pw.armDialogViaPlaywright({
499
- cdpUrl,
500
- targetId: tab.targetId,
501
- dialogId,
502
- accept,
503
- promptText,
504
- timeoutMs: timeoutMs ?? void 0
505
- });
506
- res.json({ ok: true });
507
- }
508
- });
509
- }));
510
- }
511
- //#endregion
512
- //#region extensions/browser/src/browser/routes/agent.act.shared.ts
513
- const ACT_KINDS = [
514
- "batch",
515
- "click",
516
- "clickCoords",
517
- "close",
518
- "drag",
519
- "evaluate",
520
- "fill",
521
- "hover",
522
- "scrollIntoView",
523
- "press",
524
- "resize",
525
- "select",
526
- "type",
527
- "wait"
528
- ];
529
- function isActKind(value) {
530
- if (typeof value !== "string") return false;
531
- return ACT_KINDS.includes(value);
532
- }
533
- const ALLOWED_CLICK_MODIFIERS = new Set([
534
- "Alt",
535
- "Control",
536
- "ControlOrMeta",
537
- "Meta",
538
- "Shift"
539
- ]);
540
- function parseClickButton(raw) {
541
- if (raw === "left" || raw === "right" || raw === "middle") return raw;
542
- }
543
- function parseClickModifiers(raw) {
544
- if (raw.filter((m) => !ALLOWED_CLICK_MODIFIERS.has(m)).length) return { error: "modifiers must be Alt|Control|ControlOrMeta|Meta|Shift" };
545
- return { modifiers: raw.length ? raw : void 0 };
546
- }
547
- //#endregion
548
- //#region extensions/browser/src/browser/routes/agent.act.normalize.ts
549
- function normalizeActKind(raw) {
550
- const kind = toStringOrEmpty(raw);
551
- if (!isActKind(kind)) throw new Error("kind is required");
552
- return kind;
553
- }
554
- function countBatchActions(actions) {
555
- let count = 0;
556
- for (const action of actions) {
557
- count += 1;
558
- if (action.kind === "batch") count += countBatchActions(action.actions);
559
- }
560
- return count;
561
- }
562
- function validateBatchTargetIds(actions, targetId) {
563
- for (const action of actions) {
564
- if (action.targetId && action.targetId !== targetId) return "batched action targetId must match request targetId";
565
- if (action.kind === "batch") {
566
- const nestedError = validateBatchTargetIds(action.actions, targetId);
567
- if (nestedError) return nestedError;
568
- }
569
- }
570
- return null;
571
- }
572
- function normalizeFields(rawFields) {
573
- return (Array.isArray(rawFields) ? rawFields : []).map((field) => {
574
- if (!field || typeof field !== "object") return null;
575
- return normalizeBrowserFormField(field);
576
- }).filter((field) => field !== null);
577
- }
578
- function normalizeBatchAction(value) {
579
- if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("batch actions must be objects");
580
- return normalizeActRequest(value, { source: "batch" });
581
- }
582
- function normalizeActRequest(body, options) {
583
- const source = options?.source ?? "request";
584
- const kind = normalizeActKind(body.kind);
585
- switch (kind) {
586
- case "click": {
587
- const ref = toStringOrEmpty(body.ref) || void 0;
588
- const selector = toStringOrEmpty(body.selector) || void 0;
589
- if (!ref && !selector) throw new Error("click requires ref or selector");
590
- const buttonRaw = toStringOrEmpty(body.button);
591
- const button = buttonRaw ? parseClickButton(buttonRaw) : void 0;
592
- if (buttonRaw && !button) throw new Error("click button must be left|right|middle");
593
- const parsedModifiers = parseClickModifiers(toStringArray(body.modifiers) ?? []);
594
- if (parsedModifiers.error) throw new Error(parsedModifiers.error);
595
- const doubleClick = toBoolean(body.doubleClick);
596
- const delayMs = normalizeActBoundedNonNegativeMs(toNumber(body.delayMs), "click delayMs", ACT_MAX_CLICK_DELAY_MS);
597
- const timeoutMs = toNumber(body.timeoutMs);
598
- const targetId = toStringOrEmpty(body.targetId) || void 0;
599
- return {
600
- kind,
601
- ...ref ? { ref } : {},
602
- ...selector ? { selector } : {},
603
- ...targetId ? { targetId } : {},
604
- ...doubleClick !== void 0 ? { doubleClick } : {},
605
- ...button ? { button } : {},
606
- ...parsedModifiers.modifiers ? { modifiers: parsedModifiers.modifiers } : {},
607
- ...delayMs !== void 0 ? { delayMs } : {},
608
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
609
- };
610
- }
611
- case "clickCoords": {
612
- const x = toNumber(body.x);
613
- const y = toNumber(body.y);
614
- if (x === void 0 || y === void 0 || x < 0 || y < 0) throw new Error("clickCoords requires non-negative x and y");
615
- const buttonRaw = toStringOrEmpty(body.button);
616
- const button = buttonRaw ? parseClickButton(buttonRaw) : void 0;
617
- if (buttonRaw && !button) throw new Error("clickCoords button must be left|right|middle");
618
- const doubleClick = toBoolean(body.doubleClick);
619
- const delayMs = normalizeActBoundedNonNegativeMs(toNumber(body.delayMs), "clickCoords delayMs", ACT_MAX_CLICK_DELAY_MS);
620
- const timeoutMs = toNumber(body.timeoutMs);
621
- const targetId = toStringOrEmpty(body.targetId) || void 0;
622
- return {
623
- kind,
624
- x,
625
- y,
626
- ...targetId ? { targetId } : {},
627
- ...doubleClick !== void 0 ? { doubleClick } : {},
628
- ...button ? { button } : {},
629
- ...delayMs !== void 0 ? { delayMs } : {},
630
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
631
- };
632
- }
633
- case "type": {
634
- const ref = toStringOrEmpty(body.ref) || void 0;
635
- const selector = toStringOrEmpty(body.selector) || void 0;
636
- const text = body.text;
637
- if (!ref && !selector) throw new Error("type requires ref or selector");
638
- if (typeof text !== "string") throw new Error("type requires text");
639
- const targetId = toStringOrEmpty(body.targetId) || void 0;
640
- const submit = toBoolean(body.submit);
641
- const slowly = toBoolean(body.slowly);
642
- const timeoutMs = toNumber(body.timeoutMs);
643
- return {
644
- kind,
645
- ...ref ? { ref } : {},
646
- ...selector ? { selector } : {},
647
- text,
648
- ...targetId ? { targetId } : {},
649
- ...submit !== void 0 ? { submit } : {},
650
- ...slowly !== void 0 ? { slowly } : {},
651
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
652
- };
653
- }
654
- case "press": {
655
- const key = toStringOrEmpty(body.key);
656
- if (!key) throw new Error("press requires key");
657
- const targetId = toStringOrEmpty(body.targetId) || void 0;
658
- const delayMs = toNumber(body.delayMs);
659
- return {
660
- kind,
661
- key,
662
- ...targetId ? { targetId } : {},
663
- ...delayMs !== void 0 ? { delayMs } : {}
664
- };
665
- }
666
- case "hover":
667
- case "scrollIntoView": {
668
- const ref = toStringOrEmpty(body.ref) || void 0;
669
- const selector = toStringOrEmpty(body.selector) || void 0;
670
- if (!ref && !selector) throw new Error(`${kind} requires ref or selector`);
671
- const targetId = toStringOrEmpty(body.targetId) || void 0;
672
- const timeoutMs = toNumber(body.timeoutMs);
673
- return {
674
- kind,
675
- ...ref ? { ref } : {},
676
- ...selector ? { selector } : {},
677
- ...targetId ? { targetId } : {},
678
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
679
- };
680
- }
681
- case "drag": {
682
- const startRef = toStringOrEmpty(body.startRef) || void 0;
683
- const startSelector = toStringOrEmpty(body.startSelector) || void 0;
684
- const endRef = toStringOrEmpty(body.endRef) || void 0;
685
- const endSelector = toStringOrEmpty(body.endSelector) || void 0;
686
- if (!startRef && !startSelector) throw new Error("drag requires startRef or startSelector");
687
- if (!endRef && !endSelector) throw new Error("drag requires endRef or endSelector");
688
- const targetId = toStringOrEmpty(body.targetId) || void 0;
689
- const timeoutMs = toNumber(body.timeoutMs);
690
- return {
691
- kind,
692
- ...startRef ? { startRef } : {},
693
- ...startSelector ? { startSelector } : {},
694
- ...endRef ? { endRef } : {},
695
- ...endSelector ? { endSelector } : {},
696
- ...targetId ? { targetId } : {},
697
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
698
- };
699
- }
700
- case "select": {
701
- const ref = toStringOrEmpty(body.ref) || void 0;
702
- const selector = toStringOrEmpty(body.selector) || void 0;
703
- const values = toStringArray(body.values);
704
- if (!ref && !selector || !values?.length) throw new Error("select requires ref/selector and values");
705
- const targetId = toStringOrEmpty(body.targetId) || void 0;
706
- const timeoutMs = toNumber(body.timeoutMs);
707
- return {
708
- kind,
709
- ...ref ? { ref } : {},
710
- ...selector ? { selector } : {},
711
- values,
712
- ...targetId ? { targetId } : {},
713
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
714
- };
715
- }
716
- case "fill": {
717
- const fields = normalizeFields(body.fields);
718
- if (!fields.length) throw new Error("fill requires fields");
719
- const targetId = toStringOrEmpty(body.targetId) || void 0;
720
- const timeoutMs = toNumber(body.timeoutMs);
721
- return {
722
- kind,
723
- fields,
724
- ...targetId ? { targetId } : {},
725
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
726
- };
727
- }
728
- case "resize": {
729
- const width = toNumber(body.width);
730
- const height = toNumber(body.height);
731
- if (width === void 0 || height === void 0 || width <= 0 || height <= 0) throw new Error("resize requires positive width and height");
732
- const targetId = toStringOrEmpty(body.targetId) || void 0;
733
- return {
734
- kind,
735
- width,
736
- height,
737
- ...targetId ? { targetId } : {}
738
- };
739
- }
740
- case "wait": {
741
- const loadStateRaw = toStringOrEmpty(body.loadState);
742
- const loadState = loadStateRaw === "load" || loadStateRaw === "domcontentloaded" || loadStateRaw === "networkidle" ? loadStateRaw : void 0;
743
- const timeMs = normalizeActBoundedNonNegativeMs(toNumber(body.timeMs), "wait timeMs", ACT_MAX_WAIT_TIME_MS);
744
- const text = toStringOrEmpty(body.text) || void 0;
745
- const textGone = toStringOrEmpty(body.textGone) || void 0;
746
- const selector = toStringOrEmpty(body.selector) || void 0;
747
- const url = toStringOrEmpty(body.url) || void 0;
748
- const fn = toStringOrEmpty(body.fn) || void 0;
749
- if (timeMs === void 0 && !text && !textGone && !selector && !url && !loadState && !fn) throw new Error("wait requires at least one of: timeMs, text, textGone, selector, url, loadState, fn");
750
- const targetId = toStringOrEmpty(body.targetId) || void 0;
751
- const timeoutMs = toNumber(body.timeoutMs);
752
- return {
753
- kind,
754
- ...timeMs !== void 0 ? { timeMs } : {},
755
- ...text ? { text } : {},
756
- ...textGone ? { textGone } : {},
757
- ...selector ? { selector } : {},
758
- ...url ? { url } : {},
759
- ...loadState ? { loadState } : {},
760
- ...fn ? { fn } : {},
761
- ...targetId ? { targetId } : {},
762
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
763
- };
764
- }
765
- case "evaluate": {
766
- const fn = toStringOrEmpty(body.fn);
767
- if (!fn) throw new Error("evaluate requires fn");
768
- const ref = toStringOrEmpty(body.ref) || void 0;
769
- const targetId = toStringOrEmpty(body.targetId) || void 0;
770
- const timeoutMs = toNumber(body.timeoutMs);
771
- return {
772
- kind,
773
- fn,
774
- ...ref ? { ref } : {},
775
- ...targetId ? { targetId } : {},
776
- ...timeoutMs !== void 0 ? { timeoutMs } : {}
777
- };
778
- }
779
- case "close": {
780
- const targetId = toStringOrEmpty(body.targetId) || void 0;
781
- return {
782
- kind,
783
- ...targetId ? { targetId } : {}
784
- };
785
- }
786
- case "batch": {
787
- const actions = Array.isArray(body.actions) ? body.actions.map(normalizeBatchAction) : [];
788
- if (!actions.length) throw new Error(source === "batch" ? "batch requires actions" : "actions are required");
789
- if (countBatchActions(actions) > 100) throw new Error(`batch exceeds maximum of 100 actions`);
790
- const targetId = toStringOrEmpty(body.targetId) || void 0;
791
- const stopOnError = toBoolean(body.stopOnError);
792
- return {
793
- kind,
794
- actions,
795
- ...targetId ? { targetId } : {},
796
- ...stopOnError !== void 0 ? { stopOnError } : {}
797
- };
798
- }
799
- }
800
- throw new Error("Unsupported browser act kind");
801
- }
802
- //#endregion
803
- //#region extensions/browser/src/browser/routes/agent.snapshot-target.ts
804
- /** Resolve the correct targetId after a navigation that may trigger a renderer swap. */
805
- async function resolveTargetIdAfterNavigate(opts) {
806
- let currentTargetId = opts.oldTargetId;
807
- try {
808
- const pickReplacement = (tabs, options) => {
809
- if (tabs.some((tab) => tab.targetId === opts.oldTargetId)) return {
810
- targetId: opts.oldTargetId,
811
- shouldRetry: false
812
- };
813
- const byUrl = tabs.filter((tab) => tab.url === opts.navigatedUrl);
814
- if (byUrl.length === 1) return {
815
- targetId: byUrl[0]?.targetId ?? opts.oldTargetId,
816
- shouldRetry: false
817
- };
818
- const uniqueReplacement = byUrl.filter((tab) => tab.targetId !== opts.oldTargetId);
819
- if (uniqueReplacement.length === 1) return {
820
- targetId: uniqueReplacement[0]?.targetId ?? opts.oldTargetId,
821
- shouldRetry: false
822
- };
823
- if (options?.allowSingleTabFallback && tabs.length === 1) return {
824
- targetId: tabs[0]?.targetId ?? opts.oldTargetId,
825
- shouldRetry: false
826
- };
827
- return {
828
- targetId: opts.oldTargetId,
829
- shouldRetry: true
830
- };
831
- };
832
- const first = pickReplacement(await opts.listTabs());
833
- currentTargetId = first.targetId;
834
- if (first.shouldRetry) {
835
- await new Promise((r) => setTimeout(r, opts.retryDelayMs ?? 800));
836
- currentTargetId = pickReplacement(await opts.listTabs(), { allowSingleTabFallback: true }).targetId;
837
- }
838
- } catch {}
839
- return currentTargetId;
840
- }
841
- //#endregion
842
- //#region extensions/browser/src/browser/routes/agent.act.ts
843
- function sleep(ms) {
844
- return new Promise((resolve) => setTimeout(resolve, ms));
845
- }
846
- const EXISTING_SESSION_INTERACTION_NAVIGATION_RECHECK_DELAYS_MS = [
847
- 0,
848
- 250,
849
- 500
850
- ];
851
- async function readExistingSessionLocationHref(params) {
852
- const currentUrl = await evaluateChromeMcpScript({
853
- profileName: params.profileName,
854
- profile: params.profile,
855
- userDataDir: params.userDataDir,
856
- targetId: params.targetId,
857
- fn: "() => window.location.href"
858
- });
859
- if (typeof currentUrl !== "string") throw new Error("Location probe returned a non-string result");
860
- const normalizedUrl = currentUrl.trim();
861
- if (!normalizedUrl) throw new Error("Location probe returned an empty URL");
862
- return normalizedUrl;
863
- }
864
- async function assertExistingSessionPostInteractionNavigationAllowed(params) {
865
- const ssrfPolicyOpts = withBrowserNavigationPolicy(params.ssrfPolicy);
866
- if (!ssrfPolicyOpts.ssrfPolicy) return;
867
- const listTabs = params.listTabs;
868
- const initialTabTargetIds = params.initialTabTargetIds;
869
- const assertNewTabsAllowed = async () => {
870
- const tabs = await listTabs();
871
- for (const tab of tabs) {
872
- if (initialTabTargetIds.has(tab.targetId)) continue;
873
- await assertBrowserNavigationResultAllowed({
874
- url: tab.url,
875
- ...ssrfPolicyOpts
876
- });
877
- }
878
- };
879
- let lastObservedUrl;
880
- let sawStableAllowedUrl = false;
881
- for (const delayMs of EXISTING_SESSION_INTERACTION_NAVIGATION_RECHECK_DELAYS_MS) {
882
- if (delayMs > 0) await sleep(delayMs);
883
- let currentUrl;
884
- try {
885
- currentUrl = await readExistingSessionLocationHref(params);
886
- } catch {
887
- sawStableAllowedUrl = false;
888
- continue;
889
- }
890
- await assertBrowserNavigationResultAllowed({
891
- url: currentUrl,
892
- ...ssrfPolicyOpts
893
- });
894
- if (currentUrl === lastObservedUrl) sawStableAllowedUrl = true;
895
- else sawStableAllowedUrl = false;
896
- lastObservedUrl = currentUrl;
897
- }
898
- if (sawStableAllowedUrl) {
899
- await assertNewTabsAllowed();
900
- return;
901
- }
902
- if (lastObservedUrl) {
903
- const lastDelay = EXISTING_SESSION_INTERACTION_NAVIGATION_RECHECK_DELAYS_MS[EXISTING_SESSION_INTERACTION_NAVIGATION_RECHECK_DELAYS_MS.length - 1];
904
- await sleep(lastDelay);
905
- try {
906
- const followUpUrl = await readExistingSessionLocationHref(params);
907
- await assertBrowserNavigationResultAllowed({
908
- url: followUpUrl,
909
- ...ssrfPolicyOpts
910
- });
911
- if (followUpUrl === lastObservedUrl) {
912
- await assertNewTabsAllowed();
913
- return;
914
- }
915
- } catch {}
916
- }
917
- throw new Error("Unable to verify stable post-interaction navigation");
918
- }
919
- async function runExistingSessionActionWithNavigationGuard(params) {
920
- let actionError;
921
- let result;
922
- try {
923
- result = await params.execute();
924
- } catch (error) {
925
- actionError = error;
926
- }
927
- if (params.guard) await assertExistingSessionPostInteractionNavigationAllowed(params.guard);
928
- if (actionError) throw actionError;
929
- return result;
930
- }
931
- function buildExistingSessionWaitPredicate(params) {
932
- const checks = [];
933
- if (params.text) checks.push(`Boolean(document.body?.innerText?.includes(${JSON.stringify(params.text)}))`);
934
- if (params.textGone) checks.push(`!document.body?.innerText?.includes(${JSON.stringify(params.textGone)})`);
935
- if (params.selector) checks.push(`Boolean(document.querySelector(${JSON.stringify(params.selector)}))`);
936
- if (params.loadState === "domcontentloaded") checks.push(`document.readyState === "interactive" || document.readyState === "complete"`);
937
- else if (params.loadState === "load") checks.push(`document.readyState === "complete"`);
938
- if (params.fn) checks.push(`Boolean(await (${params.fn})())`);
939
- if (checks.length === 0) return null;
940
- return checks.length === 1 ? checks[0] : checks.map((check) => `(${check})`).join(" && ");
941
- }
942
- async function waitForExistingSessionCondition(params) {
943
- if (params.timeMs && params.timeMs > 0) await sleep(params.timeMs);
944
- const predicate = buildExistingSessionWaitPredicate(params);
945
- if (!predicate && !params.url) return;
946
- const timeoutMs = Math.max(250, params.timeoutMs ?? 1e4);
947
- const deadline = Date.now() + timeoutMs;
948
- while (Date.now() < deadline) {
949
- let ready = true;
950
- if (predicate) ready = Boolean(await evaluateChromeMcpScript({
951
- profileName: params.profileName,
952
- profile: params.profile,
953
- userDataDir: params.userDataDir,
954
- targetId: params.targetId,
955
- fn: `async () => ${predicate}`
956
- }));
957
- if (ready && params.url) {
958
- const currentUrl = await evaluateChromeMcpScript({
959
- profileName: params.profileName,
960
- profile: params.profile,
961
- userDataDir: params.userDataDir,
962
- targetId: params.targetId,
963
- fn: "() => window.location.href"
964
- });
965
- ready = typeof currentUrl === "string" && matchBrowserUrlPattern(params.url, currentUrl);
966
- }
967
- if (ready) return;
968
- await sleep(250);
969
- }
970
- throw new Error("Timed out waiting for condition");
971
- }
972
- const SELECTOR_ALLOWED_KINDS = new Set([
973
- "batch",
974
- "click",
975
- "drag",
976
- "hover",
977
- "scrollIntoView",
978
- "select",
979
- "type",
980
- "wait"
981
- ]);
982
- function shouldEnforceCurrentUrlForAct(action) {
983
- return action.kind !== "resize" && action.kind !== "close";
984
- }
985
- function getExistingSessionUnsupportedMessage(action) {
986
- switch (action.kind) {
987
- case "click":
988
- if (action.selector) return EXISTING_SESSION_LIMITS.act.clickSelector;
989
- if (action.button && action.button !== "left" || Array.isArray(action.modifiers) && action.modifiers.length > 0) return EXISTING_SESSION_LIMITS.act.clickButtonOrModifiers;
990
- return null;
991
- case "clickCoords": return null;
992
- case "type":
993
- if (action.selector) return EXISTING_SESSION_LIMITS.act.typeSelector;
994
- if (action.slowly) return EXISTING_SESSION_LIMITS.act.typeSlowly;
995
- return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.typeTimeout : null;
996
- case "press": return action.delayMs ? EXISTING_SESSION_LIMITS.act.pressDelay : null;
997
- case "hover":
998
- if (action.selector) return EXISTING_SESSION_LIMITS.act.hoverSelector;
999
- return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.hoverTimeout : null;
1000
- case "scrollIntoView":
1001
- if (action.selector) return EXISTING_SESSION_LIMITS.act.scrollSelector;
1002
- return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.scrollTimeout : null;
1003
- case "drag":
1004
- if (action.startSelector || action.endSelector) return EXISTING_SESSION_LIMITS.act.dragSelector;
1005
- return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.dragTimeout : null;
1006
- case "select":
1007
- if (action.selector) return EXISTING_SESSION_LIMITS.act.selectSelector;
1008
- if (action.values.length !== 1) return EXISTING_SESSION_LIMITS.act.selectSingleValue;
1009
- return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.selectTimeout : null;
1010
- case "fill": return action.timeoutMs ? EXISTING_SESSION_LIMITS.act.fillTimeout : null;
1011
- case "wait": return action.loadState === "networkidle" ? EXISTING_SESSION_LIMITS.act.waitNetworkIdle : null;
1012
- case "evaluate": return action.timeoutMs !== void 0 ? EXISTING_SESSION_LIMITS.act.evaluateTimeout : null;
1013
- case "batch": return EXISTING_SESSION_LIMITS.act.batch;
1014
- case "resize":
1015
- case "close": return null;
1016
- }
1017
- throw new Error("Unsupported browser act kind");
1018
- }
1019
- function registerBrowserAgentActRoutes(app, ctx) {
1020
- app.post("/act", asyncBrowserRoute(async (req, res) => {
1021
- const body = readBody(req);
1022
- const kindRaw = toStringOrEmpty(body.kind);
1023
- if (!isActKind(kindRaw)) return jsonActError(res, 400, ACT_ERROR_CODES.kindRequired, "kind is required");
1024
- const kind = kindRaw;
1025
- let action;
1026
- try {
1027
- action = normalizeActRequest(body);
1028
- } catch (err) {
1029
- return jsonActError(res, 400, ACT_ERROR_CODES.invalidRequest, formatErrorMessage(err));
1030
- }
1031
- const targetId = resolveTargetIdFromBody(body);
1032
- if (Object.hasOwn(body, "selector") && !SELECTOR_ALLOWED_KINDS.has(kind)) return jsonActError(res, 400, ACT_ERROR_CODES.selectorUnsupported, SELECTOR_UNSUPPORTED_MESSAGE);
1033
- const earlyFn = action.kind === "wait" || action.kind === "evaluate" ? action.fn : "";
1034
- if ((action.kind === "evaluate" || action.kind === "wait" && earlyFn) && !ctx.state().resolved.evaluateEnabled) return jsonActError(res, 403, ACT_ERROR_CODES.evaluateDisabled, browserEvaluateDisabledMessage(action.kind === "evaluate" ? "evaluate" : "wait"));
1035
- await withRouteTabContext({
1036
- req,
1037
- res,
1038
- ctx,
1039
- targetId,
1040
- enforceCurrentUrlAllowed: shouldEnforceCurrentUrlForAct(action),
1041
- run: async ({ profileCtx, cdpUrl, tab, resolveTabUrl }) => {
1042
- const evaluateEnabled = ctx.state().resolved.evaluateEnabled;
1043
- const ssrfPolicy = ctx.state().resolved.ssrfPolicy;
1044
- const isExistingSession = getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp;
1045
- const hasNavigationResultPolicy = Boolean(withBrowserNavigationPolicy(ssrfPolicy).ssrfPolicy);
1046
- const jsonOk = async (extra, options) => {
1047
- const responseTargetId = options?.resolveCurrentTarget && (!isExistingSession || hasNavigationResultPolicy) ? await resolveTargetIdAfterNavigate({
1048
- oldTargetId: tab.targetId,
1049
- navigatedUrl: tab.url,
1050
- listTabs: () => profileCtx.listTabs()
1051
- }) : tab.targetId;
1052
- const url = responseTargetId === tab.targetId ? await resolveTabUrl(tab.url) : await resolveSafeRouteTabUrl({
1053
- ctx,
1054
- profileCtx,
1055
- targetId: responseTargetId,
1056
- fallbackUrl: tab.url
1057
- });
1058
- return res.json({
1059
- ok: true,
1060
- targetId: responseTargetId,
1061
- ...url ? { url } : {},
1062
- ...extra
1063
- });
1064
- };
1065
- if (action.targetId && action.targetId !== tab.targetId) return jsonActError(res, 403, ACT_ERROR_CODES.targetIdMismatch, "action targetId must match request targetId");
1066
- const profileName = profileCtx.profile.name;
1067
- if (isExistingSession) {
1068
- const initialTabTargetIds = hasNavigationResultPolicy ? new Set((await profileCtx.listTabs()).map((currentTab) => currentTab.targetId)) : /* @__PURE__ */ new Set();
1069
- const existingSessionNavigationGuard = {
1070
- profileName,
1071
- profile: profileCtx.profile,
1072
- targetId: tab.targetId,
1073
- ssrfPolicy,
1074
- listTabs: () => profileCtx.listTabs(),
1075
- initialTabTargetIds
1076
- };
1077
- const unsupportedMessage = getExistingSessionUnsupportedMessage(action);
1078
- if (unsupportedMessage) return jsonActError(res, 501, ACT_ERROR_CODES.unsupportedForExistingSession, unsupportedMessage);
1079
- switch (action.kind) {
1080
- case "click":
1081
- await runExistingSessionActionWithNavigationGuard({
1082
- execute: () => clickChromeMcpElement({
1083
- profileName,
1084
- profile: profileCtx.profile,
1085
- targetId: tab.targetId,
1086
- uid: action.ref,
1087
- doubleClick: action.doubleClick ?? false,
1088
- timeoutMs: action.timeoutMs,
1089
- signal: req.signal
1090
- }),
1091
- guard: existingSessionNavigationGuard
1092
- });
1093
- return await jsonOk(void 0, { resolveCurrentTarget: true });
1094
- case "clickCoords":
1095
- await runExistingSessionActionWithNavigationGuard({
1096
- execute: () => clickChromeMcpCoords({
1097
- profileName,
1098
- profile: profileCtx.profile,
1099
- targetId: tab.targetId,
1100
- x: action.x,
1101
- y: action.y,
1102
- doubleClick: action.doubleClick ?? false,
1103
- button: action.button,
1104
- delayMs: action.delayMs
1105
- }),
1106
- guard: existingSessionNavigationGuard
1107
- });
1108
- return await jsonOk(void 0, { resolveCurrentTarget: true });
1109
- case "type":
1110
- await runExistingSessionActionWithNavigationGuard({
1111
- execute: async () => {
1112
- await fillChromeMcpElement({
1113
- profileName,
1114
- profile: profileCtx.profile,
1115
- targetId: tab.targetId,
1116
- uid: action.ref,
1117
- value: action.text
1118
- });
1119
- if (action.submit) await pressChromeMcpKey({
1120
- profileName,
1121
- profile: profileCtx.profile,
1122
- targetId: tab.targetId,
1123
- key: "Enter"
1124
- });
1125
- },
1126
- guard: existingSessionNavigationGuard
1127
- });
1128
- return await jsonOk(void 0, { resolveCurrentTarget: true });
1129
- case "press":
1130
- await runExistingSessionActionWithNavigationGuard({
1131
- execute: () => pressChromeMcpKey({
1132
- profileName,
1133
- profile: profileCtx.profile,
1134
- targetId: tab.targetId,
1135
- key: action.key
1136
- }),
1137
- guard: existingSessionNavigationGuard
1138
- });
1139
- return await jsonOk(void 0, { resolveCurrentTarget: true });
1140
- case "hover":
1141
- await runExistingSessionActionWithNavigationGuard({
1142
- execute: () => hoverChromeMcpElement({
1143
- profileName,
1144
- profile: profileCtx.profile,
1145
- targetId: tab.targetId,
1146
- uid: action.ref
1147
- }),
1148
- guard: existingSessionNavigationGuard
1149
- });
1150
- return await jsonOk();
1151
- case "scrollIntoView":
1152
- await runExistingSessionActionWithNavigationGuard({
1153
- execute: () => evaluateChromeMcpScript({
1154
- profileName,
1155
- profile: profileCtx.profile,
1156
- targetId: tab.targetId,
1157
- fn: `(el) => { el.scrollIntoView({ block: "center", inline: "center" }); return true; }`,
1158
- args: [action.ref]
1159
- }),
1160
- guard: existingSessionNavigationGuard
1161
- });
1162
- return await jsonOk();
1163
- case "drag":
1164
- await runExistingSessionActionWithNavigationGuard({
1165
- execute: () => dragChromeMcpElement({
1166
- profileName,
1167
- profile: profileCtx.profile,
1168
- targetId: tab.targetId,
1169
- fromUid: action.startRef,
1170
- toUid: action.endRef
1171
- }),
1172
- guard: existingSessionNavigationGuard
1173
- });
1174
- return await jsonOk();
1175
- case "select":
1176
- await runExistingSessionActionWithNavigationGuard({
1177
- execute: () => fillChromeMcpElement({
1178
- profileName,
1179
- profile: profileCtx.profile,
1180
- targetId: tab.targetId,
1181
- uid: action.ref,
1182
- value: action.values[0] ?? ""
1183
- }),
1184
- guard: existingSessionNavigationGuard
1185
- });
1186
- return await jsonOk();
1187
- case "fill":
1188
- await runExistingSessionActionWithNavigationGuard({
1189
- execute: () => fillChromeMcpForm({
1190
- profileName,
1191
- profile: profileCtx.profile,
1192
- targetId: tab.targetId,
1193
- elements: action.fields.map((field) => ({
1194
- uid: field.ref,
1195
- value: String(field.value ?? "")
1196
- }))
1197
- }),
1198
- guard: existingSessionNavigationGuard
1199
- });
1200
- return await jsonOk();
1201
- case "resize":
1202
- await resizeChromeMcpPage({
1203
- profileName,
1204
- profile: profileCtx.profile,
1205
- targetId: tab.targetId,
1206
- width: action.width,
1207
- height: action.height
1208
- });
1209
- return await jsonOk();
1210
- case "wait":
1211
- await waitForExistingSessionCondition({
1212
- profileName,
1213
- profile: profileCtx.profile,
1214
- targetId: tab.targetId,
1215
- timeMs: action.timeMs,
1216
- text: action.text,
1217
- textGone: action.textGone,
1218
- selector: action.selector,
1219
- url: action.url,
1220
- loadState: action.loadState,
1221
- fn: action.fn,
1222
- timeoutMs: action.timeoutMs
1223
- });
1224
- return await jsonOk();
1225
- case "evaluate": return await jsonOk({ result: await runExistingSessionActionWithNavigationGuard({
1226
- execute: () => evaluateChromeMcpScript({
1227
- profileName,
1228
- profile: profileCtx.profile,
1229
- targetId: tab.targetId,
1230
- fn: action.fn,
1231
- args: action.ref ? [action.ref] : void 0
1232
- }),
1233
- guard: existingSessionNavigationGuard
1234
- }) });
1235
- case "close":
1236
- await closeChromeMcpTab(profileName, tab.targetId, profileCtx.profile);
1237
- return await jsonOk();
1238
- case "batch": return jsonActError(res, 501, ACT_ERROR_CODES.unsupportedForExistingSession, EXISTING_SESSION_LIMITS.act.batch);
1239
- }
1240
- }
1241
- const pw = await requirePwAi(res, `act:${kind}`);
1242
- if (!pw) return;
1243
- if (action.kind === "batch") {
1244
- const targetIdError = validateBatchTargetIds(action.actions, tab.targetId);
1245
- if (targetIdError) return jsonActError(res, 403, ACT_ERROR_CODES.targetIdMismatch, targetIdError);
1246
- }
1247
- const result = await pw.executeActViaPlaywright({
1248
- cdpUrl,
1249
- action,
1250
- targetId: tab.targetId,
1251
- evaluateEnabled,
1252
- ssrfPolicy,
1253
- signal: req.signal
1254
- });
1255
- if (result.blockedByDialog) return await jsonOk({
1256
- blockedByDialog: true,
1257
- browserState: result.browserState
1258
- });
1259
- switch (action.kind) {
1260
- case "batch": return await jsonOk({ results: result.results ?? [] }, { resolveCurrentTarget: true });
1261
- case "evaluate": return await jsonOk({ result: result.result }, { resolveCurrentTarget: true });
1262
- case "click":
1263
- case "clickCoords": return await jsonOk(void 0, { resolveCurrentTarget: true });
1264
- case "resize": return await jsonOk();
1265
- default: return await jsonOk(void 0, { resolveCurrentTarget: true });
1266
- }
1267
- }
1268
- });
1269
- }));
1270
- registerBrowserAgentActHookRoutes(app, ctx);
1271
- registerBrowserAgentActDownloadRoutes(app, ctx);
1272
- app.post("/response/body", asyncBrowserRoute(async (req, res) => {
1273
- const body = readBody(req);
1274
- const targetId = resolveTargetIdFromBody(body);
1275
- const url = toStringOrEmpty(body.url);
1276
- const timeoutMs = toNumber(body.timeoutMs);
1277
- const maxChars = toNumber(body.maxChars);
1278
- if (!url) return jsonError(res, 400, "url is required");
1279
- await withRouteTabContext({
1280
- req,
1281
- res,
1282
- ctx,
1283
- targetId,
1284
- enforceCurrentUrlAllowed: true,
1285
- run: async ({ profileCtx, cdpUrl, tab, resolveTabUrl }) => {
1286
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) return jsonError(res, 501, EXISTING_SESSION_LIMITS.responseBody);
1287
- const pw = await requirePwAi(res, "response body");
1288
- if (!pw) return;
1289
- const result = await pw.responseBodyViaPlaywright({
1290
- cdpUrl,
1291
- targetId: tab.targetId,
1292
- url,
1293
- timeoutMs: timeoutMs ?? void 0,
1294
- maxChars: maxChars ?? void 0
1295
- });
1296
- const currentUrl = await resolveTabUrl(tab.url);
1297
- res.json({
1298
- ok: true,
1299
- targetId: tab.targetId,
1300
- ...currentUrl ? { url: currentUrl } : {},
1301
- response: result
1302
- });
1303
- }
1304
- });
1305
- }));
1306
- app.post("/highlight", asyncBrowserRoute(async (req, res) => {
1307
- const body = readBody(req);
1308
- const targetId = resolveTargetIdFromBody(body);
1309
- const ref = toStringOrEmpty(body.ref);
1310
- if (!ref) return jsonError(res, 400, "ref is required");
1311
- await withRouteTabContext({
1312
- req,
1313
- res,
1314
- ctx,
1315
- targetId,
1316
- enforceCurrentUrlAllowed: true,
1317
- run: async ({ profileCtx, cdpUrl, tab, resolveTabUrl }) => {
1318
- const jsonOk = async () => {
1319
- const currentUrl = await resolveTabUrl(tab.url);
1320
- return res.json({
1321
- ok: true,
1322
- targetId: tab.targetId,
1323
- ...currentUrl ? { url: currentUrl } : {}
1324
- });
1325
- };
1326
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) {
1327
- await evaluateChromeMcpScript({
1328
- profileName: profileCtx.profile.name,
1329
- profile: profileCtx.profile,
1330
- targetId: tab.targetId,
1331
- args: [ref],
1332
- fn: `(el) => {
1333
- if (!(el instanceof Element)) {
1334
- return false;
1335
- }
1336
- el.scrollIntoView({ block: "center", inline: "center" });
1337
- const previousOutline = el.style.outline;
1338
- const previousOffset = el.style.outlineOffset;
1339
- el.style.outline = "3px solid #FF4500";
1340
- el.style.outlineOffset = "2px";
1341
- setTimeout(() => {
1342
- el.style.outline = previousOutline;
1343
- el.style.outlineOffset = previousOffset;
1344
- }, 2000);
1345
- return true;
1346
- }`
1347
- });
1348
- return await jsonOk();
1349
- }
1350
- const pw = await requirePwAi(res, "highlight");
1351
- if (!pw) return;
1352
- await pw.highlightViaPlaywright({
1353
- cdpUrl,
1354
- targetId: tab.targetId,
1355
- ref
1356
- });
1357
- await jsonOk();
1358
- }
1359
- });
1360
- }));
1361
- }
1362
- //#endregion
1363
- //#region extensions/browser/src/browser/routes/agent.debug.ts
1364
- function registerBrowserAgentDebugRoutes(app, ctx) {
1365
- app.get("/console", asyncBrowserRoute(async (req, res) => {
1366
- const targetId = resolveTargetIdFromQuery(req.query);
1367
- const level = typeof req.query.level === "string" ? req.query.level : "";
1368
- await withPlaywrightRouteContext({
1369
- req,
1370
- res,
1371
- ctx,
1372
- targetId,
1373
- feature: "console messages",
1374
- enforceCurrentUrlAllowed: true,
1375
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1376
- const messages = await pw.getConsoleMessagesViaPlaywright({
1377
- cdpUrl,
1378
- targetId: tab.targetId,
1379
- level: normalizeOptionalString$4(level)
1380
- });
1381
- const url = await resolveTabUrl(tab.url);
1382
- res.json({
1383
- ok: true,
1384
- messages,
1385
- targetId: tab.targetId,
1386
- ...url ? { url } : {}
1387
- });
1388
- }
1389
- });
1390
- }));
1391
- app.get("/errors", asyncBrowserRoute(async (req, res) => {
1392
- const targetId = resolveTargetIdFromQuery(req.query);
1393
- const clear = toBoolean(req.query.clear) ?? false;
1394
- await withPlaywrightRouteContext({
1395
- req,
1396
- res,
1397
- ctx,
1398
- targetId,
1399
- feature: "page errors",
1400
- enforceCurrentUrlAllowed: true,
1401
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1402
- const result = await pw.getPageErrorsViaPlaywright({
1403
- cdpUrl,
1404
- targetId: tab.targetId,
1405
- clear
1406
- });
1407
- const url = await resolveTabUrl(tab.url);
1408
- res.json({
1409
- ok: true,
1410
- targetId: tab.targetId,
1411
- ...url ? { url } : {},
1412
- ...result
1413
- });
1414
- }
1415
- });
1416
- }));
1417
- app.get("/requests", asyncBrowserRoute(async (req, res) => {
1418
- const targetId = resolveTargetIdFromQuery(req.query);
1419
- const filter = typeof req.query.filter === "string" ? req.query.filter : "";
1420
- const clear = toBoolean(req.query.clear) ?? false;
1421
- await withPlaywrightRouteContext({
1422
- req,
1423
- res,
1424
- ctx,
1425
- targetId,
1426
- feature: "network requests",
1427
- enforceCurrentUrlAllowed: true,
1428
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1429
- const result = await pw.getNetworkRequestsViaPlaywright({
1430
- cdpUrl,
1431
- targetId: tab.targetId,
1432
- filter: normalizeOptionalString$4(filter),
1433
- clear
1434
- });
1435
- const url = await resolveTabUrl(tab.url);
1436
- res.json({
1437
- ok: true,
1438
- targetId: tab.targetId,
1439
- ...url ? { url } : {},
1440
- ...result
1441
- });
1442
- }
1443
- });
1444
- }));
1445
- app.get("/dialogs", asyncBrowserRoute(async (req, res) => {
1446
- await withPlaywrightRouteContext({
1447
- req,
1448
- res,
1449
- ctx,
1450
- targetId: resolveTargetIdFromQuery(req.query),
1451
- feature: "dialog state",
1452
- enforceCurrentUrlAllowed: true,
1453
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1454
- const browserState = await pw.getObservedBrowserStateViaPlaywright({
1455
- cdpUrl,
1456
- targetId: tab.targetId,
1457
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
1458
- });
1459
- const url = await resolveTabUrl(tab.url);
1460
- res.json({
1461
- ok: true,
1462
- targetId: tab.targetId,
1463
- ...url ? { url } : {},
1464
- browserState
1465
- });
1466
- }
1467
- });
1468
- }));
1469
- app.post("/trace/start", asyncBrowserRoute(async (req, res) => {
1470
- const body = readBody(req);
1471
- const targetId = resolveTargetIdFromBody(body);
1472
- const screenshots = toBoolean(body.screenshots) ?? void 0;
1473
- const snapshots = toBoolean(body.snapshots) ?? void 0;
1474
- const sources = toBoolean(body.sources) ?? void 0;
1475
- await withPlaywrightRouteContext({
1476
- req,
1477
- res,
1478
- ctx,
1479
- targetId,
1480
- feature: "trace start",
1481
- enforceCurrentUrlAllowed: true,
1482
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1483
- await pw.traceStartViaPlaywright({
1484
- cdpUrl,
1485
- targetId: tab.targetId,
1486
- screenshots,
1487
- snapshots,
1488
- sources
1489
- });
1490
- const url = await resolveTabUrl(tab.url);
1491
- res.json({
1492
- ok: true,
1493
- targetId: tab.targetId,
1494
- ...url ? { url } : {}
1495
- });
1496
- }
1497
- });
1498
- }));
1499
- app.post("/trace/stop", asyncBrowserRoute(async (req, res) => {
1500
- const body = readBody(req);
1501
- const targetId = resolveTargetIdFromBody(body);
1502
- const out = toStringOrEmpty(body.path) || "";
1503
- await withPlaywrightRouteContext({
1504
- req,
1505
- res,
1506
- ctx,
1507
- targetId,
1508
- feature: "trace stop",
1509
- enforceCurrentUrlAllowed: true,
1510
- run: async ({ cdpUrl, tab, pw, resolveTabUrl }) => {
1511
- const tracePath = await resolveWritableOutputPathOrRespond({
1512
- res,
1513
- rootDir: DEFAULT_TRACE_DIR,
1514
- requestedPath: out,
1515
- scopeLabel: "trace directory",
1516
- defaultFileName: `browser-trace-${crypto.randomUUID()}.zip`,
1517
- ensureRootDir: true
1518
- });
1519
- if (!tracePath) return;
1520
- await pw.traceStopViaPlaywright({
1521
- cdpUrl,
1522
- targetId: tab.targetId,
1523
- path: tracePath
1524
- });
1525
- const url = await resolveTabUrl(tab.url);
1526
- res.json({
1527
- ok: true,
1528
- targetId: tab.targetId,
1529
- ...url ? { url } : {},
1530
- path: path.resolve(tracePath)
1531
- });
1532
- }
1533
- });
1534
- }));
1535
- }
1536
- //#endregion
1537
- //#region extensions/browser/src/browser/chrome-mcp.snapshot.ts
1538
- function normalizeRole(node) {
1539
- return normalizeLowercaseStringOrEmpty(node.role) || "generic";
1540
- }
1541
- function escapeQuoted(value) {
1542
- return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
1543
- }
1544
- function shouldIncludeNode(params) {
1545
- if (params.options?.interactive && !INTERACTIVE_ROLES.has(params.role)) return false;
1546
- if (params.options?.compact && STRUCTURAL_ROLES.has(params.role) && !params.name) return false;
1547
- return true;
1548
- }
1549
- function shouldCreateRef(role, name) {
1550
- return INTERACTIVE_ROLES.has(role) || CONTENT_ROLES.has(role) && Boolean(name);
1551
- }
1552
- function createDuplicateTracker() {
1553
- return {
1554
- counts: /* @__PURE__ */ new Map(),
1555
- keysByRef: /* @__PURE__ */ new Map(),
1556
- duplicates: /* @__PURE__ */ new Set()
1557
- };
1558
- }
1559
- function registerRef(tracker, ref, role, name) {
1560
- const key = `${role}:${name ?? ""}`;
1561
- const count = tracker.counts.get(key) ?? 0;
1562
- tracker.counts.set(key, count + 1);
1563
- tracker.keysByRef.set(ref, key);
1564
- if (count > 0) {
1565
- tracker.duplicates.add(key);
1566
- return count;
1567
- }
1568
- }
1569
- function flattenChromeMcpSnapshotToAriaNodes(root, limit = 500) {
1570
- const boundedLimit = Math.max(1, Math.min(2e3, Math.floor(limit)));
1571
- const out = [];
1572
- const visit = (node, depth) => {
1573
- if (out.length >= boundedLimit) return;
1574
- const ref = normalizeString(node.id);
1575
- if (ref) out.push({
1576
- ref,
1577
- role: normalizeRole(node),
1578
- name: normalizeString(node.name) ?? "",
1579
- value: normalizeString(node.value),
1580
- description: normalizeString(node.description),
1581
- depth
1582
- });
1583
- for (const child of node.children ?? []) {
1584
- visit(child, depth + 1);
1585
- if (out.length >= boundedLimit) return;
1586
- }
1587
- };
1588
- visit(root, 0);
1589
- return out;
1590
- }
1591
- function buildAiSnapshotFromChromeMcpSnapshot(params) {
1592
- const refs = {};
1593
- const tracker = createDuplicateTracker();
1594
- const lines = [];
1595
- const visit = (node, depth) => {
1596
- const role = normalizeRole(node);
1597
- const name = normalizeString(node.name);
1598
- const value = normalizeString(node.value);
1599
- const description = normalizeString(node.description);
1600
- const maxDepth = params.options?.maxDepth;
1601
- if (maxDepth !== void 0 && depth > maxDepth) return;
1602
- if (shouldIncludeNode({
1603
- role,
1604
- name,
1605
- options: params.options
1606
- })) {
1607
- let line = `${" ".repeat(depth)}- ${role}`;
1608
- if (name) line += ` "${escapeQuoted(name)}"`;
1609
- const ref = normalizeString(node.id);
1610
- if (ref && shouldCreateRef(role, name)) {
1611
- const nth = registerRef(tracker, ref, role, name);
1612
- refs[ref] = nth === void 0 ? {
1613
- role,
1614
- name
1615
- } : {
1616
- role,
1617
- name,
1618
- nth
1619
- };
1620
- line += ` [ref=${ref}]`;
1621
- }
1622
- if (value) line += ` value="${escapeQuoted(value)}"`;
1623
- if (description) line += ` description="${escapeQuoted(description)}"`;
1624
- lines.push(line);
1625
- }
1626
- for (const child of node.children ?? []) visit(child, depth + 1);
1627
- };
1628
- visit(params.root, 0);
1629
- for (const [ref, data] of Object.entries(refs)) {
1630
- const key = tracker.keysByRef.get(ref);
1631
- if (key && !tracker.duplicates.has(key)) delete data.nth;
1632
- }
1633
- let snapshot = lines.join("\n");
1634
- let truncated = false;
1635
- const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) && params.maxChars > 0 ? Math.floor(params.maxChars) : void 0;
1636
- if (maxChars && snapshot.length > maxChars) {
1637
- snapshot = `${snapshot.slice(0, maxChars)}\n\n[...TRUNCATED - page too large]`;
1638
- truncated = true;
1639
- }
1640
- const stats = getRoleSnapshotStats(snapshot, refs);
1641
- return truncated ? {
1642
- snapshot,
1643
- truncated,
1644
- refs,
1645
- stats
1646
- } : {
1647
- snapshot,
1648
- refs,
1649
- stats
1650
- };
1651
- }
1652
- //#endregion
1653
- //#region extensions/browser/src/browser/screenshot.ts
1654
- const DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE = 2e3;
1655
- const DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES = 5 * 1024 * 1024;
1656
- async function normalizeBrowserScreenshot(buffer, opts) {
1657
- const maxSide = Math.max(1, Math.round(opts?.maxSide ?? 2e3));
1658
- const maxBytes = Math.max(1, Math.round(opts?.maxBytes ?? 5242880));
1659
- const meta = await getImageMetadata(buffer);
1660
- const width = meta?.width ?? 0;
1661
- const height = meta?.height ?? 0;
1662
- const maxDim = Math.max(width, height);
1663
- if (buffer.byteLength <= maxBytes && (maxDim === 0 || width <= maxSide && height <= maxSide)) return { buffer };
1664
- const sideGrid = buildImageResizeSideGrid(maxSide, maxDim > 0 ? Math.min(maxSide, maxDim) : maxSide);
1665
- let smallest = null;
1666
- let processorUnavailableError;
1667
- for (const side of sideGrid) {
1668
- for (const quality of IMAGE_REDUCE_QUALITY_STEPS) {
1669
- let out;
1670
- try {
1671
- out = await resizeToJpeg({
1672
- buffer,
1673
- maxSide: side,
1674
- quality,
1675
- withoutEnlargement: true
1676
- });
1677
- } catch (err) {
1678
- if (isImageProcessorUnavailableError(err)) {
1679
- processorUnavailableError = err;
1680
- break;
1681
- }
1682
- throw err;
1683
- }
1684
- if (!smallest || out.byteLength < smallest.size) smallest = {
1685
- buffer: out,
1686
- size: out.byteLength
1687
- };
1688
- if (out.byteLength <= maxBytes) return {
1689
- buffer: out,
1690
- contentType: "image/jpeg"
1691
- };
1692
- }
1693
- if (processorUnavailableError) break;
1694
- }
1695
- if (processorUnavailableError) throw processorUnavailableError;
1696
- const best = smallest?.buffer ?? buffer;
1697
- throw new Error(`Browser screenshot could not be reduced below ${(maxBytes / (1024 * 1024)).toFixed(0)}MB (got ${(best.byteLength / (1024 * 1024)).toFixed(2)}MB)`);
1698
- }
1699
- //#endregion
1700
- //#region extensions/browser/src/browser/routes/agent.snapshot.plan.ts
1701
- function readStringValue$1(value) {
1702
- return typeof value === "string" ? value : void 0;
1703
- }
1704
- function normalizeOptionalString$1(value) {
1705
- return readStringValue$1(value)?.trim() || void 0;
1706
- }
1707
- function resolveSnapshotPlan(params) {
1708
- const mode = params.query.mode === "efficient" ? "efficient" : void 0;
1709
- const labels = toBoolean(params.query.labels) ?? void 0;
1710
- const urls = toBoolean(params.query.urls) ?? void 0;
1711
- const explicitFormat = params.query.format === "aria" ? "aria" : params.query.format === "ai" ? "ai" : void 0;
1712
- const format = resolveDefaultSnapshotFormat({
1713
- profile: params.profile,
1714
- hasPlaywright: params.hasPlaywright,
1715
- explicitFormat,
1716
- mode
1717
- });
1718
- const limitRaw = readStringValue$1(params.query.limit);
1719
- const hasMaxChars = Object.hasOwn(params.query, "maxChars");
1720
- const maxCharsRaw = readStringValue$1(params.query.maxChars);
1721
- const limit = Number.isFinite(Number(limitRaw)) ? Number(limitRaw) : void 0;
1722
- const maxChars = Number.isFinite(Number(maxCharsRaw)) && Number(maxCharsRaw) > 0 ? Math.floor(Number(maxCharsRaw)) : void 0;
1723
- const resolvedMaxChars = format === "ai" ? hasMaxChars ? maxChars : mode === "efficient" ? DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS : DEFAULT_AI_SNAPSHOT_MAX_CHARS : void 0;
1724
- const interactiveRaw = toBoolean(params.query.interactive);
1725
- const compactRaw = toBoolean(params.query.compact);
1726
- const depthRaw = toNumber(params.query.depth);
1727
- const refsModeRaw = toStringOrEmpty(params.query.refs).trim();
1728
- const refsMode = refsModeRaw === "aria" ? "aria" : refsModeRaw === "role" ? "role" : void 0;
1729
- const interactive = interactiveRaw ?? (mode === "efficient" ? true : void 0);
1730
- const compact = compactRaw ?? (mode === "efficient" ? true : void 0);
1731
- const depth = depthRaw ?? (mode === "efficient" ? 6 : void 0);
1732
- const selectorValue = normalizeOptionalString$1(toStringOrEmpty(params.query.selector));
1733
- const frameSelectorValue = normalizeOptionalString$1(toStringOrEmpty(params.query.frame));
1734
- return {
1735
- format,
1736
- mode,
1737
- labels,
1738
- urls,
1739
- limit,
1740
- resolvedMaxChars,
1741
- interactive,
1742
- compact,
1743
- depth,
1744
- refsMode,
1745
- selectorValue,
1746
- frameSelectorValue,
1747
- wantsRoleSnapshot: labels === true || urls === true || mode === "efficient" || interactive === true || compact === true || depth !== void 0 || Boolean(selectorValue) || Boolean(frameSelectorValue)
1748
- };
1749
- }
1750
- //#endregion
1751
- //#region extensions/browser/src/browser/routes/agent.snapshot.ts
1752
- const CHROME_MCP_OVERLAY_ATTR = "data-daocore-mcp-overlay";
1753
- function browserNavigationPolicyForProfile$1(ctx, profileCtx) {
1754
- return withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy, { browserProxyMode: resolveBrowserNavigationProxyMode({
1755
- resolved: ctx.state().resolved,
1756
- profile: profileCtx.profile
1757
- }) });
1758
- }
1759
- async function collectChromeMcpSnapshotUrls(params) {
1760
- const result = await evaluateChromeMcpScript({
1761
- profileName: params.profileName,
1762
- profile: params.profile,
1763
- userDataDir: params.userDataDir,
1764
- targetId: params.targetId,
1765
- fn: `() => {
1766
- const seen = new Set();
1767
- const out = [];
1768
- for (const anchor of Array.from(document.querySelectorAll("a[href]"))) {
1769
- const href = anchor.href || "";
1770
- if (!href || seen.has(href)) continue;
1771
- const text = (anchor.innerText || anchor.textContent || anchor.getAttribute("aria-label") || "")
1772
- .replace(/\\s+/g, " ")
1773
- .trim()
1774
- .slice(0, 120) || href;
1775
- seen.add(href);
1776
- out.push({ text, url: href });
1777
- if (out.length >= 100) break;
1778
- }
1779
- return out;
1780
- }`
1781
- }).catch(() => []);
1782
- return Array.isArray(result) ? result.filter((entry) => entry && typeof entry === "object" && typeof entry.text === "string" && typeof entry.url === "string") : [];
1783
- }
1784
- function appendSnapshotUrls(snapshot, urls) {
1785
- if (urls.length === 0) return snapshot;
1786
- return `${snapshot}\n\nLinks:\n${urls.map((entry, index) => `${index + 1}. ${entry.text} -> ${entry.url}`).join("\n")}`;
1787
- }
1788
- async function clearChromeMcpOverlay(params) {
1789
- await evaluateChromeMcpScript({
1790
- profileName: params.profileName,
1791
- profile: params.profile,
1792
- userDataDir: params.userDataDir,
1793
- targetId: params.targetId,
1794
- fn: `() => {
1795
- document.querySelectorAll("[${CHROME_MCP_OVERLAY_ATTR}]").forEach((node) => node.remove());
1796
- return true;
1797
- }`
1798
- }).catch(() => {});
1799
- }
1800
- async function renderChromeMcpLabels(params) {
1801
- const refList = JSON.stringify(params.refs);
1802
- const result = await evaluateChromeMcpScript({
1803
- profileName: params.profileName,
1804
- profile: params.profile,
1805
- userDataDir: params.userDataDir,
1806
- targetId: params.targetId,
1807
- args: params.refs,
1808
- fn: `(...elements) => {
1809
- const refs = ${refList};
1810
- document.querySelectorAll("[${CHROME_MCP_OVERLAY_ATTR}]").forEach((node) => node.remove());
1811
- const root = document.createElement("div");
1812
- root.setAttribute("${CHROME_MCP_OVERLAY_ATTR}", "labels");
1813
- root.style.position = "fixed";
1814
- root.style.inset = "0";
1815
- root.style.pointerEvents = "none";
1816
- root.style.zIndex = "2147483647";
1817
- let labels = 0;
1818
- let skipped = 0;
1819
- elements.forEach((el, index) => {
1820
- if (!(el instanceof Element)) {
1821
- skipped += 1;
1822
- return;
1823
- }
1824
- const rect = el.getBoundingClientRect();
1825
- if (rect.width <= 0 && rect.height <= 0) {
1826
- skipped += 1;
1827
- return;
1828
- }
1829
- labels += 1;
1830
- const badge = document.createElement("div");
1831
- badge.setAttribute("${CHROME_MCP_OVERLAY_ATTR}", "label");
1832
- badge.textContent = refs[index] || String(labels);
1833
- badge.style.position = "fixed";
1834
- badge.style.left = \`\${Math.max(0, rect.left)}px\`;
1835
- badge.style.top = \`\${Math.max(0, rect.top)}px\`;
1836
- badge.style.transform = "translateY(-100%)";
1837
- badge.style.padding = "2px 6px";
1838
- badge.style.borderRadius = "999px";
1839
- badge.style.background = "#FF4500";
1840
- badge.style.color = "#fff";
1841
- badge.style.font = "600 12px ui-monospace, SFMono-Regular, Menlo, monospace";
1842
- badge.style.boxShadow = "0 2px 6px rgba(0,0,0,0.35)";
1843
- badge.style.whiteSpace = "nowrap";
1844
- root.appendChild(badge);
1845
- });
1846
- document.documentElement.appendChild(root);
1847
- return { labels, skipped };
1848
- }`
1849
- });
1850
- return {
1851
- labels: result && typeof result === "object" && typeof result.labels === "number" ? result.labels : 0,
1852
- skipped: result && typeof result === "object" && typeof result.skipped === "number" ? result.skipped : 0
1853
- };
1854
- }
1855
- async function saveNormalizedScreenshotResponse(params) {
1856
- const normalized = await normalizeBrowserScreenshot(params.buffer, {
1857
- maxSide: DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,
1858
- maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES
1859
- });
1860
- await saveBrowserMediaResponse({
1861
- res: params.res,
1862
- buffer: normalized.buffer,
1863
- contentType: normalized.contentType ?? `image/${params.type}`,
1864
- maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES,
1865
- targetId: params.targetId,
1866
- url: params.url,
1867
- labels: params.labels,
1868
- labelsCount: params.labelsCount,
1869
- labelsSkipped: params.labelsSkipped
1870
- });
1871
- }
1872
- async function saveBrowserMediaResponse(params) {
1873
- await ensureMediaDir();
1874
- const saved = await saveMediaBuffer(params.buffer, params.contentType, "browser", params.maxBytes);
1875
- params.res.json({
1876
- ok: true,
1877
- path: path.resolve(saved.path),
1878
- targetId: params.targetId,
1879
- url: params.url,
1880
- ...params.labels ? { labels: true } : {},
1881
- ...typeof params.labelsCount === "number" ? { labelsCount: params.labelsCount } : {},
1882
- ...typeof params.labelsSkipped === "number" ? { labelsSkipped: params.labelsSkipped } : {}
1883
- });
1884
- }
1885
- function hasObservableBrowserState(state) {
1886
- if (!state || typeof state !== "object") return false;
1887
- const dialogs = state.dialogs;
1888
- return Boolean(dialogs?.pending?.length || dialogs?.recent?.length);
1889
- }
1890
- function hasPendingDialogs(state) {
1891
- if (!state || typeof state !== "object") return false;
1892
- const dialogs = state.dialogs;
1893
- return Boolean(dialogs?.pending?.length);
1894
- }
1895
- function browserStateResponseFields(state) {
1896
- return hasObservableBrowserState(state) ? { browserState: state } : {};
1897
- }
1898
- function registerBrowserAgentSnapshotRoutes(app, ctx) {
1899
- app.post("/navigate", asyncBrowserRoute(async (req, res) => {
1900
- const body = readBody(req);
1901
- const url = toStringOrEmpty(body.url);
1902
- const targetId = toStringOrEmpty(body.targetId) || void 0;
1903
- if (!url) return jsonError(res, 400, "url is required");
1904
- await withRouteTabContext({
1905
- req,
1906
- res,
1907
- ctx,
1908
- targetId,
1909
- run: async ({ profileCtx, tab, cdpUrl }) => {
1910
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) {
1911
- const ssrfPolicyOpts = browserNavigationPolicyForProfile$1(ctx, profileCtx);
1912
- await assertBrowserNavigationAllowed({
1913
- url,
1914
- ...ssrfPolicyOpts
1915
- });
1916
- const result = await navigateChromeMcpPage({
1917
- profileName: profileCtx.profile.name,
1918
- profile: profileCtx.profile,
1919
- targetId: tab.targetId,
1920
- url
1921
- });
1922
- await assertBrowserNavigationResultAllowed({
1923
- url: result.url,
1924
- ...ssrfPolicyOpts
1925
- });
1926
- return res.json({
1927
- ok: true,
1928
- targetId: tab.targetId,
1929
- ...result
1930
- });
1931
- }
1932
- const pw = await requirePwAi(res, "navigate");
1933
- if (!pw) return;
1934
- const result = await pw.navigateViaPlaywright({
1935
- cdpUrl,
1936
- targetId: tab.targetId,
1937
- url,
1938
- ...browserNavigationPolicyForProfile$1(ctx, profileCtx)
1939
- });
1940
- const currentTargetId = await resolveTargetIdAfterNavigate({
1941
- oldTargetId: tab.targetId,
1942
- navigatedUrl: result.url,
1943
- listTabs: () => profileCtx.listTabs()
1944
- });
1945
- res.json({
1946
- ok: true,
1947
- targetId: currentTargetId,
1948
- ...result
1949
- });
1950
- }
1951
- });
1952
- }));
1953
- app.post("/pdf", asyncBrowserRoute(async (req, res) => {
1954
- const targetId = toStringOrEmpty(readBody(req).targetId) || void 0;
1955
- const profileCtx = resolveProfileContext(req, res, ctx);
1956
- if (!profileCtx) return;
1957
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) return jsonError(res, 501, EXISTING_SESSION_LIMITS.snapshot.pdfUnsupported);
1958
- await withPlaywrightRouteContext({
1959
- req,
1960
- res,
1961
- ctx,
1962
- targetId,
1963
- feature: "pdf",
1964
- enforceCurrentUrlAllowed: true,
1965
- run: async ({ cdpUrl, tab, pw }) => {
1966
- const pdf = await pw.pdfViaPlaywright({
1967
- cdpUrl,
1968
- targetId: tab.targetId
1969
- });
1970
- await saveBrowserMediaResponse({
1971
- res,
1972
- buffer: pdf.buffer,
1973
- contentType: "application/pdf",
1974
- maxBytes: pdf.buffer.byteLength,
1975
- targetId: tab.targetId,
1976
- url: tab.url
1977
- });
1978
- }
1979
- });
1980
- }));
1981
- app.post("/screenshot", asyncBrowserRoute(async (req, res) => {
1982
- const body = readBody(req);
1983
- const targetId = toStringOrEmpty(body.targetId) || void 0;
1984
- const fullPage = toBoolean(body.fullPage) ?? false;
1985
- const ref = toStringOrEmpty(body.ref) || void 0;
1986
- const element = toStringOrEmpty(body.element) || void 0;
1987
- const labels = toBoolean(body.labels) ?? false;
1988
- const type = body.type === "jpeg" ? "jpeg" : "png";
1989
- const timeoutMsRaw = toNumber(body.timeoutMs);
1990
- const timeoutMs = timeoutMsRaw !== void 0 ? Math.max(1, Math.floor(timeoutMsRaw)) : DEFAULT_BROWSER_SCREENSHOT_TIMEOUT_MS;
1991
- if (fullPage && (ref || element)) return jsonError(res, 400, "fullPage is not supported for element screenshots");
1992
- await withRouteTabContext({
1993
- req,
1994
- res,
1995
- ctx,
1996
- targetId,
1997
- enforceCurrentUrlAllowed: true,
1998
- run: async ({ profileCtx, tab, cdpUrl }) => {
1999
- if (getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp) {
2000
- const ssrfPolicyOpts = browserNavigationPolicyForProfile$1(ctx, profileCtx);
2001
- if (ssrfPolicyOpts.ssrfPolicy) await assertBrowserNavigationResultAllowed({
2002
- url: tab.url,
2003
- ...ssrfPolicyOpts
2004
- });
2005
- if (element) return jsonError(res, 400, EXISTING_SESSION_LIMITS.snapshot.screenshotElement);
2006
- if (labels) {
2007
- const built = buildAiSnapshotFromChromeMcpSnapshot({ root: await takeChromeMcpSnapshot({
2008
- profileName: profileCtx.profile.name,
2009
- profile: profileCtx.profile,
2010
- targetId: tab.targetId
2011
- }) });
2012
- const labelResult = await renderChromeMcpLabels({
2013
- profileName: profileCtx.profile.name,
2014
- profile: profileCtx.profile,
2015
- targetId: tab.targetId,
2016
- refs: Object.keys(built.refs)
2017
- });
2018
- try {
2019
- await saveNormalizedScreenshotResponse({
2020
- res,
2021
- buffer: await takeChromeMcpScreenshot({
2022
- profileName: profileCtx.profile.name,
2023
- profile: profileCtx.profile,
2024
- targetId: tab.targetId,
2025
- fullPage,
2026
- format: type,
2027
- timeoutMs
2028
- }),
2029
- type,
2030
- targetId: tab.targetId,
2031
- url: tab.url,
2032
- labels: true,
2033
- labelsCount: labelResult.labels,
2034
- labelsSkipped: labelResult.skipped
2035
- });
2036
- } finally {
2037
- await clearChromeMcpOverlay({
2038
- profileName: profileCtx.profile.name,
2039
- profile: profileCtx.profile,
2040
- targetId: tab.targetId
2041
- });
2042
- }
2043
- return;
2044
- }
2045
- await saveNormalizedScreenshotResponse({
2046
- res,
2047
- buffer: await takeChromeMcpScreenshot({
2048
- profileName: profileCtx.profile.name,
2049
- profile: profileCtx.profile,
2050
- targetId: tab.targetId,
2051
- uid: ref,
2052
- fullPage,
2053
- format: type,
2054
- timeoutMs
2055
- }),
2056
- type,
2057
- targetId: tab.targetId,
2058
- url: tab.url
2059
- });
2060
- return;
2061
- }
2062
- let buffer;
2063
- if (labels || shouldUsePlaywrightForScreenshot({
2064
- profile: profileCtx.profile,
2065
- wsUrl: tab.wsUrl,
2066
- ref,
2067
- element
2068
- })) {
2069
- const pw = await requirePwAi(res, "screenshot");
2070
- if (!pw) return;
2071
- if (labels) {
2072
- const snap = await pw.snapshotRoleViaPlaywright({
2073
- cdpUrl,
2074
- targetId: tab.targetId,
2075
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
2076
- });
2077
- const labeled = await pw.screenshotWithLabelsViaPlaywright({
2078
- cdpUrl,
2079
- targetId: tab.targetId,
2080
- refs: snap.refs,
2081
- type,
2082
- timeoutMs
2083
- });
2084
- await saveNormalizedScreenshotResponse({
2085
- res,
2086
- buffer: labeled.buffer,
2087
- type,
2088
- targetId: tab.targetId,
2089
- url: tab.url,
2090
- labels: true,
2091
- labelsCount: labeled.labels,
2092
- labelsSkipped: labeled.skipped
2093
- });
2094
- return;
2095
- }
2096
- buffer = (await pw.takeScreenshotViaPlaywright({
2097
- cdpUrl,
2098
- targetId: tab.targetId,
2099
- ref,
2100
- element,
2101
- fullPage,
2102
- type,
2103
- timeoutMs
2104
- })).buffer;
2105
- } else buffer = await captureScreenshot({
2106
- wsUrl: tab.wsUrl ?? "",
2107
- fullPage,
2108
- format: type,
2109
- quality: type === "jpeg" ? 85 : void 0,
2110
- timeoutMs
2111
- });
2112
- await saveNormalizedScreenshotResponse({
2113
- res,
2114
- buffer,
2115
- type,
2116
- targetId: tab.targetId,
2117
- url: tab.url
2118
- });
2119
- }
2120
- });
2121
- }));
2122
- app.get("/snapshot", asyncBrowserRoute(async (req, res) => {
2123
- const profileCtx = resolveProfileContext(req, res, ctx);
2124
- if (!profileCtx) return;
2125
- const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
2126
- const pwModule = await getPwAiModule();
2127
- const hasPlaywright = Boolean(pwModule);
2128
- const plan = resolveSnapshotPlan({
2129
- profile: profileCtx.profile,
2130
- query: req.query,
2131
- hasPlaywright
2132
- });
2133
- try {
2134
- const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
2135
- const usesChromeMcp = getBrowserProfileCapabilities(profileCtx.profile).usesChromeMcp;
2136
- const ssrfPolicyOpts = browserNavigationPolicyForProfile$1(ctx, profileCtx);
2137
- let observedBrowserState;
2138
- if (!usesChromeMcp && pwModule) {
2139
- await assertBrowserNavigationResultAllowed({
2140
- url: tab.url,
2141
- ...ssrfPolicyOpts
2142
- });
2143
- observedBrowserState = await pwModule.getObservedBrowserStateViaPlaywright({
2144
- cdpUrl: profileCtx.profile.cdpUrl,
2145
- targetId: tab.targetId,
2146
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
2147
- }).catch(() => void 0);
2148
- }
2149
- if ((plan.labels || plan.mode === "efficient") && plan.format === "aria") return jsonError(res, 400, "labels/mode=efficient require format=ai");
2150
- if (usesChromeMcp) {
2151
- if (plan.selectorValue || plan.frameSelectorValue) return jsonError(res, 400, EXISTING_SESSION_LIMITS.snapshot.snapshotSelector);
2152
- if (ssrfPolicyOpts.ssrfPolicy) await assertBrowserNavigationResultAllowed({
2153
- url: tab.url,
2154
- ...ssrfPolicyOpts
2155
- });
2156
- const snapshot = await takeChromeMcpSnapshot({
2157
- profileName: profileCtx.profile.name,
2158
- profile: profileCtx.profile,
2159
- targetId: tab.targetId
2160
- });
2161
- if (plan.format === "aria") return res.json({
2162
- ok: true,
2163
- format: "aria",
2164
- targetId: tab.targetId,
2165
- url: tab.url,
2166
- nodes: flattenChromeMcpSnapshotToAriaNodes(snapshot, plan.limit)
2167
- });
2168
- const built = buildAiSnapshotFromChromeMcpSnapshot({
2169
- root: snapshot,
2170
- options: {
2171
- interactive: plan.interactive ?? void 0,
2172
- compact: plan.compact ?? void 0,
2173
- maxDepth: plan.depth ?? void 0
2174
- },
2175
- maxChars: plan.resolvedMaxChars
2176
- });
2177
- const builtWithUrls = plan.urls ? {
2178
- ...built,
2179
- snapshot: appendSnapshotUrls(built.snapshot, await collectChromeMcpSnapshotUrls({
2180
- profileName: profileCtx.profile.name,
2181
- profile: profileCtx.profile,
2182
- targetId: tab.targetId
2183
- }))
2184
- } : built;
2185
- if (plan.labels) {
2186
- const refs = Object.keys(builtWithUrls.refs);
2187
- const labelResult = await renderChromeMcpLabels({
2188
- profileName: profileCtx.profile.name,
2189
- profile: profileCtx.profile,
2190
- targetId: tab.targetId,
2191
- refs
2192
- });
2193
- try {
2194
- const normalized = await normalizeBrowserScreenshot(await takeChromeMcpScreenshot({
2195
- profileName: profileCtx.profile.name,
2196
- profile: profileCtx.profile,
2197
- targetId: tab.targetId,
2198
- format: "png"
2199
- }), {
2200
- maxSide: DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,
2201
- maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES
2202
- });
2203
- await ensureMediaDir();
2204
- const saved = await saveMediaBuffer(normalized.buffer, normalized.contentType ?? "image/png", "browser", DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES);
2205
- return res.json({
2206
- ok: true,
2207
- format: "ai",
2208
- targetId: tab.targetId,
2209
- url: tab.url,
2210
- labels: true,
2211
- labelsCount: labelResult.labels,
2212
- labelsSkipped: labelResult.skipped,
2213
- imagePath: path.resolve(saved.path),
2214
- imageType: normalized.contentType?.includes("jpeg") ? "jpeg" : "png",
2215
- ...builtWithUrls
2216
- });
2217
- } finally {
2218
- await clearChromeMcpOverlay({
2219
- profileName: profileCtx.profile.name,
2220
- profile: profileCtx.profile,
2221
- targetId: tab.targetId
2222
- });
2223
- }
2224
- }
2225
- return res.json({
2226
- ok: true,
2227
- format: "ai",
2228
- targetId: tab.targetId,
2229
- url: tab.url,
2230
- ...builtWithUrls
2231
- });
2232
- }
2233
- if (hasPendingDialogs(observedBrowserState)) return res.json({
2234
- ok: true,
2235
- format: plan.format,
2236
- targetId: tab.targetId,
2237
- url: tab.url,
2238
- blockedByDialog: true,
2239
- ...browserStateResponseFields(observedBrowserState),
2240
- ...plan.format === "aria" ? { nodes: [] } : {
2241
- snapshot: "",
2242
- refs: {}
2243
- }
2244
- });
2245
- if (plan.format === "ai") {
2246
- const roleSnapshotArgs = {
2247
- cdpUrl: profileCtx.profile.cdpUrl,
2248
- targetId: tab.targetId,
2249
- selector: plan.selectorValue,
2250
- frameSelector: plan.frameSelectorValue,
2251
- refsMode: plan.refsMode,
2252
- ssrfPolicy: ctx.state().resolved.ssrfPolicy,
2253
- urls: plan.urls,
2254
- options: {
2255
- interactive: plan.interactive ?? void 0,
2256
- compact: plan.compact ?? void 0,
2257
- maxDepth: plan.depth ?? void 0
2258
- }
2259
- };
2260
- const cdpRoleSnapshot = async () => {
2261
- if (!tab.wsUrl) return null;
2262
- if (plan.selectorValue || plan.frameSelectorValue) return null;
2263
- return await snapshotRoleViaCdp({
2264
- wsUrl: tab.wsUrl,
2265
- urls: plan.urls,
2266
- options: {
2267
- interactive: plan.interactive ?? void 0,
2268
- compact: plan.compact ?? void 0,
2269
- maxDepth: plan.depth ?? void 0
2270
- }
2271
- });
2272
- };
2273
- const pw = await getPwAiModule();
2274
- const snap = plan.wantsRoleSnapshot ? pw ? await pw.snapshotRoleViaPlaywright(roleSnapshotArgs).catch(async (err) => {
2275
- const fallback = await cdpRoleSnapshot();
2276
- if (fallback) return fallback;
2277
- throw err;
2278
- }) : await cdpRoleSnapshot() : pw ? await pw.snapshotAiViaPlaywright({
2279
- cdpUrl: profileCtx.profile.cdpUrl,
2280
- targetId: tab.targetId,
2281
- ssrfPolicy: ctx.state().resolved.ssrfPolicy,
2282
- urls: plan.urls,
2283
- ...typeof plan.resolvedMaxChars === "number" ? { maxChars: plan.resolvedMaxChars } : {}
2284
- }) : await cdpRoleSnapshot();
2285
- if (!snap) {
2286
- await requirePwAi(res, "ai snapshot");
2287
- return;
2288
- }
2289
- if (plan.labels) {
2290
- if (!pw) return jsonError(res, 501, "Snapshot labels require Playwright.");
2291
- const labeled = await pw.screenshotWithLabelsViaPlaywright({
2292
- cdpUrl: profileCtx.profile.cdpUrl,
2293
- targetId: tab.targetId,
2294
- refs: "refs" in snap ? snap.refs : {},
2295
- type: "png"
2296
- });
2297
- const normalized = await normalizeBrowserScreenshot(labeled.buffer, {
2298
- maxSide: DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,
2299
- maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES
2300
- });
2301
- await ensureMediaDir();
2302
- const saved = await saveMediaBuffer(normalized.buffer, normalized.contentType ?? "image/png", "browser", DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES);
2303
- const imageType = normalized.contentType?.includes("jpeg") ? "jpeg" : "png";
2304
- return res.json({
2305
- ok: true,
2306
- format: plan.format,
2307
- targetId: tab.targetId,
2308
- url: tab.url,
2309
- ...browserStateResponseFields(observedBrowserState),
2310
- labels: true,
2311
- labelsCount: labeled.labels,
2312
- labelsSkipped: labeled.skipped,
2313
- imagePath: path.resolve(saved.path),
2314
- imageType,
2315
- ...snap
2316
- });
2317
- }
2318
- return res.json({
2319
- ok: true,
2320
- format: plan.format,
2321
- targetId: tab.targetId,
2322
- url: tab.url,
2323
- ...browserStateResponseFields(observedBrowserState),
2324
- ...snap
2325
- });
2326
- }
2327
- const usePlaywrightAriaSnapshot = shouldUsePlaywrightForAriaSnapshot({
2328
- profile: profileCtx.profile,
2329
- wsUrl: tab.wsUrl
2330
- });
2331
- const snap = usePlaywrightAriaSnapshot ? requirePwAi(res, "aria snapshot").then(async (pw) => {
2332
- if (!pw) return null;
2333
- return await pw.snapshotAriaViaPlaywright({
2334
- cdpUrl: profileCtx.profile.cdpUrl,
2335
- targetId: tab.targetId,
2336
- limit: plan.limit,
2337
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
2338
- });
2339
- }) : snapshotAria({
2340
- wsUrl: tab.wsUrl ?? "",
2341
- limit: plan.limit
2342
- });
2343
- const resolved = await Promise.resolve(snap);
2344
- if (!resolved) return;
2345
- if (!usePlaywrightAriaSnapshot) await pwModule?.storeAriaSnapshotRefsViaPlaywright?.({
2346
- cdpUrl: profileCtx.profile.cdpUrl,
2347
- targetId: tab.targetId,
2348
- nodes: resolved.nodes
2349
- });
2350
- return res.json({
2351
- ok: true,
2352
- format: plan.format,
2353
- targetId: tab.targetId,
2354
- url: tab.url,
2355
- ...browserStateResponseFields(observedBrowserState),
2356
- ...resolved
2357
- });
2358
- } catch (err) {
2359
- handleRouteError(ctx, res, err);
2360
- }
2361
- }));
2362
- }
2363
- //#endregion
2364
- //#region extensions/browser/src/browser/routes/agent.storage.ts
2365
- function readStringValue(value) {
2366
- return typeof value === "string" ? value : void 0;
2367
- }
2368
- function normalizeOptionalString(value) {
2369
- return readStringValue(value)?.trim() || void 0;
2370
- }
2371
- function parseStorageKind(raw) {
2372
- if (raw === "local" || raw === "session") return raw;
2373
- return null;
2374
- }
2375
- function parseStorageMutationRequest(kindParam, body) {
2376
- return {
2377
- kind: parseStorageKind(toStringOrEmpty(kindParam)),
2378
- targetId: resolveTargetIdFromBody(body)
2379
- };
2380
- }
2381
- function parseRequiredStorageMutationRequest(kindParam, body) {
2382
- const parsed = parseStorageMutationRequest(kindParam, body);
2383
- if (!parsed.kind) return null;
2384
- return {
2385
- kind: parsed.kind,
2386
- targetId: parsed.targetId
2387
- };
2388
- }
2389
- function parseStorageMutationOrRespond(res, kindParam, body) {
2390
- const parsed = parseRequiredStorageMutationRequest(kindParam, body);
2391
- if (!parsed) {
2392
- jsonError(res, 400, "kind must be local|session");
2393
- return null;
2394
- }
2395
- return parsed;
2396
- }
2397
- function parseStorageMutationFromRequest(req, res) {
2398
- const body = readBody(req);
2399
- const parsed = parseStorageMutationOrRespond(res, req.params.kind, body);
2400
- if (!parsed) return null;
2401
- return {
2402
- body,
2403
- parsed
2404
- };
2405
- }
2406
- function registerBrowserAgentStorageRoutes(app, ctx) {
2407
- app.get("/cookies", asyncBrowserRoute(async (req, res) => {
2408
- await withPlaywrightRouteContext({
2409
- req,
2410
- res,
2411
- ctx,
2412
- targetId: resolveTargetIdFromQuery(req.query),
2413
- feature: "cookies",
2414
- enforceCurrentUrlAllowed: true,
2415
- run: async ({ cdpUrl, tab, pw }) => {
2416
- const result = await pw.cookiesGetViaPlaywright({
2417
- cdpUrl,
2418
- targetId: tab.targetId
2419
- });
2420
- res.json({
2421
- ok: true,
2422
- targetId: tab.targetId,
2423
- ...result
2424
- });
2425
- }
2426
- });
2427
- }));
2428
- app.post("/cookies/set", asyncBrowserRoute(async (req, res) => {
2429
- const body = readBody(req);
2430
- const targetId = resolveTargetIdFromBody(body);
2431
- const cookie = body.cookie && typeof body.cookie === "object" && !Array.isArray(body.cookie) ? body.cookie : null;
2432
- if (!cookie) return jsonError(res, 400, "cookie is required");
2433
- await withPlaywrightRouteContext({
2434
- req,
2435
- res,
2436
- ctx,
2437
- targetId,
2438
- feature: "cookies set",
2439
- run: async ({ cdpUrl, tab, pw }) => {
2440
- await pw.cookiesSetViaPlaywright({
2441
- cdpUrl,
2442
- targetId: tab.targetId,
2443
- cookie: {
2444
- name: toStringOrEmpty(cookie.name),
2445
- value: toStringOrEmpty(cookie.value),
2446
- url: toStringOrEmpty(cookie.url) || void 0,
2447
- domain: toStringOrEmpty(cookie.domain) || void 0,
2448
- path: toStringOrEmpty(cookie.path) || void 0,
2449
- expires: toNumber(cookie.expires) ?? void 0,
2450
- httpOnly: toBoolean(cookie.httpOnly) ?? void 0,
2451
- secure: toBoolean(cookie.secure) ?? void 0,
2452
- sameSite: cookie.sameSite === "Lax" || cookie.sameSite === "None" || cookie.sameSite === "Strict" ? cookie.sameSite : void 0
2453
- }
2454
- });
2455
- res.json({
2456
- ok: true,
2457
- targetId: tab.targetId
2458
- });
2459
- }
2460
- });
2461
- }));
2462
- app.post("/cookies/clear", asyncBrowserRoute(async (req, res) => {
2463
- await withPlaywrightRouteContext({
2464
- req,
2465
- res,
2466
- ctx,
2467
- targetId: resolveTargetIdFromBody(readBody(req)),
2468
- feature: "cookies clear",
2469
- run: async ({ cdpUrl, tab, pw }) => {
2470
- await pw.cookiesClearViaPlaywright({
2471
- cdpUrl,
2472
- targetId: tab.targetId
2473
- });
2474
- res.json({
2475
- ok: true,
2476
- targetId: tab.targetId
2477
- });
2478
- }
2479
- });
2480
- }));
2481
- app.get("/storage/:kind", asyncBrowserRoute(async (req, res) => {
2482
- const kind = parseStorageKind(toStringOrEmpty(req.params.kind));
2483
- if (!kind) return jsonError(res, 400, "kind must be local|session");
2484
- const targetId = resolveTargetIdFromQuery(req.query);
2485
- const key = toStringOrEmpty(req.query.key);
2486
- await withPlaywrightRouteContext({
2487
- req,
2488
- res,
2489
- ctx,
2490
- targetId,
2491
- feature: "storage get",
2492
- enforceCurrentUrlAllowed: true,
2493
- run: async ({ cdpUrl, tab, pw }) => {
2494
- const result = await pw.storageGetViaPlaywright({
2495
- cdpUrl,
2496
- targetId: tab.targetId,
2497
- kind,
2498
- key: normalizeOptionalString(key)
2499
- });
2500
- res.json({
2501
- ok: true,
2502
- targetId: tab.targetId,
2503
- ...result
2504
- });
2505
- }
2506
- });
2507
- }));
2508
- app.post("/storage/:kind/set", asyncBrowserRoute(async (req, res) => {
2509
- const mutation = parseStorageMutationFromRequest(req, res);
2510
- if (!mutation) return;
2511
- const key = toStringOrEmpty(mutation.body.key);
2512
- if (!key) return jsonError(res, 400, "key is required");
2513
- const value = typeof mutation.body.value === "string" ? mutation.body.value : "";
2514
- await withPlaywrightRouteContext({
2515
- req,
2516
- res,
2517
- ctx,
2518
- targetId: mutation.parsed.targetId,
2519
- feature: "storage set",
2520
- run: async ({ cdpUrl, tab, pw }) => {
2521
- await pw.storageSetViaPlaywright({
2522
- cdpUrl,
2523
- targetId: tab.targetId,
2524
- kind: mutation.parsed.kind,
2525
- key,
2526
- value
2527
- });
2528
- res.json({
2529
- ok: true,
2530
- targetId: tab.targetId
2531
- });
2532
- }
2533
- });
2534
- }));
2535
- app.post("/storage/:kind/clear", asyncBrowserRoute(async (req, res) => {
2536
- const mutation = parseStorageMutationFromRequest(req, res);
2537
- if (!mutation) return;
2538
- await withPlaywrightRouteContext({
2539
- req,
2540
- res,
2541
- ctx,
2542
- targetId: mutation.parsed.targetId,
2543
- feature: "storage clear",
2544
- run: async ({ cdpUrl, tab, pw }) => {
2545
- await pw.storageClearViaPlaywright({
2546
- cdpUrl,
2547
- targetId: tab.targetId,
2548
- kind: mutation.parsed.kind
2549
- });
2550
- res.json({
2551
- ok: true,
2552
- targetId: tab.targetId
2553
- });
2554
- }
2555
- });
2556
- }));
2557
- app.post("/set/offline", asyncBrowserRoute(async (req, res) => {
2558
- const body = readBody(req);
2559
- const targetId = resolveTargetIdFromBody(body);
2560
- const offline = toBoolean(body.offline);
2561
- if (offline === void 0) return jsonError(res, 400, "offline is required");
2562
- await withPlaywrightRouteContext({
2563
- req,
2564
- res,
2565
- ctx,
2566
- targetId,
2567
- feature: "offline",
2568
- run: async ({ cdpUrl, tab, pw }) => {
2569
- await pw.setOfflineViaPlaywright({
2570
- cdpUrl,
2571
- targetId: tab.targetId,
2572
- offline
2573
- });
2574
- res.json({
2575
- ok: true,
2576
- targetId: tab.targetId
2577
- });
2578
- }
2579
- });
2580
- }));
2581
- app.post("/set/headers", asyncBrowserRoute(async (req, res) => {
2582
- const body = readBody(req);
2583
- const targetId = resolveTargetIdFromBody(body);
2584
- const headers = body.headers && typeof body.headers === "object" && !Array.isArray(body.headers) ? body.headers : null;
2585
- if (!headers) return jsonError(res, 400, "headers is required");
2586
- const parsed = {};
2587
- for (const [k, v] of Object.entries(headers)) if (typeof v === "string") parsed[k] = v;
2588
- await withPlaywrightRouteContext({
2589
- req,
2590
- res,
2591
- ctx,
2592
- targetId,
2593
- feature: "headers",
2594
- run: async ({ cdpUrl, tab, pw }) => {
2595
- await pw.setExtraHTTPHeadersViaPlaywright({
2596
- cdpUrl,
2597
- targetId: tab.targetId,
2598
- headers: parsed
2599
- });
2600
- res.json({
2601
- ok: true,
2602
- targetId: tab.targetId
2603
- });
2604
- }
2605
- });
2606
- }));
2607
- app.post("/set/credentials", asyncBrowserRoute(async (req, res) => {
2608
- const body = readBody(req);
2609
- const targetId = resolveTargetIdFromBody(body);
2610
- const clear = toBoolean(body.clear) ?? false;
2611
- const username = toStringOrEmpty(body.username) || void 0;
2612
- const password = readStringValue(body.password);
2613
- await withPlaywrightRouteContext({
2614
- req,
2615
- res,
2616
- ctx,
2617
- targetId,
2618
- feature: "http credentials",
2619
- run: async ({ cdpUrl, tab, pw }) => {
2620
- await pw.setHttpCredentialsViaPlaywright({
2621
- cdpUrl,
2622
- targetId: tab.targetId,
2623
- username,
2624
- password,
2625
- clear
2626
- });
2627
- res.json({
2628
- ok: true,
2629
- targetId: tab.targetId
2630
- });
2631
- }
2632
- });
2633
- }));
2634
- app.post("/set/geolocation", asyncBrowserRoute(async (req, res) => {
2635
- const body = readBody(req);
2636
- const targetId = resolveTargetIdFromBody(body);
2637
- const clear = toBoolean(body.clear) ?? false;
2638
- const latitude = toNumber(body.latitude);
2639
- const longitude = toNumber(body.longitude);
2640
- const accuracy = toNumber(body.accuracy) ?? void 0;
2641
- const origin = toStringOrEmpty(body.origin) || void 0;
2642
- await withPlaywrightRouteContext({
2643
- req,
2644
- res,
2645
- ctx,
2646
- targetId,
2647
- feature: "geolocation",
2648
- run: async ({ cdpUrl, tab, pw }) => {
2649
- await pw.setGeolocationViaPlaywright({
2650
- cdpUrl,
2651
- targetId: tab.targetId,
2652
- latitude,
2653
- longitude,
2654
- accuracy,
2655
- origin,
2656
- clear
2657
- });
2658
- res.json({
2659
- ok: true,
2660
- targetId: tab.targetId
2661
- });
2662
- }
2663
- });
2664
- }));
2665
- app.post("/set/media", asyncBrowserRoute(async (req, res) => {
2666
- const body = readBody(req);
2667
- const targetId = resolveTargetIdFromBody(body);
2668
- const schemeRaw = toStringOrEmpty(body.colorScheme);
2669
- const colorScheme = schemeRaw === "dark" || schemeRaw === "light" || schemeRaw === "no-preference" ? schemeRaw : schemeRaw === "none" ? null : void 0;
2670
- if (colorScheme === void 0) return jsonError(res, 400, "colorScheme must be dark|light|no-preference|none");
2671
- await withPlaywrightRouteContext({
2672
- req,
2673
- res,
2674
- ctx,
2675
- targetId,
2676
- feature: "media emulation",
2677
- run: async ({ cdpUrl, tab, pw }) => {
2678
- await pw.emulateMediaViaPlaywright({
2679
- cdpUrl,
2680
- targetId: tab.targetId,
2681
- colorScheme
2682
- });
2683
- res.json({
2684
- ok: true,
2685
- targetId: tab.targetId
2686
- });
2687
- }
2688
- });
2689
- }));
2690
- app.post("/set/timezone", asyncBrowserRoute(async (req, res) => {
2691
- const body = readBody(req);
2692
- const targetId = resolveTargetIdFromBody(body);
2693
- const timezoneId = toStringOrEmpty(body.timezoneId);
2694
- if (!timezoneId) return jsonError(res, 400, "timezoneId is required");
2695
- await withPlaywrightRouteContext({
2696
- req,
2697
- res,
2698
- ctx,
2699
- targetId,
2700
- feature: "timezone",
2701
- run: async ({ cdpUrl, tab, pw }) => {
2702
- await pw.setTimezoneViaPlaywright({
2703
- cdpUrl,
2704
- targetId: tab.targetId,
2705
- timezoneId
2706
- });
2707
- res.json({
2708
- ok: true,
2709
- targetId: tab.targetId
2710
- });
2711
- }
2712
- });
2713
- }));
2714
- app.post("/set/locale", asyncBrowserRoute(async (req, res) => {
2715
- const body = readBody(req);
2716
- const targetId = resolveTargetIdFromBody(body);
2717
- const locale = toStringOrEmpty(body.locale);
2718
- if (!locale) return jsonError(res, 400, "locale is required");
2719
- await withPlaywrightRouteContext({
2720
- req,
2721
- res,
2722
- ctx,
2723
- targetId,
2724
- feature: "locale",
2725
- run: async ({ cdpUrl, tab, pw }) => {
2726
- await pw.setLocaleViaPlaywright({
2727
- cdpUrl,
2728
- targetId: tab.targetId,
2729
- locale
2730
- });
2731
- res.json({
2732
- ok: true,
2733
- targetId: tab.targetId
2734
- });
2735
- }
2736
- });
2737
- }));
2738
- app.post("/set/device", asyncBrowserRoute(async (req, res) => {
2739
- const body = readBody(req);
2740
- const targetId = resolveTargetIdFromBody(body);
2741
- const name = toStringOrEmpty(body.name);
2742
- if (!name) return jsonError(res, 400, "name is required");
2743
- await withPlaywrightRouteContext({
2744
- req,
2745
- res,
2746
- ctx,
2747
- targetId,
2748
- feature: "device emulation",
2749
- run: async ({ cdpUrl, tab, pw }) => {
2750
- await pw.setDeviceViaPlaywright({
2751
- cdpUrl,
2752
- targetId: tab.targetId,
2753
- name
2754
- });
2755
- res.json({
2756
- ok: true,
2757
- targetId: tab.targetId
2758
- });
2759
- }
2760
- });
2761
- }));
2762
- }
2763
- //#endregion
2764
- //#region extensions/browser/src/browser/routes/agent.ts
2765
- function registerBrowserAgentRoutes(app, ctx) {
2766
- registerBrowserAgentSnapshotRoutes(app, ctx);
2767
- registerBrowserAgentActRoutes(app, ctx);
2768
- registerBrowserAgentDebugRoutes(app, ctx);
2769
- registerBrowserAgentStorageRoutes(app, ctx);
2770
- }
2771
- //#endregion
2772
- //#region extensions/browser/src/browser/doctor.ts
2773
- function buildBrowserDoctorReport(params) {
2774
- const status = params.status;
2775
- const checks = [];
2776
- const transport = status.transport === "chrome-mcp" ? "chrome-mcp" : "cdp";
2777
- checks.push({
2778
- id: "plugin-enabled",
2779
- label: "Browser plugin",
2780
- status: status.enabled ? "pass" : "fail",
2781
- summary: status.enabled ? "enabled" : "disabled",
2782
- ...status.enabled ? {} : { fixHint: "Enable the browser plugin and restart the Gateway." }
2783
- });
2784
- checks.push({
2785
- id: "profile",
2786
- label: "Profile",
2787
- status: "pass",
2788
- summary: `${status.profile ?? "daocore"} via ${transport}`
2789
- });
2790
- if (transport === "chrome-mcp") checks.push({
2791
- id: "attach-target",
2792
- label: "Existing browser attach",
2793
- status: status.running ? "pass" : "fail",
2794
- summary: status.running ? "Chrome MCP target is reachable" : "Chrome MCP target is not reachable",
2795
- ...status.running ? {} : { fixHint: "Keep the matching Chromium browser running, enable remote debugging in chrome://inspect, and accept the attach prompt." }
2796
- });
2797
- else {
2798
- checks.push({
2799
- id: "managed-executable",
2800
- label: "Chromium executable",
2801
- status: status.detectError ? "fail" : status.detectedExecutablePath ? "pass" : "warn",
2802
- summary: status.detectError ? status.detectError : status.detectedExecutablePath ? `${status.detectedBrowser ?? "chromium"} at ${status.detectedExecutablePath}` : "No Chromium executable detected",
2803
- ...status.detectedExecutablePath || status.detectError ? {} : { fixHint: "Install Chrome/Chromium/Brave/Edge or set browser.executablePath." }
2804
- });
2805
- const platform = params.platform ?? process.platform;
2806
- const env = params.env ?? process.env;
2807
- const uid = params.uid ?? process.getuid?.();
2808
- const missingDisplay = platform === "linux" && !status.headless && !env.DISPLAY && !env.WAYLAND_DISPLAY;
2809
- if (status.headlessSource === "linux-display-fallback") checks.push({
2810
- id: "headless-mode",
2811
- label: "Headless mode",
2812
- status: "pass",
2813
- summary: "Linux no-display fallback selected headless mode"
2814
- });
2815
- if (missingDisplay) checks.push({
2816
- id: "display",
2817
- label: "Display",
2818
- status: "warn",
2819
- summary: `No DISPLAY or WAYLAND_DISPLAY is set while headed mode is selected (${status.headlessSource ?? "unknown"})`,
2820
- fixHint: "Use a desktop session, Xvfb, set DAOCORE_BROWSER_HEADLESS=1, or remove the headed override."
2821
- });
2822
- if (platform === "linux" && uid === 0 && !status.noSandbox) checks.push({
2823
- id: "linux-sandbox",
2824
- label: "Linux sandbox",
2825
- status: "warn",
2826
- summary: "Gateway is running as root while browser.noSandbox is false",
2827
- fixHint: "Set browser.noSandbox: true for container/root Chromium runtimes."
2828
- });
2829
- checks.push({
2830
- id: "cdp-http",
2831
- label: "CDP HTTP",
2832
- status: status.cdpHttp ? "pass" : status.running ? "fail" : "info",
2833
- summary: status.cdpHttp ? "CDP HTTP endpoint is reachable" : status.running ? "CDP HTTP endpoint is not reachable" : "Browser is not currently running",
2834
- ...status.cdpHttp || !status.running ? {} : { fixHint: "Run daocore browser start or inspect browser.cdpUrl/CDP port reachability." }
2835
- });
2836
- checks.push({
2837
- id: "cdp-websocket",
2838
- label: "CDP WebSocket",
2839
- status: status.cdpReady ? "pass" : status.running ? "fail" : "info",
2840
- summary: status.cdpReady ? "CDP WebSocket is reachable" : status.running ? "CDP WebSocket is not reachable" : "Browser is launchable but not running",
2841
- ...status.cdpReady || !status.running ? {} : { fixHint: "Check Chrome launch logs, stale locks, proxy env, and port conflicts." }
2842
- });
2843
- }
2844
- return {
2845
- ok: checks.every((check) => check.status !== "fail"),
2846
- profile: status.profile ?? "daocore",
2847
- transport,
2848
- checks,
2849
- status
2850
- };
2851
- }
2852
- //#endregion
2853
- //#region extensions/browser/src/browser/profiles-service.ts
2854
- const HEX_COLOR_RE = /^#[0-9A-Fa-f]{6}$/;
2855
- function createBrowserProfilesService(ctx) {
2856
- const listProfiles = async () => {
2857
- return await ctx.listProfiles();
2858
- };
2859
- const createProfile = async (params) => {
2860
- const name = params.name.trim();
2861
- const rawCdpUrl = normalizeOptionalString$4(params.cdpUrl);
2862
- const rawUserDataDir = normalizeOptionalString$4(params.userDataDir);
2863
- const normalizedUserDataDir = rawUserDataDir ? resolveUserPath(rawUserDataDir) : void 0;
2864
- const driver = params.driver === "existing-session" ? "existing-session" : void 0;
2865
- if (!isValidProfileName(name)) throw new BrowserValidationError("invalid profile name: use lowercase letters, numbers, and hyphens only");
2866
- const state = ctx.state();
2867
- if (name in state.resolved.profiles) throw new BrowserConflictError(`profile "${name}" already exists`);
2868
- if (name in (getRuntimeConfig().browser?.profiles ?? {})) throw new BrowserConflictError(`profile "${name}" already exists`);
2869
- const explicitProfileColor = params.color && HEX_COLOR_RE.test(params.color) ? params.color : void 0;
2870
- let parsedCdpUrl;
2871
- if (normalizedUserDataDir && driver !== "existing-session") throw new BrowserValidationError("driver=existing-session is required when userDataDir is provided");
2872
- if (normalizedUserDataDir && !fs.existsSync(normalizedUserDataDir)) throw new BrowserValidationError(`browser user data directory not found: ${normalizedUserDataDir}`);
2873
- if (rawCdpUrl) {
2874
- if (driver === "existing-session") throw new BrowserValidationError("driver=existing-session does not accept cdpUrl; it attaches via the Chrome MCP auto-connect flow");
2875
- let parsed;
2876
- try {
2877
- parsed = parseBrowserHttpUrl(rawCdpUrl, "browser.profiles.cdpUrl");
2878
- await assertCdpEndpointAllowed(parsed.normalized, state.resolved.ssrfPolicy);
2879
- } catch (err) {
2880
- throw new BrowserValidationError(formatErrorMessage(err));
2881
- }
2882
- parsedCdpUrl = parsed.normalized;
2883
- }
2884
- const profileConfig = await createBrowserProfileConfig({
2885
- name,
2886
- resolved: state.resolved,
2887
- ...explicitProfileColor ? { color: explicitProfileColor } : {},
2888
- ...parsedCdpUrl ? { parsedCdpUrl } : {},
2889
- ...normalizedUserDataDir ? { userDataDir: normalizedUserDataDir } : {},
2890
- ...driver ? { driver } : {}
2891
- });
2892
- if (!profileConfig) throw new BrowserProfileNotFoundError(`profile "${name}" not found after creation`);
2893
- state.resolved.profiles[name] = profileConfig;
2894
- const resolved = resolveProfile(state.resolved, name);
2895
- if (!resolved) throw new BrowserProfileNotFoundError(`profile "${name}" not found after creation`);
2896
- const capabilities = getBrowserProfileCapabilities(resolved);
2897
- return {
2898
- ok: true,
2899
- profile: name,
2900
- transport: capabilities.usesChromeMcp ? "chrome-mcp" : "cdp",
2901
- cdpPort: capabilities.usesChromeMcp ? null : resolved.cdpPort,
2902
- cdpUrl: capabilities.usesChromeMcp ? null : resolved.cdpUrl,
2903
- userDataDir: resolved.userDataDir ?? null,
2904
- color: resolved.color,
2905
- isRemote: !resolved.cdpIsLoopback
2906
- };
2907
- };
2908
- const deleteProfile = async (nameRaw) => {
2909
- const name = nameRaw.trim();
2910
- if (!name) throw new BrowserValidationError("profile name is required");
2911
- if (!isValidProfileName(name)) throw new BrowserValidationError("invalid profile name");
2912
- const state = ctx.state();
2913
- const cfg = getRuntimeConfig();
2914
- const profiles = cfg.browser?.profiles ?? {};
2915
- if (name === (cfg.browser?.defaultProfile ?? state.resolved.defaultProfile)) throw new BrowserValidationError(`cannot delete the default profile "${name}"; change browser.defaultProfile first`);
2916
- if (!(name in profiles)) throw new BrowserProfileNotFoundError(`profile "${name}" not found`);
2917
- let deleted = false;
2918
- const resolved = resolveProfile(state.resolved, name);
2919
- if (resolved?.cdpIsLoopback && resolved.driver === "daocore") {
2920
- try {
2921
- await ctx.forProfile(name).stopRunningBrowser();
2922
- } catch {}
2923
- const userDataDir = resolveDaoCoreUserDataDir(name);
2924
- const profileDir = path.dirname(userDataDir);
2925
- if (fs.existsSync(profileDir)) {
2926
- await movePathToTrash(profileDir);
2927
- deleted = true;
2928
- }
2929
- }
2930
- await deleteBrowserProfileConfig(name);
2931
- delete state.resolved.profiles[name];
2932
- state.profiles.delete(name);
2933
- return {
2934
- ok: true,
2935
- profile: name,
2936
- deleted
2937
- };
2938
- };
2939
- return {
2940
- listProfiles,
2941
- createProfile,
2942
- deleteProfile
2943
- };
2944
- }
2945
- //#endregion
2946
- //#region extensions/browser/src/browser/routes/basic.ts
2947
- const STATUS_CDP_HTTP_TIMEOUT_MS = 300;
2948
- const STATUS_CDP_TRANSPORT_TIMEOUT_MS = 600;
2949
- const STATUS_CHROME_MCP_TOTAL_TIMEOUT_MS = 7e3;
2950
- const STATUS_CHROME_MCP_TRANSPORT_TIMEOUT_MS = 5e3;
2951
- function remainingChromeMcpStatusTimeoutMs(startedAtMs) {
2952
- return Math.max(1, STATUS_CHROME_MCP_TOTAL_TIMEOUT_MS - (Date.now() - startedAtMs));
2953
- }
2954
- async function probeChromeMcpPageReady(profileCtx, timeoutMs) {
2955
- const abort = new AbortController();
2956
- const timer = setTimeout(() => {
2957
- abort.abort(/* @__PURE__ */ new Error(`Chrome MCP page-readiness probe timed out after ${timeoutMs}ms.`));
2958
- }, timeoutMs);
2959
- try {
2960
- return await profileCtx.isReachable(timeoutMs, {
2961
- ephemeral: true,
2962
- signal: abort.signal
2963
- });
2964
- } catch {
2965
- return false;
2966
- } finally {
2967
- clearTimeout(timer);
2968
- }
2969
- }
2970
- function handleBrowserRouteError(res, err) {
2971
- const mapped = toBrowserErrorResponse(err);
2972
- if (mapped) return jsonError(res, mapped.status, mapped.message);
2973
- jsonError(res, 500, String(err));
2974
- }
2975
- async function withBasicProfileRoute(params) {
2976
- const profileCtx = resolveProfileContext(params.req, params.res, params.ctx);
2977
- if (!profileCtx) return;
2978
- try {
2979
- await params.run(profileCtx);
2980
- } catch (err) {
2981
- return handleBrowserRouteError(params.res, err);
2982
- }
2983
- }
2984
- async function withProfilesServiceMutation(params) {
2985
- try {
2986
- const service = createBrowserProfilesService(params.ctx);
2987
- const result = await params.run(service);
2988
- params.res.json(result);
2989
- } catch (err) {
2990
- return handleBrowserRouteError(params.res, err);
2991
- }
2992
- }
2993
- async function buildBrowserStatus(req, ctx) {
2994
- let current;
2995
- try {
2996
- current = ctx.state();
2997
- } catch {
2998
- throw new BrowserError("browser server not started", 503);
2999
- }
3000
- const profileCtx = getProfileContext(req, ctx);
3001
- if ("error" in profileCtx) throw new BrowserError(profileCtx.error, profileCtx.status);
3002
- const capabilities = getBrowserProfileCapabilities(profileCtx.profile);
3003
- const [cdpHttp, cdpReady, pageReady] = capabilities.usesChromeMcp ? await (async () => {
3004
- const statusStartedAtMs = Date.now();
3005
- const transportReady = await profileCtx.isTransportAvailable(STATUS_CHROME_MCP_TRANSPORT_TIMEOUT_MS);
3006
- if (!transportReady) return [
3007
- false,
3008
- false,
3009
- false
3010
- ];
3011
- return [
3012
- transportReady,
3013
- transportReady,
3014
- await probeChromeMcpPageReady(profileCtx, remainingChromeMcpStatusTimeoutMs(statusStartedAtMs))
3015
- ];
3016
- })() : await (async () => {
3017
- const [http, ready] = await Promise.all([profileCtx.isHttpReachable(STATUS_CDP_HTTP_TIMEOUT_MS), profileCtx.isTransportAvailable(STATUS_CDP_TRANSPORT_TIMEOUT_MS)]);
3018
- return [
3019
- http,
3020
- ready,
3021
- ready
3022
- ];
3023
- })();
3024
- const profileState = current.profiles.get(profileCtx.profile.name);
3025
- let detectedBrowser = null;
3026
- let detectedExecutablePath = null;
3027
- let detectError = null;
3028
- try {
3029
- const detected = resolveBrowserExecutableForPlatform(current.resolved, process.platform);
3030
- if (detected) {
3031
- detectedBrowser = detected.kind;
3032
- detectedExecutablePath = detected.path;
3033
- }
3034
- } catch (err) {
3035
- detectError = String(err);
3036
- }
3037
- const configuredHeadlessMode = resolveManagedBrowserHeadlessMode(current.resolved, profileCtx.profile);
3038
- const headlessMode = typeof profileState?.running?.headless === "boolean" ? {
3039
- headless: profileState.running.headless,
3040
- source: profileState.running.headlessSource ?? configuredHeadlessMode.source
3041
- } : configuredHeadlessMode;
3042
- return {
3043
- enabled: current.resolved.enabled,
3044
- profile: profileCtx.profile.name,
3045
- driver: profileCtx.profile.driver,
3046
- transport: capabilities.usesChromeMcp ? "chrome-mcp" : "cdp",
3047
- running: cdpReady,
3048
- cdpReady,
3049
- cdpHttp,
3050
- pageReady,
3051
- pid: capabilities.usesChromeMcp ? getChromeMcpPid(profileCtx.profile.name) : profileState?.running?.pid ?? null,
3052
- cdpPort: capabilities.usesChromeMcp ? null : profileCtx.profile.cdpPort,
3053
- cdpUrl: capabilities.usesChromeMcp ? null : redactCdpUrl(profileCtx.profile.cdpUrl) ?? null,
3054
- chosenBrowser: profileState?.running?.exe.kind ?? null,
3055
- detectedBrowser,
3056
- detectedExecutablePath,
3057
- detectError,
3058
- userDataDir: profileState?.running?.userDataDir ?? profileCtx.profile.userDataDir ?? null,
3059
- color: profileCtx.profile.color,
3060
- headless: headlessMode.headless,
3061
- headlessSource: headlessMode.source,
3062
- noSandbox: current.resolved.noSandbox,
3063
- executablePath: profileCtx.profile.executablePath ?? null,
3064
- attachOnly: profileCtx.profile.attachOnly
3065
- };
3066
- }
3067
- async function runBrowserLiveProbe(req, ctx) {
3068
- const profileCtx = getProfileContext(req, ctx);
3069
- if ("error" in profileCtx) return {
3070
- id: "live-snapshot",
3071
- label: "Live snapshot",
3072
- status: "fail",
3073
- summary: profileCtx.error
3074
- };
3075
- const capabilities = getBrowserProfileCapabilities(profileCtx.profile);
3076
- try {
3077
- const tab = await profileCtx.ensureTabAvailable();
3078
- if (capabilities.usesChromeMcp) {
3079
- const { takeChromeMcpSnapshot } = await import("./chrome-mcp-D73SABLN.js");
3080
- await takeChromeMcpSnapshot({
3081
- profileName: profileCtx.profile.name,
3082
- profile: profileCtx.profile,
3083
- targetId: tab.targetId
3084
- });
3085
- return {
3086
- id: "live-snapshot",
3087
- label: "Live snapshot",
3088
- status: "pass",
3089
- summary: `Chrome MCP snapshot succeeded on ${tab.suggestedTargetId ?? tab.targetId}`
3090
- };
3091
- }
3092
- if (!tab.wsUrl) return {
3093
- id: "live-snapshot",
3094
- label: "Live snapshot",
3095
- status: "warn",
3096
- summary: "No per-tab CDP WebSocket available for the lightweight live snapshot probe"
3097
- };
3098
- const snap = await snapshotAria({
3099
- wsUrl: tab.wsUrl,
3100
- limit: 25
3101
- });
3102
- return {
3103
- id: "live-snapshot",
3104
- label: "Live snapshot",
3105
- status: snap.nodes.length > 0 ? "pass" : "warn",
3106
- summary: snap.nodes.length > 0 ? `CDP accessibility snapshot returned ${snap.nodes.length} nodes on ${tab.suggestedTargetId ?? tab.targetId}` : `CDP accessibility snapshot returned no nodes on ${tab.suggestedTargetId ?? tab.targetId}`
3107
- };
3108
- } catch (err) {
3109
- return {
3110
- id: "live-snapshot",
3111
- label: "Live snapshot",
3112
- status: "fail",
3113
- summary: String(err),
3114
- fixHint: "Run daocore browser start, then retry with daocore browser doctor --deep."
3115
- };
3116
- }
3117
- }
3118
- function hasQueryKey(query, key) {
3119
- return Object.prototype.hasOwnProperty.call(query ?? {}, key);
3120
- }
3121
- function parseHeadlessStartOverride(params) {
3122
- if (!hasQueryKey(params.req.query, "headless")) return { ok: true };
3123
- const headless = toBoolean(params.req.query.headless);
3124
- if (typeof headless !== "boolean") {
3125
- jsonError(params.res, 400, "Invalid headless value. Use \"true\" or \"false\".");
3126
- return { ok: false };
3127
- }
3128
- const capabilities = getBrowserProfileCapabilities(params.profileCtx.profile);
3129
- if (params.profileCtx.profile.driver !== "daocore" || params.profileCtx.profile.attachOnly || capabilities.isRemote) {
3130
- jsonError(params.res, 400, `Headless start override is only supported for locally launched daocore profiles. Profile "${params.profileCtx.profile.name}" is attach-only, remote, or existing-session.`);
3131
- return { ok: false };
3132
- }
3133
- return {
3134
- ok: true,
3135
- headless
3136
- };
3137
- }
3138
- function registerBrowserBasicRoutes(app, ctx) {
3139
- app.get("/profiles", asyncBrowserRoute(async (_req, res) => {
3140
- try {
3141
- const profiles = await createBrowserProfilesService(ctx).listProfiles();
3142
- res.json({ profiles });
3143
- } catch (err) {
3144
- jsonError(res, 500, String(err));
3145
- }
3146
- }));
3147
- app.get("/", asyncBrowserRoute(async (req, res) => {
3148
- try {
3149
- res.json(await buildBrowserStatus(req, ctx));
3150
- } catch (err) {
3151
- const mapped = toBrowserErrorResponse(err);
3152
- if (mapped) return jsonError(res, mapped.status, mapped.message);
3153
- jsonError(res, 500, String(err));
3154
- }
3155
- }));
3156
- app.get("/doctor", asyncBrowserRoute(async (req, res) => {
3157
- try {
3158
- const report = buildBrowserDoctorReport({ status: await buildBrowserStatus(req, ctx) });
3159
- if (toBoolean(req.query.deep) === true || toBoolean(req.query.live) === true) {
3160
- report.checks.push(await runBrowserLiveProbe(req, ctx));
3161
- report.ok = report.checks.every((check) => check.status !== "fail");
3162
- }
3163
- res.json(report);
3164
- } catch (err) {
3165
- const mapped = toBrowserErrorResponse(err);
3166
- if (mapped) return jsonError(res, mapped.status, mapped.message);
3167
- jsonError(res, 500, String(err));
3168
- }
3169
- }));
3170
- app.post("/start", asyncBrowserRoute(async (req, res) => {
3171
- await withBasicProfileRoute({
3172
- req,
3173
- res,
3174
- ctx,
3175
- run: async (profileCtx) => {
3176
- const headlessOverride = parseHeadlessStartOverride({
3177
- req,
3178
- res,
3179
- profileCtx
3180
- });
3181
- if (!headlessOverride.ok) return;
3182
- await profileCtx.ensureBrowserAvailable({ headless: headlessOverride.headless });
3183
- res.json({
3184
- ok: true,
3185
- profile: profileCtx.profile.name
3186
- });
3187
- }
3188
- });
3189
- }));
3190
- app.post("/stop", asyncBrowserRoute(async (req, res) => {
3191
- await withBasicProfileRoute({
3192
- req,
3193
- res,
3194
- ctx,
3195
- run: async (profileCtx) => {
3196
- const result = await profileCtx.stopRunningBrowser();
3197
- res.json({
3198
- ok: true,
3199
- stopped: result.stopped,
3200
- profile: profileCtx.profile.name
3201
- });
3202
- }
3203
- });
3204
- }));
3205
- app.post("/reset-profile", asyncBrowserRoute(async (req, res) => {
3206
- await withBasicProfileRoute({
3207
- req,
3208
- res,
3209
- ctx,
3210
- run: async (profileCtx) => {
3211
- const result = await profileCtx.resetProfile();
3212
- res.json({
3213
- ok: true,
3214
- profile: profileCtx.profile.name,
3215
- ...result
3216
- });
3217
- }
3218
- });
3219
- }));
3220
- app.post("/profiles/create", asyncBrowserRoute(async (req, res) => {
3221
- const name = toStringOrEmpty(req.body?.name);
3222
- const color = toStringOrEmpty(req.body?.color);
3223
- const cdpUrl = toStringOrEmpty(req.body?.cdpUrl);
3224
- const userDataDir = toStringOrEmpty(req.body?.userDataDir);
3225
- const driver = toStringOrEmpty(req.body?.driver);
3226
- if (!name) return jsonError(res, 400, "name is required");
3227
- if (driver && driver !== "daocore" && driver !== "clawd" && driver !== "existing-session") return jsonError(res, 400, `unsupported profile driver "${driver}"; use "daocore", "clawd", or "existing-session"`);
3228
- await withProfilesServiceMutation({
3229
- res,
3230
- ctx,
3231
- run: async (service) => await service.createProfile({
3232
- name,
3233
- color: color || void 0,
3234
- cdpUrl: cdpUrl || void 0,
3235
- userDataDir: userDataDir || void 0,
3236
- driver: driver === "existing-session" ? "existing-session" : driver === "daocore" || driver === "clawd" ? "daocore" : void 0
3237
- })
3238
- });
3239
- }));
3240
- app.delete("/profiles/:name", asyncBrowserRoute(async (req, res) => {
3241
- const name = toStringOrEmpty(req.params.name);
3242
- if (!name) return jsonError(res, 400, "profile name is required");
3243
- await withProfilesServiceMutation({
3244
- res,
3245
- ctx,
3246
- run: async (service) => await service.deleteProfile(name)
3247
- });
3248
- }));
3249
- }
3250
- //#endregion
3251
- //#region extensions/browser/src/browser/routes/permissions.ts
3252
- const permissionRouteDeps = { getPwAiModule: getPwAiModule$1 };
3253
- function readOrigin(raw) {
3254
- const value = toStringOrEmpty(raw);
3255
- if (!value) return null;
3256
- try {
3257
- const parsed = new URL(value);
3258
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
3259
- return parsed.origin;
3260
- } catch {
3261
- return null;
3262
- }
3263
- }
3264
- function readPermissions(raw) {
3265
- if (!Array.isArray(raw)) return null;
3266
- const permissions = raw.map((value) => typeof value === "string" ? value.trim() : "").filter(Boolean);
3267
- if (permissions.length !== raw.length) return null;
3268
- return [...new Set(permissions)];
3269
- }
3270
- async function grantPermissions(params) {
3271
- const allPermissions = [...new Set([...params.requiredPermissions, ...params.optionalPermissions])];
3272
- const playwrightRequiredPermissions = params.requiredPermissions.map(toPlaywrightPermission);
3273
- if (playwrightRequiredPermissions.every((value) => Boolean(value)) && params.requiredPermissions.length > 0) {
3274
- const pw = await permissionRouteDeps.getPwAiModule({ mode: "soft" });
3275
- if (pw) try {
3276
- await (await pw.getPageForTargetId({
3277
- cdpUrl: params.profileCtx.profile.cdpUrl,
3278
- targetId: params.targetId,
3279
- ssrfPolicy: params.ssrfPolicy
3280
- })).context().grantPermissions(playwrightRequiredPermissions, { origin: params.origin });
3281
- return {
3282
- grantedPermissions: params.requiredPermissions,
3283
- unsupportedPermissions: params.optionalPermissions,
3284
- grantMethod: "playwright"
3285
- };
3286
- } catch {}
3287
- }
3288
- let unsupportedPermissions = [];
3289
- await withCdpSocket(params.wsUrl, async (send) => {
3290
- try {
3291
- await send("Browser.grantPermissions", {
3292
- origin: params.origin,
3293
- permissions: allPermissions
3294
- });
3295
- return;
3296
- } catch (error) {
3297
- if (params.optionalPermissions.length === 0) throw error;
3298
- }
3299
- await send("Browser.grantPermissions", {
3300
- origin: params.origin,
3301
- permissions: params.requiredPermissions
3302
- });
3303
- unsupportedPermissions = params.optionalPermissions;
3304
- }, { commandTimeoutMs: params.timeoutMs });
3305
- return {
3306
- grantedPermissions: allPermissions.filter((value) => !unsupportedPermissions.includes(value)),
3307
- unsupportedPermissions,
3308
- grantMethod: "cdp"
3309
- };
3310
- }
3311
- function toPlaywrightPermission(permission) {
3312
- switch (permission) {
3313
- case "audioCapture": return "microphone";
3314
- case "videoCapture": return "camera";
3315
- default: return;
3316
- }
3317
- }
3318
- function registerBrowserPermissionRoutes(app, ctx) {
3319
- app.post("/permissions/grant", asyncBrowserRoute(async (req, res) => {
3320
- const profileCtx = getProfileContext(req, ctx);
3321
- if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
3322
- const body = req.body ?? {};
3323
- const origin = readOrigin(body.origin);
3324
- if (!origin) return jsonError(res, 400, "origin must be an http(s) origin");
3325
- const requiredPermissions = readPermissions(body.permissions);
3326
- if (!requiredPermissions || requiredPermissions.length === 0) return jsonError(res, 400, "permissions must be a non-empty string array");
3327
- const optionalPermissions = readPermissions(body.optionalPermissions ?? []) ?? [];
3328
- const targetId = toStringOrEmpty(body.targetId) || void 0;
3329
- const timeoutMs = Math.max(1e3, toNumber(body.timeoutMs) ?? 5e3);
3330
- try {
3331
- await profileCtx.ensureBrowserAvailable();
3332
- const wsUrl = await getChromeWebSocketUrl(profileCtx.profile.cdpUrl, timeoutMs, ctx.state().resolved.ssrfPolicy);
3333
- if (!wsUrl) return jsonError(res, 409, "browser CDP WebSocket unavailable");
3334
- const granted = await grantPermissions({
3335
- profileCtx,
3336
- targetId,
3337
- wsUrl,
3338
- origin,
3339
- requiredPermissions,
3340
- optionalPermissions,
3341
- timeoutMs,
3342
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
3343
- });
3344
- return res.json({
3345
- ok: true,
3346
- origin,
3347
- ...granted
3348
- });
3349
- } catch (error) {
3350
- return jsonError(res, 500, error instanceof Error ? error.message : String(error));
3351
- }
3352
- }));
3353
- }
3354
- //#endregion
3355
- //#region extensions/browser/src/browser/routes/tabs.ts
3356
- function resolveTabsProfileContext(req, res, ctx) {
3357
- const profileCtx = getProfileContext(req, ctx);
3358
- if ("error" in profileCtx) {
3359
- jsonError(res, profileCtx.status, profileCtx.error);
3360
- return null;
3361
- }
3362
- return profileCtx;
3363
- }
3364
- function browserNavigationPolicyForProfile(ctx, profileCtx) {
3365
- return withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy, { browserProxyMode: resolveBrowserNavigationProxyMode({
3366
- resolved: ctx.state().resolved,
3367
- profile: profileCtx.profile
3368
- }) });
3369
- }
3370
- function handleTabsRouteError(ctx, res, err, opts) {
3371
- if (opts?.mapTabError) {
3372
- const mapped = ctx.mapTabError(err);
3373
- if (mapped) return jsonError(res, mapped.status, mapped.message);
3374
- }
3375
- return jsonError(res, 500, String(err));
3376
- }
3377
- async function withTabsProfileRoute(params) {
3378
- const profileCtx = resolveTabsProfileContext(params.req, params.res, params.ctx);
3379
- if (!profileCtx) return;
3380
- try {
3381
- await params.run(profileCtx);
3382
- } catch (err) {
3383
- handleTabsRouteError(params.ctx, params.res, err, { mapTabError: params.mapTabError });
3384
- }
3385
- }
3386
- async function ensureBrowserRunning(profileCtx, res) {
3387
- if (!await profileCtx.isReachable(300)) {
3388
- jsonError(res, new BrowserProfileUnavailableError("browser not running").status, "browser not running");
3389
- return false;
3390
- }
3391
- return true;
3392
- }
3393
- async function redactBlockedTabUrls(params) {
3394
- const ssrfPolicyOpts = withBrowserNavigationPolicy(params.ssrfPolicy);
3395
- if (!ssrfPolicyOpts.ssrfPolicy) return params.tabs;
3396
- const redactedTabs = [];
3397
- for (const tab of params.tabs) try {
3398
- await assertBrowserNavigationResultAllowed({
3399
- url: tab.url,
3400
- ...ssrfPolicyOpts
3401
- });
3402
- redactedTabs.push(tab);
3403
- } catch {
3404
- redactedTabs.push({
3405
- ...tab,
3406
- url: ""
3407
- });
3408
- }
3409
- return redactedTabs;
3410
- }
3411
- function resolveIndexedTab(tabs, index) {
3412
- return typeof index === "number" ? tabs[index] : tabs.at(0);
3413
- }
3414
- function parseRequiredTargetId(res, rawTargetId) {
3415
- const targetId = toStringOrEmpty(rawTargetId);
3416
- if (!targetId) {
3417
- jsonError(res, 400, "targetId is required");
3418
- return null;
3419
- }
3420
- return targetId;
3421
- }
3422
- function readOptionalTabLabel(body) {
3423
- return toStringOrEmpty(body?.label) || void 0;
3424
- }
3425
- async function runTabTargetMutation(params) {
3426
- await withTabsProfileRoute({
3427
- req: params.req,
3428
- res: params.res,
3429
- ctx: params.ctx,
3430
- mapTabError: true,
3431
- run: async (profileCtx) => {
3432
- if (!await ensureBrowserRunning(profileCtx, params.res)) return;
3433
- await params.mutate(profileCtx, params.targetId);
3434
- params.res.json({ ok: true });
3435
- }
3436
- });
3437
- }
3438
- function registerBrowserTabRoutes(app, ctx) {
3439
- app.get("/tabs", asyncBrowserRoute(async (req, res) => {
3440
- await withTabsProfileRoute({
3441
- req,
3442
- res,
3443
- ctx,
3444
- run: async (profileCtx) => {
3445
- if (!await profileCtx.isReachable(300)) return res.json({
3446
- running: false,
3447
- tabs: []
3448
- });
3449
- const tabs = await redactBlockedTabUrls({
3450
- tabs: await profileCtx.listTabs(),
3451
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
3452
- });
3453
- res.json({
3454
- running: true,
3455
- tabs
3456
- });
3457
- }
3458
- });
3459
- }));
3460
- app.post("/tabs/open", asyncBrowserRoute(async (req, res) => {
3461
- const url = toStringOrEmpty(req.body?.url);
3462
- const label = readOptionalTabLabel(req.body);
3463
- if (!url) return jsonError(res, 400, "url is required");
3464
- await withTabsProfileRoute({
3465
- req,
3466
- res,
3467
- ctx,
3468
- mapTabError: true,
3469
- run: async (profileCtx) => {
3470
- await assertBrowserNavigationAllowed({
3471
- url,
3472
- ...browserNavigationPolicyForProfile(ctx, profileCtx)
3473
- });
3474
- await profileCtx.ensureBrowserAvailable();
3475
- const tab = await profileCtx.openTab(url, { label });
3476
- res.json(tab);
3477
- }
3478
- });
3479
- }));
3480
- app.post("/tabs/focus", asyncBrowserRoute(async (req, res) => {
3481
- const targetId = parseRequiredTargetId(res, req.body?.targetId);
3482
- if (!targetId) return;
3483
- await runTabTargetMutation({
3484
- req,
3485
- res,
3486
- ctx,
3487
- targetId,
3488
- mutate: async (profileCtx, id) => {
3489
- const tabs = await profileCtx.listTabs();
3490
- const resolved = resolveTargetIdFromTabs(id, tabs);
3491
- if (!resolved.ok) {
3492
- if (resolved.reason === "ambiguous") throw new BrowserTargetAmbiguousError();
3493
- throw new BrowserTabNotFoundError({ input: id });
3494
- }
3495
- const tab = tabs.find((currentTab) => currentTab.targetId === resolved.targetId);
3496
- if (!tab) throw new BrowserTabNotFoundError({ input: id });
3497
- const ssrfPolicyOpts = browserNavigationPolicyForProfile(ctx, profileCtx);
3498
- if (ssrfPolicyOpts.ssrfPolicy) await assertBrowserNavigationResultAllowed({
3499
- url: tab.url,
3500
- ...ssrfPolicyOpts
3501
- });
3502
- await profileCtx.focusTab(resolved.targetId);
3503
- }
3504
- });
3505
- }));
3506
- app.delete("/tabs/:targetId", asyncBrowserRoute(async (req, res) => {
3507
- const targetId = parseRequiredTargetId(res, req.params.targetId);
3508
- if (!targetId) return;
3509
- await runTabTargetMutation({
3510
- req,
3511
- res,
3512
- ctx,
3513
- targetId,
3514
- mutate: async (profileCtx, id) => {
3515
- await profileCtx.closeTab(id);
3516
- }
3517
- });
3518
- }));
3519
- app.post("/tabs/action", asyncBrowserRoute(async (req, res) => {
3520
- const action = toStringOrEmpty(req.body?.action);
3521
- const index = toNumber(req.body?.index);
3522
- await withTabsProfileRoute({
3523
- req,
3524
- res,
3525
- ctx,
3526
- mapTabError: true,
3527
- run: async (profileCtx) => {
3528
- if (action === "list") {
3529
- if (!await profileCtx.isReachable(300)) return res.json({
3530
- ok: true,
3531
- tabs: []
3532
- });
3533
- const tabs = await redactBlockedTabUrls({
3534
- tabs: await profileCtx.listTabs(),
3535
- ssrfPolicy: ctx.state().resolved.ssrfPolicy
3536
- });
3537
- return res.json({
3538
- ok: true,
3539
- tabs
3540
- });
3541
- }
3542
- if (action === "new") {
3543
- await profileCtx.ensureBrowserAvailable();
3544
- const tab = await profileCtx.openTab("about:blank", { label: readOptionalTabLabel(req.body) });
3545
- return res.json({
3546
- ok: true,
3547
- tab
3548
- });
3549
- }
3550
- if (action === "label") {
3551
- if (!await ensureBrowserRunning(profileCtx, res)) return;
3552
- const targetId = parseRequiredTargetId(res, req.body?.targetId);
3553
- if (!targetId) return;
3554
- const label = readOptionalTabLabel(req.body);
3555
- if (!label) return jsonError(res, 400, "label is required");
3556
- const tab = await profileCtx.labelTab(targetId, label);
3557
- return res.json({
3558
- ok: true,
3559
- tab
3560
- });
3561
- }
3562
- if (action === "close") {
3563
- if (!await ensureBrowserRunning(profileCtx, res)) return;
3564
- const target = resolveIndexedTab(await profileCtx.listTabs(), index);
3565
- if (!target) throw new BrowserTabNotFoundError();
3566
- await profileCtx.closeTab(target.targetId);
3567
- return res.json({
3568
- ok: true,
3569
- targetId: target.targetId
3570
- });
3571
- }
3572
- if (action === "select") {
3573
- if (typeof index !== "number") return jsonError(res, 400, "index is required");
3574
- if (!await ensureBrowserRunning(profileCtx, res)) return;
3575
- const target = (await profileCtx.listTabs())[index];
3576
- if (!target) throw new BrowserTabNotFoundError();
3577
- const ssrfPolicyOpts = browserNavigationPolicyForProfile(ctx, profileCtx);
3578
- if (ssrfPolicyOpts.ssrfPolicy) await assertBrowserNavigationResultAllowed({
3579
- url: target.url,
3580
- ...ssrfPolicyOpts
3581
- });
3582
- await profileCtx.focusTab(target.targetId);
3583
- return res.json({
3584
- ok: true,
3585
- targetId: target.targetId
3586
- });
3587
- }
3588
- return jsonError(res, 400, "unknown tab action");
3589
- }
3590
- });
3591
- }));
3592
- }
3593
- //#endregion
3594
- //#region extensions/browser/src/browser/routes/index.ts
3595
- function registerBrowserRoutes(app, ctx) {
3596
- registerBrowserBasicRoutes(app, ctx);
3597
- registerBrowserTabRoutes(app, ctx);
3598
- registerBrowserPermissionRoutes(app, ctx);
3599
- registerBrowserAgentRoutes(app, ctx);
3600
- }
3601
- //#endregion
3602
- export { registerBrowserRoutes as t };