stitchkit 0.110.6 → 0.111.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/agent-runtime/sandbox-broker.d.ts.map +1 -1
- package/dist/application/grammy-update-admission.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +3 -2
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/contract/runtime-context.d.ts +3 -1
- package/dist/contract/runtime-context.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/sandbox.js +13 -27
- package/dist/entrypoints/application/grammy.js +11 -2
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +123 -29
- package/dist/entrypoints/cli/publish.js +1 -1
- package/dist/entrypoints/cli.js +2 -2
- package/dist/entrypoints/http.d.ts +2 -0
- package/dist/entrypoints/http.d.ts.map +1 -1
- package/dist/entrypoints/http.js +5 -1
- package/dist/entrypoints/index.d.ts +1 -0
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +5 -1
- package/dist/entrypoints/node.d.ts +1 -0
- package/dist/entrypoints/node.d.ts.map +1 -1
- package/dist/entrypoints/node.js +3 -1
- package/dist/entrypoints/observability.js +24 -9
- package/dist/entrypoints/remote.js +1 -1
- package/dist/entrypoints/server.d.ts +1 -0
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +24 -3
- package/dist/entrypoints/telegram.js +3 -3
- package/dist/entrypoints/testing.js +1 -1
- package/dist/entrypoints/tools/connections.js +16 -31
- package/dist/entrypoints/tools/mcp.js +1 -1
- package/dist/entrypoints/tools.js +40 -8
- package/dist/entrypoints/voice.js +17 -10
- package/dist/{index-s6d8zsha.js → index-2qymcsq2.js} +66 -121
- package/dist/index-5efrpfmj.js +55 -0
- package/dist/{index-s2eybn7b.js → index-c5374vpt.js} +10 -9
- package/dist/{index-jk44mbqb.js → index-c5at3ykd.js} +3 -57
- package/dist/index-cjbn98zt.js +68 -0
- package/dist/{index-3h0ztg0z.js → index-cxpcdswt.js} +5 -21
- package/dist/{index-s0xbnpfh.js → index-erv5shjq.js} +1 -1
- package/dist/{index-n7hrpngg.js → index-v2eyj2ws.js} +1 -1
- package/dist/internal/bounded-body.d.ts +44 -0
- package/dist/internal/bounded-body.d.ts.map +1 -0
- package/dist/internal/bounded-lines.d.ts +1 -2
- package/dist/internal/bounded-lines.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/stream-chunks.d.ts +13 -0
- package/dist/internal/stream-chunks.d.ts.map +1 -0
- package/dist/internal/upgrade-affects.d.ts +5 -0
- package/dist/internal/upgrade-affects.d.ts.map +1 -1
- package/dist/internal/upgrade-plan.d.ts +18 -3
- package/dist/internal/upgrade-plan.d.ts.map +1 -1
- package/dist/internal/upgrade-usage.d.ts +21 -5
- package/dist/internal/upgrade-usage.d.ts.map +1 -1
- package/dist/observability/audit.d.ts +10 -0
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/event.d.ts +5 -0
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/endpoints.d.ts.map +1 -1
- package/dist/server/oauth/provider.d.ts +5 -0
- package/dist/server/oauth/provider.d.ts.map +1 -1
- package/dist/server/raw.d.ts +6 -3
- package/dist/server/raw.d.ts.map +1 -1
- package/dist/server/request-body.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts.map +1 -1
- package/dist/server/request-ingress.d.ts +31 -0
- package/dist/server/request-ingress.d.ts.map +1 -0
- package/dist/server/unix-client-body.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/voice/speech-queue.d.ts +6 -1
- package/dist/voice/speech-queue.d.ts.map +1 -1
- package/llms/http.txt +3 -0
- package/llms/observability.txt +19 -2
- package/llms/server.2.txt +4 -0
- package/llms/server.5.txt +2 -1
- package/llms/server.txt +42 -0
- package/llms/stitchkit.2.txt +28 -0
- package/llms/stitchkit.txt +3 -3
- package/llms/tools.3.txt +1 -1
- package/llms/tools.txt +4 -0
- package/llms/{upgrading-0.101.0-0.110.0.txt → upgrading-0.101.0-0.111.0.txt} +29 -3
- package/llms/upgrading.txt +8 -2
- package/llms-full.txt +136 -8
- package/llms.txt +6 -6
- package/package.json +1 -1
package/llms/tools.3.txt
CHANGED
|
@@ -196,7 +196,7 @@ A native remote-connector auth surface for MCP — [guide](../guide/mcp-and-agen
|
|
|
196
196
|
| `protectedResourceMetadataUrl` | function | build the metadata URL for a resource |
|
|
197
197
|
| `wwwAuthenticateHeader` | function | build the `WWW-Authenticate` challenge header |
|
|
198
198
|
| `PROTECTED_RESOURCE_PATH` | const | the well-known metadata path |
|
|
199
|
-
| `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider` |
|
|
199
|
+
| `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider`; `maxRequestBodyBytes` bounds the `/token` and `/register` bodies (64 KiB by default) |
|
|
200
200
|
| `ProtectedResourceConfig` | _type_ | config for `oauthProtectedResourceRoute` |
|
|
201
201
|
| `ApplicationType` | _type_ | DCR `application_type` — `'native'` (loopback allowed) \| `'web'` (https only) |
|
|
202
202
|
| `AuthCodeData` | _type_ | a stored authorization-code record |
|
package/llms/tools.txt
CHANGED
|
@@ -926,6 +926,10 @@ default; DCR is off unless `clientRegistration.dcr` supplies both `register` and
|
|
|
926
926
|
exactly equals its URL, explicit redirect URIs and
|
|
927
927
|
`token_endpoint_auth_method: 'none'`.
|
|
928
928
|
|
|
929
|
+
The token endpoint and `/register` read at most 64 KiB of a request body, or
|
|
930
|
+
`maxRequestBodyBytes` when you set it; a larger one is answered `413` with
|
|
931
|
+
`invalid_request` and the rest is not read.
|
|
932
|
+
|
|
929
933
|
The production fetcher rejects credentials, fragments, non-HTTPS URLs and
|
|
930
934
|
private/reserved targets. Every redirect is DNS-resolved and IP-pinned again;
|
|
931
935
|
timeouts, redirect count and body size are bounded. Its bounded cache respects
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
# Upgrading 0.101.0 → 0.
|
|
1
|
+
# Upgrading 0.101.0 → 0.111.0 — stitchkit docs slice
|
|
2
2
|
|
|
3
3
|
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
4
|
> `llms.txt` in this package.
|
|
5
5
|
|
|
6
|
-
Contains: Guide: Upgrading, 0.101.0 → 0.
|
|
6
|
+
Contains: Guide: Upgrading, 0.101.0 → 0.111.0 (docs/guide/upgrading.md)
|
|
7
7
|
|
|
8
8
|
==============================================================================
|
|
9
|
-
# Guide: Upgrading, 0.101.0 → 0.
|
|
9
|
+
# Guide: Upgrading, 0.101.0 → 0.111.0 (docs/guide/upgrading.md)
|
|
10
10
|
==============================================================================
|
|
11
11
|
|
|
12
|
+
## Released migration: 0.111.0
|
|
13
|
+
|
|
14
|
+
**Who must act:** applications whose raw routes call `parseBody` on JSON larger than 1 MiB, and applications whose OAuth clients send `/register` or `/token` bodies larger than 64 KiB.
|
|
15
|
+
|
|
16
|
+
### Bounded raw and OAuth bodies
|
|
17
|
+
|
|
18
|
+
`parseBody` reads at most 1 MiB and returns `null` for a larger body, where it used to read any size. A route that takes larger JSON states its limit:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// before
|
|
22
|
+
const body = await parseBody(req, Schema)
|
|
23
|
+
// after
|
|
24
|
+
const body = await parseBody(req, Schema, { maxBytes: 8 * 1024 * 1024 })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`mountOAuthProvider` reads at most 64 KiB of a `/token` or `/register` body and answers `413` with `invalid_request` for a larger one. A deployment whose clients register larger metadata raises the limit:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// before
|
|
31
|
+
mountOAuthProvider({ issuer, signingSecret, resource, codes, authorizeUser })
|
|
32
|
+
// after
|
|
33
|
+
mountOAuthProvider({ issuer, signingSecret, resource, codes, authorizeUser, maxRequestBodyBytes: 256 * 1024 })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Both limits must be a positive safe integer; anything else is refused when the route is built or called.
|
|
37
|
+
|
|
12
38
|
## Released migration: 0.110.0
|
|
13
39
|
|
|
14
40
|
### Interrupted process drains
|
package/llms/upgrading.txt
CHANGED
|
@@ -11,7 +11,7 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
|
|
|
11
11
|
|
|
12
12
|
Load this slice, then every range slice between your installed version and the target:
|
|
13
13
|
|
|
14
|
-
- 0.101.0 → 0.
|
|
14
|
+
- 0.101.0 → 0.111.0: `llms/upgrading-0.101.0-0.111.0.txt`
|
|
15
15
|
- 0.74.0 → 0.100.0: `llms/upgrading-0.74.0-0.100.0.txt`
|
|
16
16
|
- 0.61.0 → 0.73.0: `llms/upgrading-0.61.0-0.73.0.txt`
|
|
17
17
|
- 0.44.0 → 0.60.0: `llms/upgrading-0.44.0-0.60.0.txt`
|
|
@@ -36,7 +36,7 @@ Run it inside the project that depends on stitchkit. It reads your installed
|
|
|
36
36
|
version out of `node_modules`, reads the changelog **shipped inside the
|
|
37
37
|
package**, and prints every breaking section your range crosses, oldest first,
|
|
38
38
|
each with its **Who must act** line — the list this guide's migrations expand
|
|
39
|
-
on. Nothing to clone, nothing to be told: `--from` / `--to` override either end
|
|
39
|
+
on — and then the fixes of that range that name what they touch. Nothing to clone, nothing to be told: `--from` / `--to` override either end
|
|
40
40
|
of the range if you want a different one.
|
|
41
41
|
|
|
42
42
|
So upgrading is: read the `### ⚠️ Breaking changes` of every version *above* your
|
|
@@ -67,6 +67,12 @@ beside a `package.json`, which is build output) and gives each item one verdict:
|
|
|
67
67
|
- **not declared — check by hand** — an item from before the line existed, with the files that
|
|
68
68
|
import the entrypoints it leads with.
|
|
69
69
|
|
|
70
|
+
A fix that names what it touches gets the same verdicts. Since 0.110.7 every `### Fixed` item that
|
|
71
|
+
leads with an entrypoint carries the `**Affects:**` line, and `upgrade` prints them in a second
|
|
72
|
+
section, **Fixes that touch this project** (`fixes` in `--json`): a fix to `runNativeCommand` is
|
|
73
|
+
listed with the `path:line` that imports it, or as *not used here*. Fixes of earlier releases that
|
|
74
|
+
carry no line are not judged; one line counts them (`fixesWithoutAffects` in `--json`).
|
|
75
|
+
|
|
70
76
|
`--json` prints the same verdicts per item for a CI step. The scan reads static `import` and
|
|
71
77
|
`export … from` declarations, bare imports and `import()` / `require()` of a literal specifier; a
|
|
72
78
|
specifier built at run time is invisible to it, and so is a file of another kind (`.astro`,
|
package/llms-full.txt
CHANGED
|
@@ -77,12 +77,12 @@ own, recorded as an ADR.
|
|
|
77
77
|
| `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
|
|
78
78
|
| `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
|
|
79
79
|
| `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
|
|
80
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the
|
|
80
|
+
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the 56 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
|
|
81
81
|
| `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
|
|
82
82
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
83
83
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
84
84
|
| `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
|
|
85
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 23 of the
|
|
85
|
+
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 23 of the 56 minors since 0.56.2, most recently 0.105.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
86
86
|
| `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
|
|
87
87
|
| `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
|
|
88
88
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
@@ -94,7 +94,7 @@ own, recorded as an ADR.
|
|
|
94
94
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
95
95
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
96
96
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
97
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the
|
|
97
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 56 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
98
98
|
| `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
|
|
99
99
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
100
100
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -1162,6 +1162,48 @@ Every handler receives one `ctx` argument:
|
|
|
1162
1162
|
The same handler runs for HTTP, MCP and agent calls — `ctx.source` tells you
|
|
1163
1163
|
which. Anything an auth hook attaches (e.g. the resolved user) is also on `ctx`.
|
|
1164
1164
|
|
|
1165
|
+
### Request attributes from the ingress
|
|
1166
|
+
|
|
1167
|
+
When your own code builds the `Request` — a local socket ingress, a relay, a test harness —
|
|
1168
|
+
and calls the fetch handler of the core, it often knows something an endpoint needs and the
|
|
1169
|
+
request cannot be allowed to say for itself: which authenticated peer sent it. A header can be
|
|
1170
|
+
forged by any client. `defineRequestIngress` is the channel the request cannot carry:
|
|
1171
|
+
|
|
1172
|
+
```ts
|
|
1173
|
+
import { createHandler, defineRequestIngress, implement } from 'stitchkit/server'
|
|
1174
|
+
|
|
1175
|
+
interface Peer {
|
|
1176
|
+
node: string
|
|
1177
|
+
}
|
|
1178
|
+
export const peer = defineRequestIngress<Peer>('peer')
|
|
1179
|
+
|
|
1180
|
+
// The ingress, after it has authenticated the peer and built the request:
|
|
1181
|
+
peer.attach(request, { node: 'node-7' })
|
|
1182
|
+
const response = await handler(request)
|
|
1183
|
+
|
|
1184
|
+
// An endpoint, `authorize`, `beforeHandle` or `onError` — `ctx` is the source:
|
|
1185
|
+
implement(contract, {
|
|
1186
|
+
place: (ctx) => ({ node: peer.from(ctx)?.node ?? null }),
|
|
1187
|
+
})
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
- The value belongs to the key. A header, a body, `request.clone()` and `new Request(request)`
|
|
1191
|
+
carry nothing; a request from another ingress has no value, and `from` answers `undefined`.
|
|
1192
|
+
Two keys never meet, even under one name, and a second `attach` of the same key to the same
|
|
1193
|
+
request is an error.
|
|
1194
|
+
- `ctx.req` is the `Request` the fetch handler of the core received, on every HTTP context: an
|
|
1195
|
+
endpoint, `authorize`, `beforeHandle`, and the `onError` context of a validation failure, an
|
|
1196
|
+
unknown path, a refused method or an `onRequest` that threw. That is the guarantee the lookup
|
|
1197
|
+
stands on, and the ingress tests hold it.
|
|
1198
|
+
- A raw route, `streamingRoute` and `onRequest` receive the request without a context: read with
|
|
1199
|
+
`peer.from({ req })`. The MCP, agent and CLI lanes carry no `Request`, so there is nothing to
|
|
1200
|
+
read.
|
|
1201
|
+
- With `proxyOrigin` configured, the request is replaced before `wrapFetch`: attach in
|
|
1202
|
+
`wrapFetch` or later, to the request you are handed.
|
|
1203
|
+
- A Socket.IO handshake is routed before `wrapFetch` on Bun and rebuilt as a new `Request` on
|
|
1204
|
+
Node: it never carries an attached value.
|
|
1205
|
+
- `stitchkit/node` exports the same names.
|
|
1206
|
+
|
|
1165
1207
|
### `createImplement` — a fixed context type
|
|
1166
1208
|
|
|
1167
1209
|
To type `ctx` with your app's extras (the user an auth hook injects), fix the
|
|
@@ -2087,6 +2129,10 @@ handler: async (req) => {
|
|
|
2087
2129
|
}
|
|
2088
2130
|
```
|
|
2089
2131
|
|
|
2132
|
+
`parseBody` reads the body up to `{ maxBytes }` — 1 MiB when you pass none, as the third
|
|
2133
|
+
argument — and returns `null` for a larger one without reading further, so a raw route
|
|
2134
|
+
never holds an unbounded body in memory.
|
|
2135
|
+
|
|
2090
2136
|
The error helpers (`badRequest`, `notFound`, …) **throw** an `AppError`, so raise
|
|
2091
2137
|
them inside the `try` and let `errorResponse(err)` render it — that runs any
|
|
2092
2138
|
thrown value through the framework's `normalizeError`, so a raw route returns the
|
|
@@ -3509,6 +3555,33 @@ that ends inside a line throws `StreamTruncatedLineError` (`lineBytes`) instead
|
|
|
3509
3555
|
fragment as a value — the right policy for a socket or a child process, where a missing newline
|
|
3510
3556
|
means the writer died. Both errors extend the `RangeError` / `SyntaxError` they replace.
|
|
3511
3557
|
|
|
3558
|
+
## Reading a body up to a byte limit
|
|
3559
|
+
|
|
3560
|
+
`readBoundedBody` (from `stitchkit` or `stitchkit/http`) reads a request or response body, a
|
|
3561
|
+
`ReadableStream<Uint8Array>` or any `AsyncIterable<Uint8Array>`, and never reads past
|
|
3562
|
+
`maxBytes` plus one chunk. Whoever owns the boundary picks the two errors, so a body that is too
|
|
3563
|
+
large and a read that was cancelled stay different outcomes:
|
|
3564
|
+
|
|
3565
|
+
```ts
|
|
3566
|
+
import { readBoundedBody } from 'stitchkit'
|
|
3567
|
+
|
|
3568
|
+
const bytes = await readBoundedBody(request.body, {
|
|
3569
|
+
maxBytes: 64 * 1024,
|
|
3570
|
+
signal: request.signal,
|
|
3571
|
+
limitError: (observedBytes) => new PayloadTooLarge(observedBytes),
|
|
3572
|
+
abortError: (reason) => new ClientGone({ cause: reason }),
|
|
3573
|
+
})
|
|
3574
|
+
```
|
|
3575
|
+
|
|
3576
|
+
- The source is cancelled when the limit is crossed and when `signal` aborts. A read that never
|
|
3577
|
+
settles does not hold the call after an abort, and an abort is honoured before the first read
|
|
3578
|
+
(even for a `null` body).
|
|
3579
|
+
- A body of exactly `maxBytes` is read; one more byte calls `limitError` with the bytes seen so far
|
|
3580
|
+
(the chunk that crossed the limit included).
|
|
3581
|
+
- A `null` body, such as a request without one, is an empty result.
|
|
3582
|
+
- Without `abortError` the signal's own reason is thrown.
|
|
3583
|
+
- `maxBytes` is a positive safe integer.
|
|
3584
|
+
|
|
3512
3585
|
## Resumable streams
|
|
3513
3586
|
|
|
3514
3587
|
A stream that survives a dropped connection needs four things beyond opening it:
|
|
@@ -4511,6 +4584,10 @@ default; DCR is off unless `clientRegistration.dcr` supplies both `register` and
|
|
|
4511
4584
|
exactly equals its URL, explicit redirect URIs and
|
|
4512
4585
|
`token_endpoint_auth_method: 'none'`.
|
|
4513
4586
|
|
|
4587
|
+
The token endpoint and `/register` read at most 64 KiB of a request body, or
|
|
4588
|
+
`maxRequestBodyBytes` when you set it; a larger one is answered `413` with
|
|
4589
|
+
`invalid_request` and the rest is not read.
|
|
4590
|
+
|
|
4514
4591
|
The production fetcher rejects credentials, fragments, non-HTTPS URLs and
|
|
4515
4592
|
private/reserved targets. Every redirect is DNS-resolved and IP-pinned again;
|
|
4516
4593
|
timeouts, redirect count and body size are bounded. Its bounded cache respects
|
|
@@ -13427,7 +13504,7 @@ queryable across all three:
|
|
|
13427
13504
|
| `ok` / `statusCode` | legacy success bit plus real HTTP status, or `200`/`400` for a tool; an opted-in cancellation is `false` / `499`. `statusCode` is **absent** on a job — it had no transport to have a status on, and inventing one would be the same defect as the `method: 'AGENT'` this replaced. A job's outcome is `ok`, plus `errorCode` when it failed |
|
|
13428
13505
|
| `durationMs` / `startedAt` | timing |
|
|
13429
13506
|
| `errorCode` / `errorMessage` / `errorDetail` | failures only — `errorDetail` carries the structure the message flattens (e.g. Zod issues) |
|
|
13430
|
-
| `payload` | sanitised tool arguments; HTTP is `null` unless request `includePayload` is enabled |
|
|
13507
|
+
| `payload` | sanitised tool arguments; HTTP is `null` unless request `includePayload` is enabled, or when the body was larger than `payloadMaxBytes` (then `payloadTruncated: true`) |
|
|
13431
13508
|
| `resultSize` / `responseBytes` | result item count + serialised size |
|
|
13432
13509
|
| `userId` / `ipAddress` / `userAgent` | identity |
|
|
13433
13510
|
|
|
@@ -13799,6 +13876,23 @@ createObservability({
|
|
|
13799
13876
|
`redact`, `truncatePreview` and `measureSize` are exported on their own if you
|
|
13800
13877
|
need to sanitise something outside the audit path.
|
|
13801
13878
|
|
|
13879
|
+
### How much of a body the audit row reads
|
|
13880
|
+
|
|
13881
|
+
With `includePayload: true` the row reads a clone of the request body, and it reads at most
|
|
13882
|
+
`payloadMaxBytes` of it. Unset, the limit is the handler's `maxJsonBodyBytes`, or 1 MiB when the
|
|
13883
|
+
handler has none, so one number bounds both. The clone is taken when the request opens, before
|
|
13884
|
+
a route is matched, so an endpoint's own `maxJsonBodyBytes` is not known to it: set
|
|
13885
|
+
`payloadMaxBytes` when endpoints accept more than the handler default. A body that is larger
|
|
13886
|
+
is cancelled at the limit, its `payload` is `null`, and the row carries `payloadTruncated: true` — a `null` payload with that flag
|
|
13887
|
+
means "too large to record", not "no body". Set `payloadMaxBytes` (a positive integer) to record
|
|
13888
|
+
more or less than the handler accepts:
|
|
13889
|
+
|
|
13890
|
+
```ts
|
|
13891
|
+
createObservability({
|
|
13892
|
+
request: { write, includePayload: true, payloadMaxBytes: 256 * 1024 },
|
|
13893
|
+
})
|
|
13894
|
+
```
|
|
13895
|
+
|
|
13802
13896
|
## The raw hooks
|
|
13803
13897
|
|
|
13804
13898
|
Tool observability is built on hooks you can also use directly — for a one-off
|
|
@@ -16053,6 +16147,32 @@ analytics policy belong to the application.
|
|
|
16053
16147
|
|
|
16054
16148
|
# Upgrading stitchkit
|
|
16055
16149
|
|
|
16150
|
+
## Released migration: 0.111.0
|
|
16151
|
+
|
|
16152
|
+
**Who must act:** applications whose raw routes call `parseBody` on JSON larger than 1 MiB, and applications whose OAuth clients send `/register` or `/token` bodies larger than 64 KiB.
|
|
16153
|
+
|
|
16154
|
+
### Bounded raw and OAuth bodies
|
|
16155
|
+
|
|
16156
|
+
`parseBody` reads at most 1 MiB and returns `null` for a larger body, where it used to read any size. A route that takes larger JSON states its limit:
|
|
16157
|
+
|
|
16158
|
+
```ts
|
|
16159
|
+
// before
|
|
16160
|
+
const body = await parseBody(req, Schema)
|
|
16161
|
+
// after
|
|
16162
|
+
const body = await parseBody(req, Schema, { maxBytes: 8 * 1024 * 1024 })
|
|
16163
|
+
```
|
|
16164
|
+
|
|
16165
|
+
`mountOAuthProvider` reads at most 64 KiB of a `/token` or `/register` body and answers `413` with `invalid_request` for a larger one. A deployment whose clients register larger metadata raises the limit:
|
|
16166
|
+
|
|
16167
|
+
```ts
|
|
16168
|
+
// before
|
|
16169
|
+
mountOAuthProvider({ issuer, signingSecret, resource, codes, authorizeUser })
|
|
16170
|
+
// after
|
|
16171
|
+
mountOAuthProvider({ issuer, signingSecret, resource, codes, authorizeUser, maxRequestBodyBytes: 256 * 1024 })
|
|
16172
|
+
```
|
|
16173
|
+
|
|
16174
|
+
Both limits must be a positive safe integer; anything else is refused when the route is built or called.
|
|
16175
|
+
|
|
16056
16176
|
## Released migration: 0.110.0
|
|
16057
16177
|
|
|
16058
16178
|
### Interrupted process drains
|
|
@@ -17430,7 +17550,7 @@ Run it inside the project that depends on stitchkit. It reads your installed
|
|
|
17430
17550
|
version out of `node_modules`, reads the changelog **shipped inside the
|
|
17431
17551
|
package**, and prints every breaking section your range crosses, oldest first,
|
|
17432
17552
|
each with its **Who must act** line — the list this guide's migrations expand
|
|
17433
|
-
on. Nothing to clone, nothing to be told: `--from` / `--to` override either end
|
|
17553
|
+
on — and then the fixes of that range that name what they touch. Nothing to clone, nothing to be told: `--from` / `--to` override either end
|
|
17434
17554
|
of the range if you want a different one.
|
|
17435
17555
|
|
|
17436
17556
|
So upgrading is: read the `### ⚠️ Breaking changes` of every version *above* your
|
|
@@ -17461,6 +17581,12 @@ beside a `package.json`, which is build output) and gives each item one verdict:
|
|
|
17461
17581
|
- **not declared — check by hand** — an item from before the line existed, with the files that
|
|
17462
17582
|
import the entrypoints it leads with.
|
|
17463
17583
|
|
|
17584
|
+
A fix that names what it touches gets the same verdicts. Since 0.110.7 every `### Fixed` item that
|
|
17585
|
+
leads with an entrypoint carries the `**Affects:**` line, and `upgrade` prints them in a second
|
|
17586
|
+
section, **Fixes that touch this project** (`fixes` in `--json`): a fix to `runNativeCommand` is
|
|
17587
|
+
listed with the `path:line` that imports it, or as *not used here*. Fixes of earlier releases that
|
|
17588
|
+
carry no line are not judged; one line counts them (`fixesWithoutAffects` in `--json`).
|
|
17589
|
+
|
|
17464
17590
|
`--json` prints the same verdicts per item for a CI step. The scan reads static `import` and
|
|
17465
17591
|
`export … from` declarations, bare imports and `import()` / `require()` of a literal specifier; a
|
|
17466
17592
|
specifier built at run time is invisible to it, and so is a file of another kind (`.astro`,
|
|
@@ -20958,6 +21084,7 @@ The browser-and-server entrypoint. Re-exports everything from
|
|
|
20958
21084
|
| `parseSSE` | function | parse SSE from a `Response`, a web stream or an async byte iterable into an async generator — [guide](../guide/client.md#sse) |
|
|
20959
21085
|
| `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
|
|
20960
21086
|
| `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
|
|
21087
|
+
| `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
|
|
20961
21088
|
| `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
|
|
20962
21089
|
| `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
|
|
20963
21090
|
| `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
|
|
@@ -21297,9 +21424,10 @@ Also re-exports the error helpers from `stitchkit/contract`.
|
|
|
21297
21424
|
| `formatZodError` | function | a `ZodError` → a readable, field-summarised string |
|
|
21298
21425
|
| `zodIssues` | function | a `ZodError` → structured `{ path, code, message }[]` — the machine-readable sibling of `formatZodError` |
|
|
21299
21426
|
| `ZodIssueSummary` | _type_ | one structured validation issue (`{ path, code, message }`) |
|
|
21300
|
-
| `parseBody` | function | parse + Zod-validate a JSON body → `data` or `null` (no throw) |
|
|
21427
|
+
| `parseBody` | function | parse + Zod-validate a JSON body → `data` or `null` (no throw); reads at most `options.maxBytes` (1 MiB by default) and is `null` for a larger body |
|
|
21301
21428
|
| `HandlerConfig` | _type_ | config for `createHandler`, including optional `maxJsonBodyBytes`; bound to `BunServer` on this entrypoint |
|
|
21302
21429
|
| `BunServerConfig` | _type_ | config for `createServer` (Bun); `unix` listens on a unix domain socket (mutually exclusive with `port`/`hostname`) — [details](../guide/server.md#local-daemon-over-a-unix-socket) |
|
|
21430
|
+
| `defineRequestIngress` / `RequestIngress` / `RequestIngressSource` | function / _type_ | a typed key the code that builds a `Request` attaches a value to (`attach(request, value)`) and an endpoint, `authorize`, `beforeHandle` or `onError` reads from its `ctx` (`from(ctx)`); a header, `clone()` and `new Request(request)` carry nothing, a second `attach` is refused, and `ctx.req` is the very request the handler received — [guide](../guide/server.md#request-attributes-from-the-ingress) |
|
|
21303
21431
|
| `ProxyOriginConfig` | _type_ | explicit real-peer trust for Bun `createServer({ proxyOrigin })`; strict external-scheme normalization before composition — [details](../guide/server.md#external-origin-behind-a-trusted-proxy) |
|
|
21304
21432
|
| `UnixListenConfig` | _type_ | unix listener — a socket path, or `{ path, mode }` to tighten the file mode after listen |
|
|
21305
21433
|
| `BunServerHandle` | _type_ | managed Bun handle (`url`, `port`, `runtime`, `status`, `shutdown`) |
|
|
@@ -22389,7 +22517,7 @@ audit event. See the [Observability guide](../guide/observability.md).
|
|
|
22389
22517
|
| `ObservabilityDrainReport` | _type_ | final closed/drained snapshot, `durationMs` (the shared drain's age, not this call's wait), and `drained` — read from the counters, `false` only when `total.pending + total.preparing` is nonzero |
|
|
22390
22518
|
| `ObservabilitySinkStatusSchema` / `ObservabilityStatusSchema` / `ObservabilityDrainReportSchema` | schema | runtime schemas for status/report integration boundaries |
|
|
22391
22519
|
| `RequestEventSinkConfig` | _type_ | `write`, filter/sanitisation, `maxPending`, `onSinkError` and `onDrop` |
|
|
22392
|
-
| `RequestObservabilityConfig` | _type_ | request sink plus opt-in payload capture and default-off `includeCancelled` rows |
|
|
22520
|
+
| `RequestObservabilityConfig` | _type_ | request sink plus opt-in payload capture (`payloadMaxBytes` bounds the body read, `payloadTruncated` marks a cut one) and default-off `includeCancelled` rows |
|
|
22393
22521
|
| `SinkDropReason` | _type_ | `'capacity' \| 'closed'` |
|
|
22394
22522
|
| `SinkError` | _type_ | isolated sink/projection failure and optional event |
|
|
22395
22523
|
| `SinkDrop` | _type_ | rejected event, reason and current pending count |
|
|
@@ -22634,7 +22762,7 @@ A native remote-connector auth surface for MCP — [guide](../guide/mcp-and-agen
|
|
|
22634
22762
|
| `protectedResourceMetadataUrl` | function | build the metadata URL for a resource |
|
|
22635
22763
|
| `wwwAuthenticateHeader` | function | build the `WWW-Authenticate` challenge header |
|
|
22636
22764
|
| `PROTECTED_RESOURCE_PATH` | const | the well-known metadata path |
|
|
22637
|
-
| `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider` |
|
|
22765
|
+
| `OAuthProviderConfig` | _type_ | config for `mountOAuthProvider`; `maxRequestBodyBytes` bounds the `/token` and `/register` bodies (64 KiB by default) |
|
|
22638
22766
|
| `ProtectedResourceConfig` | _type_ | config for `oauthProtectedResourceRoute` |
|
|
22639
22767
|
| `ApplicationType` | _type_ | DCR `application_type` — `'native'` (loopback allowed) \| `'web'` (https only) |
|
|
22640
22768
|
| `AuthCodeData` | _type_ | a stored authorization-code record |
|
package/llms.txt
CHANGED
|
@@ -9,11 +9,11 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
|
|
|
9
9
|
Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
|
|
10
10
|
|
|
11
11
|
## Entrypoint slices
|
|
12
|
-
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 47.5 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt)
|
|
12
|
+
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 47.5 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 38.1 KB
|
|
13
13
|
- **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
|
|
14
14
|
- **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.6 KB
|
|
15
15
|
- **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.2 KB
|
|
16
|
-
- **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 46.
|
|
16
|
+
- **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 46.4 KB → [llms/tools.2.txt](llms/tools.2.txt) 30.4 KB → [llms/tools.3.txt](llms/tools.3.txt) 26.3 KB
|
|
17
17
|
- **stitchkit/tools/mcp**: [llms/tools-mcp.txt](llms/tools-mcp.txt) 1.8 KB
|
|
18
18
|
- **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
|
|
19
19
|
- **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
|
|
@@ -23,8 +23,8 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
23
23
|
- **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
|
|
24
24
|
- **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.9 KB
|
|
25
25
|
- **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 11.7 KB
|
|
26
|
-
- **stitchkit/server**: [llms/server.txt](llms/server.txt)
|
|
27
|
-
- **stitchkit/observability**: [llms/observability.txt](llms/observability.txt)
|
|
26
|
+
- **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.2 KB → [llms/server.2.txt](llms/server.2.txt) 20.5 KB → [llms/server.3.txt](llms/server.3.txt) 45.6 KB → [llms/server.4.txt](llms/server.4.txt) 38.3 KB → [llms/server.5.txt](llms/server.5.txt) 22.9 KB
|
|
27
|
+
- **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 46.9 KB
|
|
28
28
|
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 42.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 46.7 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 35.6 KB
|
|
29
29
|
- **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
|
|
30
30
|
- **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 11.0 KB
|
|
@@ -63,8 +63,8 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
63
63
|
- **stitchkit/realtime**: [llms/realtime.txt](llms/realtime.txt) 1.4 KB
|
|
64
64
|
|
|
65
65
|
## Upgrading slices
|
|
66
|
-
- **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 12.
|
|
67
|
-
- **Upgrading 0.101.0 → 0.
|
|
66
|
+
- **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 12.7 KB
|
|
67
|
+
- **Upgrading 0.101.0 → 0.111.0**: [llms/upgrading-0.101.0-0.111.0.txt](llms/upgrading-0.101.0-0.111.0.txt) 46.9 KB
|
|
68
68
|
- **Upgrading 0.74.0 → 0.100.0**: [llms/upgrading-0.74.0-0.100.0.txt](llms/upgrading-0.74.0-0.100.0.txt) 45.1 KB
|
|
69
69
|
- **Upgrading 0.61.0 → 0.73.0**: [llms/upgrading-0.61.0-0.73.0.txt](llms/upgrading-0.61.0-0.73.0.txt) 41.2 KB
|
|
70
70
|
- **Upgrading 0.44.0 → 0.60.0**: [llms/upgrading-0.44.0-0.60.0.txt](llms/upgrading-0.44.0-0.60.0.txt) 43.9 KB
|
package/package.json
CHANGED