stitchkit 0.134.1 → 0.134.2

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 (90) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -6
  3. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  4. package/dist/agent-runtime/sqlite-schema.d.ts +2 -2
  5. package/dist/agent-runtime/sqlite.d.ts +1 -1
  6. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  7. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  8. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  9. package/dist/application/grammy.d.ts +1 -1
  10. package/dist/browser/contract-identity.d.ts +1 -1
  11. package/dist/browser/http-fetch.d.ts +1 -1
  12. package/dist/browser/socket-io-contract.d.ts +1 -1
  13. package/dist/contract/bridge-envelope.d.ts +1 -1
  14. package/dist/contract/client-types.d.ts +1 -1
  15. package/dist/contract/define.d.ts +2 -2
  16. package/dist/contract/errors-factory.d.ts +1 -1
  17. package/dist/contract/fingerprint.d.ts +1 -1
  18. package/dist/device-relay/hub.d.ts +1 -1
  19. package/dist/entrypoints/agent-runtime/postgres.js +3 -3
  20. package/dist/entrypoints/agent-runtime/sqlite/bun.js +1 -1
  21. package/dist/entrypoints/agent-runtime/sqlite/node.js +1 -1
  22. package/dist/entrypoints/bin/upgrade-cli.js +1 -1
  23. package/dist/entrypoints/files/packaging.js +2 -2
  24. package/dist/entrypoints/handler.js +2 -2
  25. package/dist/entrypoints/node.js +2 -2
  26. package/dist/entrypoints/server.js +2 -2
  27. package/dist/entrypoints/tools/mcp.js +3 -3
  28. package/dist/entrypoints/tools/toolkit.js +3 -3
  29. package/dist/entrypoints/tools.js +2 -2
  30. package/dist/files/native-packaging-layout.d.ts +1 -1
  31. package/dist/{index-654rhe5d.js → index-7mjsb7zv.js} +5 -1
  32. package/dist/{index-kdw0n92g.js → index-a09r9ff0.js} +1 -1
  33. package/dist/{index-epyj7ptp.js → index-a84wj6y8.js} +4 -4
  34. package/dist/{index-qymek778.js → index-m2b49tvc.js} +76 -22
  35. package/dist/{index-mrng24wq.js → index-zag9sjpd.js} +1 -1
  36. package/dist/internal/postgres-query.d.ts +1 -1
  37. package/dist/react/query-client.d.ts +1 -1
  38. package/dist/server/bridge-host.d.ts +1 -1
  39. package/dist/server/bun.d.ts +1 -1
  40. package/dist/server/endpoint-dispatch.d.ts.map +1 -1
  41. package/dist/server/middleware/cors.d.ts +3 -3
  42. package/dist/server/middleware/cors.d.ts.map +1 -1
  43. package/dist/server/socket-io-config.d.ts +1 -1
  44. package/dist/service-host/identity.d.ts +1 -1
  45. package/dist/service-host/systemd-inspect.d.ts +1 -1
  46. package/dist/testing/manual-clock.d.ts +1 -1
  47. package/dist/tools/connections/types.d.ts +1 -1
  48. package/dist/tools/mcp/handler.d.ts +1 -1
  49. package/dist/tools/mcp/lazy-discovery.d.ts +1 -1
  50. package/dist/tools/mcp/mount.d.ts +1 -1
  51. package/dist/tools/mcp/stdio.d.ts +1 -1
  52. package/llms/agent-runtime-browser.txt +1 -1
  53. package/llms/agent-runtime-sqlite-bun.txt +1 -1
  54. package/llms/agent-runtime.2.txt +1 -1
  55. package/llms/agent-runtime.3.txt +4 -4
  56. package/llms/agent-runtime.txt +3 -3
  57. package/llms/application.2.txt +4 -4
  58. package/llms/application.txt +4 -4
  59. package/llms/cli.2.txt +27 -6
  60. package/llms/cli.txt +2 -2
  61. package/llms/contract.txt +1 -1
  62. package/llms/files-packaging.txt +1 -1
  63. package/llms/geo.txt +1 -1
  64. package/llms/live.txt +1 -1
  65. package/llms/oauth.txt +4 -4
  66. package/llms/observability.txt +3 -3
  67. package/llms/primitives.txt +1 -1
  68. package/llms/process.2.txt +7 -7
  69. package/llms/react.txt +4 -4
  70. package/llms/server.2.txt +7 -7
  71. package/llms/server.3.txt +5 -5
  72. package/llms/server.4.txt +6 -6
  73. package/llms/server.txt +13 -5
  74. package/llms/stitchkit.2.txt +3 -3
  75. package/llms/stitchkit.3.txt +1 -1
  76. package/llms/stitchkit.txt +4 -4
  77. package/llms/telegram.txt +1 -1
  78. package/llms/testing.txt +4 -4
  79. package/llms/tools-connections.txt +1 -1
  80. package/llms/tools-toolkit.txt +3 -1
  81. package/llms/tools.2.txt +6 -6
  82. package/llms/tools.3.txt +8 -8
  83. package/llms/upgrading-0.106.0-0.126.0.txt +1 -1
  84. package/llms/upgrading-0.128.0-0.134.0.txt +7 -1
  85. package/llms/upgrading-0.37.0-0.53.0.txt +7 -7
  86. package/llms/upgrading-0.69.0-0.95.0.txt +1 -1
  87. package/llms/upgrading-0.96.0-0.105.0.txt +1 -1
  88. package/llms-full.txt +149 -112
  89. package/llms.txt +5 -5
  90. package/package.json +1 -1
package/llms-full.txt CHANGED
@@ -274,8 +274,8 @@ below is the canonical install command.
274
274
  you import — both for `stitchkit/tools/toolkit`:
275
275
 
276
276
  ```bash
277
- bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp
278
- bun add ai@^7 # stitchkit/tools/agent or stitchkit/agent-runtime/ai-sdk
277
+ bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp or stitchkit/tools/toolkit
278
+ bun add ai@^7 # stitchkit/tools/agent, stitchkit/tools/toolkit or stitchkit/agent-runtime/ai-sdk
279
279
  ```
280
280
 
281
281
  Browser, HTTP-client and React entrypoints remain usable without either MCP
