stitchkit 0.119.0 → 0.121.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 (163) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +10 -7
  3. package/dist/agent-runtime/coding-discovery.d.ts +25 -0
  4. package/dist/agent-runtime/coding-discovery.d.ts.map +1 -0
  5. package/dist/agent-runtime/coding-search-automaton.d.ts +37 -0
  6. package/dist/agent-runtime/coding-search-automaton.d.ts.map +1 -0
  7. package/dist/agent-runtime/coding-search-case-fold.d.ts +4 -0
  8. package/dist/agent-runtime/coding-search-case-fold.d.ts.map +1 -0
  9. package/dist/agent-runtime/coding-search-class-ranges.d.ts +10 -0
  10. package/dist/agent-runtime/coding-search-class-ranges.d.ts.map +1 -0
  11. package/dist/agent-runtime/coding-search-contract.d.ts +86 -0
  12. package/dist/agent-runtime/coding-search-contract.d.ts.map +1 -0
  13. package/dist/agent-runtime/coding-search-limits.d.ts +13 -0
  14. package/dist/agent-runtime/coding-search-limits.d.ts.map +1 -0
  15. package/dist/agent-runtime/coding-search-matcher.d.ts +33 -0
  16. package/dist/agent-runtime/coding-search-matcher.d.ts.map +1 -0
  17. package/dist/agent-runtime/coding-search-output.d.ts +5 -0
  18. package/dist/agent-runtime/coding-search-output.d.ts.map +1 -0
  19. package/dist/agent-runtime/coding-search-regex-syntax.d.ts +39 -0
  20. package/dist/agent-runtime/coding-search-regex-syntax.d.ts.map +1 -0
  21. package/dist/agent-runtime/coding-search-unit-classes.d.ts +31 -0
  22. package/dist/agent-runtime/coding-search-unit-classes.d.ts.map +1 -0
  23. package/dist/agent-runtime/coding-shell-process.d.ts +1 -0
  24. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  25. package/dist/agent-runtime/coding-tool-contract.d.ts +8 -3
  26. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  27. package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
  28. package/dist/agent-runtime/coding-tool-listing.d.ts +1 -11
  29. package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
  30. package/dist/agent-runtime/coding-tool-paths.d.ts +6 -2
  31. package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
  32. package/dist/agent-runtime/coding-tool-refusals.d.ts +6 -0
  33. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  34. package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
  35. package/dist/agent-runtime/coding-tool-search.d.ts +113 -0
  36. package/dist/agent-runtime/coding-tool-search.d.ts.map +1 -0
  37. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  38. package/dist/agent-runtime/contained-scan-budget.d.ts +32 -0
  39. package/dist/agent-runtime/contained-scan-budget.d.ts.map +1 -0
  40. package/dist/agent-runtime/contained-scan-contract.d.ts +52 -0
  41. package/dist/agent-runtime/contained-scan-contract.d.ts.map +1 -0
  42. package/dist/agent-runtime/contained-scan.d.ts +48 -13
  43. package/dist/agent-runtime/contained-scan.d.ts.map +1 -1
  44. package/dist/agent-runtime/sandbox.d.ts +5 -1
  45. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  46. package/dist/agent-runtime/workspace-glob.d.ts +6 -0
  47. package/dist/agent-runtime/workspace-glob.d.ts.map +1 -0
  48. package/dist/entrypoints/agent-runtime/coding-tools.js +7 -7
  49. package/dist/entrypoints/agent-runtime/harness.js +5 -5
  50. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  51. package/dist/entrypoints/agent-runtime/sandbox.js +8 -8
  52. package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -9
  53. package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -9
  54. package/dist/entrypoints/agent-runtime/testing.js +9 -9
  55. package/dist/entrypoints/agent-runtime.js +16 -14
  56. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  57. package/dist/entrypoints/application/directory-inbox.js +5 -5
  58. package/dist/entrypoints/application.js +6 -6
  59. package/dist/entrypoints/cli/publish.js +5 -5
  60. package/dist/entrypoints/cli.js +8 -8
  61. package/dist/entrypoints/contract.js +4 -4
  62. package/dist/entrypoints/files.js +4 -4
  63. package/dist/entrypoints/http.js +2 -2
  64. package/dist/entrypoints/index.js +2 -2
  65. package/dist/entrypoints/node.js +1 -1
  66. package/dist/entrypoints/process/owner-loss.js +2 -1
  67. package/dist/entrypoints/process.js +4 -4
  68. package/dist/entrypoints/remote.js +1 -1
  69. package/dist/entrypoints/server.js +12 -12
  70. package/dist/entrypoints/telegram/screens.js +5 -5
  71. package/dist/entrypoints/telegram.js +8 -8
  72. package/dist/entrypoints/testing.js +2 -2
  73. package/dist/entrypoints/tools/agent.d.ts +9 -0
  74. package/dist/entrypoints/tools/agent.d.ts.map +1 -0
  75. package/dist/entrypoints/tools/agent.js +16 -0
  76. package/dist/entrypoints/tools/connections.js +4 -4
  77. package/dist/entrypoints/tools/mcp.js +104 -4
  78. package/dist/entrypoints/tools/toolkit.d.ts +9 -0
  79. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -0
  80. package/dist/entrypoints/tools/toolkit.js +40 -0
  81. package/dist/entrypoints/tools.d.ts +0 -10
  82. package/dist/entrypoints/tools.d.ts.map +1 -1
  83. package/dist/entrypoints/tools.js +25 -69
  84. package/dist/{index-s0qjs6ee.js → index-0fra8xvy.js} +9 -81
  85. package/dist/{index-rxcgp4b9.js → index-10rg78vf.js} +1 -1
  86. package/dist/index-1psbyyhj.js +21 -0
  87. package/dist/index-3prvb42w.js +30 -0
  88. package/dist/{index-ba7are04.js → index-4tyt1qya.js} +1 -1
  89. package/dist/index-568w258r.js +76 -0
  90. package/dist/{index-fqd4yqwd.js → index-6j15ktag.js} +1 -1
  91. package/dist/{index-zrdcmg6j.js → index-72xtvcvr.js} +40 -6
  92. package/dist/{index-6a69xzrx.js → index-7zwtbak8.js} +5 -46
  93. package/dist/{index-fcqj44mb.js → index-8ryydawp.js} +4 -4
  94. package/dist/{index-q968hy6y.js → index-aqmadanx.js} +2 -2
  95. package/dist/{index-s20s2mad.js → index-bgcwxhxh.js} +16 -14
  96. package/dist/index-bph35vpy.js +77 -0
  97. package/dist/{index-arjmb6de.js → index-eeahxwvg.js} +60 -76
  98. package/dist/{index-57gqaq8b.js → index-f6pw75e1.js} +1 -1
  99. package/dist/{index-f4njz9j0.js → index-gq3fnq3f.js} +1 -1
  100. package/dist/{index-ynrf908v.js → index-gtx3eknx.js} +1 -1
  101. package/dist/index-h1j71dr1.js +48 -0
  102. package/dist/{index-nn9qvkww.js → index-j95jp7ee.js} +45 -9
  103. package/dist/{index-mgb7r8b8.js → index-jswst0h3.js} +1 -1
  104. package/dist/{index-bbvc59gw.js → index-knmnj11j.js} +9 -180
  105. package/dist/{index-2kbysk9s.js → index-m5m9rmvt.js} +2 -0
  106. package/dist/{index-g444vfz2.js → index-nwm3ww60.js} +1 -1
  107. package/dist/{index-yk4g8805.js → index-pq7rkwkk.js} +1 -30
  108. package/dist/index-qaqxdbxf.js +2857 -0
  109. package/dist/{index-x8d9fdeg.js → index-qctbzmg9.js} +8 -4
  110. package/dist/index-s9a0fjh3.js +305 -0
  111. package/dist/index-sb9dr3tq.js +14 -0
  112. package/dist/{index-tvtacc9a.js → index-zyc64nbh.js} +1 -34
  113. package/dist/internal/contained-directory.d.ts +1 -1
  114. package/dist/internal/contained-directory.d.ts.map +1 -1
  115. package/dist/internal/contained-files.d.ts +18 -51
  116. package/dist/internal/contained-files.d.ts.map +1 -1
  117. package/dist/internal/contained-read.d.ts +17 -0
  118. package/dist/internal/contained-read.d.ts.map +1 -0
  119. package/dist/internal/darwin-binding.d.ts +3 -1
  120. package/dist/internal/darwin-binding.d.ts.map +1 -1
  121. package/dist/process/bun-child.d.ts.map +1 -1
  122. package/dist/process/command-owner.d.ts.map +1 -1
  123. package/dist/process/group.d.ts +2 -0
  124. package/dist/process/group.d.ts.map +1 -1
  125. package/dist/process/launch.d.ts +1 -0
  126. package/dist/process/launch.d.ts.map +1 -1
  127. package/dist/process/owned-child.d.ts.map +1 -1
  128. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  129. package/dist/process/owner-loss-protocol.d.ts +1 -0
  130. package/dist/process/owner-loss-protocol.d.ts.map +1 -1
  131. package/llms/agent-runtime-coding-tools.txt +9 -9
  132. package/llms/agent-runtime-harness.txt +4 -3
  133. package/llms/agent-runtime-sandbox.txt +1 -1
  134. package/llms/agent-runtime.2.txt +20 -2
  135. package/llms/agent-runtime.3.txt +4 -46
  136. package/llms/agent-runtime.4.txt +113 -0
  137. package/llms/agent-runtime.txt +70 -37
  138. package/llms/application.3.txt +5 -2
  139. package/llms/cli.txt +1 -1
  140. package/llms/contract.txt +1 -1
  141. package/llms/process.txt +3 -1
  142. package/llms/server.5.txt +2 -0
  143. package/llms/stitchkit.txt +15 -9
  144. package/llms/testing.txt +4 -6
  145. package/llms/tools-agent.txt +24 -0
  146. package/llms/tools-mcp.txt +71 -6
  147. package/llms/tools-toolkit.txt +23 -0
  148. package/llms/tools.2.txt +6 -3
  149. package/llms/tools.3.txt +8 -77
  150. package/llms/tools.txt +8 -8
  151. package/llms/{upgrading-0.106.0-0.119.0.txt → upgrading-0.106.0-0.121.0.txt} +84 -3
  152. package/llms/upgrading.txt +1 -1
  153. package/llms-full.txt +360 -139
  154. package/llms.txt +11 -9
  155. package/native/darwin-arm64.node +0 -0
  156. package/native/darwin-x64.node +0 -0
  157. package/native-assets.json +4 -4
  158. package/package.json +10 -2
  159. package/dist/index-1k18qzqa.js +0 -1478
  160. package/dist/index-6f49krb5.js +0 -107
  161. package/dist/{index-2dfvv1jg.js → index-2fc1k9k2.js} +0 -0
  162. package/dist/{index-qndsr7f0.js → index-5efrpfmj.js} +3 -3
  163. /package/dist/{index-cyxp8rbf.js → index-mtwh9hyp.js} +0 -0
