stitchkit 0.132.3 → 0.133.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/CHANGELOG.md +178 -1
  2. package/README.md +4 -0
  3. package/dist/agent-executor/acp/v1-connect.d.ts +12 -1
  4. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  5. package/dist/agent-executor/acp/v1-driver.d.ts +3 -1
  6. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  7. package/dist/agent-executor/acp/v1-handlers.d.ts +9 -1
  8. package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
  9. package/dist/agent-executor/acp/v1-permission.d.ts +3 -2
  10. package/dist/agent-executor/acp/v1-permission.d.ts.map +1 -1
  11. package/dist/agent-executor/acp/v1-probe.d.ts +10 -1
  12. package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -1
  13. package/dist/agent-executor/acp/v1-session.d.ts +11 -2
  14. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  15. package/dist/agent-executor/acp/v1-turn.d.ts +13 -10
  16. package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -1
  17. package/dist/agent-executor/claude/cli-driver.d.ts +6 -0
  18. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  19. package/dist/agent-executor/claude/record-router.d.ts +44 -0
  20. package/dist/agent-executor/claude/record-router.d.ts.map +1 -0
  21. package/dist/agent-executor/claude/session.d.ts +2 -0
  22. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  23. package/dist/agent-executor/claude-sdk/driver.d.ts +20 -2
  24. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  25. package/dist/agent-executor/claude-sdk/engine-spawn.d.ts +18 -0
  26. package/dist/agent-executor/claude-sdk/engine-spawn.d.ts.map +1 -0
  27. package/dist/agent-executor/claude-sdk/query-loop.d.ts +8 -11
  28. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
  29. package/dist/agent-executor/claude-sdk/query-manager.d.ts +4 -2
  30. package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -1
  31. package/dist/agent-executor/claude-sdk/query-options.d.ts +1 -0
  32. package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
  33. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  34. package/dist/agent-executor/codex/capabilities.d.ts +8 -0
  35. package/dist/agent-executor/codex/capabilities.d.ts.map +1 -0
  36. package/dist/agent-executor/codex/connect.d.ts +6 -1
  37. package/dist/agent-executor/codex/connect.d.ts.map +1 -1
  38. package/dist/agent-executor/codex/driver.d.ts +10 -0
  39. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  40. package/dist/agent-executor/codex/event-routing.d.ts +23 -1
  41. package/dist/agent-executor/codex/event-routing.d.ts.map +1 -1
  42. package/dist/agent-executor/codex/handlers.d.ts +23 -3
  43. package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
  44. package/dist/agent-executor/codex/limits.d.ts +17 -0
  45. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  46. package/dist/agent-executor/codex/request-answers.d.ts +23 -3
  47. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  48. package/dist/agent-executor/codex/session-bind.d.ts +6 -1
  49. package/dist/agent-executor/codex/session-bind.d.ts.map +1 -1
  50. package/dist/agent-executor/codex/session-types.d.ts +5 -1
  51. package/dist/agent-executor/codex/session-types.d.ts.map +1 -1
  52. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  53. package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
  54. package/dist/agent-executor/codex/shared-thread.d.ts +6 -8
  55. package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
  56. package/dist/agent-executor/codex/thread-open.d.ts +12 -3
  57. package/dist/agent-executor/codex/thread-open.d.ts.map +1 -1
  58. package/dist/agent-executor/engine-requests.d.ts +42 -0
  59. package/dist/agent-executor/engine-requests.d.ts.map +1 -1
  60. package/dist/agent-executor/handoff-schemas.d.ts.map +1 -1
  61. package/dist/agent-executor/handoff.d.ts.map +1 -1
  62. package/dist/agent-executor/image-input.d.ts +6 -5
  63. package/dist/agent-executor/image-input.d.ts.map +1 -1
  64. package/dist/agent-executor/profile.d.ts +3 -5
  65. package/dist/agent-executor/profile.d.ts.map +1 -1
  66. package/dist/agent-executor/session-primitives.d.ts +64 -3
  67. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  68. package/dist/agent-executor/testing/claude-sdk-stubs.d.ts +5 -0
  69. package/dist/agent-executor/testing/claude-sdk-stubs.d.ts.map +1 -0
  70. package/dist/agent-executor/testing/conformance-lifecycle.d.ts +11 -0
  71. package/dist/agent-executor/testing/conformance-lifecycle.d.ts.map +1 -0
  72. package/dist/agent-executor/testing/conformance-support.d.ts +23 -0
  73. package/dist/agent-executor/testing/conformance-support.d.ts.map +1 -0
  74. package/dist/agent-executor/testing/conformance.d.ts +7 -2
  75. package/dist/agent-executor/testing/conformance.d.ts.map +1 -1
  76. package/dist/agent-executor/testing/consumer-stubs.d.ts +5 -3
  77. package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -1
  78. package/dist/agent-executor/testing/fake-codex-app-server.d.ts +5 -1
  79. package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -1
  80. package/dist/agent-executor/testing/replay-driver.d.ts +6 -0
  81. package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
  82. package/dist/agent-executor/testing/replay-gate.d.ts +4 -1
  83. package/dist/agent-executor/testing/replay-gate.d.ts.map +1 -1
  84. package/dist/agent-runtime/deferred-tool-types.d.ts +2 -0
  85. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  86. package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
  87. package/dist/browser/client.d.ts.map +1 -1
  88. package/dist/browser/operation-refusal.d.ts +10 -0
  89. package/dist/browser/operation-refusal.d.ts.map +1 -0
  90. package/dist/contract/client-types.d.ts +13 -4
  91. package/dist/contract/client-types.d.ts.map +1 -1
  92. package/dist/contract/define-validation.d.ts +6 -0
  93. package/dist/contract/define-validation.d.ts.map +1 -1
  94. package/dist/contract/define.d.ts +3 -0
  95. package/dist/contract/define.d.ts.map +1 -1
  96. package/dist/contract/errors-factory.d.ts +8 -2
  97. package/dist/contract/errors-factory.d.ts.map +1 -1
  98. package/dist/contract/errors.d.ts +9 -0
  99. package/dist/contract/errors.d.ts.map +1 -1
  100. package/dist/contract/fingerprint.d.ts +4 -1
  101. package/dist/contract/fingerprint.d.ts.map +1 -1
  102. package/dist/contract/operation-refusals.d.ts +51 -0
  103. package/dist/contract/operation-refusals.d.ts.map +1 -0
  104. package/dist/contract/tool-options.d.ts +4 -0
  105. package/dist/contract/tool-options.d.ts.map +1 -1
  106. package/dist/entrypoints/agent-executor/acp.js +253 -210
  107. package/dist/entrypoints/agent-executor/claude-sdk.js +248 -173
  108. package/dist/entrypoints/agent-executor/claude.js +57 -109
  109. package/dist/entrypoints/agent-executor/codex.js +412 -335
  110. package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts +3 -0
  111. package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts.map +1 -0
  112. package/dist/entrypoints/agent-executor/testing/claude-sdk.js +329 -0
  113. package/dist/entrypoints/agent-executor/testing.d.ts +1 -2
  114. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
  115. package/dist/entrypoints/agent-executor/testing.js +413 -667
  116. package/dist/entrypoints/agent-executor.d.ts +1 -1
  117. package/dist/entrypoints/agent-executor.d.ts.map +1 -1
  118. package/dist/entrypoints/agent-executor.js +12 -12
  119. package/dist/entrypoints/agent-runtime/browser.js +2 -2
  120. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  121. package/dist/entrypoints/agent-runtime/harness.js +8 -8
  122. package/dist/entrypoints/agent-runtime/postgres.js +5 -5
  123. package/dist/entrypoints/agent-runtime/realtime.js +2 -2
  124. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  125. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  126. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  127. package/dist/entrypoints/agent-runtime/testing.js +5 -5
  128. package/dist/entrypoints/agent-runtime.js +26 -18
  129. package/dist/entrypoints/application/grammy.js +1 -1
  130. package/dist/entrypoints/application.js +2 -2
  131. package/dist/entrypoints/cli.js +8 -8
  132. package/dist/entrypoints/contract.d.ts +3 -2
  133. package/dist/entrypoints/contract.d.ts.map +1 -1
  134. package/dist/entrypoints/contract.js +6 -4
  135. package/dist/entrypoints/files/packaging.d.ts +4 -1
  136. package/dist/entrypoints/files/packaging.d.ts.map +1 -1
  137. package/dist/entrypoints/files/packaging.js +1008 -168
  138. package/dist/entrypoints/files.js +1 -1
  139. package/dist/entrypoints/handler.js +7 -7
  140. package/dist/entrypoints/http.js +2 -2
  141. package/dist/entrypoints/index.js +10 -8
  142. package/dist/entrypoints/node.js +11 -11
  143. package/dist/entrypoints/observability.js +1 -1
  144. package/dist/entrypoints/process/bootstrap.d.ts +3 -0
  145. package/dist/entrypoints/process/bootstrap.d.ts.map +1 -0
  146. package/dist/entrypoints/process/bootstrap.js +16 -0
  147. package/dist/entrypoints/process.js +7 -7
  148. package/dist/entrypoints/realtime.js +3 -3
  149. package/dist/entrypoints/remote.js +8 -7
  150. package/dist/entrypoints/server.js +30 -14
  151. package/dist/entrypoints/service-host/macos.js +72 -206
  152. package/dist/entrypoints/service-host/work.d.ts +15 -0
  153. package/dist/entrypoints/service-host/work.d.ts.map +1 -0
  154. package/dist/entrypoints/service-host/work.js +676 -0
  155. package/dist/entrypoints/service-host.js +146 -536
  156. package/dist/entrypoints/telegram/screens.js +4 -4
  157. package/dist/entrypoints/telegram.js +4 -4
  158. package/dist/entrypoints/testing.d.ts +2 -1
  159. package/dist/entrypoints/testing.d.ts.map +1 -1
  160. package/dist/entrypoints/testing.js +27 -8
  161. package/dist/entrypoints/tools/agent.js +6 -6
  162. package/dist/entrypoints/tools/connections.js +2 -2
  163. package/dist/entrypoints/tools/invoker.js +5 -5
  164. package/dist/entrypoints/tools/mcp.js +8 -6
  165. package/dist/entrypoints/tools/toolkit.js +11 -9
  166. package/dist/entrypoints/tools.js +19 -17
  167. package/dist/entrypoints/tracking/contract.js +1 -1
  168. package/dist/entrypoints/tracking/performance.js +3 -3
  169. package/dist/files/client-artifact.d.ts +14 -42
  170. package/dist/files/client-artifact.d.ts.map +1 -1
  171. package/dist/files/client-build.d.ts +57 -0
  172. package/dist/files/client-build.d.ts.map +1 -0
  173. package/dist/files/client-declarations.d.ts +35 -0
  174. package/dist/files/client-declarations.d.ts.map +1 -0
  175. package/dist/files/client-package-bundle.d.ts +25 -0
  176. package/dist/files/client-package-bundle.d.ts.map +1 -0
  177. package/dist/files/client-package-contract.d.ts +183 -0
  178. package/dist/files/client-package-contract.d.ts.map +1 -0
  179. package/dist/files/client-package-proof.d.ts +40 -0
  180. package/dist/files/client-package-proof.d.ts.map +1 -0
  181. package/dist/files/client-package.d.ts +17 -0
  182. package/dist/files/client-package.d.ts.map +1 -0
  183. package/dist/files/declaration-specifiers.d.ts +30 -0
  184. package/dist/files/declaration-specifiers.d.ts.map +1 -0
  185. package/dist/{index-v759mzed.js → index-02r5sq9p.js} +36 -23
  186. package/dist/{index-0r15pkjq.js → index-0k1ba0ss.js} +1 -1
  187. package/dist/{index-znd1b57f.js → index-1dn2wjq6.js} +5 -4
  188. package/dist/{index-p06z7g7w.js → index-1p8q0yrt.js} +6 -5
  189. package/dist/{index-wa6h4tz6.js → index-1qwd54n3.js} +6 -5
  190. package/dist/index-2dzc7mv9.js +174 -0
  191. package/dist/index-2mz8hj58.js +155 -0
  192. package/dist/{index-17qgm6xe.js → index-34k82crg.js} +2 -2
  193. package/dist/index-3mcbr8sx.js +349 -0
  194. package/dist/{index-ybdq8kk2.js → index-3y2tzhr8.js} +3 -3
  195. package/dist/{index-fgahdc7s.js → index-5n3a8hd8.js} +5 -3
  196. package/dist/{index-jb4m241t.js → index-6918kxbf.js} +45 -1
  197. package/dist/{index-n3bm7zqq.js → index-6kmjcm81.js} +4 -4
  198. package/dist/{index-akf0xkrm.js → index-78da4g74.js} +1 -1
  199. package/dist/{index-9pv126eh.js → index-7fjbdga8.js} +7 -1
  200. package/dist/{index-zhshhxew.js → index-8jf4bt7v.js} +1 -1
  201. package/dist/{index-p16q492v.js → index-8t9dr41h.js} +18 -5
  202. package/dist/{index-xq4s9mka.js → index-8yt3rwe7.js} +1 -1
  203. package/dist/{index-39c2hj6h.js → index-9c76vfxf.js} +7 -3
  204. package/dist/index-9ft4n9j1.js +432 -0
  205. package/dist/{index-sd4e5x5j.js → index-9wdrwx3b.js} +8 -7
  206. package/dist/{index-z114ax5e.js → index-an7vcmwf.js} +49 -2
  207. package/dist/{index-pzhqydxb.js → index-d04w81fz.js} +1 -1
  208. package/dist/index-d2drhb9c.js +219 -0
  209. package/dist/{index-8gmmdz7k.js → index-dacxr7nf.js} +1 -1
  210. package/dist/{index-dnzxxf8a.js → index-dm6nxkn1.js} +1 -1
  211. package/dist/index-dxft2mnm.js +42 -0
  212. package/dist/{index-rxh3qy4x.js → index-fzd477xk.js} +1 -1
  213. package/dist/{index-xgae0bn7.js → index-g4gstmp1.js} +2 -2
  214. package/dist/{index-athc412x.js → index-g5fgeb6v.js} +1 -1
  215. package/dist/{index-z9d74jmb.js → index-gbhj370g.js} +3 -3
  216. package/dist/{index-3fym4j8n.js → index-gtaaxe9d.js} +1 -1
  217. package/dist/{index-v59pxmf1.js → index-jpecjm30.js} +2 -2
  218. package/dist/index-k9g061ma.js +164 -0
  219. package/dist/{index-669374qc.js → index-ma26mfnt.js} +84 -315
  220. package/dist/{index-ryxb427v.js → index-msxf2r8x.js} +16 -3
  221. package/dist/{index-rbd2rq3z.js → index-nr4fhfn4.js} +1 -1
  222. package/dist/{index-qa2jjb65.js → index-pbekeqzm.js} +1 -1
  223. package/dist/{index-mkfhpk11.js → index-pq6g1k9t.js} +2 -2
  224. package/dist/{index-gya4hwh3.js → index-pws5c3x6.js} +21 -1
  225. package/dist/{index-x2fb37t0.js → index-q427q23r.js} +3 -2
  226. package/dist/{index-jcrj0b8z.js → index-qggqqja2.js} +39 -2
  227. package/dist/{index-jxtg307y.js → index-rkjfzs0a.js} +1 -1
  228. package/dist/{index-5tdc0q43.js → index-rw8ze745.js} +5 -3
  229. package/dist/index-s43tr4my.js +129 -0
  230. package/dist/{index-f9p62ean.js → index-stpy56r3.js} +175 -249
  231. package/dist/index-t5g5rm9n.js +213 -0
  232. package/dist/{index-z20pdxeb.js → index-tmv3ez1h.js} +3 -3
  233. package/dist/{index-dcsxj68j.js → index-tqjamnax.js} +1 -1
  234. package/dist/{index-j15dhkda.js → index-wddcfbng.js} +1 -325
  235. package/dist/{index-9sfhje6y.js → index-wh70tmpd.js} +24 -234
  236. package/dist/index-wxjv4sqx.js +82 -0
  237. package/dist/{index-qhjmmsm2.js → index-x46y9z26.js} +2 -2
  238. package/dist/{index-nk0cy9g1.js → index-y53cqwke.js} +1 -1
  239. package/dist/{index-sv5svtq7.js → index-y68gavb5.js} +1 -1
  240. package/dist/{index-5y7j383h.js → index-yrhw10ef.js} +1 -1
  241. package/dist/process/bootstrap.d.ts +12 -0
  242. package/dist/process/bootstrap.d.ts.map +1 -0
  243. package/dist/process/owner-loss-guard.d.ts +2 -9
  244. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  245. package/dist/process/work-root.d.ts +20 -0
  246. package/dist/process/work-root.d.ts.map +1 -0
  247. package/dist/server/contract-identity.d.ts.map +1 -1
  248. package/dist/server/contract-method.d.ts +12 -0
  249. package/dist/server/contract-method.d.ts.map +1 -1
  250. package/dist/server/implement.d.ts.map +1 -1
  251. package/dist/server/openapi.d.ts.map +1 -1
  252. package/dist/server/types.d.ts +10 -9
  253. package/dist/server/types.d.ts.map +1 -1
  254. package/dist/service-host/host-adapter.d.ts +2 -0
  255. package/dist/service-host/host-adapter.d.ts.map +1 -1
  256. package/dist/service-host/work/command.d.ts +72 -0
  257. package/dist/service-host/work/command.d.ts.map +1 -0
  258. package/dist/service-host/work/errors.d.ts +29 -0
  259. package/dist/service-host/work/errors.d.ts.map +1 -0
  260. package/dist/service-host/work/host.d.ts +38 -0
  261. package/dist/service-host/work/host.d.ts.map +1 -0
  262. package/dist/service-host/work/launch.d.ts +51 -0
  263. package/dist/service-host/work/launch.d.ts.map +1 -0
  264. package/dist/service-host/work/membership.d.ts +51 -0
  265. package/dist/service-host/work/membership.d.ts.map +1 -0
  266. package/dist/service-host/work/origin.d.ts +79 -0
  267. package/dist/service-host/work/origin.d.ts.map +1 -0
  268. package/dist/service-host/work/owner.d.ts +45 -0
  269. package/dist/service-host/work/owner.d.ts.map +1 -0
  270. package/dist/service-host/work/placement.d.ts +55 -0
  271. package/dist/service-host/work/placement.d.ts.map +1 -0
  272. package/dist/service-host/work/probe.d.ts +24 -0
  273. package/dist/service-host/work/probe.d.ts.map +1 -0
  274. package/dist/service-host/work/scope-command.d.ts +68 -0
  275. package/dist/service-host/work/scope-command.d.ts.map +1 -0
  276. package/dist/sync/session.d.ts +4 -1
  277. package/dist/sync/session.d.ts.map +1 -1
  278. package/dist/testing/surface-manifest-digest.d.ts +2 -0
  279. package/dist/testing/surface-manifest-digest.d.ts.map +1 -1
  280. package/dist/testing/surface-manifest.d.ts +32 -3
  281. package/dist/testing/surface-manifest.d.ts.map +1 -1
  282. package/dist/tools/agent.d.ts +2 -0
  283. package/dist/tools/agent.d.ts.map +1 -1
  284. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  285. package/dist/tools/internal/mcp-projection.d.ts +58 -0
  286. package/dist/tools/internal/mcp-projection.d.ts.map +1 -0
  287. package/dist/tools/internal/surface-projector.d.ts +3 -47
  288. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  289. package/dist/tools/invoker.d.ts +2 -0
  290. package/dist/tools/invoker.d.ts.map +1 -1
  291. package/dist/tools/manifest.d.ts +2 -0
  292. package/dist/tools/manifest.d.ts.map +1 -1
  293. package/dist/tools/mcp/handler.d.ts.map +1 -1
  294. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
  295. package/dist/tools/mcp/mount.d.ts +4 -0
  296. package/dist/tools/mcp/mount.d.ts.map +1 -1
  297. package/dist/tools/mcp/prepare.d.ts +5 -2
  298. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  299. package/dist/tools/mount.d.ts +2 -0
  300. package/dist/tools/mount.d.ts.map +1 -1
  301. package/dist/tools/remote.d.ts.map +1 -1
  302. package/dist/tools/schema/nesting-limit.d.ts +8 -0
  303. package/dist/tools/schema/nesting-limit.d.ts.map +1 -0
  304. package/dist/tools/schema/presentation.d.ts +7 -0
  305. package/dist/tools/schema/presentation.d.ts.map +1 -1
  306. package/dist/tools/surface.d.ts.map +1 -1
  307. package/llms/agent-executor-acp.txt +3 -3
  308. package/llms/agent-executor-claude-sdk.txt +1 -1
  309. package/llms/agent-executor-claude.txt +1 -1
  310. package/llms/agent-executor-codex.txt +1 -1
  311. package/llms/agent-executor-testing-claude-sdk.txt +28 -0
  312. package/llms/agent-executor-testing.txt +7 -8
  313. package/llms/agent-executor.txt +27 -4
  314. package/llms/agent-runtime.txt +1 -1
  315. package/llms/contract.txt +8 -2
  316. package/llms/files-packaging.txt +11 -6
  317. package/llms/process-bootstrap.txt +18 -0
  318. package/llms/process.2.txt +248 -18
  319. package/llms/process.txt +130 -92
  320. package/llms/server.4.txt +49 -1
  321. package/llms/service-host-work.txt +34 -0
  322. package/llms/stitchkit.2.txt +31 -0
  323. package/llms/stitchkit.txt +78 -75
  324. package/llms/sync.txt +5 -2
  325. package/llms/testing.txt +1 -0
  326. package/llms/tools.2.txt +747 -775
  327. package/llms/tools.3.txt +846 -210
  328. package/llms/tools.4.txt +226 -0
  329. package/llms/tools.txt +3 -790
  330. package/llms/{upgrading-0.128.0-0.132.0.txt → upgrading-0.128.0-0.133.0.txt} +194 -6
  331. package/llms/upgrading.txt +1 -1
  332. package/llms-full.txt +779 -135
  333. package/llms.txt +18 -16
  334. package/package.json +12 -4
  335. package/dist/entrypoints/process/owner-loss.d.ts +0 -3
  336. package/dist/entrypoints/process/owner-loss.d.ts.map +0 -1
  337. package/dist/entrypoints/process/owner-loss.js +0 -7
  338. package/llms/process-owner-loss.txt +0 -18
