stitchkit 0.104.1 → 0.105.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 (429) hide show
  1. package/CHANGELOG.md +381 -12
  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 +196 -56
  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 +104 -21
  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-kemm0ej5.js → index-1pwwan01.js} +65 -22
  160. package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
  161. package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
  162. package/dist/{index-269zqj8m.js → index-2rc6jd9n.js} +28 -12
  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-adhgd4pe.js → index-5p55xreg.js} +2 -2
  168. package/dist/index-5w6t91ze.js +47 -0
  169. package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
  170. package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
  171. package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
  172. package/dist/index-9tqbxv5p.js +44 -0
  173. package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
  174. package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
  175. package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
  176. package/dist/index-b56nnscm.js +132 -0
  177. package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
  178. package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
  179. package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
  180. package/dist/index-cq59agna.js +51 -0
  181. package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
  182. package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
  183. package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
  184. package/dist/index-eemvahkc.js +21 -0
  185. package/dist/index-ef8gdaq0.js +105 -0
  186. package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
  187. package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
  188. package/dist/{index-f330qqyg.js → index-g2vfg7ak.js} +217 -63
  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-x928baz2.js → index-j9gxbztg.js} +18 -14
  192. package/dist/index-kfjkb396.js +37 -0
  193. package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
  194. package/dist/index-m616f0yz.js +120 -0
  195. package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
  196. package/dist/{index-ptn0g0gj.js → index-ma963wz7.js} +21 -20
  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-szybbezc.js +455 -0
  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-hbd32c6a.js → index-wqmvtnkp.js} +38 -89
  211. package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
  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 +46 -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 +6 -1
  255. package/dist/process/cleanup.d.ts.map +1 -1
  256. package/dist/process/command-lifetime.d.ts +4 -0
  257. package/dist/process/command-lifetime.d.ts.map +1 -1
  258. package/dist/process/command-owner.d.ts.map +1 -1
  259. package/dist/process/command.d.ts +4 -0
  260. package/dist/process/command.d.ts.map +1 -1
  261. package/dist/process/contract.d.ts +67 -2
  262. package/dist/process/contract.d.ts.map +1 -1
  263. package/dist/process/group.d.ts +40 -3
  264. package/dist/process/group.d.ts.map +1 -1
  265. package/dist/process/launch.d.ts +12 -1
  266. package/dist/process/launch.d.ts.map +1 -1
  267. package/dist/process/terminate.d.ts +39 -0
  268. package/dist/process/terminate.d.ts.map +1 -0
  269. package/dist/react/query-client.d.ts.map +1 -1
  270. package/dist/realtime/rejection.d.ts.map +1 -1
  271. package/dist/server/contract-stream.d.ts.map +1 -1
  272. package/dist/server/handler-state.d.ts.map +1 -1
  273. package/dist/server/implement.d.ts.map +1 -1
  274. package/dist/server/request-body.d.ts +0 -1
  275. package/dist/server/request-body.d.ts.map +1 -1
  276. package/dist/server/unix-client.d.ts.map +1 -1
  277. package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
  278. package/dist/telegram/broadcast-failure.d.ts +10 -2
  279. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  280. package/dist/telegram/operator-channel.d.ts.map +1 -1
  281. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  282. package/dist/testing/surface-conformance.d.ts +1 -1
  283. package/dist/testing/surface-conformance.d.ts.map +1 -1
  284. package/dist/testing/surface-manifest.d.ts +0 -6
  285. package/dist/testing/surface-manifest.d.ts.map +1 -1
  286. package/dist/tools/agent.d.ts +1 -1
  287. package/dist/tools/agent.d.ts.map +1 -1
  288. package/dist/tools/cli/args.d.ts +1 -1
  289. package/dist/tools/cli/args.d.ts.map +1 -1
  290. package/dist/tools/cli/help.d.ts.map +1 -1
  291. package/dist/tools/cli/invoke.d.ts +2 -2
  292. package/dist/tools/cli/invoke.d.ts.map +1 -1
  293. package/dist/tools/cli/profile.d.ts.map +1 -1
  294. package/dist/tools/cli/publication-assets.d.ts.map +1 -1
  295. package/dist/tools/cli/publication-contract.d.ts +8 -0
  296. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  297. package/dist/tools/cli/publication-control.d.ts.map +1 -1
  298. package/dist/tools/cli/publication-storage.d.ts +23 -2
  299. package/dist/tools/cli/publication-storage.d.ts.map +1 -1
  300. package/dist/tools/cli/publication.d.ts +8 -1
  301. package/dist/tools/cli/publication.d.ts.map +1 -1
  302. package/dist/tools/connections/errors.d.ts +18 -6
  303. package/dist/tools/connections/errors.d.ts.map +1 -1
  304. package/dist/tools/connections/limits.d.ts +8 -2
  305. package/dist/tools/connections/limits.d.ts.map +1 -1
  306. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  307. package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
  308. package/dist/tools/connections/openapi.d.ts.map +1 -1
  309. package/dist/tools/connections/schema-budget.d.ts +1 -1
  310. package/dist/tools/connections/schema-budget.d.ts.map +1 -1
  311. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  312. package/dist/tools/execute-args.d.ts.map +1 -1
  313. package/dist/tools/execute-result.d.ts.map +1 -1
  314. package/dist/tools/internal/surface-projector.d.ts +17 -3
  315. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  316. package/dist/tools/internal/tool-error-projection.d.ts +16 -0
  317. package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
  318. package/dist/tools/internal/tool-view.d.ts.map +1 -1
  319. package/dist/tools/invoker.d.ts.map +1 -1
  320. package/dist/tools/list-names.d.ts +3 -2
  321. package/dist/tools/list-names.d.ts.map +1 -1
  322. package/dist/tools/manifest.d.ts +3 -2
  323. package/dist/tools/manifest.d.ts.map +1 -1
  324. package/dist/tools/mcp/handler.d.ts +7 -0
  325. package/dist/tools/mcp/handler.d.ts.map +1 -1
  326. package/dist/tools/mcp/mount.d.ts +18 -2
  327. package/dist/tools/mcp/mount.d.ts.map +1 -1
  328. package/dist/tools/mcp/prepare.d.ts +3 -3
  329. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  330. package/dist/tools/mcp/register.d.ts.map +1 -1
  331. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  332. package/dist/tools/mcp/stdio-signals.d.ts +14 -0
  333. package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
  334. package/dist/tools/mcp/stdio.d.ts +7 -0
  335. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  336. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  337. package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
  338. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  339. package/dist/tools/operations/define-wait-tool.d.ts +1 -1
  340. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  341. package/dist/tools/operations/wait-core.d.ts +0 -6
  342. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  343. package/dist/tools/registry.d.ts +1 -1
  344. package/dist/tools/registry.d.ts.map +1 -1
  345. package/dist/tools/remote.d.ts +1 -1
  346. package/dist/tools/remote.d.ts.map +1 -1
  347. package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
  348. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
  349. package/dist/tools/runtime-tool-mcp.d.ts +6 -15
  350. package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
  351. package/dist/tools/runtime-tool.d.ts +14 -12
  352. package/dist/tools/runtime-tool.d.ts.map +1 -1
  353. package/dist/tools/schema/coerce.d.ts +4 -0
  354. package/dist/tools/schema/coerce.d.ts.map +1 -1
  355. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  356. package/dist/tools/surface.d.ts +7 -11
  357. package/dist/tools/surface.d.ts.map +1 -1
  358. package/dist/tools/transfer/define-download-tool.d.ts +1 -1
  359. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  360. package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
  361. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  362. package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
  363. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  364. package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
  365. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  366. package/dist/tools/transfer/view-file.d.ts +1 -1
  367. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  368. package/dist/tools/transports.d.ts +3 -2
  369. package/dist/tools/transports.d.ts.map +1 -1
  370. package/llms/agent-runtime-browser.txt +10 -4
  371. package/llms/agent-runtime-harness.txt +32 -31
  372. package/llms/agent-runtime-react.txt +1 -1
  373. package/llms/agent-runtime-realtime.txt +14 -5
  374. package/llms/agent-runtime-sandbox.txt +3 -11
  375. package/llms/agent-runtime.3.txt +2 -2
  376. package/llms/agent-runtime.txt +0 -9
  377. package/llms/application.2.txt +3 -12
  378. package/llms/application.3.txt +7 -4
  379. package/llms/application.txt +44 -15
  380. package/llms/cli-publish.txt +29 -0
  381. package/llms/cli.2.txt +9 -11
  382. package/llms/cli.txt +26 -14
  383. package/llms/declaration.txt +0 -9
  384. package/llms/files-packaging.txt +22 -7
  385. package/llms/files.txt +4 -2
  386. package/llms/geo.txt +0 -9
  387. package/llms/live.txt +4 -13
  388. package/llms/observability.txt +31 -5
  389. package/llms/primitives.txt +38 -20
  390. package/llms/process.txt +305 -154
  391. package/llms/react-keyboard.txt +0 -9
  392. package/llms/react.txt +0 -18
  393. package/llms/server.4.txt +1 -1
  394. package/llms/server.5.txt +1 -1
  395. package/llms/server.txt +1 -1
  396. package/llms/stitchkit.txt +6 -7
  397. package/llms/telegram-screens.txt +2 -2
  398. package/llms/testing.txt +0 -1
  399. package/llms/tools-mcp.txt +2 -3
  400. package/llms/tools.2.txt +12 -0
  401. package/llms/tools.3.txt +5 -6
  402. package/llms/tools.txt +6 -4
  403. package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
  404. package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
  405. package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
  406. package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
  407. package/llms/upgrading.txt +4 -4
  408. package/llms-full.txt +1053 -405
  409. package/llms.txt +24 -24
  410. package/native-assets.json +11 -3
  411. package/package.json +6 -6
  412. package/dist/agent-runtime/harness-tools.d.ts +0 -11
  413. package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
  414. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
  415. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
  416. package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
  417. package/dist/index-1a6jtnd9.js +0 -88
  418. package/dist/index-8a9ksm91.js +0 -95
  419. package/dist/index-a3wma1hk.js +0 -48
  420. package/dist/index-jd470k6q.js +0 -109
  421. package/dist/index-n1dqr7gf.js +0 -20
  422. package/dist/index-nggfa2yn.js +0 -34
  423. package/dist/index-s4evrmp5.js +0 -98
  424. package/dist/index-ze1eph1k.js +0 -20
  425. package/dist/tools/connections/error-projection.d.ts +0 -4
  426. package/dist/tools/connections/error-projection.d.ts.map +0 -1
  427. package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
  428. package/llms/agent-runtime-harness-tools.txt +0 -25
  429. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