@@ -63,8 +63,10 @@ own, recorded as an ADR.
63
63
  | `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports, exact money and rounding tables |
64
64
  | `stitchkit/server` | server (Bun) | stable | `createServer`, `implement`, hooks, auth, Socket.IO server, server primitives |
65
65
  | `stitchkit/node` | server (Node ≥ 22) | stable | `serveNode` + the runtime-agnostic core — the Node mirror of `/server` |
66
- | `stitchkit/tools` | server | stable | `createMcpHandler`, `mountMcp`, `mountAgent`, the OAuth provider, native tools |
66
+ | `stitchkit/tools` | server | stable | the transport-neutral tool layer — registry, tool names and manifest, runtime tools, native tools, the OAuth provider, the durability engine; loads no optional peer at runtime |
67
67
  | `stitchkit/tools/mcp` | server (Bun or Node) | evolving | the canonical MCP HTTP/stdio server, schemas and typed MCP presenters; only Zod and the MCP server SDK peers |
68
+ | `stitchkit/tools/agent` | server (Bun or Node) | evolving | `mountAgent` — a contract's operations as AI SDK tools; only Zod and the `ai` peer |
69
+ | `stitchkit/tools/toolkit` | server (Bun or Node) | evolving | `createToolkit` — one tool set served over MCP and to an AI SDK agent; the MCP server SDK and `ai` peers |
68
70
  | `stitchkit/tools/contract` | browser + server | evolving | the shapes a tool surface speaks — async-operation contract, snapshot and cancel schemas, view-file input/output — without the runtime that serves them |
69
71
  | `stitchkit/tools/invoker` | server | stable | peer-free `createToolInvoker` over the canonical contract tool runner |
70
72
  | `stitchkit/tools/connections` | server (Bun or Node) | evolving | consume external MCP servers and a bounded OpenAPI subset — typed reauthorization, a per-request host fence and per-call credentials |
@@ -90,13 +92,13 @@ own, recorded as an ADR.
90
92
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
91
93
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
92
94
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
93
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 64 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
95
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 66 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
94
96
  | `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 |
