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
@@ -1,34 +1,99 @@
1
1
  import { z } from 'zod';
2
- declare const OptionsSchema: z.ZodObject<{
3
- platform: z.ZodString;
2
+ declare const ArchitectureSchema: z.ZodEnum<{
3
+ arm64: "arm64";
4
+ x64: "x64";
5
+ }>;
6
+ /** The platforms this package ships native addons for; any other name is refused by the schema. */
7
+ declare const PlatformSchema: z.ZodEnum<{
8
+ darwin: "darwin";
9
+ }>;
10
+ declare const SingleOptionsSchema: z.ZodObject<{
11
+ platform: z.ZodEnum<{
12
+ darwin: "darwin";
13
+ }>;
14
+ entryPath: z.ZodString;
4
15
  architecture: z.ZodString;
5
16
  delivery: z.ZodEnum<{
6
17
  companion: "companion";
7
18
  embedded: "embedded";
8
19
  }>;
9
- entryPath: z.ZodString;
10
20
  assetPath: z.ZodString;
11
21
  }, z.core.$strip>;
22
+ declare const MultipleOptionsSchema: z.ZodObject<{
23
+ platform: z.ZodEnum<{
24
+ darwin: "darwin";
25
+ }>;
26
+ entryPath: z.ZodString;
27
+ architecture: z.ZodArray<z.ZodString> & z.ZodType<[string, ...string[]], string[], z.core.$ZodTypeInternals<[string, ...string[]], string[]>>;
28
+ delivery: z.ZodLiteral<"companion">;
29
+ assetPath: z.ZodRecord<z.ZodString, z.ZodString>;
30
+ }, z.core.$strip>;
12
31
  declare const AssetSchema: z.ZodObject<{
13
- sourcePath: z.ZodString;
14
32
  outputPath: z.ZodString;
33
+ size: z.ZodInt;
34
+ sha256: z.ZodString;
35
+ bytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
36
+ }, z.core.$strip>;
37
+ declare const TargetAssetSchema: z.ZodObject<{
38
+ outputPath: z.ZodString;
39
+ size: z.ZodInt;
15
40
  sha256: z.ZodString;
41
+ bytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
42
+ architecture: z.ZodEnum<{
43
+ arm64: "arm64";
44
+ x64: "x64";
45
+ }>;
16
46
  }, z.core.$strip>;
17
- declare const RefusalSchema: z.ZodObject<{
18
- state: z.ZodEnum<{
19
- missing: "missing";
20
- unsupported: "unsupported";
47
+ declare const RefusalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ state: z.ZodLiteral<"unsupported">;
49
+ platform: z.ZodEnum<{
50
+ darwin: "darwin";
21
51
  }>;
22
- platform: z.ZodString;
23
52
  architecture: z.ZodString;
24
- code: z.ZodEnum<{
25
- NATIVE_ASSET_MISSING: "NATIVE_ASSET_MISSING";
26
- NATIVE_TARGET_UNSUPPORTED: "NATIVE_TARGET_UNSUPPORTED";
53
+ code: z.ZodLiteral<"NATIVE_TARGET_UNSUPPORTED">;
54
+ }, z.core.$strip>, z.ZodObject<{
55
+ state: z.ZodLiteral<"missing">;
56
+ platform: z.ZodEnum<{
57
+ darwin: "darwin";
27
58
  }>;
28
- }, z.core.$strip>;
29
- export type NativePackagingOptions = z.input<typeof OptionsSchema>;
30
- export type NativePackagingAsset = z.infer<typeof AssetSchema>;
31
- /** Structural Bun plugin protocol: declarations need no Bun runtime or ambient types. */
59
+ architecture: z.ZodEnum<{
60
+ arm64: "arm64";
61
+ x64: "x64";
62
+ }>;
63
+ code: z.ZodLiteral<"NATIVE_ASSET_MISSING">;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ state: z.ZodLiteral<"mismatch">;
66
+ platform: z.ZodEnum<{
67
+ darwin: "darwin";
68
+ }>;
69
+ architecture: z.ZodEnum<{
70
+ arm64: "arm64";
71
+ x64: "x64";
72
+ }>;
73
+ code: z.ZodLiteral<"NATIVE_ASSET_DIGEST_MISMATCH">;
74
+ expected: z.ZodObject<{
75
+ size: z.ZodInt;
76
+ sha256: z.ZodString;
77
+ }, z.core.$strip>;
78
+ actual: z.ZodObject<{
79
+ size: z.ZodInt;
80
+ sha256: z.ZodString;
81
+ }, z.core.$strip>;
82
+ }, z.core.$strip>], "state">;
83
+ /**
84
+ * Input to `createNativePackaging`: platform, entry path, delivery and addon path per
85
+ * architecture; `Multiple` selects one target or a list of them.
86
+ */
87
+ export type NativePackagingOptions<Multiple extends boolean = false> = Multiple extends true ? z.input<typeof MultipleOptionsSchema> : z.input<typeof SingleOptionsSchema>;
88
+ /**
89
+ * One native addon to ship with the bundle: where it lands in the output, its `bytes` already
90
+ * checked against the `size` and `sha256` the package published, and those published values.
91
+ * Write `bytes` to `outputPath`; never read the addon from the installed package a second time.
92
+ */
93
+ export type NativePackagingAsset<Multiple extends boolean = false> = Multiple extends true ? z.infer<typeof TargetAssetSchema> : z.infer<typeof AssetSchema>;
94
+ /**
95
+ * Structural Bun plugin protocol: declarations need no Bun runtime or ambient types.
96
+ */
32
97
  export type NativePackagingPlugin = {
33
98
  name: string;
34
99
  setup: (build: {
@@ -46,6 +111,9 @@ export type NativePackagingPlugin = {
46
111
  }) => {
47
112
  contents: string;
48
113
  loader: 'js';
114
+ } | {
115
+ contents: Uint8Array;
116
+ loader: 'napi';
49
117
  } | undefined) => unknown;
50
118
  onResolve: (options: {
51
119
  filter: RegExp;
@@ -58,15 +126,30 @@ export type NativePackagingPlugin = {
58
126
  } | undefined) => unknown;
59
127
  }) => void;
60
128
  };
