@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.
- package/dist/cli.cjs +2 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.mjs +1 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +2704 -1522
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +188 -50
- package/dist/index.d.ts +1147 -23
- package/dist/index.mjs +2527 -1362
- package/dist/index.mjs.map +1 -0
- package/node_modules/patchright-core/README.md +3 -0
- package/node_modules/patchright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/patchright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/patchright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/patchright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/patchright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/patchright-core/browsers.json +52 -0
- package/node_modules/patchright-core/cli.js +22 -0
- package/node_modules/patchright-core/index.d.ts +17 -0
- package/node_modules/patchright-core/index.js +17 -0
- package/node_modules/patchright-core/index.mjs +28 -0
- package/node_modules/patchright-core/lib/bootstrap.js +149 -0
- package/node_modules/patchright-core/lib/coreBundle.js +80653 -0
- package/node_modules/patchright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/patchright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/patchright-core/lib/entry/mcp.js +10 -0
- package/node_modules/patchright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/patchright-core/lib/package.js +50 -0
- package/node_modules/patchright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/patchright-core/lib/server/electron/loader.js +112 -0
- package/node_modules/patchright-core/lib/serverRegistry.js +1939 -0
- package/node_modules/patchright-core/lib/serverRegistry.js.LICENSE +65 -0
- package/node_modules/patchright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/patchright-core/lib/tools/cli-client/cli.js +7 -0
- package/node_modules/patchright-core/lib/tools/cli-client/help.json +808 -0
- package/node_modules/patchright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/patchright-core/lib/tools/cli-client/output.js +352 -0
- package/node_modules/patchright-core/lib/tools/cli-client/program.js +422 -0
- package/node_modules/patchright-core/lib/tools/cli-client/registry.js +180 -0
- package/node_modules/patchright-core/lib/tools/cli-client/session.js +261 -0
- package/node_modules/patchright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/node_modules/patchright-core/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/node_modules/patchright-core/lib/tools/utils/extension.js +112 -0
- package/node_modules/patchright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/patchright-core/lib/utilsBundle.js +86225 -0
- package/node_modules/patchright-core/lib/utilsBundle.js.LICENSE +1890 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/patchright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/patchright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/patchright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/patchright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/patchright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/patchright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/patchright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/patchright-core/lib/vite/recorder/assets/codeMirrorModule-GBnsXk4c.js +32 -0
- package/node_modules/patchright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/patchright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/patchright-core/lib/vite/recorder/assets/index-CVDOfo-j.js +129 -0
- package/node_modules/patchright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/patchright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/assets/codeMirrorModule-G79327TW.js +32 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/assets/defaultSettingsView-D9EV0iaS.js +184 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/assets/xtermModule-Al_u-Nk5.js +7 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/index.CMB2-c8e.js +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.C3yLoy2G.js +5 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/patchright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/patchright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/patchright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/patchright-core/lib/xdg-open +1267 -0
- package/node_modules/patchright-core/package.json +34 -0
- package/node_modules/patchright-core/types/protocol.d.ts +24776 -0
- package/node_modules/patchright-core/types/structs.d.ts +52 -0
- package/node_modules/patchright-core/types/types.d.ts +27167 -0
- package/node_modules/playwright/.bun-tag-91d746a6045e143f +0 -0
- package/node_modules/playwright/README.md +300 -0
- package/node_modules/playwright/ThirdPartyNotices.txt +14 -0
- package/node_modules/playwright/cli.js +19 -0
- package/node_modules/playwright/index.d.ts +17 -0
- package/node_modules/playwright/index.js +17 -0
- package/node_modules/playwright/index.mjs +18 -0
- package/node_modules/playwright/lib/agents/agentParser.js +89 -0
- package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
- package/node_modules/playwright/lib/agents/generateAgents.js +395 -0
- package/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
- package/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +56 -0
- package/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +74 -0
- package/node_modules/playwright/lib/cli/reportActions.js +78 -0
- package/node_modules/playwright/lib/cli/testActions.js +217 -0
- package/node_modules/playwright/lib/common/index.js +2937 -0
- package/node_modules/playwright/lib/common/index.js.txt +33 -0
- package/node_modules/playwright/lib/errorContext.js +129 -0
- package/node_modules/playwright/lib/globals.js +58 -0
- package/node_modules/playwright/lib/index.js +827 -0
- package/node_modules/playwright/lib/isomorphic.js +260 -0
- package/node_modules/playwright/lib/isomorphic.js.txt +9 -0
- package/node_modules/playwright/lib/loader/loaderProcessEntry.js +34 -0
- package/node_modules/playwright/lib/loader/loaderProcessEntry.js.txt +9 -0
- package/node_modules/playwright/lib/matchers/expect.js +13496 -0
- package/node_modules/playwright/lib/matchers/expect.js.LICENSE +640 -0
- package/node_modules/playwright/lib/matchers/expect.js.txt +67 -0
- package/node_modules/playwright/lib/mcp/test/browserBackend.js +135 -0
- package/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/node_modules/playwright/lib/mcp/test/plannerTools.js +150 -0
- package/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/node_modules/playwright/lib/mcp/test/streams.js +44 -0
- package/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
- package/node_modules/playwright/lib/mcp/test/testContext.js +306 -0
- package/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/node_modules/playwright/lib/mcp/test/testTools.js +98 -0
- package/node_modules/playwright/lib/package.js +47 -0
- package/node_modules/playwright/lib/program.js +242 -0
- package/node_modules/playwright/lib/runner/index.js +8721 -0
- package/node_modules/playwright/lib/runner/index.js.txt +62 -0
- package/node_modules/playwright/lib/transform/babelBundle.js +72490 -0
- package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +2384 -0
- package/node_modules/playwright/lib/transform/babelBundle.js.txt +328 -0
- package/node_modules/playwright/lib/transform/esmLoader.js +8213 -0
- package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +355 -0
- package/node_modules/playwright/lib/transform/esmLoader.js.txt +60 -0
- package/node_modules/playwright/lib/util.js +373 -0
- package/node_modules/playwright/lib/worker/workerProcessEntry.js +1860 -0
- package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +19 -0
- package/node_modules/playwright/package.json +50 -0
- package/node_modules/playwright/test.d.ts +18 -0
- package/node_modules/playwright/test.js +24 -0
- package/node_modules/playwright/test.mjs +35 -0
- package/node_modules/playwright/types/test.d.ts +11191 -0
- package/node_modules/playwright/types/testReporter.d.ts +950 -0
- package/package.json +21 -12
- package/dist/actions/desktopActions.d.ts +0 -58
- package/dist/actions/desktopActions.js +0 -155
- package/dist/actions/index.d.ts +0 -27
- package/dist/actions/index.js +0 -11
- package/dist/actions/memoryActions.d.ts +0 -9
- package/dist/actions/memoryActions.js +0 -34
- package/dist/actions/taskActions.d.ts +0 -8
- package/dist/actions/taskActions.js +0 -27
- package/dist/actions/types.d.ts +0 -35
- package/dist/actions/types.js +0 -5
- package/dist/actions/util.d.ts +0 -21
- package/dist/actions/util.js +0 -280
- package/dist/actions/webActions.d.ts +0 -87
- package/dist/actions/webActions.js +0 -214
- package/dist/actions/webActions.test.d.ts +0 -1
- package/dist/actions/webActions.test.js +0 -43
- package/dist/agent/browserAgent.d.ts +0 -31
- package/dist/agent/browserAgent.js +0 -136
- package/dist/agent/errors.d.ts +0 -22
- package/dist/agent/errors.js +0 -97
- package/dist/agent/index.d.ts +0 -64
- package/dist/agent/index.js +0 -505
- package/dist/agent/narrator.d.ts +0 -4
- package/dist/agent/narrator.js +0 -63
- package/dist/agent/pause.test.d.ts +0 -1
- package/dist/agent/pause.test.js +0 -194
- package/dist/ai/baml_client/async_client.d.ts +0 -64
- package/dist/ai/baml_client/async_client.js +0 -284
- package/dist/ai/baml_client/async_request.d.ts +0 -39
- package/dist/ai/baml_client/async_request.js +0 -134
- package/dist/ai/baml_client/config.d.ts +0 -11
- package/dist/ai/baml_client/config.js +0 -20
- package/dist/ai/baml_client/globals.d.ts +0 -16
- package/dist/ai/baml_client/globals.js +0 -37
- package/dist/ai/baml_client/index.d.ts +0 -17
- package/dist/ai/baml_client/index.js +0 -42
- package/dist/ai/baml_client/inlinedbaml.d.ts +0 -19
- package/dist/ai/baml_client/inlinedbaml.js +0 -31
- package/dist/ai/baml_client/parser.d.ts +0 -53
- package/dist/ai/baml_client/parser.js +0 -86
- package/dist/ai/baml_client/partial_types.d.ts +0 -61
- package/dist/ai/baml_client/partial_types.js +0 -10
- package/dist/ai/baml_client/sync_client.d.ts +0 -57
- package/dist/ai/baml_client/sync_client.js +0 -142
- package/dist/ai/baml_client/sync_request.d.ts +0 -37
- package/dist/ai/baml_client/sync_request.js +0 -134
- package/dist/ai/baml_client/tracing.d.ts +0 -16
- package/dist/ai/baml_client/tracing.js +0 -18
- package/dist/ai/baml_client/type_builder.d.ts +0 -40
- package/dist/ai/baml_client/type_builder.js +0 -120
- package/dist/ai/baml_client/types.d.ts +0 -69
- package/dist/ai/baml_client/types.js +0 -15
- package/dist/ai/baml_client/watchers.d.ts +0 -32
- package/dist/ai/baml_client/watchers.js +0 -50
- package/dist/ai/baseten.d.ts +0 -4
- package/dist/ai/baseten.js +0 -10
- package/dist/ai/claudeCode.d.ts +0 -1
- package/dist/ai/claudeCode.js +0 -186
- package/dist/ai/modelHarness.d.ts +0 -39
- package/dist/ai/modelHarness.js +0 -324
- package/dist/ai/modelResponseError.d.ts +0 -4
- package/dist/ai/modelResponseError.js +0 -8
- package/dist/ai/multiModelHarness.d.ts +0 -24
- package/dist/ai/multiModelHarness.js +0 -52
- package/dist/ai/plannerResponse.d.ts +0 -34
- package/dist/ai/plannerResponse.js +0 -96
- package/dist/ai/plannerResponse.test.d.ts +0 -1
- package/dist/ai/plannerResponse.test.js +0 -112
- package/dist/ai/structuredOutput.d.ts +0 -11
- package/dist/ai/structuredOutput.js +0 -94
- package/dist/ai/structuredOutput.test.d.ts +0 -1
- package/dist/ai/structuredOutput.test.js +0 -91
- package/dist/ai/types.d.ts +0 -119
- package/dist/ai/types.js +0 -5
- package/dist/ai/util.d.ts +0 -13
- package/dist/ai/util.js +0 -200
- package/dist/ai/util.test.d.ts +0 -1
- package/dist/ai/util.test.js +0 -95
- package/dist/cli.js +0 -3
- package/dist/common/actions.js +0 -14
- package/dist/common/events.d.ts +0 -17
- package/dist/common/events.js +0 -3
- package/dist/common/failure.d.ts +0 -68
- package/dist/common/failure.js +0 -1
- package/dist/common/index.d.ts +0 -3
- package/dist/common/index.js +0 -3
- package/dist/common/operation.d.ts +0 -31
- package/dist/common/operation.js +0 -102
- package/dist/common/operation.test.d.ts +0 -1
- package/dist/common/operation.test.js +0 -53
- package/dist/common/retry.d.ts +0 -16
- package/dist/common/retry.js +0 -35
- package/dist/common/util.d.ts +0 -23
- package/dist/common/util.js +0 -139
- package/dist/connectors/browserConnector.d.ts +0 -53
- package/dist/connectors/browserConnector.js +0 -290
- package/dist/connectors/desktopConnector.d.ts +0 -58
- package/dist/connectors/desktopConnector.js +0 -68
- package/dist/connectors/index.d.ts +0 -14
- package/dist/connectors/index.js +0 -2
- package/dist/index.js +0 -28
- package/dist/logger.d.ts +0 -3
- package/dist/logger.js +0 -15
- package/dist/memory/agentMemory.d.ts +0 -47
- package/dist/memory/agentMemory.js +0 -167
- package/dist/memory/agentMemory.test.d.ts +0 -1
- package/dist/memory/agentMemory.test.js +0 -150
- package/dist/memory/image.d.ts +0 -28
- package/dist/memory/image.js +0 -95
- package/dist/memory/image.test.d.ts +0 -1
- package/dist/memory/image.test.js +0 -46
- package/dist/memory/index.d.ts +0 -3
- package/dist/memory/index.js +0 -3
- package/dist/memory/masking.d.ts +0 -7
- package/dist/memory/masking.js +0 -141
- package/dist/memory/masking.test.d.ts +0 -1
- package/dist/memory/masking.test.js +0 -117
- package/dist/memory/notebook.d.ts +0 -58
- package/dist/memory/notebook.js +0 -75
- package/dist/memory/notebook.test.d.ts +0 -1
- package/dist/memory/notebook.test.js +0 -99
- package/dist/memory/observation.d.ts +0 -38
- package/dist/memory/observation.js +0 -79
- package/dist/memory/rendering/index.d.ts +0 -10
- package/dist/memory/rendering/index.js +0 -13
- package/dist/memory/rendering/renderJsonParts.d.ts +0 -3
- package/dist/memory/rendering/renderJsonParts.js +0 -115
- package/dist/memory/rendering/renderJsonParts.test.d.ts +0 -1
- package/dist/memory/rendering/renderJsonParts.test.js +0 -217
- package/dist/memory/rendering/renderXmlParts.d.ts +0 -7
- package/dist/memory/rendering/renderXmlParts.js +0 -127
- package/dist/memory/serde.d.ts +0 -20
- package/dist/memory/serde.js +0 -67
- package/dist/memory/serde.test.d.ts +0 -1
- package/dist/memory/serde.test.js +0 -64
- package/dist/memory/util.d.ts +0 -2
- package/dist/memory/util.js +0 -17
- package/dist/telemetry/events.d.ts +0 -9
- package/dist/telemetry/events.js +0 -80
- package/dist/telemetry/index.d.ts +0 -6
- package/dist/telemetry/index.js +0 -91
- package/dist/types.d.ts +0 -30
- package/dist/types.js +0 -1
- package/dist/util.d.ts +0 -1
- package/dist/util.js +0 -12
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -3
- package/dist/web/browserProvider.d.ts +0 -24
- package/dist/web/browserProvider.js +0 -164
- package/dist/web/browserProvider.test.d.ts +0 -1
- package/dist/web/browserProvider.test.js +0 -44
- package/dist/web/harness.d.ts +0 -109
- package/dist/web/harness.js +0 -401
- package/dist/web/recovery.d.ts +0 -46
- package/dist/web/recovery.js +0 -137
- package/dist/web/recovery.test.d.ts +0 -1
- package/dist/web/recovery.test.js +0 -182
- package/dist/web/stability.d.ts +0 -57
- package/dist/web/stability.js +0 -323
- package/dist/web/tabs.d.ts +0 -58
- package/dist/web/tabs.js +0 -293
- package/dist/web/transformer.d.ts +0 -7
- package/dist/web/transformer.js +0 -41
- package/dist/web/types.d.ts +0 -37
- package/dist/web/types.js +0 -2
- package/dist/web/util.d.ts +0 -3
- package/dist/web/util.js +0 -81
- package/dist/web/visualizer/cursor.d.ts +0 -16
- package/dist/web/visualizer/cursor.js +0 -153
- package/dist/web/visualizer/index.d.ts +0 -22
- package/dist/web/visualizer/index.js +0 -47
- package/dist/web/visualizer/mouseEffects.d.ts +0 -18
- package/dist/web/visualizer/mouseEffects.js +0 -287
- package/dist/web/visualizer/typeEffects.d.ts +0 -10
- package/dist/web/visualizer/typeEffects.js +0 -190
- package/dist/web/zodReexport.test.d.ts +0 -1
- package/dist/web/zodReexport.test.js +0 -14
- /package/{dist/common/actions.d.ts → node_modules/patchright-core/.bun-tag-19f23bd68c84ec1f} +0 -0
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'bun:test';
|
|
2
|
-
import { BrowserBlockedError, BrowserRecovery, detectBlock, diagnosticUrl, retryAt } from './recovery';
|
|
3
|
-
const click = { variant: 'mouse:click', x: 10, y: 10 };
|
|
4
|
-
test('retry headers support seconds and HTTP dates, without persisting query credentials', () => {
|
|
5
|
-
expect(retryAt('30', 1000)).toBe(31_000);
|
|
6
|
-
expect(retryAt('Tue, 15 Sep 2026 00:00:00 GMT', 0)).toBe(Date.parse('2026-09-15T00:00:00Z'));
|
|
7
|
-
expect(retryAt('invalid', 0)).toBeUndefined();
|
|
8
|
-
expect(retryAt('-1', 0)).toBeUndefined();
|
|
9
|
-
expect(diagnosticUrl('https://user:password@example.com/search?q=secret&token=secret#private')).toBe('https://example.com/search');
|
|
10
|
-
});
|
|
11
|
-
test('classifies explicit barriers, not a bare 403 or ordinary Subscribe button', () => {
|
|
12
|
-
expect(detectBlock([], { status: 429, timestamp: 0, url: 'https://example.com', retryAt: 5000 })).toMatchObject({ reason: 'rate_limit', retryAt: 5000 });
|
|
13
|
-
expect(detectBlock(['Too many requests'])).toMatchObject({ reason: 'rate_limit' });
|
|
14
|
-
expect(detectBlock(['Subscribe to BBC to continue'])).toMatchObject({ reason: 'subscription' });
|
|
15
|
-
expect(detectBlock(['Sign in to continue'])).toMatchObject({ reason: 'authentication' });
|
|
16
|
-
expect(detectBlock(['Subscribe'], { status: 403, timestamp: 0, url: 'https://example.com' })).toBeUndefined();
|
|
17
|
-
expect(detectBlock(['Normal page'], { status: 429, timestamp: 0, url: 'https://example.com/analytics', navigation: false })).toBeUndefined();
|
|
18
|
-
});
|
|
19
|
-
test('respects server cooldown, then blocks rather than shortening an unaffordable wait', () => {
|
|
20
|
-
const recovery = new BrowserRecovery({ maxRateLimitWaitMs: 100, noProgress: true });
|
|
21
|
-
recovery.observe('limited', click, { reason: 'rate_limit', evidence: '429', retryAt: 60 }, 0);
|
|
22
|
-
expect(recovery.waitDuration(10, 0)).toBe(60);
|
|
23
|
-
recovery.observe('limited', click, { reason: 'rate_limit', evidence: '429', retryAt: 120 }, 60);
|
|
24
|
-
expect(() => recovery.waitDuration(0, 60)).toThrow(BrowserBlockedError);
|
|
25
|
-
});
|
|
26
|
-
test('unavailable retry headers get one stable cooldown, not a fresh delay on every observation', () => {
|
|
27
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
28
|
-
recovery.observe('limited', undefined, { reason: 'rate_limit', evidence: 'Too many requests' }, 0);
|
|
29
|
-
recovery.observe('limited', { variant: 'wait' }, { reason: 'rate_limit', evidence: 'Too many requests' }, 60_000);
|
|
30
|
-
expect(recovery.block?.retryAt).toBe(60_000);
|
|
31
|
-
expect(recovery.waitDuration(0, 60_000)).toBe(0);
|
|
32
|
-
});
|
|
33
|
-
test('repeated outcomes warn before stopping, even if click coordinates vary', () => {
|
|
34
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
35
|
-
for (let i = 0; i < 3; i++)
|
|
36
|
-
recovery.observe('same-query-and-page', { ...click, x: i }, undefined);
|
|
37
|
-
expect(recovery.warning).toContain('different approach');
|
|
38
|
-
expect(() => recovery.check()).not.toThrow();
|
|
39
|
-
for (let i = 0; i < 3; i++)
|
|
40
|
-
recovery.observe('same-query-and-page', click, undefined);
|
|
41
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
42
|
-
});
|
|
43
|
-
test('no-progress termination is opt-in for library consumers', () => {
|
|
44
|
-
const recovery = new BrowserRecovery();
|
|
45
|
-
for (let i = 0; i < 100; i++)
|
|
46
|
-
recovery.observe('unchanged', click, undefined);
|
|
47
|
-
expect(recovery.warning).toBeUndefined();
|
|
48
|
-
expect(() => recovery.check()).not.toThrow();
|
|
49
|
-
});
|
|
50
|
-
test('new page states and deliberate waits do not count as repeated outcomes', () => {
|
|
51
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
52
|
-
for (let i = 0; i < 20; i++)
|
|
53
|
-
recovery.observe(`page-${i}`, click, undefined);
|
|
54
|
-
for (let i = 0; i < 20; i++)
|
|
55
|
-
recovery.observe('same', { variant: 'wait' }, undefined);
|
|
56
|
-
expect(recovery.warning).toBeUndefined();
|
|
57
|
-
expect(() => recovery.check()).not.toThrow();
|
|
58
|
-
});
|
|
59
|
-
test('subscription barrier allows a few recovery actions, then produces a distinct block', () => {
|
|
60
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
61
|
-
const block = { reason: 'subscription', evidence: 'Subscribe to continue' };
|
|
62
|
-
recovery.observe('paywall', undefined, block);
|
|
63
|
-
for (let i = 0; i < 3; i++) {
|
|
64
|
-
recovery.check();
|
|
65
|
-
recovery.observe('paywall', click, block);
|
|
66
|
-
}
|
|
67
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
68
|
-
recovery.observe('accessible', undefined, undefined);
|
|
69
|
-
expect(() => recovery.check()).not.toThrow();
|
|
70
|
-
});
|
|
71
|
-
test('a new task resets previous repetition and wait budgets', () => {
|
|
72
|
-
const recovery = new BrowserRecovery({ maxRateLimitWaitMs: 100, noProgress: true });
|
|
73
|
-
for (let i = 0; i < 6; i++)
|
|
74
|
-
recovery.observe('same', click, undefined);
|
|
75
|
-
recovery.reset();
|
|
76
|
-
expect(() => recovery.check()).not.toThrow();
|
|
77
|
-
recovery.observe('limited', undefined, { reason: 'rate_limit', evidence: '429', retryAt: 100 }, 0);
|
|
78
|
-
expect(recovery.waitDuration(0, 0)).toBe(100);
|
|
79
|
-
recovery.reset();
|
|
80
|
-
recovery.observe('limited', undefined, { reason: 'rate_limit', evidence: '429', retryAt: 200 }, 100);
|
|
81
|
-
expect(recovery.waitDuration(0, 100)).toBe(100);
|
|
82
|
-
});
|
|
83
|
-
test('new content after a wait clears the old loop warning', () => {
|
|
84
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
85
|
-
for (let i = 0; i < 6; i++)
|
|
86
|
-
recovery.observe('old', click, undefined);
|
|
87
|
-
recovery.observe('newly-loaded-results', { variant: 'wait' }, undefined);
|
|
88
|
-
expect(recovery.warning).toBeUndefined();
|
|
89
|
-
expect(() => recovery.check()).not.toThrow();
|
|
90
|
-
});
|
|
91
|
-
test('changing sign-in steps are not mistaken for an unchanged barrier', () => {
|
|
92
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
93
|
-
for (let i = 0; i < 6; i++) {
|
|
94
|
-
recovery.observe(`step-${i}`, click, { reason: 'authentication', evidence: 'Sign in to continue' });
|
|
95
|
-
expect(() => recovery.check()).not.toThrow();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
test('productive graph walks can revisit hubs and shared return paths without warnings', () => {
|
|
99
|
-
for (const depth of [1, 2, 4])
|
|
100
|
-
for (const breadth of [7, 13, 40]) {
|
|
101
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
102
|
-
recovery.observe('hub', undefined, undefined);
|
|
103
|
-
for (let leaf = 0; leaf < breadth; leaf++) {
|
|
104
|
-
const path = [`record-${leaf}`, ...Array.from({ length: depth }, (_, i) => `return-${i}`), 'hub'];
|
|
105
|
-
for (const state of path) {
|
|
106
|
-
expect(() => recovery.check()).not.toThrow();
|
|
107
|
-
recovery.observe(state, click, undefined);
|
|
108
|
-
expect(recovery.warning).toBeUndefined();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
expect(() => recovery.check()).not.toThrow();
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
test('cycles through known states still warn and stop within the unchanged history window', () => {
|
|
115
|
-
for (const length of [2, 3, 5]) {
|
|
116
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
117
|
-
recovery.observe('state-0', undefined, undefined);
|
|
118
|
-
let warned = false;
|
|
119
|
-
for (let step = 1; step <= length * recovery.repeatedActionLimit; step++) {
|
|
120
|
-
recovery.observe(`state-${step % length}`, { ...click, x: step }, undefined);
|
|
121
|
-
warned ||= Boolean(recovery.warning);
|
|
122
|
-
}
|
|
123
|
-
expect(warned).toBe(true);
|
|
124
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
test('different incoming transitions to a known hub are not one repeated outcome', () => {
|
|
128
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
129
|
-
for (let i = 0; i < 9; i++)
|
|
130
|
-
recovery.observe(`known-${i}`, undefined, undefined);
|
|
131
|
-
recovery.observe('hub', undefined, undefined);
|
|
132
|
-
for (let i = 0; i < 9; i++) {
|
|
133
|
-
recovery.observe(`known-${i}`, click, undefined);
|
|
134
|
-
recovery.observe('hub', click, undefined);
|
|
135
|
-
expect(recovery.warning).toBeUndefined();
|
|
136
|
-
expect(() => recovery.check()).not.toThrow();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
test('new evidence clears old repetition history even when returning to a familiar page', () => {
|
|
140
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
141
|
-
recovery.observe('hub', undefined, undefined);
|
|
142
|
-
for (let i = 0; i < 5; i++)
|
|
143
|
-
recovery.observe('hub', click, undefined);
|
|
144
|
-
recovery.observe('new-evidence', click, undefined);
|
|
145
|
-
recovery.observe('hub', click, undefined);
|
|
146
|
-
expect(recovery.warning).toBeUndefined();
|
|
147
|
-
for (let i = 0; i < 5; i++) {
|
|
148
|
-
expect(() => recovery.check()).not.toThrow();
|
|
149
|
-
recovery.observe('hub', click, undefined);
|
|
150
|
-
}
|
|
151
|
-
expect(() => recovery.check()).not.toThrow();
|
|
152
|
-
recovery.observe('hub', click, undefined);
|
|
153
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
154
|
-
});
|
|
155
|
-
test('passive observations neither add failures nor erase an unchanged-page stop', () => {
|
|
156
|
-
for (const action of [undefined, { variant: 'wait' }, { variant: 'mouse:hover' }]) {
|
|
157
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
158
|
-
for (let i = 0; i < 6; i++)
|
|
159
|
-
recovery.observe('same', click, undefined);
|
|
160
|
-
for (let i = 0; i < 40; i++)
|
|
161
|
-
recovery.observe('same', action, undefined);
|
|
162
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
163
|
-
recovery.observe('fresh-evidence', action, undefined);
|
|
164
|
-
recovery.observe('same', click, undefined);
|
|
165
|
-
expect(recovery.warning).toBeUndefined();
|
|
166
|
-
expect(() => recovery.check()).not.toThrow();
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
test('a task reset clears both known states and transition counts', () => {
|
|
170
|
-
const recovery = new BrowserRecovery({ noProgress: true });
|
|
171
|
-
for (let i = 0; i < 6; i++) {
|
|
172
|
-
recovery.observe('a', click, undefined);
|
|
173
|
-
recovery.observe('b', click, undefined);
|
|
174
|
-
}
|
|
175
|
-
expect(() => recovery.check()).toThrow(BrowserBlockedError);
|
|
176
|
-
recovery.reset();
|
|
177
|
-
recovery.observe('a', undefined, undefined);
|
|
178
|
-
recovery.observe('b', click, undefined);
|
|
179
|
-
recovery.observe('a', click, undefined);
|
|
180
|
-
expect(recovery.warning).toBeUndefined();
|
|
181
|
-
expect(() => recovery.check()).not.toThrow();
|
|
182
|
-
});
|
package/dist/web/stability.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Page } from 'playwright';
|
|
2
|
-
export interface ImageDiff {
|
|
3
|
-
/** Difference score between 0-1, where 0 means identical */
|
|
4
|
-
difference: number;
|
|
5
|
-
/** Optional error message if comparison failed */
|
|
6
|
-
error?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface PageStabilityOptions {
|
|
9
|
-
/** Threshold below which screenshots are considered similar (0-1) */
|
|
10
|
-
differenceThreshold?: number;
|
|
11
|
-
/** Number of consecutive stable checks required to confirm stability */
|
|
12
|
-
requiredStableChecks?: number;
|
|
13
|
-
/** Interval between stability checks in ms */
|
|
14
|
-
checkInterval?: number;
|
|
15
|
-
/** Whether to log detailed stability information */
|
|
16
|
-
/** Minimum time to wait before getting page state */
|
|
17
|
-
minimumWaitPageLoadTime?: number;
|
|
18
|
-
/** Time to wait for network requests to finish before getting page state */
|
|
19
|
-
waitForNetworkIdleTime?: number;
|
|
20
|
-
/** Maximum time to wait for page load before proceeding anyway */
|
|
21
|
-
maximumWaitPageLoadTime?: number;
|
|
22
|
-
/** Whether to disable visual stability checking */
|
|
23
|
-
disableVisualStability?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Utility class to check for visual stability of a page
|
|
27
|
-
*/
|
|
28
|
-
export declare class PageStabilityAnalyzer {
|
|
29
|
-
private page;
|
|
30
|
-
private options;
|
|
31
|
-
private lastStart;
|
|
32
|
-
private logger;
|
|
33
|
-
constructor(options?: PageStabilityOptions);
|
|
34
|
-
setActivePage(page: Page): void;
|
|
35
|
-
private log;
|
|
36
|
-
/**
|
|
37
|
-
* Compare two screenshots and return their difference score
|
|
38
|
-
* @returns Difference as float between 0-1, where 0 means identical
|
|
39
|
-
*/
|
|
40
|
-
private compareScreenshots;
|
|
41
|
-
/**
|
|
42
|
-
* Wait for the network to become stable
|
|
43
|
-
* This monitors network requests and waits until there's a period of inactivity
|
|
44
|
-
* @param timeout Maximum time to wait for network stability
|
|
45
|
-
*/
|
|
46
|
-
waitForNetworkStability(timeout?: number): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Wait for the page to become visually stable
|
|
49
|
-
* @param timeout Maximum time to wait for stability in ms
|
|
50
|
-
*/
|
|
51
|
-
waitForVisualStability(timeout?: number): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Wait for both network and visual stability
|
|
54
|
-
* @param timeout Maximum time to wait for page load
|
|
55
|
-
*/
|
|
56
|
-
waitForStability(timeout?: number): Promise<void>;
|
|
57
|
-
}
|
package/dist/web/stability.js
DELETED
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import sharp from 'sharp';
|
|
2
|
-
import logger from '@/logger';
|
|
3
|
-
import { checkOperation, operationSleep } from '@/common/operation';
|
|
4
|
-
// Maximum wait time for page stability in ms
|
|
5
|
-
const DEFAULT_PAGE_STABILITY_TIMEOUT = 5000;
|
|
6
|
-
// Default minimum wait time for page load
|
|
7
|
-
const DEFAULT_MINIMUM_WAIT_PAGE_LOAD_TIME = 500;
|
|
8
|
-
// Default time to wait for network requests to finish
|
|
9
|
-
const DEFAULT_WAIT_FOR_NETWORK_IDLE_TIME = 500;
|
|
10
|
-
// Default maximum time to wait for page load
|
|
11
|
-
const DEFAULT_MAXIMUM_WAIT_PAGE_LOAD_TIME = 5000;
|
|
12
|
-
/**
|
|
13
|
-
* Utility class to check for visual stability of a page
|
|
14
|
-
*/
|
|
15
|
-
export class PageStabilityAnalyzer {
|
|
16
|
-
page;
|
|
17
|
-
options;
|
|
18
|
-
lastStart;
|
|
19
|
-
logger;
|
|
20
|
-
constructor(options = {}) {
|
|
21
|
-
//this.page = page;
|
|
22
|
-
this.options = {
|
|
23
|
-
differenceThreshold: options.differenceThreshold ?? 0.01,
|
|
24
|
-
requiredStableChecks: options.requiredStableChecks ?? 3,
|
|
25
|
-
checkInterval: options.checkInterval ?? 100, // 200ms
|
|
26
|
-
minimumWaitPageLoadTime: options.minimumWaitPageLoadTime ?? DEFAULT_MINIMUM_WAIT_PAGE_LOAD_TIME,
|
|
27
|
-
waitForNetworkIdleTime: options.waitForNetworkIdleTime ?? DEFAULT_WAIT_FOR_NETWORK_IDLE_TIME,
|
|
28
|
-
maximumWaitPageLoadTime: options.maximumWaitPageLoadTime ?? DEFAULT_MAXIMUM_WAIT_PAGE_LOAD_TIME,
|
|
29
|
-
disableVisualStability: options.disableVisualStability ?? false
|
|
30
|
-
};
|
|
31
|
-
this.lastStart = Date.now();
|
|
32
|
-
this.logger = logger.child({ name: 'magnus.stability' });
|
|
33
|
-
}
|
|
34
|
-
setActivePage(page) {
|
|
35
|
-
this.page = page;
|
|
36
|
-
}
|
|
37
|
-
log(message) {
|
|
38
|
-
this.logger.trace(`[${Date.now() - this.lastStart}ms] ${message}`);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Compare two screenshots and return their difference score
|
|
42
|
-
* @returns Difference as float between 0-1, where 0 means identical
|
|
43
|
-
*/
|
|
44
|
-
async compareScreenshots(screenshot1, screenshot2) {
|
|
45
|
-
try {
|
|
46
|
-
// Convert screenshots to raw pixel data using Sharp
|
|
47
|
-
const img1 = await sharp(screenshot1).raw().toBuffer({ resolveWithObject: true });
|
|
48
|
-
const img2 = await sharp(screenshot2).raw().toBuffer({ resolveWithObject: true });
|
|
49
|
-
// Check for size mismatch
|
|
50
|
-
if (img1.info.width !== img2.info.width || img1.info.height !== img2.info.height) {
|
|
51
|
-
return {
|
|
52
|
-
difference: 1.0,
|
|
53
|
-
error: "Image sizes don't match"
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
// Calculate pixel differences
|
|
57
|
-
let diffSum = 0;
|
|
58
|
-
for (let i = 0; i < img1.data.length; i++) {
|
|
59
|
-
diffSum += Math.abs(img1.data[i] - img2.data[i]);
|
|
60
|
-
}
|
|
61
|
-
// Calculate mean difference and normalize
|
|
62
|
-
const mse = diffSum / img1.data.length;
|
|
63
|
-
// Normalize to 0-1 range (assuming 8-bit color depth)
|
|
64
|
-
const maxDiff = 255.0 * (img1.info.channels || 3); // Multiply by number of channels
|
|
65
|
-
const normalizedDiff = mse / maxDiff;
|
|
66
|
-
return { difference: normalizedDiff };
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
return {
|
|
70
|
-
difference: 1.0,
|
|
71
|
-
error: `Comparison failed: ${e instanceof Error ? e.message : String(e)}`
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Wait for the network to become stable
|
|
77
|
-
* This monitors network requests and waits until there's a period of inactivity
|
|
78
|
-
* @param timeout Maximum time to wait for network stability
|
|
79
|
-
*/
|
|
80
|
-
async waitForNetworkStability(timeout) {
|
|
81
|
-
checkOperation();
|
|
82
|
-
const maxWaitTime = timeout ?? this.options.maximumWaitPageLoadTime;
|
|
83
|
-
const start = Date.now();
|
|
84
|
-
this.log("Checking network stability");
|
|
85
|
-
const pendingRequests = new Set();
|
|
86
|
-
let lastActivity = Date.now();
|
|
87
|
-
// Define relevant resource types and content types
|
|
88
|
-
const RELEVANT_RESOURCE_TYPES = new Set([
|
|
89
|
-
'document',
|
|
90
|
-
'stylesheet',
|
|
91
|
-
'image',
|
|
92
|
-
'font',
|
|
93
|
-
'script',
|
|
94
|
-
'fetch',
|
|
95
|
-
'xhr',
|
|
96
|
-
'iframe'
|
|
97
|
-
]);
|
|
98
|
-
const RELEVANT_CONTENT_TYPES = [
|
|
99
|
-
'text/html',
|
|
100
|
-
'text/css',
|
|
101
|
-
'application/javascript',
|
|
102
|
-
'image/',
|
|
103
|
-
'font/',
|
|
104
|
-
'application/json'
|
|
105
|
-
];
|
|
106
|
-
// Additional patterns to filter out
|
|
107
|
-
const IGNORED_URL_PATTERNS = [
|
|
108
|
-
// Analytics and tracking
|
|
109
|
-
'analytics',
|
|
110
|
-
'tracking',
|
|
111
|
-
'telemetry',
|
|
112
|
-
'beacon',
|
|
113
|
-
'metrics',
|
|
114
|
-
// Ad-related
|
|
115
|
-
'doubleclick',
|
|
116
|
-
'adsystem',
|
|
117
|
-
'adserver',
|
|
118
|
-
'advertising',
|
|
119
|
-
// Social media widgets
|
|
120
|
-
'facebook.com/plugins',
|
|
121
|
-
'platform.twitter',
|
|
122
|
-
'linkedin.com/embed',
|
|
123
|
-
// Live chat and support
|
|
124
|
-
'livechat',
|
|
125
|
-
'zendesk',
|
|
126
|
-
'intercom',
|
|
127
|
-
'crisp.chat',
|
|
128
|
-
'hotjar',
|
|
129
|
-
// Push notifications
|
|
130
|
-
'push-notifications',
|
|
131
|
-
'onesignal',
|
|
132
|
-
'pushwoosh',
|
|
133
|
-
// Background sync/heartbeat
|
|
134
|
-
'heartbeat',
|
|
135
|
-
'ping',
|
|
136
|
-
'alive',
|
|
137
|
-
// WebRTC and streaming
|
|
138
|
-
'webrtc',
|
|
139
|
-
'rtmp://',
|
|
140
|
-
'wss://',
|
|
141
|
-
// Common CDNs for dynamic content
|
|
142
|
-
'cloudfront.net',
|
|
143
|
-
'fastly.net'
|
|
144
|
-
];
|
|
145
|
-
// Setup request handler
|
|
146
|
-
const onRequest = (request) => {
|
|
147
|
-
// Filter by resource type
|
|
148
|
-
if (!RELEVANT_RESOURCE_TYPES.has(request.resourceType())) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
// Filter out streaming, websocket, and other real-time requests
|
|
152
|
-
if (['websocket', 'media', 'eventsource', 'manifest', 'other'].includes(request.resourceType())) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
// Filter out by URL patterns
|
|
156
|
-
const url = request.url().toLowerCase();
|
|
157
|
-
if (IGNORED_URL_PATTERNS.some(pattern => url.includes(pattern))) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
// Filter out data URLs and blob URLs
|
|
161
|
-
if (url.startsWith('data:') || url.startsWith('blob:')) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
pendingRequests.add(request);
|
|
165
|
-
lastActivity = Date.now();
|
|
166
|
-
this.log(`Request started: ${request.url()}`);
|
|
167
|
-
};
|
|
168
|
-
// Setup response handler
|
|
169
|
-
const onResponse = (response) => {
|
|
170
|
-
const request = response.request();
|
|
171
|
-
if (!pendingRequests.has(request)) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
// Filter by content type if available
|
|
175
|
-
const contentType = response.headers()['content-type'] || '';
|
|
176
|
-
// Skip if content type indicates streaming or real-time data
|
|
177
|
-
if (['streaming', 'video', 'audio', 'webm', 'mp4', 'event-stream', 'websocket', 'protobuf']
|
|
178
|
-
.some(t => contentType.includes(t))) {
|
|
179
|
-
pendingRequests.delete(request);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
// Only process relevant content types
|
|
183
|
-
if (!RELEVANT_CONTENT_TYPES.some(ct => contentType.includes(ct))) {
|
|
184
|
-
pendingRequests.delete(request);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
// Skip if response is too large (likely not essential for page load)
|
|
188
|
-
const contentLength = parseInt(response.headers()['content-length'] || '0', 10);
|
|
189
|
-
if (contentLength > 5 * 1024 * 1024) { // 5MB
|
|
190
|
-
pendingRequests.delete(request);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
pendingRequests.delete(request);
|
|
194
|
-
lastActivity = Date.now();
|
|
195
|
-
this.log(`Request resolved: ${request.url()}`);
|
|
196
|
-
};
|
|
197
|
-
// Add event listeners
|
|
198
|
-
this.page.on('request', onRequest);
|
|
199
|
-
this.page.on('response', onResponse);
|
|
200
|
-
try {
|
|
201
|
-
// Wait for idle time
|
|
202
|
-
const startTime = Date.now();
|
|
203
|
-
while (true) {
|
|
204
|
-
await operationSleep(100);
|
|
205
|
-
const now = Date.now();
|
|
206
|
-
if (pendingRequests.size === 0 &&
|
|
207
|
-
(now - lastActivity) >= this.options.waitForNetworkIdleTime) {
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
if (now - startTime > maxWaitTime) {
|
|
211
|
-
this.log(`Network timeout after ${maxWaitTime}ms with ${pendingRequests.size} pending requests`);
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
finally {
|
|
217
|
-
// Clean up event listeners
|
|
218
|
-
this.page.removeListener('request', onRequest);
|
|
219
|
-
this.page.removeListener('response', onResponse);
|
|
220
|
-
}
|
|
221
|
-
const totalTime = (Date.now() - start) / 1000;
|
|
222
|
-
this.log(`Network stabilized in ${totalTime.toFixed(2)}s`);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Wait for the page to become visually stable
|
|
226
|
-
* @param timeout Maximum time to wait for stability in ms
|
|
227
|
-
*/
|
|
228
|
-
async waitForVisualStability(timeout = DEFAULT_PAGE_STABILITY_TIMEOUT) {
|
|
229
|
-
checkOperation();
|
|
230
|
-
const start = Date.now();
|
|
231
|
-
this.log("Checking visual stability");
|
|
232
|
-
try {
|
|
233
|
-
let lastScreenshot = await this.page.screenshot();
|
|
234
|
-
let stabilityCount = 0;
|
|
235
|
-
const deadline = start + timeout;
|
|
236
|
-
while (Date.now() < deadline) {
|
|
237
|
-
this.log(`Waiting for ${this.options.checkInterval}`);
|
|
238
|
-
await operationSleep(this.options.checkInterval);
|
|
239
|
-
this.log(`Done waiting`);
|
|
240
|
-
try {
|
|
241
|
-
this.log("Taking screenshot...");
|
|
242
|
-
const currentScreenshot = await this.page.screenshot();
|
|
243
|
-
this.log("Comparing screenshots...");
|
|
244
|
-
const diffResult = await this.compareScreenshots(lastScreenshot, currentScreenshot);
|
|
245
|
-
if (diffResult.error) {
|
|
246
|
-
this.log(`Comparison error: ${diffResult.error}`);
|
|
247
|
-
stabilityCount = 0;
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
this.log(`Screenshot difference: ${diffResult.difference.toFixed(4)}`);
|
|
251
|
-
if (diffResult.difference < this.options.differenceThreshold) {
|
|
252
|
-
stabilityCount++;
|
|
253
|
-
if (stabilityCount >= this.options.requiredStableChecks) {
|
|
254
|
-
this.log(`Visual stability achieved (difference: ${diffResult.difference.toFixed(4)})`);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
stabilityCount = 0;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
lastScreenshot = currentScreenshot;
|
|
263
|
-
}
|
|
264
|
-
catch (e) {
|
|
265
|
-
checkOperation();
|
|
266
|
-
this.log(`Screenshot/comparison error: ${e instanceof Error ? e.message : String(e)}`);
|
|
267
|
-
stabilityCount = 0;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// If we exit the loop without returning, we timed out
|
|
271
|
-
this.log("Visual stability check timed out");
|
|
272
|
-
}
|
|
273
|
-
catch (e) {
|
|
274
|
-
checkOperation();
|
|
275
|
-
this.log(`Visual stability check error: ${e instanceof Error ? e.message : String(e)}`);
|
|
276
|
-
}
|
|
277
|
-
finally {
|
|
278
|
-
const totalTime = (Date.now() - start) / 1000;
|
|
279
|
-
this.log(`Visual stability check took ${totalTime.toFixed(2)}s`);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Wait for both network and visual stability
|
|
284
|
-
* @param timeout Maximum time to wait for page load
|
|
285
|
-
*/
|
|
286
|
-
async waitForStability(timeout) {
|
|
287
|
-
checkOperation();
|
|
288
|
-
const maxWaitTime = timeout ?? this.options.maximumWaitPageLoadTime;
|
|
289
|
-
const startTime = Date.now();
|
|
290
|
-
this.lastStart = startTime;
|
|
291
|
-
// Track our deadlines
|
|
292
|
-
const minWaitDeadline = startTime + this.options.minimumWaitPageLoadTime;
|
|
293
|
-
const maxWaitDeadline = startTime + maxWaitTime;
|
|
294
|
-
this.log(`Starting stability wait (min: ${this.options.minimumWaitPageLoadTime}ms, max: ${maxWaitTime}ms)`);
|
|
295
|
-
try {
|
|
296
|
-
// Wait for network stability, but don't exceed max wait time
|
|
297
|
-
const remainingForNetwork = Math.max(0, maxWaitDeadline - Date.now());
|
|
298
|
-
if (remainingForNetwork > 0) {
|
|
299
|
-
await this.waitForNetworkStability(remainingForNetwork);
|
|
300
|
-
}
|
|
301
|
-
// Wait for visual stability with whatever time remains, but don't exceed max wait time
|
|
302
|
-
if (!this.options.disableVisualStability) {
|
|
303
|
-
const remainingForVisual = Math.max(0, maxWaitDeadline - Date.now());
|
|
304
|
-
if (remainingForVisual > 0) {
|
|
305
|
-
await this.waitForVisualStability(remainingForVisual);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
// Ensure we've waited at least the minimum time
|
|
309
|
-
const now = Date.now();
|
|
310
|
-
if (now < minWaitDeadline) {
|
|
311
|
-
const remainingMinWait = minWaitDeadline - now;
|
|
312
|
-
this.log(`Waiting additional ${remainingMinWait}ms to meet minimum wait time`);
|
|
313
|
-
await operationSleep(remainingMinWait);
|
|
314
|
-
}
|
|
315
|
-
const totalTime = Date.now() - startTime;
|
|
316
|
-
this.log(`Page stability wait completed in ${totalTime}ms`);
|
|
317
|
-
}
|
|
318
|
-
catch (e) {
|
|
319
|
-
checkOperation();
|
|
320
|
-
this.log(`Error during stability wait: ${e instanceof Error ? e.message : String(e)}`);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
package/dist/web/tabs.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "eventemitter3";
|
|
2
|
-
import { BrowserContext, Page } from "playwright";
|
|
3
|
-
export interface TabEvents {
|
|
4
|
-
'tabChanged': (page: Page) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface TabState {
|
|
7
|
-
activeTab: number;
|
|
8
|
-
tabs: {
|
|
9
|
-
title: string;
|
|
10
|
-
url: string;
|
|
11
|
-
}[];
|
|
12
|
-
}
|
|
13
|
-
export interface TabManagerOptions {
|
|
14
|
-
switchOnActivity?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare class TabManager {
|
|
17
|
-
private context;
|
|
18
|
-
private activePage;
|
|
19
|
-
private options;
|
|
20
|
-
private pollInterval?;
|
|
21
|
-
readonly events: EventEmitter<TabEvents>;
|
|
22
|
-
constructor(context: BrowserContext, options?: TabManagerOptions);
|
|
23
|
-
initialize(): Promise<void>;
|
|
24
|
-
private initializeExistingPages;
|
|
25
|
-
private onPageCreated;
|
|
26
|
-
private setupPageTracking;
|
|
27
|
-
private startActivityPolling;
|
|
28
|
-
setActivePage(page: Page): void;
|
|
29
|
-
switchTab(index: number): Promise<void>;
|
|
30
|
-
getActivePage(): Page;
|
|
31
|
-
getPages(): Page[];
|
|
32
|
-
retrieveState(): Promise<TabState>;
|
|
33
|
-
debugVisibilityStates(): Promise<({
|
|
34
|
-
hasFocus: boolean;
|
|
35
|
-
hidden: boolean;
|
|
36
|
-
visibilityState: DocumentVisibilityState;
|
|
37
|
-
index: number;
|
|
38
|
-
url: string;
|
|
39
|
-
error?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
index: number;
|
|
42
|
-
url: string;
|
|
43
|
-
error: boolean;
|
|
44
|
-
})[]>;
|
|
45
|
-
debugFocusStates(): Promise<({
|
|
46
|
-
hasFocus: boolean;
|
|
47
|
-
isVisible: boolean;
|
|
48
|
-
isHidden: boolean;
|
|
49
|
-
url: string;
|
|
50
|
-
index: number;
|
|
51
|
-
error?: undefined;
|
|
52
|
-
} | {
|
|
53
|
-
index: number;
|
|
54
|
-
url: string;
|
|
55
|
-
error: boolean;
|
|
56
|
-
})[]>;
|
|
57
|
-
destroy(): void;
|
|
58
|
-
}
|