stitchkit 0.103.11 → 0.103.12

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 (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  3. package/dist/agent-runtime/sandbox-process-owner.d.ts +1 -1
  4. package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
  5. package/dist/durability/json.d.ts.map +1 -1
  6. package/dist/entrypoints/agent-runtime/coding-tools.js +2 -2
  7. package/dist/entrypoints/agent-runtime/harness.js +2 -2
  8. package/dist/entrypoints/agent-runtime/sandbox.js +20 -16
  9. package/dist/entrypoints/agent-runtime.js +2 -2
  10. package/dist/entrypoints/application/diagnostic-journal.js +1 -1
  11. package/dist/entrypoints/files.js +1 -1
  12. package/dist/entrypoints/primitives.js +4 -3
  13. package/dist/entrypoints/process.js +1 -1
  14. package/dist/entrypoints/tools.js +1 -1
  15. package/dist/{index-ary5s7k0.js → index-69nvze1q.js} +1 -2
  16. package/dist/{index-g4jxe7ve.js → index-806d5phm.js} +3 -2
  17. package/dist/{index-32jkwkdm.js → index-f330qqyg.js} +253 -165
  18. package/dist/index-fm1c1a08.js +138 -0
  19. package/dist/{index-ttf0y7b8.js → index-xvdd2rbb.js} +37 -18
  20. package/dist/{index-9jb61j5a.js → index-zp4jpkp0.js} +1 -1
  21. package/dist/internal/exclusive-lock.d.ts +1 -1
  22. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  23. package/dist/internal/json-data.d.ts +8 -2
  24. package/dist/internal/json-data.d.ts.map +1 -1
  25. package/dist/internal/json-string-size.d.ts +3 -0
  26. package/dist/internal/json-string-size.d.ts.map +1 -0
  27. package/dist/primitives/canonical-json.d.ts.map +1 -1
  28. package/dist/process/cleanup.d.ts +12 -0
  29. package/dist/process/cleanup.d.ts.map +1 -0
  30. package/dist/process/command-lifetime.d.ts +19 -0
  31. package/dist/process/command-lifetime.d.ts.map +1 -0
  32. package/dist/process/command-owner.d.ts +0 -3
  33. package/dist/process/command-owner.d.ts.map +1 -1
  34. package/dist/process/group.d.ts.map +1 -1
  35. package/dist/process/launch.d.ts +15 -6
  36. package/dist/process/launch.d.ts.map +1 -1
  37. package/dist/process/owned-child.d.ts +10 -0
  38. package/dist/process/owned-child.d.ts.map +1 -0
  39. package/dist/process/start-failure.d.ts +2 -5
  40. package/dist/process/start-failure.d.ts.map +1 -1
  41. package/dist/process/transport.d.ts +30 -0
  42. package/dist/process/transport.d.ts.map +1 -0
  43. package/llms/agent-runtime-sandbox.txt +9 -1
  44. package/llms/process.txt +29 -4
  45. package/llms-full.txt +38 -5
  46. package/llms.txt +2 -2
  47. package/package.json +1 -1
  48. package/dist/index-c1jmtxa0.js +0 -74
package/CHANGELOG.md CHANGED
@@ -15,6 +15,25 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.103.12] - 2026-10-03
19
+
20
+ ### Fixed
21
+
22
+ - `stitchkit/primitives`: bounded canonical JSON serializes one admitted snapshot, preserving
23
+ historical key order and undefined handling while refusing unstable Proxy reads and oversized
24
+ escaped UTF-8 output before unbounded encoding. Durable JSON predicates avoid copying or encoding.
25
+ - `stitchkit/process`: post-spawn launch failures retain cleanup ownership; process-group cleanup
26
+ uses proven ownership and monotonic deadlines. Exclusive-lock stale guards have bounded depth.
27
+ - Direct sandbox launchers retain process-group cleanup through leader settlement.
28
+ - Release tooling requires every selected evidence job and remote exact-SHA push CI before tags;
29
+ CI covers the complete affected tree independently of which packages are published, preserving
30
+ package paths across renames and Unicode or control characters in filenames.
31
+ - Gate reuse includes tracked inputs matched by ignore rules, fingerprints only selected external
32
+ inputs, rechecks them after execution and serializes memo mutations. Memory admission reads exact
33
+ v1/v2 controller paths, including colons and trailing spaces; registry polling
34
+ bounds requests, bodies and waits with one elapsed deadline.
35
+
36
+
18
37
  ## [0.103.11] - 2026-10-02
19
38
 
20
39
  ### Added
@@ -1 +1 @@
1
- {"version":3,"file":"coding-shell-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-shell-process.ts"],"names":[],"mappings":"AAKA,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;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACrE;;;;;;;;;;;;;;;GAkKA"}
1
+ {"version":3,"file":"coding-shell-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-shell-process.ts"],"names":[],"mappings":"AAMA,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;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACrE;;;;;;;;;;;;;;;GAkKA"}
@@ -1,4 +1,4 @@
1
- import { type ChildProcessWithoutNullStreams } from 'node:child_process';
1
+ import type { ChildProcessWithoutNullStreams } from 'node:child_process';
2
2
  import type { AgentProcessSandbox } from './sandbox.js';