61
- export type NativePackagingResult = z.infer<typeof RefusalSchema> | {
129
+ /**
130
+ * `ready` with the verified assets to write and the Bun plugin to add, or a refusal naming an
131
+ * unsupported architecture, a missing asset or an asset whose bytes differ from the published
132
+ * digest (`mismatch` carries the `expected` and `actual` size and SHA256); check `state` first.
133
+ */
134
+ export type NativePackagingResult<Multiple extends boolean = false> = z.infer<typeof RefusalSchema> | {
62
135
  state: 'ready';
63
- platform: 'darwin';
64
- architecture: 'arm64' | 'x64';
136
+ platform: z.infer<typeof PlatformSchema>;
137
+ architecture: Multiple extends true ? z.infer<typeof ArchitectureSchema>[] : z.infer<typeof ArchitectureSchema>;
65
138
  packageVersion: string;
66
- assets: NativePackagingAsset[];
139
+ assets: NativePackagingAsset<Multiple>[];
67
140
  plugin: NativePackagingPlugin;
68
141
  };
69
- /** Resolve this installed package's asset graph, without parsing downstream loader text. */
142
+ /**
143
+ * Resolve this installed package's asset graph, without parsing downstream loader text.
144
+ * `platform` is `'darwin'`, the only platform with native addons; another name throws.
145
+ * Each selected addon is read and hashed once per call and checked against the size and
146
+ * SHA256 published in the package's `native-assets.json`; the first one that differs refuses
147
+ * with `NATIVE_ASSET_DIGEST_MISMATCH` and its `expected` and `actual` size and SHA256. Call it
148
+ * once per build and reuse the result: its `assets` carry the verified bytes to write and its
149
+ * plugin embeds those same bytes.
150
+ */
70
151
  export declare function createNativePackaging(options: NativePackagingOptions): NativePackagingResult;
152
+ export declare function createNativePackaging(options: NativePackagingOptions<true>): NativePackagingResult<true>;
153
+ export declare function createNativePackaging(options: NativePackagingOptions<boolean>): NativePackagingResult<boolean>;
71
154
  export {};
72
155
  //# sourceMappingURL=native-packaging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-packaging.d.ts","sourceRoot":"","sources":["../../src/files/native-packaging.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,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C,OAAO,kBAAkB,CAAC,EAAE,GACpC,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC;IACzC,MAAM,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAsFN;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;AAC9F,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,CAAC,IAAI,CAAC,GACpC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAC/B,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACvC,qBAAqB,CAAC,OAAO,CAAC,CAAC"}
@@ -9,8 +9,8 @@ import {
9
9
  AgentSnapshotSchema2
10
10
  } from "./index-8kzct1d6.js";
11
11
  import {
12
- serializeCanonicalJson
13
- } from "./index-zsvzhjtk.js";
12
+ canonicalZodJson
13
+ } from "./index-5w6t91ze.js";
14
14
 
