@orkestrel/process 0.0.10 → 0.0.11

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/README.md CHANGED
@@ -1,26 +1,15 @@
1
1
  # @orkestrel/process
2
2
 
3
- A typed **child-process toolkit** in tiers. `Process` supervises one
4
- child: stdout is framed into lines under a bounded backlog, stderr is forwarded
5
- live and kept as a byte-bounded tail, stdin is a writable channel, and
6
- termination is bounded and reports whether the real exit arrived — `SIGTERM` then
7
- `SIGKILL` after a grace window on a POSIX host, a whole-tree kill on Windows.
8
- `Session` supervises the same child as raw bytes instead: one owned
9
- `Uint8Array` per stdout chunk, an `end` that closes stdin without terminating
10
- anything, and the child's own `ending` beside the terminal `exit`.
11
- `execute` and `executeSync` buffer a child to completion and settle with an
12
- `ExecuteResult` carrying the captured output, the exit, and `failed` /
13
- `expired` / `aborted` / `truncated`, rejecting with a `ProcessError` by default
14
- or resolving the result when you pass `strict: false`. `ProcessManager` is a
15
- keyed registry of live children: `launch` spawns and registers by id, a settled
16
- child evicts itself with no polling, and `stop` terminates one id, a list, or
17
- every child. `Process`, `Session`, and `ProcessManager` expose typed `emitter`
18
- properties.
19
- `Process`, `launch`, and `execute` take an `AbortSignal` that terminates the
20
- child; `executeSync` and `detach` take none. No spawn uses a shell, so a
21
- metacharacter in an argument is data rather than syntax. The contracts are
22
- host-independent and ship from `@orkestrel/process`; the Node engine ships from
23
- `@orkestrel/process/server`. Part of the `@orkestrel` line.
3
+ > A typed child-process toolkit in tiers: the supervised `Process` with framed stdout lines and a
4
+ > writable stdin channel, the byte-oriented `Session`, the buffered `execute` and `executeSync`
5
+ > runs, the fire-and-forget `detach`, and the keyed `ProcessManager` registry, none of them spawning
6
+ > through a shell.
7
+
8
+ Spawn a supervised child with the `createProcess` function, read the lines it frames, and call
9
+ `stop()` to end it on a bounded window. Reach for `execute` where you want the captured output and
10
+ the exit in one call, and for `ProcessManager` where you supervise several children by id. The
11
+ contracts ship from `@orkestrel/process` and the Node engine from `@orkestrel/process/server`. Part
12
+ of the `@orkestrel` line.
24
13
 
25
14
  ## Install
26
15
 
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _orkestrel_contract = require("@orkestrel/contract");
3
3
  //#region src/core/constants.ts
4
- /** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */
4
+ /** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */
5
5
  var PROCESS_GRACE = 5e3;
6
- /** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */
6
+ /** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */
7
7
  var PROCESS_CONFIRMATION = 5e3;
8
8
  /**
9
- * Names the default window in milliseconds the package waits for the child's read ends to close after
10
- * the child's native exit or after a termination this package initiated, before cutting them off.
9
+ * Names the default window, 1000 ms, the package waits for the child's read ends to close after the
10
+ * child's native exit or after a termination this package initiated, before cutting them off.
11
11
  *
12
12
  * @remarks
13
13
  * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`
@@ -21,17 +21,20 @@ var PROCESS_CONFIRMATION = 5e3;
21
21
  * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.
22
22
  */
23
23
  var PROCESS_DRAIN = 1e3;
24
- /** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */
24
+ /** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */
25
25
  var PROCESS_EVIDENCE = 2048;
26
- /** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */
26
+ /** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */
27
27
  var PROCESS_BACKLOG = 10485760;
28
- /** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */
28
+ /** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */
29
29
  var PROCESS_OUTPUT = 10485760;
30
- /** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */
30
+ /** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */
31
31
  var PROCESS_TIMER = 2147483647;
32
- /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */
32
+ /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */
33
33
  var PROCESS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
34
- /** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */
34
+ /**
35
+ * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:
36
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
37
+ */
35
38
  var PROCESS_ERROR_CODES = Object.freeze([
36
39
  "spawn",
37
40
  "timeout",
@@ -105,7 +108,7 @@ function isProcessError(value) {
105
108
  });
106
109
  }
