stitchkit 0.103.10 → 0.103.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  3. package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
  4. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
  5. package/dist/entrypoints/agent-runtime/coding-tools.js +2 -1
  6. package/dist/entrypoints/agent-runtime/sandbox.js +28 -14
  7. package/dist/entrypoints/application/diagnostic-journal.js +2 -2
  8. package/dist/entrypoints/files.js +8 -2
  9. package/dist/entrypoints/process.js +1 -1
  10. package/dist/index-32jkwkdm.js +565 -0
  11. package/dist/{index-a4ajxwmb.js → index-g4jxe7ve.js} +113 -131
  12. package/dist/{index-ga597cvy.js → index-ttf0y7b8.js} +85 -23
  13. package/dist/internal/exclusive-lock-read.d.ts +20 -0
  14. package/dist/internal/exclusive-lock-read.d.ts.map +1 -0
  15. package/dist/internal/exclusive-lock.d.ts +1 -0
  16. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  17. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  18. package/dist/process/command-owner.d.ts +7 -2
  19. package/dist/process/command-owner.d.ts.map +1 -1
  20. package/dist/process/contract.d.ts +12 -1
  21. package/dist/process/contract.d.ts.map +1 -1
  22. package/dist/process/group.d.ts +6 -1
  23. package/dist/process/group.d.ts.map +1 -1
  24. package/dist/process/launch.d.ts +65 -0
  25. package/dist/process/launch.d.ts.map +1 -0
  26. package/dist/process/leader-settlement.d.ts +2 -0
  27. package/dist/process/leader-settlement.d.ts.map +1 -1
  28. package/dist/process/start-failure.d.ts +7 -0
  29. package/dist/process/start-failure.d.ts.map +1 -0
  30. package/llms/agent-runtime.txt +7 -1
  31. package/llms/process.txt +42 -4
  32. package/llms-full.txt +49 -5
  33. package/llms.txt +2 -2
  34. package/package.json +2 -2
  35. package/dist/index-6m6a9ty4.js +0 -285
package/CHANGELOG.md CHANGED
@@ -15,6 +15,19 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.103.11] - 2026-10-02
19
+
20
+ ### Added
21
+
22
+ - `stitchkit/process`: native command limit errors expose a typed `reason` (`deadline` or `output-budget`) independent of their message; existing codes, causes, cancellation and cleanup guarantees are preserved.
23
+
24
+ ### Fixed
25
+
26
+ - `stitchkit/files`: cancellation after acquiring an exclusive lock refuses the callback and releases ownership. Lock and reclaim-guard records use bounded descriptor reads and refuse FIFO, nonregular, linked, oversized or changing records.
27
+ - `stitchkit/process`: synchronous native launch failures settle external resources once before rejecting, with bounded cleanup and the original syscall cause.
28
+ - `stitchkit/agent-runtime`: coding commands share the native execution owner while retaining forced descendant cleanup, structural sandbox launchers, bounded artifacts and UTF-8 previews.
29
+ - Local gate evidence is saved only for stable inputs, including content changed and restored during a run. PostgreSQL fingerprint probes have finite budgets and distinguish URI connection overrides; unknown external inputs cannot authorize heavy memo reuse. Heavy concurrency accounts for visible cgroup memory limits.
30
+
18
31
  ## [0.103.10] - 2026-10-01
19
32
 
20
33
  ### Added
@@ -1 +1 @@
1
- {"version":3,"file":"coding-shell-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-shell-process.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAqB,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAuCrD,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9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C,CAAC,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACrE;;;;;;;;;;;;;;;GAkKA"}
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-process-owner.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAS,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM;;mBAOrD,8BAA8B;;iBAerC,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;;EA0B7D"}
1
+ {"version":3,"file":"sandbox-process-owner.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/sandbox-process-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAS,MAAM,oBAAoB,CAAC;AAIhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM;;mBAOrD,8BAA8B;;iBA6BrC,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;;EAkC7D"}
@@ -133,11 +133,6 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
133
133
  parts: ({
134
134
  type: "text";
135
135
  text: string;
136
- } | {
137
- type: "file";
138
- mediaType: string;
139
- reference: string;
140
- filename?: string | undefined;
141
136
  } | {
142
137
  type: "reasoning";
143
138
  text: string;
@@ -146,6 +141,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
146
141
  provider: string;
147
142
  data: Record<string, import("zod").JSONType>;
148
143
  } | undefined;
144
+ } | {
145
+ type: "file";
146
+ mediaType: string;
147
+ reference: string;
148
+ filename?: string | undefined;
149
149
  } | {
150
150
  type: "source";
151
151
  sourceId: string;
@@ -313,11 +313,6 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
313
313
  parts: ({
314
314
  type: "text";
315
315
  text: string;
316
- } | {
317
- type: "file";
318
- mediaType: string;
319
- reference: string;
320
- filename?: string | undefined;
321
316
  } | {
322
317
  type: "reasoning";
323
318
  text: string;
@@ -326,6 +321,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
326
321
  provider: string;
327
322
  data: Record<string, import("zod").JSONType>;
328
323
  } | undefined;
324
+ } | {
325
+ type: "file";
326
+ mediaType: string;
327
+ reference: string;
328
+ filename?: string | undefined;
329
329
  } | {
330
330
  type: "source";
331
331
  sourceId: string;
@@ -7,7 +7,8 @@ import {
7
7
  AgentCodingToolAuthorizationSchema2,
8
8
  AgentCodingToolPathAuthorizationSchema2,
9
9
  createAgentCodingTools2
10
- } from "../../index-a4ajxwmb.js";
10
+ } from "../../index-g4jxe7ve.js";
11
+ import"../../index-32jkwkdm.js";
11
12
  import"../../index-ahvsksw5.js";
12
13
  import"../../index-tgzhq07n.js";
13
14
  export {
@@ -9,11 +9,12 @@ import"../../index-x87j7csh.js";
9
9
  import"../../index-b2bz0kdm.js";
10
10
  import {
11
11
  createAgentCodingTools2
12
- } from "../../index-a4ajxwmb.js";
12
+ } from "../../index-g4jxe7ve.js";
13
13
  import {
14
14
  NativeCommandError2,
15
+ nativeCommandOwner,
15
16
  startNativeCommand
16
- } from "../../index-6m6a9ty4.js";
17
+ } from "../../index-32jkwkdm.js";
17
18
  import"../../index-tgzhq07n.js";