@@ -31,9 +31,9 @@ approvals for unprompted tool calls. Explicit `approve` supports `scope: 'once'`
31
31
 
32
32
  | Export | Kind | Purpose |
33
33
  |--------|------|---------|
34
- | `createAcpDriver` / `AcpDriver` / `AcpDriverConfig` | function / _types_ | the driver (`approvalEnforcement: 'agent-initiated'`): `executable` and `args`; optional `clientInfo`, `sessionMeta`, `stdoutLineFilter`, `probeMode` (`'ephemeral-session' \| 'initialize-only' \| 'passive'`) / `passiveVersion`, `model` / `thoughtLevel` / `mode` (also overridable per open via `AcpOpenInput`, falling back to `session/set_model`), `mcpServers`, `transformUpdate`, post-settle `onUpdate` / `onPermissionRequest`, `permissionRequestDelivery` (`'external-only' \| 'all'`), `onProviderPid` (fired during `open()`), `onDisconnect`, `watchPromptOutcome`, `usageInputIncludesCachedRead`, `steerMode` (`'none' \| 'prompt'`), `resolveFile`, `maxImageBytes` (5 MiB), `maxFrameBytes` (8 MiB), `ambient`, and `requestTimeoutMs` (60 s, capping `session/close` / `session/delete` to at most 5 s); exposes `probeCapabilities(AcpProbeCapabilitiesInput)` for non-inference capability probing |
35
- | `AcpSession` / `AcpOpenInput` / `AcpSteerTurnInput` / `AcpConfigOption` / `AcpConfigOptionChoice` / `acpOptionChoices` / `acpOptionValues` / `AcpApprovalEnforcement` | _types_ / functions | a session's `providerPid`, settings, title and commands, `approvalEnforcement` (`'agent-initiated'`), `setConfigOption(category or id, value)`, `respond(interactionId, reply)` for pending permissions, `steerTurn(input)` when `steerMode: 'prompt'`, per-open overrides on `AcpOpenInput`, and flat/grouped config-option flattening helpers (`acpOptionChoices`, `acpOptionValues`) |
36
- | `AcpProbeCapabilitiesInput` / `AcpCapabilitiesProbe` / `AcpProbeMode` / `AcpSteerMode` / `AcpSessionMetaInput` / `AcpWatchPromptOutcome` / `AcpPromptOutcomeOverride` | _types_ | non-inference capability probe input/result (running regardless of `probeMode` and calling both `session/close` and `session/delete` in `finally`), probe strategy, steer mode, static or `initialize`-derived `_meta` attachment on session open, and prompt-outcome verification hook reclassifying masked `end_turn` failures with `errorKind` and `threadDisposition` |
34
+ | `createAcpDriver` / `AcpDriver` / `AcpDriverConfig` | function / _types_ | the driver (`approvalEnforcement: 'agent-initiated'`): `executable` and `args`; optional `clientInfo`, `sessionMeta`, `stdoutLineFilter`, `probeMode` (`'ephemeral-session' \| 'initialize-only' \| 'passive'`) / `passiveVersion`, `model` / `thoughtLevel` / `mode` (also overridable per open via `AcpOpenInput`, falling back to `session/set_model`), `mcpServers`, `transformUpdate`, post-settle `onUpdate` / `onPermissionRequest`, `permissionRequestDelivery` (`'external-only' \| 'all'`), `onProviderPid` (fired during `open()`), `onDisconnect`, `onObserverError` (every failure of a host callback the driver contained, with the name of the option that failed; a `JsonRpcError` thrown by `onPermissionRequest` outside a turn is its refusal and is not reported), `watchPromptOutcome`, `usageInputIncludesCachedRead`, `steerMode` (`'none' \| 'prompt'`), `resolveFile`, `maxImageBytes` (5 MiB), `maxFrameBytes` (8 MiB), `ambient`, and `requestTimeoutMs` (60 s, capping `session/close` / `session/delete` to at most 5 s; a request the agent sends while `close()` waits for `session/close` is refused — `session/request_permission` with the `cancelled` outcome, any other method with `-32601` — and after an abort or a lost connection nothing is written); exposes `probeCapabilities(AcpProbeCapabilitiesInput)` for non-inference capability probing |
35
+ | `AcpSession` / `AcpOpenInput` / `AcpSteerTurnInput` / `AcpConfigOption` / `AcpConfigOptionChoice` / `acpOptionChoices` / `acpOptionValues` / `AcpApprovalEnforcement` | _types_ / functions | a session's `providerPid`, its agent's `initialize` answer (`initialized`, with `agentCapabilities.promptCapabilities`), settings, title and commands, `approvalEnforcement` (`'agent-initiated'`), `setConfigOption(category or id, value)`, `respond(interactionId, reply)` for pending permissions, `steerTurn(input)` when `steerMode: 'prompt'`, per-open overrides on `AcpOpenInput`, and flat/grouped config-option flattening helpers (`acpOptionChoices`, `acpOptionValues`) |
36
+ | `AcpProbeCapabilitiesInput` / `AcpCapabilitiesProbe` / `AcpProbeMode` / `AcpSteerMode` / `AcpSessionMetaInput` / `AcpWatchPromptOutcome` / `AcpPromptOutcomeOverride` | _types_ | non-inference capability probe input/result (running regardless of `probeMode`; `eachModel: true` also selects each `model` value in the ephemeral session and returns `optionsByModel`; once `session/new` answered, `session/close` and `session/delete` run even after an abort or timeout), probe strategy, steer mode, static or `initialize`-derived `_meta` attachment on session open, and prompt-outcome verification hook reclassifying masked `end_turn` failures with `errorKind` and `threadDisposition` |
37
37
  | `AcpTransformUpdate` / `AcpUpdateEvent` / `AcpPermissionRequestEvent` | _types_ | update normalizer (`transformUpdate`), live/post-settle `session/update` observer payload (`onUpdate`), and permission request payload with `duringActiveTurn`, full typed `request.options`, and shared single-shot `respond()` (`onPermissionRequest`) |
