stitchkit 0.103.13 → 0.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/darwin-native.cjs +1 -3
  3. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
  4. package/dist/agent-runtime/store-conformance-support.d.ts +5 -5
  5. package/dist/application/directory-inbox-accept.d.ts +13 -0
  6. package/dist/application/directory-inbox-accept.d.ts.map +1 -0
  7. package/dist/application/directory-inbox-contract.d.ts +42 -5
  8. package/dist/application/directory-inbox-contract.d.ts.map +1 -1
  9. package/dist/application/directory-inbox-delivery.d.ts +14 -0
  10. package/dist/application/directory-inbox-delivery.d.ts.map +1 -0
  11. package/dist/application/directory-inbox-files.d.ts +28 -0
  12. package/dist/application/directory-inbox-files.d.ts.map +1 -0
  13. package/dist/application/directory-inbox-state.d.ts +14 -0
  14. package/dist/application/directory-inbox-state.d.ts.map +1 -0
  15. package/dist/application/directory-inbox.d.ts +2 -1
  16. package/dist/application/directory-inbox.d.ts.map +1 -1
  17. package/dist/application/file-state-store.d.ts +2 -8
  18. package/dist/application/file-state-store.d.ts.map +1 -1
  19. package/dist/application/state-store.d.ts +6 -1
  20. package/dist/application/state-store.d.ts.map +1 -1
  21. package/dist/browser/client-arguments.d.ts +4 -0
  22. package/dist/browser/client-arguments.d.ts.map +1 -0
  23. package/dist/browser/client-executors.d.ts.map +1 -1
  24. package/dist/browser/client.d.ts.map +1 -1
  25. package/dist/browser/contract-stream.d.ts.map +1 -1
  26. package/dist/browser/http.d.ts +2 -1
  27. package/dist/browser/http.d.ts.map +1 -1
  28. package/dist/browser/native-fetch.d.ts +8 -0
  29. package/dist/browser/native-fetch.d.ts.map +1 -0
  30. package/dist/contract/errors.d.ts +16 -12
  31. package/dist/contract/errors.d.ts.map +1 -1
  32. package/dist/contract/normalize.d.ts +5 -1
  33. package/dist/contract/normalize.d.ts.map +1 -1
  34. package/dist/contract/stream.d.ts +1 -0
  35. package/dist/contract/stream.d.ts.map +1 -1
  36. package/dist/entrypoints/agent-runtime/browser.js +3 -3
  37. package/dist/entrypoints/agent-runtime/coding-tools.js +6 -6
  38. package/dist/entrypoints/agent-runtime/harness-tools.js +8 -8
  39. package/dist/entrypoints/agent-runtime/harness.js +11 -11
  40. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  41. package/dist/entrypoints/agent-runtime/sandbox.js +6 -6
  42. package/dist/entrypoints/agent-runtime.js +13 -13
  43. package/dist/entrypoints/application/diagnostic-journal.js +1 -1
  44. package/dist/entrypoints/application/directory-inbox.js +424 -119
  45. package/dist/entrypoints/application/grammy.js +1 -1
  46. package/dist/entrypoints/application.d.ts +2 -2
  47. package/dist/entrypoints/application.d.ts.map +1 -1
  48. package/dist/entrypoints/application.js +7 -3
  49. package/dist/entrypoints/cli.d.ts +2 -0
  50. package/dist/entrypoints/cli.d.ts.map +1 -1
  51. package/dist/entrypoints/cli.js +757 -136
  52. package/dist/entrypoints/contract.js +3 -3
  53. package/dist/entrypoints/files/packaging.d.ts +3 -0
  54. package/dist/entrypoints/files/packaging.d.ts.map +1 -0
  55. package/dist/entrypoints/files/packaging.js +133 -0
  56. package/dist/entrypoints/files.js +10 -107
  57. package/dist/entrypoints/index.js +7 -7
  58. package/dist/entrypoints/node.js +8 -8
  59. package/dist/entrypoints/observability.js +2 -2
  60. package/dist/entrypoints/react.js +1 -1
  61. package/dist/entrypoints/remote.js +19 -6
  62. package/dist/entrypoints/server.d.ts +1 -1
  63. package/dist/entrypoints/server.d.ts.map +1 -1
  64. package/dist/entrypoints/server.js +23 -17
  65. package/dist/entrypoints/telegram.d.ts +1 -0
  66. package/dist/entrypoints/telegram.d.ts.map +1 -1
  67. package/dist/entrypoints/telegram.js +214 -98
  68. package/dist/entrypoints/testing.js +7 -7
  69. package/dist/entrypoints/tools/connections.d.ts +2 -2
  70. package/dist/entrypoints/tools/connections.d.ts.map +1 -1
  71. package/dist/entrypoints/tools/connections.js +427 -294
  72. package/dist/entrypoints/tools/invoker.js +6 -6
  73. package/dist/entrypoints/tools/mcp.d.ts +12 -0
  74. package/dist/entrypoints/tools/mcp.d.ts.map +1 -0
  75. package/dist/entrypoints/tools/mcp.js +45 -0
  76. package/dist/entrypoints/tools.d.ts +1 -0
  77. package/dist/entrypoints/tools.d.ts.map +1 -1
  78. package/dist/entrypoints/tools.js +82 -1147
  79. package/dist/entrypoints/tracking.js +1 -1
  80. package/dist/files/boundary.d.ts +2 -8
  81. package/dist/files/boundary.d.ts.map +1 -1
  82. package/dist/files/file-io.d.ts +0 -5
  83. package/dist/files/file-io.d.ts.map +1 -1
  84. package/dist/files/native-packaging-layout.d.ts +12 -0
  85. package/dist/files/native-packaging-layout.d.ts.map +1 -0
  86. package/dist/files/native-packaging.d.ts +72 -0
  87. package/dist/files/native-packaging.d.ts.map +1 -0
  88. package/dist/files/read.d.ts +2 -2
  89. package/dist/files/read.d.ts.map +1 -1
  90. package/dist/index-1a6jtnd9.js +88 -0
  91. package/dist/index-269zqj8m.js +77 -0
  92. package/dist/{index-r34mvse1.js → index-27a2pj09.js} +1 -1
  93. package/dist/{index-r956rndn.js → index-2hyavjjj.js} +3 -3
  94. package/dist/{index-m2xqkv55.js → index-2vnh05w4.js} +83 -14
  95. package/dist/{index-pw99k9h5.js → index-43p08g7t.js} +1 -1
  96. package/dist/{index-xwq9j1sf.js → index-4e0ah203.js} +9 -7
  97. package/dist/{index-qapzv4p5.js → index-5z6jn897.js} +1 -1
  98. package/dist/{index-ahvsksw5.js → index-6d9xaxw1.js} +1 -1
  99. package/dist/{index-8zfsgar0.js → index-6drst9sg.js} +11 -5
  100. package/dist/{index-x87j7csh.js → index-77nxk6ay.js} +2 -2
  101. package/dist/{index-dnn9z96q.js → index-a0zzh8ak.js} +3 -3
  102. package/dist/{index-kmpzj1cq.js → index-a3wma1hk.js} +1 -1
  103. package/dist/{index-j8aw2c0e.js → index-bakgedh8.js} +35 -7
  104. package/dist/index-bhb950qs.js +1145 -0
  105. package/dist/{index-tgzhq07n.js → index-cvda079a.js} +1 -1
  106. package/dist/{index-n2gre124.js → index-fa4wg312.js} +4 -4
  107. package/dist/{index-zp4jpkp0.js → index-fk18k56k.js} +2 -2
  108. package/dist/{index-afjvjyck.js → index-g2j7pnak.js} +2 -134
  109. package/dist/index-g95fk660.js +116 -0
  110. package/dist/{index-r5c4fedv.js → index-h2fhjqy7.js} +2 -1
  111. package/dist/{index-sybedc8b.js → index-hbd32c6a.js} +23 -94
  112. package/dist/{index-fyphpknh.js → index-hp9d77wk.js} +1 -1
  113. package/dist/index-jd470k6q.js +109 -0
  114. package/dist/{index-b2bz0kdm.js → index-kb8styz3.js} +4 -3
  115. package/dist/{index-0c419yx7.js → index-kemm0ej5.js} +12 -9
  116. package/dist/{index-db2spkv1.js → index-ptn0g0gj.js} +3 -3
  117. package/dist/{index-w575evhq.js → index-r4r70zmh.js} +1 -1
  118. package/dist/{index-12m2v2a9.js → index-s4evrmp5.js} +1 -1
  119. package/dist/{index-1khy8y7n.js → index-t1sr4aks.js} +3 -3
  120. package/dist/{index-45tdvqa3.js → index-wh0ecvyk.js} +1 -1
  121. package/dist/{index-n53mswt3.js → index-x928baz2.js} +8 -1
  122. package/dist/index-yk4g8805.js +133 -0
  123. package/dist/{index-ygkka6zn.js → index-ywppsaby.js} +28 -5
  124. package/dist/{index-9853ymwb.js → index-za6j7nwy.js} +18 -4
  125. package/dist/internal/bounded-file-read.d.ts +41 -0
  126. package/dist/internal/bounded-file-read.d.ts.map +1 -0
  127. package/dist/internal/exclusive-lock.d.ts +2 -0
  128. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  129. package/dist/internal/with-exclusive-lock.d.ts +4 -2
  130. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  131. package/dist/telegram/broadcast-delivery.d.ts +23 -0
  132. package/dist/telegram/broadcast-delivery.d.ts.map +1 -0
  133. package/dist/telegram/broadcast-failure.d.ts +22 -0
  134. package/dist/telegram/broadcast-failure.d.ts.map +1 -0
  135. package/dist/telegram/broadcast-state.d.ts +6 -3
  136. package/dist/telegram/broadcast-state.d.ts.map +1 -1
  137. package/dist/telegram/broadcast.d.ts +10 -5
  138. package/dist/telegram/broadcast.d.ts.map +1 -1
  139. package/dist/tools/cli/format.d.ts.map +1 -1
  140. package/dist/tools/cli/invoke.d.ts +2 -2
  141. package/dist/tools/cli/invoke.d.ts.map +1 -1
  142. package/dist/tools/cli/publication-assets.d.ts +10 -0
  143. package/dist/tools/cli/publication-assets.d.ts.map +1 -0
  144. package/dist/tools/cli/publication-contract.d.ts +75 -0
  145. package/dist/tools/cli/publication-contract.d.ts.map +1 -0
  146. package/dist/tools/cli/publication-control.d.ts +4 -0
  147. package/dist/tools/cli/publication-control.d.ts.map +1 -0
  148. package/dist/tools/cli/publication-storage.d.ts +32 -0
  149. package/dist/tools/cli/publication-storage.d.ts.map +1 -0
  150. package/dist/tools/cli/publication.d.ts +35 -0
  151. package/dist/tools/cli/publication.d.ts.map +1 -0
  152. package/dist/tools/cli/update.d.ts.map +1 -1
  153. package/dist/tools/connections/define.d.ts.map +1 -1
  154. package/dist/tools/connections/error-projection.d.ts +4 -0
  155. package/dist/tools/connections/error-projection.d.ts.map +1 -0
  156. package/dist/tools/connections/errors.d.ts +24 -8
  157. package/dist/tools/connections/errors.d.ts.map +1 -1
  158. package/dist/tools/connections/limits.d.ts +11 -31
  159. package/dist/tools/connections/limits.d.ts.map +1 -1
  160. package/dist/tools/connections/mcp-client.d.ts +6 -4
  161. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  162. package/dist/tools/connections/mcp.d.ts.map +1 -1
  163. package/dist/tools/connections/openapi.d.ts.map +1 -1
  164. package/dist/tools/connections/operation-limits.d.ts +25 -0
  165. package/dist/tools/connections/operation-limits.d.ts.map +1 -0
  166. package/dist/tools/connections/sse-frames.d.ts +11 -2
  167. package/dist/tools/connections/sse-frames.d.ts.map +1 -1
  168. package/dist/tools/connections/sse-session.d.ts +15 -2
  169. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  170. package/dist/tools/connections/types.d.ts +19 -1
  171. package/dist/tools/connections/types.d.ts.map +1 -1
  172. package/dist/tools/execute-result.d.ts.map +1 -1
  173. package/dist/tools/execute.d.ts.map +1 -1
  174. package/dist/tools/internal/observe-hook.d.ts +3 -0
  175. package/dist/tools/internal/observe-hook.d.ts.map +1 -0
  176. package/dist/tools/internal/surface-projector.d.ts +2 -1
  177. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  178. package/dist/tools/mcp/mount.d.ts +2 -2
  179. package/dist/tools/mcp/mount.d.ts.map +1 -1
  180. package/dist/tools/mcp/prepare.d.ts +4 -5
  181. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  182. package/dist/tools/mcp/register.d.ts +4 -1
  183. package/dist/tools/mcp/register.d.ts.map +1 -1
  184. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  185. package/dist/tools/remote.d.ts.map +1 -1
  186. package/dist/tools/runtime-tool-execution.d.ts +65 -0
  187. package/dist/tools/runtime-tool-execution.d.ts.map +1 -0
  188. package/dist/tools/runtime-tool-mcp.d.ts +27 -0
  189. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -0
  190. package/dist/tools/runtime-tool.d.ts +9 -60
  191. package/dist/tools/runtime-tool.d.ts.map +1 -1
  192. package/dist/tools/surface.d.ts +12 -14
  193. package/dist/tools/surface.d.ts.map +1 -1
  194. package/llms/application.2.txt +221 -44
  195. package/llms/application.3.txt +3 -1
  196. package/llms/application.txt +1 -1
  197. package/llms/cli.2.txt +144 -1
  198. package/llms/cli.txt +123 -104
  199. package/llms/contract.txt +1 -1
  200. package/llms/files-packaging.txt +27 -0
  201. package/llms/process.txt +63 -1
  202. package/llms/server.4.txt +4 -1
  203. package/llms/server.5.txt +1 -0
  204. package/llms/stitchkit.2.txt +14 -0
  205. package/llms/stitchkit.txt +6 -4
  206. package/llms/telegram.txt +64 -2
  207. package/llms/tools-connections.txt +3 -0
  208. package/llms/tools-mcp.txt +29 -0
  209. package/llms/tools.2.txt +59 -0
  210. package/llms/tools.3.txt +1 -0
  211. package/llms/tools.txt +11 -52
  212. package/llms/upgrading-0.37.0-0.44.0.txt +444 -0
  213. package/llms/{upgrading-0.44.0-0.60.0.txt → upgrading-0.44.0-0.61.0.txt} +140 -271
  214. package/llms/{upgrading-0.61.0-0.74.0.txt → upgrading-0.62.0-0.80.0.txt} +217 -140
  215. package/llms/{upgrading-0.75.0-0.103.0.txt → upgrading-0.81.0-0.104.0.txt} +154 -217
  216. package/llms/upgrading.txt +4 -4
  217. package/llms-full.txt +745 -60
  218. package/llms.txt +14 -12
  219. package/native-assets.json +8 -0
  220. package/package.json +12 -3
  221. package/dist/index-wykebpn9.js +0 -221
  222. package/llms/upgrading-0.37.0.txt +0 -176
  223. package/dist/{index-69nvze1q.js → index-pptyv13k.js} +3 -3