95
97
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
96
98
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
97
99
  | `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) |
98
100
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
99
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the 64 minors since 0.56.2, most recently 0.115.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
101
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 66 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
100
102
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
101
103
  | `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 |
102
104
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -108,7 +110,7 @@ own, recorded as an ADR.
108
110
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
109
111
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
110
112
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
111
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 64 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
113
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 66 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
112
114
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
113
115
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
114
116
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -211,7 +213,10 @@ map — feature → packages:
211
213
  | `createServer` (Bun) | — (uses `Bun.serve`) |
212
214
  | `serveNode` (Node ≥ 22) | `srvx` (+ `@types/bun` dev) |
213
215
  | In-process contract tools (`stitchkit/tools/invoker`) | — |
214
- | MCP / agent adapters (`stitchkit/tools`) | `@modelcontextprotocol/server` `ai` |
216
+ | Tool layer — registry, tool names, runtime tools (`stitchkit/tools`) | — |
217
+ | MCP server (`stitchkit/tools/mcp`) | `@modelcontextprotocol/server` |
218
+ | AI SDK agent tools (`stitchkit/tools/agent`) | `ai` |
219
+ | MCP and agent toolkit (`stitchkit/tools/toolkit`) | `@modelcontextprotocol/server` `ai` |
215
220
  | Agent application runtime (`stitchkit/agent-runtime`) | `ai` |
216
221
  | Headless Agent harness (`stitchkit/agent-runtime/harness`) | `ai` |
217
222
  | Agent coding tools (`stitchkit/agent-runtime/coding-tools`) | — |
@@ -240,15 +245,16 @@ bun add socket.io @socket.io/bun-engine # e.g. the Socket.IO server on Bun
240
245
  ```
241
246
 
242
247
  Dynamic optional-peer adapters fail with an actionable error naming the package
243
- and install command. Static entrypoints such as `stitchkit/tools` fail during
248
+ and install command. Static entrypoints such as `stitchkit/tools/mcp` fail during
244
249
  ESM resolution by naming the exact missing package; the feature-to-peer matrix
245
250
  below is the canonical install command.
246
251
 
247
- The combined tools entry owns MCP and AI-agent adapters, so install both runtime
248
- peers before importing `stitchkit/tools`:
252
+ `stitchkit/tools` itself loads no optional peer. Install the peer of the adapter
253
+ you import — both for `stitchkit/tools/toolkit`:
249
254
 
250
255
  ```bash
