stitchkit 0.108.0 → 0.108.1

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/CHANGELOG.md CHANGED
@@ -15,6 +15,18 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.108.1] - 2026-10-07
19
+
20
+ ### Fixed
21
+
22
+ - `stitchkit/process` — **under Bun, `runNativeCommand` no longer waits for its deadline on a command
23
+ that has already exited.** Bun's `node:child_process` can lose a child's `exit` event while the host
24
+ is heavily loaded inside `bun test` (a bare `spawn` of `sh -c 'echo x; exit 1'` received no event at
25
+ all in 4 of 30 parallel runs at load average ~90), so the call hung until `timeoutMs` and failed with
26
+ `Command deadline exceeded`. Under Bun a command is now launched through `Bun.spawn`, presented to the
27
+ command owner with the same events, streams, group ownership and failure reporting; Node still uses
28
+ `node:child_process`. The deadline, stop policy and process-group cleanup are unchanged.
29
+
18
30
  ## [0.108.0] - 2026-10-06
19
31
 
20
32
  ### ⚠️ Breaking changes
@@ -1,4 +1,4 @@
1
- import type { ChildProcessWithoutNullStreams } from 'node:child_process';
1
+ import type { OwnedChild } from '../process/bun-child.js';
2
2
  import type { AgentProcessSandbox } from './sandbox.js';
3
3
  /**
4
4
  * All entry paths share one command admission limit and one shutdown barrier.
@@ -11,9 +11,9 @@ import type { AgentProcessSandbox } from './sandbox.js';
11
11
  */
12
12
  export declare function sandboxProcessOwner(assertActive: () => void, maximum: number): {
13
13
  admit: () => void;
14
- track: (child: ChildProcessWithoutNullStreams) => void;
14
+ track: (child: OwnedChild) => void;
15
15
  readonly size: number;
16
- spawn(input: Parameters<AgentProcessSandbox['prepare']>[0]): ChildProcessWithoutNullStreams;
16
+ spawn(input: Parameters<AgentProcessSandbox['prepare']>[0]): OwnedChild;
17
17
  stop(): Promise<void>;
18
18
  };
19
19
  //# sourceMappingURL=sandbox-process-owner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-process-owner.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAKzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM;;mBAarD,8BAA8B;;iBAsCrC,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;;EAqB7D"}
1
+ {"version":3,"file":"sandbox-process-owner.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAKvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM;;mBAUrD,UAAU;;iBAsCjB,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;;EAqB7D"}
@@ -1,8 +1,8 @@
1
- import type { ChildProcessWithoutNullStreams } from 'node:child_process';
1
+ import type { OwnedChild } from '../process/bun-child.js';
2
2
  import { type SandboxProcess, type SandboxRunOptions } from './sandbox-contract.js';
3
3
  /** Sandbox admission and mandatory caps adapt the shared native command owner. */
4
4
  export declare function spawnSandboxProcess(executable: string, args: string[], limits: {
5
5
  timeoutMs: number;
6
6
  maxOutputBytes: number;
7
- }, options?: SandboxRunOptions, onSpawn?: (child: ChildProcessWithoutNullStreams) => void): SandboxProcess;
7
+ }, options?: SandboxRunOptions, onSpawn?: (child: OwnedChild) => void): SandboxProcess;
8
8
  //# sourceMappingURL=sandbox-process.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,kFAAkF;AAClF,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,GAAE,iBAAsB,EAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,GACxD,cAAc,CA8ChB"}