107
110
  /**
108
- * Creates the failure raised when a manager launch reuses a live id.
111
+ * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.
109
112
  *
110
113
  * @param id - The id already occupied by a live child
111
114
  * @returns A typed duplicate-id failure
@@ -117,7 +120,8 @@ function createDuplicateError(id) {
117
120
  });
118
121
  }
119
122
  /**
120
- * Creates the failure raised when a launch is attempted on a registry that is being destroyed.
123
+ * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is
124
+ * being destroyed.
121
125
  *
122
126
  * @param id - The id the refused launch asked for
123
127
  * @returns A typed protocol failure
@@ -129,7 +133,8 @@ function createProtocolError(id) {
129
133
  });
130
134
  }
131
135
  /**
132
- * Creates the failure raised when a public input is refused before anything is spawned.
136
+ * Creates the `invalid`-coded failure raised when a public input is refused before anything is
137
+ * spawned.
133
138
  *
134
139
  * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`
135
140
  * @param value - The rejected value, carried as `context.value`
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts"],"sourcesContent":["/** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */\nexport const PROCESS_GRACE = 5_000\n\n/** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */\nexport const PROCESS_CONFIRMATION = 5_000\n\n/**\n * Names the default window in milliseconds the package waits for the child's read ends to close after\n * the child's native exit or after a termination this package initiated, before cutting them off.\n *\n * @remarks\n * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`\n * child modes as real children and timing the host `close` event against the host `exit` event.\n * Every ordinary run closed within 0.02ms of the native exit, whether the child ended itself or a\n * kill ended it, and a `taskkill /F /T` that reaped a descendant while the root was still alive\n * closed within 0.01ms. The only finite late close came from a descendant that outlived its root and\n * then ended on its own, at 127.44ms to 193.41ms — that lag is the descendant's own remaining life\n * rather than a flush cost. A descendant that never ends never closes, so the distribution has no\n * finite tail to cover and this value bounds it instead: 1000ms is over five times the slowest\n * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.\n */\nexport const PROCESS_DRAIN = 1_000\n\n/** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */\nexport const PROCESS_EVIDENCE = 2_048\n\n/** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */\nexport const PROCESS_BACKLOG = 10_485_760\n\n/** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */\nexport const PROCESS_OUTPUT = 10_485_760\n\n/** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */\nexport const PROCESS_TIMER = 2_147_483_647\n\n/** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */\nexport const PROCESS_PATHEXT = '.COM;.EXE;.BAT;.CMD'\n\n/** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */\nexport const PROCESS_ERROR_CODES = Object.freeze([\n\t'spawn',\n\t'timeout',\n\t'input',\n\t'duplicate',\n\t'protocol',\n\t'invalid',\n] as const)\n","import type {\n\tProcessErrorCode,\n\tProcessErrorContext,\n\tProcessErrorOptions,\n\tExecuteResult,\n} from './types.js'\nimport { holds, isError } from '@orkestrel/contract'\nimport { PROCESS_ERROR_CODES } from './constants.js'\n\n/**\n * Represents a child-process failure with a stable machine-readable category.\n *\n * @example\n * ```ts\n * const error = new ProcessError('git status refused', {\n * \tcode: 'invalid',\n * \tcontext: { command: 'git status' },\n * })\n * error.code // 'invalid'\n * ```\n */\nexport class ProcessError extends Error {\n\toverride readonly name = 'ProcessError'\n\treadonly code: ProcessErrorCode\n\treadonly context?: ProcessErrorContext\n\t/** Carries the buffered run outcome, present when a one-shot run produced the failure. */\n\treadonly result?: ExecuteResult\n\n\t/**\n\t * Creates a process error.\n\t *\n\t * @param message - Human-readable failure description\n\t * @param options - Machine-readable category, optional context, optional cause, and optional run result\n\t */\n\tconstructor(message: string, options: ProcessErrorOptions) {\n\t\tconst cause = options.cause\n\t\tsuper(message, cause === undefined ? undefined : { cause })\n\t\tObject.defineProperty(this, Symbol.for('@orkestrel/process.error'), { value: true })\n\t\tthis.code = options.code\n\t\tif (options.context !== undefined) this.context = options.context\n\t\tif (options.result !== undefined) this.result = options.result\n\t}\n}\n\n/**\n * Checks whether an unknown value is a {@link ProcessError}.\n *\n * @remarks\n * Recognition combines a global own-property brand with the native `Error` base, the subclass\n * prototype, the fixed name, and a code {@link PROCESS_ERROR_CODES} declares. The brand is\n * recognized across duplicate installations and ESM/CommonJS module copies at 0.0.4 or later. A copy\n * earlier than 0.0.4 stamps no brand, so an error it throws stays outside the type, and so does a\n * plain or property-only lookalike.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `ProcessError` instance; false otherwise\n *\n * @example\n * ```ts\n * isProcessError(new ProcessError('spawn failed', { code: 'spawn' })) // true\n * isProcessError(new Error('spawn failed')) // false\n * ```\n */\nexport function isProcessError(value: unknown): value is ProcessError {\n\tif (!isError(value)) return false\n\treturn holds(() => {\n\t\tif (Object.getPrototypeOf(value) === Error.prototype) return false\n\t\tif (value.name !== 'ProcessError' || !('code' in value)) return false\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tvalue,\n\t\t\tSymbol.for('@orkestrel/process.error'),\n\t\t)\n\t\tif (descriptor?.value !== true) return false\n\t\tconst code: unknown = value.code\n\t\treturn PROCESS_ERROR_CODES.some((declared) => declared === code)\n\t})\n}\n\n/**\n * Creates the failure raised when a manager launch reuses a live id.\n *\n * @param id - The id already occupied by a live child\n * @returns A typed duplicate-id failure\n */\nexport function createDuplicateError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' is already live`, {\n\t\tcode: 'duplicate',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the failure raised when a launch is attempted on a registry that is being destroyed.\n *\n * @param id - The id the refused launch asked for\n * @returns A typed protocol failure\n */\nexport function createProtocolError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' cannot launch: the registry is destroyed`, {\n\t\tcode: 'protocol',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the failure raised when a public input is refused before anything is spawned.\n *\n * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`\n * @param value - The rejected value, carried as `context.value`\n * @returns A typed validation failure\n *\n * @example\n * ```ts\n * createInvalidError(\"option 'grace'\", -1).code // 'invalid'\n * ```\n */\nexport function createInvalidError(subject: string, value: unknown): ProcessError {\n\treturn new ProcessError(`Invalid ${subject}`, { code: 'invalid', context: { value } })\n}\n\n/**\n * Creates the failure raised when a run does not complete successfully and rejection is requested.\n *\n * @remarks\n * The category is `timeout` only when the run's own timeout elapsed; every other failure,\n * including an abort and an output overflow, is a `spawn` failure carrying its\n * {@link ExecuteResult}.\n *\n * @param result - The buffered run outcome that failed\n * @param cause - The underlying host fault, when one ended the run\n * @returns A typed run failure carrying its {@link ExecuteResult}\n */\nexport function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError {\n\tlet reason = `exited with code ${String(result.code)}`\n\tif (result.signal !== null) reason = `was killed by ${result.signal}`\n\tif (result.truncated) reason = 'exceeded its output limit'\n\tif (result.aborted) reason = 'was aborted'\n\tif (result.expired) reason = 'timed out'\n\treturn new ProcessError(`Command '${result.command}' ${reason}`, {\n\t\tcode: result.expired ? 'timeout' : 'spawn',\n\t\tcontext: { command: result.command, code: result.code, signal: result.signal },\n\t\t...(cause === undefined ? {} : { cause }),\n\t\tresult,\n\t})\n}\n"],"mappings":";;;;AACA,IAAa,gBAAgB;;AAG7B,IAAa,uBAAuB;;;;;;;;;;;;;;;;AAiBpC,IAAa,gBAAgB;;AAG7B,IAAa,mBAAmB;;AAGhC,IAAa,kBAAkB;;AAG/B,IAAa,iBAAiB;;AAG9B,IAAa,gBAAgB;;AAG7B,IAAa,kBAAkB;;AAG/B,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;;;ACzBV,IAAa,eAAb,cAAkC,MAAM;CACvC,OAAyB;CACzB;CACA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAA8B;EAC1D,MAAM,QAAQ,QAAQ;EACtB,MAAM,SAAS,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,MAAM,CAAC;EAC1D,OAAO,eAAe,MAAM,OAAO,IAAI,0BAA0B,GAAG,EAAE,OAAO,KAAK,CAAC;EACnF,KAAK,OAAO,QAAQ;EACpB,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;EAC1D,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;CACzD;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,OAAuC;CACrE,IAAI,EAAA,GAAC,oBAAA,QAAA,CAAQ,KAAK,GAAG,OAAO;CAC5B,QAAA,GAAO,oBAAA,MAAA,OAAY;EAClB,IAAI,OAAO,eAAe,KAAK,MAAM,MAAM,WAAW,OAAO;EAC7D,IAAI,MAAM,SAAS,kBAAkB,EAAE,UAAU,QAAQ,OAAO;EAKhE,IAJmB,OAAO,yBACzB,OACA,OAAO,IAAI,0BAA0B,CAElC,CAAA,EAAY,UAAU,MAAM,OAAO;EACvC,MAAM,OAAgB,MAAM;EAC5B,OAAO,oBAAoB,MAAM,aAAa,aAAa,IAAI;CAChE,CAAC;AACF;;;;;;;AAQA,SAAgB,qBAAqB,IAA0B;CAC9D,OAAO,IAAI,aAAa,YAAY,GAAG,oBAAoB;EAC1D,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;AAQA,SAAgB,oBAAoB,IAA0B;CAC7D,OAAO,IAAI,aAAa,YAAY,GAAG,6CAA6C;EACnF,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,SAAiB,OAA8B;CACjF,OAAO,IAAI,aAAa,WAAW,WAAW;EAAE,MAAM;EAAW,SAAS,EAAE,MAAM;CAAE,CAAC;AACtF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,QAAuB,OAA+B;CACxF,IAAI,SAAS,oBAAoB,OAAO,OAAO,IAAI;CACnD,IAAI,OAAO,WAAW,MAAM,SAAS,iBAAiB,OAAO;CAC7D,IAAI,OAAO,WAAW,SAAS;CAC/B,IAAI,OAAO,SAAS,SAAS;CAC7B,IAAI,OAAO,SAAS,SAAS;CAC7B,OAAO,IAAI,aAAa,YAAY,OAAO,QAAQ,IAAI,UAAU;EAChE,MAAM,OAAO,UAAU,YAAY;EACnC,SAAS;GAAE,SAAS,OAAO;GAAS,MAAM,OAAO;GAAM,QAAQ,OAAO;EAAO;EAC7E,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EACvC;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts"],"sourcesContent":["/** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */\nexport const PROCESS_GRACE = 5_000\n\n/** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */\nexport const PROCESS_CONFIRMATION = 5_000\n\n/**\n * Names the default window, 1000 ms, the package waits for the child's read ends to close after the\n * child's native exit or after a termination this package initiated, before cutting them off.\n *\n * @remarks\n * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`\n * child modes as real children and timing the host `close` event against the host `exit` event.\n * Every ordinary run closed within 0.02ms of the native exit, whether the child ended itself or a\n * kill ended it, and a `taskkill /F /T` that reaped a descendant while the root was still alive\n * closed within 0.01ms. The only finite late close came from a descendant that outlived its root and\n * then ended on its own, at 127.44ms to 193.41ms — that lag is the descendant's own remaining life\n * rather than a flush cost. A descendant that never ends never closes, so the distribution has no\n * finite tail to cover and this value bounds it instead: 1000ms is over five times the slowest\n * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.\n */\nexport const PROCESS_DRAIN = 1_000\n\n/** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */\nexport const PROCESS_EVIDENCE = 2_048\n\n/** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */\nexport const PROCESS_BACKLOG = 10_485_760\n\n/** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */\nexport const PROCESS_OUTPUT = 10_485_760\n\n/** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */\nexport const PROCESS_TIMER = 2_147_483_647\n\n/** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */\nexport const PROCESS_PATHEXT = '.COM;.EXE;.BAT;.CMD'\n\n/**\n * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:\n * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.\n */\nexport const PROCESS_ERROR_CODES = Object.freeze([\n\t'spawn',\n\t'timeout',\n\t'input',\n\t'duplicate',\n\t'protocol',\n\t'invalid',\n] as const)\n","import type {\n\tProcessErrorCode,\n\tProcessErrorContext,\n\tProcessErrorOptions,\n\tExecuteResult,\n} from './types.js'\nimport { holds, isError } from '@orkestrel/contract'\nimport { PROCESS_ERROR_CODES } from './constants.js'\n\n/**\n * Represents a child-process failure with a stable machine-readable category.\n *\n * @example\n * ```ts\n * const error = new ProcessError('git status refused', {\n * \tcode: 'invalid',\n * \tcontext: { command: 'git status' },\n * })\n * error.code // 'invalid'\n * ```\n */\nexport class ProcessError extends Error {\n\toverride readonly name = 'ProcessError'\n\treadonly code: ProcessErrorCode\n\treadonly context?: ProcessErrorContext\n\t/** Carries the buffered run outcome, present when a one-shot run produced the failure. */\n\treadonly result?: ExecuteResult\n\n\t/**\n\t * Creates a process error.\n\t *\n\t * @param message - Human-readable failure description\n\t * @param options - Machine-readable category, optional context, optional cause, and optional run result\n\t */\n\tconstructor(message: string, options: ProcessErrorOptions) {\n\t\tconst cause = options.cause\n\t\tsuper(message, cause === undefined ? undefined : { cause })\n\t\tObject.defineProperty(this, Symbol.for('@orkestrel/process.error'), { value: true })\n\t\tthis.code = options.code\n\t\tif (options.context !== undefined) this.context = options.context\n\t\tif (options.result !== undefined) this.result = options.result\n\t}\n}\n\n/**\n * Checks whether an unknown value is a {@link ProcessError}.\n *\n * @remarks\n * Recognition combines a global own-property brand with the native `Error` base, the subclass\n * prototype, the fixed name, and a code {@link PROCESS_ERROR_CODES} declares. The brand is\n * recognized across duplicate installations and ESM/CommonJS module copies at 0.0.4 or later. A copy\n * earlier than 0.0.4 stamps no brand, so an error it throws stays outside the type, and so does a\n * plain or property-only lookalike.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `ProcessError` instance; false otherwise\n *\n * @example\n * ```ts\n * isProcessError(new ProcessError('spawn failed', { code: 'spawn' })) // true\n * isProcessError(new Error('spawn failed')) // false\n * ```\n */\nexport function isProcessError(value: unknown): value is ProcessError {\n\tif (!isError(value)) return false\n\treturn holds(() => {\n\t\tif (Object.getPrototypeOf(value) === Error.prototype) return false\n\t\tif (value.name !== 'ProcessError' || !('code' in value)) return false\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tvalue,\n\t\t\tSymbol.for('@orkestrel/process.error'),\n\t\t)\n\t\tif (descriptor?.value !== true) return false\n\t\tconst code: unknown = value.code\n\t\treturn PROCESS_ERROR_CODES.some((declared) => declared === code)\n\t})\n}\n\n/**\n * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.\n *\n * @param id - The id already occupied by a live child\n * @returns A typed duplicate-id failure\n */\nexport function createDuplicateError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' is already live`, {\n\t\tcode: 'duplicate',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is\n * being destroyed.\n *\n * @param id - The id the refused launch asked for\n * @returns A typed protocol failure\n */\nexport function createProtocolError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' cannot launch: the registry is destroyed`, {\n\t\tcode: 'protocol',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the `invalid`-coded failure raised when a public input is refused before anything is\n * spawned.\n *\n * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`\n * @param value - The rejected value, carried as `context.value`\n * @returns A typed validation failure\n *\n * @example\n * ```ts\n * createInvalidError(\"option 'grace'\", -1).code // 'invalid'\n * ```\n */\nexport function createInvalidError(subject: string, value: unknown): ProcessError {\n\treturn new ProcessError(`Invalid ${subject}`, { code: 'invalid', context: { value } })\n}\n\n/**\n * Creates the failure raised when a run does not complete successfully and rejection is requested.\n *\n * @remarks\n * The category is `timeout` only when the run's own timeout elapsed; every other failure,\n * including an abort and an output overflow, is a `spawn` failure carrying its\n * {@link ExecuteResult}.\n *\n * @param result - The buffered run outcome that failed\n * @param cause - The underlying host fault, when one ended the run\n * @returns A typed run failure carrying its {@link ExecuteResult}\n */\nexport function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError {\n\tlet reason = `exited with code ${String(result.code)}`\n\tif (result.signal !== null) reason = `was killed by ${result.signal}`\n\tif (result.truncated) reason = 'exceeded its output limit'\n\tif (result.aborted) reason = 'was aborted'\n\tif (result.expired) reason = 'timed out'\n\treturn new ProcessError(`Command '${result.command}' ${reason}`, {\n\t\tcode: result.expired ? 'timeout' : 'spawn',\n\t\tcontext: { command: result.command, code: result.code, signal: result.signal },\n\t\t...(cause === undefined ? {} : { cause }),\n\t\tresult,\n\t})\n}\n"],"mappings":";;;;AACA,IAAa,gBAAgB;;AAG7B,IAAa,uBAAuB;;;;;;;;;;;;;;;;AAiBpC,IAAa,gBAAgB;;AAG7B,IAAa,mBAAmB;;AAGhC,IAAa,kBAAkB;;AAG/B,IAAa,iBAAiB;;AAG9B,IAAa,gBAAgB;;AAG7B,IAAa,kBAAkB;;;;;AAM/B,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;;;AC5BV,IAAa,eAAb,cAAkC,MAAM;CACvC,OAAyB;CACzB;CACA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAA8B;EAC1D,MAAM,QAAQ,QAAQ;EACtB,MAAM,SAAS,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,MAAM,CAAC;EAC1D,OAAO,eAAe,MAAM,OAAO,IAAI,0BAA0B,GAAG,EAAE,OAAO,KAAK,CAAC;EACnF,KAAK,OAAO,QAAQ;EACpB,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;EAC1D,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;CACzD;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,OAAuC;CACrE,IAAI,EAAA,GAAC,oBAAA,QAAA,CAAQ,KAAK,GAAG,OAAO;CAC5B,QAAA,GAAO,oBAAA,MAAA,OAAY;EAClB,IAAI,OAAO,eAAe,KAAK,MAAM,MAAM,WAAW,OAAO;EAC7D,IAAI,MAAM,SAAS,kBAAkB,EAAE,UAAU,QAAQ,OAAO;EAKhE,IAJmB,OAAO,yBACzB,OACA,OAAO,IAAI,0BAA0B,CAElC,CAAA,EAAY,UAAU,MAAM,OAAO;EACvC,MAAM,OAAgB,MAAM;EAC5B,OAAO,oBAAoB,MAAM,aAAa,aAAa,IAAI;CAChE,CAAC;AACF;;;;;;;AAQA,SAAgB,qBAAqB,IAA0B;CAC9D,OAAO,IAAI,aAAa,YAAY,GAAG,oBAAoB;EAC1D,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;AASA,SAAgB,oBAAoB,IAA0B;CAC7D,OAAO,IAAI,aAAa,YAAY,GAAG,6CAA6C;EACnF,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;;;;;;;AAeA,SAAgB,mBAAmB,SAAiB,OAA8B;CACjF,OAAO,IAAI,aAAa,WAAW,WAAW;EAAE,MAAM;EAAW,SAAS,EAAE,MAAM;CAAE,CAAC;AACtF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,QAAuB,OAA+B;CACxF,IAAI,SAAS,oBAAoB,OAAO,OAAO,IAAI;CACnD,IAAI,OAAO,WAAW,MAAM,SAAS,iBAAiB,OAAO;CAC7D,IAAI,OAAO,WAAW,SAAS;CAC/B,IAAI,OAAO,SAAS,SAAS;CAC7B,IAAI,OAAO,SAAS,SAAS;CAC7B,OAAO,IAAI,aAAa,YAAY,OAAO,QAAQ,IAAI,UAAU;EAChE,MAAM,OAAO,UAAU,YAAY;EACnC,SAAS;GAAE,SAAS,OAAO;GAAS,MAAM,OAAO;GAAM,QAAQ,OAAO;EAAO;EAC7E,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EACvC;CACD,CAAC;AACF"}
@@ -1,9 +1,9 @@
1
- import { EmitterErrorHandler } from '@orkestrel/emitter';
2
- import { EmitterHooks } from '@orkestrel/emitter';
3
- import { EmitterInterface } from '@orkestrel/emitter';
1
+ import type { EmitterErrorHandler } from '@orkestrel/emitter';
2
+ import type { EmitterHooks } from '@orkestrel/emitter';
3
+ import type { EmitterInterface } from '@orkestrel/emitter';
4
4
 
