@ddwang/magnitude-core 0.3.1-ddwang.2 → 0.3.1-ddwang.21

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 (363) hide show
  1. package/dist/cli.cjs +2 -0
  2. package/dist/cli.cjs.map +1 -0
  3. package/dist/cli.d.cts +2 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.mjs +1 -0
  6. package/dist/cli.mjs.map +1 -0
  7. package/dist/index.cjs +2704 -1522
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.cts +188 -50
  10. package/dist/index.d.ts +1147 -23
  11. package/dist/index.mjs +2527 -1362
  12. package/dist/index.mjs.map +1 -0
  13. package/node_modules/patchright-core/README.md +3 -0
  14. package/node_modules/patchright-core/ThirdPartyNotices.txt +13 -0
  15. package/node_modules/patchright-core/bin/install_media_pack.ps1 +5 -0
  16. package/node_modules/patchright-core/bin/install_webkit_wsl.ps1 +33 -0
  17. package/node_modules/patchright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
  18. package/node_modules/patchright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  19. package/node_modules/patchright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  20. package/node_modules/patchright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
  21. package/node_modules/patchright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  22. package/node_modules/patchright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  23. package/node_modules/patchright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
  24. package/node_modules/patchright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  25. package/node_modules/patchright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  26. package/node_modules/patchright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
  27. package/node_modules/patchright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  28. package/node_modules/patchright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  29. package/node_modules/patchright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
  30. package/node_modules/patchright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  31. package/node_modules/patchright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  32. package/node_modules/patchright-core/browsers.json +52 -0
  33. package/node_modules/patchright-core/cli.js +22 -0
  34. package/node_modules/patchright-core/index.d.ts +17 -0
  35. package/node_modules/patchright-core/index.js +17 -0
  36. package/node_modules/patchright-core/index.mjs +28 -0
  37. package/node_modules/patchright-core/lib/bootstrap.js +149 -0
  38. package/node_modules/patchright-core/lib/coreBundle.js +80653 -0
  39. package/node_modules/patchright-core/lib/entry/cliDaemon.js +5 -0
  40. package/node_modules/patchright-core/lib/entry/dashboardApp.js +3 -0
  41. package/node_modules/patchright-core/lib/entry/mcp.js +10 -0
  42. package/node_modules/patchright-core/lib/entry/oopBrowserDownload.js +3 -0
  43. package/node_modules/patchright-core/lib/package.js +50 -0
  44. package/node_modules/patchright-core/lib/server/chromium/appIcon.png +0 -0
  45. package/node_modules/patchright-core/lib/server/electron/loader.js +112 -0
  46. package/node_modules/patchright-core/lib/serverRegistry.js +1939 -0
  47. package/node_modules/patchright-core/lib/serverRegistry.js.LICENSE +65 -0
  48. package/node_modules/patchright-core/lib/tools/cli-client/channelSessions.js +141 -0
  49. package/node_modules/patchright-core/lib/tools/cli-client/cli.js +7 -0
  50. package/node_modules/patchright-core/lib/tools/cli-client/help.json +808 -0
  51. package/node_modules/patchright-core/lib/tools/cli-client/minimist.js +128 -0
  52. package/node_modules/patchright-core/lib/tools/cli-client/output.js +352 -0
  53. package/node_modules/patchright-core/lib/tools/cli-client/program.js +422 -0
  54. package/node_modules/patchright-core/lib/tools/cli-client/registry.js +180 -0
  55. package/node_modules/patchright-core/lib/tools/cli-client/session.js +261 -0
  56. package/node_modules/patchright-core/lib/tools/dashboard/appIcon.png +0 -0
  57. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/SKILL.md +493 -0
  58. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  59. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  60. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
  61. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  62. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
  63. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
  64. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  65. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  66. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  67. package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
  68. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
  69. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  70. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
  71. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
  72. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
  73. package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
  74. package/node_modules/patchright-core/lib/tools/skills/playwright-trace/SKILL.md +174 -0
  75. package/node_modules/patchright-core/lib/tools/utils/extension.js +112 -0
  76. package/node_modules/patchright-core/lib/tools/utils/socketConnection.js +108 -0
  77. package/node_modules/patchright-core/lib/utilsBundle.js +86225 -0
  78. package/node_modules/patchright-core/lib/utilsBundle.js.LICENSE +1890 -0
  79. package/node_modules/patchright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
  80. package/node_modules/patchright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
  81. package/node_modules/patchright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  82. package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  83. package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  84. package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  85. package/node_modules/patchright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
  86. package/node_modules/patchright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
  87. package/node_modules/patchright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  88. package/node_modules/patchright-core/lib/vite/dashboard/index.html +29 -0
  89. package/node_modules/patchright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
  90. package/node_modules/patchright-core/lib/vite/htmlReport/index.html +16 -0
  91. package/node_modules/patchright-core/lib/vite/htmlReport/report.css +2 -0
  92. package/node_modules/patchright-core/lib/vite/htmlReport/report.js +32 -0
  93. package/node_modules/patchright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  94. package/node_modules/patchright-core/lib/vite/recorder/assets/codeMirrorModule-GBnsXk4c.js +32 -0
  95. package/node_modules/patchright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  96. package/node_modules/patchright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
  97. package/node_modules/patchright-core/lib/vite/recorder/assets/index-CVDOfo-j.js +129 -0
  98. package/node_modules/patchright-core/lib/vite/recorder/index.html +29 -0
  99. package/node_modules/patchright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  100. package/node_modules/patchright-core/lib/vite/traceViewer/assets/codeMirrorModule-G79327TW.js +32 -0
  101. package/node_modules/patchright-core/lib/vite/traceViewer/assets/defaultSettingsView-D9EV0iaS.js +184 -0
  102. package/node_modules/patchright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  103. package/node_modules/patchright-core/lib/vite/traceViewer/assets/xtermModule-Al_u-Nk5.js +7 -0
  104. package/node_modules/patchright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  105. package/node_modules/patchright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  106. package/node_modules/patchright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
  107. package/node_modules/patchright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  108. package/node_modules/patchright-core/lib/vite/traceViewer/index.CMB2-c8e.js +1 -0
  109. package/node_modules/patchright-core/lib/vite/traceViewer/index.html +44 -0
  110. package/node_modules/patchright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
  111. package/node_modules/patchright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  112. package/node_modules/patchright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  113. package/node_modules/patchright-core/lib/vite/traceViewer/snapshot.html +10 -0
  114. package/node_modules/patchright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
  115. package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.C3yLoy2G.js +5 -0
  116. package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
  117. package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.html +18 -0
  118. package/node_modules/patchright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  119. package/node_modules/patchright-core/lib/webp_codec.LICENSE +173 -0
  120. package/node_modules/patchright-core/lib/webp_codec.wasm +0 -0
  121. package/node_modules/patchright-core/lib/xdg-open +1267 -0
  122. package/node_modules/patchright-core/package.json +34 -0
  123. package/node_modules/patchright-core/types/protocol.d.ts +24776 -0
  124. package/node_modules/patchright-core/types/structs.d.ts +52 -0
  125. package/node_modules/patchright-core/types/types.d.ts +27167 -0
  126. package/node_modules/playwright/.bun-tag-91d746a6045e143f +0 -0
  127. package/node_modules/playwright/README.md +300 -0
  128. package/node_modules/playwright/ThirdPartyNotices.txt +14 -0
  129. package/node_modules/playwright/cli.js +19 -0
  130. package/node_modules/playwright/index.d.ts +17 -0
  131. package/node_modules/playwright/index.js +17 -0
  132. package/node_modules/playwright/index.mjs +18 -0
  133. package/node_modules/playwright/lib/agents/agentParser.js +89 -0
  134. package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
  135. package/node_modules/playwright/lib/agents/generateAgents.js +395 -0
  136. package/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
  137. package/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
  138. package/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
  139. package/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
  140. package/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +56 -0
  141. package/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
  142. package/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +74 -0
  143. package/node_modules/playwright/lib/cli/reportActions.js +78 -0
  144. package/node_modules/playwright/lib/cli/testActions.js +217 -0
  145. package/node_modules/playwright/lib/common/index.js +2937 -0
  146. package/node_modules/playwright/lib/common/index.js.txt +33 -0
  147. package/node_modules/playwright/lib/errorContext.js +129 -0
  148. package/node_modules/playwright/lib/globals.js +58 -0
  149. package/node_modules/playwright/lib/index.js +827 -0
  150. package/node_modules/playwright/lib/isomorphic.js +260 -0
  151. package/node_modules/playwright/lib/isomorphic.js.txt +9 -0
  152. package/node_modules/playwright/lib/loader/loaderProcessEntry.js +34 -0
  153. package/node_modules/playwright/lib/loader/loaderProcessEntry.js.txt +9 -0
  154. package/node_modules/playwright/lib/matchers/expect.js +13496 -0
  155. package/node_modules/playwright/lib/matchers/expect.js.LICENSE +640 -0
  156. package/node_modules/playwright/lib/matchers/expect.js.txt +67 -0
  157. package/node_modules/playwright/lib/mcp/test/browserBackend.js +135 -0
  158. package/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
  159. package/node_modules/playwright/lib/mcp/test/plannerTools.js +150 -0
  160. package/node_modules/playwright/lib/mcp/test/seed.js +82 -0
  161. package/node_modules/playwright/lib/mcp/test/streams.js +44 -0
  162. package/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
  163. package/node_modules/playwright/lib/mcp/test/testContext.js +306 -0
  164. package/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
  165. package/node_modules/playwright/lib/mcp/test/testTools.js +98 -0
  166. package/node_modules/playwright/lib/package.js +47 -0
  167. package/node_modules/playwright/lib/program.js +242 -0
  168. package/node_modules/playwright/lib/runner/index.js +8721 -0
  169. package/node_modules/playwright/lib/runner/index.js.txt +62 -0
  170. package/node_modules/playwright/lib/transform/babelBundle.js +72490 -0
  171. package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +2384 -0
  172. package/node_modules/playwright/lib/transform/babelBundle.js.txt +328 -0
  173. package/node_modules/playwright/lib/transform/esmLoader.js +8213 -0
  174. package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +355 -0
  175. package/node_modules/playwright/lib/transform/esmLoader.js.txt +60 -0
  176. package/node_modules/playwright/lib/util.js +373 -0
  177. package/node_modules/playwright/lib/worker/workerProcessEntry.js +1860 -0
  178. package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +19 -0
  179. package/node_modules/playwright/package.json +50 -0
  180. package/node_modules/playwright/test.d.ts +18 -0
  181. package/node_modules/playwright/test.js +24 -0
  182. package/node_modules/playwright/test.mjs +35 -0
  183. package/node_modules/playwright/types/test.d.ts +11191 -0
  184. package/node_modules/playwright/types/testReporter.d.ts +950 -0
  185. package/package.json +21 -12
  186. package/dist/actions/desktopActions.d.ts +0 -58
  187. package/dist/actions/desktopActions.js +0 -155
  188. package/dist/actions/index.d.ts +0 -27
  189. package/dist/actions/index.js +0 -11
  190. package/dist/actions/memoryActions.d.ts +0 -9
  191. package/dist/actions/memoryActions.js +0 -34
  192. package/dist/actions/taskActions.d.ts +0 -8
  193. package/dist/actions/taskActions.js +0 -27
  194. package/dist/actions/types.d.ts +0 -35
  195. package/dist/actions/types.js +0 -5
  196. package/dist/actions/util.d.ts +0 -21
  197. package/dist/actions/util.js +0 -280
  198. package/dist/actions/webActions.d.ts +0 -87
  199. package/dist/actions/webActions.js +0 -214
  200. package/dist/actions/webActions.test.d.ts +0 -1
  201. package/dist/actions/webActions.test.js +0 -43
  202. package/dist/agent/browserAgent.d.ts +0 -31
  203. package/dist/agent/browserAgent.js +0 -136
  204. package/dist/agent/errors.d.ts +0 -22
  205. package/dist/agent/errors.js +0 -97
  206. package/dist/agent/index.d.ts +0 -64
  207. package/dist/agent/index.js +0 -505
  208. package/dist/agent/narrator.d.ts +0 -4
  209. package/dist/agent/narrator.js +0 -63
  210. package/dist/agent/pause.test.d.ts +0 -1
  211. package/dist/agent/pause.test.js +0 -194
  212. package/dist/ai/baml_client/async_client.d.ts +0 -64
  213. package/dist/ai/baml_client/async_client.js +0 -284
  214. package/dist/ai/baml_client/async_request.d.ts +0 -39
  215. package/dist/ai/baml_client/async_request.js +0 -134
  216. package/dist/ai/baml_client/config.d.ts +0 -11
  217. package/dist/ai/baml_client/config.js +0 -20
  218. package/dist/ai/baml_client/globals.d.ts +0 -16
  219. package/dist/ai/baml_client/globals.js +0 -37
  220. package/dist/ai/baml_client/index.d.ts +0 -17
  221. package/dist/ai/baml_client/index.js +0 -42
  222. package/dist/ai/baml_client/inlinedbaml.d.ts +0 -19
  223. package/dist/ai/baml_client/inlinedbaml.js +0 -31
  224. package/dist/ai/baml_client/parser.d.ts +0 -53
  225. package/dist/ai/baml_client/parser.js +0 -86
  226. package/dist/ai/baml_client/partial_types.d.ts +0 -61
  227. package/dist/ai/baml_client/partial_types.js +0 -10
  228. package/dist/ai/baml_client/sync_client.d.ts +0 -57
  229. package/dist/ai/baml_client/sync_client.js +0 -142
  230. package/dist/ai/baml_client/sync_request.d.ts +0 -37
  231. package/dist/ai/baml_client/sync_request.js +0 -134
  232. package/dist/ai/baml_client/tracing.d.ts +0 -16
  233. package/dist/ai/baml_client/tracing.js +0 -18
  234. package/dist/ai/baml_client/type_builder.d.ts +0 -40
  235. package/dist/ai/baml_client/type_builder.js +0 -120
  236. package/dist/ai/baml_client/types.d.ts +0 -69
  237. package/dist/ai/baml_client/types.js +0 -15
  238. package/dist/ai/baml_client/watchers.d.ts +0 -32
  239. package/dist/ai/baml_client/watchers.js +0 -50
  240. package/dist/ai/baseten.d.ts +0 -4
  241. package/dist/ai/baseten.js +0 -10
  242. package/dist/ai/claudeCode.d.ts +0 -1
  243. package/dist/ai/claudeCode.js +0 -186
  244. package/dist/ai/modelHarness.d.ts +0 -39
  245. package/dist/ai/modelHarness.js +0 -324
  246. package/dist/ai/modelResponseError.d.ts +0 -4
  247. package/dist/ai/modelResponseError.js +0 -8
  248. package/dist/ai/multiModelHarness.d.ts +0 -24
  249. package/dist/ai/multiModelHarness.js +0 -52
  250. package/dist/ai/plannerResponse.d.ts +0 -34
  251. package/dist/ai/plannerResponse.js +0 -96
  252. package/dist/ai/plannerResponse.test.d.ts +0 -1
  253. package/dist/ai/plannerResponse.test.js +0 -112
  254. package/dist/ai/structuredOutput.d.ts +0 -11
  255. package/dist/ai/structuredOutput.js +0 -94
  256. package/dist/ai/structuredOutput.test.d.ts +0 -1
  257. package/dist/ai/structuredOutput.test.js +0 -91
  258. package/dist/ai/types.d.ts +0 -119
  259. package/dist/ai/types.js +0 -5
  260. package/dist/ai/util.d.ts +0 -13
  261. package/dist/ai/util.js +0 -200
  262. package/dist/ai/util.test.d.ts +0 -1
  263. package/dist/ai/util.test.js +0 -95
  264. package/dist/cli.js +0 -3
  265. package/dist/common/actions.js +0 -14
  266. package/dist/common/events.d.ts +0 -17
  267. package/dist/common/events.js +0 -3
  268. package/dist/common/failure.d.ts +0 -68
  269. package/dist/common/failure.js +0 -1
  270. package/dist/common/index.d.ts +0 -3
  271. package/dist/common/index.js +0 -3
  272. package/dist/common/operation.d.ts +0 -31
  273. package/dist/common/operation.js +0 -102
  274. package/dist/common/operation.test.d.ts +0 -1
  275. package/dist/common/operation.test.js +0 -53
  276. package/dist/common/retry.d.ts +0 -16
  277. package/dist/common/retry.js +0 -35
  278. package/dist/common/util.d.ts +0 -23
  279. package/dist/common/util.js +0 -139
  280. package/dist/connectors/browserConnector.d.ts +0 -53
  281. package/dist/connectors/browserConnector.js +0 -290
  282. package/dist/connectors/desktopConnector.d.ts +0 -58
  283. package/dist/connectors/desktopConnector.js +0 -68
  284. package/dist/connectors/index.d.ts +0 -14
  285. package/dist/connectors/index.js +0 -2
  286. package/dist/index.js +0 -28
  287. package/dist/logger.d.ts +0 -3
  288. package/dist/logger.js +0 -15
  289. package/dist/memory/agentMemory.d.ts +0 -47
  290. package/dist/memory/agentMemory.js +0 -167
  291. package/dist/memory/agentMemory.test.d.ts +0 -1
  292. package/dist/memory/agentMemory.test.js +0 -150
  293. package/dist/memory/image.d.ts +0 -28
  294. package/dist/memory/image.js +0 -95
  295. package/dist/memory/image.test.d.ts +0 -1
  296. package/dist/memory/image.test.js +0 -46
  297. package/dist/memory/index.d.ts +0 -3
  298. package/dist/memory/index.js +0 -3
  299. package/dist/memory/masking.d.ts +0 -7
  300. package/dist/memory/masking.js +0 -141
  301. package/dist/memory/masking.test.d.ts +0 -1
  302. package/dist/memory/masking.test.js +0 -117
  303. package/dist/memory/notebook.d.ts +0 -58
  304. package/dist/memory/notebook.js +0 -75
  305. package/dist/memory/notebook.test.d.ts +0 -1
  306. package/dist/memory/notebook.test.js +0 -99
  307. package/dist/memory/observation.d.ts +0 -38
  308. package/dist/memory/observation.js +0 -79
  309. package/dist/memory/rendering/index.d.ts +0 -10
  310. package/dist/memory/rendering/index.js +0 -13
  311. package/dist/memory/rendering/renderJsonParts.d.ts +0 -3
  312. package/dist/memory/rendering/renderJsonParts.js +0 -115
  313. package/dist/memory/rendering/renderJsonParts.test.d.ts +0 -1
  314. package/dist/memory/rendering/renderJsonParts.test.js +0 -217
  315. package/dist/memory/rendering/renderXmlParts.d.ts +0 -7
  316. package/dist/memory/rendering/renderXmlParts.js +0 -127
  317. package/dist/memory/serde.d.ts +0 -20
  318. package/dist/memory/serde.js +0 -67
  319. package/dist/memory/serde.test.d.ts +0 -1
  320. package/dist/memory/serde.test.js +0 -64
  321. package/dist/memory/util.d.ts +0 -2
  322. package/dist/memory/util.js +0 -17
  323. package/dist/telemetry/events.d.ts +0 -9
  324. package/dist/telemetry/events.js +0 -80
  325. package/dist/telemetry/index.d.ts +0 -6
  326. package/dist/telemetry/index.js +0 -91
  327. package/dist/types.d.ts +0 -30
  328. package/dist/types.js +0 -1
  329. package/dist/util.d.ts +0 -1
  330. package/dist/util.js +0 -12
  331. package/dist/version.d.ts +0 -1
  332. package/dist/version.js +0 -3
  333. package/dist/web/browserProvider.d.ts +0 -24
  334. package/dist/web/browserProvider.js +0 -164
  335. package/dist/web/browserProvider.test.d.ts +0 -1
  336. package/dist/web/browserProvider.test.js +0 -44
  337. package/dist/web/harness.d.ts +0 -109
  338. package/dist/web/harness.js +0 -401
  339. package/dist/web/recovery.d.ts +0 -46
  340. package/dist/web/recovery.js +0 -137
  341. package/dist/web/recovery.test.d.ts +0 -1
  342. package/dist/web/recovery.test.js +0 -182
  343. package/dist/web/stability.d.ts +0 -57
  344. package/dist/web/stability.js +0 -323
  345. package/dist/web/tabs.d.ts +0 -58
  346. package/dist/web/tabs.js +0 -293
  347. package/dist/web/transformer.d.ts +0 -7
  348. package/dist/web/transformer.js +0 -41
  349. package/dist/web/types.d.ts +0 -37
  350. package/dist/web/types.js +0 -2
  351. package/dist/web/util.d.ts +0 -3
  352. package/dist/web/util.js +0 -81
  353. package/dist/web/visualizer/cursor.d.ts +0 -16
  354. package/dist/web/visualizer/cursor.js +0 -153
  355. package/dist/web/visualizer/index.d.ts +0 -22
  356. package/dist/web/visualizer/index.js +0 -47
  357. package/dist/web/visualizer/mouseEffects.d.ts +0 -18
  358. package/dist/web/visualizer/mouseEffects.js +0 -287
  359. package/dist/web/visualizer/typeEffects.d.ts +0 -10
  360. package/dist/web/visualizer/typeEffects.js +0 -190
  361. package/dist/web/zodReexport.test.d.ts +0 -1
  362. package/dist/web/zodReexport.test.js +0 -14
  363. /package/{dist/common/actions.d.ts → node_modules/patchright-core/.bun-tag-19f23bd68c84ec1f} +0 -0