1
+ {"version":3,"file":"sandbox-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,kFAAkF;AAClF,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,GAAE,iBAAsB,EAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GACpC,cAAc,CA8ChB"}
@@ -8,11 +8,6 @@ export declare function userMessage(conversationId: string, id: string): {
8
8
  parts: ({
9
9
  type: "text";
10
10
  text: string;
11
- } | {
12
- type: "file";
13
- mediaType: string;
14
- reference: string;
15
- filename?: string | undefined;
16
11
  } | {
17
12
  type: "reasoning";
18
13
  text: string;
@@ -21,6 +16,11 @@ export declare function userMessage(conversationId: string, id: string): {
21
16
  provider: string;
22
17
  data: Record<string, import("zod").JSONType>;
23
18
  } | undefined;
19
+ } | {
20
+ type: "file";
21
+ mediaType: string;
22
+ reference: string;
23
+ filename?: string | undefined;
24
24
  } | {
25
25
  type: "source";
26
26
  sourceId: string;
@@ -6,9 +6,9 @@ import {
6
6
  AgentCodingToolAuthorizationSchema2,
7
7
  AgentCodingToolPathAuthorizationSchema2,
8
8
  createAgentCodingTools2
9
- } from "../../index-dwf0gymy.js";
9
+ } from "../../index-e35py42g.js";
10
10
  import"../../index-2kbysk9s.js";
11
- import"../../index-4q9jvqg7.js";
11
+ import"../../index-epg514ys.js";
12
12
  import"../../index-8ks9b85e.js";
13
13
  import"../../index-zrtrjkbf.js";
14
14
  import"../../index-636mggad.js";
@@ -8,7 +8,7 @@ import"../../index-q6crhe1n.js";
8
8
  import"../../index-fynr93w4.js";
9
9
  import {
10
10
  createAgentCodingTools2
11
- } from "../../index-dwf0gymy.js";
11
+ } from "../../index-e35py42g.js";
12
12
  import"../../index-2kbysk9s.js";
13
13
  import {
14
14
  COMMAND_CLEANUP_TIMEOUT_MS,
@@ -17,7 +17,7 @@ import {
17
17
  nativeCommandOwner,
18
18
  terminateOwnedGroup,
19
19
  startNativeCommand
20
- } from "../../index-4q9jvqg7.js";
20
+ } from "../../index-epg514ys.js";
21
21
  import"../../index-zrtrjkbf.js";
22
22
  import {
23
23
  MAX_TIMER_MS
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  NativeCommandError2,
9
9
  startNativeCommand
10
- } from "../index-4q9jvqg7.js";
10
+ } from "../index-epg514ys.js";
11
11
  // src/process/command.ts
