@descryy/runtime-controller 0.3.8 → 0.3.9

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.
Files changed (73) hide show
  1. package/dist/attach-fencing.d.ts +109 -0
  2. package/dist/attach-fencing.d.ts.map +1 -0
  3. package/dist/attach-fencing.js +215 -0
  4. package/dist/attach-fencing.js.map +1 -0
  5. package/dist/capability-registry.d.ts +9 -0
  6. package/dist/capability-registry.d.ts.map +1 -0
  7. package/dist/capability-registry.js +32 -0
  8. package/dist/capability-registry.js.map +1 -0
  9. package/dist/collector-version.d.ts +3 -0
  10. package/dist/collector-version.d.ts.map +1 -0
  11. package/dist/collector-version.js +5 -0
  12. package/dist/collector-version.js.map +1 -0
  13. package/dist/container-sandbox.d.ts +104 -0
  14. package/dist/container-sandbox.d.ts.map +1 -0
  15. package/dist/container-sandbox.js +152 -0
  16. package/dist/container-sandbox.js.map +1 -0
  17. package/dist/controller.d.ts +138 -0
  18. package/dist/controller.d.ts.map +1 -0
  19. package/dist/controller.js +449 -0
  20. package/dist/controller.js.map +1 -0
  21. package/dist/dependency-version-check.d.ts +36 -0
  22. package/dist/dependency-version-check.d.ts.map +1 -0
  23. package/dist/dependency-version-check.js +72 -0
  24. package/dist/dependency-version-check.js.map +1 -0
  25. package/dist/env.d.ts +10 -0
  26. package/dist/env.d.ts.map +1 -0
  27. package/dist/env.js +12 -0
  28. package/dist/env.js.map +1 -0
  29. package/dist/environment-metadata.d.ts +15 -0
  30. package/dist/environment-metadata.d.ts.map +1 -0
  31. package/dist/environment-metadata.js +63 -0
  32. package/dist/environment-metadata.js.map +1 -0
  33. package/dist/environment-version-check.d.ts +40 -0
  34. package/dist/environment-version-check.d.ts.map +1 -0
  35. package/dist/environment-version-check.js +176 -0
  36. package/dist/environment-version-check.js.map +1 -0
  37. package/dist/execution-safety.d.ts +96 -0
  38. package/dist/execution-safety.d.ts.map +1 -0
  39. package/dist/execution-safety.js +140 -0
  40. package/dist/execution-safety.js.map +1 -0
  41. package/dist/index.d.ts +31 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +17 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/orchestration.d.ts +55 -0
  46. package/dist/orchestration.d.ts.map +1 -0
  47. package/dist/orchestration.js +219 -0
  48. package/dist/orchestration.js.map +1 -0
  49. package/dist/preflight.d.ts +122 -0
  50. package/dist/preflight.d.ts.map +1 -0
  51. package/dist/preflight.js +177 -0
  52. package/dist/preflight.js.map +1 -0
  53. package/dist/process-collector.d.ts +20 -0
  54. package/dist/process-collector.d.ts.map +1 -0
  55. package/dist/process-collector.js +116 -0
  56. package/dist/process-collector.js.map +1 -0
  57. package/dist/process-identity.d.ts +46 -0
  58. package/dist/process-identity.d.ts.map +1 -0
  59. package/dist/process-identity.js +186 -0
  60. package/dist/process-identity.js.map +1 -0
  61. package/dist/process-manager.d.ts +137 -0
  62. package/dist/process-manager.d.ts.map +1 -0
  63. package/dist/process-manager.js +365 -0
  64. package/dist/process-manager.js.map +1 -0
  65. package/dist/readiness.d.ts +122 -0
  66. package/dist/readiness.d.ts.map +1 -0
  67. package/dist/readiness.js +214 -0
  68. package/dist/readiness.js.map +1 -0
  69. package/dist/sandbox.d.ts +94 -0
  70. package/dist/sandbox.d.ts.map +1 -0
  71. package/dist/sandbox.js +228 -0
  72. package/dist/sandbox.js.map +1 -0
  73. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ /**
2
+ * `ProcessCollector`: turns `ProcessLifecycleEvent` (`controller.ts`) into
3
+ * `PROCESS_STARTED` / `PROCESS_READY` / `PROCESS_EXITED` Evidence. A plain translator
4
+ * with no lifecycle logic of its own — `ExecutionController` decides when each
5
+ * transition happens and calls `RunOptions.onProcessLifecycleEvent`; this collector
6
+ * just turns that call into one `context.emit()`.
7
+ *
8
+ * **Wiring order is load-bearing.** `start(context)` must run before
9
+ * `onProcessLifecycleEvent` can fire. `handleLifecycleEvent` throws rather than
10
+ * silently dropping an event on violation — a lost PROCESS_STARTED would otherwise
11
+ * read downstream as "never observed," a worse, quieter failure than a thrown error.
12
+ */
13
+ import { COLLECTOR_VERSION } from "./collector-version.js";
14
+ // None of `CollectorCapabilities`' fields is "process lifecycle observation" — the
15
+ // one thing this collector does. Reported `unavailable` on the others with an honest
16
+ // reason rather than inventing a field outside this lane's boundary (`contracts`).
17
+ // This collector doing its job while capabilities() shows all-unavailable is a
18
+ // disclosed gap in the capability model, not a bug here.
19
+ function computeCapabilities() {
20
+ const reason = "ProcessCollector observes process lifecycle (started/ready/exited) only — the capability model has no field for that yet.";
21
+ const status = { availability: "unavailable", reason };
22
+ return {
23
+ domObservation: status,
24
+ consoleObservation: status,
25
+ networkObservation: status,
26
+ backendLogAccess: status,
27
+ distributedTrace: status,
28
+ sourceMapping: status,
29
+ stackCapture: status,
30
+ processLifecycle: { availability: "available", reason: null },
31
+ databaseObservation: status,
32
+ externalServiceObservation: status,
33
+ };
34
+ }
35
+ function eventTypeOf(kind) {
36
+ switch (kind) {
37
+ case "process-started":
38
+ return "PROCESS_STARTED";
39
+ case "process-ready":
40
+ case "process-ready-failed":
41
+ return "PROCESS_READY";
42
+ case "process-exited":
43
+ return "PROCESS_EXITED";
44
+ }
45
+ }
46
+ // `process-ready-failed` still emits `PROCESS_READY` — no separate vocabulary type,
47
+ // and adding one here is the wrong layer. `payload.ready: false` plus the full
48
+ // `ReadinessResult` lets a reader distinguish success from failure via payload, not
49
+ // event type (same shape as `ServiceStartResult`'s `succeeded` + `stage`).
50
+ function payloadOf(event) {
51
+ switch (event.kind) {
52
+ case "process-started":
53
+ return { processId: event.handle.processId, serviceName: event.serviceName, pid: event.handle.pid, command: event.handle.command, startedAt: event.handle.startedAt };
54
+ case "process-ready":
55
+ case "process-ready-failed":
56
+ return { processId: event.handle.processId, serviceName: event.serviceName, ready: event.readiness.ready, readiness: event.readiness };
57
+ case "process-exited":
58
+ // `phase` distinguishes "crashed on boot" from "finished/stopped after
59
+ // running" — see `ProcessLifecycleEvent` in controller.ts.
60
+ return {
61
+ processId: event.handle.processId,
62
+ serviceName: event.serviceName,
63
+ exitCode: event.handle.exitCode,
64
+ signal: event.handle.signal,
65
+ exitedAt: event.handle.exitedAt,
66
+ phase: event.phase,
67
+ };
68
+ }
69
+ }
70
+ export function createProcessCollector() {
71
+ const capabilities = computeCapabilities();
72
+ let context = null;
73
+ return {
74
+ collectorId: "process-collector",
75
+ start(ctx) {
76
+ context = ctx;
77
+ return Promise.resolve({ available: true });
78
+ },
79
+ stop() {
80
+ // Idempotent per the Collector contract; nothing to release -- owns
81
+ // only a reference to the emit context, no process/socket/file handle.
82
+ context = null;
83
+ return Promise.resolve();
84
+ },
85
+ capabilities() {
86
+ return capabilities;
87
+ },
88
+ handleLifecycleEvent(event) {
89
+ if (context === null) {
90
+ throw new Error(`ProcessCollector.handleLifecycleEvent("${event.kind}") called before start() — ` +
91
+ `wire handleLifecycleEvent as RunOptions.onProcessLifecycleEvent only after start() has resolved, ` +
92
+ `or this event (and everything downstream of it) is silently unobserved rather than loudly wrong.`);
93
+ }
94
+ context.emit({
95
+ timestamp: new Date().toISOString(),
96
+ source: event.kind === "process-exited" ? "process-exit" : "backend-process",
97
+ service: event.serviceName,
98
+ process: event.handle.processId,
99
+ eventType: eventTypeOf(event.kind),
100
+ payload: payloadOf(event),
101
+ traceId: null,
102
+ requestId: null,
103
+ correlationId: null,
104
+ graphNodeId: null,
105
+ sourceLocation: null,
106
+ stackTrace: null,
107
+ // Direct observation of our own orchestration state, never inferred --
108
+ // same basis as LogCollector's verbatim-capture confidence of 1.
109
+ confidence: 1,
110
+ redactionStatus: "pending-redaction",
111
+ collectorVersion: COLLECTOR_VERSION,
112
+ });
113
+ },
114
+ };
115
+ }
116
+ //# sourceMappingURL=process-collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-collector.js","sourceRoot":"","sources":["../src/process-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,iBAAiB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;oBACnG,kGAAkG,CACrG,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,IAAI,CAAC;gBACX,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,MAAM,EAAE,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB;gBAC5E,OAAO,EAAE,KAAK,CAAC,WAAW;gBAC1B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;gBAC/B,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;gBAClC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC;gBACzB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;gBACf,aAAa,EAAE,IAAI;gBACnB,WAAW,EAAE,IAAI;gBACjB,cAAc,EAAE,IAAI;gBACpB,UAAU,EAAE,IAAI;gBAChB,uEAAuE;gBACvE,iEAAiE;gBACjE,UAAU,EAAE,CAAC;gBACb,eAAe,EAAE,mBAAmB;gBACpC,gBAAgB,EAAE,iBAAiB;aACpC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * RT-024's named hole, closed for the two mechanisms that can carry it:
3
+ * "none of readiness's five mechanisms confirm the listener is THIS run's
4
+ * process -- a stale listener from a dead run satisfies http/tcp-port
5
+ * identically." Ephemeral-by-default (`allocateEphemeralPort`) closes the
6
+ * common case by construction; this closes the fixed-port case by
7
+ * detection, for real, via `/proc` -- not a heuristic guess.
8
+ *
9
+ * **Mechanism.** A TCP listening socket on Linux is a row in `/proc/net/tcp`
10
+ * (or `/proc/net/tcp6`) carrying an inode; a process's open file descriptors
11
+ * are symlinks under `/proc/<pid>/fd/*` named `socket:[<inode>]` when that fd
12
+ * is a socket. If the expected pid's fd table holds a socket whose inode
13
+ * matches a LISTEN row for the target port, that pid really does own the
14
+ * listener -- not a name-based guess, a kernel-backed fact.
15
+ *
16
+ * **Scope, disclosed rather than silently narrowed.** Linux only (`/proc`
17
+ * doesn't exist elsewhere) and only for a process in the same pid namespace
18
+ * as this one -- true for every spawn this repo produces today: a direct
19
+ * spawn, and a bwrap-wrapped one (bwrap execs into the target without
20
+ * `--unshare-pid`, so `child.pid` names the real process, not a wrapper).
21
+ * **Not true for `sandboxBackend: "container"`** -- a published Docker port
22
+ * is commonly owned by a host-side `docker-proxy` process, not the pid this
23
+ * module would be asked to verify, so a mismatch there would be a false
24
+ * positive. Callers must not invoke this for the container backend; See
25
+ * `controller.ts`'s call site, which guards on exactly that condition.
26
+ * Anything this function cannot determine returns `"unsupported"`, never a
27
+ * fabricated "verified" or a false "mismatch".
28
+ *
29
+ * **The spawned pid, or any of its descendants.** A launcher that forks the
30
+ * real server is the ordinary case: `sh -c "..."`, `npm run dev`, `dotnet run`
31
+ * (which builds and then runs the app as its child). The pid this run holds is
32
+ * the launcher's, and the listener belongs to a process under it — still this
33
+ * run's own process tree, which is exactly the property RT-024 asked for. The
34
+ * tree is walked from `/proc/<pid>/stat`'s parent-pid field, a kernel fact like
35
+ * the fd table, and a decoy outside that tree is refused exactly as before.
36
+ * Checking the spawned pid alone made every forking launcher time out at
37
+ * readiness (every .NET managed-lifecycle test, found at release integration).
38
+ */
39
+ export type IdentityVerification = "verified" | "mismatch" | "unsupported";
40
+ /**
41
+ * Does `expectedPid` -- or a process descended from it -- own the socket
42
+ * listening on `port`, on this host, right now? A real kernel-state check, not
43
+ * a guess -- see module header for the mechanism and its disclosed scope.
44
+ */
45
+ export declare function verifyListeningSocketOwner(port: number, expectedPid: number): IdentityVerification;
46
+ //# sourceMappingURL=process-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-identity.d.ts","sourceRoot":"","sources":["../src/process-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAgH3E;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAqBlG"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * RT-024's named hole, closed for the two mechanisms that can carry it:
3
+ * "none of readiness's five mechanisms confirm the listener is THIS run's
4
+ * process -- a stale listener from a dead run satisfies http/tcp-port
5
+ * identically." Ephemeral-by-default (`allocateEphemeralPort`) closes the
6
+ * common case by construction; this closes the fixed-port case by
7
+ * detection, for real, via `/proc` -- not a heuristic guess.
8
+ *
9
+ * **Mechanism.** A TCP listening socket on Linux is a row in `/proc/net/tcp`
10
+ * (or `/proc/net/tcp6`) carrying an inode; a process's open file descriptors
11
+ * are symlinks under `/proc/<pid>/fd/*` named `socket:[<inode>]` when that fd
12
+ * is a socket. If the expected pid's fd table holds a socket whose inode
13
+ * matches a LISTEN row for the target port, that pid really does own the
14
+ * listener -- not a name-based guess, a kernel-backed fact.
15
+ *
16
+ * **Scope, disclosed rather than silently narrowed.** Linux only (`/proc`
17
+ * doesn't exist elsewhere) and only for a process in the same pid namespace
18
+ * as this one -- true for every spawn this repo produces today: a direct
19
+ * spawn, and a bwrap-wrapped one (bwrap execs into the target without
20
+ * `--unshare-pid`, so `child.pid` names the real process, not a wrapper).
21
+ * **Not true for `sandboxBackend: "container"`** -- a published Docker port
22
+ * is commonly owned by a host-side `docker-proxy` process, not the pid this
23
+ * module would be asked to verify, so a mismatch there would be a false
24
+ * positive. Callers must not invoke this for the container backend; See
25
+ * `controller.ts`'s call site, which guards on exactly that condition.
26
+ * Anything this function cannot determine returns `"unsupported"`, never a
27
+ * fabricated "verified" or a false "mismatch".
28
+ *
29
+ * **The spawned pid, or any of its descendants.** A launcher that forks the
30
+ * real server is the ordinary case: `sh -c "..."`, `npm run dev`, `dotnet run`
31
+ * (which builds and then runs the app as its child). The pid this run holds is
32
+ * the launcher's, and the listener belongs to a process under it — still this
33
+ * run's own process tree, which is exactly the property RT-024 asked for. The
34
+ * tree is walked from `/proc/<pid>/stat`'s parent-pid field, a kernel fact like
35
+ * the fd table, and a decoy outside that tree is refused exactly as before.
36
+ * Checking the spawned pid alone made every forking launcher time out at
37
+ * readiness (every .NET managed-lifecycle test, found at release integration).
38
+ */
39
+ import { readFileSync, readdirSync, readlinkSync } from "node:fs";
40
+ function hexPort(port) {
41
+ return port.toString(16).toUpperCase().padStart(4, "0");
42
+ }
43
+ /** Every inode `/proc/net/tcp{,6}` records as LISTENing on `port`, host-wide. Usually one; more than one only under `SO_REUSEPORT`. */
44
+ function listenInodesForPort(port) {
45
+ const inodes = new Set();
46
+ const targetPort = hexPort(port);
47
+ const TCP_LISTEN_STATE = "0A";
48
+ for (const path of ["/proc/net/tcp", "/proc/net/tcp6"]) {
49
+ let content;
50
+ try {
51
+ content = readFileSync(path, "utf8");
52
+ }
53
+ catch {
54
+ // Absent entirely (non-Linux) or unreadable -- the caller sees an empty
55
+ // set from both paths and reports "unsupported", never a false mismatch.
56
+ continue;
57
+ }
58
+ for (const line of content.split("\n").slice(1)) {
59
+ const fields = line.trim().split(/\s+/);
60
+ const localAddress = fields[1];
61
+ const state = fields[3];
62
+ const inode = fields[9];
63
+ if (localAddress === undefined || state === undefined || inode === undefined)
64
+ continue;
65
+ if (state !== TCP_LISTEN_STATE)
66
+ continue;
67
+ const portHex = localAddress.split(":")[1];
68
+ if (portHex === targetPort)
69
+ inodes.add(inode);
70
+ }
71
+ }
72
+ return inodes;
73
+ }
74
+ /**
75
+ * Does `expectedPid` own the socket listening on `port`, on this host, right
76
+ * now? A real kernel-state check, not a guess -- see module header for the
77
+ * mechanism and its disclosed scope.
78
+ */
79
+ /** The parent pid recorded in `/proc/<pid>/stat`, or null if it cannot be read. The command name
80
+ * field is parenthesised and may itself contain spaces or parentheses, so the fields are read
81
+ * from after its LAST closing parenthesis. */
82
+ function parentPidOf(pid) {
83
+ let stat;
84
+ try {
85
+ stat = readFileSync(`/proc/${pid}/stat`, "utf8");
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ const afterName = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
91
+ // afterName[0] is the state, afterName[1] the parent pid.
92
+ return afterName[1] ?? null;
93
+ }
94
+ /** `root` and every live process below it, from one pass over `/proc`'s parent-pid fields. */
95
+ function processTree(root) {
96
+ const childrenOf = new Map();
97
+ let entries;
98
+ try {
99
+ entries = readdirSync("/proc");
100
+ }
101
+ catch {
102
+ return [String(root)];
103
+ }
104
+ for (const entry of entries) {
105
+ if (!/^\d+$/.test(entry))
106
+ continue;
107
+ const parent = parentPidOf(entry);
108
+ if (parent === null)
109
+ continue;
110
+ const siblings = childrenOf.get(parent);
111
+ if (siblings === undefined)
112
+ childrenOf.set(parent, [entry]);
113
+ else
114
+ siblings.push(entry);
115
+ }
116
+ const tree = [];
117
+ const pending = [String(root)];
118
+ const seen = new Set();
119
+ while (pending.length > 0) {
120
+ const pid = pending.pop();
121
+ if (seen.has(pid))
122
+ continue;
123
+ seen.add(pid);
124
+ tree.push(pid);
125
+ for (const child of childrenOf.get(pid) ?? [])
126
+ pending.push(child);
127
+ }
128
+ return tree;
129
+ }
130
+ /** Whether `pid`'s fd table holds one of `inodes`; `null` when that table cannot be read at all. */
131
+ function ownsOneOf(pid, inodes) {
132
+ let fds;
133
+ try {
134
+ fds = readdirSync(`/proc/${pid}/fd`);
135
+ }
136
+ catch {
137
+ // Permission denied, or the pid is already gone -- cannot look inside its
138
+ // fd table, so no claim either way.
139
+ return null;
140
+ }
141
+ const SOCKET_FD_PATTERN = /^socket:\[(\d+)\]$/;
142
+ for (const fd of fds) {
143
+ let link;
144
+ try {
145
+ link = readlinkSync(`/proc/${pid}/fd/${fd}`);
146
+ }
147
+ catch {
148
+ // A fd can close between readdir and readlink -- not this pid's fault,
149
+ // just skip it and keep looking at the rest.
150
+ continue;
151
+ }
152
+ const match = SOCKET_FD_PATTERN.exec(link);
153
+ if (match !== null && inodes.has(match[1]))
154
+ return true;
155
+ }
156
+ return false;
157
+ }
158
+ /**
159
+ * Does `expectedPid` -- or a process descended from it -- own the socket
160
+ * listening on `port`, on this host, right now? A real kernel-state check, not
161
+ * a guess -- see module header for the mechanism and its disclosed scope.
162
+ */
163
+ export function verifyListeningSocketOwner(port, expectedPid) {
164
+ const inodes = listenInodesForPort(port);
165
+ if (inodes.size === 0) {
166
+ // Either `/proc/net/tcp*` doesn't exist (non-Linux) or nothing is
167
+ // actually listening there yet -- either way this function cannot make
168
+ // a claim, so it declines rather than guessing.
169
+ return "unsupported";
170
+ }
171
+ // The spawned pid itself first: its fd table being unreadable is the one
172
+ // case that says nothing about ownership at all.
173
+ const own = ownsOneOf(String(expectedPid), inodes);
174
+ if (own === null)
175
+ return "unsupported";
176
+ if (own)
177
+ return "verified";
178
+ // Then its descendants. One that vanished or cannot be read is skipped --
179
+ // it cannot turn a real mismatch into a claim either way.
180
+ for (const pid of processTree(expectedPid).slice(1)) {
181
+ if (ownsOneOf(pid, inodes) === true)
182
+ return "verified";
183
+ }
184
+ return "mismatch";
185
+ }
186
+ //# sourceMappingURL=process-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-identity.js","sourceRoot":"","sources":["../src/process-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIlE,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,uIAAuI;AACvI,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,M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AI,KAAK,CAAC,EAAE,CAAC;QACtB,kEAAkE;QAClE,uEAAuE;QACvE,gDAAgD;QAChD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,yEAAyE;IACzE,iDAAiD;IACjD,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;IACnD,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,aAAa,CAAC;IACvC,IAAI,GAAG;QAAE,OAAO,UAAU,CAAC;IAE3B,0EAA0E;IAC1E,0DAA0D;IAC1D,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,IAAI,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,IAAI;YAAE,OAAO,UAAU,CAAC;IACzD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Process manager (§5): command execution, cwd, env, process-group tracking,
3
+ * stdout/stderr capture, exit-code capture, graceful shutdown, orphan prevention.
4
+ *
5
+ * Orphan prevention and group-kill use POSIX process groups (`detached: true` +
6
+ * `process.kill(-pid, signal)`) -- not portable to Windows, out of scope for the V1
7
+ * fixture-app slice (§34).
8
+ */
9
+ import type { FilesystemPolicy, NetworkPolicy, ProcessHandle, ResourceLimits, ServiceAttachConfiguration } from "@descryy/runtime-contracts";
10
+ import { type AttachFence } from "./attach-fencing.ts";
11
+ /**
12
+ * Binds port 0, reads it, releases immediately. A real gap remains between "free
13
+ * when checked" and "still free when the child binds it" (RT-024's gap, one layer
14
+ * down) -- unavoidable without binding the real service directly to the probe
15
+ * socket, which the child-process model doesn't support.
16
+ *
17
+ * **Examined and deliberately not "fixed".** Holding the probe socket longer widens
18
+ * the window rather than narrowing it (the child can't bind while we hold it).
19
+ * Instead, `awaitReadiness` names the endpoint it probed, so a collision reads as
20
+ * "nothing answered on this port" rather than an unexplained failure. Window is a
21
+ * handful of ms in practice; a genuine collision still fails loudly, just correctly
22
+ * attributed.
23
+ */
24
+ export declare function allocateEphemeralPort(): Promise<number>;
25
+ export interface SpawnProcessOptions {
26
+ readonly processId: string;
27
+ readonly command: string;
28
+ readonly args?: readonly string[];
29
+ readonly cwd?: string;
30
+ readonly env?: Readonly<Record<string, string | undefined>>;
31
+ /** Joins the resulting ProcessHandle back to ExecutionConfiguration.services (RT-023). Omit for no corresponding named service. */
32
+ readonly serviceName?: string;
33
+ /** Real port this process is bound to, when the caller already knows it. Recorded on the handle only. */
34
+ readonly port?: number;
35
+ /** §21 execution boundary (RT-070), via `applyResourceLimits`. Re-applied on every (re)spawn including `restart()`. */
36
+ readonly resourceLimits?: ResourceLimits;
37
+ /** §21 execution boundary, filesystem half, via `applySandbox`. Re-applied on every (re)spawn. */
38
+ readonly filesystemPolicy?: FilesystemPolicy;
39
+ /** §21 execution boundary, network half, via `applySandbox`. Re-applied on every (re)spawn. */
40
+ readonly networkPolicy?: NetworkPolicy;
41
+ /**
42
+ * Selects the mechanism enforcing `filesystemPolicy`/`networkPolicy`. Absent means
43
+ * `"bwrap"` (unchanged default); `"container"` routes through `applyContainerSandbox`.
44
+ *
45
+ * **Does not compose with `resourceLimits` in this pass** -- the container backend
46
+ * skips `applyResourceLimits`'s `prlimit` wrap entirely (a minimal image isn't
47
+ * guaranteed to carry `prlimit`, Docker's own limit flags aren't wired up).
48
+ * Disclosed in `container-sandbox.ts`, not silently dropped.
49
+ */
50
+ readonly sandboxBackend?: "bwrap" | "container";
51
+ }
52
+ export interface ProcessExitInfo {
53
+ readonly exitCode: number | null;
54
+ readonly signal: NodeJS.Signals | null;
55
+ }
56
+ export interface ManagedProcess {
57
+ handle(): ProcessHandle;
58
+ /**
59
+ * Combined stdout+stderr captured so far, in arrival order -- backing store
60
+ * for log-pattern readiness checks.
61
+ *
62
+ * **RT-261: bounded, not whole.** Holds the first `OUTPUT_HEAD_BYTES` and
63
+ * the last `OUTPUT_TAIL_BYTES` of everything the process has written; once
64
+ * `outputInfo().truncated` is true, the string also contains one inline
65
+ * marker naming how much was dropped between them. Readiness log-pattern
66
+ * checks run against the live head/tail as data arrives, so a pattern that
67
+ * only ever appears in the (dropped) middle is a real, disclosed gap, not
68
+ * a silent one -- see `outputInfo()`.
69
+ */
70
+ readOutput(): string;
71
+ /** Real total bytes seen and whether `readOutput()` is a truncated view of them (RT-261). */
72
+ outputInfo(): ProcessOutputInfo;
73
+ waitForExit(): Promise<ProcessExitInfo>;
74
+ /** SIGTERM the process group, wait up to `gracePeriodMs`, then SIGKILL. Idempotent. */
75
+ kill(gracePeriodMs?: number): Promise<void>;
76
+ /**
77
+ * Kills the current process (no-op wait if already exited) and spawns a fresh one
78
+ * with the same command/args/cwd/env. `handle()`/`readOutput()`/`waitForExit()`
79
+ * observe the new process on the same object -- no re-fetch needed. Resolves once
80
+ * the new process exists, not once it's ready (readiness is the caller's job).
81
+ */
82
+ restart(gracePeriodMs?: number): Promise<void>;
83
+ /**
84
+ * The attach-time fence (RT-N3), or `null` for a process this runtime spawned
85
+ * itself -- fencing only exists to mark content that predates OBSERVATION, and
86
+ * a spawned process has no output before Descry started it. See
87
+ * `computeAttachFence` (`attach-fencing.ts`) for what it records and why.
88
+ */
89
+ attachFence(): AttachFence | null;
90
+ }
91
+ export interface ProcessOutputInfo {
92
+ /** Every byte this process has written to stdout+stderr, whether kept or dropped. */
93
+ readonly totalBytesSeen: number;
94
+ /** True once `totalBytesSeen` exceeds what head+tail can hold -- `readOutput()` is a bounded view, not the whole thing. */
95
+ readonly truncated: boolean;
96
+ }
97
+ export declare function spawnProcess(options: SpawnProcessOptions): ManagedProcess;
98
+ /**
99
+ * `process.kill(pid, 0)` sends no signal, only asks the kernel if delivery is
100
+ * possible. `ESRCH` = no such pid; `EPERM` = a pid we don't own but that exists.
101
+ *
102
+ * Deliberate second copy of `orchestrator/src/attach-to-running-process.ts`'s
103
+ * same-named function, not an import -- `orchestrator` depends on `controller`, so
104
+ * the reverse import would be circular. Tiny and pure enough to duplicate safely.
105
+ */
106
+ export declare function isProcessAlive(pid: number): boolean;
107
+ export interface AttachProcessOptions {
108
+ readonly processId: string;
109
+ readonly attach: ServiceAttachConfiguration;
110
+ readonly serviceName?: string;
111
+ readonly port?: number;
112
+ }
113
+ /**
114
+ * `ManagedProcess` for a service attached to rather than spawned. Reads
115
+ * `attach.logFilePath` fresh on every `readOutput()` -- same growing-whole-buffer
116
+ * contract as a spawned process's in-memory pipe buffer.
117
+ *
118
+ * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this process,
119
+ * and `ATTACH_MODE_SCOPE_DISCLOSURE` is unconditional: attach mode never executes
120
+ * code in or applies changes to what it observes. Ending observation is the honest
121
+ * equivalent of "stop" -- the target keeps running. `restart()` throws for the same
122
+ * reason: no command exists to relaunch it with.
123
+ *
124
+ * **Attach fencing (RT-N3).** `computeAttachFence` snapshots, at construction time
125
+ * (i.e. the moment of attach), how much of `logFilePath` already existed and
126
+ * whether some other process also holds it open -- see `attach-fencing.ts`. Exposed
127
+ * via `attachFence()` for a caller building a `ProcessOutputSource` over
128
+ * `readOutput()` to mark pre-existing content instead of reporting it as freshly
129
+ * observed. `readOutput()` itself additionally refuses (rather than silently
130
+ * mis-reading) if the file is ever found shorter than the largest size already
131
+ * seen -- the same "cannot reconstruct a rotated/truncated buffer" rule
132
+ * `orchestrator/src/polling-output-source.ts` enforces one layer up, duplicated
133
+ * here for the same reason `isProcessAlive` is: this module cannot depend on
134
+ * that one without a cycle, and the check is small and pure enough to repeat.
135
+ */
136
+ export declare function attachManagedProcess(options: AttachProcessOptions): ManagedProcess;
137
+ //# sourceMappingURL=process-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-manager.d.ts","sourceRoot":"","sources":["../src/process-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,0BAA0B,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