stitchkit 0.104.2 → 0.105.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 (430) hide show
  1. package/CHANGELOG.md +401 -13
  2. package/darwin-native.cjs +4 -2
  3. package/dist/agent-runtime/browser-control-contract.d.ts +32 -2
  4. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
  5. package/dist/agent-runtime/browser-controller.d.ts +21 -3
  6. package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
  7. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  8. package/dist/agent-runtime/coding-tool-refusals.d.ts +1 -0
  9. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  10. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  11. package/dist/agent-runtime/compaction.d.ts.map +1 -1
  12. package/dist/agent-runtime/contained-write.d.ts.map +1 -1
  13. package/dist/agent-runtime/control-schema.d.ts +48 -1
  14. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  15. package/dist/agent-runtime/deferred-tool-search.d.ts +3 -2
  16. package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -1
  17. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  18. package/dist/agent-runtime/harness-realtime.d.ts +34 -4
  19. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
  20. package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -1
  21. package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
  22. package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
  23. package/dist/agent-runtime/sandbox-process-owner.d.ts +9 -1
  24. package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
  25. package/dist/agent-runtime/sandbox.d.ts +32 -1
  26. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  27. package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
  28. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  29. package/dist/agent-runtime/store-events.d.ts +9 -4
  30. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  31. package/dist/agent-runtime/testing.d.ts.map +1 -1
  32. package/dist/application/diagnostic-journal-contract.d.ts +50 -0
  33. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  34. package/dist/application/diagnostic-journal-generations.d.ts +24 -0
  35. package/dist/application/diagnostic-journal-generations.d.ts.map +1 -0
  36. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  37. package/dist/application/diagnostic-journal-open.d.ts +10 -0
  38. package/dist/application/diagnostic-journal-open.d.ts.map +1 -0
  39. package/dist/application/diagnostic-journal-quarantine.d.ts +28 -0
  40. package/dist/application/diagnostic-journal-quarantine.d.ts.map +1 -0
  41. package/dist/application/diagnostic-journal-read-contract.d.ts +73 -3
  42. package/dist/application/diagnostic-journal-read-contract.d.ts.map +1 -1
  43. package/dist/application/diagnostic-journal-reader.d.ts +17 -2
  44. package/dist/application/diagnostic-journal-reader.d.ts.map +1 -1
  45. package/dist/application/diagnostic-journal-recovery.d.ts +18 -2
  46. package/dist/application/diagnostic-journal-recovery.d.ts.map +1 -1
  47. package/dist/application/diagnostic-journal-storage.d.ts +6 -2
  48. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  49. package/dist/application/diagnostic-journal-tail.d.ts +12 -0
  50. package/dist/application/diagnostic-journal-tail.d.ts.map +1 -0
  51. package/dist/application/diagnostic-journal.d.ts +3 -0
  52. package/dist/application/diagnostic-journal.d.ts.map +1 -1
  53. package/dist/application/directory-inbox-accept.d.ts +3 -3
  54. package/dist/application/directory-inbox-accept.d.ts.map +1 -1
  55. package/dist/application/directory-inbox-contract.d.ts +38 -10
  56. package/dist/application/directory-inbox-contract.d.ts.map +1 -1
  57. package/dist/application/directory-inbox-delivery.d.ts +3 -3
  58. package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
  59. package/dist/application/directory-inbox-files.d.ts +17 -2
  60. package/dist/application/directory-inbox-files.d.ts.map +1 -1
  61. package/dist/application/directory-inbox-state.d.ts +1 -1
  62. package/dist/application/directory-inbox-state.d.ts.map +1 -1
  63. package/dist/application/directory-inbox.d.ts +1 -1
  64. package/dist/application/directory-inbox.d.ts.map +1 -1
  65. package/dist/application/file-state-store.d.ts +21 -1
  66. package/dist/application/file-state-store.d.ts.map +1 -1
  67. package/dist/application/grammy.d.ts.map +1 -1
  68. package/dist/application/kernel-contract.d.ts.map +1 -1
  69. package/dist/application/revision-signal.d.ts.map +1 -1
  70. package/dist/application/state-store.d.ts +3 -0
  71. package/dist/application/state-store.d.ts.map +1 -1
  72. package/dist/browser/api-error.d.ts +38 -0
  73. package/dist/browser/api-error.d.ts.map +1 -0
  74. package/dist/browser/chunked-upload.d.ts.map +1 -1
  75. package/dist/browser/client-executors.d.ts.map +1 -1
  76. package/dist/browser/client-url.d.ts.map +1 -1
  77. package/dist/browser/contract-stream.d.ts.map +1 -1
  78. package/dist/browser/http.d.ts +0 -25
  79. package/dist/browser/http.d.ts.map +1 -1
  80. package/dist/browser/resumable.d.ts.map +1 -1
  81. package/dist/contract/define-validation.d.ts +0 -1
  82. package/dist/contract/define-validation.d.ts.map +1 -1
  83. package/dist/contract/define.d.ts.map +1 -1
  84. package/dist/contract/errors-factory.d.ts.map +1 -1
  85. package/dist/contract/errors.d.ts +15 -18
  86. package/dist/contract/errors.d.ts.map +1 -1
  87. package/dist/contract/normalize.d.ts.map +1 -1
  88. package/dist/durability/effect.d.ts.map +1 -1
  89. package/dist/durability/scheduler.d.ts.map +1 -1
  90. package/dist/entrypoints/agent-runtime/browser.js +29 -18
  91. package/dist/entrypoints/agent-runtime/coding-tools.js +8 -7
  92. package/dist/entrypoints/agent-runtime/harness.js +15 -14
  93. package/dist/entrypoints/agent-runtime/realtime.d.ts +1 -1
  94. package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -1
  95. package/dist/entrypoints/agent-runtime/realtime.js +119 -54
  96. package/dist/entrypoints/agent-runtime/sandbox.js +23 -17
  97. package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -3
  98. package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -3
  99. package/dist/entrypoints/agent-runtime/testing.js +8 -6
  100. package/dist/entrypoints/agent-runtime.js +37 -38
  101. package/dist/entrypoints/application/diagnostic-journal.js +305 -111
  102. package/dist/entrypoints/application/directory-inbox.js +174 -77
  103. package/dist/entrypoints/application/grammy.js +5 -2
  104. package/dist/entrypoints/application/opentelemetry.js +2 -2
  105. package/dist/entrypoints/application.d.ts +2 -2
  106. package/dist/entrypoints/application.d.ts.map +1 -1
  107. package/dist/entrypoints/application.js +17 -8
  108. package/dist/entrypoints/cli/publish.d.ts +16 -0
  109. package/dist/entrypoints/cli/publish.d.ts.map +1 -0
  110. package/dist/entrypoints/cli/publish.js +527 -0
  111. package/dist/entrypoints/cli.d.ts +1 -2
  112. package/dist/entrypoints/cli.d.ts.map +1 -1
  113. package/dist/entrypoints/cli.js +59 -966
  114. package/dist/entrypoints/contract.js +3 -3
  115. package/dist/entrypoints/files/packaging.js +161 -66
  116. package/dist/entrypoints/files.d.ts +1 -0
  117. package/dist/entrypoints/files.d.ts.map +1 -1
  118. package/dist/entrypoints/files.js +17 -10
  119. package/dist/entrypoints/index.d.ts +2 -1
  120. package/dist/entrypoints/index.d.ts.map +1 -1
  121. package/dist/entrypoints/index.js +31 -60
  122. package/dist/entrypoints/node.js +8 -8
  123. package/dist/entrypoints/observability.js +3 -3
  124. package/dist/entrypoints/primitives.js +67 -83
  125. package/dist/entrypoints/process.d.ts +1 -1
  126. package/dist/entrypoints/process.d.ts.map +1 -1
  127. package/dist/entrypoints/process.js +2 -2
  128. package/dist/entrypoints/react.js +4 -2
  129. package/dist/entrypoints/remote.js +37 -13
  130. package/dist/entrypoints/server.js +18 -16
  131. package/dist/entrypoints/telegram/screens.js +5 -3
  132. package/dist/entrypoints/telegram.js +31 -46
  133. package/dist/entrypoints/testing.d.ts +1 -1
  134. package/dist/entrypoints/testing.d.ts.map +1 -1
  135. package/dist/entrypoints/testing.js +444 -448
  136. package/dist/entrypoints/tools/connections.js +268 -105
  137. package/dist/entrypoints/tools/contract.js +2 -2
  138. package/dist/entrypoints/tools/invoker.js +8 -7
  139. package/dist/entrypoints/tools/mcp.d.ts +2 -2
  140. package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
  141. package/dist/entrypoints/tools/mcp.js +10 -9
  142. package/dist/entrypoints/tools.d.ts +0 -1
  143. package/dist/entrypoints/tools.d.ts.map +1 -1
  144. package/dist/entrypoints/tools.js +118 -53
  145. package/dist/entrypoints/tracking.js +2 -3
  146. package/dist/files/boundary.d.ts +2 -2
  147. package/dist/files/boundary.d.ts.map +1 -1
  148. package/dist/files/chunk-spool.d.ts.map +1 -1
  149. package/dist/files/file-io.d.ts +2 -2
  150. package/dist/files/file-io.d.ts.map +1 -1
  151. package/dist/files/native-packaging-layout.d.ts +50 -4
  152. package/dist/files/native-packaging-layout.d.ts.map +1 -1
  153. package/dist/files/native-packaging.d.ts +78 -17
  154. package/dist/files/native-packaging.d.ts.map +1 -1
  155. package/dist/{index-r5hsgkz5.js → index-0gs4ymfj.js} +6 -3
  156. package/dist/{index-zax7resm.js → index-0gxvns6s.js} +1 -13
  157. package/dist/index-0s4xebbg.js +8 -0
  158. package/dist/{index-r4r70zmh.js → index-12zsej7b.js} +5 -2
  159. package/dist/{index-269zqj8m.js → index-1ptj98e0.js} +28 -12
  160. package/dist/{index-kemm0ej5.js → index-1pwwan01.js} +65 -22
  161. package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
  162. package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
  163. package/dist/{index-wh0ecvyk.js → index-37asdw3a.js} +1 -1
  164. package/dist/index-3h0ztg0z.js +285 -0
  165. package/dist/{index-g95fk660.js → index-4vsby8n8.js} +8 -15
  166. package/dist/index-556g5hsh.js +17 -0
  167. package/dist/{index-f330qqyg.js → index-5c26631f.js} +244 -67
  168. package/dist/{index-adhgd4pe.js → index-5p55xreg.js} +2 -2
  169. package/dist/index-5w6t91ze.js +47 -0
  170. package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
  171. package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
  172. package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
  173. package/dist/index-9tqbxv5p.js +44 -0
  174. package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
  175. package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
  176. package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
  177. package/dist/index-b56nnscm.js +132 -0
  178. package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
  179. package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
  180. package/dist/index-cazts87s.js +105 -0
  181. package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
  182. package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
  183. package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
  184. package/dist/index-drs41arz.js +455 -0
  185. package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
  186. package/dist/index-eemvahkc.js +21 -0
  187. package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
  188. package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
  189. package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
  190. package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
  191. package/dist/index-j4zh647a.js +59 -0
  192. package/dist/{index-x928baz2.js → index-j9gxbztg.js} +18 -14
  193. package/dist/index-kfjkb396.js +37 -0
  194. package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
  195. package/dist/index-m616f0yz.js +120 -0
  196. package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
  197. package/dist/{index-bakgedh8.js → index-msfpyy2f.js} +2 -4
  198. package/dist/{index-ywppsaby.js → index-n1nszyk0.js} +23 -34
  199. package/dist/{index-v14qqmys.js → index-n4689krb.js} +1 -1
  200. package/dist/{index-a0zzh8ak.js → index-pz3y6b6g.js} +3 -3
  201. package/dist/{index-43p08g7t.js → index-pzb63z66.js} +12 -8
  202. package/dist/{index-h97tqqp1.js → index-qaet40b2.js} +5 -3
  203. package/dist/{index-t1sr4aks.js → index-qaqbdm7s.js} +52 -6
  204. package/dist/{index-77nxk6ay.js → index-r393tnfp.js} +16 -10
  205. package/dist/{index-kb8styz3.js → index-rpzewktb.js} +15 -5
  206. package/dist/{index-27a2pj09.js → index-sj28htvf.js} +1 -1
  207. package/dist/{index-hbd32c6a.js → index-w8etpm8j.js} +38 -89
  208. package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
  209. package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
  210. package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
  211. package/dist/{index-ptn0g0gj.js → index-y7k2cdgv.js} +21 -20
  212. package/dist/{index-20yvtn9a.js → index-yt7gyg5x.js} +1 -1
  213. package/dist/{index-cvda079a.js → index-yvfk3y36.js} +12 -2
  214. package/dist/{index-5z6jn897.js → index-z23rfxhj.js} +1 -1
  215. package/dist/internal/abort-race.d.ts +8 -2
  216. package/dist/internal/abort-race.d.ts.map +1 -1
  217. package/dist/internal/atomic-file.d.ts +55 -9
  218. package/dist/internal/atomic-file.d.ts.map +1 -1
  219. package/dist/internal/atomic-publication.d.ts +39 -4
  220. package/dist/internal/atomic-publication.d.ts.map +1 -1
  221. package/dist/internal/atomic-staging.d.ts +47 -0
  222. package/dist/internal/atomic-staging.d.ts.map +1 -0
  223. package/dist/internal/bounded-file-read.d.ts +19 -11
  224. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  225. package/dist/internal/bounded-lines.d.ts.map +1 -1
  226. package/dist/internal/close-after.d.ts +11 -0
  227. package/dist/internal/close-after.d.ts.map +1 -0
  228. package/dist/internal/deadline.d.ts +10 -0
  229. package/dist/internal/deadline.d.ts.map +1 -1
  230. package/dist/internal/exclusive-lock-read.d.ts +10 -12
  231. package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
  232. package/dist/internal/exclusive-lock.d.ts +2 -2
  233. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  234. package/dist/internal/file-observation.d.ts +14 -0
  235. package/dist/internal/file-observation.d.ts.map +1 -0
  236. package/dist/internal/json-data.d.ts +22 -5
  237. package/dist/internal/json-data.d.ts.map +1 -1
  238. package/dist/internal/positive-integer.d.ts +9 -0
  239. package/dist/internal/positive-integer.d.ts.map +1 -0
  240. package/dist/internal/process-instance.d.ts +35 -5
  241. package/dist/internal/process-instance.d.ts.map +1 -1
  242. package/dist/internal/secure-fetch.d.ts.map +1 -1
  243. package/dist/internal/timers.d.ts +11 -0
  244. package/dist/internal/timers.d.ts.map +1 -0
  245. package/dist/internal/with-exclusive-lock.d.ts +5 -4
  246. package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
  247. package/dist/observability/bounded-sink.d.ts.map +1 -1
  248. package/dist/primitives/canonical-json.d.ts +23 -2
  249. package/dist/primitives/canonical-json.d.ts.map +1 -1
  250. package/dist/primitives/delivery.d.ts.map +1 -1
  251. package/dist/primitives/index.d.ts +1 -1
  252. package/dist/primitives/index.d.ts.map +1 -1
  253. package/dist/primitives/money.d.ts.map +1 -1
  254. package/dist/process/cleanup.d.ts +7 -2
  255. package/dist/process/cleanup.d.ts.map +1 -1
  256. package/dist/process/command-lifetime.d.ts +6 -1
  257. package/dist/process/command-lifetime.d.ts.map +1 -1
  258. package/dist/process/command-owner.d.ts +1 -0
  259. package/dist/process/command-owner.d.ts.map +1 -1
  260. package/dist/process/command.d.ts +4 -0
  261. package/dist/process/command.d.ts.map +1 -1
  262. package/dist/process/contract.d.ts +68 -2
  263. package/dist/process/contract.d.ts.map +1 -1
  264. package/dist/process/group.d.ts +42 -3
  265. package/dist/process/group.d.ts.map +1 -1
  266. package/dist/process/launch.d.ts +12 -1
  267. package/dist/process/launch.d.ts.map +1 -1
  268. package/dist/process/terminate.d.ts +40 -0
  269. package/dist/process/terminate.d.ts.map +1 -0
  270. package/dist/react/query-client.d.ts.map +1 -1
  271. package/dist/realtime/rejection.d.ts.map +1 -1
  272. package/dist/server/contract-stream.d.ts.map +1 -1
  273. package/dist/server/handler-state.d.ts.map +1 -1
  274. package/dist/server/implement.d.ts.map +1 -1
  275. package/dist/server/request-body.d.ts +0 -1
  276. package/dist/server/request-body.d.ts.map +1 -1
  277. package/dist/server/unix-client.d.ts.map +1 -1
  278. package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
  279. package/dist/telegram/broadcast-failure.d.ts +10 -2
  280. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  281. package/dist/telegram/operator-channel.d.ts.map +1 -1
  282. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  283. package/dist/testing/surface-conformance.d.ts +1 -1
  284. package/dist/testing/surface-conformance.d.ts.map +1 -1
  285. package/dist/testing/surface-manifest.d.ts +0 -6
  286. package/dist/testing/surface-manifest.d.ts.map +1 -1
  287. package/dist/tools/agent.d.ts +1 -1
  288. package/dist/tools/agent.d.ts.map +1 -1
  289. package/dist/tools/cli/args.d.ts +1 -1
  290. package/dist/tools/cli/args.d.ts.map +1 -1
  291. package/dist/tools/cli/help.d.ts.map +1 -1
  292. package/dist/tools/cli/invoke.d.ts +2 -2
  293. package/dist/tools/cli/invoke.d.ts.map +1 -1
  294. package/dist/tools/cli/profile.d.ts.map +1 -1
  295. package/dist/tools/cli/publication-assets.d.ts.map +1 -1
  296. package/dist/tools/cli/publication-contract.d.ts +8 -0
  297. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  298. package/dist/tools/cli/publication-control.d.ts.map +1 -1
  299. package/dist/tools/cli/publication-storage.d.ts +23 -2
  300. package/dist/tools/cli/publication-storage.d.ts.map +1 -1
  301. package/dist/tools/cli/publication.d.ts +8 -1
  302. package/dist/tools/cli/publication.d.ts.map +1 -1
  303. package/dist/tools/connections/errors.d.ts +18 -6
  304. package/dist/tools/connections/errors.d.ts.map +1 -1
  305. package/dist/tools/connections/limits.d.ts +8 -2
  306. package/dist/tools/connections/limits.d.ts.map +1 -1
  307. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  308. package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
  309. package/dist/tools/connections/openapi.d.ts.map +1 -1
  310. package/dist/tools/connections/schema-budget.d.ts +1 -1
  311. package/dist/tools/connections/schema-budget.d.ts.map +1 -1
  312. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  313. package/dist/tools/execute-args.d.ts.map +1 -1
  314. package/dist/tools/execute-result.d.ts.map +1 -1
  315. package/dist/tools/internal/surface-projector.d.ts +17 -3
  316. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  317. package/dist/tools/internal/tool-error-projection.d.ts +16 -0
  318. package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
  319. package/dist/tools/internal/tool-view.d.ts.map +1 -1
  320. package/dist/tools/invoker.d.ts.map +1 -1
  321. package/dist/tools/list-names.d.ts +3 -2
  322. package/dist/tools/list-names.d.ts.map +1 -1
  323. package/dist/tools/manifest.d.ts +3 -2
  324. package/dist/tools/manifest.d.ts.map +1 -1
  325. package/dist/tools/mcp/handler.d.ts +7 -0
  326. package/dist/tools/mcp/handler.d.ts.map +1 -1
  327. package/dist/tools/mcp/mount.d.ts +18 -2
  328. package/dist/tools/mcp/mount.d.ts.map +1 -1
  329. package/dist/tools/mcp/prepare.d.ts +3 -3
  330. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  331. package/dist/tools/mcp/register.d.ts.map +1 -1
  332. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  333. package/dist/tools/mcp/stdio-signals.d.ts +14 -0
  334. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
  335. package/dist/tools/mcp/stdio.d.ts +7 -0
  336. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  337. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  338. package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
  339. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  340. package/dist/tools/operations/define-wait-tool.d.ts +1 -1
  341. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  342. package/dist/tools/operations/wait-core.d.ts +0 -6
  343. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  344. package/dist/tools/registry.d.ts +1 -1
  345. package/dist/tools/registry.d.ts.map +1 -1
  346. package/dist/tools/remote.d.ts +1 -1
  347. package/dist/tools/remote.d.ts.map +1 -1
  348. package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
  349. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
  350. package/dist/tools/runtime-tool-mcp.d.ts +6 -15
  351. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
  352. package/dist/tools/runtime-tool.d.ts +14 -12
  353. package/dist/tools/runtime-tool.d.ts.map +1 -1
  354. package/dist/tools/schema/coerce.d.ts +4 -0
  355. package/dist/tools/schema/coerce.d.ts.map +1 -1
  356. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  357. package/dist/tools/surface.d.ts +7 -11
  358. package/dist/tools/surface.d.ts.map +1 -1
  359. package/dist/tools/transfer/define-download-tool.d.ts +1 -1
  360. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  361. package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
  362. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  363. package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
  364. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  365. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
  366. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  367. package/dist/tools/transfer/view-file.d.ts +1 -1
  368. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  369. package/dist/tools/transports.d.ts +3 -2
  370. package/dist/tools/transports.d.ts.map +1 -1
  371. package/llms/agent-runtime-browser.txt +10 -4
  372. package/llms/agent-runtime-harness.txt +32 -31
  373. package/llms/agent-runtime-react.txt +1 -1
  374. package/llms/agent-runtime-realtime.txt +14 -5
  375. package/llms/agent-runtime-sandbox.txt +3 -11
  376. package/llms/agent-runtime.3.txt +2 -2
  377. package/llms/agent-runtime.txt +0 -9
  378. package/llms/application.2.txt +3 -12
  379. package/llms/application.3.txt +7 -4
  380. package/llms/application.txt +44 -15
  381. package/llms/cli-publish.txt +29 -0
  382. package/llms/cli.2.txt +9 -11
  383. package/llms/cli.txt +26 -14
  384. package/llms/declaration.txt +0 -9
  385. package/llms/files-packaging.txt +18 -8
  386. package/llms/files.txt +4 -2
  387. package/llms/geo.txt +0 -9
  388. package/llms/live.txt +4 -13
  389. package/llms/observability.txt +31 -5
  390. package/llms/primitives.txt +38 -20
  391. package/llms/process.txt +324 -160
  392. package/llms/react-keyboard.txt +0 -9
  393. package/llms/react.txt +0 -18
  394. package/llms/server.4.txt +1 -1
  395. package/llms/server.5.txt +1 -1
  396. package/llms/server.txt +1 -1
  397. package/llms/stitchkit.txt +6 -7
  398. package/llms/telegram-screens.txt +2 -2
  399. package/llms/testing.txt +0 -1
  400. package/llms/tools-mcp.txt +2 -3
  401. package/llms/tools.2.txt +12 -0
  402. package/llms/tools.3.txt +5 -6
  403. package/llms/tools.txt +6 -4
  404. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  405. package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
  406. package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
  407. package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
  408. package/llms/upgrading.txt +4 -4
  409. package/llms-full.txt +1068 -412
  410. package/llms.txt +24 -24
  411. package/native-assets.json +11 -3
  412. package/package.json +6 -6
  413. package/dist/agent-runtime/harness-tools.d.ts +0 -11
  414. package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
  415. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
  416. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
  417. package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
  418. package/dist/index-1a6jtnd9.js +0 -88
  419. package/dist/index-8a9ksm91.js +0 -95
  420. package/dist/index-a3wma1hk.js +0 -48
  421. package/dist/index-jd470k6q.js +0 -109
  422. package/dist/index-n1dqr7gf.js +0 -20
  423. package/dist/index-nggfa2yn.js +0 -34
  424. package/dist/index-s4evrmp5.js +0 -98
  425. package/dist/index-ze1eph1k.js +0 -20
  426. package/dist/tools/connections/error-projection.d.ts +0 -4
  427. package/dist/tools/connections/error-projection.d.ts.map +0 -1
  428. package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
  429. package/llms/agent-runtime-harness-tools.txt +0 -25
  430. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
