stitchkit 0.109.4 → 0.110.0

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 (58) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
  3. package/dist/application/process-lifecycle-transitions.d.ts +10 -2
  4. package/dist/application/process-lifecycle-transitions.d.ts.map +1 -1
  5. package/dist/browser/http.d.ts.map +1 -1
  6. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  7. package/dist/entrypoints/agent-runtime/harness.js +6 -6
  8. package/dist/entrypoints/agent-runtime/realtime.js +2 -2
  9. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  10. package/dist/entrypoints/agent-runtime.js +6 -6
  11. package/dist/entrypoints/application.js +16 -8
  12. package/dist/entrypoints/cli.js +7 -7
  13. package/dist/entrypoints/contract.js +1 -1
  14. package/dist/entrypoints/http.d.ts +5 -0
  15. package/dist/entrypoints/http.d.ts.map +1 -0
  16. package/dist/entrypoints/http.js +28 -0
  17. package/dist/entrypoints/index.js +8 -8
  18. package/dist/entrypoints/process/owner-loss.js +1 -1
  19. package/dist/entrypoints/process.js +2 -2
  20. package/dist/entrypoints/react.js +1 -1
  21. package/dist/entrypoints/remote.js +2 -2
  22. package/dist/entrypoints/server.js +3 -3
  23. package/dist/entrypoints/telegram/screens.js +3 -3
  24. package/dist/entrypoints/testing.js +2 -2
  25. package/dist/entrypoints/tools/invoker.js +3 -3
  26. package/dist/entrypoints/tools/mcp.js +4 -4
  27. package/dist/entrypoints/tools.js +9 -9
  28. package/dist/{index-tpk71wqn.js → index-064zxbwj.js} +1 -1
  29. package/dist/{index-68y3n9j3.js → index-2pevnh0x.js} +3 -3
  30. package/dist/{index-hjvje0pf.js → index-506kd458.js} +1 -1
  31. package/dist/{index-3wm2xp2a.js → index-61m15a18.js} +1 -1
  32. package/dist/{index-k3ty2b88.js → index-7a1xhhdx.js} +65 -10
  33. package/dist/{index-dj1aycxw.js → index-84bf5spd.js} +0 -1
  34. package/dist/{index-5cw390s6.js → index-dmfr2cg5.js} +3 -3
  35. package/dist/{index-x5xs71dw.js → index-fnra8n1j.js} +9 -9
  36. package/dist/{index-kc3jqqew.js → index-jyw90rps.js} +2 -2
  37. package/dist/{index-kvvpw1kq.js → index-mnhtbqrb.js} +2 -2
  38. package/dist/{index-00v1qz76.js → index-p6apg0jg.js} +1 -1
  39. package/dist/{index-ryv32myz.js → index-p6mvqcbq.js} +1 -1
  40. package/dist/{index-e32vy8jw.js → index-zgwkwr1g.js} +1 -1
  41. package/dist/process/command-owner.d.ts.map +1 -1
  42. package/dist/process/group-settlement.d.ts +5 -0
  43. package/dist/process/group-settlement.d.ts.map +1 -0
  44. package/dist/process/group.d.ts.map +1 -1
  45. package/dist/process/output-drain.d.ts +1 -1
  46. package/dist/process/output-drain.d.ts.map +1 -1
  47. package/dist/process/owner-loss-control.d.ts.map +1 -1
  48. package/llms/application.2.txt +8 -5
  49. package/llms/application.3.txt +3 -0
  50. package/llms/http.txt +19 -0
  51. package/llms/stitchkit.txt +4 -3
  52. package/llms/{upgrading-0.101.0-0.109.0.txt → upgrading-0.101.0-0.110.0.txt} +13 -3
  53. package/llms/upgrading.txt +1 -1
  54. package/llms-full.txt +35 -8
  55. package/llms.txt +4 -3
  56. package/package.json +5 -1
  57. /package/dist/{index-299sm5tr.js → index-616xh7f2.js} +0 -0
  58. /package/dist/{index-k4v2kq4q.js → index-73cz22ds.js} +0 -0
