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
@@ -10,6 +10,51 @@ export interface CorsConfig {
10
10
  */
11
11
  exposeHeaders?: string | string[];
12
12
  }
13
+ /**
14
+ * What an origin resolver answers for one exact origin: an allowance with or
15
+ * without credentials, or `false` for none.
16
+ */
17
+ export type CorsOriginDecision = false | {
18
+ credentials: boolean;
19
+ };
20
+ /**
21
+ * A CORS policy decided per request: the application looks the origin up —
22
+ * in a database, a key's allowed origins — and answers for that origin alone.
23
+ *
24
+ * Credentials are part of the answer, never a flag beside it: one origin can be
25
+ * the application's own page with cookies while another holds a short bearer
26
+ * token and gets none. The grant names the requesting origin exactly; a resolver
27
+ * cannot answer with another origin or `*`. It is called only with a serialized
28
+ * origin (scheme and authority), never with `null` or a missing header, and a
29
+ * throw, a rejection or an answer of another shape grants nothing.
30
+ */
31
+ export interface CorsOriginPolicy extends Pick<CorsConfig, 'methods' | 'headers' | 'exposeHeaders'> {
32
+ origin: (origin: string) => CorsOriginDecision | Promise<CorsOriginDecision>;
33
+ /** Decided per origin by `origin`; a flag here would be a second answer. */
34
+ credentials?: never;
35
+ }
36
+ /**
37
+ * The CORS answer for one request, decided once before any work and read by
38
+ * every exit — preflight, `onRequest`, raw routes, every endpoint response and
39
+ * every error — so the same request never gets two answers.
40
+ */
41
+ export interface RequestCors {
42
+ readonly headers: Readonly<Record<string, string>>;
43
+ /**
44
+ * Whether this request's origin may send a safelisted `text/plain` body
45
+ * (ADR 0165): there is no allow-list at all, the origin is allowed, or it is not.
46
+ */
47
+ readonly safelistedBody: 'no-allow-list' | 'allowed' | 'refused';
48
+ }
49
+ /**
50
+ * Decide CORS for one request. A static config answers synchronously, so a
51
+ * handler without a policy keeps its timing; a policy asks the application. A
52
+ * failing policy throws or rejects, and the caller answers with
53
+ * {@link deniedRequestCors}.
54
+ */
55
+ export declare function resolveRequestCors(config: CorsConfig | CorsOriginPolicy, origin: string | null): RequestCors | Promise<RequestCors>;
56
+ /** No allowance: the shared headers without an origin, varying by `Origin` for caches. */
57
+ export declare function deniedRequestCors(config: Pick<CorsConfig, 'methods' | 'headers' | 'exposeHeaders'>): RequestCors;
13
58
  /**
14
59
  * The default `Access-Control-Allow-Headers` — the request headers stitchkit's
15
60
  * own clients send, so a browser preflight passes out of the box. The single
@@ -55,7 +100,7 @@ export declare const DEFAULT_CORS_EXPOSE_HEADERS = "Content-Disposition, Content
55
100
  * `Allow-Credentials: true` — every site could make authenticated cross-origin
56
101
  * requests. Credentials require an explicit origin allow-list.
57
102
  */
58
- export declare function assertCorsConfig(config: CorsConfig): void;
103
+ export declare function assertCorsConfig(config: CorsConfig | CorsOriginPolicy): void;
59
104
  /**
60
105
  * Is `requestOrigin` on the server's **explicit** allow-list? The question a
61
106
  * safelisted request body asks before it is read (→ ADR 0165), and it is
@@ -70,7 +115,7 @@ export declare function isOriginAllowed(config: CorsConfig | undefined, requestO
70
115
  export declare function corsHeaders(config: CorsConfig, requestOrigin?: string | null): Record<string, string>;
71
116
  export declare function corsPreflightResponse(config: CorsConfig, req: Request): Response;
72
117
  /** The CORS headers for one request — none when the handler has no CORS config. */
73
- export declare function requestCorsHeaders(cors: CorsConfig | undefined, req: Request): Record<string, string>;
118
+ export declare function requestCorsHeaders(cors: RequestCors | undefined): Record<string, string>;
74
119
  /**
75
120
  * Apply CORS headers to a response produced outside the framework (a raw route,
76
121
  * a binary endpoint or an `onError` hook).
@@ -85,5 +130,5 @@ export declare function requestCorsHeaders(cors: CorsConfig | undefined, req: Re
85
130
  * headers immutable (Node throws; Bun currently allows the set), and a redirect
86
131
  * has no body to corrupt.
87
132
  */
