@speedkit/cli 4.50.4 → 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/CHANGELOG.md +7 -0
- 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/customer-domain-document-response.js +4 -25
- 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/html-charset.d.ts +28 -0
- package/dist/services/onboarding/html-charset.js +57 -0
- package/dist/services/onboarding/onboarding-model.d.ts +30 -1
- package/dist/services/onboarding/onboarding-model.js +10 -1
- 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/customer-domain-document-response.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/customer-domain-document-response.spec.js +39 -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/html-charset.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/html-charset.spec.js +58 -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/spec/virtual-orestes-app/index.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/index.spec.js +19 -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 +85 -53
- 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 +21 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LogEvent, LogLevel } from "./log-event-model.js";
|
|
2
|
+
/**
|
|
3
|
+
* A repeated message, collapsed.
|
|
4
|
+
*
|
|
5
|
+
* The count and the time span are the point: "failed to fetch" once at startup
|
|
6
|
+
* and "failed to fetch" 400 times across the whole run are different problems,
|
|
7
|
+
* and a log read line by line makes them look the same.
|
|
8
|
+
*/
|
|
9
|
+
export interface LogProblem {
|
|
10
|
+
level: LogLevel;
|
|
11
|
+
/** The normalised form messages were grouped by. */
|
|
12
|
+
pattern: string;
|
|
13
|
+
/** One real message from the group, unnormalised. */
|
|
14
|
+
example: string;
|
|
15
|
+
count: number;
|
|
16
|
+
firstAt: string;
|
|
17
|
+
lastAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface LogSummary {
|
|
20
|
+
events: number;
|
|
21
|
+
span: {
|
|
22
|
+
from?: string;
|
|
23
|
+
to?: string;
|
|
24
|
+
durationMs?: number;
|
|
25
|
+
};
|
|
26
|
+
byLevel: Record<string, number>;
|
|
27
|
+
byScope: Record<string, number>;
|
|
28
|
+
/** Warnings and errors, deduplicated, worst and most frequent first. */
|
|
29
|
+
problems: LogProblem[];
|
|
30
|
+
/** Actions that ended in failure, in order. */
|
|
31
|
+
failedActions: {
|
|
32
|
+
name: string;
|
|
33
|
+
msg: string;
|
|
34
|
+
at: string;
|
|
35
|
+
}[];
|
|
36
|
+
/** Questions the run asked, and what it got. */
|
|
37
|
+
interactions: {
|
|
38
|
+
question: string;
|
|
39
|
+
answer?: unknown;
|
|
40
|
+
defaulted?: boolean;
|
|
41
|
+
unanswered?: boolean;
|
|
42
|
+
}[];
|
|
43
|
+
/**
|
|
44
|
+
* Histograms over structured fields, for the fields that were annotated.
|
|
45
|
+
*
|
|
46
|
+
* Empty is a statement about the producers, not about the run: a field only
|
|
47
|
+
* appears here once the code that emits the line passes it as `data`. Until
|
|
48
|
+
* then the run happened, and the log simply does not know its shape.
|
|
49
|
+
*/
|
|
50
|
+
histograms: Record<string, Record<string, number>>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Compress a run to something readable in one screen.
|
|
54
|
+
*
|
|
55
|
+
* This is the mode that makes a log useful to an agent: a session of tens of
|
|
56
|
+
* thousands of lines becomes a few hundred tokens, and the question "what
|
|
57
|
+
* happened in this run" gets an answer without reading the run. Everything
|
|
58
|
+
* here is derived — nothing is summarised that could not be re-derived from
|
|
59
|
+
* the events, so a surprising summary can always be checked against the log.
|
|
60
|
+
*/
|
|
61
|
+
export declare function summariseLog(events: LogEvent[]): LogSummary;
|
|
62
|
+
/**
|
|
63
|
+
* Collapse the parts of a message that vary per occurrence.
|
|
64
|
+
*
|
|
65
|
+
* Deliberately shallow: query strings and numbers, nothing else. Aggressive
|
|
66
|
+
* normalisation merges two genuinely different failures into one line and
|
|
67
|
+
* hides the second, which costs far more than reporting one problem twice —
|
|
68
|
+
* and `example` keeps a real message in view either way.
|
|
69
|
+
*/
|
|
70
|
+
export declare function normalise(message: string): string;
|
|
71
|
+
/** The summary as a human reads it. `sk onboarding logs --summary` prints this. */
|
|
72
|
+
export declare function renderSummary(summary: LogSummary): string;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { LOG_LEVELS } from "./log-event-model.js";
|
|
2
|
+
/** `data` keys worth counting across a whole run. */
|
|
3
|
+
const COUNTED_FIELDS = [
|
|
4
|
+
"responseCause",
|
|
5
|
+
"responseSource",
|
|
6
|
+
"status",
|
|
7
|
+
"versionId",
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Compress a run to something readable in one screen.
|
|
11
|
+
*
|
|
12
|
+
* This is the mode that makes a log useful to an agent: a session of tens of
|
|
13
|
+
* thousands of lines becomes a few hundred tokens, and the question "what
|
|
14
|
+
* happened in this run" gets an answer without reading the run. Everything
|
|
15
|
+
* here is derived — nothing is summarised that could not be re-derived from
|
|
16
|
+
* the events, so a surprising summary can always be checked against the log.
|
|
17
|
+
*/
|
|
18
|
+
export function summariseLog(events) {
|
|
19
|
+
const byLevel = {};
|
|
20
|
+
const byScope = {};
|
|
21
|
+
const histograms = {};
|
|
22
|
+
const groups = new Map();
|
|
23
|
+
const failedActions = [];
|
|
24
|
+
const interactions = [];
|
|
25
|
+
for (const event of events) {
|
|
26
|
+
byLevel[event.level] = (byLevel[event.level] ?? 0) + 1;
|
|
27
|
+
byScope[event.scope] = (byScope[event.scope] ?? 0) + 1;
|
|
28
|
+
for (const field of COUNTED_FIELDS) {
|
|
29
|
+
const value = event.data?.[field];
|
|
30
|
+
if (value === undefined || value === null) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
histograms[field] ??= {};
|
|
34
|
+
const key = String(value);
|
|
35
|
+
histograms[field][key] = (histograms[field][key] ?? 0) + 1;
|
|
36
|
+
}
|
|
37
|
+
if (event.level === "warn" || event.level === "error") {
|
|
38
|
+
collect(groups, event);
|
|
39
|
+
}
|
|
40
|
+
if (event.action?.state === "fail") {
|
|
41
|
+
failedActions.push({
|
|
42
|
+
name: event.action.name,
|
|
43
|
+
msg: event.msg,
|
|
44
|
+
at: event.ts,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Only the resolved half of a prompt is reported, except where there never
|
|
48
|
+
// was one — a question still pending at the end of the log is why the run
|
|
49
|
+
// stopped where it did, and is worth more than any answered one.
|
|
50
|
+
if (event.interaction && !event.interaction.pending) {
|
|
51
|
+
interactions.push({
|
|
52
|
+
question: event.interaction.question,
|
|
53
|
+
answer: event.interaction.answer,
|
|
54
|
+
defaulted: event.interaction.defaulted,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const pending of unansweredQuestions(events)) {
|
|
59
|
+
interactions.push({ question: pending, unanswered: true });
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
events: events.length,
|
|
63
|
+
span: span(events),
|
|
64
|
+
byLevel: ordered(byLevel),
|
|
65
|
+
byScope: byScope,
|
|
66
|
+
problems: [...groups.values()].sort((a, b) => rank(b.level) - rank(a.level) ||
|
|
67
|
+
b.count - a.count ||
|
|
68
|
+
a.firstAt.localeCompare(b.firstAt)),
|
|
69
|
+
failedActions,
|
|
70
|
+
interactions,
|
|
71
|
+
histograms,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function rank(level) {
|
|
75
|
+
return level === "error" ? 1 : 0;
|
|
76
|
+
}
|
|
77
|
+
/** Levels in their natural order, and only the ones that occurred. */
|
|
78
|
+
function ordered(counts) {
|
|
79
|
+
const out = {};
|
|
80
|
+
for (const level of LOG_LEVELS) {
|
|
81
|
+
if (counts[level]) {
|
|
82
|
+
out[level] = counts[level];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
function span(events) {
|
|
88
|
+
if (events.length === 0) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
const from = events[0].ts;
|
|
92
|
+
const to = events[events.length - 1].ts;
|
|
93
|
+
return { from, to, durationMs: Date.parse(to) - Date.parse(from) };
|
|
94
|
+
}
|
|
95
|
+
function collect(groups, event) {
|
|
96
|
+
const pattern = normalise(event.msg);
|
|
97
|
+
const existing = groups.get(pattern);
|
|
98
|
+
if (existing) {
|
|
99
|
+
existing.count += 1;
|
|
100
|
+
existing.lastAt = event.ts;
|
|
101
|
+
// An error outranks a warning that happened to normalise the same way.
|
|
102
|
+
if (event.level === "error") {
|
|
103
|
+
existing.level = "error";
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
groups.set(pattern, {
|
|
108
|
+
level: event.level,
|
|
109
|
+
pattern,
|
|
110
|
+
example: event.msg,
|
|
111
|
+
count: 1,
|
|
112
|
+
firstAt: event.ts,
|
|
113
|
+
lastAt: event.ts,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Collapse the parts of a message that vary per occurrence.
|
|
118
|
+
*
|
|
119
|
+
* Deliberately shallow: query strings and numbers, nothing else. Aggressive
|
|
120
|
+
* normalisation merges two genuinely different failures into one line and
|
|
121
|
+
* hides the second, which costs far more than reporting one problem twice —
|
|
122
|
+
* and `example` keeps a real message in view either way.
|
|
123
|
+
*/
|
|
124
|
+
export function normalise(message) {
|
|
125
|
+
return message
|
|
126
|
+
.replaceAll(/\?[^\s"']*/g, "?…")
|
|
127
|
+
.replaceAll(/\b\d{2,}\b/g, "#")
|
|
128
|
+
.trim();
|
|
129
|
+
}
|
|
130
|
+
/** Questions asked but never resolved — at most one, at the end. */
|
|
131
|
+
function unansweredQuestions(events) {
|
|
132
|
+
const pending = new Map();
|
|
133
|
+
for (const event of events) {
|
|
134
|
+
const interaction = event.interaction;
|
|
135
|
+
if (!interaction) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (interaction.pending) {
|
|
139
|
+
pending.set(interaction.question, (pending.get(interaction.question) ?? 0) + 1);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
const open = pending.get(interaction.question) ?? 0;
|
|
143
|
+
if (open <= 1) {
|
|
144
|
+
pending.delete(interaction.question);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
pending.set(interaction.question, open - 1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return [...pending.keys()];
|
|
152
|
+
}
|
|
153
|
+
/** The summary as a human reads it. `sk onboarding logs --summary` prints this. */
|
|
154
|
+
export function renderSummary(summary) {
|
|
155
|
+
const lines = [];
|
|
156
|
+
const { span: range } = summary;
|
|
157
|
+
lines.push(`${summary.events} events${range.from ? ` from ${range.from} over ${duration(range.durationMs)}` : ""}`);
|
|
158
|
+
lines.push(` levels: ${describe(summary.byLevel)}`, ` scopes: ${describe(summary.byScope)}`);
|
|
159
|
+
if (summary.problems.length > 0) {
|
|
160
|
+
lines.push("", `problems (${summary.problems.length} distinct):`);
|
|
161
|
+
for (const problem of summary.problems) {
|
|
162
|
+
lines.push(` [${problem.level}] ×${problem.count} ${problem.example}${problem.count > 1
|
|
163
|
+
? ` (first ${problem.firstAt}, last ${problem.lastAt})`
|
|
164
|
+
: ""}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (summary.failedActions.length > 0) {
|
|
168
|
+
lines.push("", "failed actions:");
|
|
169
|
+
for (const action of summary.failedActions) {
|
|
170
|
+
lines.push(` ${action.name}: ${action.msg}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const [field, counts] of Object.entries(summary.histograms)) {
|
|
174
|
+
lines.push("", `${field}:`);
|
|
175
|
+
for (const [value, count] of Object.entries(counts).sort((a, b) => b[1] - a[1])) {
|
|
176
|
+
lines.push(` ${value}: ${count}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (summary.interactions.length > 0) {
|
|
180
|
+
lines.push("", "questions asked:");
|
|
181
|
+
for (const interaction of summary.interactions) {
|
|
182
|
+
const answer = interaction.unanswered
|
|
183
|
+
? "(never answered — the run ended here)"
|
|
184
|
+
: `${JSON.stringify(interaction.answer)}${interaction.defaulted ? " (default)" : ""}`;
|
|
185
|
+
lines.push(` ${interaction.question} → ${answer}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return lines.join("\n");
|
|
189
|
+
}
|
|
190
|
+
function describe(counts) {
|
|
191
|
+
const entries = Object.entries(counts);
|
|
192
|
+
return entries.length === 0
|
|
193
|
+
? "none"
|
|
194
|
+
: entries.map(([key, count]) => `${key} ${count}`).join(", ");
|
|
195
|
+
}
|
|
196
|
+
function duration(ms) {
|
|
197
|
+
if (ms === undefined) {
|
|
198
|
+
return "an unknown span";
|
|
199
|
+
}
|
|
200
|
+
if (ms < 1000) {
|
|
201
|
+
return `${ms} ms`;
|
|
202
|
+
}
|
|
203
|
+
const seconds = Math.round(ms / 1000);
|
|
204
|
+
if (seconds < 120) {
|
|
205
|
+
return `${seconds} s`;
|
|
206
|
+
}
|
|
207
|
+
return `${Math.round(seconds / 60)} min`;
|
|
208
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeping secrets out of a file an agent is invited to read.
|
|
3
|
+
*
|
|
4
|
+
* Onboarding handles app tokens, basic-auth credentials, cookies and signed
|
|
5
|
+
* URLs. None of that was ever written to disk while the only output was a
|
|
6
|
+
* terminal; a log file changes that, and it changes it for a file whose entire
|
|
7
|
+
* purpose is to be read by something other than the person who started the run.
|
|
8
|
+
*
|
|
9
|
+
* Two rules decide the design:
|
|
10
|
+
*
|
|
11
|
+
* - **Redact at the sink, not at the reader.** A secret that reaches the file
|
|
12
|
+
* has already leaked — the file gets copied into a bug report, or read by an
|
|
13
|
+
* agent, or synced. There is no second chance at the query layer.
|
|
14
|
+
* - **Know, do not guess.** What is sensitive is declared at the call site
|
|
15
|
+
* (`{ sensitive: true }` on a prompt), because a redactor that infers from
|
|
16
|
+
* prompt wording will eventually infer wrong in the direction that writes a
|
|
17
|
+
* password to disk. The patterns below are the backstop for values that
|
|
18
|
+
* arrive inside a url or a header the caller never looked at, not the
|
|
19
|
+
* primary mechanism.
|
|
20
|
+
*/
|
|
21
|
+
/** What replaces a value that was withheld. Recognisable, and never a valid token. */
|
|
22
|
+
export declare const REDACTED = "[redacted]";
|
|
23
|
+
/** Withhold secrets that travelled inside a string. */
|
|
24
|
+
export declare function redactText(text: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Copy `data`, withholding what should not be on disk.
|
|
27
|
+
*
|
|
28
|
+
* Copies rather than mutating: the caller is usually logging an object it is
|
|
29
|
+
* still using, and a redactor that edited it in place would blank a field the
|
|
30
|
+
* run then went on to need. Cycles and depth are bounded because `data` is
|
|
31
|
+
* whatever a producer passed, which at some point will be a puppeteer object
|
|
32
|
+
* with a parent pointer.
|
|
33
|
+
*/
|
|
34
|
+
export declare function redactData(data: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeping secrets out of a file an agent is invited to read.
|
|
3
|
+
*
|
|
4
|
+
* Onboarding handles app tokens, basic-auth credentials, cookies and signed
|
|
5
|
+
* URLs. None of that was ever written to disk while the only output was a
|
|
6
|
+
* terminal; a log file changes that, and it changes it for a file whose entire
|
|
7
|
+
* purpose is to be read by something other than the person who started the run.
|
|
8
|
+
*
|
|
9
|
+
* Two rules decide the design:
|
|
10
|
+
*
|
|
11
|
+
* - **Redact at the sink, not at the reader.** A secret that reaches the file
|
|
12
|
+
* has already leaked — the file gets copied into a bug report, or read by an
|
|
13
|
+
* agent, or synced. There is no second chance at the query layer.
|
|
14
|
+
* - **Know, do not guess.** What is sensitive is declared at the call site
|
|
15
|
+
* (`{ sensitive: true }` on a prompt), because a redactor that infers from
|
|
16
|
+
* prompt wording will eventually infer wrong in the direction that writes a
|
|
17
|
+
* password to disk. The patterns below are the backstop for values that
|
|
18
|
+
* arrive inside a url or a header the caller never looked at, not the
|
|
19
|
+
* primary mechanism.
|
|
20
|
+
*/
|
|
21
|
+
/** What replaces a value that was withheld. Recognisable, and never a valid token. */
|
|
22
|
+
export const REDACTED = "[redacted]";
|
|
23
|
+
/**
|
|
24
|
+
* Object keys whose value is withheld wherever it appears in `data`.
|
|
25
|
+
*
|
|
26
|
+
* Matched case-insensitively against the key with separators removed, so
|
|
27
|
+
* `app_token`, `appToken` and `APP-TOKEN` are one entry.
|
|
28
|
+
*/
|
|
29
|
+
const SENSITIVE_KEYS = new Set([
|
|
30
|
+
"authorization",
|
|
31
|
+
"auth",
|
|
32
|
+
"cookie",
|
|
33
|
+
"setcookie",
|
|
34
|
+
"credentials",
|
|
35
|
+
"password",
|
|
36
|
+
"passwd",
|
|
37
|
+
"pwd",
|
|
38
|
+
"secret",
|
|
39
|
+
"token",
|
|
40
|
+
"apptoken",
|
|
41
|
+
"bat",
|
|
42
|
+
"apikey",
|
|
43
|
+
"accesstoken",
|
|
44
|
+
"refreshtoken",
|
|
45
|
+
"signature",
|
|
46
|
+
"sig",
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Query parameters whose value is withheld inside any string.
|
|
50
|
+
*
|
|
51
|
+
* A signed url is the common way a secret travels through a message that looks
|
|
52
|
+
* entirely innocent — the caller is logging "fetched <url>" and has no idea the
|
|
53
|
+
* url carries a signature.
|
|
54
|
+
*/
|
|
55
|
+
const SENSITIVE_QUERY_PARAMS = /([?&](?:token|bat|api[-_]?key|access[-_]?token|auth|password|secret|signature|sig)=)([^&\s"'<>]+)/gi;
|
|
56
|
+
/**
|
|
57
|
+
* `Authorization: Bearer …` and friends, as they appear in prose or a header
|
|
58
|
+
* dump.
|
|
59
|
+
*
|
|
60
|
+
* The value runs to the end of the line rather than to the next space: a bearer
|
|
61
|
+
* token is written `Bearer <token>`, and stopping at the first space would
|
|
62
|
+
* withhold the word "Bearer" and keep the secret. Over-redacting the tail of a
|
|
63
|
+
* line that mentions a header is the cheap error here; the precise path is
|
|
64
|
+
* `data`, where the value has a key of its own.
|
|
65
|
+
*/
|
|
66
|
+
const AUTH_HEADER = /\b(authorization|cookie|set-cookie|x-api-key)\b(\s*[:=]\s*)([^\n]+)/gi;
|
|
67
|
+
/** A string longer than this is cut. One log line is not a body dump. */
|
|
68
|
+
const MAX_STRING = 2000;
|
|
69
|
+
/** How deep into `data` to walk before giving up. */
|
|
70
|
+
const MAX_DEPTH = 6;
|
|
71
|
+
function normaliseKey(key) {
|
|
72
|
+
return key.toLowerCase().replaceAll(/[^a-z]/g, "");
|
|
73
|
+
}
|
|
74
|
+
/** Withhold secrets that travelled inside a string. */
|
|
75
|
+
export function redactText(text) {
|
|
76
|
+
return text
|
|
77
|
+
.replaceAll(SENSITIVE_QUERY_PARAMS, `$1${REDACTED}`)
|
|
78
|
+
.replaceAll(AUTH_HEADER, `$1$2${REDACTED}`);
|
|
79
|
+
}
|
|
80
|
+
function clip(text) {
|
|
81
|
+
return text.length <= MAX_STRING
|
|
82
|
+
? text
|
|
83
|
+
: `${text.slice(0, MAX_STRING)}… [${text.length - MAX_STRING} more chars]`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Copy `data`, withholding what should not be on disk.
|
|
87
|
+
*
|
|
88
|
+
* Copies rather than mutating: the caller is usually logging an object it is
|
|
89
|
+
* still using, and a redactor that edited it in place would blank a field the
|
|
90
|
+
* run then went on to need. Cycles and depth are bounded because `data` is
|
|
91
|
+
* whatever a producer passed, which at some point will be a puppeteer object
|
|
92
|
+
* with a parent pointer.
|
|
93
|
+
*/
|
|
94
|
+
export function redactData(data) {
|
|
95
|
+
return redactValue(data, 0, new WeakSet());
|
|
96
|
+
}
|
|
97
|
+
function redactValue(value, depth, seen) {
|
|
98
|
+
if (typeof value === "string") {
|
|
99
|
+
return clip(redactText(value));
|
|
100
|
+
}
|
|
101
|
+
if (value === null || typeof value !== "object") {
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
if (seen.has(value)) {
|
|
105
|
+
return "[circular]";
|
|
106
|
+
}
|
|
107
|
+
if (depth >= MAX_DEPTH) {
|
|
108
|
+
return "[truncated]";
|
|
109
|
+
}
|
|
110
|
+
seen.add(value);
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
return value.map((entry) => redactValue(entry, depth + 1, seen));
|
|
113
|
+
}
|
|
114
|
+
if (value instanceof Error) {
|
|
115
|
+
return { name: value.name, message: clip(redactText(value.message)) };
|
|
116
|
+
}
|
|
117
|
+
const out = {};
|
|
118
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
119
|
+
out[key] = SENSITIVE_KEYS.has(normaliseKey(key))
|
|
120
|
+
? REDACTED
|
|
121
|
+
: redactValue(entry, depth + 1, seen);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** One record per intercepted request. */
|
|
2
|
+
export declare const REQUESTS_FILE = "requests.jsonl";
|
|
3
|
+
/** The one generation kept after a rotation. */
|
|
4
|
+
export declare const REQUESTS_PREVIOUS_FILE = "requests.1.jsonl";
|
|
5
|
+
/**
|
|
6
|
+
* When to rotate. Larger than the narration's cap because this is where the
|
|
7
|
+
* volume is: a single navigation of a large site produces hundreds of records,
|
|
8
|
+
* and they are the ones worth keeping a long tail of.
|
|
9
|
+
*/
|
|
10
|
+
export declare const REQUESTS_MAX_BYTES: number;
|
|
11
|
+
/** What the CLI did with a request it intercepted. */
|
|
12
|
+
export type RequestOutcome =
|
|
13
|
+
/** Answered from the CLI — a cached body, a rewritten script, the dashboard. */
|
|
14
|
+
"fulfilled"
|
|
15
|
+
/** Deliberately failed, e.g. an abort rule. */
|
|
16
|
+
| "failed"
|
|
17
|
+
/** Handed back to Chrome untouched. */
|
|
18
|
+
| "continued"
|
|
19
|
+
/** A handler threw. The request was failed so the page sees a network error. */
|
|
20
|
+
| "error";
|
|
21
|
+
export interface RequestRecord {
|
|
22
|
+
/** Monotonic within a run, from 1. The cursor for tailing. */
|
|
23
|
+
seq: number;
|
|
24
|
+
ts: string;
|
|
25
|
+
url: string;
|
|
26
|
+
method: string;
|
|
27
|
+
/** Chrome's resource type: Document, Script, XHR, Image, … */
|
|
28
|
+
resourceType: string;
|
|
29
|
+
/** Which side of the request the interception paused at. */
|
|
30
|
+
stage: "Request" | "Response";
|
|
31
|
+
outcome: RequestOutcome;
|
|
32
|
+
/**
|
|
33
|
+
* The handler that decided, by class name.
|
|
34
|
+
*
|
|
35
|
+
* This is the field that answers "why did the CLI touch this url at all",
|
|
36
|
+
* which is otherwise a matter of reading the pattern list and simulating it.
|
|
37
|
+
*/
|
|
38
|
+
handler?: string;
|
|
39
|
+
/** The status the CLI answered with, when it answered. */
|
|
40
|
+
status?: number;
|
|
41
|
+
/** How long the deciding handler took. */
|
|
42
|
+
durationMs?: number;
|
|
43
|
+
/** Why it errored, when it did. */
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface RequestLogInterface {
|
|
47
|
+
record(input: Omit<RequestRecord, "seq" | "ts">): void;
|
|
48
|
+
close(): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Appends a run's request records to `requests.jsonl`.
|
|
52
|
+
*
|
|
53
|
+
* Separate from `log.jsonl` because the two have opposite shapes and opposite
|
|
54
|
+
* read patterns. Narration is tens to hundreds of lines a human might read in
|
|
55
|
+
* order; this is thousands of rows nobody reads in order and everyone
|
|
56
|
+
* aggregates — "which urls did the CLI serve", "what got continued that should
|
|
57
|
+
* not have", "where did the time go". Mixing them would bury the narration
|
|
58
|
+
* under the traffic and make every `sk onboarding logs` read parse the traffic to find it.
|
|
59
|
+
*
|
|
60
|
+
* Nothing is written here that the narration also carries: an error a handler
|
|
61
|
+
* threw still goes to the log as a line a human sees, and lands here as a field
|
|
62
|
+
* that can be counted.
|
|
63
|
+
*/
|
|
64
|
+
export declare class RequestLog implements RequestLogInterface {
|
|
65
|
+
private seq;
|
|
66
|
+
private readonly file;
|
|
67
|
+
constructor(dir: string, maxBytes?: number);
|
|
68
|
+
get path(): string;
|
|
69
|
+
get error(): string | undefined;
|
|
70
|
+
record(input: Omit<RequestRecord, "seq" | "ts">): void;
|
|
71
|
+
close(): void;
|
|
72
|
+
}
|
|
73
|
+
/** Keeps every record in memory. For tests. */
|
|
74
|
+
export declare class MemoryRequestLog implements RequestLogInterface {
|
|
75
|
+
readonly records: RequestRecord[];
|
|
76
|
+
private seq;
|
|
77
|
+
record(input: Omit<RequestRecord, "seq" | "ts">): void;
|
|
78
|
+
/** Nothing to release: an in-memory log holds no handle. */
|
|
79
|
+
close(): void;
|
|
80
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { JsonlAppender } from "./jsonl-appender.js";
|
|
2
|
+
import { redactText } from "./redaction.js";
|
|
3
|
+
/** One record per intercepted request. */
|
|
4
|
+
export const REQUESTS_FILE = "requests.jsonl";
|
|
5
|
+
/** The one generation kept after a rotation. */
|
|
6
|
+
export const REQUESTS_PREVIOUS_FILE = "requests.1.jsonl";
|
|
7
|
+
/**
|
|
8
|
+
* When to rotate. Larger than the narration's cap because this is where the
|
|
9
|
+
* volume is: a single navigation of a large site produces hundreds of records,
|
|
10
|
+
* and they are the ones worth keeping a long tail of.
|
|
11
|
+
*/
|
|
12
|
+
export const REQUESTS_MAX_BYTES = 64 * 1024 * 1024;
|
|
13
|
+
/**
|
|
14
|
+
* Appends a run's request records to `requests.jsonl`.
|
|
15
|
+
*
|
|
16
|
+
* Separate from `log.jsonl` because the two have opposite shapes and opposite
|
|
17
|
+
* read patterns. Narration is tens to hundreds of lines a human might read in
|
|
18
|
+
* order; this is thousands of rows nobody reads in order and everyone
|
|
19
|
+
* aggregates — "which urls did the CLI serve", "what got continued that should
|
|
20
|
+
* not have", "where did the time go". Mixing them would bury the narration
|
|
21
|
+
* under the traffic and make every `sk onboarding logs` read parse the traffic to find it.
|
|
22
|
+
*
|
|
23
|
+
* Nothing is written here that the narration also carries: an error a handler
|
|
24
|
+
* threw still goes to the log as a line a human sees, and lands here as a field
|
|
25
|
+
* that can be counted.
|
|
26
|
+
*/
|
|
27
|
+
export class RequestLog {
|
|
28
|
+
seq = 0;
|
|
29
|
+
file;
|
|
30
|
+
constructor(dir, maxBytes = REQUESTS_MAX_BYTES) {
|
|
31
|
+
this.file = new JsonlAppender(dir, REQUESTS_FILE, REQUESTS_PREVIOUS_FILE, maxBytes);
|
|
32
|
+
}
|
|
33
|
+
get path() {
|
|
34
|
+
return this.file.path;
|
|
35
|
+
}
|
|
36
|
+
get error() {
|
|
37
|
+
return this.file.error;
|
|
38
|
+
}
|
|
39
|
+
record(input) {
|
|
40
|
+
this.file.append({
|
|
41
|
+
...input,
|
|
42
|
+
seq: ++this.seq,
|
|
43
|
+
ts: new Date().toISOString(),
|
|
44
|
+
// A request url is the most likely place in this whole file for a
|
|
45
|
+
// credential to appear — a signed asset url, a token in a query string.
|
|
46
|
+
url: redactText(input.url),
|
|
47
|
+
error: input.error === undefined ? undefined : redactText(input.error),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
close() {
|
|
51
|
+
this.file.close();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Keeps every record in memory. For tests. */
|
|
55
|
+
export class MemoryRequestLog {
|
|
56
|
+
records = [];
|
|
57
|
+
seq = 0;
|
|
58
|
+
record(input) {
|
|
59
|
+
this.records.push({
|
|
60
|
+
...input,
|
|
61
|
+
seq: ++this.seq,
|
|
62
|
+
ts: new Date().toISOString(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Nothing to release: an in-memory log holds no handle. */
|
|
66
|
+
close() {
|
|
67
|
+
// Intentionally empty.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { JsonlReader } from "./log-reader.js";
|
|
2
|
+
import { RequestRecord } from "./request-log.js";
|
|
3
|
+
/** The request stream of a run. */
|
|
4
|
+
export declare class RequestReader extends JsonlReader<RequestRecord> {
|
|
5
|
+
constructor(dir: string);
|
|
6
|
+
}
|
|
7
|
+
/** What to select out of a run's request records. */
|
|
8
|
+
export interface RequestQuery {
|
|
9
|
+
/** Everything after this sequence number. */
|
|
10
|
+
sinceSeq?: number;
|
|
11
|
+
/** Substring match against the url. */
|
|
12
|
+
url?: string;
|
|
13
|
+
outcome?: string;
|
|
14
|
+
handler?: string;
|
|
15
|
+
resourceType?: string;
|
|
16
|
+
/** Only the last n matches. */
|
|
17
|
+
tail?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface RequestReadResult {
|
|
20
|
+
records: RequestRecord[];
|
|
21
|
+
total: number;
|
|
22
|
+
truncated: boolean;
|
|
23
|
+
lastSeq: number;
|
|
24
|
+
malformed: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function readRequests(dir: string, query?: RequestQuery): RequestReadResult;
|
|
27
|
+
/** A url the CLI handled repeatedly, collapsed. */
|
|
28
|
+
export interface RequestHotspot {
|
|
29
|
+
url: string;
|
|
30
|
+
count: number;
|
|
31
|
+
/**
|
|
32
|
+
* How the CLI answered, counted rather than named.
|
|
33
|
+
*
|
|
34
|
+
* A url routinely has more than one outcome in a single run — the homepage is
|
|
35
|
+
* served once and handed back to Chrome the next time — and served versus
|
|
36
|
+
* handed back is the one question this whole stream exists to answer. Naming
|
|
37
|
+
* only the first would report half of it as all of it.
|
|
38
|
+
*/
|
|
39
|
+
outcomes: Record<string, number>;
|
|
40
|
+
/** Every handler that answered it. Empty when none did. */
|
|
41
|
+
handlers: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface RequestSummary {
|
|
44
|
+
total: number;
|
|
45
|
+
byOutcome: Record<string, number>;
|
|
46
|
+
/** Which handler answered, by class name. Absent for a continued request. */
|
|
47
|
+
byHandler: Record<string, number>;
|
|
48
|
+
byResourceType: Record<string, number>;
|
|
49
|
+
byStatus: Record<string, number>;
|
|
50
|
+
/** The urls the CLI touched most, which is usually where a config question is. */
|
|
51
|
+
hotspots: RequestHotspot[];
|
|
52
|
+
/** Where the time went: the slowest handled requests. */
|
|
53
|
+
slowest: {
|
|
54
|
+
url: string;
|
|
55
|
+
durationMs: number;
|
|
56
|
+
handler?: string;
|
|
57
|
+
}[];
|
|
58
|
+
/** Deduplicated handler failures. */
|
|
59
|
+
errors: {
|
|
60
|
+
url: string;
|
|
61
|
+
error: string;
|
|
62
|
+
count: number;
|
|
63
|
+
}[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Aggregate a run's request records.
|
|
67
|
+
*
|
|
68
|
+
* This is the half of `--summary` that answers config questions rather than
|
|
69
|
+
* "did it crash": which urls the CLI served and which it handed straight to
|
|
70
|
+
* Chrome is exactly the distinction a `disabledScopes` or `blacklist` change is
|
|
71
|
+
* trying to move, and counting it is the only way to see the change land
|
|
72
|
+
* without reading every line.
|
|
73
|
+
*/
|
|
74
|
+
export declare function summariseRequests(records: RequestRecord[]): RequestSummary;
|
|
75
|
+
/** The request half of `sk logs --summary`. */
|
|
76
|
+
export declare function renderRequestSummary(summary: RequestSummary): string;
|
|
Binary file
|