@@ -865,7 +865,7 @@ export const users = defineContract({ prefix: 'users' }, {
865
865
  `HEAD` is an explicit HTTP-only operation, never an automatic alias for `GET`.
866
866
  It must declare `rawResponse: true`; request body, `input`, multipart, `rawBody`,
867
867
  typed `output` and tool exposure are rejected. The handler owns status and
868
- headers, while Stitchkit guarantees an empty wire body even if the returned
868
+ headers, while StitchKit guarantees an empty wire body even if the returned
869
869
  `Response` accidentally contains one.
870
870
 
871
871
  ## `params` vs `input` vs `output`
@@ -1353,6 +1353,14 @@ When an HTTP caller sends a relative remaining budget in `x-stitchkit-timeout-ms
1353
1353
  `401`/`403`; an inbound value of `0` then fails immediately with `REQUEST_TIMEOUT` (`408`) before
1354
1354
  payload parsing, `beforeHandle`, or the handler runs. Malformed non-integer values are ignored so
1355
1355
  the endpoint's declared timeout remains authoritative.
1356
+ - For a streaming endpoint (`stream: { ... }`), `timeout` and `x-stitchkit-timeout-ms` bound only
1357
+ the response-open phase until the handler returns its `AsyncIterable` (matching the client's open
1358
+ timeout). Once the stream opens, the open deadline timer is disarmed, `ctx.signal` stays bound to
1359
+ client disconnect (`req.signal`), managed shutdown, and `stream.lifetimeMs`, and
1360
+ `ctx.remainingTimeoutMs` switches to `stream.lifetimeMs` (or `undefined` when unbounded). The same
1361
+ open-phase boundary applies to a `rawResponse: true` endpoint returning a `Response` with a body:
1362
+ the open timer is disarmed once the `Response` is returned while `ctx.signal` stays subscribed to
1363
+ client disconnect (`req.signal`).
1356
1364
  - Inside the handler, `ctx.remainingTimeoutMs?.(reserveMs?)` returns the live remaining integer
1357
1365
  milliseconds (clamped to `>= 0`, subtracting optional `reserveMs` for response serialization), or
1358
1366
  `undefined` when neither an inbound header nor an endpoint `timeout` bounds the request. Always
@@ -1620,7 +1628,7 @@ server. See [Testing & deployment](./testing-and-deployment.md).
1620
1628
  | `traceId` | override per-request trace-id resolution — may return `undefined` to fall back |
1621
1629
  | `wrapFetch` | compose wrappers around the finished handler (request context, audit) |
1622
1630
  | `proxyOrigin` | Bun TCP ingress policy: `{ trustedPeer(socketIp) }` restores the external scheme before all composition; independent of client-IP `trustProxy` |
1623
- | `socket` | full Stitchkit Socket.IO handle; route, default WebSocket handler and shutdown are mounted once |
1631
+ | `socket` | full StitchKit Socket.IO handle; route, default WebSocket handler and shutdown are mounted once |
1624
1632
  | `websocket` | custom Bun WebSocket handler; with `socket`, this is the explicit composed handler |
1625
1633
  | `development` / `bun` | passthrough to `Bun.serve` |
1626
1634
 
@@ -1827,7 +1835,7 @@ when forwarding to owned streaming routes; it is also required by native timeout
1827
1835
 
1828
1836
  ### Trusted HTTPS in development
1829
1837
 
1830
- Stitchkit does not own local certificate generation or a frontend development
1838
+ StitchKit does not own local certificate generation or a frontend development
1831
1839
  server. When a device or browser feature requires a secure context, generate a
1832
1840
  trusted certificate outside the application (for example with `mkcert`) and pass
1833
1841
  its files through the Bun server boundary:
@@ -1892,7 +1900,7 @@ request-error recorder; an `AbortError` while the request signal is still active
1892
1900
  remains an internal failure. A runtime abort reason may be preserved by identity
1893
1901
  through at most eight cycle-safe standard `cause` links; error messages and codes
1894
1902
  are never classifiers. The same rule applies when the disconnect happens while
1895
- Stitchkit is reading a JSON upload body: bounded reads race every pending stream
1903
+ StitchKit is reading a JSON upload body: bounded reads race every pending stream
1896
1904
  read against the request signal and never parse a cancelled partial body. `499`
1897
1905
  is transport telemetry, not a response declared in the contract or generated
1898
1906
  OpenAPI document.
@@ -2094,7 +2102,7 @@ That split is deliberate — see [ADR 0003](../decisions/0003-two-context-types.
2094
2102
 
2095
2103
  ## A host beside its own window
2096
2104
 
2097
- A desktop app's host — the process beside its window — is an ordinary Stitchkit server, bound to
2105
+ A desktop app's host — the process beside its window — is an ordinary StitchKit server, bound to
2098
2106
  loopback. Calls are plain HTTP through the typed client; events travel the realtime socket with
2099
2107
  `retain` per topic ([realtime](./realtime.md)). There is no second transport to learn.
2100
2108
 
@@ -2198,7 +2206,7 @@ Trust boundary and operational rules for the unix channel:
2198
2206
  container and keep the full UTF-8 path within 103 bytes; TCC permissions remain bound to the host
2199
2207
  process's responsible bundle.
2200
2208
  - **Embedded agents and shell tools.** An unsandboxed agent shell running as the same OS user has full
2201
- access to the socket. Inside Stitchkit's Linux Bubblewrap sandbox (`stitchkit/agent-runtime/sandbox`),
2209
+ access to the socket. Inside StitchKit's Linux Bubblewrap sandbox (`stitchkit/agent-runtime/sandbox`),
2202
2210
  the host's `$HOME`, `/tmp`, `/run` and `XDG_RUNTIME_DIR` are not mounted (`--unshare-all --clearenv`),
2203
2211
  so keep the socket outside the agent's mounted `workspace` directory (note that macOS has no
2204
2212
  Bubblewrap isolation).
@@ -2589,7 +2597,7 @@ createServer({
2589
2597
  `serviceName` and `action` are optional observability identity. Declare
2590
2598
  `serviceName` when audit, logging, sampling or another cross-cutting policy
2591
2599
  groups this raw route with a service; add `action` when the policy needs an
2592
- operation within that service. Stitchkit never derives either from `path`.
2600
+ operation within that service. StitchKit never derives either from `path`.
2593
2601
  `action` without `serviceName`, and empty identity strings, fail at startup.
2594
2602
 
2595
2603
  A path may be exact, carry `:param` segments, or end in `/*filePath` for a prefix
@@ -2598,7 +2606,7 @@ wildcard — and the two combine: `/app/:slug/*filePath` matches `/app/x/a/b` wi
2598
2606
  deep-link fallback). List more specific routes before the wildcard — the first
2599
2607
  match wins. `staticRoute()` builds a raw route that serves a directory.
2600
2608
 
2601
- At startup Stitchkit rejects exact duplicates, equivalent parameter shapes
2609
+ At startup StitchKit rejects exact duplicates, equivalent parameter shapes
2602
2610
  (`/users/:id` vs `/users/:userId`) and any later raw route completely hidden by
2603
2611
  an earlier raw route. Partial overlap stays legal, including the recommended
2604
2612
  specific-before-wildcard order. `GET` and `HEAD` remain independent because that
@@ -2903,7 +2911,7 @@ them.
2903
2911
 
2904
2912
  For large files, set `delivery: 'stream'` and define receivers. A receiver gets
2905
2913
  a Web `ReadableStream<Uint8Array>` and writes directly to consumer-owned
2906
- storage; Stitchkit holds only bounded parser state:
2914
+ storage; StitchKit holds only bounded parser state:
2907
2915
 
2908
2916
  ```ts
2909
2917
  const streamingUploads = defineContract({ prefix: 'uploads' }, {
@@ -3004,12 +3012,12 @@ createServer({ services: [users, orders], rawRoutes: [openApiRoute('/openapi.jso
3004
3012
  Only HTTP-exposed methods appear (an MCP/agent-only tool is skipped).
3005
3013
 
3006
3014
  OpenAPI 3.1 has no standard multi-segment path parameter. For a contract path
3007
- ending in a named wildcard such as `/*filePath`, Stitchkit keeps the literal
3015
+ ending in a named wildcard such as `/*filePath`, StitchKit keeps the literal
3008
3016
  runtime path, omits `filePath` from the
3009
3017
  standard `in: path` parameter list, and emits
3010
3018
  `x-stitchkit-trailing-wildcard` on the operation with its parameter name,
3011
3019
  schema and semantics. A generic OpenAPI client therefore cannot invent
3012
- catch-all expansion; use Stitchkit's typed client or teach the generator that
3020
+ catch-all expansion; use StitchKit's typed client or teach the generator that
3013
3021
  extension.
3014
3022
 
3015
3023
  ### Curating the spec — `includeMethod`
@@ -3211,7 +3219,7 @@ pauses its socket, and resuming preserves the exact chunked body.
3211
3219
 
3212
3220
  `UnixClientTransportError` carries a stable `code` and `delivery`:
3213
3221
  `not-dispatched`, `possibly-dispatched` or `response-received`. Only the first
3214
- proves that the remote operation did not begin; Stitchkit never silently retries
3222
+ proves that the remote operation did not begin; StitchKit never silently retries
3215
3223
  an ambiguous write. Response consumption/cancellation belongs to the operation,
3216
3224
  and `close()` interrupts active work and destroys owned connections.
3217
3225
 
@@ -3273,7 +3281,7 @@ attempt, so the default `2` permits at most three total attempts. The default
3273
3281
 
3274
3282
  Inside Next.js 16 server rendering, the first attempt still uses Next's normal
3275
3283
  request memoization. If Ky authorizes a retry after a network rejection,
3276
- Stitchkit passes that retry's current `Request.signal` in the second fetch
3284
+ StitchKit passes that retry's current `Request.signal` in the second fetch
3277
3285
  argument and materializes the current Request as URL + init. Next 16.3 otherwise
3278
3286
  merges `init` into a Request before its dedupe layer and loses the explicit
3279
3287
  signal opt-out. The retry therefore performs a new network attempt instead of
@@ -3390,7 +3398,7 @@ contract:
3390
3398
  Every endpoint callable exposes a `withOptions` method accepting required
3391
3399
  `ClientRequestOptions`. The ordinary callable contains only contract arguments,
3392
3400
  so it can be passed directly to callback APIs such as `react-query-kit` without
3393
- mistaking their callback context for Stitchkit transport options.
3401
+ mistaking their callback context for StitchKit transport options.
3394
3402
 
3395
3403
  **That safety has a cost worth knowing before it bites you.** `api.thing(args,
3396
3404
  { signal })` — the shape everyone reaches for first — is not an error: the second
@@ -3886,7 +3894,7 @@ try {
3886
3894
 
3887
3895
  `traceId` is present when the server returned `x-request-id`. A network error,
3888
3896
  timeout or abort without an HTTP response cannot carry one. Cross-origin
3889
- browser code can read it through Stitchkit's default CORS expose list; a custom
3897
+ browser code can read it through StitchKit's default CORS expose list; a custom
3890
3898
  `cors.exposeHeaders` policy must keep `x-request-id` exposed.
3891
3899
 
3892
3900
  The error model is shared with the server — see [Auth & errors](./auth-and-errors.md).
@@ -3979,7 +3987,7 @@ if (server === undefined) {
3979
3987
  }
3980
3988
  ```
3981
3989
 
3982
- Both fingerprints arrive as a value; a difference never throws. Stitchkit
3990
+ Both fingerprints arrive as a value; a difference never throws. StitchKit
3983
3991
  computes the two identities and compares nothing — what a mismatch means is the
3984
3992
  application's decision. The client's fingerprint is computed locally and is not
3985
3993
  sent to the server. The identity operation is public and lists operation names,
@@ -4742,7 +4750,7 @@ load balancing therefore cannot strand a client on an in-memory session.
4742
4750
  The default `legacy: 'serve'` lets the official SDK negotiate either modern
4743
4751
  `2026-07-28` or the supported legacy stateless opening on this same endpoint.
4744
4752
  Set `legacy: 'reject'` when every host is modern. Legacy support is protocol
4745
- translation inside the SDK, not a second Stitchkit transport or compatibility
4753
+ translation inside the SDK, not a second StitchKit transport or compatibility
4746
4754
  API. Stateful MCP and subscriptions are intentionally outside this layer.
4747
4755
 
4748
4756
  `createMcpHttpRoute` is the framework-owned raw-route adapter. It registers
@@ -4761,7 +4769,7 @@ must not be used as authorization input.
4761
4769
 
4762
4770
  ### Modern discovery, routing and cache hints
4763
4771
 
4764
- Stitchkit forwards the negotiated protocol era and validated MCP request data
4772
+ StitchKit forwards the negotiated protocol era and validated MCP request data
4765
4773
  to both `RequestEvent.mcp` and the current managed call's typed `context.mcp`;
4766
4774
  untrusted routing headers never become application identity. The SDK validates
4767
4775
  `MCP-Protocol-Version`, JSON-RPC shape and routing
@@ -4776,7 +4784,7 @@ means zero/private: neither a prepared surface nor a deterministic response is
4776
4784
  silently treated as public. Unbounded auth-selected surface factories are
4777
4785
  always forced to zero/private even when an operation policy is present; use a
4778
4786
  finite `surfaces` registry when identities share a provably immutable surface.
4779
- Stitchkit never advertises list-change or subscription capabilities
4787
+ StitchKit never advertises list-change or subscription capabilities
4780
4788
  without an implementation.
4781
4789
 
4782
4790
  ### Knowing your catalog is stale — the catalog stamp
@@ -5106,7 +5114,7 @@ expiry-checked. Tampered, expired, cross-user or cross-tool state fails before
5106
5114
  the side effect. Output validation applies only to the final result.
5107
5115
 
5108
5116
  Every attempt re-runs auth/lifecycle and emits its own tool hooks; audit metadata
5109
- contains the attempt's `mcp.outcome` and `mcp.round`. Stitchkit does not merge
5117
+ contains the attempt's `mcp.outcome` and `mcp.round`. StitchKit does not merge
5110
5118
  separate HTTP attempts into one logical trace. Parallel
5111
5119
  rounds have isolated context. HTTP/stdio modern hosts and the supported legacy
5112
5120
  stdio bridge may use this declaration; Agent, CLI and ordinary HTTP invocation
@@ -5358,7 +5366,7 @@ It is **deep** because the projection walks the generated JSON Schema document,
5358
5366
  including objects, arrays, tuples and schema-definition nodes. Structurally
5359
5367
  identifiable discriminated object unions are flattened wherever they occur.
5360
5368
  Plain unions and unions hidden behind unresolved external references remain
5361
- unions because Stitchkit cannot soundly invent a discriminator.
5369
+ unions because StitchKit cannot soundly invent a discriminator.
5362
5370
 
5363
5371
  Use the default `flattenUnionInput: false` when the model must see the exact
5364
5372
  relationship between a discriminator and each branch. Joined property schemas
@@ -5368,7 +5376,7 @@ The flattened form is **lossy but never executable**. Per-variant refinements
5368
5376
  and incompatible constraints are widened in the presentation document; the
5369
5377
  original Zod contract enforces them exactly once inside `executeToolMethod`.
5370
5378
  MCP and AI adapters forward the raw argument object unchanged, so defaults,
5371
- coercions and transforms cannot run before Stitchkit. Strict violations return
5379
+ coercions and transforms cannot run before StitchKit. Strict violations return
5372
5380
  the normal `VALIDATION_ERROR` tool envelope and fire `beforeToolCall` /
5373
5381
  `afterToolCall`. → [ADR 0050](../decisions/0050-presentation-schema-is-not-a-parser.md).
5374
5382
 
@@ -5681,7 +5689,7 @@ a deadline the remote client hit (`REQUEST_TIMEOUT`, `408`) follows the status l
5681
5689
  When a contract endpoint or runtime tool declares `output`, its MCP tool
5682
5690
  registers that exact schema as `outputSchema` and returns the validated value as
5683
5691
  `structuredContent` alongside a JSON text block. Every JSON root type is kept
5684
- unchanged: object, array, string, number, boolean and `null`. Stitchkit does not
5692
+ unchanged: object, array, string, number, boolean and `null`. StitchKit does not
5685
5693
  wrap non-object values in `{ result }`; protocol-era adaptation belongs to the
5686
5694
  official SDK.
5687
5695
 
@@ -5776,7 +5784,7 @@ removes keys on purpose and is not reported. → [ADR 0196](../decisions/0196-a-
5776
5784
  ## AI agents — `mountAgent`
5777
5785
 
5778
5786
  `mountAgent` remains the low-level path when the application owns its own model
5779
- loop and conversation state. For the optional Stitchkit-owned run/history loop,
5787
+ loop and conversation state. For the optional StitchKit-owned run/history loop,
5780
5788
  see [Agent application runtime](./agent-runtime.md).
5781
5789
 
5782
5790
  `mountAgent` turns a service into a Vercel AI SDK `ToolSet`, ready for
@@ -5958,7 +5966,7 @@ hook/lifecycle `OperationIdentity` and the tool `RequestEvent`
5958
5966
  (`serviceName`, `action`, `httpMethod`). A runtime operation has no HTTP route,
5959
5967
  so no fake `path` is added.
5960
5968
 
5961
- When `output` is declared, Stitchkit validates the neutral handler result after
5969
+ When `output` is declared, StitchKit validates the neutral handler result after
5962
5970
  `afterHandle`. MCP owns `structuredContent` and `isError`: a presenter supplies
5963
5971
  only rich `content`/metadata, while the framework inserts the validated
5964
5972
  structured result and normalises failures. The Agent adapter uses the AI SDK's
@@ -5967,7 +5975,7 @@ neutral output while the model receives text/file content. Presentation
5967
5975
  callbacks require an output schema.
5968
5976
 
5969
5977
  The MCP registration uses an identity carrier: the SDK advertises the compiled
5970
- JSON Schema but forwards the raw object into Stitchkit. Input failures therefore
5978
+ JSON Schema but forwards the raw object into StitchKit. Input failures therefore
5971
5979
  use the same validation, lifecycle and hook path as contract tools.
5972
5980
 
5973
5981
  ### Managed wait, download, upload and view-file
@@ -6078,7 +6086,7 @@ batch operation.
6078
6086
  ### Async-operation protocol
6079
6087
 
6080
6088
  For a complete long-running operation, define the linked runtime-only surface
6081
- once. Stitchkit owns transport names, validation and wait mechanics; the
6089
+ once. StitchKit owns transport names, validation and wait mechanics; the
6082
6090
  application still owns storage, execution, retries and domain states:
6083
6091
 
6084
6092
  ```ts
@@ -6142,7 +6150,7 @@ prevents a stale run owner from crossing an effect boundary; the transactional
6142
6150
  idempotency record makes a repeated current call converge on one operation.
6143
6151
  Neither replaces the other.
6144
6152
 
6145
- Stitchkit deliberately does **not** own the durable queue, operation database,
6153
+ StitchKit deliberately does **not** own the durable queue, operation database,
6146
6154
  lease renewal, provider retry/reconciliation protocol, asset catalog or domain
6147
6155
  states. The process-local application resource stops admission and drains
6148
6156
  accepted work; unresolved durable records survive shutdown for the next
@@ -6273,7 +6281,7 @@ operations whose contract intentionally differs.
6273
6281
  Deferred tool search, name snapshots and boot diagnostics accept the same
6274
6282
  object-shaped surface as the mounts. Contract operations are followed by
6275
6283
  runtime definitions, matching mount order; exposure filters and collisions are
6276
- resolved by Stitchkit rather than by consumer code:
6284
+ resolved by StitchKit rather than by consumer code:
6277
6285
 
6278
6286
  ```ts
6279
6287
  import {
@@ -6300,7 +6308,7 @@ fails first on duplicate contract/runtime names. There is no runtime-only
6300
6308
  manifest helper or public mount adapter: the framework owns merging and schema
6301
6309
  projection.
6302
6310
 
6303
- Applications using Stitchkit's durable runtime can compose this manifest with
6311
+ Applications using StitchKit's durable runtime can compose this manifest with
6304
6312
  bounded per-run activation through `createDeferredAgentToolSurface` from
6305
6313
  `stitchkit/agent-runtime`. It keeps selected calls as direct `mountAgent` tools
6306
6314
  rather than routing them through a generic executor. Search receipts live in
@@ -6367,7 +6375,7 @@ identical. Write the handler once; it serves every surface.
6367
6375
  > from `stitchkit/tools/agent` for an AI SDK loop) is the direct path.
6368
6376
 
6369
6377
  `stitchkit/agent-runtime` is the peer-free, server-only, opinionated layer above
6370
- `mountAgentTools`. Use it when the application wants Stitchkit to own conversation
6378
+ `mountAgentTools`. Use it when the application wants StitchKit to own conversation
6371
6379
  mechanics: durable acceptance, history projection, the native `AgentModelDriver`
6372
6380
  step loop, checkpoints, keyed interruption, terminal commit and stable application
6373
6381
  events.
@@ -6815,7 +6823,7 @@ is a reference structured control loop for `submit`, `interrupt`, `snapshot` and
6815
6823
  It starts no process and chooses no framing, authentication or transport. Importing either example
6816
6824
  has no side effect; an external supervisor owns process placement and restart.
6817
6825
 
6818
- | Concern | Public Stitchkit composition | Boundary |
6826
+ | Concern | Public StitchKit composition | Boundary |
6819
6827
  | --- | --- | --- |
6820
6828
  | execution loop | `createAgentRuntime` | already available; do not copy a second loop |
6821
6829
  | model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
@@ -7103,7 +7111,7 @@ fit. Exact equality (including a zero window with zero reservations/history)
7103
7111
  fits; any unavailable component keeps the decision `unavailable`.
7104
7112
 
7105
7113
  The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
7106
- and supplies atomicity; Stitchkit owns transition validation and revision
7114
+ and supplies atomicity; StitchKit owns transition validation and revision
7107
7115
  arithmetic. The executable reference is
7108
7116
  [`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
7109
7117
  `compareAndSwap` returns either `{ outcome: 'applied' }` or
@@ -7145,7 +7153,7 @@ const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sq
7145
7153
  Initialization creates only `stitchkit_agent_runtime_*` tables and records
7146
7154
  schema version 2 in `stitchkit_agent_runtime_meta`; it does not use
7147
7155
  `PRAGMA user_version` or mutate application tables. An unknown schema version or
7148
- unversioned partial Stitchkit schema is refused. The connection is owned by the
7156
+ unversioned partial StitchKit schema is refused. The connection is owned by the
7149
7157
  returned handle and closes only after accepted operations drain.
7150
7158
 
7151
7159
  Each handle serializes its transactions. Separate connections use
@@ -7688,7 +7696,7 @@ what it produced"**:
7688
7696
  surface that sends nothing until the run is done never showed it at all. When
7689
7697
  it reached nobody, it is not part of the conversation. That is `supersede`.
7690
7698
 
7691
- **Stitchkit cannot answer that question for you** — delivery belongs to the
7699
+ **StitchKit cannot answer that question for you** — delivery belongs to the
7692
7700
  transport, and the runtime sees an abort, not a screen. Hence a declared policy
7693
7701
  (→ ADR 0108), and hence `inputPolicy` accepting a function, so one application
7694
7702
  can hold two surfaces with different rules without the core learning which is
@@ -7816,7 +7824,7 @@ while the predecessor still owns managed callbacks. A hung predecessor blocks
7816
7824
  the lane in the first version.
7817
7825
 
7818
7826
  Shutdown is two-phase, and both budgets carry the names they carry everywhere
7819
- else in Stitchkit:
7827
+ else in StitchKit:
7820
7828
 
7821
7829
  ```ts
7822
7830
  const closed = await runtime.close({ gracePeriodMs: 30_000, forceTimeoutMs: 5_000 })
@@ -8178,7 +8186,7 @@ The agent `terminal` event and the adapter's delivery receipt are intentionally
8178
8186
  different records. A successful run does not prove that a reply reached its
8179
8187
  channel, and a delivery failure never rewrites the canonical agent result.
8180
8188
  Shutdown stops ingress, drains accepted process-local work and leaves ambiguous
8181
- outbox records visible for a later reconciliation pass. Stitchkit does not own
8189
+ outbox records visible for a later reconciliation pass. StitchKit does not own
8182
8190
  a channel database, durable broker, provider payload schema or application
8183
8191
  identity policy.
8184
8192
 
@@ -8217,7 +8225,7 @@ prepareStep: (step) => {
8217
8225
  ```
8218
8226
 
8219
8227
  That deliberate refusal ends the run as `context_overflow` on the durable
8220
- record, delivery terminal and operator event. Stitchkit does not inspect error
8228
+ record, delivery terminal and operator event. StitchKit does not inspect error
8221
8229
  messages — it recognises failures by identity, not by text. A store refusing an
8222
8230
  owned mutation ends the run `storage_conflict`; `protocol.acceptTerminal`
8223
8231
  refusing a finished message ends it `output_rejected`; a check the SDK runs on
@@ -8959,7 +8967,7 @@ no cost to binding first.
8959
8967
 
8960
8968
  The exact resource callbacks are typed by their public configuration. The
8961
8969
  important ownership rule is stable: the application decides what the
8962
- database/server/provider objects are and how they are configured; Stitchkit
8970
+ database/server/provider objects are and how they are configured; StitchKit
8963
8971
  orders their process-local lifecycle and decides *when* they come into
8964
8972
  existence.
8965
8973
 
@@ -8972,9 +8980,9 @@ dependency.
8972
8980
 
8973
8981
  Start and readiness are different. A connection can finish setup and return a
8974
8982
  ready handle. A poller can return a handle immediately, settle `ready` later,
8975
- and keep a long-lived `completion` promise. Stitchkit observes both.
8983
+ and keep a long-lived `completion` promise. StitchKit observes both.
8976
8984
 
8977
- Once Stitchkit invokes start/activation, cleanup is guaranteed to be attempted.
8985
+ Once StitchKit invokes start/activation, cleanup is guaranteed to be attempted.
8978
8986
  Write `close` so it is safe when setup was partial:
8979
8987
 
8980
8988
  ```ts
@@ -9122,7 +9130,7 @@ failure, and the startup error stays the `cause` of the `AggregateError` that
9122
9130
  failed startup from ever reporting why it failed.
9123
9131
 
9124
9132
  A required long-lived completion that rejects after startup makes readiness
9125
- false and health unhealthy. Stitchkit records the failure but does not restart
9133
+ false and health unhealthy. StitchKit records the failure but does not restart
9126
9134
  the resource or process.
9127
9135
 
9128
9136
  `ApplicationResourceShutdown.failures` names the phase that failed — `start`,
@@ -10972,11 +10980,11 @@ still judged alive.
10972
10980
 
10973
10981
  Public leaves keep optional peers out of their import closure. Installing `stitchkit` still
10974
10982
  installs the complete package and ky; selective imports alone do not avoid that installation.
10975
- A library can use Stitchkit as a build dependency, bundle its selected public native imports,
10983
+ A library can use StitchKit as a build dependency, bundle its selected public native imports,
10976
10984
  keep Zod external, and publish the resulting implementation with its library artifact.
10977
10985
 
10978
10986
  ```ts
10979
- // The library's build entry; all mechanisms remain owned by Stitchkit.
10987
+ // The library's build entry; all mechanisms remain owned by StitchKit.
10980
10988
  export { canonicalJson } from 'stitchkit/primitives';
10981
10989
  export { writeFileAtomic, withExclusiveLock } from 'stitchkit/files';
10982
10990
  export { observeProcessInstance, probeProcessOwner, runNativeCommand } from 'stitchkit/process';
@@ -11038,7 +11046,7 @@ identity, live-owner refusal, dead-owner recovery and contained file operations
11038
11046
  with the packaging plugin, and check that an unpackaged build reports the backend `unavailable`
11039
11047
  with stage `packaging` rather than certifying a dead owner. Bun and Node package imports retain the same
11040
11048
  lazy loader; importing a portable leaf does not load a Darwin addon on another OS. Test
11041
- declarations too, and check that importing an unbundled Stitchkit leaf fails in a deliberately
11049
+ declarations too, and check that importing an unbundled StitchKit leaf fails in a deliberately
11042
11050
  isolated library distribution. A separate schema-only entry must not import the native entry.
11043
11051
 
11044
11052
  If the Darwin backend cannot load, `observeProcessInstance` still returns `unavailable`.
@@ -11052,20 +11060,20 @@ failures or turn unavailable identity into proof that an owner is dead. If a run
11052
11060
  no recognized native error code, the stage stays `load`; the loader never infers errno from text.
11053
11061
 
11054
11062
  This delivery removes a runtime kernel installation; it does not remove the build-time
11055
- Stitchkit installation or create an independent lightweight npm package.
11063
+ StitchKit installation or create an independent lightweight npm package.
11056
11064
 
11057
11065
  ## Public native packaging
11058
11066
 
11059
11067
  Custom archives and installers use `stitchkit/files/packaging` at **build time**.
11060
11068
  `createNativePackaging` resolves the installed version and target addon, reads the addon once and
11061
- checks it against the size and SHA256 that Stitchkit published in its `native-assets.json` when the
11069
+ checks it against the size and SHA256 that StitchKit published in its `native-assets.json` when the
11062
11070
  package was built. A ready asset carries those verified `bytes` with the published `size` and
11063
11071
  `sha256`; its Bun-compatible plugin integrates the same bytes with the same lazy native loader.
11064
11072
  Each call reads and hashes the selected addons, so call it once per build and reuse the result.
11065
11073
  The leaf is evolving. It requires no optional peer or Bun ambient declarations for Node imports.
11066
11074
  Calling it must happen in a process that runs it from its installed package: it locates the
11067
11075
  package's `native-assets.json` beside its own file and throws `Native packaging must run from its
11068
- installed Stitchkit package` anywhere else, such as inside an application's runtime artifact.
11076
+ installed StitchKit package` anywhere else, such as inside an application's runtime artifact.
11069
11077
  Importing the leaf is side-effect free (it loads no addon and reads no file), so a module that
11070
11078
  both builds and is bundled may import it; only the call has to stay in the build step.
11071
11079
 
@@ -11112,7 +11120,7 @@ second time. An installed addon whose size or SHA256 differs from the published
11112
11120
  with `mismatch` / `NATIVE_ASSET_DIGEST_MISMATCH`, so a file substituted after installation never
11113
11121
  reaches an artifact. Archive the complete output directory with an integrity manifest that records
11114
11122
  `asset.sha256`, unpack to a clean directory, verify the same hashes there, and run offline without
11115
- the build tree or `node_modules`. The published digest ties the bytes to the package Stitchkit
11123
+ the build tree or `node_modules`. The published digest ties the bytes to the package StitchKit
11116
11124
  built; the package itself is only as trusted as its tarball (the lockfile integrity of the install).
11117
11125
  Signature and trust policy remain application-owned.
11118
11126
 
@@ -11440,7 +11448,7 @@ an immutable branded value; `transition()` produces the next one. `availableTran
11440
11448
 
11441
11449
  `defineOwnerScope` resolves one owner from authenticated identity. Reading across owners is a
11442
11450
  separate `acrossAllOwners(identity)` call and permission. Pass the resulting branded `OwnerScope`
11443
- to the data adapter. This proves the scope was explicit; Stitchkit cannot prove what SQL an
11451
+ to the data adapter. This proves the scope was explicit; StitchKit cannot prove what SQL an
11444
11452
  arbitrary adapter emits. `scanOwnerFilterRisks` maps existing caller-named manual filters before a
11445
11453
  migration.
11446
11454
 
@@ -11599,7 +11607,7 @@ only through `stitchkit/application` exports.
11599
11607
  ## Database connection
11600
11608
 
11601
11609
  Wrap connection allocation and readiness in `start`, and make `close` safe after
11602
- partial setup. Stitchkit invokes cleanup for every attempted start, including a
11610
+ partial setup. StitchKit invokes cleanup for every attempted start, including a
11603
11611
  start that allocates a client and then rejects.
11604
11612
 
11605
11613
  ```ts
@@ -11622,7 +11630,7 @@ allocation and proves one rollback close.
11622
11630
 
11623
11631
  An application-owned client is an ordinary managed resource. Keep SDK creation,
11624
11632
  credentials, authorization and reconnect policy in the application; no Telegram
11625
- client SDK is required by Stitchkit. Create a fresh client inside each `start`,
11633
+ client SDK is required by StitchKit. Create a fresh client inside each `start`,
11626
11634
  publish it after connection/readiness succeeds, and share one memoized destroy
11627
11635
  promise between partial-start cleanup, `close` and `force`:
11628
11636
 
@@ -11788,7 +11796,7 @@ async function handleDelivery(delivery: Delivery) {
11788
11796
  }
11789
11797
  ```
11790
11798
 
11791
- Stitchkit owns only process-local admission accounting and drain. Durable claims,
11799
+ StitchKit owns only process-local admission accounting and drain. Durable claims,
11792
11800
  visibility timeouts, deduplication, idempotency and retry classification remain
11793
11801
  in the queue/product layer.
11794
11802
 
@@ -11817,7 +11825,7 @@ await publisher.close()
11817
11825
  ```
11818
11826
 
11819
11827
  The monitoring backend, transport retry and cross-process aggregation remain
11820
- outside Stitchkit. The executable recipe blocks revision 0, coalesces
11828
+ outside StitchKit. The executable recipe blocks revision 0, coalesces
11821
11829
  intermediate revisions, explicitly admits the final absolute snapshot after
11822
11830
  unsubscribe and proves that `close()` flushes revision 3. Do not rely on an
11823
11831
  asynchronous subscriber callback racing cleanup: publish `getSnapshot()` before
@@ -12067,7 +12075,7 @@ await createCli({
12067
12075
  ```
12068
12076
 
12069
12077
  `createCli({ signal })` and its wait loop honor an explicit caller
12070
- `AbortSignal`. Stitchkit does not install a process-global SIGINT handler for
12078
+ `AbortSignal`. StitchKit does not install a process-global SIGINT handler for
12071
12079
  ordinary CLI programs: if desired, the application binds SIGINT to an
12072
12080
  `AbortController` and passes its signal. Aborting wait stops polling only; it
12073
12081
  does not cancel the underlying job.
@@ -12168,7 +12176,7 @@ const doctor = defineCliCommand({
12168
12176
  })
12169
12177
  ```
12170
12178
 
12171
- `present` returns the exact stdout bytes, which Stitchkit writes once. Without
12179
+ `present` returns the exact stdout bytes, which StitchKit writes once. Without
12172
12180
  it the canonical JSON output is unchanged. `exitCode` classifies a successfully
12173
12181
  validated result and must return an integer in `0..255`; failed `ToolResult`
12174
12182
  envelopes and the application-wide `exitCodes` mapping remain authoritative for
@@ -12907,7 +12915,7 @@ on stdout. A native `defineCliCommand` declares none of those facts, so a failed
12907
12915
 
12908
12916
  A CLI that mounts a server's tools through `defineMcpClientConnection` never sees the
12909
12917
  method or contract `effect` — every MCP call is a `POST` — so it reads the `readOnlyHint`
12910
- the server publishes. A Stitchkit server publishes it for every repeatable read by the
12918
+ the server publishes. A StitchKit server publishes it for every repeatable read by the
12911
12919
  rule above ([MCP → `readOnlyHint`](./mcp-and-agents.md#saying-which-tools-only-read--readonlyhint)),
12912
12920
  so the same command behaves the same over the contract and over MCP. The hint is the
12913
12921
  server's word: a server that labels a write as read-only makes the CLI withhold that
@@ -13521,7 +13529,7 @@ counts raw UTF-8 body bytes, including SSE framing, regardless of `Content-Lengt
13521
13529
  Pending legacy calls also count comments and wrong-id frames. `budget.maxTools`
13522
13530
  and `budget.maxSchemaBytes` remain separate mount limits.
13523
13531
 
13524
- **A stored catalog is mounted while it is current.** A Stitchkit server sends its
13532
+ **A stored catalog is mounted while it is current.** A StitchKit server sends its
13525
13533
  [catalog stamp](./mcp-and-agents.md#knowing-your-catalog-is-stale--the-catalog-stamp) with
13526
13534
  the `initialize` answer, as the `stitchkit-catalog` response header. Given a `catalog:
13527
13535
  { load, store }`, the connection compares it with the stamp of the stored `tools/list`
@@ -13532,7 +13540,7 @@ stores again. A listing is stored only when every tool in it carries the stamp t
13532
13540
  `initialize` answer announced, so a rolling deploy answering the two requests from
13533
13541
  different builds stores nothing. A server without a stamp, a surface with raw SDK tools
13534
13542
  and a failing `load` or `store` all cost one `tools/list`, never the mount. The stamp
13535
- covers what `tools/list` publishes as Stitchkit builds it; the JSON Schema text the
13543
+ covers what `tools/list` publishes as StitchKit builds it; the JSON Schema text the
13536
13544
  server's MCP SDK renders from the same schema is not hashed separately.
13537
13545
 
13538
13546
  Only the initial `initialize` can negotiate HTTP-to-legacy fallback on 400, 404
@@ -13669,11 +13677,32 @@ A native-only CLI (only `commands`, no `services` or `runtimeTools`) takes no
13669
13677
 
13670
13678
  ## Typed context
13671
13679
 
13672
- Use `createToolkit<AppContext>()` to type the injected `context` against your
13673
- app's context shape — the tool-side mirror of `createImplement`
13674
- ([ADR 0017](../decisions/0017-typed-tool-context.md)):
13680
+ For a peer-free CLI, import `createCli` directly from `stitchkit/cli` and
13681
+ annotate the `context` factory's return type against your app's context shape
13682
+ — no optional peers are loaded:
13675
13683
 
13676
13684
  ```ts
13685
+ import { createCli } from 'stitchkit/cli'
13686
+
13687
+ await createCli({
13688
+ name: 'myapp',
13689
+ version: '1.0.0',
13690
+ services,
13691
+ access: { gate: { beforeHandle: authHook } },
13692
+ context: (identity): { user: User | undefined } => ({ user: identity }),
13693
+ })
13694
+ ```
13695
+
13696
+ If your application already installs both `@modelcontextprotocol/server` and
13697
+ `ai` and mounts MCP, AI SDK `mountAgent`, and CLI surfaces together, you can
13698
+ also pin the shared context type once via `createToolkit<AppContext>()` from
13699
+ `stitchkit/tools/toolkit` — the tool-side mirror of `createImplement`
13700
+ ([ADR 0017](../decisions/0017-typed-tool-context.md),
13701
+ [ADR 0284](../decisions/0284-the-tools-barrel-loads-no-optional-peer.md)):
13702
+
13703
+ ```ts
13704
+ import { createToolkit } from 'stitchkit/tools/toolkit'
13705
+
13677
13706
  const tools = createToolkit<{ user: User }>()
13678
13707
  await tools.createCli({
13679
13708
  name: 'myapp',
@@ -13790,7 +13819,7 @@ try {
13790
13819
  ```
13791
13820
 
13792
13821
  `path` is `'0.v'` and not `'v'` because event arguments are a tuple: index `0`
13793
- is the first payload. The issues are already flattened by Stitchkit's own
13822
+ is the first payload. The issues are already flattened by StitchKit's own
13794
13823
  normaliser, so telling "wrong generation" from "malformed payload" is one
13795
13824
  comparison rather than an inspection of a `ZodError`'s internals.
13796
13825
 
@@ -13825,7 +13854,7 @@ The client sends it as `auth`, and a rejection reaches `onConnectError` with
13825
13854
  deployment reads as a half-rolled deployment and not as an access problem.
13826
13855
 
13827
13856
  What that identity *is* remains the application's decision — a build version, a
13828
- contract hash, a protocol generation. Stitchkit does not compare it for you
13857
+ contract hash, a protocol generation. StitchKit does not compare it for you
13829
13858
  (→ ADR 0002); it gives the place where the comparison happens before any frame
13830
13859
  is interpreted, and it makes the per-frame alternative honest by letting its
13831
13860
  refusals be seen.
@@ -13949,7 +13978,7 @@ socket.on('note:created', (note) => { /* typed note */ })
13949
13978
  socket.emit('room:join', 'general', ({ joined }) => { /* typed + validated */ })
