@smartmemory/stratum 0.4.5 → 0.5.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.
Files changed (45) hide show
  1. package/dist/cli/flow.js +61 -0
  2. package/dist/cli/flow.js.map +1 -0
  3. package/dist/cli/learn.js +9 -16
  4. package/dist/cli/learn.js.map +1 -1
  5. package/dist/cli/query_gate.js +7 -2
  6. package/dist/cli/query_gate.js.map +1 -1
  7. package/dist/cli/stratum.js +3 -1
  8. package/dist/cli/stratum.js.map +1 -1
  9. package/dist/connectors/background.js +2 -2
  10. package/dist/connectors/background.js.map +1 -1
  11. package/dist/connectors/claude.js +2 -0
  12. package/dist/connectors/claude.js.map +1 -1
  13. package/dist/connectors/codex.js +4 -0
  14. package/dist/connectors/codex.js.map +1 -1
  15. package/dist/connectors/foreground_registry.js +589 -0
  16. package/dist/connectors/foreground_registry.js.map +1 -0
  17. package/dist/connectors/index.js +1 -0
  18. package/dist/connectors/index.js.map +1 -1
  19. package/dist/connectors/proc_identity.js +28 -0
  20. package/dist/connectors/proc_identity.js.map +1 -1
  21. package/dist/connectors/runner.js +2 -0
  22. package/dist/connectors/runner.js.map +1 -1
  23. package/dist/contracts/events.json +27 -1
  24. package/dist/contracts/mcp-surface.json +176 -6
  25. package/dist/engine/checkpoint.js +1 -1
  26. package/dist/engine/checkpoint.js.map +1 -1
  27. package/dist/engine/engine.js +860 -195
  28. package/dist/engine/engine.js.map +1 -1
  29. package/dist/engine/flow_cancel.js +158 -0
  30. package/dist/engine/flow_cancel.js.map +1 -0
  31. package/dist/engine/run_lock.js +628 -0
  32. package/dist/engine/run_lock.js.map +1 -0
  33. package/dist/engine/state.js +43 -2
  34. package/dist/engine/state.js.map +1 -1
  35. package/dist/ir/refs.js +12 -0
  36. package/dist/ir/refs.js.map +1 -1
  37. package/dist/ir/schema.js +9 -0
  38. package/dist/ir/schema.js.map +1 -1
  39. package/dist/ir/validate.js +243 -29
  40. package/dist/ir/validate.js.map +1 -1
  41. package/dist/learn/smartmemory_egress.js +3 -1
  42. package/dist/learn/smartmemory_egress.js.map +1 -1
  43. package/dist/mcp/server.js +193 -4
  44. package/dist/mcp/server.js.map +1 -1
  45. package/package.json +3 -2