package/CHANGELOG.md CHANGED
@@ -15,7 +15,395 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
- ## [0.104.2] - 2026-10-04
18
+ ## [0.105.1] - 2026-10-06
19
+
20
+ ### Added
21
+
22
+ - `stitchkit/process` — `NativeCommandResult.descendantsStopped` reports that the group still had
23
+ members after the leader exited and that `descendants: 'terminate-after-leader'` stopped them,
24
+ so a helper ended this way is visible in the result instead of only missing afterwards.
25
+ - `stitchkit/files/packaging` — `assetPath` accepts `[hash]`, replaced by the first 16 hex digits
26
+ of the addon's published SHA256, so two installed versions get different companion names
27
+ (`addons/darwin-arm64-[hash].node`); the loader requires exactly that name.
28
+
29
+ ### Fixed
30
+
31
+ - `stitchkit/files` — `sweepAtomicStaging` returns `[]` for a `directory` that does not exist yet
32
+ instead of throwing `ENOENT`; any other listing failure still throws.
33
+ - `stitchkit/process` — an option `runNativeCommand` does not know is refused by name, and the
34
+ removed `killGraceMs` names its replacement, `stop: { target: 'group', graceMs }`: a spread
35
+ object can carry a key the type never checked.
36
+
37
+ ### Documentation
38
+
39
+ - `stitchkit/process` — the 0.105.0 note that a descendant leaving the group with `setsid` is
40
+ unaffected holds only when it has left before the leader exits: `setsid helper &` and
41
+ `nohup helper &` race the leader and are stopped, `setsid -f helper` survives. The native IO
42
+ guide shows the measured forms, how a guardian or worker that holds a child until it exits
43
+ maps onto `runNativeCommand`, and why a child inheriting the terminal stays a plain spawn.
44
+ - `stitchkit/files/packaging` — calling `createNativePackaging` has to stay in the build step;
45
+ importing the leaf from a module that is also bundled is side-effect free.
46
+
47
+ ## [0.105.0] - 2026-10-05
48
+
49
+ ### ⚠️ Breaking changes
50
+
51
+ **Who must act:** consumers who bundle `stitchkit/files`, `stitchkit/process` or contained-file
52
+ tools for Darwin and relied on the bundler embedding or copying the native addon, and callers
53
+ of `withExclusiveLock` that depended on age-based reclaim of an empty lock file; code that names
54
+ a removed runtime-tool type, imports `stitchkit/agent-runtime/harness-tools` or compares agent
55
+ control error codes; callers that send a JSON array as text to a string-or-array tool field;
56
+ code that constructs an `AppError` or an `ApiError` with more than its code; build scripts
57
+ that read `sourcePath` from a `createNativePackaging` asset, pass it a `platform` other than
58
+ `'darwin'` or parse `native-assets.json`; and
59
+ operators of a diagnostic journal that must not start over damaged retained files, code that
60
+ constructs or reads `DiagnosticJournalRecoveryError`, and protocols that embed
61
+ `DiagnosticJournalRecoveryStatusSchema`; and callers of `runNativeCommand` that pass `killGraceMs`
62
+ or rely on a helper in the command's process group outliving the command;
63
+ and code that imports `publishCli` or its types from `stitchkit/cli`.
64
+
65
+ - `stitchkit/cli` — **`publishCli` moves to the new evolving entrypoint `stitchkit/cli/publish`.**
66
+ `publishCli`, `CliPublicationOptions`, `CliPublicationPhase` and `CliPublicationResult` are no
67
+ longer exported from `stitchkit/cli`, with no re-export left behind. Publication is release
68
+ infrastructure whose limits, staging and recovery are still being found, and the stable CLI
69
+ could not hold its shape; the manifest, signatures, installer and updater it writes for stay in
70
+ `stitchkit/cli`, which remains stable. The call, its options and its result are unchanged.
71
+ `// before: import { publishCli, type CliPublicationOptions } from 'stitchkit/cli'` →
72
+ `// after: import { publishCli, type CliPublicationOptions } from 'stitchkit/cli/publish'`
73
+ **Who must act:** code that imports `publishCli` or a `CliPublication*` type from
74
+ `stitchkit/cli`. See [migration](docs/guide/upgrading.md#cli-publication-has-its-own-entrypoint).
75
+ → ADR 0245
76
+
77
+ - `stitchkit/process` — **`killGraceMs` becomes the `stop` policy.** How a cancelled command
78
+ stops is one named object: `target` `'group'` (the signal goes to every member, as before) or
79
+ `'leader'` (cooperative cancellation: only the leader is signalled, its exit ends the grace and
80
+ whatever it left in the group gets KILL), `signal` (`SIGTERM` by default, or `SIGINT`, `SIGHUP`,
81
+ `SIGQUIT`, `SIGUSR1`, `SIGUSR2`), `graceMs` up to one hour (was 10 000 ms), and `killOn`, an
82
+ `AbortSignal` that ends any grace with KILL to the whole group. The output pipes stay open
83
+ through the grace and its output is dropped, so a leader writing while it shuts down does not
84
+ meet a broken pipe. The process surface ceiling grows by one name, `NativeCommandStopPolicy`.
85
+ `// before: runNativeCommand({ …, killGraceMs: 500 })` →
86
+ `// after: runNativeCommand({ …, stop: { target: 'group', graceMs: 500 } })`
87
+ **Who must act:** callers that pass `killGraceMs`. → ADR 0243
88
+
89
+ - `stitchkit/process` — **a command's leftover group members are stopped after its leader
90
+ exits.** `runNativeCommand` takes `descendants: 'terminate-after-leader' | 'leave'`, and
91
+ omitting it means `'terminate-after-leader'`: once the leader has exited, whatever it left in
92
+ the command's process group is stopped by the `stop` policy before the pipes drain, so a
93
+ command no longer leaks its helpers or waits for one that holds its output pipe. A real daemon
94
+ leaves the group with `setsid` and is unaffected. `'leave'` keeps a helper that has to outlive
95
+ the command.
96
+ `// before: runNativeCommand({ …, timeoutMs }) (the leader's helpers kept running)` →
97
+ `// after: runNativeCommand({ …, timeoutMs, descendants: 'leave' })`
98
+ **Who must act:** callers whose command starts a helper in its own process group that must
99
+ keep running after the command returns. See
100
+ [migration](docs/guide/upgrading.md#a-command-stops-what-its-leader-left).
101
+ → ADR 0246
102
+
103
+ - `stitchkit/server`, `stitchkit/files`, `stitchkit/process` — **bundles no longer emit Darwin
104
+ addons.** The packaged Darwin loader names its addon by a computed path, so a Bun bundle of
105
+ these entrypoints is one JS file with no `.node` output on every operating system, and
106
+ `bun build --outfile` works again for Linux server apps. An artifact that must carry the
107
+ Darwin addon is built with the `stitchkit/files/packaging` plugin; without it the bundle looks
108
+ for the addon beside the original package files and reports the backend `unavailable`
109
+ elsewhere, never a dead owner.
110
+ `// before: bun build src/native.ts --compile --outfile=dist/native (addon embedded)` →
111
+ `// after: Bun.build({ …, plugins: [createNativePackaging({ platform: 'darwin', architecture: process.arch, delivery: 'embedded', entryPath, assetPath }).plugin] })`
112
+ **Who must act:** Darwin packagers of bundled or compiled artifacts using these entrypoints.
113
+ Linux and portable bundles need no change. See [migration](docs/guide/upgrading.md#released-migration-010313).
114
+ → ADR 0235
115
+ - `stitchkit/files/packaging` — **`createNativePackaging` checks each addon against a digest the
116
+ package published, and returns the verified bytes.** `native-assets.json` is now written when
117
+ Stitchkit is built, at `formatVersion: 2`, with the `path`, `size` and `sha256` of every Darwin
118
+ addon present then; the reader refuses any other format version. Before, `sha256` was computed
119
+ from whatever file sat in `node_modules`, so an addon substituted after installation got its own
120
+ "original" digest. Each selected addon is now read once and compared by size and SHA256; a
121
+ difference returns `{ state: 'mismatch', code: 'NATIVE_ASSET_DIGEST_MISMATCH', architecture,
122
+ expected: { size, sha256 }, actual: { size, sha256 } }` for the first differing addon, and an
123
+ architecture the manifest does not list is `missing`. `platform` is the closed enum `'darwin'`:
124
+ another platform is a type error and a schema refusal that throws, no longer an `unsupported`
125
+ result, which now names only an unsupported architecture. A ready asset drops `sourcePath` and
126
+ carries `bytes` (the verified bytes) and the published `size` and `sha256`; embedded delivery
127
+ gives Bun those same bytes instead of reading the file again. Call it once per build and reuse
128
+ the result.
129
+ `// before: copyFileSync(asset.sourcePath, join(outdir, asset.outputPath)) (asset: { sourcePath, outputPath, sha256 })` →
130
+ `// after: writeFileSync(join(outdir, asset.outputPath), asset.bytes) (asset: { outputPath, size, sha256, bytes })`
131
+ `// before: native-assets.json { formatVersion: 1, assets: { arm64: 'native/darwin-arm64.node' } }` →
132
+ `// after: native-assets.json { formatVersion: 2, assets: { arm64: { path, size, sha256 } } }`
133
+ `// before: createNativePackaging({ platform: target.platform, … }) (non-Darwin → 'unsupported')` →
134
+ `// after: if (target.platform === 'darwin') createNativePackaging({ platform: target.platform, … })`
135
+ **Who must act:** build scripts that read `asset.sourcePath`, re-hash the addon themselves,
136
+ switch over the refusal `code`/`state`, parse `native-assets.json`, or pass a `platform` other
137
+ than the literal `'darwin'`.
138
+ See [migration](docs/guide/upgrading.md#native-packaging-verifies-published-digests).
139
+ → ADR 0241
140
+ - `stitchkit/files` — **`withExclusiveLock` publishes its lock with the owner already recorded,
141
+ and `ownerlessGraceMs` defaults to `null`.** The owner record is written to a temporary file
142
+ and hard-linked to the lock name, so the name never exists without an owner and a stalled
143
+ holder can no longer be displaced after the former 5 000 ms default. An empty lock file
144
+ left by an older writer is reclaimed by age only when asked for:
145
+ `// before: withExclusiveLock(path, run) (an empty lock older than 5 s was taken)` →
146
+ `// after: withExclusiveLock(path, run, { ownerlessGraceMs: 5_000 }) (only for legacy empty files)`
147
+ The lock directory must support hard links, and a holder killed mid-publication leaves a
148
+ `.lock-*.tmp` sibling that the next reclaim removes.
149
+ **Who must act:** callers that relied on the age-based reclaim of an empty or unreadable lock
150
+ file, and locks on a filesystem without hard links; every other caller is unaffected.
151
+ See [migration](docs/guide/upgrading.md#exclusive-locks-publish-their-owner-first).
152
+ → ADR 0238
153
+ - `stitchkit/tools/connections` — **a `timeoutMs` or `maxResponseBytes` that is not a positive
154
+ integer within range throws a `RangeError`** instead of falling back to the default. This
155
+ shipped in 0.104.0 without a breaking entry.
156
+ `// before: timeoutMs: 0 (the default applied silently)` →
157
+ `// after: timeoutMs: 0 (RangeError; omit the option to take the default)`
158
+ **Who must act:** callers that passed 0, a negative, a fractional or an oversized limit.
159
+ See [migration](docs/guide/upgrading.md#connection-limits-are-validated).
160
+ - `stitchkit/testing` — **`serializeSurfaceValue` is removed.** It was a second name for the
161
+ package's one canonical serializer. `canonicalJson` from `stitchkit/primitives` is that
162
+ serializer, bounded and with a typed refusal:
163
+ `// before: serializeSurfaceValue(manifest)` →
164
+ `// after: canonicalJson(manifest, { maxBytes: 16 * 1024 * 1024 })`
165
+ **Who must act:** tests that call `serializeSurfaceValue`.
166
+ See [migration](docs/guide/upgrading.md#one-canonical-json-serializer).
167
+ → ADR 0199, ADR 0238
168
+ - `stitchkit/agent-runtime` — **`canonicalAgentJson` follows the one admissibility table of
169
+ `canonicalJson`.** A value nested deeper than 100 levels is refused with a
170
+ `CanonicalJsonError`, and an `undefined` object member is omitted instead of failing. It still
171
+ reads a value as `z.json()` did, so `-0` hashes as `0` and an own `__proto__` member is dropped
172
+ (the public `canonicalJson` refuses `-0` and keeps `__proto__`). Bytes of every value both
173
+ accepted are unchanged, so stored digests and archives still match.
174
+ `// before: canonicalAgentJson({ a: undefined }) threw, a 101-level value was accepted` →
175
+ `// after: canonicalAgentJson({ a: undefined }) === '{}', a 101-level value throws (reason 'depth')`
176
+ **Who must act:** code that puts a value nested deeper than 100 levels into agent store events,
177
+ archives or projections. See
178
+ [migration](docs/guide/upgrading.md#one-canonical-json-serializer).
179
+ - `stitchkit/application` — **`DirectoryInbox` sets a hard-linked entry file aside as
180
+ `invalid`, and `accept` takes the schema's input type.** A dropped file with more than one
181
+ link is never trusted, because another name can still rewrite it (since 0.104.0, without a
182
+ changelog entry). `DirectoryInboxConfig` gains the schema input type as a second type
183
+ parameter, and `DirectoryInbox` and `DirectoryInboxResource` take that input type as their one
184
+ parameter (it was the entry type); for a schema without a transform the two are equal and
185
+ nothing changes.
186
+ `// before: accept({ ...identity, entry: { amount: 42 } }) (the output of z.string().transform(Number))` →
187
+ `// after: accept({ ...identity, entry: { amount: '42' } }) (the input; it is stored as given and parsed on delivery)`
188
+ **Who must act:** producers that drop hard links into an inbox directory, and callers that pass
189
+ `accept` the output of a transforming schema.
190
+ See [migration](docs/guide/upgrading.md#directory-inbox-entries).
191
+ - `stitchkit/application` — **`createDiagnosticJournal` checks only the last line of each file
192
+ when it opens** (`startupScan: 'tails'`, the default), so opening no longer parses and
193
+ validates every line of every retained generation. The scan still reads each file once in
194
+ large blocks to count lines, so opening still takes time proportional to the bytes retained,
195
+ at read speed. `recovery` in the status no longer reports a damaged row in the
196
+ middle of a file unless the journal is opened with `startupScan: 'full'`.
197
+ `// before: createDiagnosticJournal({ path, eventSchema, limits }) (every line of every file was parsed)` →
198
+ `// after: createDiagnosticJournal({ path, eventSchema, limits, startupScan: 'full' }) (the same full scan)`
199
+ **Who must act:** operators that read `recovery` at startup to find damaged rows in the middle
200
+ of a file. See [migration](docs/guide/upgrading.md#journal-startup-scan).
201
+ - `stitchkit/application/diagnostic-journal`, `stitchkit/application` — **opening a diagnostic
202
+ journal moves a file it cannot keep in place aside and starts, instead of refusing to start.**
203
+ A torn active file with `maxFiles: 1`, a generation name that is not a regular file and a
204
+ retained file that cannot be read are renamed to `<file>.quarantined-<epoch>` beside the
205
+ journal (`onStartupRefusal: 'quarantine'`, the default) and never deleted. Every open lists
206
+ every quarantined file beside the journal in `getStatus().recovery.quarantined` until the
207
+ operator removes it: the ones it moved first, with their `reason`, then earlier ones without
208
+ one; at most 32, with `quarantinedUnlisted` counting the rest.
209
+ `onStartupRefusal: 'fail'` keeps refusing, now always with
210
+ one typed `DiagnosticJournalRecoveryError` whose `reason` is
211
+ `'torn-without-retention-slot' | 'not-a-regular-file' | 'unreadable'`; its constructor takes
212
+ an options object and `recovery` is present only for a torn single slot.
213
+ `DiagnosticJournalRecoveryStatusSchema` gains the optional `quarantined` and
214
+ `quarantinedUnlisted` fields; the schema is `.strict()`, so a reader parsing with an older copy
215
+ refuses a status that carries them.
216
+ `// before: createDiagnosticJournal({ path, eventSchema, limits }) (threw on a damaged or unreadable retained file)` →
217
+ `// after: createDiagnosticJournal({ path, eventSchema, limits, onStartupRefusal: 'fail' }) (the same refusal, typed)`
218
+ **Who must act:** operators of a journal that is a source of truth and must not start over
219
+ damage (declare `'fail'`); code that constructs `DiagnosticJournalRecoveryError` or reads its
220
+ `recovery`; protocols that embed `DiagnosticJournalRecoveryStatusSchema` and their readers.
221
+ See [migration](docs/guide/upgrading.md#journal-startup-quarantine).
222
+ → ADR 0240
223
+
224
+ - `stitchkit/cli`, `stitchkit/tools`, `stitchkit/tools/mcp` — **one runtime-tool declaration.**
225
+ `RuntimeToolExecution`, `RuntimeToolExecutionWithOutput` (cli), `RuntimeMcpToolDefinition`,
226
+ `RuntimeMcpToolDefinitionWithOutput` (tools/mcp) and `ToolSurfaceDefinition` (tools) are removed.
227
+ `RuntimeToolDefinition`, `RuntimeToolDefinitionWithOutput` and `RuntimeToolDefinitionWithoutOutput`
228
+ are the same neutral, peer-free types on all three entrypoints, and the presenters are the
229
+ adapter's extension: the fourth type argument of `RuntimeToolDefinitionWithOutput`
230
+ (`RuntimeMcpToolPresenters<…>` on `tools/mcp`, `RuntimeToolPresenters<…>` on `tools`), or
231
+ `defineRuntimeTool`, which fixes it. `RuntimeToolDefinition` is the one registration type, and an
232
+ inline handler written in `runtimeTools: [...]` is typed again instead of failing with TS2339 on
233
+ `never`. `ToolSurfaceProjection` is the one surface container.
234
+ `// before: satisfies RuntimeToolExecutionWithOutput<typeof input, typeof output>` →
235
+ `// after: satisfies RuntimeToolDefinitionWithOutput<typeof input, typeof output>`
236
+ `// before: satisfies RuntimeMcpToolDefinitionWithOutput<typeof input, typeof output>` →
237
+ `// after: satisfies RuntimeToolDefinitionWithOutput<typeof input, typeof output, undefined, RuntimeMcpToolPresenters<z.output<typeof output>>>`
238
+ **Who must act:** code that names a removed type, and code that annotates a definition with
239
+ presenters as `RuntimeToolDefinitionWithOutput<I, O>` from `stitchkit/tools` (use `defineRuntimeTool`
240
+ or pass the presenter type as the fourth argument). Values returned by `defineRuntimeTool` and
241
+ `createRuntimeToolFactory` need no change.
242
+ See [migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
243
+ → ADR 0236, ADR 0238
244
+ - `stitchkit/tools`, `stitchkit/tools/mcp` — **a flattened union keeps declaration order.**
245
+ With `flattenUnionInput: true`, properties, enum values and branch labels are advertised in the
246
+ order of their first appearance across the variants instead of alphabetically, so the bytes of
247
+ every flattened tool listing (and any provider prompt cache keyed on them) change once.
248
+ Alternatives of different kinds (`anyOf`) keep their one canonical order.
249
+ `// before: union([{ kind: 'b', z: 1 }, { kind: 'a', a: 1 }]) → properties kind, a, z; kind enum a|b` →
250
+ `// after: the same union → properties kind, z, a; kind enum b|a`
251
+ **Who must act:** consumers with snapshot tests or caches of flattened tool schemas, and
252
+ anyone using `flattenUnionInput: true`: regenerate the snapshots.
253
+ See [migration](docs/guide/upgrading.md#flattened-unions-keep-declaration-order).
254
+ → ADR 0238
255
+ - `stitchkit/tools`, `stitchkit/cli` — **a list written as text is refused in every
256
+ string-or-array field.** `coerceJsonArgs`, and so every tool surface, throws a validation error
257
+ naming the field when a union that keeps a string member receives a string that parses to an
258
+ array the union's array member accepts. Before, `'["a","b"]'` in `z.union([z.string(),
259
+ z.array(z.string())])` was read as one plain string. The `view_file`-only refusal is this rule;
260
+ a list written as text as an *element* of the array is no longer refused by name.
261
+ `// before: { paths: '["a.png"]' } (the string "[\"a.png\"]" reached the handler)` →
262
+ `// after: { paths: ['a.png'] } (the text form is VALIDATION_ERROR: "paths is a list written as text")`
263
+ **Who must act:** callers that send a JSON array as text to a string-or-array field; a plain
264
+ string, including one that is not a list the array member accepts, is unchanged.
265
+ → ADR 0218, ADR 0239, ADR 0238
266
+ - `stitchkit/agent-runtime` — **the `stitchkit/agent-runtime/harness-tools` leaf is removed.** It
267
+ was one `mountAgent` call with the run's fence composed in; no consumer imported it.
268
+ `// before: tools: createAgentHarnessTools(({ context }) => ({ services: [svc], context }))` →
269
+ `// after: tools: ({ context, toolFenceLifecycle }) => mountAgent([svc], { context, lifecycle: composeToolLifecycle(undefined, toolFenceLifecycle) })`
270
+ **Who must act:** imports of `stitchkit/agent-runtime/harness-tools`. See
271
+ [migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
272
+ - `stitchkit/agent-runtime/realtime`, `stitchkit/agent-runtime/browser` — **control errors use one
273
+ vocabulary, and the binding authorizes requests, not events.** `ACCESS_DENIED` is `FORBIDDEN`, and
274
+ a closed connection answers `CONNECTION_CLOSED` instead of a denial. `AgentControlErrorCode`
275
+ (`AgentControlErrorCodeSchema`) is the closed set every response and `AgentControllerState.error`
276
+ carries. `authorize` receives `source: 'request' | 'delivery'` and runs once per request; the
277
+ events of an attached conversation flow under the grant that request created until
278
+ `binding.revoke(conversationId, matches?)` drops it, and a refusal then reaches the browser as an
279
+ `access-denied` delivery that puts the controller in `error` (`FORBIDDEN`). A reconnect rejects
280
+ the previous connection's requests so a small `maxPendingRequests` cannot leave the controller in
281
+ `connecting`. Both leaves are evolving and experimental.
282
+ `// before: if (state.error?.code === 'ACCESS_DENIED') …` →
283
+ `// after: if (state.error?.code === 'FORBIDDEN') …`
284
+ **Who must act:** code that compares control error codes, and applications that revoke access while
285
+ a stream is open (call `binding.revoke`; before, every event re-asked `authorize`).
286
+ - `stitchkit/contract`, `stitchkit/server`, `stitchkit/node` — **`AppError` takes its fields by
287
+ name.** The constructor had seven positions, so a call that set only `retryable` read
288
+ `new AppError(code, message, 409, undefined, undefined, undefined, true)`. The code stays first;
289
+ everything else is one options object, and `new AppError(code)` still works:
290
+ `// before: new AppError('CONFLICT', 'stale', 409, { revision: 7 }, 'reload', undefined, false)` →
291
+ `// after: new AppError('CONFLICT', { message: 'stale', status: 409, details: { revision: 7 }, hint: 'reload', retryable: false })`
292
+ The options are `message`, `status` (default 500), `details`, `hint`, `traceId`, `retryable` and
293
+ the standard `cause`. A subclass calls `super(code, { message, status })` the same way.
294
+ **Who must act:** code that constructs an `AppError` or extends it with more than the code.
295
+ The `notFound`, `badRequest`, `unauthorized`, `forbidden`, `conflict` and `rateLimited` helpers
296
+ are unchanged. See [migration](docs/guide/upgrading.md#error-constructors-take-named-options).
297
+ → ADR 0238
298
+ - `stitchkit` — **`ApiError` takes its fields by name.** The constructor had eight positions
299
+ and call sites ended in `undefined, undefined, retryable`. The code stays first and the rest
300
+ is one options object; `new ApiError(code)` still works:
301
+ `// before: new ApiError('RATE_LIMITED', 429, undefined, 'slow down', 'wait', 'trace-1', { cause }, true)` →
302
+ `// after: new ApiError('RATE_LIMITED', { status: 429, message: 'slow down', hint: 'wait', traceId: 'trace-1', retryable: true, cause })`
303
+ The options are `status` (default 0), `details`, `message`, `hint`, `traceId`, `retryable` and
304
+ `cause`. **Who must act:** code that constructs an `ApiError`, which is mostly tests and
305
+ custom transports; code that only reads `code`, `status`, `details`, `hint`, `traceId`,
306
+ `retryable` or `cause` is unaffected. See
307
+ [migration](docs/guide/upgrading.md#error-constructors-take-named-options).
308
+ → ADR 0238
309
+
310
+ ### Added
311
+
312
+ - `stitchkit/files` — `isAtomicStagingName(name)` and `sweepAtomicStaging({ directory,
313
+ olderThanMs, signal })` recognise and remove the staging files that an atomic write killed
314
+ before publication leaves beside its target. The staging name `.stitchkit-<24 lowercase
315
+ hex>.tmp` is now a **stable public contract**: one module produces it for `writeFileAtomic`,
316
+ `writeFileAtomicSync`, the managed writer, the chunk spool and the agent runtime's contained
317
+ write, and changing it is a breaking change. The sweep removes only regular files older than
318
+ the required `olderThanMs`, never follows a symlink and never enters a subdirectory; sweeping
319
+ abandoned staging is the caller's responsibility. The files surface ceiling grows by three
320
+ names. → ADR 0242
321
+ - `stitchkit/primitives` — `canonicalJson` refuses with a `CanonicalJsonError` (a `TypeError`)
322
+ whose `reason` is `'cycle' | 'negative-zero' | 'depth' | 'nodes' | 'bytes' | 'not-json'`
323
+ (`CanonicalJsonRefusal`), so an exceeded limit is told apart from a value that is not JSON.
324
+ The primitives surface ceiling grows by two names and the testing ceiling shrinks by one.
325
+ - `stitchkit/application` — `FileStateStoreOptions.maxBytes` bounds the state read (default
326
+ 64 MiB); a larger file is refused before it is parsed and is not reported as corruption.
327
+ `DiagnosticJournalConfig.startupScan: 'tails' | 'full'` chooses what opening reads.
328
+
329
+ ### Documentation
330
+
331
+ - `stitchkit/observability`: request rows, `runUnitOfWork` rows and schedule status carry no
332
+ per-operation CPU, by decision (ADR 0244). A `process.cpuUsage()` delta across an operation's
333
+ wall-clock interval absorbs every interleaved operation and timer, and Bun gives no async
334
+ segment boundary to measure correctly. The guide
335
+ ([CPU is not attributed to work](docs/guide/observability.md#cpu-is-not-attributed-to-work))
336
+ states the process-CPU window you can observe and the rule for building attribution yourself.
337
+ - 0.103.13 shipped two breaking changes as a patch: the Darwin native-asset delivery and the
338
+ refusal of repeated non-array CLI options. The upgrade guide now carries a migration for each
339
+ ([native assets](docs/guide/upgrading.md#released-migration-010313),
340
+ [repeated options](docs/guide/upgrading.md#cli-repeated-options-are-refused)). `release:check`
341
+ refuses a patch whose notes carry any breaking marker.
342
+
343
+ ### Fixed
344
+
345
+ - `stitchkit/agent-runtime`: `probeAgentProcessSandbox` never rejects. A `probe()` that throws
346
+ synchronously, rejects or returns something that is not a grade resolves to
347
+ `{ grade: 'unavailable', reason }` with a fixed reason (`'sandbox probe failed'` or
348
+ `'sandbox probe returned no valid grade'`), cached like any grade until `refresh: true`. The
349
+ cause (an adapter error may carry absolute paths) stays out of the grade and is emitted as a
350
+ process warning. A synchronous throw used to escape raw and was not cached. The probe cache is
351
+ keyed by the sandbox object, so a sandbox is expected to be long-lived.
352
+ - `stitchkit/agent-runtime/coding-tools`: a sandbox `prepare()` that throws refuses the command
353
+ with `SANDBOX_UNAVAILABLE` and the fixed reason `'sandbox prepare failed'`; the adapter's error
354
+ message no longer reaches the agent. The original error of a failed `prepare()` or `probe()`
355
+ rides on the refusal as its `cause`, which the mount's `hooks.onToolError` (and
356
+ `afterToolCall`'s `error`) receives, so an application with a structured log records it
357
+ there; the tool envelope carries only the code and the fixed reason, and the coding tools emit
358
+ no process warning. `probeAgentProcessSandbox` called directly still warns, because it
359
+ returns only the grade.
360
+ - `stitchkit/process`: a group that reported `ESRCH` is not sent SIGKILL afterwards, so a
361
+ recycled group id is never signalled.
362
+ - `stitchkit/agent-runtime`: a stopped coding command is classified by a typed stop reason
363
+ instead of its message text; the sandbox terminates a direct child's group without wrapping it
364
+ in a placeholder command, and a slot whose cleanup was not proven stays occupied (documented).
365
+ - `stitchkit/application`: a `DirectoryInbox` entry whose name is already in `rejected/` no
366
+ longer stops the pass with `EEXIST`. Identical bytes are the entry already set aside and the
367
+ new file is only removed; different bytes are kept under `<name>.<first 16 hex of SHA-256>`.
368
+ A failure of one entry's own file is reported through `onError` and the pass continues with the
369
+ next entry, and an entry that changes during its read or is not a regular file is released
370
+ for a later attempt instead of throwing out of the pass.
371
+ - `stitchkit/application`: `createFileStateStore` commits nothing for a transition whose
372
+ resulting state encodes to the bytes it started from (the directory inbox passes over
373
+ already-receipted files without a single write), and reads and fences the lock fewer times per update. Every update still reads and
374
+ rewrites the whole state, so keep `retain` of the directory inbox as small as duplicate
375
+ detection needs.
376
+ - `stitchkit/cli/publish`: `publishCli` removes `.publish-*` staging directories left by a publisher that
377
+ died mid-build, under its publication lock, so they no longer fill the directory entry cap.
378
+ Each stored version is decompressed once per publication instead of up to five times.
379
+ - `stitchkit/files`: one descriptor open and one atomic staging sequence serve every managed
380
+ read and write. `rejectSymlinks` alone decides whether a symlink leaf is followed, a
381
+ too-large file reports its observation whatever its link count, and the managed writer stages
382
+ through a hidden `.stitchkit-<random>.tmp` file whose length does not depend on the target name. The synchronous atomic write has the same
383
+ fault controls as the asynchronous one.
384
+ - `stitchkit/remote`: `implementRemote` keeps the status and the retryability of a remote failure
385
+ that carries no stitchkit error envelope. A `503` page, a `429` or a `404` becomes `HTTP_ERROR`
386
+ with that status and a fixed message, and a refused connection becomes `CONNECTION_REQUEST_FAILED`
387
+ (`502`); neither carries `details`, so the upstream body, URL and credentials stay in the raw cause.
388
+ Before, both became `INTERNAL_SERVER_ERROR` `500`, which says `retryable: false`. One rule decides
389
+ `retryable` for every origin: the declared value, else the status (`408` included, so a deadline the
390
+ remote client hit is retryable like a local `408`; a cancelled call stays `false`).
391
+ - `stitchkit/cli`: command help prints only the bounds a schema declares. An integer prints
392
+ `<integer>` instead of `[>=-9007199254740991, <=9007199254740991]`; `.min(1)` prints `>=1` and
393
+ `.positive()` prints `>0`. Repeating `-h` or `--help` in any spelling shows help instead of an
394
+ argument error.
395
+ - `stitchkit/telegram`: a broadcast caps its own backoff between transient failures at
396
+ `maxRetryDelayMs` (computed by the shared backoff formula) and halts only when the provider's
397
+ `retry-after` exceeds that limit. With `maxRetryDelayMs: 5000` the fourth transient failure used
398
+ to halt the whole broadcast.
399
+ - `stitchkit/agent-runtime`: the realtime binding's `authorize` hook gets one deadline shared
400
+ with every other bounded wait, and deliveries that arrive while it is deciding share its one
401
+ answer instead of asking again.
402
+ - Limit options that are not positive safe integers are refused with one message that ends in the
403
+ value received, in `stitchkit/application`, `stitchkit/files`, `stitchkit/server`,
404
+ `stitchkit/agent-runtime`, `stitchkit/primitives` and `stitchkit/process`.
405
+
406
+ ## [0.104.2] — 2026-10-04
19
407
 
20
408
  ### Added
21
409
 
@@ -25,7 +413,7 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
25
413
 
26
414
  - Native qualification waits for the helper’s actual first write instead of inferring readiness from startup timing.
27
415
 
28
- ## [0.104.1] - 2026-10-04
416
+ ## [0.104.1] — 2026-10-04
29
417
 
30
418
  ### Added
31
419
 
@@ -40,7 +428,7 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
40
428
  [upgrade guide](docs/guide/upgrading.md#released-migration-010313), including single-file
41
429
  packaging, complete output graphs and the distinct npm/JS/compiled delivery paths.
42
430
 
43
- ## [0.104.0] - 2026-10-04
431
+ ## [0.104.0] — 2026-10-04
44
432
 
45
433
  ### ⚠️ Breaking changes
46
434
 
@@ -135,7 +523,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
135
523
  names, CLI +4 publisher names; connection diagnostics and policy gain named public types.
136
524
  The MCP leaf shares existing owners and gives strict MCP construction its own contracts.
137
525
 
138
- ## [0.103.13] - 2026-10-04
526
+ ## [0.103.13] — 2026-10-04
139
527
 
140
528
  ### ⚠️ Delivery migration
141
529
 
@@ -162,7 +550,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
162
550
  argument error instead of silently selecting `false`. Single options, array repetition,
163
551
  untyped passthrough lists and command help retain their grammar.
164
552
 
165
- ## [0.103.12] - 2026-10-03
553
+ ## [0.103.12] — 2026-10-03
166
554
 
167
555
  ### Fixed
168
556
 
@@ -181,7 +569,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
181
569
  bounds requests, bodies and waits with one elapsed deadline.
182
570
 
183
571
 
184
- ## [0.103.11] - 2026-10-02
572
+ ## [0.103.11] — 2026-10-02
185
573
 
186
574
  ### Added
187
575
 
@@ -194,7 +582,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
194
582
  - `stitchkit/agent-runtime`: coding commands share the native execution owner while retaining forced descendant cleanup, structural sandbox launchers, bounded artifacts and UTF-8 previews.
195
583
  - Local gate evidence is saved only for stable inputs, including content changed and restored during a run. PostgreSQL fingerprint probes have finite budgets and distinguish URI connection overrides; unknown external inputs cannot authorize heavy memo reuse. Heavy concurrency accounts for visible cgroup memory limits.
196
584
 
197
- ## [0.103.10] - 2026-10-01
585
+ ## [0.103.10] — 2026-10-01
198
586
 
199
587
  ### Added
200
588
 
@@ -202,7 +590,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
202
590
  - `stitchkit/files`: `ownerlessGraceMs: null` explicitly refuses age-based reclaim of unknown locks and guards; exact requested lock permissions survive restrictive umask, and failed descriptor setup cannot remove a replacement inode.
203
591
  - Document and qualify neutral library bundling from public imports and published declarations with Zod as its only runtime peer; full-kernel install remains a build-time choice.
204
592
 
205
- ## [0.103.9] - 2026-10-01
593
+ ## [0.103.9] — 2026-10-01
206
594
 
207
595
  ### Added
208
596
 
@@ -215,31 +603,31 @@ native CLI commands and ordinary one-argument state transitions remain valid.
215
603
  - Effect reconciliation releases caller waits on cancellation and ignores late results, including independently cancelled coalesced observers; document the external execution lease required across processes. Historical sticky uncertain remains unchanged; automatic absence-based retries require recipient authority.
216
604
  - Managed reads preserve the primary error when descriptor cleanup also fails. Native command and reconciliation deadlines refuse timer overflow instead of silently firing after 1 ms.
217
605
 
218
- ## [0.103.8] - 2026-10-01
606
+ ## [0.103.8] — 2026-10-01
219
607
 
220
608
  ### Fixed
221
609
 
222
610
  - Clarify core prepack build ownership in release assembly to prevent restoring a duplicate build.
223
611
 
224
- ## [0.103.7] - 2026-10-01
612
+ ## [0.103.7] — 2026-10-01
225
613
 
226
614
  ### Fixed
227
615
 
228
616
  - Release candidates run structural preflight locally; every unit test and selected evidence lane still must pass in exact-SHA push CI before publication. Ordinary pushes retain fast checks.
229
617
 
230
- ## [0.103.6] - 2026-10-01
618
+ ## [0.103.6] — 2026-10-01
231
619
 
232
620
  ### Fixed
233
621
 
234
622
  - Document fast-gate attestation boundaries and retained lane-environment checks for release verification.
235
623
 
236
- ## [0.103.5] - 2026-10-01
624
+ ## [0.103.5] — 2026-10-01
237
625
 
238
626
  ### Fixed
239
627
 
240
628
  - Clarify release delivery checks: ordinary registry visibility, matching artifact bytes and fresh installed Bun/Node consumers.
241
629
 
242
- ## [0.103.4] - 2026-10-01
630
+ ## [0.103.4] — 2026-10-01
243
631
 
244
632
  ### Fixed
245
633
 
package/darwin-native.cjs CHANGED
@@ -1,8 +1,10 @@
1
1
  /** Generated from the owning native asset graph. Loading remains lazy. */
2
+ // The addon path is computed, so a bundler never follows or embeds it. A packaging
3
+ // plugin replaces this file with a static loader when an artifact must carry the addon.
2
4
  module.exports = function loadDarwinAddon() {
3
5
  try {
4
- if (process.arch === 'arm64') return require('./native/darwin-arm64.node');
5
- if (process.arch === 'x64') return require('./native/darwin-x64.node');
6
+ if (process.arch === 'arm64') return require(`${__dirname}/native/darwin-arm64.node`);
7
+ if (process.arch === 'x64') return require(`${__dirname}/native/darwin-x64.node`);
6
8
  throw new Error('Unsupported Darwin addon architecture');
7
9
  } catch (cause) {
8
10
  throw new Error('Darwin addon loading failed', { cause });
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
- /** Untrusted user input cannot manufacture tool evidence or supply runtime identity. */
2
+ /**
3
+ * Untrusted user input cannot manufacture tool evidence or supply runtime identity.
4
+ */
3
5
  export declare const AgentBrowserRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
6
  schemaVersion: z.ZodLiteral<1>;
5
7
  requestId: z.ZodString;
@@ -51,7 +53,16 @@ export declare const AgentBrowserRequestSchema: z.ZodDiscriminatedUnion<[z.ZodOb
51
53
  reason: z.ZodOptional<z.ZodString>;
52
54
  metadata: z.ZodOptional<z.ZodUnknown>;
53
55
  }, z.core.$strict>], "operation">;
56
+ /**
57
+ * A request a browser may send to the agent controller (attach, send message, interrupt and so
58
+ * on); the server supplies context and identity, the browser cannot.
59
+ */
54
60
  export type AgentBrowserRequest = z.infer<typeof AgentBrowserRequestSchema>;
61
+ /**
62
+ * Realtime contract carrying `agent:control` requests up and `agent:delivery` events down;
63
+ * bind it with `bindAgentHarnessRealtime` on the server and `createAgentController` in the
64
+ * browser.
65
+ */
55
66
  export declare const agentControlRealtimeContract: import("../realtime/index.js").RealtimeContract<{
56
67
  readonly 'agent:delivery': {
57
68
  args: z.ZodTuple<[z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -828,6 +839,10 @@ export declare const agentControlRealtimeContract: import("../realtime/index.js"
828
839
  type: z.ZodLiteral<"resync-required">;
829
840
  conversationId: z.ZodString;
830
841
  reason: z.ZodLiteral<"overflow">;
842
+ }, z.core.$strict>, z.ZodObject<{
843
+ schemaVersion: z.ZodLiteral<1>;
844
+ type: z.ZodLiteral<"access-denied">;
845
+ conversationId: z.ZodString;
831
846
  }, z.core.$strict>], "type">], null>;
832
847
  };
833
848
  }, {
@@ -1109,7 +1124,22 @@ export declare const agentControlRealtimeContract: import("../realtime/index.js"
1109
1124
  requestId: z.ZodString;
1110
1125
  outcome: z.ZodLiteral<"error">;
1111
1126
  error: z.ZodObject<{
1112
- code: z.ZodString;
1127
+ code: z.ZodEnum<{
1128
+ ATTACHMENT_CAPACITY: "ATTACHMENT_CAPACITY";
1129
+ ATTACH_CANCELLED: "ATTACH_CANCELLED";
1130
+ ATTACH_IN_PROGRESS: "ATTACH_IN_PROGRESS";
1131
+ CONNECTION_CLOSED: "CONNECTION_CLOSED";
1132
+ CONTROL_REQUEST_FAILED: "CONTROL_REQUEST_FAILED";
1133
+ EVENT_OVERFLOW: "EVENT_OVERFLOW";
1134
+ FORBIDDEN: "FORBIDDEN";
1135
+ LEASE_CONFLICT: "LEASE_CONFLICT";
1136
+ LEASE_REQUIRED: "LEASE_REQUIRED";
1137
+ NOT_ATTACHED: "NOT_ATTACHED";
1138
+ REQUEST_CANCELLED: "REQUEST_CANCELLED";
1139
+ REQUEST_CAPACITY: "REQUEST_CAPACITY";
1140
+ REQUEST_REJECTED: "REQUEST_REJECTED";
1141
+ RESYNC_EXHAUSTED: "RESYNC_EXHAUSTED";
1142
+ }>;
1113
1143
  message: z.ZodString;
1114
1144
  }, z.core.$strict>;
1115
1145
  }, z.core.$strict>], "outcome">;
@@ -1 +1 @@
1
- {"version":3,"file":"browser-control-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/browser-control-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,wFAAwF;AACxF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAWpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAItB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QACJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGP,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import { type RealtimeClientTransport } from '../browser/realtime-client.js';
2
2
  import { type AgentBrowserRequest } from './browser-control-contract.js';
3
- import { type AgentControlResponse, type AgentControlView } from './control-schema.js';
3
+ import { type AgentControlErrorCode, type AgentControlResponse, type AgentControlView } from './control-schema.js';
4
+ /**
5
+ * Config for `createAgentController`: a realtime transport, one conversation id, `observe` or
6
+ * `control` access, and optional buffer and timeout limits.
7
+ */
4
8
  export interface AgentControllerConfig {
5
9
  transport: RealtimeClientTransport;
6
10
  conversationId: string;
@@ -10,15 +14,27 @@ export interface AgentControllerConfig {
10
14
  maxBufferedBytes?: number;
11
15
  maxPendingRequests?: number;
12
16
  }
17
+ /**
18
+ * Connection status (`connecting` to `closed`), the current conversation view and the last
19
+ * error, as returned by `getSnapshot()`.
20
+ */
13
21
  export interface AgentControllerState {
14
22
  status: 'connecting' | 'ready' | 'disconnected' | 'error' | 'closed';
15
23
  view: AgentControlView;
16
24
  error?: {
17
- code: string;
25
+ code: AgentControlErrorCode;
18
26
  message: string;
19
27
  };
20
28
  }
29
+ /**
30
+ * A browser request without `schemaVersion`, `requestId` and `conversationId`; the controller
31
+ * fills those in.
32
+ */
21
33
  export type AgentBrowserCommand<T extends AgentBrowserRequest = AgentBrowserRequest> = T extends unknown ? Omit<T, 'schemaVersion' | 'requestId' | 'conversationId'> : never;
34
+ /**
35
+ * Browser handle on one conversation: `getSnapshot` and `subscribe` read state, `request`
36
+ * sends a command, `close` detaches (the transport stays yours).
37
+ */
22
38
  export interface AgentController {
23
39
  getSnapshot(): AgentControllerState;
24
40
  subscribe(listener: () => void): () => void;
@@ -26,6 +42,8 @@ export interface AgentController {
26
42
  /** Release this attachment; the supplied transport and remote runtime remain application-owned. */
27
43
  close(): Promise<void>;
28
44
  }
29
- /** One conversation over the existing realtime client; no transport or agent-loop ownership. */
45
+ /**
46
+ * One conversation over the existing realtime client; no transport or agent-loop ownership.
47
+ */
30
48
  export declare function createAgentController(config: AgentControllerConfig): AgentController;
31
49
  //# sourceMappingURL=browser-controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-controller.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/browser-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EAItB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,uBAAuB,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7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