12
12
  function runNativeCommand(input) {
13
13
  return startNativeCommand(input).result;
@@ -5,7 +5,7 @@ import {
5
5
  NativeCommandError2,
6
6
  CommandStopped,
7
7
  startNativeCommand
8
- } from "./index-4q9jvqg7.js";
8
+ } from "./index-epg514ys.js";
9
9
  import {
10
10
  probeAgentProcessSandboxOutcome,
11
11
  missingSandboxRestrictions2,
@@ -395,21 +395,190 @@ function createCommandLifetime(input) {
395
395
  }
396
396
 
397
397
  // src/process/launch.ts
398
- import { Readable as Readable2 } from "node:stream";
398
+ import { Readable as Readable3 } from "node:stream";
399
399
 
400
400
  // src/process/owned-child.ts
401
401
  import { spawn } from "node:child_process";
402
+
403
+ // src/process/bun-child.ts
404
+ import { EventEmitter } from "node:events";
405
+ import { Readable, Writable } from "node:stream";
406
+ function hostIsBun() {
407
+ return typeof Bun !== "undefined";
408
+ }
409
+ function readableOf(source) {
410
+ const reader = source.getReader();
411
+ let reading = false;
412
+ return new Readable({
413
+ read() {
414
+ if (reading)
415
+ return;
416
+ reading = true;
417
+ reader.read().then(({ done, value }) => {
418
+ reading = false;
419
+ if (done)
420
+ this.push(null);
421
+ else
422
+ this.push(value);
423
+ }, (error) => {
424
+ reading = false;
425
+ this.destroy(error instanceof Error ? error : new Error(String(error)));
426
+ });
427
+ },
428
+ destroy(error, done) {
429
+ reader.cancel().then(() => done(error), () => done(error));
430
+ }
431
+ });
432
+ }
433
+ var REPORTED_SPAWN_CODES = new Set(["ENOENT", "EACCES", "EAGAIN", "EMFILE", "ENFILE"]);
434
+ function reportedSpawnFailure(cause) {
435
+ return typeof cause === "object" && cause !== null && "code" in cause && typeof cause.code === "string" && REPORTED_SPAWN_CODES.has(cause.code);
436
+ }
437
+ var waitClosed = (stream) => stream.closed ? Promise.resolve() : new Promise((resolve) => stream.once("close", () => resolve()));
438
+ function defineBunChildren() {
439
+
440
+ class BunProcess extends EventEmitter {
441
+ pipes;
442
+ pid;
443
+ exitCode = null;
444
+ signalCode = null;
445
+ #subprocess;
446
+ constructor(pipes) {
447
+ super();
448
+ this.pipes = pipes;
449
+ }
450
+ watch(subprocess) {
451
+ this.pid = subprocess.pid;
452
+ this.#subprocess = subprocess;
453
+ subprocess.exited.then(() => {
454
+ this.exitCode = subprocess.exitCode;
455
+ this.signalCode = subprocess.signalCode;
456
+ this.emit("exit", this.exitCode, this.signalCode);
457
+ for (const pipe of this.pipes)
458
+ if (pipe.readableFlowing === null)
459
+ pipe.resume();
460
+ this.closeAfterPipes();
461
+ });
462
+ }
463
+ fail(cause) {
464
+ for (const pipe of this.pipes)
465
+ pipe.resume();
466
+ setImmediate(() => {
467
+ this.emit("error", cause);
468
+ this.closeAfterPipes();
469
+ });
470
+ }
471
+ kill(signal) {
472
+ const subprocess = this.#subprocess;
473
+ if (!subprocess || this.exitCode !== null || this.signalCode !== null)
474
+ return false;
475
+ try {
476
+ subprocess.kill(signal);
477
+ return true;
478
+ } catch {
479
+ return false;
480
+ }
481
+ }
482
+ closeAfterPipes() {
483
+ Promise.all(this.pipes.map(waitClosed)).then(() => this.emit("close", this.exitCode, this.signalCode));
484
+ }
485
+ }
486
+
487
+ class BunChild extends BunProcess {
488
+ stdin;
489
+ stdout;
490
+ stderr;
491
+ constructor(stdin, stdout, stderr) {
492
+ super([stdout, stderr]);
493
+ this.stdin = stdin;
494
+ this.stdout = stdout;
495
+ this.stderr = stderr;
496
+ }
497
+ }
498
+ return { BunProcess, BunChild };
499
+ }
500
+ var bunChildren;
501
+ function children() {
502
+ bunChildren ??= defineBunChildren();
503
+ return bunChildren;
504
+ }
505
+ function sinkWritable(sink) {
506
+ let ended = false;
507
+ const end = () => {
508
+ if (ended)
509
+ return Promise.resolve(0);
510
+ ended = true;
511
+ return Promise.resolve().then(() => sink.end());
512
+ };
513
+ return new Writable({
514
+ write(chunk, _encoding, done) {
515
+ Promise.resolve().then(() => sink.write(chunk)).then(() => done(), done);
516
+ },
517
+ final(done) {
518
+ end().then(() => done(), done);
519
+ },
520
+ destroy(error, done) {
521
+ end().then(() => done(error), () => done(error));
522
+ }
523
+ });
524
+ }
525
+ function spawnBunChild(input) {
526
+ const { BunChild } = children();
527
+ try {
528
+ const subprocess = Bun.spawn([input.executable, ...input.args], {
529
+ cwd: input.cwd,
530
+ env: input.env,
531
+ detached: input.group,
532
+ stdin: "pipe",
533
+ stdout: "pipe",
534
+ stderr: "pipe"
535
+ });
536
+ const child = new BunChild(sinkWritable(subprocess.stdin), readableOf(subprocess.stdout), readableOf(subprocess.stderr));
537
+ child.watch(subprocess);
538
+ return child;
539
+ } catch (cause) {
540
+ if (!reportedSpawnFailure(cause))
541
+ throw cause;
542
+ const child = new BunChild(new Writable({ write: (_chunk, _encoding, done) => done() }), Readable.from([]), Readable.from([]));
543
+ child.fail(cause);
544
+ return child;
545
+ }
546
+ }
547
+ function spawnBunInheritedChild(input) {
548
+ const { BunProcess } = children();
549
+ const child = new BunProcess([]);
550
+ try {
551
+ child.watch(Bun.spawn([input.executable, ...input.args], {
552
+ cwd: input.cwd,
553
+ env: input.env,
554
+ detached: input.group,
555
+ stdin: "inherit",
556
+ stdout: "inherit",
557
+ stderr: "inherit"
558
+ }));
559
+ } catch (cause) {
560
+ if (!reportedSpawnFailure(cause))
561
+ throw cause;
562
+ child.fail(cause);
563
+ }
564
+ return child;
565
+ }
566
+
567
+ // src/process/owned-child.ts
402
568
  var groups = new WeakSet;
403
569
  function spawnOwnedCommand(input) {
404
- const child = spawn(input.executable, [...input.args], {
570
+ const child = hostIsBun() ? spawnBunChild(input) : nodeChild(input);
571
+ if (input.group)
572
+ groups.add(child);
573
+ return child;
574
+ }
575
+ function nodeChild(input) {
576
+ return spawn(input.executable, [...input.args], {
405
577
  cwd: input.cwd,
406
578
  env: input.env,
407
579
  detached: input.group,
408
580
  stdio: ["pipe", "pipe", "pipe"]
409
581
  });
410
- if (input.group)
411
- groups.add(child);
412
- return child;
413
582
  }
414
583
  var INHERITED_OUTPUT = {
415
584
  destroyed: true,
@@ -445,7 +614,7 @@ class InheritedChild {
445
614
  }
446
615
  }
447
616
  function spawnInheritedCommand(input) {
448
- const child = new InheritedChild(spawn(input.executable, [...input.args], {
617
+ const child = new InheritedChild(hostIsBun() ? spawnBunInheritedChild(input) : spawn(input.executable, [...input.args], {
449
618
  cwd: input.cwd,
450
619
  env: input.env,
451
620
  detached: input.group,
@@ -460,7 +629,7 @@ function ownsCommandGroup(child) {
460
629
  }
461
630
 
462
631
  // src/process/transport.ts
463
- import { Readable, Writable } from "node:stream";
632
+ import { Readable as Readable2, Writable as Writable2 } from "node:stream";
464
633
  function createCommandTransport(child) {
465
634
  const leader = Promise.withResolvers();
466
635
  const closed = Promise.withResolvers();
@@ -517,17 +686,17 @@ function createCommandTransport(child) {
517
686
  stderr = child.stderr;
518
687
  destructors.set("stderr", () => stderr?.destroy());
519
688
  const input = "stdin" in child ? child.stdin : undefined;
520
- if (input instanceof Writable) {
689
+ if (input instanceof Writable2) {
521
690
  stdin = input;
522
691
  pendingHandles.add("stdin");
523
692
  destructors.set("stdin", () => input.destroy());
524
693
  pipe("stdin", input);
525
694
  }
526
- if (stdout instanceof Readable)
695
+ if (stdout instanceof Readable2)
527
696
  pipe("stdout", stdout);
528
- if (stderr instanceof Readable)
697
+ if (stderr instanceof Readable2)
529
698
  pipe("stderr", stderr);
530
- if (stdout instanceof Readable && stderr instanceof Readable)
699
+ if (stdout instanceof Readable2 && stderr instanceof Readable2)
531
700
  release("launcher");
532
701
  return { stdout, stderr };
533
702
  },
@@ -545,7 +714,7 @@ function createCommandTransport(child) {
545
714
  child.stdout.destroy();
546
715
  else if (name === "stderr")
547
716
  child.stderr.destroy();
548
- else if ("stdin" in child && child.stdin instanceof Writable)
717
+ else if ("stdin" in child && child.stdin instanceof Writable2)
549
718
  child.stdin.destroy();
550
719
  } catch (cause) {
551
720
  failures.push(cause);
@@ -578,7 +747,7 @@ function nativeCommandOwner(child) {
578
747
  return owners.get(child);
579
748
  }
580
749
  function outputStream(source, closed, maxBufferedBytes) {
581
- if (source instanceof Readable2)
750
+ if (source instanceof Readable3)
582
751
  return {
583
752
  bytes: source,
584
753
  destroy() {
@@ -0,0 +1,38 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { Readable, Writable } from 'node:stream';
3
+ /** What a spawned command exposes to its owner: the subset of a Node child the package uses. */
4
+ export interface OwnedChild extends EventEmitter {
5
+ readonly pid?: number;
6
+ readonly exitCode: number | null;
7
+ readonly signalCode: NodeJS.Signals | null;
8
+ readonly stdin: Writable;
9
+ readonly stdout: Readable;
10
+ readonly stderr: Readable;
11
+ kill(signal: NodeJS.Signals): boolean;
12
+ }
13
+ /** A child spawned with the caller's stdio: it carries no pipes. */
14
+ export interface ObservableChild extends EventEmitter {
15
+ readonly pid?: number;
16
+ readonly exitCode: number | null;
17
+ readonly signalCode: NodeJS.Signals | null;
18
+ kill(signal: NodeJS.Signals): boolean;
19
+ }
20
+ interface BunSpawnInput {
21
+ executable: string;
22
+ args: readonly string[];
23
+ cwd?: string;
24
+ env?: NodeJS.ProcessEnv;
25
+ group: boolean;
26
+ }
27
+ /**
28
+ * Whether the host is Bun. Bun's `node:child_process` can lose a child's `exit` event under
29
+ * host load inside `bun test`; `Bun.spawn` observes the same exit reliably, so under Bun a
30
+ * command is launched through it and presented with the Node child's events and streams.
31
+ */
32
+ export declare function hostIsBun(): boolean;
33
+ /** `spawnOwnedCommand` for Bun: a command with piped stdio. */
34
+ export declare function spawnBunChild(input: BunSpawnInput): OwnedChild;
35
+ /** `spawnInheritedCommand` for Bun: a command with the caller's stdio. */
36
+ export declare function spawnBunInheritedChild(input: BunSpawnInput): ObservableChild;
37
+ export {};
38
+ //# sourceMappingURL=bun-child.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-child.d.ts","sourceRoot":"","sources":["../../src/process/bun-child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,gGAAgG;AAChG,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CACvC;AAED,oEAAoE;AACpE,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CACvC;AAED,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAoKD,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CA4B9D;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAmB5E"}
@@ -1,8 +1,8 @@
1
- import type { ChildProcessWithoutNullStreams } from 'node:child_process';
1
+ import type { OwnedChild } from './bun-child.js';
2
2
  import { type NativeCommandOptions } from './contract.js';
3
3
  import { type NativeCommandLaunchDriver } from './launch.js';
4
4
  /** One-shot native execution; sandbox policy/admission is composed above this owner. */
5
- export declare function startNativeCommand(input: NativeCommandOptions, onSpawn?: (child: ChildProcessWithoutNullStreams) => void, driver?: NativeCommandLaunchDriver): {
5
+ export declare function startNativeCommand(input: NativeCommandOptions, onSpawn?: (child: OwnedChild) => void, driver?: NativeCommandLaunchDriver): {
6
6
  result: Promise<{
7
7
  exitCode: number | null;
8
8
  signal: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAIzE,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAOlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,EACzD,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EAkKnC"}
1
+ {"version":3,"file":"command-owner.d.ts","sourceRoot":"","sources":["../../src/process/command-owner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,UAAU,CAAC;AAOlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EAkKnC"}
@@ -1,5 +1,5 @@
1
- import type { ChildProcessWithoutNullStreams } from 'node:child_process';
2
1
  import { Readable } from 'node:stream';
2
+ import type { OwnedChild } from './bun-child.js';
3
3
  import { type ParsedNativeCommandOptions } from './contract.js';
4
4
  import { type NativeCommandTransport } from './transport.js';
5
5
  /** A structural host launcher may supply pipes without importing Node ambient types. */
@@ -46,7 +46,7 @@ export declare function launchNativeCommand({ options, driver, onSpawn, onFailur
46
46
  options: ParsedNativeCommandOptions;
47
47
  driver: NativeCommandLaunchDriver | undefined;
48
48
  /** Called once the real child exists, when the command starts. */
49
- onSpawn?: (child: ChildProcessWithoutNullStreams) => void;
49
+ onSpawn?: (child: OwnedChild) => void;
50
50
  /** The process failed to start or reported an error. */
51
51
  onFailure: (error: Error) => void;
52
52
  /** Writing stdin failed for a reason other than a closed pipe. */
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/process/launch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAsB,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAElF,wFAAwF;AACxF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IACjC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC;IAC9D,EAAE,CACA,KAAK,EAAE,MAAM,GAAG,OAAO,EACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAC7D,OAAO,CA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CAAC;IAC9C,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,wDAAwD;IACxD,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,kEAAkE;IAClE,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,yEAAyE;IACzE,UAAU,EAAE,CAAC,SAAS,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDA"}
@@ -1,3 +1,4 @@
1
+ import { type OwnedChild } from './bun-child.js';
1
2
  import type { NativeCommandLaunchedProcess } from './launch.js';
2
3
  /** Only this native spawn can establish group ownership; structural PIDs cannot. */
3
4
  export declare function spawnOwnedCommand(input: {
@@ -6,7 +7,7 @@ export declare function spawnOwnedCommand(input: {
6
7
  cwd?: string;
7
8
  env?: NodeJS.ProcessEnv;
8
9
  group: boolean;
9
- }): import("node:child_process").ChildProcessWithoutNullStreams;
10
+ }): OwnedChild;
10
11
  /** The same ownership rule as {@link spawnOwnedCommand}, for a child that inherits stdio. */
11
12
  export declare function spawnInheritedCommand(input: {
12
13
  executable: string;
@@ -1 +1 @@
1
- {"version":3,"file":"owned-child.d.ts","sourceRoot":"","sources":["../../src/process/owned-child.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA+B,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAI1F,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,+DASA;AAmDD,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,4BAA4B,CAW/B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD"}
1
+ {"version":3,"file":"owned-child.d.ts","sourceRoot":"","sources":["../../src/process/owned-child.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAA+B,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAI1F,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,UAAU,CAIb;AAkED,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,4BAA4B,CAa/B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.108.0",
3
+ "version": "0.108.1",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",