5
5
  /**
6
- * Creates the failure raised when a manager launch reuses a live id.
6
+ * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.
7
7
  *
8
8
  * @param id - The id already occupied by a live child
9
9
  * @returns A typed duplicate-id failure
@@ -25,7 +25,8 @@ export declare function createDuplicateError(id: string): ProcessError;
25
25
  export declare function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError;
26
26
 
27
27
  /**
28
- * Creates the failure raised when a public input is refused before anything is spawned.
28
+ * Creates the `invalid`-coded failure raised when a public input is refused before anything is
29
+ * spawned.
29
30
  *
30
31
  * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`
31
32
  * @param value - The rejected value, carried as `context.value`
@@ -39,7 +40,8 @@ export declare function createExecuteError(result: ExecuteResult, cause?: unknow
39
40
  export declare function createInvalidError(subject: string, value: unknown): ProcessError;
40
41
 
41
42
  /**
42
- * Creates the failure raised when a launch is attempted on a registry that is being destroyed.
43
+ * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is
44
+ * being destroyed.
43
45
  *
44
46
  * @param id - The id the refused launch asked for
45
47
  * @returns A typed protocol failure
@@ -219,15 +221,15 @@ export declare interface ExecuteSyncOptions {
219
221
  */
220
222
  export declare function isProcessError(value: unknown): value is ProcessError;
