stitchkit 0.125.0 → 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 (76) hide show
  1. package/CHANGELOG.md +71 -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 +2 -2
  20. package/dist/entrypoints/agent-runtime/sandbox.js +2 -2
  21. package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -4
  22. package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -4
  23. package/dist/entrypoints/agent-runtime/testing.js +31 -7
  24. package/dist/entrypoints/agent-runtime.js +4 -4
  25. package/dist/entrypoints/application.d.ts +1 -1
  26. package/dist/entrypoints/application.d.ts.map +1 -1
  27. package/dist/entrypoints/application.js +55 -8
  28. package/dist/entrypoints/bin/upgrade-cli.js +2 -0
  29. package/dist/entrypoints/files/packaging.js +2 -2
  30. package/dist/entrypoints/node.js +2 -1
  31. package/dist/entrypoints/process.js +2 -2
  32. package/dist/entrypoints/server.d.ts +1 -1
  33. package/dist/entrypoints/server.d.ts.map +1 -1
  34. package/dist/entrypoints/server.js +7 -7
  35. package/dist/entrypoints/tools/mcp.js +3 -1
  36. package/dist/entrypoints/tools/toolkit.js +3 -1
  37. package/dist/entrypoints/tools.js +4 -4
  38. package/dist/{index-gbj964dt.js → index-103dp7fz.js} +54 -31
  39. package/dist/{index-fgzbc06j.js → index-48acz7z0.js} +1 -1
  40. package/dist/{index-8wzhmgpa.js → index-4efxzrht.js} +1 -1
  41. package/dist/{index-cj5f0x4y.js → index-57ppvpw0.js} +1 -1
  42. package/dist/{index-7q05ag0z.js → index-7zksb1ty.js} +1 -1
  43. package/dist/{index-568w258r.js → index-a6w6mwda.js} +1 -1
  44. package/dist/{index-0sg3wnzr.js → index-ft2wvst5.js} +101 -32
  45. package/dist/{index-gdqawggb.js → index-jjvr9f15.js} +14 -0
  46. package/dist/{index-pq7rkwkk.js → index-m200b8hs.js} +65 -12
  47. package/dist/{index-r8swbw1x.js → index-pa9bhefy.js} +1 -1
  48. package/dist/internal/coalesced-task.d.ts +14 -2
  49. package/dist/internal/coalesced-task.d.ts.map +1 -1
  50. package/dist/internal/upgrade-affects.d.ts.map +1 -1
  51. package/dist/process/group-settlement.d.ts +2 -0
  52. package/dist/process/group-settlement.d.ts.map +1 -1
  53. package/dist/server/context.d.ts +2 -2
  54. package/dist/server/context.d.ts.map +1 -1
  55. package/dist/server/create.d.ts.map +1 -1
  56. package/dist/server/error-dispatch.d.ts +2 -0
  57. package/dist/server/error-dispatch.d.ts.map +1 -1
  58. package/dist/server/handler-state.d.ts +3 -0
  59. package/dist/server/handler-state.d.ts.map +1 -1
  60. package/dist/server/middleware/cors.d.ts +48 -3
  61. package/dist/server/middleware/cors.d.ts.map +1 -1
  62. package/dist/server/types.d.ts +8 -2
  63. package/dist/server/types.d.ts.map +1 -1
  64. package/llms/agent-runtime.2.txt +30 -0
  65. package/llms/agent-runtime.4.txt +1 -1
  66. package/llms/application.3.txt +9 -3
  67. package/llms/live.txt +28 -1
  68. package/llms/server.3.txt +2 -1
  69. package/llms/server.5.txt +3 -1
  70. package/llms/server.txt +44 -1
  71. package/llms/stitchkit.txt +3 -3
  72. package/llms/{upgrading-0.106.0-0.125.0.txt → upgrading-0.106.0-0.126.0.txt} +42 -3
  73. package/llms/upgrading.txt +1 -1
  74. package/llms-full.txt +159 -11
  75. package/llms.txt +5 -5
  76. package/package.json +4 -4
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 70 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 70 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 70 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
@@ -12246,7 +12319,8 @@ await createSocketIOServer({
12246
12319
  })
12247
12320
  ```
12248
12321
 
12249
- `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
12250
12324
  own origin — Socket.IO then emits no CORS headers, which is same-origin only.
12251
12325
  Supply it only for a genuinely cross-origin browser: naming a foreign origin is
12252
12326
  naming where the code will run, and a repository that does not have to know