15
15
  // src/durability/events.ts
16
16
  import { z } from "zod";
@@ -225,7 +225,10 @@ function agentStoreEventDraft(input) {
225
225
  };
226
226
  }
227
227
  function canonicalAgentJson2(value) {
228
- return serializeCanonicalJson(z3.json().parse(value));
228
+ return canonicalZodJson(value, {
229
+ maxNodes: Number.MAX_SAFE_INTEGER,
230
+ maxBytes: Number.MAX_SAFE_INTEGER
231
+ });
229
232
  }
230
233
  var AgentConversationArchiveSchema2 = z3.object({
231
234
  format: z3.literal("stitchkit.agent-conversation"),
@@ -45,19 +45,7 @@ var ViewFileOutputSchema2 = z2.object({
45
45
  content: z2.array(McpMediaContentSchema2),
46
46
  errors: z2.array(ViewFileErrorSchema2)
47
47
  });
48
- function isTextList(value) {
49
- if (!value.trimStart().startsWith("["))
50
- return false;
51
- try {
52
- return Array.isArray(JSON.parse(value));
53
- } catch {
54
- return false;
55
- }
56
- }
57
- var MediaPathSchema = z2.string().refine((value) => !isTextList(value), {
58
- message: "paths is a list written as text — pass an array of paths or one path"
59
- });
60
48
  var ViewFileInputSchema2 = z2.object({
61
- paths: z2.union([MediaPathSchema, z2.array(MediaPathSchema).max(MAX_VIEW_FILES)]).describe("One media URL or file path, or an array of them. Pass the array itself, not JSON written as text.")
49
+ paths: z2.union([z2.string(), z2.array(z2.string()).max(MAX_VIEW_FILES)]).describe("One media URL or file path, or an array of them. Pass the array itself, not JSON written as text.")
62
50
  });
63
51
  export { AsyncOperationCancelResultSchema2, createAsyncOperationSnapshotSchema2, McpAnnotationsSchema2, McpMediaContentSchema2, ViewFileErrorSchema2, ViewFileOutputSchema2, ViewFileInputSchema2 };
@@ -0,0 +1,8 @@
1
+ // src/internal/positive-integer.ts
2
+ function assertPositiveSafeInteger(name, value, errorType = TypeError) {
3
+ if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {
4
+ throw new errorType(`${name} must be a positive safe integer, received ${value}`);
5
+ }
6
+ }
7
+
8
+ export { assertPositiveSafeInteger };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AppError2
3
- } from "./index-x928baz2.js";
3
+ } from "./index-j9gxbztg.js";
4
4
  import {
5
5
  ShutdownOptionsSchema2
6
6
  } from "./index-q0th8q0z.js";
