@speedkit/cli 4.50.5 → 4.51.0-run-control.1
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 +1369 -10
- 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 +6 -1
- package/dist/commands/diff.js +9 -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 +93 -0
- package/dist/commands/onboarding/browser/emulate.js +23 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +67 -0
- package/dist/commands/onboarding/browser/navigate.js +18 -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 +77 -0
- package/dist/commands/onboarding/debug/arm.js +18 -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 +256 -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/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 +220 -3
- 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 +8 -0
- package/dist/services/diff/diff-service-build-context.js +40 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +48 -20
- 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/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/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/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/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/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 +521 -0
- package/dist/services/onboarding/control/browser-session.js +1273 -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 +1390 -0
- package/dist/services/onboarding/control/control-protocol.js +69 -0
- package/dist/services/onboarding/control/control-server.d.ts +284 -0
- package/dist/services/onboarding/control/control-server.js +1609 -0
- package/dist/services/onboarding/control/debug-session.d.ts +190 -0
- package/dist/services/onboarding/control/debug-session.js +801 -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/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 +119 -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 +149 -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 +94 -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/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +10 -0
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +6 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +131 -17
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +135 -22
- 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/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 +526 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +338 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +693 -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/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 +172 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +202 -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 +37 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -0
- 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/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 +34 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +82 -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.js +9 -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 +541 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +78 -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 +64 -0
- package/dist/services/run-control/browser/run-browser-service.js +199 -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 +411 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +44 -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 +38 -0
- package/dist/services/run-control/debug/run-debug-service.js +161 -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 +32 -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 +203 -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 +193 -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 +25 -0
- package/dist/services/run-control/session/run-session-service.js +95 -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 +224 -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 +101 -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 +80 -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 +150 -0
- package/dist/services/run-registry/run-registry.js +409 -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 +509 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3293 -272
- package/package.json +20 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { redactData, redactText, REDACTED } from "../redaction.js";
|
|
4
|
+
describe("redactText", () => {
|
|
5
|
+
it("withholds the value of a signed query parameter", () => {
|
|
6
|
+
expect(redactText("GET https://x.test/a?signature=deadbeef&page=2")).to.equal(`GET https://x.test/a?signature=${REDACTED}&page=2`);
|
|
7
|
+
});
|
|
8
|
+
it("withholds an app token however it is spelled", () => {
|
|
9
|
+
expect(redactText("https://x.test/?BAT=abc")).to.equal(`https://x.test/?BAT=${REDACTED}`);
|
|
10
|
+
expect(redactText("https://x.test/?api_key=abc")).to.equal(`https://x.test/?api_key=${REDACTED}`);
|
|
11
|
+
});
|
|
12
|
+
it("withholds an authorization header written into prose", () => {
|
|
13
|
+
expect(redactText("sent authorization: Bearer abc.def")).to.equal(`sent authorization: ${REDACTED}`);
|
|
14
|
+
});
|
|
15
|
+
it("leaves an ordinary url alone", () => {
|
|
16
|
+
const url = "https://x.test/checkout?step=2&ref=home";
|
|
17
|
+
expect(redactText(url)).to.equal(url);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("redactData", () => {
|
|
21
|
+
it("withholds a sensitive key however it is cased or separated", () => {
|
|
22
|
+
expect(redactData({ appToken: "a", "set-cookie": "b", API_KEY: "c", url: "/x" })).to.eql({
|
|
23
|
+
appToken: REDACTED,
|
|
24
|
+
"set-cookie": REDACTED,
|
|
25
|
+
API_KEY: REDACTED,
|
|
26
|
+
url: "/x",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it("reaches into nested objects and arrays", () => {
|
|
30
|
+
expect(redactData({ headers: [{ cookie: "session=1" }], status: 200 })).to.eql({ headers: [{ cookie: REDACTED }], status: 200 });
|
|
31
|
+
});
|
|
32
|
+
it("does not mutate what the caller passed", () => {
|
|
33
|
+
const data = { password: "hunter2" };
|
|
34
|
+
redactData(data);
|
|
35
|
+
// The caller is usually still using this object; blanking it in place
|
|
36
|
+
// would take a field the run then goes on to need.
|
|
37
|
+
expect(data.password).to.equal("hunter2");
|
|
38
|
+
});
|
|
39
|
+
it("survives a cycle", () => {
|
|
40
|
+
const data = { name: "outer" };
|
|
41
|
+
data.self = data;
|
|
42
|
+
expect(redactData(data)).to.eql({ name: "outer", self: "[circular]" });
|
|
43
|
+
});
|
|
44
|
+
it("stops at a depth rather than walking a whole object graph", () => {
|
|
45
|
+
let leaf = { deep: true };
|
|
46
|
+
for (let index = 0; index < 10; index++) {
|
|
47
|
+
leaf = { nested: leaf };
|
|
48
|
+
}
|
|
49
|
+
expect(JSON.stringify(redactData(leaf))).to.contain("[truncated]");
|
|
50
|
+
});
|
|
51
|
+
it("keeps an error readable instead of serialising it to nothing", () => {
|
|
52
|
+
expect(redactData({ error: new TypeError("no") }).error).to.eql({
|
|
53
|
+
name: "TypeError",
|
|
54
|
+
message: "no",
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
it("cuts a string that is really a body", () => {
|
|
58
|
+
const long = "x".repeat(5000);
|
|
59
|
+
expect(String(redactData({ body: long }).body)).to.contain("more chars");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { REDACTED } from "../redaction.js";
|
|
7
|
+
import { RequestLog, REQUESTS_FILE, REQUESTS_PREVIOUS_FILE, } from "../request-log.js";
|
|
8
|
+
describe("RequestLog", () => {
|
|
9
|
+
let dir;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
dir = mkdtempSync(join(tmpdir(), "sk-request-log-"));
|
|
12
|
+
});
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
rmSync(dir, { recursive: true, force: true });
|
|
15
|
+
});
|
|
16
|
+
const lines = (file = REQUESTS_FILE) => readFileSync(join(dir, file), "utf8")
|
|
17
|
+
.split("\n")
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.map((line) => JSON.parse(line));
|
|
20
|
+
const record = (patch = {}) => ({
|
|
21
|
+
url: "https://x.test/",
|
|
22
|
+
method: "GET",
|
|
23
|
+
resourceType: "Document",
|
|
24
|
+
stage: "Request",
|
|
25
|
+
outcome: "continued",
|
|
26
|
+
...patch,
|
|
27
|
+
});
|
|
28
|
+
it("writes to its own file, not the narration log", () => {
|
|
29
|
+
const log = new RequestLog(dir);
|
|
30
|
+
log.record(record());
|
|
31
|
+
log.close();
|
|
32
|
+
// The two streams are separate so a navigation's traffic cannot bury the
|
|
33
|
+
// handful of lines a human is actually reading.
|
|
34
|
+
expect(existsSync(join(dir, REQUESTS_FILE))).to.equal(true);
|
|
35
|
+
expect(existsSync(join(dir, "log.jsonl"))).to.equal(false);
|
|
36
|
+
});
|
|
37
|
+
it("numbers records from one and stamps them", () => {
|
|
38
|
+
const log = new RequestLog(dir);
|
|
39
|
+
log.record(record({ url: "https://x.test/a" }));
|
|
40
|
+
log.record(record({ url: "https://x.test/b" }));
|
|
41
|
+
log.close();
|
|
42
|
+
expect(lines().map((entry) => [entry.seq, entry.url])).to.eql([
|
|
43
|
+
[1, "https://x.test/a"],
|
|
44
|
+
[2, "https://x.test/b"],
|
|
45
|
+
]);
|
|
46
|
+
expect(lines()[0].ts).to.be.a("string");
|
|
47
|
+
});
|
|
48
|
+
it("withholds a credential carried in the request url", () => {
|
|
49
|
+
const log = new RequestLog(dir);
|
|
50
|
+
log.record(record({ url: "https://x.test/asset?signature=abc&v=2" }));
|
|
51
|
+
log.close();
|
|
52
|
+
// A signed asset url is the likeliest place in this whole file for a
|
|
53
|
+
// secret to appear, and nothing about the surrounding code would notice.
|
|
54
|
+
expect(lines()[0].url).to.equal(`https://x.test/asset?signature=${REDACTED}&v=2`);
|
|
55
|
+
});
|
|
56
|
+
it("withholds a credential quoted back inside an error", () => {
|
|
57
|
+
const log = new RequestLog(dir);
|
|
58
|
+
log.record(record({
|
|
59
|
+
outcome: "error",
|
|
60
|
+
error: "failed to fetch https://x.test/a?token=abc",
|
|
61
|
+
}));
|
|
62
|
+
log.close();
|
|
63
|
+
expect(lines()[0].error).to.contain(REDACTED);
|
|
64
|
+
expect(lines()[0].error).to.not.contain("abc");
|
|
65
|
+
});
|
|
66
|
+
it("keeps the fields that make a record worth having", () => {
|
|
67
|
+
const log = new RequestLog(dir);
|
|
68
|
+
log.record(record({
|
|
69
|
+
outcome: "fulfilled",
|
|
70
|
+
handler: "SpeedKitAssetRequest",
|
|
71
|
+
status: 200,
|
|
72
|
+
durationMs: 12,
|
|
73
|
+
stage: "Response",
|
|
74
|
+
}));
|
|
75
|
+
log.close();
|
|
76
|
+
expect(lines()[0]).to.include({
|
|
77
|
+
outcome: "fulfilled",
|
|
78
|
+
handler: "SpeedKitAssetRequest",
|
|
79
|
+
status: 200,
|
|
80
|
+
durationMs: 12,
|
|
81
|
+
stage: "Response",
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
it("rotates at the cap and keeps one generation", () => {
|
|
85
|
+
const log = new RequestLog(dir, 300);
|
|
86
|
+
for (let index = 0; index < 20; index++) {
|
|
87
|
+
log.record(record({ url: `https://x.test/${index}` }));
|
|
88
|
+
}
|
|
89
|
+
// One more after the loop, because rotation happens *after* a write: the
|
|
90
|
+
// live file can legitimately be absent until the next record arrives.
|
|
91
|
+
log.record(record({ url: "https://x.test/last" }));
|
|
92
|
+
log.close();
|
|
93
|
+
expect(existsSync(join(dir, REQUESTS_PREVIOUS_FILE))).to.equal(true);
|
|
94
|
+
expect(lines(REQUESTS_PREVIOUS_FILE).at(-1).seq).to.be.lessThan(lines()[0].seq);
|
|
95
|
+
});
|
|
96
|
+
it("never throws into the run", () => {
|
|
97
|
+
const log = new RequestLog(join(dir, "nope", "nope"));
|
|
98
|
+
expect(() => log.record(record())).to.not.throw();
|
|
99
|
+
expect(log.error).to.be.a("string");
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { REQUESTS_FILE } from "../request-log.js";
|
|
7
|
+
import { readRequests, renderRequestSummary, summariseRequests, } from "../request-summary.js";
|
|
8
|
+
let seq = 0;
|
|
9
|
+
function record(patch = {}) {
|
|
10
|
+
return {
|
|
11
|
+
seq: ++seq,
|
|
12
|
+
ts: "2026-09-18T08:00:00.000Z",
|
|
13
|
+
url: "https://x.test/",
|
|
14
|
+
method: "GET",
|
|
15
|
+
resourceType: "Document",
|
|
16
|
+
stage: "Request",
|
|
17
|
+
outcome: "continued",
|
|
18
|
+
...patch,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
describe("summariseRequests", () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
seq = 0;
|
|
24
|
+
});
|
|
25
|
+
it("counts what the CLI did with each request", () => {
|
|
26
|
+
const summary = summariseRequests([
|
|
27
|
+
record({ outcome: "fulfilled", handler: "SpeedKitAssetRequest" }),
|
|
28
|
+
record({ outcome: "fulfilled", handler: "SpeedKitAssetRequest" }),
|
|
29
|
+
record({ outcome: "continued" }),
|
|
30
|
+
]);
|
|
31
|
+
expect(summary.byOutcome).to.eql({ fulfilled: 2, continued: 1 });
|
|
32
|
+
expect(summary.byHandler).to.eql({ SpeedKitAssetRequest: 2 });
|
|
33
|
+
});
|
|
34
|
+
it("counts continued requests, which have no other trace anywhere", () => {
|
|
35
|
+
// "What did the CLI *not* take" is the question a disabledScopes or
|
|
36
|
+
// blacklist change is asking, and nothing else in the run records it.
|
|
37
|
+
const summary = summariseRequests([
|
|
38
|
+
record({ outcome: "continued", url: "https://x.test/checkout" }),
|
|
39
|
+
]);
|
|
40
|
+
expect(summary.byOutcome.continued).to.equal(1);
|
|
41
|
+
expect(summary.hotspots[0].url).to.equal("https://x.test/checkout");
|
|
42
|
+
expect(summary.hotspots[0].outcomes).to.eql({ continued: 1 });
|
|
43
|
+
});
|
|
44
|
+
it("keeps every outcome a url had, not just the first", () => {
|
|
45
|
+
// A url served once and handed back to Chrome the next time is the normal
|
|
46
|
+
// case — the atida homepage did exactly this — and naming only the first
|
|
47
|
+
// reports half of the one question this stream answers as all of it.
|
|
48
|
+
const summary = summariseRequests([
|
|
49
|
+
record({
|
|
50
|
+
url: "https://x.test/",
|
|
51
|
+
outcome: "continued",
|
|
52
|
+
}),
|
|
53
|
+
record({
|
|
54
|
+
url: "https://x.test/",
|
|
55
|
+
outcome: "fulfilled",
|
|
56
|
+
handler: "CustomerDomainDocumentResponse",
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
59
|
+
expect(summary.hotspots[0].outcomes).to.eql({
|
|
60
|
+
continued: 1,
|
|
61
|
+
fulfilled: 1,
|
|
62
|
+
});
|
|
63
|
+
expect(summary.hotspots[0].handlers).to.eql([
|
|
64
|
+
"CustomerDomainDocumentResponse",
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
it("shows both outcomes when it renders a mixed url", () => {
|
|
68
|
+
const rendered = renderRequestSummary(summariseRequests([
|
|
69
|
+
record({ url: "https://x.test/", outcome: "continued" }),
|
|
70
|
+
record({ url: "https://x.test/", outcome: "fulfilled" }),
|
|
71
|
+
]));
|
|
72
|
+
expect(rendered).to.contain("continued 1");
|
|
73
|
+
expect(rendered).to.contain("fulfilled 1");
|
|
74
|
+
});
|
|
75
|
+
it("names an outcome without a count when it is the only one", () => {
|
|
76
|
+
const rendered = renderRequestSummary(summariseRequests([
|
|
77
|
+
record({ url: "https://x.test/a", outcome: "continued" }),
|
|
78
|
+
]));
|
|
79
|
+
expect(rendered).to.contain("(continued)");
|
|
80
|
+
});
|
|
81
|
+
it("ranks the urls it saw most", () => {
|
|
82
|
+
const summary = summariseRequests([
|
|
83
|
+
record({ url: "https://x.test/a" }),
|
|
84
|
+
record({ url: "https://x.test/a" }),
|
|
85
|
+
record({ url: "https://x.test/b" }),
|
|
86
|
+
]);
|
|
87
|
+
expect(summary.hotspots.map((spot) => [spot.url, spot.count])).to.eql([
|
|
88
|
+
["https://x.test/a", 2],
|
|
89
|
+
["https://x.test/b", 1],
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
it("puts the slowest first, and only counts what was timed", () => {
|
|
93
|
+
const summary = summariseRequests([
|
|
94
|
+
record({ url: "https://x.test/slow", durationMs: 900 }),
|
|
95
|
+
record({ url: "https://x.test/quick", durationMs: 4 }),
|
|
96
|
+
record({ url: "https://x.test/untimed" }),
|
|
97
|
+
]);
|
|
98
|
+
expect(summary.slowest.map((entry) => entry.url)).to.eql([
|
|
99
|
+
"https://x.test/slow",
|
|
100
|
+
"https://x.test/quick",
|
|
101
|
+
]);
|
|
102
|
+
});
|
|
103
|
+
it("collapses a repeated failure of the same url", () => {
|
|
104
|
+
const summary = summariseRequests([
|
|
105
|
+
record({
|
|
106
|
+
outcome: "error",
|
|
107
|
+
url: "https://x.test/a",
|
|
108
|
+
error: "ECONNRESET",
|
|
109
|
+
}),
|
|
110
|
+
record({
|
|
111
|
+
outcome: "error",
|
|
112
|
+
url: "https://x.test/a",
|
|
113
|
+
error: "ECONNRESET",
|
|
114
|
+
}),
|
|
115
|
+
record({
|
|
116
|
+
outcome: "error",
|
|
117
|
+
url: "https://x.test/b",
|
|
118
|
+
error: "ECONNRESET",
|
|
119
|
+
}),
|
|
120
|
+
]);
|
|
121
|
+
expect(summary.errors).to.eql([
|
|
122
|
+
{ url: "https://x.test/a", error: "ECONNRESET", count: 2 },
|
|
123
|
+
{ url: "https://x.test/b", error: "ECONNRESET", count: 1 },
|
|
124
|
+
]);
|
|
125
|
+
});
|
|
126
|
+
it("renders nothing for a run that intercepted nothing", () => {
|
|
127
|
+
// An empty block in the summary would read as "the requests were fine".
|
|
128
|
+
expect(renderRequestSummary(summariseRequests([]))).to.equal("");
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
describe("readRequests", () => {
|
|
132
|
+
let dir;
|
|
133
|
+
beforeEach(() => {
|
|
134
|
+
dir = mkdtempSync(join(tmpdir(), "sk-request-read-"));
|
|
135
|
+
seq = 0;
|
|
136
|
+
});
|
|
137
|
+
afterEach(() => {
|
|
138
|
+
rmSync(dir, { recursive: true, force: true });
|
|
139
|
+
});
|
|
140
|
+
const write = (records) => writeFileSync(join(dir, REQUESTS_FILE), `${records.map((entry) => JSON.stringify(entry)).join("\n")}\n`);
|
|
141
|
+
it("filters by outcome, handler, type and url", () => {
|
|
142
|
+
write([
|
|
143
|
+
record({ outcome: "fulfilled", handler: "A", url: "https://x.test/a" }),
|
|
144
|
+
record({ outcome: "continued", url: "https://x.test/b" }),
|
|
145
|
+
record({
|
|
146
|
+
outcome: "fulfilled",
|
|
147
|
+
handler: "B",
|
|
148
|
+
resourceType: "Script",
|
|
149
|
+
url: "https://x.test/c",
|
|
150
|
+
}),
|
|
151
|
+
]);
|
|
152
|
+
expect(readRequests(dir, { outcome: "fulfilled" }).records.map((r) => r.seq)).to.eql([1, 3]);
|
|
153
|
+
expect(readRequests(dir, { handler: "B" }).records.map((r) => r.seq)).to.eql([3]);
|
|
154
|
+
expect(readRequests(dir, { resourceType: "Script" }).records.map((r) => r.seq)).to.eql([3]);
|
|
155
|
+
expect(readRequests(dir, { url: "/b" }).records.map((r) => r.seq)).to.eql([
|
|
156
|
+
2,
|
|
157
|
+
]);
|
|
158
|
+
});
|
|
159
|
+
it("reports the total behind a tail, and the newest cursor", () => {
|
|
160
|
+
write([record(), record(), record(), record()]);
|
|
161
|
+
const result = readRequests(dir, { tail: 2 });
|
|
162
|
+
expect(result.records).to.have.length(2);
|
|
163
|
+
expect(result.total).to.equal(4);
|
|
164
|
+
expect(result.truncated).to.equal(true);
|
|
165
|
+
expect(result.lastSeq).to.equal(4);
|
|
166
|
+
});
|
|
167
|
+
it("returns nothing for a run that recorded no requests", () => {
|
|
168
|
+
expect(readRequests(dir).records).to.eql([]);
|
|
169
|
+
expect(readRequests(dir).lastSeq).to.equal(0);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { LOG_FILE, LOG_PREVIOUS_FILE, RunLog } from "../run-log.js";
|
|
7
|
+
import { REDACTED } from "../redaction.js";
|
|
8
|
+
/** What chalk leaves in a message: colour on, text, colour off. */
|
|
9
|
+
const ESC = String.fromCodePoint(27);
|
|
10
|
+
const YELLOW = (text) => `${ESC}[33m${text}${ESC}[39m`;
|
|
11
|
+
describe("RunLog", () => {
|
|
12
|
+
let dir;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
dir = mkdtempSync(join(tmpdir(), "sk-run-log-"));
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
rmSync(dir, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
const lines = (file = LOG_FILE) => readFileSync(join(dir, file), "utf8")
|
|
20
|
+
.split("\n")
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.map((line) => JSON.parse(line));
|
|
23
|
+
it("appends one JSON object per event, numbered from one", () => {
|
|
24
|
+
const log = new RunLog(dir);
|
|
25
|
+
log.event({ level: "info", msg: "first" });
|
|
26
|
+
log.event({ level: "error", msg: "second" });
|
|
27
|
+
log.close();
|
|
28
|
+
expect(lines().map((event) => [event.seq, event.level, event.msg])).to.eql([
|
|
29
|
+
[1, "info", "first"],
|
|
30
|
+
[2, "error", "second"],
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
it("defaults the scope rather than leaving it out", () => {
|
|
34
|
+
const log = new RunLog(dir);
|
|
35
|
+
log.event({ level: "info", msg: "unannotated" });
|
|
36
|
+
log.close();
|
|
37
|
+
expect(lines()[0].scope).to.equal("cli");
|
|
38
|
+
});
|
|
39
|
+
it("strips the colours the message was composed with", () => {
|
|
40
|
+
const log = new RunLog(dir);
|
|
41
|
+
log.event({ level: "warn", msg: YELLOW("took over") });
|
|
42
|
+
log.close();
|
|
43
|
+
// Every message in this CLI arrives styled; a log that kept the escapes
|
|
44
|
+
// would break every `grep` run against it.
|
|
45
|
+
expect(lines()[0].msg).to.equal("took over");
|
|
46
|
+
});
|
|
47
|
+
it("trims a message that arrived with trailing whitespace", () => {
|
|
48
|
+
// `browserVersionString` keeps the newline `execSync` returned, so this
|
|
49
|
+
// reached the file as "…47 \n" and printed a stray blank line.
|
|
50
|
+
const log = new RunLog(dir);
|
|
51
|
+
log.event({
|
|
52
|
+
level: "info",
|
|
53
|
+
msg: "prepare browser Chrome 153.0.8010.47 \n",
|
|
54
|
+
});
|
|
55
|
+
log.close();
|
|
56
|
+
expect(lines()[0].msg).to.equal("prepare browser Chrome 153.0.8010.47");
|
|
57
|
+
});
|
|
58
|
+
it("withholds a secret that arrived inside a url", () => {
|
|
59
|
+
const log = new RunLog(dir);
|
|
60
|
+
log.event({
|
|
61
|
+
level: "info",
|
|
62
|
+
msg: "fetched https://example.com/a?token=abc123&page=2",
|
|
63
|
+
});
|
|
64
|
+
log.close();
|
|
65
|
+
expect(lines()[0].msg).to.equal(`fetched https://example.com/a?token=${REDACTED}&page=2`);
|
|
66
|
+
});
|
|
67
|
+
it("withholds a sensitive field in data", () => {
|
|
68
|
+
const log = new RunLog(dir);
|
|
69
|
+
log.event({
|
|
70
|
+
level: "info",
|
|
71
|
+
msg: "authenticated",
|
|
72
|
+
data: { user: "someone", password: "hunter2" },
|
|
73
|
+
});
|
|
74
|
+
log.close();
|
|
75
|
+
expect(lines()[0].data).to.eql({ user: "someone", password: REDACTED });
|
|
76
|
+
});
|
|
77
|
+
it("keeps the question of a pending interaction and no answer", () => {
|
|
78
|
+
const log = new RunLog(dir);
|
|
79
|
+
log.event({
|
|
80
|
+
level: "info",
|
|
81
|
+
msg: "Start anyway?",
|
|
82
|
+
interaction: {
|
|
83
|
+
kind: "confirm",
|
|
84
|
+
question: "Start anyway?",
|
|
85
|
+
pending: true,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
log.close();
|
|
89
|
+
const [event] = lines();
|
|
90
|
+
expect(event.interaction?.pending).to.equal(true);
|
|
91
|
+
expect(event.interaction).to.not.have.property("answer");
|
|
92
|
+
});
|
|
93
|
+
it("rotates at the cap and keeps one generation", () => {
|
|
94
|
+
const log = new RunLog(dir, 200);
|
|
95
|
+
for (let index = 0; index < 20; index++) {
|
|
96
|
+
log.event({ level: "info", msg: `message ${index}` });
|
|
97
|
+
}
|
|
98
|
+
log.close();
|
|
99
|
+
expect(existsSync(join(dir, LOG_PREVIOUS_FILE))).to.equal(true);
|
|
100
|
+
expect(existsSync(join(dir, LOG_FILE))).to.equal(true);
|
|
101
|
+
});
|
|
102
|
+
it("keeps counting sequence numbers across a rotation", () => {
|
|
103
|
+
const log = new RunLog(dir, 200);
|
|
104
|
+
for (let index = 0; index < 20; index++) {
|
|
105
|
+
log.event({ level: "info", msg: `message ${index}` });
|
|
106
|
+
}
|
|
107
|
+
log.close();
|
|
108
|
+
// A reader tailing from seq 12 must not be handed the start of the run
|
|
109
|
+
// again because the file underneath it turned over. Only the newest
|
|
110
|
+
// generation is kept, so the two files are not contiguous — what has to
|
|
111
|
+
// hold is that the numbering never goes backwards.
|
|
112
|
+
const previous = lines(LOG_PREVIOUS_FILE);
|
|
113
|
+
const current = lines();
|
|
114
|
+
expect(previous.at(-1).seq).to.be.lessThan(current[0].seq);
|
|
115
|
+
expect(current.map((event) => event.seq)).to.eql(current.map((_, index) => current[0].seq + index));
|
|
116
|
+
});
|
|
117
|
+
it("never throws into the run, and says once what went wrong", () => {
|
|
118
|
+
const log = new RunLog(join(dir, "does", "not", "exist"));
|
|
119
|
+
expect(() => log.event({ level: "info", msg: "anything" })).to.not.throw();
|
|
120
|
+
expect(log.error).to.be.a("string");
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RunStatus } from "./run-registry-model.js";
|
|
2
|
+
export interface ExitFacts {
|
|
3
|
+
/** A shutdown signal reached the CLI's own handler. */
|
|
4
|
+
stopping: boolean;
|
|
5
|
+
/** Which one, when one did. */
|
|
6
|
+
signal?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the onboarding run returned before the process began exiting.
|
|
9
|
+
*
|
|
10
|
+
* This is the fact that separates "ended by itself" from "the process went
|
|
11
|
+
* away underneath it", which otherwise look identical: both leave a zero exit
|
|
12
|
+
* code and no signal.
|
|
13
|
+
*/
|
|
14
|
+
runReturned: boolean;
|
|
15
|
+
/** The process exit code, where one is known. */
|
|
16
|
+
code?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ExitOutcome {
|
|
19
|
+
status: Exclude<RunStatus, "running" | "crashed">;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What to record about a run that is ending.
|
|
24
|
+
*
|
|
25
|
+
* Pulled out of the command because it has been wrong twice: once calling a
|
|
26
|
+
* deliberate Ctrl+C a failure, and once calling a process that vanished
|
|
27
|
+
* mid-run a clean finish. It is four booleans of policy and no I/O, so it is
|
|
28
|
+
* worth being able to state each case as a test rather than reasoning about it
|
|
29
|
+
* again from a screenshot of `meta.json`.
|
|
30
|
+
*
|
|
31
|
+
* The cases, in the order they are decided:
|
|
32
|
+
*
|
|
33
|
+
* 1. A signal reached us. The run was asked to stop, whatever happened after.
|
|
34
|
+
* 2. The run never returned. The process exited out from under it — a zero code
|
|
35
|
+
* here is not a clean finish, it means the event loop simply ran dry, which
|
|
36
|
+
* happens when the browser and every watcher have gone.
|
|
37
|
+
* 3. The run returned. A zero code is `finished`; anything else failed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function classifyExit(facts: ExitFacts): ExitOutcome;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What to record about a run that is ending.
|
|
3
|
+
*
|
|
4
|
+
* Pulled out of the command because it has been wrong twice: once calling a
|
|
5
|
+
* deliberate Ctrl+C a failure, and once calling a process that vanished
|
|
6
|
+
* mid-run a clean finish. It is four booleans of policy and no I/O, so it is
|
|
7
|
+
* worth being able to state each case as a test rather than reasoning about it
|
|
8
|
+
* again from a screenshot of `meta.json`.
|
|
9
|
+
*
|
|
10
|
+
* The cases, in the order they are decided:
|
|
11
|
+
*
|
|
12
|
+
* 1. A signal reached us. The run was asked to stop, whatever happened after.
|
|
13
|
+
* 2. The run never returned. The process exited out from under it — a zero code
|
|
14
|
+
* here is not a clean finish, it means the event loop simply ran dry, which
|
|
15
|
+
* happens when the browser and every watcher have gone.
|
|
16
|
+
* 3. The run returned. A zero code is `finished`; anything else failed.
|
|
17
|
+
*/
|
|
18
|
+
export function classifyExit(facts) {
|
|
19
|
+
if (facts.stopping) {
|
|
20
|
+
return {
|
|
21
|
+
status: "stopped",
|
|
22
|
+
error: facts.signal ? `received ${facts.signal}` : undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!facts.runReturned) {
|
|
26
|
+
return facts.code === 0
|
|
27
|
+
? {
|
|
28
|
+
status: "stopped",
|
|
29
|
+
error: "the process exited before the run finished",
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
status: "failed",
|
|
33
|
+
error: `process exited with code ${facts.code} before the run finished`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return facts.code === 0 || facts.code === undefined
|
|
37
|
+
? { status: "finished" }
|
|
38
|
+
: {
|
|
39
|
+
status: "failed",
|
|
40
|
+
error: `process exited with code ${facts.code}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Something that tells one incarnation of a pid from the next.
|
|
3
|
+
*
|
|
4
|
+
* A pid on its own cannot answer "is my run still running". Pids are recycled,
|
|
5
|
+
* and a long-lived run directory outlives several rounds of recycling, so a
|
|
6
|
+
* dead run whose number came up again reads as alive. What distinguishes them
|
|
7
|
+
* is *when* the process started: the kernel will hand out the number again, but
|
|
8
|
+
* not the instant.
|
|
9
|
+
*
|
|
10
|
+
* Returns `null` where the platform gives us nothing to ask — the caller then
|
|
11
|
+
* falls back to the pid alone rather than guessing, see
|
|
12
|
+
* {@link sameProcess}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function processStartToken(pid: number): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a pid that is alive now is the same process that recorded `expected`.
|
|
17
|
+
*
|
|
18
|
+
* Only a *mismatch* is treated as evidence. When either side has no token —
|
|
19
|
+
* an older run directory, or a platform that cannot tell us — the answer stays
|
|
20
|
+
* whatever the pid said. Absence of evidence is not evidence: hiding a live run
|
|
21
|
+
* because we could not confirm it would make the user's actual session
|
|
22
|
+
* invisible, which is worse than the failure we are guarding against, and that
|
|
23
|
+
* one announces itself the moment anything tries to talk to the run.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sameProcess(pid: number, expected: string | undefined): {
|
|
26
|
+
same: boolean;
|
|
27
|
+
verified: boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
/**
|
|
4
|
+
* Something that tells one incarnation of a pid from the next.
|
|
5
|
+
*
|
|
6
|
+
* A pid on its own cannot answer "is my run still running". Pids are recycled,
|
|
7
|
+
* and a long-lived run directory outlives several rounds of recycling, so a
|
|
8
|
+
* dead run whose number came up again reads as alive. What distinguishes them
|
|
9
|
+
* is *when* the process started: the kernel will hand out the number again, but
|
|
10
|
+
* not the instant.
|
|
11
|
+
*
|
|
12
|
+
* Returns `null` where the platform gives us nothing to ask — the caller then
|
|
13
|
+
* falls back to the pid alone rather than guessing, see
|
|
14
|
+
* {@link sameProcess}.
|
|
15
|
+
*/
|
|
16
|
+
export function processStartToken(pid) {
|
|
17
|
+
switch (process.platform) {
|
|
18
|
+
case "linux": {
|
|
19
|
+
return linuxStartToken(pid);
|
|
20
|
+
}
|
|
21
|
+
case "darwin": {
|
|
22
|
+
return darwinStartToken(pid);
|
|
23
|
+
}
|
|
24
|
+
default: {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether a pid that is alive now is the same process that recorded `expected`.
|
|
31
|
+
*
|
|
32
|
+
* Only a *mismatch* is treated as evidence. When either side has no token —
|
|
33
|
+
* an older run directory, or a platform that cannot tell us — the answer stays
|
|
34
|
+
* whatever the pid said. Absence of evidence is not evidence: hiding a live run
|
|
35
|
+
* because we could not confirm it would make the user's actual session
|
|
36
|
+
* invisible, which is worse than the failure we are guarding against, and that
|
|
37
|
+
* one announces itself the moment anything tries to talk to the run.
|
|
38
|
+
*/
|
|
39
|
+
export function sameProcess(pid, expected) {
|
|
40
|
+
if (!expected) {
|
|
41
|
+
return { same: true, verified: false };
|
|
42
|
+
}
|
|
43
|
+
const actual = processStartToken(pid);
|
|
44
|
+
if (actual === null) {
|
|
45
|
+
return { same: true, verified: false };
|
|
46
|
+
}
|
|
47
|
+
return { same: actual === expected, verified: true };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Field 22 of `/proc/<pid>/stat` — the process start time in clock ticks since
|
|
51
|
+
* boot.
|
|
52
|
+
*
|
|
53
|
+
* Parsed from after the last `)` because field 2 is the executable name, which
|
|
54
|
+
* is unquoted and may itself contain spaces and parentheses. Everything before
|
|
55
|
+
* that closing bracket is therefore unsplittable, and everything after it is
|
|
56
|
+
* plain numbers: index 0 is field 3, so field 22 is index 19.
|
|
57
|
+
*/
|
|
58
|
+
function linuxStartToken(pid) {
|
|
59
|
+
try {
|
|
60
|
+
const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
61
|
+
const fields = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
62
|
+
return fields[19] ?? null;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** `ps` is the only way in without a native module. One-second granularity. */
|
|
69
|
+
function darwinStartToken(pid) {
|
|
70
|
+
try {
|
|
71
|
+
const out = execFileSync("ps", ["-p", String(pid), "-o", "lstart="], {
|
|
72
|
+
encoding: "utf8",
|
|
73
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
74
|
+
});
|
|
75
|
+
return out.trim() || null;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|