251
- bun add @modelcontextprotocol/server@^2 ai@^7
256
+ bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp
257
+ bun add ai@^7 # stitchkit/tools/agent
252
258
  ```
253
259
 
254
260
  Browser, HTTP-client and React entrypoints remain usable without either MCP
package/llms/testing.txt CHANGED
@@ -326,8 +326,9 @@ fixture's transitive dependency.
326
326
 
327
327
  That includes `stitchkit/tools/invoker`: a minimal packed consumer imports it
328
328
  without MCP/AI peers and executes validation, output projection and normalized
329
- errors on Bun and Node. The broader `stitchkit/tools` barrel deliberately keeps
330
- the adapter peer budget.
329
+ errors on Bun and Node, and so does `stitchkit/tools`, which loads no optional peer at
330
+ runtime. The adapters keep their peer budgets on their own subpaths:
331
+ `stitchkit/tools/mcp`, `stitchkit/tools/agent` and `stitchkit/tools/toolkit`.
331
332
 
332
333
  Beside the matrix, one case is about the ARTIFACT rather than the inventory: a
333
334
  program that injects the Socket.IO peer loaders is bundled and started in a
@@ -556,10 +557,7 @@ signal and deadline. Bind its process lifecycle with the truthful close-only
556
557
  sibling from `stitchkit/tools`:
557
558
 
558
559
  ```ts
559
- import {
560
- bindStdioProcessSignals,
561
- createStdioMcpServer,
562
- } from 'stitchkit/tools'
560
+ import { bindStdioProcessSignals, createStdioMcpServer } from 'stitchkit/tools/mcp'
563
561
 
564
562
  const stdio = await createStdioMcpServer(config)
