stitchkit 0.103.12 → 0.104.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 (225) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/darwin-native.cjs +12 -0
  3. package/darwin-native.d.cts +2 -0
  4. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
  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 +8 -6
  38. package/dist/entrypoints/agent-runtime/harness-tools.js +8 -8
  39. package/dist/entrypoints/agent-runtime/harness.js +12 -11
  40. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  41. package/dist/entrypoints/agent-runtime/sandbox.js +8 -6
  42. package/dist/entrypoints/agent-runtime.js +13 -13
  43. package/dist/entrypoints/application/diagnostic-journal.js +3 -2
  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.js +11 -107
  54. package/dist/entrypoints/index.js +7 -7
  55. package/dist/entrypoints/node.js +8 -8
  56. package/dist/entrypoints/observability.js +2 -2
  57. package/dist/entrypoints/process.js +2 -1
  58. package/dist/entrypoints/react.js +1 -1
  59. package/dist/entrypoints/remote.js +19 -6
  60. package/dist/entrypoints/server.d.ts +1 -1
  61. package/dist/entrypoints/server.d.ts.map +1 -1
  62. package/dist/entrypoints/server.js +20 -14
  63. package/dist/entrypoints/telegram.d.ts +1 -0
  64. package/dist/entrypoints/telegram.d.ts.map +1 -1
  65. package/dist/entrypoints/telegram.js +214 -98
  66. package/dist/entrypoints/testing.js +7 -7
  67. package/dist/entrypoints/tools/connections.d.ts +2 -2
  68. package/dist/entrypoints/tools/connections.d.ts.map +1 -1
  69. package/dist/entrypoints/tools/connections.js +427 -294
  70. package/dist/entrypoints/tools/invoker.js +6 -6
  71. package/dist/entrypoints/tools/mcp.d.ts +12 -0
  72. package/dist/entrypoints/tools/mcp.d.ts.map +1 -0
  73. package/dist/entrypoints/tools/mcp.js +45 -0
  74. package/dist/entrypoints/tools.d.ts +1 -0
  75. package/dist/entrypoints/tools.d.ts.map +1 -1
  76. package/dist/entrypoints/tools.js +82 -1147
  77. package/dist/entrypoints/tracking.js +1 -1
  78. package/dist/files/boundary.d.ts +2 -8
  79. package/dist/files/boundary.d.ts.map +1 -1
  80. package/dist/files/file-io.d.ts +0 -5
  81. package/dist/files/file-io.d.ts.map +1 -1
  82. package/dist/files/read.d.ts +2 -2
  83. package/dist/files/read.d.ts.map +1 -1
  84. package/dist/index-1a6jtnd9.js +88 -0
  85. package/dist/{index-fyphpknh.js → index-22rhg58f.js} +1 -1
  86. package/dist/index-269zqj8m.js +77 -0
  87. package/dist/{index-r34mvse1.js → index-27a2pj09.js} +1 -1
  88. package/dist/{index-r956rndn.js → index-2hyavjjj.js} +3 -3
  89. package/dist/{index-m2xqkv55.js → index-2vnh05w4.js} +83 -14
  90. package/dist/{index-pw99k9h5.js → index-43p08g7t.js} +1 -1
  91. package/dist/{index-xwq9j1sf.js → index-4e0ah203.js} +9 -7
  92. package/dist/{index-nybn2err.js → index-5csmzesf.js} +1 -1
  93. package/dist/{index-qapzv4p5.js → index-5z6jn897.js} +1 -1
  94. package/dist/{index-ahvsksw5.js → index-6d9xaxw1.js} +1 -1
  95. package/dist/{index-ahtnte39.js → index-6drst9sg.js} +46 -35
  96. package/dist/{index-x87j7csh.js → index-77nxk6ay.js} +2 -2
  97. package/dist/{index-dnn9z96q.js → index-a0zzh8ak.js} +3 -3
  98. package/dist/{index-kmpzj1cq.js → index-a3wma1hk.js} +1 -1
  99. package/dist/{index-j8aw2c0e.js → index-bakgedh8.js} +35 -7
  100. package/dist/index-bhb950qs.js +1145 -0
  101. package/dist/{index-tgzhq07n.js → index-cvda079a.js} +1 -1
  102. package/dist/{index-n2gre124.js → index-fa4wg312.js} +4 -4
  103. package/dist/{index-zp4jpkp0.js → index-fk18k56k.js} +2 -2
  104. package/dist/{index-afjvjyck.js → index-g2j7pnak.js} +2 -134
  105. package/dist/index-g95fk660.js +116 -0
  106. package/dist/{index-ej331hah.js → index-gxm9rc97.js} +1 -1
  107. package/dist/{index-r5c4fedv.js → index-h2fhjqy7.js} +2 -1
  108. package/dist/{index-sybedc8b.js → index-hbd32c6a.js} +23 -94
  109. package/dist/index-jd470k6q.js +109 -0
  110. package/dist/{index-b2bz0kdm.js → index-kb8styz3.js} +4 -3
  111. package/dist/{index-0c419yx7.js → index-kemm0ej5.js} +12 -9
  112. package/dist/{index-806d5phm.js → index-ptn0g0gj.js} +7 -7
  113. package/dist/{index-w575evhq.js → index-r4r70zmh.js} +1 -1
  114. package/dist/{index-12m2v2a9.js → index-s4evrmp5.js} +1 -1
  115. package/dist/{index-1khy8y7n.js → index-t1sr4aks.js} +3 -3
  116. package/dist/index-v5ee8ath.js +88 -0
  117. package/dist/{index-45tdvqa3.js → index-wh0ecvyk.js} +1 -1
  118. package/dist/{index-n53mswt3.js → index-x928baz2.js} +8 -1
  119. package/dist/index-yk4g8805.js +133 -0
  120. package/dist/{index-ygkka6zn.js → index-ywppsaby.js} +28 -5
  121. package/dist/{index-xvdd2rbb.js → index-za6j7nwy.js} +19 -5
  122. package/dist/internal/bounded-file-read.d.ts +41 -0
  123. package/dist/internal/bounded-file-read.d.ts.map +1 -0
  124. package/dist/internal/darwin-binding-error.d.ts +24 -0
  125. package/dist/internal/darwin-binding-error.d.ts.map +1 -0
  126. package/dist/internal/darwin-binding.d.ts.map +1 -1
  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/args-fields.d.ts +2 -0
  140. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  141. package/dist/tools/cli/args.d.ts.map +1 -1
  142. package/dist/tools/cli/format.d.ts.map +1 -1
  143. package/dist/tools/cli/invoke.d.ts +2 -2
  144. package/dist/tools/cli/invoke.d.ts.map +1 -1
  145. package/dist/tools/cli/publication-assets.d.ts +10 -0
  146. package/dist/tools/cli/publication-assets.d.ts.map +1 -0
  147. package/dist/tools/cli/publication-contract.d.ts +75 -0
  148. package/dist/tools/cli/publication-contract.d.ts.map +1 -0
  149. package/dist/tools/cli/publication-control.d.ts +4 -0
  150. package/dist/tools/cli/publication-control.d.ts.map +1 -0
  151. package/dist/tools/cli/publication-storage.d.ts +32 -0
  152. package/dist/tools/cli/publication-storage.d.ts.map +1 -0
  153. package/dist/tools/cli/publication.d.ts +35 -0
  154. package/dist/tools/cli/publication.d.ts.map +1 -0
  155. package/dist/tools/cli/update.d.ts.map +1 -1
  156. package/dist/tools/connections/define.d.ts.map +1 -1
  157. package/dist/tools/connections/error-projection.d.ts +4 -0
  158. package/dist/tools/connections/error-projection.d.ts.map +1 -0
  159. package/dist/tools/connections/errors.d.ts +24 -8
  160. package/dist/tools/connections/errors.d.ts.map +1 -1
  161. package/dist/tools/connections/limits.d.ts +11 -31
  162. package/dist/tools/connections/limits.d.ts.map +1 -1
  163. package/dist/tools/connections/mcp-client.d.ts +6 -4
  164. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  165. package/dist/tools/connections/mcp.d.ts.map +1 -1
  166. package/dist/tools/connections/openapi.d.ts.map +1 -1
  167. package/dist/tools/connections/operation-limits.d.ts +25 -0
  168. package/dist/tools/connections/operation-limits.d.ts.map +1 -0
  169. package/dist/tools/connections/sse-frames.d.ts +11 -2
  170. package/dist/tools/connections/sse-frames.d.ts.map +1 -1
  171. package/dist/tools/connections/sse-session.d.ts +15 -2
  172. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  173. package/dist/tools/connections/types.d.ts +19 -1
  174. package/dist/tools/connections/types.d.ts.map +1 -1
  175. package/dist/tools/execute-result.d.ts.map +1 -1
  176. package/dist/tools/execute.d.ts.map +1 -1
  177. package/dist/tools/internal/observe-hook.d.ts +3 -0
  178. package/dist/tools/internal/observe-hook.d.ts.map +1 -0
  179. package/dist/tools/internal/surface-projector.d.ts +2 -1
  180. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  181. package/dist/tools/mcp/mount.d.ts +2 -2
  182. package/dist/tools/mcp/mount.d.ts.map +1 -1
  183. package/dist/tools/mcp/prepare.d.ts +4 -5
  184. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  185. package/dist/tools/mcp/register.d.ts +4 -1
  186. package/dist/tools/mcp/register.d.ts.map +1 -1
  187. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  188. package/dist/tools/remote.d.ts.map +1 -1
  189. package/dist/tools/runtime-tool-execution.d.ts +65 -0
  190. package/dist/tools/runtime-tool-execution.d.ts.map +1 -0
  191. package/dist/tools/runtime-tool-mcp.d.ts +27 -0
  192. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -0
  193. package/dist/tools/runtime-tool.d.ts +9 -60
  194. package/dist/tools/runtime-tool.d.ts.map +1 -1
  195. package/dist/tools/surface.d.ts +12 -14
  196. package/dist/tools/surface.d.ts.map +1 -1
  197. package/llms/application.2.txt +221 -44
  198. package/llms/application.3.txt +3 -1
  199. package/llms/application.txt +1 -1
  200. package/llms/cli.2.txt +144 -1
  201. package/llms/cli.txt +133 -104
  202. package/llms/contract.txt +1 -1
  203. package/llms/process.txt +34 -5
  204. package/llms/server.4.txt +4 -1
  205. package/llms/server.5.txt +1 -0
  206. package/llms/stitchkit.2.txt +14 -0
  207. package/llms/stitchkit.txt +5 -4
  208. package/llms/telegram.txt +64 -2
  209. package/llms/tools-connections.txt +3 -0
  210. package/llms/tools-mcp.txt +29 -0
  211. package/llms/tools.2.txt +59 -0
  212. package/llms/tools.3.txt +1 -0
  213. package/llms/tools.txt +11 -52
  214. package/llms/upgrading-0.37.0-0.44.0.txt +444 -0
  215. package/llms/{upgrading-0.44.0-0.60.0.txt → upgrading-0.44.0-0.61.0.txt} +140 -271
  216. package/llms/{upgrading-0.61.0-0.74.0.txt → upgrading-0.62.0-0.79.0.txt} +171 -140
  217. package/llms/{upgrading-0.75.0-0.103.0.txt → upgrading-0.80.0-0.104.0.txt} +120 -171
  218. package/llms/upgrading.txt +4 -4
  219. package/llms-full.txt +677 -64
  220. package/llms.txt +13 -12
  221. package/package.json +10 -1
  222. package/dist/index-d4pa2bgs.js +0 -42
  223. package/dist/index-wykebpn9.js +0 -221
  224. package/llms/upgrading-0.37.0.txt +0 -176
  225. package/dist/{index-69nvze1q.js → index-pptyv13k.js} +3 -3
