@claudexor/core 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/answer-assembly.d.ts +17 -1
- package/dist/answer-assembly.d.ts.map +1 -1
- package/dist/answer-assembly.js +36 -10
- package/dist/answer-assembly.js.map +1 -1
- package/dist/env-scope.d.ts +1 -1
- package/dist/env-scope.d.ts.map +1 -1
- package/dist/env-scope.js +2 -2
- package/dist/env-scope.js.map +1 -1
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/inactivity.d.ts +7 -14
- package/dist/inactivity.d.ts.map +1 -1
- package/dist/inactivity.js +97 -10
- package/dist/inactivity.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/native/claudexor-process-identity +0 -0
- package/dist/proc.d.ts +53 -0
- package/dist/proc.d.ts.map +1 -1
- package/dist/proc.js +150 -42
- package/dist/proc.js.map +1 -1
- package/dist/process-identity.d.ts.map +1 -1
- package/dist/process-identity.js +17 -7
- package/dist/process-identity.js.map +1 -1
- package/dist/process-tree.d.ts +116 -0
- package/dist/process-tree.d.ts.map +1 -0
- package/dist/process-tree.js +258 -0
- package/dist/process-tree.js.map +1 -0
- package/dist/runloop.d.ts +5 -0
- package/dist/runloop.d.ts.map +1 -1
- package/dist/runloop.js +41 -0
- package/dist/runloop.js.map +1 -1
- package/dist/runtime-env.d.ts +57 -3
- package/dist/runtime-env.d.ts.map +1 -1
- package/dist/runtime-env.js +187 -10
- package/dist/runtime-env.js.map +1 -1
- package/package.json +3 -3
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
export declare class AnswerAssembly {
|
|
8
8
|
private readonly parts;
|
|
9
9
|
private finalText?;
|
|
10
|
+
/**
|
|
11
|
+
* MACHINE-truth final, decoupled from the DISPLAY final (codex #19816 /
|
|
12
|
+
* QA-009). A codex constrained WorkReport route pre-unwraps its final
|
|
13
|
+
* message's DISPLAY text to the `output` (so the answer bubble + the app's
|
|
14
|
+
* twin-removal see the unwrapped output, not raw JSON) and carries the raw
|
|
15
|
+
* `{work_report, output}` envelope on `payload.work_report_envelope`. The
|
|
16
|
+
* orchestrator un-nests machine truth via `machineText()`, so the display
|
|
17
|
+
* unwrap never breaks the envelope parse; adapters that leave the raw envelope
|
|
18
|
+
* IN the final text (claude) never set this, so `machineText()` === `text()`.
|
|
19
|
+
*/
|
|
20
|
+
private machineFinalText?;
|
|
10
21
|
/** Feed one already-sanitized harness event; non-answer events are ignored. */
|
|
11
22
|
observe(ev: {
|
|
12
23
|
type: string;
|
|
@@ -16,7 +27,12 @@ export declare class AnswerAssembly {
|
|
|
16
27
|
}): void;
|
|
17
28
|
/** Whether a typed final answer has been accepted. */
|
|
18
29
|
hasFinal(): boolean;
|
|
19
|
-
/** The assembled answer: the typed final verbatim, else joined
|
|
30
|
+
/** The assembled answer for DISPLAY: the typed final verbatim, else joined
|
|
31
|
+
* narration. For codex constrained routes this is the UNWRAPPED output. */
|
|
20
32
|
text(): string;
|
|
33
|
+
/** The assembled answer for MACHINE consumption (the WorkReport un-nest): the
|
|
34
|
+
* raw envelope when the adapter pre-unwrapped the display copy, else identical
|
|
35
|
+
* to `text()`. The orchestrator passes THIS to `unwrapWorkReportEnvelope`. */
|
|
36
|
+
machineText(): string;
|
|
21
37
|
}
|
|
22
38
|
//# sourceMappingURL=answer-assembly.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-assembly.d.ts","sourceRoot":"","sources":["../src/answer-assembly.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,SAAS,CAAC,CAAS;
|
|
1
|
+
{"version":3,"file":"answer-assembly.d.ts","sourceRoot":"","sources":["../src/answer-assembly.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAElC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,GAAG,IAAI;IAyBR,sDAAsD;IACtD,QAAQ,IAAI,OAAO;IAInB;+EAC2E;IAC3E,IAAI,IAAI,MAAM;IAId;;kFAE8E;IAC9E,WAAW,IAAI,MAAM;CAGtB"}
|
package/dist/answer-assembly.js
CHANGED
|
@@ -7,9 +7,20 @@
|
|
|
7
7
|
export class AnswerAssembly {
|
|
8
8
|
parts = [];
|
|
9
9
|
finalText;
|
|
10
|
+
/**
|
|
11
|
+
* MACHINE-truth final, decoupled from the DISPLAY final (codex #19816 /
|
|
12
|
+
* QA-009). A codex constrained WorkReport route pre-unwraps its final
|
|
13
|
+
* message's DISPLAY text to the `output` (so the answer bubble + the app's
|
|
14
|
+
* twin-removal see the unwrapped output, not raw JSON) and carries the raw
|
|
15
|
+
* `{work_report, output}` envelope on `payload.work_report_envelope`. The
|
|
16
|
+
* orchestrator un-nests machine truth via `machineText()`, so the display
|
|
17
|
+
* unwrap never breaks the envelope parse; adapters that leave the raw envelope
|
|
18
|
+
* IN the final text (claude) never set this, so `machineText()` === `text()`.
|
|
19
|
+
*/
|
|
20
|
+
machineFinalText;
|
|
10
21
|
/** Feed one already-sanitized harness event; non-answer events are ignored. */
|
|
11
22
|
observe(ev) {
|
|
12
|
-
if (ev.type !== "message"
|
|
23
|
+
if (ev.type !== "message")
|
|
13
24
|
return;
|
|
14
25
|
if (ev.payload?.["auth_switched"] === true)
|
|
15
26
|
return;
|
|
@@ -18,25 +29,40 @@ export class AnswerAssembly {
|
|
|
18
29
|
if (ev.payload?.["delta"] === true)
|
|
19
30
|
return;
|
|
20
31
|
if (ev.final === true) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
const raw = ev.payload?.["work_report_envelope"];
|
|
33
|
+
const machine = typeof raw === "string" ? raw : undefined;
|
|
34
|
+
const display = ev.text ?? "";
|
|
35
|
+
// A whitespace-only DISPLAY final is NOT an answer and must never erase an
|
|
36
|
+
// earlier real final (review sol #3) — UNLESS it carries machine truth. A
|
|
37
|
+
// codex constrained route legitimately finalizes `output:""` (all its work
|
|
38
|
+
// lived in the work_report): keep the RAW envelope so the orchestrator
|
|
39
|
+
// still un-nests work_state/outcome, with an empty display. Otherwise the
|
|
40
|
+
// accepted final is kept VERBATIM (the documented contract) — no trimming.
|
|
41
|
+
if (display.trim().length === 0 && machine === undefined)
|
|
25
42
|
return;
|
|
26
|
-
this.finalText =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
pushUniqueText(this.parts, ev.text);
|
|
43
|
+
this.finalText = display;
|
|
44
|
+
this.machineFinalText = machine;
|
|
45
|
+
return;
|
|
30
46
|
}
|
|
47
|
+
if (!ev.text)
|
|
48
|
+
return;
|
|
49
|
+
pushUniqueText(this.parts, ev.text);
|
|
31
50
|
}
|
|
32
51
|
/** Whether a typed final answer has been accepted. */
|
|
33
52
|
hasFinal() {
|
|
34
53
|
return this.finalText !== undefined;
|
|
35
54
|
}
|
|
36
|
-
/** The assembled answer: the typed final verbatim, else joined
|
|
55
|
+
/** The assembled answer for DISPLAY: the typed final verbatim, else joined
|
|
56
|
+
* narration. For codex constrained routes this is the UNWRAPPED output. */
|
|
37
57
|
text() {
|
|
38
58
|
return this.finalText ?? this.parts.join("\n").trim();
|
|
39
59
|
}
|
|
60
|
+
/** The assembled answer for MACHINE consumption (the WorkReport un-nest): the
|
|
61
|
+
* raw envelope when the adapter pre-unwrapped the display copy, else identical
|
|
62
|
+
* to `text()`. The orchestrator passes THIS to `unwrapWorkReportEnvelope`. */
|
|
63
|
+
machineText() {
|
|
64
|
+
return this.machineFinalText ?? this.text();
|
|
65
|
+
}
|
|
40
66
|
}
|
|
41
67
|
/**
|
|
42
68
|
* Deduplicate the known "final result repeats the last streamed message" shape
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-assembly.js","sourceRoot":"","sources":["../src/answer-assembly.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACR,KAAK,GAAa,EAAE,CAAC;IAC9B,SAAS,CAAU;
|
|
1
|
+
{"version":3,"file":"answer-assembly.js","sourceRoot":"","sources":["../src/answer-assembly.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACR,KAAK,GAAa,EAAE,CAAC;IAC9B,SAAS,CAAU;IAC3B;;;;;;;;;OASG;IACK,gBAAgB,CAAU;IAElC,+EAA+E;IAC/E,OAAO,CAAC,EAKP;QACC,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO;QAClC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,KAAK,IAAI;YAAE,OAAO;QACnD,qEAAqE;QACrE,+DAA+D;QAC/D,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI;YAAE,OAAO;QAC3C,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,sBAAsB,CAAC,CAAC;YACjD,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1D,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,IAA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34
34
|
* allowlist (agent isolation). The adapter's `spec.env` overrides + the
|
|
35
35
|
* providerScrubEnv patch are applied ON TOP of this by the spawn layer.
|
|
36
36
|
*/
|
|
37
|
-
export declare function composeBaseEnv(inheritance: "mirror_native" | "clean", source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
37
|
+
export declare function composeBaseEnv(inheritance: "mirror_native" | "clean", source?: NodeJS.ProcessEnv, execPath?: string, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
38
38
|
//# sourceMappingURL=env-scope.d.ts.map
|
package/dist/env-scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-scope.d.ts","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EA4DhD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAOnF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAoChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,eAAe,GAAG,OAAO,EACtC,MAAM,GAAE,MAAM,CAAC,UAAwB,
|
|
1
|
+
{"version":3,"file":"env-scope.d.ts","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EA4DhD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAOnF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAoChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,eAAe,GAAG,OAAO,EACtC,MAAM,GAAE,MAAM,CAAC,UAAwB,EACvC,QAAQ,GAAE,MAAyB,EACnC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,MAAM,CAAC,UAAU,CASnB"}
|
package/dist/env-scope.js
CHANGED
|
@@ -139,8 +139,8 @@ export const CLEAN_ENV_ALLOWLIST = [
|
|
|
139
139
|
* allowlist (agent isolation). The adapter's `spec.env` overrides + the
|
|
140
140
|
* providerScrubEnv patch are applied ON TOP of this by the spawn layer.
|
|
141
141
|
*/
|
|
142
|
-
export function composeBaseEnv(inheritance, source = process.env) {
|
|
143
|
-
const normalizedSource = harnessRuntimeEnv(source);
|
|
142
|
+
export function composeBaseEnv(inheritance, source = process.env, execPath = process.execPath, platform = process.platform) {
|
|
143
|
+
const normalizedSource = harnessRuntimeEnv(source, execPath, platform);
|
|
144
144
|
if (inheritance !== "clean")
|
|
145
145
|
return normalizedSource;
|
|
146
146
|
const out = {};
|
package/dist/env-scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-scope.js","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,yBAAyB;IACzB,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,4BAA4B;IAC5B,6BAA6B;IAC7B,2BAA2B;IAC3B,8BAA8B;IAC9B,4BAA4B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aAAa;IACb,WAAW;IACX,UAAU;IACV,YAAY;IACZ,aAAa;IACb,WAAW;IACX,UAAU;IACV,qBAAqB;IACrB,eAAe;IACf,cAAc;IACd,oBAAoB;IACpB,gBAAgB;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,WAAsC,EACtC,SAA4B,OAAO,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"env-scope.js","sourceRoot":"","sources":["../src/env-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,yBAAyB;IACzB,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,4BAA4B;IAC5B,6BAA6B;IAC7B,2BAA2B;IAC3B,8BAA8B;IAC9B,4BAA4B;IAC5B,4BAA4B;IAC5B,6BAA6B;IAC7B,2DAA2D;IAC3D,mBAAmB;IACnB,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;IACb,gCAAgC;IAChC,mEAAmE;IACnE,iBAAiB;IACjB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,4BAA4B;IAC5B,sBAAsB;IACtB,yBAAyB;IACzB,kBAAkB;IAClB,qDAAqD;IACrD,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,oCAAoC;IACpC,sBAAsB;IACtB,2BAA2B;IAC3B,uEAAuE;IACvE,cAAc;I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sB,EAAE,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -13,4 +13,15 @@ export declare class ContextOverflowError extends ClaudexorError {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class WorkspaceError extends ClaudexorError {
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The Claudexor delegation belt (D32) cannot be made operational for this run:
|
|
18
|
+
* no `cli.js` entry that hosts `mcp serve-belt` exists next to the launching
|
|
19
|
+
* process OR this module. Emitting the belt descriptor anyway would spawn
|
|
20
|
+
* `node <missing cli.js> mcp serve-belt`, which MODULE_NOT_FOUNDs inside the
|
|
21
|
+
* harness — the belt reports `failed`, the harness silently answers from its
|
|
22
|
+
* own native subagent, and the run terminalizes a false success (QA-024). We
|
|
23
|
+
* refuse TYPED at preflight instead, naming the probed entry and the remedy.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DelegationBeltUnavailableError extends ClaudexorError {
|
|
26
|
+
}
|
|
16
27
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAI3D;AAED,qBAAa,uBAAwB,SAAQ,cAAc;CAAG;AAC9D,qBAAa,oBAAqB,SAAQ,cAAc;CAAG;AAC3D,qBAAa,cAAe,SAAQ,cAAc;CAAG"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAI3D;AAED,qBAAa,uBAAwB,SAAQ,cAAc;CAAG;AAC9D,qBAAa,oBAAqB,SAAQ,cAAc;CAAG;AAC3D,qBAAa,cAAe,SAAQ,cAAc;CAAG;AAErD;;;;;;;;GAQG;AACH,qBAAa,8BAA+B,SAAQ,cAAc;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -14,4 +14,15 @@ export class ContextOverflowError extends ClaudexorError {
|
|
|
14
14
|
}
|
|
15
15
|
export class WorkspaceError extends ClaudexorError {
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The Claudexor delegation belt (D32) cannot be made operational for this run:
|
|
19
|
+
* no `cli.js` entry that hosts `mcp serve-belt` exists next to the launching
|
|
20
|
+
* process OR this module. Emitting the belt descriptor anyway would spawn
|
|
21
|
+
* `node <missing cli.js> mcp serve-belt`, which MODULE_NOT_FOUNDs inside the
|
|
22
|
+
* harness — the belt reports `failed`, the harness silently answers from its
|
|
23
|
+
* own native subagent, and the run terminalizes a false success (QA-024). We
|
|
24
|
+
* refuse TYPED at preflight instead, naming the probed entry and the remedy.
|
|
25
|
+
*/
|
|
26
|
+
export class DelegationBeltUnavailableError extends ClaudexorError {
|
|
27
|
+
}
|
|
17
28
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,cAAc;CAAG;AAC9D,MAAM,OAAO,oBAAqB,SAAQ,cAAc;CAAG;AAC3D,MAAM,OAAO,cAAe,SAAQ,cAAc;CAAG"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,cAAc;CAAG;AAC9D,MAAM,OAAO,oBAAqB,SAAQ,cAAc;CAAG;AAC3D,MAAM,OAAO,cAAe,SAAQ,cAAc;CAAG;AAErD;;;;;;;;GAQG;AACH,MAAM,OAAO,8BAA+B,SAAQ,cAAc;CAAG"}
|
package/dist/inactivity.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inactivity watchdog for harness event streams: a wedged vendor CLI
|
|
3
|
-
* that stops emitting events would otherwise park the run in `running`
|
|
4
|
-
* forever — only reviewers had a timeout. The combinator pumps the source
|
|
5
|
-
* iterator and re-arms a timer on EVERY event; when the window elapses with
|
|
6
|
-
* no event, `onTimeout` fires exactly once (the caller aborts its per-attempt
|
|
7
|
-
* controller, which kills the process group through the existing abort
|
|
8
|
-
* plumbing) and the pump stops waiting for the source.
|
|
9
|
-
*
|
|
10
|
-
* This is an INACTIVITY window, not a wall-clock cap: long runs are fine as
|
|
11
|
-
* long as they keep talking. Distinct from cancellation by construction —
|
|
12
|
-
* the caller decides what the timeout means (typed harness_timeout failure),
|
|
13
|
-
* and a user cancel still routes through the run signal.
|
|
14
|
-
*/
|
|
15
1
|
export declare class HarnessInactivityTimeoutError extends Error {
|
|
16
2
|
readonly timeoutMs: number;
|
|
17
3
|
constructor(timeoutMs: number);
|
|
@@ -27,5 +13,12 @@ export declare function withInactivityWatchdog<T>(source: AsyncIterable<T>, opts
|
|
|
27
13
|
* and the interaction channel enforces its own answer-wait budget.
|
|
28
14
|
*/
|
|
29
15
|
isSuspended?: () => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* How long to drain the aborted source's cleanup after a timeout (or await
|
|
18
|
+
* iterator.return on an early caller break) before giving up. MUST exceed
|
|
19
|
+
* the source's process-reap deadline so its typed termination_unconfirmed
|
|
20
|
+
* terminal fact surfaces; defaults to {@link REAP_PROOF_DEADLINE_MS}.
|
|
21
|
+
*/
|
|
22
|
+
cleanupDeadlineMs?: number;
|
|
30
23
|
}): AsyncIterable<T>;
|
|
31
24
|
//# sourceMappingURL=inactivity.d.ts.map
|
package/dist/inactivity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity.d.ts","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inactivity.d.ts","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"AA4BA,qBAAa,6BAA8B,SAAQ,KAAK;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM;CAQvC;AAED,wBAAuB,sBAAsB,CAAC,CAAC,EAC7C,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACA,aAAa,CAAC,CAAC,CAAC,CA8FlB"}
|
package/dist/inactivity.js
CHANGED
|
@@ -12,6 +12,19 @@
|
|
|
12
12
|
* the caller decides what the timeout means (typed harness_timeout failure),
|
|
13
13
|
* and a user cancel still routes through the run signal.
|
|
14
14
|
*/
|
|
15
|
+
/** QA-027: how long to await the source's cleanup after an inactivity timeout
|
|
16
|
+
* (or an early caller break) before the watchdog gives up and lets the terminal
|
|
17
|
+
* proceed anyway. This MUST exceed spawnProcess's own whole-tree death-proof
|
|
18
|
+
* deadline (`cancelDeadlineMs`, default `cancelKillDelayMs + 4000` = 5000ms) so
|
|
19
|
+
* the underlying runCliHarness reap runs to completion and its typed
|
|
20
|
+
* `termination_unconfirmed` terminal fact (14e958a3) is emitted through the
|
|
21
|
+
* stream. The previous 2000ms grace was SHORTER than the reap deadline, so on an
|
|
22
|
+
* inactivity timeout the caller could terminalize BEFORE death was proven and
|
|
23
|
+
* the unconfirmed-death disclosure was dropped (runCliHarness wires no
|
|
24
|
+
* `onTerminationUnconfirmed` callback, the only channel an early
|
|
25
|
+
* iterator.return leaves). A pathological in-memory source still cannot park the
|
|
26
|
+
* run past this bound. Overridable per-call for deterministic tests. */
|
|
27
|
+
const REAP_PROOF_DEADLINE_MS = 8000;
|
|
15
28
|
export class HarnessInactivityTimeoutError extends Error {
|
|
16
29
|
timeoutMs;
|
|
17
30
|
constructor(timeoutMs) {
|
|
@@ -27,6 +40,7 @@ export async function* withInactivityWatchdog(source, opts) {
|
|
|
27
40
|
let timer = null;
|
|
28
41
|
let timedOut = false;
|
|
29
42
|
let wake = null;
|
|
43
|
+
const cleanupDeadlineMs = opts.cleanupDeadlineMs ?? REAP_PROOF_DEADLINE_MS;
|
|
30
44
|
const arm = () => {
|
|
31
45
|
if (timer)
|
|
32
46
|
clearTimeout(timer);
|
|
@@ -43,35 +57,108 @@ export async function* withInactivityWatchdog(source, opts) {
|
|
|
43
57
|
// else on the event loop, and an unref'd watchdog would let node exit 0
|
|
44
58
|
// mid-run instead of firing the timeout.
|
|
45
59
|
};
|
|
60
|
+
// Hold the in-flight next() across the race so a timeout NEVER orphans it: the
|
|
61
|
+
// very next value the source produces (the source reacting to the abort with
|
|
62
|
+
// its terminal death-proof events) must be consumed by the drain, not silently
|
|
63
|
+
// eaten by an abandoned pending promise from this loop.
|
|
64
|
+
let pending = null;
|
|
46
65
|
try {
|
|
47
66
|
arm();
|
|
48
67
|
for (;;) {
|
|
68
|
+
if (!pending)
|
|
69
|
+
pending = iterator.next();
|
|
49
70
|
// Race the next event against the watchdog firing: after onTimeout()
|
|
50
71
|
// aborts the child, the source SHOULD end on its own, but a stuck
|
|
51
72
|
// iterator must not keep the run parked — the sentinel wakes the pump.
|
|
52
|
-
const
|
|
53
|
-
|
|
73
|
+
const raced = await Promise.race([
|
|
74
|
+
pending.then((result) => ({
|
|
75
|
+
kind: "next",
|
|
76
|
+
result,
|
|
77
|
+
})),
|
|
54
78
|
new Promise((resolve) => {
|
|
55
|
-
wake = () => resolve("timeout");
|
|
79
|
+
wake = () => resolve({ kind: "timeout" });
|
|
56
80
|
if (timedOut)
|
|
57
|
-
resolve("timeout");
|
|
81
|
+
resolve({ kind: "timeout" });
|
|
58
82
|
}),
|
|
59
83
|
]);
|
|
60
|
-
if (
|
|
84
|
+
if (raced.kind === "timeout" || timedOut) {
|
|
85
|
+
// Inactivity fired. onTimeout() already aborted the child. Do NOT throw
|
|
86
|
+
// and terminalize yet: DRAIN the aborted source to its process-reap
|
|
87
|
+
// deadline so the underlying spawnProcess whole-tree death proof runs
|
|
88
|
+
// and its typed `termination_unconfirmed` terminal fact (14e958a3) is
|
|
89
|
+
// emitted THROUGH the stream — instead of being cut off by an early
|
|
90
|
+
// iterator.return whose only disclosure channel (spawnProcess's
|
|
91
|
+
// `onTerminationUnconfirmed` callback) runCliHarness never wires up.
|
|
92
|
+
// The still-pending next() is handed to the drain so the FIRST terminal
|
|
93
|
+
// event is not lost; yielding the drained events lets the caller see the
|
|
94
|
+
// unconfirmed-death error/terminal before it terminalizes on the throw.
|
|
95
|
+
yield* drainAfterTimeout(iterator, pending, cleanupDeadlineMs);
|
|
61
96
|
throw new HarnessInactivityTimeoutError(opts.timeoutMs);
|
|
62
97
|
}
|
|
63
|
-
|
|
98
|
+
pending = null;
|
|
99
|
+
if (raced.result.done)
|
|
64
100
|
return;
|
|
65
101
|
arm();
|
|
66
|
-
yield
|
|
102
|
+
yield raced.result.value;
|
|
67
103
|
}
|
|
68
104
|
}
|
|
69
105
|
finally {
|
|
70
106
|
if (timer)
|
|
71
107
|
clearTimeout(timer);
|
|
72
|
-
//
|
|
73
|
-
// finally -> requestCancel
|
|
74
|
-
|
|
108
|
+
// AWAIT the source's cleanup (QA-027): iterator.return() drives
|
|
109
|
+
// spawnProcess's finally -> requestCancel, i.e. the process teardown. It
|
|
110
|
+
// used to be fire-and-forgotten, so the agent loop could break on abort and
|
|
111
|
+
// the run could reach its `cancelled` terminal BEFORE the child was proven
|
|
112
|
+
// dead. Awaiting makes the terminal strictly follow the death proof.
|
|
113
|
+
//
|
|
114
|
+
// Bound the wait by the SAME reap deadline the drain uses (not a shorter
|
|
115
|
+
// grace): a cooperative spawnProcess-backed stream resolves return() as soon
|
|
116
|
+
// as the reap settles, so the terminal follows the death proof in the real
|
|
117
|
+
// path; a pathological in-memory source suspended in an UNRELATED await must
|
|
118
|
+
// never park the terminal past the reap's own deadline. (After a timeout the
|
|
119
|
+
// drain above already ran the source to completion, so this return() is then
|
|
120
|
+
// a fast no-op.)
|
|
121
|
+
const ret = iterator.return?.(undefined);
|
|
122
|
+
if (ret) {
|
|
123
|
+
await Promise.race([
|
|
124
|
+
Promise.resolve(ret).then(() => undefined, () => undefined),
|
|
125
|
+
new Promise((resolve) => {
|
|
126
|
+
const grace = setTimeout(resolve, cleanupDeadlineMs);
|
|
127
|
+
grace.unref?.();
|
|
128
|
+
}),
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* After an inactivity timeout aborted the child, pump the source to completion
|
|
135
|
+
* so its own teardown/death-proof events (the typed `termination_unconfirmed`
|
|
136
|
+
* terminal fact and terminal `completed`) surface through the stream, bounded by
|
|
137
|
+
* the process-reap deadline so a source that cannot prove death still cannot
|
|
138
|
+
* park the run. The inactivity timer is NOT re-armed here — the source is being
|
|
139
|
+
* torn down, and a second timeout would race the reap it is waiting on.
|
|
140
|
+
*/
|
|
141
|
+
async function* drainAfterTimeout(iterator, pending, deadlineMs) {
|
|
142
|
+
const deadline = new Promise((resolve) => {
|
|
143
|
+
const t = setTimeout(() => resolve("deadline"), Math.max(1, deadlineMs));
|
|
144
|
+
t.unref?.();
|
|
145
|
+
});
|
|
146
|
+
// Start from the loop's still-in-flight next() (the abort-reaction event),
|
|
147
|
+
// then keep pumping until the source ends or the reap deadline elapses.
|
|
148
|
+
let cur = pending;
|
|
149
|
+
for (;;) {
|
|
150
|
+
const drained = await Promise.race([
|
|
151
|
+
cur.then((result) => ({ kind: "next", result })),
|
|
152
|
+
deadline,
|
|
153
|
+
]);
|
|
154
|
+
// Source could not prove death within the reap deadline — give up draining;
|
|
155
|
+
// the outer `finally` runs iterator.return() (also bounded) as a last resort.
|
|
156
|
+
if (drained === "deadline")
|
|
157
|
+
return;
|
|
158
|
+
if (drained.result.done)
|
|
159
|
+
return;
|
|
160
|
+
yield drained.result.value;
|
|
161
|
+
cur = iterator.next();
|
|
75
162
|
}
|
|
76
163
|
}
|
|
77
164
|
//# sourceMappingURL=inactivity.js.map
|
package/dist/inactivity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity.js","sourceRoot":"","sources":["../src/inactivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACjC;IAArB,YAAqB,SAAiB;QACpC,KAAK,CACH,kCAAkC,SAAS,4BAA4B;YACrE,6DAA6D;YAC7D,gFAAgF,CACnF,CA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AAC,EAAE,UAAU,CAAC,CAAC,CAAC;QACxE,CAAuC,CAAC,KAAK,EAAE,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,SAAS,CAAC;QACR,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAA+C,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7F,QAAQ;SACT,CAAC,CAAC;QACH,4EAA4E;QAC5E,8EAA8E;QAC9E,IAAI,OAAO,KAAK,UAAU;YAAE,OAAO;QACnC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI;YAAE,OAAO;QAChC,MAAM,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ export * from "./instructions.js";
|
|
|
21
21
|
export * from "./browser-mcp.js";
|
|
22
22
|
export * from "./process-identity.js";
|
|
23
23
|
export * from "./process-group.js";
|
|
24
|
+
export * from "./process-tree.js";
|
|
24
25
|
export * from "./isolation-locator.js";
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,5 +21,6 @@ export * from "./instructions.js";
|
|
|
21
21
|
export * from "./browser-mcp.js";
|
|
22
22
|
export * from "./process-identity.js";
|
|
23
23
|
export * from "./process-group.js";
|
|
24
|
+
export * from "./process-tree.js";
|
|
24
25
|
export * from "./isolation-locator.js";
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
|
Binary file
|
package/dist/proc.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ProcessTreeTerminationOutcome, type ReapProcessTreeOptions } from "./process-tree.js";
|
|
2
|
+
import { type ProcessGroupService } from "./process-group.js";
|
|
1
3
|
export interface SpawnOptions {
|
|
2
4
|
cwd?: string;
|
|
3
5
|
env?: Record<string, string | null | undefined>;
|
|
@@ -13,6 +15,41 @@ export interface SpawnOptions {
|
|
|
13
15
|
cancelSignal?: NodeJS.Signals;
|
|
14
16
|
/** Hard-kill delay after cancelSignal when the child ignores cooperative stop. */
|
|
15
17
|
cancelKillDelayMs?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Overall bound (ms) on the whole-tree death proof after a cancel. Past it the
|
|
20
|
+
* generator returns and `onTerminationUnconfirmed` fires rather than hanging.
|
|
21
|
+
* Defaults to `cancelKillDelayMs + 4000`.
|
|
22
|
+
*/
|
|
23
|
+
cancelDeadlineMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Fail-closed disclosure (QA-027) for a consumer that broke the stream EARLY
|
|
26
|
+
* (it is no longer iterating, so the typed `termination_unconfirmed` event
|
|
27
|
+
* cannot be delivered): called once when a proven-alive descendant group
|
|
28
|
+
* survives the bounded TERM->KILL escalation. An actively-iterating consumer
|
|
29
|
+
* receives the typed `termination_unconfirmed` ProcEvent instead — the primary,
|
|
30
|
+
* non-optional disclosure channel.
|
|
31
|
+
*/
|
|
32
|
+
onTerminationUnconfirmed?: (info: {
|
|
33
|
+
rootPid: number;
|
|
34
|
+
survivors: number[];
|
|
35
|
+
unresolved: Array<{
|
|
36
|
+
pgid: number;
|
|
37
|
+
reason: string;
|
|
38
|
+
}>;
|
|
39
|
+
}) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Injection seam for the whole-tree death proof (deterministic tests of the
|
|
42
|
+
* termination_unconfirmed disclosure). Defaults to the real `reapProcessTree`.
|
|
43
|
+
* Production callers never set this.
|
|
44
|
+
*/
|
|
45
|
+
reap?: (opts: ReapProcessTreeOptions) => Promise<ProcessTreeTerminationOutcome>;
|
|
46
|
+
/**
|
|
47
|
+
* Injection seam for the identity-proven process-group service used by the
|
|
48
|
+
* direct-group cancel belt (deterministic tests of unknown-capture / stale-
|
|
49
|
+
* identity refusal). Defaults to the shared `defaultProcessGroupService`.
|
|
50
|
+
* Production callers never set this.
|
|
51
|
+
*/
|
|
52
|
+
processGroups?: ProcessGroupService;
|
|
16
53
|
/** Runtime abort signal for active daemon/orchestrator cancellation. */
|
|
17
54
|
abortSignal?: AbortSignal;
|
|
18
55
|
/**
|
|
@@ -41,6 +78,22 @@ export type ProcEvent = {
|
|
|
41
78
|
type: "exit";
|
|
42
79
|
code: number | null;
|
|
43
80
|
signal: NodeJS.Signals | null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* QA-027 fail-closed death-proof disclosure: the process was cancelled and the
|
|
84
|
+
* whole-tree reap could NOT confirm death — a descendant group is proven-alive
|
|
85
|
+
* (`survivors`) or its leader identity was unreadable (`unresolved`). Emitted
|
|
86
|
+
* once, AFTER the terminal `exit`, so an actively-iterating consumer terminalizes
|
|
87
|
+
* over a typed unconfirmed-death fact instead of a silent clean cancel.
|
|
88
|
+
*/
|
|
89
|
+
| {
|
|
90
|
+
type: "termination_unconfirmed";
|
|
91
|
+
rootPid: number;
|
|
92
|
+
survivors: number[];
|
|
93
|
+
unresolved: Array<{
|
|
94
|
+
pgid: number;
|
|
95
|
+
reason: string;
|
|
96
|
+
}>;
|
|
44
97
|
};
|
|
45
98
|
/**
|
|
46
99
|
* Spawn a process and stream stdout/stderr lines as they arrive, ending with an
|
package/dist/proc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proc.d.ts","sourceRoot":"","sources":["../src/proc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proc.d.ts","sourceRoot":"","sources":["../src/proc.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAChD;;;;OAIG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAC9B,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE;QAChC,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACrD,KAAK,IAAI,CAAC;IACX;;;;OAIG;IACH,IA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