@@ -40,7 +40,10 @@ var ApplicationRestartResultSchema2 = z.object({
40
40
 
41
41
  class ApplicationAdmissionError2 extends AppError2 {
42
42
  constructor() {
43
- super("APPLICATION_NOT_ACCEPTING", "Application is not accepting new operations", 503);
43
+ super("APPLICATION_NOT_ACCEPTING", {
44
+ message: "Application is not accepting new operations",
45
+ status: 503
46
+ });
44
47
  this.name = "ApplicationAdmissionError";
45
48
  }
46
49
  }
@@ -1,14 +1,7 @@
1
1
  import {
2
- RequestCancellationError,
3
- createRequestCancellation,
4
- resolveClientFetch,
5
- responseTraceId,
6
- uploadProgressRoute,
7
- withUploadProgress,
8
2
  ApiError2,
9
- refuseLocally,
10
- parseApiErrorBody
11
- } from "./index-ywppsaby.js";
3
+ refuseLocally
4
+ } from "./index-kfjkb396.js";
12
5
  import {
13
6
  parseTrailingWildcard
14
7
  } from "./index-m38ej7e5.js";
@@ -16,9 +9,21 @@ import {
16
9
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
17
10
  ContractStreamFrameSchema2
18
11
  } from "./index-h2fhjqy7.js";
12
+ import {
13
+ RequestCancellationError,
14
+ createRequestCancellation,
15
+ resolveClientFetch,
16
+ responseTraceId,
17
+ uploadProgressRoute,
18
+ withUploadProgress,
19
+ parseApiErrorBody
20
+ } from "./index-n1nszyk0.js";
19
21
  import {
20
22
  inputIsQuery
21
23
  } from "./index-xhzq2qvj.js";
24
+ import {
25
+ assertPositiveSafeInteger
26
+ } from "./index-0s4xebbg.js";
22
27
  import {
23
28
  typedEntries,
24
29
  isRecord,
@@ -29,9 +34,7 @@ import {
29
34
  var DEFAULT_STREAM_LINE_BYTES = 1024 * 1024;
30
35
  function lineLimit(value) {
31
36
  const resolved = value ?? DEFAULT_STREAM_LINE_BYTES;
32
- if (!Number.isSafeInteger(resolved) || resolved <= 0) {
33
- throw new TypeError("maxLineBytes must be a positive safe integer");
34
- }
37
+ assertPositiveSafeInteger("maxLineBytes", resolved);
35
38
  return resolved;
36
39
  }
37
40
  function joinBytes(left, right) {
@@ -369,15 +372,27 @@ async function* readContractStream(response, descriptor, abort) {
369
372
  if (descriptor.framing !== "item") {
370
373
  const parsedFrame = ContractStreamFrameSchema2.safeParse(candidate);
371
374
  if (!parsedFrame.success) {
372
- throw new ApiError2("STREAM_PROTOCOL_ERROR", 0, undefined, "Stream frame did not match the protocol envelope");
375
+ throw new ApiError2("STREAM_PROTOCOL_ERROR", {
376
+ status: 0,
377
+ message: "Stream frame did not match the protocol envelope"
378
+ });
373
379
  }
374
380
  const frame = parsedFrame.data;
375
381
  if (frame.type === "error") {
376
- throw new ApiError2(frame.error.code, 0, frame.error.details, frame.error.message, frame.error.hint, undefined, undefined, frame.error.retryable);
382
+ throw new ApiError2(frame.error.code, {
383
+ status: 0,
384
+ details: frame.error.details,
385
+ message: frame.error.message,
386
+ hint: frame.error.hint,
387
+ retryable: frame.error.retryable
388
+ });
377
389
  }
378
390
  if (frame.type === "end") {
379
391
  if (!terminalSeen) {
380
- throw new ApiError2("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
392
+ throw new ApiError2("STREAM_TERMINAL_MISSING", {
393
+ status: 0,
394
+ message: "Stream completed before its declared terminal item"
395
+ });
381
396
  }
382
397
  ended = true;
383
398
  return;
@@ -386,7 +401,10 @@ async function* readContractStream(response, descriptor, abort) {
386
401
  }
387
402
  const parsedItem = descriptor.item.safeParse(candidate);
388
403
  if (!parsedItem.success) {
389
- throw new ApiError2("STREAM_ITEM_INVALID", 0, undefined, "Stream item did not match its contract");
404
+ throw new ApiError2("STREAM_ITEM_INVALID", {
405
+ status: 0,
406
+ message: "Stream item did not match its contract"
407
+ });
390
408
  }
391
409
  const item = parsedItem.data;
392
410
  const terminal = descriptor.terminal?.safeParse(item).success ?? false;
@@ -404,10 +422,16 @@ async function* readContractStream(response, descriptor, abort) {
404
422
  if (descriptor.framing === "item") {
405
423
  if (terminalSeen)
406
424
  return;
407
- throw new ApiError2("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
425
+ throw new ApiError2("STREAM_TERMINAL_MISSING", {
426
+ status: 0,
427
+ message: "Stream completed before its declared terminal item"
428
+ });
408
429
  }
409
430
  if (!ended) {
410
- throw new ApiError2("STREAM_TRUNCATED", 0, undefined, "Stream ended without its protocol terminal frame");
431
+ throw new ApiError2("STREAM_TRUNCATED", {
432
+ status: 0,
433
+ message: "Stream ended without its protocol terminal frame"
434
+ });
411
435
  }
412
436
  } finally {
413
437
  abort();
@@ -579,12 +603,20 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
579
603
  });
580
604
  } catch (error) {
581
605
  if (error instanceof RequestCancellationError) {
582
- throw new ApiError2(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", 0, undefined, error.message);
606
+ throw new ApiError2(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
607
+ status: 0,
608
+ message: error.message
609
+ });
583
610
  }
584
611
  if (ApiError2.is(error))
585
612
  throw error;
586
613
  const message = error instanceof Error ? error.message : undefined;
587
- throw new ApiError2("UNKNOWN_ERROR", 0, message ? { message } : undefined, message, undefined, undefined, { cause: error });
614
+ throw new ApiError2("UNKNOWN_ERROR", {
615
+ status: 0,
616
+ details: message ? { message } : undefined,
617
+ message,
618
+ cause: error
619
+ });
588
620
  }
589
621
  };
590
622
  }
@@ -593,9 +625,20 @@ async function throwForErrorResponse(res, config, fallbackBody) {
593
625
  config.onError?.(res.status, body);
594
626
  const parsed = parseApiErrorBody(body);
595
627
  if (parsed) {
596
- throw new ApiError2(parsed.code, res.status, parsed.details, parsed.message, parsed.hint, responseTraceId(res), undefined, parsed.retryable);
628
+ throw new ApiError2(parsed.code, {
629
+ status: res.status,
630
+ details: parsed.details,
631
+ message: parsed.message,
632
+ hint: parsed.hint,
633
+ traceId: responseTraceId(res),
634
+ retryable: parsed.retryable
635
+ });
597
636
  }
598
- throw new ApiError2("HTTP_ERROR", res.status, { body }, undefined, undefined, responseTraceId(res));
637
+ throw new ApiError2("HTTP_ERROR", {
638
+ status: res.status,
639
+ details: { body },
640
+ traceId: responseTraceId(res)
641
+ });
599
642
  }
600
643
 
601
644
  // src/browser/client.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBoundedSinkManager
3
- } from "./index-h97tqqp1.js";
3
+ } from "./index-qaet40b2.js";
4
4
  import {
5
5
  AgentRuntimeEventSchema2
6
6
  } from "./index-mnkk1ffz.js";
@@ -3,27 +3,22 @@ import {
3
3
  STITCH_ERROR_STATUS2,
4
4
  isRetryableStatus2,
5
5
  isStitchErrorCode2
6
- } from "./index-x928baz2.js";
6
+ } from "./index-j9gxbztg.js";
7
7
  import {
8
8
  normalizeError2,
9
9
  validateDeclaredOutput
10
- } from "./index-kb8styz3.js";
10
+ } from "./index-rpzewktb.js";
11
11
  import {
12
12
  coerceJsonArgs2
13
- } from "./index-9pw0a51a.js";
13
+ } from "./index-6yxhe58g.js";
14
14
  import {
15
15
  applyToolViewDefaults,
16
16
  projectToolView,
17
17
  objectShapeKeys
18
- } from "./index-77nxk6ay.js";
18
+ } from "./index-r393tnfp.js";
19
19
  import {
20
- ConnectionAuthorizationRequiredError2,
21
- ConnectionRequestError2,
22
- ConnectionUrlError2,
23
- ConnectionBudgetExceededError2,
24
- ConnectionTimeoutError2,
25
- ConnectionResponseTooLargeError2
26
- } from "./index-1a6jtnd9.js";
20
+ projectedToolError
21
+ } from "./index-556g5hsh.js";
27
22
  import {
28
23
  runWithRequestContext2,
29
24
  getRequestContext2
@@ -39,6 +34,7 @@ import {
39
34
  } from "./index-9jfdm5tg.js";
40
35
 
41
36
  // src/tools/execute-args.ts
37
+ import { z } from "zod";
42
38
  function parseToolCallArguments(method, callArgs, {
43
39
  coerceJson = false,
44
40
  toolSurface = false
@@ -55,8 +51,22 @@ function parseToolCallArguments(method, callArgs, {
55
51
  inputArgs[key] = value;
56
52
  }
57
53
  if (coerceJson) {
58
- paramArgs = coerceJsonArgs2(paramArgs, method.paramsSchema);
59
- inputArgs = coerceJsonArgs2(inputArgs, method.inputSchema);
54
+ try {
55
+ paramArgs = coerceJsonArgs2(paramArgs, method.paramsSchema);
56
+ } catch (err) {
57
+ if (err instanceof z.ZodError) {
58
+ return { ok: false, message: `Invalid params: ${formatZodError2(err)}` };
59
+ }
60
+ throw err;
61
+ }
62
+ try {
63
+ inputArgs = coerceJsonArgs2(inputArgs, method.inputSchema);
64
+ } catch (err) {
65
+ if (err instanceof z.ZodError) {
66
+ return { ok: false, message: `Invalid input: ${formatZodError2(err)}` };
67
+ }
68
+ throw err;
69
+ }
60
70
  }
61
71
  if (toolSurface)
62
72
  inputArgs = applyToolViewDefaults(inputArgs, method.toolView?.defaults);
@@ -89,69 +99,10 @@ function parseToolCallArguments(method, callArgs, {
89
99
  return { ok: true, params, input };
90
100
  }
91
101
 
92
- // src/tools/connections/error-projection.ts
93
- function connectionToolError(error) {
94
- if (error instanceof ConnectionTimeoutError2) {
95
- const message = "Connection deadline exceeded";
96
- return new AppError2("CONNECTION_TIMEOUT", message, STITCH_ERROR_STATUS2.CONNECTION_TIMEOUT, {
97
- message,
98
- reason: "deadline-exceeded",
99
- operation: error.operation,
100
- phase: error.phase,
101
- timeoutMs: error.timeoutMs,
102
- observedReadBytes: error.observedReadBytes
103
- }, "Check the connection deadline and verify any write outcome before retrying.", undefined, false);
104
- }
105
- if (error instanceof ConnectionResponseTooLargeError2) {
106
- const message = "Connection response exceeds the byte limit";
107
- return new AppError2("CONNECTION_RESPONSE_TOO_LARGE", message, STITCH_ERROR_STATUS2.CONNECTION_RESPONSE_TOO_LARGE, {
108
- message,
109
- reason: "response-too-large",
110
- operation: error.operation,
111
- phase: error.phase,
112
- maxResponseBytes: error.maxBytes,
113
- observedReadBytes: error.observedReadBytes
114
- }, "Narrow the response or increase the limit for this operation phase.", undefined, false);
115
- }
116
- if (error instanceof ConnectionAuthorizationRequiredError2) {
117
- const message = "Authorization required";
118
- return new AppError2("UNAUTHORIZED", message, STITCH_ERROR_STATUS2.UNAUTHORIZED, {
119
- message,
120
- reason: "authorization-required",
121
- operation: error.operation,
122
- phase: error.phase
123
- }, "Obtain a new credential before retrying.", undefined, false);
124
- }
125
- if (error instanceof ConnectionRequestError2) {
126
- const forbidden = error.status === 403;
127
- const code = forbidden ? "FORBIDDEN" : "CONNECTION_REQUEST_FAILED";
128
- const message = forbidden ? "Connection access denied" : "Connection request failed";
129
- return new AppError2(code, message, STITCH_ERROR_STATUS2[code], {
130
- message,
131
- reason: forbidden ? "permission-denied" : "upstream-request-failed",
132
- operation: error.operation,
133
- phase: error.phase,
134
- upstreamStatus: error.status
135
- }, forbidden ? "Check the credential permissions." : "Check the upstream service and verify any write outcome before retrying.", undefined, !forbidden && isRetryableStatus2(error.status));
136
- }
137
- if (error instanceof ConnectionUrlError2) {
138
- return new AppError2("BAD_REQUEST", "Connection URL refused", STITCH_ERROR_STATUS2.BAD_REQUEST, { message: "Connection URL refused", reason: "url-rejected" }, "Check the connection URL and its allowed hosts.", undefined, false);
139
- }
140
- if (error instanceof ConnectionBudgetExceededError2) {
141
- return new AppError2("BAD_REQUEST", "Connection mount budget exceeded", STITCH_ERROR_STATUS2.BAD_REQUEST, {
142
- message: "Connection mount budget exceeded",
143
- reason: "mount-budget-exceeded",
144
- limit: error.limit,
145
- actual: error.actual
146
- }, "Narrow the mounted tool surface or increase its mount budget.", undefined, false);
147
- }
148
- return;
149
- }
150
-
151
102
  // src/tools/execute-result.ts
152
103
  var normalizedToolErrors = new WeakMap;
153
104
  function toolResultFromError(err) {
154
- const appErr = normalizeError2(connectionToolError(err) ?? err, { logUnexpected: false });
105
+ const appErr = normalizeError2(projectedToolError(err) ?? err, { logUnexpected: false });
155
106
  const result = {
156
107
  ok: false,
157
108
  code: appErr.code,
@@ -169,7 +120,13 @@ function toolErrorFromResult(result) {
169
120
  const details = isRecord(result.details) ? result.details : undefined;
170
121
  const message = typeof details?.message === "string" ? details.message : result.code;
171
122
  const status = isStitchErrorCode2(result.code) ? STITCH_ERROR_STATUS2[result.code] : 500;
172
- return new AppError2(result.code, message, status, details, result.hint, undefined, result.retryable);
123
+ return new AppError2(result.code, {
124
+ message,
125
+ status,
126
+ details,
127
+ hint: result.hint,
128
+ retryable: result.retryable
129
+ });
173
130
  }
174
131
  function toolCauseFromResult(result) {
175
132
  return normalizedToolErrors.get(result)?.cause;
@@ -1,27 +1,42 @@
1
1
  import {
2
2
  withExclusiveLock2
3
- } from "./index-g95fk660.js";
3
+ } from "./index-4vsby8n8.js";
4
+ import {
5
+ readBoundedFile
6
+ } from "./index-m616f0yz.js";
4
7
  import {
5
8
  writeAtomicFileData
6
- } from "./index-s4evrmp5.js";
9
+ } from "./index-ef8gdaq0.js";
7
10
  import {
8
11
  publishAtomicFile
9
- } from "./index-8a9ksm91.js";
12
+ } from "./index-b56nnscm.js";
13
+ import {
14
+ assertPositiveSafeInteger
15
+ } from "./index-0s4xebbg.js";
10
16
 
11
17
  // src/application/file-state-store.ts
12
- import { mkdir, open, readFile, unlink } from "node:fs/promises";
18
+ import { mkdir, open, unlink } from "node:fs/promises";
13
19
  import { dirname } from "node:path";
20
+ var NATIVE_IO = { write: writeAtomicFileData, lock: withExclusiveLock2 };
21
+ var DEFAULT_MAX_BYTES = 64 * 1024 * 1024;
22
+ var encode = (state) => `${JSON.stringify(state)}
23
+ `;
14
24
  var missing = (error) => error instanceof Error && ("code" in error) && error.code === "ENOENT";
15
25
  function createFileStateStore2(path, options) {
26
+ return createFileStateStoreOn(path, options, NATIVE_IO);
27
+ }
28
+ function createFileStateStoreOn(path, options, io) {
16
29
  if ("staleLockMs" in options || "retryMs" in options)
17
30
  throw new TypeError("File state store lock age/retry options are unsupported");
18
31
  const lockTimeoutMs = options.lockTimeoutMs ?? 1e4;
19
32
  if (!Number.isSafeInteger(lockTimeoutMs) || lockTimeoutMs < 0)
20
33
  throw new TypeError("lockTimeoutMs must be a nonnegative safe integer");
34
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
35
+ assertPositiveSafeInteger("maxBytes", maxBytes);
21
36
  const parseFile = async () => {
22
37
  let source;
23
38
  try {
24
- source = await readFile(path, "utf8");
39
+ source = new TextDecoder().decode((await readBoundedFile(path, maxBytes)).bytes);
25
40
  } catch (error) {
26
41
  if (missing(error))
27
42
  return null;
@@ -40,7 +55,7 @@ function createFileStateStore2(path, options) {
40
55
  read: parseFile,
41
56
  async update(transition) {
42
57
  await mkdir(dirname(path), { recursive: true });
43
- return withExclusiveLock2(`${path}.lock`, async (lock) => {
58
+ return io.lock(`${path}.lock`, async (lock) => {
44
59
  let active = true;
45
60
  const context = {
46
61
  async assertHeld() {
@@ -50,19 +65,20 @@ function createFileStateStore2(path, options) {
50
65
  }
51
66
  };
52
67
  try {
53
- await context.assertHeld();
54
68
  const current = await parseFile();
69
+ const before = current === null ? null : encode(current);
55
70
  await context.assertHeld();
56
71
  const next = await transition(current, context);
57
- await context.assertHeld();
58
72
  const state = options.schema.parse(next.state);
59
- await writeAtomicFileData(path, `${JSON.stringify(state)}
60
- `, { durability: "directory" }, {
73
+ const text = encode(state);
74
+ if (text === before)
75
+ return next.result;
76
+ await io.write(path, text, { durability: "directory" }, {
61
77
  open,
62
78
  unlink,
63
- async publish(staged, target, replace, directorySync) {
79
+ async publish(staged, target, publication) {
64
80
  await context.assertHeld();
65
- await publishAtomicFile(staged, target, replace, directorySync);
81
+ await publishAtomicFile(staged, target, publication);
66
82
  }
67
83
  });
68
84
  return next.result;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unauthorized2
3
- } from "./index-x928baz2.js";
3
+ } from "./index-j9gxbztg.js";
4
4
  import {
5
5
  deriveCodeChallenge2
6
6
  } from "./index-ap3gqe56.js";