@@ -13266,7 +13340,7 @@ pushing the new answer to everyone watching it.
13266
13340
  import { createWatchHub } from 'stitchkit/application';
13267
13341
 
13268
13342
  const hub = createWatchHub({
13269
- read: (operation, args) => api[operation.action](args),
13343
+ read: ({ operation, args, signal }) => api[operation.action].withOptions(args, { signal }),
13270
13344
  watchable: (operation) => operation.service === 'notes',
13271
13345
  invalidatedBy: () => ['notes.changed'],
13272
13346
  subscribe: (topic, listener) => bus.on(topic, listener),
@@ -13337,6 +13411,33 @@ The one way to defeat that is to resolve an identity from ambient state *inside*
13337
13411
  subscriber on that key receives whatever the first read happened to resolve.
13338
13412
  Put the identity in the arguments instead.
13339
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
+
13340
13441
  ### Three states, not two
13341
13442
 
13342
13443
  `state.phase` comes from `LiveStatePhase`, the vocabulary the live-state
@@ -18046,6 +18147,45 @@ charts, no merged cells and no streaming: an application that needs them takes a
18046
18147
 
18047
18148
  # Upgrading stitchkit
18048
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
+
18049
18189
  ## Released migration: 0.125.0
18050
18190
 
18051
18191
  ### cli-framework-option-command-names
@@ -23992,7 +24132,9 @@ Also re-exports the error helpers from `stitchkit/contract`.
23992
24132
  | `CookieDef` | _type_ | the `defineCookie` handle |
23993
24133
  | `CookieOptions` | _type_ | cookie attributes, plus the `duplicates` read policy |
23994
24134
  | `CookieDuplicatesPolicy` | _type_ | `'last'` (default) / `'first'` / `'reject'` — `reject` yields `undefined` for two different values and the value when they agree |
23995
- | `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 }` |
23996
24138
 
23997
24139
  ### Realtime (server)
23998
24140
 
@@ -24333,6 +24475,7 @@ vocabulary with an event topic declared `mode: 'decision'`.
24333
24475
  | `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _types_ | the minimal synchronous SQLite boundary the framework types against |
24334
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 |
24335
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 |
24336
24479
 
24337
24480
  → [ADR 0152](../decisions/0152-a-keyspace-is-memory-that-nothing-reaches-before-it-is-durable.md),
24338
24481
  [ADR 0153](../decisions/0153-a-watched-read-is-one-read-per-question.md).
@@ -24354,9 +24497,14 @@ periodically even when no notification arrives.
24354
24497
  `WatchHubConfig` adds `maxSources` (1024), `maxSubscribers` (1024), and optional
24355
24498
  `reconcileIntervalMs` (10 ms–1 h). `hub.attach(subscriber, scope?)` accepts a
24356
24499
  `WatchAdmissionScope` containing a **server-verified** `key` (1–512 characters) and
24357
- revocation `signal`. The key separates sharing and is the optional third argument
24358
- of `read(operation, args, scope)`; a key's `instance` routes frames and never
24359
- 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
24360
24508
  `open` refuses with `Watch subscriber capacity exceeded`; `attach` does not throw
24361
24509
  for capacity. It must represent account, session and permissions;
24362
24510
  never trust a client-supplied owner ID as that scope.
@@ -24483,7 +24631,7 @@ Server-only optional application runtime. See the
24483
24631
  | `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
24484
24632
  | `AgentRunQueuePrioritySchema` | schema | durable opt-in priority for queued `interrupt-next` runs |
24485
24633
  | `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
24486
- | `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 |
24487
24635
  | `AgentConversationBranchReceiptSchema` / `AgentConversationBranchReceipt` | schema / _type_ | durable lineage: request fingerprint, source/destination identities, source sequence/version/digest and creation time |
24488
24636
  | `AgentConversationBranchResultSchema` / `AgentConversationBranchResult` | schema / _type_ | `created` or `duplicate` with the same durable receipt; `AgentRuntimeStore.branchConversation` is optional for hand-written stores |
24489
24637
  | `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
package/llms.txt CHANGED
@@ -10,7 +10,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
10
10
 
11
11
  ## Entrypoint slices
12
12
  - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 45.2 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 31.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.3 KB
13
- - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
13
+ - **stitchkit/live**: [llms/live.txt](llms/live.txt) 22.7 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
16
16
  - **stitchkit/react/keyboard/testing**: [llms/react-keyboard-testing.txt](llms/react-keyboard-testing.txt) 1.9 KB
@@ -26,9 +26,9 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
26
26
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
27
27
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 34.1 KB
28
28
  - **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 13.2 KB
29
- - **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.4 KB → [llms/server.2.txt](llms/server.2.txt) 23.1 KB → [llms/server.3.txt](llms/server.3.txt) 47.0 KB → [llms/server.4.txt](llms/server.4.txt) 38.7 KB → [llms/server.5.txt](llms/server.5.txt) 23.8 KB
29
+ - **stitchkit/server**: [llms/server.txt](llms/server.txt) 46.7 KB → [llms/server.2.txt](llms/server.2.txt) 23.1 KB → [llms/server.3.txt](llms/server.3.txt) 47.1 KB → [llms/server.4.txt](llms/server.4.txt) 38.7 KB → [llms/server.5.txt](llms/server.5.txt) 24.2 KB
30
30
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 46.9 KB
31
- - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 5.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 44.1 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 42.5 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 45.2 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 11.8 KB
31
+ - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 5.7 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 46.4 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 42.5 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 45.5 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 11.8 KB
32
32
  - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
33
33
  - **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 11.0 KB
34
34
  - **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 5.0 KB
@@ -36,7 +36,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
36
36
  - **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 1.1 KB
37
37
  - **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.8 KB
38
38
  - **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.7 KB
39
- - **stitchkit/application**: [llms/application.txt](llms/application.txt) 40.8 KB → [llms/application.2.txt](llms/application.2.txt) 31.3 KB → [llms/application.3.txt](llms/application.3.txt) 29.6 KB
39
+ - **stitchkit/application**: [llms/application.txt](llms/application.txt) 40.8 KB → [llms/application.2.txt](llms/application.2.txt) 31.3 KB → [llms/application.3.txt](llms/application.3.txt) 30.2 KB
40
40
  - **stitchkit/application/grammy**: [llms/application-grammy.txt](llms/application-grammy.txt) 2.3 KB
41
41
  - **stitchkit/application/opentelemetry**: [llms/application-opentelemetry.txt](llms/application-opentelemetry.txt) 1.6 KB
42
42
  - **stitchkit/application/directory-inbox**: [llms/application-directory-inbox.txt](llms/application-directory-inbox.txt) 0.3 KB
@@ -73,7 +73,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
73
73
 
74
74
  ## Upgrading slices
75
75
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 12.7 KB
76
- - **Upgrading 0.106.0 → 0.125.0**: [llms/upgrading-0.106.0-0.125.0.txt](llms/upgrading-0.106.0-0.125.0.txt) 38.9 KB
76
+ - **Upgrading 0.106.0 → 0.126.0**: [llms/upgrading-0.106.0-0.126.0.txt](llms/upgrading-0.106.0-0.126.0.txt) 40.4 KB
77
77
  - **Upgrading 0.96.0 → 0.105.0**: [llms/upgrading-0.96.0-0.105.0.txt](llms/upgrading-0.96.0-0.105.0.txt) 45.8 KB
78
78
  - **Upgrading 0.69.0 → 0.95.0**: [llms/upgrading-0.69.0-0.95.0.txt](llms/upgrading-0.69.0-0.95.0.txt) 46.6 KB
79
79
  - **Upgrading 0.55.0 → 0.68.0**: [llms/upgrading-0.55.0-0.68.0.txt](llms/upgrading-0.55.0-0.68.0.txt) 47.0 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.125.0",
3
+ "version": "0.126.0",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",
@@ -412,13 +412,13 @@
412
412
  "@seriousme/openapi-schema-validator": "^2.12.0",
413
413
  "@socket.io/bun-engine": "^0.1.2",
414
414
  "@socket.io/component-emitter": "^3.1.2",
415
- "@tanstack/react-query": "5.108.0",
416
- "@types/bun": "^1.4.4",
415
+ "@tanstack/react-query": "5.108.2",
416
+ "@types/bun": "^1.4.5",
417
417
  "@types/json-schema": "^7.0.15",
418
418
  "@types/react": "^19.3.0",
419
419
  "@types/react-dom": "^19.3.0",
420
420
  "@typescript/typescript6": "^6.0.2",
421
- "ai": "^7.0.173",
421
+ "ai": "^7.0.179",
422
422
  "ajv": "^8.20.0",
423
423
  "exceljs": "^4.4.0",
424
424
  "fake-indexeddb": "^6.2.8",