3
3
  /** All entry paths share one command admission limit and one shutdown barrier. */
4
4
  export declare function sandboxProcessOwner(assertActive: () => void, maximum: number): {
@@ -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;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"}
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,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM;;mBAiBrD,8BAA8B;;iBAmCrC,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;;EAmB7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/durability/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB,qCAS7B,CAAC"}
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/durability/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB,qCAQ7B,CAAC"}
@@ -7,8 +7,8 @@ import {
7
7
  AgentCodingToolAuthorizationSchema2,
8
8
  AgentCodingToolPathAuthorizationSchema2,
9
9
  createAgentCodingTools2
10
- } from "../../index-g4jxe7ve.js";
11
- import"../../index-32jkwkdm.js";
10
+ } from "../../index-806d5phm.js";
11
+ import"../../index-f330qqyg.js";
12
12
  import"../../index-ahvsksw5.js";
13
13
  import"../../index-tgzhq07n.js";
14
14
  export {
@@ -5,7 +5,7 @@ import"../../index-8kzct1d6.js";
5
5
  import {
6
6
  composeAgentPrompt2,
7
7
  createAgentRuntime2
8
- } from "../../index-9jb61j5a.js";
8
+ } from "../../index-zp4jpkp0.js";
9
9
  import"../../index-h97tqqp1.js";
10
10
  import"../../index-mnkk1ffz.js";
11
11
  import"../../index-n53mswt3.js";
@@ -15,7 +15,7 @@ import"../../index-9pw0a51a.js";
15
15
  import"../../index-ct75c3at.js";
16
16
  import"../../index-x87j7csh.js";
17
17
  import"../../index-m2xqkv55.js";
18
- import"../../index-ary5s7k0.js";
18
+ import"../../index-69nvze1q.js";
19
19
  import"../../index-nggfa2yn.js";
20
20
  import"../../index-r5hsgkz5.js";
21
21
  import"../../index-n5yqxd3d.js";
@@ -9,12 +9,13 @@ import"../../index-x87j7csh.js";
9
9
  import"../../index-b2bz0kdm.js";
10
10
  import {
11
11
  createAgentCodingTools2
12
- } from "../../index-g4jxe7ve.js";
12
+ } from "../../index-806d5phm.js";
13
13
  import {
14
14
  NativeCommandError2,
15
+ spawnOwnedCommand,
15
16
  nativeCommandOwner,
16
17
  startNativeCommand
17
- } from "../../index-32jkwkdm.js";
18
+ } from "../../index-f330qqyg.js";
18
19
  import"../../index-tgzhq07n.js";
19
20
 
20
21
  // src/agent-runtime/sandbox-bubblewrap.ts
@@ -540,7 +541,6 @@ function spawnSandboxProcess(executable, args, limits, options = {}, onSpawn) {
540
541
  }
541
542
 
542
543
  // src/agent-runtime/sandbox-process-owner.ts
