@excitedjs/dreamux-utils 0.3.4 → 0.4.0-alpha.g4f6be1013ebb

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/index.d.ts CHANGED
@@ -4,4 +4,6 @@ export * from './fs.js';
4
4
  export * from './completion-body.js';
5
5
  export * from './socket-budget.js';
6
6
  export * from './turn-render.js';
7
+ export * from './supervised-child.js';
8
+ export * from './unsupported-feature.js';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -4,4 +4,6 @@ export * from './fs.js';
4
4
  export * from './completion-body.js';
5
5
  export * from './socket-budget.js';
6
6
  export * from './turn-render.js';
7
+ export * from './supervised-child.js';
8
+ export * from './unsupported-feature.js';
7
9
  //# 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,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type ChildProcess, type ForkOptions, type SpawnOptions } from 'node:child_process';
2
+ export interface SupervisedChildExit {
3
+ code: number | null;
4
+ signal: NodeJS.Signals | null;
5
+ }
6
+ export type SupervisedChildLaunch = {
7
+ kind: 'spawn';
8
+ command: string;
9
+ args?: readonly string[];
10
+ options?: Omit<SpawnOptions, 'detached'>;
11
+ } | {
12
+ kind: 'fork';
13
+ modulePath: string;
14
+ args?: readonly string[];
15
+ options?: Omit<ForkOptions, 'detached'>;
16
+ };
17
+ export interface SupervisedChildOptions {
18
+ stopTimeoutMs?: number;
19
+ pollIntervalMs?: number;
20
+ }
21
+ type ExitHandler = (exit: SupervisedChildExit) => void;
22
+ type ErrorHandler = (error: Error) => void;
23
+ /**
24
+ * Neutral owner for one detached child process group. Domain wrappers keep
25
+ * readiness probes, transports, and cleanup policy; this class owns only
26
+ * launch, unexpected-exit observation, and two-stage group termination.
27
+ */
28
+ export declare class SupervisedChild {
29
+ private readonly launch;
30
+ private readonly options;
31
+ private child_;
32
+ private pid_;
33
+ private stopping;
34
+ private stopPromise;
35
+ private readonly exitHandlers;
36
+ private readonly errorHandlers;
37
+ constructor(launch: SupervisedChildLaunch, options?: SupervisedChildOptions);
38
+ get pid(): number | null;
39
+ onExit(handler: ExitHandler): () => void;
40
+ onError(handler: ErrorHandler): () => void;
41
+ start(): Promise<ChildProcess>;
42
+ stop(): Promise<void>;
43
+ private doStop;
44
+ private notifyExit;
45
+ private notifyError;
46
+ }
47
+ export {};
48
+ //# sourceMappingURL=supervised-child.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supervised-child.d.ts","sourceRoot":"","sources":["../src/supervised-child.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,qBAAqB,GAC7B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;CAC1C,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;CACzC,CAAC;AAEN,MAAM,WAAW,sBAAsB;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,KAAK,WAAW,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;AACvD,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAE3C;;;;GAIG;AACH,qBAAa,eAAe;IASxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAT1B,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;gBAGtC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,GAAE,sBAA2B;IAGvD,IAAI,GAAG,IAAI,MAAM,GAAG,IAAI,CAEvB;IAED,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,IAAI;IAKxC,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,IAAI;IAKpC,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC;IAuCpC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAKP,MAAM;IAmBpB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,WAAW;CASpB"}
@@ -0,0 +1,148 @@
1
+ import { fork, spawn, } from 'node:child_process';
2
+ import { isProcessAlive, killProcessGroup } from './os.js';
3
+ /**
4
+ * Neutral owner for one detached child process group. Domain wrappers keep
5
+ * readiness probes, transports, and cleanup policy; this class owns only
6
+ * launch, unexpected-exit observation, and two-stage group termination.
7
+ */
8
+ export class SupervisedChild {
9
+ launch;
10
+ options;
11
+ child_ = null;
12
+ pid_ = null;
13
+ stopping = false;
14
+ stopPromise = null;
15
+ exitHandlers = new Set();
16
+ errorHandlers = new Set();
17
+ constructor(launch, options = {}) {
18
+ this.launch = launch;
19
+ this.options = options;
20
+ }
21
+ get pid() {
22
+ return this.pid_;
23
+ }
24
+ onExit(handler) {
25
+ this.exitHandlers.add(handler);
26
+ return () => this.exitHandlers.delete(handler);
27
+ }
28
+ onError(handler) {
29
+ this.errorHandlers.add(handler);
30
+ return () => this.errorHandlers.delete(handler);
31
+ }
32
+ async start() {
33
+ if (this.child_ !== null) {
34
+ throw new Error('SupervisedChild.start: already started');
35
+ }
36
+ if (this.stopping) {
37
+ throw new Error('SupervisedChild.start: already stopped');
38
+ }
39
+ const child = launchChild(this.launch);
40
+ this.child_ = child;
41
+ // Node assigns pid synchronously for a successfully launched child. Publish
42
+ // it before the first await so a concurrent stop can never miss the group.
43
+ if (child.pid !== undefined)
44
+ this.pid_ = child.pid;
45
+ child.on('error', (error) => this.notifyError(error));
46
+ child.once('exit', (code, signal) => {
47
+ if (this.stopping)
48
+ return;
49
+ this.notifyExit({ code, signal });
50
+ });
51
+ try {
52
+ await waitForSpawn(child);
53
+ }
54
+ catch (error) {
55
+ this.child_ = null;
56
+ this.pid_ = null;
57
+ throw error;
58
+ }
59
+ if (child.pid === undefined) {
60
+ this.child_ = null;
61
+ this.pid_ = null;
62
+ throw new Error('supervised child spawned without a pid');
63
+ }
64
+ this.pid_ = child.pid;
65
+ if (this.stopping) {
66
+ await this.stopPromise;
67
+ throw new Error('SupervisedChild.start: stopped during start');
68
+ }
69
+ return child;
70
+ }
71
+ stop() {
72
+ this.stopPromise ??= this.doStop();
73
+ return this.stopPromise;
74
+ }
75
+ async doStop() {
76
+ this.stopping = true;
77
+ const pid = this.pid_;
78
+ if (pid !== null) {
79
+ if (isProcessAlive(pid)) {
80
+ killProcessGroup(pid, 'SIGTERM');
81
+ const deadline = Date.now() + (this.options.stopTimeoutMs ?? 1_000);
82
+ const pollIntervalMs = this.options.pollIntervalMs ?? 25;
83
+ while (Date.now() < deadline) {
84
+ if (!isProcessAlive(pid))
85
+ break;
86
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
87
+ }
88
+ }
89
+ // Always signal the group: a grandchild may outlive an exited leader.
90
+ killProcessGroup(pid, 'SIGKILL');
91
+ }
92
+ this.child_ = null;
93
+ }
94
+ notifyExit(exit) {
95
+ for (const handler of this.exitHandlers) {
96
+ try {
97
+ handler(exit);
98
+ }
99
+ catch {
100
+ // Observers must not poison child-process event dispatch.
101
+ }
102
+ }
103
+ }
104
+ notifyError(error) {
105
+ for (const handler of this.errorHandlers) {
106
+ try {
107
+ handler(error);
108
+ }
109
+ catch {
110
+ // Observers must not poison child-process event dispatch.
111
+ }
112
+ }
113
+ }
114
+ }
115
+ function launchChild(launch) {
116
+ if (launch.kind === 'fork') {
117
+ return fork(launch.modulePath, [...(launch.args ?? [])], {
118
+ ...launch.options,
119
+ detached: true,
120
+ });
121
+ }
122
+ return spawn(launch.command, [...(launch.args ?? [])], {
123
+ ...launch.options,
124
+ detached: true,
125
+ });
126
+ }
127
+ async function waitForSpawn(child) {
128
+ await new Promise((resolve, reject) => {
129
+ let settled = false;
130
+ const onError = (error) => {
131
+ if (settled)
132
+ return;
133
+ settled = true;
134
+ child.off('spawn', onSpawn);
135
+ reject(error);
136
+ };
137
+ const onSpawn = () => {
138
+ if (settled)
139
+ return;
140
+ settled = true;
141
+ child.off('error', onError);
142
+ resolve();
143
+ };
144
+ child.once('error', onError);
145
+ child.once('spawn', onSpawn);
146
+ });
147
+ }
148
+ //# sourceMappingURL=supervised-child.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supervised-child.js","sourceRoot":"","sources":["../src/supervised-child.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,GAIN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA6B3D;;;;GAIG;AACH,MAAM,OAAO,eAAe;IASP;IACA;IATX,MAAM,GAAwB,IAAI,CAAC;IACnC,IAAI,GAAkB,IAAI,CAAC;IAC3B,QAAQ,GAAG,KAAK,CAAC;IACjB,WAAW,GAAyB,IAAI,CAAC;IAChC,YAAY,GAAG,IAAI,GAAG,EAAe,CAAC;IACtC,aAAa,GAAG,IAAI,GAAG,EAAgB,CAAC;IAEzD,YACmB,MAA6B,EAC7B,UAAkC,EAAE;QADpC,WAAM,GAAN,MAAM,CAAuB;QAC7B,YAAO,GAAP,OAAO,CAA6B;IACpD,CAAC;IAEJ,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,OAAoB;QACzB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC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AO,EAAE,MAAM,EAAE,EAAE;QAC1C,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,OAAO,GAAG,CAAC,KAAY,EAAQ,EAAE;YACrC,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { UnsupportedAgentRuntimeFeatureError } from '@excitedjs/dreamux-types';
2
+ export declare function unsupportedFeatureError(feature: string, message: string): UnsupportedAgentRuntimeFeatureError;
3
+ export declare function isUnsupportedFeatureError(error: unknown, feature?: string): error is UnsupportedAgentRuntimeFeatureError;
4
+ //# sourceMappingURL=unsupported-feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported-feature.d.ts","sourceRoot":"","sources":["../src/unsupported-feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAEpF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,mCAAmC,CAKrC;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,GACf,KAAK,IAAI,mCAAmC,CAM9C"}
@@ -0,0 +1,15 @@
1
+ export function unsupportedFeatureError(feature, message) {
2
+ return Object.assign(new Error(message), {
3
+ name: 'UnsupportedAgentRuntimeFeatureError',
4
+ feature,
5
+ });
6
+ }
7
+ export function isUnsupportedFeatureError(error, feature) {
8
+ if (typeof error !== 'object' || error === null)
9
+ return false;
10
+ const candidate = error;
11
+ return candidate.name === 'UnsupportedAgentRuntimeFeatureError' &&
12
+ typeof candidate.feature === 'string' &&
13
+ (feature === undefined || candidate.feature === feature);
14
+ }
15
+ //# sourceMappingURL=unsupported-feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported-feature.js","sourceRoot":"","sources":["../src/unsupported-feature.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,OAAe;IAEf,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QACvC,IAAI,EAAE,qCAA8C;QACpD,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc,EACd,OAAgB;IAEhB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,KAA8C,CAAC;IACjE,OAAO,SAAS,CAAC,IAAI,KAAK,qCAAqC;QAC7D,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ;QACrC,CAAC,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excitedjs/dreamux-utils",
3
- "version": "0.3.4",
3
+ "version": "0.4.0-alpha.g4f6be1013ebb",
4
4
  "description": "Pure shared utilities for Dreamux providers and host: neutral config-validation primitives, OS/filesystem helpers, completion-body resolution, and inbound-turn render helpers. Depends on @excitedjs/dreamux-types only, never on @excitedjs/dreamux core (issue excitedjs/dreamux#209).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "LICENSE"
28
28
  ],
29
29
  "dependencies": {
30
- "@excitedjs/dreamux-types": "0.7.0"
30
+ "@excitedjs/dreamux-types": "0.8.0-alpha.g4f6be1013ebb"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.10.0",