@@ -23,15 +23,15 @@ import {
23
23
  import {
24
24
  ToolExecutionControlError2,
25
25
  isToolExecutionControlError2
26
- } from "../index-k4v2kq4q.js";
26
+ } from "../index-73cz22ds.js";
27
27
  import {
28
28
  collectTools2
29
- } from "../index-ryv32myz.js";
29
+ } from "../index-p6mvqcbq.js";
30
30
  import {
31
31
  mountAgent2,
32
32
  describeToolCatalog2,
33
33
  buildToolManifest2
34
- } from "../index-68y3n9j3.js";
34
+ } from "../index-2pevnh0x.js";
35
35
  import"../index-m38ej7e5.js";
36
36
  import {
37
37
  ALL_TRANSPORTS2,
@@ -58,7 +58,7 @@ import {
58
58
  createMcpHttpRoute2,
59
59
  createStdioMcpServer2,
60
60
  bindStdioProcessSignals2
61
- } from "../index-x5xs71dw.js";
61
+ } from "../index-fnra8n1j.js";
62
62
  import {
63
63
  AsyncOperationCancelResultSchema2,
64
64
  createAsyncOperationSnapshotSchema2,
@@ -72,11 +72,14 @@ import {
72
72
  WaitTimeoutError,
73
73
  runWaitOperation,
74
74
  createCli2
75
- } from "../index-5cw390s6.js";
75
+ } from "../index-dmfr2cg5.js";
76
76
  import {
77
77
  ManagedFilePathSchema2,
78
78
  ManagedFileRefSchema2
79
79
  } from "../index-xqhede6x.js";
80
+ import {
81
+ createToolInvoker2
82
+ } from "../index-mnhtbqrb.js";
80
83
  import {
81
84
  ManagedFileError2
82
85
  } from "../index-9j2atjte.js";
@@ -96,7 +99,7 @@ import {
96
99
  import"../index-1bx1xv1k.js";
97
100
  import {
98
101
  collectToolSurface
99
- } from "../index-3wm2xp2a.js";
102
+ } from "../index-61m15a18.js";
100
103
  import {
101
104
  defineRuntimeTool2,
102
105
  createRuntimeToolFactory2
@@ -104,9 +107,6 @@ import {
104
107
  import {
105
108
  DEFAULT_CORS_ALLOW_HEADERS2
106
109
  } from "../index-yk4g8805.js";
107
- import {
108
- createToolInvoker2
109
- } from "../index-kvvpw1kq.js";
110
110
  import {
111
111
  getTraceId2
112
112
  } from "../index-y3nemndz.js";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  ToolExecutionControlError2,
16
16
  isToolExecutionControlError2
17
- } from "./index-k4v2kq4q.js";
17
+ } from "./index-73cz22ds.js";
18
18
  import {
19
19
  agentDurableEventId2
20
20
  } from "./index-mnkk1ffz.js";
@@ -2,18 +2,18 @@ import {
2
2
  toolResultFromError,
3
3
  toolCauseFromResult,
4
4
  isToolExecutionControlError2
5
- } from "./index-k4v2kq4q.js";
5
+ } from "./index-73cz22ds.js";
6
6
  import {
7
7
  createToolRunner,
8
8
  formatToolError
9
- } from "./index-ryv32myz.js";
9
+ } from "./index-p6mvqcbq.js";
10
10
  import {
11
11
  AgentToolError2,
12
12
  resolveToolDurability
13
13
  } from "./index-c17xcx4k.js";
14
14
  import {
15
15
  collectToolSurface
16
- } from "./index-3wm2xp2a.js";
16
+ } from "./index-61m15a18.js";
17
17
  import {
18
18
  agentPresenterOf
19
19
  } from "./index-636mggad.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-b0w7rbpt.js";
