stitchkit 0.124.5 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +99 -1
  2. package/dist/agent-runtime/branch-contract.d.ts +5 -0
  3. package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
  4. package/dist/agent-runtime/branch-identities.d.ts +18 -0
  5. package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
  6. package/dist/agent-runtime/branch-messages.d.ts +9 -2
  7. package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
  8. package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
  9. package/dist/agent-runtime/branch-source.d.ts +1 -1
  10. package/dist/agent-runtime/branch-source.d.ts.map +1 -1
  11. package/dist/agent-runtime/store-branch.d.ts.map +1 -1
  12. package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -1
  13. package/dist/application/watch-hub-core.d.ts +2 -1
  14. package/dist/application/watch-hub-core.d.ts.map +1 -1
  15. package/dist/application/watch-hub-source.d.ts +2 -0
  16. package/dist/application/watch-hub-source.d.ts.map +1 -1
  17. package/dist/application/watch-hub.d.ts +20 -1
  18. package/dist/application/watch-hub.d.ts.map +1 -1
  19. package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
  20. package/dist/entrypoints/agent-runtime/harness.js +4 -4
  21. package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
  22. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  23. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  24. package/dist/entrypoints/agent-runtime/testing.js +33 -9
  25. package/dist/entrypoints/agent-runtime.js +12 -12
  26. package/dist/entrypoints/application.d.ts +1 -1
  27. package/dist/entrypoints/application.d.ts.map +1 -1
  28. package/dist/entrypoints/application.js +55 -8
  29. package/dist/entrypoints/bin/upgrade-cli.js +2 -0
  30. package/dist/entrypoints/cli.js +6 -6
  31. package/dist/entrypoints/files/packaging.js +2 -2
  32. package/dist/entrypoints/node.js +2 -1
  33. package/dist/entrypoints/process.js +2 -2
  34. package/dist/entrypoints/server.d.ts +1 -1
  35. package/dist/entrypoints/server.d.ts.map +1 -1
  36. package/dist/entrypoints/server.js +7 -7
  37. package/dist/entrypoints/testing.js +1 -1
  38. package/dist/entrypoints/tools/agent.js +6 -6
  39. package/dist/entrypoints/tools/connections.js +2 -2
  40. package/dist/entrypoints/tools/invoker.js +4 -4
  41. package/dist/entrypoints/tools/mcp.js +8 -6
  42. package/dist/entrypoints/tools/toolkit.js +10 -8
  43. package/dist/entrypoints/tools.js +11 -11
  44. package/dist/{index-gbj964dt.js → index-103dp7fz.js} +54 -31
  45. package/dist/{index-cm07qz01.js → index-1v3k5zgx.js} +1 -1
  46. package/dist/{index-3n8k175r.js → index-48acz7z0.js} +5 -5
  47. package/dist/{index-6fmg17bg.js → index-4efxzrht.js} +2 -2
  48. package/dist/{index-en2xqhty.js → index-57ppvpw0.js} +1 -1
  49. package/dist/{index-x68eyh6y.js → index-7cn66qdk.js} +2 -2
  50. package/dist/{index-7q05ag0z.js → index-7zksb1ty.js} +1 -1
  51. package/dist/{index-xaem29dc.js → index-a3z56mtn.js} +1 -1
  52. package/dist/{index-568w258r.js → index-a6w6mwda.js} +1 -1
  53. package/dist/{index-z2z67tnv.js → index-cvjddnvd.js} +3 -3
  54. package/dist/{index-afc3mtah.js → index-ft2wvst5.js} +101 -32
  55. package/dist/{index-gdqawggb.js → index-jjvr9f15.js} +14 -0
  56. package/dist/{index-q7s1yr9g.js → index-kxff9e9w.js} +3 -3
  57. package/dist/{index-r7v5xz0g.js → index-m0wsfmrc.js} +1 -1
  58. package/dist/{index-pq7rkwkk.js → index-m200b8hs.js} +65 -12
  59. package/dist/{index-2ds89z96.js → index-n6hvd1r2.js} +4 -4
  60. package/dist/{index-p9saezh1.js → index-pa9bhefy.js} +1 -1
  61. package/dist/{index-p1mwqkgh.js → index-v7rbjatr.js} +122 -113
  62. package/dist/{index-rk7m4j7r.js → index-x2d51zay.js} +9 -10
  63. package/dist/{index-1wz4y15d.js → index-x2rvpbtj.js} +1 -1
  64. package/dist/internal/coalesced-task.d.ts +14 -2
  65. package/dist/internal/coalesced-task.d.ts.map +1 -1
  66. package/dist/internal/upgrade-affects.d.ts.map +1 -1
  67. package/dist/process/group-settlement.d.ts +2 -0
  68. package/dist/process/group-settlement.d.ts.map +1 -1
  69. package/dist/server/context.d.ts +2 -2
  70. package/dist/server/context.d.ts.map +1 -1
  71. package/dist/server/create.d.ts.map +1 -1
  72. package/dist/server/error-dispatch.d.ts +2 -0
  73. package/dist/server/error-dispatch.d.ts.map +1 -1
  74. package/dist/server/handler-state.d.ts +3 -0
  75. package/dist/server/handler-state.d.ts.map +1 -1
  76. package/dist/server/middleware/cors.d.ts +48 -3
  77. package/dist/server/middleware/cors.d.ts.map +1 -1
  78. package/dist/server/types.d.ts +8 -2
  79. package/dist/server/types.d.ts.map +1 -1
  80. package/dist/tools/cli/args-route.d.ts +10 -1
  81. package/dist/tools/cli/args-route.d.ts.map +1 -1
  82. package/dist/tools/cli/args.d.ts.map +1 -1
  83. package/dist/tools/cli/command-shape.d.ts +4 -0
  84. package/dist/tools/cli/command-shape.d.ts.map +1 -1
  85. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  86. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  87. package/dist/tools/cli/session.d.ts +1 -1
  88. package/dist/tools/cli/session.d.ts.map +1 -1
  89. package/dist/tools/cli/stream-surface.d.ts +6 -1
  90. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  91. package/dist/tools/internal/surface-projector.d.ts +2 -0
  92. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  93. package/llms/agent-runtime.2.txt +30 -0
  94. package/llms/agent-runtime.4.txt +1 -1
  95. package/llms/application.3.txt +9 -3
  96. package/llms/cli.2.txt +1 -1
  97. package/llms/cli.txt +27 -0
  98. package/llms/live.txt +28 -1
  99. package/llms/server.3.txt +2 -1
  100. package/llms/server.5.txt +3 -1
  101. package/llms/server.txt +44 -1
  102. package/llms/stitchkit.txt +3 -3
  103. package/llms/{upgrading-0.106.0-0.124.0.txt → upgrading-0.106.0-0.126.0.txt} +65 -3
  104. package/llms/upgrading.txt +1 -1
  105. package/llms-full.txt +210 -12
  106. package/llms.txt +6 -6
  107. package/package.json +4 -4