package/llms.txt CHANGED
@@ -9,19 +9,20 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
9
9
  Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
10
10
 
11
11
  ## Entrypoint slices
12
- - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 17.2 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 45.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 17.1 KB
12
+ - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 17.4 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 46.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 17.1 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.6 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 9.0 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.4 KB
16
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 47.4 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.5 KB
16
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 46.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 29.5 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.7 KB
17
+ - **stitchkit/tools/mcp**: [llms/tools-mcp.txt](llms/tools-mcp.txt) 1.8 KB
17
18
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
18
19
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
19
- - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.1 KB
20
- - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 43.6 KB → [llms/cli.2.txt](llms/cli.2.txt) 8.1 KB
20
+ - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.7 KB
21
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 46.1 KB → [llms/cli.2.txt](llms/cli.2.txt) 15.8 KB
21
22
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
22
23
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.9 KB
23
24
  - **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 11.2 KB
24
- - **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt) 45.6 KB → [llms/server.4.txt](llms/server.4.txt) 38.1 KB → [llms/server.5.txt](llms/server.5.txt) 21.8 KB
25
+ - **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt) 45.6 KB → [llms/server.4.txt](llms/server.4.txt) 38.3 KB → [llms/server.5.txt](llms/server.5.txt) 22.0 KB
25
26
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 44.8 KB
26
27
  - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 37.2 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 46.7 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 34.3 KB