5
5
  import {
6
6
  createAgentRuntimeEventSink2
7
- } from "./index-299sm5tr.js";
7
+ } from "./index-616xh7f2.js";
8
8
  import {
9
9
  assertPositiveSafeInteger
10
10
  } from "./index-0s4xebbg.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-ryv32myz.js";
6
+ } from "./index-p6mvqcbq.js";
7
7
  import {
8
8
  runtimeToolMountable
9
9
  } from "./index-636mggad.js";
@@ -11,7 +11,7 @@ import {
11
11
  spawnBunChild,
12
12
  spawnBunInheritedChild,
13
13
  ownerLossGuardEntry
14
- } from "./index-dj1aycxw.js";
14
+ } from "./index-84bf5spd.js";
15
15
  import {
16
16
  raceAbort
17
17
  } from "./index-b0kddvzw.js";
@@ -23,6 +23,44 @@ import {
23
23
  assertPositiveSafeInteger
24
24
  } from "./index-0s4xebbg.js";
25
25
 
26
+ // src/process/group-settlement.ts
27
+ import { execFile } from "node:child_process";
28
+ function hasLiveGroupMember(table, group) {
29
+ for (const row of table.split(/\r?\n/)) {
30
+ if (!row.trim())
31
+ continue;
32
+ const fields = /^\s*(\d+)\s+(\S+)\s*$/.exec(row);
33
+ if (!fields)
34
+ throw new Error("Invalid process group observation");
35
+ if (Number(fields[1]) === group && !/^[ZX]/.test(fields[2] ?? ""))
36
+ return true;
37
+ }
38
+ return false;
39
+ }
40
+ function processGroups(timeoutMs) {
41
+ return new Promise((resolve, reject) => {
42
+ execFile("ps", ["-axo", "pgid=,stat="], { encoding: "utf8", timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: 1024 * 1024 }, (error, stdout) => {
43
+ if (error)
44
+ reject(new Error("Could not observe command process group settlement", { cause: error }));
45
+ else
46
+ resolve(stdout);
47
+ });
48
+ });
49
+ }
50
+ async function waitForProcessGroupExit(pid, deadline) {
51
+ if (pid === undefined)
52
+ return;
53
+ for (;; ) {
54
+ const remaining = Math.ceil(deadline - performance.now());
55
+ if (remaining <= 0)
56
+ throw new Error("Command process group remained alive after SIGKILL");
57
+ const table = await processGroups(remaining);
58
+ if (!hasLiveGroupMember(table, pid))
59
+ return;
60
+ await sleep(Math.min(5, Math.max(0, deadline - performance.now())));
61
+ }
62
+ }
63
+
26
64
  // src/process/group.ts
27
65
  function createCommandDeadline(timeoutMs, reason) {
28
66
  assertPositiveSafeInteger("Command deadline", timeoutMs, RangeError);
@@ -89,11 +127,18 @@ async function signalUntilSettled(pid, signal, deadline) {
89
127
  }
90
128
  }
91
129
  }
130
+ async function killAndSettleGroup(pid, deadline, cleanupTimeoutMs) {
131
+ const cleanupDeadline = Math.min(deadline, performance.now() + cleanupTimeoutMs);
132
+ const signalled = await signalUntilSettled(pid, "SIGKILL", cleanupDeadline);
133
+ if (signalled)
134
+ await waitForProcessGroupExit(pid, cleanupDeadline);
135
+ return signalled;
136
+ }
92
137
  async function stopCommandGroup(stop) {
93
138
  const { pid, policy } = stop;
94
139
  const deadline = performance.now() + policy.graceMs + stop.cleanupTimeoutMs;
95
140
  if (stop.force || policy.killOn?.aborted)
96
- return signalUntilSettled(pid, "SIGKILL", deadline);
141
+ return killAndSettleGroup(pid, deadline, stop.cleanupTimeoutMs);
97
142
  if (!await signalUntilSettled(pid, policy.signal, deadline))
98
143
  return false;
99
144
  const until = performance.now() + policy.graceMs;
@@ -110,7 +155,7 @@ async function stopCommandGroup(stop) {
110
155
  present = exists(pid);
111
156
  }
112
157
  if (present)
113
- await signalUntilSettled(pid, "SIGKILL", deadline);
158
+ await killAndSettleGroup(pid, deadline, stop.cleanupTimeoutMs);
114
159
  return true;
115
160
  }
