@descryy/runtime-contracts 0.2.0 → 0.3.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/LICENSE +6 -0
- package/dist/capability.d.ts +20 -66
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +6 -14
- package/dist/capability.js.map +1 -1
- package/dist/collector.d.ts +34 -86
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +12 -33
- package/dist/collector.js.map +1 -1
- package/dist/correlation.d.ts +10 -42
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +8 -28
- package/dist/correlation.js.map +1 -1
- package/dist/evidence.d.ts +92 -206
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +62 -138
- package/dist/evidence.js.map +1 -1
- package/dist/execution.d.ts +103 -213
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +6 -14
- package/dist/execution.js.map +1 -1
- package/dist/runtime-event.d.ts +13 -31
- package/dist/runtime-event.d.ts.map +1 -1
- package/dist/runtime-event.js +81 -218
- package/dist/runtime-event.js.map +1 -1
- package/dist/source-root.d.ts +33 -60
- package/dist/source-root.d.ts.map +1 -1
- package/dist/source-root.js +23 -44
- package/dist/source-root.js.map +1 -1
- package/package.json +6 -1
package/dist/evidence.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Evidence contract
|
|
2
|
+
* Evidence contract, per §13 (evidence model), plus `evidenceId` (the
|
|
3
|
+
* ID-reference pattern Execution uses) and `stackTrace`. `confidence` is
|
|
4
|
+
* the resolution-honesty axis (§9), never conflated with environment
|
|
5
|
+
* fidelity (lives on Execution/Capability). Redaction per §25.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Execution uses) and `stackTrace` (structured detail for the plan's
|
|
7
|
-
* STACK_TRACE event type, per Agent 3's stack-fidelity finding below). Also
|
|
8
|
-
* grounded in the architecture doc's §18.2 (evidence bundling —
|
|
9
|
-
* screenshot/console/network/backend log, "none of these individually
|
|
10
|
-
* would have been enough"), §17.2 (the observe stream), §9 (the three
|
|
11
|
-
* confidence axes — this file's `confidence` field is the resolution-
|
|
12
|
-
* honesty axis, never conflated with environment fidelity, which lives on
|
|
13
|
-
* Execution/Capability instead) and §25 (redaction before storage).
|
|
14
|
-
*
|
|
15
|
-
* Static facts and runtime observations stay separate. Evidence never
|
|
16
|
-
* embeds a graph node's data — `graphNodeId` is a reference into
|
|
17
|
-
* @descryy/ir's identity scheme, resolved by whoever reads it. This file
|
|
18
|
-
* does not, and must not, redefine graph identity or storage.
|
|
7
|
+
* Evidence never embeds a graph node's data — `graphNodeId` is a reference
|
|
8
|
+
* into @descryy/ir's identity scheme, resolved by whoever reads it.
|
|
19
9
|
*/
|
|
20
10
|
export const EVIDENCE_SOURCES = [
|
|
21
|
-
// Also the source for VIDEO (runtime-event.ts)
|
|
22
|
-
//
|
|
23
|
-
//
|
|
11
|
+
// Also the source for VIDEO (runtime-event.ts): a captured-artifact
|
|
12
|
+
// *kind* is a RuntimeEventType, not a watched domain, so it reuses this
|
|
13
|
+
// entry rather than adding one.
|
|
24
14
|
"browser-dom",
|
|
25
15
|
"browser-console",
|
|
26
16
|
"browser-network",
|
|
@@ -28,86 +18,53 @@ export const EVIDENCE_SOURCES = [
|
|
|
28
18
|
"backend-process",
|
|
29
19
|
"process-exit",
|
|
30
20
|
"http-response-payload",
|
|
31
|
-
/**
|
|
21
|
+
/** RT-073: TEST_STARTED/PASSED/FAILED from a runner's own structured reporter output, never parsed from printed prose. */
|
|
32
22
|
"test-runner",
|
|
33
23
|
/**
|
|
34
|
-
* RT-219
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* own harness broke, not the app) had no evidence this repo could point
|
|
41
|
-
* at to positively establish it; this is that evidence's tag.
|
|
42
|
-
*
|
|
43
|
-
* Deliberately a new `source`, not a repurposing of `COLLECTOR_ERROR`
|
|
44
|
-
* alone. `COLLECTOR_ERROR` already existed (`runtime-event.ts`) for "the
|
|
45
|
-
* observer failed, not the observed system," but every existing emitter
|
|
46
|
-
* stamps it with the *domain* source it was observing when it died
|
|
47
|
-
* (`"backend-process"` for a log collector's consume loop, etc.) --
|
|
48
|
-
* correct for a collector's own mid-stream failure, but it means a
|
|
49
|
-
* COLLECTOR_ERROR row is not on its own distinguishable from ordinary
|
|
50
|
-
* domain evidence by `source` alone, only by `eventType`. A harness
|
|
51
|
-
* component with no domain of its own (the orchestrator's own
|
|
52
|
-
* `Promise.all` around `collector.start()`, for instance) has no honest
|
|
53
|
-
* domain source to reuse, and reusing one anyway would make a self-
|
|
54
|
-
* failure look like it came from the thing being watched. `"harness"`
|
|
55
|
-
* is that missing, honestly-named source -- additive, not a
|
|
56
|
-
* retag of any existing emitter.
|
|
24
|
+
* RT-219. Every other source names a domain being watched; `"harness"`
|
|
25
|
+
* is the runtime observing itself — a collector/orchestrator/correlator
|
|
26
|
+
* operation that broke on its own terms, not the app's. Not
|
|
27
|
+
* `COLLECTOR_ERROR`: that's stamped with the domain source being watched
|
|
28
|
+
* when it died, so it's indistinguishable from domain evidence by
|
|
29
|
+
* `source` alone.
|
|
57
30
|
*/
|
|
58
31
|
"harness",
|
|
59
32
|
/**
|
|
60
|
-
* `
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* execution time. Same standing as `"harness"` -- a fact the runtime
|
|
66
|
-
* establishes about its own execution environment, not an observation of
|
|
67
|
-
* the domain under test, so `signal` stays `null` for records carrying
|
|
68
|
-
* this source (`classifyEvidenceChannel` fails it closed, same as
|
|
69
|
-
* `"harness"`).
|
|
33
|
+
* `checkDependencyVersions`: lockfile-declared dependency version does
|
|
34
|
+
* not match what's actually installed at execution time. Same standing
|
|
35
|
+
* as `"harness"` — a fact about the runtime's own environment, so
|
|
36
|
+
* `signal` stays null for these records (`classifyEvidenceChannel` fails
|
|
37
|
+
* closed).
|
|
70
38
|
*/
|
|
71
39
|
"dependency-check",
|
|
72
40
|
/**
|
|
73
|
-
*
|
|
74
|
-
* (`
|
|
75
|
-
*
|
|
76
|
-
* engines.node`) does not match the runner version actually observed at
|
|
77
|
-
* execution (`process.version`). Same standing as `"dependency-check"`.
|
|
41
|
+
* `checkEnvironmentVersion`: declared runner version (`.nvmrc`/`engines.node`)
|
|
42
|
+
* does not match the observed runner (`process.version`). Same standing
|
|
43
|
+
* as `"dependency-check"`.
|
|
78
44
|
*/
|
|
79
45
|
"environment-check",
|
|
80
46
|
];
|
|
81
47
|
export const REDACTION_STATUSES = ["not-required", "redacted", "pending-redaction"];
|
|
82
48
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* conflating them into a single confidence number loses exactly the
|
|
49
|
+
* Three structurally different classes, not one axis with a probabilistic
|
|
50
|
+
* middle — collapsing them into a confidence number would lose the
|
|
86
51
|
* information a reader needs to judge a location claim:
|
|
87
52
|
*
|
|
88
|
-
* - self-contained:
|
|
89
|
-
*
|
|
90
|
-
* Accurate when captured; the risk is *capture completeness*, not
|
|
53
|
+
* - self-contained: from the process's own captured state (Python/Ruby
|
|
54
|
+
* traceback, Go `recover()` frame). Risk is capture completeness, not
|
|
91
55
|
* correctness.
|
|
92
56
|
* - debug-info-present / debug-info-stripped: a binary's own line-number
|
|
93
|
-
* table (Java/Kotlin)
|
|
94
|
-
* - side-artifact-resolved /
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* `
|
|
104
|
-
* `(eval at file.rb:12):1`, where `12` is where `eval` was called from
|
|
105
|
-
* but `1` counts lines within the evaluated string, not within
|
|
106
|
-
* `file.rb`. Opening `file.rb` at line `1` shows unrelated code, so this
|
|
107
|
-
* is not a plain self-contained claim; it is not a side-artifact claim
|
|
108
|
-
* either, since nothing was resolved through a separate file. See
|
|
109
|
-
* `packages/adapter-ruby/src/ruby-source-location-resolver.ts` for the
|
|
110
|
-
* one producer of this value.
|
|
57
|
+
* table (Java/Kotlin) — binary outcome, no partial case.
|
|
58
|
+
* - side-artifact-resolved / -stale / -missing: resolved through a
|
|
59
|
+
* separate file that can drift or vanish (source map, PDB, dSYM) —
|
|
60
|
+
* "mapped and right" vs. "mapped through something that may be stale"
|
|
61
|
+
* are different claims.
|
|
62
|
+
* - self-contained-eval-line: same mechanism as self-contained, but the
|
|
63
|
+
* line doesn't index the named file. Ruby's `eval` frames print
|
|
64
|
+
* `(eval at file.rb:12):1` — `12` is the eval call site, `1` counts
|
|
65
|
+
* lines in the evaluated string, not in `file.rb`. Neither plain
|
|
66
|
+
* self-contained nor side-artifact. See
|
|
67
|
+
* `packages/adapter-ruby/src/ruby-source-location-resolver.ts`.
|
|
111
68
|
*/
|
|
112
69
|
export const SOURCE_LOCATION_RELIABILITIES = [
|
|
113
70
|
"self-contained",
|
|
@@ -119,61 +76,31 @@ export const SOURCE_LOCATION_RELIABILITIES = [
|
|
|
119
76
|
"self-contained-eval-line",
|
|
120
77
|
];
|
|
121
78
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* caller" guarantee. That is not a low-confidence stack — it is a
|
|
127
|
-
* different kind of evidence, and gets its own field rather than a lower
|
|
128
|
-
* number folded into `confidence`.
|
|
79
|
+
* Orthogonal to `confidence`: concurrency models (coroutines, goroutines,
|
|
80
|
+
* async/await, tokio tasks) can capture a stack successfully while
|
|
81
|
+
* structurally breaking the "reflects the logical caller" guarantee. Not
|
|
82
|
+
* a low-confidence stack — a different kind of evidence, own field.
|
|
129
83
|
*/
|
|
130
84
|
export const STACK_FIDELITIES = ["synchronous", "concurrency-fragmented", "unavailable"];
|
|
131
85
|
/**
|
|
132
|
-
* Which `SourceLocation` an `Evidence` carries for a
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* ## Why it lives in the contract rather than in each collector
|
|
136
|
-
*
|
|
137
|
-
* It was written twice. `backend-observation`'s collector was moved onto
|
|
138
|
-
* `primaryFrameIndex` (RT-083); `browser`'s console collector kept its own
|
|
139
|
-
* `frames[0]` copy and nothing failed, because V8 reports
|
|
140
|
-
* `primaryFrameIndex: 0` and the two rules agree there **by coincidence**.
|
|
141
|
-
* A copied rule is a rule that will hold in one of them, and this one held
|
|
142
|
-
* in one of them for exactly as long as one runtime was involved.
|
|
143
|
-
*
|
|
144
|
-
* ## The empty location, which is the part that is not obvious
|
|
86
|
+
* Which `SourceLocation` an `Evidence` carries for a stack — one rule, one
|
|
87
|
+
* place, for every collector (was written twice and only agreed by
|
|
88
|
+
* coincidence, RT-083, since V8 always reports index 0).
|
|
145
89
|
*
|
|
146
|
-
* `StackFrame.location`
|
|
147
|
-
*
|
|
148
|
-
* `
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* null`. An unsymbolicated crash would be counted as *located* in the very
|
|
152
|
-
* artifact handed to a model — RT-124's shape (a thing reported as the thing
|
|
153
|
-
* it failed to be), one field over.
|
|
90
|
+
* `StackFrame.location` isn't nullable, so an unresolved frame still
|
|
91
|
+
* carries a `SourceLocation` with everything null. Returning it as-is
|
|
92
|
+
* would make `evidence-package.ts`'s `sourceLocation !== null` census
|
|
93
|
+
* count an unsymbolicated crash as located (measured, RT-126: a Swift CI
|
|
94
|
+
* crash with an address-only backtrace).
|
|
154
95
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
96
|
+
* Discriminator is `functionName`, not `file`: a stripped JVM frame and a
|
|
97
|
+
* Rust release frame both have null file but a real symbol, resolvable
|
|
98
|
+
* against the graph by name — keying on `file` would delete the location
|
|
99
|
+
* for every stripped build.
|
|
158
100
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* and a Rust release frame both have a null file **and a real symbol**,
|
|
163
|
-
* which `SourceLocation.file`'s own doc calls real evidence that still
|
|
164
|
-
* resolves against the graph by name. `adapter-jvm` and `adapter-rust` each
|
|
165
|
-
* assert exactly that. Keying emptiness on a null file would delete the
|
|
166
|
-
* location for every stripped build in both languages — the case this type
|
|
167
|
-
* was widened to express.
|
|
168
|
-
*
|
|
169
|
-
* ## Nothing is lost by returning null
|
|
170
|
-
*
|
|
171
|
-
* The frames stay on `Evidence.stackTrace` with their raw text and their
|
|
172
|
-
* `reliability`. "There was no stack" and "there was a stack that could name
|
|
173
|
-
* nothing" therefore remain distinguishable **on the same record**, because
|
|
174
|
-
* `stackTrace` separates them. That recoverability is the test for whether
|
|
175
|
-
* nulling a field is honest degradation or information loss; here it is the
|
|
176
|
-
* first.
|
|
101
|
+
* Nothing is lost by returning null: frames stay on `Evidence.stackTrace`
|
|
102
|
+
* with raw text and reliability, so "no stack" and "a stack naming
|
|
103
|
+
* nothing" stay distinguishable on the same record.
|
|
177
104
|
*/
|
|
178
105
|
export function primaryFrameLocation(stackTrace) {
|
|
179
106
|
if (stackTrace === null || stackTrace.frames.length === 0)
|
|
@@ -190,13 +117,10 @@ export function primaryFrameLocation(stackTrace) {
|
|
|
190
117
|
return locationNamesNothing(location) ? null : location;
|
|
191
118
|
}
|
|
192
119
|
/**
|
|
193
|
-
* True when a location identifies no place in any source.
|
|
194
|
-
*
|
|
195
|
-
* `
|
|
196
|
-
*
|
|
197
|
-
* location informative. `reliability` and `resolvedVia` are not consulted
|
|
198
|
-
* either — they record *why* nothing resolved, which describes the failure
|
|
199
|
-
* rather than a place.
|
|
120
|
+
* True when a location identifies no place in any source. `column` isn't
|
|
121
|
+
* consulted — an offset into a null line names no position. `reliability`
|
|
122
|
+
* and `resolvedVia` aren't either — they record why nothing resolved, not
|
|
123
|
+
* a place.
|
|
200
124
|
*/
|
|
201
125
|
export function locationNamesNothing(location) {
|
|
202
126
|
return location.file === null && location.line === null && location.functionName === null;
|
package/dist/evidence.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,oEAAoE;IACpE,wEAAwE;IACxE,gCAAgC;IAChC,aAAa;IACb,iBAAiB;IACjB,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,cAAc;IACd,uBAAuB;IACvB,0HAA0H;IAC1H,aAAa;IACb;;;;;;;OAOG;IACH,SAAS;IACT;;;;;;OAMG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,mBAAmB;CACX,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,mBAAmB,CAAU,CAAC;AAG7F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,gBAAgB;IAChB,oBAAoB;IACpB,qBAAqB;IACrB,wBAAwB;IACxB,qBAAqB;IACrB,uBAAuB;IACvB,0BAA0B;CAClB,CAAC;AA6BX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,aAAa,EAAE,wBAAwB,EAAE,aAAa,CAAU,CAAC;AA0FlG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA6B;IAChE,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvE,MAAM,KAAK,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC/E,MAAM,IAAI,UAAU,CAClB,qBAAqB,MAAM,CAAC,KAAK,CAAC,mBAAmB,UAAU,CAAC,MAAM,CAAC,MAAM,0BAA0B;YACrG,oGAAoG;YACpG,qGAAqG,CACxG,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAC;IAC5D,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAwB;IAC3D,OAAO,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,YAAY,KAAK,IAAI,CAAC;AAC5F,CAAC"}
|