@@ -1,280 +0,0 @@
1
- import { zodToJsonSchema } from "zod-to-json-schema";
2
- import { z, ZodObject } from "zod";
3
- function randomName() {
4
- const chars = 'abcdefghijklmnopqrstuvwxyz';
5
- let result = '';
6
- for (let i = 0; i < 12; i++) {
7
- result += chars.charAt(Math.floor(Math.random() * chars.length));
8
- }
9
- return result;
10
- }
11
- class SchemaAdder {
12
- tb;
13
- rootSchema;
14
- refCache = {};
15
- constructor(tb, rootSchema) {
16
- this.tb = tb;
17
- this.rootSchema = rootSchema;
18
- }
19
- _parseObject(jsonSchema) {
20
- if (jsonSchema.type !== "object") {
21
- throw new Error(`_parseObject called with non-object type: ${jsonSchema.type}`);
22
- }
23
- let name = jsonSchema.title;
24
- if (name === undefined || typeof name !== 'string') {
25
- // Name doesn't actually affect much if field used as return value anyway, just needs to be unique
26
- name = randomName();
27
- //throw new Error("Title (string) is required in JSON schema for object type that becomes a BAML class.");
28
- }
29
- const newCls = this.tb.addClass(name);
30
- const requiredFields = jsonSchema.required || [];
31
- if (!Array.isArray(requiredFields) || !requiredFields.every(rf => typeof rf === 'string')) {
32
- throw new Error(`'required' property in object '${name}' must be an array of strings.`);
33
- }
34
- const properties = jsonSchema.properties;
35
- if (properties && typeof properties === 'object') {
36
- for (const [fieldName, fieldSchemaUntyped] of Object.entries(properties)) {
37
- if (typeof fieldSchemaUntyped !== 'object' || fieldSchemaUntyped === null) {
38
- console.warn(`Property schema for '${fieldName}' in class '${name}' is not a valid object/schema. Skipping.`);
39
- continue;
40
- }
41
- const fieldSchema = fieldSchemaUntyped;
42
- const defaultValue = fieldSchema.default;
43
- let fieldType;
44
- if (fieldSchema.properties === undefined && fieldSchema.type === "object") {
45
- console.warn(`Field '${fieldName}' in class '${name}' uses generic dict type (object without properties) ` +
46
- `which defaults to map<string, string>. ` +
47
- "If a more specific type is needed, please provide a specific schema with properties.");
48
- fieldType = this.tb.map(this.tb.string(), this.tb.string());
49
- }
50
- else {
51
- fieldType = this.parse(fieldSchema);
52
- }
53
- if (!requiredFields.includes(fieldName)) {
54
- if (defaultValue === undefined) {
55
- fieldType = fieldType.optional();
56
- }
57
- }
58
- const propertyBuilder = newCls.addProperty(fieldName, fieldType);
59
- let fieldDescription = fieldSchema.description;
60
- if (typeof fieldDescription === 'string') {
61
- let finalDescription = fieldDescription.trim();
62
- if (defaultValue !== undefined) {
63
- finalDescription = `${finalDescription}\nDefault: ${JSON.stringify(defaultValue)}`;
64
- finalDescription = finalDescription.trim();
65
- }
66
- if (finalDescription.length > 0) {
67
- propertyBuilder.description(finalDescription);
68
- }
69
- }
70
- else if (defaultValue !== undefined) {
71
- const defaultDesc = `Default: ${JSON.stringify(defaultValue)}`;
72
- propertyBuilder.description(defaultDesc.trim());
73
- }
74
- }
75
- }
76
- return newCls.type();
77
- }
78
- _parseString(jsonSchema) {
79
- if (jsonSchema.type !== "string") {
80
- throw new Error(`_parseString called with non-string type: ${jsonSchema.type}`);
81
- }
82
- const title = jsonSchema.title;
83
- const enumValues = jsonSchema.enum;
84
- if (enumValues) {
85
- if (!Array.isArray(enumValues)) {
86
- throw new Error(`'enum' property for string type '${title || "anonymous"}' must be an array.`);
87
- }
88
- const stringEnumValues = [];
89
- for (const val of enumValues) {
90
- stringEnumValues.push(String(val));
91
- }
92
- if (title === undefined || typeof title !== 'string') {
93
- if (stringEnumValues.length === 0) {
94
- console.warn(`Anonymous enum (string type with 'enum' but no 'title') has no values. Defaulting to plain string type.`);
95
- return this.tb.string();
96
- }
97
- return this.tb.union(stringEnumValues.map(value => this.tb.literalString(value)));
98
- }
99
- const newEnum = this.tb.addEnum(title);
100
- if (stringEnumValues.length === 0) {
101
- console.warn(`Enum '${title}' has no values. An empty enum was created.`);
102
- }
103
- for (const value of stringEnumValues) {
104
- newEnum.addValue(value);
105
- }
106
- return newEnum.type();
107
- }
108
- return this.tb.string();
109
- }
110
- _parseArray(jsonSchema) {
111
- if (jsonSchema.type !== "array") {
112
- throw new Error(`_parseArray called with non-array type: ${jsonSchema.type}`);
113
- }
114
- const itemsSchema = jsonSchema.items;
115
- if (itemsSchema === undefined) {
116
- throw new Error(`Array field '${jsonSchema.title || "untitled array"}' is missing 'items' definition.`);
117
- }
118
- if (Array.isArray(itemsSchema) || typeof itemsSchema !== 'object' || itemsSchema === null) {
119
- throw new Error(`'items' property for array '${jsonSchema.title || "untitled array"}' must be a single schema object. Tuple/array types for 'items' are not supported by this converter (matching Python script's direct parsing of items).`);
120
- }
121
- return this.parse(itemsSchema).list();
122
- }
123
- _loadRef(ref) {
124
- if (!ref.startsWith("#/")) {
125
- throw new Error(`Only local references are supported: ${ref}`);
126
- }
127
- if (this.refCache[ref]) {
128
- return this.refCache[ref];
129
- }
130
- const pathParts = ref.substring(2).split('/');
131
- if (pathParts.length !== 2 || !pathParts[0] || !pathParts[1]) {
132
- throw new Error(`Unsupported $ref format: '${ref}'. Expected format like '#/collectionKey/definitionKey' matching Python logic.`);
133
- }
134
- const collectionKey = pathParts[0];
135
- const definitionKey = pathParts[1];
136
- const collection = this.rootSchema[collectionKey];
137
- if (typeof collection !== 'object' || collection === null) {
138
- throw new Error(`Reference collection '${collectionKey}' for $ref '${ref}' not found or not an object in the root schema.`);
139
- }
140
- if (!collection.hasOwnProperty(definitionKey)) {
141
- throw new Error(`Reference item '${definitionKey}' for $ref '${ref}' not found in collection '${collectionKey}'.`);
142
- }
143
- const targetSchema = collection[definitionKey];
144
- if (typeof targetSchema !== 'object' || targetSchema === null) {
145
- throw new Error(`Resolved $ref '${ref}' points to a non-object schema.`);
146
- }
147
- const fieldType = this.parse(targetSchema);
148
- this.refCache[ref] = fieldType;
149
- return fieldType;
150
- }
151
- parse(jsonSchema) {
152
- if (jsonSchema.$ref) {
153
- if (typeof jsonSchema.$ref !== 'string') {
154
- throw new Error("'$ref' property must be a string.");
155
- }
156
- return this._loadRef(jsonSchema.$ref);
157
- }
158
- // Handle 'const' next, as it's a very specific assertion
159
- if (jsonSchema.const !== undefined) {
160
- const constValue = jsonSchema.const;
161
- if (typeof constValue === 'string') {
162
- return this.tb.literalString(constValue);
163
- }
164
- else if (typeof constValue === 'number') {
165
- if (Number.isInteger(constValue)) {
166
- return this.tb.literalInt(constValue);
167
- }
168
- else {
169
- // BAML does not appear to have a literalFloat, based on available information.
170
- // The 'const' value itself isn't captured as a literal in the BAML type for floats.
171
- console.warn(`JSON Schema 'const' with float value '${constValue}' encountered. ` +
172
- `BAML will use base type (float) as literalFloat is not available. Title: '${jsonSchema.title || "anonymous"}'`);
173
- return this.tb.float();
174
- }
175
- }
176
- else if (typeof constValue === 'boolean') {
177
- return this.tb.literalBool(constValue);
178
- }
179
- else if (constValue === null) {
180
- return this.tb.null();
181
- }
182
- if (typeof constValue === 'object' && (jsonSchema.type !== 'object' && jsonSchema.type !== 'array')) {
183
- console.warn(`JSON Schema 'const' with complex value '${JSON.stringify(constValue)}' ` +
184
- `encountered. Title: '${jsonSchema.title || "anonymous"}'. ` +
185
- `Expected 'type: "object"' or 'type: "array"' if this const is to be further processed as such. ` +
186
- `Falling back to standard type parsing based on 'jsonSchema.type' (if present).`);
187
- }
188
- }
189
- if (jsonSchema.anyOf) {
190
- if (!Array.isArray(jsonSchema.anyOf)) {
191
- throw new Error("'anyOf' property must be an array of schema objects.");
192
- }
193
- if (!jsonSchema.anyOf.every(s => typeof s === 'object' && s !== null)) {
194
- throw new Error("'anyOf' array must contain valid schema objects.");
195
- }
196
- if (jsonSchema.anyOf.length === 0) {
197
- console.warn("'anyOf' is an empty array. Defaulting to string (Python script has no specific handling).");
198
- return this.tb.string();
199
- }
200
- return this.tb.union(jsonSchema.anyOf.map(subSchema => this.parse(subSchema)));
201
- }
202
- const additionalProperties = jsonSchema.additionalProperties;
203
- if (additionalProperties && typeof additionalProperties === 'object' && additionalProperties.anyOf) {
204
- const apSchema = additionalProperties;
205
- const anyOfInAp = apSchema.anyOf;
206
- if (!Array.isArray(anyOfInAp)) {
207
- throw new Error("'anyOf' in 'additionalProperties' must be an array of schema objects.");
208
- }
209
- if (!anyOfInAp.every(s => typeof s === 'object' && s !== null)) {
210
- throw new Error("'anyOf' in 'additionalProperties' must contain valid schema objects.");
211
- }
212
- if (anyOfInAp.length === 0) {
213
- console.warn("'anyOf' in 'additionalProperties' is empty. Defaulting map value to string.");
214
- return this.tb.map(this.tb.string(), this.tb.string());
215
- }
216
- const valueType = this.tb.union(anyOfInAp.map(subSchema => this.parse(subSchema)));
217
- return this.tb.map(this.tb.string(), valueType);
218
- }
219
- const type = jsonSchema.type;
220
- if (type === undefined) {
221
- console.warn("Type field is missing in JSON schema, defaulting to string (Python script behavior).");
222
- return this.tb.string();
223
- }
224
- if (typeof type !== 'string') {
225
- throw new Error(`Unsupported 'type' format: Expected a string, got ${typeof type} (${JSON.stringify(type)}). Python script would raise ValueError.`);
226
- }
227
- let fieldType;
228
- switch (type) {
229
- case "string":
230
- fieldType = this._parseString(jsonSchema);
231
- break;
232
- case "number":
233
- fieldType = this.tb.float();
234
- break;
235
- case "integer":
236
- fieldType = this.tb.int();
237
- break;
238
- case "object":
239
- fieldType = this._parseObject(jsonSchema);
240
- break;
241
- case "array":
242
- fieldType = this._parseArray(jsonSchema);
243
- break;
244
- case "boolean":
245
- fieldType = this.tb.bool();
246
- break;
247
- case "null":
248
- fieldType = this.tb.null();
249
- break;
250
- default:
251
- throw new Error(`Unsupported JSON Schema type: '${type}'`);
252
- }
253
- return fieldType;
254
- }
255
- }
256
- function convertJsonSchemaToBaml(tb, jsonSchema) {
257
- if (typeof jsonSchema !== 'object' || jsonSchema === null) {
258
- throw new Error("Invalid JSON schema provided. Must be an object.");
259
- }
260
- const parser = new SchemaAdder(tb, jsonSchema);
261
- return parser.parse(jsonSchema);
262
- }
263
- export function convertZodToBaml(tb, schema) {
264
- const jsonSchema = zodToJsonSchema(schema);
265
- return convertJsonSchemaToBaml(tb, jsonSchema);
266
- }
267
- export function convertActionDefinitionsToBaml(tb, actionVocabulary) {
268
- /**
269
- * Convert action definitions to BAML TypeBuilder union representing any one of the actions
270
- */
271
- return tb.union(actionVocabulary.map(action => convertZodToBaml(tb, actionInputSchema(action))));
272
- }
273
- // One wire schema for BAML's prompt and provider-enforced structured output.
274
- export function actionInputSchema({ name, description, schema }) {
275
- const wrapper = z.object({ variant: description ? z.literal(name).describe(description) : z.literal(name) });
276
- return schema instanceof ZodObject ? wrapper.merge(schema) : wrapper.extend({ input: schema });
277
- }
278
- //const tb = new TypeBuilder();
279
- //console.log(convertZodToBaml(tb, z.string()))
280
- //console.log(zodToJsonSchema(z.string()))
@@ -1,87 +0,0 @@
1
- import { ActionDefinition } from ".";
2
- export declare const clickCoordAction: ActionDefinition<{
3
- x: number;
4
- y: number;
5
- }>;
6
- export declare const mouseDoubleClickAction: ActionDefinition<{
7
- x: number;
8
- y: number;
9
- }>;
10
- export declare const mouseHoverAction: ActionDefinition<{
11
- x: number;
12
- y: number;
13
- }>;
14
- export declare const mouseRightClickAction: ActionDefinition<{
15
- x: number;
16
- y: number;
17
- }>;
18
- export declare const mouseDragAction: ActionDefinition<{
19
- from: {
20
- x: number;
21
- y: number;
22
- };
23
- to: {
24
- x: number;
25
- y: number;
26
- };
27
- }>;
28
- export declare const typeAction: ActionDefinition<{
29
- content: string;
30
- }>;
31
- export declare const keyboardEnterAction: ActionDefinition<any>;
32
- export declare const keyboardTabAction: ActionDefinition<any>;
33
- export declare const keyboardBackspaceAction: ActionDefinition<any>;
34
- export declare const keyboardSelectAllAction: ActionDefinition<any>;
35
- export declare const keyboardEscapeAction: ActionDefinition<{}>;
36
- export declare const scrollCoordAction: ActionDefinition<{
37
- x: number;
38
- y: number;
39
- deltaX: number;
40
- deltaY: number;
41
- }>;
42
- export declare const switchTabAction: ActionDefinition<{
43
- index: number;
44
- }>;
45
- export declare const newTabAction: ActionDefinition<{}>;
46
- export declare const navigateAction: ActionDefinition<{
47
- url: string;
48
- }>;
49
- export declare const goBackAction: ActionDefinition<{}>;
50
- export declare const waitAction: ActionDefinition<{
51
- seconds: number;
52
- }>;
53
- export declare const webActions: readonly [ActionDefinition<{
54
- x: number;
55
- y: number;
56
- }>, ActionDefinition<{
57
- x: number;
58
- y: number;
59
- }>, ActionDefinition<{
60
- x: number;
61
- y: number;
62
- }>, ActionDefinition<{
63
- x: number;
64
- y: number;
65
- }>, ActionDefinition<{
66
- x: number;
67
- y: number;
68
- deltaX: number;
69
- deltaY: number;
70
- }>, ActionDefinition<{
71
- from: {
72
- x: number;
73
- y: number;
74
- };
75
- to: {
76
- x: number;
77
- y: number;
78
- };
79
- }>, ActionDefinition<{}>, ActionDefinition<{
80
- index: number;
81
- }>, ActionDefinition<{
82
- url: string;
83
- }>, ActionDefinition<{
84
- content: string;
85
- }>, ActionDefinition<any>, ActionDefinition<any>, ActionDefinition<any>, ActionDefinition<{}>, ActionDefinition<any>, ActionDefinition<{
86
- seconds: number;
87
- }>];
@@ -1,214 +0,0 @@
1
- import { createAction } from ".";
2
- import { z } from "zod";
3
- import { BrowserConnector } from "@/connectors/browserConnector"; // Changed from WebInteractionFacet
4
- export const clickCoordAction = createAction({
5
- name: 'mouse:click',
6
- description: "Click something",
7
- schema: z.object({
8
- x: z.number().int(),
9
- y: z.number().int(),
10
- }),
11
- resolver: async ({ input: { x, y }, agent }) => {
12
- const web = agent.require(BrowserConnector);
13
- const harness = web.getHarness();
14
- await harness.click({ x, y });
15
- },
16
- render: ({ x, y }) => `⊙ click (${x}, ${y})`
17
- });
18
- export const mouseDoubleClickAction = createAction({
19
- name: 'mouse:double_click',
20
- schema: z.object({
21
- x: z.number().int(),
22
- y: z.number().int(),
23
- }),
24
- resolver: async ({ input: { x, y }, agent }) => {
25
- const web = agent.require(BrowserConnector);
26
- const harness = web.getHarness();
27
- await harness.doubleClick({ x, y });
28
- },
29
- render: ({ x, y }) => `⊙ double click (${x}, ${y})`
30
- });
31
- export const mouseHoverAction = createAction({
32
- name: 'mouse:hover',
33
- description: "Hover over an element to reveal tooltips, dropdown menus, or hidden content",
34
- schema: z.object({
35
- x: z.number().int(),
36
- y: z.number().int(),
37
- }),
38
- resolver: async ({ input: { x, y }, agent }) => {
39
- const web = agent.require(BrowserConnector);
40
- await web.getHarness().hover({ x, y });
41
- },
42
- render: ({ x, y }) => `◎ hover (${x}, ${y})`
43
- });
44
- export const mouseRightClickAction = createAction({
45
- name: 'mouse:right_click',
46
- schema: z.object({
47
- x: z.number().int(),
48
- y: z.number().int(),
49
- }),
50
- resolver: async ({ input: { x, y }, agent }) => {
51
- await agent.require(BrowserConnector).getHarness().rightClick({ x, y });
52
- },
53
- render: ({ x, y }) => `⊙ right click (${x}, ${y})`
54
- });
55
- export const mouseDragAction = createAction({
56
- name: 'mouse:drag',
57
- description: "Click and hold mouse in one location and release in another",
58
- schema: z.object({
59
- from: z.object({ x: z.number().int(), y: z.number().int() }),
60
- to: z.object({ x: z.number().int(), y: z.number().int() })
61
- }),
62
- resolver: async ({ input: { from, to }, agent }) => {
63
- const web = agent.require(BrowserConnector);
64
- const harness = web.getHarness();
65
- await harness.drag({ x1: from.x, y1: from.y, x2: to.x, y2: to.y });
66
- },
67
- render: ({ from, to }) => `⤡ drag (${from.x}, ${from.y}) -> (${to.x}, ${to.y})`
68
- });
69
- export const typeAction = createAction({
70
- name: 'keyboard:type',
71
- description: "Make sure to click where you need to type first", // make sure you click into it first
72
- schema: z.object({
73
- content: z.string().describe("Content to type"),
74
- }),
75
- resolver: async ({ input: { content }, agent }) => {
76
- const webConnector = agent.require(BrowserConnector);
77
- const harness = webConnector.getHarness();
78
- await harness.type({ content });
79
- },
80
- render: ({ content }) => `⌨︎ type "${content}"`
81
- });
82
- export const keyboardEnterAction = createAction({
83
- name: 'keyboard:enter',
84
- resolver: async ({ agent }) => {
85
- await agent.require(BrowserConnector).getHarness().enter();
86
- },
87
- render: () => `⏎ press enter`
88
- });
89
- export const keyboardTabAction = createAction({
90
- name: 'keyboard:tab',
91
- resolver: async ({ agent }) => {
92
- await agent.require(BrowserConnector).getHarness().tab();
93
- },
94
- render: () => `⇥ press tab`
95
- });
96
- export const keyboardBackspaceAction = createAction({
97
- name: 'keyboard:backspace',
98
- resolver: async ({ agent }) => {
99
- await agent.require(BrowserConnector).getHarness().backspace();
100
- },
101
- render: () => `⌫ press backspace`
102
- });
103
- export const keyboardSelectAllAction = createAction({
104
- name: 'keyboard:select_all',
105
- description: "Select all content in the active text area (CTRL+A)",
106
- resolver: async ({ input: { content }, agent }) => {
107
- await agent.require(BrowserConnector).getHarness().selectAll();
108
- },
109
- render: () => `⬚ select all`
110
- });
111
- export const keyboardEscapeAction = createAction({
112
- name: 'keyboard:escape',
113
- description: 'Press Escape to dismiss a dismissible dialog, menu, or focused interaction. This does not bypass a subscription or sign-in requirement.',
114
- schema: z.object({}),
115
- resolver: async ({ agent }) => {
116
- await agent.require(BrowserConnector).getHarness().escape();
117
- },
118
- render: () => '⎋ press Escape'
119
- });
120
- export const scrollCoordAction = createAction({
121
- name: 'mouse:scroll',
122
- description: "Hover over the area to scroll. Distances are in pixels, not wheel ticks. To browse a full page, use about 500-600 pixels per scroll. Reserve small distances for fine adjustments or small scrollable areas.",
123
- schema: z.object({
124
- x: z.number().int(),
125
- y: z.number().int(),
126
- deltaX: z.number().int().describe("Horizontal distance in pixels: positive scrolls right, negative scrolls left. Use 0 for vertical-only scrolling."),
127
- deltaY: z.number().int().describe("Vertical distance in pixels: 600 scrolls down, -600 scrolls up. Use about 500-600 to browse a full page; 5 moves only 5 pixels. Use smaller distances for fine adjustments and 0 for horizontal-only scrolling."),
128
- }),
129
- resolver: async ({ input: { x, y, deltaX, deltaY }, agent }) => {
130
- const webConnector = agent.require(BrowserConnector);
131
- const harness = webConnector.getHarness();
132
- await harness.scroll({ x, y, deltaX, deltaY });
133
- },
134
- render: ({ x, y, deltaX, deltaY }) => `↕ scroll (${deltaX}px, ${deltaY}px)`
135
- });
136
- // Grounding agnostic
137
- export const switchTabAction = createAction({
138
- name: 'browser:tab:switch',
139
- description: "Switch to a tab that is already open",
140
- schema: z.object({
141
- index: z.number().int().describe("Index of tab to switch to"),
142
- }),
143
- resolver: async ({ input: { index }, agent }) => {
144
- const webConnector = agent.require(BrowserConnector);
145
- const harness = webConnector.getHarness();
146
- await harness.switchTab({ index });
147
- },
148
- render: ({ index }) => `⧉ switch to tab ${index}`
149
- });
150
- export const newTabAction = createAction({
151
- name: 'browser:tab:new',
152
- description: "Open and switch to a new tab",
153
- schema: z.object({}),
154
- resolver: async ({ agent }) => {
155
- const webConnector = agent.require(BrowserConnector);
156
- const harness = webConnector.getHarness();
157
- await harness.newTab();
158
- },
159
- render: () => `⊞ open new tab`
160
- });
161
- export const navigateAction = createAction({
162
- name: 'browser:nav',
163
- description: "Navigate to a URL directly",
164
- schema: z.object({
165
- url: z.string().describe('URL to navigate to'),
166
- }),
167
- resolver: async ({ input: { url }, agent }) => {
168
- const webConnector = agent.require(BrowserConnector);
169
- const harness = webConnector.getHarness();
170
- await harness.navigate(url);
171
- },
172
- render: ({ url }) => `⛓︎ navigate to ${url}`
173
- });
174
- export const goBackAction = createAction({
175
- name: 'browser:nav:back',
176
- description: "Go back",
177
- schema: z.object({}),
178
- resolver: async ({ agent }) => {
179
- const webConnector = agent.require(BrowserConnector);
180
- const harness = webConnector.getHarness();
181
- await harness.goBack();
182
- },
183
- render: () => `← navigate back`
184
- });
185
- // gets overused currently if we include this
186
- export const waitAction = createAction({
187
- name: 'wait',
188
- description: "Actions include smart waiting automatically - so only use this when a significant additional wait is clearly required.",
189
- schema: z.object({
190
- seconds: z.number().finite().nonnegative()
191
- }),
192
- resolver: async ({ input: { seconds }, agent }) => {
193
- await agent.require(BrowserConnector).wait(seconds * 1000);
194
- },
195
- render: ({ seconds }) => `◴ wait for ${seconds}s`
196
- });
197
- export const webActions = [
198
- clickCoordAction,
199
- mouseDoubleClickAction,
200
- mouseRightClickAction,
201
- mouseHoverAction,
202
- scrollCoordAction,
203
- mouseDragAction,
204
- newTabAction,
205
- switchTabAction,
206
- navigateAction,
207
- typeAction,
208
- keyboardEnterAction,
209
- keyboardTabAction,
210
- keyboardBackspaceAction,
211
- keyboardEscapeAction,
212
- keyboardSelectAllAction,
213
- waitAction,
214
- ];
@@ -1 +0,0 @@
1
- export {};
@@ -1,43 +0,0 @@
1
- import { expect, mock, test } from 'bun:test';
2
- import { zodToJsonSchema } from 'zod-to-json-schema';
3
- import { keyboardEscapeAction, scrollCoordAction, waitAction, webActions } from './webActions';
4
- test('Escape is exposed and forwards the Escape command', async () => {
5
- const escape = mock(async () => { });
6
- const agent = { require: () => ({ getHarness: () => ({ escape }) }) };
7
- expect(webActions).toContain(keyboardEscapeAction);
8
- await keyboardEscapeAction.resolver({ agent, input: {} });
9
- expect(escape).toHaveBeenCalledTimes(1);
10
- });
11
- test('wait validates its duration and uses browser cooldown handling', async () => {
12
- const wait = mock(async () => { });
13
- const agent = { require: () => ({ wait }) };
14
- await waitAction.resolver({ agent, input: { seconds: 2 } });
15
- expect(wait).toHaveBeenCalledWith(2000);
16
- expect(waitAction.schema.safeParse({ seconds: -1 }).success).toBe(false);
17
- expect(waitAction.schema.safeParse({ seconds: Infinity }).success).toBe(false);
18
- });
19
- test('scroll scale and precision guidance are included in the action schema', () => {
20
- const prompt = `${scrollCoordAction.description} ${JSON.stringify(zodToJsonSchema(scrollCoordAction.schema))}`;
21
- expect(prompt).toContain('not wheel ticks');
22
- expect(prompt).toContain('500-600');
23
- expect(prompt).toContain('600 scrolls down, -600 scrolls up');
24
- expect(prompt).toContain('positive scrolls right, negative scrolls left');
25
- expect(prompt).toContain('fine adjustments');
26
- });
27
- for (const deltas of [
28
- { deltaX: 0, deltaY: 5 },
29
- { deltaX: 0, deltaY: -5 },
30
- { deltaX: 0, deltaY: 600 },
31
- { deltaX: 0, deltaY: -600 },
32
- { deltaX: 600, deltaY: 0 },
33
- { deltaX: -5, deltaY: 0 },
34
- ]) {
35
- test(`scroll forwards pixel distances unchanged: ${deltas.deltaX}, ${deltas.deltaY}`, async () => {
36
- const scroll = mock(async () => { });
37
- const agent = { require: () => ({ getHarness: () => ({ scroll }) }) };
38
- const input = scrollCoordAction.schema.parse({ x: 120, y: 250, ...deltas });
39
- await scrollCoordAction.resolver({ agent, input });
40
- expect(scroll).toHaveBeenCalledTimes(1);
41
- expect(scroll).toHaveBeenCalledWith({ x: 120, y: 250, ...deltas });
42
- });
43
- }
@@ -1,31 +0,0 @@
1
- import { BrowserContext, Page } from "playwright";
2
- import { Agent, AgentOptions } from ".";
3
- import { BrowserConnectorOptions } from "@/connectors/browserConnector";
4
- import { Schema, ZodSchema } from "zod";
5
- import z from "zod";
6
- import EventEmitter from "eventemitter3";
7
- import { type OperationOptions } from '@/common/operation';
8
- export declare function startBrowserAgent(options?: AgentOptions & BrowserConnectorOptions & {
9
- narrate?: boolean;
10
- }): Promise<BrowserAgent>;
11
- type ExtractedOutput = string | number | boolean | bigint | Date | null | undefined | {
12
- [key: string]: ExtractedOutput;
13
- } | ExtractedOutput[];
14
- export interface BrowserAgentEvents {
15
- 'nav': (url: string) => void;
16
- 'extractStarted': (instructions: string, schema: ZodSchema) => void;
17
- 'extractDone': (instructions: string, data: ExtractedOutput) => void;
18
- }
19
- export declare class BrowserAgent extends Agent {
20
- readonly browserAgentEvents: EventEmitter<BrowserAgentEvents>;
21
- constructor({ agentOptions, browserOptions }: {
22
- agentOptions?: Partial<AgentOptions>;
23
- browserOptions?: BrowserConnectorOptions;
24
- });
25
- get page(): Page;
26
- get context(): BrowserContext;
27
- nav(url: string, options?: OperationOptions): Promise<void>;
28
- extract<T extends Schema>(instructions: string, schema: T, options?: OperationOptions): Promise<z.infer<T>>;
29
- private _extract;
30
- }
31
- export {};