38
38
  | `AcpClientInfoSchema` / `AcpClientInfo` / `AcpInitializeResultSchema` / `AcpInitializeResult` / `AcpConfigOptionSchema` / `AcpSessionUpdateSchema` / `AcpSessionUpdate` / `AcpPromptResult` / `AcpPromptUsage` / `AcpPermissionRequestSchema` / `AcpPermissionRequest` / `AcpPermissionOptionSchema` / `AcpPermissionOption` | schemas / _types_ | loose Zod schemas and typed ACP v1 wire payloads exposed to `sessionMeta`, `transformUpdate`, `onUpdate`, `onPermissionRequest`, and `watchPromptOutcome` |
39
39
  | `AcpSessionSummary` | _type_ | a session the agent keeps: id, working directory, title, last update |
@@ -26,7 +26,7 @@ profile's transcript. Evolving.
26
26
 
27
27
  | Export | Kind | Purpose |
28
28
  |--------|------|---------|
29
- | `createClaudeSdkDriver` / `ClaudeSdkDriver` / `ClaudeSdkDriverConfig` | function / _types_ | the driver: `query` and `sdkVersion` required; optional `forkSession`, `model`, `permissionMode` (default `default`), `allowDangerouslySkipPermissions`, `pathToClaudeCodeExecutable`, `systemPrompt`, `settingSources`, `enableFileCheckpointing`, `supportedDialogKinds` / `onUserDialog`, `hooks`, `tools`, `allowedTools`, `disallowedTools`, `mcpServers`, `mcpServersDelivery`, `strictMcpConfig`, `plugins`, `agents`, `extraArgs`, `stderr`, `spawnClaudeCodeProcess`, `onProviderPid`, `onQueryExit`, `onElicitation`, `onPermissionRequest`, `onEvent`, `onTurnUsage`, `verifyDelegation`, `resolveFile`, `maxImageBytes` (default 5 MiB), and `ambient`. Exposes `probeCapabilities(input)` for isolated never-yielding capability probes, `status` over passive `rate_limit_event` or active `readUsage()`, and `forkSession(sessionId, options?)` |
29
+ | `createClaudeSdkDriver` / `ClaudeSdkDriver` / `ClaudeSdkDriverConfig` | function / _types_ | the driver: `query` and `sdkVersion` required; optional `forkSession`, `model`, `permissionMode` (default `default`), `allowDangerouslySkipPermissions`, `pathToClaudeCodeExecutable`, `systemPrompt`, `settingSources`, `enableFileCheckpointing`, `supportedDialogKinds` / `onUserDialog`, `hooks`, `tools`, `allowedTools`, `disallowedTools`, `mcpServers`, `mcpServersDelivery`, `strictMcpConfig`, `plugins`, `agents`, `extraArgs`, `stderr`, `spawnClaudeCodeProcess`, `onProviderPid`, `onQueryExit`, `onElicitation`, `onPermissionRequest`, `onEvent`, `onTurnUsage`, `verifyDelegation`, `resolveFile`, `maxImageBytes` (default 5 MiB), `ambient`, and `onObserverError`. `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. Exposes `probeCapabilities(input)` for isolated never-yielding capability probes, `status` over passive `rate_limit_event` or active `readUsage()`, and `forkSession(sessionId, options?)` |
30
30
  | `ClaudeSdkSession` / `ClaudeSdkOpenInput` / `ClaudeSdkUsageRead` / `ClaudeSdkQueryExitContext` / `ClaudeSdkPermissionRequestMeta` / `ClaudeSdkFlagSettings` | _types_ | extended session returned by `open(ClaudeSdkOpenInput)` (supporting `resumeSessionAt`, `resumeDropsTurn`, and `onStartupPhase`): exposes `providerPid`, `readUsage(opts?)`, `setModel`, `setPermissionMode` (returning `SDKControlSetPermissionModeResponse \| undefined`), `applyFlagSettings(ClaudeSdkFlagSettings)`, `initializationResult`, `supportedModels`, `supportedCommands`, `accountInfo`, `getContextUsage`, `mcpServerStatus`, `toggleMcpServer`, `reconnectMcpServer`, `setMcpServers`, `stopTask`, `backgroundTasks`, and `rewindFiles`; supports `approve` with `updatedInput` for `AskUserQuestion` and emits `ClaudeSdkPermissionRequestMeta` (`input: Readonly<Record<string, JsonRpcValue>>`) to `onPermissionRequest` |
31
31
  | `ClaudeRuntimeEventSchema` / `ClaudeRuntimeEvent` / `ClaudeTaskUsageSchema` / `ClaudeTaskUsage` / `ClaudeSdkTurnUsageSchema` / `ClaudeSdkTurnUsage` / `ClaudeSdkTokenPairSchema` / `ClaudeSdkTokenPair` | schemas / _types_ | structured runtime events delivered to `onEvent` during and after turns (`task_started`, `task_updated`, `task_progress`, `task_notification`, `background_tasks_changed`, `tool_progress`, `api_retry`, `elicitation_complete`) alongside `compact_boundary` → `window { reset: 'context' }`, plus per-turn additive `modelUsage` deltas and `otherUsage` delivered to `onTurnUsage` |
32
32
  | `ClaudeSdkProbeCapabilitiesInput` / `ClaudeSdkCapabilitiesProbe` | _types_ | input and result shapes for `driver.probeCapabilities(input)`: runs an isolated never-yielding SDK query to inspect models, commands, account info, and optional usage, always closing the query in `finally` |
@@ -21,7 +21,7 @@ Evolving.
21
21
 
22
22
  | Export | Kind | Purpose |
23
23
  |--------|------|---------|
24
- | `createClaudeCliDriver` / `ClaudeCliDriverConfig` | function / _type_ | the driver; `permissionMode` defaults to `default`, so the server decides every tool the profile does not already allow; optional `resolveFile` and `maxImageBytes` (default 5 MiB) enable ordered turn-input image attachments |
24
+ | `createClaudeCliDriver` / `ClaudeCliDriverConfig` | function / _type_ | the driver; `permissionMode` defaults to `default`, so the server decides every tool the profile does not already allow; optional `resolveFile` and `maxImageBytes` (default 5 MiB) enable ordered turn-input image attachments; `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. |
25
25
  | `claudeFakeScenarios` | constant | the conformance scenarios in this dialect, for a scripted engine |