27
28
  - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
@@ -31,7 +32,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
31
32
  - **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 1.1 KB
32
33
  - **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.8 KB
33
34
  - **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.7 KB
34
- - **stitchkit/application**: [llms/application.txt](llms/application.txt) 37.9 KB → [llms/application.2.txt](llms/application.2.txt) 24.1 KB → [llms/application.3.txt](llms/application.3.txt) 27.3 KB
35
+ - **stitchkit/application**: [llms/application.txt](llms/application.txt) 37.9 KB → [llms/application.2.txt](llms/application.2.txt) 31.0 KB → [llms/application.3.txt](llms/application.3.txt) 27.8 KB
35
36
  - **stitchkit/application/grammy**: [llms/application-grammy.txt](llms/application-grammy.txt) 2.3 KB
36
37
  - **stitchkit/application/opentelemetry**: [llms/application-opentelemetry.txt](llms/application-opentelemetry.txt) 1.6 KB
37
38
  - **stitchkit/application/directory-inbox**: [llms/application-directory-inbox.txt](llms/application-directory-inbox.txt) 0.3 KB
@@ -40,7 +41,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
40
41
  - **stitchkit/testing**: [llms/testing.txt](llms/testing.txt) 30.8 KB
41
42
  - **stitchkit/agent-runtime/sandbox**: [llms/agent-runtime-sandbox.txt](llms/agent-runtime-sandbox.txt) 8.3 KB