221
223
 
222
- /** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */
224
+ /** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */
223
225
  export declare const PROCESS_BACKLOG = 10485760;
224
226
 
225
- /** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */
227
+ /** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */
226
228
  export declare const PROCESS_CONFIRMATION = 5000;
227
229
 
228
230
  /**
229
- * Names the default window in milliseconds the package waits for the child's read ends to close after
230
- * the child's native exit or after a termination this package initiated, before cutting them off.
231
+ * Names the default window, 1000 ms, the package waits for the child's read ends to close after the
232
+ * child's native exit or after a termination this package initiated, before cutting them off.
231
233
  *
232
234
  * @remarks
233
235
  * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`
@@ -242,22 +244,25 @@ export declare const PROCESS_CONFIRMATION = 5000;
242
244
  */
243
245
  export declare const PROCESS_DRAIN = 1000;
244
246
 
245
- /** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */
247
+ /**
248
+ * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:
249
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
250
+ */
246
251
  export declare const PROCESS_ERROR_CODES: readonly ["spawn", "timeout", "input", "duplicate", "protocol", "invalid"];
247
252
 
248
- /** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */
253
+ /** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */
249
254
  export declare const PROCESS_EVIDENCE = 2048;
250
255
 
251
- /** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */
256
+ /** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */
252
257
  export declare const PROCESS_GRACE = 5000;
253
258
 
254
- /** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */
259
+ /** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */
255
260
  export declare const PROCESS_OUTPUT = 10485760;
256
261
 
257
- /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */
262
+ /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */
258
263
  export declare const PROCESS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
259
264
 
260
- /** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */
265
+ /** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */
261
266
  export declare const PROCESS_TIMER = 2147483647;
262
267
 
263
268
  /**
@@ -332,7 +337,10 @@ export declare class ProcessError extends Error {
332
337
  constructor(message: string, options: ProcessErrorOptions);
333
338
  }
334
339
 
335
- /** Names the machine-readable {@link ProcessError} categories, derived from {@link PROCESS_ERROR_CODES}. */
340
+ /**
341
+ * Names the machine-readable {@link ProcessError} categories, derived from {@link PROCESS_ERROR_CODES}:
342
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
343
+ */
336
344
  export declare type ProcessErrorCode = (typeof PROCESS_ERROR_CODES)[number];
337
345
 
338
346
  /** Represents structured context carried by a {@link ProcessError}. */