26
26
  | `claudeTranscriptPath` / `claudeTranscriptHasUuid` / `findTranscriptInput` | functions | offline Claude transcript path resolution (resolving `realpath` of `cwd` or its nearest existing ancestor) and bounded streaming UUID lookup / reconciliation without instantiating a driver |
27
27
  | `claudePlanWindows` / `claudeUsagePlanLimits` | functions | Claude's `rate_limit_event` windows and open-bucket usage / `/api/oauth/usage` `PlanLimits` mapping preserving `plan` and the reported model name as `scope` and `label` on model-scoped windows |
@@ -19,7 +19,7 @@ WebSocket-over-Unix-socket (`unix-listen` / `unix-connect`). Evolving.
19
19
 
20
20
  | Export | Kind | Purpose |
21
21
  |--------|------|---------|
22
- | `createCodexDriver` / `CodexDriver` / `CodexDriverConfig` | function / _types_ | the driver: `transport` (`stdio`, `unix-listen`, `unix-connect`), `serverArgs`, thread policy (`model`, `modelProvider`, `approvalPolicy`, `sandbox`, `developerInstructions`, `runtimeWorkspaceRoots`, `config`), `prepareThread` / `verifyThread` lifecycle hooks, observers (`onNotification`, `onServerRequest`, `serverRequestDelivery` `'external-only' \| 'all'`, `onDisconnect`), `maxFrameBytes` (WebSocket/stdio frame ceiling), optional `resolveFile` and `maxImageBytes` (default 5 MiB) for turn-input images, `connectControl(input)` for threadless connections, opt-in `openSharedServer(input)` for headless `stdio` multi-thread multiplexing (ADR 0329), approvals and input asked of the host, and multi-bucket limits from `account/rateLimits/read` |
22
+ | `createCodexDriver` / `CodexDriver` / `CodexDriverConfig` | function / _types_ | the driver: `transport` (`stdio`, `unix-listen`, `unix-connect`), `serverArgs`, thread policy (`model`, `modelProvider`, `approvalPolicy`, `sandbox`, `developerInstructions`, `runtimeWorkspaceRoots`, `config`), `prepareThread` / `verifyThread` lifecycle hooks, observers (`onNotification`, `onServerRequest`, `serverRequestDelivery` `'external-only' \| 'all'`, `onDisconnect`, and `onObserverError`, which receives every failure of a host callback the driver contained with the name of the option that failed, or `driver:notification` for a failure inside a shared server's own handling), `maxFrameBytes` (WebSocket/stdio frame ceiling), optional `resolveFile` and `maxImageBytes` (default 5 MiB) for turn-input images, `connectControl(input)` for threadless connections, opt-in `openSharedServer(input)` for headless `stdio` multi-thread multiplexing (ADR 0329), approvals and input asked of the host, and multi-bucket limits from `account/rateLimits/read`. Closing a session, a control connection or a shared server on a stdio app-server answers every server request it still holds, and any that arrives while the process stops, as stopped; after an abort or a lost connection nothing is written, and on a Unix-socket transport such a request is left for the TUI |
23
23
  | `CodexTransportConfig` | _type_ | transport selector: `{ kind: 'stdio' }`, `{ kind: 'unix-listen', socketPath, listenTimeoutMs? }`, or `{ kind: 'unix-connect', socketPath, expectedOwnerUid? }` (resolving symlink chains on parent directories safely across Linux and Darwin) |
24
24
  | `CodexSession` / `CodexControlClient` / `CodexControlConnection` / `CodexControlConnectInput` / `CodexRpcCallOptions` | _types_ | extended session returned by `open()` and threadless connection returned by `connectControl()`: expose `providerPid`, `userAgent` (from `initialize`), `respond`, `readConfig`, `readThread`, `resumeThread`, `startThreadTurn` (threadless `turn/start` without occupying a local session turn slot), `interruptTurn`, `steerTurn`, `compactThread`, `listThreads`, `listLoadedThreads`, `listCollaborationModes`, `listTurns`, `listItems`, `archiveThread`, `unarchiveThread`, `unsubscribeThread`, `setThreadName`, `updateThreadMetadata`, `revertThread`, `injectItems`, `listMcpServerStatus`, `listSkills`, `listModels`, `readAccount`, and `readRateLimits`, each accepting optional per-call `CodexRpcCallOptions` (`{ timeoutMs?, signal? }`); `CodexSession` also exposes `threadContext`, `startTurn` (returning `CodexTurn`), and non-mutating `forkThread` |
25
25
  | `CodexSharedServer` / `CodexSharedServerOpenInput` / `CodexSharedServerThreadInput` | _types_ | opt-in headless `stdio` multi-thread server returned by `driver.openSharedServer()` exposing `userAgent` and multiplexing up to `maxThreads` (default `32`, hard cap `256`) independent `CodexSession` instances with per-thread routing and `thread/unsubscribe` cleanup on thread close (refuses `unix-listen` / `unix-connect` fail-closed) |
@@ -0,0 +1,28 @@
1
+ # stitchkit/agent-executor/testing/claude-sdk — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/agent-executor/testing/claude-sdk` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/agent-runtime.txt` for the Agent application runtime guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/agent-executor/testing/claude-sdk` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/agent-executor/testing/claude-sdk`
16
+
17
+ The testing kit's Claude Agent SDK half. Its declarations name the types of the optional peer
18
+ `@anthropic-ai/claude-agent-sdk`; it runs without the SDK. Evolving.
19
+
20
+ | Export | Kind | Purpose |
21
+ |--------|------|---------|
22
+ | `createFakeClaudeSdkQuery` / `FakeClaudeSdkQueryConfig` / `FakeClaudeSdkQueryHarness` / `FakeClaudeSdkRunController` / `FakeClaudeSdkScriptedTurn` / `FakeClaudeSdkRecordedCall` | function / _types_ | scripted multi-turn in-process `ClaudeSdkQuery` harness over real `createClaudeSdkDriver` supporting `canUseTool` via `askPermission`, live control call recording, optional experimental usage attachment, and non-inference `probeCapabilities` |
23
+ | `createStubClaudeSdkSession` | function | fail-loud typed `ClaudeSdkSession` stub taking `StubOverrides<ClaudeSdkSession>` from `stitchkit/agent-executor/testing`: no-op `close()`, unexpected-call throws on unset methods |
24
+
25
+ ---
26
+
27
+
28
+ ---
@@ -16,19 +16,18 @@ Also read:
16
16
 
17
17
  | Export | Kind | Purpose |
18
18
  |--------|------|---------|
19
- | `runAgentEngineConformance` / `AgentEngineConformanceConfig` / `AgentEngineDialectScenarios` | function / _types_ | prove a driver against its dialect's scripted engine: capabilities shape, text and reconcile, approvals, failures by kind, interrupts (including `interruptDuringApproval`, whose request must close with `request-resolved`, and `requestAfterInterrupt`, which the driver must refuse rather than offer), a request still held when the turn ends (`requestAtTurnEnd`, closed with `request-resolved` before the end) or when the engine dies (`requestThenCrash`), neither left open to the consumer's answer, a dead or garbled engine, unknown records, and a dispatch never sent twice |
20
- | `createReplayExecutorDriver` / `ReplayExecutorDriver` / `ReplayExecutorDriverConfig` | function / _types_ | in-process, zero-subprocess, deterministic replay `AgentEngineDriver` over validated NDJSON transcripts for local dev and e2e tests; emulates any existing `ExecutorEngine` without widening `ExecutorEngineSchema` and provides `inputsFor`, `wasAnswered`, and `assertComplete` |
21
- | `createReplayGate` / `ReplayGate` | function / _type_ | deterministic label-based synchronization gate pausing `{ kind: 'gate', label }` steps until `waitForReached` / `release` without timers |
19
+ | `runAgentEngineConformance` / `AgentEngineConformanceConfig` / `AgentEngineDialectScenarios` | function / _types_ | prove a driver against its dialect's scripted engine: capabilities (what the driver declares is what `info()` reports, declared or not; a declared set matches the schema), text and reconcile, approvals, failures by kind, interrupts (including `interruptDuringApproval`, whose request must close with `request-resolved`, and `requestAfterInterrupt`, which the driver must refuse rather than offer), a request still held when the turn ends (`requestAtTurnEnd`, closed with `request-resolved` before the end) or when the engine dies (`requestThenCrash`), neither left open to the consumer's answer, a dead or garbled engine, unknown records, a dispatch never sent twice, and the session's life: `open` given an aborted signal, or one aborted from `onStartupPhase`, rejects with the signal's reason; an abort in a turn fails its stream with that reason and `respond` and `startTurn` reject with it; `interrupt` after the turn's end, an abort or a close resolves; `close()` in a turn fails the turn, resolves however often it is called and leaves `onStartupPhase` silent. Each of these waits at most 10 s, so a driver that hangs fails by the name of its check — give the test a longer timeout to read it |
20
+ | `createReplayExecutorDriver` / `ReplayExecutorDriver` / `ReplayExecutorDriverConfig` | function / _types_ | in-process, zero-subprocess, deterministic replay `AgentEngineDriver` over validated NDJSON transcripts for local dev and e2e tests; emulates any existing `ExecutorEngine` without widening `ExecutorEngineSchema` and provides `inputsFor`, `wasAnswered`, and `assertComplete`; `onObserverError(error, hook)` receives a throwing `onStartupPhase`, as the real drivers' option does |
21
+ | `createReplayGate` / `ReplayGate` | function / _type_ | deterministic label-based synchronization gate pausing `{ kind: 'gate', label }` steps until `waitForReached` / `release` without timers; a label is compared without its surrounding whitespace on every call |
22
22
  | `ExecutorReplayTranscriptSchema` / `ExecutorReplayTranscript` / `ExecutorReplayStepSchema` / `ExecutorReplayStep` / `parseReplayTranscript` / `ParseReplayTranscriptOptions` / `formatReplayTranscript` | schemas / functions / _types_ | strict Zod-validated NDJSON transcript format (bounded by `maxBytes` and `maxSteps`, substituting `<workspace>` placeholders) and round-trip parser/formatter |
23
23
  | `REPLAY_SCENARIOS` / `unpackReplayScenario` / `replayDialectScenarios` | constant / functions | built-in deterministic scenario presets (`'text-stream'`, `'approval'`, `'user-input'`, `'tool-calls'`, `'rate-limit'`, `'multi-turn'`, `'crash-mid-turn'`) and conformance dialect adapter |
24
- | `createFakeCodexAppServer` / `FakeCodexAppServer` / `FakeCodexAppServerConfig` / `FakeCodexRpcHandler` / `FakeCodexRpcHandlerOutcome` / `FakeCodexRpcErrorOutcome` / `RecordedJsonRpcRequest` | function / _types_ | portable (Bun and Node.js) real Unix-socket WebSocket JSON-RPC fake Codex app-server for integration tests with `createCodexDriver({ transport: { kind: 'unix-connect' } })`: automatic `initialize` handshake, `'hang'` / DTO / RPC error handlers, `requests` recording, `sendNotification`, `sendRequest`, `sendRaw`, `disconnect()`, and idempotent `close()` |
25
- | `createFakeClaudeSdkQuery` / `FakeClaudeSdkQueryConfig` / `FakeClaudeSdkQueryHarness` / `FakeClaudeSdkRunController` / `FakeClaudeSdkScriptedTurn` / `FakeClaudeSdkRecordedCall` | function / _types_ | scripted multi-turn in-process `ClaudeSdkQuery` harness over real `createClaudeSdkDriver` supporting `canUseTool` via `askPermission`, live control call recording, optional experimental usage attachment, and non-inference `probeCapabilities` |
26
- | `createStubCodexControlClient` / `createStubCodexControlConnection` / `createStubCodexSession` / `createStubCodexSharedServer` / `createStubCodexTurn` / `createStubAgentEngineTurn` / `createStubClaudeSdkSession` / `createStubAcpSession` / `StubOverrides` / `StubAgentEngineTurnOverrides` / `StubCodexTurnOverrides` | functions / _types_ | fail-loud typed consumer stub factories (`exactOptionalPropertyTypes: true`-safe `StubOverrides<T>`, no-op `close()`, unexpected-call throws on unset methods) |
24
+ | `createFakeCodexAppServer` / `FakeCodexAppServer` / `FakeCodexAppServerConfig` / `FakeCodexRpcHandler` / `FakeCodexRpcHandlerOutcome` / `FakeCodexRpcErrorOutcome` / `RecordedJsonRpcRequest` | function / _types_ | portable (Bun and Node.js) real Unix-socket WebSocket JSON-RPC fake Codex app-server for integration tests with `createCodexDriver({ transport: { kind: 'unix-connect' } })`: automatic `initialize` handshake, `'hang'` / DTO / RPC error handlers, `requests` recording, `sendNotification`, `sendRequest`, `sendRaw`, `disconnect()`, and idempotent `close()`; a server `error` after startup drops the connected clients, rejects their pending `sendRequest` calls and makes every later send throw with that error as `cause` |
25
+ | `createStubCodexControlClient` / `createStubCodexControlConnection` / `createStubCodexSession` / `createStubCodexSharedServer` / `createStubCodexTurn` / `createStubAgentEngineTurn` / `createStubAcpSession` / `StubOverrides` / `StubAgentEngineTurnOverrides` / `StubCodexTurnOverrides` | functions / _types_ | fail-loud typed consumer stub factories (`exactOptionalPropertyTypes: true`-safe `StubOverrides<T>`, no-op `close()`, unexpected-call throws on unset methods); `createStubCodexSharedServer` declares the capabilities `createCodexDriver()` declares on its shared server |
27
26
  | `makeExecutorDelta` / `ExecutorDeltaInput` / `makeCodexNotificationEvent` / `CodexNotificationEventOverrides` / `makeCodexThreadFixture` | functions / _types_ | schema-validated fixture factories for `ExecutorDelta`, `CodexNotificationEvent`, and `CodexThread` |
28
27
  | `FakeEngineScenarioSchema` / `FakeEngineScenario` / `FakeEngineStepSchema` / `FakeEngineStep` | schemas / _types_ | a scripted engine turn in any dialect: expect, emit, delay, crash, exit |
29
28
  | `runFakeClaudeEngine` | function | play a scenario as Claude Code does on `stream-json` — the engine side of a Claude-dialect conformance test |
30
29
 
31
- ---
32
-
30
+ This entrypoint declares no optional peer: a Codex or ACP driver's tests import it without
31
+ `@anthropic-ai/claude-agent-sdk` installed, with `skipLibCheck: false`.
33
32
 
34
33
  ---
@@ -25,14 +25,14 @@ leaves of their own; this entrypoint knows no vendor. Evolving.
25
25
  | `PlanLimitsSchema` / `PlanLimits` / `PlanWindowSchema` / `PlanWindow` | schemas / _types_ | a subscription's limits: `known`, `no-plan-limit` or `unpublished`, with optional `plan` and the last read's error beside the last answer; each window carries `name`, `usedPercent`, and optional `resetsAt`, `windowDurationMins`, `label`, and `scope` |
26
26
  | `ThreadClaimSchema` / `ThreadClaim` / `ThreadLeaseSchema` / `ThreadLease` / `ThreadRenewSchema` / `ThreadReleaseSchema` | schemas / _types_ | thread leases pinned to an executor and profile, under a fence |
27
27
  | `TurnOfferSchema` / `TurnOffer` / `TurnPhaseSchema` / `TurnPhase` / `TurnReportSchema` / `TurnReport` / `TurnReportAckSchema` / `TurnFailureKindSchema` / `TurnInterruptSchema` / `InteractionReplySchema` / `InteractionReply` / `EXECUTOR_ERRORS` | schemas / _types_ / constant | a turn offered under its thread's `turnOrdinal`, its phases and reports applied once by `executorSeq` (acknowledged `applied`, `duplicate` or `not-retained`), interrupts, answers to an engine's requests (`approve` with optional `scope: 'once' \| 'session'` and `updatedInput`, `deny` with optional `interrupt: boolean`), and the refusal codes |
28
- | `ExecutorDeltaSchema` / `ExecutorDelta` / `ExecutorStatusDeltaSchema` / `ExecutorStartupPhaseSchema` / `ExecutorStartupPhase` / `ExecutorThreadDispositionSchema` / `ExecutorThreadDisposition` / `ExecutorErrorKindSchema` / `ExecutorErrorKind` / `ExecutorRawSchema` / `ExecutorTokenUsageSchema` / `ExecutorTokenUsage` / `ExecutorModelUsageSchema` / `ExecutorModelUsage` | schemas / _types_ | what an engine said: `agent-parts` blocks with `turnId`, `itemId` and `raw`, plus requests, usage (including optional `cacheCreationInputTokens`, `thinkingTokens`, `totalTokens`, cumulative `total`, and per-model `modelUsage`), the context gauge (`context-usage`), lifecycle `status` deltas (`ExecutorStartupPhase`: `spawning`, `initializing`, `verifying`), the end of the turn (with optional `threadDisposition`: `'reusable' \| 'broken'`, also carried on `TurnReportSchema.failure`), errors by kind and window resets |
28
+ | `ExecutorDeltaSchema` / `ExecutorDelta` / `ExecutorStatusDeltaSchema` / `ExecutorStartupPhaseSchema` / `ExecutorStartupPhase` / `ExecutorThreadDispositionSchema` / `ExecutorThreadDisposition` / `ExecutorErrorKindSchema` / `ExecutorErrorKind` / `ExecutorRawSchema` / `ExecutorTokenUsageSchema` / `ExecutorTokenUsage` / `ExecutorModelUsageSchema` / `ExecutorModelUsage` | schemas / _types_ | what an engine said: `agent-parts` blocks with `turnId`, `itemId` and `raw`, plus requests, usage (including optional `cacheCreationInputTokens`, `thinkingTokens`, `totalTokens`, cumulative `total`, and per-model `modelUsage`), the context gauge (`context-usage`), lifecycle `status` deltas (`ExecutorStartupPhase` is an open label of 1–64 trimmed characters; the drivers emit `spawning`, `initializing` and `verifying`, and a reader treats any other label as a phase it does not know), the end of the turn (with optional `threadDisposition`: `'reusable' \| 'broken'`, also carried on `TurnReportSchema.failure`), errors by kind and window resets |
29
29
  | `projectExecutorDeltas` | function | fold a turn's deltas into the message parts the agent runtime stores (ignoring lifecycle `status` deltas) |
30
- | `buildContextHandoff` / `withInlineHandoffContext` / `InlineHandoffComposition` / `ContextHandoffInputSchema` / `ContextHandoffInput` / `ContextHandoffEntrySchema` / `ContextHandoffEntry` / `ContextHandoffMessageEntrySchema` / `ContextHandoffClearEntrySchema` / `ContextHandoffBudgetSchema` / `ContextHandoffStrategySchema` / `ContextHandoffResultSchema` / `ContextHandoffResult` / `ContextHandoffSelectedItemSchema` / `ContextHandoffSelectedItem` / `ContextHandoffStructuredItemSchema` / `ContextHandoffStructuredItem` | functions / schemas / _types_ | pure portable context-handoff builder for cross-engine or cross-session transitions: supports `full` and `delta` (`afterItemId` or `afterTurnId`, fail-closed `missingAnchor: 'error'` or `'full'`) strategies respecting the latest `clear` barrier, keeps intact items by fixed priority (`last user → last assistant → first user → newest..oldest`) under strict `maxTokens` / `maxBytes` / `maxOmittedIds` (and optional `contextWindowTokens` / `usedTokens` / `workReserveTokens`) ceilings while dropping non-text/binary/reasoning/provider parts, emits deterministic `inlineText` and Responses API `structuredItems`, and composes inline context ahead of a user prompt via `withInlineHandoffContext` (deferring on leading `/slash` commands) |
31
- | `AgentEngineDriver` / `AgentEngineSession` / `AgentEngineTurn` / `ExecutorEngineInfo` | _types_ | one vendor's engine behind one interface: info, declarative `capabilities`, login status, a session per connection (accepting `onStartupPhase` on `open`), turns with `interrupt` and `respond`, `findInput` for a `client-id` engine |
30
+ | `buildContextHandoff` / `withInlineHandoffContext` / `InlineHandoffComposition` / `ContextHandoffInputSchema` / `ContextHandoffInput` / `ContextHandoffEntrySchema` / `ContextHandoffEntry` / `ContextHandoffMessageEntrySchema` / `ContextHandoffClearEntrySchema` / `ContextHandoffBudgetSchema` / `ContextHandoffStrategySchema` / `ContextHandoffResultSchema` / `ContextHandoffResult` / `ContextHandoffSelectedItemSchema` / `ContextHandoffSelectedItem` / `ContextHandoffStructuredItemSchema` / `ContextHandoffStructuredItem` | functions / schemas / _types_ | pure portable context-handoff builder for cross-engine or cross-session transitions: supports `full` and `delta` (`afterItemId` or `afterTurnId`, fail-closed `missingAnchor: 'error'` or `'full'`) strategies respecting the latest `clear` barrier, keeps intact items by fixed priority (`last user → last assistant → first user → newest..oldest`) under strict `maxTokens` / `maxBytes` / `maxOmittedIds` (and optional `contextWindowTokens` / `usedTokens` / `workReserveTokens`; an omitted `usedTokens` counts as `0` — the caller's statement that the receiving thread is new, so a caller that does not know the fill of a thread in use omits `contextWindowTokens` too) ceilings while dropping non-text/binary/reasoning/provider parts, emits deterministic `inlineText` and Responses API `structuredItems`, and composes inline context ahead of a user prompt via `withInlineHandoffContext` (deferring on leading `/slash` commands) |
31
+ | `AgentEngineDriver` / `AgentEngineSession` / `AgentEngineTurn` / `ExecutorEngineInfo` | _types_ | one vendor's engine behind one interface: info, declarative `capabilities`, login status, a session per connection (accepting `onStartupPhase` on `open`), turns with `interrupt` and `respond`, `findInput` for a `client-id` engine. A session stops for one reason, asked in one order — its `close()`, the loss of its engine, the caller's `signal`, its own abort: `open` given an aborted signal rejects with the signal's reason; an abort in a turn fails its stream with that reason, and `respond` and `startTurn` then reject with it; `respond` on a turn that failed rejects with that failure; `interrupt` on an ended turn or a stopped session resolves and tells the engine nothing; `close()` may be called again |
32
32
  | `dispatchTurn` / `DispatchOutcome` | function / _type_ | send a turn's input at most once through `LocalStepDurability.effect`: `sent`, `delivered` after a reconcile, or `unknown_after_restart` — never resent |
33
33
  | `spawnEngineProcess` / `EngineProcess` | function / _type_ | an engine process talked to by lines over `stitchkit/process`: declared environment, owner-loss termination, optional leader `pid` / `pidReady`, `stdoutMode` (`'lines'` default or `'drain'` for socket-serving engines), bounded lines (`maxLineBytes`), stderr, queued stdin (`maxPendingStdinBytes`) and stdin written over the connection's life (`maxStdinBytes`, a refused `send()` that leaves the engine running); every option checked before the spawn |
34
34
  | `createExecutorLeases` / `memoryExecutorLeaseStore` / `ExecutorLeaseStateStore` / `ExecutorLeaseState` / `ExecutorLeaseStateSchema` / `ExecutorLeaseRefusal` | functions / _types_ / class | the server's thread leases and turn receipts over one atomically updated value, bounded by threads: each thread keeps the receipts of its last `retainedTurns` turns (default 64, at most 1024) and the highest `turnOrdinal` it let go, a report of a turn at or below it is `not-retained`, and `resume(resumable)` answers a hello the same way; a `StateStore` of `stitchkit/application` fits; a refusal is an `ExecutorLeaseRefusal` — an `AppError` with status 409 and a code of `EXECUTOR_ERRORS` — so an operation returning the service's promise answers `409 { error: { code } }` |
35
- | `ExecutorProfileConfigSchema` / `ExecutorProfileConfig` / `EXECUTOR_ENV_KEY_PATTERN` / `sanitizeProfileEnv` / `engineEnvironment` / `ownCredentials` / `helloProfile` / `CREDENTIAL_VARIABLES` | schema / _type_ / constants / functions | a profile on the executor's machine, profile env-key filtering (`EXECUTOR_ENV_KEY_PATTERN`, `sanitizeProfileEnv`), the engine's allowlisted environment with an explicit profile's `home` as `CLAUDE_CONFIG_DIR`, `CODEX_HOME` or (ACP) `HOME` plus explicit `profile.env` pass-through for host-specific overrides (such as `TMPDIR`, `SSH_CONNECTION`, or agent-specific `AGY_*` variables), and `helloProfile({ profile, status, ambient })` carrying no path and no value; a driver refuses a profile whose `engine` is not its own with a `TypeError`, before it reads a file or starts the engine |
35
+ | `ExecutorProfileConfigSchema` / `ExecutorProfileConfig` / `EXECUTOR_ENV_KEY_PATTERN` / `engineEnvironment` / `ownCredentials` / `helloProfile` / `CREDENTIAL_VARIABLES` | schema / _type_ / constants / functions | a profile on the executor's machine, the one rule for a declared variable's name (`EXECUTOR_ENV_KEY_PATTERN`: the schema refuses a profile whose `env` holds any other name, on every path a profile takes), the engine's allowlisted environment with an explicit profile's `home` as `CLAUDE_CONFIG_DIR`, `CODEX_HOME` or (ACP) `HOME` plus explicit `profile.env` pass-through for host-specific overrides (such as `TMPDIR`, `SSH_CONNECTION`, or agent-specific `AGY_*` variables), and `helloProfile({ profile, status, ambient })` carrying no path and no value; a driver refuses a profile whose `engine` is not its own with a `TypeError`, before it reads a file or starts the engine |
36
36
  | `mergeRateLimitEvent` / `planLimitsReadFailed` / `planLimitsDue` / `planWindowExpired` / `planWindowDurationMins` | functions | plan limits kept as three answers (`mergeRateLimitEvent` preserving `plan`, `planLimitsReadFailed`, `planLimitsDue` treating clean `no-plan-limit`/`unpublished` as not due, `planWindowExpired`, and `planWindowDurationMins` deriving durations in minutes) |
37
37
  | `canAdvanceTurnPhase` / `isTerminalTurnPhase` | functions | the turn phase machine: a terminal phase is never left |
38
38
  | `advanceExecutorConnection` / `canAcceptTurn` / `INITIAL_EXECUTOR_CONNECTION` / `ExecutorConnectionState` / `ExecutorConnectionEvent` | functions / constant / _types_ | the executor's connection as a pure machine with generations: an answer of an earlier connection never acts on a later one |
@@ -40,6 +40,29 @@ leaves of their own; this entrypoint knows no vendor. Evolving.
40
40
 
41
41
  ---
42
42
 
43
+ ### Version skew between an executor and its server
44
+
45
+ Every object of the contract is strict: a message with a key its reader does not declare is
46
+ refused whole, and `protocol: 1` negotiates nothing. An executor and a server on different
47
+ releases therefore agree only on what the older one declares (ADR 0334):
48
+
49
+ - **Upgrade the server first.** It reads `hello` and `report`; a driver writes `capabilities` on
50
+ every engine it announces, so an executor newer than its server has its handshake refused. An
51
+ older executor keeps working against a newer server: every added key is optional.
52
+ - **A server writes an added reply key only to an executor that can read it.** `scope: 'session'`
53
+ needs the engine's `sessionApproval`, `updatedInput` its `updatedToolInput`, `interrupt` its
54
+ `interruptOnDeny`, as that executor's `hello` declared them; an engine announced without
55
+ `capabilities` is sent none of the three.
56
+
57
+ What a release added to the wire, and so what a reader older than it refuses:
58
+
59
+ | Added in | Travels | Message | A reader older than the release refuses |
60
+ |----------|---------|---------|------------------------------------------|
61
+ | 0.130.0 | executor → server | `hello` | `engines[].capabilities` |
62
+ | 0.130.0 | executor → server | `report` | `deltas[].type = 'status'`, `turn-end.threadDisposition`, `usage.cacheCreationInputTokens`, `usage.thinkingTokens`, `usage.totalTokens`, `usage.total`, `usage.modelUsage`, `failure.threadDisposition` |
63
+ | 0.130.0 | server → executor | `reply` | `approve.scope`, `approve.updatedInput`, `deny.interrupt` |
64
+ | 0.131.0 | executor → server | `hello` | `profiles[].planLimits.plan`, `profiles[].planLimits.windows[].scope` |
65
+
43
66
  For a Claude CLI or SDK profile that should use the user's native sign-in, pass
44
67
  `{ profileId: 'personal', engine: 'claude-sdk', home: join(homedir(), '.claude'), claudeConfigDir: 'default' }`.
45
68
  The child uses its native configuration and the executor still reads transcripts from `home`.
@@ -235,7 +235,7 @@ the field is ignored and the query is ranked as usual.
235
235
 
236
236
  Every ceiling is required. `maxSchemaBytes` measures UTF-8 bytes over canonical
237
237
  name, description and presentation schema. The options that shape how inputs are
238
- advertised — `extend`, `flattenUnionInput`, `inputRecursionDepth` — are set on
238
+ advertised — `extend`, `flattenUnionInput`, `inputRecursionDepth`, `inputNestingDepth` — are set on
239
239
  `createDeferredAgentToolSurface`, not on `mount`, so the manifest the selector
240
240
  ranks and the ceilings measure is the one the model receives; a `mount` that
241
241
  names one is refused. It is useful for before/after
package/llms/contract.txt CHANGED
@@ -546,7 +546,8 @@ from the root `stitchkit`.
546
546
  | `OperationEffect` / `OperationEffectSchema` | _type_ / schema | closed `'read' \| 'write'` side-effect classification declared on contract endpoints |
547
547
  | `contractOperationEffects` / `requireContractOperationEffects` | function | project declared endpoint `effect` tags from a contract; `requireContractOperationEffects` fails closed and lists every operation missing `effect` |
548
548
  | `withToolView` | function | declare an endpoint's call and answer on the tool surface (MCP, AGENT, CLI): input `defaults`, and optionally a view `output` and a `project`, typed against the endpoint's own schemas; HTTP keeps the full answer — [guide](../guide/mcp-and-agents.md#a-different-answer-for-tools--withtoolview) |
549
- | `EndpointToolOptions` | _type_ | an endpoint's `tool` group — `name`, `view`, `ui`, `annotations`, `mcp`, `inputRecursionDepth`: what the tool surfaces read that HTTP does not |
549
+ | `EndpointToolOptions` | _type_ | an endpoint's `tool` group — `name`, `view`, `ui`, `annotations`, `mcp`, `inputRecursionDepth`, `inputNestingDepth`: what the tool surfaces read that HTTP does not |
550
+ | `OperationToolOption` | _type_ | the `tool` options an operation's identity carries to every tool transport — `ui`, `annotations`, `mcp`, `inputRecursionDepth`, `inputNestingDepth` |
550
551
  | `EndpointToolView` | _type_ | the stored shape of a tool view (`MethodDef.toolView`) |
551
552
  | `DeclaredToolView` | _type_ | a tool view as `withToolView` produces it — the only form `tool.view` accepts |
552
553
  | `WithToolView` | _type_ | the endpoint `withToolView` returns: its own tool options plus the declared view in `tool.view` — name it when a helper returns such an endpoint |
@@ -612,7 +613,12 @@ from the root `stitchkit`.
612
613
  | `ErrorDetailsSchema` | _type_ | required or optional Zod object accepted for structured details |
613
614
  | `ErrorDetailsOutput` | _type_ | parsed details inferred from one definition |
614
615
  | `ErrorFactoryArguments` | _type_ | options tuple with forbidden/required/optional details inferred per code |
615
- | `ErrorFactory` | _type_ | one typed `AppError` constructor |
616
+ | `ErrorFactory` | _type_ | one typed `AppError` constructor; it carries its `code` and `definition`, so an endpoint can list it in `refuses` |
617
+ | `RefusalDeclaration` | _type_ | one entry of an endpoint's `refuses` — an `ErrorFactory` (`{ code, definition }`) — [guide](../guide/auth-and-errors.md#the-codes-an-operation-refuses-with) |
618
+ | `DescribedRefusal` | _type_ | a declared refusal resolved for a reader without types — `{ code, status, retryable, message?, details? }`, on `MethodDef.refuses` |
619
+ | `OperationRefusal` | _type_ | every refusal a call of one endpoint can end with — its declared codes with typed `details`, plus framework and client codes; what `client.op.refusal(error)` returns |
620
+ | `DeclaredRefusal` | _type_ | the `ApiError` shape `OperationRefusal` narrows — `{ code, status, details, message, hint?, traceId?, retryable? }` |
621
+ | `CLIENT_ERROR_CODES` / `ClientErrorCode` | const / _type_ | codes only the typed client raises, with no server status — `UNKNOWN_ERROR`, `STREAM_TRUNCATED`, `STREAM_PROTOCOL_ERROR` |
616
622
  | `ErrorFactories` | _type_ | mapped constructor registry derived from all definitions |
617
623
  | `FrozenErrorDefinitions` | _type_ | read-only definition registry returned to consumers |
618
624
  | `STITCH_ERROR_STATUS` | const | `code → HTTP status` map for stitchkit's own error codes — [guide](../guide/auth-and-errors.md#stitch-codes-vs-your-codes) |
@@ -50,12 +50,17 @@ without splitting, preserve every output, and write each asset's `bytes` to its
50
50
  This evolving entrypoint is a build dependency; runtime imports do not reach it.
51
51
  The detailed recipe is in [native IO](../guide/native-io.md#public-native-packaging).
52
52
 
53
- It also owns the build of a client into one self-contained file:
53
+ It also owns the two builds of a client — one self-contained file, and a typed npm package:
54
54
 
55
55
  | Export | Kind | Summary |
56
56
  |--------|------|---------|
57
- | `buildClientArtifact` | function | bundle a client entry into one self-contained file with its SHA-256, refuse forbidden modules in the graph, optionally pack and verify an npm archive — [guide](../guide/native-io.md#a-client-as-one-self-contained-file) |
58
- | `ClientArtifactOptions` | _type_ | entry, output file, runtime, forbidden modules and the optional package to pack and verify |
59
- | `ClientArtifact` | _type_ | the built file, its SHA-256 and size, the bundled modules and the verified archive |
60
- | `ForbiddenModule` | _type_ | a package name, a source path fragment or a `RegExp` over module paths |
61
- | `ForbiddenModuleError` | class | the refusal of a bundle that reaches a forbidden module: `module` and `importedBy` |
57
+ | `buildClientArtifact` | function | bundle a client entry into one self-contained file with its SHA-256 and refuse forbidden modules in the graph — [guide](../guide/native-io.md#a-client-as-one-self-contained-file) |
58
+ | `ClientArtifactOptions` | _type_ | entry, output file, runtime, forbidden modules, `executables.bun`, deadline and signal |
59
+ | `ClientArtifact` | _type_ | the built file, its SHA-256 and size, and the bundled modules |
60
+ | `buildClientPackage` | function | build several entries of a typed client into one npm archive over one module graph, with peers and dependencies outside and declarations that resolve under Bundler and NodeNext, and return it only after the archive was installed, imported in Node and Bun and typechecked by a strict consumer — [guide](../guide/native-io.md#a-typed-client-as-an-npm-package), [ADR 0331](../decisions/0331-a-client-package-is-one-module-graph-proven-installed.md) |
61
+ | `ClientPackageOptions` | _type_ | name, version, `entries` by subpath, `tsconfig`, peers and dependencies, forbidden modules, runtime, output directory, `manifest`, extra `files`, `exportedFiles` (`./package.json` and packed files a consumer imports by subpath), `replaceModules` (a module built from given contents), `proof` (consumer sources, required and distinct exports, type packages), `executables`, deadline and signal |
62
+ | `ClientPackageManifest` | _type_ | descriptive `package.json` fields of the package; a field the build writes itself is refused |
63
+ | `ClientPackage` | _type_ | the archive with its SHA-256 and size, every packed file with its digest, the bundled modules, exports per subpath, the names proven shared across subpaths, and what the proof ran, the exported files it resolved included |
64
+ | `ClientPackageError` | class | the refusal of a client package: a closed `reason` and `details` naming the file, specifier, package or names |
65
+ | `ForbiddenModule` | _type_ | a package name or subpath, a source path fragment or a `RegExp` over module paths |
66
+ | `ForbiddenModuleError` | class | the refusal of a client that reaches a forbidden module, bundled or left external: `module` and `importedBy` |
@@ -0,0 +1,18 @@
1
+ # stitchkit/process/bootstrap — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/process/bootstrap` (docs/api/reference.md)
7
+
8
+ ==============================================================================
9
+ # API reference: `stitchkit/process/bootstrap` (docs/api/reference.md)
10
+ ==============================================================================
11
+
12
+ ## `stitchkit/process/bootstrap`
13
+
14
+ Narrow startup entry for single-file applications that lazy-import `stitchkit/process` or `stitchkit/service-host/work`.
15
+
16
+ | Export | Kind | Purpose |
17
+ |---|---|---|
18
+ | `bootstrapPackageProcess` | function | call before application argv routing; returns `true` only when the package owns this invocation — the owner-loss guard of `runNativeCommand`, or a process root of `stitchkit/service-host/work` that could not become its command — so the application skips its dispatcher while preserving a lazy import of the full runner |
@@ -11,6 +11,92 @@ Parts of this slice:
11
11
  # Guide: Native IO (docs/guide/native-io.md) (continued)
12
12
  ==============================================================================
13
13
 
14
+ ## Libraries with a Zod-only runtime
15
+
16
+ Public leaves keep optional peers out of their import closure. Installing `stitchkit` still
17
+ installs the complete package and ky; selective imports alone do not avoid that installation.
18
+ A library can use Stitchkit as a build dependency, bundle its selected public native imports,
19
+ keep Zod external, and publish the resulting implementation with its library artifact.
20
+
21
+ ```ts
22
+ // The library's build entry; all mechanisms remain owned by Stitchkit.
23
+ export { canonicalJson } from 'stitchkit/primitives';
24
+ export { writeFileAtomic, withExclusiveLock } from 'stitchkit/files';
25
+ export { observeProcessInstance, probeProcessOwner, runNativeCommand } from 'stitchkit/process';
26
+ ```
27
+
28
+ Bundle for Node-compatible execution with Zod external. Publish declarations from the same
29
+ version: carry their reachable relative `.d.ts` closure, rather than emitting references to
30
+ `stitchkit` that force clients to install it for types. A library exposing its own DTOs may
31
+ instead emit declarations for only that DTO contract. Keep the library's manifest at runtime
32
+ `dependencies: {}` and `peerDependencies: { zod: ... }` when that is its declared promise.
33
+
34
+ The packaged Darwin loader computes its addon path at run time from its own file
35
+ (`module.filename`), so a bundler never follows it: bundling `stitchkit/server`,
36
+ `stitchkit/files` or `stitchkit/process` yields the same single JS file on every operating
37
+ system, with no `.node` output, `bun build --outfile` works, and no path of the build machine
38
+ becomes a literal of the artifact. A bundle has no installed package beside it, so without the
39
+ packaging plugin it never loads the addon: the first call that needs it reports the Darwin backend
40
+ `unavailable` with stage `packaging`, and the message names `createNativePackaging`. An artifact
41
+ that must carry the Darwin addon uses the packaging plugin of the next section; it is the only way
42
+ a static loader enters a bundle.
43
+
44
+ Only these calls load the addon, and only on macOS: process identity (`observeProcessInstance`
45
+ and `probeProcessOwner`), every exclusive lock (`withExclusiveLock` and what is built on it, such
46
+ as the file state store and the diagnostic journal, and the startup lock of `createServer({ unix })`), the contained file operations of the Agent
47
+ coding tools and `--output-dir` downloads of `stitchkit/cli`. Without the addon a download refuses, and a lock still works, but it cannot record or check its owner's
48
+ identity, so a lock held by a crashed owner is not reclaimed. The managed file boundary
49
+ (`createManagedFileBoundary` and the transfer tools built on it), atomic writes and the chunk
50
+ spool never load it, on any operating system. The package is free of import side effects
51
+ (`sideEffects: false`), so a bundle that imports only those parts carries no Darwin loader at all.
52
+
53
+ Check an artifact by its loader, never by whether it holds `.node` bytes: Bun can copy the addon
54
+ into a compiled executable even without the plugin, and the unpackaged loader does not use it.
55
+ `inspectNativeArtifact(bytes)` from `stitchkit/files/packaging` reads the marker every generated
56
+ loader carries and answers `packaged` (the plugin's static loader is inside), `unpackaged` (the
57
+ default loader is inside, and every call above refuses on macOS) or `no-loader` (nothing in the
58
+ artifact loads the addon). It reads both latin1 and UTF-16LE, because Bun stores source text with
59
+ non-ASCII characters as UTF-16, and it does not mistake the `STITCHKIT_NATIVE_NOT_PACKAGED` error
60
+ code, which every bundle with a lock carries, for a loader. Artifacts built by 0.107.0 or earlier
61
+ carry no marker and read `no-loader`.
62
+
63
+ ```ts
64
+ import { inspectNativeArtifact } from 'stitchkit/files/packaging'
65
+
66
+ const loader = inspectNativeArtifact(await Bun.file('dist/cli').bytes())
67
+ if (loader === 'unpackaged') throw new Error('dist/cli was built without native packaging')
68
+ ```
69
+
70
+ ```sh
71
+ bun build src/native.ts --target=bun --minify --outfile=dist/native.js
72
+ ```
73
+
74
+ That plain build serves Linux and the parts that never load the addon. A library whose consumers
75
+ take locks or read process identity on macOS builds each native entry with the companion plugin of
76
+ the next section (one entry per build, `naming.entry` equal to `entryPath`) and ships the addon it
77
+ writes beside the entries.
78
+
79
+ Qualify the complete output outside its build tree and installed dependency graph. Test process
80
+ identity, live-owner refusal, dead-owner recovery and contained file operations in artifacts built
81
+ with the packaging plugin, and check that an unpackaged build reports the backend `unavailable`
82
+ with stage `packaging` rather than certifying a dead owner. Bun and Node package imports retain the same
83
+ lazy loader; importing a portable leaf does not load a Darwin addon on another OS. Test
84
+ declarations too, and check that importing an unbundled Stitchkit leaf fails in a deliberately
85
+ isolated library distribution. A separate schema-only entry must not import the native entry.
86
+
87
+ If the Darwin backend cannot load, `observeProcessInstance` still returns `unavailable`.
88
+ Its backend `Error` preserves the original `cause`; JSON serialization carries only the stable
89
+ `DARWIN_BACKEND_UNAVAILABLE` code, architecture, safe message and failure stage
90
+ (`architecture`, `packaging`, `resolve`, `load` or `surface`), plus a recognized native error code
91
+ when present: `packaging` is a bundle built without the packaging plugin, with native code
92
+ `STITCHKIT_NATIVE_NOT_PACKAGED`.
93
+ It excludes stack, paths and nested cause. This backend diagnosis does not reclassify kernel
94
+ failures or turn unavailable identity into proof that an owner is dead. If a runtime provides
95
+ no recognized native error code, the stage stays `load`; the loader never infers errno from text.
96
+
97
+ This delivery removes a runtime kernel installation; it does not remove the build-time
98
+ Stitchkit installation or create an independent lightweight npm package.
99
+
14
100
  ## Public native packaging
15
101
 
16
102
  Custom archives and installers use `stitchkit/files/packaging` at **build time**.
@@ -148,8 +234,7 @@ The plugin does not parse consumer JS or establish a second runtime native imple
148
234
 
149
235
  A package that owns a server usually ships a typed client for it, and the client's consumers
150
236
  must not inherit the server's dependencies. `buildClientArtifact` (`stitchkit/files/packaging`)
151
- bundles one entry module into a single file, publishes its SHA-256 beside it and can prove an
152
- npm archive of it:
237
+ bundles one entry module into a single file and publishes its SHA-256 beside it:
153
238
 
154
239
  ```ts
155
240
  import { buildClientArtifact } from 'stitchkit/files/packaging'
@@ -158,30 +243,175 @@ const artifact = await buildClientArtifact({
158
243
  entry: 'src/api-client.ts',
159
244
  outFile: 'dist/api-client.js', // + dist/api-client.js.sha256
160
245
  forbiddenModules: ['chalk', '@acme/terminal-ui', 'src/terminal/', /providers\//],
161
- package: {
162
- name: '@acme/api-client', version: '1.4.0', outDir: 'dist',
163
- exports: ['createApiClient'],
164
- },
165
246
  })
166
- // artifact.file, artifact.sha256, artifact.bytes, artifact.modules, artifact.package.tarball
247
+ // artifact.file, artifact.sha256, artifact.bytes, artifact.modules
167
248
  ```
168
249
 
169
250
  - **`forbiddenModules`** refuses a bundle whose module graph reaches a listed module with a
170
251
  `ForbiddenModuleError` naming the module and what imports it. A bare or scoped name
171
- (`'chalk'`, `'@scope/pkg'`) is a package: it is matched by the specifier that imports it, so a
172
- linked or workspace package is caught wherever it really lives, and by its installed path. A
173
- string with a slash matches a fragment of the project's own source path; a `RegExp` is tested
174
- against each module's absolute path. Nothing is left at `outFile` when the build is refused.
175
- - **`package`** packs the file as an npm archive, installs it into an empty directory, imports
176
- it by name and checks every name in `exports`. A client that still reaches for the building
177
- package's `node_modules` fails there, before it reaches a consumer; a failed proof removes the
178
- file and its hash again.
252
+ (`'chalk'`, `'@scope/pkg'`, `'node:child_process'`) is a package or a platform module: it is
253
+ matched by the specifier that imports it, so a linked or workspace package is caught wherever
254
+ it really lives and a platform module is caught although it is never bundled, and by its
255
+ installed path. A string with a slash matches a fragment of the project's own source path; a
256
+ `RegExp` is tested against each bundled module's absolute path. Nothing is left at `outFile`
257
+ when the build is refused.
179
258
  - **`runtime`** is the platform the file is built for — `node` by default, which Bun also runs,
180
259
  or `bun` or `browser`; a module the platform does not have fails the build.
181
260
 
182
- The build, the pack and the verification each run Bun as a bounded command: `timeoutMs`
183
- (default 120 s) is the deadline of each step, `signal` cancels, and `executable` names the Bun
184
- binary when it is not `bun` on `PATH`.
261
+ The build runs Bun as a bounded command: `timeoutMs` (default 120 s) is its deadline, `signal`
262
+ cancels, and `executables.bun` names the Bun binary when it is not `bun` on `PATH`.
263
+
264
+ The file is for a consumer that copies it. A client published to a registry — with types,
265
+ several entries and peers the consumer already has — is the next section.
266
+
267
+ ## A typed client as an npm package
268
+
269
+ `buildClientPackage` (`stitchkit/files/packaging`) builds a typed client into an npm archive and
270
+ returns it only after the archive was installed and used the way a consumer uses it:
271
+
272
+ ```ts
273
+ import { buildClientPackage } from 'stitchkit/files/packaging'
274
+
275
+ const client = await buildClientPackage({
276
+ name: '@acme/api-client',
277
+ version: '1.4.0',
278
+ entries: { '.': 'src/client/index.ts', './monitoring': 'src/client/monitoring.ts' },
279
+ tsconfig: 'tsconfig.json',
280
+ peerDependencies: { stitchkit: '^0.133.0', zod: '^4.6.0' },
281
+ outDir: 'dist', // dist/acme-api-client-1.4.0.tgz
282
+ })
283
+ // client.tarball, client.sha256, client.files, client.exports, client.sharedExports, client.proof
284
+ ```
285
+
286
+ Publishing the archive, and its provenance, stay with your release.
287
+
288
+ ### One module graph for every entry
289
+
290
+ All `entries` are built in one pass, so a module two of them import is emitted once, as a shared
291
+ chunk. A schema or an error class exported from `.` and from `./monitoring` is then one object:
292
+ `===` and `instanceof` hold across the entries, in Node and in Bun. Two separate builds of the
293
+ same entries give two copies, and both comparisons are false.
294
+
295
+ The proof checks it on the installed package: every name more than one subpath exports must be
296
+ the same value in all of them, and `client.sharedExports` lists the names proven. A name two
297
+ entries export as different values on purpose goes into `proof.distinctExports`; any other is
298
+ refused as `shared-export-split`, with the names in `details.names`.
299
+
300
+ ### Peers and dependencies stay outside
301
+
302
+ Each package in `peerDependencies` and `dependencies` is left out of the output and written to
303
+ the archive's `package.json` under the same key. Both must be installed where the client is
304
+ built: the proof installs them from there, and refuses with `peer-range` when an installed
305
+ version is outside the range you declared.
306
+
307
+ - An import that reaches into a peer's directory by path — a workspace neighbour imported as
308
+ `../../packages/kit/index.js` — would bundle it all the same, and is refused as
309
+ `bundled-peer`. Import the package by its name.
310
+ - `forbiddenModules` takes the rules of `buildClientArtifact` and also reads imports left
311
+ outside: `'stitchkit/server'` refuses a client that imports that subpath of a peer, while
312
+ `stitchkit/contract` stays allowed.
313
+
314
+ ### Declarations for Bundler and NodeNext
315
+
316
+ Declarations are emitted with `tsconfig`, for the entries and what they import — nothing else of
317
+ the project is typechecked or shipped. The tsconfig's directory is the root: every entry lies
318
+ under it, and `dist/` in the archive mirrors it. A `typescript` package must be installed in the
319
+ project; the build runs its compiler with the runtime that runs the build (Bun or Node), and
320
+ writes a temporary `.client-package-*.tsconfig.json` beside your tsconfig for the length of the
321
+ emit.
322
+
323
+ The compiler leaves relative specifiers in a declaration as the source wrote them, and a
324
+ consumer under `moduleResolution: NodeNext` cannot resolve an extensionless one. The build
325
+ rewrites every relative specifier to the `.js` file it stands for, whether the source wrote
326
+ `'./schema'` or `'./schema.ts'`. What a consumer could not resolve is refused:
327
+
328
+ | `reason` | The declaration names | What to do |
329
+ |---|---|---|
330
+ | `declaration-unresolved` | a relative module with no declaration in the package — a hand-written `.d.ts` beside the sources, or a `/// <reference path>` | move the types into a `.ts` module |
331
+ | `declaration-dependency` | a package that is neither a peer nor a dependency — including a tsconfig path alias such as `@/schema` | declare the package, or keep its types out of the public surface; import own modules relatively |
332
+
333
+ ### Files imported by subpath, and modules built from other contents
334
+
335
+ `exportedFiles` puts files a consumer imports by name into `exports`, beside the entries:
336
+ `'./package.json'` is the archive's own manifest — a consumer reads the client's version from it —
337
+ and any other names a path in `files`:
338
+
339
+ ```ts
340
+ files: { 'native-stream.json': 'config/native-stream.json' },
341
+ exportedFiles: ['./package.json', './native-stream.json'],
342
+ // consumer: import pkg from '@acme/api-client/package.json' with { type: 'json' }
343
+ ```
344
+
345
+ The proof resolves each by the package name to its packed file in every runtime it imports the
346
+ entries in, imports a `.json` file as JSON (`client.exports` lists its `default`), and the strict
347
+ consumer imports it with `with { type: 'json' }` under both resolutions. A file that is in `files`
348
+ but not in `exportedFiles` is packed and not importable by name.
349
+
350
+ `replaceModules` builds a module from contents you give instead of its file. The key is a path,
351
+ resolved like an entry; the contents are in that file's own format (`.json`, `.ts`, `.tsx`, `.js`,
352
+ `.jsx`), and every import that reaches the file gets them. A client that imports the project's
353
+ `package.json` for its version otherwise ships the whole manifest, `scripts` and
354
+ `devDependencies` included:
355
+
356
+ ```ts
357
+ replaceModules: { 'package.json': JSON.stringify({ version }) },
358
+ ```
359
+
360
+ A replacement no bundled module imports is refused as `replacement-unused`: it would say the
361
+ package was built from something it was not. Declarations are still emitted from the files
362
+ themselves, so a replacement keeps the shape the types describe.
363
+
364
+ ### What the proof runs
365
+
366
+ The archive is installed into an empty directory beside its peers. There the build:
367
+
368
+ 1. compares every installed file with the one it built;
369
+ 2. imports every subpath by the package name — in Node and Bun for `runtime: 'node'` (the
370
+ default), in Bun for `'bun'` and `'browser'` — and checks `proof.exports` and shared names,
371
+ and resolves every exported file;
372
+ 3. typechecks a strict consumer (`strict`, `skipLibCheck: false`) that re-exports every subpath,
373
+ under `moduleResolution: bundler` and under `NodeNext`.
374
+
375
+ ```ts
376
+ proof: {
377
+ typecheck: ['src/client/consumer-proof.ts'], // your own consumer source, both resolutions
378
+ exports: { '.': ['createApiClient'], './monitoring': ['readSessions'] },
379
+ types: ['@types/node'], // type packages the declarations need
380
+ }
381
+ ```
382
+
383
+ A `proof.typecheck` file imports the package by name and nothing relative. Give it a negative
384
+ assertion — a `// @ts-expect-error` over a value the types must reject — so a type that silently
385
+ became `any` fails the proof. The consumer typecheck loads the `ES2023` and `DOM` libraries and
386
+ only the type packages in `proof.types`, installed from the project.
387
+
388
+ Peers are installed from the project's own `node_modules`; what they depend on in turn comes
389
+ from the package manager's cache or registry.
390
+
391
+ ### Refusals
392
+
393
+ A refusal is a `ClientPackageError`: switch on `reason`, read `details`. A forbidden module is a
394
+ `ForbiddenModuleError`, as for the file. No archive is left in `outDir` after either.
395
+
396
+ | `reason` | When | `details` |
397
+ |---|---|---|
398
+ | `build` | the bundler failed | `output` |
399
+ | `replacement-unused` | a module in `replaceModules` is imported by no bundled module | `module` |
400
+ | `declarations` | the compiler reported an error in the client's graph | `output` |
401
+ | `declaration-unresolved`, `declaration-dependency` | see above | `file`, `specifier`, `package` |
402
+ | `bundled-peer` | code of a peer or dependency is in the package | `package`, `module` |
403
+ | `manifest-owned-field` | `manifest` sets a field the build writes | `field` |
404
+ | `install` | a peer is not installed for the build, or packing, installing or importing the archive failed | `package` or `output`, `runtime` |
405
+ | `peer-range` | an installed peer or dependency is outside its declared range | `package`, `range`, `installed` |
406
+ | `missing-export` | a subpath lacks a name from `proof.exports`, or an exported file does not resolve to its packed path | `subpath`, `names`, `runtime` |
407
+ | `shared-export-split` | several subpaths export one name as different values | `names`, `runtime` |
408
+ | `typecheck` | the strict consumer did not typecheck | `resolution`, `output` |
409
+
410
+ `manifest` adds descriptive `package.json` fields (`description`, `license`, `repository`, …);
411
+ `name`, `version`, `type`, `exports`, `files` and the dependency maps come from the build and are
412
+ refused there. `files` maps a path inside the package to a source file, for a README or a
413
+ licence. Each tool runs as a bounded command under `timeoutMs` (default 120 s per step) and
414
+ `signal`; `executables` names `bun`, `node` or `tsc` when the default is not the one to use.
185
415
 
186
416
  ## Qualification boundaries
187
417