543
- import { spawn } from "node:child_process";
544
544
  function sandboxProcessOwner(assertActive, maximum) {
545
545
  const children = new Map;
546
546
  const admit = () => {
@@ -548,7 +548,19 @@ function sandboxProcessOwner(assertActive, maximum) {
548
548
  if (children.size >= maximum)
549
549
  throw new SandboxError("SANDBOX_BUSY", "Sandbox command concurrency limit reached");
550
550
  };
551
+ const terminate = (child) => {
552
+ const owner = nativeCommandOwner(child) ?? startNativeCommand({ executable: "host-owned-command", signal: new AbortController().signal }, undefined, { launch: () => child, group: process.platform !== "win32", force: true });
553
+ return owner.terminate();
554
+ };
551
555
  const track = (child) => {
556
+ const settleDirect = () => {
557
+ if (!nativeCommandOwner(child))
558
+ terminate(child).catch(() => {
559
+ return;
560
+ });
561
+ };
562
+ child.once("exit", settleDirect);
563
+ child.once("error", settleDirect);
552
564
  const closed = new Promise((resolve, reject) => {
553
565
  child.once("close", () => {
554
566
  const settled = nativeCommandOwner(child)?.result ?? Promise.resolve();
@@ -578,11 +590,12 @@ function sandboxProcessOwner(assertActive, maximum) {
578
590
  },
579
591
  spawn(input) {
580
592
  admit();
581
- const child = spawn(input.executable, [...input.args], {
593
+ const child = spawnOwnedCommand({
594
+ executable: input.executable,
595
+ args: input.args,
582
596
  cwd: input.cwd,
583
597
  env: input.environment,
584
- detached: true,
585
- stdio: ["pipe", "pipe", "pipe"]
598
+ group: process.platform !== "win32"
586
599
  });
587
600
  child.stdin.end();
588
601
  track(child);
@@ -590,16 +603,7 @@ function sandboxProcessOwner(assertActive, maximum) {
590
603
  },
591
604
  async stop() {
592
605
  const pending = [...children];
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();
600
- }
601
- return owner.terminate();
602
- }));
606
+ await Promise.all(pending.map(([child]) => terminate(child)));
603
607
  await Promise.all(pending.map(([, closed]) => closed));
604
608
  }
605
609
  };
@@ -110,7 +110,7 @@ import {
110
110
  agentGoalStateSlot2,
111
111
  agentTodoStateSlot2,
112
112
  createAgentRuntime2
113
- } from "../index-9jb61j5a.js";
113
+ } from "../index-zp4jpkp0.js";
114
114
  import {
115
115
  AgentConversationSummarySchema2,
116
116
  AgentConversationPageSchema2,
@@ -175,7 +175,7 @@ import {
175
175
  StepAbortedError2,
176
176
  ParkRecordDecodeError2,
177
177
  ParkAbortedError2
178
- } from "../index-ary5s7k0.js";
178
+ } from "../index-69nvze1q.js";
179
179
  import {
180
180
  AgentSandboxRestrictionSchema2,
181
181
  AgentSandboxGradeSchema2,
@@ -16,7 +16,7 @@ import {
16
16
  } from "../../index-w0eqdhyd.js";
17
17
  import {
18
18
  attemptExclusiveLock
19
- } from "../../index-ttf0y7b8.js";
19
+ } from "../../index-xvdd2rbb.js";
20
20
  import"../../index-nybn2err.js";
21
21
  import {
22
22
  isRecord
@@ -11,7 +11,7 @@ import {
11
11
  } from "../index-n53mswt3.js";
12
12
  import {
13
13
  attemptExclusiveLock
14
- } from "../index-ttf0y7b8.js";
14
+ } from "../index-xvdd2rbb.js";
15
15
  import"../index-nybn2err.js";
16
16
  import {
17
17
  writeFileAtomic2,
@@ -3,7 +3,7 @@ import {
3
3
  } from "../index-xqhede6x.js";
4
4
  import {
5
5
  isJsonData
6
- } from "../index-c1jmtxa0.js";
6
+ } from "../index-fm1c1a08.js";
7
7
  import {
8
8
  serializeCanonicalJson
9
9
  } from "../index-zsvzhjtk.js";
@@ -91,9 +91,10 @@ var CanonicalJsonOptionsSchema = z3.strictObject({
91
91
  });
92
92
  function canonicalJson(value, options = {}) {
93
93
  const limits = CanonicalJsonOptionsSchema.parse(options);
94
- if (!isJsonData(value, { ...limits, omitObjectUndefined: true }))
94
+ const snapshot = {};
95
+ if (!isJsonData(value, { ...limits, omitObjectUndefined: true }, snapshot))
95
96
  throw new TypeError("Expected bounded plain JSON: dense arrays, finite numbers, no -0, cycles or accessors");
96
- return serializeCanonicalJson(value);
97
+ return serializeCanonicalJson(snapshot.value);
97
98
  }
98
99
  // src/primitives/deadline.ts
99
100
  import { z as z4 } from "zod";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  NativeCommandError2,
8
8
  startNativeCommand
9
- } from "../index-32jkwkdm.js";
9
+ } from "../index-f330qqyg.js";
10
10
  // src/process/command.ts
11
11
  function runNativeCommand(input) {
12
12
  return startNativeCommand(input).result;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EffectUnresolvedError2,
3
3
  createLocalStepDurability2
4
- } from "../index-ary5s7k0.js";
4
+ } from "../index-69nvze1q.js";
5
5
  import {
6
6
  AppError2,
7
7
  STITCH_ERROR_STATUS2
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isJsonData
3
- } from "./index-c1jmtxa0.js";
3
+ } from "./index-fm1c1a08.js";
4
4
  import {
5
5
  raceAbort
6
6
  } from "./index-mbnnw3f2.js";
@@ -103,7 +103,6 @@ import { z as z2 } from "zod";
103
103
  var DurableJsonSchema = z2.custom((value) => isJsonData(value, {
104
104
  maxDepth: 100,
105
105
  maxNodes: Number.MAX_SAFE_INTEGER,
106
- maxBytes: Number.MAX_SAFE_INTEGER,
107
106
  omitObjectUndefined: false
108
107
  }), "Expected lossless JSON data (finite numbers, plain objects and dense arrays; no accessors)");
109
108
 
@@ -5,8 +5,9 @@ import {
5
5
  import {
6
6
  NativeCommandError2,
7
7
  stopCommandGroup,
8
+ ownsCommandGroup,
8
9
  startNativeCommand
9
- } from "./index-32jkwkdm.js";
10
+ } from "./index-f330qqyg.js";
10
11
  import {
11
12
  probeAgentProcessSandbox2,
12
13
  missingSandboxRestrictions2,
@@ -1073,7 +1074,7 @@ async function runCodingShell(input) {
1073
1074
  return;
1074
1075
  exitCode = event.exitCode;
1075
1076
  signal = event.signal;
1076
- if (process.platform !== "win32")
1077
+ if (process.platform !== "win32" && child && ownsCommandGroup(child))
1077
1078
  await stopCommandGroup(child?.pid, 0, input.terminationGraceMs, true);
1078
1079
  }
1079
1080
  }, (started) => {