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.
- package/CHANGELOG.md +68 -0
- package/README.md +10 -7
- package/dist/agent-runtime/coding-discovery.d.ts +25 -0
- package/dist/agent-runtime/coding-discovery.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-automaton.d.ts +37 -0
- package/dist/agent-runtime/coding-search-automaton.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-case-fold.d.ts +4 -0
- package/dist/agent-runtime/coding-search-case-fold.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-class-ranges.d.ts +10 -0
- package/dist/agent-runtime/coding-search-class-ranges.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-contract.d.ts +86 -0
- package/dist/agent-runtime/coding-search-contract.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-limits.d.ts +13 -0
- package/dist/agent-runtime/coding-search-limits.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-matcher.d.ts +33 -0
- package/dist/agent-runtime/coding-search-matcher.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-output.d.ts +5 -0
- package/dist/agent-runtime/coding-search-output.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-regex-syntax.d.ts +39 -0
- package/dist/agent-runtime/coding-search-regex-syntax.d.ts.map +1 -0
- package/dist/agent-runtime/coding-search-unit-classes.d.ts +31 -0
- package/dist/agent-runtime/coding-search-unit-classes.d.ts.map +1 -0
- package/dist/agent-runtime/coding-shell-process.d.ts +1 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +8 -3
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts +1 -11
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts +6 -2
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-refusals.d.ts +6 -0
- package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search.d.ts +113 -0
- package/dist/agent-runtime/coding-tool-search.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan-budget.d.ts +32 -0
- package/dist/agent-runtime/contained-scan-budget.d.ts.map +1 -0
- package/dist/agent-runtime/contained-scan-contract.d.ts +52 -0
- package/dist/agent-runtime/contained-scan-contract.d.ts.map +1 -0
- package/dist/agent-runtime/contained-scan.d.ts +48 -13
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +5 -1
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/workspace-glob.d.ts +6 -0
- package/dist/agent-runtime/workspace-glob.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +7 -7
- package/dist/entrypoints/agent-runtime/harness.js +5 -5
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +8 -8
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -9
- package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -9
- package/dist/entrypoints/agent-runtime/testing.js +9 -9
- package/dist/entrypoints/agent-runtime.js +16 -14
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +5 -5
- package/dist/entrypoints/application.js +6 -6
- package/dist/entrypoints/cli/publish.js +5 -5
- package/dist/entrypoints/cli.js +8 -8
- package/dist/entrypoints/contract.js +4 -4
- package/dist/entrypoints/files.js +4 -4
- package/dist/entrypoints/http.js +2 -2
- package/dist/entrypoints/index.js +2 -2
- package/dist/entrypoints/node.js +1 -1
- package/dist/entrypoints/process/owner-loss.js +2 -1
- package/dist/entrypoints/process.js +4 -4
- package/dist/entrypoints/remote.js +1 -1
- package/dist/entrypoints/server.js +12 -12
- package/dist/entrypoints/telegram/screens.js +5 -5
- package/dist/entrypoints/telegram.js +8 -8
- package/dist/entrypoints/testing.js +2 -2
- package/dist/entrypoints/tools/agent.d.ts +9 -0
- package/dist/entrypoints/tools/agent.d.ts.map +1 -0
- package/dist/entrypoints/tools/agent.js +16 -0
- package/dist/entrypoints/tools/connections.js +4 -4
- package/dist/entrypoints/tools/mcp.js +104 -4
- package/dist/entrypoints/tools/toolkit.d.ts +9 -0
- package/dist/entrypoints/tools/toolkit.d.ts.map +1 -0
- package/dist/entrypoints/tools/toolkit.js +40 -0
- package/dist/entrypoints/tools.d.ts +0 -10
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +25 -69
- package/dist/{index-s0qjs6ee.js → index-0fra8xvy.js} +9 -81
- package/dist/{index-rxcgp4b9.js → index-10rg78vf.js} +1 -1
- package/dist/index-1psbyyhj.js +21 -0
- package/dist/index-3prvb42w.js +30 -0
- package/dist/{index-ba7are04.js → index-4tyt1qya.js} +1 -1
- package/dist/index-568w258r.js +76 -0
- package/dist/{index-fqd4yqwd.js → index-6j15ktag.js} +1 -1
- package/dist/{index-zrdcmg6j.js → index-72xtvcvr.js} +40 -6
- package/dist/{index-6a69xzrx.js → index-7zwtbak8.js} +5 -46
- package/dist/{index-fcqj44mb.js → index-8ryydawp.js} +4 -4
- package/dist/{index-q968hy6y.js → index-aqmadanx.js} +2 -2
- package/dist/{index-s20s2mad.js → index-bgcwxhxh.js} +16 -14
- package/dist/index-bph35vpy.js +77 -0
- package/dist/{index-arjmb6de.js → index-eeahxwvg.js} +60 -76
- package/dist/{index-57gqaq8b.js → index-f6pw75e1.js} +1 -1
- package/dist/{index-f4njz9j0.js → index-gq3fnq3f.js} +1 -1
- package/dist/{index-ynrf908v.js → index-gtx3eknx.js} +1 -1
- package/dist/index-h1j71dr1.js +48 -0
- package/dist/{index-nn9qvkww.js → index-j95jp7ee.js} +45 -9
- package/dist/{index-mgb7r8b8.js → index-jswst0h3.js} +1 -1
- package/dist/{index-bbvc59gw.js → index-knmnj11j.js} +9 -180
- package/dist/{index-2kbysk9s.js → index-m5m9rmvt.js} +2 -0
- package/dist/{index-g444vfz2.js → index-nwm3ww60.js} +1 -1
- package/dist/{index-yk4g8805.js → index-pq7rkwkk.js} +1 -30
- package/dist/index-qaqxdbxf.js +2857 -0
- package/dist/{index-x8d9fdeg.js → index-qctbzmg9.js} +8 -4
- package/dist/index-s9a0fjh3.js +305 -0
- package/dist/index-sb9dr3tq.js +14 -0
- package/dist/{index-tvtacc9a.js → index-zyc64nbh.js} +1 -34
- package/dist/internal/contained-directory.d.ts +1 -1
- package/dist/internal/contained-directory.d.ts.map +1 -1
- package/dist/internal/contained-files.d.ts +18 -51
- package/dist/internal/contained-files.d.ts.map +1 -1
- package/dist/internal/contained-read.d.ts +17 -0
- package/dist/internal/contained-read.d.ts.map +1 -0
- package/dist/internal/darwin-binding.d.ts +3 -1
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/process/bun-child.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/group.d.ts +2 -0
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +1 -0
- package/dist/process/launch.d.ts.map +1 -1
- package/dist/process/owned-child.d.ts.map +1 -1
- package/dist/process/owner-loss-guard.d.ts.map +1 -1
- package/dist/process/owner-loss-protocol.d.ts +1 -0
- package/dist/process/owner-loss-protocol.d.ts.map +1 -1
- package/llms/agent-runtime-coding-tools.txt +9 -9
- package/llms/agent-runtime-harness.txt +4 -3
- package/llms/agent-runtime-sandbox.txt +1 -1
- package/llms/agent-runtime.2.txt +20 -2
- package/llms/agent-runtime.3.txt +4 -46
- package/llms/agent-runtime.4.txt +113 -0
- package/llms/agent-runtime.txt +70 -37
- package/llms/application.3.txt +5 -2
- package/llms/cli.txt +1 -1
- package/llms/contract.txt +1 -1
- package/llms/process.txt +3 -1
- package/llms/server.5.txt +2 -0
- package/llms/stitchkit.txt +15 -9
- package/llms/testing.txt +4 -6
- package/llms/tools-agent.txt +24 -0
- package/llms/tools-mcp.txt +71 -6
- package/llms/tools-toolkit.txt +23 -0
- package/llms/tools.2.txt +6 -3
- package/llms/tools.3.txt +8 -77
- package/llms/tools.txt +8 -8
- package/llms/{upgrading-0.106.0-0.119.0.txt → upgrading-0.106.0-0.121.0.txt} +84 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +360 -139
- package/llms.txt +11 -9
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/native-assets.json +4 -4
- package/package.json +10 -2
- package/dist/index-1k18qzqa.js +0 -1478
- package/dist/index-6f49krb5.js +0 -107
- package/dist/{index-2dfvv1jg.js → index-2fc1k9k2.js} +0 -0
- package/dist/{index-qndsr7f0.js → index-5efrpfmj.js} +3 -3
- /package/dist/{index-cyxp8rbf.js → index-mtwh9hyp.js} +0 -0
package/llms-full.txt
CHANGED
|
@@ -55,8 +55,10 @@ own, recorded as an ADR.
|
|
|
55
55
|
| `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports, exact money and rounding tables |
|
|
56
56
|
| `stitchkit/server` | server (Bun) | stable | `createServer`, `implement`, hooks, auth, Socket.IO server, server primitives |
|
|
57
57
|
| `stitchkit/node` | server (Node ≥ 22) | stable | `serveNode` + the runtime-agnostic core — the Node mirror of `/server` |
|
|
58
|
-
| `stitchkit/tools` | server | stable |
|
|
58
|
+
| `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 |
|
|
59
59
|
| `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 |
|
|
60
|
+
| `stitchkit/tools/agent` | server (Bun or Node) | evolving | `mountAgent` — a contract's operations as AI SDK tools; only Zod and the `ai` peer |
|
|
61
|
+
| `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 |
|
|
60
62
|
| `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 |
|
|
61
63
|
| `stitchkit/tools/invoker` | server | stable | peer-free `createToolInvoker` over the canonical contract tool runner |
|
|
62
64
|
| `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 |
|
|
@@ -82,13 +84,13 @@ own, recorded as an ADR.
|
|
|
82
84
|
| `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
|
|
83
85
|
| `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
|
|
84
86
|
| `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
|
|
85
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the
|
|
87
|
+
| `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 |
|
|
86
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 |
|
|
87
89
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
88
90
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
89
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) |
|
|
90
92
|
| `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 |
|
|
91
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in
|
|
93
|
+
| `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 |
|
|
92
94
|
| `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
|
|
93
95
|
| `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
96
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
@@ -100,7 +102,7 @@ own, recorded as an ADR.
|
|
|
100
102
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
101
103
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
102
104
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
103
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the
|
|
105
|
+
| `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 |
|
|
104
106
|
| `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
|
|
105
107
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
106
108
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -203,7 +205,10 @@ map — feature → packages:
|
|
|
203
205
|
| `createServer` (Bun) | — (uses `Bun.serve`) |
|
|
204
206
|
| `serveNode` (Node ≥ 22) | `srvx` (+ `@types/bun` dev) |
|
|
205
207
|
| In-process contract tools (`stitchkit/tools/invoker`) | — |
|
|
206
|
-
|
|
|
208
|
+
| Tool layer — registry, tool names, runtime tools (`stitchkit/tools`) | — |
|
|
209
|
+
| MCP server (`stitchkit/tools/mcp`) | `@modelcontextprotocol/server` |
|
|
210
|
+
| AI SDK agent tools (`stitchkit/tools/agent`) | `ai` |
|
|
211
|
+
| MCP and agent toolkit (`stitchkit/tools/toolkit`) | `@modelcontextprotocol/server` `ai` |
|
|
207
212
|
| Agent application runtime (`stitchkit/agent-runtime`) | `ai` |
|
|
208
213
|
| Headless Agent harness (`stitchkit/agent-runtime/harness`) | `ai` |
|
|
209
214
|
| Agent coding tools (`stitchkit/agent-runtime/coding-tools`) | — |
|
|
@@ -232,15 +237,16 @@ bun add socket.io @socket.io/bun-engine # e.g. the Socket.IO server on Bun
|
|
|
232
237
|
```
|
|
233
238
|
|
|
234
239
|
Dynamic optional-peer adapters fail with an actionable error naming the package
|
|
235
|
-
and install command. Static entrypoints such as `stitchkit/tools` fail during
|
|
240
|
+
and install command. Static entrypoints such as `stitchkit/tools/mcp` fail during
|
|
236
241
|
ESM resolution by naming the exact missing package; the feature-to-peer matrix
|
|
237
242
|
below is the canonical install command.
|
|
238
243
|
|
|
239
|
-
|
|
240
|
-
|
|
244
|
+
`stitchkit/tools` itself loads no optional peer. Install the peer of the adapter
|
|
245
|
+
you import — both for `stitchkit/tools/toolkit`:
|
|
241
246
|
|
|
242
247
|
```bash
|
|
243
|
-
bun add @modelcontextprotocol/server@^2
|
|
248
|
+
bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp
|
|
249
|
+
bun add ai@^7 # stitchkit/tools/agent
|
|
244
250
|
```
|
|
245
251
|
|
|
246
252
|
Browser, HTTP-client and React entrypoints remain usable without either MCP
|
|
@@ -3936,10 +3942,10 @@ recursive calls without retaining request state. Every invocation gets a fresh
|
|
|
3936
3942
|
tool-call context and runs the same extension resolution, input/output
|
|
3937
3943
|
validation, lifecycle, hooks and output-strip reporter as mounted tools.
|
|
3938
3944
|
|
|
3939
|
-
The dedicated entrypoint needs only the normal `stitchkit`/`zod` install
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3945
|
+
The dedicated entrypoint needs only the normal `stitchkit`/`zod` install, and so does
|
|
3946
|
+
`stitchkit/tools`, which exports the same invoker beside the rest of the tool layer. Both
|
|
3947
|
+
imports reach the same runner; this is dependency isolation, not a second execution
|
|
3948
|
+
implementation.
|
|
3943
3949
|
|
|
3944
3950
|
`invoke` returns the canonical discriminated `ToolResult`, not an AI SDK or MCP
|
|
3945
3951
|
presentation envelope. `invokeOrThrow` returns validated data and throws the
|
|
@@ -3961,9 +3967,8 @@ get the view's defaults and projected answer, which is what `collectTools` and
|
|
|
3961
3967
|
An MCP-only server imports `stitchkit/tools/mcp` and installs
|
|
3962
3968
|
`stitchkit`, `zod` and `@modelcontextprotocol/server`. The leaf's runtime and strict
|
|
3963
3969
|
NodeNext declarations require no `ai`. It exports the existing HTTP/stdio server,
|
|
3964
|
-
schema policy, catalog and resource helpers
|
|
3965
|
-
|
|
3966
|
-
needs its AI SDK features.
|
|
3970
|
+
schema policy, catalog and resource helpers, and it is the only entrypoint that does:
|
|
3971
|
+
`stitchkit/tools` loads no optional peer. AI SDK tools come from `stitchkit/tools/agent`.
|
|
3967
3972
|
|
|
3968
3973
|
`createMcpHandler` builds a complete stateless Streamable-HTTP MCP endpoint on
|
|
3969
3974
|
the official TypeScript SDK v2 server package. It owns server creation,
|
|
@@ -4687,7 +4692,8 @@ stitchkit ships the OAuth **protocol mechanics**; the app supplies only
|
|
|
4687
4692
|
**identity and storage**. Three pieces wire it together:
|
|
4688
4693
|
|
|
4689
4694
|
```ts
|
|
4690
|
-
import {
|
|
4695
|
+
import { mountOAuthProvider, oauthProtectedResourceRoute } from 'stitchkit/tools'
|
|
4696
|
+
import { createMcpHandler, createMcpHttpRoute } from 'stitchkit/tools/mcp'
|
|
4691
4697
|
import { createServer } from 'stitchkit/server'
|
|
4692
4698
|
|
|
4693
4699
|
const resource = 'https://api.example.com/mcp'
|
|
@@ -4948,7 +4954,7 @@ see [Agent application runtime](./agent-runtime.md).
|
|
|
4948
4954
|
`generateText` / `streamText`:
|
|
4949
4955
|
|
|
4950
4956
|
```ts
|
|
4951
|
-
import { mountAgent } from 'stitchkit/tools'
|
|
4957
|
+
import { mountAgent } from 'stitchkit/tools/agent'
|
|
4952
4958
|
import { generateText } from 'ai'
|
|
4953
4959
|
|
|
4954
4960
|
const tools = mountAgent(usersService, { context: { userId: 'agent-1' } })
|
|
@@ -5032,7 +5038,9 @@ result. Optional presentation callbacks map that result to MCP content and AI
|
|
|
5032
5038
|
SDK model output without coupling the handler to either SDK:
|
|
5033
5039
|
|
|
5034
5040
|
```ts
|
|
5035
|
-
import {
|
|
5041
|
+
import { defineRuntimeTool } from 'stitchkit/tools'
|
|
5042
|
+
import { createMcpHandler } from 'stitchkit/tools/mcp'
|
|
5043
|
+
import { mountAgent } from 'stitchkit/tools/agent'
|
|
5036
5044
|
import { z } from 'zod'
|
|
5037
5045
|
|
|
5038
5046
|
const renderPreview = defineRuntimeTool({
|
|
@@ -5398,7 +5406,8 @@ hooks. The built-in `mountViewFile`, `mountWait`, `mountDownload` and
|
|
|
5398
5406
|
media helper fetches with SSRF and path-traversal defenses:
|
|
5399
5407
|
|
|
5400
5408
|
```ts
|
|
5401
|
-
import {
|
|
5409
|
+
import { mountViewFile } from 'stitchkit/tools'
|
|
5410
|
+
import { createMcpHandler } from 'stitchkit/tools/mcp'
|
|
5402
5411
|
|
|
5403
5412
|
const handleMcp = createMcpHandler({
|
|
5404
5413
|
serverInfo: { name: 'my-app', version: '1.0.0' },
|
|
@@ -5506,16 +5515,16 @@ identical. Write the handler once; it serves every surface.
|
|
|
5506
5515
|
> **Maturity: evolving.** This surface is still finding its shape and may be
|
|
5507
5516
|
> redefined in any minor release — always with a `### ⚠️ Breaking changes` entry
|
|
5508
5517
|
> and a migration section, never silently. If your application already owns the
|
|
5509
|
-
> conversation loop, `mountAgent` from `stitchkit/tools` is the
|
|
5518
|
+
> conversation loop, `mountAgent` from `stitchkit/tools/agent` is the direct path.
|
|
5510
5519
|
|
|
5511
5520
|
`stitchkit/agent-runtime` is the server-only, opinionated layer above
|
|
5512
5521
|
`mountAgent`. Use it when the application wants Stitchkit to own conversation
|
|
5513
5522
|
mechanics: durable acceptance, history projection, the AI SDK stream loop,
|
|
5514
5523
|
checkpoints, keyed interruption, terminal commit and stable application events.
|
|
5515
5524
|
|
|
5516
|
-
If the application already owns that loop,
|
|
5517
|
-
`stitchkit/tools`. `stitchkit/tools`
|
|
5518
|
-
this entrypoint uses the tool executor
|
|
5525
|
+
If the application already owns that loop, import `mountAgent` from
|
|
5526
|
+
`stitchkit/tools/agent`. Neither `stitchkit/tools` nor `stitchkit/tools/agent` depends on
|
|
5527
|
+
this entrypoint; this entrypoint uses the tool executor, but pulls no MCP peer, so
|
|
5519
5528
|
choosing `mountAgent` alone costs you nothing from here.
|
|
5520
5529
|
|
|
5521
5530
|
UI and shared DTO code must import canonical records and delivery validation from
|
|
@@ -5539,12 +5548,8 @@ persistence, event sinks and every Node context dependency.
|
|
|
5539
5548
|
bun add stitchkit ai zod
|
|
5540
5549
|
```
|
|
5541
5550
|
|
|
5542
|
-
`mountAgent` from `stitchkit/tools` — used in the composition below —
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
```sh
|
|
5546
|
-
bun add @modelcontextprotocol/server
|
|
5547
|
-
```
|
|
5551
|
+
`mountAgent` from `stitchkit/tools/agent` — used in the composition below — needs no
|
|
5552
|
+
peer beyond `ai`.
|
|
5548
5553
|
|
|
5549
5554
|
OpenRouter is isolated so other runtime users do not resolve its package:
|
|
5550
5555
|
|
|
@@ -5565,7 +5570,8 @@ import {
|
|
|
5565
5570
|
defineModelRegistry,
|
|
5566
5571
|
} from 'stitchkit/agent-runtime'
|
|
5567
5572
|
import { openRouterProvider } from 'stitchkit/agent-runtime/openrouter'
|
|
5568
|
-
import { composeToolLifecycle
|
|
5573
|
+
import { composeToolLifecycle } from 'stitchkit/tools'
|
|
5574
|
+
import { mountAgent } from 'stitchkit/tools/agent'
|
|
5569
5575
|
|
|
5570
5576
|
const protocol = defineAgentProtocol({
|
|
5571
5577
|
context: z.object({ userId: z.string() }),
|
|
@@ -5794,14 +5800,26 @@ outermost first, stopping at the first refusal; discovery rooted at `.` also ask
|
|
|
5794
5800
|
Thus denying `credentials` denies everything
|
|
5795
5801
|
under it. The comparison is segment-wise, so it does not deny `credentials-backup`, and a path of
|
|
5796
5802
|
depth N costs N questions for direct access. Directory decisions happen before descent; file decisions and
|
|
5797
|
-
`search_files.include` happen before opening content.
|
|
5803
|
+
`search_files.include` happen before opening content. Incompatible glob directory prefixes are
|
|
5804
|
+
pruned before policy or directory opens. Requested paths use `/`: a backslash is
|
|
5798
5805
|
refused rather than normalised, because the workspace walk reads it as a separator and every
|
|
5799
5806
|
authorization callback would otherwise be asked about a different decomposition than the one opened. File paths are relative, bounded and contained after
|
|
5800
5807
|
descriptor-relative resolution: each ancestor is opened without following symlinks. Reads and edits
|
|
5801
5808
|
stay pinned through authorization; `write_file` plans before it and opens the parent after, because
|
|
5802
5809
|
the parent it creates does not exist yet. Reads revalidate the pinned file identity;
|
|
5803
5810
|
writes and patches revalidate the pinned parent identity; search and resource discovery descend
|
|
5804
|
-
only through opened directories.
|
|
5811
|
+
only through opened directories. Every filesystem tool selects its root capability before operation or path authorization and retains
|
|
5812
|
+
that identity if a callback replaces the root path or configured alias. On Linux the ordinary
|
|
5813
|
+
command launcher spawns the command with the pinned directory's `/proc` descriptor link as its cwd;
|
|
5814
|
+
on macOS it inherits the pinned cwd through an isolated guard — one short-lived guard process per
|
|
5815
|
+
command, tens of milliseconds, outside `shellTimeoutMs`, which counts from the command's start. The
|
|
5816
|
+
application process never changes cwd. Where
|
|
5817
|
+
contained descriptors are unavailable (Windows), `run_command` accepts a cwd whose realpath is
|
|
5818
|
+
that same name under the root — a symlink segment refuses there too — and checks the directory's
|
|
5819
|
+
identity again immediately before launch, after every host decision.
|
|
5820
|
+
A custom sandbox launcher owns atomic cwd capture at its pathname handoff; the SDK refuses a
|
|
5821
|
+
changed identity after policy/prepare and immediately before that handoff. A path that changed
|
|
5822
|
+
during direct-access authorization refuses with `CONFLICT`.
|
|
5805
5823
|
A path spelled differently from the name stored on disk refuses before any policy reads it, so on a
|
|
5806
5824
|
case-insensitive volume a rule on `credentials` cannot be passed by asking for `CREDENTIALS`.
|
|
5807
5825
|
NUL bytes are refused before either host policy sees a path.
|
|
@@ -5855,11 +5873,51 @@ crosses a process boundary and is rebuilt from the wire.
|
|
|
5855
5873
|
excluded directory is not "no files", and a model told only "nothing found" concludes the wrong
|
|
5856
5874
|
thing. `search_files` takes `regex`, `context` lines and an anchored `include` pattern matched
|
|
5857
5875
|
against the whole workspace-relative path. `*` does not cross `/`, so files in subdirectories need
|
|
5858
|
-
`**/`; `scannedFiles` counts files admitted by both that filter and host authorization
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5876
|
+
`**/`; `scannedFiles` counts files admitted by both that filter and host authorization that reached
|
|
5877
|
+
comparison. One finite glob automaton matches files and prunes incompatible directory prefixes;
|
|
5878
|
+
`glob` also confines its walk to the requested path. A `hint` can explain include filtering or
|
|
5879
|
+
pruning, without counting files below unopened directories.
|
|
5880
|
+
|
|
5881
|
+
Search processes one file at a time. List, glob and search share directory, entry, serialized-output,
|
|
5882
|
+
timeout and cancellation budgets, including canonical spelling checks before path authorization.
|
|
5883
|
+
`list_directory` caps raw enumeration at the smaller of `maxListEntries` and `maxSearchEntries`;
|
|
5884
|
+
its coverage scope lists symlinks while glob/search skip them. Glob patterns are limited to 4,096
|
|
5885
|
+
UTF-16 units. A scoped glob measures depth from its requested base directory. In addition to `maxSearchFiles` (10,000), `maxSearchDepth`
|
|
5886
|
+
(32), `maxSearchResults` (100) and `maxReadBytes` (262,144), hosts can configure
|
|
5887
|
+
`maxSearchDirectories` (1,000 directory-open attempts, root included), `maxSearchEntries`
|
|
5888
|
+
(20,000 entries observed by bounded readers), `maxSearchBytes` (16,777,216 aggregate content
|
|
5889
|
+
bytes, including rejected UTF-8), `maxSearchOutputBytes` (65,536 bytes for the entire serialized
|
|
5890
|
+
UTF-8 JSON, minimum 1,024) and `searchTimeoutMs` (5,000). An input whose minimum coverage
|
|
5891
|
+
envelope cannot fit the output ceiling refuses before filesystem access. Directory readers cap
|
|
5892
|
+
enumeration before materialization and sorting; reaching an entry or result ceiling is
|
|
5893
|
+
conservatively partial, without reading a lookahead entry or match.
|
|
5894
|
+
|
|
5895
|
+
`list_directory`, `glob` and `search_files` return `coverage.complete` and `coverage.reasons`
|
|
5896
|
+
to distinguish full empty results from partial work. Glob `resultTruncated` conservatively marks
|
|
5897
|
+
the result ceiling even when no extra match was read.
|
|
5898
|
+
Coverage names the include/exclusion/symlink scope, directory and entry counters, actual content
|
|
5899
|
+
bytes and elapsed milliseconds. Limits, cancellation, denial, unreadable files and oversized
|
|
5900
|
+
lines are explicit reasons. `errors` names only a workspace-relative path, operation and safe code;
|
|
5901
|
+
`errorsTruncated` and `deniedTruncated` report shortened diagnostics. Excluded directories and
|
|
5902
|
+
symlinks are outside the declared search scope. The caller's signal and deadline reach host
|
|
5903
|
+
authorization, file reads and traversal; CPU checkpoints and asynchronous races stop further work.
|
|
5904
|
+
Late opened handles are closed, while already-running kernel calls may finish later. Directory
|
|
5905
|
+
enumeration and glob matching have internal checkpoints; cancellation stops their producer loops.
|
|
5906
|
+
Host policy and visitor exceptions propagate to error hooks with their original cause, rather
|
|
5907
|
+
than becoming filesystem diagnostics. Diagnostic byte admission is linear and checks the deadline
|
|
5908
|
+
even for an empty result.
|
|
5909
|
+
|
|
5910
|
+
Regex searches use JavaScript `RegExp` syntax without flags — groups, alternation, classes,
|
|
5911
|
+
anchors, `\b`, quantifiers and `(?ims-ims:…)` modifiers — with bounded cost per line. A line
|
|
5912
|
+
whose backtracking work (paths × longest path × line length × (number of groups + 1), every
|
|
5913
|
+
repetition capped at the line length beyond the iterations it requires) stays within 2^24 steps runs on the native engine, so ordinary `.*` searches over code
|
|
5914
|
+
lines keep native speed and the deadline is observed between lines; any other line runs on a
|
|
5915
|
+
cached linear automaton, so `(a+)+$` on a long line costs the same as `a+` and the deadline is
|
|
5916
|
+
observed inside the line. Backreferences and
|
|
5917
|
+
lookaround refuse before I/O; lines over 8,192 UTF-8 bytes are skipped with incomplete coverage.
|
|
5918
|
+
Literal queries allow up to 8,192 UTF-16 units and include patterns up to 4,096.
|
|
5919
|
+
|
|
5920
|
+
With an optional `AgentCodingArtifactStore`, shell output beyond the inline
|
|
5863
5921
|
preview continues into an opaque bounded artifact and `read_output` reads slices without
|
|
5864
5922
|
exposing a host path. Without a store, the previous finite output-limit behavior is unchanged.
|
|
5865
5923
|
|
|
@@ -7279,7 +7337,8 @@ import {
|
|
|
7279
7337
|
createAgentHarnessFileResources,
|
|
7280
7338
|
createHeadlessAgentHarness,
|
|
7281
7339
|
} from 'stitchkit/agent-runtime/harness';
|
|
7282
|
-
import { composeToolLifecycle
|
|
7340
|
+
import { composeToolLifecycle } from 'stitchkit/tools';
|
|
7341
|
+
import { mountAgent } from 'stitchkit/tools/agent';
|
|
7283
7342
|
|
|
7284
7343
|
const resources = createAgentHarnessFileResources({
|
|
7285
7344
|
roots: [{ id: 'guide', kind: 'instruction', path: instructionRoot }],
|
|
@@ -7303,8 +7362,8 @@ compose your authorization with the run's `toolFenceLifecycle` by `composeToolLi
|
|
|
7303
7362
|
fence rejects a call from a run that no longer owns the conversation, and it must run exactly
|
|
7304
7363
|
once. Every mount option remains available, including registry, runtime tools, extension,
|
|
7305
7364
|
coercion, output stripping, hooks and durability, and the callback may be async. The same callback
|
|
7306
|
-
still accepts arbitrary typed AI SDK tools and prepareStep. `stitchkit/tools
|
|
7307
|
-
|
|
7365
|
+
still accepts arbitrary typed AI SDK tools and prepareStep. `mountAgent` comes from `stitchkit/tools/agent`, which needs only the `ai` peer the
|
|
7366
|
+
harness already has; the base harness stays AI-only.
|
|
7308
7367
|
The resource reader is explicitly selected: filtered allowlists do not gain tools merely
|
|
7309
7368
|
because a loader exists. Root IDs, kinds, provenance and limits are unchanged.
|
|
7310
7369
|
|
|
@@ -8657,7 +8716,7 @@ Storage is process-durable, without a power-loss/fsync guarantee.
|
|
|
8657
8716
|
|
|
8658
8717
|
```ts
|
|
8659
8718
|
import { createSandboxCodingTools } from 'stitchkit/agent-runtime/sandbox';
|
|
8660
|
-
import { mountAgent } from 'stitchkit/tools';
|
|
8719
|
+
import { mountAgent } from 'stitchkit/tools/agent';
|
|
8661
8720
|
|
|
8662
8721
|
const tools = mountAgent([], {
|
|
8663
8722
|
runtimeTools: createSandboxCodingTools(handle, {
|
|
@@ -8906,7 +8965,9 @@ concurrently or cancel the stream you ignore. Cancelling a stream drops its late
|
|
|
8906
8965
|
command fails or is stopped, both streams error and the bytes still queued are dropped.
|
|
8907
8966
|
|
|
8908
8967
|
A command needs a caller `signal` or a finite `timeoutMs` (1 to 2147483647 ms, the native timer
|
|
8909
|
-
range; a larger value is refused, never turned into 1 ms).
|
|
8968
|
+
range; a larger value is refused, never turned into 1 ms). `timeoutMs` counts from the moment the
|
|
8969
|
+
command started. A guarded command (`ownerLoss: 'terminate'`) first starts its guard; that start is
|
|
8970
|
+
bounded by `timeoutMs` or 5 seconds, whichever is longer, and does not use the command's budget. Streaming runs for the caller's lifetime,
|
|
8910
8971
|
with no hidden 60-second timeout or 1 MiB output limit. `capture` defaults to false; `true` requires
|
|
8911
8972
|
`maxOutputBytes` for the combined stdout and stderr. The limit counts source bytes; the API returns
|
|
8912
8973
|
`Uint8Array` and does not decode invalid UTF-8. The result holds the observed `exitCode: number | null`
|
|
@@ -10040,7 +10101,7 @@ types; the package keeps its required dependencies separate from optional SDKs.
|
|
|
10040
10101
|
CLI runtime tools use the one runtime-tool declaration: identity, input and output
|
|
10041
10102
|
schemas, handler, and explicit CLI exposure. SDK presenters are the adapter's extension
|
|
10042
10103
|
of that declaration (the fourth type argument of `RuntimeToolDefinitionWithOutput`, or
|
|
10043
|
-
`defineRuntimeTool` in `stitchkit/tools`),
|
|
10104
|
+
`defineRuntimeTool` in `stitchkit/tools`), whose presenter types name the corresponding SDKs. A typed
|
|
10044
10105
|
definition returned by `defineRuntimeTool` or `createRuntimeToolFactory` can be
|
|
10045
10106
|
passed directly to both CLI and SDK mounts.
|
|
10046
10107
|
|
|
@@ -14917,8 +14978,9 @@ fixture's transitive dependency.
|
|
|
14917
14978
|
|
|
14918
14979
|
That includes `stitchkit/tools/invoker`: a minimal packed consumer imports it
|
|
14919
14980
|
without MCP/AI peers and executes validation, output projection and normalized
|
|
14920
|
-
errors on Bun and Node
|
|
14921
|
-
|
|
14981
|
+
errors on Bun and Node, and so does `stitchkit/tools`, which loads no optional peer at
|
|
14982
|
+
runtime. The adapters keep their peer budgets on their own subpaths:
|
|
14983
|
+
`stitchkit/tools/mcp`, `stitchkit/tools/agent` and `stitchkit/tools/toolkit`.
|
|
14922
14984
|
|
|
14923
14985
|
Beside the matrix, one case is about the ARTIFACT rather than the inventory: a
|
|
14924
14986
|
program that injects the Socket.IO peer loaders is bundled and started in a
|
|
@@ -15147,10 +15209,7 @@ signal and deadline. Bind its process lifecycle with the truthful close-only
|
|
|
15147
15209
|
sibling from `stitchkit/tools`:
|
|
15148
15210
|
|
|
15149
15211
|
```ts
|
|
15150
|
-
import {
|
|
15151
|
-
bindStdioProcessSignals,
|
|
15152
|
-
createStdioMcpServer,
|
|
15153
|
-
} from 'stitchkit/tools'
|
|
15212
|
+
import { bindStdioProcessSignals, createStdioMcpServer } from 'stitchkit/tools/mcp'
|
|
15154
15213
|
|
|
15155
15214
|
const stdio = await createStdioMcpServer(config)
|
|
15156
15215
|
const binding = bindStdioProcessSignals(stdio, {
|
|
@@ -17144,6 +17203,87 @@ charts, no merged cells and no streaming: an application that needs them takes a
|
|
|
17144
17203
|
|
|
17145
17204
|
# Upgrading stitchkit
|
|
17146
17205
|
|
|
17206
|
+
## Released migration: 0.121.0
|
|
17207
|
+
|
|
17208
|
+
### bounded-coding-search
|
|
17209
|
+
|
|
17210
|
+
**Who must act:** hosts that construct a complete `AgentCodingToolLimits` value, inspect exact
|
|
17211
|
+
`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.
|
|
17212
|
+
|
|
17213
|
+
Partial `limits` still fill finite defaults. Complete values add:
|
|
17214
|
+
|
|
17215
|
+
```ts
|
|
17216
|
+
maxSearchDirectories: 1_000,
|
|
17217
|
+
maxSearchEntries: 20_000,
|
|
17218
|
+
maxSearchBytes: 16_777_216,
|
|
17219
|
+
maxSearchOutputBytes: 65_536,
|
|
17220
|
+
searchTimeoutMs: 5_000,
|
|
17221
|
+
```
|
|
17222
|
+
|
|
17223
|
+
Read `coverage.complete` on list, glob and search before interpreting an empty result.
|
|
17224
|
+
List raw enumeration is also capped by `maxListEntries`; glob patterns have a 4,096-unit ceiling.
|
|
17225
|
+
The ordinary command cwd is a pinned directory, so descendant symlink cwd aliases are refused;
|
|
17226
|
+
use the real relative directory name. Custom sandbox launchers own atomic cwd capture.
|
|
17227
|
+
`coverage.reasons` names stopped
|
|
17228
|
+
budgets, cancellation, denial, unreadable files and lines beyond the searchable byte ceiling.
|
|
17229
|
+
`coverage.scope` names the workspace-relative include, exclusion policy and symlink policy;
|
|
17230
|
+
directory/entry/read-byte counters report work reached by the bounded reader. Denied and error
|
|
17231
|
+
lists can themselves be truncated. The entire UTF-8 JSON result fits `maxSearchOutputBytes`
|
|
17232
|
+
(minimum 1,024); an input whose minimum envelope cannot fit refuses before I/O.
|
|
17233
|
+
|
|
17234
|
+
Regex queries keep JavaScript syntax, `(?ims-ims:…)` modifiers and Annex B forms, and their
|
|
17235
|
+
cost is bounded per line: a line whose backtracking work, repetition capped at the line's length,
|
|
17236
|
+
stays within 2^24 steps runs natively, any other line in linear time. Named backreferences,
|
|
17237
|
+
counted repetition above 1,000 and patterns needing the automaton with more than 16,384 automaton states, 65,536
|
|
17238
|
+
construction steps (nested repetition of an empty group such as `(?:(?:){1000}){1000}`) or
|
|
17239
|
+
4,194,304 overlapping character-set memberships now return `BAD_REQUEST`
|
|
17240
|
+
before authorization or file access, as
|
|
17241
|
+
numbered backreferences and lookaround already did. Spell the repeated text out, for example
|
|
17242
|
+
replace `{ query: '(?<w>ab)\\k<w>', regex: true }` with `{ query: '(ab)ab', regex: true }`.
|
|
17243
|
+
|
|
17244
|
+
`glob` with a `path` that is missing, a file or a symlink now refuses (`NOT_FOUND` or
|
|
17245
|
+
`BAD_REQUEST`, with a hint) instead of returning no paths; treat that refusal as "nothing
|
|
17246
|
+
there". `run_command` refuses such a `cwd` the same way.
|
|
17247
|
+
|
|
17248
|
+
Glob matching preserves `**`, `*`, `?` and literal punctuation, including embedded `**`.
|
|
17249
|
+
A pattern that prunes directories may produce an explanatory `hint` without counting unseen
|
|
17250
|
+
files. `glob` confines traversal to its requested path and viable pattern prefixes.
|
|
17251
|
+
|
|
17252
|
+
Traversal checks cancellation and deadlines at CPU checkpoints and races asynchronous waits.
|
|
17253
|
+
Late opened handles are closed; in-flight operating-system calls are not claimed to be interrupted.
|
|
17254
|
+
Reaching an entry or result ceiling conservatively reports partial coverage without a lookahead.
|
|
17255
|
+
|
|
17256
|
+
## Released migration: 0.120.0
|
|
17257
|
+
|
|
17258
|
+
### tools-barrel-subpaths
|
|
17259
|
+
|
|
17260
|
+
**Who must act:** code importing the MCP server, `mountAgent` or `createToolkit` from
|
|
17261
|
+
`stitchkit/tools`. Imports of the registry, tool names, manifest, runtime and native tools, the
|
|
17262
|
+
invoker, the OAuth provider and the durability engine stay where they are.
|
|
17263
|
+
|
|
17264
|
+
`stitchkit/tools` now loads no optional peer, so an application without
|
|
17265
|
+
`@modelcontextprotocol/server` and `ai` can import it. Move each adapter import to its subpath:
|
|
17266
|
+
|
|
17267
|
+
```ts
|
|
17268
|
+
// before
|
|
17269
|
+
import { createMcpHandler, listToolNames, mountAgent } from 'stitchkit/tools'
|
|
17270
|
+
import { createToolkit } from 'stitchkit/tools'
|
|
17271
|
+
// after
|
|
17272
|
+
import { listToolNames } from 'stitchkit/tools'
|
|
17273
|
+
import { createMcpHandler } from 'stitchkit/tools/mcp'
|
|
17274
|
+
import { mountAgent } from 'stitchkit/tools/agent'
|
|
17275
|
+
import { createToolkit } from 'stitchkit/tools/toolkit'
|
|
17276
|
+
```
|
|
17277
|
+
|
|
17278
|
+
| Names | New subpath | Peers it needs |
|
|
17279
|
+
|-------|-------------|----------------|
|
|
17280
|
+
| `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` |
|
|
17281
|
+
| `mountAgent`, `AgentMountConfig`, `AgentContext` | `stitchkit/tools/agent` | `ai` |
|
|
17282
|
+
| `createToolkit`, `Toolkit` | `stitchkit/tools/toolkit` | `@modelcontextprotocol/server`, `ai` |
|
|
17283
|
+
|
|
17284
|
+
The move is mechanical: `bunx stitchkit upgrade --from 0.119.0` lists every import it touches, and
|
|
17285
|
+
`tsc` names any name still imported from `stitchkit/tools`. Behaviour is unchanged.
|
|
17286
|
+
|
|
17147
17287
|
## Released migration: 0.119.0
|
|
17148
17288
|
|
|
17149
17289
|
### factory-default-exposure
|
|
@@ -22589,7 +22729,7 @@ from the root `stitchkit`.
|
|
|
22589
22729
|
| `McpProgressUpdate` | _type_ | one mid-call progress update — `message`, and `progress`/`total` when the operation knows a scale |
|
|
22590
22730
|
| `McpReportProgress` | _type_ | `ctx.reportProgress` — sends one update to the host that asked for progress; a no-op when none did, and never throws |
|
|
22591
22731
|
| `McpRoundOutcome` | _type_ | managed multi-round attempt outcome |
|
|
22592
|
-
| `
|
|
22732
|
+
| `HandlerContext` | _type_ | contract handler's fully inferred params, input, files and runtime context |
|
|
22593
22733
|
| `EndpointFn` | _type_ | the call signature of one client method |
|
|
22594
22734
|
| `TypedClient` | _type_ | the full typed client for a contract |
|
|
22595
22735
|
| `TypedHttpClient` | _type_ | the typed client, HTTP endpoints only (`= ScopedHttpClient<C, unknown>`) |
|
|
@@ -22744,6 +22884,8 @@ schedules, transports and file generation remain application-owned.
|
|
|
22744
22884
|
|
|
22745
22885
|
## `stitchkit/server`
|
|
22746
22886
|
|
|
22887
|
+
`EndpointHandlerContext` is the server endpoint handler’s inferred params, input, files and runtime context.
|
|
22888
|
+
|
|
22747
22889
|
Server-only. Builds and runs the HTTP server, and carries the server primitives.
|
|
22748
22890
|
Also re-exports the error helpers from `stitchkit/contract`.
|
|
22749
22891
|
|
|
@@ -22980,6 +23122,8 @@ lane never reaches the hooks on either runtime.
|
|
|
22980
23122
|
|
|
22981
23123
|
## `stitchkit/application`
|
|
22982
23124
|
|
|
23125
|
+
Construct a directory inbox with `createDirectoryInbox` from `stitchkit/application/directory-inbox`.
|
|
23126
|
+
|
|
22983
23127
|
`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.
|
|
22984
23128
|
|
|
22985
23129
|
|
|
@@ -23005,7 +23149,7 @@ cutovers are covered by the executable
|
|
|
23005
23149
|
| `NotificationOutboxItem` / `NotificationOutboxReceipt` / `NotificationOutboxState` / `NotificationSend` / `NotificationFailureClassification` / `DroppedNotification` / `EnqueueNotification` | _type_ | versioned queue records, stable send identity and delivery decisions |
|
|
23006
23150
|
| `notificationOutboxStateSchema` | function | strict persisted-state schema over an application payload schema |
|
|
23007
23151
|
| `notificationOutboxResource` / `NotificationOutboxResource` / `NotificationOutboxResourceConfig` | function / _type_ | thin managed-resource scheduler over an outbox handle |
|
|
23008
|
-
| `
|
|
23152
|
+
| `DirectoryInbox` / `DirectoryInboxConfig` / `DirectoryInboxDelivery` / `DirectoryInboxResource` | _type_ | one managed directory inbox for files or durable `accept({ source, key, entry })` (`entry` is the schema's input, stored as given); a hard-linked file is set aside as `invalid`; first payload wins, bounded capacity/bytes/receipts and renewable fenced leases; delivery begins after readiness and effects remain at least once |
|
|
23009
23153
|
| `DirectoryInboxIdentitySchema` / `DirectoryInboxIdentity` / `DirectoryInboxAccept` / `DirectoryInboxAcceptResultSchema` / `DirectoryInboxAcceptResult` | schema / _type_ | validated source/key, typed entry and durable accepted/duplicate result with filename; duplicates do not replace the first payload |
|
|
23010
23154
|
| `StateStoreUpdateContext` | _type_ | real active protected transaction: `assertHeld()` refuses after ownership loss or completion; custom adapters supply this context to their transition |
|
|
23011
23155
|
| `DirectoryInboxStateSchema` / `DirectoryInboxState` / `DirectoryInboxRejection` / `DirectoryInboxRejectionReasonSchema` / `DirectoryInboxRejectionReason` | schema / _type_ | the inbox's claims, receipts and rejections (`invalid`, `too-large`, `attempt-limit`) |
|
|
@@ -23088,9 +23232,10 @@ cutovers are covered by the executable
|
|
|
23088
23232
|
|
|
23089
23233
|
### Bounded diagnostic journal
|
|
23090
23234
|
|
|
23235
|
+
Construct the writer with `createDiagnosticJournal` from `stitchkit/application/diagnostic-journal`.
|
|
23236
|
+
|
|
23091
23237
|
| Export | Kind | Summary |
|
|
23092
23238
|
|--------|------|---------|
|
|
23093
|
-
| `createDiagnosticJournal` | function | create one schema-owned FIFO JSONL writer with bounded retained memory, exclusive local path ownership and finite rotation |
|
|
23094
23239
|
| `DiagnosticJournalConfig` / `DiagnosticJournal` | _type_ | owner schema/path/limits/failure observer, `startupScan` (`tails` by default, or `full`), `onStartupRefusal` (`quarantine` by default, or `fail`) and the synchronous `submit`, bounded-wait `flush`/`close`, status handle |
|
|
23095
23240
|
| `DiagnosticJournalLimitsSchema` / `DiagnosticJournalLimits` | schema / _type_ | positive event, pending-item, pending-byte, file-byte and retained-file limits |
|
|
23096
23241
|
| `DiagnosticJournalLockPolicySchema` / `DiagnosticJournalLockPolicy` | schema / _type_ | `refuse` (default) or `reclaim-stale`, which reclaims only a lock whose recorded owner is provably gone |
|
|
@@ -23696,28 +23841,28 @@ artifact store is supplied, `read_output`.
|
|
|
23696
23841
|
| Export | Kind | Summary |
|
|
23697
23842
|
|--------|------|---------|
|
|
23698
23843
|
| `createAgentCodingTools` | function | construct direct host-authorized bounded file, listing, glob, search, exact-snippet edit, shell and artifact runtime-tool definitions; `edit_file` inserts `newText` literally in both single and `replaceAll` modes; every ordinary refusal is a typed code with an instructive `hint`, and filesystem operations use Linux `/proc/self/fd` or the packaged macOS Node-API backend and otherwise fail closed |
|
|
23699
|
-
| `AGENT_CODING_TOOL_NAMES` | const | the mounted tool names — `read_file`, `write_file`, `edit_file`, `list_directory`, `glob`, `search_files`, `run_command`, `read_output` |
|
|
23700
23844
|
| `AgentCodingToolDefinition` | _type_ | peer-free structural direct-tool shape accepted by the canonical runtime-tool surface |
|
|
23701
23845
|
| `AgentCodingToolConfig` | _type_ | absolute root, required operation authorization, optional async/sync `authorizePath({ path })` shared by direct file effects and discovery, finite executable alias map, exact child environment and optional limits |
|
|
23702
23846
|
| `AgentCodingToolAuthorizationSchema` / `AgentCodingToolAuthorization` | schema / _type_ | discriminated read/write/search/patch/shell/artifact decision presented to host policy before effect |
|
|
23703
23847
|
| `AgentCodingToolPathAuthorizationSchema` / `AgentCodingToolPathAuthorization` | schema / _type_ | strict workspace-relative path presented to the shared path policy before disclosure, opening or mutation |
|
|
23704
|
-
| `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout/termination-grace ceilings |
|
|
23848
|
+
| `AgentCodingToolLimitsSchema` / `AgentCodingToolLimits` | schema / _type_ | explicit path/read/write/argument-count/argument-byte/output/artifact/timeout/termination-grace ceilings; shared discovery directory/entry/serialized-output/deadline ceilings, aggregate search-read ceiling and measured coverage |
|
|
23705
23849
|
| `AgentCodingArtifactStore` | _type_ | host-owned opaque artifact write and bounded read boundary |
|
|
23706
|
-
| `FileReadInputSchema` / `FileReadOutputSchema` | schema | bounded strict-UTF-8 byte slice; offsets must align with UTF-8 code-point boundaries |
|
|
23707
|
-
| `FileWriteInputSchema` / `FileWriteOutputSchema` | schema | create-only by default or explicit atomic replacement; symlink targets fail closed |
|
|
23708
|
-
| `createShellInputSchema` / `ShellOutputSchema` | schema | enumerated executable alias plus arguments and concrete relative cwd; explicit exited/timeout/output-limit/cancelled outcome |
|
|
23709
23850
|
|
|
23710
|
-
File/search operations pin directory descriptors across authorization and the actual effect;
|
|
23851
|
+
File/search operations select a root descriptor before both policy callback kinds and pin directory descriptors across authorization and the actual effect;
|
|
23711
23852
|
resource discovery uses the same ancestor-safe traversal. This closes parent rename/symlink races
|
|
23712
|
-
without claiming an executable sandbox. The
|
|
23853
|
+
without claiming an executable sandbox. The ordinary command launcher passes a pinned cwd to its
|
|
23854
|
+
isolated guard (inherited fd 4); a custom sandbox launcher owns atomic capture of its pathname cwd. List/glob/search report coverage; canonical spelling work consumes the same budget. List raw entries
|
|
23855
|
+
are capped by maxListEntries and maxSearchEntries, and glob patterns by 4,096 UTF-16 units.
|
|
23856
|
+
The default ceilings are 4,096 path bytes, 256 KiB read/write/output, 128 shell arguments, 64 KiB
|
|
23713
23857
|
of aggregate argument text, 4 MiB per artifact and 30 seconds. The root is a path-resolution
|
|
23714
23858
|
boundary, not an OS sandbox; executable behavior, process
|
|
23715
23859
|
isolation, credentials and external-effect idempotency remain host responsibilities.
|
|
23716
23860
|
|
|
23717
23861
|
When `authorizePath` denies a path, direct read/write/edit returns `FORBIDDEN`, while
|
|
23718
23862
|
`list_directory`, `glob` and `search_files` omit it. Denial is recursive: direct access and
|
|
23719
|
-
discovery base paths
|
|
23720
|
-
|
|
23863
|
+
discovery base paths check every named ancestor, outermost first and segment-wise; `.` is
|
|
23864
|
+
checked only when the requested base itself is `.`, so subtree allowlists remain usable. Thus
|
|
23865
|
+
denying `credentials` denies `credentials/token.txt` but not `credentials-backup`. Directory
|
|
23721
23866
|
admission happens before descent and file admission before opening; `search_files.include` is also
|
|
23722
23867
|
applied before content is read. Requested paths must use `/` — a backslash is refused, because the
|
|
23723
23868
|
containment walk reads it as a separator while a callback would read it as one name.
|
|
@@ -23813,8 +23958,8 @@ Separate optional evolving Bun/OpenTUI package over a caller-composed headless h
|
|
|
23813
23958
|
|
|
23814
23959
|
| Export | Kind | Summary |
|
|
23815
23960
|
|--------|------|---------|
|
|
23816
|
-
| `defineAgentTui` | function | typed config for title
|
|
23817
|
-
| `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override |
|
|
23961
|
+
| `defineAgentTui` | function | typed config for title, `theme` (a `TerminalPalette` override) and `themeMode`, status rows, model catalog, context, commands, runtime bundle and optional host-evidenced recovery policy; the default never requeues acquired effects |
|
|
23962
|
+
| `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override; it closes the session and exits the process on Ctrl-C and every signal OpenTUI catches unless `exitSignals: []` |
|
|
23818
23963
|
| `defineTuiCommand` / `resolveTuiCommand` | function | typed composable slash-command registry; unknown slash input remains an ordinary model prompt |
|
|
23819
23964
|
| `createAgentTuiController` | function | single admission, selection, approval, interruption and conversation-switch owner over the harness |
|
|
23820
23965
|
| `startAgentTuiSessionHost` / `createAgentTuiClient` | function | authenticated mode-`0600` Unix-socket host/client for status, submit and interrupt through that controller |
|
|
@@ -23823,7 +23968,7 @@ Separate optional evolving Bun/OpenTUI package over a caller-composed headless h
|
|
|
23823
23968
|
| `defaultAgentTuiStatusLine` / `AgentTuiStatusLineFormatter` | function / _type_ | terminal-native default rows and a host formatter over model capacity, durable snapshot, activity, workspace and local identities; `statusLine: false` hides the rows |
|
|
23824
23969
|
| `createAgentTuiDiagnosticRecorder` / `AgentTuiDiagnosticEventSchema` | function / schema | bounded per-session metadata journal that rejects prompt, reasoning, tool-input and provider-cause payloads before disk admission |
|
|
23825
23970
|
|
|
23826
|
-
The `stitchkit-agent` binary loads `stitchkit.agent.ts` by default and also exposes `sessions`,
|
|
23971
|
+
The `stitchkit-agent` binary runs React's production build unless `NODE_ENV` says otherwise and loads `stitchkit.agent.ts` by default and also exposes `sessions`,
|
|
23827
23972
|
`status`, `send` and `interrupt`. `--workspace` addresses a host outside the caller's cwd,
|
|
23828
23973
|
`send --idempotency-key` accepts caller-owned retry identity, and `interrupt` defaults to the
|
|
23829
23974
|
active run returned by `status`. Session descriptors and sockets are local control credentials,
|
|
@@ -23846,6 +23991,65 @@ Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor t
|
|
|
23846
23991
|
| `createTerminalCommandPalette` / `terminalCommandMatches` | function | bounded command filtering and keyboard selection over a collision-validated registry |
|
|
23847
23992
|
| `resolveExactTerminalCommand` / `validateTerminalCommands` | function | exact dispatch and fail-closed name/alias validation |
|
|
23848
23993
|
| `createTerminalOperationState` / `reduceTerminalOperationState` | function | confirmation and single-pending-operation lifecycle |
|
|
23994
|
+
| `createTerminalTable` / `reduceTerminalTable` / `projectTerminalTable` | function | live table: typed columns, rows validated on entry, sort with key tie-break and missing values last, tree expansion pruned to present rows, filter on displayed text, selection kept across data; a row's `tone` and a column's `tone(value, row)` colour state |
|
|
23995
|
+
| `layoutTerminalTableColumns` / `formatTerminalTableCell` / `visibleTerminalTableRows` / `terminalTableTreePrefix` | function | fixed and flexible column widths, `—` for missing values, the virtualized window, tree indentation |
|
|
23996
|
+
| `createTerminalList` / `reduceTerminalList` / `visibleTerminalListLines` | function | picker with sections, fuzzy query with title highlight ranges, multi-select, disabled items and "more above/below" counts |
|
|
23997
|
+
| `createTerminalForm` / `reduceTerminalForm` / `readTerminalForm` / `terminalFormFieldsFromJsonSchema` | function | typed fields (text, secret, number, integer, boolean, choice, JSON) from a JSON Schema, relative text edits, validation on leave and submit |
|
|
23998
|
+
| `createTerminalTabs` / `reduceTerminalTabs` | function | tabs with badges, wrap-around movement, digit selection and reconcile that keeps the selected tab |
|
|
23999
|
+
| `createTerminalNavigation` / `reduceTerminalNavigation` / `terminalBreadcrumbs` | function | screen stack keeping each level's state, root never popped |
|
|
24000
|
+
| `createTerminalFocus` / `reduceTerminalFocus` | function | focus ring plus layers that take the keyboard and give it back |
|
|
24001
|
+
| `createTerminalNotices` / `reduceTerminalNotices` / `nextTerminalNoticeExpiry` | function | bounded toasts on a caller clock, replaced by id |
|
|
24002
|
+
| `createTerminalTimeSeries` / `appendTerminalSample` / `sampleTerminalTimeSeries` | function | time window bounded by duration and sample count, value-in-force sampling with explicit gaps |
|
|
24003
|
+
| `terminalBrailleChart` / `terminalSparkline` / `terminalTimeAxis` / `terminalChartScale` | function | multi-series braille line or area chart as toned runs, sparkline, time axis |
|
|
24004
|
+
| `terminalMeter` / `layoutTerminalMeterGrid` | function | eighth-block bar toned by thresholds, unmeasured as muted; column-major core grid |
|
|
24005
|
+
| `terminalProgress` / `terminalSpinnerFrame` / `terminalIndeterminateBlock` / `formatTerminalDuration` | function | ratio, rate and ETA only when knowable; spinner frames; indeterminate bar; elapsed time |
|
|
24006
|
+
| `defineTerminalKeymap` / `matchTerminalKey` / `fitTerminalKeyHints` | function | conflict-checked bindings that both answer keys and draw a footer fitted to the width |
|
|
24007
|
+
| `terminalTableKeymap` / `terminalTableKey` / `terminalTabsKeymap` / `terminalTabsKey` | function | htop-style table bindings and tab bindings as keymaps |
|
|
24008
|
+
| `matchTerminalSearch` / `searchTerminalItems` / `terminalHighlightRuns` | function | multi-word fuzzy match with ranges, stable ranking, highlight runs |
|
|
24009
|
+
| `sanitizeTerminalText` / `terminalTextWidth` / `truncateTerminalText` / `fitTerminalText` / `wrapTerminalText` | function | strip escape and control sequences; measure, cut, pad and wrap by terminal cells |
|
|
24010
|
+
| `terminalTextEdit` / `applyTerminalTextEdit` | function | one-line edits as relative actions, so fast input is never lost |
|
|
24011
|
+
| `terminalJsonLines` / `layoutTerminalDetails` | function | toned, sanitized JSON lines; aligned key/value pairs |
|
|
24012
|
+
| `terminalPalettes` / `resolveTerminalPalette` / `TerminalPalette` / `TerminalTone` | value / function / _type_ | one semantic palette (surfaces plus `primary`, `muted`, `accent`, `success`, `warning`, `danger`) for dark and light terminals |
|
|
24013
|
+
| `terminalLabelsEn` / `terminalLabelsRu` / `TerminalLabels` | value / _type_ | every word the widgets draw |
|
|
24014
|
+
|
|
24015
|
+
### `stitchkit-tui/widgets`
|
|
24016
|
+
|
|
24017
|
+
OpenTUI React widgets over the core state. React, `@opentui/core` and `@opentui/react` are peers;
|
|
24018
|
+
this entrypoint never loads `stitchkit`.
|
|
24019
|
+
|
|
24020
|
+
| Export | Kind | Summary |
|
|
24021
|
+
|--------|------|---------|
|
|
24022
|
+
| `TerminalAppShell` / `TerminalPanel` / `TerminalStatusBar` / `TerminalKeyHints` | component | breadcrumbs, status lines, body, fitted key hints and toast overlay; titled rounded panels with a focus frame |
|
|
24023
|
+
| `TerminalTable` | component | virtualized live table with header sort marks, tree, filter line and htop keys; row and cell tones in the palette, bold or dim where colour is missing |
|
|
24024
|
+
| `terminalToneAttributes` | function | the text attribute that carries a tone without colour: `danger` and `warning` bold, `muted` dim |
|
|
24025
|
+
| `TerminalList` | component | sections, fuzzy search line with highlights, `›` cursor, meta, badges, multi-select, description |
|
|
24026
|
+
| `runTerminalApp` / `RunTerminalAppOptions` / `RunningTerminalApp` | function / _type_ | start an application: renderer, theme and labels providers, the error boundary, and an exit with 128 + signal after `onClose` on Ctrl-C and every signal OpenTUI catches — a closed window leaves no orphan |
|
|
24027
|
+
| `TerminalErrorBoundary` / `TERMINAL_EXIT_SIGNALS` / `TerminalExitSignal` | component / value / _type_ | draws a render error and its stack in place of the screen, where OpenTUI's own boundary renders nothing under production React |
|
|
24028
|
+
| `TerminalForm` | component | fields edited in place, cycling choices, masked secrets, inline errors; a form without fields says so and submits `{}` on Enter |
|
|
24029
|
+
| `TerminalTextView` / `TerminalJsonView` | component | pager over sanitized wrapped text or toned JSON |
|
|
24030
|
+
| `TerminalMeter` / `TerminalMeterGrid` / `TerminalChart` / `TerminalSparkline` | component | htop meters and core grid; btop braille charts with axis |
|
|
24031
|
+
| `TerminalTabs` / `TerminalDialog` / `TerminalSpinner` / `TerminalProgressBar` / `TerminalAsyncView` / `TerminalDetails` / `TerminalNotices` / `TerminalHelp` | component | views, confirmation, loading, progress, async states, details, toasts, key help |
|
|
24032
|
+
| `TerminalThemeProvider` / `useTerminalPalette` / `useTerminalThemeMode` | component / hook | palette from the terminal's reported background (`auto`) or a fixed mode |
|
|
24033
|
+
| `TerminalLabelsProvider` / `TerminalFocusProvider` / `useTerminalFocused` | component / hook | product language and shared focus |
|
|
24034
|
+
|
|
24035
|
+
The `stitchkit-tui-gallery` binary shows every widget live.
|
|
24036
|
+
|
|
24037
|
+
### `stitchkit-tui/build`
|
|
24038
|
+
|
|
24039
|
+
Build-time only; imports Bun and no React.
|
|
24040
|
+
|
|
24041
|
+
| Export | Kind | Summary |
|
|
24042
|
+
|--------|------|---------|
|
|
24043
|
+
| `compileTerminalApp` / `CompileTerminalAppOptions` | function / _type_ | one standalone executable for any Bun compile target, from any machine, with React's production build defined |
|
|
24044
|
+
| `terminalNativePlugin` / `TerminalNativePluginOptions` | function / _type_ | the `Bun.build` plugin behind it: the target's `@opentui/core-<os>-<arch>` at the pinned version from the registry, verified against `bun.lock`; other platforms' packages throw; musl refused |
|
|
24045
|
+
| `terminalNativeTarget` / `TerminalNativeTarget` | function / _type_ | the native package a compile target needs |
|
|
24046
|
+
|
|
24047
|
+
### `stitchkit-tui/testing`
|
|
24048
|
+
|
|
24049
|
+
| Export | Kind | Summary |
|
|
24050
|
+
|--------|------|---------|
|
|
24051
|
+
| `renderTerminalTest` / `TerminalTestScreen` / `TerminalTestOptions` | function / _type_ | a screen inside the kit's providers on a test terminal; `press`, `type`, `burst`, `advance`, `waitForText`, `resize` run inside React's `act` and wait out a lone Esc |
|
|
24052
|
+
| `TerminalTestKey` / `TerminalTestModifiers` | _type_ | the mock input's key names and modifiers |
|
|
23849
24053
|
|
|
23850
24054
|
## `stitchkit/agent-runtime/sqlite/node`
|
|
23851
24055
|
|
|
@@ -23955,57 +24159,25 @@ SDK, `ai`, or other optional tool peers, so it is safe in a thin CLI bundle.
|
|
|
23955
24159
|
|
|
23956
24160
|
## `stitchkit/tools`
|
|
23957
24161
|
|
|
23958
|
-
Server-only
|
|
23959
|
-
|
|
23960
|
-
|
|
23961
|
-
|
|
23962
|
-
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
payload.
|
|
24162
|
+
Server-only, and imported without any optional peer: the transport-neutral tool layer —
|
|
24163
|
+
the registry, tool names and manifest, runtime tools, native tools, the invoker, the OAuth
|
|
24164
|
+
provider and the durability engine. An application that serves its operations over HTTP and
|
|
24165
|
+
CLI lists its tool names here with neither MCP nor the AI SDK installed. The adapters that
|
|
24166
|
+
need a peer have their own subpaths: [`stitchkit/tools/mcp`](#stitchkittoolsmcp) (the MCP
|
|
24167
|
+
server SDK), [`stitchkit/tools/agent`](#stitchkittoolsagent) (the `ai` peer) and
|
|
24168
|
+
[`stitchkit/tools/toolkit`](#stitchkittoolstoolkit) (both). → ADR 0284.
|
|
23966
24169
|
|
|
23967
24170
|
| Export | Kind | Summary |
|
|
23968
24171
|
|--------|------|---------|
|
|
23969
|
-
| `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
|
|
23970
|
-
| `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
|
|
23971
|
-
| `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
|
|
23972
|
-
| `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
|
|
23973
|
-
| `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
|
|
23974
|
-
| `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
|
|
23975
|
-
| `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) |
|
|
23976
24172
|
| `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) |
|
|
23977
24173
|
| `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) |
|
|
23978
|
-
| `createToolInvoker` | function | compile an exposure-aware in-process dispatcher over the canonical tool runner; use
|
|
23979
|
-
| `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
|
|
24174
|
+
| `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) |
|
|
23980
24175
|
| `mountViewFile` | function | a native multimodal "view file" MCP tool |
|
|
23981
24176
|
| `resolveMedia` | function | resolve a media reference for a tool result |
|
|
23982
|
-
| `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)) |
|
|
23983
24177
|
| `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) |
|
|
23984
24178
|
| `listContractToolNames` | function | the same listing straight from contracts — no handlers or stub services needed |
|
|
23985
24179
|
| `describeToolCatalog` | function | inspect the exact model-facing names, source identities, schema byte sizes and deferred state; an explicit total byte budget fails closed |
|
|
23986
24180
|
| `ToolCatalogConfig` / `ToolCatalogEntry` | _type_ | catalog source, transport, optional explicit schema budget and one inspectable result row |
|
|
23987
|
-
| `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
|
|
23988
|
-
| `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
|
|
23989
|
-
| `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
|
|
23990
|
-
| `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
|
|
23991
|
-
| `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
|
|
23992
|
-
| `McpStdioHandle` | _type_ | closeable official stdio transport handle |
|
|
23993
|
-
| `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
|
|
23994
|
-
| `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
|
|
23995
|
-
| `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
|
|
23996
|
-
| `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
|
|
23997
|
-
| `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
|
|
23998
|
-
| `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
|
|
23999
|
-
| `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
|
|
24000
|
-
| `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
|
|
24001
|
-
| `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
|
|
24002
|
-
| `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
|
|
24003
|
-
| `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
|
|
24004
|
-
| `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
|
|
24005
|
-
| `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
|
|
24006
|
-
| `McpMountConfig` | _type_ | config for `mountMcp` |
|
|
24007
|
-
| `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
|
|
24008
|
-
| `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
|
|
24009
24181
|
| `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 |
|
|
24010
24182
|
| `RuntimeToolDefinitionBase` | _type_ | common name, identity, input, exposure and MCP metadata fields |
|
|
24011
24183
|
| `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) |
|
|
@@ -24031,11 +24203,8 @@ payload.
|
|
|
24031
24203
|
| `CimdCacheEvent` | _type_ | observable CIMD cache hit, miss, revalidation and eviction event |
|
|
24032
24204
|
| `createSecureClientMetadataFetcher` | function | production HTTPS, DNS/IP-pinned CIMD fetcher |
|
|
24033
24205
|
| `RuntimeAgentModelOutput` | _type_ | AI SDK model-facing text/JSON/content output returned by `present.agent` |
|
|
24034
|
-
| `AgentMountConfig` | _type_ | config for `mountAgent` |
|
|
24035
24206
|
| `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 |
|
|
24036
24207
|
| `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 |
|
|
24037
|
-
| `AgentContext` | _type_ | the context merged into agent tool handlers |
|
|
24038
|
-
| `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
|
|
24039
24208
|
| `ToolExtend` | _type_ | extra-args extension for `mountMcp` / `mountAgent` |
|
|
24040
24209
|
| `ToolLifecycle` | _type_ | `beforeHandle` / `afterHandle` gate for tool calls — [guide](../guide/mcp-and-agents.md#guarding-tools--lifecycle) |
|
|
24041
24210
|
| `ToolExecutionControlReason` | _type_ | internal managed-execution stop reason: stale run or requested interruption |
|
|
@@ -24067,7 +24236,6 @@ payload.
|
|
|
24067
24236
|
| `NonPortableFormat` | _type_ | one `{ path, format }` portability finding |
|
|
24068
24237
|
| `PORTABLE_JSON_SCHEMA_FORMATS` | constant | portable-format baseline used by MCP validation |
|
|
24069
24238
|
| `ToolNameEntry` | _type_ | one `listToolNames` row — `{ kind, name, service, method, transports }` |
|
|
24070
|
-
| `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
|
|
24071
24239
|
| `McpMediaContent` | _type_ | a multimodal MCP content item |
|
|
24072
24240
|
|
|
24073
24241
|
### Native tools
|
|
@@ -24171,6 +24339,77 @@ mountAgent(services, { durability: (toolCallId) => myLedgerFor(toolCallId) });
|
|
|
24171
24339
|
| `AgentToolError` | class | the model-safe envelope a failed agent tool throws |
|
|
24172
24340
|
| `isAgentToolError` | function | brand check for it — a consumer running its own loop no longer parses the message |
|
|
24173
24341
|
|
|
24342
|
+
### Introspection & internals
|
|
24343
|
+
|
|
24344
|
+
Advanced building blocks — the shared machinery the mounts are built on.
|
|
24345
|
+
|
|
24346
|
+
| Export | Kind | Summary |
|
|
24347
|
+
|--------|------|---------|
|
|
24348
|
+
| `collectTools` | function | resolve a service's methods to mountable tools (the shared resolver) |
|
|
24349
|
+
| `createToolLogger` | function | a ready `afterToolCall` that logs every tool call — [guide](../guide/mcp-and-agents.md#logging-tool-calls--createtoollogger) |
|
|
24350
|
+
| `summarizeTransports` | function | mixed contract/runtime operation counts and per-source breakdown for a boot-time summary |
|
|
24351
|
+
| `buildToolManifest` | function | transport-aware searchable `{ name, description, inputSchema }` rows from a mixed surface |
|
|
24352
|
+
| `ToolLoggerConfig` | _type_ | config for `createToolLogger` |
|
|
24353
|
+
| `ToolCallRecord` | _type_ | the structured record `createToolLogger` passes to `onRecord` |
|
|
24354
|
+
| `TransportSummary` | _type_ | `{ contractServices, runtimeTools, totals, sources }` from `summarizeTransports` |
|
|
24355
|
+
| `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
|
|
24356
|
+
| `ToolSurfaceProjection` | _type_ | the one readonly `{ services?, runtimeTools? }` container shared by full, MCP-only and introspection surfaces (`buildToolManifest`, `listToolNames`, `summarizeTransports` take `ToolSurfaceProjection<RuntimeToolDefinition>`) |
|
|
24357
|
+
| `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
|
|
24358
|
+
| `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments, including object guards restored from JSON Schema; arbitrary transform pipes stay untouched; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
|
|
24359
|
+
| `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; scalar collisions retain provable types, object/array collisions retain structural alternatives, and field descriptions retain discriminator labels plus availability/requiredness hints; the projection never executes validation |
|
|
24360
|
+
| `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
|
|
24361
|
+
| `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
|
|
24362
|
+
| `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
|
|
24363
|
+
|
|
24364
|
+
---
|
|
24365
|
+
|
|
24366
|
+
## `stitchkit/tools/mcp`
|
|
24367
|
+
|
|
24368
|
+
Server-only, and the one place the MCP server is exported. Its runtime and strict NodeNext
|
|
24369
|
+
declarations require Zod and the `@modelcontextprotocol/server` v2 peer, with no AI SDK peer;
|
|
24370
|
+
MCP hosts and tests use the separate `@modelcontextprotocol/client` package.
|
|
24371
|
+
|
|
24372
|
+
Framework-owned MCP tools advertise the exact declared output schema and return
|
|
24373
|
+
the validated value unchanged as `structuredContent`, including arrays, scalars
|
|
24374
|
+
and `null`. Tools without an output contract advertise and return no structured
|
|
24375
|
+
payload. See [MCP guide](../guide/mcp-and-agents.md#mcp--createmcphandler).
|
|
24376
|
+
|
|
24377
|
+
| Export | Kind | Purpose |
|
|
24378
|
+
|--------|------|---------|
|
|
24379
|
+
| `createMcpHandler` | function | a stateless dual-era Streamable-HTTP MCP handler — [guide](../guide/mcp-and-agents.md#mcp--createmcphandler) |
|
|
24380
|
+
| `createMcpHttpRoute` | function | framework-owned `RawRoute` adapter for an MCP HTTP handler |
|
|
24381
|
+
| `createStdioMcpServer` | function | a complete stdio MCP server — [guide](../guide/mcp-and-agents.md#mcp-over-stdio--createstdiomcpserver) |
|
|
24382
|
+
| `bindStdioProcessSignals` | function | explicitly bind OS signals to one close-only stdio handle — [guide](../guide/testing-and-deployment.md#stdio-process-signals) |
|
|
24383
|
+
| `buildMcpServer` | function | build an `McpServer` from contract/runtime surfaces; no-auth configs omit the second argument |
|
|
24384
|
+
| `mountMcp` | function | add contract tools to an existing `McpServer` — [guide](../guide/mcp-and-agents.md#mountmcp) |
|
|
24385
|
+
| `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)) |
|
|
24386
|
+
| `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
|
|
24387
|
+
| `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
|
|
24388
|
+
| `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
|
|
24389
|
+
| `McpHttpSecurityConfig` | _type_ | Fetch-boundary Host and Origin allowlists |
|
|
24390
|
+
| `McpLegacyPolicy` | _type_ | `'serve' \| 'reject'` protocol-era compatibility policy |
|
|
24391
|
+
| `McpStdioHandle` | _type_ | closeable official stdio transport handle |
|
|
24392
|
+
| `StdioMcpServerConfig` | _type_ | config for `createStdioMcpServer` |
|
|
24393
|
+
| `StdioCloseTarget` | _type_ | minimal close-only target accepted by `bindStdioProcessSignals` |
|
|
24394
|
+
| `StdioProcessSignalsOptions` | _type_ | signal source, close callbacks and phased error reporting |
|
|
24395
|
+
| `StdioProcessSignalsBinding` | _type_ | close-only signal binding with observed `promise` and listener `close()` |
|
|
24396
|
+
| `StdioProcessSignalsErrorPhase` | _type_ | `'prepare' \| 'close' \| 'complete'` reporting phase |
|
|
24397
|
+
| `McpServerBuildConfig` | _type_ | shared config for `buildMcpServer` |
|
|
24398
|
+
| `McpServerSharedConfig` | _type_ | transport-neutral options shared by direct and finite surface configs |
|
|
24399
|
+
| `McpServer` | _type_ | official split-SDK server instance accepted by raw extension points |
|
|
24400
|
+
| `DirectMcpSurfaceConfig` | _type_ | static or identity-dynamic `services` / `runtimeTools` source |
|
|
24401
|
+
| `FiniteMcpSurfaceConfig` | _type_ | bounded `surfaces` registry plus typed selector |
|
|
24402
|
+
| `McpSurfaceDefinition` | _type_ | one immutable `{ services, runtimeTools }` MCP surface |
|
|
24403
|
+
| `McpSurfaceRegistry` | _type_ | finite keyed surface registry for eager preparation |
|
|
24404
|
+
| `StdioAuthConfig` | _type_ | startup identity composed into `StdioMcpServerConfig` |
|
|
24405
|
+
| `McpMountConfig` | _type_ | config for `mountMcp` |
|
|
24406
|
+
| `McpSchemaValidationConfig` | _type_ | shared `{ policy, requireTypedProperties, allowUntyped, requirePortableFormats, allowFormats }` profile |
|
|
24407
|
+
| `ValidateMcpSchemasConfig` | _type_ | standalone validation profile plus `services`, `extend`, flattening and logger |
|
|
24408
|
+
| `IncompatibleSchemaPolicy` | _type_ | `'throw' \| 'skip' \| 'warn'` |
|
|
24409
|
+
| `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>>` |
|
|
24410
|
+
| `RuntimeToolDefinition` | _type_ | heterogeneous registration; the canonical runner validates input/output before invocation |
|
|
24411
|
+
| `RuntimeMcpToolPresenters` / `RuntimeMcpPresentation` | _type_ | official SDK content without framework-owned `structuredContent` or `isError`; one presenter owner shared with the full SDK surface |
|
|
24412
|
+
|
|
24174
24413
|
### Catalog stamp
|
|
24175
24414
|
|
|
24176
24415
|
Every advertised tool and every tool result carries the fingerprint of the catalog it came
|
|
@@ -24204,44 +24443,26 @@ Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.
|
|
|
24204
24443
|
| `McpAppResourceMeta` | _type_ | resource `_meta` for an MCP App |
|
|
24205
24444
|
| `McpAppCsp` | _type_ | the widget content-security policy |
|
|
24206
24445
|
|
|
24207
|
-
|
|
24446
|
+
## `stitchkit/tools/agent`
|
|
24208
24447
|
|
|
24209
|
-
|
|
24448
|
+
Server-only. A contract's operations as Vercel AI SDK tools; needs Zod and the `ai`
|
|
24449
|
+
peer, not the MCP server SDK. → ADR 0284.
|
|
24210
24450
|
|
|
24211
24451
|
| Export | Kind | Summary |
|
|
24212
24452
|
|--------|------|---------|
|
|
24213
|
-
| `
|
|
24214
|
-
| `
|
|
24215
|
-
| `
|
|
24216
|
-
| `buildToolManifest` | function | transport-aware searchable `{ name, description, inputSchema }` rows from a mixed surface |
|
|
24217
|
-
| `ToolLoggerConfig` | _type_ | config for `createToolLogger` |
|
|
24218
|
-
| `ToolCallRecord` | _type_ | the structured record `createToolLogger` passes to `onRecord` |
|
|
24219
|
-
| `TransportSummary` | _type_ | `{ contractServices, runtimeTools, totals, sources }` from `summarizeTransports` |
|
|
24220
|
-
| `TransportCounts` | _type_ | per-transport counts (`{ HTTP, MCP, AGENT, CLI }`) |
|
|
24221
|
-
| `ToolSurfaceProjection` | _type_ | the one readonly `{ services?, runtimeTools? }` container shared by full, MCP-only and introspection surfaces (`buildToolManifest`, `listToolNames`, `summarizeTransports` take `ToolSurfaceProjection<RuntimeToolDefinition>`) |
|
|
24222
|
-
| `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
|
|
24223
|
-
| `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments, including object guards restored from JSON Schema; arbitrary transform pipes stay untouched; throws a `ZodError` naming the field when a union that keeps a string member receives a string that parses to an array its array member accepts |
|
|
24224
|
-
| `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; scalar collisions retain provable types, object/array collisions retain structural alternatives, and field descriptions retain discriminator labels plus availability/requiredness hints; the projection never executes validation |
|
|
24225
|
-
| `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
|
|
24226
|
-
| `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
|
|
24227
|
-
| `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
|
|
24228
|
-
|
|
24229
|
-
---
|
|
24453
|
+
| `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) |
|
|
24454
|
+
| `AgentMountConfig` | _type_ | config for `mountAgent` |
|
|
24455
|
+
| `AgentContext` | _type_ | the context merged into agent tool handlers |
|
|
24230
24456
|
|
|
24231
|
-
## `stitchkit/tools/
|
|
24457
|
+
## `stitchkit/tools/toolkit`
|
|
24232
24458
|
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
HTTP/stdio factories, mounts, schema policy, catalog and resource helpers keep their canonical
|
|
24236
|
-
behavior and names. See [MCP guide](../guide/mcp-and-agents.md#mcp--createmcphandler).
|
|
24459
|
+
Server-only. One context-typed tool set served over MCP and to an AI SDK agent, so it
|
|
24460
|
+
needs both the `@modelcontextprotocol/server` and `ai` peers. → ADR 0284.
|
|
24237
24461
|
|
|
24238
|
-
| Export | Kind |
|
|
24462
|
+
| Export | Kind | Summary |
|
|
24239
24463
|
|--------|------|---------|
|
|
24240
|
-
| `
|
|
24241
|
-
| `
|
|
24242
|
-
| `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>>` |
|
|
24243
|
-
| `RuntimeToolDefinition` | _type_ | heterogeneous registration; the canonical runner validates input/output before invocation |
|
|
24244
|
-
| `RuntimeMcpToolPresenters` / `RuntimeMcpPresentation` | _type_ | official SDK content without framework-owned `structuredContent` or `isError`; one presenter owner shared with the full SDK surface |
|
|
24464
|
+
| `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
|
|
24465
|
+
| `Toolkit` | _type_ | the context-pinned tool surface from `createToolkit` |
|
|
24245
24466
|
|
|
24246
24467
|
## `stitchkit/tools/connections`
|
|
24247
24468
|
|