package/CHANGELOG.md CHANGED
@@ -15,7 +15,376 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
- ## [0.104.1] - 2026-10-04
18
+ ## [0.105.0] - 2026-10-05
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** consumers who bundle `stitchkit/files`, `stitchkit/process` or contained-file
23
+ tools for Darwin and relied on the bundler embedding or copying the native addon, and callers
24
+ of `withExclusiveLock` that depended on age-based reclaim of an empty lock file; code that names
25
+ a removed runtime-tool type, imports `stitchkit/agent-runtime/harness-tools` or compares agent
26
+ control error codes; callers that send a JSON array as text to a string-or-array tool field;
27
+ code that constructs an `AppError` or an `ApiError` with more than its code; build scripts
28
+ that read `sourcePath` from a `createNativePackaging` asset, pass it a `platform` other than
29
+ `'darwin'` or parse `native-assets.json`; and
30
+ operators of a diagnostic journal that must not start over damaged retained files, code that
31
+ constructs or reads `DiagnosticJournalRecoveryError`, and protocols that embed
32
+ `DiagnosticJournalRecoveryStatusSchema`; and callers of `runNativeCommand` that pass `killGraceMs`
33
+ or rely on a helper in the command's process group outliving the command;
34
+ and code that imports `publishCli` or its types from `stitchkit/cli`.
35
+
36
+ - `stitchkit/cli` — **`publishCli` moves to the new evolving entrypoint `stitchkit/cli/publish`.**
37
+ `publishCli`, `CliPublicationOptions`, `CliPublicationPhase` and `CliPublicationResult` are no
38
+ longer exported from `stitchkit/cli`, with no re-export left behind. Publication is release
39
+ infrastructure whose limits, staging and recovery are still being found, and the stable CLI
40
+ could not hold its shape; the manifest, signatures, installer and updater it writes for stay in
41
+ `stitchkit/cli`, which remains stable. The call, its options and its result are unchanged.
42
+ `// before: import { publishCli, type CliPublicationOptions } from 'stitchkit/cli'` →
43
+ `// after: import { publishCli, type CliPublicationOptions } from 'stitchkit/cli/publish'`
44
+ **Who must act:** code that imports `publishCli` or a `CliPublication*` type from
45
+ `stitchkit/cli`. See [migration](docs/guide/upgrading.md#cli-publication-has-its-own-entrypoint).
46
+ → ADR 0245
47
+
48
+ - `stitchkit/process` — **`killGraceMs` becomes the `stop` policy.** How a cancelled command
49
+ stops is one named object: `target` `'group'` (the signal goes to every member, as before) or
50
+ `'leader'` (cooperative cancellation: only the leader is signalled, its exit ends the grace and
51
+ whatever it left in the group gets KILL), `signal` (`SIGTERM` by default, or `SIGINT`, `SIGHUP`,
52
+ `SIGQUIT`, `SIGUSR1`, `SIGUSR2`), `graceMs` up to one hour (was 10 000 ms), and `killOn`, an
53
+ `AbortSignal` that ends any grace with KILL to the whole group. The output pipes stay open
54
+ through the grace and its output is dropped, so a leader writing while it shuts down does not
55
+ meet a broken pipe. The process surface ceiling grows by one name, `NativeCommandStopPolicy`.
56
+ `// before: runNativeCommand({ …, killGraceMs: 500 })` →
57
+ `// after: runNativeCommand({ …, stop: { target: 'group', graceMs: 500 } })`
58
+ **Who must act:** callers that pass `killGraceMs`. → ADR 0243
59
+
60
+ - `stitchkit/process` — **a command's leftover group members are stopped after its leader
61
+ exits.** `runNativeCommand` takes `descendants: 'terminate-after-leader' | 'leave'`, and
62
+ omitting it means `'terminate-after-leader'`: once the leader has exited, whatever it left in
63
+ the command's process group is stopped by the `stop` policy before the pipes drain, so a
64
+ command no longer leaks its helpers or waits for one that holds its output pipe. A real daemon
65
+ leaves the group with `setsid` and is unaffected. `'leave'` keeps a helper that has to outlive
66
+ the command.
67
+ `// before: runNativeCommand({ …, timeoutMs }) (the leader's helpers kept running)` →
68
+ `// after: runNativeCommand({ …, timeoutMs, descendants: 'leave' })`
69
+ **Who must act:** callers whose command starts a helper in its own process group that must
70
+ keep running after the command returns. See
71
+ [migration](docs/guide/upgrading.md#a-command-stops-what-its-leader-left).
72
+ → ADR 0246
73
+
74
+ - `stitchkit/server`, `stitchkit/files`, `stitchkit/process` — **bundles no longer emit Darwin
75
+ addons.** The packaged Darwin loader names its addon by a computed path, so a Bun bundle of
76
+ these entrypoints is one JS file with no `.node` output on every operating system, and
77
+ `bun build --outfile` works again for Linux server apps. An artifact that must carry the
78
+ Darwin addon is built with the `stitchkit/files/packaging` plugin; without it the bundle looks
79
+ for the addon beside the original package files and reports the backend `unavailable`
80
+ elsewhere, never a dead owner.
81
+ `// before: bun build src/native.ts --compile --outfile=dist/native (addon embedded)` →
82
+ `// after: Bun.build({ …, plugins: [createNativePackaging({ platform: 'darwin', architecture: process.arch, delivery: 'embedded', entryPath, assetPath }).plugin] })`
83
+ **Who must act:** Darwin packagers of bundled or compiled artifacts using these entrypoints.
84
+ Linux and portable bundles need no change. See [migration](docs/guide/upgrading.md#released-migration-010313).
85
+ → ADR 0235
86
+ - `stitchkit/files/packaging` — **`createNativePackaging` checks each addon against a digest the
87
+ package published, and returns the verified bytes.** `native-assets.json` is now written when
88
+ Stitchkit is built, at `formatVersion: 2`, with the `path`, `size` and `sha256` of every Darwin
89
+ addon present then; the reader refuses any other format version. Before, `sha256` was computed
90
+ from whatever file sat in `node_modules`, so an addon substituted after installation got its own
91
+ "original" digest. Each selected addon is now read once and compared by size and SHA256; a
92
+ difference returns `{ state: 'mismatch', code: 'NATIVE_ASSET_DIGEST_MISMATCH', architecture,
93
+ expected: { size, sha256 }, actual: { size, sha256 } }` for the first differing addon, and an
94
+ architecture the manifest does not list is `missing`. `platform` is the closed enum `'darwin'`:
95
+ another platform is a type error and a schema refusal that throws, no longer an `unsupported`
96
+ result, which now names only an unsupported architecture. A ready asset drops `sourcePath` and
97
+ carries `bytes` (the verified bytes) and the published `size` and `sha256`; embedded delivery
98
+ gives Bun those same bytes instead of reading the file again. Call it once per build and reuse
99
+ the result.
100
+ `// before: copyFileSync(asset.sourcePath, join(outdir, asset.outputPath)) (asset: { sourcePath, outputPath, sha256 })` →
101
+ `// after: writeFileSync(join(outdir, asset.outputPath), asset.bytes) (asset: { outputPath, size, sha256, bytes })`
102
+ `// before: native-assets.json { formatVersion: 1, assets: { arm64: 'native/darwin-arm64.node' } }` →
103
+ `// after: native-assets.json { formatVersion: 2, assets: { arm64: { path, size, sha256 } } }`
104
+ `// before: createNativePackaging({ platform: target.platform, … }) (non-Darwin → 'unsupported')` →
105
+ `// after: if (target.platform === 'darwin') createNativePackaging({ platform: target.platform, … })`
106
+ **Who must act:** build scripts that read `asset.sourcePath`, re-hash the addon themselves,
107
+ switch over the refusal `code`/`state`, parse `native-assets.json`, or pass a `platform` other
108
+ than the literal `'darwin'`.
109
+ See [migration](docs/guide/upgrading.md#native-packaging-verifies-published-digests).
110
+ → ADR 0241
111
+ - `stitchkit/files` — **`withExclusiveLock` publishes its lock with the owner already recorded,
112
+ and `ownerlessGraceMs` defaults to `null`.** The owner record is written to a temporary file
113
+ and hard-linked to the lock name, so the name never exists without an owner and a stalled
114
+ holder can no longer be displaced after the former 5 000 ms default. An empty lock file
115
+ left by an older writer is reclaimed by age only when asked for:
116
+ `// before: withExclusiveLock(path, run) (an empty lock older than 5 s was taken)` →
117
+ `// after: withExclusiveLock(path, run, { ownerlessGraceMs: 5_000 }) (only for legacy empty files)`
118
+ The lock directory must support hard links, and a holder killed mid-publication leaves a
119
+ `.lock-*.tmp` sibling that the next reclaim removes.
120
+ **Who must act:** callers that relied on the age-based reclaim of an empty or unreadable lock
121
+ file, and locks on a filesystem without hard links; every other caller is unaffected.
122
+ See [migration](docs/guide/upgrading.md#exclusive-locks-publish-their-owner-first).
123
+ → ADR 0238
124
+ - `stitchkit/tools/connections` — **a `timeoutMs` or `maxResponseBytes` that is not a positive
125
+ integer within range throws a `RangeError`** instead of falling back to the default. This
126
+ shipped in 0.104.0 without a breaking entry.
127
+ `// before: timeoutMs: 0 (the default applied silently)` →
128
+ `// after: timeoutMs: 0 (RangeError; omit the option to take the default)`
129
+ **Who must act:** callers that passed 0, a negative, a fractional or an oversized limit.
130
+ See [migration](docs/guide/upgrading.md#connection-limits-are-validated).
131
+ - `stitchkit/testing` — **`serializeSurfaceValue` is removed.** It was a second name for the
132
+ package's one canonical serializer. `canonicalJson` from `stitchkit/primitives` is that
133
+ serializer, bounded and with a typed refusal:
134
+ `// before: serializeSurfaceValue(manifest)` →
135
+ `// after: canonicalJson(manifest, { maxBytes: 16 * 1024 * 1024 })`
136
+ **Who must act:** tests that call `serializeSurfaceValue`.
137
+ See [migration](docs/guide/upgrading.md#one-canonical-json-serializer).
138
+ → ADR 0199, ADR 0238
139
+ - `stitchkit/agent-runtime` — **`canonicalAgentJson` follows the one admissibility table of
140
+ `canonicalJson`.** A value nested deeper than 100 levels is refused with a
141
+ `CanonicalJsonError`, and an `undefined` object member is omitted instead of failing. It still
142
+ reads a value as `z.json()` did, so `-0` hashes as `0` and an own `__proto__` member is dropped
143
+ (the public `canonicalJson` refuses `-0` and keeps `__proto__`). Bytes of every value both
144
+ accepted are unchanged, so stored digests and archives still match.
145
+ `// before: canonicalAgentJson({ a: undefined }) threw, a 101-level value was accepted` →
146
+ `// after: canonicalAgentJson({ a: undefined }) === '{}', a 101-level value throws (reason 'depth')`
147
+ **Who must act:** code that puts a value nested deeper than 100 levels into agent store events,
148
+ archives or projections. See
149
+ [migration](docs/guide/upgrading.md#one-canonical-json-serializer).
150
+ - `stitchkit/application` — **`DirectoryInbox` sets a hard-linked entry file aside as
151
+ `invalid`, and `accept` takes the schema's input type.** A dropped file with more than one
152
+ link is never trusted, because another name can still rewrite it (since 0.104.0, without a
153
+ changelog entry). `DirectoryInboxConfig` gains the schema input type as a second type
154
+ parameter, and `DirectoryInbox` and `DirectoryInboxResource` take that input type as their one
155
+ parameter (it was the entry type); for a schema without a transform the two are equal and
156
+ nothing changes.
157
+ `// before: accept({ ...identity, entry: { amount: 42 } }) (the output of z.string().transform(Number))` →
158
+ `// after: accept({ ...identity, entry: { amount: '42' } }) (the input; it is stored as given and parsed on delivery)`
159
+ **Who must act:** producers that drop hard links into an inbox directory, and callers that pass
160
+ `accept` the output of a transforming schema.
161
+ See [migration](docs/guide/upgrading.md#directory-inbox-entries).
162
+ - `stitchkit/application` — **`createDiagnosticJournal` checks only the last line of each file
163
+ when it opens** (`startupScan: 'tails'`, the default), so opening no longer parses and
164
+ validates every line of every retained generation. The scan still reads each file once in
165
+ large blocks to count lines, so opening still takes time proportional to the bytes retained,
166
+ at read speed. `recovery` in the status no longer reports a damaged row in the
167
+ middle of a file unless the journal is opened with `startupScan: 'full'`.
168
+ `// before: createDiagnosticJournal({ path, eventSchema, limits }) (every line of every file was parsed)` →
169
+ `// after: createDiagnosticJournal({ path, eventSchema, limits, startupScan: 'full' }) (the same full scan)`
170
+ **Who must act:** operators that read `recovery` at startup to find damaged rows in the middle
171
+ of a file. See [migration](docs/guide/upgrading.md#journal-startup-scan).
172
+ - `stitchkit/application/diagnostic-journal`, `stitchkit/application` — **opening a diagnostic
173
+ journal moves a file it cannot keep in place aside and starts, instead of refusing to start.**
174
+ A torn active file with `maxFiles: 1`, a generation name that is not a regular file and a
175
+ retained file that cannot be read are renamed to `<file>.quarantined-<epoch>` beside the
176
+ journal (`onStartupRefusal: 'quarantine'`, the default) and never deleted. Every open lists
177
+ every quarantined file beside the journal in `getStatus().recovery.quarantined` until the
178
+ operator removes it: the ones it moved first, with their `reason`, then earlier ones without
179
+ one; at most 32, with `quarantinedUnlisted` counting the rest.
180
+ `onStartupRefusal: 'fail'` keeps refusing, now always with
181
+ one typed `DiagnosticJournalRecoveryError` whose `reason` is
182
+ `'torn-without-retention-slot' | 'not-a-regular-file' | 'unreadable'`; its constructor takes
183
+ an options object and `recovery` is present only for a torn single slot.
184
+ `DiagnosticJournalRecoveryStatusSchema` gains the optional `quarantined` and
185
+ `quarantinedUnlisted` fields; the schema is `.strict()`, so a reader parsing with an older copy
186
+ refuses a status that carries them.
187
+ `// before: createDiagnosticJournal({ path, eventSchema, limits }) (threw on a damaged or unreadable retained file)` →
188
+ `// after: createDiagnosticJournal({ path, eventSchema, limits, onStartupRefusal: 'fail' }) (the same refusal, typed)`
189
+ **Who must act:** operators of a journal that is a source of truth and must not start over
190
+ damage (declare `'fail'`); code that constructs `DiagnosticJournalRecoveryError` or reads its
191
+ `recovery`; protocols that embed `DiagnosticJournalRecoveryStatusSchema` and their readers.
192
+ See [migration](docs/guide/upgrading.md#journal-startup-quarantine).
193
+ → ADR 0240
194
+
195
+ - `stitchkit/cli`, `stitchkit/tools`, `stitchkit/tools/mcp` — **one runtime-tool declaration.**
196
+ `RuntimeToolExecution`, `RuntimeToolExecutionWithOutput` (cli), `RuntimeMcpToolDefinition`,
197
+ `RuntimeMcpToolDefinitionWithOutput` (tools/mcp) and `ToolSurfaceDefinition` (tools) are removed.
198
+ `RuntimeToolDefinition`, `RuntimeToolDefinitionWithOutput` and `RuntimeToolDefinitionWithoutOutput`
199
+ are the same neutral, peer-free types on all three entrypoints, and the presenters are the
200
+ adapter's extension: the fourth type argument of `RuntimeToolDefinitionWithOutput`
201
+ (`RuntimeMcpToolPresenters<…>` on `tools/mcp`, `RuntimeToolPresenters<…>` on `tools`), or
202
+ `defineRuntimeTool`, which fixes it. `RuntimeToolDefinition` is the one registration type, and an
203
+ inline handler written in `runtimeTools: [...]` is typed again instead of failing with TS2339 on
204
+ `never`. `ToolSurfaceProjection` is the one surface container.
205
+ `// before: satisfies RuntimeToolExecutionWithOutput<typeof input, typeof output>` →
206
+ `// after: satisfies RuntimeToolDefinitionWithOutput<typeof input, typeof output>`
207
+ `// before: satisfies RuntimeMcpToolDefinitionWithOutput<typeof input, typeof output>` →
208
+ `// after: satisfies RuntimeToolDefinitionWithOutput<typeof input, typeof output, undefined, RuntimeMcpToolPresenters<z.output<typeof output>>>`
209
+ **Who must act:** code that names a removed type, and code that annotates a definition with
210
+ presenters as `RuntimeToolDefinitionWithOutput<I, O>` from `stitchkit/tools` (use `defineRuntimeTool`
211
+ or pass the presenter type as the fourth argument). Values returned by `defineRuntimeTool` and
212
+ `createRuntimeToolFactory` need no change.
213
+ See [migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
214
+ → ADR 0236, ADR 0238
215
+ - `stitchkit/tools`, `stitchkit/tools/mcp` — **a flattened union keeps declaration order.**
216
+ With `flattenUnionInput: true`, properties, enum values and branch labels are advertised in the
217
+ order of their first appearance across the variants instead of alphabetically, so the bytes of
218
+ every flattened tool listing (and any provider prompt cache keyed on them) change once.
219
+ Alternatives of different kinds (`anyOf`) keep their one canonical order.
220
+ `// before: union([{ kind: 'b', z: 1 }, { kind: 'a', a: 1 }]) → properties kind, a, z; kind enum a|b` →
221
+ `// after: the same union → properties kind, z, a; kind enum b|a`
222
+ **Who must act:** consumers with snapshot tests or caches of flattened tool schemas, and
223
+ anyone using `flattenUnionInput: true`: regenerate the snapshots.
224
+ See [migration](docs/guide/upgrading.md#flattened-unions-keep-declaration-order).
225
+ → ADR 0238
226
+ - `stitchkit/tools`, `stitchkit/cli` — **a list written as text is refused in every
227
+ string-or-array field.** `coerceJsonArgs`, and so every tool surface, throws a validation error
228
+ naming the field when a union that keeps a string member receives a string that parses to an
229
+ array the union's array member accepts. Before, `'["a","b"]'` in `z.union([z.string(),
230
+ z.array(z.string())])` was read as one plain string. The `view_file`-only refusal is this rule;
231
+ a list written as text as an *element* of the array is no longer refused by name.
232
+ `// before: { paths: '["a.png"]' } (the string "[\"a.png\"]" reached the handler)` →
233
+ `// after: { paths: ['a.png'] } (the text form is VALIDATION_ERROR: "paths is a list written as text")`
234
+ **Who must act:** callers that send a JSON array as text to a string-or-array field; a plain
235
+ string, including one that is not a list the array member accepts, is unchanged.
236
+ → ADR 0218, ADR 0239, ADR 0238
237
+ - `stitchkit/agent-runtime` — **the `stitchkit/agent-runtime/harness-tools` leaf is removed.** It
238
+ was one `mountAgent` call with the run's fence composed in; no consumer imported it.
239
+ `// before: tools: createAgentHarnessTools(({ context }) => ({ services: [svc], context }))` →
240
+ `// after: tools: ({ context, toolFenceLifecycle }) => mountAgent([svc], { context, lifecycle: composeToolLifecycle(undefined, toolFenceLifecycle) })`
241
+ **Who must act:** imports of `stitchkit/agent-runtime/harness-tools`. See
242
+ [migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
243
+ - `stitchkit/agent-runtime/realtime`, `stitchkit/agent-runtime/browser` — **control errors use one
244
+ vocabulary, and the binding authorizes requests, not events.** `ACCESS_DENIED` is `FORBIDDEN`, and
245
+ a closed connection answers `CONNECTION_CLOSED` instead of a denial. `AgentControlErrorCode`
246
+ (`AgentControlErrorCodeSchema`) is the closed set every response and `AgentControllerState.error`
247
+ carries. `authorize` receives `source: 'request' | 'delivery'` and runs once per request; the
248
+ events of an attached conversation flow under the grant that request created until
249
+ `binding.revoke(conversationId, matches?)` drops it, and a refusal then reaches the browser as an
250
+ `access-denied` delivery that puts the controller in `error` (`FORBIDDEN`). A reconnect rejects
251
+ the previous connection's requests so a small `maxPendingRequests` cannot leave the controller in
252
+ `connecting`. Both leaves are evolving and experimental.
253
+ `// before: if (state.error?.code === 'ACCESS_DENIED') …` →
254
+ `// after: if (state.error?.code === 'FORBIDDEN') …`
255
+ **Who must act:** code that compares control error codes, and applications that revoke access while
256
+ a stream is open (call `binding.revoke`; before, every event re-asked `authorize`).
257
+ - `stitchkit/contract`, `stitchkit/server`, `stitchkit/node` — **`AppError` takes its fields by
258
+ name.** The constructor had seven positions, so a call that set only `retryable` read
259
+ `new AppError(code, message, 409, undefined, undefined, undefined, true)`. The code stays first;
260
+ everything else is one options object, and `new AppError(code)` still works:
261
+ `// before: new AppError('CONFLICT', 'stale', 409, { revision: 7 }, 'reload', undefined, false)` →
262
+ `// after: new AppError('CONFLICT', { message: 'stale', status: 409, details: { revision: 7 }, hint: 'reload', retryable: false })`
263
+ The options are `message`, `status` (default 500), `details`, `hint`, `traceId`, `retryable` and
264
+ the standard `cause`. A subclass calls `super(code, { message, status })` the same way.
265
+ **Who must act:** code that constructs an `AppError` or extends it with more than the code.
266
+ The `notFound`, `badRequest`, `unauthorized`, `forbidden`, `conflict` and `rateLimited` helpers
267
+ are unchanged. See [migration](docs/guide/upgrading.md#error-constructors-take-named-options).
268
+ → ADR 0238
269
+ - `stitchkit` — **`ApiError` takes its fields by name.** The constructor had eight positions
270
+ and call sites ended in `undefined, undefined, retryable`. The code stays first and the rest
271
+ is one options object; `new ApiError(code)` still works:
272
+ `// before: new ApiError('RATE_LIMITED', 429, undefined, 'slow down', 'wait', 'trace-1', { cause }, true)` →
273
+ `// after: new ApiError('RATE_LIMITED', { status: 429, message: 'slow down', hint: 'wait', traceId: 'trace-1', retryable: true, cause })`
274
+ The options are `status` (default 0), `details`, `message`, `hint`, `traceId`, `retryable` and
275
+ `cause`. **Who must act:** code that constructs an `ApiError`, which is mostly tests and
276
+ custom transports; code that only reads `code`, `status`, `details`, `hint`, `traceId`,
277
+ `retryable` or `cause` is unaffected. See
278
+ [migration](docs/guide/upgrading.md#error-constructors-take-named-options).
279
+ → ADR 0238
280
+
281
+ ### Added
282
+
283
+ - `stitchkit/files` — `isAtomicStagingName(name)` and `sweepAtomicStaging({ directory,
284
+ olderThanMs, signal })` recognise and remove the staging files that an atomic write killed
285
+ before publication leaves beside its target. The staging name `.stitchkit-<24 lowercase
286
+ hex>.tmp` is now a **stable public contract**: one module produces it for `writeFileAtomic`,
287
+ `writeFileAtomicSync`, the managed writer, the chunk spool and the agent runtime's contained
288
+ write, and changing it is a breaking change. The sweep removes only regular files older than
289
+ the required `olderThanMs`, never follows a symlink and never enters a subdirectory; sweeping
290
+ abandoned staging is the caller's responsibility. The files surface ceiling grows by three
291
+ names. → ADR 0242
292
+ - `stitchkit/primitives` — `canonicalJson` refuses with a `CanonicalJsonError` (a `TypeError`)
293
+ whose `reason` is `'cycle' | 'negative-zero' | 'depth' | 'nodes' | 'bytes' | 'not-json'`
294
+ (`CanonicalJsonRefusal`), so an exceeded limit is told apart from a value that is not JSON.
295
+ The primitives surface ceiling grows by two names and the testing ceiling shrinks by one.
296
+ - `stitchkit/application` — `FileStateStoreOptions.maxBytes` bounds the state read (default
297
+ 64 MiB); a larger file is refused before it is parsed and is not reported as corruption.
298
+ `DiagnosticJournalConfig.startupScan: 'tails' | 'full'` chooses what opening reads.
299
+
300
+ ### Documentation
301
+
302
+ - `stitchkit/observability`: request rows, `runUnitOfWork` rows and schedule status carry no
303
+ per-operation CPU, by decision (ADR 0244). A `process.cpuUsage()` delta across an operation's
304
+ wall-clock interval absorbs every interleaved operation and timer, and Bun gives no async
305
+ segment boundary to measure correctly. The guide
306
+ ([CPU is not attributed to work](docs/guide/observability.md#cpu-is-not-attributed-to-work))
307
+ states the process-CPU window you can observe and the rule for building attribution yourself.
308
+ - 0.103.13 shipped two breaking changes as a patch: the Darwin native-asset delivery and the
309
+ refusal of repeated non-array CLI options. The upgrade guide now carries a migration for each
310
+ ([native assets](docs/guide/upgrading.md#released-migration-010313),
311
+ [repeated options](docs/guide/upgrading.md#cli-repeated-options-are-refused)). `release:check`
312
+ refuses a patch whose notes carry any breaking marker.
313
+
314
+ ### Fixed
315
+
316
+ - `stitchkit/agent-runtime`: `probeAgentProcessSandbox` never rejects. A `probe()` that throws
317
+ synchronously, rejects or returns something that is not a grade resolves to
318
+ `{ grade: 'unavailable', reason }` with a fixed reason (`'sandbox probe failed'` or
319
+ `'sandbox probe returned no valid grade'`), cached like any grade until `refresh: true`. The
320
+ cause (an adapter error may carry absolute paths) stays out of the grade and is emitted as a
321
+ process warning. A synchronous throw used to escape raw and was not cached. The probe cache is
322
+ keyed by the sandbox object, so a sandbox is expected to be long-lived.
323
+ - `stitchkit/agent-runtime/coding-tools`: a sandbox `prepare()` that throws refuses the command
324
+ with `SANDBOX_UNAVAILABLE` and the fixed reason `'sandbox prepare failed'`; the adapter's error
325
+ message no longer reaches the agent. The original error of a failed `prepare()` or `probe()`
326
+ rides on the refusal as its `cause`, which the mount's `hooks.onToolError` (and
327
+ `afterToolCall`'s `error`) receives, so an application with a structured log records it
328
+ there; the tool envelope carries only the code and the fixed reason, and the coding tools emit
329
+ no process warning. `probeAgentProcessSandbox` called directly still warns, because it
330
+ returns only the grade.
331
+ - `stitchkit/process`: a group that reported `ESRCH` is not sent SIGKILL afterwards, so a
332
+ recycled group id is never signalled.
333
+ - `stitchkit/agent-runtime`: a stopped coding command is classified by a typed stop reason
334
+ instead of its message text; the sandbox terminates a direct child's group without wrapping it
335
+ in a placeholder command, and a slot whose cleanup was not proven stays occupied (documented).
336
+ - `stitchkit/application`: a `DirectoryInbox` entry whose name is already in `rejected/` no
337
+ longer stops the pass with `EEXIST`. Identical bytes are the entry already set aside and the
338
+ new file is only removed; different bytes are kept under `<name>.<first 16 hex of SHA-256>`.
339
+ A failure of one entry's own file is reported through `onError` and the pass continues with the
340
+ next entry, and an entry that changes during its read or is not a regular file is released
341
+ for a later attempt instead of throwing out of the pass.
342
+ - `stitchkit/application`: `createFileStateStore` commits nothing for a transition whose
343
+ resulting state encodes to the bytes it started from (the directory inbox passes over
344
+ already-receipted files without a single write), and reads and fences the lock fewer times per update. Every update still reads and
345
+ rewrites the whole state, so keep `retain` of the directory inbox as small as duplicate
346
+ detection needs.
347
+ - `stitchkit/cli/publish`: `publishCli` removes `.publish-*` staging directories left by a publisher that
348
+ died mid-build, under its publication lock, so they no longer fill the directory entry cap.
349
+ Each stored version is decompressed once per publication instead of up to five times.
350
+ - `stitchkit/files`: one descriptor open and one atomic staging sequence serve every managed
351
+ read and write. `rejectSymlinks` alone decides whether a symlink leaf is followed, a
352
+ too-large file reports its observation whatever its link count, and the managed writer stages
353
+ through a hidden `.stitchkit-<random>.tmp` file whose length does not depend on the target name. The synchronous atomic write has the same
354
+ fault controls as the asynchronous one.
355
+ - `stitchkit/remote`: `implementRemote` keeps the status and the retryability of a remote failure
356
+ that carries no stitchkit error envelope. A `503` page, a `429` or a `404` becomes `HTTP_ERROR`
357
+ with that status and a fixed message, and a refused connection becomes `CONNECTION_REQUEST_FAILED`
358
+ (`502`); neither carries `details`, so the upstream body, URL and credentials stay in the raw cause.
359
+ Before, both became `INTERNAL_SERVER_ERROR` `500`, which says `retryable: false`. One rule decides
360
+ `retryable` for every origin: the declared value, else the status (`408` included, so a deadline the
361
+ remote client hit is retryable like a local `408`; a cancelled call stays `false`).
362
+ - `stitchkit/cli`: command help prints only the bounds a schema declares. An integer prints
363
+ `<integer>` instead of `[>=-9007199254740991, <=9007199254740991]`; `.min(1)` prints `>=1` and
364
+ `.positive()` prints `>0`. Repeating `-h` or `--help` in any spelling shows help instead of an
365
+ argument error.
366
+ - `stitchkit/telegram`: a broadcast caps its own backoff between transient failures at
367
+ `maxRetryDelayMs` (computed by the shared backoff formula) and halts only when the provider's
368
+ `retry-after` exceeds that limit. With `maxRetryDelayMs: 5000` the fourth transient failure used
369
+ to halt the whole broadcast.
370
+ - `stitchkit/agent-runtime`: the realtime binding's `authorize` hook gets one deadline shared
371
+ with every other bounded wait, and deliveries that arrive while it is deciding share its one
372
+ answer instead of asking again.
373
+ - Limit options that are not positive safe integers are refused with one message that ends in the
374
+ value received, in `stitchkit/application`, `stitchkit/files`, `stitchkit/server`,
375
+ `stitchkit/agent-runtime`, `stitchkit/primitives` and `stitchkit/process`.
376
+
377
+ ## [0.104.2] — 2026-10-04
378
+
379
+ ### Added
380
+
381
+ - `stitchkit/files/packaging`: one multi-target companion plugin packages both Darwin addons into a universal JS artifact; explicit per-architecture output paths preserve single-target and embedded recipes.
382
+
383
+ ### Fixed
384
+
385
+ - Native qualification waits for the helper’s actual first write instead of inferring readiness from startup timing.
386
+
387
+ ## [0.104.1] — 2026-10-04
19
388
 
20
389
  ### Added
21
390
 
@@ -30,7 +399,7 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
30
399
  [upgrade guide](docs/guide/upgrading.md#released-migration-010313), including single-file
31
400
  packaging, complete output graphs and the distinct npm/JS/compiled delivery paths.
32
401
 
33
- ## [0.104.0] - 2026-10-04
402
+ ## [0.104.0] — 2026-10-04
34
403
 
35
404
  ### ⚠️ Breaking changes
36
405
 
@@ -125,7 +494,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
125
494
  names, CLI +4 publisher names; connection diagnostics and policy gain named public types.
126
495
  The MCP leaf shares existing owners and gives strict MCP construction its own contracts.
127
496
 
128
- ## [0.103.13] - 2026-10-04
497
+ ## [0.103.13] — 2026-10-04
129
498
 
130
499
  ### ⚠️ Delivery migration
131
500
 
@@ -152,7 +521,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
152
521
  argument error instead of silently selecting `false`. Single options, array repetition,
153
522
  untyped passthrough lists and command help retain their grammar.
154
523
 
155
- ## [0.103.12] - 2026-10-03
524
+ ## [0.103.12] — 2026-10-03
156
525
 
157
526
  ### Fixed
158
527
 
@@ -171,7 +540,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
171
540
  bounds requests, bodies and waits with one elapsed deadline.
172
541
 
173
542
 
174
- ## [0.103.11] - 2026-10-02
543
+ ## [0.103.11] — 2026-10-02
175
544
 
176
545
  ### Added
177
546
 
@@ -184,7 +553,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
184
553
  - `stitchkit/agent-runtime`: coding commands share the native execution owner while retaining forced descendant cleanup, structural sandbox launchers, bounded artifacts and UTF-8 previews.
185
554
  - 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.
186
555
 
187
- ## [0.103.10] - 2026-10-01
556
+ ## [0.103.10] — 2026-10-01
188
557
 
189
558
  ### Added
190
559
 
@@ -192,7 +561,7 @@ native CLI commands and ordinary one-argument state transitions remain valid.
192
561
  - `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.
193
562
  - 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.
194
563
 
195
- ## [0.103.9] - 2026-10-01
564
+ ## [0.103.9] — 2026-10-01
196
565
 
197
566
  ### Added
198
567
 
@@ -205,31 +574,31 @@ native CLI commands and ordinary one-argument state transitions remain valid.
205
574
  - 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.
206
575
  - 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.
207
576
 
208
- ## [0.103.8] - 2026-10-01
577
+ ## [0.103.8] — 2026-10-01
209
578
 
210
579
  ### Fixed
211
580
 
212
581
  - Clarify core prepack build ownership in release assembly to prevent restoring a duplicate build.
213
582
 
214
- ## [0.103.7] - 2026-10-01
583
+ ## [0.103.7] — 2026-10-01
215
584
 
216
585
  ### Fixed
217
586
 
218
587
  - 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.
219
588
 
220
- ## [0.103.6] - 2026-10-01
589
+ ## [0.103.6] — 2026-10-01
221
590
 
222
591
  ### Fixed
223
592
 
224
593
  - Document fast-gate attestation boundaries and retained lane-environment checks for release verification.
225
594
 
226
- ## [0.103.5] - 2026-10-01
595
+ ## [0.103.5] — 2026-10-01
227
596
 
228
597
  ### Fixed
229
598
 
230
599
  - Clarify release delivery checks: ordinary registry visibility, matching artifact bytes and fresh installed Bun/Node consumers.
231
600
 
232
- ## [0.103.4] - 2026-10-01
601
+ ## [0.103.4] — 2026-10-01
233
602
 
234
603
  ### Fixed
235
604
 
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
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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,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,CAAC;CACxB;AAgCD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAEpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"coding-shell-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-shell-process.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,qBAAqB,EAAqB,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAuCrD,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACrE;;;;;;;;;;;;;;;GAkKA"}
1
+ {"version":3,"file":"coding-shell-process.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-shell-process.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAAqB,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAuCrD,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACrE;;;;;;;;;;;;;;;GA4JA"}
@@ -45,6 +45,7 @@ export type CodingRefusalCode = (typeof REFUSAL_CODES)[number];
45
45
  export declare function codingRefusal(code: CodingRefusalCode, message: string, options?: {
46
46
  details?: Record<string, unknown>;
47
47
  hint?: string;
48
+ cause?: unknown;
48
49
  }): never;
49
50
  /** The workspace path a refusal may name — never a host path. */
50
51
  export declare function codingPathRefusal(code: CodingRefusalCode, message: string, path: string, options?: {