package/llms/live.txt CHANGED
@@ -131,7 +131,7 @@ pushing the new answer to everyone watching it.
131
131
  import { createWatchHub } from 'stitchkit/application';
132
132
 
133
133
  const hub = createWatchHub({
134
- read: (operation, args) => api[operation.action](args),
134
+ read: ({ operation, args, signal }) => api[operation.action].withOptions(args, { signal }),
135
135
  watchable: (operation) => operation.service === 'notes',
136
136
  invalidatedBy: () => ['notes.changed'],
137
137
  subscribe: (topic, listener) => bus.on(topic, listener),
@@ -202,6 +202,33 @@ The one way to defeat that is to resolve an identity from ambient state *inside*
202
202
  subscriber on that key receives whatever the first read happened to resolve.
203
203
  Put the identity in the arguments instead.
204
204
 
205
+ ### A read stops when nobody waits for it
206
+
207
+ `read` receives one request, `{ operation, args, scope, signal }`, and the
208
+ `signal` belongs to that read alone. It stays live while anyone watches the key:
209
+ one of three panels closing changes nothing. It aborts when the last subscriber
210
+ leaves — its scope revoked included — or the hub closes. `holdMs` keeps the last
211
+ value warm for a returning page; it does not keep work running that nobody waits
212
+ for.
213
+
214
+ Pass the signal to whatever performs the read. What the read settles with after
215
+ the abort, an answer or an error, is dropped: it is not published, not announced
216
+ as `unavailable`, not logged and does not move the retry backoff, because nobody
217
+ asked for it any more. A subscriber that arrives meanwhile gets a fresh read,
218
+ never the abandoned answer. A read that ignores the signal still finishes, and
219
+ the next read of its key waits for it: one read per question holds even then.
220
+
221
+ The hub sets no deadline of its own, so a read that never settles holds its key
222
+ for good. Give the read one where it is performed —
223
+ `AbortSignal.any([signal, AbortSignal.timeout(10_000)])` — and a timeout is then
224
+ an ordinary failure: `unavailable`, then a retry.
225
+
226
+ The pause after a failed read belongs to the key, not to whoever is watching. A
227
+ subscriber that leaves and comes back while the source is down is told the known
228
+ state at once and gets the next read when the pause ends, not on arrival; an
229
+ abandoned read does not shorten the following pause either. A failed key is kept
230
+ for the length of its pause even with no subscribers and no `holdMs`.
231
+
205
232
  ### Three states, not two
206
233
 
207
234
  `state.phase` comes from `LiveStatePhase`, the vocabulary the live-state
package/llms/server.3.txt CHANGED
@@ -225,7 +225,8 @@ await createSocketIOServer({
225
225
  })
226
226
  ```
227
227
 
228
- `cors` is **optional**. Omit it when the browser reaches this server on its
228
+ `cors` is **optional**, and it is Socket.IO's own: the HTTP handler's `cors`,
229
+ including an origin function, does not reach it. Omit it when the browser reaches this server on its
229
230
  own origin — Socket.IO then emits no CORS headers, which is same-origin only.
230
231
  Supply it only for a genuinely cross-origin browser: naming a foreign origin is
231
232
  naming where the code will run, and a repository that does not have to know
package/llms/server.5.txt CHANGED
@@ -145,7 +145,9 @@ Also re-exports the error helpers from `stitchkit/contract`.
145
145
  | `CookieDef` | _type_ | the `defineCookie` handle |
146
146
  | `CookieOptions` | _type_ | cookie attributes, plus the `duplicates` read policy |
147
147
  | `CookieDuplicatesPolicy` | _type_ | `'last'` (default) / `'first'` / `'reject'` — `reject` yields `undefined` for two different values and the value when they agree |
148
- | `CorsConfig` | _type_ | CORS policy |
148
+ | `CorsConfig` | _type_ | static CORS policy: origin (or list, or `'*'`) and one `credentials` flag |
149
+ | `CorsOriginPolicy` | _type_ | CORS decided per request: `origin(origin)` answers each exact serialized origin, sync or async; no `credentials` beside it. Decided once per request for every exit, always `Vary: Origin`, a throw or malformed answer grants nothing and runs nothing; a safelisted `text/plain` body needs a grant with credentials |
150
+ | `CorsOriginDecision` | _type_ | what the policy answers: `false` or `{ credentials: boolean }` |
149
151
 
150
152
  ### Realtime (server)
151
153
 
package/llms/server.txt CHANGED
@@ -305,7 +305,7 @@ server. See [Testing & deployment](./testing-and-deployment.md).
305
305
  | `maxJsonBodyBytes` | optional JSON body cap (bytes); per-route value overrides; unset preserves existing behaviour |
306
306
  | `port` / `hostname` | listen address — port defaults to `3000` |
307
307
  | `unix` | listen on a unix domain socket instead of TCP — `'/run/app.sock'` or `{ path, mode }` (see below) |
308
- | `cors` | CORS policy — `{ origin, credentials, methods, headers, exposeHeaders }`. `origin` is **required** when `cors` is present: pass an explicit origin (or list), or `'*'` to deliberately allow every origin — an origin-less config is a construction error, never a silent wildcard. Omit `cors` entirely to emit no CORS headers. |
308
+ | `cors` | CORS policy — `{ origin, credentials, methods, headers, exposeHeaders }`. `origin` is **required** when `cors` is present: pass an explicit origin (or list), or `'*'` to deliberately allow every origin — an origin-less config is a construction error, never a silent wildcard. `origin` may also be a function that answers each request origin with or without credentials ([below](#cors-decided-per-request)). Omit `cors` entirely to emit no CORS headers. |
309
309
  | `hooks` | lifecycle hooks (see below) |
310
310
  | `logging` | `true` for built-in request logs, or a `LoggingConfig` (see below) |
311
311
  | `traceId` | override per-request trace-id resolution — may return `undefined` to fall back |
@@ -319,6 +319,47 @@ Native Bun `routes` are intentionally not accepted: Bun matches them before
319
319
  `fetch`, so they could bypass shutdown admission. Use `rawRoutes`; they retain
320
320
  the Fetch `Request → Response` model and participate in lifecycle tracking.
321
321
 
322
+ ### CORS decided per request
323
+
324
+ When the allowed origins live in your data — a key that lists the sites its
325
+ browser tokens may be used from — pass a function as `cors.origin`. It gets the
326
+ exact request origin and answers `{ credentials: true }`, `{ credentials: false }`
327
+ or `false`, synchronously or as a promise:
328
+
329
+ ```ts
330
+ createServer({
331
+ cors: {
332
+ origin: async (origin) => {
333
+ if (origin === 'https://app.example.com') return { credentials: true } // our pages, cookies
334
+ if (await keys.allowsOrigin(origin)) return { credentials: false } // a partner page, bearer only
335
+ return false
336
+ },
337
+ },
338
+ // …
339
+ })
340
+ ```
341
+
342
+ - The answer is reached **once per request** and used by every response it
343
+ produces: the preflight, an `onRequest` short-circuit, raw routes, every kind
344
+ of endpoint response and every error.
345
+ - A grant names the requesting origin exactly; the function cannot answer with
346
+ another origin or `*`. It is never asked about a missing `Origin`, `null` or a
347
+ string that is not a scheme and authority.
348
+ - Every response carries `Vary: Origin`, a refusal included, so a shared cache
349
+ never hands one origin's answer to another.
350
+ - A throw, a rejection or an answer of another shape grants nothing: the request
351
+ is refused through `onError` with the cause, nothing runs and the response
352
+ carries no allowance.
353
+ - `credentials` beside the function is a construction error: the function
354
+ decides it per origin.
355
+ - It runs before `onRequest`, so before any rate limit there, on every request
356
+ that carries an origin a browser could send. Answer from memory or a cache
357
+ rather than a slow lookup per request.
358
+ - Like a static list, a refusal only stops the page from reading the answer; it
359
+ does not stop the endpoint. Authorization still decides whether work runs.
360
+ - A `safelistedBody` endpoint reads a `text/plain` body only from an origin
361
+ granted with credentials ([below](#safelisted-request-bodies-beacons)).
362
+
322
363
  ### External origin behind a trusted proxy
323
364
 
324
365
  An HTTPS ingress often forwards plain HTTP to Bun. `trustProxy` trusts client-IP
@@ -790,6 +831,8 @@ is read:
790
831
  | `Origin: null` — sandboxed iframe, cross-origin redirect, `file://` | `403` |
791
832
  | no `Origin` header | `403` |
792
833
  | server `cors.origin: '*'` | `403` — a wildcard is not an allow-list |
834
+ | origin policy granted the origin `{ credentials: true }` | parsed |
835
+ | origin policy granted `{ credentials: false }` or `false` | `403` — only an origin trusted with credentials may post text |
793
836
  | server without `cors` | `403` — there is no allow-list |
794
837
  | `application/json` from any origin | unchanged — never subject to the check |
795
838
 
@@ -94,13 +94,13 @@ own, recorded as an ADR.
94
94
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
95
95
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
96
96
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
97
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 69 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
97
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 71 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
98
98
  | `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 |
99
99
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
100
100
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
101
101
  | `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) |
102
102
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
103
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 69 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
103
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 27 of the 71 minors since 0.56.2, most recently 0.126.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
104
104
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
105
105
  | `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 |
106
106
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -112,7 +112,7 @@ own, recorded as an ADR.
112
112
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
113
113
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
114
114
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
115
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 69 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
115
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 15 of the 71 minors since 0.56.2, most recently 0.126.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
116
116
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
117
117
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
118
118
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -1,14 +1,76 @@
1
- # Upgrading 0.106.0 → 0.124.0 — stitchkit docs slice
1
+ # Upgrading 0.106.0 → 0.126.0 — stitchkit docs slice
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
5
 
6
- Contains: Guide: Upgrading, 0.106.0 → 0.124.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.106.0 → 0.126.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.106.0 → 0.124.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.106.0 → 0.126.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.126.0
13
+
14
+ ### watch-read-request
15
+
16
+ **Who must act:** every server that passes `read` to `createWatchHub` from
17
+ `stitchkit/application`.
18
+
19
+ `read` receives one `WatchReadRequest` instead of three positions. Destructure
20
+ what the old signature named and pass `signal` on to whatever performs the read:
21
+
22
+ ```ts
23
+ // before
24
+ createWatchHub({ read: (operation, args, scope) => dispatch(operation, args, scope), … })
25
+
26
+ // after
27
+ createWatchHub({
28
+ read: ({ operation, args, scope, signal }) => dispatch(operation, args, { scope, signal }),
29
+ …
30
+ })
31
+ ```
32
+
33
+ The signal aborts when the key's last subscriber leaves or the hub closes. What the
34
+ read settles with after that is dropped, so a read that rejects on abort needs no
35
+ special handling. A read that ignores the signal keeps working as before; it only
36
+ cannot stop early.
37
+
38
+ ### branch-conformance-application-files
39
+
40
+ **Who must act:** authors of a hand-written `AgentRuntimeStore` that implements
41
+ `branchConversation` itself and runs `runAgentStoreConformance` from
42
+ `stitchkit/agent-runtime/testing`. Stores built on the shipped memory, SQLite or
43
+ driver-backed store need nothing.
44
+
45
+ The conformance kit's branch case now carries a file part the application stores.
46
+ The store must accept `applicationFiles` on `branchConversation`, write each declared
47
+ `destinationReference` into the branch, refuse a file part that is neither a spill nor
48
+ declared before any write, and fingerprint the declaration with the request.
49
+ Delegating to the shipped branch planner does all four.
50
+
51
+ ## Released migration: 0.125.0
52
+
53
+ ### cli-framework-option-command-names
54
+
55
+ **Who must act:** shell CLI authors who use framework option spellings as
56
+ command names, and callers of native commands in a CLI with a managed factory
57
+ and no default command.
58
+
59
+ Rename matching native, contract or runtime CLI commands and update callers.
60
+ For example, change `name: '--quiet'` to `name: 'quiet-mode'` and
61
+ `app --quiet inspect` to `app quiet-mode inspect`. Include factory-supplied
62
+ names in the check. Native and static CLI declarations are checked at startup.
63
+ A factory reports the conflicting name when its managed catalogue is loaded.
64
+
65
+ For a native command beside a managed factory, use `app whoami --quiet`
66
+ in place of `app --quiet whoami` if the CLI has no default command. Putting
67
+ the command first keeps it available without opening the catalogue.
68
+
69
+ When moving a bare boolean flag next to a positional `true` or `false`, make
70
+ the flag's value explicit. Migrate `app --dry-run inspect false` to
71
+ `app inspect --dry-run=true false`. This previews the call with the string
72
+ `false`. The separate form `app inspect --dry-run false` executes the command.
73
+
12
74
  ## Released migration: 0.124.0
13
75
 
14
76
  ### media-block-file-name
@@ -11,7 +11,7 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
11
11
 
12
12
  Load this slice, then every range slice between your installed version and the target:
13
13
 
14
- - 0.106.0 → 0.124.0: `llms/upgrading-0.106.0-0.124.0.txt`
14
+ - 0.106.0 → 0.126.0: `llms/upgrading-0.106.0-0.126.0.txt`
15
15
  - 0.96.0 → 0.105.0: `llms/upgrading-0.96.0-0.105.0.txt`
16
16
  - 0.69.0 → 0.95.0: `llms/upgrading-0.69.0-0.95.0.txt`
17
17
  - 0.55.0 → 0.68.0: `llms/upgrading-0.55.0-0.68.0.txt`
package/llms-full.txt CHANGED
@@ -85,13 +85,13 @@ own, recorded as an ADR.
85
85
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
86
86
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
87
87
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
88
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 69 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
88
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 71 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
89
89
  | `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 |
90
90
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
91
91
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
92
92
  | `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) |
93
93
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
94
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 69 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
94
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 27 of the 71 minors since 0.56.2, most recently 0.126.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
95
95
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
96
96
  | `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 |
97
97
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -103,7 +103,7 @@ own, recorded as an ADR.
103
103
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
104
104
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
105
105
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
106
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 69 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
106
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 15 of the 71 minors since 0.56.2, most recently 0.126.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
107
107
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
108
108
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
109
109
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -1557,7 +1557,7 @@ server. See [Testing & deployment](./testing-and-deployment.md).
1557
1557
  | `maxJsonBodyBytes` | optional JSON body cap (bytes); per-route value overrides; unset preserves existing behaviour |
1558
1558
  | `port` / `hostname` | listen address — port defaults to `3000` |
1559
1559
  | `unix` | listen on a unix domain socket instead of TCP — `'/run/app.sock'` or `{ path, mode }` (see below) |
1560
- | `cors` | CORS policy — `{ origin, credentials, methods, headers, exposeHeaders }`. `origin` is **required** when `cors` is present: pass an explicit origin (or list), or `'*'` to deliberately allow every origin — an origin-less config is a construction error, never a silent wildcard. Omit `cors` entirely to emit no CORS headers. |
1560
+ | `cors` | CORS policy — `{ origin, credentials, methods, headers, exposeHeaders }`. `origin` is **required** when `cors` is present: pass an explicit origin (or list), or `'*'` to deliberately allow every origin — an origin-less config is a construction error, never a silent wildcard. `origin` may also be a function that answers each request origin with or without credentials ([below](#cors-decided-per-request)). Omit `cors` entirely to emit no CORS headers. |
1561
1561
  | `hooks` | lifecycle hooks (see below) |
1562
1562
  | `logging` | `true` for built-in request logs, or a `LoggingConfig` (see below) |
1563
1563
  | `traceId` | override per-request trace-id resolution — may return `undefined` to fall back |
@@ -1571,6 +1571,47 @@ Native Bun `routes` are intentionally not accepted: Bun matches them before
1571
1571
  `fetch`, so they could bypass shutdown admission. Use `rawRoutes`; they retain
1572
1572
  the Fetch `Request → Response` model and participate in lifecycle tracking.
1573
1573
 
1574
+ ### CORS decided per request
1575
+
1576
+ When the allowed origins live in your data — a key that lists the sites its
1577
+ browser tokens may be used from — pass a function as `cors.origin`. It gets the
1578
+ exact request origin and answers `{ credentials: true }`, `{ credentials: false }`
1579
+ or `false`, synchronously or as a promise:
1580
+
1581
+ ```ts
1582
+ createServer({
1583
+ cors: {
1584
+ origin: async (origin) => {
1585
+ if (origin === 'https://app.example.com') return { credentials: true } // our pages, cookies
1586
+ if (await keys.allowsOrigin(origin)) return { credentials: false } // a partner page, bearer only
1587
+ return false
1588
+ },
1589
+ },
1590
+ // …
1591
+ })
1592
+ ```
1593
+
1594
+ - The answer is reached **once per request** and used by every response it
1595
+ produces: the preflight, an `onRequest` short-circuit, raw routes, every kind
1596
+ of endpoint response and every error.
1597
+ - A grant names the requesting origin exactly; the function cannot answer with
1598
+ another origin or `*`. It is never asked about a missing `Origin`, `null` or a
1599
+ string that is not a scheme and authority.
1600
+ - Every response carries `Vary: Origin`, a refusal included, so a shared cache
1601
+ never hands one origin's answer to another.
1602
+ - A throw, a rejection or an answer of another shape grants nothing: the request
1603
+ is refused through `onError` with the cause, nothing runs and the response
1604
+ carries no allowance.
1605
+ - `credentials` beside the function is a construction error: the function
1606
+ decides it per origin.
1607
+ - It runs before `onRequest`, so before any rate limit there, on every request
1608
+ that carries an origin a browser could send. Answer from memory or a cache
1609
+ rather than a slow lookup per request.
1610
+ - Like a static list, a refusal only stops the page from reading the answer; it
1611
+ does not stop the endpoint. Authorization still decides whether work runs.
1612
+ - A `safelistedBody` endpoint reads a `text/plain` body only from an origin
1613
+ granted with credentials ([below](#safelisted-request-bodies-beacons)).
1614
+
1574
1615
  ### External origin behind a trusted proxy
1575
1616
 
1576
1617
  An HTTPS ingress often forwards plain HTTP to Bun. `trustProxy` trusts client-IP
@@ -2042,6 +2083,8 @@ is read:
2042
2083
  | `Origin: null` — sandboxed iframe, cross-origin redirect, `file://` | `403` |
2043
2084
  | no `Origin` header | `403` |
2044
2085
  | server `cors.origin: '*'` | `403` — a wildcard is not an allow-list |
2086
+ | origin policy granted the origin `{ credentials: true }` | parsed |
2087
+ | origin policy granted `{ credentials: false }` or `false` | `403` — only an origin trusted with credentials may post text |
2045
2088
  | server without `cors` | `403` — there is no allow-list |
2046
2089
  | `application/json` from any origin | unchanged — never subject to the check |
2047
2090
 
@@ -6365,6 +6408,10 @@ const copy = await sqlite.store.branchConversation({
6365
6408
  source: { kind: 'conversation', conversationId: 'original', throughRunId: 'finished-run' },
6366
6409
  // Required when selected history has spills: an explicit policy for this destination.
6367
6410
  artifactAuthorization: { operation: 'read', path: 'approved-destination-workspace' },
6411
+ // File parts your application stores: the reference you granted the destination.
6412
+ applicationFiles: [
6413
+ { reference: 'uploads/original/photo.png', destinationReference: 'uploads/new-conversation/photo.png' },
6414
+ ],
6368
6415
  })
6369
6416
 
6370
6417
  const restored = await sqlite.store.branchConversation({
@@ -6389,6 +6436,32 @@ Run update timestamps reconstructed from events use their recorded `occurredAt`.
6389
6436
  retain the full failed assistant in the same event; a legacy archive must retain that exact assistant
6390
6437
  in its runtime snapshot, otherwise copying refuses instead of inventing historical content or time.
6391
6438
 
6439
+ A file part's `reference` belongs to whoever stored it. A spill of the archive is rekeyed with the
6440
+ spills. Any other file part — an upload your input carried, a file `persistGeneratedFile` saved —
6441
+ lives in your store, where the runtime can neither copy it nor grant access to it. Grant the
6442
+ destination conversation access in your store first, then declare each pair in `applicationFiles`:
6443
+ the branch writes your `destinationReference` and never the source address. A file part neither
6444
+ spilled nor declared refuses the whole branch with `Branch contains a foreign or missing file
6445
+ reference`, as does a declared reference that is also a spill or a repeated `reference` or
6446
+ `destinationReference`. Declare every attachment of the supplied history, including turns after
6447
+ `throughRunId`: the complete archive is validated before the prefix is chosen. The declaration is
6448
+ part of the request fingerprint, so a retry with the same pairs returns the receipt and different
6449
+ pairs conflict. If the branch refuses, remove the grants you made for it.
6450
+
6451
+ Message metadata, the input and output of your own tools and provider options are your JSON, and
6452
+ the branch does not rewrite them. A key in them named like a runtime reference — `reference`,
6453
+ `conversationId`, `runId`, `messageId`, `callId`, `toolCallId`, `approvalId`, `operationId`,
6454
+ `artifactId` — refuses the branch, because a runtime reference there could be neither rekeyed nor
6455
+ safely carried. When such a name is simply your data — a Telegram `messageId`, a CRM `reference` —
6456
+ list it in `applicationKeys: ['messageId', 'reference']`. A declared key still refuses when its value
6457
+ names an identity of the source conversation, and the order of `applicationKeys` and
6458
+ `applicationFiles` is not part of the request.
6459
+
6460
+ The provider journal is the record of what a model was actually sent, and a branch copies it as
6461
+ evidence, unrewritten. File bytes are recorded by hash; an address your `resolveFile` returned —
6462
+ a URL, a signed link — is recorded as that string and stays in the branch's journal. If such an
6463
+ address must not reach the destination, resolve files to bytes.
6464
+
6392
6465
  No provider or tool runs during copying. The next ordinary runtime `submit` continues the copied
6393
6466
  history. All engine identities and typed references are new, including repeated references to one
6394
6467
  spill. Compacted content stays in the event history and SQLite inactive rows; the model reads the
@@ -10771,6 +10844,14 @@ there stays a positional, and `--` makes a literal `false` one too. The same
10771
10844
  holds for a short alias, a framework flag such as `--json false` and an
10772
10845
  application option.
10773
10846
 
10847
+ Only the next token in the original invocation can supply a framework flag's
10848
+ boolean value. For example, `app --dry-run inspect false` previews `inspect`
10849
+ with the positional string `false`. If the app declares a `--profile` option,
10850
+ `app inspect --dry-run --profile demo false` does the same. To execute the
10851
+ command with dry-run explicitly disabled, use `app inspect --dry-run false`.
10852
+ On a named command, `--schema false` and `--help false` also allow execution.
10853
+ At the top level, `app --help false` searches the command list for `false`.
10854
+
10774
10855
  Every declared non-array option is single-use, including framework and
10775
10856
  application globals. Bare, separate-value, inline, negative and short-alias
10776
10857
  forms of a command option count as the same name: `--active=false --active`,
@@ -10883,6 +10964,25 @@ same Zod schema an HTTP or MCP call does.
10883
10964
 
10884
10965
  ## Global flags
10885
10966
 
10967
+ Framework options can precede an explicit command even when the CLI has no
10968
+ default command. With a static catalogue, `myapp --quiet item_list --json` and
10969
+ `myapp item_list --quiet --json` produce the same output. Keep an option's value
10970
+ next to it, as in `myapp --sort date item_list`. Place `--help` before the
10971
+ command name to filter the command list or after the name to show that command's help.
10972
+
10973
+ Shell command names cannot use a framework option spelling such as `--quiet`,
10974
+ `--sort` or `--json=false`, the separator `--`, or a built-in help or version
10975
+ token. Static CLI declarations are checked before dispatch. Names supplied by
10976
+ a managed factory are checked when that factory is resolved.
10977
+
10978
+ If a CLI has a managed factory and no default command, put a native command
10979
+ first, for example `myapp whoami --quiet`. A leading framework option before a
10980
+ native command exits with code 2: older catalogues could use that option as a
10981
+ command name. This refusal and the command-first invocation both work offline.
10982
+ To keep a positional `false` in a preview after moving the command first,
10983
+ use `myapp inspect --dry-run=true false`.
10984
+ Discovered managed commands accept framework flags in either position.
10985
+
10886
10986
  | Flag | Effect |
10887
10987
  | --------------------- | ---------------------------------------------------------- |
10888
10988
  | `--json` | Compact success/error JSON records for scripts |
@@ -12219,7 +12319,8 @@ await createSocketIOServer({
12219
12319
  })
12220
12320
  ```
12221
12321
 
12222
- `cors` is **optional**. Omit it when the browser reaches this server on its
12322
+ `cors` is **optional**, and it is Socket.IO's own: the HTTP handler's `cors`,
12323
+ including an origin function, does not reach it. Omit it when the browser reaches this server on its
12223
12324
  own origin — Socket.IO then emits no CORS headers, which is same-origin only.
12224
12325
  Supply it only for a genuinely cross-origin browser: naming a foreign origin is
12225
12326
  naming where the code will run, and a repository that does not have to know
@@ -13239,7 +13340,7 @@ pushing the new answer to everyone watching it.
13239
13340
  import { createWatchHub } from 'stitchkit/application';
13240
13341
 
13241
13342
  const hub = createWatchHub({
13242
- read: (operation, args) => api[operation.action](args),
13343
+ read: ({ operation, args, signal }) => api[operation.action].withOptions(args, { signal }),
13243
13344
  watchable: (operation) => operation.service === 'notes',
13244
13345
  invalidatedBy: () => ['notes.changed'],
13245
13346
  subscribe: (topic, listener) => bus.on(topic, listener),
@@ -13310,6 +13411,33 @@ The one way to defeat that is to resolve an identity from ambient state *inside*
13310
13411
  subscriber on that key receives whatever the first read happened to resolve.
13311
13412
  Put the identity in the arguments instead.
13312
13413
 
13414
+ ### A read stops when nobody waits for it
13415
+
13416
+ `read` receives one request, `{ operation, args, scope, signal }`, and the
13417
+ `signal` belongs to that read alone. It stays live while anyone watches the key:
13418
+ one of three panels closing changes nothing. It aborts when the last subscriber
13419
+ leaves — its scope revoked included — or the hub closes. `holdMs` keeps the last
13420
+ value warm for a returning page; it does not keep work running that nobody waits
13421
+ for.
13422
+
13423
+ Pass the signal to whatever performs the read. What the read settles with after
13424
+ the abort, an answer or an error, is dropped: it is not published, not announced
13425
+ as `unavailable`, not logged and does not move the retry backoff, because nobody
13426
+ asked for it any more. A subscriber that arrives meanwhile gets a fresh read,
13427
+ never the abandoned answer. A read that ignores the signal still finishes, and
13428
+ the next read of its key waits for it: one read per question holds even then.
13429
+
13430
+ The hub sets no deadline of its own, so a read that never settles holds its key
13431
+ for good. Give the read one where it is performed —
13432
+ `AbortSignal.any([signal, AbortSignal.timeout(10_000)])` — and a timeout is then
13433
+ an ordinary failure: `unavailable`, then a retry.
13434
+
13435
+ The pause after a failed read belongs to the key, not to whoever is watching. A
13436
+ subscriber that leaves and comes back while the source is down is told the known
13437
+ state at once and gets the next read when the pause ends, not on arrival; an
13438
+ abandoned read does not shorten the following pause either. A failed key is kept
13439
+ for the length of its pause even with no subscribers and no `holdMs`.
13440
+
13313
13441
  ### Three states, not two
13314
13442
 
13315
13443
  `state.phase` comes from `LiveStatePhase`, the vocabulary the live-state
@@ -18019,6 +18147,68 @@ charts, no merged cells and no streaming: an application that needs them takes a
18019
18147
 
18020
18148
  # Upgrading stitchkit
18021
18149
 
18150
+ ## Released migration: 0.126.0
18151
+
18152
+ ### watch-read-request
18153
+
18154
+ **Who must act:** every server that passes `read` to `createWatchHub` from
18155
+ `stitchkit/application`.
18156
+
18157
+ `read` receives one `WatchReadRequest` instead of three positions. Destructure
18158
+ what the old signature named and pass `signal` on to whatever performs the read:
18159
+
18160
+ ```ts
18161
+ // before
18162
+ createWatchHub({ read: (operation, args, scope) => dispatch(operation, args, scope), … })
18163
+
18164
+ // after
18165
+ createWatchHub({
18166
+ read: ({ operation, args, scope, signal }) => dispatch(operation, args, { scope, signal }),
18167
+ …
18168
+ })
18169
+ ```
18170
+
18171
+ The signal aborts when the key's last subscriber leaves or the hub closes. What the
18172
+ read settles with after that is dropped, so a read that rejects on abort needs no
18173
+ special handling. A read that ignores the signal keeps working as before; it only
18174
+ cannot stop early.
18175
+
18176
+ ### branch-conformance-application-files
18177
+
18178
+ **Who must act:** authors of a hand-written `AgentRuntimeStore` that implements
18179
+ `branchConversation` itself and runs `runAgentStoreConformance` from
18180
+ `stitchkit/agent-runtime/testing`. Stores built on the shipped memory, SQLite or
18181
+ driver-backed store need nothing.
18182
+
18183
+ The conformance kit's branch case now carries a file part the application stores.
18184
+ The store must accept `applicationFiles` on `branchConversation`, write each declared
18185
+ `destinationReference` into the branch, refuse a file part that is neither a spill nor
18186
+ declared before any write, and fingerprint the declaration with the request.
18187
+ Delegating to the shipped branch planner does all four.
18188
+
18189
+ ## Released migration: 0.125.0
18190
+
18191
+ ### cli-framework-option-command-names
18192
+
18193
+ **Who must act:** shell CLI authors who use framework option spellings as
18194
+ command names, and callers of native commands in a CLI with a managed factory
18195
+ and no default command.
18196
+
18197
+ Rename matching native, contract or runtime CLI commands and update callers.
18198
+ For example, change `name: '--quiet'` to `name: 'quiet-mode'` and
18199
+ `app --quiet inspect` to `app quiet-mode inspect`. Include factory-supplied
18200
+ names in the check. Native and static CLI declarations are checked at startup.
18201
+ A factory reports the conflicting name when its managed catalogue is loaded.
18202
+
18203
+ For a native command beside a managed factory, use `app whoami --quiet`
18204
+ in place of `app --quiet whoami` if the CLI has no default command. Putting
18205
+ the command first keeps it available without opening the catalogue.
18206
+
18207
+ When moving a bare boolean flag next to a positional `true` or `false`, make
18208
+ the flag's value explicit. Migrate `app --dry-run inspect false` to
18209
+ `app inspect --dry-run=true false`. This previews the call with the string
18210
+ `false`. The separate form `app inspect --dry-run false` executes the command.
18211
+
18022
18212
  ## Released migration: 0.124.0
18023
18213
 
18024
18214
  ### media-block-file-name
@@ -23942,7 +24132,9 @@ Also re-exports the error helpers from `stitchkit/contract`.
23942
24132
  | `CookieDef` | _type_ | the `defineCookie` handle |
23943
24133
  | `CookieOptions` | _type_ | cookie attributes, plus the `duplicates` read policy |
23944
24134
  | `CookieDuplicatesPolicy` | _type_ | `'last'` (default) / `'first'` / `'reject'` — `reject` yields `undefined` for two different values and the value when they agree |
23945
- | `CorsConfig` | _type_ | CORS policy |
24135
+ | `CorsConfig` | _type_ | static CORS policy: origin (or list, or `'*'`) and one `credentials` flag |
24136
+ | `CorsOriginPolicy` | _type_ | CORS decided per request: `origin(origin)` answers each exact serialized origin, sync or async; no `credentials` beside it. Decided once per request for every exit, always `Vary: Origin`, a throw or malformed answer grants nothing and runs nothing; a safelisted `text/plain` body needs a grant with credentials |
24137
+ | `CorsOriginDecision` | _type_ | what the policy answers: `false` or `{ credentials: boolean }` |
23946
24138
 
23947
24139
  ### Realtime (server)
23948
24140
 
@@ -24283,6 +24475,7 @@ vocabulary with an event topic declared `mode: 'decision'`.
24283
24475
  | `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _types_ | the minimal synchronous SQLite boundary the framework types against |
24284
24476
  | `createWatchHub` / `watchKey` | function | one read per question however many are asking: single-flight per key, re-read on a declared topic, publish only what changed |
24285
24477
  | `WatchHub` / `WatchHubConfig` / `WatchOperation` / `WatchSubscriber` / `AttachedWatcher` | _types_ | the hub, its read/watchable/invalidation policy, the operation identity, and one connection's attachment |
24478
+ | `WatchReadRequest` | _type_ | what `read` receives: `{ operation, args, scope?, signal }`; `signal` belongs to that one read and aborts when the key's last subscriber leaves or the hub closes |
24286
24479
 
24287
24480
  → [ADR 0152](../decisions/0152-a-keyspace-is-memory-that-nothing-reaches-before-it-is-durable.md),
24288
24481
  [ADR 0153](../decisions/0153-a-watched-read-is-one-read-per-question.md).
@@ -24304,9 +24497,14 @@ periodically even when no notification arrives.
24304
24497
  `WatchHubConfig` adds `maxSources` (1024), `maxSubscribers` (1024), and optional
24305
24498
  `reconcileIntervalMs` (10 ms–1 h). `hub.attach(subscriber, scope?)` accepts a
24306
24499
  `WatchAdmissionScope` containing a **server-verified** `key` (1–512 characters) and
24307
- revocation `signal`. The key separates sharing and is the optional third argument
24308
- of `read(operation, args, scope)`; a key's `instance` routes frames and never
24309
- separates sources. Attached over `maxSubscribers`, a subscriber gets a watcher whose
24500
+ revocation `signal`. The key separates sharing and reaches the application as
24501
+ `scope` in the one `WatchReadRequest` that `read({ operation, args, scope, signal })`
24502
+ receives; a key's `instance` routes frames and never separates sources. The request's
24503
+ `signal` belongs to that one read: it stays live while any subscriber watches the
24504
+ key and aborts when the last one leaves (its scope revoked included) or the hub
24505
+ closes. An aborted read's outcome, value or error, is dropped — not published,
24506
+ announced, logged or retried with backoff — and the next read of the key starts only
24507
+ after it settles. Attached over `maxSubscribers`, a subscriber gets a watcher whose
24310
24508
  `open` refuses with `Watch subscriber capacity exceeded`; `attach` does not throw
24311
24509
  for capacity. It must represent account, session and permissions;
24312
24510
  never trust a client-supplied owner ID as that scope.
@@ -24433,7 +24631,7 @@ Server-only optional application runtime. See the
24433
24631
  | `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
24434
24632
  | `AgentRunQueuePrioritySchema` | schema | durable opt-in priority for queued `interrupt-next` runs |
24435
24633
  | `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
24436
- | `BranchAgentConversationInputSchema` / `BranchAgentConversationInput` | schema / _type_ | strict branch request: stable request key, empty destination, settled conversation boundary or archive bytes, fresh artifact authorization |
24634
+ | `BranchAgentConversationInputSchema` / `BranchAgentConversationInput` | schema / _type_ | strict branch request: stable request key, empty destination, settled conversation boundary or archive bytes, fresh artifact authorization, and `applicationFiles` — `{ reference, destinationReference }` pairs for file parts the application stores; an undeclared non-spill file reference refuses the branch. `applicationKeys` names keys such as `messageId` or `reference` that are the application's own data inside its JSON; a declared key still refuses when its value names a source identity |
24437
24635
  | `AgentConversationBranchReceiptSchema` / `AgentConversationBranchReceipt` | schema / _type_ | durable lineage: request fingerprint, source/destination identities, source sequence/version/digest and creation time |
24438
24636
  | `AgentConversationBranchResultSchema` / `AgentConversationBranchResult` | schema / _type_ | `created` or `duplicate` with the same durable receipt; `AgentRuntimeStore.branchConversation` is optional for hand-written stores |
24439
24637
  | `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
@@ -25986,7 +26184,7 @@ SDK nor the `ai` peer.
25986
26184
  | `defineCliCommand` | function | define one Zod-typed CLI-only executable command with optional validated-result presentation/exit policy |
25987
26185
  | `defineCliResult` | function | type a managed command's `present` / `exitCode` policy against its output schema, for `CliConfig.results` — [guide](../guide/cli.md#the-same-policy-for-a-managed-command) |
25988
26186
  | `parseCliArgs` | function | argv → typed tool args against a schema; inline `--field:=JSON` assigns a whole JSON value, including null, while ordinary string flags remain lexical; named array options together with bare positionals require an explicit `positionals` policy (advanced) |
25989
- | `routeCliArgv` | function | select the command out of argv without duplicating the global-option grammar (advanced) |
26187
+ | `routeCliArgv` | function | select the command using the framework's option grammar before catalogue discovery. `createCli` also checks declared names and offline native dispatch — [guide](../guide/cli.md#global-flags) |
25990
26188
  | `extractCliGlobalOptions` | function | lift the application's own global options out of argv before routing (advanced) |
25991
26189
  | `coerceJsonArgs` | function | the second half of `parseCliArgs` — parse array/object values a consumer sends itself, including discovered MCP object guards restored from JSON Schema, without the `stitchkit/tools` barrel |
25992
26190
  | `CliArgumentError` | class | the refusal `parseCliArgs` and the view flags raise; a CLI reports it and exits `2` |