13950
13979
  ```
13951
13980
 
13952
- When an application already owns the low-level Stitchkit transport, bind the
13981
+ When an application already owns the low-level StitchKit transport, bind the
13953
13982
  contract without opening a second connection:
13954
13983
 
13955
13984
  ```ts
@@ -14115,7 +14144,7 @@ classification detects duplicates—those are different policies.
14115
14144
 
14116
14145
  A server process that owns such a receiver can place `start()` and `close()` in
14117
14146
  an existing `defineManagedResource` and include it in `createApplication`.
14118
- Readiness follows a successful `live` snapshot; shutdown calls `close()`. Stitchkit
14147
+ Readiness follows a successful `live` snapshot; shutdown calls `close()`. StitchKit
14119
14148
  does not add another supervisor, reconnect loop or durable event database.
14120
14149
 
14121
14150
  When migrating a hand-written receiver, remove only the superseded attach/snapshot
@@ -14186,7 +14215,7 @@ closed phase:
14186
14215
  |-------|----------------------|
14187
14216
  | `engine-handoff` | Engine.IO created the outbound message packet and accepted it into its write path |
14188
14217
  | `engine-ack-received` | Engine.IO decoded the inbound acknowledgement message, before Socket.IO invokes the acknowledgement callback |
14189
- | `settled` | the acknowledgement callback ran and Stitchkit finished acknowledgement validation |
14218
+ | `settled` | the acknowledgement callback ran and StitchKit finished acknowledgement validation |
14190
14219
  | `timeout` | the existing native acknowledgement timeout won |