42
43
  - **stitchkit/files**: [llms/files.txt](llms/files.txt) 4.5 KB
43
- - **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 26.9 KB
44
+ - **stitchkit/telegram**: [llms/telegram.txt](llms/telegram.txt) 30.1 KB
44
45
  - **stitchkit/telegram/html**: [llms/telegram-html.txt](llms/telegram-html.txt) 2.7 KB
45
46
  - **stitchkit/telegram/screens**: [llms/telegram-screens.txt](llms/telegram-screens.txt) 21.2 KB
46
47
  - **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt) 16.8 KB
@@ -55,14 +56,14 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
55
56
  - **stitchkit/agent-runtime/react**: [llms/agent-runtime-react.txt](llms/agent-runtime-react.txt) 1.0 KB
56
57
  - **stitchkit/agent-runtime/realtime**: [llms/agent-runtime-realtime.txt](llms/agent-runtime-realtime.txt) 1.8 KB
57
58
  - **stitchkit/agent-runtime/harness-tools**: [llms/agent-runtime-harness-tools.txt](llms/agent-runtime-harness-tools.txt) 1.3 KB
58
- - **stitchkit/process**: [llms/process.txt](llms/process.txt) 20.0 KB
59
+ - **stitchkit/process**: [llms/process.txt](llms/process.txt) 21.7 KB
59
60
 
60
61
  ## Upgrading slices
61
62
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 10.3 KB
62
- - **Upgrading 0.75.0 → 0.103.0**: [llms/upgrading-0.75.0-0.103.0.txt](llms/upgrading-0.75.0-0.103.0.txt) 46.3 KB
63
- - **Upgrading 0.61.0 → 0.74.0**: [llms/upgrading-0.61.0-0.74.0.txt](llms/upgrading-0.61.0-0.74.0.txt) 43.5 KB
64
- - **Upgrading 0.44.0 → 0.60.0**: [llms/upgrading-0.44.0-0.60.0.txt](llms/upgrading-0.44.0-0.60.0.txt) 43.9 KB
65
- - **Upgrading 0.37.0 → 0.37.0**: [llms/upgrading-0.37.0.txt](llms/upgrading-0.37.0.txt) 6.2 KB
63
+ - **Upgrading 0.80.0 → 0.104.0**: [llms/upgrading-0.80.0-0.104.0.txt](llms/upgrading-0.80.0-0.104.0.txt) 46.7 KB
64
+ - **Upgrading 0.62.0 → 0.79.0**: [llms/upgrading-0.62.0-0.79.0.txt](llms/upgrading-0.62.0-0.79.0.txt) 43.7 KB
65
+ - **Upgrading 0.44.0 → 0.61.0**: [llms/upgrading-0.44.0-0.61.0.txt](llms/upgrading-0.44.0-0.61.0.txt) 41.4 KB
66
+ - **Upgrading 0.37.0 → 0.44.0**: [llms/upgrading-0.37.0-0.44.0.txt](llms/upgrading-0.37.0-0.44.0.txt) 14.7 KB
66
67
 
67
68
  ## Guide (web)
