@speedkit/cli 4.50.5 → 4.51.0-run-control.2
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/README.md +1425 -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/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 +40 -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 +33 -6
- 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 +3 -1
- 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 +535 -0
- package/dist/services/onboarding/control/browser-session.js +1300 -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 +1428 -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 +30 -0
- package/dist/services/onboarding/onboarding-model.js +12 -1
- 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 +136 -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/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +651 -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 +66 -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 +327 -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 +3409 -288
- package/package.json +20 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, describe, it } from "mocha";
|
|
3
|
+
import { Cache } from "../../../onboarding/request-cache/cache.js";
|
|
4
|
+
import { BaqendResponse } from "../../../onboarding/browser/baqend-response.js";
|
|
5
|
+
import { SpeedKitConfig } from "../../../integration-api/struct/speed-kit-config.js";
|
|
6
|
+
import { memoryCli } from "../../../cli/spec/memory-cli.js";
|
|
7
|
+
import { RunProbeServiceFactory } from "../../probe/run-probe-service-factory.js";
|
|
8
|
+
import { LiveRunFixture, answer, failure, summary, } from "../live-run-fixture.js";
|
|
9
|
+
const ORIGIN = "https://www.shop.de";
|
|
10
|
+
describe("RunProbeService response over the control socket", () => {
|
|
11
|
+
let fixture;
|
|
12
|
+
let cache;
|
|
13
|
+
const start = async (options) => {
|
|
14
|
+
fixture = new LiveRunFixture();
|
|
15
|
+
const dir = fixture.writeRun({ id: "scratch" });
|
|
16
|
+
cache = new Cache(memoryCli(), `${dir}/dh-cache`);
|
|
17
|
+
await fixture.serve("shop.de-production-live", {
|
|
18
|
+
cache,
|
|
19
|
+
origin: "origin" in options ? options.origin : ORIGIN,
|
|
20
|
+
speedKitConfig: options.configThrows
|
|
21
|
+
? () => Promise.reject(new Error("Unexpected token }"))
|
|
22
|
+
: () => Promise.resolve(SpeedKitConfig.createFrom(options.config ?? {})),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const response = (url) => (sink, json) => new RunProbeServiceFactory(fixture.context(sink, json, {}))
|
|
26
|
+
.buildService()
|
|
27
|
+
.response(url);
|
|
28
|
+
afterEach(() => fixture?.close());
|
|
29
|
+
it("should evaluate a real config's rule sets against the url", async () => {
|
|
30
|
+
await start({ config: { blacklist: [{ pathname: "/checkout" }] } });
|
|
31
|
+
const excluded = (await answer(response("/checkout/cart"))).rules;
|
|
32
|
+
const allowed = (await answer(response("/shoes"))).rules;
|
|
33
|
+
expect(excluded.decision).to.equal("excluded");
|
|
34
|
+
expect(excluded.decidedBy).to.equal("blacklist");
|
|
35
|
+
expect(excluded.blacklist).to.deep.equal(["blacklist[0]"]);
|
|
36
|
+
expect(allowed.decision).to.equal("included");
|
|
37
|
+
});
|
|
38
|
+
it("should resolve a relative url against the customer origin", async () => {
|
|
39
|
+
await start({ config: {} });
|
|
40
|
+
expect((await answer(response("/shoes"))).url).to.equal(`${ORIGIN}/shoes`);
|
|
41
|
+
});
|
|
42
|
+
it("should report the cached entry, and whether its body can be compared", async () => {
|
|
43
|
+
await start({ config: {} });
|
|
44
|
+
const transformed = Buffer.from("<html><script>setAssetList([])</script></html>");
|
|
45
|
+
cache.addEntry(`${ORIGIN}/shoes`, new BaqendResponse(transformed, "text/html; charset=utf-8"), transformed);
|
|
46
|
+
const data = await answer(response(`${ORIGIN}/shoes`));
|
|
47
|
+
const entry = data.cache;
|
|
48
|
+
expect(entry.status).to.equal(200);
|
|
49
|
+
expect(entry.assetList).to.equal(true);
|
|
50
|
+
// The note only fires when the marker is missing; it is here.
|
|
51
|
+
expect(data.notes.join(" ")).to.not.contain("setAssetList(");
|
|
52
|
+
});
|
|
53
|
+
it("should warn when a cached body carries no asset list", async () => {
|
|
54
|
+
await start({ config: {} });
|
|
55
|
+
const untransformed = Buffer.from("<html><body>untransformed</body></html>");
|
|
56
|
+
cache.addEntry(`${ORIGIN}/plain`, new BaqendResponse(untransformed, "text/html; charset=utf-8"), untransformed);
|
|
57
|
+
const data = await answer(response(`${ORIGIN}/plain`));
|
|
58
|
+
expect(data.cache.assetList).to.equal(false);
|
|
59
|
+
expect(data.notes.join(" ")).to.contain("returns early");
|
|
60
|
+
});
|
|
61
|
+
it("should say a url is uncached rather than imply it was excluded", async () => {
|
|
62
|
+
await start({ config: {} });
|
|
63
|
+
const data = await answer(response(`${ORIGIN}/never-visited`));
|
|
64
|
+
expect(data.cache).to.equal(undefined);
|
|
65
|
+
expect(data.explanation).to.contain("Nothing has been cached");
|
|
66
|
+
expect(data.rules.decision).to.equal("included");
|
|
67
|
+
});
|
|
68
|
+
it("should lead the summary with the rule that excluded it", async () => {
|
|
69
|
+
await start({ config: { disabledScopes: ["/admin"] } });
|
|
70
|
+
expect(await summary(response("/admin/orders"))).to.contain("excluded by disabledScopes");
|
|
71
|
+
});
|
|
72
|
+
it("should call an unreadable config the answer, not a verdict", async () => {
|
|
73
|
+
// A verdict computed from a config the browser never saw would be worse
|
|
74
|
+
// than no verdict.
|
|
75
|
+
await start({ configThrows: true });
|
|
76
|
+
const failed = await failure(response("/shoes"));
|
|
77
|
+
expect(failed.code).to.equal("CONFIG_UNREADABLE");
|
|
78
|
+
expect(failed.message).to.contain("did not evaluate");
|
|
79
|
+
});
|
|
80
|
+
it("should accept a fully-qualified url on the run's own origin", async () => {
|
|
81
|
+
// This failed for every customer: `domain` is a bare host, and
|
|
82
|
+
// `new URL(input, base)` parses the base first and throws on it — even
|
|
83
|
+
// when the input is absolute.
|
|
84
|
+
await start({ config: {} });
|
|
85
|
+
expect((await answer(response(`${ORIGIN}/`))).url).to.equal(`${ORIGIN}/`);
|
|
86
|
+
});
|
|
87
|
+
it("should survive an origin that was handed over without a scheme", async () => {
|
|
88
|
+
await start({ config: {}, origin: "www.shop.de" });
|
|
89
|
+
expect((await answer(response(`${ORIGIN}/shoes`))).url).to.equal(`${ORIGIN}/shoes`);
|
|
90
|
+
expect((await answer(response("/shoes"))).url).to.equal(`${ORIGIN}/shoes`);
|
|
91
|
+
});
|
|
92
|
+
it("should blame the base, not the input, when there is no origin at all", async () => {
|
|
93
|
+
await start({ config: {}, origin: undefined });
|
|
94
|
+
const failed = await failure(response("/shoes"));
|
|
95
|
+
expect(failed.code).to.equal("BAD_URL");
|
|
96
|
+
expect(failed.detail.base).to.equal(null);
|
|
97
|
+
});
|
|
98
|
+
it("should still reject something that is not a url", async () => {
|
|
99
|
+
await start({ config: {} });
|
|
100
|
+
expect((await failure(response("http://[bad"))).code).to.equal("BAD_URL");
|
|
101
|
+
});
|
|
102
|
+
it("should not claim a serving source for a url nothing watched", async () => {
|
|
103
|
+
await start({ config: {} });
|
|
104
|
+
const data = await answer(response("/shoes"));
|
|
105
|
+
expect(data.servedFrom).to.equal("unknown");
|
|
106
|
+
expect(data.notes.join(" ")).to.contain("not the page in front of");
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { RunRumServiceFactory } from "../../rum/run-rum-service-factory.js";
|
|
4
|
+
import { LiveRunFixture, answer, failure } from "../live-run-fixture.js";
|
|
5
|
+
const beacon = (seq, data) => ({
|
|
6
|
+
seq,
|
|
7
|
+
at: `2026-10-12T10:00:0${seq}.000Z`,
|
|
8
|
+
url: "https://myapp.app.baqend.com/v1/rum/pi",
|
|
9
|
+
bytes: JSON.stringify(data).length,
|
|
10
|
+
data,
|
|
11
|
+
});
|
|
12
|
+
describe("RunRumService beacons over the control socket", () => {
|
|
13
|
+
let fixture;
|
|
14
|
+
let kept;
|
|
15
|
+
const rumOp = (op) => (sink, json) => op(new RunRumServiceFactory(fixture.context(sink, json, {})).buildService());
|
|
16
|
+
beforeEach(async () => {
|
|
17
|
+
fixture = new LiveRunFixture();
|
|
18
|
+
kept = [
|
|
19
|
+
beacon(1, { pageType: "pdp", dimensions: {} }),
|
|
20
|
+
beacon(2, { dimensions: { addToCart: "sku-1" } }),
|
|
21
|
+
beacon(3, { cls: 0.01 }),
|
|
22
|
+
];
|
|
23
|
+
await fixture.serve("example.com-production-live", {
|
|
24
|
+
rumBeacons: () => kept,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
afterEach(() => fixture.close());
|
|
28
|
+
it("should say which beacon carried a field, and where in it", async () => {
|
|
29
|
+
// The merged state says addToCart was tracked; only the beacons say by
|
|
30
|
+
// which one, and so whether the click sent it.
|
|
31
|
+
const data = (await answer(rumOp((rum) => rum.beacons({ key: "addToCart" }))));
|
|
32
|
+
expect(data.beacons.map((one) => one.seq)).to.deep.equal([2]);
|
|
33
|
+
expect(data.beacons[0].matches[0].path).to.equal("dimensions.addToCart");
|
|
34
|
+
});
|
|
35
|
+
it("should read on from a cursor", async () => {
|
|
36
|
+
const data = (await answer(rumOp((rum) => rum.beacons({ sinceSeq: 2 }))));
|
|
37
|
+
expect(data.beacons.map((one) => one.seq)).to.deep.equal([3]);
|
|
38
|
+
expect(data.lastSeq).to.equal(3);
|
|
39
|
+
});
|
|
40
|
+
it("should say a run that keeps no beacons keeps none", async () => {
|
|
41
|
+
await fixture.close();
|
|
42
|
+
fixture = new LiveRunFixture();
|
|
43
|
+
await fixture.serve("example.com-production-live", {});
|
|
44
|
+
const failed = await failure(rumOp((rum) => rum.beacons({})));
|
|
45
|
+
expect(failed.code).to.equal("BROWSER_UNAVAILABLE");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { MemorySink } from "../../cli/index.js";
|
|
4
|
+
import { memoryCli } from "../../cli/spec/memory-cli.js";
|
|
5
|
+
import { AmbiguousRunError, NoSuchRunError, } from "../../run-registry/index.js";
|
|
6
|
+
import { ControlError } from "../control-client.js";
|
|
7
|
+
import { RunAnswer } from "../run-answer.js";
|
|
8
|
+
const answerInto = (json) => {
|
|
9
|
+
const sink = new MemorySink();
|
|
10
|
+
return { sink, answer: new RunAnswer(memoryCli(sink), json) };
|
|
11
|
+
};
|
|
12
|
+
describe("RunAnswer", () => {
|
|
13
|
+
it("should print the summary and the detail for a person, and no payload", () => {
|
|
14
|
+
const { sink, answer } = answerInto(false);
|
|
15
|
+
answer.give("2 things", { things: [1, 2] }, () => sink.line("detail"));
|
|
16
|
+
expect(sink.lines).to.deep.equal(["2 things", "detail"]);
|
|
17
|
+
expect(sink.payloads).to.deep.equal([]);
|
|
18
|
+
});
|
|
19
|
+
it("should print only the data under --json, so stdout parses", () => {
|
|
20
|
+
const { sink, answer } = answerInto(true);
|
|
21
|
+
answer.give("2 things", { things: [1, 2] }, () => sink.line("detail"));
|
|
22
|
+
expect(sink.lines).to.deep.equal([]);
|
|
23
|
+
expect(JSON.parse(sink.payloads.join(""))).to.deep.equal({
|
|
24
|
+
things: [1, 2],
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it("should give a failure its code under --json", () => {
|
|
28
|
+
const { sink, answer } = answerInto(true);
|
|
29
|
+
answer.fail(new ControlError("NO_LIVE_RUN", "gone", { run: "a", next: "start one" }));
|
|
30
|
+
expect(JSON.parse(sink.payloads.join(""))).to.deep.equal({
|
|
31
|
+
code: "NO_LIVE_RUN",
|
|
32
|
+
message: "gone",
|
|
33
|
+
run: "a",
|
|
34
|
+
next: "start one",
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it("should give a person the message and the way past it", () => {
|
|
38
|
+
const { sink, answer } = answerInto(false);
|
|
39
|
+
answer.fail(new ControlError("NO_LIVE_RUN", "gone", { next: "start one" }));
|
|
40
|
+
expect(sink.lines.join("\n")).to.contain("gone");
|
|
41
|
+
expect(sink.lines.join("\n")).to.contain("start one");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe("ControlError.from", () => {
|
|
45
|
+
const run = (id) => ({ meta: { id }, status: "running" });
|
|
46
|
+
it("should name the candidates of an ambiguous selector", () => {
|
|
47
|
+
const failed = ControlError.from(new AmbiguousRunError([run("a"), run("b")]));
|
|
48
|
+
expect(failed.code).to.equal("AMBIGUOUS_RUN");
|
|
49
|
+
expect(failed.detail.candidates).to.deep.equal(["a", "b"]);
|
|
50
|
+
});
|
|
51
|
+
it("should say no run matched", () => {
|
|
52
|
+
expect(ControlError.from(new NoSuchRunError("x")).code).to.equal("NO_SUCH_RUN");
|
|
53
|
+
});
|
|
54
|
+
it("should leave a bug a bug", () => {
|
|
55
|
+
expect(ControlError.from(new TypeError("boom"))).to.equal(undefined);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
4
|
+
import { processStartToken } from "../../../run-registry/process-identity.js";
|
|
5
|
+
import { RunSessionServiceFactory } from "../../session/run-session-service-factory.js";
|
|
6
|
+
import { LiveRunFixture, answer, failure, summary, } from "../live-run-fixture.js";
|
|
7
|
+
describe("RunSessionService", () => {
|
|
8
|
+
let fixture;
|
|
9
|
+
const sessionOp = (op) => async (sink, json) => op(new RunSessionServiceFactory(fixture.context(sink, json, {})).buildService());
|
|
10
|
+
/** Claimed by this process, so the registry reads it as live. */
|
|
11
|
+
const live = (id, extra = {}) => fixture.writeRun({
|
|
12
|
+
id,
|
|
13
|
+
customer: id.split("-")[0],
|
|
14
|
+
status: "running",
|
|
15
|
+
pid: process.pid,
|
|
16
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
17
|
+
...extra,
|
|
18
|
+
});
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
fixture = new LiveRunFixture();
|
|
21
|
+
});
|
|
22
|
+
afterEach(() => fixture.close());
|
|
23
|
+
describe("list", () => {
|
|
24
|
+
it("should say so, rather than fail, when nothing has run yet", async () => {
|
|
25
|
+
const data = await answer(sessionOp((session) => session.list()));
|
|
26
|
+
expect(data.runs).to.deep.equal([]);
|
|
27
|
+
});
|
|
28
|
+
it("should list recorded runs, newest first", async () => {
|
|
29
|
+
fixture.writeRun({
|
|
30
|
+
id: "a-production-1",
|
|
31
|
+
startedAt: "2026-09-01T00:00:00.000Z",
|
|
32
|
+
});
|
|
33
|
+
fixture.writeRun({
|
|
34
|
+
id: "b-production-2",
|
|
35
|
+
startedAt: "2026-09-02T00:00:00.000Z",
|
|
36
|
+
});
|
|
37
|
+
const data = await answer(sessionOp((session) => session.list()));
|
|
38
|
+
const line = await summary(sessionOp((session) => session.list()));
|
|
39
|
+
expect(data.runs.map((run) => run.id)).to.deep.equal(["b-production-2", "a-production-1"]);
|
|
40
|
+
expect(line).to.equal("2 runs, 0 live");
|
|
41
|
+
});
|
|
42
|
+
it("should surface why a run ended, not only that it did", async () => {
|
|
43
|
+
fixture.writeRun({
|
|
44
|
+
id: "stopped-production-1",
|
|
45
|
+
status: "stopped",
|
|
46
|
+
error: "browser disconnected",
|
|
47
|
+
endedAt: new Date().toISOString(),
|
|
48
|
+
});
|
|
49
|
+
const [run] = (await answer(sessionOp((session) => session.list())))
|
|
50
|
+
.runs;
|
|
51
|
+
expect(run.status).to.equal("stopped");
|
|
52
|
+
// Written to meta.json and never surfaced would make the status a dead end.
|
|
53
|
+
expect(run.error).to.equal("browser disconnected");
|
|
54
|
+
});
|
|
55
|
+
it("should report a crashed run as crashed, not as running", async () => {
|
|
56
|
+
fixture.writeRun({ id: "gone-production-1", status: "running" });
|
|
57
|
+
const [run] = (await answer(sessionOp((session) => session.list())))
|
|
58
|
+
.runs;
|
|
59
|
+
expect(run.status).to.equal("crashed");
|
|
60
|
+
expect(run.live).to.equal(false);
|
|
61
|
+
});
|
|
62
|
+
it("should say how many are live in the summary line", async () => {
|
|
63
|
+
live("one-production-1");
|
|
64
|
+
live("two-production-1");
|
|
65
|
+
expect(await summary(sessionOp((session) => session.list()))).to.contain("2 live");
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe("status", () => {
|
|
69
|
+
it("should return the one live run", async () => {
|
|
70
|
+
live("only-production-1");
|
|
71
|
+
fixture.writeRun({ id: "old-production-1" });
|
|
72
|
+
const data = await answer(sessionOp((session) => session.status()));
|
|
73
|
+
expect(data.run.id).to.equal("only-production-1");
|
|
74
|
+
});
|
|
75
|
+
it("should refuse to pick between two live runs", async () => {
|
|
76
|
+
// `current` used to answer with whichever was newest and say nothing
|
|
77
|
+
// about the other, while every op on a run refused the same situation.
|
|
78
|
+
live("one-production-1");
|
|
79
|
+
live("two-production-1");
|
|
80
|
+
const failed = await failure(sessionOp((session) => session.status()));
|
|
81
|
+
expect(failed.code).to.equal("AMBIGUOUS_RUN");
|
|
82
|
+
expect(failed.detail.candidates.sort()).to.deep.equal([
|
|
83
|
+
"one-production-1",
|
|
84
|
+
"two-production-1",
|
|
85
|
+
]);
|
|
86
|
+
});
|
|
87
|
+
it("should name the command to run when nothing is live", async () => {
|
|
88
|
+
fixture.writeRun({ id: "old-production-1" });
|
|
89
|
+
const failed = await failure(sessionOp((session) => session.status()));
|
|
90
|
+
expect(failed.code).to.equal("NO_LIVE_RUN");
|
|
91
|
+
expect(failed.detail.next).to.contain("sk onboarding <customerPath>");
|
|
92
|
+
});
|
|
93
|
+
it("should say whether the live run's page answers", async () => {
|
|
94
|
+
const page = (evaluate) => ({ available: true, debug: { evaluate } });
|
|
95
|
+
await fixture.serve("ok-production-1", {
|
|
96
|
+
session: page(async () => ({ onCallFrame: false, value: 1 })),
|
|
97
|
+
});
|
|
98
|
+
await fixture.serve("stuck-production-1", {
|
|
99
|
+
session: page(() => new Promise(() => undefined)),
|
|
100
|
+
});
|
|
101
|
+
const probe = (id) => answer(sessionOp((session) => session.status(id, 300)));
|
|
102
|
+
expect((await probe("ok-production-1")).page).to.include({
|
|
103
|
+
answers: true,
|
|
104
|
+
paused: false,
|
|
105
|
+
});
|
|
106
|
+
// A page blocked by a dialog: the process is live, the page is not.
|
|
107
|
+
const stuck = await probe("stuck-production-1");
|
|
108
|
+
expect(stuck.run.live).to.equal(true);
|
|
109
|
+
expect(stuck.page).to.include({
|
|
110
|
+
answers: false,
|
|
111
|
+
code: "CONTROL_TIMEOUT",
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
it("should describe a finished run when --run names one", async () => {
|
|
115
|
+
fixture.writeRun({ id: "old-production-1", error: "it broke" });
|
|
116
|
+
const data = await answer(sessionOp((session) => session.status("old-production-1")));
|
|
117
|
+
expect(data.run).to.include({
|
|
118
|
+
id: "old-production-1",
|
|
119
|
+
error: "it broke",
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe("stop", () => {
|
|
124
|
+
const stopOp = (selector) => async (sink, json) => new RunSessionServiceFactory(fixture.context(sink, json, {}))
|
|
125
|
+
.buildService()
|
|
126
|
+
.stop(selector, 5000);
|
|
127
|
+
it("should end the run's process and wait until it is gone", async () => {
|
|
128
|
+
const child = spawn(process.execPath, [
|
|
129
|
+
"-e",
|
|
130
|
+
"setInterval(() => {}, 1000)",
|
|
131
|
+
]);
|
|
132
|
+
const exited = new Promise((resolve) => child.once("exit", resolve));
|
|
133
|
+
await new Promise((resolve) => child.once("spawn", resolve));
|
|
134
|
+
fixture.writeRun({
|
|
135
|
+
id: "shop-production-1",
|
|
136
|
+
status: "running",
|
|
137
|
+
pid: child.pid,
|
|
138
|
+
startToken: processStartToken(child.pid ?? 0) ?? undefined,
|
|
139
|
+
});
|
|
140
|
+
const data = await answer(stopOp("shop"));
|
|
141
|
+
expect(data.stopped).to.equal(true);
|
|
142
|
+
expect(await exited).to.equal(null);
|
|
143
|
+
});
|
|
144
|
+
it("should say a run had already ended, and send nothing", async () => {
|
|
145
|
+
fixture.writeRun({ id: "old-production-1", status: "stopped" });
|
|
146
|
+
const data = await answer(stopOp("old-production-1"));
|
|
147
|
+
expect(data.stopped).to.equal(false);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RunLogInterface } from "./run-log.js";
|
|
2
|
+
/**
|
|
3
|
+
* Put the things that never pass through `CliService` into the log.
|
|
4
|
+
*
|
|
5
|
+
* An uncaught exception, a rejected promise nobody awaited and a Node warning
|
|
6
|
+
* are precisely the output a run produces when it is going wrong, and none of
|
|
7
|
+
* them is written by the CLI — they are printed by Node, straight to stderr,
|
|
8
|
+
* after or instead of anything the run had to say.
|
|
9
|
+
*
|
|
10
|
+
* While `sk onboarding` lived in a tmux session there was a fallback: the pane
|
|
11
|
+
* captured them because it captured the terminal. A run started in an ordinary
|
|
12
|
+
* shell has no such capture, so mirroring these is what makes the log a
|
|
13
|
+
* complete account rather than an account of the parts that went to plan.
|
|
14
|
+
*
|
|
15
|
+
* **Nothing here changes what the process does**, which takes some care,
|
|
16
|
+
* because two of the three events decide Node's behaviour by whether anyone is
|
|
17
|
+
* listening:
|
|
18
|
+
*
|
|
19
|
+
* - `uncaughtExceptionMonitor` exists for exactly this. A plain
|
|
20
|
+
* `uncaughtException` listener suppresses the default — the process would
|
|
21
|
+
* survive its own fatal error and carry on half-dead, which is far worse than
|
|
22
|
+
* a missing log line. The monitor observes and the default still runs.
|
|
23
|
+
* - `unhandledRejection` has no monitor variant, so the listener re-raises what
|
|
24
|
+
* it was handed. Node's default is to turn an unhandled rejection into an
|
|
25
|
+
* uncaught exception; throwing from here is that, one frame later.
|
|
26
|
+
* - `warning` is safe: Node installs its own listener at bootstrap, so ours is
|
|
27
|
+
* additional and the warning is still printed.
|
|
28
|
+
*
|
|
29
|
+
* @returns a function that removes every listener it installed.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mirrorCrashes(log: RunLogInterface): () => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Put the things that never pass through `CliService` into the log.
|
|
3
|
+
*
|
|
4
|
+
* An uncaught exception, a rejected promise nobody awaited and a Node warning
|
|
5
|
+
* are precisely the output a run produces when it is going wrong, and none of
|
|
6
|
+
* them is written by the CLI — they are printed by Node, straight to stderr,
|
|
7
|
+
* after or instead of anything the run had to say.
|
|
8
|
+
*
|
|
9
|
+
* While `sk onboarding` lived in a tmux session there was a fallback: the pane
|
|
10
|
+
* captured them because it captured the terminal. A run started in an ordinary
|
|
11
|
+
* shell has no such capture, so mirroring these is what makes the log a
|
|
12
|
+
* complete account rather than an account of the parts that went to plan.
|
|
13
|
+
*
|
|
14
|
+
* **Nothing here changes what the process does**, which takes some care,
|
|
15
|
+
* because two of the three events decide Node's behaviour by whether anyone is
|
|
16
|
+
* listening:
|
|
17
|
+
*
|
|
18
|
+
* - `uncaughtExceptionMonitor` exists for exactly this. A plain
|
|
19
|
+
* `uncaughtException` listener suppresses the default — the process would
|
|
20
|
+
* survive its own fatal error and carry on half-dead, which is far worse than
|
|
21
|
+
* a missing log line. The monitor observes and the default still runs.
|
|
22
|
+
* - `unhandledRejection` has no monitor variant, so the listener re-raises what
|
|
23
|
+
* it was handed. Node's default is to turn an unhandled rejection into an
|
|
24
|
+
* uncaught exception; throwing from here is that, one frame later.
|
|
25
|
+
* - `warning` is safe: Node installs its own listener at bootstrap, so ours is
|
|
26
|
+
* additional and the warning is still printed.
|
|
27
|
+
*
|
|
28
|
+
* @returns a function that removes every listener it installed.
|
|
29
|
+
*/
|
|
30
|
+
export function mirrorCrashes(log) {
|
|
31
|
+
const onUncaught = (error) => {
|
|
32
|
+
log.event({
|
|
33
|
+
level: "error",
|
|
34
|
+
scope: "process",
|
|
35
|
+
msg: `uncaught exception: ${error?.message ?? String(error)}`,
|
|
36
|
+
data: { name: error?.name, stack: error?.stack },
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const onRejection = (reason) => {
|
|
40
|
+
const error = reason instanceof Error ? reason : undefined;
|
|
41
|
+
log.event({
|
|
42
|
+
level: "error",
|
|
43
|
+
scope: "process",
|
|
44
|
+
msg: `unhandled rejection: ${error?.message ?? String(reason)}`,
|
|
45
|
+
data: { name: error?.name, stack: error?.stack },
|
|
46
|
+
});
|
|
47
|
+
// Hand it back to the default path. Without this, installing the mirror
|
|
48
|
+
// would be enough to make a run survive a rejection it used to die on.
|
|
49
|
+
throw reason;
|
|
50
|
+
};
|
|
51
|
+
const onWarning = (warning) => {
|
|
52
|
+
log.event({
|
|
53
|
+
level: "warn",
|
|
54
|
+
scope: "process",
|
|
55
|
+
msg: `${warning.name}: ${warning.message}`,
|
|
56
|
+
data: { stack: warning.stack },
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
// `on`, not `once`: a run that produces one unhandled rejection usually
|
|
60
|
+
// produces several, and the later ones are often the informative ones.
|
|
61
|
+
process.on("uncaughtExceptionMonitor", onUncaught);
|
|
62
|
+
process.on("unhandledRejection", onRejection);
|
|
63
|
+
process.on("warning", onWarning);
|
|
64
|
+
return () => {
|
|
65
|
+
process.off("uncaughtExceptionMonitor", onUncaught);
|
|
66
|
+
process.off("unhandledRejection", onRejection);
|
|
67
|
+
process.off("warning", onWarning);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./log-event-model.js";
|
|
2
|
+
export * from "./log-reader.js";
|
|
3
|
+
export * from "./log-summary.js";
|
|
4
|
+
export * from "./redaction.js";
|
|
5
|
+
export * from "./jsonl-appender.js";
|
|
6
|
+
export * from "./request-log.js";
|
|
7
|
+
export * from "./request-summary.js";
|
|
8
|
+
export * from "./run-log.js";
|
|
9
|
+
export * from "./crash-mirror.js";
|
|
10
|
+
export * from "./log-query-service.js";
|
|
11
|
+
export * from "./log-query-service-factory.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./log-event-model.js";
|
|
2
|
+
export * from "./log-reader.js";
|
|
3
|
+
export * from "./log-summary.js";
|
|
4
|
+
export * from "./redaction.js";
|
|
5
|
+
export * from "./jsonl-appender.js";
|
|
6
|
+
export * from "./request-log.js";
|
|
7
|
+
export * from "./request-summary.js";
|
|
8
|
+
export * from "./run-log.js";
|
|
9
|
+
export * from "./crash-mirror.js";
|
|
10
|
+
export * from "./log-query-service.js";
|
|
11
|
+
export * from "./log-query-service-factory.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An append-only JSON-lines file in a run directory.
|
|
3
|
+
*
|
|
4
|
+
* Shared by the two streams a run writes — its narration and its request
|
|
5
|
+
* records — because everything below the record shape is the same problem:
|
|
6
|
+
* append a line, rotate before the file becomes the disk, and never let a
|
|
7
|
+
* failure here reach the run.
|
|
8
|
+
*
|
|
9
|
+
* **Writes are synchronous, on purpose.** The whole claim of these files is
|
|
10
|
+
* that a run which crashed is still explainable, and buffered writes lose
|
|
11
|
+
* exactly the lines that matter — the ones just before the crash.
|
|
12
|
+
*
|
|
13
|
+
* **A failure disables the stream rather than propagating.** A full disk, or a
|
|
14
|
+
* directory pruned out from under a live run, is not a reason for
|
|
15
|
+
* `sk onboarding` to stop. The first failure is remembered in {@link error},
|
|
16
|
+
* so a caller can mention it once instead of filling the terminal with the
|
|
17
|
+
* same errno.
|
|
18
|
+
*/
|
|
19
|
+
export declare class JsonlAppender {
|
|
20
|
+
private readonly dir;
|
|
21
|
+
private readonly file;
|
|
22
|
+
private readonly previousFile;
|
|
23
|
+
private readonly maxBytes;
|
|
24
|
+
private fd?;
|
|
25
|
+
private bytes;
|
|
26
|
+
private disabled;
|
|
27
|
+
/** What went wrong the first time a write failed, if one did. */
|
|
28
|
+
error?: string;
|
|
29
|
+
constructor(dir: string, file: string, previousFile: string, maxBytes: number);
|
|
30
|
+
/** Absolute path of the file being appended to. */
|
|
31
|
+
get path(): string;
|
|
32
|
+
/** @returns whether the record reached the file. */
|
|
33
|
+
append(record: unknown): boolean;
|
|
34
|
+
private open;
|
|
35
|
+
/**
|
|
36
|
+
* Start a new file, keeping one generation.
|
|
37
|
+
*
|
|
38
|
+
* Callers deliberately do *not* restart their sequence numbers: `seq` is the
|
|
39
|
+
* cursor a tailing reader holds, and a reader that asked for "everything
|
|
40
|
+
* after 40 000" must not be handed the start of the run again because the
|
|
41
|
+
* file underneath it turned over.
|
|
42
|
+
*/
|
|
43
|
+
private rotate;
|
|
44
|
+
private closeFd;
|
|
45
|
+
close(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { closeSync, existsSync, openSync, renameSync, statSync, writeSync, } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* An append-only JSON-lines file in a run directory.
|
|
5
|
+
*
|
|
6
|
+
* Shared by the two streams a run writes — its narration and its request
|
|
7
|
+
* records — because everything below the record shape is the same problem:
|
|
8
|
+
* append a line, rotate before the file becomes the disk, and never let a
|
|
9
|
+
* failure here reach the run.
|
|
10
|
+
*
|
|
11
|
+
* **Writes are synchronous, on purpose.** The whole claim of these files is
|
|
12
|
+
* that a run which crashed is still explainable, and buffered writes lose
|
|
13
|
+
* exactly the lines that matter — the ones just before the crash.
|
|
14
|
+
*
|
|
15
|
+
* **A failure disables the stream rather than propagating.** A full disk, or a
|
|
16
|
+
* directory pruned out from under a live run, is not a reason for
|
|
17
|
+
* `sk onboarding` to stop. The first failure is remembered in {@link error},
|
|
18
|
+
* so a caller can mention it once instead of filling the terminal with the
|
|
19
|
+
* same errno.
|
|
20
|
+
*/
|
|
21
|
+
export class JsonlAppender {
|
|
22
|
+
dir;
|
|
23
|
+
file;
|
|
24
|
+
previousFile;
|
|
25
|
+
maxBytes;
|
|
26
|
+
fd;
|
|
27
|
+
bytes = 0;
|
|
28
|
+
disabled = false;
|
|
29
|
+
/** What went wrong the first time a write failed, if one did. */
|
|
30
|
+
error;
|
|
31
|
+
constructor(dir, file, previousFile, maxBytes) {
|
|
32
|
+
this.dir = dir;
|
|
33
|
+
this.file = file;
|
|
34
|
+
this.previousFile = previousFile;
|
|
35
|
+
this.maxBytes = maxBytes;
|
|
36
|
+
}
|
|
37
|
+
/** Absolute path of the file being appended to. */
|
|
38
|
+
get path() {
|
|
39
|
+
return join(this.dir, this.file);
|
|
40
|
+
}
|
|
41
|
+
/** @returns whether the record reached the file. */
|
|
42
|
+
append(record) {
|
|
43
|
+
if (this.disabled) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const line = `${JSON.stringify(record)}\n`;
|
|
48
|
+
this.open();
|
|
49
|
+
this.bytes += writeSync(this.fd, line);
|
|
50
|
+
if (this.bytes >= this.maxBytes) {
|
|
51
|
+
this.rotate();
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.disabled = true;
|
|
57
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
58
|
+
this.closeFd();
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
open() {
|
|
63
|
+
if (this.fd !== undefined) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.fd = openSync(this.path, "a");
|
|
67
|
+
this.bytes = existsSync(this.path) ? statSync(this.path).size : 0;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Start a new file, keeping one generation.
|
|
71
|
+
*
|
|
72
|
+
* Callers deliberately do *not* restart their sequence numbers: `seq` is the
|
|
73
|
+
* cursor a tailing reader holds, and a reader that asked for "everything
|
|
74
|
+
* after 40 000" must not be handed the start of the run again because the
|
|
75
|
+
* file underneath it turned over.
|
|
76
|
+
*/
|
|
77
|
+
rotate() {
|
|
78
|
+
this.closeFd();
|
|
79
|
+
renameSync(this.path, join(this.dir, this.previousFile));
|
|
80
|
+
this.bytes = 0;
|
|
81
|
+
}
|
|
82
|
+
closeFd() {
|
|
83
|
+
if (this.fd !== undefined) {
|
|
84
|
+
closeSync(this.fd);
|
|
85
|
+
this.fd = undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
close() {
|
|
89
|
+
this.closeFd();
|
|
90
|
+
}
|
|
91
|
+
}
|