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
@@ -0,0 +1,25 @@
1
+ import { type ClientBuildGraph, type ClientBuildStep } from './client-build.js';
2
+ /** Extension of a replaced module → the loader its replacement contents are read with. */
3
+ export declare const REPLACEMENT_LOADERS: Readonly<Record<string, string>>;
4
+ /** What one build of a client package needs. */
5
+ export interface ClientPackageBundleInput {
6
+ step: ClientBuildStep;
7
+ bun: string;
8
+ /** The build root: the tsconfig's directory, where the bundler runs. */
9
+ root: string;
10
+ tsconfig: string;
11
+ entries: readonly string[];
12
+ external: readonly string[];
13
+ runtime: 'node' | 'bun' | 'browser';
14
+ /** Absolute path of a replaced module → its contents. */
15
+ replacements: ReadonlyMap<string, string>;
16
+ /** The temporary directory the script, its config and the metafile go to. */
17
+ work: string;
18
+ outdir: string;
19
+ }
20
+ /**
21
+ * Build every entry in one pass, so a module two of them import is emitted
22
+ * once, and refuse a replacement that no bundled module imports.
23
+ */
24
+ export declare function bundleClientPackage(input: ClientPackageBundleInput): Promise<ClientBuildGraph>;
25
+ //# sourceMappingURL=client-package-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-package-bundle.d.ts","sourceRoot":"","sources":["../../src/files/client-package-bundle.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGrB,MAAM,gBAAgB,CAAC;AAGxB,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQhE,CAAC;AAEF,gDAAgD;AAChD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IACpC,yDAAyD;IACzD,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAmDD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA8C3B"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * What `buildClientPackage` is asked for, what it returns and how it refuses.
3
+ */
4
+ import { z } from 'zod';
5
+ import type { ForbiddenModule } from './client-build.js';
6
+ /**
7
+ * Descriptive `package.json` fields of the client package. Any other field is
8
+ * written as given, except the ones the build derives itself — see
9
+ * `CLIENT_PACKAGE_OWNED_FIELDS`.
10
+ */
11
+ export declare const ClientPackageManifestSchema: z.ZodObject<{
12
+ description: z.ZodOptional<z.ZodString>;
13
+ license: z.ZodOptional<z.ZodString>;
14
+ repository: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
15
+ type: z.ZodString;
16
+ url: z.ZodString;
17
+ directory: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>]>>;
19
+ homepage: z.ZodOptional<z.ZodString>;
20
+ keywords: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
21
+ author: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
22
+ name: z.ZodString;
23
+ email: z.ZodOptional<z.ZodString>;
24
+ url: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>]>>;
26
+ }, z.core.$loose>;
27
+ /** Descriptive `package.json` fields of the client package: description, license, repository and the like. */
28
+ export type ClientPackageManifest = z.input<typeof ClientPackageManifestSchema>;
29
+ /**
30
+ * Manifest fields the build writes from its own options and results. One of
31
+ * them in `manifest` would be a second, unproven statement of the same fact.
32
+ */
33
+ export declare const CLIENT_PACKAGE_OWNED_FIELDS: readonly string[];
34
+ /** What `buildClientPackage` builds, keeps external, refuses and proves. */
35
+ export interface ClientPackageOptions {
36
+ /** The package name, bare or scoped. */
37
+ name: string;
38
+ version: string;
39
+ /**
40
+ * Package subpath → source module (`.ts` or `.tsx`). All of them are built
41
+ * in one pass, so a module two entries import exists once in the package.
42
+ */
43
+ entries: Readonly<Record<'.' | `./${string}`, string>>;
44
+ /**
45
+ * The project tsconfig the declarations are emitted with. Its directory is
46
+ * the root every entry lies under and the place peers are resolved from.
47
+ */
48
+ tsconfig: string;
49
+ /** Packages the consumer provides: kept out of the output, written as `peerDependencies`. */
50
+ peerDependencies?: Readonly<Record<string, string>>;
51
+ /** Packages installed with the client: kept out of the output, written as `dependencies`. */
52
+ dependencies?: Readonly<Record<string, string>>;
53
+ /**
54
+ * Modules the client must not reach, bundled or external. A bare or scoped
55
+ * name or subpath (`'chalk'`, `'@scope/name'`, `'stitchkit/server'`) is
56
+ * matched by the specifier that imports it and by its installed path; a
57
+ * string with a slash that names no import is a fragment of the project's own
58
+ * source path (`'src/terminal/'`); a `RegExp` is tested against each bundled
59
+ * module's absolute path.
60
+ */
61
+ forbiddenModules?: readonly ForbiddenModule[];
62
+ /**
63
+ * The runtime the package is built for. `node` (default) is proven by
64
+ * importing it in Node and in Bun, `bun` in Bun; `browser` is built for
65
+ * browsers and imported in Bun.
66
+ */
67
+ runtime?: 'node' | 'bun' | 'browser';
68
+ /** Directory the proven `<name>-<version>.tgz` is written to. */
69
+ outDir: string;
70
+ /** Further `package.json` fields; a field the build owns is refused. */
71
+ manifest?: ClientPackageManifest;
72
+ /** Extra files of the package: path inside the package → source file. */
73
+ files?: Readonly<Record<string, string>>;
74
+ /**
75
+ * Files a consumer imports by subpath, written to `exports` beside the
76
+ * entries: `'./package.json'` is the archive's own manifest, any other names
77
+ * a path in `files` (`'./native-stream.json'` for `files['native-stream.json']`).
78
+ * The proof resolves each by the package name in every runtime, imports a
79
+ * `.json` file with `with { type: 'json' }` and typechecks that import.
80
+ */
81
+ exportedFiles?: readonly `./${string}`[];
82
+ /**
83
+ * Modules the bundle takes as other contents: source file → the contents it
84
+ * is built from instead, in that file's own format (`.json`, `.ts`, `.tsx`,
85
+ * `.js`, `.jsx`). A key is resolved like an entry and replaces every import
86
+ * that reaches that file, so `{ 'package.json': JSON.stringify({ version }) }`
87
+ * ships one field of the project manifest instead of its scripts. A
88
+ * replacement no bundled module imports is refused. Declarations are still
89
+ * emitted from the files themselves.
90
+ */
91
+ replaceModules?: Readonly<Record<string, string>>;
92
+ /** What the installed archive must additionally satisfy. */
93
+ proof?: {
94
+ /**
95
+ * Consumer source files typechecked against the installed package under
96
+ * both module resolutions. Each imports the package by name and nothing
97
+ * relative.
98
+ */
99
+ typecheck?: readonly string[];
100
+ /** Per subpath: names the installed package must export. */
101
+ exports?: Readonly<Record<string, readonly string[]>>;
102
+ /** Names that more than one subpath exports as deliberately different values. */
103
+ distinctExports?: readonly string[];
104
+ /**
105
+ * Type packages the consumer typecheck installs and loads, e.g.
106
+ * `'@types/node'` for a client whose declarations name Node types.
107
+ */
108
+ types?: readonly string[];
109
+ };
110
+ /**
111
+ * The tools the build runs. `bun` and `node` default to the ones on `PATH`,
112
+ * `tsc` to the compiler of the `typescript` package resolved from the
113
+ * tsconfig's directory, run by the runtime that runs the build.
114
+ */
115
+ executables?: {
116
+ bun?: string;
117
+ node?: string;
118
+ tsc?: string;
119
+ };
120
+ /** Deadline of each build, pack, install and proof step. Default 120 000 ms. */
121
+ timeoutMs?: number;
122
+ signal?: AbortSignal;
123
+ }
124
+ /** A proven client package: the archive, what is in it and what the proof ran. */
125
+ export interface ClientPackage {
126
+ /** Absolute path of the archive. */
127
+ tarball: string;
128
+ /** Lowercase hex SHA-256 of the archive. */
129
+ sha256: string;
130
+ bytes: number;
131
+ /** Every packed file — its path inside the package, SHA-256 and size — as installed from the archive. */
132
+ files: readonly {
133
+ path: string;
134
+ sha256: string;
135
+ bytes: number;
136
+ }[];
137
+ /** Absolute path of every source module bundled into the package. */
138
+ modules: readonly string[];
139
+ /** Per subpath: the names the installed package exports at runtime; a `.json` file exports `default`. */
140
+ exports: Readonly<Record<string, readonly string[]>>;
141
+ /** Names more than one subpath exports, each proven to be one value across them. */
142
+ sharedExports: readonly string[];
143
+ proof: {
144
+ /** The runtimes that imported every subpath of the installed package. */
145
+ runtimes: readonly ('node' | 'bun')[];
146
+ /** The module resolutions a strict consumer typechecked under. */
147
+ resolutions: readonly ('bundler' | 'NodeNext')[];
148
+ /** Version of the compiler that emitted the declarations and ran the typecheck. */
149
+ typescript: string;
150
+ /** Each peer and dependency the proof installed → its version. */
151
+ externals: Readonly<Record<string, string>>;
152
+ /** Each of `exportedFiles`, resolved by the package name to the packed file in every runtime. */
153
+ exportedFiles: readonly string[];
154
+ };
155
+ }
156
+ /** Every reason `buildClientPackage` refuses with. */
157
+ export declare const ClientPackageRefusalSchema: z.ZodEnum<{
158
+ build: "build";
159
+ "bundled-peer": "bundled-peer";
160
+ "declaration-dependency": "declaration-dependency";
161
+ "declaration-unresolved": "declaration-unresolved";
162
+ declarations: "declarations";
163
+ install: "install";
164
+ "manifest-owned-field": "manifest-owned-field";
165
+ "missing-export": "missing-export";
166
+ "peer-range": "peer-range";
167
+ "replacement-unused": "replacement-unused";
168
+ "shared-export-split": "shared-export-split";
169
+ typecheck: "typecheck";
170
+ }>;
171
+ /** The refusal of a client package; switch on `reason`, never on the message. */
172
+ export declare class ClientPackageError extends Error {
173
+ /** Why the build refused: one of the reasons in the list above. */
174
+ readonly reason: z.infer<typeof ClientPackageRefusalSchema>;
175
+ /** What the refusal is about: the file, specifier, package or names, and a tool's output. */
176
+ readonly details: Readonly<Record<string, unknown>>;
177
+ constructor(
178
+ /** Why the build refused: one of the reasons in the list above. */
179
+ reason: z.infer<typeof ClientPackageRefusalSchema>, message: string,
180
+ /** What the refusal is about: the file, specifier, package or names, and a tool's output. */
181
+ details?: Readonly<Record<string, unknown>>, options?: ErrorOptions);
182
+ }
183
+ //# sourceMappingURL=client-package-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-package-contract.d.ts","sourceRoot":"","sources":["../../src/files/client-package-contract.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,40 @@
1
+ import { type ClientBuildStep, type ClientToolCommand } from './client-build.js';
2
+ import { type ClientPackage, type ClientPackageOptions } from './client-package-contract.js';
3
+ /** Where a package the build leaves outside is installed, and which version that is. */
4
+ export interface ExternalPackage {
5
+ /** Real path of the installed package. */
6
+ directory: string;
7
+ version: string;
8
+ }
9
+ /**
10
+ * Find a package the way a module in `from` would: the nearest
11
+ * `node_modules/<name>` up the tree. The real path is returned, so a linked or
12
+ * workspace package is known by where its code actually is.
13
+ */
14
+ export declare function resolveExternalPackage(from: string, name: string): Promise<ExternalPackage>;
15
+ /** What the proof needs from the build. */
16
+ export interface ClientPackageProofInput {
17
+ options: ClientPackageOptions;
18
+ step: ClientBuildStep;
19
+ tools: {
20
+ bun: string;
21
+ node: string;
22
+ tsc: ClientToolCommand;
23
+ };
24
+ /** An empty directory the consumer is created in. */
25
+ consumer: string;
26
+ /** The staged package directory the archive was packed from. */
27
+ staged: string;
28
+ tarball: string;
29
+ /** Every peer and dependency → where the build resolved it. */
30
+ externals: ReadonlyMap<string, ExternalPackage>;
31
+ /** The project directory type packages are resolved from. */
32
+ root: string;
33
+ /** Exported file subpath → the packed file it names, `./`-relative. */
34
+ exportedFiles: ReadonlyMap<string, string>;
35
+ }
36
+ type ProvenPackage = Pick<ClientPackage, 'files' | 'exports' | 'sharedExports' | 'proof'>;
37
+ /** Prove the packed archive; every refusal is a `ClientPackageError`. */
38
+ export declare function proveClientPackage(input: ClientPackageProofInput): Promise<ProvenPackage>;
39
+ export {};
40
+ //# sourceMappingURL=client-package-proof.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-package-proof.d.ts","sourceRoot":"","sources":["../../src/files/client-package-proof.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAID;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CAkB1B;AAgFD,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,iBAAiB,CAAA;KAAE,CAAC;IAC7D,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAChD,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED,KAAK,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,eAAe,GAAG,OAAO,CAAC,CAAC;AAkQ1F,yEAAyE;AACzE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAiBxB"}
@@ -0,0 +1,17 @@
1
+ import { type ClientPackage, type ClientPackageOptions } from './client-package-contract.js';
2
+ /**
3
+ * Build a typed client as an npm package and prove the packed archive.
4
+ *
5
+ * Every entry is built in one pass over one module graph, with peers and
6
+ * dependencies left outside; declarations are emitted for that graph and
7
+ * rewritten to resolve under both Bundler and NodeNext resolution; the archive
8
+ * is then installed into an empty directory beside its peers, every subpath is
9
+ * imported in each runtime, a name several subpaths export is checked to be one
10
+ * value, and a strict consumer is typechecked under both resolutions.
11
+ *
12
+ * A refusal is a `ClientPackageError` with a `reason`, or a
13
+ * `ForbiddenModuleError`. No archive is left at the output path when the build
14
+ * or the proof refuses: one from an earlier build is removed first.
15
+ */
16
+ export declare function buildClientPackage(options: ClientPackageOptions): Promise<ClientPackage>;
17
+ //# sourceMappingURL=client-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-package.d.ts","sourceRoot":"","sources":["../../src/files/client-package.ts"],"names":[],"mappings":"AA8BA,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAwNnC;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAkGxB"}
@@ -0,0 +1,30 @@
1
+ /** One module named by a declaration file. `start`–`end` is the specifier text between its quotes. */
2
+ export interface DeclarationSpecifier {
3
+ /** How it is named: an import or export, or a `/// <reference path|types>` directive. */
4
+ kind: 'module' | 'reference-path' | 'reference-types';
5
+ text: string;
6
+ start: number;
7
+ end: number;
8
+ }
9
+ /** Every module specifier and reference directive in one declaration file, in source order. */
10
+ export declare function declarationSpecifiers(source: string): DeclarationSpecifier[];
11
+ /** Whether a specifier is relative to the file that names it. */
12
+ export declare function isRelativeSpecifier(specifier: string): boolean;
13
+ /**
14
+ * The specifier of the JavaScript file a relative declaration import stands
15
+ * for, resolved against the emitted tree `file` is part of: `./x` and `./x.ts`
16
+ * become `./x.js`, a directory becomes its `index.js`. `undefined` when the
17
+ * tree holds no declaration for it.
18
+ */
19
+ export declare function declarationOutputSpecifier(file: string, specifier: string): string | undefined;
20
+ /**
21
+ * Rewrite a declaration tree in place. `rewrite` sees every specifier of
22
+ * every declaration file and returns the text it should carry, or `undefined`
23
+ * to leave it; it refuses a specifier by throwing. Returns how many files and
24
+ * specifiers changed.
25
+ */
26
+ export declare function rewriteDeclarationTree(directory: string, rewrite: (specifier: DeclarationSpecifier, file: string) => string | undefined): {
27
+ files: number;
28
+ specifiers: number;
29
+ };
30
+ //# sourceMappingURL=declaration-specifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration-specifiers.d.ts","sourceRoot":"","sources":["../../src/files/declaration-specifiers.ts"],"names":[],"mappings":"AAqBA,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACnC,yFAAyF;IACzF,IAAI,EAAE,QAAQ,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAgID,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAa5E;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE9D;AAcD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAapB;AAYD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC7E;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAoBvC"}
@@ -10,23 +10,25 @@ import {
10
10
  parseToolCallArguments,
11
11
  toolResultFromError,
12
12
  observed
13
- } from "./index-n3bm7zqq.js";
13
+ } from "./index-6kmjcm81.js";
14
14
  import {
15
15
  toolSurfaceOutputSchema,
16
- staticInputRounds,
17
- validateMcpRoundPolicy,
18
- validateResolvedInputRounds,
19
- presentationMetadata,
20
- prepareProjectedMcpTools
21
- } from "./index-669374qc.js";
16
+ presentationMetadata
17
+ } from "./index-ma26mfnt.js";
22
18
  import {
23
19
  collectTools2,
24
20
  createToolRunner,
25
21
  formatToolError
26
- } from "./index-fgahdc7s.js";
22
+ } from "./index-5n3a8hd8.js";
27
23
  import {
28
24
  publishedToolAnnotations
29
25
  } from "./index-0x4mnwg5.js";