@@ -0,0 +1,589 @@
1
+ import { readdir, readFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { setTimeout as delay } from "node:timers/promises";
5
+ import { atomicWriteJson, newRunDir } from "./background.js";
6
+ import { cancellationGraceMs } from "./cancellation.js";
7
+ import { processGroupId, processIdentity, procStartTime } from "./proc_identity.js";
8
+ /** Deliberately a SIBLING of the background registry, never a member of it (C8). `loadMeta`
9
+ * (background.ts) accepts any meta.json whose runId matches its directory, so a foreground
10
+ * codex record dropped into `agent_runs` would be loadable by `cancelBackgroundRun` and
11
+ * killed as if it were a detached background run. */
12
+ export function agentForegroundRoot() {
13
+ return join(homedir(), ".stratum", "ts", "agent_fg");
14
+ }
15
+ const REGISTRY_ID = /^[0-9a-f]{12}$/;
16
+ const REAL_PROBES = {
17
+ startTime: procStartTime,
18
+ groupId: processGroupId,
19
+ groupState: (pid) => realGroupState(pid),
20
+ kill: (pid, signal) => { process.kill(-pid, signal); },
21
+ };
22
+ function resolveProbes(options) {
23
+ return options.probes === undefined ? REAL_PROBES : { ...REAL_PROBES, ...options.probes };
24
+ }
25
+ function resolveRoot(options) {
26
+ return options.registryRoot ?? process.env.STRATUM_AGENT_FG_ROOT ?? agentForegroundRoot();
27
+ }
28
+ // ── Records ───────────────────────────────────────────────────────────────────
29
+ function isRecord(value) {
30
+ return typeof value === "object" && value !== null && !Array.isArray(value);
31
+ }
32
+ function metaPath(root, registryId) {
33
+ if (!REGISTRY_ID.test(registryId))
34
+ throw new Error(`invalid foreground registry id ${JSON.stringify(registryId)}`);
35
+ return join(root, registryId, "meta.json");
36
+ }
37
+ async function readMeta(root, registryId) {
38
+ if (!REGISTRY_ID.test(registryId))
39
+ return undefined;
40
+ let raw;
41
+ try {
42
+ raw = JSON.parse(await readFile(join(root, registryId, "meta.json"), "utf8"));
43
+ }
44
+ catch {
45
+ return undefined;
46
+ }
47
+ if (!isRecord(raw) || raw.runId !== registryId || raw.foreground !== true)
48
+ return undefined;
49
+ if (raw.agent !== "claude" && raw.agent !== "codex")
50
+ return undefined;
51
+ if (!isRecord(raw.flow) || typeof raw.flow.runId !== "string")
52
+ return undefined;
53
+ if (!Array.isArray(raw.groups))
54
+ return undefined;
55
+ if (raw.state !== "starting" && raw.state !== "running" && raw.state !== "settled")
56
+ return undefined;
57
+ return raw;
58
+ }
59
+ /** Writes the `starting` record. Throws on failure — the caller must not proceed to a spawn
60
+ * it could not record, which is the uncancellable-orphan hazard `background.ts:191-196`
61
+ * already refuses to accept on the durable path. */
62
+ export async function createForegroundRun(meta, options = {}) {
63
+ const root = resolveRoot(options);
64
+ const { runId, runDir } = await newRunDir(root);
65
+ await atomicWriteJson(join(runDir, "meta.json"), { ...meta, runId });
66
+ return runId;
67
+ }
68
+ /** Appends one spawned group and promotes the record to `running`. Serialised by the caller
69
+ * (one promise chain per run), so no lock is needed. Returns what it wrote so the caller can
70
+ * check `procStartTime` without re-reading the file (R3-8). Throws on failure. */
71
+ export async function recordForegroundGroup(registryId, pid, options = {}) {
72
+ const root = resolveRoot(options);
73
+ const meta = await readMeta(root, registryId);
74
+ if (!meta)
75
+ throw Object.assign(new Error(`foreground registry entry ${registryId} is missing or unreadable`), { code: "REGISTRY_WRITE_FAILED" });
76
+ const startTime = await procStartTime(pid);
77
+ const group = { childPid: pid, ...(startTime !== undefined ? { procStartTime: startTime } : {}) };
78
+ const next = { ...meta, state: "running", groups: [...meta.groups, group] };
79
+ await atomicWriteJson(metaPath(root, registryId), next);
80
+ return group;
81
+ }
82
+ /** Stamps `settled`. Never deletes the directory: a reader that raced the settle must see a
83
+ * stamped record rather than an ENOENT it would have to interpret. */
84
+ export async function settleForegroundRun(registryId, options = {}) {
85
+ const root = resolveRoot(options);
86
+ const meta = await readMeta(root, registryId);
87
+ if (!meta)
88
+ throw Object.assign(new Error(`foreground registry entry ${registryId} is missing or unreadable`), { code: "REGISTRY_WRITE_FAILED" });
89
+ if (meta.state === "settled")
90
+ return;
91
+ await atomicWriteJson(metaPath(root, registryId), { ...meta, state: "settled", settledAt: new Date().toISOString() });
92
+ }
93
+ // ── Killing ───────────────────────────────────────────────────────────────────
94
+ /** Only ESRCH means dead. EPERM means "exists, not ours" — reported as unreachable, never as
95
+ * reaped. The lifecycle test helper's bare catch
96
+ * (ts/tests/connectors/background-codex-lifecycle.test.ts:34-41) gets this wrong and must not
97
+ * be copied here (invariant 13). */
98
+ function realGroupState(pid) {
99
+ try {
100
+ process.kill(-pid, 0);
101
+ return "alive";
102
+ }
103
+ catch (error) {
104
+ return error.code === "ESRCH" ? "gone" : "unknown";
105
+ }
106
+ }
107
+ /** Every probe on the signal path is an `await` on another process, and an unbounded one turns
108
+ * the caller's absolute deadline into a suggestion (F6). A probe that has not answered by the
109
+ * deadline yields no verdict at all — `undefined` — and the caller stops rather than acting on
110
+ * an answer nobody is still waiting for. */
111
+ async function bounded(work, deadline) {
112
+ const remaining = deadline - Date.now();
113
+ if (remaining <= 0) {
114
+ void work.catch(() => undefined);
115
+ return undefined;
116
+ }
117
+ let timer;
118
+ const expiry = new Promise((resolve) => {
119
+ timer = setTimeout(() => resolve(undefined), remaining);
120
+ timer.unref?.();
121
+ });
122
+ try {
123
+ return await Promise.race([work.then((value) => ({ value })), expiry]);
124
+ }
125
+ finally {
126
+ clearTimeout(timer);
127
+ }
128
+ }
129
+ async function identityVerdict(probes, pid, expected, deadline) {
130
+ if (!expected)
131
+ return "mismatch";
132
+ const probed = await bounded(probes.startTime(pid), deadline);
133
+ if (probed === undefined)
134
+ return "deadline";
135
+ return probed.value === expected ? "match" : "mismatch";
136
+ }
137
+ /**
138
+ * The four gates from `background.ts:444-452`, plus the prior question they never asked.
139
+ *
140
+ * TRI-STATE, because "we did not signal it" is two different facts. A group that is already
141
+ * gone (ESRCH on the group probe) is RESOLVED — the thing we wanted dead is dead — while a
142
+ * group whose identity does not match, or cannot be read, is UNREACHABLE and can never be
143
+ * acknowledged. The old boolean collapsed both into `false` and recorded both as unreachable,
144
+ * so an agent that exited a moment before the cancel arrived permanently blocked the
145
+ * acknowledgement of a teardown that had already happened.
146
+ */
147
+ async function signalGroup(probes, pid, expected, deadline) {
148
+ if (Date.now() >= deadline)
149
+ return "deadline";
150
+ if (probes.groupState(pid) === "gone")
151
+ return "gone";
152
+ const first = await identityVerdict(probes, pid, expected, deadline);
153
+ if (first === "deadline")
154
+ return "deadline";
155
+ if (first === "mismatch") {
156
+ // Re-probe: the identity may have failed to read BECAUSE the process exited between the
157
+ // group probe above and here, which is a `gone`, not an unreachable.
158
+ return probes.groupState(pid) === "gone" ? "gone" : "unreachable";
159
+ }
160
+ const leader = await bounded(probes.groupId(pid), deadline);
161
+ if (leader === undefined)
162
+ return "deadline";
163
+ if (leader.value !== pid)
164
+ return "unreachable";
165
+ // Verify the start-time identity a second time immediately before the only signal.
166
+ const second = await identityVerdict(probes, pid, expected, deadline);
167
+ if (second === "deadline")
168
+ return "deadline";
169
+ // Re-probe, exactly as the FIRST mismatch branch does (F6). An exit between the group-leader
170
+ // probe and here leaves no readable start time, which reads as a mismatch — so a teardown that
171
+ // demonstrably completed was reported `unreachable` and could never be acknowledged.
172
+ if (second === "mismatch")
173
+ return probes.groupState(pid) === "gone" ? "gone" : "unreachable";
174
+ // The LAST word before the signal is the clock (F6). A SIGTERM sent after the caller's
175
+ // deadline has no grace window left to run in and no reap pass left to confirm it: it is a
176
+ // signal delivered to a child nobody is waiting on.
177
+ if (Date.now() >= deadline)
178
+ return "deadline";
179
+ try {
180
+ probes.kill(pid, "SIGTERM");
181
+ }
182
+ catch (error) {
183
+ return error.code === "ESRCH" ? "gone" : "unreachable";
184
+ }
185
+ return "signalled";
186
+ }
187
+ /**
188
+ * SIGKILL escalation, through the SAME gates as the SIGTERM — re-run here, immediately before
189
+ * the signal, never inherited from the earlier pass.
190
+ *
191
+ * The escalation used to be a bare `process.kill(-pid, "SIGKILL")` on the recorded number. The
192
+ * gap between SIGTERM and SIGKILL is the grace window, by construction the longest pause in the
193
+ * whole teardown, and it is exactly the window in which the group leader exits and its pid is
194
+ * handed to something else. A kill by pid alone at the end of it is a SIGKILL delivered to a
195
+ * stranger's process group.
196
+ */
197
+ async function escalateGroup(probes, pid, expected, deadline) {
198
+ if (Date.now() >= deadline)
199
+ return "deadline";
200
+ if (probes.groupState(pid) === "gone")
201
+ return "gone";
202
+ const first = await identityVerdict(probes, pid, expected, deadline);
203
+ if (first === "deadline")
204
+ return "deadline";
205
+ if (first === "mismatch") {
206
+ return probes.groupState(pid) === "gone" ? "gone" : "unreachable";
207
+ }
208
+ const leader = await bounded(probes.groupId(pid), deadline);
209
+ if (leader === undefined)
210
+ return "deadline";
211
+ if (leader.value !== pid)
212
+ return "unreachable";
213
+ // F5: the identity is checked AGAIN after the group-leader probe, immediately before the
214
+ // SIGKILL — never inherited across that await. The whole reason the escalation re-runs the
215
+ // gates is that a pid can be reissued while they run; a check that stops one await short of
216
+ // the signal reintroduces exactly the window it was added to close.
217
+ const second = await identityVerdict(probes, pid, expected, deadline);
218
+ if (second === "deadline")
219
+ return "deadline";
220
+ // Same re-probe as the first branch (F6): the grace window is the longest pause in the whole
221
+ // teardown, so the leader exiting DURING this second check is the expected case, not an edge.
222
+ if (second === "mismatch")
223
+ return probes.groupState(pid) === "gone" ? "gone" : "unreachable";
224
+ if (Date.now() >= deadline)
225
+ return "deadline";
226
+ try {
227
+ probes.kill(pid, "SIGKILL");
228
+ }
229
+ catch (error) {
230
+ return error.code === "ESRCH" ? "gone" : "unreachable";
231
+ }
232
+ return "escalated";
233
+ }
234
+ const REAP_POLL_MS = 10;
235
+ /** SIGTERM → grace → SIGKILL → reap, for ONE group, using its RECORDED identity (R3-8). A
236
+ * `process.kill(-pid, …)` without the start-time token is a kill by pid alone, which is the
237
+ * recycled-pid hazard the four gates exist to close — so a call with no `startTime` signals
238
+ * nothing and reports `unreachable`. */
239
+ export async function killAndReapGroup(pid, options = {}) {
240
+ const probes = resolveProbes(options);
241
+ const deadline = resolveDeadline(options);
242
+ const grace = requireDuration(options.graceMs ?? cancellationGraceMs(), "graceMs");
243
+ // No recorded identity, a mismatched one, a non-leader or a refused signal: there is no
244
+ // group we can honestly claim to have killed (invariant 15b). A group already gone is a
245
+ // different answer entirely, and a resolved one.
246
+ //
247
+ // The deadline goes IN (F6). Without it this call could send its SIGTERM after the caller's
248
+ // budget had already expired, then report a timeout for a signal it had just issued.
249
+ const signal = await signalGroup(probes, pid, options.startTime, deadline);
250
+ if (signal === "deadline")
251
+ return "timeout";
252
+ if (signal !== "signalled")
253
+ return signal;
254
+ // The grace clock starts at OUR SIGTERM, not at the top of the call.
255
+ const escalateAt = Date.now() + grace;
256
+ let escalated = false;
257
+ let last = "alive";
258
+ while (Date.now() < deadline) {
259
+ const state = probes.groupState(pid);
260
+ if (state === "gone")
261
+ return "reaped";
262
+ last = state;
263
+ if (!escalated && Date.now() >= escalateAt) {
264
+ escalated = true;
265
+ const result = await escalateGroup(probes, pid, options.startTime, deadline);
266
+ if (result === "gone")
267
+ return "reaped";
268
+ if (result === "unreachable")
269
+ return "unreachable";
270
+ }
271
+ await delay(REAP_POLL_MS);
272
+ }
273
+ const final = probes.groupState(pid);
274
+ if (final === "gone")
275
+ return "reaped";
276
+ return final === "unknown" || last === "unknown" ? "unreachable" : "timeout";
277
+ }
278
+ export function cancelTimeoutMs(env = process.env) {
279
+ const value = Number(env.STRATUM_CANCEL_TIMEOUT_MS ?? 15000);
280
+ if (!Number.isFinite(value) || value < 0)
281
+ throw new Error("STRATUM_CANCEL_TIMEOUT_MS must be a nonnegative number");
282
+ return value;
283
+ }
284
+ /** A caller-supplied budget gets the same treatment as an env one (F6): `Date.now() + NaN` is
285
+ * NaN, `Date.now() >= NaN` is false forever, and the reap loop that trusts it never ends. */
286
+ function requireDuration(value, name) {
287
+ if (!Number.isFinite(value) || value < 0)
288
+ throw new Error(`${name} must be a nonnegative finite number`);
289
+ return value;
290
+ }
291
+ /** THE one place a teardown deadline is resolved (F3). `deadlineAt` used to bypass
292
+ * `requireDuration` entirely — it is an absolute instant, not a duration, so no validator ever
293
+ * saw it — and a NaN one is exactly as fatal: every `Date.now() >= deadline` test against it is
294
+ * false, so the reap loop that trusts it runs forever. Every entry point resolves through here,
295
+ * so neither shape can reach a loop unvalidated. */
296
+ function resolveDeadline(options) {
297
+ if (options.deadlineAt === undefined) {
298
+ return Date.now() + requireDuration(options.timeoutMs ?? cancelTimeoutMs(), "timeoutMs");
299
+ }
300
+ if (!Number.isFinite(options.deadlineAt)) {
301
+ throw new Error("deadlineAt must be a finite epoch-millisecond timestamp");
302
+ }
303
+ return options.deadlineAt;
304
+ }
305
+ // ── The sweep ─────────────────────────────────────────────────────────────────
306
+ async function scan(root, flowRunId) {
307
+ let names;
308
+ try {
309
+ names = await readdir(root);
310
+ }
311
+ catch (error) {
312
+ // An empty registry is the normal case: most flows never dispatch a foreground agent.
313
+ if (error.code === "ENOENT")
314
+ return [];
315
+ throw error;
316
+ }
317
+ const found = [];
318
+ for (const name of names) {
319
+ if (!REGISTRY_ID.test(name))
320
+ continue;
321
+ const meta = await readMeta(root, name);
322
+ if (!meta || meta.flow.runId !== flowRunId)
323
+ continue;
324
+ found.push({ id: name, meta });
325
+ }
326
+ return found;
327
+ }
328
+ function absorb(accumulated, id, meta) {
329
+ let entry = accumulated.entries.get(id);
330
+ if (!entry) {
331
+ entry = {
332
+ groups: new Map(),
333
+ state: meta.state,
334
+ settled: meta.state === "settled",
335
+ alreadySettled: meta.state === "settled",
336
+ ...(typeof meta.serverPid === "number" ? { serverPid: meta.serverPid } : {}),
337
+ ...(typeof meta.serverProcStartTime === "string" ? { serverProcStartTime: meta.serverProcStartTime } : {}),
338
+ };
339
+ accumulated.entries.set(id, entry);
340
+ }
341
+ entry.state = meta.state;
342
+ if (meta.state === "settled")
343
+ entry.settled = true;
344
+ // Re-read the owner every pass rather than trusting the first observation: the record a
345
+ // sweep first sees may be a `starting` one whose fields are still being filled in.
346
+ if (typeof meta.serverPid === "number")
347
+ entry.serverPid = meta.serverPid;
348
+ else
349
+ delete entry.serverPid;
350
+ if (typeof meta.serverProcStartTime === "string")
351
+ entry.serverProcStartTime = meta.serverProcStartTime;
352
+ else
353
+ delete entry.serverProcStartTime;
354
+ for (const group of meta.groups) {
355
+ if (typeof group.childPid !== "number")
356
+ continue;
357
+ if (entry.groups.has(group.childPid))
358
+ continue;
359
+ entry.groups.set(group.childPid, {
360
+ ...(group.procStartTime !== undefined ? { startTime: group.procStartTime } : {}),
361
+ everSignalled: false,
362
+ });
363
+ }
364
+ return entry;
365
+ }
366
+ /** Steps 1-2 of §2.4: enumerate the flow's unsettled entries and send each recorded group its
367
+ * one SIGTERM, through the four identity gates. The bookkeeping it returns is carried into
368
+ * `reapFlowAgents` so nothing is double-counted across the rescan passes. */
369
+ export async function signalFlowAgents(flowRunId, options = {}) {
370
+ const accumulated = { entries: new Map() };
371
+ // The SIGNAL pass shares the caller's one absolute deadline (R3-5). Without it a slow scan
372
+ // can hand the reap a budget that is already spent, and — worse — keep sending SIGTERMs
373
+ // after the caller has given up waiting for anything to answer them.
374
+ await sweepPass(resolveRoot(options), flowRunId, accumulated, {
375
+ escalate: false,
376
+ deadline: resolveDeadline(options),
377
+ graceMs: requireDuration(options.graceMs ?? cancellationGraceMs(), "graceMs"),
378
+ probes: resolveProbes(options),
379
+ });
380
+ return accumulated;
381
+ }
382
+ async function sweepPass(root, flowRunId, accumulated, options) {
383
+ const { probes } = options;
384
+ for (const { id, meta } of await scan(root, flowRunId)) {
385
+ const entry = absorb(accumulated, id, meta);
386
+ for (const [pid, group] of entry.groups) {
387
+ if (group.outcome === "reaped" || group.outcome === "gone" || group.outcome === "unreachable")
388
+ continue;
389
+ // A settled entry is never SIGNALLED again (invariant 14) — but its already-signalled
390
+ // groups are still PROBED below. Skipping a settled entry outright leaves the probe
391
+ // taken during the signal pass as the final verdict, and that probe is `unknown` for
392
+ // the whole window in which the leader is dead but not yet reaped by its parent — so
393
+ // an agent whose teardown demonstrably completed would be reported `unreachable` and
394
+ // could never be acknowledged.
395
+ if (entry.settled && !group.everSignalled)
396
+ continue;
397
+ if (!group.everSignalled) {
398
+ // Past the deadline nothing new is signalled: a SIGTERM sent now has no grace window
399
+ // left to run in and no reap pass left to confirm it. The group stays unresolved and
400
+ // is reported as such, which is the honest answer.
401
+ if (Date.now() >= options.deadline)
402
+ continue;
403
+ const signal = await signalGroup(probes, pid, group.startTime, options.deadline);
404
+ // The deadline expired inside the gates: no signal was sent, so the group is left
405
+ // unresolved and reported as such rather than given a verdict nobody probed for.
406
+ if (signal === "deadline")
407
+ continue;
408
+ if (signal === "gone") {
409
+ group.outcome = "gone";
410
+ delete group.lastProbe;
411
+ continue;
412
+ }
413
+ if (signal === "unreachable") {
414
+ // An identity mismatch means the pid is now some other process: the group we
415
+ // recorded is gone too, but we never signalled it, and we cannot prove which — so
416
+ // it is `unreachable`, not `gone`. Collapsing the two would let a recycled pid read
417
+ // as a teardown.
418
+ group.outcome = "unreachable";
419
+ continue;
420
+ }
421
+ group.everSignalled = true;
422
+ group.outcome = "signalled";
423
+ // Per-group grace, clocked from THIS SIGTERM (F5).
424
+ group.escalateAt = Date.now() + options.graceMs;
425
+ }
426
+ const state = probes.groupState(pid);
427
+ if (state === "gone") {
428
+ group.outcome = "reaped";
429
+ delete group.lastProbe;
430
+ continue;
431
+ }
432
+ group.lastProbe = state;
433
+ const escalateAt = group.escalateAt ?? options.deadline;
434
+ if (options.escalate && !entry.settled && Date.now() >= escalateAt && Date.now() < options.deadline) {
435
+ // F6: the identity and group-leader gates are re-run here, immediately before the
436
+ // SIGKILL. The grace window is long enough for the leader to exit and its pid to be
437
+ // reissued, and a kill by bare pgid at the end of it lands on a stranger.
438
+ const result = await escalateGroup(probes, pid, group.startTime, options.deadline);
439
+ if (result === "deadline")
440
+ continue;
441
+ if (result === "gone") {
442
+ group.outcome = "reaped";
443
+ delete group.lastProbe;
444
+ continue;
445
+ }
446
+ if (result === "unreachable") {
447
+ group.outcome = "unreachable";
448
+ delete group.lastProbe;
449
+ }
450
+ }
451
+ }
452
+ }
453
+ }
454
+ function resolvedOutcome(outcome) {
455
+ return outcome === "reaped" || outcome === "gone" || outcome === "unreachable";
456
+ }
457
+ function entryResolved(entry) {
458
+ // Multi-group Claude entries (C9) follow the same rule: every pid must be resolved.
459
+ for (const group of entry.groups.values()) {
460
+ // A group this sweep never signalled belongs to an entry that was already settled when we
461
+ // arrived: it is not ours to tear down and never blocks resolution. A group we DID signal
462
+ // blocks it until the probe answers, settled entry or not — the entry settling says the
463
+ // dispatcher unwound, not that the process group is gone.
464
+ if (entry.settled && !group.everSignalled)
465
+ continue;
466
+ if (!resolvedOutcome(group.outcome))
467
+ return false;
468
+ }
469
+ // Reaping the groups is not the same as the entry being over, and `summarise` says so:
470
+ // it counts every unsettled entry as `unsettled` whatever its groups did (R3-6). Breaking
471
+ // the poll here would stop watching an entry the owning dispatcher is still unwinding and
472
+ // then report that as a teardown failure — so an unsettled entry keeps the poll alive until
473
+ // it settles or the deadline answers for it.
474
+ return entry.settled;
475
+ }
476
+ /** Steps 3-5 of §2.4: grace, escalation, reap and rescan, all under ONE absolute deadline.
477
+ * The loop re-reads the directory rather than trusting one snapshot, because an entry can
478
+ * move `starting → running` while the sweep is in progress. */
479
+ export async function reapFlowAgents(flowRunId, signalled, options = {}) {
480
+ const root = resolveRoot(options);
481
+ const deadline = resolveDeadline(options);
482
+ const graceMs = requireDuration(options.graceMs ?? cancellationGraceMs(), "graceMs");
483
+ const identity = options.identity ?? processIdentity;
484
+ const probes = resolveProbes(options);
485
+ while (true) {
486
+ // `escalate: true` unconditionally: each group carries its OWN escalation instant now, so
487
+ // the pass decides per group rather than off one clock that started before some of them
488
+ // had even been signalled.
489
+ await sweepPass(root, flowRunId, signalled, { escalate: true, deadline, graceMs, probes });
490
+ await applyDeadOwnerException(root, signalled, identity, deadline);
491
+ if ([...signalled.entries.values()].every(entryResolved))
492
+ break;
493
+ if (Date.now() >= deadline)
494
+ break;
495
+ await delay(REAP_POLL_MS);
496
+ }
497
+ // At the deadline a standing `unknown` is the final answer: EPERM means "exists, not ours",
498
+ // which is never a reap and never a licence to acknowledge (invariant 13).
499
+ for (const entry of signalled.entries.values()) {
500
+ for (const group of entry.groups.values()) {
501
+ if (group.outcome === "signalled" && group.lastProbe === "unknown")
502
+ group.outcome = "unreachable";
503
+ }
504
+ }
505
+ return summarise(signalled);
506
+ }
507
+ /** Convenience for callers that do not need to interleave a local teardown between the two
508
+ * phases (S03 does; the CLI and the tests mostly do not). */
509
+ export async function cancelFlowAgents(flowRunId, options = {}) {
510
+ // ONE deadline, resolved here and handed to BOTH phases (F7). Passing `options` through gave
511
+ // each phase its own `timeoutMs` budget, so a slow signal pass did not eat into the reap's
512
+ // time — it doubled the total, and a caller that configured 15s could wait 30.
513
+ const shared = { ...options, deadlineAt: resolveDeadline(options) };
514
+ return reapFlowAgents(flowRunId, await signalFlowAgents(flowRunId, shared), shared);
515
+ }
516
+ /** The sweep stamps `settled` itself ONLY when the owning server is PROVABLY dead and every
517
+ * recorded group is resolved (R3-6, R4-3). A pid-only check would read a recycled pid as "the
518
+ * server is gone" and stamp a live dispatcher's entry settled, so the owner's start time is
519
+ * required — an entry written without `serverProcStartTime` is never eligible. And the probe
520
+ * is the TRI-STATE one: `unknown` (EPERM, or a start time we could not read) is never a
521
+ * licence to reclaim another process's record. */
522
+ async function applyDeadOwnerException(root, accumulated, identity, deadline) {
523
+ for (const [id, entry] of accumulated.entries) {
524
+ if (entry.settled || entry.state === "starting")
525
+ continue;
526
+ if (entry.serverPid === undefined || entry.serverProcStartTime === undefined)
527
+ continue;
528
+ if (entry.groups.size === 0)
529
+ continue;
530
+ let resolved = true;
531
+ for (const group of entry.groups.values()) {
532
+ if (!resolvedOutcome(group.outcome)) {
533
+ resolved = false;
534
+ break;
535
+ }
536
+ }
537
+ if (!resolved)
538
+ continue;
539
+ // Bounded like every other probe on this path (F6): the owner probe is a shell-out on
540
+ // darwin, and an unbounded one lets a single slow answer run the reap loop past the
541
+ // caller's deadline.
542
+ const owner = await bounded(identity(entry.serverPid, entry.serverProcStartTime), deadline);
543
+ if (owner === undefined || owner.value !== "dead")
544
+ continue;
545
+ try {
546
+ await settleForegroundRun(id, { registryRoot: root });
547
+ entry.settled = true;
548
+ }
549
+ catch { /* a stale entry is reported as unsettled rather than claimed */ }
550
+ }
551
+ }
552
+ function summarise(accumulated) {
553
+ const summary = { signalled: 0, reaped: 0, gone: 0, unreachable: 0, alreadySettled: 0, unresolved: 0, unsettled: 0, unreaped: 0 };
554
+ for (const entry of accumulated.entries.values()) {
555
+ if (entry.alreadySettled) {
556
+ summary.alreadySettled += 1;
557
+ continue;
558
+ }
559
+ for (const group of entry.groups.values()) {
560
+ // F7: the SAME exclusion `sweepPass` and `entryResolved` already apply. A group belonging
561
+ // to an entry that settled before we signalled it is not ours to tear down — the sweep
562
+ // deliberately never signals it and `entryResolved` deliberately ignores it — so counting
563
+ // its absent outcome as `unreaped` here contradicted both and turned an entry that went
564
+ // `starting → settled` mid-sweep into a teardown timeout for a group nobody touched.
565
+ //
566
+ // ONLY the outcome-less ones. A group that was probed and found `gone` on a settled entry
567
+ // is a real, reported verdict; dropping it too would hide the very counter that lets a
568
+ // flow whose agent exited on its own be acknowledged.
569
+ if (entry.settled && !group.everSignalled && group.outcome === undefined)
570
+ continue;
571
+ if (group.everSignalled)
572
+ summary.signalled += 1;
573
+ if (group.outcome === "reaped")
574
+ summary.reaped += 1;
575
+ else if (group.outcome === "gone")
576
+ summary.gone += 1;
577
+ else if (group.outcome === "unreachable")
578
+ summary.unreachable += 1;
579
+ else
580
+ summary.unreaped += 1;
581
+ }
582
+ if (entry.state === "starting" && !entry.settled)
583
+ summary.unresolved += 1;
584
+ if (!entry.settled)
585
+ summary.unsettled += 1;
586
+ }
587
+ return summary;
588
+ }
589
+ //# sourceMappingURL=foreground_registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foreground_registry.js","sourceRoot":"","sources":["../../src/connectors/foreground_registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAA0B,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5G;;;sDAGsD;AACtD,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAkBrC,MAAM,WAAW,GAAkB;IACjC,SAAS,EAAE,aAAa;IACxB,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC;IACxC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,SAAS,aAAa,CAAC,OAA4C;IACjE,OAAO,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC5F,CAAC;AAgBD,SAAS,WAAW,CAAC,OAA4B;IAC/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D,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,OAAO;YAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CAAC,OAAO;YAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -2,6 +2,7 @@ export * from "./background.js";
2
2
  export * from "./base.js";
3
3
  export * from "./claude.js";
4
4
  export * from "./codex.js";
5
+ export * from "./foreground_registry.js";
5
6
  export * from "./proc_identity.js";
6
7
  export * from "./runner.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}