14191
14220
  | `disconnected` | the request began disconnected or an in-flight disconnect won |
14192
14221
 
@@ -14208,7 +14237,7 @@ await socket.request('room:join', 'general', {
14208
14237
 
14209
14238
  The client-wide hook receives every observed request; a request hook receives
14210
14239
  only its invocation. If the same function is supplied in both places it runs
14211
- once per phase. The closure is local: Stitchkit does not retain `operationId`,
14240
+ once per phase. The closure is local: StitchKit does not retain `operationId`,
14212
14241
  add it to the event or transmit it to the peer. A request hook works without a
14213
14242
  client-wide hook, and the no-hook path installs no phase listeners.
14214
14243
 
@@ -14594,7 +14623,7 @@ question: a list takes one of them, and `createEntityCacheHandlers` refuses both
14594
14623
 
14595
14624
  The helper deliberately does **not** flatten pages, infer filter semantics,
14596
14625
  derive a sort order or replace arbitrary `setQueryData` logic. Those remain
14597
- declared application policies; Stitchkit applies their generic cache mechanics.
14626
+ declared application policies; StitchKit applies their generic cache mechanics.
14598
14627
 
14599
14628
  ## Raw binary lane (Bun)
14600
14629
 
@@ -14969,7 +14998,7 @@ is where the full name is *built*, not a second name for the same topic.
14969
14998
  ### The wire is the socket you already run
14970
14999
 
14971
15000
  `toRealtimeContract` projects the declaration onto `RealtimeContract`. Everything
14972
- after that is the machinery Stitchkit already ships — validation both ways,
15001
+ after that is the machinery StitchKit already ships — validation both ways,
14973
15002
  rejection reporting, rooms, and the client's `retain:` replay.
14974
15003
 
14975
15004
  ```ts
@@ -15417,7 +15446,7 @@ The framework attaches no meaning to the strings — `'public'`, `'user'`,
15417
15446
  ## `createAuthHook`
15418
15447
 
15419
15448
  `createAuthHook` builds one scope gate that can run in both HTTP and tool
15420
- lifecycles. On HTTP it belongs in `hooks.authorize`: Stitchkit validates path
15449
+ lifecycles. On HTTP it belongs in `hooks.authorize`: StitchKit validates path
15421
15450
  params, resolves identity and scope, and rejects `401`/`403` **before reading a
15422
15451
  JSON or multipart body**. On MCP, agent and CLI surfaces it belongs in
15423
15452
  `access.gate.beforeHandle` (`access: { gate: { beforeHandle: authHook } }`),
@@ -15604,7 +15633,7 @@ export const implementFor = createScopedImplement<AuthScopes<typeof auth>>()
15604
15633
 
15605
15634
  Only hooks that declare the selected scope run. An unknown scope fails closed;
15606
15635
  when several hooks own one scope, every owner must pass in declaration order.
15607
- Each owner evaluates on an isolated shadow context. Stitchkit validates all
15636
+ Each owner evaluates on an isolated shadow context. StitchKit validates all
15608
15637
  changed fields, rejects reserved/unsafe fields and cross-owner key collisions,
15609
15638
  then commits the combined contribution once. A rejected or cancelled composite
15610
15639
  therefore exposes no partial fields to the handler.
@@ -15855,7 +15884,7 @@ complete: async ({ response }) => {
15855
15884
  }
15856
15885
  ```
15857
15886
 
15858
- Append once per cookie; Stitchkit preserves separate `Set-Cookie` fields through
15887
+ Append once per cookie; StitchKit preserves separate `Set-Cookie` fields through
15859
15888
  both Bun and Node. Cookie/session policy remains application logic.
15860
15889
 
15861
15890
  ## The error model
@@ -16009,7 +16038,7 @@ onError: (ctx, err) => {
16009
16038
 
16010
16039
  ## One application vocabulary and one wire map
16011
16040
 
16012
- `defineErrors` can also resolve Stitchkit's framework codes into the same
16041
+ `defineErrors` can also resolve StitchKit's framework codes into the same
16013
16042
  application vocabulary. A status fallback is explicit because several
16014
16043
  application codes may legally share one HTTP status:
16015
16044
 
@@ -16101,7 +16130,7 @@ retained on the returned `AppError`.
16101
16130
  HTTP renders the complete code/status/message/details/hint. Tool transports keep
16102
16131
  their established model-facing projection (code/details/hint, without HTTP
16103
16132
  status), while `invokeOrThrow` recovers the exact normalized `AppError`. The
16104
- codes and schemas remain application-owned; Stitchkit stays domain-free.
16133
+ codes and schemas remain application-owned; StitchKit stays domain-free.
16105
16134
 
16106
16135
  ### The codes an operation refuses with
16107
16136
 
@@ -16188,7 +16217,7 @@ stitchkit code you did not list travels as itself. Set `unmappedCode` to one
16188
16217
  wire-code when your public vocabulary has a catch-all, or to a function such as
16189
16218
  `(code) => code.startsWith('FILE_') ? 'storage_error' : 'framework_error'` when
16190
16219
  framework code families need different buckets. An explicit `codeMap` entry
16191
- always wins. Codes your project throws itself do not belong to Stitchkit's
16220
+ always wins. Codes your project throws itself do not belong to StitchKit's
16192
16221
  vocabulary, so they never pass through this fallback and remain unchanged.
16193
16222
 
16194
16223
  One `satisfies` is the **opt-in** to the stricter deal:
@@ -16250,7 +16279,7 @@ onError: (ctx, err) => {
16250
16279
 
16251
16280
  # Browser OAuth and Google OIDC
16252
16281
 
16253
- Stitchkit separates the browser's Authorization Code + PKCE transaction from the server's
16282
+ StitchKit separates the browser's Authorization Code + PKCE transaction from the server's
16254
16283
  provider credential verification. The application still owns navigation, users, account matching
16255
16284
  and merge policy, persistence, sessions, roles, unlink policy and UI.
16256
16285
 
@@ -16258,13 +16287,13 @@ and merge policy, persistence, sessions, roles, unlink policy and UI.
16258
16287
 
16259
16288
  The current Google adapter supports one explicit profile: **web OpenID Connect Authorization Code
16260
16289
  with PKCE**. A browser performs a top-level redirect, an application backend exchanges the
16261
- one-time code, and Stitchkit returns a verified identity. It is the redirect-based sign-in path;
16290
+ one-time code, and StitchKit returns a verified identity. It is the redirect-based sign-in path;
16262
16291
  it is not a generic name for every Google identity or authorization mechanism.
16263
16292
 
16264
16293
  Keep adjacent Google capabilities separate because their credentials, lifecycle and trust
16265
16294
  boundaries differ:
16266
16295
 
16267
- | Capability | Credential/result | Stitchkit support |
16296
+ | Capability | Credential/result | StitchKit support |
16268
16297
  | --- | --- | --- |
16269
16298
  | Web OIDC Authorization Code + PKCE | verified user identity | `stitchkit/oauth` + `stitchkit/google` |
16270
16299
  | Google Identity Services button, One Tap or FedCM | browser-delivered ID credential | not implemented |
@@ -16346,7 +16375,7 @@ const identity = await google.exchangeAuthorizationCode({
16346
16375
 
16347
16376
  The redirect must match the immutable allowlist exactly before any outbound call. The token
16348
16377
  exchange is bounded by an abort deadline; `google-auth-library` verifies the ID-token signature,
16349
- issuer, audience and expiry. Stitchkit additionally requires `sub`, a valid verified email and an
16378
+ issuer, audience and expiry. StitchKit additionally requires `sub`, a valid verified email and an
16350
16379
  exact nonce. Access, refresh and raw ID tokens never leave the adapter.
16351
16380
 
16352
16381
  `GoogleOidcError.code` distinguishes `MISCONFIGURED`, `INVALID_CREDENTIAL` and
@@ -16575,7 +16604,7 @@ bound observes the same drain under its own limit rather than starting another.
16575
16604
  Passing no bound keeps the previous behaviour exactly, including the identical
16576
16605
  returned promise.
16577
16606
 
16578
- Stitchkit manages only in-process delivery. If process-crash durability matters,
16607
+ StitchKit manages only in-process delivery. If process-crash durability matters,
16579
16608
  make `write` enqueue into a consumer-owned durable outbox and let that adapter
16580
16609
  own retry, replay and storage policy:
16581
16610
 
@@ -16863,7 +16892,7 @@ locally; you do not need to change `NODE_ENV` or deploy.
16863
16892
  Every response the stitchkit handler produces carries the resolved id as
16864
16893
  **`x-request-id`**. With `cors` configured it is in the default
16865
16894
  `Access-Control-Expose-Headers`, so a browser client can read it and quote it in
16866
- a bug report. Stitchkit browser clients retain it as `ApiError.traceId` on
16895
+ a bug report. StitchKit browser clients retain it as `ApiError.traceId` on
16867
16896
  response-backed failures. Note the deliberate asymmetry: inbound the id may arrive as
16868
16897
  `X-Trace-Id` *or* `X-Request-Id`; outbound there is one name and no alias.
16869
16898
 
@@ -16915,7 +16944,7 @@ cross-origin `trace: true` client works out of the box. If you set a custom
16915
16944
  the preflight will reject the trace header.
16916
16945
 
16917
16946
  MCP tools use the same context. On a modern HTTP or stdio `tools/call`, the
16918
- official SDK exposes W3C propagation values from request `_meta`; Stitchkit
16947
+ official SDK exposes W3C propagation values from request `_meta`; StitchKit
16919
16948
  continues a valid `_meta.traceparent` before validation, lifecycle and hooks.
16920
16949
  If MCP metadata omits `traceparent`, an HTTP call keeps its ambient HTTP trace
16921
16950
  and a stdio call starts a new root. If the key is present but malformed or
@@ -17711,7 +17740,7 @@ of defect stays invisible in development.
17711
17740
 
17712
17741
  ### Shipping one self-contained artifact
17713
17742
 
17714
- Stitchkit resolves the optional Socket.IO peers through a variable, so a
17743
+ StitchKit resolves the optional Socket.IO peers through a variable, so a
17715
17744
  consumer bundling an unrelated `stitchkit/server` export never has to resolve
17716
17745
  them. A bundler cannot follow that, which matters if you ship **one file** to a
17717
17746
  machine with no `node_modules`: the package never enters the artifact and the
@@ -17734,7 +17763,7 @@ const socket = await createSocketIOServer({
17734
17763
 
17735
17764
  The packed Next/Webpack gate compiles the browser
17736
17765
  `peers.client: () => import('socket.io-client')` loader and rejects Webpack's
17737
- "request is an expression" warning. Stitchkit's runtime fallback remains lazy;
17766
+ "request is an expression" warning. StitchKit's runtime fallback remains lazy;
17738
17767
  its emitted import carries a count-checked ignore directive.
17739
17768
 
17740
17769
  Omit `peers` and nothing changes: the peers stay lazy and are resolved from the
@@ -17945,7 +17974,7 @@ await binding.promise
17945
17974
 
17946
17975
  The first signal starts exactly one close chain. A same-turn duplicate is
17947
17976
  ignored; a later signal restores the default OS disposition because the
17948
- official stdio close is not abortable and Stitchkit will not pretend otherwise.
17977
+ official stdio close is not abortable and StitchKit will not pretend otherwise.
17949
17978
  `binding.close()` removes idle listeners and resolves the promise with
17950
17979
  `undefined`. No listener is installed until the binder is called, and the
17951
17980
  framework never calls `process.exit()`.
@@ -18008,7 +18037,7 @@ stitchkit serves the API. A SPA front-end is built and hosted separately — a
18008
18037
  static host or CDN in production, its own dev server in development. The backend
18009
18038
  does not serve static files (`staticRoute` exists for the occasional asset, not
18010
18039
  a whole app). `bun create stitchkit my-app` demonstrates the supported split:
18011
- an independently built Next.js frontend and Bun/Stitchkit API.
18040
+ an independently built Next.js frontend and Bun/StitchKit API.
18012
18041
 
18013
18042
  ### MCP
18014
18043
 
@@ -18164,12 +18193,12 @@ per-transport tenant plumbing.
18164
18193
  # Frontend integrations
18165
18194
 
18166
18195
  The official `bun create stitchkit` application uses Next.js with a separate
18167
- Bun API. Stitchkit remains a Fetch-native backend and does not own frontend
18196
+ Bun API. StitchKit remains a Fetch-native backend and does not own frontend
18168
18197
  routing, SSR or HMR.
18169
18198
 
18170
18199
  ## Theme boundary in the official starter
18171
18200
 
18172
- The generated Next.js application uses `@wrksz/themes`, not a Stitchkit-owned
18201
+ The generated Next.js application uses `@wrksz/themes`, not a StitchKit-owned
18173
18202
  theme abstraction. Its root `ThemeProvider` comes from `@wrksz/themes/next` and
18174
18203
  lives directly in the server layout so Next 16 can inject the first-paint script
18175
18204
  through `useServerInsertedHTML`. The default `hybrid` storage reads a cookie
@@ -18209,10 +18238,10 @@ export async function action({ request }: ActionFunctionArgs) {
18209
18238
 
18210
18239
  ## Vite
18211
18240
 
18212
- Run Vite and the Stitchkit API as separate development processes. Declare one
18241
+ Run Vite and the StitchKit API as separate development processes. Declare one
18213
18242
  proxy for `/api`, `/mcp` and `/socket.io`; browser code still calls the typed
18214
18243
  client with same-origin paths. Production serves the static Vite output from a
18215
- static host or reverse proxy and routes those backend paths to Stitchkit.
18244
+ static host or reverse proxy and routes those backend paths to StitchKit.
18216
18245
 
18217
18246
  Do not duplicate DTOs or handwritten API wrappers in either integration. The
18218
18247
  shared contract remains the only transport schema source.
@@ -19436,7 +19465,7 @@ of git.
19436
19465
  ### Injecting another transport's failure policy
19437
19466
 
19438
19467
  `classify(error)` returns the public `TelegramBroadcastFailure` union. It lets
19439
- an application use its own client without adding that SDK to Stitchkit:
19468
+ an application use its own client without adding that SDK to StitchKit:
19440
19469
 
19441
19470
  ```ts
19442
19471
  const report = await runTelegramBroadcast({
@@ -20450,7 +20479,7 @@ The previous reader closes only after its in-flight lookups finish.
20450
20479
 
20451
20480
  Use `GeoIpReaderLoader` when the database is not MaxMind-compatible. `revision`
20452
20481
  must identify the complete input generation and return `null` when it cannot be
20453
- read. `open` returns a reader for exactly that revision. Stitchkit serializes
20482
+ read. `open` returns a reader for exactly that revision. StitchKit serializes
20454
20483
  reloads, swaps generations and owns their close lifecycle.
20455
20484
 
20456
20485
  Download schedules, licenses, database paths, attribution persistence and
@@ -20606,7 +20635,13 @@ const runtime = createAgentRuntime({
20606
20635
  - `anthropicProvider` from `stitchkit/agent-runtime/anthropic`
20607
20636
  2. Replace `fromAiSdkTools(mountAgent(...))` with `mountAgentTools(...)` from `stitchkit/tools`, and replace custom AI SDK `tool(...)` declarations with `defineAgentTool(...)` from `stitchkit/tools`.
20608
20637
  3. Replace direct `generateText` / `generateObject` helper calls with `completeText` / `completeObject` from `stitchkit/agent-runtime`, and replace `wrapLanguageModel` middleware with `wrapModelDriver` / `composeModelDrivers`.
20609
- 4. Remove `ai` and `@openrouter/ai-sdk-provider` from `package.json` if nothing else in your project uses `stitchkit/tools/agent` or `stitchkit/agent-runtime/ai-sdk`.
20638
+ 4. Check for every remaining `ai`-requiring `stitchkit` entrypoint — `stitchkit/tools/agent`, `stitchkit/tools/toolkit`, and `stitchkit/agent-runtime/ai-sdk` — before removing `ai` and `@openrouter/ai-sdk-provider` from `package.json`:
20639
+ - `stitchkit/tools/toolkit` (`createToolkit`) deliberately requires **both** `@modelcontextprotocol/server` and `ai` because it composes the MCP server factories and AI SDK `mountAgent` together (ADR 0284). Keeping a `stitchkit/tools/toolkit` import after removing `ai` fails clean installs and bundling (`Could not resolve: "ai"`).
20640
+ - If you used `createToolkit<AppContext>()` without AI SDK `mountAgent`, replace it with the narrow entrypoints directly:
20641
+ - MCP servers (`createMcpHandler`, `buildMcpServer`, `mountMcp`, `createStdioMcpServer`) → import from `stitchkit/tools/mcp` (requires only `@modelcontextprotocol/server`) and annotate the `context` factory return type (`context: (auth): AppContext => ({ ... })`).
20642
+ - Peer-free agent tools (`mountAgentTools`, `defineAgentTool`) → import from `stitchkit/tools` (zero optional peers).
20643
+ - CLI (`createCli`, `createCliInvoker`) → import from `stitchkit/cli` (zero optional peers; annotate `context: (auth): AppContext => ({ ... })`).
20644
+ - Once no imports of `stitchkit/tools/agent`, `stitchkit/tools/toolkit`, or `stitchkit/agent-runtime/ai-sdk` remain (`rg "stitchkit/(tools/agent|tools/toolkit|agent-runtime/ai-sdk)" .`), remove `ai` and `@openrouter/ai-sdk-provider` from `package.json`.
20610
20645
 
20611
20646
  ```ts
20612
20647
  // After (Step 2: completely peer-free)
@@ -22729,7 +22764,7 @@ succeeds, its result stays on stdout, stderr names the refusal and the exit is n
22729
22764
  A JS bundle uses `delivery: 'companion'`; every shape is in the [native I/O guide](./native-io.md). Search pattern:
22730
22765
  `createCli` with a `download` option in a project that runs `bun build` for macOS.
22731
22766
  2. On Windows, run the download through Linux or macOS, or read the URLs from the operation's
22732
- JSON result and fetch them yourself. Stitchkit offers no weaker path on that platform.
22767
+ JSON result and fetch them yourself. StitchKit offers no weaker path on that platform.
22733
22768
  3. A download now replaces a file rather than rewriting it. Give the process write permission on
22734
22769
  the output directory, and do not point it at a bind-mounted file: that refuses with `EBUSY`. A
22735
22770
  replaced file belongs to the process user, and a read-only file is replaced like any other.
@@ -23151,7 +23186,7 @@ pipes drain.
23151
23186
  read `asset.sourcePath`, hash the addon themselves, switch over the refusal `state`/`code`, pass a
23152
23187
  `platform` other than the literal `'darwin'`, or parse `node_modules/stitchkit/native-assets.json`.
23153
23188
 
23154
- The package now publishes the `size` and SHA256 of each Darwin addon, computed when Stitchkit is
23189
+ The package now publishes the `size` and SHA256 of each Darwin addon, computed when StitchKit is
23155
23190
  built, in `native-assets.json` at `formatVersion: 2`. `createNativePackaging` reads each selected
23156
23191
  addon once, compares it with that digest and returns the verified bytes. An installed addon that
23157
23192
  differs refuses with `NATIVE_ASSET_DIGEST_MISMATCH`.
@@ -24426,7 +24461,7 @@ If you operate a built-in SQLite store file:
24426
24461
 
24427
24462
  1. Back the file up. The first open by 0.86.0 migrates it to schema 2 in one
24428
24463
  transaction and there is no way back: a 0.85.x package refuses a migrated
24429
- file with `Unsupported Stitchkit agent-runtime SQLite schema version 2`.
24464
+ file with `Unsupported StitchKit agent-runtime SQLite schema version 2`.
24430
24465
  2. Check the build for FTS5 before deploying:
24431
24466
 
24432
24467
  ```sql
@@ -26645,7 +26680,7 @@ runtime callback arguments; only `.withOptions` reads `ClientRequestOptions`.
26645
26680
  ### HTTP auth moves to the pre-body `authorize` phase
26646
26681
 
26647
26682
  Move the HTTP wiring of `createAuthHook` from `beforeHandle` to `authorize`.
26648
- This lets Stitchkit reject an unauthorized JSON or multipart request after path
26683
+ This lets StitchKit reject an unauthorized JSON or multipart request after path
26649
26684
  parameter validation but before reading a body chunk. Keep application
26650
26685
  preconditions that depend on validated input in `beforeHandle`.
26651
26686
 
@@ -26788,7 +26823,7 @@ collected tool logs from stdout.
26788
26823
 
26789
26824
  ### MCP TypeScript SDK v2 and protocol `2026-07-28`
26790
26825
 
26791
- This is a hard cut: there is one Stitchkit API and no v1 aliases. Applications
26826
+ This is a hard cut: there is one StitchKit API and no v1 aliases. Applications
26792
26827
  that expose MCP install the split server package; applications that implement an
26793
26828
  MCP host or run client E2E install the split client package.
26794
26829
 
@@ -26864,7 +26899,7 @@ modern-only. This is not a stateful compatibility transport.
26864
26899
 
26865
26900
  #### Output shape depends on the negotiated protocol era
26866
26901
 
26867
- Stitchkit always validates the handler result against the declared output
26902
+ StitchKit always validates the handler result against the declared output
26868
26903
  schema. The negotiated MCP era determines only its wire representation:
26869
26904
 
26870
26905
  | Negotiated era | Non-object `structuredContent` |
@@ -26929,7 +26964,7 @@ mountOAuthProvider({
26929
26964
  A URL client id must be HTTPS and serve a document whose `client_id` exactly
26930
26965
  matches that URL, with explicit `redirect_uris` and
26931
26966
  `token_endpoint_auth_method: 'none'`. Do not keep a consumer-side metadata
26932
- fetcher or DCR fallback; Stitchkit owns SSRF-safe resolution and caching.
26967
+ fetcher or DCR fallback; StitchKit owns SSRF-safe resolution and caching.
26933
26968
 
26934
26969
  Multi-round input is opt-in on the operation and does not change Agent, CLI or
26935
26970
  ordinary HTTP handlers:
@@ -27049,7 +27084,7 @@ summarizeTransports(surface)
27049
27084
  `ToolNameEntry` adds `kind: 'contract' | 'runtime'`. `TransportSummary` is now
27050
27085
  `{ contractServices, runtimeTools, totals, sources }`; replace `services` and
27051
27086
  `perService` reads with the explicit counts and mixed-source breakdown. There
27052
- is no positional overload and no `buildRuntimeToolManifest`: Stitchkit owns the
27087
+ is no positional overload and no `buildRuntimeToolManifest`: StitchKit owns the
27053
27088
  combined order, transport filtering, canonical presentation schema and
27054
27089
  cross-origin collision checks.
27055
27090
 
@@ -27117,7 +27152,7 @@ createMcpHandler({
27117
27152
  ```
27118
27153
 
27119
27154
  Keep direct `services(auth)` / `runtimeTools(auth)` only for genuinely
27120
- unbounded definitions; Stitchkit intentionally does not cache arbitrary auth
27155
+ unbounded definitions; StitchKit intentionally does not cache arbitrary auth
27121
27156
  values.
27122
27157
 
27123
27158
  Contract success bodies are now determined by the presence of `output`, not by
@@ -27290,7 +27325,7 @@ mountable.argumentSchema // executable CLI argument adapter only
27290
27325
 
27291
27326
  Contract and native handlers keep their original Zod schemas; MCP and agent SDK
27292
27327
  adapters now forward raw arguments so defaults, coercions, refinements and
27293
- transforms execute exactly once inside Stitchkit. There are no compatibility
27328
+ transforms execute exactly once inside StitchKit. There are no compatibility
27294
27329
  exports for `flattenDiscriminatedUnion`, `flattenUnionsDeep` or
27295
27330
  `MountableTool.schema`. → ADR 0050
27296
27331
 
@@ -27764,7 +27799,7 @@ The browser-and-server entrypoint. Re-exports everything from
27764
27799
  | `createSocketIOClient` | function | low-level typed Socket.IO transport primitive — [guide](../guide/realtime.md#low-level-transport) |
27765
27800
  | `defineRealtimeContract` | function | Zod-first shared Socket.IO event contract — [guide](../guide/realtime.md#zod-first-event-contract) |
27766
27801
  | `createRealtimeClient` | function | inferred, runtime-validated Socket.IO client — [guide](../guide/realtime.md#client--createrealtimeclient) |
27767
- | `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing Stitchkit client transport without owning its lifecycle |
27802
+ | `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing StitchKit client transport without owning its lifecycle |
27768
27803
  | `createLiveStateController` | function | keep typed application state current across one source-owned snapshot/event generation with finite pre-snapshot buffering, generation fencing and explicit resync — [guide](../guide/realtime.md#snapshot--event-state-synchronization) |
27769
27804
  | `LiveStateController` | _type_ | renderer-neutral `start` / `resync` / `getSnapshot` / `subscribe` / `close` handle |
27770
27805
  | `LiveStateControllerConfig` | _type_ | typed source, reducer, explicit event/byte bounds, event sizing and isolated error hooks |
@@ -29215,7 +29250,7 @@ protocol but exclude runtime `context`. Submit permits only strict text/file par
29215
29250
  file ownership and metadata policy are checked by server authorization. The shared
29216
29251
  `agentControlRealtimeContract` owns `agent:control` acknowledgements and `agent:delivery`.
29217
29252
 
29218
- `createAgentController` / `AgentControllerConfig` take an existing Stitchkit
29253
+ `createAgentController` / `AgentControllerConfig` take an existing StitchKit
29219
29254
  realtime `transport`, `conversationId`, `access` (`observe` or `control`), optional
29220
29255
  `timeoutMs` (10000), `maxBufferedEvents` (256), `maxBufferedBytes` (1048576) and
29221
29256
  `maxPendingRequests` (32). All bounds are positive safe integers. One controller owns one
@@ -29545,7 +29580,7 @@ loaded by the neutral, browser or Node runtime surfaces.
29545
29580
  | `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate the schema, migrate older versions transactionally and return `{ store, conversations, host, close }` |
29546
29581
  | `BunSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional create and initialization policies |
29547
29582
  | `createSqliteAgentRuntimeStore` | function | build the normalized store over an injected synchronous SQLite boundary |
29548
- | `initializeAgentRuntimeSqlite` | function | initialize or validate only Stitchkit's namespaced SQLite schema |
29583
+ | `initializeAgentRuntimeSqlite` | function | initialize or validate only StitchKit's namespaced SQLite schema |
29549
29584
  | `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
29550
29585
  | `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle — `store`, `conversations`, `host`, `close` — owned connection lifecycle, initialization policy, and the companion host every companion takes |
29551
29586
 
@@ -30082,7 +30117,9 @@ not the MCP server SDK. → ADR 0284, ADR 0336.
30082
30117
  ## `stitchkit/tools/toolkit`
30083
30118
 
30084
30119
  Server-only. One context-typed tool set served over MCP and to an AI SDK agent, so it
30085
- needs both the `@modelcontextprotocol/server` and `ai` peers. → ADR 0284.
30120
+ deliberately requires both the `@modelcontextprotocol/server` and `ai` peers. Applications
30121
+ that drop `ai` (or install neither peer) should import directly from `stitchkit/tools/mcp`,
30122
+ `stitchkit/tools`, or `stitchkit/cli` instead of `stitchkit/tools/toolkit`. → ADR 0284.
30086
30123
 
30087
30124
  | Export | Kind | Summary |
30088
30125
  |--------|------|---------|
@@ -30104,7 +30141,7 @@ and approval path.
30104
30141
  | `ConnectionPhase` / `ConnectionOperation` / `ConnectionFailureContext` | _type_ | closed operation/phase vocabulary and measured read context for existing typed connection errors |
30105
30142
  | `ConnectionTimeoutError` / `ConnectionResponseTooLargeError` | class | bounded operation refusal, with phase, operation and finite observed bytes — a timeout also says which `deadline` fired (`'total'` or `'idle'`, with `timeoutMs` the limit that fired); safe tool projection retains the raw cause locally |
30106
30143
  | `ConnectionDeadline` / `ConnectionTimeoutContext` | _type_ | `'total' \| 'idle'`, and a timeout's diagnostics with the deadline that fired (default `'total'`) |
30107
- | `McpConnectionCatalogStore` / `McpConnectionCatalogEntry` | _type_ | `{ load, store }` the application gives a connection's `catalog`, and the `{ stamp, result }` it keeps: when the server's `initialize` answer carries a catalog stamp (a Stitchkit server's does), a stored `tools/list` result whose stamp — and every tool's — matches is mounted without listing; anything else lists and stores again, and a failing store is a miss |
30144
+ | `McpConnectionCatalogStore` / `McpConnectionCatalogEntry` | _type_ | `{ load, store }` the application gives a connection's `catalog`, and the `{ stamp, result }` it keeps: when the server's `initialize` answer carries a catalog stamp (a StitchKit server's does), a stored `tools/list` result whose stamp — and every tool's — matches is mounted without listing; anything else lists and stores again, and a failing store is a miss |
30108
30145
  | `defineOpenApiConnection` | function | declare one OpenAPI document (object, JSON text or JSON URL) as a tool surface |
30109
30146
  | `mountConnections` | function | discover every connection and return readonly `RuntimeToolDefinition`s for `mountAgent`; reported structural failures and bounds stay local, while unions and string-format/pattern refusals (including inside record keys) are judged by the server that owns the original schema (ADR 0266, ADR 0272) |
30110
30147
  | `ConnectionAuthorizationRequiredError` | class | typed reauthorization signal raised on `401` with credentials resolved again on the next call |
@@ -31151,7 +31188,7 @@ fails a build whose entry imports the default loader of another `stitchkit` inst
31151
31188
  both versions and roots.
31152
31189
  It resolves the installed package's target/version, reads each selected addon once and checks it
31153
31190
  against the `size` and `sha256` published in the package's `native-assets.json` (`formatVersion: 2`,
31154
- written when Stitchkit is built). Call it once per build and reuse the result.
31191
+ written when StitchKit is built). Call it once per build and reuse the result.
31155
31192
  `platform`, `architecture`, `delivery`, `entryPath` and `assetPath` are the explicit inputs of
31156
31193
  companion delivery; embedded delivery takes `platform`, one `architecture` and `delivery` only, and
31157
31194
  refuses a path. `assetPath` accepts one template, `[hash]`, replaced by the first 16 hex digits of