18
19
 
19
20
  // src/agent-runtime/sandbox-bubblewrap.ts
@@ -548,12 +549,25 @@ function sandboxProcessOwner(assertActive, maximum) {
548
549
  throw new SandboxError("SANDBOX_BUSY", "Sandbox command concurrency limit reached");
549
550
  };
550
551
  const track = (child) => {
551
- const closed = new Promise((resolve) => {
552
+ const closed = new Promise((resolve, reject) => {
552
553
  child.once("close", () => {
553
- children.delete(child);
554
- resolve();
554
+ const settled = nativeCommandOwner(child)?.result ?? Promise.resolve();
555
+ settled.then(() => {
556
+ children.delete(child);
557
+ resolve();
558
+ }, (error) => {
559
+ if (error instanceof NativeCommandError2 && error.code === "COMMAND_CLEANUP")
560
+ reject(error);
561
+ else {
562
+ children.delete(child);
563
+ resolve();
564
+ }
565
+ });
555
566
  });
556
567
  });
568
+ closed.catch(() => {
569
+ return;
570
+ });
557
571
  children.set(child, closed);
558
572
  };
559
573
  return {
@@ -576,16 +590,16 @@ function sandboxProcessOwner(assertActive, maximum) {
576
590
  },
577
591
  async stop() {
578
592
  const pending = [...children];
579
- for (const [child] of pending) {
580
- if (child.pid === undefined)
581
- continue;
582
- try {
583
- process.kill(-child.pid, "SIGKILL");
584
- } catch (error) {
585
- if (!(error instanceof Error && ("code" in error) && error.code === "ESRCH"))
586
- throw error;
593
+ await Promise.all(pending.map(([child]) => {
594
+ let owner = nativeCommandOwner(child);
595
+ if (!owner) {
596
+ const adopted = startNativeCommand({ executable: "host-owned-command", signal: new AbortController().signal }, undefined, { launch: () => child, group: process.platform !== "win32", force: true });
597
+ owner = nativeCommandOwner(child);
598
+ if (!owner)
599
+ return adopted.stop();
587
600
  }
588
- }
601
+ return owner.terminate();
602
+ }));
589
603
  await Promise.all(pending.map(([, closed]) => closed));
590
604
  }
591
605
  };
@@ -14,10 +14,10 @@ import {
14
14
  import {
15
15
  createBoundedChannel2
16
16
  } from "../../index-w0eqdhyd.js";
17
- import"../../index-nybn2err.js";
18
17
  import {
19
18
  attemptExclusiveLock
20
- } from "../../index-ga597cvy.js";
19
+ } from "../../index-ttf0y7b8.js";
20
+ import"../../index-nybn2err.js";
21
21
  import {
22
22
  isRecord
23
23
  } from "../../index-9jfdm5tg.js";
@@ -9,10 +9,10 @@ import {
9
9
  import {
10
10
  AppError2
11
11
  } from "../index-n53mswt3.js";
12
- import"../index-nybn2err.js";
13
12
  import {
14
13
  attemptExclusiveLock
15
- } from "../index-ga597cvy.js";
14
+ } from "../index-ttf0y7b8.js";
15
+ import"../index-nybn2err.js";
16
16
  import {
17
17
  writeFileAtomic2,
18
18
  writeFileAtomicSync2
@@ -315,6 +315,7 @@ async function withExclusiveLock(path, run, options = {}) {
315
315
  const attempt = await attemptExclusiveLock(path, {
316
316
  mode,
317
317
  reclaim: true,
318
+ signal,
318
319
  ownerlessGraceMs,
319
320
  ...options.machineIdentity !== undefined && {
320
321
  machineIdentity: options.machineIdentity
@@ -324,6 +325,9 @@ async function withExclusiveLock(path, run, options = {}) {
324
325
  const { held } = attempt;
325
326
  let result;
326
327
  try {
328
+ if (signal?.aborted) {
329
+ throw new ExclusiveLockError("LOCK_ABORTED", label, null, `[stitchkit] waiting for the lock on "${label}" was cancelled`, { cause: signal.reason });
330
+ }
327
331
  result = await run({ path: held.path, owner: held.owner, reclaimed: held.reclaimed });
328
332
  } catch (error) {
329
333
  await held.release().catch(() => {
@@ -334,6 +338,8 @@ async function withExclusiveLock(path, run, options = {}) {
334
338
  await held.release();
335
339
  return result;
336
340
  }
341
+ if (signal?.aborted)
342
+ continue;
337
343
  const remaining = deadline - performance.now();
338
344
  if (remaining <= 0) {
339
345
  const holder = attempt.diagnosis?.owner ?? null;
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  NativeCommandError2,
8
8
  startNativeCommand
9
- } from "../index-6m6a9ty4.js";
9
+ } from "../index-32jkwkdm.js";
10
10
  // src/process/command.ts
11
11
  function runNativeCommand(input) {
12
12
  return startNativeCommand(input).result;