116
161
  async function stopCommandLeader(stop) {
@@ -136,7 +181,7 @@ async function stopCommandLeader(stop) {
136
181
  policy.killOn?.removeEventListener("abort", end);
137
182
  grace.abort();
138
183
  }
139
- return await signalUntilSettled(pid, "SIGKILL", deadline) || signalled;
184
+ return await killAndSettleGroup(pid, deadline, stop.cleanupTimeoutMs) || signalled;
140
185
  }
141
186
  async function stopLeaderAlone(stop) {
142
187
  const { leader, policy } = stop;
@@ -676,8 +721,13 @@ function createLeaderSettlement(options, signal) {
676
721
  function createOutputDrain(options, signal) {
677
722
  const captured = { stdout: [], stderr: [] };
678
723
  let total = 0;
679
- const drain = async (stream, channel) => {
724
+ const drain = async (stream, channel, admitted) => {
725
+ let admission = admitted;
680
726
  for await (const chunk of stream) {
727
+ if (admission) {
728
+ await admission;
729
+ admission = undefined;
730
+ }
681
731
  if (signal.aborted)
682
732
  continue;
683
733
  if (!(chunk instanceof Uint8Array))
@@ -877,15 +927,19 @@ function startNativeCommand(input, onSpawn, driver) {
877
927
  throw commandCleanupError(cause);
878
928
  }
879
929
  };
930
+ const admitted = Promise.withResolvers();
880
931
  const run = (async () => {
881
932
  try {
882
- const pid = await raceAbort(launched.start(), controller.signal);
883
- if (pid !== undefined)
884
- options.onLeaderStarted?.({ pid });
933
+ const started = launched.start();
885
934
  const drains = Promise.all([
886
- output.drain(stdout, "stdout"),
887
- output.drain(stderr, "stderr")
935
+ output.drain(stdout, "stdout", admitted.promise),
936
+ output.drain(stderr, "stderr", admitted.promise)
888
937
  ]);
938
+ drains.catch((error) => controller.abort(error));
939
+ const pid = await raceAbort(started, controller.signal);
940
+ if (pid !== undefined)
941
+ options.onLeaderStarted?.({ pid });
942
+ admitted.resolve();
889
943
  await raceAbort(Promise.all([drains, leader.then(settleLeader)]), controller.signal);
890
944
  const status = await raceAbort(closed, controller.signal);
891
945
  if (spawnFailure !== undefined)
@@ -897,6 +951,7 @@ function startNativeCommand(input, onSpawn, driver) {
897
951
  };
898
952
  } catch (error) {
899
953
  controller.abort(error);
954
+ admitted.resolve();
900
955
  await cleanupNativeCommand({
901
956
  error,
902
957
  transport: acquired,
@@ -246,7 +246,6 @@ function attachOwnerLossControl(child, control) {
246
246
  control.once("end", onMissing);
247
247
  control.once("close", onMissing);
248
248
  control.once("error", onError);
249
- child.on("exit", onMissing);
250
249
  guards.set(child, { control, started: settled.promise });
251
250
  }
252
251
  function transferOwnerLossControl(source, target) {
@@ -18,11 +18,11 @@ import {
18
18
  import {
19
19
  toolResultFromError,
20
20
  toolErrorFromResult
21
- } from "./index-k4v2kq4q.js";
21
+ } from "./index-73cz22ds.js";
22
22
  import {
23
23
  createToolRunner,
24
24
  formatToolError
25
- } from "./index-ryv32myz.js";
25
+ } from "./index-p6mvqcbq.js";
26
26
  import {
27
27
  fetchGuarded,
28
28
  readCapped
@@ -35,7 +35,7 @@ import {
35
35
  } from "./index-eemvahkc.js";
36
36
  import {
37
37
  collectToolSurface
38
- } from "./index-3wm2xp2a.js";
38
+ } from "./index-61m15a18.js";
39
39
  import {
40
40
  formatZodError2
41
41
  } from "./index-1eeqpadm.js";
@@ -13,15 +13,18 @@ import {
13
13
  parseToolCallArguments,
14
14
  toolResultFromError,
15
15
  observed
16
- } from "./index-k4v2kq4q.js";
16
+ } from "./index-73cz22ds.js";
17
17
  import {
18
18
  collectTools2,
19
19
  createToolRunner,
20
20
  formatToolError
21
- } from "./index-ryv32myz.js";
21
+ } from "./index-p6mvqcbq.js";
22
+ import {
23
+ redact2
24
+ } from "./index-e6c2spsd.js";
22
25
  import {
23
26
  collectToolSurface
24
- } from "./index-3wm2xp2a.js";
27
+ } from "./index-61m15a18.js";
25
28
  import {
26
29
  DEFAULT_CORS_ALLOW_HEADERS2,
27
30
  DEFAULT_PROCESS_SIGNALS,
@@ -29,12 +32,6 @@ import {
29
32
  reportSignalError,
30
33
  guardSignalCallback
31
34
  } from "./index-yk4g8805.js";
32
- import {
33
- redact2
34
- } from "./index-e6c2spsd.js";
35
- import {
36
- argumentsDigest
37
- } from "./index-r7a7r7ha.js";
38
35
  import {
39
36
  runWithRequestContext2,
40
37
  getRequestContext2
@@ -42,6 +39,9 @@ import {
42
39
  import {
43
40
  AppError2
44
41
  } from "./index-j9gxbztg.js";
42
+ import {
43
+ argumentsDigest
44
+ } from "./index-r7a7r7ha.js";
45
45
  import {
46
46
  compareCodeUnits,
47
47
  serializeCanonicalJson
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-2kbysk9s.js";
4
4
  import {
5
5
  NativeCommandError2
6
- } from "./index-dj1aycxw.js";
6
+ } from "./index-84bf5spd.js";
7
7
  import {
8
8
  probeAgentProcessSandboxOutcome,
9
9
  missingSandboxRestrictions2,
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  CommandStopped,
16
16
  startNativeCommand
17
- } from "./index-k3ty2b88.js";
17
+ } from "./index-7a1xhhdx.js";
18
18
  import {
19
19
  NumericFileHandle,
20
20
  descriptorPath,
@@ -3,11 +3,11 @@ import {
3
3
  } from "./index-q6crhe1n.js";
4
4
  import {
5
5
  toolErrorFromResult
6
- } from "./index-k4v2kq4q.js";
6
+ } from "./index-73cz22ds.js";
7
7
  import {
8
8
  collectTools2,
9
9
  createToolRunner
10
- } from "./index-ryv32myz.js";
10
+ } from "./index-p6mvqcbq.js";
11
11
  import {
12
12
  AppError2
13
13
  } from "./index-j9gxbztg.js";
@@ -383,7 +383,7 @@ function shouldRetryBunNetworkError(error) {
383
383
  if (!(error instanceof Error))
384
384
  return;
385
385
  const code = Object.getOwnPropertyDescriptor(error, "code");
386
- return code && "value" in code && code.value === "ConnectionRefused" ? true : undefined;
386
+ return code && "value" in code && (code.value === "ConnectionRefused" || code.value === "ECONNREFUSED") ? true : undefined;
387
387
  }
388
388
  function parseApiErrorBody(body) {
389
389
  if (!isRecord(body) || !isRecord(body.error))
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  toolErrorFromResult,
9
9
  executeToolMethod
10
- } from "./index-k4v2kq4q.js";
10
+ } from "./index-73cz22ds.js";
11
11
  import {
12
12
  isRetryableStatus2
13
13
  } from "./index-j9gxbztg.js";
@@ -13,7 +13,7 @@ import {
13
13
  uploadProgressRoute,
14
14
  withUploadProgress,
15
15
  parseApiErrorBody
16
- } from "./index-00v1qz76.js";
16
+ } from "./index-p6apg0jg.js";
17
17
  import {
18
18
  abortReason,
19
19
  untilAborted
@@ -1 +1 @@
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;AAQlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EA8KnC"}
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;AAQlB,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,yBAAyB;;;;;;;;;;EAqLnC"}
@@ -0,0 +1,5 @@
1
+ /** `killpg(..., 0)` also sees Linux zombies; only live members can still perform work. */
2
+ export declare function hasLiveGroupMember(table: string, group: number): boolean;
3
+ /** A delivered SIGKILL is asynchronous; do not report cleanup until every group member is dead. */
4
+ export declare function waitForProcessGroupExit(pid: number | undefined, deadline: number): Promise<void>;
5
+ //# sourceMappingURL=group-settlement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-settlement.d.ts","sourceRoot":"","sources":["../../src/process/group-settlement.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQxE;AAmBD,mGAAmG;AACnG,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -1 +1 @@
1
- {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/process/group.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEpF,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAYpE,MAAM;IACN,MAAM;EAIT;AAeD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CASpF;AAoCD,sGAAsG;AACtG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,E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AAO,CAAC,CAAC,CAAC,CAMxF"}
@@ -4,7 +4,7 @@ import { type ParsedNativeCommandOptions } from './contract.js';
4
4
  * captured bytes per channel and the `onOutput` sink, all under the command's lifetime signal.
5
5
  */
6
6
  export declare function createOutputDrain(options: ParsedNativeCommandOptions, signal: AbortSignal): {
7
- drain: (stream: AsyncIterable<Uint8Array>, channel: 'stdout' | 'stderr') => Promise<void>;
7
+ drain: (stream: AsyncIterable<Uint8Array>, channel: 'stdout' | 'stderr', admitted?: Promise<void>) => Promise<void>;
8
8
  /** The captured bytes of each channel; empty unless `capture` was set. */
9
9
  captured: () => {
10
10
  stdout: Buffer<ArrayBuffer>;
@@ -1 +1 @@
1
- {"version":3,"file":"output-drain.d.ts","sourceRoot":"","sources":["../../src/process/output-drain.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,WAAW;oBAG3D,aAAa,CAAC,UAAU,CAAC,WAAW,QAAQ,GAAG,QAAQ;IA+BlF,0EAA0E;;QAExE,MAAM;QACN,MAAM;;EAGX"}
1
+ {"version":3,"file":"output-drain.d.ts","sourceRoot":"","sources":["../../src/process/output-drain.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,WAAW;oBAI9E,aAAa,CAAC,UAAU,CAAC,WACxB,QAAQ,GAAG,QAAQ,aACjB,OAAO,CAAC,IAAI,CAAC;IAuCxB,0EAA0E;;QAExE,MAAM;QACN,MAAM;;EAGX"}
@@ -1 +1 @@
1
- {"version":3,"file":"owner-loss-control.d.ts","sourceRoot":"","sources":["../../src/process/owner-loss-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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,IAAI,CAwDjF;AAED,gGAAgG;AAChG,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED,oGAAoG;AACpG,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAIxF"}
@@ -32,12 +32,13 @@ ever became ready:
32
32
  | newest run | same pid | version | `previousExit` | predecessor's `termination` |
33
33
  |---|---|---|---|---|
34
34
  | none | — | — | `first-boot` | — |
35
- | recorded `stoppedAt` | — | — | `clean` / `forced` / `startup-failed` / `abnormal` as recorded | unchanged |
35
+ | recorded `stoppedAt` | — | — | the recorded termination, including `interrupted` | unchanged |
36
36
  | still open | yes | — | `hot-reload` | `hot-reload`, closed at the new start |
37
37
  | still open | no | changed | `handoff` (default) | stays open; it records its own stop later |
38
- | still open | no | changed, `versionChangeOverlap: 'abnormal'` | `abnormal` / `startup-failed` | closed at the new start, as for the same version |
39
- | still open, was ready | no | same | `abnormal` (default) | `abnormal`, closed at the new start — an upper bound, the crash time is unknown |
40
- | still open, never ready | no | same | `startup-failed` (default) | `startup-failed`, closed at the new start |
38
+ | still open | no | changed, `versionChangeOverlap: 'abnormal'` | `interrupted` / `abnormal` / `startup-failed` | closed at the new start, as for the same version |
39
+ | still draining | no | same or non-overlapping build | `interrupted` | closed at the new start; its death time and kill signal are unknown |
40
+ | still active, was ready | no | same | `abnormal` (default) | `abnormal`, closed at the new start — an upper bound, the crash time is unknown |
41
+ | still active, never ready | no | same | `startup-failed` (default) | `startup-failed`, closed at the new start |
41
42
 
42
43
  Every other open run the start finds was abandoned too and is closed the same
43
44
  way — two crashes in a row leave two open runs, and both are closed, not only
@@ -66,10 +67,12 @@ The ledger records what the process says while it can say it. stitchkit never
66
67
  calls `process.exit` (ADR 0074), so a stop is recorded on the kernel's `close`
67
68
  or `force` path, both awaited. An application that exits the process on its
68
69
  own before its shutdown settles loses that last write; the successor then
69
- finds the run open and closes it as `abnormal`, keeping the `unavailableAt`
70
+ finds the unfinished drain and closes it as `interrupted`, keeping the `unavailableAt`
70
71
  already recorded — which is why the drain moment is written first, at
71
72
  `stopAdmission`, and the downtime survives a stop that was never recorded.
72
73
 
74
+ An abandoned `draining` run closes as `interrupted`, including before readiness. `StartFact.previousDrainUpperBoundMs` is the elapsed time from recorded admission stop to successor start, or `null` when unknown. This is an upper bound, not proof of a supervisor timeout or a particular kill signal. Live handoff predecessors remain open; same-pid restarts remain `hot-reload`.
75
+
73
76
  The `abnormal` default is a choice, and it is the single-process deployment:
74
77
  one process per build, a new pid of the same build means the old one stopped
75
78
  answering. Where processes of **one** build overlap on purpose — a cluster, a
@@ -14,6 +14,9 @@ Parts of this slice:
14
14
 
15
15
  ## `stitchkit/application`
16
16
 
17
+ `StartFact` also carries `previousDrainUpperBoundMs`: the time from a predecessor's recorded admission stop to this start when its exit is `interrupted`, otherwise `null`. This is an upper bound, and does not identify a kill signal or supervisor deadline.
18
+
19
+
17
20
  Server-only process-local application composition. See the
18
21
  [application kernel guide](../guide/application-kernel.md) and
19
22
  [architecture](../architecture/application-kernel.md). Complete consumer
package/llms/http.txt ADDED
@@ -0,0 +1,19 @@
1
+ # stitchkit/http — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/http` (docs/api/reference.md)
7
+
8
+ ==============================================================================
9
+ # API reference: `stitchkit/http` (docs/api/reference.md)
10
+ ==============================================================================
11
+
12
+ ## `stitchkit/http`
13
+
14
+ An HTTP-only entrypoint for browsers, React Native/Hermes and servers. It exports the same `createClient`, `createClients`, `createHttpClient`, URL builders, client configuration types and `ApiError` as the root, without loading its optional Socket.IO graph. Import shared contracts from `stitchkit/contract`.
15
+
16
+ ```ts
17
+ import { createClients, createHttpClient } from 'stitchkit/http';
18
+ import { defineContract } from 'stitchkit/contract';
19
+ ```
@@ -56,6 +56,7 @@ own, recorded as an ADR.
56
56
  | Import | Use in | Maturity | Holds |
57
57
  |--------|--------|----------|-------|
58
58
  | `stitchkit` | browser **and** server | stable | `defineContract`, `createClient`, `createHttpClient`, `createSocketIOClient`, `parseSSE`, the error model |
59
+ | `stitchkit/http` | browser, React Native/Hermes **and** server | evolving | typed HTTP client factories and `ApiError`, without optional realtime peers |
59
60
  | `stitchkit/contract` | browser **and** server | stable | the contract layer alone — `defineContract`, errors, pagination |
60
61
  | `stitchkit/live` | browser **and** server | evolving | `defineEvents` — topic declarations beside the operation contract — and watched reads: `createWatchClient`, the value/difference frame and its reassembly |
61
62
  | `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports |
@@ -83,12 +84,12 @@ own, recorded as an ADR.
83
84
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
84
85
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
85
86
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
86
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 54 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
87
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 55 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
87
88
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
88
89
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
89
90
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
90
91
  | `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
91
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 23 of the 54 minors since 0.56.2, most recently 0.105.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
92
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 23 of the 55 minors since 0.56.2, most recently 0.105.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
92
93
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
93
94
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
94
95
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -100,7 +101,7 @@ own, recorded as an ADR.
100
101
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
101
102
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
102
103
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
103
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 13 of the 54 minors since 0.56.2, most recently 0.105.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
104
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 55 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
104
105
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
105
106
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
106
107
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -1,14 +1,24 @@
1
- # Upgrading 0.101.0 → 0.109.0 — stitchkit docs slice
1
+ # Upgrading 0.101.0 → 0.110.0 — stitchkit docs slice
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
5
 
6
- Contains: Guide: Upgrading, 0.101.0 → 0.109.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.101.0 → 0.110.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.101.0 → 0.109.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.101.0 → 0.110.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.110.0
13
+
14
+ ### Interrupted process drains
15
+
16
+ **Who must act:** applications with exhaustive switches or schemas over `LifecycleTermination` or `PreviousExit` from `stitchkit/application`.
17
+
18
+ A successor that closes an abandoned `draining` run now reports `interrupted`, rather than `abnormal` (or `startup-failed` before readiness). Add an `interrupted` case for an unfinished shutdown. `abnormal` still describes an abandoned active run. Handoff and same-pid hot reload retain their meaning.
19
+
20
+ `StartFact.previousDrainUpperBoundMs` measures from recorded admission stop to successor start, or is `null` without those facts. It is an upper bound: the ledger does not observe the actual kill signal, supervisor deadline, or death time. Before: `previousExit === "abnormal"` included unfinished drains; after: handle `previousExit === "interrupted"` separately.
21
+
12
22
  ## Released migration: 0.109.0
13
23
 
14
24
  ### free CLI record leaves are lexical
@@ -11,7 +11,7 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
11
11
 
12
12
  Load this slice, then every range slice between your installed version and the target:
13
13
 
14
- - 0.101.0 → 0.109.0: `llms/upgrading-0.101.0-0.109.0.txt`
14
+ - 0.101.0 → 0.110.0: `llms/upgrading-0.101.0-0.110.0.txt`
15
15
  - 0.74.0 → 0.100.0: `llms/upgrading-0.74.0-0.100.0.txt`
16
16
  - 0.61.0 → 0.73.0: `llms/upgrading-0.61.0-0.73.0.txt`
17
17
  - 0.44.0 → 0.60.0: `llms/upgrading-0.44.0-0.60.0.txt`