stitchkit 0.69.0 → 0.70.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.
Files changed (59) hide show
  1. package/README.md +4 -4
  2. package/dist/agent-runtime/coding-tool-contract.d.ts +1 -0
  3. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
  5. package/dist/agent-runtime/coding-tool-paths.d.ts +1 -1
  6. package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
  7. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  8. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  9. package/dist/agent-runtime/contained-files.d.ts +52 -4
  10. package/dist/agent-runtime/contained-files.d.ts.map +1 -1
  11. package/dist/agent-runtime/harness-file-resources.d.ts.map +1 -1
  12. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  13. package/dist/agent-runtime-coding-tools.js +202 -145
  14. package/dist/agent-runtime-harness.js +12 -8
  15. package/dist/agent-runtime.js +9 -7
  16. package/dist/application/server-resource.d.ts +1 -0
  17. package/dist/application/server-resource.d.ts.map +1 -1
  18. package/dist/application.js +5 -2
  19. package/dist/cli.js +7 -6
  20. package/dist/{index-t4dpby6e.js → index-0yphgata.js} +1 -1
  21. package/dist/index-1z5xxfst.js +397 -0
  22. package/dist/index-3xnq72rz.js +21 -0
  23. package/dist/{index-444747ww.js → index-4g196jmf.js} +14 -9
  24. package/dist/{index-kg9xx84n.js → index-7rey2b8s.js} +1 -1
  25. package/dist/{index-dk6e56g0.js → index-7wpgrqa8.js} +37 -2
  26. package/dist/{index-zh459sfj.js → index-aczggrty.js} +1 -1
  27. package/dist/index-bd17ytae.js +192 -0
  28. package/dist/{index-q7gdep2c.js → index-da1aqnhb.js} +2 -2
  29. package/dist/{index-p1be103g.js → index-ktsps64f.js} +4 -2
  30. package/dist/{index-mbxds404.js → index-mjx0wt4c.js} +8 -6
  31. package/dist/{index-h8vn1jcr.js → index-qzbg46b6.js} +6 -4
  32. package/dist/{index-h7ctj1kp.js → index-s8nt8c22.js} +14 -11
  33. package/dist/{index-d1jsvkyk.js → index-vbf2p6me.js} +1 -1
  34. package/dist/{index-xxsq3ca1.js → index-vc498pst.js} +1 -1
  35. package/dist/{index-x18ndp4p.js → index-vj3vvpaa.js} +1 -192
  36. package/dist/{index-3eqrkqhg.js → index-vy5bjy07.js} +7 -3
  37. package/dist/{index-6wzr93cg.js → index-w0445741.js} +1 -1
  38. package/dist/{index-kxxyvkka.js → index-wc80at9n.js} +2 -2
  39. package/dist/{index-gqdfpv4n.js → index-y3w12g8d.js} +2 -2
  40. package/dist/node.js +26 -5
  41. package/dist/observability/index.js +4 -3
  42. package/dist/remote.js +4 -3
  43. package/dist/server/bun.d.ts.map +1 -1
  44. package/dist/server/index.js +20 -10
  45. package/dist/server/node.d.ts.map +1 -1
  46. package/dist/server/process-signals.d.ts.map +1 -1
  47. package/dist/server/shutdown.d.ts +2 -0
  48. package/dist/server/shutdown.d.ts.map +1 -1
  49. package/dist/testing.js +6 -5
  50. package/dist/tool-invoker.js +6 -5
  51. package/dist/tools/agent-tool-error.d.ts +14 -0
  52. package/dist/tools/agent-tool-error.d.ts.map +1 -0
  53. package/dist/tools/agent.d.ts.map +1 -1
  54. package/dist/tools.js +15 -12
  55. package/llms-full.txt +73 -22
  56. package/native/darwin-arm64.node +0 -0
  57. package/native/darwin-x64.node +0 -0
  58. package/package.json +3 -1
  59. package/dist/index-v3dpzpjw.js +0 -92
@@ -10,7 +10,7 @@ import {
10
10
  redact,
11
11
  sanitizePayload,
12
12
  truncatePreview
13
- } from "../index-zh459sfj.js";
13
+ } from "../index-aczggrty.js";
14
14
  import {
15
15
  getRequestContext,
16
16
  getTraceId,
@@ -21,7 +21,7 @@ import {
21
21
  setRequestError,
22
22
  setRequestUser,
23
23
  wrapInRequestContext
24
- } from "../index-p1be103g.js";
24
+ } from "../index-ktsps64f.js";
25
25
  import {
26
26
  childSpan,
27
27
  createTraceContext,
@@ -30,7 +30,8 @@ import {
30
30
  recordedErrorMessage,
31
31
  resolvePropagationContext,
32
32
  resolveTraceContext
33
- } from "../index-x18ndp4p.js";
33
+ } from "../index-bd17ytae.js";
34
+ import"../index-vj3vvpaa.js";
34
35
  import"../index-0w9abg87.js";
