@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,24 +0,0 @@
1
- import { MultiMediaContentPart } from "@/memory/rendering";
2
- import { ModelHarnessEvents } from "./modelHarness";
3
- import { LLMClient } from "./types";
4
- import { ActionDefinition } from "@/actions";
5
- import { AgentContext } from "./baml_client";
6
- import { Image } from '@/memory/image';
7
- import EventEmitter from "eventemitter3";
8
- import z from "zod";
9
- import type { PlannerResponse } from './plannerResponse';
10
- export declare class MultiModelHarness {
11
- /**
12
- * Delegates model responsibilites to different LLMs and consolidates their usage
13
- */
14
- private roles;
15
- private uniqueModels;
16
- readonly events: EventEmitter<ModelHarnessEvents>;
17
- constructor(clients: LLMClient[]);
18
- setup(): Promise<void>;
19
- describe(): string;
20
- partialAct<T>(context: AgentContext, task: string, data: MultiMediaContentPart[], actionVocabulary: ActionDefinition<T>[]): Promise<PlannerResponse>;
21
- extract<T extends z.Schema>(instructions: string, schema: T, screenshot: Image, domContent: string): Promise<z.infer<T>>;
22
- query<T extends z.Schema>(context: AgentContext, query: string, schema: T): Promise<z.infer<T>>;
23
- get numUniqueModels(): number;
24
- }
@@ -1,52 +0,0 @@
1
- import { ModelHarness } from "./modelHarness";
2
- import { allBrowserAgentRoles } from "./types";
3
- import EventEmitter from "eventemitter3";
4
- export class MultiModelHarness {
5
- /**
6
- * Delegates model responsibilites to different LLMs and consolidates their usage
7
- */
8
- // Roles may reference the same harness
9
- roles = {};
10
- uniqueModels = [];
11
- events = new EventEmitter();
12
- constructor(clients) {
13
- // Sort by specificity (from least specific to most specific)
14
- const sortedClients = clients.toSorted((a, b) => (b.roles ? b.roles.length : 9999) - (a.roles ? a.roles.length : 9999));
15
- for (const client of sortedClients) {
16
- const harness = new ModelHarness({ llm: client });
17
- this.uniqueModels.push(harness);
18
- if (client.roles) {
19
- for (const role of client.roles) {
20
- this.roles[role] = harness;
21
- }
22
- }
23
- else {
24
- for (const role of allBrowserAgentRoles) {
25
- this.roles[role] = harness;
26
- }
27
- }
28
- // Forward token usage events upward
29
- harness.events.on('tokensUsed', (usage) => { this.events.emit('tokensUsed', usage); }, this);
30
- }
31
- }
32
- async setup() {
33
- await Promise.all(this.uniqueModels.map(model => model.setup()));
34
- }
35
- describe() {
36
- // for now - describe least specific model
37
- return this.uniqueModels[0].describeModel();
38
- }
39
- // TODO: generalize responsibility delegation
40
- async partialAct(context, task, data, actionVocabulary) {
41
- return await this.roles['act'].partialAct(context, task, data, actionVocabulary);
42
- }
43
- async extract(instructions, schema, screenshot, domContent) {
44
- return await this.roles['extract'].extract(instructions, schema, screenshot, domContent);
45
- }
46
- async query(context, query, schema) {
47
- return await this.roles['query'].query(context, query, schema);
48
- }
49
- get numUniqueModels() {
50
- return this.uniqueModels.length;
51
- }
52
- }
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ActionDefinition } from '@/actions';
3
- import type { Action } from '@/actions/types';
4
- import { type NoteUpdate } from '@/memory/notebook';
5
- export interface PlannerResponse {
6
- reasoning: string;
7
- memory_updates: NoteUpdate[];
8
- actions: Action[];
9
- }
10
- export declare const memoryUpdatesSchema: z.ZodArray<z.ZodObject<{
11
- key: z.ZodString;
12
- text: z.ZodString;
13
- sources: z.ZodArray<z.ZodNumber, "many">;
14
- } & {
15
- operation: z.ZodEnum<["add", "correct"]>;
16
- expected_text: z.ZodNullable<z.ZodString>;
17
- }, "strict", z.ZodTypeAny, {
18
- key: string;
19
- text: string;
20
- sources: number[];
21
- operation: "add" | "correct";
22
- expected_text: string | null;
23
- }, {
24
- key: string;
25
- text: string;
26
- sources: number[];
27
- operation: "add" | "correct";
28
- expected_text: string | null;
29
- }>, "many">;
30
- export declare class PlannerResponseError extends Error {
31
- readonly diagnostic: string;
32
- constructor(diagnostic?: string, message?: string);
33
- }
34
- export declare function parsePlannerResponse<T>(raw: string | null, vocabulary: ActionDefinition<T>[]): PlannerResponse;
@@ -1,96 +0,0 @@
1
- import { z } from 'zod';
2
- import { noteUpdateSchema, NOTEBOOK_LIMITS } from '@/memory/notebook';
3
- export const memoryUpdatesSchema = z.array(noteUpdateSchema).max(NOTEBOOK_LIMITS.entries)
4
- .describe('Review the current observations before acting. Add exact facts and completed checks as separate records; correct only the targeted existing record with an exact current-text match. Omitted records stay unchanged. Return [] when nothing new needs retaining. Never record imagined action results. Each update costs one action.');
5
- export class PlannerResponseError extends Error {
6
- diagnostic;
7
- constructor(diagnostic = '$: expected one complete JSON plan with reasoning, memory_updates and actions', message = 'Invalid planner response') {
8
- const bounded = diagnostic.slice(0, 1024);
9
- super(`${message}: ${bounded}`);
10
- this.name = 'PlannerResponseError';
11
- this.diagnostic = bounded;
12
- }
13
- }
14
- const planSchema = z.object({
15
- reasoning: z.string().trim().min(1),
16
- memory_updates: memoryUpdatesSchema,
17
- actions: z.array(z.object({ variant: z.string() }).passthrough()).min(1),
18
- }).strict();
19
- // Only schema-owned field names and array indices may enter the repair prompt.
20
- // Record keys, custom refinement paths/messages and received values can contain
21
- // model output or page text; do not echo them into prompts or persisted errors.
22
- function diagnosticPath(schema, path, prefix) {
23
- let current = schema;
24
- for (const part of path.slice(0, 6)) {
25
- for (let depth = 0; depth < 16; depth++) {
26
- if (current instanceof z.ZodOptional || current instanceof z.ZodNullable)
27
- current = current.unwrap();
28
- else if (current instanceof z.ZodEffects)
29
- current = current.innerType();
30
- else if (current instanceof z.ZodDefault)
31
- current = current.removeDefault();
32
- else
33
- break;
34
- }
35
- if (typeof part === 'string' && current instanceof z.ZodObject
36
- && Object.hasOwn(current.shape, part) && /^[A-Za-z_][A-Za-z0-9_]{0,31}$/.test(part)) {
37
- prefix += `.${part}`;
38
- current = current.shape[part];
39
- }
40
- else if (typeof part === 'number' && Number.isSafeInteger(part) && part >= 0 && current instanceof z.ZodArray) {
41
- prefix += `[${part}]`;
42
- current = current.element;
43
- }
44
- else
45
- return `${prefix}[*]`;
46
- }
47
- return path.length > 6 ? `${prefix}...` : prefix;
48
- }
49
- function schemaDiagnostic(error, schema, prefix = '$') {
50
- const details = error.issues.slice(0, 3).map(issue => {
51
- let constraint = '';
52
- if (issue.code === 'invalid_type' && Object.hasOwn(z.ZodParsedType, issue.expected)) {
53
- constraint = ` (expected ${issue.expected})`;
54
- }
55
- else if (issue.code === 'too_big' || issue.code === 'too_small') {
56
- const limit = issue.code === 'too_big' ? issue.maximum : issue.minimum;
57
- if (typeof limit === 'number' && Number.isFinite(limit)) {
58
- constraint = ` (${issue.code === 'too_big' ? 'maximum' : 'minimum'} ${limit}, ${issue.inclusive ? 'inclusive' : 'exclusive'})`;
59
- }
60
- }
61
- const code = Object.hasOwn(z.ZodIssueCode, issue.code) ? issue.code : 'schema constraint failed';
62
- return `${diagnosticPath(schema, issue.path, prefix)}: ${code}${constraint}`;
63
- });
64
- if (error.issues.length > 3)
65
- details.push('additional issues omitted');
66
- return details.join('; ');
67
- }
68
- // BAML can coerce prose, incomplete JSON, or multiple objects into a plan. Do not
69
- // execute that recovery: a simulated multi-turn transcript is not a safe batch.
70
- export function parsePlannerResponse(raw, vocabulary) {
71
- const text = raw?.trim() ?? '';
72
- // Accept a single JSON fence for compatibility, but no surrounding narrative.
73
- const fenced = /^```(?:json)?\s*\n([\s\S]*?)\n```$/i.exec(text);
74
- let value;
75
- try {
76
- value = JSON.parse(fenced ? fenced[1] : text);
77
- }
78
- catch {
79
- throw new PlannerResponseError('$: invalid_json; return exactly one complete JSON object');
80
- }
81
- const plan = planSchema.safeParse(value);
82
- if (!plan.success)
83
- throw new PlannerResponseError(schemaDiagnostic(plan.error, planSchema));
84
- for (const [index, action] of plan.data.actions.entries()) {
85
- const definition = vocabulary.find(candidate => candidate.name === action.variant);
86
- if (!definition)
87
- throw new PlannerResponseError(`$.actions[${index}].variant: unknown action; choose an action from the schema`);
88
- const { variant, ...fields } = action;
89
- const objectInput = definition.schema instanceof z.ZodObject;
90
- const parsed = definition.schema.safeParse(objectInput ? fields : action.input);
91
- if (!parsed.success) {
92
- throw new PlannerResponseError(schemaDiagnostic(parsed.error, definition.schema, `$.actions[${index}]${objectInput ? '' : '.input'}`));
93
- }
94
- }
95
- return plan.data;
96
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,112 +0,0 @@
1
- import { expect, test } from 'bun:test';
2
- import { z } from 'zod';
3
- import { createAction } from '@/actions';
4
- import { parsePlannerResponse, PlannerResponseError } from './plannerResponse';
5
- const vocabulary = [createAction({ name: 'click', schema: z.object({ x: z.number() }), resolver: async () => { } })];
6
- const plan = { reasoning: 'Click the observed button.', memory_updates: [], actions: [{ variant: 'click', x: 12 }] };
7
- test('accepts exactly one JSON plan, optionally in a single JSON fence', () => {
8
- expect(parsePlannerResponse(JSON.stringify(plan), vocabulary)).toEqual(plan);
9
- expect(parsePlannerResponse(['', '```json', JSON.stringify(plan), '```', ''].join('\n'), vocabulary)).toEqual(plan);
10
- });
11
- for (const raw of [
12
- null, '', '<function_calls><invoke name="web_action">...</invoke></function_calls>',
13
- `Here is the plan: ${JSON.stringify(plan)}`, `${JSON.stringify(plan)}\nNow I see a new page.`,
14
- `${JSON.stringify(plan)}\n${JSON.stringify(plan)}`, JSON.stringify(plan).slice(0, -2),
15
- JSON.stringify([plan]), JSON.stringify({ ...plan, actions: [] }),
16
- JSON.stringify({ ...plan, reasoning: '' }), JSON.stringify({ actions: plan.actions }),
17
- JSON.stringify({ ...plan, observations: 'Invented results' }),
18
- JSON.stringify({ ...plan, actions: [{ variant: 'unknown', x: 12 }] }),
19
- JSON.stringify({ ...plan, actions: [{ variant: 'click', x: '12' }] }),
20
- JSON.stringify({ ...plan, actions: [{ variant: 'click' }] }),
21
- JSON.stringify({ ...plan, actions: [...plan.actions, { variant: 'click', x: 'invalid' }] }),
22
- ])
23
- test(`rejects invalid planner output: ${String(raw).slice(0, 75)}`, () => {
24
- expect(() => parsePlannerResponse(raw, vocabulary)).toThrow(PlannerResponseError);
25
- });
26
- test('validates primitive action inputs without transforming them twice', () => {
27
- const primitive = createAction({ name: 'say', schema: z.string().transform(text => `${text}!`), resolver: async () => { } });
28
- const response = { reasoning: 'Answer.', memory_updates: [], actions: [{ variant: 'say', input: 'hello' }] };
29
- expect(parsePlannerResponse(JSON.stringify(response), [primitive])).toEqual(response);
30
- });
31
- test('requires a bounded memory review and validates every update before accepting actions', () => {
32
- const note = { key: 'record', text: 'Observed value: 731.', sources: [0], operation: 'add', expected_text: null };
33
- const valid = { ...plan, memory_updates: [note] };
34
- expect(parsePlannerResponse(JSON.stringify(valid), vocabulary)).toEqual(valid);
35
- const correction = { ...valid, memory_updates: [{ ...note, operation: 'correct', expected_text: note.text, text: 'Corrected value: 914.' }] };
36
- expect(parsePlannerResponse(JSON.stringify(correction), vocabulary)).toEqual(correction);
37
- const { memory_updates, ...missing } = valid;
38
- for (const invalid of [missing, ...[null, {}, [null], [{ ...note, sources: [] }],
39
- [{ ...note, sources: [-1] }], [{ ...note, sources: ['0'] }], [{ ...note, sources: [0.5] }],
40
- [{ ...note, text: '' }], [{ ...note, text: 'a'.repeat(2001) }], [{ ...note, key: 'a'.repeat(81) }],
41
- [{ ...note, fabricated: true }], [{ ...note, operation: 'replace' }], [{ ...note, operation: undefined }],
42
- [{ ...note, expected_text: undefined }], [{ ...note, expected_text: '' }], [{ ...note, expected_text: 'a'.repeat(2001) }],
43
- Array(33).fill(note), [note, { ...note, sources: [] }],
44
- ].map(memory_updates => ({ ...plan, memory_updates }))]) {
45
- expect(() => parsePlannerResponse(JSON.stringify(invalid), vocabulary)).toThrow(PlannerResponseError);
46
- }
47
- });
48
- function rejection(value, actions = vocabulary) {
49
- try {
50
- parsePlannerResponse(JSON.stringify(value), actions);
51
- }
52
- catch (error) {
53
- expect(error).toBeInstanceOf(PlannerResponseError);
54
- return error;
55
- }
56
- throw new Error('Expected the whole plan to be rejected');
57
- }
58
- test('diagnoses missing fields, empty actions, and nested note limits', () => {
59
- const { memory_updates, ...missing } = plan;
60
- expect(rejection(missing).diagnostic).toContain('$.memory_updates: invalid_type (expected array)');
61
- expect(rejection({ ...plan, actions: [] }).diagnostic).toContain('$.actions: too_small (minimum 1, inclusive)');
62
- const note = { key: 'record', text: 'x'.repeat(2001), sources: Array(9).fill(0), operation: 'add', expected_text: null };
63
- const diagnostic = rejection({ ...plan, memory_updates: [note] }).diagnostic;
64
- expect(diagnostic).toContain('$.memory_updates[0].text: too_big (maximum 2000, inclusive)');
65
- expect(diagnostic).toContain('$.memory_updates[0].sources: too_big (maximum 8, inclusive)');
66
- });
67
- test('diagnoses the failing action without exposing its values or unknown variant', () => {
68
- const secret = 'REJECTED_RESPONSE_SECRET';
69
- const error = rejection({ ...plan, actions: [...plan.actions, { variant: 'click', x: secret }] });
70
- expect(error.diagnostic).toContain('$.actions[1].x: invalid_type (expected number)');
71
- expect(error.message).toContain(error.diagnostic);
72
- expect(error.message).not.toContain(secret);
73
- const unknown = rejection({ ...plan, actions: [{ variant: secret }] });
74
- expect(unknown.diagnostic).toContain('$.actions[0].variant: unknown action');
75
- expect(unknown.message).not.toContain(secret);
76
- });
77
- test('primitive and wrapped action inputs retain precise schema paths', () => {
78
- const say = createAction({ name: 'say', schema: z.string().max(4), resolver: async () => { } });
79
- expect(rejection({ ...plan, actions: [{ variant: 'say', input: 'longer' }] }, [say]).diagnostic)
80
- .toContain('$.actions[0].input: too_big (maximum 4, inclusive)');
81
- const nested = createAction({ name: 'nested', schema: z.object({ items: z.array(z.object({ count: z.number().int() }).optional()) }), resolver: async () => { } });
82
- expect(rejection({ ...plan, actions: [{ variant: 'nested', items: [{ count: 1.5 }] }] }, [nested]).diagnostic)
83
- .toContain('$.actions[0].items[0].count: invalid_type (expected integer)');
84
- });
85
- test('diagnostics omit unknown keys, dynamic record keys, and custom refinement messages', () => {
86
- const secret = 'REJECTED_RESPONSE_SECRET';
87
- expect(rejection({ ...plan, [secret]: true }).message).not.toContain(secret);
88
- const record = createAction({ name: 'record', schema: z.object({ values: z.record(z.number()) }), resolver: async () => { } });
89
- const error = rejection({ ...plan, actions: [{ variant: 'record', values: { [secret]: 'invalid' } }] }, [record]);
90
- expect(error.diagnostic).toContain('$.actions[0].values[*]: invalid_type (expected number)');
91
- expect(error.message).not.toContain(secret);
92
- const custom = createAction({ name: 'custom', schema: z.string().refine(() => false, { message: secret, path: [secret] }), resolver: async () => { } });
93
- const refined = rejection({ ...plan, actions: [{ variant: 'custom', input: secret }] }, [custom]);
94
- expect(refined.diagnostic).toContain('custom');
95
- expect(refined.message).not.toContain(secret);
96
- });
97
- test('diagnostics remain bounded for many errors and enormous malformed text', () => {
98
- const error = rejection({ ...plan, memory_updates: Array(100).fill({ key: '', text: '' }) });
99
- expect(error.diagnostic.length).toBeLessThanOrEqual(1024);
100
- expect(error.diagnostic).toContain('additional issues omitted');
101
- const secret = 'REJECTED_RESPONSE_SECRET';
102
- try {
103
- parsePlannerResponse(`${secret.repeat(10000)}{`, vocabulary);
104
- }
105
- catch (error) {
106
- expect(error).toBeInstanceOf(PlannerResponseError);
107
- expect(error.diagnostic).toContain('invalid_json');
108
- expect(error.message).not.toContain(secret);
109
- return;
110
- }
111
- throw new Error('Malformed output was accepted');
112
- });
@@ -1,11 +0,0 @@
1
- import { type Schema } from 'zod';
2
- import type { LLMClient } from './types';
3
- import type { ActionDefinition } from '@/actions';
4
- type JsonSchema = Record<string, any>;
5
- export declare function usesStructuredOutput(client: LLMClient): boolean;
6
- export declare function plannerSchema(vocabulary: ActionDefinition<any>[]): Schema;
7
- export declare function anthropicOutputFormat(schema: Schema): {
8
- type: 'json_schema';
9
- schema: JsonSchema;
10
- } | undefined;
11
- export {};
@@ -1,94 +0,0 @@
1
- import { zodToJsonSchema } from 'zod-to-json-schema';
2
- import { z } from 'zod';
3
- import { actionInputSchema } from '@/actions/util';
4
- import { memoryUpdatesSchema } from './plannerResponse';
5
- import { DEFAULT_BASETEN_BASE_URL } from './baseten';
6
- export function usesStructuredOutput(client) {
7
- if (client.provider === 'baseten') {
8
- return client.options.structuredOutputs ?? (client.options.baseUrl === undefined
9
- || client.options.baseUrl.replace(/\/+$/, '') === DEFAULT_BASETEN_BASE_URL);
10
- }
11
- if (client.provider !== 'anthropic')
12
- return false;
13
- // Unknown/older models and OAuth providers keep their existing transport.
14
- return client.options.structuredOutputs ?? /^claude-(?:haiku-4-5|sonnet-(?:4-5|4-6|5)|opus-(?:4-5|4-6|4-7|4-8|5))(?:-\d{8})?$/.test(client.options.model);
15
- }
16
- export function plannerSchema(vocabulary) {
17
- const actions = vocabulary.map(actionInputSchema);
18
- if (!actions.length)
19
- throw new Error('Planner requires at least one action definition');
20
- return z.object({
21
- reasoning: z.string(),
22
- memory_updates: memoryUpdatesSchema,
23
- actions: z.array(actions.length === 1 ? actions[0] : z.union(actions)).min(1),
24
- });
25
- }
26
- // https://platform.claude.com/docs/en/build-with-claude/structured-outputs
27
- // Provider constraints are narrower than Zod. Retain unsupported value constraints
28
- // in descriptions and validate the response against the original Zod schema.
29
- // Open maps, recursive schemas, and unknown schema constructs use the existing
30
- // BAML path instead of silently changing the caller's data shape.
31
- export function anthropicOutputFormat(schema) {
32
- const root = zodToJsonSchema(schema);
33
- const constraints = new Set(['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf', 'minLength', 'maxLength', 'pattern', 'format', 'maxItems', 'uniqueItems']);
34
- const annotations = new Set(['$schema', 'definitions', '$defs', 'title', 'description', 'default']);
35
- let optionalCount = 0;
36
- let unionCount = 0;
37
- function convert(input, ancestors = new Set()) {
38
- if (!input || typeof input !== 'object' || Array.isArray(input) || ancestors.has(input))
39
- throw new Error('Unsupported schema');
40
- const path = new Set(ancestors).add(input);
41
- if (input.$ref) {
42
- if (!input.$ref.startsWith('#/'))
43
- throw new Error('Unsupported schema reference');
44
- const referenced = input.$ref.slice(2).split('/').reduce((value, key) => value?.[key.replaceAll('~1', '/').replaceAll('~0', '~')], root);
45
- return convert(referenced, path);
46
- }
47
- const result = {};
48
- const notes = [];
49
- for (const [key, value] of Object.entries(input)) {
50
- if (constraints.has(key) || (key === 'minItems' && value > 1)) {
51
- notes.push(`${key}: ${JSON.stringify(value)}`);
52
- }
53
- else if (key === 'properties') {
54
- result.properties = Object.fromEntries(Object.entries(value).map(([name, property]) => [name, convert(property, path)]));
55
- }
56
- else if (key === 'items') {
57
- result.items = convert(value, path);
58
- }
59
- else if (key === 'anyOf' || key === 'allOf') {
60
- if (key === 'anyOf')
61
- unionCount++;
62
- result[key] = value.map((item) => convert(item, path));
63
- }
64
- else if (['type', 'enum', 'const', 'required', 'minItems', 'additionalProperties'].includes(key)) {
65
- result[key] = value;
66
- if (key === 'type' && Array.isArray(value))
67
- unionCount++;
68
- }
69
- else if (!annotations.has(key))
70
- throw new Error('Unsupported schema keyword');
71
- }
72
- if (!result.type && !result.anyOf && !result.allOf && !('const' in result) && !result.enum)
73
- throw new Error('Unconstrained schema');
74
- if (result.enum?.some((value) => value !== null && typeof value === 'object') || (result.const !== null && typeof result.const === 'object'))
75
- throw new Error('Complex literal');
76
- if (result.type === 'object') {
77
- if (result.additionalProperties !== false)
78
- throw new Error('Open-ended object');
79
- optionalCount += Object.keys(result.properties ?? {}).filter(key => !result.required?.includes(key)).length;
80
- }
81
- if (input.description || notes.length)
82
- result.description = [input.description, ...notes].filter(Boolean).join('\n');
83
- return result;
84
- }
85
- try {
86
- const converted = convert(root);
87
- if (optionalCount > 24 || unionCount > 16)
88
- return undefined;
89
- return { type: 'json_schema', schema: converted };
90
- }
91
- catch {
92
- return undefined;
93
- }
94
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,91 +0,0 @@
1
- import { expect, test } from 'bun:test';
2
- import { z } from 'zod';
3
- import { createAction } from '@/actions';
4
- import { webActions } from '@/actions/webActions';
5
- import { anthropicOutputFormat, plannerSchema, usesStructuredOutput } from './structuredOutput';
6
- test('Anthropic native output is automatic only for known supported direct models', () => {
7
- for (const model of ['claude-haiku-4-5-20251001', 'claude-sonnet-5', 'claude-opus-4-6']) {
8
- expect(usesStructuredOutput({ provider: 'anthropic', options: { model } })).toBe(true);
9
- expect(usesStructuredOutput({ provider: 'anthropic', options: { model, structuredOutputs: false } })).toBe(false);
10
- }
11
- for (const model of ['claude-sonnet-4-20250514', 'claude-sonnet-50', 'future-custom-model']) {
12
- expect(usesStructuredOutput({ provider: 'anthropic', options: { model } })).toBe(false);
13
- }
14
- expect(usesStructuredOutput({ provider: 'anthropic', options: { model: 'future-custom-model', structuredOutputs: true } })).toBe(true);
15
- expect(usesStructuredOutput({ provider: 'claude-code', options: { model: 'claude-sonnet-5' } })).toBe(false);
16
- expect(usesStructuredOutput({ provider: 'openai', options: { model: 'claude-sonnet-5' } })).toBe(false);
17
- });
18
- test('Baseten hosted Model APIs enable native output with an explicit custom-endpoint opt-in', () => {
19
- for (const model of ['deepseek-ai/DeepSeek-V4.1-Flash', 'zai-org/GLM-5.3-Flash', 'future-hosted-model']) {
20
- for (const baseUrl of [undefined, 'https://inference.baseten.co/v1', 'https://inference.baseten.co/v1/']) {
21
- expect(usesStructuredOutput({ provider: 'baseten', options: { model, baseUrl } })).toBe(true);
22
- expect(usesStructuredOutput({ provider: 'baseten', options: { model, baseUrl, structuredOutputs: false } })).toBe(false);
23
- }
24
- }
25
- for (const baseUrl of ['http://127.0.0.1:8080/v1', 'https://inference.baseten.co/v1/custom', 'https://proxy.example/v1']) {
26
- expect(usesStructuredOutput({ provider: 'baseten', options: { model: 'custom', baseUrl } })).toBe(false);
27
- expect(usesStructuredOutput({ provider: 'baseten', options: { model: 'custom', baseUrl, structuredOutputs: true } })).toBe(true);
28
- }
29
- });
30
- test('wire schema uses existing action definitions, including primitive and nested payloads', () => {
31
- const actions = [
32
- createAction({ name: 'move', schema: z.object({ to: z.object({ x: z.number().int(), y: z.number().int() }) }), resolver: async () => { } }),
33
- createAction({ name: 'report', schema: z.string(), resolver: async () => { } }),
34
- ];
35
- const schema = anthropicOutputFormat(plannerSchema(actions)).schema;
36
- expect(schema.additionalProperties).toBe(false);
37
- expect(schema.required).toEqual(['reasoning', 'memory_updates', 'actions']);
38
- expect(schema.properties.memory_updates.type).toBe('array');
39
- expect(schema.properties.memory_updates.items.required).toEqual(['key', 'text', 'sources', 'operation', 'expected_text']);
40
- expect(schema.properties.memory_updates.items.properties.operation.enum).toEqual(['add', 'correct']);
41
- expect(schema.properties.memory_updates.items.properties.expected_text.anyOf.map((option) => option.type)).toEqual(['string', 'null']);
42
- expect(schema.properties.memory_updates.items.properties.sources.items.type).toBe('integer');
43
- expect(schema.properties.actions.minItems).toBe(1);
44
- expect(schema.properties.actions.items.anyOf.map((item) => item.properties.variant.const)).toEqual(['move', 'report']);
45
- expect(schema.properties.actions.items.anyOf[0].properties.to.properties.x.type).toBe('integer');
46
- expect(schema.properties.actions.items.anyOf[1].properties.input.type).toBe('string');
47
- expect(() => plannerSchema([])).toThrow('at least one action');
48
- expect(anthropicOutputFormat(plannerSchema([...webActions]))?.schema.properties.actions.items.anyOf).toHaveLength(webActions.length);
49
- });
50
- test('unsupported value constraints stay in descriptions and the original validator', () => {
51
- const original = z.object({
52
- size: z.number().int().min(2).max(5),
53
- text: z.string().min(2).max(4).regex(/^A/),
54
- rows: z.array(z.string()).min(3).max(7),
55
- });
56
- const format = anthropicOutputFormat(original);
57
- expect(format.schema.properties.size.minimum).toBeUndefined();
58
- expect(format.schema.properties.size.description).toContain('minimum: 2');
59
- expect(format.schema.properties.text.pattern).toBeUndefined();
60
- expect(format.schema.properties.rows.minItems).toBeUndefined();
61
- expect(format.schema.properties.rows.description).toContain('minItems: 3');
62
- expect(original.safeParse({ size: 1, text: 'bad', rows: [] }).success).toBe(false);
63
- });
64
- test('reused nonrecursive definitions resolve without treating property names as keywords', () => {
65
- const coordinate = z.object({ x: z.number() });
66
- const format = anthropicOutputFormat(z.object({ minimum: coordinate, properties: coordinate, 'a/b~c': coordinate }));
67
- expect(format.schema.properties.minimum).toEqual(format.schema.properties.properties);
68
- expect(format.schema.properties['a/b~c']).toEqual(format.schema.properties.minimum);
69
- });
70
- test('unsupported data shapes retain prompt-only compatibility instead of changing their shape', () => {
71
- const recursive = z.lazy(() => z.object({ next: recursive.optional() }));
72
- for (const schema of [z.record(z.string()), z.object({}).passthrough(), z.any(), recursive, z.tuple([z.string(), z.number()])]) {
73
- expect(anthropicOutputFormat(schema)).toBeUndefined();
74
- }
75
- expect(anthropicOutputFormat(z.object(Object.fromEntries(Array.from({ length: 25 }, (_, i) => [`field${i}`, z.string().optional()]))))).toBeUndefined();
76
- });
77
- test('generated schemas stay stable across varied field names and action vocabularies', () => {
78
- // Synthetic protocol cases, independent of website task content or answers.
79
- let seed = 0x9147;
80
- const next = () => { seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0; return seed.toString(36); };
81
- for (let i = 0; i < 64; i++) {
82
- const name = `op:${next()}`;
83
- const field = `field_${next()}_\"\\é`;
84
- const schema = plannerSchema([createAction({ name, schema: z.object({ [field]: z.string(), enabled: z.boolean().optional() }), resolver: async () => { } })]);
85
- const first = anthropicOutputFormat(schema);
86
- expect(first).toEqual(anthropicOutputFormat(schema));
87
- expect(first.schema.properties.actions.items.properties[field].type).toBe('string');
88
- expect(first.schema.properties.actions.items.properties.variant.const).toBe(name);
89
- expect(first.schema.properties.actions.items.required).not.toContain('enabled');
90
- }
91
- });
@@ -1,119 +0,0 @@
1
- export type BrowserAgentRole = 'act' | 'extract' | 'query';
2
- export declare const allBrowserAgentRoles: BrowserAgentRole[];
3
- export type LLMClient = (AnthropicClient | ClaudeCodeClient | BedrockClient | GoogleAIClient | GoogleVertexClient | OpenAIClient | BasetenClient | OpenAIGenericClient | AzureOpenAIClient) & {
4
- roles?: BrowserAgentRole[];
5
- };
6
- export interface AnthropicClient {
7
- provider: 'anthropic';
8
- options: {
9
- model: string;
10
- apiKey?: string;
11
- temperature?: number;
12
- promptCaching?: boolean;
13
- /** Maximum output tokens, including thinking. Omitted uses the transport default. */
14
- maxTokens?: number;
15
- /** Default: enabled for known supporting models. False retains prompt-only JSON. */
16
- structuredOutputs?: boolean;
17
- };
18
- }
19
- export interface ClaudeCodeClient {
20
- provider: 'claude-code';
21
- options: {
22
- model: string;
23
- temperature?: number;
24
- promptCaching?: boolean;
25
- /** Maximum output tokens, including thinking. Omitted uses the transport default. */
26
- maxTokens?: number;
27
- };
28
- }
29
- export interface BedrockClient {
30
- provider: 'aws-bedrock';
31
- options: {
32
- model: string;
33
- temperature?: number;
34
- };
35
- }
36
- export interface GoogleAIClient {
37
- provider: 'google-ai';
38
- options: {
39
- model: string;
40
- apiKey?: string;
41
- temperature?: number;
42
- baseUrl?: string;
43
- };
44
- }
45
- export interface GoogleVertexClient {
46
- provider: 'vertex-ai';
47
- options: {
48
- model: string;
49
- location?: string;
50
- baseUrl?: string;
51
- projectId?: string;
52
- credentials?: string | object;
53
- anthropicVersion?: string;
54
- temperature?: number;
55
- };
56
- }
57
- export interface OpenAIClient {
58
- provider: 'openai';
59
- options: {
60
- model: string;
61
- apiKey?: string;
62
- baseUrl?: string;
63
- /** Omitted by default: reasoning models may reject sampling parameters. */
64
- temperature?: number;
65
- reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
66
- /** Includes both visible output and reasoning tokens. */
67
- maxCompletionTokens?: number;
68
- };
69
- }
70
- export interface BasetenClient {
71
- provider: 'baseten';
72
- options: {
73
- model: string;
74
- /** Defaults to BASETEN_API_KEY; never falls back to OPENAI_API_KEY. */
75
- apiKey?: string;
76
- /** Defaults to https://inference.baseten.co/v1. */
77
- baseUrl?: string;
78
- /** Omitted by default to preserve model-specific sampling defaults. */
79
- temperature?: number;
80
- /** Model-dependent. DeepSeek V4.1 Flash accepts none, low, high, or max. */
81
- reasoningEffort?: OpenAIClient['options']['reasoningEffort'];
82
- /** Baseten max_tokens: includes both visible output and reasoning tokens. */
83
- maxTokens?: number;
84
- /** Default: enabled on the hosted Model API; custom base URLs require opt-in. */
85
- structuredOutputs?: boolean;
86
- };
87
- }
88
- export interface AzureOpenAIClient {
89
- provider: 'azure-openai';
90
- options: {
91
- resourceName: string;
92
- deploymentId: string;
93
- apiVersion: string;
94
- apiKey: string;
95
- };
96
- }
97
- export interface OpenAIGenericClient {
98
- provider: 'openai-generic';
99
- options: {
100
- model: string;
101
- baseUrl: string;
102
- apiKey?: string;
103
- temperature?: number;
104
- headers?: Record<string, string>;
105
- };
106
- }
107
- export interface LLMClientIdentifier {
108
- provider: string;
109
- model: string;
110
- }
111
- export interface ModelUsage {
112
- llm: LLMClientIdentifier;
113
- inputTokens: number;
114
- outputTokens: number;
115
- cacheWriteInputTokens?: number;
116
- cacheReadInputTokens?: number;
117
- inputCost?: number;
118
- outputCost?: number;
119
- }
package/dist/ai/types.js DELETED
@@ -1,5 +0,0 @@
1
- // export interface CheckResult {
2
- // passed: boolean,
3
- // confidence: number
4
- // }
5
- export const allBrowserAgentRoles = ['act', 'extract', 'query'];