@speedkit/cli 4.51.1 → 4.52.0
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/CHANGELOG.md +7 -0
- package/README.md +1426 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/browser-fetch/device-emulation.d.ts +11 -0
- package/dist/services/browser-fetch/device-emulation.js +14 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +43 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +68 -13
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +6 -1
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +14 -0
- package/dist/services/onboarding/browser/resume-restarted-workers.js +26 -0
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +547 -0
- package/dist/services/onboarding/control/browser-session.js +1337 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1430 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +40 -7
- package/dist/services/onboarding/onboarding-model.js +20 -9
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +139 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +45 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +753 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +67 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +328 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3493 -372
- package/package.json +20 -2
|
@@ -4,6 +4,8 @@ import { INTEGRATION_FILES } from "../../models/files.js";
|
|
|
4
4
|
import { AthenaServiceBuildContext, AthenaServiceFactory, } from "../athena/index.js";
|
|
5
5
|
import { BundleServiceFactory } from "../bundler/index.js";
|
|
6
6
|
import { createDiffEngine, PageSource } from "../diff/index.js";
|
|
7
|
+
import { BrowserSession, ControlServer } from "./control/index.js";
|
|
8
|
+
import { validateLoadedConfig } from "./control/config-validation.js";
|
|
7
9
|
import { DocumentHandlerRuntimeServiceBuildContext } from "../document-handler-runtime/document-handler-runtime-service-build-context.js";
|
|
8
10
|
import DocumentHandlerRuntimeServiceFactory from "../document-handler-runtime/factory/document-handler-runtime-service-factory.js";
|
|
9
11
|
import { documentHandlerRuntimeFiles } from "../document-handler-runtime/runtime-files.js";
|
|
@@ -42,12 +44,16 @@ import { DevtoolsExtensionApi } from "./browser/extension/devtools-extension-api
|
|
|
42
44
|
import { ExtensionBridge } from "./browser/extension/extension-bridge.js";
|
|
43
45
|
import { TodoCollector } from "./todo-collector.js";
|
|
44
46
|
import { installBrowserOriginFetch } from "../browser-fetch/index.js";
|
|
45
|
-
import { OriginFetcher, RuntimeConfigSource } from "../origin-request/index.js";
|
|
47
|
+
import { NO_RUNTIME_CONFIG_WARNING, OriginFetcher, RuntimeConfigSource, } from "../origin-request/index.js";
|
|
46
48
|
import { VirtualOrestesApp } from "./virtual-orestes-app/index.js";
|
|
47
49
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
48
50
|
import * as fs from "node:fs";
|
|
49
51
|
import * as path from "node:path";
|
|
52
|
+
import { join } from "node:path";
|
|
53
|
+
import { mkdtempSync } from "node:fs";
|
|
54
|
+
import { tmpdir } from "node:os";
|
|
50
55
|
import { StaticRecipe } from "../integration-api/virtual/static-recipe.js";
|
|
56
|
+
import FileList from "../integration-api/file-list.js";
|
|
51
57
|
import { DiffAgainstCurrentPage } from "./dashboard/diff-against-current-page.js";
|
|
52
58
|
import { ExtensionDownloader } from "./browser/extension/extension-downloader.js";
|
|
53
59
|
import { ExecutableValidator } from "./browser/executable/executable-validator.js";
|
|
@@ -57,8 +63,19 @@ import { ParameterQueryServiceBuildContext } from "../query-builder/query-builde
|
|
|
57
63
|
import { formatChromeFeatureFinding, formatChromeFlagDuplicate, } from "../../helpers/chrome-flags.js";
|
|
58
64
|
export class OnboardingServiceFactory {
|
|
59
65
|
context;
|
|
60
|
-
|
|
66
|
+
run;
|
|
67
|
+
requestLog;
|
|
68
|
+
constructor(context,
|
|
69
|
+
/** Recorded by the command; filled in here once the config is known. */
|
|
70
|
+
run,
|
|
71
|
+
/**
|
|
72
|
+
* Where intercepted requests go. Owned by the command, because it is the
|
|
73
|
+
* one place that decides whether this run writes anything to disk.
|
|
74
|
+
*/
|
|
75
|
+
requestLog) {
|
|
61
76
|
this.context = context;
|
|
77
|
+
this.run = run;
|
|
78
|
+
this.requestLog = requestLog;
|
|
62
79
|
}
|
|
63
80
|
/**
|
|
64
81
|
* The service `sk onboarding` runs: the browse service under `--browse`, the inject service under
|
|
@@ -98,7 +115,13 @@ export class OnboardingServiceFactory {
|
|
|
98
115
|
];
|
|
99
116
|
return new InjectService({
|
|
100
117
|
browserContext,
|
|
101
|
-
fetchEventHandler: new FetchEventHandler(
|
|
118
|
+
fetchEventHandler: new FetchEventHandler({
|
|
119
|
+
browserFetchEvents: handlers,
|
|
120
|
+
customerConfig,
|
|
121
|
+
cli,
|
|
122
|
+
client: this.getConfigApi(customerConfig.app),
|
|
123
|
+
requestLog: this.requestLog,
|
|
124
|
+
}),
|
|
102
125
|
installation,
|
|
103
126
|
scope: customerConfig.scope,
|
|
104
127
|
cli,
|
|
@@ -113,7 +136,18 @@ export class OnboardingServiceFactory {
|
|
|
113
136
|
applyOriginProxy(customerConfig?.chromeFlags, cli);
|
|
114
137
|
const url = resolveBrowseUrl(this.context.domain, customerConfig);
|
|
115
138
|
const { browserContext } = await this.prepareBrowser(url, customerConfig?.chromeFlags);
|
|
116
|
-
|
|
139
|
+
// Browse mode has no cache and no files; the ops that read them answer empty.
|
|
140
|
+
const session = new BrowserSession();
|
|
141
|
+
const controlServer = this.run
|
|
142
|
+
? new ControlServer(this.run.dir, this.run.id, {
|
|
143
|
+
cache: new Cache(cli, join(this.run.dir, "dh-cache")),
|
|
144
|
+
cli,
|
|
145
|
+
files: new FileList(),
|
|
146
|
+
session,
|
|
147
|
+
origin: browserContext.domain,
|
|
148
|
+
})
|
|
149
|
+
: undefined;
|
|
150
|
+
return new BrowseService(browserContext, cli, controlServer, session);
|
|
117
151
|
}
|
|
118
152
|
/**
|
|
119
153
|
* What inject mode injects, and where. The app and the domain come from the flags, else from a
|
|
@@ -195,11 +229,21 @@ export class OnboardingServiceFactory {
|
|
|
195
229
|
for (const finding of browserContext.findFeatureFindings()) {
|
|
196
230
|
cli.writeWarning(formatChromeFeatureFinding(finding));
|
|
197
231
|
}
|
|
198
|
-
if (this.context.debuggingPort
|
|
199
|
-
cli.writeWarning(`Chrome remote debugging enabled on port ${this.context.debugPort}
|
|
232
|
+
if (this.context.debuggingPort) {
|
|
233
|
+
cli.writeWarning(`Chrome remote debugging enabled on port ${this.context.debugPort}.`, false,
|
|
234
|
+
// Yellow on the terminal because it changes how Chrome behaves, but it
|
|
235
|
+
// is not a problem — and `--summary` lists every warning as one.
|
|
236
|
+
{
|
|
237
|
+
scope: "browser",
|
|
238
|
+
level: "info",
|
|
239
|
+
data: { debugPort: this.context.debugPort },
|
|
240
|
+
});
|
|
200
241
|
}
|
|
201
242
|
if (this.context.headless) {
|
|
202
|
-
cli.writeWarning("Running in headless mode."
|
|
243
|
+
cli.writeWarning("Running in headless mode.", false, {
|
|
244
|
+
scope: "browser",
|
|
245
|
+
data: { headless: true },
|
|
246
|
+
});
|
|
203
247
|
}
|
|
204
248
|
if (browserContext.emulation) {
|
|
205
249
|
const { device, userAgent, viewport } = browserContext.emulation;
|
|
@@ -215,6 +259,7 @@ export class OnboardingServiceFactory {
|
|
|
215
259
|
const cli = this.context.environment.cli;
|
|
216
260
|
const files = await this.getIntegrationFiles(cli);
|
|
217
261
|
const customerConfig = files.getCustomerConfig().config;
|
|
262
|
+
this.run?.update({ app: customerConfig.app });
|
|
218
263
|
// Before any origin request, so Chrome and the CLI agree on the route out.
|
|
219
264
|
applyOriginProxy(customerConfig.chromeFlags, cli);
|
|
220
265
|
// Also before any origin request: an origin behind bot protection refuses the CLI outright,
|
|
@@ -228,7 +273,19 @@ export class OnboardingServiceFactory {
|
|
|
228
273
|
cli.writeWarning("Fetching every origin document through a second headless Chrome.");
|
|
229
274
|
}
|
|
230
275
|
const domainToStart = await this.getUrlForTest(customerConfig, cli);
|
|
231
|
-
|
|
276
|
+
// Recorded, not derived: a customer with several origins and no `domain`
|
|
277
|
+
// has nothing in its config that says which site this run is on, and
|
|
278
|
+
// `origins[0]` is a guess that is wrong for anyone started with `-d` or who
|
|
279
|
+
// picked the second entry at the prompt. `sk origin-request` reads it back to
|
|
280
|
+
// resolve a relative url the way the control socket already does for a live
|
|
281
|
+
// run — and from here it survives the run, so a post-mortem resolves too.
|
|
282
|
+
this.run?.update({ domain: domainToStart });
|
|
283
|
+
// Inside the run directory, so the run's own retention prunes the bodies
|
|
284
|
+
// and a finished run's cache is still readable. Without a run — a test
|
|
285
|
+
// harness — a temp directory keeps it to one code path.
|
|
286
|
+
const cache = new Cache(cli, this.run
|
|
287
|
+
? join(this.run.dir, "dh-cache")
|
|
288
|
+
: mkdtempSync(join(tmpdir(), "sk-dh-cache-")));
|
|
232
289
|
const documentHandler = await new DocumentHandlerRuntimeServiceFactory(new DocumentHandlerRuntimeServiceBuildContext({
|
|
233
290
|
environment: this.context.environment,
|
|
234
291
|
configName: this.context.configName,
|
|
@@ -242,7 +299,11 @@ export class OnboardingServiceFactory {
|
|
|
242
299
|
const { browserContext, browserExtensions } = await this.prepareBrowser(domainToStart, customerConfig.chromeFlags);
|
|
243
300
|
const fileWatcher = new FileWatcher(cli, customerConfig, files, documentHandler, browserContext, cache);
|
|
244
301
|
const athenaClient = (await this.getAthenaClient(customerConfig.app)) || null;
|
|
245
|
-
|
|
302
|
+
// One collector, read by both consumers: the devtools panel gets it as a
|
|
303
|
+
// message, `sk onboarding todo` reads it over the control socket. Two instances would
|
|
304
|
+
// drift the moment either started caching.
|
|
305
|
+
const todos = new TodoCollector(files.getInstallResources());
|
|
306
|
+
const messageHandler = await this.prepareMessagehandler(athenaClient, files, customerConfig, todos);
|
|
246
307
|
const speedKitServiceWorkerJs = new SpeedKitServiceWorkerJs(customerConfig, files.getByName(INTEGRATION_FILES.CUSTOM.SW), embedsConfigInServiceWorker(customerConfig)
|
|
247
308
|
? (serviceWorker) => bundler.packjockel.bundleServiceWorker({
|
|
248
309
|
serviceWorker,
|
|
@@ -254,11 +315,62 @@ export class OnboardingServiceFactory {
|
|
|
254
315
|
versions: customerConfig,
|
|
255
316
|
})
|
|
256
317
|
: undefined);
|
|
257
|
-
const fetchHandler = await this.getFetchEventHandler(files, customerConfig, documentHandler, cache, cli, browserContext, athenaClient, messageHandler, fileWatcher, speedKitServiceWorkerJs);
|
|
318
|
+
const { fetchHandler, orestesApp, rumPi, runtimeConfig } = await this.getFetchEventHandler(files, customerConfig, documentHandler, cache, cli, browserContext, athenaClient, messageHandler, fileWatcher, speedKitServiceWorkerJs);
|
|
258
319
|
const extensionBridge = new ExtensionBridge(cli, browserExtensions.hasDevtoolsExtension);
|
|
259
|
-
|
|
320
|
+
// Constructed here so it holds the same Cache the run does, not a second
|
|
321
|
+
// one. Its lifetime is the run's: OnboardingService starts it against the
|
|
322
|
+
// shutdown signal.
|
|
323
|
+
// The run fills this in once it has a page; until then every op that needs
|
|
324
|
+
// one answers NO_PAGE rather than hanging on something that is not there.
|
|
325
|
+
const browserSession = new BrowserSession();
|
|
326
|
+
const controlServer = this.run
|
|
327
|
+
? new ControlServer(this.run.dir, this.run.id, {
|
|
328
|
+
cache,
|
|
329
|
+
cli,
|
|
330
|
+
files,
|
|
331
|
+
session: browserSession,
|
|
332
|
+
todos,
|
|
333
|
+
// `browserContext.domain`, not `customerConfig.domain`: the latter is
|
|
334
|
+
// a bare host in every config_customer, and `new URL(input, base)`
|
|
335
|
+
// parses the base first and throws when it has no scheme — even for
|
|
336
|
+
// an absolute input. That made every `sk onboarding response` call fail with
|
|
337
|
+
// BAD_URL blaming the url the caller passed. This one is
|
|
338
|
+
// `ensureHttps`-ed and honours `-d` and the multi-origin prompt, so
|
|
339
|
+
// it is also the origin the run is actually driving — `origins[0]`
|
|
340
|
+
// would resolve a relative url against the wrong site for a customer
|
|
341
|
+
// started on their second origin.
|
|
342
|
+
origin: browserContext.domain,
|
|
343
|
+
// Undefined without `--local`, and the op says so rather than
|
|
344
|
+
// failing obscurely: there is no local documentHandler to build with.
|
|
345
|
+
prewarm: orestesApp
|
|
346
|
+
? (url, variation) => orestesApp.prewarm(url, variation)
|
|
347
|
+
: undefined,
|
|
348
|
+
variations: orestesApp
|
|
349
|
+
? () => orestesApp.namedVariations()
|
|
350
|
+
: undefined,
|
|
351
|
+
rumBeacons: rumPi ? () => rumPi.beacons() : undefined,
|
|
352
|
+
cacheErrors: orestesApp
|
|
353
|
+
? () => orestesApp.getLocalCacheErrors()
|
|
354
|
+
: undefined,
|
|
355
|
+
// The watcher's own rebuild groups, so an on-demand rebuild has the
|
|
356
|
+
// same blast radius as the file change that would have triggered it.
|
|
357
|
+
// It answers NO_REBUILD until the run has wired its watchers, which
|
|
358
|
+
// is after the page is ready.
|
|
359
|
+
rebuild: (target) => fileWatcher.rebuild(target),
|
|
360
|
+
validate: () => validateLoadedConfig(customerConfig, files),
|
|
361
|
+
// `sk diff` follows the run with the config it loaded, and refuses without one.
|
|
362
|
+
runtimeConfig: () => runtimeConfig,
|
|
363
|
+
// Evaluated per call, not captured: the config is the thing being
|
|
364
|
+
// edited, and explaining a url against the version loaded at startup
|
|
365
|
+
// would answer about a file the user has since changed.
|
|
366
|
+
speedKitConfig: () => files
|
|
367
|
+
.getSpeedKitConfig()
|
|
368
|
+
.evaluate(customerConfig, customerConfig.origins[0]),
|
|
369
|
+
})
|
|
370
|
+
: undefined;
|
|
371
|
+
return new OnboardingService(browserContext, customerConfig, fetchHandler, fileWatcher, cli, messageHandler, extensionBridge, speedKitServiceWorkerJs, browserFetch, controlServer, browserSession, this.run);
|
|
260
372
|
}
|
|
261
|
-
async prepareMessagehandler(athenaClient, files, customerConfig) {
|
|
373
|
+
async prepareMessagehandler(athenaClient, files, customerConfig, todos) {
|
|
262
374
|
const messageHandler = new DevtoolsExtensionApi();
|
|
263
375
|
messageHandler.addMessage({
|
|
264
376
|
id: "skCli",
|
|
@@ -271,10 +383,9 @@ export class OnboardingServiceFactory {
|
|
|
271
383
|
id: "athena",
|
|
272
384
|
data: { client: !!athenaClient },
|
|
273
385
|
});
|
|
274
|
-
const fileTodoCollector = new TodoCollector(files.getInstallResources());
|
|
275
386
|
messageHandler.addMessage({
|
|
276
387
|
id: "todo",
|
|
277
|
-
data: [...
|
|
388
|
+
data: [...todos.getOpenTasks()],
|
|
278
389
|
});
|
|
279
390
|
const appToken = await this.getAppToken(customerConfig.app);
|
|
280
391
|
if (appToken) {
|
|
@@ -298,15 +409,21 @@ export class OnboardingServiceFactory {
|
|
|
298
409
|
return result.data.token ?? null;
|
|
299
410
|
}
|
|
300
411
|
async buildInstallResource(speedKitInstallContext, files, cli) {
|
|
301
|
-
cli.startAction("ONBOARDING:BUILD:INSTALL_RESOURCE", "build file install_resource");
|
|
412
|
+
cli.startAction("ONBOARDING:BUILD:INSTALL_RESOURCE", "build file install_resource", { scope: "config" });
|
|
302
413
|
const installResourceFile = new VirtualFile(INTEGRATION_FILES.BUILD.INSTALL, new InstallFileRecipe(speedKitInstallContext));
|
|
303
414
|
const result = await safe(installResourceFile.buildContent());
|
|
304
415
|
if (result.success === true) {
|
|
305
416
|
files.addFile(installResourceFile);
|
|
306
|
-
cli.successAction("ONBOARDING:BUILD:INSTALL_RESOURCE"
|
|
417
|
+
cli.successAction("ONBOARDING:BUILD:INSTALL_RESOURCE", undefined, {
|
|
418
|
+
scope: "config",
|
|
419
|
+
data: { file: INTEGRATION_FILES.BUILD.INSTALL },
|
|
420
|
+
});
|
|
307
421
|
return;
|
|
308
422
|
}
|
|
309
|
-
cli.failAction("ONBOARDING:BUILD:INSTALL_RESOURCE", result.error
|
|
423
|
+
cli.failAction("ONBOARDING:BUILD:INSTALL_RESOURCE", result.error, {
|
|
424
|
+
scope: "config",
|
|
425
|
+
data: { file: INTEGRATION_FILES.BUILD.INSTALL, error: result.error },
|
|
426
|
+
});
|
|
310
427
|
}
|
|
311
428
|
async getAthenaClient(app) {
|
|
312
429
|
// no promptForLogin: onboarding shows the Athena data when a login is
|
|
@@ -331,9 +448,7 @@ export class OnboardingServiceFactory {
|
|
|
331
448
|
configApi,
|
|
332
449
|
}).load();
|
|
333
450
|
if (!runtimeConfig) {
|
|
334
|
-
|
|
335
|
-
// override of a device variation. Those still resolve, from their built-in defaults only.
|
|
336
|
-
cli.writeWarning("without the runtime config, origin fetches carry no basic auth, no custom variation and no configured override of default, mobile or tablet — those fall back to the built-in defaults.");
|
|
451
|
+
cli.writeWarning(NO_RUNTIME_CONFIG_WARNING);
|
|
337
452
|
}
|
|
338
453
|
const originFetcher = new OriginFetcher({ cli, config: runtimeConfig });
|
|
339
454
|
const parameterQueryBuilder = await new QueryBuilderFactory(new ParameterQueryServiceBuildContext({
|
|
@@ -360,8 +475,20 @@ export class OnboardingServiceFactory {
|
|
|
360
475
|
const orestesApp = new VirtualOrestesApp(customerConfig, originFetcher, documentHandler, cache, cli, messageHandler, this.context.ignoreContentSecurityPolicy);
|
|
361
476
|
// let config-file changes re-warm the dh-cache in the background
|
|
362
477
|
fileWatcher.setCacheRefresher(orestesApp);
|
|
363
|
-
|
|
364
|
-
|
|
478
|
+
const rumPi = new SpeedKitRumPiRequest(customerConfig, orestesApp);
|
|
479
|
+
handlers.push(new SpeedKitAssetRequest(customerConfig, orestesApp), rumPi);
|
|
480
|
+
return {
|
|
481
|
+
rumPi,
|
|
482
|
+
fetchHandler: new FetchEventHandler({
|
|
483
|
+
browserFetchEvents: handlers,
|
|
484
|
+
customerConfig,
|
|
485
|
+
cli,
|
|
486
|
+
client: configApi,
|
|
487
|
+
requestLog: this.requestLog,
|
|
488
|
+
}),
|
|
489
|
+
orestesApp,
|
|
490
|
+
runtimeConfig,
|
|
491
|
+
};
|
|
365
492
|
}
|
|
366
493
|
async getIntegrationFiles(cli) {
|
|
367
494
|
const projectRoot = path.resolve(this.context.customerPath, "../..");
|
|
@@ -386,7 +513,7 @@ export class OnboardingServiceFactory {
|
|
|
386
513
|
];
|
|
387
514
|
// if speed-kit is npm-linked, use linked local files else fetch latest released sw and df
|
|
388
515
|
if (isSpeedKitLinked) {
|
|
389
|
-
cli.writeWarning(`Linked Speed-Kit found in node_modules. Using built sw, df and loader
|
|
516
|
+
cli.writeWarning(`Linked Speed-Kit found in node_modules. Using built sw, df and loader.`, false, { scope: "config", data: { speedKitLinked: true } });
|
|
390
517
|
integrationApiArray.push({
|
|
391
518
|
name: INTEGRATION_FILES.CUSTOM.SW,
|
|
392
519
|
recipe: new StaticRecipe(fs.readFileSync(swPath, "utf-8")),
|
|
@@ -7,6 +7,8 @@ import { CliServiceInterface } from "../cli/index.js";
|
|
|
7
7
|
import { DevtoolsExtensionApi } from "./browser/extension/devtools-extension-api.js";
|
|
8
8
|
import { ExtensionBridge } from "./browser/extension/extension-bridge.js";
|
|
9
9
|
import { BrowserOriginFetchHandle } from "../browser-fetch/index.js";
|
|
10
|
+
import { BrowserSession, ControlServer } from "./control/index.js";
|
|
11
|
+
import { RunHandle } from "../run-registry/index.js";
|
|
10
12
|
/**
|
|
11
13
|
* Represents the OnboardingService which is responsible for setting up the browser to test a config using Puppeteer.
|
|
12
14
|
*/
|
|
@@ -20,10 +22,22 @@ export declare class OnboardingService {
|
|
|
20
22
|
private extensionBridge;
|
|
21
23
|
private speedKitServiceWorkerJs;
|
|
22
24
|
private browserFetch?;
|
|
25
|
+
/** Absent when the run was not recorded, e.g. in a test harness. */
|
|
26
|
+
private controlServer?;
|
|
27
|
+
/** Filled in once the page is ready, so control ops can reach it. */
|
|
28
|
+
private browserSession?;
|
|
29
|
+
/** So the run can be stamped where the reason for ending is known. */
|
|
30
|
+
private runHandle?;
|
|
23
31
|
private reinstallOnNextNavigate;
|
|
24
32
|
private lastForeignSwReinstall;
|
|
25
33
|
private readonly activatedSwVersions;
|
|
26
|
-
constructor(browserContext: BrowserContext, customerConfig: CustomerConfig, fetchEventHandler: FetchEventHandler, fileWatcher: FileWatcher, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, extensionBridge: ExtensionBridge, speedKitServiceWorkerJs: SpeedKitServiceWorkerJs, browserFetch?: BrowserOriginFetchHandle
|
|
34
|
+
constructor(browserContext: BrowserContext, customerConfig: CustomerConfig, fetchEventHandler: FetchEventHandler, fileWatcher: FileWatcher, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, extensionBridge: ExtensionBridge, speedKitServiceWorkerJs: SpeedKitServiceWorkerJs, browserFetch?: BrowserOriginFetchHandle,
|
|
35
|
+
/** Absent when the run was not recorded, e.g. in a test harness. */
|
|
36
|
+
controlServer?: ControlServer,
|
|
37
|
+
/** Filled in once the page is ready, so control ops can reach it. */
|
|
38
|
+
browserSession?: BrowserSession,
|
|
39
|
+
/** So the run can be stamped where the reason for ending is known. */
|
|
40
|
+
runHandle?: RunHandle);
|
|
27
41
|
/**
|
|
28
42
|
* Prepare the puppeteer browser, wire event listeners, navigate to the
|
|
29
43
|
* install page, then block until either the caller aborts the signal
|
|
@@ -31,6 +45,13 @@ export declare class OnboardingService {
|
|
|
31
45
|
* any still-open resources. File watchers close themselves via `signal`.
|
|
32
46
|
*/
|
|
33
47
|
run(externalSignal: AbortSignal): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Open the control socket, if this run has a directory to put it in.
|
|
50
|
+
*
|
|
51
|
+
* Non-fatal: a run that cannot be controlled from outside is still a run, and
|
|
52
|
+
* failing the developer's session over it would be the wrong trade.
|
|
53
|
+
*/
|
|
54
|
+
private startControlServer;
|
|
34
55
|
private prepareBrowser;
|
|
35
56
|
private preparePage;
|
|
36
57
|
/**
|
|
@@ -41,6 +62,19 @@ export declare class OnboardingService {
|
|
|
41
62
|
* sk-cli. Without a loaded devtools extension there is nothing to attach
|
|
42
63
|
* to — ExtensionValidator already reported why — so it is skipped.
|
|
43
64
|
*/
|
|
65
|
+
/**
|
|
66
|
+
* Say what an agent is doing, for the devtools extension to show.
|
|
67
|
+
*
|
|
68
|
+
* Reported, not drawn. The tab strip is browser UI with no CDP surface at
|
|
69
|
+
* all, so only an extension can colour it — and the one already loaded into
|
|
70
|
+
* the run owns that, keyed off this message. See `lib/agent-tab-state.ts` in
|
|
71
|
+
* team-pi/devtools.
|
|
72
|
+
*
|
|
73
|
+
* Upserted rather than appended: this is current state, not an event log, and
|
|
74
|
+
* a panel that had to dedupe a history to find the live value would be doing
|
|
75
|
+
* work this side can simply not create.
|
|
76
|
+
*/
|
|
77
|
+
private reportAgentActivity;
|
|
44
78
|
/**
|
|
45
79
|
* Open the run's DevTools on the Speed Kit panel rather than on Elements.
|
|
46
80
|
*
|
|
@@ -51,6 +85,11 @@ export declare class OnboardingService {
|
|
|
51
85
|
private showDevtoolsPanelOnStart;
|
|
52
86
|
private attachExtensionBridge;
|
|
53
87
|
private findPage;
|
|
88
|
+
/**
|
|
89
|
+
* What service workers this run has seen. Nothing else records it — CDP only
|
|
90
|
+
* streams the events, so a reader arriving later has missed them.
|
|
91
|
+
*/
|
|
92
|
+
private readonly serviceWorkers;
|
|
54
93
|
private prepareCleanState;
|
|
55
94
|
/**
|
|
56
95
|
* Detects when the DEPLOYED service worker takes over the local session and
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BROWSER_EVENTS, CDP_SESSION, } from "./onboarding-model.js";
|
|
2
|
-
import { PanelNotFoundError, showDevtoolsPanel, } from "./browser/extension/devtools-panel.js";
|
|
3
2
|
import { safe } from "../../helpers/safe.js";
|
|
4
3
|
import { isEmptyServiceWorkerUrl } from "./empty-service-worker.js";
|
|
5
4
|
import { launchBrowser, resetBrowserState } from "./browser/launch-browser.js";
|
|
5
|
+
import { recordConsole } from "./browser/console-log.js";
|
|
6
|
+
import { ServiceWorkerTracker, } from "./control/index.js";
|
|
6
7
|
// A SW version activating later than this after the last locally served sw.js
|
|
7
8
|
// cannot originate from our interception — it is a deployed-build takeover.
|
|
8
9
|
const LOCAL_SW_SERVE_GRACE_MS = 10_000;
|
|
@@ -21,10 +22,19 @@ export class OnboardingService {
|
|
|
21
22
|
extensionBridge;
|
|
22
23
|
speedKitServiceWorkerJs;
|
|
23
24
|
browserFetch;
|
|
25
|
+
controlServer;
|
|
26
|
+
browserSession;
|
|
27
|
+
runHandle;
|
|
24
28
|
reinstallOnNextNavigate = false;
|
|
25
29
|
lastForeignSwReinstall = 0;
|
|
26
30
|
activatedSwVersions = new Set();
|
|
27
|
-
constructor(browserContext, customerConfig, fetchEventHandler, fileWatcher, cli, developmentToolsMessages, extensionBridge, speedKitServiceWorkerJs, browserFetch
|
|
31
|
+
constructor(browserContext, customerConfig, fetchEventHandler, fileWatcher, cli, developmentToolsMessages, extensionBridge, speedKitServiceWorkerJs, browserFetch,
|
|
32
|
+
/** Absent when the run was not recorded, e.g. in a test harness. */
|
|
33
|
+
controlServer,
|
|
34
|
+
/** Filled in once the page is ready, so control ops can reach it. */
|
|
35
|
+
browserSession,
|
|
36
|
+
/** So the run can be stamped where the reason for ending is known. */
|
|
37
|
+
runHandle) {
|
|
28
38
|
this.browserContext = browserContext;
|
|
29
39
|
this.customerConfig = customerConfig;
|
|
30
40
|
this.fetchEventHandler = fetchEventHandler;
|
|
@@ -34,6 +44,9 @@ export class OnboardingService {
|
|
|
34
44
|
this.extensionBridge = extensionBridge;
|
|
35
45
|
this.speedKitServiceWorkerJs = speedKitServiceWorkerJs;
|
|
36
46
|
this.browserFetch = browserFetch;
|
|
47
|
+
this.controlServer = controlServer;
|
|
48
|
+
this.browserSession = browserSession;
|
|
49
|
+
this.runHandle = runHandle;
|
|
37
50
|
}
|
|
38
51
|
/**
|
|
39
52
|
* Prepare the puppeteer browser, wire event listeners, navigate to the
|
|
@@ -42,36 +55,90 @@ export class OnboardingService {
|
|
|
42
55
|
* any still-open resources. File watchers close themselves via `signal`.
|
|
43
56
|
*/
|
|
44
57
|
async run(externalSignal) {
|
|
45
|
-
this.cli.startAction("ONBOARDING:PREPARE:BROWSER", `prepare browser ${this.cli.style.bold(this.browserContext.browserVersionString)}
|
|
58
|
+
this.cli.startAction("ONBOARDING:PREPARE:BROWSER", `prepare browser ${this.cli.style.bold(this.browserContext.browserVersionString)}`, {
|
|
59
|
+
scope: "browser",
|
|
60
|
+
data: { browser: this.browserContext.browserVersionString },
|
|
61
|
+
});
|
|
46
62
|
const localController = new AbortController();
|
|
47
63
|
const shutdownSignal = AbortSignal.any([
|
|
48
64
|
externalSignal,
|
|
49
65
|
localController.signal,
|
|
50
66
|
]);
|
|
67
|
+
await this.startControlServer(shutdownSignal);
|
|
51
68
|
const browser = await this.prepareBrowser(localController);
|
|
52
69
|
await this.attachExtensionBridge(browser);
|
|
53
70
|
const page = await this.preparePage(browser, shutdownSignal);
|
|
54
|
-
|
|
71
|
+
// The browser ops need more than a handle: the origins they may act on, and
|
|
72
|
+
// the run's own way of reinstalling. Both belong to the run, so they are
|
|
73
|
+
// lent rather than rediscovered.
|
|
74
|
+
//
|
|
75
|
+
// Every origin, not only the one this run started on. Storage is
|
|
76
|
+
// partitioned per origin, so an op that assumed the startup domain would
|
|
77
|
+
// act on the wrong site the moment the page moved to a sibling — and a
|
|
78
|
+
// multi-domain app is the normal case, not the exception.
|
|
79
|
+
this.browserSession?.attach(browser, page, {
|
|
80
|
+
origin: this.browserContext.domain,
|
|
81
|
+
origins: this.customerConfig.origins ?? [],
|
|
82
|
+
reinstall: () => this.reinstallSpeedKit(page, new URL(page.url()).pathname),
|
|
83
|
+
serviceWorkers: this.serviceWorkers,
|
|
84
|
+
setWorkerUserAgent: (userAgent) => {
|
|
85
|
+
this.speedKitServiceWorkerJs.userAgent = userAgent ?? undefined;
|
|
86
|
+
},
|
|
87
|
+
reportAgentActivity: (label, breakpoints, releasedAt) => this.reportAgentActivity(label, breakpoints, releasedAt),
|
|
88
|
+
extensionArms: () => this.extensionBridge.available,
|
|
89
|
+
devtoolsExtensionId: () => this.extensionBridge.devtoolsExtensionId,
|
|
90
|
+
touch: this.browserContext.getTouchEmulation()?.enabled === true,
|
|
91
|
+
deviceMetrics: this.browserContext.getDeviceMetricsOverride(),
|
|
92
|
+
setDeviceTouch: async (touch) => this.browserContext.setDeviceTouch?.(touch),
|
|
93
|
+
});
|
|
94
|
+
this.cli.successAction("ONBOARDING:PREPARE:BROWSER", undefined, {
|
|
95
|
+
scope: "browser",
|
|
96
|
+
});
|
|
55
97
|
// Not awaited: the panel registers a moment after DevTools opens, and the
|
|
56
98
|
// run has no reason to wait for a convenience.
|
|
57
|
-
void this.showDevtoolsPanelOnStart(
|
|
99
|
+
void this.showDevtoolsPanelOnStart();
|
|
58
100
|
await this.navigate(page, `${this.customerConfig.scope}speed-kit-install.html?url=${this.customerConfig.scope}`);
|
|
59
101
|
await waitForAbort(shutdownSignal);
|
|
102
|
+
// Before the browser closes, so nothing can evaluate against a page that is
|
|
103
|
+
// on its way out.
|
|
104
|
+
this.browserSession?.detach();
|
|
60
105
|
await safe(browser.close());
|
|
61
106
|
// The fetch browser only exists if an origin refused a direct request, but closing an unused
|
|
62
107
|
// handle is free and leaving a Chrome behind is not.
|
|
63
108
|
if (this.browserFetch)
|
|
64
109
|
await safe(this.browserFetch.close());
|
|
65
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Open the control socket, if this run has a directory to put it in.
|
|
113
|
+
*
|
|
114
|
+
* Non-fatal: a run that cannot be controlled from outside is still a run, and
|
|
115
|
+
* failing the developer's session over it would be the wrong trade.
|
|
116
|
+
*/
|
|
117
|
+
async startControlServer(signal) {
|
|
118
|
+
if (!this.controlServer) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const result = await safe(this.controlServer.listen(signal));
|
|
122
|
+
if (result.success !== true) {
|
|
123
|
+
this.cli.writeWarning(`control socket unavailable, external tools cannot reach this run: ${result.error}`, false, { data: { error: result.error } });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
66
126
|
async prepareBrowser(localController) {
|
|
67
|
-
const browser = await launchBrowser(this.browserContext);
|
|
127
|
+
const browser = await launchBrowser(this.browserContext, this.cli);
|
|
68
128
|
for (const target of browser.targets()) {
|
|
69
129
|
if (target.type() === "browser") {
|
|
70
130
|
await this.fetchEventHandler.handleRequestFetchEvents(target);
|
|
71
131
|
}
|
|
72
132
|
}
|
|
73
133
|
browser.on(BROWSER_EVENTS.DISCONNECTED, () => {
|
|
74
|
-
this.cli.writeError("Browser disconnected, shutting down"
|
|
134
|
+
this.cli.writeError("Browser disconnected, shutting down", false, {
|
|
135
|
+
scope: "browser",
|
|
136
|
+
});
|
|
137
|
+
// Stamped here because this is the only place that knows *why* the run is
|
|
138
|
+
// ending. The command's exit handler cannot tell a closed window from a
|
|
139
|
+
// crash, and it can win the race to write first — recording it here means
|
|
140
|
+
// first-write-wins works for us rather than against us.
|
|
141
|
+
this.runHandle?.finish("stopped", "browser disconnected");
|
|
75
142
|
localController.abort();
|
|
76
143
|
});
|
|
77
144
|
return browser;
|
|
@@ -81,6 +148,7 @@ export class OnboardingService {
|
|
|
81
148
|
await safe(this.prepareCleanState(page));
|
|
82
149
|
this.registerFileWatcher(page, shutdownSignal);
|
|
83
150
|
this.registerReinstallSpeedKitOnNavigate(page);
|
|
151
|
+
recordConsole(page, this.cli);
|
|
84
152
|
return page;
|
|
85
153
|
}
|
|
86
154
|
/**
|
|
@@ -91,6 +159,32 @@ export class OnboardingService {
|
|
|
91
159
|
* sk-cli. Without a loaded devtools extension there is nothing to attach
|
|
92
160
|
* to — ExtensionValidator already reported why — so it is skipped.
|
|
93
161
|
*/
|
|
162
|
+
/**
|
|
163
|
+
* Say what an agent is doing, for the devtools extension to show.
|
|
164
|
+
*
|
|
165
|
+
* Reported, not drawn. The tab strip is browser UI with no CDP surface at
|
|
166
|
+
* all, so only an extension can colour it — and the one already loaded into
|
|
167
|
+
* the run owns that, keyed off this message. See `lib/agent-tab-state.ts` in
|
|
168
|
+
* team-pi/devtools.
|
|
169
|
+
*
|
|
170
|
+
* Upserted rather than appended: this is current state, not an event log, and
|
|
171
|
+
* a panel that had to dedupe a history to find the live value would be doing
|
|
172
|
+
* work this side can simply not create.
|
|
173
|
+
*/
|
|
174
|
+
async reportAgentActivity(label, breakpoints = [], releasedAt) {
|
|
175
|
+
this.developmentToolsMessages.upsertMessage({
|
|
176
|
+
id: "agent",
|
|
177
|
+
data: {
|
|
178
|
+
active: label !== null,
|
|
179
|
+
label,
|
|
180
|
+
breakpoints,
|
|
181
|
+
// The panel drops every breakpoint switch once per new value. See
|
|
182
|
+
// `mirrorArmedBreakpoints` in team-pi/devtools.
|
|
183
|
+
...(releasedAt ? { releasedAt } : {}),
|
|
184
|
+
...(label === null ? {} : { since: new Date().toISOString() }),
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
}
|
|
94
188
|
/**
|
|
95
189
|
* Open the run's DevTools on the Speed Kit panel rather than on Elements.
|
|
96
190
|
*
|
|
@@ -98,22 +192,16 @@ export class OnboardingService {
|
|
|
98
192
|
* tab, and where someone is looking at it. The selection reaches into
|
|
99
193
|
* DevTools' internals, so a failure is a warning and nothing more.
|
|
100
194
|
*/
|
|
101
|
-
async showDevtoolsPanelOnStart(
|
|
102
|
-
|
|
103
|
-
|
|
195
|
+
async showDevtoolsPanelOnStart() {
|
|
196
|
+
if (this.browserContext.headless ||
|
|
197
|
+
!this.browserSession ||
|
|
198
|
+
!this.extensionBridge.available) {
|
|
104
199
|
return;
|
|
105
200
|
}
|
|
106
|
-
const result = await safe(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!(error instanceof PanelNotFoundError))
|
|
110
|
-
throw error;
|
|
111
|
-
throw new Error(`${error.message} — DevTools shows ${error.tabs.join(", ") || "no tabs at all"}`);
|
|
112
|
-
}));
|
|
113
|
-
if (result.success === true) {
|
|
114
|
-
return;
|
|
201
|
+
const result = await safe(this.browserSession.showPanel());
|
|
202
|
+
if (result.success !== true) {
|
|
203
|
+
this.cli.writeWarning(`DevTools did not open on the Speed Kit panel: ${result.error}`, false, { scope: "extension", data: { error: result.error } });
|
|
115
204
|
}
|
|
116
|
-
this.cli.writeWarning(`DevTools did not open on the Speed Kit panel: ${result.error}`);
|
|
117
205
|
}
|
|
118
206
|
async attachExtensionBridge(browser) {
|
|
119
207
|
if (!this.extensionBridge.isAvailable) {
|
|
@@ -121,7 +209,7 @@ export class OnboardingService {
|
|
|
121
209
|
}
|
|
122
210
|
const result = await safe(this.extensionBridge.init(browser));
|
|
123
211
|
if (result.success !== true) {
|
|
124
|
-
this.cli.writeWarning(`ExtensionBridge unavailable, devtools panel will not receive live updates: ${result.error}
|
|
212
|
+
this.cli.writeWarning(`ExtensionBridge unavailable, devtools panel will not receive live updates: ${result.error}`, false, { scope: "extension", data: { error: result.error } });
|
|
125
213
|
return;
|
|
126
214
|
}
|
|
127
215
|
this.developmentToolsMessages.setBridge(this.extensionBridge);
|
|
@@ -135,19 +223,32 @@ export class OnboardingService {
|
|
|
135
223
|
}
|
|
136
224
|
return browser.newPage();
|
|
137
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* What service workers this run has seen. Nothing else records it — CDP only
|
|
228
|
+
* streams the events, so a reader arriving later has missed them.
|
|
229
|
+
*/
|
|
230
|
+
serviceWorkers = new ServiceWorkerTracker();
|
|
138
231
|
async prepareCleanState(page) {
|
|
139
232
|
const cdpSession = await page.target().createCDPSession();
|
|
140
233
|
await resetBrowserState(cdpSession, this.browserContext.domain);
|
|
141
234
|
this.registerForeignSwGuard(page, cdpSession);
|
|
142
235
|
safe(() => {
|
|
143
236
|
cdpSession.on(CDP_SESSION.EVENTS.SERVICE_WORKER.REGISTRATION_UPDATED, ({ registrations, }) => {
|
|
237
|
+
this.serviceWorkers.recordRegistrations(registrations);
|
|
144
238
|
for (const registration of registrations) {
|
|
145
239
|
if (registration.isDeleted) {
|
|
146
240
|
this.developmentToolsMessages.addMessage({
|
|
147
241
|
id: "serviceWorker",
|
|
148
242
|
data: `Unregistered Service Worker at ${registration.scopeURL} id: ${registration.registrationId}`,
|
|
149
243
|
});
|
|
150
|
-
this.cli.writeWarning(`${this.cli.style.yellow("Unregistered Service Worker")} at ${this.cli.style.bold(registration.scopeURL)} (${registration.registrationId})
|
|
244
|
+
this.cli.writeWarning(`${this.cli.style.yellow("Unregistered Service Worker")} at ${this.cli.style.bold(registration.scopeURL)} (${registration.registrationId})`, false, {
|
|
245
|
+
scope: "sw",
|
|
246
|
+
data: {
|
|
247
|
+
scopeURL: registration.scopeURL,
|
|
248
|
+
registrationId: registration.registrationId,
|
|
249
|
+
unregistered: true,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
151
252
|
}
|
|
152
253
|
}
|
|
153
254
|
});
|
|
@@ -173,11 +274,26 @@ export class OnboardingService {
|
|
|
173
274
|
*/
|
|
174
275
|
registerForeignSwGuard(page, cdpSession) {
|
|
175
276
|
cdpSession.on(CDP_SESSION.EVENTS.SERVICE_WORKER.VERSION_UPDATED, async ({ versions, }) => {
|
|
277
|
+
this.serviceWorkers.recordVersions(versions);
|
|
176
278
|
for (const version of versions) {
|
|
177
279
|
if (!this.isForeignSwVersion(version)) {
|
|
178
280
|
continue;
|
|
179
281
|
}
|
|
180
|
-
|
|
282
|
+
// Recorded before the repair, so the takeover is visible even when
|
|
283
|
+
// the reinstall below is skipped by the cooldown.
|
|
284
|
+
this.serviceWorkers.recordTakeover(version.versionId);
|
|
285
|
+
// The field a reader counts on. A takeover is silent in the browser
|
|
286
|
+
// — with static routing the routes freeze at install time from the
|
|
287
|
+
// deployed config — so the only evidence it happened is this line,
|
|
288
|
+
// and `foreign` is what makes it findable without matching prose.
|
|
289
|
+
this.cli.writeWarning(`${this.cli.style.yellow("Deployed Service Worker took over")} (version ${version.versionId}) — an update check bypassed the local interception. Reinstalling the local build.`, false, {
|
|
290
|
+
scope: "sw",
|
|
291
|
+
data: {
|
|
292
|
+
versionId: version.versionId,
|
|
293
|
+
foreign: true,
|
|
294
|
+
takeover: true,
|
|
295
|
+
},
|
|
296
|
+
});
|
|
181
297
|
this.developmentToolsMessages.addMessage({
|
|
182
298
|
id: "serviceWorker",
|
|
183
299
|
data: `Deployed Service Worker took over (version ${version.versionId}); reinstalling the local build`,
|