565
563
  const binding = bindStdioProcessSignals(stdio, {
@@ -0,0 +1,24 @@
1
+ # stitchkit/tools/agent — 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/tools/agent` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/tools.txt` for the MCP & agents guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/tools/agent` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/tools/agent`
16
+
17
+ Server-only. A contract's operations as Vercel AI SDK tools; needs Zod and the `ai`
18
+ peer, not the MCP server SDK. → ADR 0284.
19
+
20
+ | Export | Kind | Summary |
21
+ |--------|------|---------|
22
+ | `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) |
23
+ | `AgentMountConfig` | _type_ | config for `mountAgent` |
24
+ | `AgentContext` | _type_ | the context merged into agent tool handlers |
@@ -14,15 +14,80 @@ Also read:
14
14
 
15
15
  ## `stitchkit/tools/mcp`
16
16
 
17
- A server-only leaf over the same MCP owner as `stitchkit/tools`. Its runtime and strict
18
- NodeNext declarations require Zod and `@modelcontextprotocol/server`, with no AI SDK peer.
19
- HTTP/stdio factories, mounts, schema policy, catalog and resource helpers keep their canonical
20
- behavior and names. See [MCP guide](../guide/mcp-and-agents.md#mcp--createmcphandler).
17
+ Server-only, and the one place the MCP server is exported. Its runtime and strict NodeNext
18
+ declarations require Zod and the `@modelcontextprotocol/server` v2 peer, with no AI SDK peer;
19
+ MCP hosts and tests use the separate `@modelcontextprotocol/client` package.
20
+
21
+ Framework-owned MCP tools advertise the exact declared output schema and return
22
+ the validated value unchanged as `structuredContent`, including arrays, scalars
23
+ and `null`. Tools without an output contract advertise and return no structured
24
+ payload. See [MCP guide](../guide/mcp-and-agents.md#mcp--createmcphandler).
21
25
 
22
26
  | Export | Kind | Purpose |
23
27
  |--------|------|---------|
24
- | `createMcpHandler` / `createMcpHttpRoute` / `buildMcpServer` / `mountMcp` | function | the shared authenticated HTTP handler, raw-route adapter, SDK server and contract mount |
25
- | `createStdioMcpServer` / `bindStdioProcessSignals` | function | the shared stdio server and bounded process cleanup |
28
+ | `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
29
+ | `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
30
+ | `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
31
+ | `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
32
+ | `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
33
+ | `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
34
+ | `validateMcpSchemas` | function | object-shaped assertion over the exact advertised schema surface — compatibility, typed properties and portable formats ([guide](../guide/mcp-and-agents.md#mcp-schema-validation-profile)) |
35
+ | `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
36
+ | `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
37
+ | `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
38
+ | `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
39
+ | `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
40
+ | `McpStdioHandle` | _type_ | closeable official stdio transport handle |
41
+ | `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
42
+ | `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
43
+ | `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
44
+ | `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
45
+ | `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
46
+ | `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
47
+ | `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
48
+ | `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
49
+ | `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
50
+ | `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
51
+ | `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
52
+ | `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
53
+ | `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
54
+ | `McpMountConfig` | _type_ | config for `mountMcp` |
55
+ | `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
56
+ | `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
57
+ | `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
26
58
  | `RuntimeToolDefinitionWithOutput` / `RuntimeToolDefinitionWithoutOutput` | _type_ | the one neutral construction, shared with `stitchkit/cli` and `stitchkit/tools`; MCP-only presenters are its fourth type argument, `RuntimeMcpToolPresenters<z.output<typeof output>>` |
27
59
  | `RuntimeToolDefinition` | _type_ | heterogeneous registration; the canonical runner validates input/output before invocation |
28
60
  | `RuntimeMcpToolPresenters` / `RuntimeMcpPresentation` | _type_ | official SDK content without framework-owned `structuredContent` or `isError`; one presenter owner shared with the full SDK surface |
61
+
62
+ ### Catalog stamp
63
+
64
+ Every advertised tool and every tool result carries the fingerprint of the catalog it came
65
+ from, so a long-lived consumer can see that its own copy is stale **without making a
66
+ request for it**. `createMcpHandler` is stateless by construction and therefore has no
67
+ retained session to push `notifications/tools/list_changed` down; the stamp needs none.
68
+
69
+ Store the stamp beside the tools when you list them, compare it against the one on every
70
+ result, and re-list when they differ — including on a refusal, which is exactly when a
71
+ stale catalog is the likeliest explanation and the least visible one. The server side
72
+ needs no wiring: every mount stamps what it advertises.
73
+
74
+ | Export | Kind | Summary |
75
+ |--------|------|---------|
76
+ | `readMcpCatalogStamp` | function | read a peer's stamp out of `_meta`, or `null` when there is none |
77
+ | `mcpCatalogMeta` | function | the `_meta` fragment a stamped tool or result carries |
78
+ | `MCP_CATALOG_META_KEY` | const | the namespaced `_meta` key (`stitchkit/catalog`) |
79
+ | `McpCatalogStamp` | _type_ | `{ digest, tools }` — the catalog fingerprint and its tool count |
80
+
81
+ ### MCP Apps (widgets)
82
+
83
+ Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.md).
84
+
85
+ | Export | Kind | Summary |
86
+ |--------|------|---------|
87
+ | `mountMcpResource` | function | mount an MCP Apps widget resource |
88
+ | `inlineMcpAppBundle` | function | inline a built widget bundle into a resource |
89
+ | `EXT_APPS_BUNDLE_PLACEHOLDER` | const | the placeholder token `inlineMcpAppBundle` replaces |
90
+ | `RESOURCE_MIME_TYPE` | const | the MCP Apps resource MIME type |
91
+ | `McpResourceDef` | _type_ | an MCP Apps resource definition |
92
+ | `McpAppResourceMeta` | _type_ | resource `_meta` for an MCP App |
93
+ | `McpAppCsp` | _type_ | the widget content-security policy |
@@ -0,0 +1,23 @@
1
+ # stitchkit/tools/toolkit — 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/tools/toolkit` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/tools.txt` for the MCP & agents guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/tools/toolkit` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/tools/toolkit`
16
+
17
+ Server-only. One context-typed tool set served over MCP and to an AI SDK agent, so it
18
+ needs both the `@modelcontextprotocol/server` and `ai` peers. → ADR 0284.
19
+
20
+ | Export | Kind | Summary |
21
+ |--------|------|---------|
22
+ | `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
23
+ | `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
package/llms/tools.2.txt CHANGED
@@ -178,7 +178,7 @@ see [Agent application runtime](./agent-runtime.md).
178
178
  `generateText` / `streamText`:
179
179
 
180
180
  ```ts
181
- import { mountAgent } from 'stitchkit/tools'
181
+ import { mountAgent } from 'stitchkit/tools/agent'
182
182
  import { generateText } from 'ai'
183
183
 
184
184
  const tools = mountAgent(usersService, { context: { userId: 'agent-1' } })
@@ -262,7 +262,9 @@ result. Optional presentation callbacks map that result to MCP content and AI
262
262
  SDK model output without coupling the handler to either SDK:
263
263
 
264
264
  ```ts
265
- import { createMcpHandler, defineRuntimeTool, mountAgent } from 'stitchkit/tools'
265
+ import { defineRuntimeTool } from 'stitchkit/tools'
266
+ import { createMcpHandler } from 'stitchkit/tools/mcp'
267
+ import { mountAgent } from 'stitchkit/tools/agent'
266
268
  import { z } from 'zod'
267
269
 
268
270
  const renderPreview = defineRuntimeTool({
@@ -628,7 +630,8 @@ hooks. The built-in `mountViewFile`, `mountWait`, `mountDownload` and
628
630
  media helper fetches with SSRF and path-traversal defenses:
629
631
 
630
632
  ```ts
631
- import { createMcpHandler, mountViewFile } from 'stitchkit/tools'
633
+ import { mountViewFile } from 'stitchkit/tools'
634
+ import { createMcpHandler } from 'stitchkit/tools/mcp'
632
635
 
633
636
  const handleMcp = createMcpHandler({
634
637
  serverInfo: { name: 'my-app', version: '1.0.0' },
package/llms/tools.3.txt CHANGED
@@ -14,57 +14,25 @@ Parts of this slice:
14
14
 
15
15
  ## `stitchkit/tools`
16
16
 
17
- Server-only. Turns contracts into MCP and AI-agent tools. MCP server surfaces
18
- need the `@modelcontextprotocol/server` v2 peer; MCP hosts/tests use the separate
19
- `@modelcontextprotocol/client` package. Agent surfaces need the `ai` peer.
20
-
21
- Framework-owned MCP tools advertise the exact declared output schema and return
22
- the validated value unchanged as `structuredContent`, including arrays, scalars
23
- and `null`. Tools without an output contract advertise and return no structured
24
- payload.
17
+ Server-only, and imported without any optional peer: the transport-neutral tool layer —
18
+ the registry, tool names and manifest, runtime tools, native tools, the invoker, the OAuth
19
+ provider and the durability engine. An application that serves its operations over HTTP and
20
+ CLI lists its tool names here with neither MCP nor the AI SDK installed. The adapters that
21
+ need a peer have their own subpaths: [`stitchkit/tools/mcp`](#stitchkittoolsmcp) (the MCP
22
+ server SDK), [`stitchkit/tools/agent`](#stitchkittoolsagent) (the `ai` peer) and
23
+ [`stitchkit/tools/toolkit`](#stitchkittoolstoolkit) (both). → ADR 0284.
25
24
 
26
25
  | Export | Kind | Summary |
27
26
  |--------|------|---------|
28
- | `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
29
- | `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
30
- | `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
31
- | `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
32
- | `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
33
- | `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
34
- | `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) |
35
27
  | `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) |
36
28
  | `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) |
37
- | `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) |
38
- | `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
29
+ | `createToolInvoker` | function | compile an exposure-aware in-process dispatcher over the canonical tool runner; use `stitchkit/tools/invoker` or `stitchkit/tools`, both peer-free — [guide](../guide/mcp-and-agents.md#in-process-calls--createtoolinvoker) |
39
30
  | `mountViewFile` | function | a native multimodal "view file" MCP tool |
40
31
  | `resolveMedia` | function | resolve a media reference for a tool result |
41
- | `validateMcpSchemas` | function | object-shaped assertion over the exact advertised schema surface — compatibility, typed properties and portable formats ([guide](../guide/mcp-and-agents.md#mcp-schema-validation-profile)) |
42
32
  | `listToolNames` | function | every contract/runtime tool name with origin, identity and transports — for stable snapshots — [guide](../guide/mcp-and-agents.md#pinning-tool-names--listtoolnames) |
43
33
  | `listContractToolNames` | function | the same listing straight from contracts — no handlers or stub services needed |
44
34
  | `describeToolCatalog` | function | inspect the exact model-facing names, source identities, schema byte sizes and deferred state; an explicit total byte budget fails closed |
45
35
  | `ToolCatalogConfig` / `ToolCatalogEntry` | _type_ | catalog source, transport, optional explicit schema budget and one inspectable result row |
46
- | `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
47
- | `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
48
- | `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
49
- | `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
50
- | `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
51
- | `McpStdioHandle` | _type_ | closeable official stdio transport handle |
52
- | `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
53
- | `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
54
- | `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
55
- | `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
56
- | `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
57
- | `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
58
- | `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
59
- | `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
60
- | `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
61
- | `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
62
- | `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
63
- | `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
64
- | `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
65
- | `McpMountConfig` | _type_ | config for `mountMcp` |
66
- | `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
67
- | `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
68
36
  | `RuntimeToolDefinition` | _type_ | heterogeneous registration of pathless operations in `runtimeTools: [...]`; an inline handler is contextually typed by the parsed object, a definition constructed with its own schema registers unchanged, and the runner validates input before the handler |
69
37
  | `RuntimeToolDefinitionBase` | _type_ | common name, identity, input, exposure and MCP metadata fields |
70
38
  | `RuntimeToolDefinitionWithOutput` | _type_ | the one neutral construction: identity, schemas and a handler typed from them; the fourth type argument names the adapter's `present` extension (`RuntimeToolPresenters<…>` here, `RuntimeMcpToolPresenters<…>` on `stitchkit/tools/mcp`, none by default) |
@@ -90,11 +58,8 @@ payload.
90
58
  | `CimdCacheEvent` | _type_ | observable CIMD cache hit, miss, revalidation and eviction event |
91
59
  | `createSecureClientMetadataFetcher` | function | production HTTPS, DNS/IP-pinned CIMD fetcher |
92
60
  | `RuntimeAgentModelOutput` | _type_ | AI SDK model-facing text/JSON/content output returned by `present.agent` |
93
- | `AgentMountConfig` | _type_ | config for `mountAgent` |
94
61
  | `AgentToolRegistry` / `AgentToolRegistryBuilder` / `AgentToolRegistryInput` | _type_ | the composed runtime surface and its builder: declared defaults, `replace`/`disable` by name, and the exact `{ tools, names }` a mount receives |
95
62
  | `defineToolRegistry` | function | compose runtime tools over one declared default set; an unknown `replace`/`disable` name is refused instead of silently leaving the default in place |
96
- | `AgentContext` | _type_ | the context merged into agent tool handlers |
97
- | `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
98
63
  | `ToolExtend` | _type_ | extra-args extension for `mountMcp` / `mountAgent` |
99
64
  | `ToolLifecycle` | _type_ | `beforeHandle` / `afterHandle` gate for tool calls — [guide](../guide/mcp-and-agents.md#guarding-tools--lifecycle) |
100
65
  | `ToolExecutionControlReason` | _type_ | internal managed-execution stop reason: stale run or requested interruption |
@@ -126,7 +91,6 @@ payload.
126
91
  | `NonPortableFormat` | _type_ | one `{ path, format }` portability finding |
127
92
  | `PORTABLE_JSON_SCHEMA_FORMATS` | constant | portable-format baseline used by MCP validation |
128
93
  | `ToolNameEntry` | _type_ | one `listToolNames` row — `{ kind, name, service, method, transports }` |
129
- | `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
130
94
  | `McpMediaContent` | _type_ | a multimodal MCP content item |
131
95
 
132
96
  ### Native tools
@@ -230,39 +194,6 @@ mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
230
194
  | `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
231
195
  | `isAgentToolError` | function | brand check for it — a consumer running its own loop no longer parses the message |
232
196
 
233
- ### Catalog stamp
234
-
235
- Every advertised tool and every tool result carries the fingerprint of the catalog it came
236
- from, so a long-lived consumer can see that its own copy is stale **without making a
237
- request for it**. `createMcpHandler` is stateless by construction and therefore has no
238
- retained session to push `notifications/tools/list_changed` down; the stamp needs none.
239
-
240
- Store the stamp beside the tools when you list them, compare it against the one on every
241
- result, and re-list when they differ — including on a refusal, which is exactly when a
242
- stale catalog is the likeliest explanation and the least visible one. The server side
243
- needs no wiring: every mount stamps what it advertises.
244
-
245
- | Export | Kind | Summary |
246
- |--------|------|---------|
247
- | `readMcpCatalogStamp` | function | read a peer's stamp out of `_meta`, or `null` when there is none |
248
- | `mcpCatalogMeta` | function | the `_meta` fragment a stamped tool or result carries |
249
- | `MCP_CATALOG_META_KEY` | const | the namespaced `_meta` key (`stitchkit/catalog`) |
250
- | `McpCatalogStamp` | _type_ | `{ digest, tools }` — the catalog fingerprint and its tool count |
251
-
252
- ### MCP Apps (widgets)
253
-
254
- Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.md).
255
-
256
- | Export | Kind | Summary |
257
- |--------|------|---------|
258
- | `mountMcpResource` | function | mount an MCP Apps widget resource |
259
- | `inlineMcpAppBundle` | function | inline a built widget bundle into a resource |
260
- | `EXT_APPS_BUNDLE_PLACEHOLDER` | const | the placeholder token `inlineMcpAppBundle` replaces |
261
- | `RESOURCE_MIME_TYPE` | const | the MCP Apps resource MIME type |
262
- | `McpResourceDef` | _type_ | an MCP Apps resource definition |
263
- | `McpAppResourceMeta` | _type_ | resource `_meta` for an MCP App |
264
- | `McpAppCsp` | _type_ | the widget content-security policy |
265
-
266
197
  ### Introspection & internals
267
198
 
268
199
  Advanced building blocks — the shared machinery the mounts are built on.
package/llms/tools.txt CHANGED
@@ -125,10 +125,10 @@ recursive calls without retaining request state. Every invocation gets a fresh
125
125
  tool-call context and runs the same extension resolution, input/output
126
126
  validation, lifecycle, hooks and output-strip reporter as mounted tools.
127
127
 
128
- The dedicated entrypoint needs only the normal `stitchkit`/`zod` install. Use
129
- the broader `stitchkit/tools` barrel when the same program also mounts MCP or AI
130
- adapters and has installed their optional peers. Both imports reach the same
131
- runner; this is dependency isolation, not a second execution implementation.
128
+ The dedicated entrypoint needs only the normal `stitchkit`/`zod` install, and so does
129
+ `stitchkit/tools`, which exports the same invoker beside the rest of the tool layer. Both
130
+ imports reach the same runner; this is dependency isolation, not a second execution
131
+ implementation.
132
132
 
133
133
  `invoke` returns the canonical discriminated `ToolResult`, not an AI SDK or MCP
134
134
  presentation envelope. `invokeOrThrow` returns validated data and throws the
@@ -150,9 +150,8 @@ get the view's defaults and projected answer, which is what `collectTools` and
150
150
  An MCP-only server imports `stitchkit/tools/mcp` and installs
151
151
  `stitchkit`, `zod` and `@modelcontextprotocol/server`. The leaf's runtime and strict
152
152
  NodeNext declarations require no `ai`. It exports the existing HTTP/stdio server,
153
- schema policy, catalog and resource helpers; their implementation and security are shared
154
- with the full `stitchkit/tools` barrel. Use that full barrel when the application also
155
- needs its AI SDK features.
153
+ schema policy, catalog and resource helpers, and it is the only entrypoint that does:
154
+ `stitchkit/tools` loads no optional peer. AI SDK tools come from `stitchkit/tools/agent`.
156
155
 
157
156
  `createMcpHandler` builds a complete stateless Streamable-HTTP MCP endpoint on
158
157
  the official TypeScript SDK v2 server package. It owns server creation,
@@ -876,7 +875,8 @@ stitchkit ships the OAuth **protocol mechanics**; the app supplies only
876
875
  **identity and storage**. Three pieces wire it together:
877
876
 
878
877
  ```ts
879
- import { createMcpHandler, createMcpHttpRoute, mountOAuthProvider, oauthProtectedResourceRoute } from 'stitchkit/tools'
878
+ import { mountOAuthProvider, oauthProtectedResourceRoute } from 'stitchkit/tools'
879
+ import { createMcpHandler, createMcpHttpRoute } from 'stitchkit/tools/mcp'
880
880
  import { createServer } from 'stitchkit/server'
881
881
 
882
882
  const resource = 'https://api.example.com/mcp'
@@ -1,14 +1,95 @@
1
- # Upgrading 0.106.0 → 0.119.0 — stitchkit docs slice
1
+ # Upgrading 0.106.0 → 0.121.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.106.0 → 0.119.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.106.0 → 0.121.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.106.0 → 0.119.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.106.0 → 0.121.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.121.0
13
+
14
+ ### bounded-coding-search
15
+
16
+ **Who must act:** hosts that construct a complete `AgentCodingToolLimits` value, inspect exact
17
+ `list_directory`, `glob` or `search_files` output objects, rely on symlink cwd aliases, call `glob` on a path that may not exist, or send regex named backreferences or counted repetition above 1,000.
18
+
19
+ Partial `limits` still fill finite defaults. Complete values add:
20
+
21
+ ```ts
22
+ maxSearchDirectories: 1_000,
23
+ maxSearchEntries: 20_000,
24
+ maxSearchBytes: 16_777_216,
25
+ maxSearchOutputBytes: 65_536,
26
+ searchTimeoutMs: 5_000,
27
+ ```
28
+
29
+ Read `coverage.complete` on list, glob and search before interpreting an empty result.
30
+ List raw enumeration is also capped by `maxListEntries`; glob patterns have a 4,096-unit ceiling.
31
+ The ordinary command cwd is a pinned directory, so descendant symlink cwd aliases are refused;
32
+ use the real relative directory name. Custom sandbox launchers own atomic cwd capture.
33
+ `coverage.reasons` names stopped
34
+ budgets, cancellation, denial, unreadable files and lines beyond the searchable byte ceiling.
35
+ `coverage.scope` names the workspace-relative include, exclusion policy and symlink policy;
36
+ directory/entry/read-byte counters report work reached by the bounded reader. Denied and error
37
+ lists can themselves be truncated. The entire UTF-8 JSON result fits `maxSearchOutputBytes`
38
+ (minimum 1,024); an input whose minimum envelope cannot fit refuses before I/O.
39
+
40
+ Regex queries keep JavaScript syntax, `(?ims-ims:…)` modifiers and Annex B forms, and their
41
+ cost is bounded per line: a line whose backtracking work, repetition capped at the line's length,
42
+ stays within 2^24 steps runs natively, any other line in linear time. Named backreferences,
43
+ counted repetition above 1,000 and patterns needing the automaton with more than 16,384 automaton states, 65,536
44
+ construction steps (nested repetition of an empty group such as `(?:(?:){1000}){1000}`) or
45
+ 4,194,304 overlapping character-set memberships now return `BAD_REQUEST`
46
+ before authorization or file access, as
47
+ numbered backreferences and lookaround already did. Spell the repeated text out, for example
48
+ replace `{ query: '(?<w>ab)\\k<w>', regex: true }` with `{ query: '(ab)ab', regex: true }`.
49
+
50
+ `glob` with a `path` that is missing, a file or a symlink now refuses (`NOT_FOUND` or
51
+ `BAD_REQUEST`, with a hint) instead of returning no paths; treat that refusal as "nothing
52
+ there". `run_command` refuses such a `cwd` the same way.
53
+
54
+ Glob matching preserves `**`, `*`, `?` and literal punctuation, including embedded `**`.
55
+ A pattern that prunes directories may produce an explanatory `hint` without counting unseen
56
+ files. `glob` confines traversal to its requested path and viable pattern prefixes.
57
+
58
+ Traversal checks cancellation and deadlines at CPU checkpoints and races asynchronous waits.
59
+ Late opened handles are closed; in-flight operating-system calls are not claimed to be interrupted.
60
+ Reaching an entry or result ceiling conservatively reports partial coverage without a lookahead.
61
+
62
+ ## Released migration: 0.120.0
63
+
64
+ ### tools-barrel-subpaths
65
+
66
+ **Who must act:** code importing the MCP server, `mountAgent` or `createToolkit` from
67
+ `stitchkit/tools`. Imports of the registry, tool names, manifest, runtime and native tools, the
68
+ invoker, the OAuth provider and the durability engine stay where they are.
69
+
70
+ `stitchkit/tools` now loads no optional peer, so an application without
71
+ `@modelcontextprotocol/server` and `ai` can import it. Move each adapter import to its subpath:
72
+
73
+ ```ts
74
+ // before
75
+ import { createMcpHandler, listToolNames, mountAgent } from 'stitchkit/tools'
76
+ import { createToolkit } from 'stitchkit/tools'
77
+ // after
78
+ import { listToolNames } from 'stitchkit/tools'
79
+ import { createMcpHandler } from 'stitchkit/tools/mcp'
80
+ import { mountAgent } from 'stitchkit/tools/agent'
81
+ import { createToolkit } from 'stitchkit/tools/toolkit'
82
+ ```
83
+
84
+ | Names | New subpath | Peers it needs |
85
+ |-------|-------------|----------------|
86
+ | `createMcpHandler`, `createMcpHttpRoute`, `buildMcpServer`, `mountMcp`, `mountMcpResource`, `validateMcpSchemas`, `createStdioMcpServer`, `bindStdioProcessSignals`, `inlineMcpAppBundle`, `mcpCatalogMeta`, `readMcpCatalogStamp`, `EXT_APPS_BUNDLE_PLACEHOLDER`, `MCP_CATALOG_META_KEY`, `RESOURCE_MIME_TYPE` and their config types, `McpServer`, `IncompatibleSchemaPolicy`, `McpSchemaValidationConfig` | `stitchkit/tools/mcp` | `@modelcontextprotocol/server` |
87
+ | `mountAgent`, `AgentMountConfig`, `AgentContext` | `stitchkit/tools/agent` | `ai` |
88
+ | `createToolkit`, `Toolkit` | `stitchkit/tools/toolkit` | `@modelcontextprotocol/server`, `ai` |
89
+
90
+ The move is mechanical: `bunx stitchkit upgrade --from 0.119.0` lists every import it touches, and
91
+ `tsc` names any name still imported from `stitchkit/tools`. Behaviour is unchanged.
92
+
12
93
  ## Released migration: 0.119.0
13
94
 
14
95
  ### factory-default-exposure
@@ -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.106.0 → 0.119.0: `llms/upgrading-0.106.0-0.119.0.txt`
14
+ - 0.106.0 → 0.121.0: `llms/upgrading-0.106.0-0.121.0.txt`
15
15
  - 0.96.0 → 0.105.0: `llms/upgrading-0.96.0-0.105.0.txt`
16
16
  - 0.69.0 → 0.95.0: `llms/upgrading-0.69.0-0.95.0.txt`
17
17
  - 0.55.0 → 0.68.0: `llms/upgrading-0.55.0-0.68.0.txt`