@@ -1,14 +1,228 @@
1
- # Upgrading 0.61.0 → 0.74.0 — stitchkit docs slice
1
+ # Upgrading 0.62.0 → 0.80.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.61.0 → 0.74.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.62.0 → 0.80.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.61.0 → 0.74.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.62.0 → 0.80.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.80.0
13
+
14
+ One thing, and only if you parse an async-operation snapshot.
15
+
16
+ ```bash
17
+ rg -n "createAsyncOperationSnapshotSchema"
18
+ ```
19
+
20
+ `progress` on a parsed snapshot used to be `unknown`. The factory built its
21
+ object shapes with a conditional spread, and the narrowing inside it widened
22
+ your schema back to a bare `ZodType`, so the emitted declaration threw the type
23
+ argument away. It is now the output of the schema you configured.
24
+
25
+ ```ts
26
+ const schema = createAsyncOperationSnapshotSchema({
27
+ progress: z.object({ done: z.number(), total: z.number() }),
28
+ failure: z.object({ code: z.string() }),
29
+ })
30
+ const snap = schema.parse(body)
31
+ if (snap.phase === 'running') {
32
+ // before: `snap.progress` was `unknown` — this needed a cast or a narrow
33
+ // after: it is `{ done: number; total: number } | undefined`
34
+ console.log(snap.progress?.done)
35
+ }
36
+ ```
37
+
38
+ **If you cast it**, delete the cast — it was working around the erased type.
39
+ **If you assigned something else to it**, the compiler now refuses, and it was
40
+ already a value the schema rejected at run time.
41
+
42
+ **If you pass explicit type arguments**, the no-progress form takes one now, not
43
+ two: the factory is two overloads. Pass none.
44
+
45
+ ```ts
46
+ // before: createAsyncOperationSnapshotSchema<undefined, typeof Failure>({ failure: Failure })
47
+ // after: createAsyncOperationSnapshotSchema({ failure: Failure })
48
+ ```
49
+
50
+ Nothing about parsing moves. A snapshot configured without `progress` still
51
+ strips an unexpected `progress` rather than refusing it — that behaviour is why
52
+ this is overloads and not one normalised key.
53
+
54
+ **If you compile with `skipLibCheck: false`**, this is also the release that
55
+ makes `stitchkit/tools/contract` compile at all: it carried five `TS2344`
56
+ errors, one per phase, from the same conditional spread.
57
+
58
+ ## Released migration: 0.79.0
59
+
60
+ One thing, and only if you assert on the whole snapshot.
61
+
62
+ ```bash
63
+ rg -n "getSnapshot\(\)|projectApplicationStatus|status\(\)" --glob '*.test.ts' --glob '*.spec.ts'
64
+ ```
65
+
66
+ `ApplicationSnapshot` and `ApplicationStatusProjection` each gained a
67
+ `restarting` field — ids in the snapshot, a count in the projection. A reader
68
+ that names the fields it wants is unaffected. A test that compares the whole
69
+ object with `toEqual` fails until it adds the field:
70
+
71
+ ```ts
72
+ // before
73
+ expect(body).toEqual({ id, lifecycle: 'ready', /* … */ resources: { total: 1, ready: 1, degraded: 0, failed: 0 } })
74
+ // after
75
+ expect(body).toEqual({ id, lifecycle: 'ready', /* … */ resources: { total: 1, ready: 1, degraded: 0, failed: 0 }, restarting: 0 })
76
+ ```
77
+
78
+ It is zero except while a restart is running, and then it names the subtree being
79
+ replaced. That is the point: a snapshot taken mid-restart used to be
80
+ indistinguishable from a resource that had failed on its own, so a dashboard read
81
+ a planned replacement as an outage.
82
+
83
+ **If you watch a hub across a restart**, nothing to change, but the behaviour is
84
+ different and better: closing a hub now tells its subscribers `unavailable` /
85
+ `source-unavailable` instead of dropping them, so a page stops showing a value
86
+ that will never update again.
87
+
88
+ **If you need a tool contract in a browser**, `stitchkit/tools/contract` now
89
+ carries the async-operation helpers, its schemas and the view-file input/output
90
+ without the runtime. `stitchkit/tools` still exports all of them.
91
+
92
+ ## Released migration: 0.78.0
93
+
94
+ Two mechanical edits. Find them both:
95
+
96
+ ```bash
97
+ rg -n "createDecisionPipeline|createDiagnosticJournal" --glob '*.ts' --glob '*.tsx'
98
+ ```
99
+
100
+ **1. `createDecisionPipeline` takes a deadline.**
101
+
102
+ ```ts
103
+ // before
104
+ createDecisionPipeline([policyA, policyB])
105
+ // after
106
+ createDecisionPipeline([policyA, policyB], { policyTimeoutMs: 2_000 })
107
+ ```
108
+
109
+ Pick a number your slowest policy comfortably beats. There is no default on
110
+ purpose: a policy that never settles hangs every caller of the operation it
111
+ guards, and the framework has no basis for choosing that number for you.
112
+
113
+ Past the deadline — and on a throw, and on a non-decision — the pipeline raises
114
+ `DecisionPolicyError` naming the policy, with the trace so far. If you already
115
+ catch that for a bad return value, you now catch two more cases with it.
116
+
117
+ **2. `createDiagnosticJournal` moved.**
118
+
119
+ ```ts
120
+ // before
121
+ import { createDiagnosticJournal } from 'stitchkit/application'
122
+ // after
123
+ import { createDiagnosticJournal } from 'stitchkit/application/diagnostic-journal'
124
+ ```
125
+
126
+ Only the factory moved. `DiagnosticJournalConfig`, every
127
+ `DiagnosticJournal*Schema` and `readDiagnosticJournalLockDiagnosis` stay where
128
+ they were.
129
+
130
+ **If you restart resources**, nothing to change — but three things that did not
131
+ work now do: a managed schedule can be restarted, a restarted keyspace accepts
132
+ writes again, and a restarted managed server is actually shut down at exit. If
133
+ you pass `managedServerResource` a server *instance*, a restart is now refused
134
+ by name; pass a factory (`server: (context) => …`) to restart it.
135
+
136
+ ## Released migration: 0.77.0
137
+
138
+ Two type renames, and only if you named them. Nothing runtime moved.
139
+
140
+ ```bash
141
+ rg -n "EventDecision|EventUndecided" --glob '*.ts' --glob '*.tsx'
142
+ ```
143
+
144
+ ```ts
145
+ // before
146
+ import type { EventDecision, EventUndecided } from 'stitchkit/live'
147
+ // after
148
+ import type { PolicyDecision, UndecidedOutcome } from 'stitchkit/live'
149
+ ```
150
+
151
+ The shapes are identical — `{ outcome: 'allow' } | { outcome: 'deny', reason } | { outcome: 'defer' }`
152
+ and `'allow' | 'deny'`. If you only ever *return* decisions from listeners and never named the
153
+ type, the search above finds nothing and there is nothing to do.
154
+
155
+ They were renamed because `createDecisionPipeline` (new in this release) votes with exactly the
156
+ same three outcomes, and two identical types under two names is the thing that makes a search for
157
+ either one return half the truth.
158
+
159
+ ## Released migration: 0.76.0
160
+
161
+ One change, and only if you hand `createWatchClient` a transport you wrote yourself.
162
+
163
+ ```bash
164
+ rg -n "createWatchClient" --glob '*.ts'
165
+ ```
166
+
167
+ If the `transport:` you pass is a bound realtime client — `bindRealtimeClient(...)` or
168
+ `createRealtimeClient(...)` — there is nothing to do: it already carries
169
+ `onConnectionChange`. If it is an object you assembled, add the fourth member:
170
+
171
+ ```ts
172
+ onConnectionChange(listener: (connected: boolean, reason?: string) => void): () => void
173
+ ```
174
+
175
+ It is required because the client recovers through it: on a drop it publishes
176
+ `unavailable` to subscribers and forgets what was opened, and on a fresh
177
+ connection it re-opens every key that still has a listener. Without it a watch
178
+ stays "open" on the client after a server restart while the hub remembers
179
+ nothing, and the face stops updating without saying so.
180
+
181
+ ## Released migration: 0.75.0
182
+
183
+ Two mechanical renames and one option that has to move. Nothing about a passing
184
+ request changes.
185
+
186
+ ### 1. A route group's `onRequest`
187
+
188
+ ```bash
189
+ rg -n "hooks:\s*\{[^}]*onRequest" --glob '*.ts'
190
+ ```
191
+
192
+ Any match **inside a `groups: [...]` entry** must move. The hook was accepted and
193
+ never dispatched, so the behaviour you have today is "no hook"; the fix is to
194
+ decide which one you meant:
195
+
196
+ ```ts
197
+ // refuse before dispatch, for the whole server
198
+ createServer({ groups, hooks: { onRequest: gate } });
199
+
200
+ // gate this group once the endpoint is known
201
+ groups: [{ pathPrefix: '/admin', services, hooks: { authorize: gate } }]
202
+ ```
203
+
204
+ A group that still declares `onRequest` fails at startup with that message.
205
+
206
+ ### 2. The SQLite boundary type
207
+
208
+ ```bash
209
+ rg -l "AgentRuntimeSqlite(Database|Statement|Value)" | xargs sed -i \
210
+ -e 's/AgentRuntimeSqliteDatabase/SqliteDatabase/g' \
211
+ -e 's/AgentRuntimeSqliteStatement/SqliteStatement/g' \
212
+ -e 's/AgentRuntimeSqliteValue/SqliteValue/g'
213
+ ```
214
+
215
+ Type-only: the same three methods, the same structural compatibility with
216
+ `bun:sqlite` and a `node:sqlite` wrapper, imported from the same entrypoints.
217
+ `initializeAgentRuntimeSqlite` keeps its name — it really is the agent runtime's
218
+ schema.
219
+
220
+ ### 3. Nothing else
221
+
222
+ `stitchkit/live`, the watch hub, the keyspace and the trust fence are all
223
+ additive. Adopt them when you want them; the guide is
224
+ [Live data](./live.md).
225
+
12
226
  ## Released migration: 0.74.0