88
- export declare function applyCors(res: Response, cors: CorsConfig | undefined, req: Request): Response;
133
+ export declare function applyCors(res: Response, cors: RequestCors | undefined): Response;
89
134
  //# sourceMappingURL=cors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/cors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,qEAC6B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,2BAA2B,qHAC4E,CAAC;AAErH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAoBzD;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAMT;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4BxB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,QAAQ,CAKhF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,GAAG,EAAE,OAAO,GACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxB;AAED;;;;;;;;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FAA0F;AAC1F,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,GAChE,WAAW,CAKb;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,qEAC6B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,2BAA2B,qHAC4E,CAAC;AAErH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,IAAI,CA4B5E;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAMT;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AA6BD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,QAAQ,CAKhF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAehF"}
@@ -9,7 +9,7 @@ import type { PathParams } from '../internal/route-pattern.js';
9
9
  import type { HttpRequestObserver } from '../observability/audit.js';
10
10
  import type { ReleaseMarker } from '../release/marker.js';
11
11
  import type { LogFormat } from './logger.js';
12
- import type { CorsConfig } from './middleware/cors.js';
12
+ import type { CorsConfig, CorsOriginPolicy } from './middleware/cors.js';
13
13
  type Prop<T, K extends string> = K extends keyof T ? T[K] : undefined;