68
69
  - [Getting started](https://github.com/max-listov/stitchkit/blob/master/docs/guide/getting-started.md): install, entrypoints, and a first contract → server → client app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.103.12",
3
+ "version": "0.104.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",
@@ -42,6 +42,8 @@
42
42
  "files": [
43
43
  "dist",
44
44
  "native/*.node",
45
+ "darwin-native.cjs",
46
+ "darwin-native.d.cts",
45
47
  "llms.txt",
46
48
  "llms-full.txt",
47
49
  "llms",
@@ -49,6 +51,9 @@
49
51
  "CHANGELOG.md",
50
52
  "LICENSE"
51
53
  ],
54
+ "imports": {
55
+ "#stitchkit-darwin-native": "./darwin-native.cjs"
56
+ },
52
57
  "exports": {
53
58
  ".": {
54
59
  "types": "./dist/entrypoints/index.d.ts",
@@ -70,6 +75,10 @@
70
75
  "types": "./dist/entrypoints/tools.d.ts",
71
76
  "import": "./dist/entrypoints/tools.js"
72
77
  },
78
+ "./tools/mcp": {
79
+ "types": "./dist/entrypoints/tools/mcp.d.ts",
80
+ "import": "./dist/entrypoints/tools/mcp.js"
81
+ },
73
82
  "./tools/contract": {
74
83
  "types": "./dist/entrypoints/tools/contract.d.ts",
75
84
  "import": "./dist/entrypoints/tools/contract.js"
@@ -1,42 +0,0 @@
1
- // src/internal/darwin-binding.ts
2
- import { existsSync } from "node:fs";
3
- import { createRequire } from "node:module";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- function hasFunctions(value, names) {
7
- return typeof value === "object" && value !== null && names.every((name) => typeof Reflect.get(value, name) === "function");
8
- }
9
- var darwinBinding;
10
- function loadDarwinBinding() {
11
- if (darwinBinding)
12
- return darwinBinding;
13
- const directory = path.dirname(fileURLToPath(import.meta.url));
14
- const binary = `darwin-${process.arch}.node`;
15
- const candidates = [
16
- path.resolve(directory, "../native", binary),
17
- path.resolve(directory, "../../native", binary)
18
- ];
19
- const selected = candidates.find((candidate) => existsSync(candidate));
20
- if (!selected) {
21
- throw new Error(`Contained filesystem operations need the packaged Darwin ${process.arch} backend`);
22
- }
23
- const loaded = createRequire(import.meta.url)(selected);
24
- const methods = [
25
- "openDirectoryAt",
26
- "openFileAt",
27
- "createFileAt",
28
- "createDirectoryAt",
29
- "statAt",
30
- "listAt",
31
- "renameAt",
32
- "unlinkAt",
33
- "processIdentity"
34
- ];
35
- if (!hasFunctions(loaded, methods)) {
36
- throw new Error("The packaged Darwin contained-files backend has an invalid surface");
37
- }
38
- darwinBinding = loaded;
39
- return darwinBinding;
40
- }
41
-
42
- export { loadDarwinBinding };
@@ -1,221 +0,0 @@
1
- import {
2
- isRecord
3
- } from "./index-9jfdm5tg.js";
4
-
5
- // src/application/file-state-store.ts
6
- import { mkdir, open, readdir, readFile, rename, stat, unlink } from "node:fs/promises";
7
- import { basename, dirname, join } from "node:path";
8
- var ABANDONED_LOCK_MULTIPLIER = 10;
9
- var ABANDONED_HEARTBEATS = 30;
10
- var MIN_HEARTBEAT_MS = 10;
11
- var delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
12
- async function missing(error) {
13
- return error instanceof Error && "code" in error && error.code === "ENOENT";
14
- }
15
- function existing(error) {
16
- return error instanceof Error && "code" in error && error.code === "EEXIST";
17
- }
18
- async function ownerState(lockPath) {
19
- let owner;
20
- try {
21
- owner = JSON.parse(await readFile(lockPath, "utf8"));
22
- } catch {
23
- return "unknown";
24
- }
25
- if (typeof owner !== "object" || owner === null || !("pid" in owner) || typeof owner.pid !== "number" || !Number.isSafeInteger(owner.pid) || owner.pid <= 0) {
26
- return "unknown";
27
- }
28
- try {
29
- process.kill(owner.pid, 0);
30
- return "alive";
31
- } catch (error) {
32
- return error instanceof Error && "code" in error && error.code === "ESRCH" ? "gone" : "unknown";
33
- }
34
- }
35
- async function sweepTemporaries(path, staleLockMs) {
36
- const prefix = `${basename(path)}.tmp.`;
37
- const directory = dirname(path);
38
- let entries;
39
- try {
40
- entries = await readdir(directory);
41
- } catch {
42
- return;
43
- }
44
- for (const entry of entries) {
45
- if (!entry.startsWith(prefix))
46
- continue;
47
- const candidate = join(directory, entry);
48
- const info = await stat(candidate).catch(() => null);
49
- if (info && Date.now() - info.mtimeMs > staleLockMs) {
50
- await unlink(candidate).catch(() => {
51
- return;
52
- });
53
- }
54
- }
55
- }
56
- async function reclaim(lockPath, observed, staleLockMs, abandonedAfterMs) {
57
- const guardPath = `${lockPath}.reclaim`;
58
- let guard;
59
- try {
60
- guard = await open(guardPath, "wx");
61
- } catch (error) {
62
- if (!existing(error))
63
- throw error;
64
- const orphan = await stat(guardPath).catch(() => null);
65
- if (orphan && Date.now() - orphan.mtimeMs > staleLockMs) {
66
- await unlink(guardPath).catch(() => {
67
- return;
68
- });
69
- }
70
- return false;
71
- }
72
- try {
73
- const current = await stat(lockPath).catch(() => null);
74
- if (!current || current.dev !== observed.dev || current.ino !== observed.ino || current.mtimeMs !== observed.mtimeMs) {
75
- return false;
76
- }
77
- const owner = await ownerState(lockPath);
78
- const age = Date.now() - current.mtimeMs;
79
- if (owner !== "gone" && age < abandonedAfterMs)
80
- return false;
81
- await unlink(lockPath);
82
- return true;
83
- } finally {
84
- await guard.close().catch(() => {
85
- return;
86
- });
87
- await unlink(guardPath).catch(() => {
88
- return;
89
- });
90
- }
91
- }
92
- function createFileStateStore2(path, options) {
93
- const lockPath = `${path}.lock`;
94
- const lockTimeoutMs = options.lockTimeoutMs ?? 1e4;
95
- const staleLockMs = options.staleLockMs ?? 3000;
96
- const retryMs = options.retryMs ?? 10;
97
- const heartbeatMs = Math.max(MIN_HEARTBEAT_MS, Math.floor(staleLockMs / 3));
98
- const abandonedAfterMs = Math.max(staleLockMs * ABANDONED_LOCK_MULTIPLIER, heartbeatMs * ABANDONED_HEARTBEATS);
99
- if (staleLockMs >= lockTimeoutMs) {
100
- throw new Error(`[stitchkit] createFileStateStore: staleLockMs (${staleLockMs}) must be below lockTimeoutMs (${lockTimeoutMs}), or a crashed holder blocks every update until the timeout`);
101
- }
102
- let sweptTemporaries = false;
103
- const parseFile = async () => {
104
- let source;
105
- try {
106
- source = await readFile(path, "utf8");
107
- } catch (error) {
108
- if (await missing(error))
109
- return null;
110
- throw error;
111
- }
112
- try {
113
- return options.schema.parse(JSON.parse(source));
114
- } catch (error) {
115
- await options.onCorrupt?.({ path, error });
116
- if ((options.corrupt ?? "throw") === "empty")
117
- return null;
118
- throw error;
119
- }
120
- };
121
- const acquire = async () => {
122
- await mkdir(dirname(path), { recursive: true });
123
- if (!sweptTemporaries) {
124
- sweptTemporaries = true;
125
- await sweepTemporaries(path, staleLockMs);
126
- }
127
- const deadline = Date.now() + lockTimeoutMs;
128
- while (true) {
129
- try {
130
- const handle = await open(lockPath, "wx");
131
- const token = crypto.randomUUID();
132
- try {
133
- await handle.writeFile(JSON.stringify({ token, pid: process.pid, acquiredAt: Date.now() }));
134
- await handle.sync();
135
- } catch (error) {
136
- await handle.close().catch(() => {
137
- return;
138
- });
139
- await unlink(lockPath).catch(() => {
140
- return;
141
- });
142
- throw error;
143
- }
144
- return {
145
- refresh: async () => {
146
- const now = new Date;
147
- await handle.utimes(now, now);
148
- },
149
- release: async () => {
150
- await handle.close();
151
- try {
152
- const owner = JSON.parse(await readFile(lockPath, "utf8"));
153
- if (isRecord(owner) && owner.token === token)
154
- await unlink(lockPath);
155
- } catch (error) {
156
- if (!await missing(error))
157
- throw error;
158
- }
159
- }
160
- };
161
- } catch (error) {
162
- if (!existing(error))
163
- throw error;
164
- try {
165
- const lock = await stat(lockPath);
166
- if (Date.now() - lock.mtimeMs > staleLockMs) {
167
- if (await reclaim(lockPath, lock, staleLockMs, abandonedAfterMs))
168
- continue;
169
- }
170
- } catch (statError) {
171
- if (await missing(statError))
172
- continue;
173
- throw statError;
174
- }
175
- if (Date.now() >= deadline) {
176
- throw new Error(`[stitchkit] timed out acquiring state lock for ${path}`);
177
- }
178
- await delay(retryMs);
179
- }
180
- }
181
- };
182
- const write = async (state) => {
183
- const validated = options.schema.parse(state);
184
- const temporary = `${path}.tmp.${process.pid}.${crypto.randomUUID()}`;
185
- const handle = await open(temporary, "wx");
186
- try {
187
- try {
188
- await handle.writeFile(`${JSON.stringify(validated)}
189
- `);
190
- await handle.sync();
191
- } finally {
192
- await handle.close();
193
- }
194
- await rename(temporary, path);
195
- } catch (error) {
196
- await unlink(temporary).catch(() => {
197
- return;
198
- });
199
- throw error;
200
- }
201
- };
202
- return {
203
- read: parseFile,
204
- async update(transition) {
205
- const lock = await acquire();
206
- const heartbeat = setInterval(() => void lock.refresh().catch(() => {
207
- return;
208
- }), heartbeatMs);
209
- try {
210
- const next = await transition(await parseFile());
211
- await write(next.state);
212
- return next.result;
213
- } finally {
214
- clearInterval(heartbeat);
215
- await lock.release();
216
- }
217
- }
218
- };
219
- }
220
-
221
- export { createFileStateStore2 };
@@ -1,176 +0,0 @@
1
- # Upgrading 0.37.0 → 0.37.0 — stitchkit docs slice
2
-
3
- > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
- > `llms.txt` in this package.
5
-
6
- Contains: Guide: Upgrading, 0.37.0 → 0.37.0 (docs/guide/upgrading.md)
7
-
8
- ==============================================================================
9
- # Guide: Upgrading, 0.37.0 → 0.37.0 (docs/guide/upgrading.md)
10
- ==============================================================================
11
-
12
- ## The 0.37 migration
13
-
14
- Tool presentation is no longer an executable Zod parser. Replace the removed
15
- flatten helpers with the JSON Schema compiler, and choose the explicit
16
- `MountableTool` surface when using the advanced collection API:
17
-
18
- ```ts
19
- // before
20
- const flat = flattenUnionsDeep(zodSchema)
21
- mountable.schema
22
-
23
- // after
24
- const flat = flattenToolJsonSchema(
25
- z.toJSONSchema(zodSchema, { target: 'draft-07', io: 'input' }),
26
- )
27
- mountable.presentationSchema // model/MCP/manifest JSON Schema
28
- mountable.argumentSchema // executable CLI argument adapter only
29
- ```
30
-
31
- Contract and native handlers keep their original Zod schemas; MCP and agent SDK
32
- adapters now forward raw arguments so defaults, coercions, refinements and
33
- transforms execute exactly once inside Stitchkit. There are no compatibility
34
- exports for `flattenDiscriminatedUnion`, `flattenUnionsDeep` or
35
- `MountableTool.schema`. → ADR 0050
36
-
37
- Tool-call hooks now take one options object. Migrate all three callbacks; there
38
- are no positional overloads:
39
-
40
- ```ts
41
- // before
42
- beforeToolCall: (toolName, args, context, endpoint) => {}
43
- afterToolCall: (toolName, args, result, durationMs, context, endpoint, error) => {}
44
- onToolError: (toolName, error, context, endpoint) => {}
45
-
46
- // after
47
- beforeToolCall: ({ toolName, args, context, endpoint }) => {}
48
- afterToolCall: ({ toolName, args, result, durationMs, context, endpoint, error }) => {}
49
- onToolError: ({ toolName, error, context, endpoint }) => {}
50
- ```
51
-
52
- ### MCP schema validation
53
-
54
- The standalone validator now takes one object and live MCP configs carry the
55
- same rules under `schemaValidation`. Migrate every positional call and every
56
- `onIncompatibleSchema` field; there is no old-shape overload:
57
-
58
- ```ts
59
- // before
60
- validateMcpSchemas(services, 'throw', logger, { requireTypedProperties: true })
61
- createMcpHandler({ services, onIncompatibleSchema: 'throw' })
62
-
63
- // after
64
- validateMcpSchemas({ services, policy: 'throw', logger, requireTypedProperties: true })
65
- createMcpHandler({ services, schemaValidation: { policy: 'throw' } })
66
- ```
67
-
68
- Put `extend` and `flattenUnionInput` beside `services`, not inside
69
- `schemaValidation`. The handler applies the profile to the exact prepared schema
70
- it advertises. Add `requirePortableFormats: true` when every custom JSON Schema
71
- format must be rejected before a client sees it.
72
-
73
- Native MCP registration also changed shape in 0.37. Move protected tools to the
74
- framework registrar; keep an SDK-raw tool only by naming the opt-out:
75
-
76
- ```ts
77
- // before
78
- nativeTools: (server, auth) => server.registerTool(name, config, handler)
79
-
80
- // after — lifecycle, hooks and schema policy apply
81
- nativeTools: ({ registerTool }, auth) => registerTool({
82
- name, description, identity, input, output, handler,
83
- })
84
-
85
- // after — intentionally raw
86
- nativeTools: ({ rawServer }, auth) => rawServer.registerTool(name, config, handler)
87
- ```
88
-
89
- If a tool hook annotated `endpoint` as `MethodDef`, remove that annotation or
90
- use `OperationIdentity`: native operations have service/action/scope/method but
91
- no HTTP path.
92
-
93
- ### Node-facing server types
94
-
95
- `stitchkit/server` remains Bun-concrete: an explicitly annotated `RawRoute`
96
- still receives `BunServer`. `stitchkit/node` no longer drags Bun declarations
97
- into a Node project. Its raw routes default the host server to `unknown`, and
98
- its Socket.IO handle exposes only Node capabilities:
99
-
100
- ```ts
101
- // before — Node entry still leaked Bun-only fields and ambient types
102
- const route: RawRoute = { handler: (_req, ctx) => ctx.server?.upgrade(...) }
103
- const socket = await createSocketIOServer(config)
104
- socket.websocket
105
-
106
- // after — name a custom embedding host only when one exists
107
- const route: RawRoute<MyHostServer> = {
108
- handler: (_req, ctx) => useHost(ctx.server),
109
- }
110
- const socket = await createSocketIOServer(config)
111
- socket.io
112
- socket.attach(nodeHttpServer)
113
- ```
114
-
115
- Node consumers can remove `@types/bun` unless another dependency independently
116
- requires it.
117
-
118
- ### Managed server shutdown
119
-
120
- `createServer()` and `serveNode()` now return the same structural managed
121
- lifecycle. Replace every direct runtime stop and parallel Socket.IO close:
122
-
123
- ```ts
124
- // before — split ownership
125
- const socket = await createSocketIOServer(config)
126
- const server = createServer({
127
- services,
128
- websocket: socket.websocket,
129
- rawRoutes: [socket.route],
130
- })
131
- server.stop()
132
- await socket.io.close()
133
-
134
- // after — one owner and one total deadline
135
- const socket = await createSocketIOServer(config)
136
- const server = createServer({ services, socket })
137
- const result = await server.shutdown({ gracePeriodMs: 30_000 })
138
- ```
139
-
140
- On Node, keep the same `socket` field and replace `handle.close()` with
141
- `handle.shutdown()`. Runtime-specific diagnostics move under `handle.runtime`;
142
- do not use it as a second shutdown path. Standalone CLI/tools that create a
143
- Socket.IO handle without an HTTP server call `await socket.close()`.
144
-
145
- If Bun Socket.IO shares the port with a raw lane, keep the explicit composition
146
- but let the server mount the Socket.IO route:
147
-
148
- ```ts
149
- createServer({
150
- services,
151
- socket,
152
- websocket: composeWebSocketHandlers([
153
- webSocketLane({ match: isRaw, handlers: rawHandlers }),
154
- socketIoLane(socket.websocket),
155
- ]),
156
- rawRoutes: [rawUpgradeRoute],
157
- })
158
- ```
159
-
160
- Move native Bun `routes` entries to `rawRoutes`. Native routes run before the
161
- Fetch handler and therefore cannot participate in admission or drain. Wire
162
- `SIGTERM`/`SIGINT` in the application; the first signal starts `shutdown()`, and
163
- a later signal may abort the same controller. Close MCP, databases and queues
164
- after the server result—those resources remain application-owned.
165
-
166
- Move a handshake policy from the Node-only callback shape inside
167
- `serverOptions` to the runtime-neutral top-level policy. It receives a Web
168
- `Request`, may be async, and returns whether to admit the handshake:
169
-
170
- ```ts
171
- // before
172
- serverOptions: { allowRequest: (request, done) => done(null, allowed(request)) }
173
-
174
- // after
175
- allowRequest: (request) => allowed(request)
176
- ```
@@ -1,9 +1,9 @@
1
- import {
2
- isJsonData
3
- } from "./index-fm1c1a08.js";
4
1
  import {
5
2
  raceAbort
6
3
  } from "./index-mbnnw3f2.js";
4
+ import {
5
+ isJsonData
6
+ } from "./index-fm1c1a08.js";
7
7
 
8
8
  // src/durability/contract.ts
9
9
  import { z } from "zod";