35
36
  import {
36
37
  isRecord
package/dist/remote.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  ApiError,
3
3
  createClient
4
- } from "./index-kxxyvkka.js";
5
- import"./index-t4dpby6e.js";
4
+ } from "./index-wc80at9n.js";
5
+ import"./index-0yphgata.js";
6
+ import"./index-bd17ytae.js";
6
7
  import {
7
8
  mergeMeta
8
- } from "./index-x18ndp4p.js";
9
+ } from "./index-vj3vvpaa.js";
9
10
  import {
10
11
  AppError
11
12
  } from "./index-0w9abg87.js";
@@ -1 +1 @@
1
- {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/server/bun.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC9C,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,aAAa,C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AAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,iGAAiG;IACjG,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAyD7D,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAoMrE"}
@@ -13,7 +13,7 @@ import {
13
13
  sseRoute,
14
14
  streamingRoute,
15
15
  webSocketLane
16
- } from "../index-444747ww.js";
16
+ } from "../index-4g196jmf.js";
17
17
  import {
18
18
  composeAuthHooks,
19
19
  createAuthHook,
@@ -26,7 +26,7 @@ import {
26
26
  signJwt,
27
27
  verifyJwt,
28
28
  verifyPkce
29
- } from "../index-q7gdep2c.js";
29
+ } from "../index-da1aqnhb.js";
30
30
  import {
31
31
  DEFAULT_CORS_ALLOW_HEADERS,
32
32
  DEFAULT_CORS_EXPOSE_HEADERS,
@@ -40,7 +40,7 @@ import {
40
40
  defineMultipartStream,
41
41
  implement,
42
42
  implementRegistry
43
- } from "../index-d1jsvkyk.js";
43
+ } from "../index-vbf2p6me.js";
44
44
  import {
45
45
  extractIp,
46
46
  generateTraceId,
@@ -48,7 +48,7 @@ import {
48
48
  getTraceId,
49
49
  resolveSocketIp,
50
50
  resolveTraceId
51
- } from "../index-p1be103g.js";
51
+ } from "../index-ktsps64f.js";
52
52
  import {
53
53
  isWithinDir,
54
54
  realPathWithinDir
@@ -60,7 +60,7 @@ import {
60
60
  ShutdownStateSchema,
61
61
  ShutdownStatusSchema,
62
62
  createServerLifecycle
63
- } from "../index-dk6e56g0.js";
63
+ } from "../index-7wpgrqa8.js";
64
64
  import {
65
65
  jsonSchemaFields,
66
66
  toJsonSchema
@@ -69,16 +69,18 @@ import {
69
69
  inputIsQuery,
70
70
  parseSSE,
71
71
  streamSSE
72
- } from "../index-t4dpby6e.js";
72
+ } from "../index-0yphgata.js";
73
73
  import {
74
- DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
75
74
  errorCode,
76
75
  formatZodError,
77
- joinRoutePath,
78
76
  normalizeError,
79
- parseTrailingWildcard,
80
77
  zodIssues
81
- } from "../index-x18ndp4p.js";
78
+ } from "../index-bd17ytae.js";
79
+ import {
80
+ DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
81
+ joinRoutePath,
82
+ parseTrailingWildcard
83
+ } from "../index-vj3vvpaa.js";
82
84
  import {
83
85
  AppError,
84
86
  STITCH_ERROR_STATUS,
@@ -197,6 +199,14 @@ function createServer(config) {
197
199
  ws.close(1001, "Server shutting down");
198
200
  await Promise.all([logicalClose, waitForSocketDrain()]);
199
201
  },
202
+ async terminateRealtime() {
203
+ const count = openSockets.size;
204
+ const physicalClose = waitForSocketDrain();
205
+ for (const ws of [...openSockets])
206
+ ws.terminate();
207
+ await physicalClose;
208
+ return count;
209
+ },
200
210
  async stopGracefully() {
201
211
  await new Promise((resolve) => setTimeout(resolve, 0));
202
212
  const server2 = requireRuntime();
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/server/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAkB,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,aAAa,IAAI,IA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AK,IAAI,CAAC;IACpF;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,qBAAqB,CAAC,OAAO,GAAG,cAAc;IAC7D;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/C,wCAAwC;IACxC,KAAK,IAAI,IAAI,CAAC;CACf;AAUD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAG,cAAc,EACzD,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,EAC/B,OAAO,GAAE,qBAAqB,CAAC,OAAO,CAAM,GAC3C,qBAAqB,CAAC,OAAO,CAAC,CAwKhC"}
@@ -11,6 +11,7 @@ export declare const ShutdownStateSchema: z.ZodEnum<{
11
11
  export type ShutdownState = z.infer<typeof ShutdownStateSchema>;
12
12
  export declare const ShutdownOptionsSchema: z.ZodObject<{
13
13
  gracePeriodMs: z.ZodDefault<z.ZodNumber>;
14
+ realtimeCloseTimeoutMs: z.ZodDefault<z.ZodNumber>;
14
15
  forceTimeoutMs: z.ZodDefault<z.ZodNumber>;
15
16
  retryAfterSeconds: z.ZodDefault<z.ZodNumber>;
16
17
  signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
@@ -64,6 +65,7 @@ export interface ShutdownAdapter {
64
65
  pendingRequests(): number;
65
66
  pendingWebSockets(): number;
66
67
  closeRealtime(): Promise<void>;
68
+ terminateRealtime(): Promise<number>;
67
69
  stopGracefully(): Promise<void>;
68
70
  forceStop(): Promise<void>;
69
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../src/server/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS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e,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,eAAe,IAAI,MAAM,CAAC;IAC1B,iBAAiB,IAAI,MAAM,CAAC;IAC5B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,UAAU,eAAe;IACvB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1E,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D;AAoFD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,eAAe,GAAG,eAAe,CAiKxF"}
package/dist/testing.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-x1th9s8c.js";
5
5
  import {
6
6
  createApplication
7
- } from "./index-6wzr93cg.js";
7
+ } from "./index-w0445741.js";
8
8
  import"./index-2k4yrqkc.js";
9
9
  import"./index-8eywc9zv.js";
10
10
  import {
@@ -12,7 +12,7 @@ import {
12
12
  RealtimeRequestInvalidAcknowledgementError,
13
13
  RealtimeRequestTimeoutError
14
14
  } from "./index-7b188kmz.js";
15
- import"./index-dk6e56g0.js";
15
+ import"./index-7wpgrqa8.js";
16
16
  import {
17
17
  mcpProjectionCandidate,
18
18
  prepareProjectedMcpTools,
@@ -24,11 +24,12 @@ import {
24
24
  import {
25
25
  createClient,
26
26
  createClients
27
- } from "./index-kxxyvkka.js";
28
- import"./index-t4dpby6e.js";
27
+ } from "./index-wc80at9n.js";
28
+ import"./index-0yphgata.js";
29
+ import"./index-bd17ytae.js";
29
30
  import {
30
31
  joinRoutePath
31
- } from "./index-x18ndp4p.js";
32
+ } from "./index-vj3vvpaa.js";
32
33
  import"./index-0w9abg87.js";
33
34
  import {
34
35
  isRecord
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  createToolInvoker
3
- } from "./index-gqdfpv4n.js";
4
- import"./index-kg9xx84n.js";
5
- import"./index-h8vn1jcr.js";
6
- import"./index-p1be103g.js";
3
+ } from "./index-y3w12g8d.js";
4
+ import"./index-7rey2b8s.js";
5
+ import"./index-qzbg46b6.js";
6
+ import"./index-ktsps64f.js";
7
7
  import"./index-22by16v6.js";
8
8
  import"./index-cby4ar3v.js";
9
- import"./index-x18ndp4p.js";
9
+ import"./index-bd17ytae.js";
10
+ import"./index-vj3vvpaa.js";
10
11
  import"./index-0w9abg87.js";
11
12
  import"./index-qyrqwr4c.js";
12
13
  import"./index-6k1937bx.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A mounted tool failed with a model-safe, transport-shaped error envelope.
3
+ *
4
+ * The AI SDK must observe a throw so it emits `tool-error`; returning this
5
+ * envelope would incorrectly mark the call successful. The original cause is
6
+ * retained for local observability while `message` contains only the safe
7
+ * envelope that may be sent to the model provider.
8
+ */
9
+ export declare class AgentToolError extends Error {
10
+ readonly output: Record<string, unknown>;
11
+ constructor(output: Record<string, unknown>, cause?: unknown);
12
+ }
13
+ export declare function isAgentToolError(value: unknown): value is AgentToolError;
14
+ //# sourceMappingURL=agent-tool-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tool-error.d.ts","sourceRoot":"","sources":["../../src/tools/agent-tool-error.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhD,YAAY,MAAM,EAAE,MAAM,C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
2
2
  redact
3
- } from "./index-zh459sfj.js";
3
+ } from "./index-aczggrty.js";
4
4
  import {
5
5
  buildToolManifest,
6
6
  mountAgent
7
- } from "./index-h7ctj1kp.js";
7
+ } from "./index-s8nt8c22.js";
8
+ import"./index-3xnq72rz.js";
8
9
  import {
9
10
  signJwt,
10
11
  verifyPkce
11
- } from "./index-q7gdep2c.js";
12
+ } from "./index-da1aqnhb.js";
12
13
  import {
13
14
  DEFAULT_CORS_ALLOW_HEADERS,
14
15
  DEFAULT_PROCESS_SIGNALS,
@@ -16,10 +17,10 @@ import {
16
17
  defaultSignalSource,
17
18
  guardSignalCallback,
18
19
  reportSignalError
19
- } from "./index-d1jsvkyk.js";
20
+ } from "./index-vbf2p6me.js";
20
21
  import {
21
22
  createToolInvoker
22
- } from "./index-gqdfpv4n.js";
23
+ } from "./index-y3w12g8d.js";
23
24
  import {
24
25
  WaitTimeoutError,
25
26
  createCli,
@@ -28,10 +29,10 @@ import {
28
29
  fetchPinnedDocument,
29
30
  readCapped,
30
31
  runWaitOperation
31
- } from "./index-mbxds404.js";
32
+ } from "./index-mjx0wt4c.js";
32
33
  import {
33
34
  collectToolSurface
34
- } from "./index-xxsq3ca1.js";
35
+ } from "./index-vc498pst.js";
35
36
  import {
36
37
  createRuntimeToolFactory,
37
38
  defineRuntimeTool
@@ -40,19 +41,19 @@ import {
40
41
  collectTools,
41
42
  createToolRunner,
42
43
  formatToolError
43
- } from "./index-kg9xx84n.js";
44
+ } from "./index-7rey2b8s.js";
44
45
  import {
45
46
  ToolExecutionControlError,
46
47
  coerceJsonArgs,
47
48
  executeToolMethod,
48
49
  isToolExecutionControlError,
49
50
  toolResultFromError
50
- } from "./index-h8vn1jcr.js";
51
+ } from "./index-qzbg46b6.js";
51
52
  import {
52
53
  getRequestContext,
53
54
  getTraceId,
54
55
  runWithRequestContext
55
- } from "./index-p1be103g.js";
56
+ } from "./index-ktsps64f.js";
56
57
  import {
57
58
  ManagedFileError
58
59
  } from "./index-bfcpjw20.js";
