@descryy/runtime-contracts 0.2.0 → 0.3.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/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 +112 -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/execution.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Execution contract
|
|
2
|
+
* Execution contract, per §4 (execution model) and §16 (RVE boot sequence
|
|
3
|
+
* — §16.4's "SETUP FAILURE surfaced immediately, tagged distinctly from a
|
|
4
|
+
* test failure" is why FAILED_START is a state separate from FAILED).
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* environment selection, boot, graph-aware seeding, snapshot, ready; §16.4's
|
|
8
|
-
* "SETUP FAILURE surfaced immediately, tagged distinctly from a test
|
|
9
|
-
* failure" is the direct source of FAILED_START as a state separate from
|
|
10
|
-
* FAILED) and §10.3 (environment tiers, referenced via
|
|
11
|
-
* ExecutionConfiguration.environmentTier from capability.ts).
|
|
12
|
-
*
|
|
13
|
-
* An Execution record holds *references* (event/trace/failure/correlation/
|
|
14
|
-
* finding IDs), never inlines the records themselves — mirrors §18.2's
|
|
15
|
-
* storage rule ("referenced by ID, never inlined") so a long-running
|
|
16
|
-
* execution doesn't grow this record unboundedly.
|
|
6
|
+
* An Execution record holds references (event/trace/failure/correlation/
|
|
7
|
+
* finding IDs), never inlines the records themselves (§18.2) — keeps a
|
|
8
|
+
* long-running execution's record from growing unboundedly.
|
|
17
9
|
*/
|
|
18
10
|
import type { EnvironmentTier, FidelityLevel } from "./capability.ts";
|
|
19
11
|
export declare const EXECUTION_STATES: readonly ["CREATED", "STARTING", "READY", "RUNNING", "STOPPING", "COMPLETED", "FAILED_START", "FAILED", "TIMED_OUT", "CANCELLED"];
|
|
@@ -21,158 +13,95 @@ export type ExecutionState = (typeof EXECUTION_STATES)[number];
|
|
|
21
13
|
export declare function isValidExecutionTransition(from: ExecutionState, to: ExecutionState): boolean;
|
|
22
14
|
export declare function isTerminalExecutionState(state: ExecutionState): boolean;
|
|
23
15
|
/**
|
|
24
|
-
* One named service from
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* from a dead session can't be mistaken for this run's process by
|
|
31
|
-
* construction, not by convention. A collector recovers `cwd` for a given
|
|
32
|
-
* running process by joining `ProcessHandle.serviceName` back to this map
|
|
33
|
-
* (RT-023's browser script-URL → source mapping).
|
|
16
|
+
* One named service from §6's `services` map. `port` is explicit opt-in
|
|
17
|
+
* to a fixed port — absent (recommended default) means an OS-assigned
|
|
18
|
+
* ephemeral port (RT-024): nothing else can already be bound to a port
|
|
19
|
+
* nobody requested, so a stale listener from a dead session can't be
|
|
20
|
+
* mistaken for this run's process. A collector recovers `cwd` by joining
|
|
21
|
+
* `ProcessHandle.serviceName` back to this map.
|
|
34
22
|
*/
|
|
35
23
|
export interface ServiceConfiguration {
|
|
36
|
-
/**
|
|
37
|
-
* Required unless `attach` is set — exactly one of `command`/`attach`
|
|
38
|
-
* must be present (`validateServicesConfiguration` refuses atomically,
|
|
39
|
-
* before anything spawns, if a service declares neither or both).
|
|
40
|
-
*/
|
|
24
|
+
/** Required unless `attach` is set — exactly one of `command`/`attach` must be present, refused atomically otherwise. */
|
|
41
25
|
readonly command?: string;
|
|
42
26
|
readonly cwd: string;
|
|
43
|
-
/** Explicit opt-in only. Omit
|
|
27
|
+
/** Explicit opt-in only. Omit for an ephemeral port (RT-024's default). Attach-mode services should set this when the caller already knows the target's bound port. */
|
|
44
28
|
readonly port?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Services (by key into this same `services` map) that must be spawned
|
|
47
|
-
* and ready before this one starts. **Declared, never inferred** (RT-032)
|
|
48
|
-
* — an orchestrator refuses rather than guesses at start order from env
|
|
49
|
-
* references or any other implicit signal.
|
|
50
|
-
*/
|
|
29
|
+
/** Services (by key into this map) that must be spawned and ready before this one starts. Declared, never inferred (RT-032) — no guessing start order from env references. */
|
|
51
30
|
readonly dependsOn?: readonly string[];
|
|
52
|
-
/**
|
|
53
|
-
* Extra environment for this service. A value may contain
|
|
54
|
-
* `${<name>.port}`, substituted with the actual resolved port of the
|
|
55
|
-
* named dependency once it has started — `name` must appear in this
|
|
56
|
-
* service's own `dependsOn`, or an orchestrator refuses rather than spawn
|
|
57
|
-
* with an unresolved placeholder (RT-032).
|
|
58
|
-
*/
|
|
31
|
+
/** Extra environment. A value may contain `${<name>.port}`, substituted with the named dependency's resolved port — `name` must be in this service's own `dependsOn`, or the orchestrator refuses (RT-032). */
|
|
59
32
|
readonly env?: Readonly<Record<string, string>>;
|
|
60
33
|
/**
|
|
61
|
-
* Tokens inserted
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* Exists so instrumentation that must be in place *before any application
|
|
67
|
-
* code runs* can be declared without rewriting `command` as a string and
|
|
68
|
-
* re-quoting it. Filled by an orchestrator from
|
|
69
|
-
* `RuntimeAdapter.outboundHttpLaunch()`; nothing here knows which language
|
|
70
|
-
* asked for it, or what the tokens mean.
|
|
34
|
+
* Tokens inserted right after the interpreter, before the application's
|
|
35
|
+
* own args (`node --import <preload> server.mjs`, not the reverse, which
|
|
36
|
+
* would hand them to the application). Lets pre-application instrumentation
|
|
37
|
+
* be declared without rewriting `command` as a string. Filled by an
|
|
38
|
+
* orchestrator from `RuntimeAdapter.outboundHttpLaunch()`.
|
|
71
39
|
*/
|
|
72
40
|
readonly interpreterArgs?: readonly string[];
|
|
73
41
|
/**
|
|
74
|
-
* Alternative to `command`: attach to
|
|
75
|
-
* instead of spawning
|
|
76
|
-
*
|
|
77
|
-
* already redirected to (e.g. `npm run dev > server.log 2>&1 &`). Not
|
|
78
|
-
* generic "attach by base URL" — that remains out of scope, unchanged
|
|
79
|
-
* (see that same decision file).
|
|
42
|
+
* Alternative to `command`: attach to an already-running process (pid
|
|
43
|
+
* plus a redirected stdout/stderr file) instead of spawning one. Not
|
|
44
|
+
* generic "attach by base URL" (out of scope).
|
|
80
45
|
*
|
|
81
|
-
* When set, `
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* applied to an attached service — Descry did not spawn it and, per
|
|
86
|
-
* `ATTACH_MODE_SCOPE_DISCLOSURE`, never executes code in or applies
|
|
87
|
-
* changes to a process it merely observes. The resulting `ManagedProcess`'s
|
|
88
|
-
* `kill()` is correspondingly a no-op: cleanup must not terminate a
|
|
89
|
-
* process this runtime does not own.
|
|
46
|
+
* When set, `resourceLimits`/`filesystemPolicy`/`networkPolicy` never
|
|
47
|
+
* apply — Descry didn't spawn it (`ATTACH_MODE_SCOPE_DISCLOSURE`). The
|
|
48
|
+
* resulting `ManagedProcess.kill()` is a no-op — cleanup must not
|
|
49
|
+
* terminate a process this runtime doesn't own.
|
|
90
50
|
*/
|
|
91
51
|
readonly attach?: ServiceAttachConfiguration;
|
|
92
52
|
}
|
|
93
53
|
/** See `ServiceConfiguration.attach`. */
|
|
94
54
|
export interface ServiceAttachConfiguration {
|
|
95
|
-
/** pid of the already-running target. Verified alive before attach
|
|
55
|
+
/** pid of the already-running target. Verified alive before attach, re-checked on every poll (never signalled by this runtime). */
|
|
96
56
|
readonly pid: number;
|
|
97
|
-
/**
|
|
57
|
+
/** File the target is already writing stdout/stderr to. Read in full on every poll, same growing-buffer contract as `ManagedProcess.readOutput()` — not a delta. */
|
|
98
58
|
readonly logFilePath: string;
|
|
99
59
|
}
|
|
100
60
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* this interface (`services`, ports, env, readiness) had that path and this
|
|
106
|
-
* one didn't. Deliberately just `headless` -- the one option that already
|
|
107
|
-
* existed as a constructor arg. Inventing viewport/locale/userAgent fields
|
|
108
|
-
* nothing reads yet would repeat RT-053's lesson about a declared-but-dead
|
|
109
|
-
* type, one layer up.
|
|
61
|
+
* RT-068: gives `ExecutionConfiguration` a path to browser launch options,
|
|
62
|
+
* which previously only a direct caller of `launchBrowserSession` could
|
|
63
|
+
* reach. Deliberately just `headless` — inventing unread viewport/locale/
|
|
64
|
+
* userAgent fields would repeat RT-053's declared-but-dead-type lesson.
|
|
110
65
|
*/
|
|
111
66
|
export interface BrowserConfiguration {
|
|
112
67
|
readonly headless?: boolean;
|
|
113
68
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* `dir` is `browser-session.ts`'s own concern (a session-scoped temp
|
|
119
|
-
* directory, never caller-supplied) and `size` is not exposed because
|
|
120
|
-
* nothing reads a caller-supplied value for it yet. Landed together with
|
|
121
|
-
* its one emitter (`BrowserActionCollector.captureVideo()`), per RT-053's
|
|
122
|
-
* lesson this file already cites: a declared-but-dead option is the
|
|
123
|
-
* mistake, not an option existing at all.
|
|
69
|
+
* Toggle for Playwright's `recordVideo`. Just a boolean, same restraint
|
|
70
|
+
* as `headless` — `dir` is `browser-session.ts`'s own concern, `size`
|
|
71
|
+
* isn't exposed because nothing reads it yet. Landed with its one
|
|
72
|
+
* emitter, `BrowserActionCollector.captureVideo()`.
|
|
124
73
|
*/
|
|
125
74
|
readonly recordVideo?: boolean;
|
|
126
75
|
}
|
|
127
76
|
/**
|
|
128
|
-
* §21's execution boundary (RT-070).
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* (`resourceLimitCapability()`, `@descryy/runtime-controller`), never
|
|
135
|
-
* assumed. Requesting a limit on a platform that cannot enforce it is a
|
|
136
|
-
* refusal, not a silent no-op: the one alternative -- spawn unconstrained
|
|
137
|
-
* and stay quiet about it -- is the exact "sandbox that doesn't sandbox"
|
|
138
|
-
* shape §38 already bans one row up.
|
|
77
|
+
* §21's execution boundary (RT-070). Enforced by the OS via `prlimit`
|
|
78
|
+
* (util-invoke only, never a shell — RT-036 already refused shell
|
|
79
|
+
* metacharacters in commands). `prlimit` is util-linux, absent on macOS —
|
|
80
|
+
* a real capability, reported `available`/`unavailable` with a reason
|
|
81
|
+
* (`resourceLimitCapability()`), never assumed. Requesting a limit where
|
|
82
|
+
* it can't be enforced refuses rather than silently spawning unconstrained.
|
|
139
83
|
*
|
|
140
|
-
* Absent (
|
|
141
|
-
*
|
|
142
|
-
* DECISIONS.md RT-070) does not require one; it is available to a caller
|
|
143
|
-
* that wants a backstop, not imposed on every execution.
|
|
84
|
+
* Absent (default, unchanged) means no limit — the trusted-local boundary
|
|
85
|
+
* doesn't require one; it's a backstop a caller opts into, not imposed.
|
|
144
86
|
*/
|
|
145
87
|
export interface ResourceLimits {
|
|
146
|
-
/** Maps to `prlimit --as` (virtual address space)
|
|
88
|
+
/** Maps to `prlimit --as` (virtual address space) — what the kernel actually enforces for over-allocation; `RLIMIT_RSS` isn't enforced on modern Linux. */
|
|
147
89
|
readonly maxMemoryBytes?: number;
|
|
148
|
-
/** Maps to `prlimit --cpu`,
|
|
90
|
+
/** Maps to `prlimit --cpu`, seconds of consumed CPU time. */
|
|
149
91
|
readonly maxCpuSeconds?: number;
|
|
150
|
-
/** Maps to `prlimit --nproc`. Per-real-uid, not per-process-tree
|
|
92
|
+
/** Maps to `prlimit --nproc`. Per-real-uid, not per-process-tree (a POSIX rlimit property) — a low value can be exceeded immediately on a busy machine; see `execution-safety.test.ts`. */
|
|
151
93
|
readonly maxProcesses?: number;
|
|
152
94
|
}
|
|
153
95
|
/**
|
|
154
|
-
* §21's execution boundary, network half.
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* there are none). Enforced with a network namespace holding nothing but a
|
|
164
|
-
* loopback device, private to the sandboxed process tree -- not even the
|
|
165
|
-
* host's own loopback is reachable from inside it (`networkIsolationCapability()`,
|
|
166
|
-
* `applySandbox()`, `@descryy/runtime-controller`). A non-empty `hosts` list
|
|
167
|
-
* -- selective allow- or deny-listing -- would need DNS interception and IP
|
|
168
|
-
* filtering inside the namespace (a veth pair, NAT, iptables/nftables rules)
|
|
169
|
-
* that this iteration does not build; declaring one still refuses the run,
|
|
170
|
-
* atomically, before anything spawns -- the same "declared, refused rather
|
|
171
|
-
* than silently ignored if unenforceable" precedent `applyResourceLimits`
|
|
172
|
-
* already set one field up. macOS and Windows have no enforcement mechanism
|
|
173
|
-
* wired up at all yet (see the sandbox-isolation lane's own decision note),
|
|
174
|
-
* so every shape refuses there, matching RT-193's original behavior
|
|
175
|
-
* unchanged on those platforms.
|
|
96
|
+
* §21's execution boundary, network half. Real on Linux for one shape
|
|
97
|
+
* only: full denial, `{ mode: "allow", hosts: [] }` — enforced via a
|
|
98
|
+
* network namespace holding nothing but a private loopback device, not
|
|
99
|
+
* even the host's own loopback reachable from inside
|
|
100
|
+
* (`networkIsolationCapability()`, `applySandbox()`). A non-empty `hosts`
|
|
101
|
+
* list would need DNS interception and IP filtering this iteration
|
|
102
|
+
* doesn't build, so it refuses atomically before anything spawns — same
|
|
103
|
+
* precedent as `ResourceLimits`. macOS/Windows have no enforcement wired
|
|
104
|
+
* up, so every shape refuses there.
|
|
176
105
|
*/
|
|
177
106
|
export interface NetworkPolicy {
|
|
178
107
|
/** "allow" means only `hosts` are reachable; "deny" means every host in `hosts` is refused, everything else reachable. */
|
|
@@ -180,61 +109,44 @@ export interface NetworkPolicy {
|
|
|
180
109
|
readonly hosts: readonly string[];
|
|
181
110
|
}
|
|
182
111
|
/**
|
|
183
|
-
* §21's execution boundary, filesystem half.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* mount namespace built with bubblewrap), refused rather than silently
|
|
187
|
-
* accepted and unenforced everywhere else (macOS, Windows -- no mechanism
|
|
188
|
-
* wired up yet).
|
|
112
|
+
* §21's execution boundary, filesystem half. Real on Linux (mount
|
|
113
|
+
* namespace via bubblewrap, `filesystemIsolationCapability`), refused
|
|
114
|
+
* rather than silently unenforced on macOS/Windows.
|
|
189
115
|
*
|
|
190
|
-
* A path outside `allowedRoots` (plus `cwd
|
|
191
|
-
*
|
|
192
|
-
* `
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* bound it in. That is a stronger claim than a permission bit, and the one
|
|
196
|
-
* the escape tests in `sandbox.test.ts` exist to prove for real rather than
|
|
197
|
-
* assert from the mechanism's documentation alone.
|
|
116
|
+
* A path outside `allowedRoots` (plus `cwd` and the interpreter binary's
|
|
117
|
+
* directory, always included) is not just unreadable — `open()` fails
|
|
118
|
+
* with `ENOENT`, same as a path that never existed, because the mount
|
|
119
|
+
* namespace never bound it in. Proved for real by the escape tests in
|
|
120
|
+
* `sandbox.test.ts`, not just asserted from documentation.
|
|
198
121
|
*/
|
|
199
122
|
export interface FilesystemPolicy {
|
|
200
|
-
/** Absolute paths visible read-write inside the sandbox, in addition to `cwd`. Everything else
|
|
123
|
+
/** Absolute paths visible read-write inside the sandbox, in addition to `cwd`. Everything else, including the rest of the user's home directory, is invisible — not mounted at all. */
|
|
201
124
|
readonly allowedRoots: readonly string[];
|
|
202
125
|
}
|
|
203
126
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* at the start of `ExecutionController.run()`, from the real host --
|
|
209
|
-
* declared here as the shape, not computed in the contract layer, matching
|
|
210
|
-
* this file's own "field list lives here, capture logic lives in
|
|
211
|
-
* `packages/controller`" split.
|
|
127
|
+
* RT-193: `Execution.commit` alone can't reproduce a run — same commit,
|
|
128
|
+
* different Node/OS/toolchain can behave differently. Captured once at
|
|
129
|
+
* the start of `ExecutionController.run()`; the shape lives here, capture
|
|
130
|
+
* logic lives in `packages/controller`.
|
|
212
131
|
*/
|
|
213
132
|
export interface EnvironmentMetadata {
|
|
214
|
-
/** `os.platform()`
|
|
133
|
+
/** `os.platform()` — "linux" / "darwin" / "win32" / etc. */
|
|
215
134
|
readonly platform: string;
|
|
216
|
-
/** `process.version` of the Node process
|
|
135
|
+
/** `process.version` of the controller's own Node process — always known, never probed. */
|
|
217
136
|
readonly nodeVersion: string;
|
|
218
137
|
/**
|
|
219
|
-
* `<command> --version`
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* be probed (absent, or refuses every version flag tried) -- recorded,
|
|
224
|
-
* not dropped from the map, matching RT-070's "declared, refused rather
|
|
225
|
-
* than silently ignored" precedent applied to a report instead of an
|
|
226
|
-
* enforcement gate.
|
|
138
|
+
* `<command> --version` per distinct executable named in
|
|
139
|
+
* `configuration.services[*].command` — reuses `scripts/preflight.mjs`'s
|
|
140
|
+
* `interpreters()` probe. `null` for a command that couldn't be probed,
|
|
141
|
+
* recorded rather than dropped.
|
|
227
142
|
*/
|
|
228
143
|
readonly toolchainVersions: Readonly<Record<string, string | null>>;
|
|
229
144
|
}
|
|
230
145
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* `BrowserConfiguration` closed at RT-068, one field over. This is the
|
|
236
|
-
* contracts type; `packages/test-runner` imports and re-exports it rather
|
|
237
|
-
* than keeping a second, driftable copy.
|
|
146
|
+
* RT-068 gap, one field over: gives `ExecutionConfiguration` a path to
|
|
147
|
+
* test-runner options that previously only existed independently in
|
|
148
|
+
* `@descryy/runtime-test-runner`. `packages/test-runner` imports and
|
|
149
|
+
* re-exports this rather than keeping a driftable second copy.
|
|
238
150
|
*/
|
|
239
151
|
export interface TestRunnerConfiguration {
|
|
240
152
|
readonly command: string;
|
|
@@ -245,72 +157,50 @@ export interface ExecutionConfiguration {
|
|
|
245
157
|
readonly fidelityLevel: FidelityLevel;
|
|
246
158
|
readonly timeoutMs: number;
|
|
247
159
|
readonly services: Readonly<Record<string, ServiceConfiguration>>;
|
|
248
|
-
/** Absent means `launchBrowserSession`'s own default (`headless: true`)
|
|
160
|
+
/** Absent means `launchBrowserSession`'s own default (`headless: true`) — no second default here to disagree with it. */
|
|
249
161
|
readonly browser?: BrowserConfiguration;
|
|
250
|
-
/** Absent means no test run declared
|
|
162
|
+
/** Absent means no test run declared — `createTestRunnerCollector` is a direct caller's concern, not auto-invoked by `ExecutionController.run()`. */
|
|
251
163
|
readonly testRunner?: TestRunnerConfiguration;
|
|
252
|
-
/** Absent means unconstrained
|
|
164
|
+
/** Absent means unconstrained — see `ResourceLimits` for why that's the correct default. */
|
|
253
165
|
readonly resourceLimits?: ResourceLimits;
|
|
254
|
-
/** Absent means no policy declared. See `NetworkPolicy`
|
|
166
|
+
/** Absent means no policy declared. See `NetworkPolicy` — full denial enforced on Linux; every other shape, and every shape on macOS/Windows, refuses to start. */
|
|
255
167
|
readonly networkPolicy?: NetworkPolicy;
|
|
256
|
-
/** Absent means unconstrained
|
|
168
|
+
/** Absent means unconstrained. See `FilesystemPolicy` — enforced on Linux, refuses to start elsewhere rather than running unconstrained under an unenforceable policy. */
|
|
257
169
|
readonly filesystemPolicy?: FilesystemPolicy;
|
|
258
170
|
/**
|
|
259
|
-
* Which
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* (`container-sandbox.ts`) -- the macOS/Windows path, since neither
|
|
265
|
-
* platform has a native bwrap equivalent wired up; also usable on Linux.
|
|
266
|
-
* Declaring `"container"` without a working Docker present refuses to
|
|
267
|
-
* start, the same "refuse rather than silently run unconstrained"
|
|
268
|
-
* precedent `filesystemPolicy`/`networkPolicy` already established.
|
|
171
|
+
* Which mechanism enforces `filesystemPolicy`/`networkPolicy`. Absent
|
|
172
|
+
* means `"bwrap"` (the original Linux mechanism, unchanged). `"container"`
|
|
173
|
+
* routes the same policies through Docker instead — the macOS/Windows
|
|
174
|
+
* path, also usable on Linux. Declaring `"container"` without a working
|
|
175
|
+
* Docker refuses to start, same precedent as the policies above.
|
|
269
176
|
*/
|
|
270
177
|
readonly sandboxBackend?: "bwrap" | "container";
|
|
271
178
|
}
|
|
272
179
|
export interface ProcessHandle {
|
|
273
180
|
readonly processId: string;
|
|
274
181
|
readonly command: string;
|
|
275
|
-
/** Null once
|
|
182
|
+
/** Null once exited and reaped. */
|
|
276
183
|
readonly pid: number | null;
|
|
277
184
|
readonly startedAt: string;
|
|
278
185
|
readonly exitedAt: string | null;
|
|
279
186
|
/**
|
|
280
|
-
* POSIX only sets an exit code on normal `exit()` — null both before
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* crash (RT-032): non-null here means the process was killed by that
|
|
285
|
-
* signal, whatever `exitCode` says.
|
|
187
|
+
* POSIX only sets an exit code on normal `exit()` — null both before
|
|
188
|
+
* exiting and after being killed by a signal, so `exitCode` alone can't
|
|
189
|
+
* tell "never ran" from "crashed." `signal` distinguishes a clean-but-
|
|
190
|
+
* ambiguous exit from a real crash (RT-032).
|
|
286
191
|
*/
|
|
287
192
|
readonly exitCode: number | null;
|
|
288
193
|
readonly signal: NodeJS.Signals | null;
|
|
289
|
-
/**
|
|
290
|
-
* Which key of `ExecutionConfiguration.services` this process is running,
|
|
291
|
-
* when known — null for a process that doesn't correspond to a named
|
|
292
|
-
* service (e.g. a one-off test-runner invocation). The join key for
|
|
293
|
-
* recovering `cwd`/`command` from configuration; see `ServiceConfiguration`.
|
|
294
|
-
*/
|
|
194
|
+
/** Which key of `ExecutionConfiguration.services` this process runs, when known — null for a process with no named service (e.g. a one-off test-runner invocation). Join key for recovering `cwd`/`command`. */
|
|
295
195
|
readonly serviceName: string | null;
|
|
296
|
-
/**
|
|
297
|
-
* The actual port this process is bound to, when it listens on one — the
|
|
298
|
-
* real OS-assigned port for an ephemeral service, not merely a value that
|
|
299
|
-
* was requested. Null for a process that isn't a network service, or
|
|
300
|
-
* before the port is known.
|
|
301
|
-
*/
|
|
196
|
+
/** The actual OS-assigned port this process is bound to, not merely requested. Null if not a network service, or not yet known. */
|
|
302
197
|
readonly port: number | null;
|
|
303
198
|
/**
|
|
304
199
|
* True only for a service started via `ServiceConfiguration.attach` —
|
|
305
|
-
* absent
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* `
|
|
309
|
-
* spawn" from "we spawned this ourselves" without inferring it from
|
|
310
|
-
* `command`'s text — the same "declared, not guessed" discipline this
|
|
311
|
-
* file already applies everywhere else. See `ATTACH_MODE_SCOPE_DISCLOSURE`
|
|
312
|
-
* (`@descryy/runtime-contracts`'s `collector.ts`) for what attach mode
|
|
313
|
-
* does and does not do to the process this describes.
|
|
200
|
+
* absent for every spawned process. Lets downstream consumers
|
|
201
|
+
* (`ProcessCollector`, `runInstrumentedExecution`) tell "observed, not
|
|
202
|
+
* spawned" apart without inferring it from `command`'s text. See
|
|
203
|
+
* `ATTACH_MODE_SCOPE_DISCLOSURE` in `collector.ts`.
|
|
314
204
|
*/
|
|
315
205
|
readonly attached?: boolean;
|
|
316
206
|
}
|
|
@@ -325,7 +215,7 @@ export interface Execution {
|
|
|
325
215
|
readonly application: string;
|
|
326
216
|
readonly repository: string;
|
|
327
217
|
readonly commit: string;
|
|
328
|
-
/** Null until `run()` captures it (RT-193)
|
|
218
|
+
/** Null until `run()` captures it (RT-193) — populated by `STARTING`. See `EnvironmentMetadata` for why `commit` alone isn't reproducible. */
|
|
329
219
|
readonly environmentMetadata: EnvironmentMetadata | null;
|
|
330
220
|
readonly configuration: ExecutionConfiguration;
|
|
331
221
|
readonly state: ExecutionState;
|
package/dist/execution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEtE,eAAO,MAAM,gBAAgB,mIAWnB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAuB/D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAE5F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAEvE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,yHAAyH;IACzH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uKAAuK;IACvK,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8KAA8K;IAC9K,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,+MAA+M;IAC/M,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC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,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC"}
|
package/dist/execution.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Execution contract
|
|
2
|
+
* Execution contract, per §4 (execution model) and §16 (RVE boot sequence
|
|
3
|
+
* — §16.4's "SETUP FAILURE surfaced immediately, tagged distinctly from a
|
|
4
|
+
* test failure" is why FAILED_START is a state separate from FAILED).
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* environment selection, boot, graph-aware seeding, snapshot, ready; §16.4's
|
|
8
|
-
* "SETUP FAILURE surfaced immediately, tagged distinctly from a test
|
|
9
|
-
* failure" is the direct source of FAILED_START as a state separate from
|
|
10
|
-
* FAILED) and §10.3 (environment tiers, referenced via
|
|
11
|
-
* ExecutionConfiguration.environmentTier from capability.ts).
|
|
12
|
-
*
|
|
13
|
-
* An Execution record holds *references* (event/trace/failure/correlation/
|
|
14
|
-
* finding IDs), never inlines the records themselves — mirrors §18.2's
|
|
15
|
-
* storage rule ("referenced by ID, never inlined") so a long-running
|
|
16
|
-
* execution doesn't grow this record unboundedly.
|
|
6
|
+
* An Execution record holds references (event/trace/failure/correlation/
|
|
7
|
+
* finding IDs), never inlines the records themselves (§18.2) — keeps a
|
|
8
|
+
* long-running execution's record from growing unboundedly.
|
|
17
9
|
*/
|
|
18
10
|
export const EXECUTION_STATES = [
|
|
19
11
|
"CREATED",
|
package/dist/execution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS;IACT,UAAU;IACV,OAAO;IACP,SAAS;IACT,UAAU;IACV,WAAW;IACX,cAAc;IACd,QAAQ;IACR,WAAW;IACX,WAAW;CACH,CAAC;AAGX,MAAM,eAAe,GAAgC,IAAI,GAAG,CAAC;IAC3D,WAAW;IACX,cAAc;IACd,QAAQ;IACR,WAAW;IACX,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAgE;IACvF,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,CAAC;IAC7D,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC;IAC3C,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC;IACzD,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;IACjC,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,MAAM,UAAU,0BAA0B,CAAC,IAAoB,EAAE,EAAkB;IACjF,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,KAAqB;IAC5D,OAAO,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/runtime-event.d.ts
CHANGED
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime Event vocabulary.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* document was available in this repo and guessed at a vocabulary that did
|
|
8
|
-
* not match it; this replaces that guess.
|
|
9
|
-
*
|
|
10
|
-
* This vocabulary is DELIBERATELY INDEPENDENT of the Graph Engine's 15 node
|
|
11
|
-
* types / 15 edge types (descry-core CLAUDE.md, DEC-061) — plan §14 states
|
|
12
|
-
* this explicitly. A runtime event is an observation, not a graph fact, and
|
|
13
|
-
* this list may grow or change on its own schedule. If a runtime need ever
|
|
14
|
-
* looks like it wants a new *graph* node or edge type, that is out of scope
|
|
15
|
-
* here — stop and raise it (plan principle 12). The graph vocabulary is
|
|
16
|
-
* frozen; this one is not.
|
|
2
|
+
* Runtime Event vocabulary, per §14. Deliberately independent of the
|
|
3
|
+
* Graph Engine's 15 node/15 edge types (DEC-061) — a runtime event is an
|
|
4
|
+
* observation, not a graph fact, and can grow on its own schedule. A need
|
|
5
|
+
* that looks like a new graph node/edge type is out of scope here — the
|
|
6
|
+
* graph vocabulary is frozen, this one is not.
|
|
17
7
|
*/
|
|
18
8
|
export declare const RUNTIME_EVENT_TYPES: readonly ["PROCESS_STARTED", "PROCESS_READY", "PROCESS_EXITED", "PAGE_CREATED", "NAVIGATION", "CLICK", "INPUT", "SCREENSHOT", "VIDEO", "CONSOLE_MESSAGE", "NETWORK_REQUEST", "NETWORK_RESPONSE", "HTTP_ERROR", "BACKEND_LOG", "EXCEPTION", "STACK_TRACE", "TEST_STARTED", "TEST_PASSED", "TEST_FAILED", "TEST_SKIPPED", "DATABASE_QUERY", "EXTERNAL_REQUEST", "COLLECTOR_ERROR", "DEPENDENCY_VERSION_MISMATCH", "ENVIRONMENT_VERSION_MISMATCH", "WEBSOCKET_CLOSED"];
|
|
19
9
|
export type RuntimeEventType = (typeof RUNTIME_EVENT_TYPES)[number];
|
|
20
10
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Without knowing the prefix it attributed them to the application, and a
|
|
30
|
-
* user's report showed Descry's own instrumentation chatter as lines their
|
|
31
|
-
* service printed. This constant is the one place that says which vocabulary
|
|
32
|
-
* is Descry's, so the collector can leave it alone and every marker module can
|
|
33
|
-
* derive from it instead of spelling the prefix again.
|
|
34
|
-
*
|
|
35
|
-
* Anchored at the start of a line by every consumer: a log line that merely
|
|
36
|
-
* *mentions* a marker is the application's own output.
|
|
11
|
+
* The prefix Descry reserves on an observed process's stdout. A preload
|
|
12
|
+
* instrumenting a process from the inside reports each observation as one
|
|
13
|
+
* line of structured JSON there (`DESCRY_DB_QUERY {...}`, etc). Found the
|
|
14
|
+
* hard way: without this, the backend log collector reading the same
|
|
15
|
+
* stdout attributed Descry's own instrumentation chatter to the
|
|
16
|
+
* application. One place defines the prefix; every marker module derives
|
|
17
|
+
* from it. Anchored at line start by every consumer — a line that merely
|
|
18
|
+
* mentions a marker is the application's own output.
|
|
37
19
|
*/
|
|
38
20
|
export declare const RESERVED_MARKER_PREFIX = "DESCRY_";
|
|
39
21
|
//# sourceMappingURL=runtime-event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-event.d.ts","sourceRoot":"","sources":["../src/runtime-event.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runtime-event.d.ts","sourceRoot":"","sources":["../src/runtime-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB,qcAkHtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,YAAY,CAAC"}
|