@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
package/dist/web/tabs.js DELETED
@@ -1,293 +0,0 @@
1
- // Keeps track of current tab, enables describing open tabs, and switching between open tabs
2
- import logger from "@/logger";
3
- import EventEmitter from "eventemitter3";
4
- import { retryOnErrorIsSuccess } from "@/common";
5
- export class TabManager {
6
- context;
7
- activePage;
8
- options;
9
- pollInterval;
10
- events;
11
- constructor(context, options = {}) {
12
- this.context = context;
13
- this.options = {
14
- switchOnActivity: true,
15
- ...options
16
- };
17
- this.events = new EventEmitter();
18
- // Track new pages
19
- this.context.on('page', this.onPageCreated.bind(this));
20
- }
21
- async initialize() {
22
- // Initialize existing pages and tracking
23
- await this.initializeExistingPages();
24
- }
25
- async initializeExistingPages() {
26
- const pages = this.context.pages();
27
- logger.debug(`initializeExistingPages: found ${pages.length} existing pages`);
28
- // Set up existing pages
29
- for (const page of pages) {
30
- logger.debug(`Setting up page: ${page.url()}`);
31
- await this.onPageCreated(page);
32
- }
33
- // Start polling for activity if enabled
34
- if (this.options.switchOnActivity) {
35
- logger.debug('Starting activity polling');
36
- this.startActivityPolling();
37
- }
38
- }
39
- async onPageCreated(page) {
40
- logger.debug(`onPageCreated called for: ${page.url()}`);
41
- // If this is the only page or no active page set, make it active
42
- if (!this.activePage || this.context.pages().length === 1) {
43
- this.setActivePage(page);
44
- }
45
- // Only set up tracking if switchOnActivity is enabled
46
- if (this.options.switchOnActivity) {
47
- // Set up activity tracking immediately
48
- await this.setupPageTracking(page);
49
- // Re-inject tracking after navigation
50
- page.on('load', async () => {
51
- await this.setupPageTracking(page);
52
- // If this is the active page and it navigated from about:blank, re-emit tabChanged
53
- if (this.activePage === page && page.url() !== 'about:blank') {
54
- logger.debug(`Re-emitting tabChanged after navigation to: ${page.url()}`);
55
- this.events.emit('tabChanged', page);
56
- }
57
- });
58
- // Also inject on DOMContentLoaded for faster setup
59
- page.on('domcontentloaded', async () => {
60
- await this.setupPageTracking(page);
61
- });
62
- }
63
- // Don't automatically switch to new tabs - let the user decide
64
- // This prevents unwanted switches when links open in new tabs
65
- // Clean up when page closes
66
- page.on('close', () => {
67
- if (this.activePage === page) {
68
- const pages = this.context.pages();
69
- if (pages.length > 0) {
70
- this.setActivePage(pages[0]);
71
- }
72
- }
73
- });
74
- // Start polling if this is the first page and switchOnActivity is enabled
75
- if (this.context.pages().length === 1 && this.options.switchOnActivity && !this.pollInterval) {
76
- logger.debug('Starting activity polling from onPageCreated (first page)');
77
- this.startActivityPolling();
78
- }
79
- }
80
- async setupPageTracking(page) {
81
- // Inject the tracking script with retries
82
- await retryOnErrorIsSuccess(async () => {
83
- const currentUrl = page.url();
84
- logger.debug(`Setting up tracking for: ${currentUrl}`);
85
- // Inject activity tracking
86
- await page.evaluate(() => {
87
- // Initialize activity tracking storage
88
- if (!window.__tabActivityTime) {
89
- window.__tabActivityTime = 0;
90
- }
91
- // Set initial activity time to NOW since we're setting up tracking
92
- // This ensures the initial page is considered active
93
- window.__tabActivityTime = Date.now();
94
- // Track any user interaction
95
- const recordActivity = () => {
96
- window.__tabActivityTime = Date.now();
97
- };
98
- // Remove any existing listeners to avoid duplicates
99
- const listeners = window.__tabListeners;
100
- if (listeners) {
101
- listeners.forEach((l) => {
102
- document.removeEventListener(l.event, l.handler, true);
103
- window.removeEventListener(l.event, l.handler, true);
104
- });
105
- }
106
- // Store references to our listeners
107
- const newListeners = [];
108
- // Helper to add tracked event listener
109
- const addTrackedListener = (target, event, handler) => {
110
- target.addEventListener(event, handler, true);
111
- newListeners.push({ event, handler });
112
- };
113
- // Throttled mouse move handler
114
- let lastMouseMoveTime = 0;
115
- const throttledMouseMove = () => {
116
- const now = Date.now();
117
- if (now - lastMouseMoveTime > 500) {
118
- lastMouseMoveTime = now;
119
- recordActivity();
120
- }
121
- };
122
- // Mouse events
123
- addTrackedListener(document, 'mousedown', recordActivity);
124
- addTrackedListener(document, 'click', recordActivity);
125
- addTrackedListener(document, 'mousemove', throttledMouseMove);
126
- addTrackedListener(document, 'mouseenter', recordActivity);
127
- // Keyboard events
128
- addTrackedListener(document, 'keydown', recordActivity);
129
- // Focus events
130
- addTrackedListener(window, 'focus', recordActivity);
131
- // Scroll events
132
- let lastScrollTime = 0;
133
- const throttledScroll = () => {
134
- const now = Date.now();
135
- if (now - lastScrollTime > 500) {
136
- lastScrollTime = now;
137
- recordActivity();
138
- }
139
- };
140
- addTrackedListener(document, 'scroll', throttledScroll);
141
- // Visibility change
142
- addTrackedListener(document, 'visibilitychange', () => {
143
- if (!document.hidden) {
144
- recordActivity();
145
- }
146
- });
147
- // Store listeners for cleanup
148
- window.__tabListeners = newListeners;
149
- });
150
- }, { mode: 'retry_all', delayMs: 200, retryLimit: 5 });
151
- }
152
- startActivityPolling() {
153
- // Poll for activity every 200ms
154
- this.pollInterval = setInterval(async () => {
155
- const pages = this.context.pages();
156
- let mostRecentPage = null;
157
- let mostRecentTime = 0;
158
- // Find the page with the most recent activity
159
- for (const page of pages) {
160
- if (page.isClosed())
161
- continue;
162
- try {
163
- const lastActivity = await page.evaluate(() => {
164
- // Initialize if it doesn't exist (defensive programming)
165
- if (typeof window.__tabActivityTime === 'undefined') {
166
- window.__tabActivityTime = 0;
167
- // If tracking wasn't set up, return -1 as a signal
168
- if (!window.__tabListeners) {
169
- return -1;
170
- }
171
- }
172
- return window.__tabActivityTime;
173
- });
174
- // If tracking isn't set up (-1), inject it now
175
- if (lastActivity === -1) {
176
- logger.debug(`Tracking not set up for ${page.url()}, injecting now...`);
177
- await this.setupPageTracking(page);
178
- continue; // Skip this page for this polling cycle
179
- }
180
- if (lastActivity > mostRecentTime) {
181
- mostRecentTime = lastActivity;
182
- mostRecentPage = page;
183
- }
184
- }
185
- catch (e) {
186
- // Page might be navigating
187
- }
188
- }
189
- // Switch to the most recently active page if it's different and activity is recent
190
- if (mostRecentPage &&
191
- mostRecentPage !== this.activePage &&
192
- mostRecentTime > Date.now() - 1000) { // Activity within last second
193
- logger.trace(`Activity detected on ${mostRecentPage.url()}, switching...`);
194
- this.setActivePage(mostRecentPage);
195
- }
196
- }, 200);
197
- }
198
- setActivePage(page) {
199
- const isInitialPage = !this.activePage;
200
- if (this.activePage === page && !isInitialPage) {
201
- return;
202
- }
203
- logger.debug(`Active tab changed to: ${page.url()}`);
204
- this.activePage = page;
205
- this.events.emit('tabChanged', page);
206
- page.removeAllListeners('framenavigated');
207
- page.on('framenavigated', async (frame) => {
208
- if (frame === page.mainFrame()) {
209
- // const url = frame.url();
210
- // await logNavigation(url);
211
- }
212
- });
213
- }
214
- async switchTab(index) {
215
- const pages = this.context.pages();
216
- if (index < 0 || index >= pages.length) {
217
- throw new Error(`Invalid tab index: ${index}`);
218
- }
219
- const page = pages[index];
220
- logger.debug(`Switching to tab ${index} (${page.url()})`);
221
- await page.bringToFront();
222
- this.setActivePage(page);
223
- }
224
- getActivePage() {
225
- return this.activePage;
226
- }
227
- getPages() {
228
- return this.context.pages();
229
- }
230
- async retrieveState() {
231
- let activeIndex = -1;
232
- let tabs = [];
233
- for (const [i, page] of this.context.pages().entries()) {
234
- if (page === this.activePage) {
235
- activeIndex = i;
236
- }
237
- let title;
238
- try {
239
- title = await page.title();
240
- }
241
- catch {
242
- logger.warn('Could not load page title while retrieving tab state');
243
- title = '(could not load title)';
244
- }
245
- const url = page.url();
246
- tabs.push({ title, url });
247
- }
248
- return {
249
- activeTab: activeIndex,
250
- tabs: tabs
251
- };
252
- }
253
- async debugVisibilityStates() {
254
- const states = await Promise.all(this.context.pages().map(async (page, i) => {
255
- try {
256
- const hasFocus = await page.evaluate(() => ({
257
- hasFocus: document.hasFocus(),
258
- hidden: document.hidden,
259
- visibilityState: document.visibilityState
260
- }));
261
- return { index: i, url: page.url(), ...hasFocus };
262
- }
263
- catch {
264
- return { index: i, url: page.url(), error: true };
265
- }
266
- }));
267
- return states;
268
- }
269
- async debugFocusStates() {
270
- const states = await Promise.all(this.context.pages().map(async (page, i) => {
271
- try {
272
- const state = await page.evaluate(() => ({
273
- hasFocus: document.hasFocus(),
274
- isVisible: document.visibilityState === 'visible',
275
- isHidden: document.hidden,
276
- url: window.location.href
277
- }));
278
- return { index: i, ...state };
279
- }
280
- catch {
281
- return { index: i, url: page.url(), error: true };
282
- }
283
- }));
284
- console.log('Focus states:', states);
285
- return states;
286
- }
287
- // Clean up
288
- destroy() {
289
- if (this.pollInterval) {
290
- clearInterval(this.pollInterval);
291
- }
292
- }
293
- }
@@ -1,7 +0,0 @@
1
- import type { Page } from 'playwright';
2
- export declare class DOMTransformer {
3
- private initializedPages;
4
- constructor();
5
- setActivePage(newPage: Page): void;
6
- setupScriptForPage(targetPage: Page): Promise<void>;
7
- }
@@ -1,41 +0,0 @@
1
- import getShadowDOMInputAdapterScript from './scripts/shadowDOMInputAdapter';
2
- import logger from '@/logger';
3
- export class DOMTransformer {
4
- initializedPages = new WeakSet(); // Track pages for which 'load' listener is set
5
- constructor() { }
6
- setActivePage(newPage) {
7
- // Only add the 'load' listener if we haven't done so for this specific Page object instance.
8
- if (!this.initializedPages.has(newPage)) {
9
- newPage.on('load', async () => {
10
- // Pass 'newPage' (the page that triggered the 'load' event) to setupScriptForPage.
11
- await this.setupScriptForPage(newPage);
12
- });
13
- this.initializedPages.add(newPage); // Mark this Page object as having its 'load' listener set up.
14
- }
15
- }
16
- async setupScriptForPage(targetPage) {
17
- try {
18
- // Check if a marker for the script already exists on the page for this load cycle.
19
- const scriptAlreadyInjected = await targetPage.evaluate(() => {
20
- return window.__magnitudeShadowDOMAdapterInjected === true;
21
- }).catch(() => false); // If evaluate fails (e.g., page closed), assume not injected.
22
- if (scriptAlreadyInjected) {
23
- logger.trace('Select manager script already present on this page load.');
24
- return;
25
- }
26
- // Get the script as a string from the separate file
27
- const scriptFnString = getShadowDOMInputAdapterScript();
28
- // Evaluate the script function in the browser and set the marker.
29
- // We need to wrap it in a self-executing function
30
- await targetPage.evaluate(`
31
- (${scriptFnString})();
32
- window.__magnitudeShadowDOMAdapterInjected = true;
33
- `);
34
- logger.trace(`Script injected into page: ${targetPage.url()}`);
35
- }
36
- catch (error) {
37
- const url = targetPage.isClosed() ? '[closed page]' : targetPage.url();
38
- logger.warn(`Error injecting script into ${url}: ${error.message}`);
39
- }
40
- }
41
- }
@@ -1,37 +0,0 @@
1
- export type Base64Image = `data:image/${'jpeg' | 'png' | 'gif'};base64,${string}`;
2
- export type WebAction = NavigateWebAction | ClickWebAction | HoverWebAction | TypeWebAction | ScrollWebAction | SwitchTabWebAction;
3
- export interface NavigateWebAction {
4
- variant: 'load';
5
- url: string;
6
- }
7
- export interface ClickWebAction {
8
- variant: 'click';
9
- x: number;
10
- y: number;
11
- }
12
- export interface HoverWebAction {
13
- variant: 'hover';
14
- x: number;
15
- y: number;
16
- }
17
- export interface TypeWebAction {
18
- variant: 'type';
19
- x: number;
20
- y: number;
21
- content: string;
22
- }
23
- export interface ScrollWebAction {
24
- variant: 'scroll';
25
- x: number;
26
- y: number;
27
- deltaX: number;
28
- deltaY: number;
29
- }
30
- export type SwitchTabWebAction = {
31
- variant: 'tab';
32
- index: number;
33
- };
34
- export interface PixelCoordinate {
35
- x: number;
36
- y: number;
37
- }
package/dist/web/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- // for back-compat, not all implemented yet
@@ -1,3 +0,0 @@
1
- export type KeypressIndicator = '<enter>' | '<tab>';
2
- export declare function parseTypeContent(content: string): (string | KeypressIndicator)[];
3
- export declare function renderMinimalAccessibilityTree(node: any): string;
package/dist/web/util.js DELETED
@@ -1,81 +0,0 @@
1
- export function parseTypeContent(content) {
2
- // Parse content sequence potentially with special indicators <enter> or <tab> into components
3
- const regex = /<enter>|<tab>/g;
4
- const result = [];
5
- let lastIndex = 0;
6
- content.replace(regex, (match, offset) => {
7
- // Grab the text before the match and trim surrounding whitespace
8
- const text = content.slice(lastIndex, offset).trim();
9
- if (text)
10
- result.push(text);
11
- // Add the matched special indicator
12
- result.push(match);
13
- lastIndex = offset + match.length;
14
- return match;
15
- });
16
- // Add any remaining text after the last match
17
- const remaining = content.slice(lastIndex).trim();
18
- if (remaining)
19
- result.push(remaining);
20
- return result;
21
- }
22
- export function renderMinimalAccessibilityTree(node) {
23
- // Escapes newlines for safe inline printing, and trims whitespace.
24
- const sanitize = (text) => {
25
- return String(text).trim().replace(/\n/g, '\\n');
26
- };
27
- // Inner recursive function to handle state like indentation
28
- function recursiveFlatten(node, indent) {
29
- const isTextLike = (n) => n && (n.role === 'StaticText' || n.role === 'text') && n.name && n.name.trim();
30
- let childrenOutput = '';
31
- if (node.children) {
32
- const newChildren = [];
33
- let currentTextBuffer = [];
34
- for (const child of node.children) {
35
- if (isTextLike(child)) {
36
- currentTextBuffer.push(sanitize(child.name));
37
- }
38
- else {
39
- if (currentTextBuffer.length > 0) {
40
- newChildren.push({ role: 'coalesced-text', name: currentTextBuffer.join(' ') });
41
- currentTextBuffer = [];
42
- }
43
- newChildren.push(child);
44
- }
45
- }
46
- if (currentTextBuffer.length > 0) {
47
- newChildren.push({ role: 'coalesced-text', name: currentTextBuffer.join(' ') });
48
- }
49
- for (const child of newChildren) {
50
- if (child.role === 'coalesced-text') {
51
- childrenOutput += `${indent} ${child.name}\n`;
52
- }
53
- else {
54
- childrenOutput += recursiveFlatten(child, indent + ' ');
55
- }
56
- }
57
- }
58
- const isBoringContainer = (node.role === 'generic' || node.role === 'div') && !node.name;
59
- if (isBoringContainer) {
60
- return childrenOutput;
61
- }
62
- let line = '';
63
- if (node.role && !['StaticText', 'text', 'RootWebArea'].includes(node.role)) {
64
- line = `${indent}[${node.role}]`;
65
- if (node.name && sanitize(node.name)) {
66
- line += ` ${sanitize(node.name)}`;
67
- }
68
- if (node.value !== undefined && sanitize(node.value)) {
69
- line += ` (value: ${sanitize(node.value)})`;
70
- }
71
- if (node.checked !== undefined)
72
- line += ` (checked: ${node.checked})`;
73
- if (node.disabled)
74
- line += ` (disabled)`;
75
- line += '\n';
76
- }
77
- return line + childrenOutput;
78
- }
79
- const rawFlattened = recursiveFlatten(node, '');
80
- return rawFlattened.split('\n').filter(line => line.trim() !== '').join('\n');
81
- }
@@ -1,16 +0,0 @@
1
- import { Page } from "playwright";
2
- export declare class CursorVisual {
3
- /**
4
- * Manages the visual indicator for actions on a page
5
- */
6
- private page;
7
- private visualElementId;
8
- private lastPosition;
9
- constructor();
10
- setActivePage(page: Page): Promise<void>;
11
- move(x: number, y: number): Promise<void>;
12
- setupOnPage(): Promise<void>;
13
- private _drawVisual;
14
- hide(): Promise<void>;
15
- show(): Promise<void>;
16
- }
@@ -1,153 +0,0 @@
1
- import { retryOnErrorIsSuccess } from "@/common";
2
- import logger from "@/logger";
3
- import { operationSleep } from '@/common/operation';
4
- export class CursorVisual {
5
- /**
6
- * Manages the visual indicator for actions on a page
7
- */
8
- page;
9
- visualElementId = 'action-visual-indicator';
10
- lastPosition = null;
11
- constructor() {
12
- //this.page = page;
13
- }
14
- async setActivePage(page) {
15
- this.page = page;
16
- page.on('load', async () => {
17
- await retryOnErrorIsSuccess(this.setupOnPage.bind(this), { mode: 'retry_all', delayMs: 200, retryLimit: 10 });
18
- });
19
- await retryOnErrorIsSuccess(this.setupOnPage.bind(this), { mode: 'retry_all', delayMs: 200, retryLimit: 5 });
20
- }
21
- async move(x, y) {
22
- // Store the position
23
- this.lastPosition = { x, y };
24
- // Create or update the mouse pointer visual, showing the click effect
25
- await this._drawVisual(x, y, false);
26
- // The pointer visual takes 0.3s on the transition, but awaiting script evaluation does not wait for this to complete.
27
- // So we wait 300ms manually.
28
- await operationSleep(300);
29
- }
30
- async setupOnPage() {
31
- if (this.lastPosition) {
32
- // Redraw the visual without the click effect
33
- await this._drawVisual(this.lastPosition.x, this.lastPosition.y, false);
34
- }
35
- }
36
- // Internal method to handle the actual drawing logic
37
- async _drawVisual(x, y, showClickEffect) {
38
- try {
39
- await this.page.evaluate(({ x, y, id, showClickEffect }) => {
40
- // Use viewport coordinates directly (no scroll adjustment for fixed positioning)
41
- const viewportX = x;
42
- const viewportY = y;
43
- // Document coordinates for the click effect circle (which uses absolute positioning)
44
- const docX = x + window.scrollX;
45
- const docY = y + window.scrollY;
46
- // --- Create Expanding/Fading Circle (Optional) ---
47
- if (showClickEffect) {
48
- const circle = document.createElement('div');
49
- circle.style.position = 'absolute';
50
- circle.style.left = `${docX}px`;
51
- circle.style.top = `${docY}px`;
52
- circle.style.borderRadius = '50%';
53
- circle.style.backgroundColor = '#026aa1'; // Blue color
54
- circle.style.width = '0px';
55
- circle.style.height = '0px';
56
- circle.style.transform = 'translate(-50%, -50%)'; // Center on (x, y)
57
- circle.style.pointerEvents = 'none';
58
- circle.style.zIndex = '9998'; // Below the pointer
59
- circle.style.opacity = '0.7'; // Initial opacity
60
- document.body.appendChild(circle);
61
- // Animate the circle
62
- const animation = circle.animate([
63
- { width: '0px', height: '0px', opacity: 0.7 }, // Start state
64
- { width: '50px', height: '50px', opacity: 0 } // End state
65
- ], {
66
- duration: 500, // 500ms duration
67
- easing: 'ease-out'
68
- });
69
- // Remove circle after animation
70
- animation.onfinish = () => {
71
- circle.remove();
72
- };
73
- }
74
- // --- Pointer Logic (Always runs) ---
75
- // Check if the visual indicator already exists
76
- let pointerElement = document.getElementById(id);
77
- // If it doesn't exist, create it with all necessary styling
78
- if (!pointerElement) {
79
- pointerElement = document.createElement('div');
80
- pointerElement.id = id;
81
- pointerElement.style.position = 'fixed'; // Use fixed positioning for viewport-relative
82
- pointerElement.style.width = '32px';
83
- pointerElement.style.height = '32px';
84
- pointerElement.style.zIndex = '2147483647'; // Max z-index
85
- pointerElement.style.pointerEvents = 'none'; // Don't interfere with actual clicks
86
- // Notice that transition is 300ms
87
- pointerElement.style.transition = 'left 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), top 0.3s cubic-bezier(0.25, 0.1, 0.25, 1)';
88
- // Create SVG using DOM methods to avoid Trusted Types issues
89
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
90
- svg.setAttribute('width', '32');
91
- svg.setAttribute('height', '32');
92
- svg.setAttribute('viewBox', '0 0 113.50408 99.837555');
93
- const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
94
- g.setAttribute('transform', 'translate(-413.10686,-501.19661)');
95
- const path1 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
96
- path1.setAttribute('style', 'fill:#026aa1;fill-opacity:1;stroke:#000000;stroke-width:0');
97
- path1.setAttribute('d', 'm 416.1069,504.1966 52.47697,93.83813 8.33253,-57.61019 z');
98
- const path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
99
- path2.setAttribute('style', 'fill:#0384c7;fill-opacity:1;stroke:#000000;stroke-width:0');
100
- path2.setAttribute('d', 'm 416.1069,504.1966 60.8095,36.22794 46.69517,-34.75524 z');
101
- const path3 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
102
- path3.setAttribute('style', 'fill:#0384c7;fill-opacity:0;stroke:#000000;stroke-width:6;stroke-linecap:round;stroke-linejoin:round');
103
- path3.setAttribute('d', 'm 416.1069,504.19658 52.47698,93.83813 8.33252,-57.61019 46.69517,-34.75521 -107.50467,-1.47273');
104
- g.appendChild(path1);
105
- g.appendChild(path2);
106
- g.appendChild(path3);
107
- svg.appendChild(g);
108
- pointerElement.appendChild(svg);
109
- document.body.appendChild(pointerElement);
110
- }
111
- //pointerElement.style.display = 'none';
112
- // Update position - use viewport coordinates for fixed positioning
113
- // Set the top-left corner to (viewportX, viewportY) and then translate by (-1px, -3px)
114
- // to align the pointer tip (approx. at 1.27, 4.17 within the SVG) with the click point.
115
- pointerElement.style.left = `${viewportX}px`;
116
- pointerElement.style.top = `${viewportY}px`;
117
- pointerElement.style.transform = 'translate(-1px, -3px)';
118
- }, { x, y, id: this.visualElementId, showClickEffect });
119
- }
120
- catch (error) {
121
- // For example when:
122
- // TypeError: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment.
123
- logger.trace(`Failed to draw visual: ${error.message}`);
124
- }
125
- }
126
- async hide() {
127
- try {
128
- await this.page.evaluate((id) => {
129
- const element = document.getElementById(id);
130
- if (element) {
131
- element.style.display = 'none';
132
- }
133
- }, this.visualElementId);
134
- }
135
- catch {
136
- logger.trace(`Failed to hide pointer`);
137
- }
138
- }
139
- async show() {
140
- try {
141
- await this.page.evaluate((id) => {
142
- const element = document.getElementById(id);
143
- if (element) {
144
- // Revert to the default display value (usually 'block' for a div)
145
- element.style.display = '';
146
- }
147
- }, this.visualElementId);
148
- }
149
- catch {
150
- logger.trace(`Failed to show pointer`);
151
- }
152
- }
153
- }
@@ -1,22 +0,0 @@
1
- import { BrowserContext, Page } from "playwright";
2
- export interface ActionVisualizerOptions {
3
- showCursor?: boolean;
4
- showHoverCircle?: boolean;
5
- showClickRipple?: boolean;
6
- showDragLine?: boolean;
7
- showTypeEffects?: boolean;
8
- }
9
- export declare class ActionVisualizer {
10
- private options;
11
- private context;
12
- private page;
13
- private cursor;
14
- private mouseEffects;
15
- private typeEffects;
16
- constructor(context: BrowserContext, options: ActionVisualizerOptions);
17
- setup(): Promise<void>;
18
- setActivePage(page: Page): Promise<void>;
19
- moveVirtualCursor(x: number, y: number): Promise<void>;
20
- hideAll(): Promise<void>;
21
- showAll(): Promise<void>;
22
- }