stitchkit 0.134.0 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +6 -6
- package/dist/agent-executor/claude/cli-driver.d.ts +6 -0
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
- package/dist/agent-executor/claude/session.d.ts +2 -0
- package/dist/agent-executor/claude/session.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts +9 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts +18 -5
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-options.d.ts +16 -0
- package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/session.d.ts +1 -0
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
- package/dist/agent-runtime/harness-contract.d.ts +5 -5
- package/dist/agent-runtime/harness-contract.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +13 -13
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-macos.d.ts +5 -4
- package/dist/agent-runtime/sandbox-process-macos.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-spec.d.ts +6 -0
- package/dist/agent-runtime/sandbox-process-spec.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-wrapper.d.ts +2 -1
- package/dist/agent-runtime/sandbox-process-wrapper.d.ts.map +1 -1
- package/dist/agent-runtime/sql-rows.d.ts +10 -10
- package/dist/agent-runtime/sqlite-schema.d.ts +2 -2
- package/dist/agent-runtime/sqlite.d.ts +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/application/grammy.d.ts +1 -1
- package/dist/browser/contract-identity.d.ts +1 -1
- package/dist/browser/http-fetch.d.ts +1 -1
- package/dist/browser/socket-io-contract.d.ts +1 -1
- package/dist/contract/bridge-envelope.d.ts +1 -1
- package/dist/contract/client-types.d.ts +1 -1
- package/dist/contract/define.d.ts +2 -2
- package/dist/contract/errors-factory.d.ts +1 -1
- package/dist/contract/fingerprint.d.ts +1 -1
- package/dist/device-relay/hub.d.ts +1 -1
- package/dist/entrypoints/agent-executor/claude-sdk.js +323 -153
- package/dist/entrypoints/agent-executor/claude.js +40 -26
- package/dist/entrypoints/agent-runtime/postgres.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +21 -16
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +1 -1
- package/dist/entrypoints/agent-runtime/sqlite/node.js +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +1 -1
- package/dist/entrypoints/files/packaging.js +2 -2
- package/dist/entrypoints/handler.js +2 -2
- package/dist/entrypoints/node.js +2 -2
- package/dist/entrypoints/server.js +2 -2
- package/dist/entrypoints/tools/mcp.js +3 -3
- package/dist/entrypoints/tools/toolkit.js +3 -3
- package/dist/entrypoints/tools.js +2 -2
- package/dist/files/native-packaging-layout.d.ts +1 -1
- package/dist/{index-654rhe5d.js → index-7mjsb7zv.js} +5 -1
- package/dist/{index-kdw0n92g.js → index-a09r9ff0.js} +1 -1
- package/dist/{index-epyj7ptp.js → index-a84wj6y8.js} +4 -4
- package/dist/{index-qymek778.js → index-m2b49tvc.js} +76 -22
- package/dist/{index-mrng24wq.js → index-zag9sjpd.js} +1 -1
- package/dist/internal/postgres-query.d.ts +1 -1
- package/dist/react/query-client.d.ts +1 -1
- package/dist/server/bridge-host.d.ts +1 -1
- package/dist/server/bun.d.ts +1 -1
- package/dist/server/endpoint-dispatch.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +3 -3
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/socket-io-config.d.ts +1 -1
- package/dist/service-host/identity.d.ts +1 -1
- package/dist/service-host/systemd-inspect.d.ts +1 -1
- package/dist/testing/manual-clock.d.ts +1 -1
- package/dist/tools/connections/types.d.ts +1 -1
- package/dist/tools/mcp/handler.d.ts +1 -1
- package/dist/tools/mcp/lazy-discovery.d.ts +1 -1
- package/dist/tools/mcp/mount.d.ts +1 -1
- package/dist/tools/mcp/stdio.d.ts +1 -1
- package/llms/agent-executor-claude-sdk.txt +1 -1
- package/llms/agent-executor-claude.txt +1 -1
- package/llms/agent-runtime-browser.txt +1 -1
- package/llms/agent-runtime-sandbox.txt +12 -8
- package/llms/agent-runtime-sqlite-bun.txt +1 -1
- package/llms/agent-runtime.2.txt +1 -1
- package/llms/agent-runtime.3.txt +4 -4
- package/llms/agent-runtime.txt +3 -3
- package/llms/application.2.txt +4 -4
- package/llms/application.txt +4 -4
- package/llms/cli.2.txt +27 -6
- package/llms/cli.txt +2 -2
- package/llms/contract.txt +1 -1
- package/llms/files-packaging.txt +1 -1
- package/llms/geo.txt +1 -1
- package/llms/live.txt +1 -1
- package/llms/oauth.txt +4 -4
- package/llms/observability.txt +3 -3
- package/llms/primitives.txt +1 -1
- package/llms/process.2.txt +7 -7
- package/llms/react.txt +4 -4
- package/llms/server.2.txt +7 -7
- package/llms/server.3.txt +5 -5
- package/llms/server.4.txt +6 -6
- package/llms/server.txt +13 -5
- package/llms/stitchkit.2.txt +3 -3
- package/llms/stitchkit.3.txt +1 -1
- package/llms/stitchkit.txt +4 -4
- package/llms/telegram.txt +1 -1
- package/llms/testing.txt +4 -4
- package/llms/tools-connections.txt +1 -1
- package/llms/tools-toolkit.txt +3 -1
- package/llms/tools.2.txt +6 -6
- package/llms/tools.3.txt +8 -8
- package/llms/upgrading-0.106.0-0.126.0.txt +1 -1
- package/llms/upgrading-0.128.0-0.134.0.txt +7 -1
- package/llms/upgrading-0.37.0-0.53.0.txt +7 -7
- package/llms/upgrading-0.69.0-0.95.0.txt +1 -1
- package/llms/upgrading-0.96.0-0.105.0.txt +1 -1
- package/llms-full.txt +163 -122
- package/llms.txt +8 -8
- package/package.json +1 -1
package/llms/react.txt
CHANGED
|
@@ -15,12 +15,12 @@ Also read:
|
|
|
15
15
|
# Frontend integrations
|
|
16
16
|
|
|
17
17
|
The official `bun create stitchkit` application uses Next.js with a separate
|
|
18
|
-
Bun API.
|
|
18
|
+
Bun API. StitchKit remains a Fetch-native backend and does not own frontend
|
|
19
19
|
routing, SSR or HMR.
|
|
20
20
|
|
|
21
21
|
## Theme boundary in the official starter
|
|
22
22
|
|
|
23
|
-
The generated Next.js application uses `@wrksz/themes`, not a
|
|
23
|
+
The generated Next.js application uses `@wrksz/themes`, not a StitchKit-owned
|
|
24
24
|
theme abstraction. Its root `ThemeProvider` comes from `@wrksz/themes/next` and
|
|
25
25
|
lives directly in the server layout so Next 16 can inject the first-paint script
|
|
26
26
|
through `useServerInsertedHTML`. The default `hybrid` storage reads a cookie
|
|
@@ -60,10 +60,10 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
60
60
|
|
|
61
61
|
## Vite
|
|
62
62
|
|
|
63
|
-
Run Vite and the
|
|
63
|
+
Run Vite and the StitchKit API as separate development processes. Declare one
|
|
64
64
|
proxy for `/api`, `/mcp` and `/socket.io`; browser code still calls the typed
|
|
65
65
|
client with same-origin paths. Production serves the static Vite output from a
|
|
66
|
-
static host or reverse proxy and routes those backend paths to
|
|
66
|
+
static host or reverse proxy and routes those backend paths to StitchKit.
|
|
67
67
|
|
|
68
68
|
Do not duplicate DTOs or handwritten API wrappers in either integration. The
|
|
69
69
|
shared contract remains the only transport schema source.
|
package/llms/server.2.txt
CHANGED
|
@@ -404,7 +404,7 @@ createServer({
|
|
|
404
404
|
`serviceName` and `action` are optional observability identity. Declare
|
|
405
405
|
`serviceName` when audit, logging, sampling or another cross-cutting policy
|
|
406
406
|
groups this raw route with a service; add `action` when the policy needs an
|
|
407
|
-
operation within that service.
|
|
407
|
+
operation within that service. StitchKit never derives either from `path`.
|
|
408
408
|
`action` without `serviceName`, and empty identity strings, fail at startup.
|
|
409
409
|
|
|
410
410
|
A path may be exact, carry `:param` segments, or end in `/*filePath` for a prefix
|
|
@@ -413,7 +413,7 @@ wildcard — and the two combine: `/app/:slug/*filePath` matches `/app/x/a/b` wi
|
|
|
413
413
|
deep-link fallback). List more specific routes before the wildcard — the first
|
|
414
414
|
match wins. `staticRoute()` builds a raw route that serves a directory.
|
|
415
415
|
|
|
416
|
-
At startup
|
|
416
|
+
At startup StitchKit rejects exact duplicates, equivalent parameter shapes
|
|
417
417
|
(`/users/:id` vs `/users/:userId`) and any later raw route completely hidden by
|
|
418
418
|
an earlier raw route. Partial overlap stays legal, including the recommended
|
|
419
419
|
specific-before-wildcard order. `GET` and `HEAD` remain independent because that
|
|
@@ -718,7 +718,7 @@ them.
|
|
|
718
718
|
|
|
719
719
|
For large files, set `delivery: 'stream'` and define receivers. A receiver gets
|
|
720
720
|
a Web `ReadableStream<Uint8Array>` and writes directly to consumer-owned
|
|
721
|
-
storage;
|
|
721
|
+
storage; StitchKit holds only bounded parser state:
|
|
722
722
|
|
|
723
723
|
```ts
|
|
724
724
|
const streamingUploads = defineContract({ prefix: 'uploads' }, {
|
|
@@ -819,12 +819,12 @@ createServer({ services: [users, orders], rawRoutes: [openApiRoute('/openapi.jso
|
|
|
819
819
|
Only HTTP-exposed methods appear (an MCP/agent-only tool is skipped).
|
|
820
820
|
|
|
821
821
|
OpenAPI 3.1 has no standard multi-segment path parameter. For a contract path
|
|
822
|
-
ending in a named wildcard such as `/*filePath`,
|
|
822
|
+
ending in a named wildcard such as `/*filePath`, StitchKit keeps the literal
|
|
823
823
|
runtime path, omits `filePath` from the
|
|
824
824
|
standard `in: path` parameter list, and emits
|
|
825
825
|
`x-stitchkit-trailing-wildcard` on the operation with its parameter name,
|
|
826
826
|
schema and semantics. A generic OpenAPI client therefore cannot invent
|
|
827
|
-
catch-all expansion; use
|
|
827
|
+
catch-all expansion; use StitchKit's typed client or teach the generator that
|
|
828
828
|
extension.
|
|
829
829
|
|
|
830
830
|
### Curating the spec — `includeMethod`
|
|
@@ -995,7 +995,7 @@ try {
|
|
|
995
995
|
```
|
|
996
996
|
|
|
997
997
|
`path` is `'0.v'` and not `'v'` because event arguments are a tuple: index `0`
|
|
998
|
-
is the first payload. The issues are already flattened by
|
|
998
|
+
is the first payload. The issues are already flattened by StitchKit's own
|
|
999
999
|
normaliser, so telling "wrong generation" from "malformed payload" is one
|
|
1000
1000
|
comparison rather than an inspection of a `ZodError`'s internals.
|
|
1001
1001
|
|
|
@@ -1030,7 +1030,7 @@ The client sends it as `auth`, and a rejection reaches `onConnectError` with
|
|
|
1030
1030
|
deployment reads as a half-rolled deployment and not as an access problem.
|
|
1031
1031
|
|
|
1032
1032
|
What that identity *is* remains the application's decision — a build version, a
|
|
1033
|
-
contract hash, a protocol generation.
|
|
1033
|
+
contract hash, a protocol generation. StitchKit does not compare it for you
|
|
1034
1034
|
(→ ADR 0002); it gives the place where the comparison happens before any frame
|
|
1035
1035
|
is interpreted, and it makes the per-frame alternative honest by letting its
|
|
1036
1036
|
refusals be seen.
|
package/llms/server.3.txt
CHANGED
|
@@ -137,7 +137,7 @@ socket.on('note:created', (note) => { /* typed note */ })
|
|
|
137
137
|
socket.emit('room:join', 'general', ({ joined }) => { /* typed + validated */ })
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
When an application already owns the low-level
|
|
140
|
+
When an application already owns the low-level StitchKit transport, bind the
|
|
141
141
|
contract without opening a second connection:
|
|
142
142
|
|
|
143
143
|
```ts
|
|
@@ -303,7 +303,7 @@ classification detects duplicates—those are different policies.
|
|
|
303
303
|
|
|
304
304
|
A server process that owns such a receiver can place `start()` and `close()` in
|
|
305
305
|
an existing `defineManagedResource` and include it in `createApplication`.
|
|
306
|
-
Readiness follows a successful `live` snapshot; shutdown calls `close()`.
|
|
306
|
+
Readiness follows a successful `live` snapshot; shutdown calls `close()`. StitchKit
|
|
307
307
|
does not add another supervisor, reconnect loop or durable event database.
|
|
308
308
|
|
|
309
309
|
When migrating a hand-written receiver, remove only the superseded attach/snapshot
|
|
@@ -374,7 +374,7 @@ closed phase:
|
|
|
374
374
|
|-------|----------------------|
|
|
375
375
|
| `engine-handoff` | Engine.IO created the outbound message packet and accepted it into its write path |
|
|
376
376
|
| `engine-ack-received` | Engine.IO decoded the inbound acknowledgement message, before Socket.IO invokes the acknowledgement callback |
|
|
377
|
-
| `settled` | the acknowledgement callback ran and
|
|
377
|
+
| `settled` | the acknowledgement callback ran and StitchKit finished acknowledgement validation |
|
|
378
378
|
| `timeout` | the existing native acknowledgement timeout won |
|
|
379
379
|
| `disconnected` | the request began disconnected or an in-flight disconnect won |
|
|
380
380
|
|
|
@@ -396,7 +396,7 @@ await socket.request('room:join', 'general', {
|
|
|
396
396
|
|
|
397
397
|
The client-wide hook receives every observed request; a request hook receives
|
|
398
398
|
only its invocation. If the same function is supplied in both places it runs
|
|
399
|
-
once per phase. The closure is local:
|
|
399
|
+
once per phase. The closure is local: StitchKit does not retain `operationId`,
|
|
400
400
|
add it to the event or transmit it to the peer. A request hook works without a
|
|
401
401
|
client-wide hook, and the no-hook path installs no phase listeners.
|
|
402
402
|
|
|
@@ -782,7 +782,7 @@ question: a list takes one of them, and `createEntityCacheHandlers` refuses both
|
|
|
782
782
|
|
|
783
783
|
The helper deliberately does **not** flatten pages, infer filter semantics,
|
|
784
784
|
derive a sort order or replace arbitrary `setQueryData` logic. Those remain
|
|
785
|
-
declared application policies;
|
|
785
|
+
declared application policies; StitchKit applies their generic cache mechanics.
|
|
786
786
|
|
|
787
787
|
## Raw binary lane (Bun)
|
|
788
788
|
|
package/llms/server.4.txt
CHANGED
|
@@ -59,7 +59,7 @@ The framework attaches no meaning to the strings — `'public'`, `'user'`,
|
|
|
59
59
|
## `createAuthHook`
|
|
60
60
|
|
|
61
61
|
`createAuthHook` builds one scope gate that can run in both HTTP and tool
|
|
62
|
-
lifecycles. On HTTP it belongs in `hooks.authorize`:
|
|
62
|
+
lifecycles. On HTTP it belongs in `hooks.authorize`: StitchKit validates path
|
|
63
63
|
params, resolves identity and scope, and rejects `401`/`403` **before reading a
|
|
64
64
|
JSON or multipart body**. On MCP, agent and CLI surfaces it belongs in
|
|
65
65
|
`access.gate.beforeHandle` (`access: { gate: { beforeHandle: authHook } }`),
|
|
@@ -246,7 +246,7 @@ export const implementFor = createScopedImplement<AuthScopes<typeof auth>>()
|
|
|
246
246
|
|
|
247
247
|
Only hooks that declare the selected scope run. An unknown scope fails closed;
|
|
248
248
|
when several hooks own one scope, every owner must pass in declaration order.
|
|
249
|
-
Each owner evaluates on an isolated shadow context.
|
|
249
|
+
Each owner evaluates on an isolated shadow context. StitchKit validates all
|
|
250
250
|
changed fields, rejects reserved/unsafe fields and cross-owner key collisions,
|
|
251
251
|
then commits the combined contribution once. A rejected or cancelled composite
|
|
252
252
|
therefore exposes no partial fields to the handler.
|
|
@@ -497,7 +497,7 @@ complete: async ({ response }) => {
|
|
|
497
497
|
}
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
Append once per cookie;
|
|
500
|
+
Append once per cookie; StitchKit preserves separate `Set-Cookie` fields through
|
|
501
501
|
both Bun and Node. Cookie/session policy remains application logic.
|
|
502
502
|
|
|
503
503
|
## The error model
|
|
@@ -651,7 +651,7 @@ onError: (ctx, err) => {
|
|
|
651
651
|
|
|
652
652
|
## One application vocabulary and one wire map
|
|
653
653
|
|
|
654
|
-
`defineErrors` can also resolve
|
|
654
|
+
`defineErrors` can also resolve StitchKit's framework codes into the same
|
|
655
655
|
application vocabulary. A status fallback is explicit because several
|
|
656
656
|
application codes may legally share one HTTP status:
|
|
657
657
|
|
|
@@ -743,7 +743,7 @@ retained on the returned `AppError`.
|
|
|
743
743
|
HTTP renders the complete code/status/message/details/hint. Tool transports keep
|
|
744
744
|
their established model-facing projection (code/details/hint, without HTTP
|
|
745
745
|
status), while `invokeOrThrow` recovers the exact normalized `AppError`. The
|
|
746
|
-
codes and schemas remain application-owned;
|
|
746
|
+
codes and schemas remain application-owned; StitchKit stays domain-free.
|
|
747
747
|
|
|
748
748
|
### The codes an operation refuses with
|
|
749
749
|
|
|
@@ -830,7 +830,7 @@ stitchkit code you did not list travels as itself. Set `unmappedCode` to one
|
|
|
830
830
|
wire-code when your public vocabulary has a catch-all, or to a function such as
|
|
831
831
|
`(code) => code.startsWith('FILE_') ? 'storage_error' : 'framework_error'` when
|
|
832
832
|
framework code families need different buckets. An explicit `codeMap` entry
|
|
833
|
-
always wins. Codes your project throws itself do not belong to
|
|
833
|
+
always wins. Codes your project throws itself do not belong to StitchKit's
|
|
834
834
|
vocabulary, so they never pass through this fallback and remain unchanged.
|
|
835
835
|
|
|
836
836
|
One `satisfies` is the **opt-in** to the stricter deal:
|
package/llms/server.txt
CHANGED
|
@@ -74,6 +74,14 @@ When an HTTP caller sends a relative remaining budget in `x-stitchkit-timeout-ms
|
|
|
74
74
|
`401`/`403`; an inbound value of `0` then fails immediately with `REQUEST_TIMEOUT` (`408`) before
|
|
75
75
|
payload parsing, `beforeHandle`, or the handler runs. Malformed non-integer values are ignored so
|
|
76
76
|
the endpoint's declared timeout remains authoritative.
|
|
77
|
+
- For a streaming endpoint (`stream: { ... }`), `timeout` and `x-stitchkit-timeout-ms` bound only
|
|
78
|
+
the response-open phase until the handler returns its `AsyncIterable` (matching the client's open
|
|
79
|
+
timeout). Once the stream opens, the open deadline timer is disarmed, `ctx.signal` stays bound to
|
|
80
|
+
client disconnect (`req.signal`), managed shutdown, and `stream.lifetimeMs`, and
|
|
81
|
+
`ctx.remainingTimeoutMs` switches to `stream.lifetimeMs` (or `undefined` when unbounded). The same
|
|
82
|
+
open-phase boundary applies to a `rawResponse: true` endpoint returning a `Response` with a body:
|
|
83
|
+
the open timer is disarmed once the `Response` is returned while `ctx.signal` stays subscribed to
|
|
84
|
+
client disconnect (`req.signal`).
|
|
77
85
|
- Inside the handler, `ctx.remainingTimeoutMs?.(reserveMs?)` returns the live remaining integer
|
|
78
86
|
milliseconds (clamped to `>= 0`, subtracting optional `reserveMs` for response serialization), or
|
|
79
87
|
`undefined` when neither an inbound header nor an endpoint `timeout` bounds the request. Always
|
|
@@ -341,7 +349,7 @@ server. See [Testing & deployment](./testing-and-deployment.md).
|
|
|
341
349
|
| `traceId` | override per-request trace-id resolution — may return `undefined` to fall back |
|
|
342
350
|
| `wrapFetch` | compose wrappers around the finished handler (request context, audit) |
|
|
343
351
|
| `proxyOrigin` | Bun TCP ingress policy: `{ trustedPeer(socketIp) }` restores the external scheme before all composition; independent of client-IP `trustProxy` |
|
|
344
|
-
| `socket` | full
|
|
352
|
+
| `socket` | full StitchKit Socket.IO handle; route, default WebSocket handler and shutdown are mounted once |
|
|
345
353
|
| `websocket` | custom Bun WebSocket handler; with `socket`, this is the explicit composed handler |
|
|
346
354
|
| `development` / `bun` | passthrough to `Bun.serve` |
|
|
347
355
|
|
|
@@ -548,7 +556,7 @@ when forwarding to owned streaming routes; it is also required by native timeout
|
|
|
548
556
|
|
|
549
557
|
### Trusted HTTPS in development
|
|
550
558
|
|
|
551
|
-
|
|
559
|
+
StitchKit does not own local certificate generation or a frontend development
|
|
552
560
|
server. When a device or browser feature requires a secure context, generate a
|
|
553
561
|
trusted certificate outside the application (for example with `mkcert`) and pass
|
|
554
562
|
its files through the Bun server boundary:
|
|
@@ -613,7 +621,7 @@ request-error recorder; an `AbortError` while the request signal is still active
|
|
|
613
621
|
remains an internal failure. A runtime abort reason may be preserved by identity
|
|
614
622
|
through at most eight cycle-safe standard `cause` links; error messages and codes
|
|
615
623
|
are never classifiers. The same rule applies when the disconnect happens while
|
|
616
|
-
|
|
624
|
+
StitchKit is reading a JSON upload body: bounded reads race every pending stream
|
|
617
625
|
read against the request signal and never parse a cancelled partial body. `499`
|
|
618
626
|
is transport telemetry, not a response declared in the contract or generated
|
|
619
627
|
OpenAPI document.
|
|
@@ -815,7 +823,7 @@ That split is deliberate — see [ADR 0003](../decisions/0003-two-context-types.
|
|
|
815
823
|
|
|
816
824
|
## A host beside its own window
|
|
817
825
|
|
|
818
|
-
A desktop app's host — the process beside its window — is an ordinary
|
|
826
|
+
A desktop app's host — the process beside its window — is an ordinary StitchKit server, bound to
|
|
819
827
|
loopback. Calls are plain HTTP through the typed client; events travel the realtime socket with
|
|
820
828
|
`retain` per topic ([realtime](./realtime.md)). There is no second transport to learn.
|
|
821
829
|
|
|
@@ -919,7 +927,7 @@ Trust boundary and operational rules for the unix channel:
|
|
|
919
927
|
container and keep the full UTF-8 path within 103 bytes; TCC permissions remain bound to the host
|
|
920
928
|
process's responsible bundle.
|
|
921
929
|
- **Embedded agents and shell tools.** An unsandboxed agent shell running as the same OS user has full
|
|
922
|
-
access to the socket. Inside
|
|
930
|
+
access to the socket. Inside StitchKit's Linux Bubblewrap sandbox (`stitchkit/agent-runtime/sandbox`),
|
|
923
931
|
the host's `$HOME`, `/tmp`, `/run` and `XDG_RUNTIME_DIR` are not mounted (`--unshare-all --clearenv`),
|
|
924
932
|
so keep the socket outside the agent's mounted `workspace` directory (note that macOS has no
|
|
925
933
|
Bubblewrap isolation).
|
package/llms/stitchkit.2.txt
CHANGED
|
@@ -128,7 +128,7 @@ contract:
|
|
|
128
128
|
Every endpoint callable exposes a `withOptions` method accepting required
|
|
129
129
|
`ClientRequestOptions`. The ordinary callable contains only contract arguments,
|
|
130
130
|
so it can be passed directly to callback APIs such as `react-query-kit` without
|
|
131
|
-
mistaking their callback context for
|
|
131
|
+
mistaking their callback context for StitchKit transport options.
|
|
132
132
|
|
|
133
133
|
**That safety has a cost worth knowing before it bites you.** `api.thing(args,
|
|
134
134
|
{ signal })` — the shape everyone reaches for first — is not an error: the second
|
|
@@ -624,7 +624,7 @@ try {
|
|
|
624
624
|
|
|
625
625
|
`traceId` is present when the server returned `x-request-id`. A network error,
|
|
626
626
|
timeout or abort without an HTTP response cannot carry one. Cross-origin
|
|
627
|
-
browser code can read it through
|
|
627
|
+
browser code can read it through StitchKit's default CORS expose list; a custom
|
|
628
628
|
`cors.exposeHeaders` policy must keep `x-request-id` exposed.
|
|
629
629
|
|
|
630
630
|
The error model is shared with the server — see [Auth & errors](./auth-and-errors.md).
|
|
@@ -717,7 +717,7 @@ if (server === undefined) {
|
|
|
717
717
|
}
|
|
718
718
|
```
|
|
719
719
|
|
|
720
|
-
Both fingerprints arrive as a value; a difference never throws.
|
|
720
|
+
Both fingerprints arrive as a value; a difference never throws. StitchKit
|
|
721
721
|
computes the two identities and compares nothing — what a mismatch means is the
|
|
722
722
|
application's decision. The client's fingerprint is computed locally and is not
|
|
723
723
|
sent to the server. The identity operation is public and lists operation names,
|
package/llms/stitchkit.3.txt
CHANGED
|
@@ -244,7 +244,7 @@ The browser-and-server entrypoint. Re-exports everything from
|
|
|
244
244
|
| `createSocketIOClient` | function | low-level typed Socket.IO transport primitive — [guide](../guide/realtime.md#low-level-transport) |
|
|
245
245
|
| `defineRealtimeContract` | function | Zod-first shared Socket.IO event contract — [guide](../guide/realtime.md#zod-first-event-contract) |
|
|
246
246
|
| `createRealtimeClient` | function | inferred, runtime-validated Socket.IO client — [guide](../guide/realtime.md#client--createrealtimeclient) |
|
|
247
|
-
| `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing
|
|
247
|
+
| `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing StitchKit client transport without owning its lifecycle |
|
|
248
248
|
| `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) |
|
|
249
249
|
| `LiveStateController` | _type_ | renderer-neutral `start` / `resync` / `getSnapshot` / `subscribe` / `close` handle |
|
|
250
250
|
| `LiveStateControllerConfig` | _type_ | typed source, reducer, explicit event/byte bounds, event sizing and isolated error hooks |
|
package/llms/stitchkit.txt
CHANGED
|
@@ -283,8 +283,8 @@ below is the canonical install command.
|
|
|
283
283
|
you import — both for `stitchkit/tools/toolkit`:
|
|
284
284
|
|
|
285
285
|
```bash
|
|
286
|
-
bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp
|
|
287
|
-
bun add ai@^7 # stitchkit/tools/agent or stitchkit/agent-runtime/ai-sdk
|
|
286
|
+
bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp or stitchkit/tools/toolkit
|
|
287
|
+
bun add ai@^7 # stitchkit/tools/agent, stitchkit/tools/toolkit or stitchkit/agent-runtime/ai-sdk
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
Browser, HTTP-client and React entrypoints remain usable without either MCP
|
|
@@ -433,7 +433,7 @@ pauses its socket, and resuming preserves the exact chunked body.
|
|
|
433
433
|
|
|
434
434
|
`UnixClientTransportError` carries a stable `code` and `delivery`:
|
|
435
435
|
`not-dispatched`, `possibly-dispatched` or `response-received`. Only the first
|
|
436
|
-
proves that the remote operation did not begin;
|
|
436
|
+
proves that the remote operation did not begin; StitchKit never silently retries
|
|
437
437
|
an ambiguous write. Response consumption/cancellation belongs to the operation,
|
|
438
438
|
and `close()` interrupts active work and destroys owned connections.
|
|
439
439
|
|
|
@@ -495,7 +495,7 @@ attempt, so the default `2` permits at most three total attempts. The default
|
|
|
495
495
|
|
|
496
496
|
Inside Next.js 16 server rendering, the first attempt still uses Next's normal
|
|
497
497
|
request memoization. If Ky authorizes a retry after a network rejection,
|
|
498
|
-
|
|
498
|
+
StitchKit passes that retry's current `Request.signal` in the second fetch
|
|
499
499
|
argument and materializes the current Request as URL + init. Next 16.3 otherwise
|
|
500
500
|
merges `init` into a Request before its dedupe layer and loses the explicit
|
|
501
501
|
signal opt-out. The retry therefore performs a new network attempt instead of
|
package/llms/telegram.txt
CHANGED
|
@@ -313,7 +313,7 @@ of git.
|
|
|
313
313
|
### Injecting another transport's failure policy
|
|
314
314
|
|
|
315
315
|
`classify(error)` returns the public `TelegramBroadcastFailure` union. It lets
|
|
316
|
-
an application use its own client without adding that SDK to
|
|
316
|
+
an application use its own client without adding that SDK to StitchKit:
|
|
317
317
|
|
|
318
318
|
```ts
|
|
319
319
|
const report = await runTelegramBroadcast({
|
package/llms/testing.txt
CHANGED
|
@@ -340,7 +340,7 @@ of defect stays invisible in development.
|
|
|
340
340
|
|
|
341
341
|
### Shipping one self-contained artifact
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
StitchKit resolves the optional Socket.IO peers through a variable, so a
|
|
344
344
|
consumer bundling an unrelated `stitchkit/server` export never has to resolve
|
|
345
345
|
them. A bundler cannot follow that, which matters if you ship **one file** to a
|
|
346
346
|
machine with no `node_modules`: the package never enters the artifact and the
|
|
@@ -363,7 +363,7 @@ const socket = await createSocketIOServer({
|
|
|
363
363
|
|
|
364
364
|
The packed Next/Webpack gate compiles the browser
|
|
365
365
|
`peers.client: () => import('socket.io-client')` loader and rejects Webpack's
|
|
366
|
-
"request is an expression" warning.
|
|
366
|
+
"request is an expression" warning. StitchKit's runtime fallback remains lazy;
|
|
367
367
|
its emitted import carries a count-checked ignore directive.
|
|
368
368
|
|
|
369
369
|
Omit `peers` and nothing changes: the peers stay lazy and are resolved from the
|
|
@@ -574,7 +574,7 @@ await binding.promise
|
|
|
574
574
|
|
|
575
575
|
The first signal starts exactly one close chain. A same-turn duplicate is
|
|
576
576
|
ignored; a later signal restores the default OS disposition because the
|
|
577
|
-
official stdio close is not abortable and
|
|
577
|
+
official stdio close is not abortable and StitchKit will not pretend otherwise.
|
|
578
578
|
`binding.close()` removes idle listeners and resolves the promise with
|
|
579
579
|
`undefined`. No listener is installed until the binder is called, and the
|
|
580
580
|
framework never calls `process.exit()`.
|
|
@@ -637,7 +637,7 @@ stitchkit serves the API. A SPA front-end is built and hosted separately — a
|
|
|
637
637
|
static host or CDN in production, its own dev server in development. The backend
|
|
638
638
|
does not serve static files (`staticRoute` exists for the occasional asset, not
|
|
639
639
|
a whole app). `bun create stitchkit my-app` demonstrates the supported split:
|
|
640
|
-
an independently built Next.js frontend and Bun/
|
|
640
|
+
an independently built Next.js frontend and Bun/StitchKit API.
|
|
641
641
|
|
|
642
642
|
### MCP
|
|
643
643
|
|
|
@@ -27,7 +27,7 @@ and approval path.
|
|
|
27
27
|
| `ConnectionPhase` / `ConnectionOperation` / `ConnectionFailureContext` | _type_ | closed operation/phase vocabulary and measured read context for existing typed connection errors |
|
|
28
28
|
| `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 |
|
|
29
29
|
| `ConnectionDeadline` / `ConnectionTimeoutContext` | _type_ | `'total' \| 'idle'`, and a timeout's diagnostics with the deadline that fired (default `'total'`) |
|
|
30
|
-
| `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
|
|
30
|
+
| `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 |
|
|
31
31
|
| `defineOpenApiConnection` | function | declare one OpenAPI document (object, JSON text or JSON URL) as a tool surface |
|
|
32
32
|
| `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) |
|
|
33
33
|
| `ConnectionAuthorizationRequiredError` | class | typed reauthorization signal raised on `401` with credentials resolved again on the next call |
|
package/llms/tools-toolkit.txt
CHANGED
|
@@ -15,7 +15,9 @@ Also read:
|
|
|
15
15
|
## `stitchkit/tools/toolkit`
|
|
16
16
|
|
|
17
17
|
Server-only. One context-typed tool set served over MCP and to an AI SDK agent, so it
|
|
18
|
-
|
|
18
|
+
deliberately requires both the `@modelcontextprotocol/server` and `ai` peers. Applications
|
|
19
|
+
that drop `ai` (or install neither peer) should import directly from `stitchkit/tools/mcp`,
|
|
20
|
+
`stitchkit/tools`, or `stitchkit/cli` instead of `stitchkit/tools/toolkit`. → ADR 0284.
|
|
19
21
|
|
|
20
22
|
| Export | Kind | Summary |
|
|
21
23
|
|--------|------|---------|
|
package/llms/tools.2.txt
CHANGED
|
@@ -117,7 +117,7 @@ load balancing therefore cannot strand a client on an in-memory session.
|
|
|
117
117
|
The default `legacy: 'serve'` lets the official SDK negotiate either modern
|
|
118
118
|
`2026-07-28` or the supported legacy stateless opening on this same endpoint.
|
|
119
119
|
Set `legacy: 'reject'` when every host is modern. Legacy support is protocol
|
|
120
|
-
translation inside the SDK, not a second
|
|
120
|
+
translation inside the SDK, not a second StitchKit transport or compatibility
|
|
121
121
|
API. Stateful MCP and subscriptions are intentionally outside this layer.
|
|
122
122
|
|
|
123
123
|
`createMcpHttpRoute` is the framework-owned raw-route adapter. It registers
|
|
@@ -136,7 +136,7 @@ must not be used as authorization input.
|
|
|
136
136
|
|
|
137
137
|
### Modern discovery, routing and cache hints
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
StitchKit forwards the negotiated protocol era and validated MCP request data
|
|
140
140
|
to both `RequestEvent.mcp` and the current managed call's typed `context.mcp`;
|
|
141
141
|
untrusted routing headers never become application identity. The SDK validates
|
|
142
142
|
`MCP-Protocol-Version`, JSON-RPC shape and routing
|
|
@@ -151,7 +151,7 @@ means zero/private: neither a prepared surface nor a deterministic response is
|
|
|
151
151
|
silently treated as public. Unbounded auth-selected surface factories are
|
|
152
152
|
always forced to zero/private even when an operation policy is present; use a
|
|
153
153
|
finite `surfaces` registry when identities share a provably immutable surface.
|
|
154
|
-
|
|
154
|
+
StitchKit never advertises list-change or subscription capabilities
|
|
155
155
|
without an implementation.
|
|
156
156
|
|
|
157
157
|
### Knowing your catalog is stale — the catalog stamp
|
|
@@ -481,7 +481,7 @@ expiry-checked. Tampered, expired, cross-user or cross-tool state fails before
|
|
|
481
481
|
the side effect. Output validation applies only to the final result.
|
|
482
482
|
|
|
483
483
|
Every attempt re-runs auth/lifecycle and emits its own tool hooks; audit metadata
|
|
484
|
-
contains the attempt's `mcp.outcome` and `mcp.round`.
|
|
484
|
+
contains the attempt's `mcp.outcome` and `mcp.round`. StitchKit does not merge
|
|
485
485
|
separate HTTP attempts into one logical trace. Parallel
|
|
486
486
|
rounds have isolated context. HTTP/stdio modern hosts and the supported legacy
|
|
487
487
|
stdio bridge may use this declaration; Agent, CLI and ordinary HTTP invocation
|
|
@@ -733,7 +733,7 @@ It is **deep** because the projection walks the generated JSON Schema document,
|
|
|
733
733
|
including objects, arrays, tuples and schema-definition nodes. Structurally
|
|
734
734
|
identifiable discriminated object unions are flattened wherever they occur.
|
|
735
735
|
Plain unions and unions hidden behind unresolved external references remain
|
|
736
|
-
unions because
|
|
736
|
+
unions because StitchKit cannot soundly invent a discriminator.
|
|
737
737
|
|
|
738
738
|
Use the default `flattenUnionInput: false` when the model must see the exact
|
|
739
739
|
relationship between a discriminator and each branch. Joined property schemas
|
|
@@ -743,7 +743,7 @@ The flattened form is **lossy but never executable**. Per-variant refinements
|
|
|
743
743
|
and incompatible constraints are widened in the presentation document; the
|
|
744
744
|
original Zod contract enforces them exactly once inside `executeToolMethod`.
|
|
745
745
|
MCP and AI adapters forward the raw argument object unchanged, so defaults,
|
|
746
|
-
coercions and transforms cannot run before
|
|
746
|
+
coercions and transforms cannot run before StitchKit. Strict violations return
|
|
747
747
|
the normal `VALIDATION_ERROR` tool envelope and fire `beforeToolCall` /
|
|
748
748
|
`afterToolCall`. → [ADR 0050](../decisions/0050-presentation-schema-is-not-a-parser.md).
|
|
749
749
|
|
package/llms/tools.3.txt
CHANGED
|
@@ -188,7 +188,7 @@ a deadline the remote client hit (`REQUEST_TIMEOUT`, `408`) follows the status l
|
|
|
188
188
|
When a contract endpoint or runtime tool declares `output`, its MCP tool
|
|
189
189
|
registers that exact schema as `outputSchema` and returns the validated value as
|
|
190
190
|
`structuredContent` alongside a JSON text block. Every JSON root type is kept
|
|
191
|
-
unchanged: object, array, string, number, boolean and `null`.
|
|
191
|
+
unchanged: object, array, string, number, boolean and `null`. StitchKit does not
|
|
192
192
|
wrap non-object values in `{ result }`; protocol-era adaptation belongs to the
|
|
193
193
|
official SDK.
|
|
194
194
|
|
|
@@ -283,7 +283,7 @@ removes keys on purpose and is not reported. → [ADR 0196](../decisions/0196-a-
|
|
|
283
283
|
## AI agents — `mountAgent`
|
|
284
284
|
|
|
285
285
|
`mountAgent` remains the low-level path when the application owns its own model
|
|
286
|
-
loop and conversation state. For the optional
|
|
286
|
+
loop and conversation state. For the optional StitchKit-owned run/history loop,
|
|
287
287
|
see [Agent application runtime](./agent-runtime.md).
|
|
288
288
|
|
|
289
289
|
`mountAgent` turns a service into a Vercel AI SDK `ToolSet`, ready for
|
|
@@ -465,7 +465,7 @@ hook/lifecycle `OperationIdentity` and the tool `RequestEvent`
|
|
|
465
465
|
(`serviceName`, `action`, `httpMethod`). A runtime operation has no HTTP route,
|
|
466
466
|
so no fake `path` is added.
|
|
467
467
|
|
|
468
|
-
When `output` is declared,
|
|
468
|
+
When `output` is declared, StitchKit validates the neutral handler result after
|
|
469
469
|
`afterHandle`. MCP owns `structuredContent` and `isError`: a presenter supplies
|
|
470
470
|
only rich `content`/metadata, while the framework inserts the validated
|
|
471
471
|
structured result and normalises failures. The Agent adapter uses the AI SDK's
|
|
@@ -474,7 +474,7 @@ neutral output while the model receives text/file content. Presentation
|
|
|
474
474
|
callbacks require an output schema.
|
|
475
475
|
|
|
476
476
|
The MCP registration uses an identity carrier: the SDK advertises the compiled
|
|
477
|
-
JSON Schema but forwards the raw object into
|
|
477
|
+
JSON Schema but forwards the raw object into StitchKit. Input failures therefore
|
|
478
478
|
use the same validation, lifecycle and hook path as contract tools.
|
|
479
479
|
|
|
480
480
|
### Managed wait, download, upload and view-file
|
|
@@ -585,7 +585,7 @@ batch operation.
|
|
|
585
585
|
### Async-operation protocol
|
|
586
586
|
|
|
587
587
|
For a complete long-running operation, define the linked runtime-only surface
|
|
588
|
-
once.
|
|
588
|
+
once. StitchKit owns transport names, validation and wait mechanics; the
|
|
589
589
|
application still owns storage, execution, retries and domain states:
|
|
590
590
|
|
|
591
591
|
```ts
|
|
@@ -649,7 +649,7 @@ prevents a stale run owner from crossing an effect boundary; the transactional
|
|
|
649
649
|
idempotency record makes a repeated current call converge on one operation.
|
|
650
650
|
Neither replaces the other.
|
|
651
651
|
|
|
652
|
-
|
|
652
|
+
StitchKit deliberately does **not** own the durable queue, operation database,
|
|
653
653
|
lease renewal, provider retry/reconciliation protocol, asset catalog or domain
|
|
654
654
|
states. The process-local application resource stops admission and drains
|
|
655
655
|
accepted work; unresolved durable records survive shutdown for the next
|
|
@@ -780,7 +780,7 @@ operations whose contract intentionally differs.
|
|
|
780
780
|
Deferred tool search, name snapshots and boot diagnostics accept the same
|
|
781
781
|
object-shaped surface as the mounts. Contract operations are followed by
|
|
782
782
|
runtime definitions, matching mount order; exposure filters and collisions are
|
|
783
|
-
resolved by
|
|
783
|
+
resolved by StitchKit rather than by consumer code:
|
|
784
784
|
|
|
785
785
|
```ts
|
|
786
786
|
import {
|
|
@@ -807,7 +807,7 @@ fails first on duplicate contract/runtime names. There is no runtime-only
|
|
|
807
807
|
manifest helper or public mount adapter: the framework owns merging and schema
|
|
808
808
|
projection.
|
|
809
809
|
|
|
810
|
-
Applications using
|
|
810
|
+
Applications using StitchKit's durable runtime can compose this manifest with
|
|
811
811
|
bounded per-run activation through `createDeferredAgentToolSurface` from
|
|
812
812
|
`stitchkit/agent-runtime`. It keeps selected calls as direct `mountAgent` tools
|
|
813
813
|
rather than routing them through a generic executor. Search receipts live in
|
|
@@ -514,7 +514,7 @@ succeeds, its result stays on stdout, stderr names the refusal and the exit is n
|
|
|
514
514
|
A JS bundle uses `delivery: 'companion'`; every shape is in the [native I/O guide](./native-io.md). Search pattern:
|
|
515
515
|
`createCli` with a `download` option in a project that runs `bun build` for macOS.
|
|
516
516
|
2. On Windows, run the download through Linux or macOS, or read the URLs from the operation's
|
|
517
|
-
JSON result and fetch them yourself.
|
|
517
|
+
JSON result and fetch them yourself. StitchKit offers no weaker path on that platform.
|
|
518
518
|
3. A download now replaces a file rather than rewriting it. Give the process write permission on
|
|
519
519
|
the output directory, and do not point it at a bind-mounted file: that refuses with `EBUSY`. A
|
|
520
520
|
replaced file belongs to the process user, and a read-only file is replaced like any other.
|
|
@@ -63,7 +63,13 @@ const runtime = createAgentRuntime({
|
|
|
63
63
|
- `anthropicProvider` from `stitchkit/agent-runtime/anthropic`
|
|
64
64
|
2. Replace `fromAiSdkTools(mountAgent(...))` with `mountAgentTools(...)` from `stitchkit/tools`, and replace custom AI SDK `tool(...)` declarations with `defineAgentTool(...)` from `stitchkit/tools`.
|
|
65
65
|
3. Replace direct `generateText` / `generateObject` helper calls with `completeText` / `completeObject` from `stitchkit/agent-runtime`, and replace `wrapLanguageModel` middleware with `wrapModelDriver` / `composeModelDrivers`.
|
|
66
|
-
4.
|
|
66
|
+
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`:
|
|
67
|
+
- `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"`).
|
|
68
|
+
- If you used `createToolkit<AppContext>()` without AI SDK `mountAgent`, replace it with the narrow entrypoints directly:
|
|
69
|
+
- 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 => ({ ... })`).
|
|
70
|
+
- Peer-free agent tools (`mountAgentTools`, `defineAgentTool`) → import from `stitchkit/tools` (zero optional peers).
|
|
71
|
+
- CLI (`createCli`, `createCliInvoker`) → import from `stitchkit/cli` (zero optional peers; annotate `context: (auth): AppContext => ({ ... })`).
|
|
72
|
+
- 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`.
|
|
67
73
|
|
|
68
74
|
```ts
|
|
69
75
|
// After (Step 2: completely peer-free)
|
|
@@ -190,7 +190,7 @@ runtime callback arguments; only `.withOptions` reads `ClientRequestOptions`.
|
|
|
190
190
|
### HTTP auth moves to the pre-body `authorize` phase
|
|
191
191
|
|
|
192
192
|
Move the HTTP wiring of `createAuthHook` from `beforeHandle` to `authorize`.
|
|
193
|
-
This lets
|
|
193
|
+
This lets StitchKit reject an unauthorized JSON or multipart request after path
|
|
194
194
|
parameter validation but before reading a body chunk. Keep application
|
|
195
195
|
preconditions that depend on validated input in `beforeHandle`.
|
|
196
196
|
|
|
@@ -321,7 +321,7 @@ collected tool logs from stdout.
|
|
|
321
321
|
|
|
322
322
|
### MCP TypeScript SDK v2 and protocol `2026-07-28`
|
|
323
323
|
|
|
324
|
-
This is a hard cut: there is one
|
|
324
|
+
This is a hard cut: there is one StitchKit API and no v1 aliases. Applications
|
|
325
325
|
that expose MCP install the split server package; applications that implement an
|
|
326
326
|
MCP host or run client E2E install the split client package.
|
|
327
327
|
|
|
@@ -397,7 +397,7 @@ modern-only. This is not a stateful compatibility transport.
|
|
|
397
397
|
|
|
398
398
|
#### Output shape depends on the negotiated protocol era
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
StitchKit always validates the handler result against the declared output
|
|
401
401
|
schema. The negotiated MCP era determines only its wire representation:
|
|
402
402
|
|
|
403
403
|
| Negotiated era | Non-object `structuredContent` |
|
|
@@ -462,7 +462,7 @@ mountOAuthProvider({
|
|
|
462
462
|
A URL client id must be HTTPS and serve a document whose `client_id` exactly
|
|
463
463
|
matches that URL, with explicit `redirect_uris` and
|
|
464
464
|
`token_endpoint_auth_method: 'none'`. Do not keep a consumer-side metadata
|
|
465
|
-
fetcher or DCR fallback;
|
|
465
|
+
fetcher or DCR fallback; StitchKit owns SSRF-safe resolution and caching.
|
|
466
466
|
|
|
467
467
|
Multi-round input is opt-in on the operation and does not change Agent, CLI or
|
|
468
468
|
ordinary HTTP handlers:
|
|
@@ -582,7 +582,7 @@ summarizeTransports(surface)
|
|
|
582
582
|
`ToolNameEntry` adds `kind: 'contract' | 'runtime'`. `TransportSummary` is now
|
|
583
583
|
`{ contractServices, runtimeTools, totals, sources }`; replace `services` and
|
|
584
584
|
`perService` reads with the explicit counts and mixed-source breakdown. There
|
|
585
|
-
is no positional overload and no `buildRuntimeToolManifest`:
|
|
585
|
+
is no positional overload and no `buildRuntimeToolManifest`: StitchKit owns the
|
|
586
586
|
combined order, transport filtering, canonical presentation schema and
|
|
587
587
|
cross-origin collision checks.
|
|
588
588
|
|
|
@@ -650,7 +650,7 @@ createMcpHandler({
|
|
|
650
650
|
```
|
|
651
651
|
|
|
652
652
|
Keep direct `services(auth)` / `runtimeTools(auth)` only for genuinely
|
|
653
|
-
unbounded definitions;
|
|
653
|
+
unbounded definitions; StitchKit intentionally does not cache arbitrary auth
|
|
654
654
|
values.
|
|
655
655
|
|
|
656
656
|
Contract success bodies are now determined by the presence of `output`, not by
|
|
@@ -823,7 +823,7 @@ mountable.argumentSchema // executable CLI argument adapter only
|
|
|
823
823
|
|
|
824
824
|
Contract and native handlers keep their original Zod schemas; MCP and agent SDK
|
|
825
825
|
adapters now forward raw arguments so defaults, coercions, refinements and
|
|
826
|
-
transforms execute exactly once inside
|
|
826
|
+
transforms execute exactly once inside StitchKit. There are no compatibility
|
|
827
827
|
exports for `flattenDiscriminatedUnion`, `flattenUnionsDeep` or
|
|
828
828
|
`MountableTool.schema`. → ADR 0050
|
|
829
829
|
|
|
@@ -403,7 +403,7 @@ If you operate a built-in SQLite store file:
|
|
|
403
403
|
|
|
404
404
|
1. Back the file up. The first open by 0.86.0 migrates it to schema 2 in one
|
|
405
405
|
transaction and there is no way back: a 0.85.x package refuses a migrated
|
|
406
|
-
file with `Unsupported
|
|
406
|
+
file with `Unsupported StitchKit agent-runtime SQLite schema version 2`.
|
|
407
407
|
2. Check the build for FTS5 before deploying:
|
|
408
408
|
|
|
409
409
|
```sql
|
|
@@ -91,7 +91,7 @@ pipes drain.
|
|
|
91
91
|
read `asset.sourcePath`, hash the addon themselves, switch over the refusal `state`/`code`, pass a
|
|
92
92
|
`platform` other than the literal `'darwin'`, or parse `node_modules/stitchkit/native-assets.json`.
|
|
93
93
|
|
|
94
|
-
The package now publishes the `size` and SHA256 of each Darwin addon, computed when
|
|
94
|
+
The package now publishes the `size` and SHA256 of each Darwin addon, computed when StitchKit is
|
|
95
95
|
built, in `native-assets.json` at `formatVersion: 2`. `createNativePackaging` reads each selected
|
|
96
96
|
addon once, compares it with that digest and returns the verified bytes. An installed addon that
|
|
97
97
|
differs refuses with `NATIVE_ASSET_DIGEST_MISMATCH`.
|