@@ -70,10 +71,12 @@ import {
70
71
  } from "./index-22by16v6.js";
71
72
  import"./index-cby4ar3v.js";
72
73
  import {
73
- defineContract,
74
74
  normalizeError,
75
75
  resolvePropagationContext
76
- } from "./index-x18ndp4p.js";
76
+ } from "./index-bd17ytae.js";
77
+ import {
78
+ defineContract
79
+ } from "./index-vj3vvpaa.js";
77
80
  import {
78
81
  AppError,
79
82
  STITCH_ERROR_STATUS
package/llms-full.txt CHANGED
@@ -59,15 +59,15 @@ own, recorded as an ADR.
59
59
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the store and managed-resource conformance kits |
60
60
  | `stitchkit/declaration` | build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
61
61
  | `stitchkit/react` | browser | stable | `createCursorQuery`, `createCacheBridge` |
62
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 10 of the 14 minors since 0.56.2, most recently 0.69.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
62
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 10 of the 15 minors since 0.56.2, most recently 0.69.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
63
63
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
64
64
  | `stitchkit/agent-runtime/coding-tools` | server (Bun or Node) | evolving | bounded host-authorized direct file and shell tools; a root boundary, not an OS sandbox |
65
65
  | `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
66
66
  | `stitchkit/agent-runtime/browser` | browser + server | evolving | canonical agent records, events and reconnect cursor without execution or sinks |
67
67
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
68
68
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
69
- | `@stitchkit/tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
70
- | `stitchkit/application` | server | evolving<br>_redefined in 3 of the 14 minors since 0.56.2, most recently 0.67.0_ | managed resource graph, readiness, admission, schedules and bounded shutdown |
69
+ | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
70
+ | `stitchkit/application` | server | evolving<br>_redefined in 3 of the 15 minors since 0.56.2, most recently 0.67.0_ | managed resource graph, readiness, admission, schedules and bounded shutdown |
71
71
  | `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
72
72
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
73
73
 
@@ -224,7 +224,7 @@ set `OPENROUTER_API_KEY`, then run `bun run dev` and choose a live tool-capable
224
224
  model with `/model`. The provider catalog owns the exact model id and context window and presents
225
225
  weekly popularity separately from sourced benchmark observations; `OPENROUTER_MODEL` is only an
226
226
  optional preferred row. That profile is a thin `stitchkit.agent.ts` composition over the official
227
- `@stitchkit/tui` package and canonical headless harness:
227
+ `stitchkit-tui` package and canonical headless harness:
228
228
  durable SQLite history, lazy skills, direct coding tools, approval continuations
229
229
  and recovery stay framework-owned primitives, while model choice, permissions,
230
230
  executables and OS isolation remain application policy.
@@ -953,21 +953,26 @@ const server = createServer({ services, socket })
953
953
 
954
954
  const result = await server.shutdown({
955
955
  gracePeriodMs: 30_000,
956
+ realtimeCloseTimeoutMs: 1_000,
956
957
  forceTimeoutMs: 5_000,
957
958
  retryAfterSeconds: 5,
958
959
  signal: shutdownController.signal,
959
960
  })
960
961
  ```
961
962
 
962
- The first call closes HTTP and Socket.IO admission, then gives the complete
963
- graceful request/realtime/runtime chain one `gracePeriodMs` budget. If that
964
- budget or the external signal forces destructive teardown, `forceTimeoutMs`
965
- bounds physical completion separately. Repeated calls return the same Promise;
963
+ The first call closes HTTP and Socket.IO admission, then gives admitted HTTP/application work the
964
+ full `gracePeriodMs` budget. Once that work drains, `realtimeCloseTimeoutMs` (default `1_000`)
965
+ bounds WebSocket close handshakes inside the same outer deadline. Any upgraded sockets still open
966
+ at that boundary are terminated without shortening HTTP grace, and graceful runtime shutdown
967
+ continues. If the outer grace budget or external signal forces destructive teardown,
968
+ `forceTimeoutMs` bounds physical completion separately. Repeated calls return the same Promise;
966
969
  the first options win. New
967
970
  ordinary HTTP work receives `503`, `Retry-After` and `Connection: close` outside
968
971
  `wrapFetch`. `result.outcome` is `clean` or `forced`; a forced result preserves
969
972
  the pending snapshot and reason while final pending counters describe the
970
- post-close transport state. A graceful phase error still runs forced cleanup and
973
+ post-close transport state. `forcedWebSockets` counts both sockets terminated at the dedicated
974
+ realtime bound and sockets terminated by outer force; `pendingWebSocketsAtForce` is only the latter
975
+ snapshot, so a clean result can truthfully report a bounded realtime termination. A graceful phase error still runs forced cleanup and
971
976
  then rejects with the original error; a forced transport that cannot confirm
972
977
  completion before `forceTimeoutMs` rejects instead of reporting a false zero.
973
978
  `runtime` is a diagnostics escape hatch, not a second canonical stop path.
@@ -4066,8 +4071,15 @@ cross-crash exactly-once guarantee remain application concerns.
4066
4071
  `stitchkit/agent-runtime/coding-tools` returns ordinary direct runtime tools named `read_file`,
4067
4072
  `write_file`, `search_files`, `apply_patch`, `run_command` and optional `read_output`. Every call passes a
4068
4073
  required host authorization callback. File paths are relative, bounded and contained after
4069
- realpath resolution; writes/edits reject symlink targets, content is strict UTF-8 and retained
4070
- bytes are finite. Shell accepts a finite alias mapped by the host to an absolute executable plus an
4074
+ descriptor-relative resolution: each ancestor is opened without following symlinks and remains
4075
+ pinned through authorization and the filesystem effect. Reads revalidate the pinned file identity;
4076
+ writes and patches revalidate the pinned parent identity; search and resource discovery descend
4077
+ only through opened directories. Linux traverses `/proc/self/fd`; macOS uses the package's
4078
+ architecture-specific Node-API `openat` backend. Unsupported platforms, including FreeBSD until a
4079
+ real backend is qualified, fail closed. The package needs no install-time compiler or script.
4080
+ Other platforms fail these filesystem operations closed because Node exposes no equivalent
4081
+ portable directory-handle-relative API. Writes/edits reject symlink targets, content is strict
4082
+ UTF-8 and retained bytes are finite. Shell accepts a finite alias mapped by the host to an absolute executable plus an
4071
4083
  argument array — never a shell command string — and uses only the explicitly supplied environment.
4072
4084
  Arguments, output and time are bounded, while cancellation terminates the child. The configured
4073
4085
  root and cwd are path boundaries, not a security sandbox: isolate the process when an executable
@@ -4080,9 +4092,19 @@ multi-file atomicity. With an optional `AgentCodingArtifactStore`, shell output
4080
4092
  preview continues into an opaque bounded artifact and `read_output` reads slices without
4081
4093
  exposing a host path. Without a store, the previous finite output-limit behavior is unchanged.
4082
4094
 
4095
+ `run_command` treats every invocation as finite. `shellTimeoutMs` bounds normal execution and
4096
+ `shellTerminationGraceMs` bounds settlement after timeout, caller cancellation, output overflow or
4097
+ parent exit. POSIX hosts launch a dedicated process group and kill every descendant remaining in
4098
+ that group; a process that deliberately escapes the group is outside the guarantee. Node's
4099
+ portable Windows child-process API cannot kill a complete descendant tree without invoking a
4100
+ second host executable, so Windows kills the direct child, destroys retained pipes at the grace
4101
+ deadline and makes no descendant-cleanup claim. A signal already aborted before execution returns
4102
+ `cancelled` without spawning.
4103
+
4083
4104
  One `createAgentHarnessFileResources` instance represents one immutable discovery generation:
4084
4105
  concurrent and repeated `load()` calls share it, so a direct resource read cannot cross into a
4085
- new catalog unexpectedly. Construct a new loader to refresh after filesystem changes.
4106
+ new catalog unexpectedly. Discovery uses the same descriptor-anchored traversal as coding search;
4107
+ construct a new loader to refresh after filesystem changes.
4086
4108
 
4087
4109
  Runtime events preserve reasoning/text/tool lifecycle order. Durable admission,
4088
4110
  checkpoint, run-state and terminal events carry stable identities; transient
@@ -4509,7 +4531,9 @@ or silently accept an unknown future version.
4509
4531
  - `assistant-checkpoint` follows a successful checkpoint CAS;
4510
4532
  - `run-state` follows durable queue/acquire/interrupt transitions;
4511
4533
  - `tool-status` is transient lifecycle presentation with JSON-safe input on
4512
- start and output on completion; internal tool failures remain generic;
4534
+ start and output on completion. A mounted typed failure carries the same safe
4535
+ `{ error, details?, _hint? }` envelope as the durable result; an unknown
4536
+ internal cause remains generic and stays in local observability only;
4513
4537
  - `terminal` follows the winning terminal CAS.
4514
4538
 
4515
4539
  These are post-commit notifications, not a transactional outbox: a process can
@@ -4625,6 +4649,14 @@ before a managed side effect and again before accepting its result. Fence loss
4625
4649
  uses an internal control signal: it stops the old loop and is not sent to the
4626
4650
  model as a tool error.
4627
4651
 
4652
+ `mountAgent` sends failed runner outcomes through the AI SDK's tool-error
4653
+ channel. AgentRuntime persists them with `outcome: 'error'`, publishes the same
4654
+ safe envelope, and replays them as an error result on later turns. Classification
4655
+ comes from the execution channel, never from inspecting output fields: a valid
4656
+ successful result such as `{ error: 'domain value' }` remains successful. Typed
4657
+ `AppError` codes and safe details may reach the model; arbitrary thrown causes
4658
+ are retained for local hooks and reduced to `INTERNAL_SERVER_ERROR` outside.
4659
+
4628
4660
  The framework cannot undo an already-started non-cooperative external effect.
4629
4661
  Pass the stable call/run idempotency identity into business mutations when the
4630
4662
  effect must be replay-safe.
@@ -8869,6 +8901,23 @@ additive** — adopting it changes nothing in your code. (See
8869
8901
  So upgrading is: read the `### ⚠️ Breaking changes` of every version *above* your
8870
8902
  current one *up to* your target, and apply each snippet.
8871
8903
 
8904
+ ## Released migration: 0.70.0
8905
+
8906
+ ### Descriptor-backed Agent filesystem containment
8907
+
8908
+ Built-in coding file/search tools and `createAgentHarnessFileResources` now require a runtime
8909
+ that can address an opened directory descriptor: Linux `/proc/self/fd`, or the packaged macOS
8910
+ Node-API backend added in 0.70.1. This is what keeps a mutable parent rename or outside-symlink replacement from changing
8911
+ the authorized target between validation and the actual effect.
8912
+
8913
+ No call-site change is needed on those platforms. The 0.70.0 notes incorrectly inferred macOS and
8914
+ FreeBSD support from `/dev/fd`; macOS is restored by 0.70.1 and FreeBSD remains unsupported. On
8915
+ Windows or another platform without that
8916
+ boundary, move the built-in filesystem operations to a supported worker or replace them with
8917
+ application-owned tools backed by an equivalent native handle API. They fail closed rather than
8918
+ falling back to path spelling. `run_command` remains separately available under its explicit
8919
+ executable alias and authorization policy; this change does not claim an executable sandbox.
8920
+
8872
8921
  ## Released migration: 0.69.0
8873
8922
 
8874
8923
  ### Direct coding-tool operation names
@@ -11657,9 +11706,9 @@ Also re-exports the error helpers from `stitchkit/contract`.
11657
11706
  | `UnixListenConfig` | _type_ | unix listener — a socket path, or `{ path, mode }` to tighten the file mode after listen |
11658
11707
  | `BunServerHandle` | _type_ | managed Bun handle (`url`, `port`, `runtime`, `status`, `shutdown`) |
11659
11708
  | `ManagedServerHandle` | _type_ | shared lifecycle shape generic over the runtime escape hatch |
11660
- | `ShutdownOptionsSchema` / `ShutdownOptions` | schema / _type_ | one graceful budget, bounded forced-completion timeout, retry hint and optional external abort signal |
11709
+ | `ShutdownOptionsSchema` / `ShutdownOptions` | schema / _type_ | HTTP/application grace, a separate WebSocket close-handshake bound, bounded forced-completion timeout, retry hint and optional external abort signal |
11661
11710
  | `ShutdownStatusSchema` / `ShutdownStatus` | schema / _type_ | live state and request/WebSocket counters |
11662
- | `ShutdownResultSchema` / `ShutdownResult` | schema / _type_ | clean/forced result with final counters and at-force snapshots |
11711
+ | `ShutdownResultSchema` / `ShutdownResult` | schema / _type_ | clean/forced result with final counters, outer-force snapshots and `forcedWebSockets` including bounded realtime terminations |
11663
11712
  | `ShutdownStateSchema` / `ShutdownState` | schema / _type_ | managed lifecycle state machine |
11664
11713
  | `ServiceDef` | _type_ | the result of `implement` |
11665
11714
  | `MethodDef` | _type_ | one resolved endpoint inside a service |
@@ -11847,7 +11896,7 @@ cutovers are covered by the executable
11847
11896
  | `ManagedResourceDependency` | _type_ | a dependency named by id or given as the resource itself — the second form is what `context.use(...)` can type |
11848
11897
  | `ManagedResourcePublished` | _type_ | the value type `context.use(resource)` returns, recovered from that resource's own `start` |
11849
11898
  | `ManagedResourcePublishesNoValue` | _type_ | what `context.use(...)` returns for a resource that publishes nothing — a branded refusal rather than `never`, so reading it does not silently compile |
11850
- | `ManagedServerResourceConfig` | _type_ | the server or a sync/async factory receiving `ManagedResourceContext`, plus stable ID, dependencies and shutdown policy for `managedServerResource` |
11899
+ | `ManagedServerResourceConfig` | _type_ | the server or a sync/async factory receiving `ManagedResourceContext`, plus stable ID, dependencies and server shutdown policy (`retryAfterSeconds`, `realtimeCloseTimeoutMs`) |
11851
11900
  | `ManagedServerResource` | _type_ | the resource `managedServerResource` returns, whose `start` publishes the `ManagedServerHandle` |
11852
11901
  | `ApplicationHealthHandlerOptions` / `ApplicationHealthHandlerOptionsSchema` | _type_ / schema | liveness/readiness selection and sanitized `Retry-After` policy |
11853
11902
  | `ApplicationOperationalHandlers` / `ApplicationOperationalHandlersOptions` / `ApplicationOperationalHandlersOptionsSchema` | _type_ / schema | conventional status/readiness/liveness route surface and shared retry policy |
@@ -12204,17 +12253,19 @@ artifact store is supplied, `read_output`.
12204
12253
 
12205
12254
  | Export | Kind | Summary |
12206
12255
  |--------|------|---------|
12207
- | `createAgentCodingTools` | function | construct direct host-authorized bounded file, search, guarded patch, shell and artifact runtime-tool definitions |
12256
+ | `createAgentCodingTools` | function | construct direct host-authorized bounded file, search, guarded patch, shell and artifact runtime-tool definitions; filesystem operations use Linux `/proc/self/fd` or the packaged macOS Node-API backend and otherwise fail closed |
12208
12257
  | `AgentCodingToolDefinition` | _type_ | peer-free structural direct-tool shape accepted by the canonical runtime-tool surface |
12209
12258
  | `AgentCodingToolConfig` | _type_ | absolute root, required authorization callback, finite executable alias map, exact child environment and optional limits |
12210
12259
  | `AgentCodingToolAuthorizationSchema` / `AgentCodingToolAuthorization` | schema / _type_ | discriminated read/write/search/patch/shell/artifact decision presented to host policy before effect |
12211
- | `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout ceilings |
12260
+ | `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout/termination-grace ceilings |
12212
12261
  | `AgentCodingArtifactStore` | _type_ | host-owned opaque artifact write and bounded read boundary |
12213
12262
  | `FileReadInputSchema` / `FileReadOutputSchema` | schema | bounded strict-UTF-8 byte slice; offsets must align with UTF-8 code-point boundaries |
12214
12263
  | `FileWriteInputSchema` / `FileWriteOutputSchema` | schema | create-only by default or explicit atomic replacement; symlink targets fail closed |
12215
12264
  | `createShellInputSchema` / `ShellOutputSchema` | schema | enumerated executable alias plus arguments and concrete relative cwd; explicit exited/timeout/output-limit/cancelled outcome |
12216
12265
 
12217
- The default ceilings are 4,096 path bytes, 256 KiB read/write/output, 128 shell arguments, 64 KiB
12266
+ File/search operations pin directory descriptors across authorization and the actual effect;
12267
+ resource discovery uses the same ancestor-safe traversal. This closes parent rename/symlink races
12268
+ without claiming an executable sandbox. The default ceilings are 4,096 path bytes, 256 KiB read/write/output, 128 shell arguments, 64 KiB
12218
12269
  of aggregate argument text, 4 MiB per artifact and 30 seconds. The root is a path-resolution
12219
12270
  boundary, not an OS sandbox; executable behavior, process
12220
12271
  isolation, credentials and external-effect idempotency remain host responsibilities.
@@ -12263,7 +12314,7 @@ loaded by the neutral, browser or Node runtime surfaces.
12263
12314
 
12264
12315
  ---
12265
12316
 
12266
- ## `@stitchkit/tui`
12317
+ ## `stitchkit-tui`
12267
12318
 
12268
12319
  Separate optional evolving Bun/OpenTUI package over a caller-composed headless harness.
12269
12320
 
@@ -12290,7 +12341,7 @@ The slash palette owns its highlighted selection: Up/Down move it, Tab completes
12290
12341
  the exact command and Escape dismisses it. Partial input is never submitted while the palette is
12291
12342
  active; unknown slash text with no match remains an ordinary model prompt.
12292
12343
 
12293
- ### `@stitchkit/tui/core`
12344
+ ### `stitchkit-tui/core`
12294
12345
 
12295
12346
  Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor the agent runtime.
12296
12347
 
@@ -12415,7 +12466,7 @@ payload.
12415
12466
  | `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
12416
12467
  | `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
12417
12468
  | `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
12418
- | `mountAgent` | function | a Vercel AI SDK `ToolSet` from a service — [guide](../guide/mcp-and-agents.md#ai-agents--mountagent) |
12469
+ | `mountAgent` | function | a Vercel AI SDK `ToolSet` from a service; failed executions reject through the SDK tool-error channel with a safe typed envelope, while successful output is never classified by field name — [guide](../guide/mcp-and-agents.md#ai-agents--mountagent) |
12419
12470
  | `defineRuntimeTool` | function | define one validated pathless operation for explicit MCP, Agent and/or CLI surfaces — [guide](../guide/mcp-and-agents.md#pathless-runtime-tools-and-multimodal-results) |
12420
12471
  | `createRuntimeToolFactory` | function | bind shared identity and Zod-validated per-call context for runtime tools — [guide](../guide/mcp-and-agents.md#pathless-runtime-tools-and-multimodal-results) |
12421
12472
  | `createToolInvoker` | function | compile an exposure-aware in-process dispatcher over the canonical tool runner; use peer-free `stitchkit/tools/invoker`, or the full `stitchkit/tools` adapter barrel — [guide](../guide/mcp-and-agents.md#in-process-calls--createtoolinvoker) |
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.69.0",
3
+ "version": "0.70.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",
@@ -38,6 +38,7 @@
38
38
  "types": "./dist/index.d.ts",
39
39
  "files": [
40
40
  "dist",
41
+ "native/*.node",
41
42
  "llms.txt",
42
43
  "llms-full.txt",
43
44
  "README.md",
@@ -141,6 +142,7 @@
141
142
  "access": "public"
142
143
  },
143
144
  "scripts": {
145
+ "build:native-contained-files": "node scripts/build-contained-files-native.mjs",
144
146
  "check": "bun x tsc --noEmit",
145
147
  "build:browser": "bun build src/index.ts src/react.ts src/contract/index.ts src/declaration.ts src/agent-runtime-browser.ts --outdir dist --target node --packages external --splitting --root src",
146
148
  "build:server": "bun build src/server/index.ts src/node.ts src/tools.ts src/tool-invoker.ts src/cli.ts src/remote.ts src/files.ts src/testing.ts src/observability/index.ts src/agent-runtime.ts src/agent-runtime-harness.ts src/agent-runtime-coding-tools.ts src/agent-runtime-openrouter.ts src/agent-runtime-sqlite-bun.ts src/agent-runtime-sqlite-node.ts src/application.ts src/application-grammy.ts src/application-opentelemetry.ts --outdir dist --target node --packages external --splitting --root src",