@descryy/mcp 0.6.0 → 0.7.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/dist/action-handshake.d.ts +8 -75
- package/dist/action-handshake.d.ts.map +1 -1
- package/dist/action-handshake.js +9 -79
- package/dist/action-handshake.js.map +1 -1
- package/dist/bin/descry-mcp.d.ts +4 -15
- package/dist/bin/descry-mcp.d.ts.map +1 -1
- package/dist/bin/descry-mcp.js +12 -42
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/driver.d.ts +121 -224
- package/dist/browser/driver.d.ts.map +1 -1
- package/dist/browser/driver.js +9 -55
- package/dist/browser/driver.js.map +1 -1
- package/dist/browser/evidence.d.ts +10 -43
- package/dist/browser/evidence.d.ts.map +1 -1
- package/dist/browser/evidence.js +20 -54
- package/dist/browser/evidence.js.map +1 -1
- package/dist/browser/fake-driver.d.ts +12 -19
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +31 -26
- package/dist/browser/fake-driver.js.map +1 -1
- package/dist/browser/graph-write.d.ts +4 -45
- package/dist/browser/graph-write.d.ts.map +1 -1
- package/dist/browser/graph-write.js +8 -53
- package/dist/browser/graph-write.js.map +1 -1
- package/dist/browser/playwright-driver.d.ts +7 -91
- package/dist/browser/playwright-driver.d.ts.map +1 -1
- package/dist/browser/playwright-driver.js +59 -197
- package/dist/browser/playwright-driver.js.map +1 -1
- package/dist/browser/provider.d.ts +5 -34
- package/dist/browser/provider.d.ts.map +1 -1
- package/dist/browser/provider.js +4 -24
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/registry.d.ts +26 -106
- package/dist/browser/registry.d.ts.map +1 -1
- package/dist/browser/registry.js +20 -77
- package/dist/browser/registry.js.map +1 -1
- package/dist/browser/scenario-provenance.d.ts +23 -0
- package/dist/browser/scenario-provenance.d.ts.map +1 -0
- package/dist/browser/scenario-provenance.js +59 -0
- package/dist/browser/scenario-provenance.js.map +1 -0
- package/dist/browser/scenario-resolve.d.ts +10 -44
- package/dist/browser/scenario-resolve.d.ts.map +1 -1
- package/dist/browser/scenario-resolve.js +10 -41
- package/dist/browser/scenario-resolve.js.map +1 -1
- package/dist/browser/scenario-runner.d.ts +12 -70
- package/dist/browser/scenario-runner.d.ts.map +1 -1
- package/dist/browser/scenario-runner.js +30 -90
- package/dist/browser/scenario-runner.js.map +1 -1
- package/dist/browser/stack-parser.d.ts +4 -28
- package/dist/browser/stack-parser.d.ts.map +1 -1
- package/dist/browser/stack-parser.js +12 -39
- package/dist/browser/stack-parser.js.map +1 -1
- package/dist/browser/tool-support.d.ts +20 -67
- package/dist/browser/tool-support.d.ts.map +1 -1
- package/dist/browser/tool-support.js +21 -65
- package/dist/browser/tool-support.js.map +1 -1
- package/dist/browser/url-scheme.d.ts +14 -0
- package/dist/browser/url-scheme.d.ts.map +1 -0
- package/dist/browser/url-scheme.js +38 -0
- package/dist/browser/url-scheme.js.map +1 -0
- package/dist/cancellation.d.ts +11 -46
- package/dist/cancellation.d.ts.map +1 -1
- package/dist/cancellation.js +11 -46
- package/dist/cancellation.js.map +1 -1
- package/dist/capped.d.ts +9 -33
- package/dist/capped.d.ts.map +1 -1
- package/dist/capped.js +7 -27
- package/dist/capped.js.map +1 -1
- package/dist/disclosure-ledger.d.ts +6 -30
- package/dist/disclosure-ledger.d.ts.map +1 -1
- package/dist/disclosure-ledger.js +4 -26
- package/dist/disclosure-ledger.js.map +1 -1
- package/dist/index.d.ts +10 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -17
- package/dist/index.js.map +1 -1
- package/dist/module-trust.d.ts +24 -0
- package/dist/module-trust.d.ts.map +1 -0
- package/dist/module-trust.js +60 -0
- package/dist/module-trust.js.map +1 -0
- package/dist/path-confinement.d.ts +31 -0
- package/dist/path-confinement.d.ts.map +1 -0
- package/dist/path-confinement.js +44 -0
- package/dist/path-confinement.js.map +1 -0
- package/dist/protocol.d.ts +10 -53
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +14 -60
- package/dist/protocol.js.map +1 -1
- package/dist/registry.d.ts +37 -58
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +88 -96
- package/dist/registry.js.map +1 -1
- package/dist/render.d.ts +89 -13
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +111 -16
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +7 -66
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +39 -114
- package/dist/runtime-registry.js.map +1 -1
- package/dist/scenarios/index.d.ts +1 -1
- package/dist/scenarios/index.d.ts.map +1 -1
- package/dist/scenarios/index.js +1 -1
- package/dist/scenarios/index.js.map +1 -1
- package/dist/scenarios/parse.d.ts +4 -18
- package/dist/scenarios/parse.d.ts.map +1 -1
- package/dist/scenarios/parse.js +14 -34
- package/dist/scenarios/parse.js.map +1 -1
- package/dist/scenarios/scenario.d.ts +18 -74
- package/dist/scenarios/scenario.d.ts.map +1 -1
- package/dist/scenarios/scenario.js +7 -34
- package/dist/scenarios/scenario.js.map +1 -1
- package/dist/scenarios/storage.d.ts +11 -41
- package/dist/scenarios/storage.d.ts.map +1 -1
- package/dist/scenarios/storage.js +57 -47
- package/dist/scenarios/storage.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +69 -19
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +90 -259
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +136 -250
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +32 -118
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +65 -186
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-click.d.ts +3 -21
- package/dist/tools/browser-click.d.ts.map +1 -1
- package/dist/tools/browser-click.js +10 -31
- package/dist/tools/browser-click.js.map +1 -1
- package/dist/tools/browser-close-session.d.ts +4 -13
- package/dist/tools/browser-close-session.d.ts.map +1 -1
- package/dist/tools/browser-close-session.js +4 -13
- package/dist/tools/browser-close-session.js.map +1 -1
- package/dist/tools/browser-fill.d.ts +5 -36
- package/dist/tools/browser-fill.d.ts.map +1 -1
- package/dist/tools/browser-fill.js +9 -44
- package/dist/tools/browser-fill.js.map +1 -1
- package/dist/tools/browser-navigate.d.ts +6 -27
- package/dist/tools/browser-navigate.d.ts.map +1 -1
- package/dist/tools/browser-navigate.js +6 -23
- package/dist/tools/browser-navigate.js.map +1 -1
- package/dist/tools/browser-run-scenario.d.ts +5 -31
- package/dist/tools/browser-run-scenario.d.ts.map +1 -1
- package/dist/tools/browser-run-scenario.js +10 -46
- package/dist/tools/browser-run-scenario.js.map +1 -1
- package/dist/tools/browser-save-scenario.d.ts +3 -28
- package/dist/tools/browser-save-scenario.d.ts.map +1 -1
- package/dist/tools/browser-save-scenario.js +47 -84
- package/dist/tools/browser-save-scenario.js.map +1 -1
- package/dist/tools/browser-snapshot.d.ts +6 -39
- package/dist/tools/browser-snapshot.d.ts.map +1 -1
- package/dist/tools/browser-snapshot.js +4 -31
- package/dist/tools/browser-snapshot.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts +4 -23
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +145 -56
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/browser-type.d.ts +5 -35
- package/dist/tools/browser-type.d.ts.map +1 -1
- package/dist/tools/browser-type.js +10 -45
- package/dist/tools/browser-type.js.map +1 -1
- package/dist/tools/contracts.d.ts +9 -86
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +24 -80
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts +42 -30
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +81 -62
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts +18 -2
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +118 -26
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/git-history.d.ts +5 -16
- package/dist/tools/git-history.d.ts.map +1 -1
- package/dist/tools/git-history.js +3 -10
- package/dist/tools/git-history.js.map +1 -1
- package/dist/tools/history.d.ts +4 -33
- package/dist/tools/history.d.ts.map +1 -1
- package/dist/tools/history.js +6 -31
- package/dist/tools/history.js.map +1 -1
- package/dist/tools/impact.d.ts +7 -51
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +15 -67
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/index.d.ts +3 -8
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kit.d.ts +66 -113
- package/dist/tools/kit.d.ts.map +1 -1
- package/dist/tools/kit.js +60 -28
- package/dist/tools/kit.js.map +1 -1
- package/dist/tools/link-workspace.d.ts +7 -45
- package/dist/tools/link-workspace.d.ts.map +1 -1
- package/dist/tools/link-workspace.js +10 -48
- package/dist/tools/link-workspace.js.map +1 -1
- package/dist/tools/lookup.d.ts +4 -14
- package/dist/tools/lookup.d.ts.map +1 -1
- package/dist/tools/lookup.js +4 -14
- package/dist/tools/lookup.js.map +1 -1
- package/dist/tools/mark-incident.d.ts +7 -54
- package/dist/tools/mark-incident.d.ts.map +1 -1
- package/dist/tools/mark-incident.js +15 -68
- package/dist/tools/mark-incident.js.map +1 -1
- package/dist/tools/observe-runtime.d.ts +27 -210
- package/dist/tools/observe-runtime.d.ts.map +1 -1
- package/dist/tools/observe-runtime.js +273 -434
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe-tests.d.ts +9 -100
- package/dist/tools/observe-tests.d.ts.map +1 -1
- package/dist/tools/observe-tests.js +74 -152
- package/dist/tools/observe-tests.js.map +1 -1
- package/dist/tools/pr-analysis.d.ts +18 -2
- package/dist/tools/pr-analysis.d.ts.map +1 -1
- package/dist/tools/pr-analysis.js +73 -23
- package/dist/tools/pr-analysis.js.map +1 -1
- package/dist/tools/pre-push.d.ts +74 -16
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +152 -51
- package/dist/tools/pre-push.js.map +1 -1
- package/dist/tools/propagation.d.ts +11 -53
- package/dist/tools/propagation.d.ts.map +1 -1
- package/dist/tools/propagation.js +17 -58
- package/dist/tools/propagation.js.map +1 -1
- package/dist/tools/questions.d.ts +13 -63
- package/dist/tools/questions.d.ts.map +1 -1
- package/dist/tools/questions.js +33 -105
- package/dist/tools/questions.js.map +1 -1
- package/dist/tools/refusal-fetch.d.ts +4 -40
- package/dist/tools/refusal-fetch.d.ts.map +1 -1
- package/dist/tools/refusal-fetch.js +4 -40
- package/dist/tools/refusal-fetch.js.map +1 -1
- package/dist/tools/runtime-incident.d.ts +4 -63
- package/dist/tools/runtime-incident.d.ts.map +1 -1
- package/dist/tools/runtime-incident.js +10 -87
- package/dist/tools/runtime-incident.js.map +1 -1
- package/dist/tools/scope.d.ts +7 -25
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +10 -29
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/similar-incidents.d.ts +11 -86
- package/dist/tools/similar-incidents.d.ts.map +1 -1
- package/dist/tools/similar-incidents.js +7 -71
- package/dist/tools/similar-incidents.js.map +1 -1
- package/dist/tools/validate.d.ts +29 -70
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +141 -85
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/verification-status.d.ts +9 -64
- package/dist/tools/verification-status.d.ts.map +1 -1
- package/dist/tools/verification-status.js +9 -62
- package/dist/tools/verification-status.js.map +1 -1
- package/dist/tools/verify-claim.d.ts +5 -52
- package/dist/tools/verify-claim.d.ts.map +1 -1
- package/dist/tools/verify-claim.js +6 -56
- package/dist/tools/verify-claim.js.map +1 -1
- package/dist/transport.d.ts +15 -52
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +16 -60
- package/dist/transport.js.map +1 -1
- package/package.json +40 -22
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* language
|
|
4
|
-
*
|
|
5
|
-
* `runtime-registry.ts`'s argument, applied to the browser lane. A raw
|
|
6
|
-
* `fetch()` call-site stack is a string in some runtime's own format, and
|
|
7
|
-
* turning it into resolved frames is per-language work that lives in
|
|
8
|
-
* `descry-runtime`'s adapters. An `import { createV8StackTraceParser } from
|
|
9
|
-
* "@descryy/runtime-adapter-typescript"` in a tool file would put the word
|
|
10
|
-
* "typescript" above the IR boundary in the one process that runs everything
|
|
11
|
-
* — rule 1, which this repository calls a design bug rather than a style
|
|
12
|
-
* preference.
|
|
13
|
-
*
|
|
14
|
-
* So the parser is **named by the caller as a module specifier** and imported
|
|
15
|
-
* at run time, exactly as every static source and runtime adapter already is.
|
|
16
|
-
*
|
|
17
|
-
* ## Without one, the arrow does not exist, and the reply says so
|
|
18
|
-
*
|
|
19
|
-
* This is not a degradation that can be hidden. `confirmObservedFrontendCaller`
|
|
20
|
-
* takes a parsed `StackTrace`; with no parser, every request is still observed
|
|
21
|
-
* and every endpoint it reached can still be named, but **no caller edge is
|
|
22
|
-
* written at all**. That is a real, honest, partial answer — "this route was
|
|
23
|
-
* hit, we cannot tell you from where" — and it is disclosed rather than
|
|
24
|
-
* presented as a run that found nothing.
|
|
2
|
+
* Loads a stack-trace parser named by the caller as a module specifier —
|
|
3
|
+
* rule 1: a static import from a language-named adapter would put
|
|
4
|
+
* "typescript" above the IR boundary. Without one, every request is still observed and endpoint named, but no caller edge is written — disclosed, never hidden.
|
|
25
5
|
*/
|
|
26
6
|
import type { StackTraceParser } from "@descryy/runtime-backend-observation";
|
|
27
7
|
/** A stack-trace parser named the way `RuntimeAdapterSpec` names a runtime adapter. */
|
|
@@ -30,11 +10,7 @@ export interface StackParserSpec {
|
|
|
30
10
|
/** Named export to call. Defaults to the `create*StackTraceParser` convention. */
|
|
31
11
|
readonly export?: string;
|
|
32
12
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Distinct from a generic `Error` so a tool can tell "the parser would not
|
|
35
|
-
* load" — a refusal it must disclose — from "the run itself broke". Both are
|
|
36
|
-
* honest; they are not the same statement.
|
|
37
|
-
*/
|
|
13
|
+
/** Distinct from a generic `Error` so a tool can disclose "the parser wouldn't load" separately from "the run itself broke" — both honest, not the same statement. */
|
|
38
14
|
export declare class StackParserLoadError extends Error {
|
|
39
15
|
readonly specifier: string;
|
|
40
16
|
constructor(specifier: string, reason: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-parser.d.ts","sourceRoot":"","sources":["../../src/browser/stack-parser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stack-parser.d.ts","sourceRoot":"","sources":["../../src/browser/stack-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAI7E,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,sKAAsK;AACtK,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQ9C;AAKD,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8CtF"}
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* language
|
|
4
|
-
*
|
|
5
|
-
* `runtime-registry.ts`'s argument, applied to the browser lane. A raw
|
|
6
|
-
* `fetch()` call-site stack is a string in some runtime's own format, and
|
|
7
|
-
* turning it into resolved frames is per-language work that lives in
|
|
8
|
-
* `descry-runtime`'s adapters. An `import { createV8StackTraceParser } from
|
|
9
|
-
* "@descryy/runtime-adapter-typescript"` in a tool file would put the word
|
|
10
|
-
* "typescript" above the IR boundary in the one process that runs everything
|
|
11
|
-
* — rule 1, which this repository calls a design bug rather than a style
|
|
12
|
-
* preference.
|
|
13
|
-
*
|
|
14
|
-
* So the parser is **named by the caller as a module specifier** and imported
|
|
15
|
-
* at run time, exactly as every static source and runtime adapter already is.
|
|
16
|
-
*
|
|
17
|
-
* ## Without one, the arrow does not exist, and the reply says so
|
|
18
|
-
*
|
|
19
|
-
* This is not a degradation that can be hidden. `confirmObservedFrontendCaller`
|
|
20
|
-
* takes a parsed `StackTrace`; with no parser, every request is still observed
|
|
21
|
-
* and every endpoint it reached can still be named, but **no caller edge is
|
|
22
|
-
* written at all**. That is a real, honest, partial answer — "this route was
|
|
23
|
-
* hit, we cannot tell you from where" — and it is disclosed rather than
|
|
24
|
-
* presented as a run that found nothing.
|
|
2
|
+
* Loads a stack-trace parser named by the caller as a module specifier —
|
|
3
|
+
* rule 1: a static import from a language-named adapter would put
|
|
4
|
+
* "typescript" above the IR boundary. Without one, every request is still observed and endpoint named, but no caller edge is written — disclosed, never hidden.
|
|
25
5
|
*/
|
|
26
6
|
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
27
7
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
@@ -31,11 +11,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
31
11
|
}
|
|
32
12
|
return path;
|
|
33
13
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* load" — a refusal it must disclose — from "the run itself broke". Both are
|
|
37
|
-
* honest; they are not the same statement.
|
|
38
|
-
*/
|
|
14
|
+
import { checkModuleTrust } from "../module-trust.js";
|
|
15
|
+
/** Distinct from a generic `Error` so a tool can disclose "the parser wouldn't load" separately from "the run itself broke" — both honest, not the same statement. */
|
|
39
16
|
export class StackParserLoadError extends Error {
|
|
40
17
|
specifier;
|
|
41
18
|
constructor(specifier, reason) {
|
|
@@ -48,6 +25,10 @@ export class StackParserLoadError extends Error {
|
|
|
48
25
|
const FACTORY_PATTERN = /^create[A-Za-z0-9]*StackTraceParser$/;
|
|
49
26
|
const RESOLVER_PATTERN = /^create[A-Za-z0-9]*SourceLocationResolver$/;
|
|
50
27
|
export async function loadStackParser(spec) {
|
|
28
|
+
// A-F2: `spec.module` comes straight from tool arguments, no allowlist upstream — see module-trust.ts.
|
|
29
|
+
const trust = checkModuleTrust(spec.module);
|
|
30
|
+
if (!trust.allowed)
|
|
31
|
+
throw new StackParserLoadError(spec.module, trust.reason);
|
|
51
32
|
let module;
|
|
52
33
|
try {
|
|
53
34
|
module = (await import(__rewriteRelativeImportExtension(spec.module)));
|
|
@@ -60,17 +41,9 @@ export async function loadStackParser(spec) {
|
|
|
60
41
|
if (typeof factory !== "function") {
|
|
61
42
|
throw new StackParserLoadError(spec.module, `"${name}" is not a function`);
|
|
62
43
|
}
|
|
63
|
-
// A
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// needs one exports a `create*SourceLocationResolver` beside its parser.
|
|
67
|
-
//
|
|
68
|
-
// This is checked rather than assumed because the failure is silent. Called
|
|
69
|
-
// with no resolver, `createV8StackTraceParser` returns a parser that throws
|
|
70
|
-
// nothing and produces `null` for every stack — so a run would observe
|
|
71
|
-
// every request, write no edge, report no error, and look exactly like an
|
|
72
|
-
// application with no frontend callers. Measured, not hypothesised: it is
|
|
73
|
-
// what this loader did before this branch existed.
|
|
44
|
+
// A factory taking an arg needs a `SourceLocationResolver` (script URL to
|
|
45
|
+
// real file). Checked, not assumed: called with none, the parser silently
|
|
46
|
+
// returns null for every stack — measured, not hypothesised (a prior bug).
|
|
74
47
|
const needsResolver = factory.length >= 1;
|
|
75
48
|
let resolver;
|
|
76
49
|
if (needsResolver) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-parser.js","sourceRoot":"","sources":["../../src/browser/stack-parser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stack-parser.js","sourceRoot":"","sources":["../../src/browser/stack-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;;;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAStD,sKAAsK;AACtK,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,SAAS,CAAS;IAE3B,YAAY,SAAiB,EAAE,MAAc;QAC3C,KAAK,CACH,6CAA6C,SAAS,MAAM,MAAM,oCAAoC;YACpG,4FAA4F,CAC/F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAC/D,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAqB;IACzD,uGAAuG;IACvG,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9E,IAAI,MAA+B,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,MAAM,MAAM,kCAAC,IAAI,CAAC,MAAM,EAAC,CAA4B,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,WAAW,CAA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
|
|
6
|
-
* reply is stamped. Seven copies of a refusal is seven chances for one of
|
|
7
|
-
* them to say something slightly different about the same state.
|
|
8
|
-
*/
|
|
1
|
+
/** What the seven browser tools share — kept in one place because the parts that repeat
|
|
2
|
+
* are the parts that must not drift: how a dead session is reported, how consent is
|
|
3
|
+
* checked, how a reply is stamped. Seven copies of a refusal is seven chances for one to
|
|
4
|
+
* say something slightly different about the same state. */
|
|
9
5
|
import { type ToolContext } from "../tools/kit.ts";
|
|
10
6
|
import type { ToolAnswer } from "../render.ts";
|
|
11
7
|
import type { BrowserSessionEntry, BrowserSessionRegistry } from "./registry.ts";
|
|
12
8
|
import { type BrowserEvidenceReport } from "./evidence.ts";
|
|
13
9
|
import type { BrowserObservation } from "./driver.ts";
|
|
14
10
|
import { type BrowserGraphWrite } from "./graph-write.ts";
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* A browser tool does not read the graph, and on a repository that has never
|
|
19
|
-
* been analysed there is no graph to read. Refusing to open a browser because
|
|
20
|
-
* of that would be refusing for a reason that has nothing to do with the
|
|
21
|
-
* request, so the stamp degrades instead — and says it degraded.
|
|
22
|
-
*/
|
|
11
|
+
/** Staleness stamp for a reply that observed a browser. No graph on an unanalysed repo
|
|
12
|
+
* should not block opening a browser — the stamp degrades instead of refusing, and says so. */
|
|
23
13
|
export interface BrowserStamp {
|
|
24
14
|
readonly commitSha: string | null;
|
|
25
15
|
readonly graphBuiltAt: number | null;
|
|
@@ -36,15 +26,9 @@ export interface BrowserReplyOptions<T> {
|
|
|
36
26
|
readonly ctx: ToolContext;
|
|
37
27
|
readonly fitToBudget?: (budgetBytes: number) => import("../render.ts").ReplyFit<T>;
|
|
38
28
|
}
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `resolutionFloor: 4` on a successful observation, and that is not
|
|
43
|
-
* generosity: R4 is "observed at runtime", and a page element this call
|
|
44
|
-
* actually saw is the definition of it. A refusal or a failure observed
|
|
45
|
-
* nothing, so it stamps R0 — the floor has to describe the evidence behind
|
|
46
|
-
* *this* reply, not the tool's best case.
|
|
47
|
-
*/
|
|
29
|
+
/** Every browser reply, stamped identically. `resolutionFloor: 4` on success — R4 is
|
|
30
|
+
* "observed at runtime", exactly what this call saw; a refusal/failure observed nothing,
|
|
31
|
+
* so stamps R0 — describing this reply's evidence, not the tool's best case. */
|
|
48
32
|
export declare function browserAnswer<T>(options: BrowserReplyOptions<T>): ToolAnswer<T>;
|
|
49
33
|
export interface DeadSession {
|
|
50
34
|
readonly state: "refused" | "failed";
|
|
@@ -52,14 +36,9 @@ export interface DeadSession {
|
|
|
52
36
|
readonly notes: readonly string[];
|
|
53
37
|
readonly evidence: BrowserEvidenceReport;
|
|
54
38
|
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* The three dead states are deliberately not collapsed into one. "You never
|
|
59
|
-
* had this session", "it timed out five minutes ago, here is what it saw" and
|
|
60
|
-
* "the browser crashed" are three different things for a caller to do next,
|
|
61
|
-
* and only the last of them is a `failed`.
|
|
62
|
-
*/
|
|
39
|
+
/** Looks a session up, or says exactly why it can't be used. The three dead states stay
|
|
40
|
+
* apart — "never had it", "timed out, here's what it saw", "crashed" send a caller to
|
|
41
|
+
* three different things; only the last is `failed`. */
|
|
63
42
|
export declare function useSession(registry: BrowserSessionRegistry, sessionId: string): Promise<{
|
|
64
43
|
readonly ok: true;
|
|
65
44
|
readonly entry: BrowserSessionEntry;
|
|
@@ -67,19 +46,9 @@ export declare function useSession(registry: BrowserSessionRegistry, sessionId:
|
|
|
67
46
|
readonly ok: false;
|
|
68
47
|
readonly dead: DeadSession;
|
|
69
48
|
}>;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* Every evidence-bearing browser tool goes through this rather than draining
|
|
75
|
-
* for itself. Two reasons, and the second is the one that matters: a tool
|
|
76
|
-
* that drained without correlating would be a tool through which the R4 write
|
|
77
|
-
* silently does not happen, and nothing about its reply would look different.
|
|
78
|
-
*
|
|
79
|
-
* A repository with no graph correlates nothing and says so. That is a real
|
|
80
|
-
* state — a developer can drive a browser against an app they have never
|
|
81
|
-
* analysed — and it must not look like "we looked and found no connection".
|
|
82
|
-
*/
|
|
49
|
+
/** Drains page evidence, relates it to the graph, and returns both in one place — every
|
|
50
|
+
* evidence-bearing tool routes through this so the R4 write can't silently not happen.
|
|
51
|
+
* No graph correlates nothing and says so; that's real, not "found no connection". */
|
|
83
52
|
export declare function observeAndCorrelate(ctx: ToolContext, entry: BrowserSessionEntry): Promise<{
|
|
84
53
|
readonly evidence: BrowserEvidenceReport;
|
|
85
54
|
readonly graph: BrowserGraphWrite;
|
|
@@ -87,27 +56,11 @@ export declare function observeAndCorrelate(ctx: ToolContext, entry: BrowserSess
|
|
|
87
56
|
}>;
|
|
88
57
|
export declare function emptyEvidence(): BrowserEvidenceReport;
|
|
89
58
|
export declare function reportOf(observation: BrowserObservation): BrowserEvidenceReport;
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* The consent ruling's one hard bound. Checked here rather than in each verb
|
|
94
|
-
* so that a future eighth tool cannot forget it.
|
|
95
|
-
*/
|
|
96
|
-
/**
|
|
97
|
-
* Does this session's environment profile permit changing the application?
|
|
98
|
-
*
|
|
99
|
-
* Read off the profile the session was opened under — DEC-270's
|
|
100
|
-
* `safetyLevel`, the same field `observe_runtime` consults. Deliberately not
|
|
101
|
-
* a per-tool flag: two independent notions of "safe" is how a runtime run and
|
|
102
|
-
* a browser run end up disagreeing about the same environment.
|
|
103
|
-
*
|
|
104
|
-
* A session opened with no profile returns null here, and the session's own
|
|
105
|
-
* consent is then the only authorization — which is a real authorization,
|
|
106
|
-
* granted explicitly at `browser_start_session` against a named origin. The
|
|
107
|
-
* two are independent and both must pass: consent answers *may Descry drive a
|
|
108
|
-
* browser against this target at all*, the profile answers *may it mutate*,
|
|
109
|
-
* and neither excuses the other.
|
|
110
|
-
*/
|
|
59
|
+
/** Does the session's environment profile permit changing the application? Reads DEC-270's
|
|
60
|
+
* `safetyLevel` (same field `observe_runtime` consults), not a per-tool flag — two "safe"
|
|
61
|
+
* notions could disagree. No profile ⇒ null; consent and profile are independent, both must pass. */
|
|
111
62
|
export declare function mutationRefusal(entry: BrowserSessionEntry): string | null;
|
|
63
|
+
/** Is `url` inside the origin this session was consented for? The consent ruling's one
|
|
64
|
+
* hard bound — checked here, not in each verb, so a future eighth tool can't forget it. */
|
|
112
65
|
export declare function withinConsent(entry: BrowserSessionEntry, url: string): boolean;
|
|
113
66
|
//# sourceMappingURL=tool-support.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-support.d.ts","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-support.d.ts","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA;;;6DAG6D;AAE7D,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAiC,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAA6D,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErH;gGACgG;AAChG,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC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AwB1H;AAED;;uFAEuF;AACvF,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CA8B7H;AAED,wBAAgB,aAAa,IAAI,qBAAqB,CAErD;AAED,wBAAgB,QAAQ,CAAC,WAAW,EAAE,kBAAkB,GAAG,qBAAqB,CAE/E;AAED;;sGAEsG;AACtG,wBAAgB,eAAe,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CASzE;AAED;4FAC4F;AAC5F,wBAAgB,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAM9E"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* drift: how a dead session is reported, how consent is checked, and how a
|
|
6
|
-
* reply is stamped. Seven copies of a refusal is seven chances for one of
|
|
7
|
-
* them to say something slightly different about the same state.
|
|
8
|
-
*/
|
|
1
|
+
/** What the seven browser tools share — kept in one place because the parts that repeat
|
|
2
|
+
* are the parts that must not drift: how a dead session is reported, how consent is
|
|
3
|
+
* checked, how a reply is stamped. Seven copies of a refusal is seven chances for one to
|
|
4
|
+
* say something slightly different about the same state. */
|
|
9
5
|
import { answer } from "../tools/kit.js";
|
|
10
6
|
import { evidenceNotes, evidenceReport } from "./evidence.js";
|
|
11
7
|
import { graphWriteNotes, writeBrowserObservations, NO_GRAPH_WRITE } from "./graph-write.js";
|
|
@@ -31,15 +27,9 @@ export function browserStamp(ctx) {
|
|
|
31
27
|
};
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* `resolutionFloor: 4` on a successful observation, and that is not
|
|
38
|
-
* generosity: R4 is "observed at runtime", and a page element this call
|
|
39
|
-
* actually saw is the definition of it. A refusal or a failure observed
|
|
40
|
-
* nothing, so it stamps R0 — the floor has to describe the evidence behind
|
|
41
|
-
* *this* reply, not the tool's best case.
|
|
42
|
-
*/
|
|
30
|
+
/** Every browser reply, stamped identically. `resolutionFloor: 4` on success — R4 is
|
|
31
|
+
* "observed at runtime", exactly what this call saw; a refusal/failure observed nothing,
|
|
32
|
+
* so stamps R0 — describing this reply's evidence, not the tool's best case. */
|
|
43
33
|
export function browserAnswer(options) {
|
|
44
34
|
const stamp = browserStamp(options.ctx);
|
|
45
35
|
const observed = (options.state ?? "ok") === "ok";
|
|
@@ -60,14 +50,9 @@ export function browserAnswer(options) {
|
|
|
60
50
|
...(options.fitToBudget === undefined ? {} : { fitToBudget: options.fitToBudget }),
|
|
61
51
|
});
|
|
62
52
|
}
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* The three dead states are deliberately not collapsed into one. "You never
|
|
67
|
-
* had this session", "it timed out five minutes ago, here is what it saw" and
|
|
68
|
-
* "the browser crashed" are three different things for a caller to do next,
|
|
69
|
-
* and only the last of them is a `failed`.
|
|
70
|
-
*/
|
|
53
|
+
/** Looks a session up, or says exactly why it can't be used. The three dead states stay
|
|
54
|
+
* apart — "never had it", "timed out, here's what it saw", "crashed" send a caller to
|
|
55
|
+
* three different things; only the last is `failed`. */
|
|
71
56
|
export async function useSession(registry, sessionId) {
|
|
72
57
|
const used = await registry.use(sessionId);
|
|
73
58
|
if (used.ok)
|
|
@@ -82,8 +67,7 @@ export async function useSession(registry, sessionId) {
|
|
|
82
67
|
return {
|
|
83
68
|
ok: false,
|
|
84
69
|
dead: {
|
|
85
|
-
// A crash is something breaking; a reap is Descry
|
|
86
|
-
// five states exist to keep those apart.
|
|
70
|
+
// A crash is something breaking; a reap is Descry tidying up — the five states keep those apart.
|
|
87
71
|
state: used.kind === "crashed" ? "failed" : "refused",
|
|
88
72
|
headline: used.kind === "crashed" ? `Browser session ${sessionId} crashed.` : `Browser session ${sessionId} is gone.`,
|
|
89
73
|
notes: [used.reason, ...carried],
|
|
@@ -91,19 +75,9 @@ export async function useSession(registry, sessionId) {
|
|
|
91
75
|
},
|
|
92
76
|
};
|
|
93
77
|
}
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* Every evidence-bearing browser tool goes through this rather than draining
|
|
99
|
-
* for itself. Two reasons, and the second is the one that matters: a tool
|
|
100
|
-
* that drained without correlating would be a tool through which the R4 write
|
|
101
|
-
* silently does not happen, and nothing about its reply would look different.
|
|
102
|
-
*
|
|
103
|
-
* A repository with no graph correlates nothing and says so. That is a real
|
|
104
|
-
* state — a developer can drive a browser against an app they have never
|
|
105
|
-
* analysed — and it must not look like "we looked and found no connection".
|
|
106
|
-
*/
|
|
78
|
+
/** Drains page evidence, relates it to the graph, and returns both in one place — every
|
|
79
|
+
* evidence-bearing tool routes through this so the R4 write can't silently not happen.
|
|
80
|
+
* No graph correlates nothing and says so; that's real, not "found no connection". */
|
|
107
81
|
export async function observeAndCorrelate(ctx, entry) {
|
|
108
82
|
const observation = await entry.page.drainEvidence();
|
|
109
83
|
const evidence = evidenceReport(observation);
|
|
@@ -116,10 +90,8 @@ export async function observeAndCorrelate(ctx, entry) {
|
|
|
116
90
|
driver: ctx.session.store().driver,
|
|
117
91
|
repo: ctx.session.config.repo,
|
|
118
92
|
runId: entry.runId,
|
|
119
|
-
// An edge records the commit the
|
|
120
|
-
//
|
|
121
|
-
// observation. Absent that, the observation is still real but cannot
|
|
122
|
-
// be dated against the source, so it is not written at all.
|
|
93
|
+
// An edge records the commit the app was built from, so a reader can tell if code
|
|
94
|
+
// moved since. Without it, the observation is real but undatable against source, so not written.
|
|
123
95
|
commitSha: commitSha ?? "",
|
|
124
96
|
repoRoot: ctx.session.repoPath,
|
|
125
97
|
requests: observation.requests,
|
|
@@ -139,27 +111,9 @@ export function emptyEvidence() {
|
|
|
139
111
|
export function reportOf(observation) {
|
|
140
112
|
return evidenceReport(observation);
|
|
141
113
|
}
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* The consent ruling's one hard bound. Checked here rather than in each verb
|
|
146
|
-
* so that a future eighth tool cannot forget it.
|
|
147
|
-
*/
|
|
148
|
-
/**
|
|
149
|
-
* Does this session's environment profile permit changing the application?
|
|
150
|
-
*
|
|
151
|
-
* Read off the profile the session was opened under — DEC-270's
|
|
152
|
-
* `safetyLevel`, the same field `observe_runtime` consults. Deliberately not
|
|
153
|
-
* a per-tool flag: two independent notions of "safe" is how a runtime run and
|
|
154
|
-
* a browser run end up disagreeing about the same environment.
|
|
155
|
-
*
|
|
156
|
-
* A session opened with no profile returns null here, and the session's own
|
|
157
|
-
* consent is then the only authorization — which is a real authorization,
|
|
158
|
-
* granted explicitly at `browser_start_session` against a named origin. The
|
|
159
|
-
* two are independent and both must pass: consent answers *may Descry drive a
|
|
160
|
-
* browser against this target at all*, the profile answers *may it mutate*,
|
|
161
|
-
* and neither excuses the other.
|
|
162
|
-
*/
|
|
114
|
+
/** Does the session's environment profile permit changing the application? Reads DEC-270's
|
|
115
|
+
* `safetyLevel` (same field `observe_runtime` consults), not a per-tool flag — two "safe"
|
|
116
|
+
* notions could disagree. No profile ⇒ null; consent and profile are independent, both must pass. */
|
|
163
117
|
export function mutationRefusal(entry) {
|
|
164
118
|
if (entry.profile === null)
|
|
165
119
|
return null;
|
|
@@ -170,6 +124,8 @@ export function mutationRefusal(entry) {
|
|
|
170
124
|
"browser_navigate and browser_snapshot read the page and remain available. This is a fact about the " +
|
|
171
125
|
"profile you supplied, not about the page — the session's own consent is intact and does not override it.");
|
|
172
126
|
}
|
|
127
|
+
/** Is `url` inside the origin this session was consented for? The consent ruling's one
|
|
128
|
+
* hard bound — checked here, not in each verb, so a future eighth tool can't forget it. */
|
|
173
129
|
export function withinConsent(entry, url) {
|
|
174
130
|
try {
|
|
175
131
|
return new URL(url).origin === entry.consentedOrigin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-support.js","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-support.js","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA;;;6DAG6D;AAE7D,OAAO,EAAE,MAAM,EAAoB,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,cAAc,EAA0B,MAAM,kBAAkB,CAAC;AAYrH,MAAM,UAAU,YAAY,CAAC,GAAgB;IAC3C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;QACjD,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,IAAI,EACF,mGAAmG;gBACnG,yFAAyF;SAC5F,CAAC;IACJ,CAAC;AACH,CAAC;AAWD;;iFAEiF;AACjF,MAAM,UAAU,aAAa,CAAI,OAA+B;IAC9D,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK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AAK,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO,CACL,wBAAwB,KAAK,CAAC,OAAO,CAAC,IAAI,2DAA2D;QACrG,mGAAmG;QACnG,qGAAqG;QACrG,0GAA0G,CAC3G,CAAC;AACJ,CAAC;AAED;4FAC4F;AAC5F,MAAM,UAAU,aAAa,CAAC,KAA0B,EAAE,GAAW;IACnE,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,eAAe,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which URL schemes `browser_start_session` may open (A-F7). `file:`/`data:` resolve
|
|
3
|
+
* `.origin` to `"null"`, so same-origin containment passes for every local file (e.g.
|
|
4
|
+
* `file:///etc/passwd` reads back as inside consent). Only http:/https: trusted by
|
|
5
|
+
* default; opt in extras via `DESCRY_ALLOW_BROWSER_URL_SCHEMES`. */
|
|
6
|
+
export declare const ALLOW_BROWSER_URL_SCHEMES_ENV_VAR = "DESCRY_ALLOW_BROWSER_URL_SCHEMES";
|
|
7
|
+
export type UrlSchemeDecision = {
|
|
8
|
+
readonly allowed: true;
|
|
9
|
+
} | {
|
|
10
|
+
readonly allowed: false;
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function checkUrlScheme(url: URL): UrlSchemeDecision;
|
|
14
|
+
//# sourceMappingURL=url-scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-scheme.d.ts","sourceRoot":"","sources":["../../src/browser/url-scheme.ts"],"names":[],"mappings":"AAAA;;;;oEAIoE;AAEpE,eAAO,MAAM,iCAAiC,qCAAqC,CAAC;AAepF,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAOlH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,iBAAiB,CAa1D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which URL schemes `browser_start_session` may open (A-F7). `file:`/`data:` resolve
|
|
3
|
+
* `.origin` to `"null"`, so same-origin containment passes for every local file (e.g.
|
|
4
|
+
* `file:///etc/passwd` reads back as inside consent). Only http:/https: trusted by
|
|
5
|
+
* default; opt in extras via `DESCRY_ALLOW_BROWSER_URL_SCHEMES`. */
|
|
6
|
+
export const ALLOW_BROWSER_URL_SCHEMES_ENV_VAR = "DESCRY_ALLOW_BROWSER_URL_SCHEMES";
|
|
7
|
+
const DEFAULT_ALLOWED_SCHEMES = new Set(["http:", "https:"]);
|
|
8
|
+
function operatorAllowedSchemes() {
|
|
9
|
+
const raw = process.env[ALLOW_BROWSER_URL_SCHEMES_ENV_VAR];
|
|
10
|
+
if (raw === undefined || raw.trim() === "")
|
|
11
|
+
return DEFAULT_ALLOWED_SCHEMES;
|
|
12
|
+
const extra = raw
|
|
13
|
+
.split(",")
|
|
14
|
+
.map((s) => s.trim())
|
|
15
|
+
.filter((s) => s !== "")
|
|
16
|
+
.map((s) => (s.endsWith(":") ? s : `${s}:`));
|
|
17
|
+
return new Set([...DEFAULT_ALLOWED_SCHEMES, ...extra]);
|
|
18
|
+
}
|
|
19
|
+
/** The one exception: `about:blank` carries no content (no hazard like `file:`/`data:`)
|
|
20
|
+
* and is the standard pre-navigation target for browser automation. Other `about:`
|
|
21
|
+
* URLs (`about:config`, …) can expose browser-internal state and are excluded. */
|
|
22
|
+
const INERT_TARGET = "about:blank";
|
|
23
|
+
export function checkUrlScheme(url) {
|
|
24
|
+
if (url.href === INERT_TARGET)
|
|
25
|
+
return { allowed: true };
|
|
26
|
+
const allowed = operatorAllowedSchemes();
|
|
27
|
+
if (allowed.has(url.protocol))
|
|
28
|
+
return { allowed: true };
|
|
29
|
+
return {
|
|
30
|
+
allowed: false,
|
|
31
|
+
reason: `"${url.href}" uses the "${url.protocol}" scheme, which this tool does not open by default. Same-origin ` +
|
|
32
|
+
"containment (the check every other browser tool relies on) does not hold for a file: or data: URL — " +
|
|
33
|
+
'both resolve to the origin "null", so a session opened on one would treat every local file as inside ' +
|
|
34
|
+
`consent. Only http: and https: are allowed by default; set ${ALLOW_BROWSER_URL_SCHEMES_ENV_VAR} ` +
|
|
35
|
+
'(e.g. "file") in this server\'s own environment to add a scheme deliberately.',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=url-scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-scheme.js","sourceRoot":"","sources":["../../src/browser/url-scheme.ts"],"names":[],"mappings":"AAAA;;;;oEAIoE;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAAG,kCAAkC,CAAC;AAEpF,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7D,SAAS,sBAAsB;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC3D,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,uBAAuB,CAAC;IAC3E,MAAM,KAAK,GAAG,GAAG;SACd,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,uBAAuB,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC;AAID;;mFAEmF;AACnF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,sBAAsB,EAAE,CAAC;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EACJ,IAAI,GAAG,CAAC,IAAI,eAAe,GAAG,CAAC,QAAQ,kEAAkE;YACzG,sGAAsG;YACtG,uGAAuG;YACvG,8DAA8D,iCAAiC,GAAG;YAClG,+EAA+E;KAClF,CAAC;AACJ,CAAC"}
|
package/dist/cancellation.d.ts
CHANGED
|
@@ -1,53 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* something real — a browser, an application, a test runner — the work
|
|
7
|
-
* continuing after the reply is discarded is the whole problem: a Chromium
|
|
8
|
-
* nothing will ever close, an application still being driven, a scenario
|
|
9
|
-
* still clicking through a live system on behalf of a caller who cancelled.
|
|
10
|
-
*
|
|
11
|
-
* So `ctx.signal` is checked at the points where a tool is about to *start*
|
|
12
|
-
* something, and whatever the tool already started is released. Three rules
|
|
13
|
-
* hold everywhere it is used:
|
|
14
|
-
*
|
|
15
|
-
* 1. **Release what this call started, and nothing else.** A cancelled verb
|
|
16
|
-
* does not close the session `browser_start_session` opened, and a
|
|
17
|
-
* cancelled run does not kill a process it merely attached to. Cancellation
|
|
18
|
-
* stops the work it was asked to stop; tearing down a caller's own state
|
|
19
|
-
* because one call was cancelled is a second failure, not a cleanup.
|
|
20
|
-
* 2. **Keep the evidence.** Nothing witnessed before the cancellation is
|
|
21
|
-
* thrown away. Evidence captured and then dropped is worse than evidence
|
|
22
|
-
* never captured, because nothing discloses it.
|
|
23
|
-
* 3. **Never let a cancelled run render as a clean one.** A check that stopped
|
|
24
|
-
* a third of the way through has not passed, and the reply says so even
|
|
25
|
-
* though nobody is expected to read it — the reply is suppressed only when
|
|
26
|
-
* the cancellation arrived over the wire, and this same path is reachable
|
|
27
|
-
* when a signal is aborted for any other reason.
|
|
28
|
-
*
|
|
29
|
-
* The state is `refused`: cancellation is a fact about Descry — it stopped
|
|
30
|
-
* looking — and never a fact about the user's code. `empty` would say the run
|
|
31
|
-
* looked and found nothing, which is the one thing it must not say.
|
|
32
|
-
*/
|
|
1
|
+
/** What a tool does when the caller has already gone. `notifications/cancelled` stops the
|
|
2
|
+
* server from waiting, not the work itself — a browser or process would keep running
|
|
3
|
+
* unless released. Three rules: release only what this call started (never a caller's own
|
|
4
|
+
* state), keep evidence already witnessed, never render a cancelled run as clean. State is
|
|
5
|
+
* `refused` (a fact about Descry stopping) not `empty` (which would falsely say it looked and found nothing). */
|
|
33
6
|
/** The reply state for a call that stopped because its signal was aborted. */
|
|
34
7
|
export declare const CANCELLED_STATE: "refused";
|
|
35
8
|
export declare function cancellationHeadline(what: string): string;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* when there was nothing to release — claiming a teardown that did not happen
|
|
40
|
-
* is the same class of false statement as hiding one that did.
|
|
41
|
-
*/
|
|
9
|
+
/** @param stopped What this call stopped doing, in the caller's terms.
|
|
10
|
+
* @param released What it tore down, if anything — omitted when nothing was released;
|
|
11
|
+
* claiming a teardown that didn't happen is as false as hiding one that did. */
|
|
42
12
|
export declare function cancellationNotes(stopped: string, released?: string): readonly string[];
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* The disposal half is the point. `Promise.race` leaves the losing promise
|
|
47
|
-
* pending forever, so a listener added per call and never removed accumulates
|
|
48
|
-
* on a signal that outlives the call — the standard leak this shape exists to
|
|
49
|
-
* avoid. Callers race and then dispose in a `finally`.
|
|
50
|
-
*/
|
|
13
|
+
/** A promise that settles when the signal aborts, plus a way to stop listening.
|
|
14
|
+
* `Promise.race` leaves the loser pending forever, so an unremoved listener leaks on a
|
|
15
|
+
* signal that outlives the call — callers race then dispose in a `finally`. */
|
|
51
16
|
export declare function whenAborted(signal: AbortSignal): {
|
|
52
17
|
readonly promise: Promise<void>;
|
|
53
18
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../src/cancellation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../src/cancellation.ts"],"names":[],"mappings":"AAAA;;;;kHAIkH;AAElH,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAG,SAAkB,CAAC;AAElD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;iFAEiF;AACjF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAMvF;AAED;;gFAEgF;AAChF,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAgBrG"}
|