@@ -625,7 +633,8 @@ export declare interface ProcessManagerInterface {
625
633
  */
626
634
  launch(id: string, options: ProcessOptions): ProcessInterface;
627
635
  /**
628
- * Terminates the named children and awaits their exit.
636
+ * Terminates the named children, or every live child when a call names none, and awaits their
637
+ * exit.
629
638
  *
630
639
  * @param ids - The registry keys to stop
631
640
  * @returns True if every named child was live and its exit was confirmed; false otherwise
@@ -1,9 +1,9 @@
1
- import { EmitterErrorHandler } from '@orkestrel/emitter';
2
- import { EmitterHooks } from '@orkestrel/emitter';
3
- import { EmitterInterface } from '@orkestrel/emitter';
1
+ import type { EmitterErrorHandler } from '@orkestrel/emitter';
2
+ import type { EmitterHooks } from '@orkestrel/emitter';
3
+ import type { EmitterInterface } from '@orkestrel/emitter';
4
4
 
5
5
  /**
6
- * Creates the failure raised when a manager launch reuses a live id.
6
+ * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.
7
7
  *
8
8
  * @param id - The id already occupied by a live child
9
9
  * @returns A typed duplicate-id failure
@@ -25,7 +25,8 @@ export declare function createDuplicateError(id: string): ProcessError;
25
25
  export declare function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError;
26
26
 
27
27
  /**
28
- * Creates the failure raised when a public input is refused before anything is spawned.
28
+ * Creates the `invalid`-coded failure raised when a public input is refused before anything is
29
+ * spawned.
29
30
  *
30
31
  * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`
31
32
  * @param value - The rejected value, carried as `context.value`
@@ -39,7 +40,8 @@ export declare function createExecuteError(result: ExecuteResult, cause?: unknow
39
40
  export declare function createInvalidError(subject: string, value: unknown): ProcessError;
40
41
 
41
42
  /**
42
- * Creates the failure raised when a launch is attempted on a registry that is being destroyed.
43
+ * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is
44
+ * being destroyed.
43
45
  *
44
46
  * @param id - The id the refused launch asked for
45
47
  * @returns A typed protocol failure
@@ -219,15 +221,15 @@ export declare interface ExecuteSyncOptions {
219
221
  */
220
222
  export declare function isProcessError(value: unknown): value is ProcessError;
221
223
 
222
- /** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */
224
+ /** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */
223
225
  export declare const PROCESS_BACKLOG = 10485760;
224
226
 
225
- /** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */
227
+ /** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */
226
228
  export declare const PROCESS_CONFIRMATION = 5000;
227
229
 
228
230
  /**
229
- * Names the default window in milliseconds the package waits for the child's read ends to close after
230
- * the child's native exit or after a termination this package initiated, before cutting them off.
231
+ * Names the default window, 1000 ms, the package waits for the child's read ends to close after the
232
+ * child's native exit or after a termination this package initiated, before cutting them off.
231
233
  *
232
234
  * @remarks
233
235
  * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`
@@ -242,22 +244,25 @@ export declare const PROCESS_CONFIRMATION = 5000;
242
244
  */
243
245
  export declare const PROCESS_DRAIN = 1000;
244
246
 
245
- /** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */
247
+ /**
248
+ * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:
249
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
250
+ */
246
251
  export declare const PROCESS_ERROR_CODES: readonly ["spawn", "timeout", "input", "duplicate", "protocol", "invalid"];
247
252
 
248
- /** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */
253
+ /** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */
249
254
  export declare const PROCESS_EVIDENCE = 2048;
250
255
 
251
- /** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */
256
+ /** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */
252
257
  export declare const PROCESS_GRACE = 5000;
253
258
 
254
- /** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */
259
+ /** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */
255
260
  export declare const PROCESS_OUTPUT = 10485760;
256
261
 
257
- /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */
262
+ /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */
258
263
  export declare const PROCESS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
259
264
 
260
- /** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */
265
+ /** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */
261
266
  export declare const PROCESS_TIMER = 2147483647;
262
267
 
263
268
  /**
@@ -332,7 +337,10 @@ export declare class ProcessError extends Error {
332
337
  constructor(message: string, options: ProcessErrorOptions);
333
338
  }
334
339
 
335
- /** Names the machine-readable {@link ProcessError} categories, derived from {@link PROCESS_ERROR_CODES}. */
340
+ /**
341
+ * Names the machine-readable {@link ProcessError} categories, derived from {@link PROCESS_ERROR_CODES}:
342
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
343
+ */
336
344
  export declare type ProcessErrorCode = (typeof PROCESS_ERROR_CODES)[number];
337
345
 
338
346
  /** Represents structured context carried by a {@link ProcessError}. */
@@ -625,7 +633,8 @@ export declare interface ProcessManagerInterface {
625
633
  */
626
634
  launch(id: string, options: ProcessOptions): ProcessInterface;
627
635
  /**
628
- * Terminates the named children and awaits their exit.
636
+ * Terminates the named children, or every live child when a call names none, and awaits their
637
+ * exit.
629
638
  *
630
639
  * @param ids - The registry keys to stop
631
640
  * @returns True if every named child was live and its exit was confirmed; false otherwise
@@ -1,12 +1,12 @@
1
1
  import { holds, isError } from "@orkestrel/contract";
2
2
  //#region src/core/constants.ts
3
- /** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */
3
+ /** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */
4
4
  var PROCESS_GRACE = 5e3;
5
- /** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */
5
+ /** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */
6
6
  var PROCESS_CONFIRMATION = 5e3;
7
7
  /**
8
- * Names the default window in milliseconds the package waits for the child's read ends to close after
9
- * the child's native exit or after a termination this package initiated, before cutting them off.
8
+ * Names the default window, 1000 ms, the package waits for the child's read ends to close after the
9
+ * child's native exit or after a termination this package initiated, before cutting them off.
10
10
  *
11
11
  * @remarks
12
12
  * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`
@@ -20,17 +20,20 @@ var PROCESS_CONFIRMATION = 5e3;
20
20
  * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.
21
21
  */
22
22
  var PROCESS_DRAIN = 1e3;
23
- /** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */
23
+ /** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */
24
24
  var PROCESS_EVIDENCE = 2048;
25
- /** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */
25
+ /** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */
26
26
  var PROCESS_BACKLOG = 10485760;
27
- /** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */
27
+ /** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */
28
28
  var PROCESS_OUTPUT = 10485760;
29
- /** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */
29
+ /** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */
30
30
  var PROCESS_TIMER = 2147483647;
31
- /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */
31
+ /** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */
32
32
  var PROCESS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
33
- /** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */
33
+ /**
34
+ * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:
35
+ * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.
36
+ */
34
37
  var PROCESS_ERROR_CODES = Object.freeze([
35
38
  "spawn",
36
39
  "timeout",
@@ -104,7 +107,7 @@ function isProcessError(value) {
104
107
  });
105
108
  }
106
109
  /**
107
- * Creates the failure raised when a manager launch reuses a live id.
110
+ * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.
108
111
  *
109
112
  * @param id - The id already occupied by a live child
110
113
  * @returns A typed duplicate-id failure
@@ -116,7 +119,8 @@ function createDuplicateError(id) {
116
119
  });
117
120
  }
118
121
  /**
119
- * Creates the failure raised when a launch is attempted on a registry that is being destroyed.
122
+ * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is
123
+ * being destroyed.
120
124
  *
121
125
  * @param id - The id the refused launch asked for
122
126
  * @returns A typed protocol failure
@@ -128,7 +132,8 @@ function createProtocolError(id) {
128
132
  });
129
133
  }
130
134
  /**
131
- * Creates the failure raised when a public input is refused before anything is spawned.
135
+ * Creates the `invalid`-coded failure raised when a public input is refused before anything is
136
+ * spawned.
132
137
  *
133
138
  * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`
134
139
  * @param value - The rejected value, carried as `context.value`
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts"],"sourcesContent":["/** Names the default cooperative POSIX window in milliseconds between `SIGTERM` and `SIGKILL` during termination. */\nexport const PROCESS_GRACE = 5_000\n\n/** Names the window in milliseconds a termination waits for the child's native exit after the final kill. */\nexport const PROCESS_CONFIRMATION = 5_000\n\n/**\n * Names the default window in milliseconds the package waits for the child's read ends to close after\n * the child's native exit or after a termination this package initiated, before cutting them off.\n *\n * @remarks\n * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`\n * child modes as real children and timing the host `close` event against the host `exit` event.\n * Every ordinary run closed within 0.02ms of the native exit, whether the child ended itself or a\n * kill ended it, and a `taskkill /F /T` that reaped a descendant while the root was still alive\n * closed within 0.01ms. The only finite late close came from a descendant that outlived its root and\n * then ended on its own, at 127.44ms to 193.41ms — that lag is the descendant's own remaining life\n * rather than a flush cost. A descendant that never ends never closes, so the distribution has no\n * finite tail to cover and this value bounds it instead: 1000ms is over five times the slowest\n * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.\n */\nexport const PROCESS_DRAIN = 1_000\n\n/** Names the default maximum retained stderr tail in bytes for a supervised {@link ProcessInterface}. */\nexport const PROCESS_EVIDENCE = 2_048\n\n/** Names the default soft high-water mark in bytes for a supervised {@link ProcessInterface} line backlog. */\nexport const PROCESS_BACKLOG = 10_485_760\n\n/** Names the default maximum captured bytes for a one-shot run's stdout and stderr, each. */\nexport const PROCESS_OUTPUT = 10_485_760\n\n/** Names the largest timer delay in milliseconds the host schedules without truncating it to one. */\nexport const PROCESS_TIMER = 2_147_483_647\n\n/** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`. */\nexport const PROCESS_PATHEXT = '.COM;.EXE;.BAT;.CMD'\n\n/** Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order. */\nexport const PROCESS_ERROR_CODES = Object.freeze([\n\t'spawn',\n\t'timeout',\n\t'input',\n\t'duplicate',\n\t'protocol',\n\t'invalid',\n] as const)\n","import type {\n\tProcessErrorCode,\n\tProcessErrorContext,\n\tProcessErrorOptions,\n\tExecuteResult,\n} from './types.js'\nimport { holds, isError } from '@orkestrel/contract'\nimport { PROCESS_ERROR_CODES } from './constants.js'\n\n/**\n * Represents a child-process failure with a stable machine-readable category.\n *\n * @example\n * ```ts\n * const error = new ProcessError('git status refused', {\n * \tcode: 'invalid',\n * \tcontext: { command: 'git status' },\n * })\n * error.code // 'invalid'\n * ```\n */\nexport class ProcessError extends Error {\n\toverride readonly name = 'ProcessError'\n\treadonly code: ProcessErrorCode\n\treadonly context?: ProcessErrorContext\n\t/** Carries the buffered run outcome, present when a one-shot run produced the failure. */\n\treadonly result?: ExecuteResult\n\n\t/**\n\t * Creates a process error.\n\t *\n\t * @param message - Human-readable failure description\n\t * @param options - Machine-readable category, optional context, optional cause, and optional run result\n\t */\n\tconstructor(message: string, options: ProcessErrorOptions) {\n\t\tconst cause = options.cause\n\t\tsuper(message, cause === undefined ? undefined : { cause })\n\t\tObject.defineProperty(this, Symbol.for('@orkestrel/process.error'), { value: true })\n\t\tthis.code = options.code\n\t\tif (options.context !== undefined) this.context = options.context\n\t\tif (options.result !== undefined) this.result = options.result\n\t}\n}\n\n/**\n * Checks whether an unknown value is a {@link ProcessError}.\n *\n * @remarks\n * Recognition combines a global own-property brand with the native `Error` base, the subclass\n * prototype, the fixed name, and a code {@link PROCESS_ERROR_CODES} declares. The brand is\n * recognized across duplicate installations and ESM/CommonJS module copies at 0.0.4 or later. A copy\n * earlier than 0.0.4 stamps no brand, so an error it throws stays outside the type, and so does a\n * plain or property-only lookalike.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `ProcessError` instance; false otherwise\n *\n * @example\n * ```ts\n * isProcessError(new ProcessError('spawn failed', { code: 'spawn' })) // true\n * isProcessError(new Error('spawn failed')) // false\n * ```\n */\nexport function isProcessError(value: unknown): value is ProcessError {\n\tif (!isError(value)) return false\n\treturn holds(() => {\n\t\tif (Object.getPrototypeOf(value) === Error.prototype) return false\n\t\tif (value.name !== 'ProcessError' || !('code' in value)) return false\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tvalue,\n\t\t\tSymbol.for('@orkestrel/process.error'),\n\t\t)\n\t\tif (descriptor?.value !== true) return false\n\t\tconst code: unknown = value.code\n\t\treturn PROCESS_ERROR_CODES.some((declared) => declared === code)\n\t})\n}\n\n/**\n * Creates the failure raised when a manager launch reuses a live id.\n *\n * @param id - The id already occupied by a live child\n * @returns A typed duplicate-id failure\n */\nexport function createDuplicateError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' is already live`, {\n\t\tcode: 'duplicate',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the failure raised when a launch is attempted on a registry that is being destroyed.\n *\n * @param id - The id the refused launch asked for\n * @returns A typed protocol failure\n */\nexport function createProtocolError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' cannot launch: the registry is destroyed`, {\n\t\tcode: 'protocol',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the failure raised when a public input is refused before anything is spawned.\n *\n * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`\n * @param value - The rejected value, carried as `context.value`\n * @returns A typed validation failure\n *\n * @example\n * ```ts\n * createInvalidError(\"option 'grace'\", -1).code // 'invalid'\n * ```\n */\nexport function createInvalidError(subject: string, value: unknown): ProcessError {\n\treturn new ProcessError(`Invalid ${subject}`, { code: 'invalid', context: { value } })\n}\n\n/**\n * Creates the failure raised when a run does not complete successfully and rejection is requested.\n *\n * @remarks\n * The category is `timeout` only when the run's own timeout elapsed; every other failure,\n * including an abort and an output overflow, is a `spawn` failure carrying its\n * {@link ExecuteResult}.\n *\n * @param result - The buffered run outcome that failed\n * @param cause - The underlying host fault, when one ended the run\n * @returns A typed run failure carrying its {@link ExecuteResult}\n */\nexport function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError {\n\tlet reason = `exited with code ${String(result.code)}`\n\tif (result.signal !== null) reason = `was killed by ${result.signal}`\n\tif (result.truncated) reason = 'exceeded its output limit'\n\tif (result.aborted) reason = 'was aborted'\n\tif (result.expired) reason = 'timed out'\n\treturn new ProcessError(`Command '${result.command}' ${reason}`, {\n\t\tcode: result.expired ? 'timeout' : 'spawn',\n\t\tcontext: { command: result.command, code: result.code, signal: result.signal },\n\t\t...(cause === undefined ? {} : { cause }),\n\t\tresult,\n\t})\n}\n"],"mappings":";;;AACA,IAAa,gBAAgB;;AAG7B,IAAa,uBAAuB;;;;;;;;;;;;;;;;AAiBpC,IAAa,gBAAgB;;AAG7B,IAAa,mBAAmB;;AAGhC,IAAa,kBAAkB;;AAG/B,IAAa,iBAAiB;;AAG9B,IAAa,gBAAgB;;AAG7B,IAAa,kBAAkB;;AAG/B,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;;;ACzBV,IAAa,eAAb,cAAkC,MAAM;CACvC,OAAyB;CACzB;CACA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAA8B;EAC1D,MAAM,QAAQ,QAAQ;EACtB,MAAM,SAAS,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,MAAM,CAAC;EAC1D,OAAO,eAAe,MAAM,OAAO,IAAI,0BAA0B,GAAG,EAAE,OAAO,KAAK,CAAC;EACnF,KAAK,OAAO,QAAQ;EACpB,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;EAC1D,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;CACzD;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,OAAuC;CACrE,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAC5B,OAAO,YAAY;EAClB,IAAI,OAAO,eAAe,KAAK,MAAM,MAAM,WAAW,OAAO;EAC7D,IAAI,MAAM,SAAS,kBAAkB,EAAE,UAAU,QAAQ,OAAO;EAKhE,IAJmB,OAAO,yBACzB,OACA,OAAO,IAAI,0BAA0B,CAElC,CAAA,EAAY,UAAU,MAAM,OAAO;EACvC,MAAM,OAAgB,MAAM;EAC5B,OAAO,oBAAoB,MAAM,aAAa,aAAa,IAAI;CAChE,CAAC;AACF;;;;;;;AAQA,SAAgB,qBAAqB,IAA0B;CAC9D,OAAO,IAAI,aAAa,YAAY,GAAG,oBAAoB;EAC1D,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;AAQA,SAAgB,oBAAoB,IAA0B;CAC7D,OAAO,IAAI,aAAa,YAAY,GAAG,6CAA6C;EACnF,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,SAAiB,OAA8B;CACjF,OAAO,IAAI,aAAa,WAAW,WAAW;EAAE,MAAM;EAAW,SAAS,EAAE,MAAM;CAAE,CAAC;AACtF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,QAAuB,OAA+B;CACxF,IAAI,SAAS,oBAAoB,OAAO,OAAO,IAAI;CACnD,IAAI,OAAO,WAAW,MAAM,SAAS,iBAAiB,OAAO;CAC7D,IAAI,OAAO,WAAW,SAAS;CAC/B,IAAI,OAAO,SAAS,SAAS;CAC7B,IAAI,OAAO,SAAS,SAAS;CAC7B,OAAO,IAAI,aAAa,YAAY,OAAO,QAAQ,IAAI,UAAU;EAChE,MAAM,OAAO,UAAU,YAAY;EACnC,SAAS;GAAE,SAAS,OAAO;GAAS,MAAM,OAAO;GAAM,QAAQ,OAAO;EAAO;EAC7E,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EACvC;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts"],"sourcesContent":["/** Names the default cooperative POSIX window, 5000 ms, between `SIGTERM` and `SIGKILL` during termination. */\nexport const PROCESS_GRACE = 5_000\n\n/** Names the window, 5000 ms, a termination waits for the child's native exit after the final kill. */\nexport const PROCESS_CONFIRMATION = 5_000\n\n/**\n * Names the default window, 1000 ms, the package waits for the child's read ends to close after the\n * child's native exit or after a termination this package initiated, before cutting them off.\n *\n * @remarks\n * Measured on Windows 11 with Node v24.18.1 on 2026-08-21, spawning the `tests/src/server/fixtures`\n * child modes as real children and timing the host `close` event against the host `exit` event.\n * Every ordinary run closed within 0.02ms of the native exit, whether the child ended itself or a\n * kill ended it, and a `taskkill /F /T` that reaped a descendant while the root was still alive\n * closed within 0.01ms. The only finite late close came from a descendant that outlived its root and\n * then ended on its own, at 127.44ms to 193.41ms — that lag is the descendant's own remaining life\n * rather than a flush cost. A descendant that never ends never closes, so the distribution has no\n * finite tail to cover and this value bounds it instead: 1000ms is over five times the slowest\n * finite close measured, and it keeps an unreachable descendant from stretching a shutdown.\n */\nexport const PROCESS_DRAIN = 1_000\n\n/** Names the default maximum retained stderr tail, 2048 bytes, for a supervised {@link ProcessInterface}. */\nexport const PROCESS_EVIDENCE = 2_048\n\n/** Names the default soft high-water mark, 10485760 bytes, for a supervised {@link ProcessInterface} line backlog. */\nexport const PROCESS_BACKLOG = 10_485_760\n\n/** Names the default maximum captured bytes, 10485760 each, for a one-shot run's stdout and stderr. */\nexport const PROCESS_OUTPUT = 10_485_760\n\n/** Names the largest timer delay, 2147483647 ms, the host schedules without truncating it to one. */\nexport const PROCESS_TIMER = 2_147_483_647\n\n/** Lists the executable extensions a Windows lookup applies when the environment declares no `PATHEXT`, `.COM;.EXE;.BAT;.CMD`. */\nexport const PROCESS_PATHEXT = '.COM;.EXE;.BAT;.CMD'\n\n/**\n * Lists the machine-readable failure categories a {@link ProcessError} carries, in declaration order:\n * `spawn`, `timeout`, `input`, `duplicate`, `protocol`, and `invalid`.\n */\nexport const PROCESS_ERROR_CODES = Object.freeze([\n\t'spawn',\n\t'timeout',\n\t'input',\n\t'duplicate',\n\t'protocol',\n\t'invalid',\n] as const)\n","import type {\n\tProcessErrorCode,\n\tProcessErrorContext,\n\tProcessErrorOptions,\n\tExecuteResult,\n} from './types.js'\nimport { holds, isError } from '@orkestrel/contract'\nimport { PROCESS_ERROR_CODES } from './constants.js'\n\n/**\n * Represents a child-process failure with a stable machine-readable category.\n *\n * @example\n * ```ts\n * const error = new ProcessError('git status refused', {\n * \tcode: 'invalid',\n * \tcontext: { command: 'git status' },\n * })\n * error.code // 'invalid'\n * ```\n */\nexport class ProcessError extends Error {\n\toverride readonly name = 'ProcessError'\n\treadonly code: ProcessErrorCode\n\treadonly context?: ProcessErrorContext\n\t/** Carries the buffered run outcome, present when a one-shot run produced the failure. */\n\treadonly result?: ExecuteResult\n\n\t/**\n\t * Creates a process error.\n\t *\n\t * @param message - Human-readable failure description\n\t * @param options - Machine-readable category, optional context, optional cause, and optional run result\n\t */\n\tconstructor(message: string, options: ProcessErrorOptions) {\n\t\tconst cause = options.cause\n\t\tsuper(message, cause === undefined ? undefined : { cause })\n\t\tObject.defineProperty(this, Symbol.for('@orkestrel/process.error'), { value: true })\n\t\tthis.code = options.code\n\t\tif (options.context !== undefined) this.context = options.context\n\t\tif (options.result !== undefined) this.result = options.result\n\t}\n}\n\n/**\n * Checks whether an unknown value is a {@link ProcessError}.\n *\n * @remarks\n * Recognition combines a global own-property brand with the native `Error` base, the subclass\n * prototype, the fixed name, and a code {@link PROCESS_ERROR_CODES} declares. The brand is\n * recognized across duplicate installations and ESM/CommonJS module copies at 0.0.4 or later. A copy\n * earlier than 0.0.4 stamps no brand, so an error it throws stays outside the type, and so does a\n * plain or property-only lookalike.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `ProcessError` instance; false otherwise\n *\n * @example\n * ```ts\n * isProcessError(new ProcessError('spawn failed', { code: 'spawn' })) // true\n * isProcessError(new Error('spawn failed')) // false\n * ```\n */\nexport function isProcessError(value: unknown): value is ProcessError {\n\tif (!isError(value)) return false\n\treturn holds(() => {\n\t\tif (Object.getPrototypeOf(value) === Error.prototype) return false\n\t\tif (value.name !== 'ProcessError' || !('code' in value)) return false\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tvalue,\n\t\t\tSymbol.for('@orkestrel/process.error'),\n\t\t)\n\t\tif (descriptor?.value !== true) return false\n\t\tconst code: unknown = value.code\n\t\treturn PROCESS_ERROR_CODES.some((declared) => declared === code)\n\t})\n}\n\n/**\n * Creates the `duplicate`-coded failure raised when a manager launch reuses a live id.\n *\n * @param id - The id already occupied by a live child\n * @returns A typed duplicate-id failure\n */\nexport function createDuplicateError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' is already live`, {\n\t\tcode: 'duplicate',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the `protocol`-coded failure raised when a launch is attempted on a registry that is\n * being destroyed.\n *\n * @param id - The id the refused launch asked for\n * @returns A typed protocol failure\n */\nexport function createProtocolError(id: string): ProcessError {\n\treturn new ProcessError(`Process '${id}' cannot launch: the registry is destroyed`, {\n\t\tcode: 'protocol',\n\t\tcontext: { id },\n\t})\n}\n\n/**\n * Creates the `invalid`-coded failure raised when a public input is refused before anything is\n * spawned.\n *\n * @param subject - The rejected input named as the caller wrote it, such as `option 'grace'`\n * @param value - The rejected value, carried as `context.value`\n * @returns A typed validation failure\n *\n * @example\n * ```ts\n * createInvalidError(\"option 'grace'\", -1).code // 'invalid'\n * ```\n */\nexport function createInvalidError(subject: string, value: unknown): ProcessError {\n\treturn new ProcessError(`Invalid ${subject}`, { code: 'invalid', context: { value } })\n}\n\n/**\n * Creates the failure raised when a run does not complete successfully and rejection is requested.\n *\n * @remarks\n * The category is `timeout` only when the run's own timeout elapsed; every other failure,\n * including an abort and an output overflow, is a `spawn` failure carrying its\n * {@link ExecuteResult}.\n *\n * @param result - The buffered run outcome that failed\n * @param cause - The underlying host fault, when one ended the run\n * @returns A typed run failure carrying its {@link ExecuteResult}\n */\nexport function createExecuteError(result: ExecuteResult, cause?: unknown): ProcessError {\n\tlet reason = `exited with code ${String(result.code)}`\n\tif (result.signal !== null) reason = `was killed by ${result.signal}`\n\tif (result.truncated) reason = 'exceeded its output limit'\n\tif (result.aborted) reason = 'was aborted'\n\tif (result.expired) reason = 'timed out'\n\treturn new ProcessError(`Command '${result.command}' ${reason}`, {\n\t\tcode: result.expired ? 'timeout' : 'spawn',\n\t\tcontext: { command: result.command, code: result.code, signal: result.signal },\n\t\t...(cause === undefined ? {} : { cause }),\n\t\tresult,\n\t})\n}\n"],"mappings":";;;AACA,IAAa,gBAAgB;;AAG7B,IAAa,uBAAuB;;;;;;;;;;;;;;;;AAiBpC,IAAa,gBAAgB;;AAG7B,IAAa,mBAAmB;;AAGhC,IAAa,kBAAkB;;AAG/B,IAAa,iBAAiB;;AAG9B,IAAa,gBAAgB;;AAG7B,IAAa,kBAAkB;;;;;AAM/B,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;;;AC5BV,IAAa,eAAb,cAAkC,MAAM;CACvC,OAAyB;CACzB;CACA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAA8B;EAC1D,MAAM,QAAQ,QAAQ;EACtB,MAAM,SAAS,UAAU,KAAA,IAAY,KAAA,IAAY,EAAE,MAAM,CAAC;EAC1D,OAAO,eAAe,MAAM,OAAO,IAAI,0BAA0B,GAAG,EAAE,OAAO,KAAK,CAAC;EACnF,KAAK,OAAO,QAAQ;EACpB,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;EAC1D,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;CACzD;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,OAAuC;CACrE,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAC5B,OAAO,YAAY;EAClB,IAAI,OAAO,eAAe,KAAK,MAAM,MAAM,WAAW,OAAO;EAC7D,IAAI,MAAM,SAAS,kBAAkB,EAAE,UAAU,QAAQ,OAAO;EAKhE,IAJmB,OAAO,yBACzB,OACA,OAAO,IAAI,0BAA0B,CAElC,CAAA,EAAY,UAAU,MAAM,OAAO;EACvC,MAAM,OAAgB,MAAM;EAC5B,OAAO,oBAAoB,MAAM,aAAa,aAAa,IAAI;CAChE,CAAC;AACF;;;;;;;AAQA,SAAgB,qBAAqB,IAA0B;CAC9D,OAAO,IAAI,aAAa,YAAY,GAAG,oBAAoB;EAC1D,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;AASA,SAAgB,oBAAoB,IAA0B;CAC7D,OAAO,IAAI,aAAa,YAAY,GAAG,6CAA6C;EACnF,MAAM;EACN,SAAS,EAAE,GAAG;CACf,CAAC;AACF;;;;;;;;;;;;;;AAeA,SAAgB,mBAAmB,SAAiB,OAA8B;CACjF,OAAO,IAAI,aAAa,WAAW,WAAW;EAAE,MAAM;EAAW,SAAS,EAAE,MAAM;CAAE,CAAC;AACtF;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,QAAuB,OAA+B;CACxF,IAAI,SAAS,oBAAoB,OAAO,OAAO,IAAI;CACnD,IAAI,OAAO,WAAW,MAAM,SAAS,iBAAiB,OAAO;CAC7D,IAAI,OAAO,WAAW,SAAS;CAC/B,IAAI,OAAO,SAAS,SAAS;CAC7B,IAAI,OAAO,SAAS,SAAS;CAC7B,OAAO,IAAI,aAAa,YAAY,OAAO,QAAQ,IAAI,UAAU;EAChE,MAAM,OAAO,UAAU,YAAY;EACnC,SAAS;GAAE,SAAS,OAAO;GAAS,MAAM,OAAO;GAAM,QAAQ,OAAO;EAAO;EAC7E,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EACvC;CACD,CAAC;AACF"}
@@ -307,7 +307,8 @@ function buildExecutableCandidates(file, workspace, environment, platform) {
307
307
  return Object.freeze(targets);
308
308
  }