26
+ import {
27
+ staticInputRounds,
28
+ validateMcpRoundPolicy,
29
+ validateResolvedInputRounds,
30
+ prepareProjectedMcpTools
31
+ } from "./index-2dzc7mv9.js";
30
32
  import {
31
33
  markProtocolOutcome
32
34
  } from "./index-cfnmvcq8.js";
@@ -54,7 +56,7 @@ import {
54
56
  } from "./index-tazm4dxf.js";
55
57
  import {
56
58
  collectToolSurface
57
- } from "./index-x2fb37t0.js";
59
+ } from "./index-q427q23r.js";
58
60
  import {
59
61
  runWithRequestContext2,
60
62
  getRequestContext2
@@ -64,7 +66,7 @@ import {
64
66
  } from "./index-7csn6pva.js";
65
67
  import {
66
68
  AppError2
67
- } from "./index-9pv126eh.js";
69
+ } from "./index-7fjbdga8.js";
68
70
  import {
69
71
  compareCodeUnits,
70
72
  serializeCanonicalJson
@@ -201,6 +203,9 @@ function prepareMcpTools(tools, config = {}) {
201
203
  ...mountable.method.inputRecursionDepth !== undefined && {
202
204
  inputRecursionDepth: mountable.method.inputRecursionDepth
203
205
  },
206
+ ...mountable.method.inputNestingDepth !== undefined && {
207
+ inputNestingDepth: mountable.method.inputNestingDepth
208
+ },
204
209
  ...outputSchema !== undefined && { outputSchema },
205
210
  shouldExtend: mountable.shouldExtend,
206
211
  ...mountable.method.mcp !== undefined && { mcp: mountable.method.mcp }
@@ -225,7 +230,8 @@ function prepareMcpServerSurface(surface, config = {}) {
225
230
  transport: "MCP",
226
231
  extend: config.extend,
227
232
  flattenUnionInput: config.flattenUnionInput,
228
- inputRecursionDepth: config.inputRecursionDepth
233
+ inputRecursionDepth: config.inputRecursionDepth,
234
+ inputNestingDepth: config.inputNestingDepth
229
235
  })) {
230
236
  if (entry.kind === "contract") {
231
237
  contractMountables.push(entry.mountable);
@@ -238,6 +244,7 @@ function prepareMcpServerSurface(surface, config = {}) {
238
244
  const runtimeDescriptors = prepareMcpTools(runtimeMountables, {
239
245
  flattenUnionInput: config.flattenUnionInput,
240
246
  inputRecursionDepth: config.inputRecursionDepth,
247
+ inputNestingDepth: config.inputNestingDepth,
241
248
  schemaValidation: config.schemaValidation,
242
249
  logger: config.logger,
243
250
  multiRound: config.multiRound
@@ -787,21 +794,21 @@ function applyMcpLazyDiscovery(input) {
787
794
  annotations: { readOnlyHint: true, idempotentHint: true },
788
795
  handler: ({ input: args }) => {
789
796
  const cap = Math.min(args.limit ?? discovery.maxResults, discovery.maxResults);
790
- const ranked = rankToolsByQuery(args.query, hiddenTools).slice(0, cap);
797
+ const toEnable = rankToolsByQuery(args.query, hiddenTools.filter((entry) => !entry.registered.enabled)).slice(0, cap);
798
+ const alreadyEnabled = rankToolsByQuery(args.query, hiddenTools.filter((entry) => entry.registered.enabled)).slice(0, cap);
791
799
  const enabledTools = [];
792
800
  const matches = [];
793
- for (const entry of ranked) {
794
- const newlyEnabled = !entry.registered.enabled;
795
- if (newlyEnabled) {
796
- entry.registered.enabled = true;
797
- enabledTools.push(entry.name);
798
- }
801
+ for (const entry of toEnable) {
802
+ entry.registered.enabled = true;
803
+ enabledTools.push(entry.name);
804
+ matches.push({ name: entry.name, description: entry.description, newlyEnabled: true });
805
+ }
806
+ for (const entry of alreadyEnabled)
799
807
  matches.push({
800
808
  name: entry.name,
801
809
  description: entry.description,
802
- newlyEnabled
810
+ newlyEnabled: false
803
811
  });
804
- }
805
812
  if (enabledTools.length > 0) {
806
813
  server.sendToolListChanged();
807
814
  }
@@ -832,6 +839,7 @@ function validateMcpSchemas2(config) {
832
839
  extend: config.extend,
833
840
  flattenUnionInput: config.flattenUnionInput,
834
841
  inputRecursionDepth: config.inputRecursionDepth,
842
+ inputNestingDepth: config.inputNestingDepth,
835
843
  schemaValidation: config,
836
844
  logger: config.logger
837
845
  });
@@ -842,6 +850,7 @@ function mountMcp2(mcpServer, services, config) {
842
850
  extend: config.extend,
843
851
  flattenUnionInput: config.flattenUnionInput,
844
852
  inputRecursionDepth: config.inputRecursionDepth,
853
+ inputNestingDepth: config.inputNestingDepth,
845
854
  schemaValidation: config.schemaValidation,
846
855
  logger: config.logger
847
856
  });
@@ -853,6 +862,7 @@ function mountMcp2(mcpServer, services, config) {
853
862
  function mountPreparedMcp(mcpServer, prepared, config) {
854
863
  const lifecycle = resolveToolAccess("mountPreparedMcp", config);
855
864
  const validatedDiscovery = config.discovery !== undefined ? validateMcpLazyDiscovery(config.discovery, prepared.map((descriptor) => descriptor.mountable.name), config.reservedToolNames) : undefined;
865
+ const catalog = validatedDiscovery === undefined ? config.catalog : undefined;
856
866
  const runTool = createToolRunner({
857
867
  source: "mcp",
858
868
  toolSurface: true,
@@ -873,7 +883,7 @@ function mountPreparedMcp(mcpServer, prepared, config) {
873
883
  }, descriptor, {
874
884
  runTool,
875
885
  formatResult: (result, mode, toolName) => formatMcpResult(result, mode, toolName, config.errorHint),
876
- catalog: config.catalog,
886
+ catalog,
877
887
  multiRoundRuntime: config.multiRoundRuntime,
878
888
  hooks: config.hooks,
879
889
  lifecycle,
@@ -889,7 +899,7 @@ function mountPreparedMcp(mcpServer, prepared, config) {
889
899
  lifecycle,
890
900
  hooks: config.hooks,
891
901
  context: config.context,
892
- catalog: config.catalog,
902
+ catalog,
893
903
  coerceJsonArgs: config.coerceJsonArgs,
894
904
  errorHint: config.errorHint,
895
905
  onOutputStrip: config.onOutputStrip
@@ -920,6 +930,7 @@ function buildMcpServer2(config, auth) {
920
930
  extend: config.extend,
921
931
  flattenUnionInput: config.flattenUnionInput,
922
932
  inputRecursionDepth: config.inputRecursionDepth,
933
+ inputNestingDepth: config.inputNestingDepth,
923
934
  schemaValidation: config.schemaValidation,
924
935
  logger: config.logger,
925
936
  multiRound: {
@@ -963,7 +974,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
963
974
  const server = new McpServer(config.serverInfo, serverOptions);
964
975
  const context = config.context?.(auth);
965
976
  const catalog = mcpCatalogStamp(prepared);
966
- if (!config.rawTools)
977
+ if (!config.rawTools && config.discovery === undefined)
967
978
  servedCatalogs.set(server, catalog);
968
979
  mountPreparedMcp(server, prepared.contractTools, {
969
980
  catalog,
@@ -976,6 +987,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
976
987
  coerceJsonArgs: config.coerceJsonArgs,
977
988
  flattenUnionInput: config.flattenUnionInput,
978
989
  inputRecursionDepth: config.inputRecursionDepth,
990
+ inputNestingDepth: config.inputNestingDepth,
979
991
  errorHint: config.errorHint,
980
992
  onOutputStrip: config.onOutputStrip,
981
993
  discovery: config.discovery,
@@ -1043,6 +1055,7 @@ function prepareStaticSurface(config) {
1043
1055
  extend: config.extend,
1044
1056
  flattenUnionInput: config.flattenUnionInput,
1045
1057
  inputRecursionDepth: config.inputRecursionDepth,
1058
+ inputNestingDepth: config.inputNestingDepth,
1046
1059
  schemaValidation: config.schemaValidation,
1047
1060
  multiRound: {
1048
1061
  stateConfigured: config.multiRound !== undefined,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-1eeqpadm.js";
8
8
  import {
9
9
  AppError2
10
- } from "./index-9pv126eh.js";
10
+ } from "./index-7fjbdga8.js";
11
11
 
12
12
  // src/realtime/rejected-frame.ts
13
13
  var REALTIME_REJECTION_KEY2 = "@stitchkit/realtime-rejected";
@@ -7,11 +7,11 @@ import {
7
7
  toolResultFromError,
8
8
  toolCauseFromResult,
9
9
  isToolExecutionControlError2
10
- } from "./index-n3bm7zqq.js";
10
+ } from "./index-6kmjcm81.js";
11
11
  import {
12
12
  createToolRunner,
13
13
  formatToolError
14
- } from "./index-fgahdc7s.js";
14
+ } from "./index-5n3a8hd8.js";
15
15
  import {
16
16
  resolveRuntimeToolCall
17
17
  } from "./index-eh71zr32.js";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./index-1psbyyhj.js";
21
21
  import {
22
22
  collectToolSurface
23
- } from "./index-x2fb37t0.js";
23
+ } from "./index-q427q23r.js";
24
24
  import {
25
25
  agentPresenterOf
26
26
  } from "./index-7csn6pva.js";
@@ -53,7 +53,8 @@ function mountAgent2(services, config) {
53
53
  transport: "AGENT",
54
54
  extend: config.extend,
55
55
  flattenUnionInput: config.flattenUnionInput,
56
- inputRecursionDepth: config.inputRecursionDepth
56
+ inputRecursionDepth: config.inputRecursionDepth,
57
+ inputNestingDepth: config.inputNestingDepth
57
58
  })) {
58
59
  const { mountable } = entry;
59
60
  const inputSchema = jsonSchema(mountable.presentationSchema, {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  resolveToolAccess,
3
3
  toolErrorFromResult
4
- } from "./index-n3bm7zqq.js";
4
+ } from "./index-6kmjcm81.js";
5
5
  import {
6
6
  assertUniqueToolName
7
- } from "./index-669374qc.js";
7
+ } from "./index-ma26mfnt.js";
8
8
  import {
9
9
  collectTools2,
10
10
  createToolRunner
11
- } from "./index-fgahdc7s.js";
11
+ } from "./index-5n3a8hd8.js";
12
12
  import {
13
13
  AppError2
14
- } from "./index-9pv126eh.js";
14
+ } from "./index-7fjbdga8.js";
15
15
  import {
16
16
  isRecord
17
17
  } from "./index-ps3djm8d.js";
@@ -25,7 +25,8 @@ function createToolInvoker2(services, config) {
25
25
  for (const tool of collectTools2(service, config.transport, {
26
26
  extend: config.extend,
27
27
  flattenUnionInput: config.flattenUnionInput,
28
- inputRecursionDepth: config.inputRecursionDepth
28
+ inputRecursionDepth: config.inputRecursionDepth,
29
+ inputNestingDepth: config.inputNestingDepth
29
30
  })) {
30
31
  assertUniqueToolName(tool.name, tools.has(tool.name), "in-process tool name");
31
32
  tools.set(tool.name, tool);
@@ -1,9 +1,10 @@
1
1
  import {
2
- contractMethodFields
3
- } from "./index-jb4m241t.js";
2
+ contractMethodFields,
3
+ withDeclaredRefusals
4
+ } from "./index-6918kxbf.js";
4
5
  import {
5
6
  AppError2
6
- } from "./index-9pv126eh.js";
7
+ } from "./index-7fjbdga8.js";
7
8
  import {
8
9
  typedEntries,
9
10
  callRuntimeHandler
@@ -96,12 +97,12 @@ function bindContract(contract, handlers, options) {
96
97
  methods[String(key)] = {
97
98
  ...contractMethodFields(contract, String(key), endpoint),
98
99
  multipartReceivers: streamingHandler?.receivers,
99
- handler: streamingHandler ? (ctx) => streamingHandler.execute(ctx, ctx.files ?? {}) : (ctx) => {
100
+ handler: withDeclaredRefusals(endpoint, `${contract.meta.prefix}.${String(key)}`, streamingHandler ? (ctx) => streamingHandler.execute(ctx, ctx.files ?? {}) : (ctx) => {
100
101
  if (!regularHandler) {
101
102
  throw new Error(`[stitchkit] implement: missing handler for "${contract.meta.prefix}.${String(key)}"`);
102
103
  }
103
104
  return callRuntimeHandler(regularHandler, ctx);
104
- }
105
+ })
105
106
  };
106
107
  }
107
108
  return {