@descryy/mcp 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +59 -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 +4 -16
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +6 -20
- 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 +40 -194
- 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-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 +10 -58
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +38 -90
- package/dist/registry.js.map +1 -1
- package/dist/render.d.ts +42 -11
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +74 -10
- 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 +37 -17
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +67 -259
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +69 -250
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +24 -118
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +44 -166
- 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 +15 -74
- 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 +33 -55
- 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 +257 -435
- 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 +24 -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 +68 -16
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +98 -35
- 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 +14 -57
- 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 +14 -69
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +23 -74
- 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 +30 -21
package/dist/runtime-registry.js
CHANGED
|
@@ -1,64 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* dependency-direction fact", and the identical fact holds for
|
|
7
|
-
* `descry-runtime`'s per-language adapters. `@descryy/mcp` now depends on the
|
|
8
|
-
* runtime's *language-neutral* packages (orchestrator, evidence store,
|
|
9
|
-
* correlation, graph correlator) and on none of its nine language adapters,
|
|
10
|
-
* because an `import { createTypeScriptRuntimeAdapter } from
|
|
11
|
-
* "@descryy/runtime-adapter-typescript"` in a tool file would put the word
|
|
12
|
-
* "typescript" above the IR boundary in the one process that runs everything
|
|
13
|
-
* — rule 1, which the repository's own CLAUDE.md calls a design bug rather
|
|
14
|
-
* than a style preference.
|
|
15
|
-
*
|
|
16
|
-
* `uat-phase-1-bug-fixes.md`'s Phase 1 listed `runtime-adapter-typescript`
|
|
17
|
-
* among the packages to add as a real dependency. It is deliberately **not**
|
|
18
|
-
* one, and that is the only narrowing this integration makes to that list: the
|
|
19
|
-
* adapter is named in the call as a module specifier and imported at run time,
|
|
20
|
-
* exactly as every static source already is. The engine knows `RuntimeAdapter`;
|
|
21
|
-
* it never knows the word "typescript". Nothing about the plan's direction
|
|
22
|
-
* changes — one language ships first either way, it just ships as a
|
|
23
|
-
* configured specifier rather than as a compiled-in import.
|
|
24
|
-
*
|
|
25
|
-
* ## The factory convention
|
|
26
|
-
*
|
|
27
|
-
* `descry-runtime`'s nine language adapters each export a factory named
|
|
28
|
-
* `create<Something>RuntimeAdapter` — `createTypeScriptRuntimeAdapter`,
|
|
29
|
-
* `createPythonRuntimeAdapter`, `createJavaRuntimeAdapter`. Same shape as
|
|
30
|
-
* `registry.ts`'s `create*Adapter` convention and resolved the same way: an
|
|
31
|
-
* explicit `export` in the call wins; failing that, the single export matching
|
|
32
|
-
* the pattern is used; **two matches is an error, not a coin toss.**
|
|
33
|
-
*
|
|
34
|
-
* ## Failing to load is a disclosure, never a shrug
|
|
35
|
-
*
|
|
36
|
-
* A runtime adapter that will not import is the difference between "we
|
|
37
|
-
* observed your service and saw nothing" and "we could not observe your
|
|
38
|
-
* service at all" — §20.2's distinction, and the one `observe_runtime` turns
|
|
39
|
-
* into a `refused` state rather than an `ok` with an empty evidence list.
|
|
40
|
-
* Every failure leaves here as a thrown `RuntimeAdapterLoadError` carrying the
|
|
41
|
-
* specifier and the reason, so the caller cannot take an adapter without also
|
|
42
|
-
* having to handle not getting one.
|
|
43
|
-
*
|
|
44
|
-
* ## B5: a bare specifier now resolves from the user's own repository first
|
|
45
|
-
*
|
|
46
|
-
* A bare specifier in a dynamic `import()` resolves against the IMPORTING
|
|
47
|
-
* MODULE's own location — this file's, unconditionally, before this fix. The
|
|
48
|
-
* documented launch (`npx -y @descryy/mcp <repo-path>`) puts this file inside
|
|
49
|
-
* an npx cache, so that root held only what npx installed; the user's
|
|
50
|
-
* repository, its `node_modules`, and the working directory were never
|
|
51
|
-
* consulted, which made the documented remedy ("install the adapter
|
|
52
|
-
* alongside this server") impossible under the documented configuration.
|
|
53
|
-
*
|
|
54
|
-
* `resolveAdapterModule` (below `loadRuntimeAdapter`) now tries three roots
|
|
55
|
-
* in order and names every one tried on failure: an already-resolved
|
|
56
|
-
* specifier is used directly; a bare specifier resolves from `repoPath` —
|
|
57
|
-
* the repository `observe_runtime` was pointed at — via `createRequire`
|
|
58
|
-
* anchored at that repo's own `package.json`; failing that, from this
|
|
59
|
-
* module's own closure, unchanged, so an adapter already declared as
|
|
60
|
-
* `@descryy/mcp`'s own dependency still resolves.
|
|
61
|
-
*/
|
|
1
|
+
/** How `observe_runtime` reaches a runtime adapter without naming a language above the IR
|
|
2
|
+
* boundary (rule 1): `@descryy/mcp` depends only on descry-runtime's language-neutral packages,
|
|
3
|
+
* and each language adapter is named as a module specifier and imported at run time via
|
|
4
|
+
* `create<X>RuntimeAdapter`. A load failure is disclosed as `RuntimeAdapterLoadError`, never
|
|
5
|
+
* treated as an empty evidence list (§20.2's ok-vs-refused distinction). */
|
|
62
6
|
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
63
7
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
64
8
|
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
@@ -70,11 +14,9 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
70
14
|
import { createRequire } from "node:module";
|
|
71
15
|
import { isAbsolute, join } from "node:path";
|
|
72
16
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
* failure). Both are honest; they are not the same statement.
|
|
77
|
-
*/
|
|
17
|
+
import { checkModuleTrust, checkRepoResolvedModuleTrust } from "./module-trust.js";
|
|
18
|
+
/** Distinct from a generic `Error` so the tool can tell "the adapter would not load" (disclosed
|
|
19
|
+
* refusal) apart from "the run itself broke" (failure) — both honest, not the same statement. */
|
|
78
20
|
export class RuntimeAdapterLoadError extends Error {
|
|
79
21
|
spec;
|
|
80
22
|
constructor(spec, reason) {
|
|
@@ -91,17 +33,9 @@ function describe(error) {
|
|
|
91
33
|
}
|
|
92
34
|
return String(error);
|
|
93
35
|
}
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* The adapters are compiled separately and published as their own packages, so
|
|
99
|
-
* an `instanceof` across that boundary is a well-known way to be wrong —
|
|
100
|
-
* `registry.ts`'s `asAdapter` says the same thing about `LanguageAdapter`, for
|
|
101
|
-
* the same reason. A module that exports a matching factory returning
|
|
102
|
-
* something without these is a broken adapter, and saying so here beats a
|
|
103
|
-
* `TypeError` thrown from inside a collector three layers down.
|
|
104
|
-
*/
|
|
36
|
+
/** Duck-typed on the four members actually used, not `instanceof` — adapters are compiled and
|
|
37
|
+
* published separately, so cross-package `instanceof` is unreliable (same reasoning as
|
|
38
|
+
* `registry.ts`'s `asAdapter`). Catches a broken adapter here, not as a `TypeError` three layers down. */
|
|
105
39
|
function isRuntimeAdapter(value) {
|
|
106
40
|
const candidate = value;
|
|
107
41
|
return (typeof candidate === "object" &&
|
|
@@ -111,14 +45,9 @@ function isRuntimeAdapter(value) {
|
|
|
111
45
|
typeof candidate.stackTraceParser === "object" &&
|
|
112
46
|
typeof candidate.sourceLocationResolver === "object");
|
|
113
47
|
}
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* Under the documented `npx -y @descryy/mcp <repo-path>` launch this is
|
|
118
|
-
* somewhere under an npx cache, which is never a directory the user
|
|
119
|
-
* installed anything into — the refusal below names it as exactly that,
|
|
120
|
-
* rather than presenting it as though it were installable.
|
|
121
|
-
*/
|
|
48
|
+
/** This module's own directory — last-resort resolution root. Under the documented
|
|
49
|
+
* `npx -y @descryy/mcp <repo-path>` launch this sits inside an npx cache, never a directory the
|
|
50
|
+
* user installed anything into; the refusal below names it as exactly that. */
|
|
122
51
|
const SERVER_OWN_ROOT = fileURLToPath(new URL(".", import.meta.url));
|
|
123
52
|
/** An absolute filesystem path or a `file://` URL: already fully resolved, nothing left for repoPath or the server's own closure to add. */
|
|
124
53
|
function isAlreadyResolved(specifier) {
|
|
@@ -127,30 +56,9 @@ function isAlreadyResolved(specifier) {
|
|
|
127
56
|
async function importSpecifier(specifier) {
|
|
128
57
|
return (await import(__rewriteRelativeImportExtension(specifier)));
|
|
129
58
|
}
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* single-root version of this function — never against `repoPath` or
|
|
134
|
-
* `process.cwd()`. Under the documented `npx -y @descryy/mcp <repo-path>`
|
|
135
|
-
* launch that resolution root is an npx cache holding only what npx
|
|
136
|
-
* installed, so the documented remedy ("install the adapter alongside this
|
|
137
|
-
* server") was impossible: there was no directory the user controls on that
|
|
138
|
-
* resolution path at all.
|
|
139
|
-
*
|
|
140
|
-
* Three roots, tried in this order, and a failure names every one tried —
|
|
141
|
-
* never only the one that happened to throw last:
|
|
142
|
-
*
|
|
143
|
-
* 1. An already-resolved specifier (`isAlreadyResolved`) is fully explicit;
|
|
144
|
-
* used directly, and no other root applies to it.
|
|
145
|
-
* 2. The repository the server was pointed at (`repoPath`) — resolved via
|
|
146
|
-
* `createRequire` anchored at that repo's own `package.json`, so
|
|
147
|
-
* `npm i -D <adapter>` in the user's project — the mental model the
|
|
148
|
-
* documentation already gives every reader — actually works.
|
|
149
|
-
* 3. This module's own closure (`SERVER_OWN_ROOT`, today's only root) —
|
|
150
|
-
* kept last rather than removed, so an adapter declared as a real
|
|
151
|
-
* dependency of `@descryy/mcp` itself still resolves (see this fix's
|
|
152
|
-
* own decisions-inbox entry on `optionalDependencies`).
|
|
153
|
-
*/
|
|
59
|
+
/** B5's fix: a bare specifier used to resolve only against this file's own location (an npx cache
|
|
60
|
+
* under the documented launch — nothing installable there). Now tries, in order, naming every
|
|
61
|
+
* root on failure: already-resolved; `repoPath` via `createRequire`; this module's own closure. */
|
|
154
62
|
async function resolveAdapterModule(spec, repoPath) {
|
|
155
63
|
if (isAlreadyResolved(spec.module)) {
|
|
156
64
|
try {
|
|
@@ -161,15 +69,26 @@ async function resolveAdapterModule(spec, repoPath) {
|
|
|
161
69
|
}
|
|
162
70
|
}
|
|
163
71
|
const repoNodeModules = join(repoPath, "node_modules");
|
|
72
|
+
let resolvedFromRepo = null;
|
|
164
73
|
try {
|
|
165
74
|
const repoRequire = createRequire(pathToFileURL(join(repoPath, "package.json")));
|
|
166
|
-
|
|
167
|
-
return await importSpecifier(pathToFileURL(resolved).href);
|
|
75
|
+
resolvedFromRepo = repoRequire.resolve(spec.module);
|
|
168
76
|
}
|
|
169
77
|
catch {
|
|
170
|
-
// Fall through to the server's own closure
|
|
171
|
-
|
|
172
|
-
|
|
78
|
+
// Fall through to the server's own closure; noted only if that root fails too.
|
|
79
|
+
}
|
|
80
|
+
if (resolvedFromRepo !== null) {
|
|
81
|
+
// A-F1 (same fix as registry.ts's importSource): refused, not imported, when the resolved
|
|
82
|
+
// file is git-tracked in the repo rather than installed by a package manager — a deliberate
|
|
83
|
+
// security refusal, not "could not resolve", so it never falls through (module-trust.ts).
|
|
84
|
+
const repoTrust = await checkRepoResolvedModuleTrust({
|
|
85
|
+
specifier: spec.module,
|
|
86
|
+
repoPath,
|
|
87
|
+
resolvedAbsolutePath: resolvedFromRepo,
|
|
88
|
+
});
|
|
89
|
+
if (!repoTrust.allowed)
|
|
90
|
+
throw new RuntimeAdapterLoadError(spec, repoTrust.reason);
|
|
91
|
+
return await importSpecifier(pathToFileURL(resolvedFromRepo).href);
|
|
173
92
|
}
|
|
174
93
|
try {
|
|
175
94
|
return await importSpecifier(spec.module);
|
|
@@ -181,6 +100,12 @@ async function resolveAdapterModule(spec, repoPath) {
|
|
|
181
100
|
}
|
|
182
101
|
}
|
|
183
102
|
export async function loadRuntimeAdapter(spec, repoPath) {
|
|
103
|
+
// A-F2: `spec.module` comes straight from `observe_runtime`'s arguments, unvalidated upstream.
|
|
104
|
+
// A path-like specifier is refused before resolution unless DESCRY_ALLOW_PATH_ADAPTER_MODULES=1
|
|
105
|
+
// is set (module-trust.ts).
|
|
106
|
+
const trust = checkModuleTrust(spec.module);
|
|
107
|
+
if (!trust.allowed)
|
|
108
|
+
throw new RuntimeAdapterLoadError(spec, trust.reason);
|
|
184
109
|
const module = await resolveAdapterModule(spec, repoPath);
|
|
185
110
|
let factoryName = spec.export;
|
|
186
111
|
if (factoryName === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;6EAI6E;;;;;;;;;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa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TargetDescriptor, } from "./scenario.ts";
|
|
2
2
|
export { parseScenario, serializeScenario, type ScenarioParseResult } from "./parse.ts";
|
|
3
|
-
export { scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario } from "./storage.ts";
|
|
3
|
+
export { scenariosDirectory, scenarioPath, listScenarios, ScenarioListError, readScenario, writeScenario, } from "./storage.ts";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,cAAc,CAAC"}
|
package/dist/scenarios/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { SCENARIO_SCHEMA_VERSION, isUnverifying, } from "./scenario.js";
|
|
2
2
|
export { parseScenario, serializeScenario } from "./parse.js";
|
|
3
|
-
export { scenariosDirectory, scenarioPath, listScenarios, readScenario, writeScenario } from "./storage.js";
|
|
3
|
+
export { scenariosDirectory, scenarioPath, listScenarios, ScenarioListError, readScenario, writeScenario, } from "./storage.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,GAOd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4B,MAAM,YAAY,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,GAOd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAA4B,MAAM,YAAY,CAAC;AACxF,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,cAAc,CAAC"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reading a stored scenario — validation, and the refusals that are the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* missing field into a default would let a scenario keep loading after it had
|
|
6
|
-
* stopped describing the application, which is the exact rot both scenario
|
|
7
|
-
* rulings exist to prevent — and it would do it at the one moment nobody is
|
|
8
|
-
* watching, a replay in CI.
|
|
9
|
-
*
|
|
10
|
-
* Problems are collected rather than thrown one at a time, so a person fixing a
|
|
11
|
-
* hand-edited file sees everything wrong with it in one pass instead of
|
|
12
|
-
* discovering the next fault on the next run.
|
|
2
|
+
* Reading a stored scenario — validation, and the refusals that are the
|
|
3
|
+
* point. Refuses rather than repairs: coercing a missing field to a default
|
|
4
|
+
* would let a scenario keep loading after it stopped describing the app, silently, in CI where nobody's watching. Problems collect in one pass, not one throw at a time.
|
|
13
5
|
*/
|
|
14
6
|
import { type Scenario } from "./scenario.ts";
|
|
15
7
|
export type ScenarioParseResult = {
|
|
@@ -19,13 +11,7 @@ export type ScenarioParseResult = {
|
|
|
19
11
|
readonly valid: false;
|
|
20
12
|
readonly problems: readonly string[];
|
|
21
13
|
};
|
|
22
|
-
/**
|
|
23
|
-
* Validate an already-JSON-decoded value as a scenario.
|
|
24
|
-
*
|
|
25
|
-
* The version check runs first and short-circuits: reporting field problems
|
|
26
|
-
* against a schema this reader does not understand would be noise about a
|
|
27
|
-
* shape that was never meant to satisfy it.
|
|
28
|
-
*/
|
|
14
|
+
/** Validates an already-decoded value as a scenario. Version check runs first and short-circuits — reporting field problems against an unsupported schema would be noise about a shape never meant to satisfy it. */
|
|
29
15
|
export declare function parseScenario(raw: unknown): ScenarioParseResult;
|
|
30
16
|
/** Newline-terminated and two-space indented, so a saved scenario reads as a reviewable diff rather than one long line. */
|
|
31
17
|
export declare function serializeScenario(scenario: Scenario): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/scenarios/parse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/scenarios/parse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,QAAQ,EAMd,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAwHpE,qNAAqN;AACrN,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAiE/D;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE5D"}
|
package/dist/scenarios/parse.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reading a stored scenario — validation, and the refusals that are the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* missing field into a default would let a scenario keep loading after it had
|
|
6
|
-
* stopped describing the application, which is the exact rot both scenario
|
|
7
|
-
* rulings exist to prevent — and it would do it at the one moment nobody is
|
|
8
|
-
* watching, a replay in CI.
|
|
9
|
-
*
|
|
10
|
-
* Problems are collected rather than thrown one at a time, so a person fixing a
|
|
11
|
-
* hand-edited file sees everything wrong with it in one pass instead of
|
|
12
|
-
* discovering the next fault on the next run.
|
|
2
|
+
* Reading a stored scenario — validation, and the refusals that are the
|
|
3
|
+
* point. Refuses rather than repairs: coercing a missing field to a default
|
|
4
|
+
* would let a scenario keep loading after it stopped describing the app, silently, in CI where nobody's watching. Problems collect in one pass, not one throw at a time.
|
|
13
5
|
*/
|
|
14
6
|
import { SCENARIO_SCHEMA_VERSION, } from "./scenario.js";
|
|
15
7
|
const ACTIONS = ["navigate", "click", "type", "fill"];
|
|
@@ -34,8 +26,7 @@ function readTarget(raw, where, problems) {
|
|
|
34
26
|
problems.push(`${where}: target must be an object with role, name and selector`);
|
|
35
27
|
return null;
|
|
36
28
|
}
|
|
37
|
-
// All three, named individually
|
|
38
|
-
// not a smaller descriptor -- it is a descriptor that would have to fall back
|
|
29
|
+
// All three, named individually: a descriptor missing one would fall back
|
|
39
30
|
// to the others to resolve, and a fallback chain substitutes quietly.
|
|
40
31
|
const missing = ["role", "name", "selector"].filter((field) => typeof raw[field] !== "string");
|
|
41
32
|
if (missing.length > 0) {
|
|
@@ -50,10 +41,9 @@ function readStep(raw, index, problems) {
|
|
|
50
41
|
problems.push(`${where}: not an object`);
|
|
51
42
|
return null;
|
|
52
43
|
}
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
// broken
|
|
56
|
-
// to something else.
|
|
44
|
+
// Ref refusal, enforced not documented: a stored ref is scoped to a
|
|
45
|
+
// snapshot that no longer exists, so a scenario carrying one is already
|
|
46
|
+
// broken — it just wouldn't say so until replay resolved it to nothing.
|
|
57
47
|
if ("ref" in raw) {
|
|
58
48
|
problems.push(`${where}: carries a ref, which cannot be stored — a ref is scoped to the snapshot that issued it and means nothing in a later session. Store role, name and selector instead.`);
|
|
59
49
|
}
|
|
@@ -104,9 +94,8 @@ function readAssertion(raw, index, stepCount, problems) {
|
|
|
104
94
|
}
|
|
105
95
|
const afterStep = raw["afterStep"] ?? null;
|
|
106
96
|
if (afterStep !== null) {
|
|
107
|
-
// An assertion anchored past the end would never run
|
|
108
|
-
//
|
|
109
|
-
// is the same false negative the assertions field exists to prevent.
|
|
97
|
+
// An assertion anchored past the end would never run and never say so —
|
|
98
|
+
// the same false negative the assertions field exists to prevent.
|
|
110
99
|
if (typeof afterStep !== "number" || !Number.isInteger(afterStep) || afterStep < 0 || afterStep >= stepCount) {
|
|
111
100
|
problems.push(`${where}: afterStep must be null (end of scenario) or the index of a real step (0..${stepCount - 1}), got ${String(afterStep)}`);
|
|
112
101
|
return null;
|
|
@@ -119,13 +108,7 @@ function readAssertion(raw, index, stepCount, problems) {
|
|
|
119
108
|
expected: typeof raw["expected"] === "string" ? raw["expected"] : null,
|
|
120
109
|
};
|
|
121
110
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Validate an already-JSON-decoded value as a scenario.
|
|
124
|
-
*
|
|
125
|
-
* The version check runs first and short-circuits: reporting field problems
|
|
126
|
-
* against a schema this reader does not understand would be noise about a
|
|
127
|
-
* shape that was never meant to satisfy it.
|
|
128
|
-
*/
|
|
111
|
+
/** Validates an already-decoded value as a scenario. Version check runs first and short-circuits — reporting field problems against an unsupported schema would be noise about a shape never meant to satisfy it. */
|
|
129
112
|
export function parseScenario(raw) {
|
|
130
113
|
const problems = [];
|
|
131
114
|
if (!isRecord(raw))
|
|
@@ -136,9 +119,7 @@ export function parseScenario(raw) {
|
|
|
136
119
|
return { valid: false, problems };
|
|
137
120
|
}
|
|
138
121
|
if (schemaVersion > SCENARIO_SCHEMA_VERSION) {
|
|
139
|
-
// Refused by number, never parsed optimistically
|
|
140
|
-
// best-effort parses a future schema silently ignores the field that was
|
|
141
|
-
// added precisely because it mattered.
|
|
122
|
+
// Refused by number, never parsed optimistically — best-effort parsing a future schema would silently ignore a field added because it mattered.
|
|
142
123
|
return {
|
|
143
124
|
valid: false,
|
|
144
125
|
problems: [
|
|
@@ -165,10 +146,9 @@ export function parseScenario(raw) {
|
|
|
165
146
|
problems.push("steps is required and must hold at least one step");
|
|
166
147
|
}
|
|
167
148
|
const steps = Array.isArray(rawSteps) ? rawSteps.map((step, i) => readStep(step, i, problems)) : [];
|
|
168
|
-
// Required,
|
|
169
|
-
// Empty says "
|
|
170
|
-
//
|
|
171
|
-
// field existed read as if it had been considered.
|
|
149
|
+
// Required, may be empty — absent is a different statement than empty.
|
|
150
|
+
// Empty says "checks nothing" (honest); absent would let a pre-field
|
|
151
|
+
// scenario read as if it had been considered.
|
|
172
152
|
const rawAssertions = raw["assertions"];
|
|
173
153
|
if (!Array.isArray(rawAssertions)) {
|
|
174
154
|
problems.push("assertions is required — use [] for a scenario that asserts nothing, which replays as unverified rather than passed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/scenarios/parse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/scenarios/parse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,GAOxB,MAAM,eAAe,CAAC;AAMvB,MAAM,OAAO,GAAkC,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACrF,MAAM,eAAe,GAAqC;IACxD,gBAAgB;I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WAAW,EAAE,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;YACjE,SAAS,EAAE,GAAG,CAAC,WAAW,CAAW;YACrC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAW;YACjC,aAAa,EAAE,GAAG,CAAC,eAAe,CAAW;YAC7C,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAqB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;YACzD,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;SACzE;KACF,CAAC;AACJ,CAAC;AAED,2HAA2H;AAC3H,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -1,38 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a saved scenario
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* deliberately. A scenario is an artifact a person authored and a reviewer
|
|
7
|
-
* reads in a diff; whether one can be *replayed* is the runner's question, and
|
|
8
|
-
* keeping the two apart is what lets the format be tested without launching
|
|
9
|
-
* anything.
|
|
10
|
-
*
|
|
11
|
-
* ## The one shape decision worth reading before the types
|
|
12
|
-
*
|
|
13
|
-
* **A step stores no `ref`.** The port's action verbs take a `ref` and that is
|
|
14
|
-
* correct — a ref ties an action to a snapshot the agent actually saw. But a
|
|
15
|
-
* ref is scoped to the snapshot that issued it, and a replay is always a later
|
|
16
|
-
* session, so a stored ref resolves to nothing or, worse, to something else. A
|
|
17
|
-
* step therefore stores a `TargetDescriptor` and the runner re-resolves it
|
|
18
|
-
* against a fresh snapshot.
|
|
19
|
-
*
|
|
20
|
-
* All three descriptor fields are required, together, always. Not one of them
|
|
21
|
-
* and not a fallback chain: `selector` alone breaks on a markup refactor and
|
|
22
|
-
* silently matches the wrong element when a class is reused; `role` + `name`
|
|
23
|
-
* alone breaks on a copy change; and "try the selector, else role+name" is the
|
|
24
|
-
* dangerous option, because it turns a real disagreement into a quiet
|
|
25
|
-
* substitution — which is how a scenario keeps reporting green against a page
|
|
26
|
-
* that changed underneath it.
|
|
27
|
-
*/
|
|
2
|
+
* What a saved scenario is (DEC-383's schema half). No browser import — replayability
|
|
3
|
+
* is the runner's separate question. A step stores a `TargetDescriptor`, never a `ref`
|
|
4
|
+
* (refs are snapshot-scoped, stale by replay). All 3 descriptor fields are required
|
|
5
|
+
* together — a fallback chain would quietly substitute a match instead of disagreeing. */
|
|
28
6
|
/** Bumped when a stored scenario's shape changes. An integer, never semver: one repository, one reader, nothing to argue about. */
|
|
29
7
|
export declare const SCENARIO_SCHEMA_VERSION = 1;
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* fresh snapshot, and required to match **exactly one** element — zero,
|
|
33
|
-
* ambiguous and partial are each a refusal that names which of these three
|
|
34
|
-
* fields disagreed and what the page holds now.
|
|
35
|
-
*/
|
|
8
|
+
/** How a step names its element. Re-resolved at replay against a fresh snapshot,
|
|
9
|
+
* must match exactly one — zero/ambiguous/partial each refuse, naming what disagreed. */
|
|
36
10
|
export interface TargetDescriptor {
|
|
37
11
|
readonly role: string;
|
|
38
12
|
readonly name: string;
|
|
@@ -49,20 +23,9 @@ export interface ScenarioStep {
|
|
|
49
23
|
/** What to enter. Present for `type` and `fill` alone. `type` appends, `fill` replaces — the runtime's two text verbs, kept distinct here because the stored artifact must say which one a replay should perform. */
|
|
50
24
|
readonly text: string | null;
|
|
51
25
|
}
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Kept deliberately small and derived from what a snapshot and a run's
|
|
56
|
-
* observations already carry, rather than invented: an assertion the runner
|
|
57
|
-
* cannot evaluate from real evidence is a promise the format cannot keep.
|
|
58
|
-
*
|
|
59
|
-
* `noConsoleErrors` and `noFailedRequests` are worth one note, because they
|
|
60
|
-
* interact with `DEC-384`. An *observed* console
|
|
61
|
-
* error does not block a push — it is frequently true of a working page. An
|
|
62
|
-
* *asserted* absence of console errors that then fails does block, because the
|
|
63
|
-
* author opted in and wrote the claim down. Same evidence, different status,
|
|
64
|
-
* and the difference is entirely whether a person claimed something about it.
|
|
65
|
-
*/
|
|
26
|
+
/** What the scenario claims. Kept small, derived only from what a snapshot/run
|
|
27
|
+
* can observe — an assertion the runner can't evaluate is a promise it can't keep.
|
|
28
|
+
* DEC-384: an *observed* console error/failed request doesn't block; an *asserted* one does. */
|
|
66
29
|
export type ScenarioAssertionKind = "elementVisible" | "textEquals" | "urlEquals" | "noConsoleErrors" | "noFailedRequests";
|
|
67
30
|
export interface ScenarioAssertion {
|
|
68
31
|
readonly kind: ScenarioAssertionKind;
|
|
@@ -78,38 +41,19 @@ export interface Scenario {
|
|
|
78
41
|
readonly name: string;
|
|
79
42
|
readonly description: string | null;
|
|
80
43
|
readonly targetUrl: string;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* Neither expires anything and neither is checked at replay. They exist so a
|
|
85
|
-
* failure can say *the scenario was written against a different revision of
|
|
86
|
-
* this application*, which is usually the answer to "why did this break".
|
|
87
|
-
* DEC-223 §7's disclosed-non-detection choice, repeated on purpose: building
|
|
88
|
-
* an expiry against a population of zero real scenarios would be machinery
|
|
89
|
-
* ahead of its evidence, and retrofitting one later needs no schema change
|
|
90
|
-
* because the fields are already here.
|
|
91
|
-
*/
|
|
44
|
+
/** When saved + commit authored against. Neither expires nor is checked at replay —
|
|
45
|
+
* exists to explain "written against a different revision" failures. DEC-223 §7's
|
|
46
|
+
* disclosed-non-detection choice: no expiry machinery until real scenarios exist. */
|
|
92
47
|
readonly savedAt: string;
|
|
93
48
|
readonly savedAtCommit: string;
|
|
94
49
|
readonly steps: readonly ScenarioStep[];
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* on it, and the runner cannot invent assertions at replay time — it has no
|
|
99
|
-
* idea what the author meant to check. So they are stored with the steps.
|
|
100
|
-
*
|
|
101
|
-
* Empty is storable, because saving an exploration must stay possible. It is
|
|
102
|
-
* never `passed`: see `isUnverifying`.
|
|
103
|
-
*/
|
|
50
|
+
/** Required, may be empty. The runner can't invent assertions at replay — a
|
|
51
|
+
* successful click-through of a broken page with none stored would be a
|
|
52
|
+
* confident false negative. Empty is storable (exploration); never `passed`. */
|
|
104
53
|
readonly assertions: readonly ScenarioAssertion[];
|
|
105
54
|
}
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* A replay of one of these that meets no error has established that the steps
|
|
110
|
-
* still resolve — real information, and not the same statement as "the
|
|
111
|
-
* application is behaving." The exit rule reports it as `unverified`; this is
|
|
112
|
-
* the predicate that decides which word is honest.
|
|
113
|
-
*/
|
|
55
|
+
/** True when a scenario claims nothing, so verifies nothing. A clean replay still
|
|
56
|
+
* proves the steps resolve — real info, not "the app is behaving". Reported as
|
|
57
|
+
* `unverified`. */
|
|
114
58
|
export declare function isUnverifying(scenario: Scenario): boolean;
|
|
115
59
|
//# sourceMappingURL=scenario.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/scenarios/scenario.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/scenarios/scenario.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAE1F,mIAAmI;AACnI,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;0FAC0F;AAC1F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B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,CAAC;CACnD;AAED;;oBAEoB;AACpB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEzD"}
|
|
@@ -1,40 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a saved scenario
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* deliberately. A scenario is an artifact a person authored and a reviewer
|
|
7
|
-
* reads in a diff; whether one can be *replayed* is the runner's question, and
|
|
8
|
-
* keeping the two apart is what lets the format be tested without launching
|
|
9
|
-
* anything.
|
|
10
|
-
*
|
|
11
|
-
* ## The one shape decision worth reading before the types
|
|
12
|
-
*
|
|
13
|
-
* **A step stores no `ref`.** The port's action verbs take a `ref` and that is
|
|
14
|
-
* correct — a ref ties an action to a snapshot the agent actually saw. But a
|
|
15
|
-
* ref is scoped to the snapshot that issued it, and a replay is always a later
|
|
16
|
-
* session, so a stored ref resolves to nothing or, worse, to something else. A
|
|
17
|
-
* step therefore stores a `TargetDescriptor` and the runner re-resolves it
|
|
18
|
-
* against a fresh snapshot.
|
|
19
|
-
*
|
|
20
|
-
* All three descriptor fields are required, together, always. Not one of them
|
|
21
|
-
* and not a fallback chain: `selector` alone breaks on a markup refactor and
|
|
22
|
-
* silently matches the wrong element when a class is reused; `role` + `name`
|
|
23
|
-
* alone breaks on a copy change; and "try the selector, else role+name" is the
|
|
24
|
-
* dangerous option, because it turns a real disagreement into a quiet
|
|
25
|
-
* substitution — which is how a scenario keeps reporting green against a page
|
|
26
|
-
* that changed underneath it.
|
|
27
|
-
*/
|
|
2
|
+
* What a saved scenario is (DEC-383's schema half). No browser import — replayability
|
|
3
|
+
* is the runner's separate question. A step stores a `TargetDescriptor`, never a `ref`
|
|
4
|
+
* (refs are snapshot-scoped, stale by replay). All 3 descriptor fields are required
|
|
5
|
+
* together — a fallback chain would quietly substitute a match instead of disagreeing. */
|
|
28
6
|
/** Bumped when a stored scenario's shape changes. An integer, never semver: one repository, one reader, nothing to argue about. */
|
|
29
7
|
export const SCENARIO_SCHEMA_VERSION = 1;
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* A replay of one of these that meets no error has established that the steps
|
|
34
|
-
* still resolve — real information, and not the same statement as "the
|
|
35
|
-
* application is behaving." The exit rule reports it as `unverified`; this is
|
|
36
|
-
* the predicate that decides which word is honest.
|
|
37
|
-
*/
|
|
8
|
+
/** True when a scenario claims nothing, so verifies nothing. A clean replay still
|
|
9
|
+
* proves the steps resolve — real info, not "the app is behaving". Reported as
|
|
10
|
+
* `unverified`. */
|
|
38
11
|
export function isUnverifying(scenario) {
|
|
39
12
|
return scenario.assertions.length === 0;
|
|
40
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario.js","sourceRoot":"","sources":["../../src/scenarios/scenario.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scenario.js","sourceRoot":"","sources":["../../src/scenarios/scenario.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAE1F,mIAAmI;AACnI,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AA4DzC;;oBAEoB;AACpB,MAAM,UAAU,aAAa,CAAC,QAAkB;IAC9C,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;AAC1C,CAAC"}
|