13
227
 
14
228
  One change, and it only reaches you if you catch a refusal the **client** raised — one it made while
@@ -957,140 +1171,3 @@ exhaustively on any of those enums, add the arm** — that is the part of this
957
1171
  release that can break a build rather than a behaviour. The record itself is
958
1172
  kept: it is excluded from the projection, not deleted, so an operator can still
959
1173
  see what was thrown away.
960
-
961
- ## Released migration: 0.61.0
962
-
963
- Three behaviour changes between versions. None moves an export — the surface is
964
- strictly additive — and all three change what a running system does, which is
965
- what this heading is for.
966
-
967
- ### A failed `start()` now drains before it rejects
968
-
969
- The rollback of a failed startup used to close every resource with a zero
970
- budget: it returned almost at once, by severing requests the server had already
971
- accepted. It now spends the application's shutdown budget, so a request already
972
- in flight is answered rather than killed.
973
-
974
- **What to check.** Nothing, if a failed startup has nothing in flight — the
975
- rollback still returns immediately. The case to think about is a request that
976
- never finishes: a hung upstream, a client ignoring a close frame, a streaming
977
- subscription. Under the default 30s grace and 5s force, a `start()` that used to
978
- reject in milliseconds can now take 35 seconds to reject.
979
-
980
- If a fast failure matters more than draining — a supervisor waiting to restart,
981
- a boot check in CI — declare a smaller budget. The same field is the default for
982
- `shutdown()` with no options, so this is one decision, not two:
983
-
984
- ```ts
985
- // before
986
- createApplication({ id: 'app', resources })
987
-
988
- // after
989
- createApplication({
990
- id: 'app',
991
- resources,
992
- shutdown: { gracePeriodMs: 5_000, forceTimeoutMs: 1_000 },
993
- })
994
- ```
995
-
996
- The budget is a real bound: a `close` that never returns is abandoned when it
997
- runs out and reported as a `close` failure, and the startup error remains the
998
- `cause` of the `AggregateError` `start()` rejects with. → ADR 0107
999
-
1000
- ### A refused realtime frame now answers its sender
1001
-
1002
- A frame that fails the receiver's `args` schema used to be dropped where it
1003
- landed. If the event carries an acknowledgement, the receiver now answers it
1004
- with a reserved envelope and the sender's `request()` rejects at once with
1005
- `RealtimeRequestRejectedError`. → ADR 0106
1006
-
1007
- **What to check before you upgrade one half of a distributed pair.** Look at the
1008
- `ack` schemas on the OLDER peer:
1009
-
1010
- ```ts
1011
- // safe: a contract-first acknowledgement refuses the envelope, so the older
1012
- // peer raises RealtimeRequestInvalidAcknowledgementError at once instead of
1013
- // waiting out its deadline. Different error, still an error, and sooner.
1014
- ack: z.object({ stored: z.boolean() })
1015
-
1016
- // NOT safe: a schema that validates nothing accepts the refusal AS A VALUE.
1017
- // The older peer reads a refusal as a successful acknowledgement — silently.
1018
- ack: z.unknown()
1019
- ack: z.looseObject({})
1020
- ```
1021
-
1022
- If any acknowledgement on the older side is permissive, tighten it before the
1023
- rollout, or upgrade both halves together.
1024
-
1025
- Also: the receiver now invokes the peer's raw acknowledgement callback for a
1026
- refused frame, including when the peer is a plain Socket.IO client. That
1027
- callback previously could not run on a refused frame and now can.
1028
-
1029
- `RealtimeRejectedEvent['reason']` gained `'rejected-by-peer'`. If you `switch`
1030
- over it exhaustively with an `assertNever` default, that stops compiling — add
1031
- the case.
1032
-
1033
- ### Two smaller behaviour changes, easy to miss
1034
-
1035
- **`streamSSE`'s `cancel` no longer awaits the generator.** Teardown is now
1036
- unordered relative to request completion. If your generator releases a resource
1037
- in `return()`/`finally` — a temp file, a pooled connection — and anything
1038
- downstream assumed that had finished by the time the response settled, it no
1039
- longer has. Release in the generator's own `finally` and do not depend on the
1040
- ordering.
1041
-
1042
- **A `socket.io-client` peer that cannot load no longer kills the process.** With
1043
- `onConnectError` configured, the failure is delivered there with
1044
- `terminal: true` instead of crashing. If your handler logs and moves on, you now
1045
- have a live process whose client will never connect, where a supervisor used to
1046
- restart it. Treat `terminal: true` as fatal if that is what you want.
1047
-
1048
- ### `reportHealth` inside `start` is no longer discarded
1049
-
1050
- Becoming ready assigned `healthy` unconditionally, throwing away whatever a
1051
- resource reported during `start`. It is now kept, and only a resource that
1052
- reported nothing is assumed healthy.
1053
-
1054
- **How to find what this touches:** grep your `start` bodies for **every**
1055
- `reportHealth` call, not only the ones reporting `degraded`. The old
1056
- unconditional assignment was also a repair — a resource that reported
1057
- `'unhealthy'` early in `start` and never corrected itself was quietly fixed up
1058
- on the way to ready.
1059
-
1060
- Two cases, and they need opposite fixes.
1061
-
1062
- **1. A resource that is genuinely expected to start degraded** — up, but still
1063
- dialling something external. `required` defaults to **`true`**, and readiness
1064
- requires every required resource to be healthy, so such a resource now refuses
1065
- the whole startup where before its report vanished. That is the invariant
1066
- working as intended; what changed is that it can be reached. Say what it is:
1067
-
1068
- ```ts
1069
- // before: started, and its report was discarded
1070
- defineManagedResource({ id: 'dialling', start: ({ reportHealth }) => reportHealth('degraded') })
1071
-
1072
- // after: says what it is, and does not gate the application
1073
- defineManagedResource({ id: 'dialling', required: false, start: ({ reportHealth }) => reportHealth('degraded') })
1074
- ```
1075
-
1076
- **2. A resource that reported `'unhealthy'` early and became healthy later** —
1077
- a pessimistic report before a connection settled. Here `required: false` is the
1078
- **wrong** fix: it would hide a real failure. Report the recovery instead:
1079
-
1080
- ```ts
1081
- start: async ({ reportHealth }) => {
1082
- reportHealth('unhealthy')
1083
- await connect()
1084
- reportHealth('healthy') // ← previously unnecessary; now it is the fix
1085
- }
1086
- ```
1087
-
1088
- **Also check your health endpoint.** An **optional** resource reporting
1089
- non-healthy during `start` now moves the application aggregate to `degraded`,
1090
- where before it stayed `healthy`. A readiness probe that maps `degraded` to a
1091
- non-200 will flip on upgrade — and a supervisor that restarts on that will loop.
1092
-
1093
- The refusals now say which of the two happened: a resource that was never
1094
- healthy is told it "is not healthy" and pointed at `required: false`; one that
1095
- was healthy and stopped is told it "lost readiness" and pointed at
1096
- `onResourceFailure`.