14
14
  type InferParams<E> = Prop<E, 'params'> extends ZodType<infer P> ? P : E extends {
15
15
  path: infer TPath extends string;
@@ -441,7 +441,13 @@ export interface HandlerConfig<TServer = unknown> {
441
441
  * unbounded JSON-body behaviour.
442
442
  */
443
443
  maxJsonBodyBytes?: number;
444
- cors?: CorsConfig;
444
+ /**
445
+ * CORS for every HTTP response. A static `CorsConfig` names its origins and one
446
+ * credentials flag; a `CorsOriginPolicy` answers per request origin, with or
447
+ * without credentials, from the application's own data. Socket.IO keeps its
448
+ * own `cors`.
449
+ */
450
+ cors?: CorsConfig | CorsOriginPolicy;
445
451
  /**
446
452
  * The current frontend build, named on every response as `X-Build-Id` so a
447
453
  * browser can tell it is running a bundle the server no longer serves
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EAChB,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mB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,EAAE,CAAC;IACtB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAAC;IACrC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAClC,+EAA+E;IAC/E,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,OAAO;IACjD,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC;CACrE"}
@@ -501,6 +501,10 @@ const copy = await sqlite.store.branchConversation({
501
501
  source: { kind: 'conversation', conversationId: 'original', throughRunId: 'finished-run' },
502
502
  // Required when selected history has spills: an explicit policy for this destination.
503
503
  artifactAuthorization: { operation: 'read', path: 'approved-destination-workspace' },
504
+ // File parts your application stores: the reference you granted the destination.
505
+ applicationFiles: [
506
+ { reference: 'uploads/original/photo.png', destinationReference: 'uploads/new-conversation/photo.png' },
507
+ ],
504
508
  })
505
509
 
506
510
  const restored = await sqlite.store.branchConversation({
@@ -525,6 +529,32 @@ Run update timestamps reconstructed from events use their recorded `occurredAt`.
525
529
  retain the full failed assistant in the same event; a legacy archive must retain that exact assistant
526
530
  in its runtime snapshot, otherwise copying refuses instead of inventing historical content or time.
527
531
 
532
+ A file part's `reference` belongs to whoever stored it. A spill of the archive is rekeyed with the
533
+ spills. Any other file part — an upload your input carried, a file `persistGeneratedFile` saved —
534
+ lives in your store, where the runtime can neither copy it nor grant access to it. Grant the
535
+ destination conversation access in your store first, then declare each pair in `applicationFiles`:
536
+ the branch writes your `destinationReference` and never the source address. A file part neither
537
+ spilled nor declared refuses the whole branch with `Branch contains a foreign or missing file
538
+ reference`, as does a declared reference that is also a spill or a repeated `reference` or
539
+ `destinationReference`. Declare every attachment of the supplied history, including turns after
540
+ `throughRunId`: the complete archive is validated before the prefix is chosen. The declaration is
541
+ part of the request fingerprint, so a retry with the same pairs returns the receipt and different
542
+ pairs conflict. If the branch refuses, remove the grants you made for it.
543
+
544
+ Message metadata, the input and output of your own tools and provider options are your JSON, and
545
+ the branch does not rewrite them. A key in them named like a runtime reference — `reference`,
546
+ `conversationId`, `runId`, `messageId`, `callId`, `toolCallId`, `approvalId`, `operationId`,
547
+ `artifactId` — refuses the branch, because a runtime reference there could be neither rekeyed nor
548
+ safely carried. When such a name is simply your data — a Telegram `messageId`, a CRM `reference` —
549
+ list it in `applicationKeys: ['messageId', 'reference']`. A declared key still refuses when its value
550
+ names an identity of the source conversation, and the order of `applicationKeys` and
551
+ `applicationFiles` is not part of the request.
552
+
553
+ The provider journal is the record of what a model was actually sent, and a branch copies it as
554
+ evidence, unrewritten. File bytes are recorded by hash; an address your `resolveFile` returned —
555
+ a URL, a signed link — is recorded as that string and stays in the branch's journal. If such an
556
+ address must not reach the destination, resolve files to bytes.
557
+
528
558
  No provider or tool runs during copying. The next ordinary runtime `submit` continues the copied
529
559
  history. All engine identities and typed references are new, including repeated references to one
530
560
  spill. Compacted content stays in the event history and SQLite inactive rows; the model reads the
@@ -264,7 +264,7 @@ Server-only optional application runtime. See the
264
264
  | `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
265
265
  | `AgentRunQueuePrioritySchema` | schema | durable opt-in priority for queued `interrupt-next` runs |
266
266
  | `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
267
- | `BranchAgentConversationInputSchema` / `BranchAgentConversationInput` | schema / _type_ | strict branch request: stable request key, empty destination, settled conversation boundary or archive bytes, fresh artifact authorization |
267
+ | `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 |
268
268
  | `AgentConversationBranchReceiptSchema` / `AgentConversationBranchReceipt` | schema / _type_ | durable lineage: request fingerprint, source/destination identities, source sequence/version/digest and creation time |
269
269
  | `AgentConversationBranchResultSchema` / `AgentConversationBranchResult` | schema / _type_ | `created` or `duplicate` with the same durable receipt; `AgentRuntimeStore.branchConversation` is optional for hand-written stores |
270
270
  | `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
@@ -240,6 +240,7 @@ vocabulary with an event topic declared `mode: 'decision'`.
240
240
  | `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _types_ | the minimal synchronous SQLite boundary the framework types against |
241
241
  | `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 |
242
242
  | `WatchHub` / `WatchHubConfig` / `WatchOperation` / `WatchSubscriber` / `AttachedWatcher` | _types_ | the hub, its read/watchable/invalidation policy, the operation identity, and one connection's attachment |
243
+ | `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 |
243
244
 
244
245
  → [ADR 0152](../decisions/0152-a-keyspace-is-memory-that-nothing-reaches-before-it-is-durable.md),
245
246
  [ADR 0153](../decisions/0153-a-watched-read-is-one-read-per-question.md).
@@ -261,9 +262,14 @@ periodically even when no notification arrives.
261
262
  `WatchHubConfig` adds `maxSources` (1024), `maxSubscribers` (1024), and optional
262
263
  `reconcileIntervalMs` (10 ms–1 h). `hub.attach(subscriber, scope?)` accepts a
263
264
  `WatchAdmissionScope` containing a **server-verified** `key` (1–512 characters) and
264
- revocation `signal`. The key separates sharing and is the optional third argument
265
- of `read(operation, args, scope)`; a key's `instance` routes frames and never
266
- separates sources. Attached over `maxSubscribers`, a subscriber gets a watcher whose
265
+ revocation `signal`. The key separates sharing and reaches the application as
266
+ `scope` in the one `WatchReadRequest` that `read({ operation, args, scope, signal })`
267
+ receives; a key's `instance` routes frames and never separates sources. The request's
268
+ `signal` belongs to that one read: it stays live while any subscriber watches the
269
+ key and aborts when the last one leaves (its scope revoked included) or the hub
270
+ closes. An aborted read's outcome, value or error, is dropped — not published,
271
+ announced, logged or retried with backoff — and the next read of the key starts only
272
+ after it settles. Attached over `maxSubscribers`, a subscriber gets a watcher whose
267
273
  `open` refuses with `Watch subscriber capacity exceeded`; `attach` does not throw
268
274
  for capacity. It must represent account, session and permissions;
269
275
  never trust a client-supplied owner ID as that scope.
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 70 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 70 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 70 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,53 @@
1
- # Upgrading 0.106.0 → 0.125.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.125.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.125.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
+
12
51
  ## Released migration: 0.125.0
13
52
 
14
53
  ### cli-framework-option-command-names
@@ -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.125.0: `llms/upgrading-0.106.0-0.125.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`