309
309
  /**
310
- * Resolves a command file to the executable path the host would launch.
310
+ * Resolves a command file to the executable path the host would launch, or to `undefined` on a POSIX
311
+ * host, which performs its own lookup.
311
312
  *
312
313
  * @param file - The command executable name or path
313
314
  * @param options - The directory searched first and the child's effective environment
@@ -1446,7 +1447,8 @@ var Supervisor = class {
1446
1447
  //#endregion
1447
1448
  //#region src/server/processes/Process.ts
1448
1449
  /**
1449
- * Supervises one child while keeping every observation channel aligned at termination.
1450
+ * Supervises one child, frames its standard output into lines under a bounded backlog, and keeps
1451
+ * every observation channel aligned at termination.
1450
1452
  *
1451
1453
  * @remarks
1452
1454
  * The child's ending and the supervision's ending are distinct. `pid`, `code`, and `signal` read
@@ -1735,7 +1737,8 @@ var Process = class {
1735
1737
  //#endregion
1736
1738
  //#region src/server/processes/ProcessManager.ts
1737
1739
  /**
1738
- * Represents a keyed registry of live supervised child processes.
1740
+ * Launches supervised children under caller-chosen ids, evicts each one as it settles, and destroys
1741
+ * every live child on teardown.
1739
1742
  *
1740
1743
  * @remarks
1741
1744
  * A child launched under an id joins the registry and emits `launch`; when it settles it removes
@@ -2081,27 +2084,37 @@ var Session = class {
2081
2084
  //#endregion
2082
2085
  //#region src/server/factories.ts
2083
2086
  /**
2084
- * Creates one supervised child process.
2087
+ * Creates one supervised child process and returns it as a {@link ProcessInterface}, so a caller
2088
+ * holds the published contract rather than the `Process` class.
2085
2089
  *
2086
2090
  * @param options - Command, workspace, termination, evidence, stdin, and observation settings
2087
2091
  * @returns The launched {@link ProcessInterface}
2088
2092
  *
2089
- * @example
2093
+ * @example Supervise a child and read its lines
2090
2094
  * ```ts
2091
2095
  * import { createProcess } from '@orkestrel/process/server'
2092
2096
  *
2093
2097
  * const child = createProcess({
2094
- * command: { file: 'node', arguments: ['--version'] },
2098
+ * command: { file: 'node', arguments: ['-e', 'console.log("ready"); console.log("done")'] },
2095
2099
  * workspace: process.cwd(),
2096
- * grace: 5000,
2100
+ * grace: 5_000, // POSIX only: the window between SIGTERM and SIGKILL
2097
2101
  * })
2102
+ *
2103
+ * const lines: string[] = []
2104
+ * for await (const line of child.lines) lines.push(line)
2105
+ * lines // ['ready', 'done']
2106
+ *
2107
+ * const exit = await child.exit
2108
+ * exit.code // 0
2109
+ * await child.destroy()
2098
2110
  * ```
2099
2111
  */
2100
2112
  function createProcess(options) {
2101
2113
  return new Process(options);
2102
2114
  }
2103
2115
  /**
2104
- * Creates one raw byte session over a supervised child process.
2116
+ * Creates one raw byte session over a supervised child process and returns it as a
2117
+ * {@link SessionInterface}, so a caller holds the published contract rather than the `Session` class.
2105
2118
  *
2106
2119
  * @param options - Command, workspace, termination, evidence, stdin, and observation settings
2107
2120
  * @returns The launched {@link SessionInterface}
@@ -2121,7 +2134,9 @@ function createSession(options) {
2121
2134
  return new Session(options);
2122
2135
  }
2123
2136
  /**
2124
- * Creates one keyed registry of supervised child processes.
2137
+ * Creates one empty keyed registry of supervised child processes and returns it as a
2138
+ * {@link ProcessManagerInterface}, so a caller holds the published contract rather than the
2139
+ * `ProcessManager` class.
2125
2140
  *
2126
2141
  * @param options - Initial fleet-level observation hooks and listener-error handling
2127
2142
  * @returns The {@link ProcessManagerInterface} registry