stitchkit 0.127.0 → 0.129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/CHANGELOG.md +194 -6
  2. package/dist/agent-executor/acp/v1-connect.d.ts +9 -1
  3. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  4. package/dist/agent-executor/acp/v1-driver.d.ts +8 -2
  5. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  6. package/dist/agent-executor/acp/v1-map.d.ts.map +1 -1
  7. package/dist/agent-executor/acp/v1-session.d.ts +8 -0
  8. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  9. package/dist/agent-executor/claude/cli-driver.d.ts +4 -0
  10. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  11. package/dist/agent-executor/claude/protocol.d.ts +20 -2
  12. package/dist/agent-executor/claude/protocol.d.ts.map +1 -1
  13. package/dist/agent-executor/claude/session.d.ts +2 -1
  14. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  15. package/dist/agent-executor/claude/transcript.d.ts +9 -6
  16. package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
  17. package/dist/agent-executor/claude-sdk/controls.d.ts +19 -0
  18. package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -0
  19. package/dist/agent-executor/claude-sdk/driver.d.ts +118 -4
  20. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  21. package/dist/agent-executor/claude-sdk/query-loop.d.ts +46 -0
  22. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -0
  23. package/dist/agent-executor/claude-sdk/query-options.d.ts +27 -0
  24. package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -0
  25. package/dist/agent-executor/claude-sdk/session.d.ts +6 -5
  26. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  27. package/dist/agent-executor/codex/classify.d.ts.map +1 -1
  28. package/dist/agent-executor/codex/connect.d.ts +45 -0
  29. package/dist/agent-executor/codex/connect.d.ts.map +1 -0
  30. package/dist/agent-executor/codex/driver.d.ts +55 -10
  31. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  32. package/dist/agent-executor/codex/limits.d.ts +11 -2
  33. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  34. package/dist/agent-executor/codex/protocol.d.ts +75 -6
  35. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  36. package/dist/agent-executor/codex/session-controls.d.ts +155 -0
  37. package/dist/agent-executor/codex/session-controls.d.ts.map +1 -0
  38. package/dist/agent-executor/codex/session.d.ts +28 -30
  39. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  40. package/dist/agent-executor/codex/unix-socket-target.d.ts +26 -0
  41. package/dist/agent-executor/codex/unix-socket-target.d.ts.map +1 -0
  42. package/dist/agent-executor/codex/unix-socket.d.ts +26 -0
  43. package/dist/agent-executor/codex/unix-socket.d.ts.map +1 -0
  44. package/dist/agent-executor/codex/ws-frame.d.ts +15 -0
  45. package/dist/agent-executor/codex/ws-frame.d.ts.map +1 -0
  46. package/dist/agent-executor/contract.d.ts +2 -0
  47. package/dist/agent-executor/contract.d.ts.map +1 -1
  48. package/dist/agent-executor/engine-process.d.ts +9 -0
  49. package/dist/agent-executor/engine-process.d.ts.map +1 -1
  50. package/dist/agent-executor/hello.d.ts +8 -0
  51. package/dist/agent-executor/hello.d.ts.map +1 -1
  52. package/dist/agent-executor/image-input.d.ts +71 -0
  53. package/dist/agent-executor/image-input.d.ts.map +1 -0
  54. package/dist/agent-executor/session-primitives.d.ts +0 -3
  55. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  56. package/dist/agent-runtime/agent-tool.d.ts +21 -7
  57. package/dist/agent-runtime/agent-tool.d.ts.map +1 -1
  58. package/dist/agent-runtime/branch-contract.d.ts +1 -0
  59. package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
  60. package/dist/agent-runtime/branch-identities.d.ts +5 -2
  61. package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
  62. package/dist/agent-runtime/branch-messages.d.ts +9 -9
  63. package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
  64. package/dist/agent-runtime/branch-observations.d.ts +49 -36
  65. package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
  66. package/dist/agent-runtime/branch-provider.d.ts +14 -8
  67. package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
  68. package/dist/agent-runtime/branch-source.d.ts +13 -1
  69. package/dist/agent-runtime/branch-source.d.ts.map +1 -1
  70. package/dist/agent-runtime/child-tools.d.ts +64 -0
  71. package/dist/agent-runtime/child-tools.d.ts.map +1 -1
  72. package/dist/agent-runtime/event-search-tools.d.ts +82 -5
  73. package/dist/agent-runtime/event-search-tools.d.ts.map +1 -1
  74. package/dist/agent-runtime/invocation-attempt.d.ts +1 -1
  75. package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -1
  76. package/dist/agent-runtime/invocation-payload.d.ts +12 -0
  77. package/dist/agent-runtime/invocation-payload.d.ts.map +1 -1
  78. package/dist/agent-runtime/invocation-read.d.ts +6 -3
  79. package/dist/agent-runtime/invocation-read.d.ts.map +1 -1
  80. package/dist/agent-runtime/invocation-schema.d.ts +50 -8
  81. package/dist/agent-runtime/invocation-schema.d.ts.map +1 -1
  82. package/dist/agent-runtime/invocations.d.ts +20 -9
  83. package/dist/agent-runtime/invocations.d.ts.map +1 -1
  84. package/dist/agent-runtime/postgres.d.ts.map +1 -1
  85. package/dist/agent-runtime/schedule-tools.d.ts +30 -0
  86. package/dist/agent-runtime/schedule-tools.d.ts.map +1 -1
  87. package/dist/agent-runtime/schemas-invocation-payload.d.ts +48 -0
  88. package/dist/agent-runtime/schemas-invocation-payload.d.ts.map +1 -0
  89. package/dist/agent-runtime/sql-events.d.ts.map +1 -1
  90. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  91. package/dist/agent-runtime/sql-session.d.ts +11 -0
  92. package/dist/agent-runtime/sql-session.d.ts.map +1 -1
  93. package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -1
  94. package/dist/agent-runtime/state-tools.d.ts +55 -0
  95. package/dist/agent-runtime/state-tools.d.ts.map +1 -1
  96. package/dist/agent-runtime/store-branch.d.ts.map +1 -1
  97. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  98. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  99. package/dist/agent-runtime/store-create.d.ts.map +1 -1
  100. package/dist/agent-runtime/store-driver-contract.d.ts +12 -0
  101. package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
  102. package/dist/agent-runtime/store-memory-events.d.ts.map +1 -1
  103. package/dist/agent-runtime/store.d.ts +7 -0
  104. package/dist/agent-runtime/store.d.ts.map +1 -1
  105. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  106. package/dist/declaration/declaration.d.ts +6 -3
  107. package/dist/declaration/declaration.d.ts.map +1 -1
  108. package/dist/entrypoints/agent-executor/acp.d.ts +1 -1
  109. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
  110. package/dist/entrypoints/agent-executor/acp.js +28 -17
  111. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +1 -1
  112. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
  113. package/dist/entrypoints/agent-executor/claude-sdk.js +543 -96
  114. package/dist/entrypoints/agent-executor/claude.js +40 -21
  115. package/dist/entrypoints/agent-executor/codex.d.ts +4 -0
  116. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  117. package/dist/entrypoints/agent-executor/codex.js +1530 -207
  118. package/dist/entrypoints/agent-executor.js +7 -7
  119. package/dist/entrypoints/agent-runtime/browser.js +1 -1
  120. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  121. package/dist/entrypoints/agent-runtime/harness.js +10 -11
  122. package/dist/entrypoints/agent-runtime/openrouter.js +4 -4
  123. package/dist/entrypoints/agent-runtime/postgres.js +12 -7
  124. package/dist/entrypoints/agent-runtime/realtime.js +4 -4
  125. package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
  126. package/dist/entrypoints/agent-runtime/sqlite/bun.js +7 -7
  127. package/dist/entrypoints/agent-runtime/sqlite/node.js +7 -7
  128. package/dist/entrypoints/agent-runtime/testing.js +9 -9
  129. package/dist/entrypoints/agent-runtime.d.ts +9 -7
  130. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  131. package/dist/entrypoints/agent-runtime.js +254 -207
  132. package/dist/entrypoints/application/diagnostic-journal.js +4 -4
  133. package/dist/entrypoints/application/directory-inbox.js +8 -8
  134. package/dist/entrypoints/application/opentelemetry.js +2 -2
  135. package/dist/entrypoints/application.js +2 -2
  136. package/dist/entrypoints/cli/publish.js +8 -8
  137. package/dist/entrypoints/cli.js +12 -11
  138. package/dist/entrypoints/contract.js +2 -2
  139. package/dist/entrypoints/declaration.js +0 -1
  140. package/dist/entrypoints/files/packaging.js +2 -2
  141. package/dist/entrypoints/files.js +42 -19
  142. package/dist/entrypoints/handler.js +4 -4
  143. package/dist/entrypoints/http.js +5 -5
  144. package/dist/entrypoints/index.js +7 -7
  145. package/dist/entrypoints/node.js +7 -7
  146. package/dist/entrypoints/observability.js +4 -4
  147. package/dist/entrypoints/primitives.js +2 -2
  148. package/dist/entrypoints/process.js +6 -6
  149. package/dist/entrypoints/react.js +1 -1
  150. package/dist/entrypoints/remote.js +2 -2
  151. package/dist/entrypoints/server.js +10 -10
  152. package/dist/entrypoints/service-host/macos.js +6 -6
  153. package/dist/entrypoints/service-host.d.ts +4 -1
  154. package/dist/entrypoints/service-host.d.ts.map +1 -1
  155. package/dist/entrypoints/service-host.js +835 -224
  156. package/dist/entrypoints/spend.js +1 -1
  157. package/dist/entrypoints/sync/postgres.js +1 -1
  158. package/dist/entrypoints/sync.js +2 -2
  159. package/dist/entrypoints/telegram.js +5 -5
  160. package/dist/entrypoints/testing.js +5 -5
  161. package/dist/entrypoints/tools/agent.js +5 -4
  162. package/dist/entrypoints/tools/connections.js +2 -2
  163. package/dist/entrypoints/tools/invoker.js +4 -3
  164. package/dist/entrypoints/tools/mcp.js +5 -4
  165. package/dist/entrypoints/tools/toolkit.js +8 -7
  166. package/dist/entrypoints/tools.d.ts +1 -1
  167. package/dist/entrypoints/tools.d.ts.map +1 -1
  168. package/dist/entrypoints/tools.js +15 -13
  169. package/dist/entrypoints/tracking/contract.js +1 -1
  170. package/dist/entrypoints/xlsx.js +1 -1
  171. package/dist/files/directory-appearance.d.ts +20 -9
  172. package/dist/files/directory-appearance.d.ts.map +1 -1
  173. package/dist/files/polled-json.d.ts.map +1 -1
  174. package/dist/files/regular-file.d.ts +15 -5
  175. package/dist/files/regular-file.d.ts.map +1 -1
  176. package/dist/{index-prf6ayhf.js → index-13wmzpa6.js} +1 -1
  177. package/dist/{index-qnzhmk2s.js → index-17qgm6xe.js} +91 -48
  178. package/dist/{index-wv8dqy7q.js → index-205456mf.js} +1 -1
  179. package/dist/{index-3gwp8ez6.js → index-21cfxc4z.js} +13 -18
  180. package/dist/{index-xtkw9866.js → index-2c5w2d1d.js} +1 -1
  181. package/dist/{index-g1q7fwn9.js → index-2nwvn7m2.js} +1 -1
  182. package/dist/{index-d4svrknj.js → index-39c2hj6h.js} +2 -2
  183. package/dist/{index-sfzfd2m2.js → index-39rmc00v.js} +1 -1
  184. package/dist/{index-ky3ardqn.js → index-3fym4j8n.js} +1 -1
  185. package/dist/{index-d96c1n1q.js → index-5tdc0q43.js} +20 -19
  186. package/dist/{index-3ypvpkwr.js → index-669374qc.js} +1 -1
  187. package/dist/{index-x90w78yz.js → index-673drwkn.js} +23 -8
  188. package/dist/{index-83n766x4.js → index-7jqn3b3g.js} +16 -10
  189. package/dist/{index-5jyjb4s0.js → index-80acsm27.js} +1 -1
  190. package/dist/{index-xmr47znh.js → index-827bgv33.js} +1 -1
  191. package/dist/{index-xypxnzhp.js → index-93n6jwy0.js} +4 -4
  192. package/dist/{index-wbnpa8z6.js → index-9kpxz49v.js} +5 -5
  193. package/dist/{index-fcw255hd.js → index-9sfhje6y.js} +3 -3
  194. package/dist/{index-bh4pmtr9.js → index-afb6z77w.js} +3 -1
  195. package/dist/{index-9y0afd5f.js → index-apf5g7y9.js} +1 -1
  196. package/dist/{index-4qvyhn23.js → index-bjmj2q1z.js} +1 -1
  197. package/dist/{index-bbzvrq66.js → index-dcsxj68j.js} +457 -204
  198. package/dist/{index-j516jaaz.js → index-dnzxxf8a.js} +49 -2
  199. package/dist/{index-kmbpej2y.js → index-emgrmavr.js} +102 -61
  200. package/dist/index-fgahdc7s.js +100 -0
  201. package/dist/{index-kzavdze2.js → index-gr0kxymw.js} +5 -1
  202. package/dist/{index-e06z0tkb.js → index-gya4hwh3.js} +2 -2
  203. package/dist/{index-3djgv3ch.js → index-hab790s6.js} +26 -11
  204. package/dist/{index-j13gzgdv.js → index-j0ef04jw.js} +9 -5
  205. package/dist/{index-rhb33thr.js → index-jcge9tx3.js} +1 -1
  206. package/dist/{index-dvd1qdwa.js → index-ke02kxsr.js} +3 -3
  207. package/dist/{index-3agqmmrg.js → index-mkfhpk11.js} +7 -9
  208. package/dist/{index-a725ayvz.js → index-mttkdm5a.js} +1 -1
  209. package/dist/{index-9wh98cpa.js → index-n3bm7zqq.js} +131 -91
  210. package/dist/{index-7xp05h20.js → index-p06z7g7w.js} +7 -7
  211. package/dist/{index-kt6dh1n6.js → index-p16q492v.js} +1 -1
  212. package/dist/{index-5zwac8ft.js → index-pp97q86a.js} +3 -3
  213. package/dist/{index-39n02e0q.js → index-psye60qn.js} +1 -1
  214. package/dist/{index-5ptwb6ka.js → index-pzhqydxb.js} +1 -1
  215. package/dist/{index-7kfcb576.js → index-qa2jjb65.js} +1 -1
  216. package/dist/{index-0djnptn8.js → index-qhjmmsm2.js} +10 -3
  217. package/dist/{index-7grgs8cx.js → index-qpzyahe3.js} +2 -2
  218. package/dist/{index-8xr2eq99.js → index-r97ppg0g.js} +4 -4
  219. package/dist/{index-bmaz3jzy.js → index-rjs94dny.js} +1 -1
  220. package/dist/{index-p1m9djt6.js → index-rxh3qy4x.js} +33 -6
  221. package/dist/{index-en8e5zsj.js → index-ryxb427v.js} +1 -1
  222. package/dist/{index-nbv44x0x.js → index-s2e3h616.js} +137 -36
  223. package/dist/{index-dwa6pskj.js → index-sd4e5x5j.js} +86 -47
  224. package/dist/{index-g56ht6qf.js → index-t3qcac2a.js} +1 -1
  225. package/dist/index-vgzhw2zk.js +304 -0
  226. package/dist/{index-jrka9029.js → index-vmbxj75t.js} +2 -2
  227. package/dist/{index-caywx1c0.js → index-wv2amqm4.js} +109 -12
  228. package/dist/{index-5e0zsbf7.js → index-x2fb37t0.js} +2 -2
  229. package/dist/{index-z4k0hqp9.js → index-y71zn1gw.js} +137 -27
  230. package/dist/{index-wavv538x.js → index-ybdq8kk2.js} +3 -3
  231. package/dist/{index-4gk6k3zc.js → index-ycr4pk0z.js} +1 -1
  232. package/dist/{index-0tyt97nk.js → index-yrr3n391.js} +1 -1
  233. package/dist/{index-v37b2cd6.js → index-z20pdxeb.js} +2 -2
  234. package/dist/{index-0hdm5sx6.js → index-z9d74jmb.js} +8 -4
  235. package/dist/{index-4s2w4g37.js → index-zhshhxew.js} +80 -2
  236. package/dist/{index-3b31z0pc.js → index-znd1b57f.js} +12 -6
  237. package/dist/internal/bounded-file-confirm.d.ts +32 -0
  238. package/dist/internal/bounded-file-confirm.d.ts.map +1 -0
  239. package/dist/internal/bounded-file-read.d.ts +10 -7
  240. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  241. package/dist/internal/file-observation.d.ts +5 -1
  242. package/dist/internal/file-observation.d.ts.map +1 -1
  243. package/dist/internal/positive-integer.d.ts +2 -0
  244. package/dist/internal/positive-integer.d.ts.map +1 -1
  245. package/dist/internal/process-instance.d.ts +8 -0
  246. package/dist/internal/process-instance.d.ts.map +1 -1
  247. package/dist/internal/unix-socket.d.ts +10 -1
  248. package/dist/internal/unix-socket.d.ts.map +1 -1
  249. package/dist/server/unix-client.d.ts +7 -0
  250. package/dist/server/unix-client.d.ts.map +1 -1
  251. package/dist/service-host/systemd-inspect.d.ts +3 -1
  252. package/dist/service-host/systemd-inspect.d.ts.map +1 -1
  253. package/dist/service-host/systemd-render-shared.d.ts +64 -0
  254. package/dist/service-host/systemd-render-shared.d.ts.map +1 -0
  255. package/dist/service-host/systemd-render.d.ts +31 -26
  256. package/dist/service-host/systemd-render.d.ts.map +1 -1
  257. package/dist/service-host/systemd-timer-render.d.ts +31 -0
  258. package/dist/service-host/systemd-timer-render.d.ts.map +1 -0
  259. package/dist/service-host/systemd-timer-rollback.d.ts +26 -0
  260. package/dist/service-host/systemd-timer-rollback.d.ts.map +1 -0
  261. package/dist/service-host/systemd-timer.d.ts +82 -0
  262. package/dist/service-host/systemd-timer.d.ts.map +1 -0
  263. package/dist/service-host/systemd-unit-ops.d.ts +26 -0
  264. package/dist/service-host/systemd-unit-ops.d.ts.map +1 -0
  265. package/dist/service-host/systemd.d.ts +1 -1
  266. package/dist/service-host/systemd.d.ts.map +1 -1
  267. package/dist/tools/access.d.ts +30 -1
  268. package/dist/tools/access.d.ts.map +1 -1
  269. package/dist/tools/agent.d.ts +2 -2
  270. package/dist/tools/agent.d.ts.map +1 -1
  271. package/dist/tools/cli/args-scan.d.ts +5 -0
  272. package/dist/tools/cli/args-scan.d.ts.map +1 -1
  273. package/dist/tools/cli/args.d.ts +11 -5
  274. package/dist/tools/cli/args.d.ts.map +1 -1
  275. package/dist/tools/cli/invoke.d.ts +2 -1
  276. package/dist/tools/cli/invoke.d.ts.map +1 -1
  277. package/dist/tools/cli/notices.d.ts.map +1 -1
  278. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  279. package/dist/tools/cli/session.d.ts.map +1 -1
  280. package/dist/tools/execute.d.ts.map +1 -1
  281. package/dist/tools/invoker.d.ts +2 -1
  282. package/dist/tools/invoker.d.ts.map +1 -1
  283. package/dist/tools/list-names.d.ts +2 -3
  284. package/dist/tools/list-names.d.ts.map +1 -1
  285. package/dist/tools/manifest.d.ts +2 -3
  286. package/dist/tools/manifest.d.ts.map +1 -1
  287. package/dist/tools/mcp/mount.d.ts +5 -5
  288. package/dist/tools/mcp/mount.d.ts.map +1 -1
  289. package/dist/tools/mcp/register.d.ts +2 -1
  290. package/dist/tools/mcp/register.d.ts.map +1 -1
  291. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  292. package/llms/agent-executor-acp.txt +10 -6
  293. package/llms/agent-executor-claude-sdk.txt +13 -10
  294. package/llms/agent-executor-claude.txt +2 -2
  295. package/llms/agent-executor-codex.txt +9 -3
  296. package/llms/agent-executor.txt +2 -2
  297. package/llms/agent-runtime.4.txt +21 -9
  298. package/llms/cli.3.txt +4 -4
  299. package/llms/cli.txt +1 -0
  300. package/llms/declaration.txt +2 -2
  301. package/llms/files.txt +1 -1
  302. package/llms/node.txt +2 -2
  303. package/llms/server.5.txt +2 -2
  304. package/llms/service-host.txt +5 -5
  305. package/llms/stitchkit.txt +81 -77
  306. package/llms/tools.3.txt +3 -2
  307. package/llms/upgrading-0.128.0-0.129.0.txt +175 -0
  308. package/llms/upgrading.txt +1 -0
  309. package/llms-full.txt +323 -127
  310. package/llms.txt +15 -14
  311. package/package.json +1 -1
  312. package/dist/index-ajmtxsky.js +0 -193
  313. package/dist/index-ax3wns1a.js +0 -93
@@ -6,19 +6,15 @@ import {
6
6
  localVerdict
7
7
  } from "./index-dsa676h8.js";
8
8
  import {
9
- objectShapeKeys,
10
- rebuildObject,
11
- mergeSchemas
9
+ objectShapeKeys
12
10
  } from "./index-360j58vb.js";
13
11
  import {
14
12
  coerceJsonArgs2
15
13
  } from "./index-j903yhp4.js";
16
14
  import {
17
15
  applyToolViewDefaults,
18
- projectToolView,
19
- assertToolExtensionCompatible,
20
- projectToolSurface
21
- } from "./index-3ypvpkwr.js";
16
+ projectToolView
17
+ } from "./index-669374qc.js";
22
18
  import {
23
19
  runWithRequestContext2,
24
20
  getRequestContext2
@@ -42,6 +38,130 @@ import {
42
38
  isRecord
43
39
  } from "./index-ps3djm8d.js";
44
40
 
41
+ // src/tools/access.ts
42
+ var TOOL_OPEN_REASONS = ["public", "local-operator", "remote"];
43
+ var TOOL_OPEN_REASON_SET = new Set(TOOL_OPEN_REASONS);
44
+ var inspectOnlyLifecycles = new WeakMap;
45
+ function accessRequiredMessage(entryName) {
46
+ return `${entryName}: access is required — pass { gate } with the auth hook, { open }, or { inspect: true }`;
47
+ }
48
+ function legacyLifecycleMessage(entryName) {
49
+ return `${entryName}: access is required — pass { gate } with the auth hook, { open }, or { inspect: true } ("lifecycle" was replaced by "access")`;
50
+ }
51
+ function inspectForbiddenError(entryName) {
52
+ return new AppError2("FORBIDDEN", {
53
+ message: `${entryName}: mounted with access: { inspect: true } (read-only surface inspection); tool execution is forbidden`,
54
+ status: 403
55
+ });
56
+ }
57
+ function isInspectOnlyLifecycle(lifecycle) {
58
+ return lifecycle !== undefined && inspectOnlyLifecycles.has(lifecycle);
59
+ }
60
+ function inspectOnlyError(lifecycle) {
61
+ if (lifecycle === undefined)
62
+ return;
63
+ const entryName = inspectOnlyLifecycles.get(lifecycle);
64
+ return entryName !== undefined ? inspectForbiddenError(entryName) : undefined;
65
+ }
66
+ function isBeforeHandleHook(value) {
67
+ return typeof value === "function";
68
+ }
69
+ function isAfterHandleHook(value) {
70
+ return typeof value === "function";
71
+ }
72
+ function isToolOpenReason(value) {
73
+ return typeof value === "string" && TOOL_OPEN_REASON_SET.has(value);
74
+ }
75
+ function resolveToolAccess(entryName, config) {
76
+ if (!isRecord(config)) {
77
+ throw new TypeError(accessRequiredMessage(entryName));
78
+ }
79
+ if (Object.hasOwn(config, "lifecycle")) {
80
+ throw new TypeError(legacyLifecycleMessage(entryName));
81
+ }
82
+ if (!Object.hasOwn(config, "access")) {
83
+ throw new TypeError(accessRequiredMessage(entryName));
84
+ }
85
+ const { access } = config;
86
+ if (!isRecord(access)) {
87
+ throw new TypeError(accessRequiredMessage(entryName));
88
+ }
89
+ const hasGate = Object.hasOwn(access, "gate") && access.gate !== undefined;
90
+ const hasOpen = Object.hasOwn(access, "open") && access.open !== undefined;
91
+ const hasInspect = Object.hasOwn(access, "inspect") && access.inspect !== undefined;
92
+ if (Number(hasGate) + Number(hasOpen) + Number(hasInspect) !== 1) {
93
+ throw new TypeError(accessRequiredMessage(entryName));
94
+ }
95
+ if (hasGate) {
96
+ for (const key of Object.keys(access)) {
97
+ if (key === "gate")
98
+ continue;
99
+ if ((key === "open" || key === "inspect" || key === "afterHandle") && access[key] === undefined)
100
+ continue;
101
+ throw new TypeError(accessRequiredMessage(entryName));
102
+ }
103
+ const { gate } = access;
104
+ if (!isRecord(gate)) {
105
+ throw new TypeError(accessRequiredMessage(entryName));
106
+ }
107
+ const { beforeHandle, afterHandle } = gate;
108
+ if (!isBeforeHandleHook(beforeHandle)) {
109
+ throw new TypeError(accessRequiredMessage(entryName));
110
+ }
111
+ if (afterHandle !== undefined && !isAfterHandleHook(afterHandle)) {
112
+ throw new TypeError(accessRequiredMessage(entryName));
113
+ }
114
+ return afterHandle !== undefined ? { beforeHandle, afterHandle } : { beforeHandle };
115
+ }
116
+ if (hasInspect) {
117
+ for (const key of Object.keys(access)) {
118
+ if (key === "inspect")
119
+ continue;
120
+ if ((key === "gate" || key === "open" || key === "afterHandle") && access[key] === undefined)
121
+ continue;
122
+ throw new TypeError(accessRequiredMessage(entryName));
123
+ }
124
+ if (access.inspect !== true) {
125
+ throw new TypeError(accessRequiredMessage(entryName));
126
+ }
127
+ const lifecycle = {
128
+ beforeHandle() {
129
+ throw inspectForbiddenError(entryName);
130
+ }
131
+ };
132
+ inspectOnlyLifecycles.set(lifecycle, entryName);
133
+ return lifecycle;
134
+ }
135
+ for (const key of Object.keys(access)) {
136
+ if (key === "open" || key === "afterHandle")
137
+ continue;
138
+ if ((key === "gate" || key === "inspect") && access[key] === undefined)
139
+ continue;
140
+ throw new TypeError(accessRequiredMessage(entryName));
141
+ }
142
+ const { open, afterHandle } = access;
143
+ if (!isToolOpenReason(open)) {
144
+ throw new TypeError(accessRequiredMessage(entryName));
145
+ }
146
+ if (afterHandle !== undefined && !isAfterHandleHook(afterHandle)) {
147
+ throw new TypeError(accessRequiredMessage(entryName));
148
+ }
149
+ return afterHandle !== undefined ? { afterHandle } : {};
150
+ }
151
+ function resolveOptionalCliToolAccess(entryName, config) {
152
+ if (!isRecord(config)) {
153
+ throw new TypeError(accessRequiredMessage(entryName));
154
+ }
155
+ if (Object.hasOwn(config, "lifecycle")) {
156
+ throw new TypeError(legacyLifecycleMessage(entryName));
157
+ }
158
+ const hasManagedSurface = config.services !== undefined || config.runtimeTools !== undefined;
159
+ if (hasManagedSurface || Object.hasOwn(config, "access") && config.access !== undefined) {
160
+ return resolveToolAccess(entryName, config);
161
+ }
162
+ return {};
163
+ }
164
+
45
165
  // src/tools/execute-args.ts
46
166
  import { z } from "zod";
47
167
  function parseToolCallArguments(method, callArgs, {
@@ -178,6 +298,9 @@ var noProgress = async () => {
178
298
  return;
179
299
  };
180
300
  async function executeToolMethod(method, call, options = {}) {
301
+ const inspectErr = inspectOnlyError(options.lifecycle);
302
+ if (inspectErr)
303
+ return toolResultFromError(inspectErr);
181
304
  const { toolName, context } = call;
182
305
  return inToolCallContext({ source: context.source, toolName, method }, () => runToolMethod(method, call, options));
183
306
  }
@@ -386,87 +509,4 @@ async function runToolMethod(method, { toolName, rawArgs, context }, {
386
509
  }
387
510
  }
388
511
 
389
- // src/tools/mount.ts
390
- import { z as z2 } from "zod";
391
- function applyExtend(base, extra) {
392
- if (base instanceof z2.ZodObject) {
393
- assertToolExtensionCompatible(base, extra);
394
- return rebuildObject(base, { ...extra, ...base.shape });
395
- }
396
- return z2.intersection(z2.object(extra), base);
397
- }
398
- function contractToolMountable(projected, extend) {
399
- const method = projected.source;
400
- const baseArgumentSchema = mergeSchemas(method.paramsSchema, method.inputSchema);
401
- const argumentSchema = projected.shouldExtend && extend ? applyExtend(baseArgumentSchema, extend.schema) : baseArgumentSchema;
402
- return {
403
- method,
404
- name: projected.name,
405
- argumentSchema,
406
- presentationSchema: projected.presentationSchema,
407
- shouldExtend: projected.shouldExtend
408
- };
409
- }
410
- function collectTools2(service, transport, config = {}) {
411
- const {
412
- extend,
413
- flattenUnionInput = false,
414
- inputRecursionDepth,
415
- assertNames = true
416
- } = config;
417
- const tools = [];
418
- for (const projected of projectToolSurface({ services: [service] }, transport === "HTTP" ? "AGENT" : transport, {
419
- extend,
420
- flattenUnionInput,
421
- inputRecursionDepth,
422
- assertNames,
423
- assertUniqueNames: false
424
- })) {
425
- if (projected.kind !== "contract")
426
- continue;
427
- tools.push(contractToolMountable(projected, extend));
428
- }
429
- return tools;
430
- }
431
- function createToolRunner(config) {
432
- const extension = config.extend ? {
433
- schema: z2.object(config.extend.schema),
434
- resolve: config.extend.resolve
435
- } : undefined;
436
- return async function runOneToolCall(tool, rawArgs, context, call) {
437
- return executeToolMethod(tool.method, {
438
- toolName: tool.name,
439
- rawArgs,
440
- context: { ...config.context, ...context, source: config.source }
441
- }, {
442
- hooks: config.hooks,
443
- lifecycle: config.lifecycle,
444
- coerceJson: config.coerceJsonArgs ?? true,
445
- onOutputStrip: config.onOutputStrip ? (paths) => config.onOutputStrip?.(tool.name, paths) : undefined,
446
- extension: tool.shouldExtend ? extension : undefined,
447
- toolSurface: config.toolSurface ?? false,
448
- finalizeOutput: call?.finalizeOutput
449
- });
450
- };
451
- }
452
- function formatToolError(result, toolName, errorHint) {
453
- const err = {
454
- error: result.code,
455
- retryable: result.retryable ?? isRetryableStatus2(toolErrorFromResult(result).status)
456
- };
457
- if (result.details)
458
- err.details = result.details;
459
- const hints = [];
460
- if (result.hint)
461
- hints.push(result.hint);
462
- if (errorHint && toolName) {
463
- const global = errorHint(toolName, result.code);
464
- if (global)
465
- hints.push(global);
466
- }
467
- if (hints.length > 0)
468
- err._hint = hints.join(" ");
469
- return err;
470
- }
471
-
472
- export { parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, observed, ToolExecutionControlError2, isToolExecutionControlError2, contractToolMountable, collectTools2, createToolRunner, formatToolError };
512
+ export { isInspectOnlyLifecycle, inspectOnlyError, resolveToolAccess, resolveOptionalCliToolAccess, parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, observed, ToolExecutionControlError2, isToolExecutionControlError2, executeToolMethod };
@@ -1,14 +1,14 @@
1
1
  import {
2
- toolErrorFromResult,
3
- collectTools2,
4
- createToolRunner
5
- } from "./index-9wh98cpa.js";
2
+ resolveToolAccess,
3
+ toolErrorFromResult
4
+ } from "./index-n3bm7zqq.js";
6
5
  import {
7
6
  assertUniqueToolName
8
- } from "./index-3ypvpkwr.js";
7
+ } from "./index-669374qc.js";
9
8
  import {
10
- resolveToolAccess
11
- } from "./index-ax3wns1a.js";
9
+ collectTools2,
10
+ createToolRunner
11
+ } from "./index-fgahdc7s.js";
12
12
  import {
13
13
  AppError2
14
14
  } from "./index-9pv126eh.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-yt1gg11x.js";
8
8
  import {
9
9
  defineContract2
10
- } from "./index-d4svrknj.js";
10
+ } from "./index-39c2hj6h.js";
11
11
  import {
12
12
  canonicalDigest
13
13
  } from "./index-3dq8466w.js";
@@ -4,16 +4,16 @@ import {
4
4
  syncDirectory,
5
5
  publishAtomicFile,
6
6
  publishAtomicFileSync
7
- } from "./index-xtkw9866.js";
7
+ } from "./index-2c5w2d1d.js";
8
8
  import {
9
9
  closeAfter,
10
10
  closeAfterSync,
11
11
  readBoundedFile,
12
12
  readBoundedFileSync
13
- } from "./index-nbv44x0x.js";
13
+ } from "./index-s2e3h616.js";
14
14
  import {
15
15
  stagingPath
16
- } from "./index-39n02e0q.js";
16
+ } from "./index-psye60qn.js";
17
17
  import {
18
18
  errnoOf
19
19
  } from "./index-jj9228tt.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-jj9228tt.js";
4
4
  import {
5
5
  assertPositiveSafeInteger
6
- } from "./index-kzavdze2.js";
6
+ } from "./index-gr0kxymw.js";
7
7
 
8
8
  // src/internal/atomic-staging.ts
9
9
  import { randomBytes } from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startNativeCommand
3
- } from "./index-7kfcb576.js";
3
+ } from "./index-qa2jjb65.js";
4
4
 
5
5
  // src/process/command.ts
6
6
  function runNativeCommand2(input) {
@@ -17,7 +17,7 @@ import {
17
17
  } from "./index-jj9228tt.js";
18
18
  import {
19
19
  assertPositiveSafeInteger
20
- } from "./index-kzavdze2.js";
20
+ } from "./index-gr0kxymw.js";
21
21
  import {
22
22
  monotonicTimerClock,
23
23
  scheduleAt,
@@ -7,7 +7,7 @@ import {
7
7
  nextEventSeqByMaximum,
8
8
  agentSqlTables,
9
9
  createAgentRuntimeStore2
10
- } from "./index-bbzvrq66.js";
10
+ } from "./index-dcsxj68j.js";
11
11
  import {
12
12
  canonicalAgentJson2
13
13
  } from "./index-9xr44d2g.js";
@@ -22,7 +22,7 @@ import {
22
22
  scanSqlRecoverable,
23
23
  listSqlConversations,
24
24
  pageSqlConversationMessages
25
- } from "./index-4s2w4g37.js";
25
+ } from "./index-zhshhxew.js";
26
26
  import {
27
27
  rollbackSqliteFailure
28
28
  } from "./index-ttexdtjj.js";
@@ -398,7 +398,14 @@ var sqliteDialect = {
398
398
  conversationTables: conversationTables(TABLES3),
399
399
  messageRowId: "rowid",
400
400
  contains: (column) => `instr(${column}, ?) > 0`,
401
- nextEventSeq: (session, conversationId) => nextEventSeqByMaximum(sqliteDialect, session, conversationId)
401
+ nextEventSeq: (session, conversationId) => nextEventSeqByMaximum(sqliteDialect, session, conversationId),
402
+ async syncUpdatedEventSearch(session, event) {
403
+ if (event.rowId === undefined)
404
+ return;
405
+ await session.run(`DELETE FROM ${TABLES3.events}_fts WHERE rowid = ?`, [event.rowId]);
406
+ await session.run(`INSERT INTO ${TABLES3.events}_fts (rowid, conversation_id, event_seq, occurred_at, body)
407
+ VALUES (?, ?, ?, ?, ?)`, [event.rowId, event.conversationId, event.seq, event.occurredAt, event.payload]);
408
+ }
402
409
  };
403
410
  function sqliteSession(database) {
404
411
  return {
@@ -4,10 +4,10 @@ import {
4
4
  } from "./index-0p0s5hrj.js";
5
5
  import {
6
6
  createAgentRuntimeEventSink2
7
- } from "./index-wv8dqy7q.js";
7
+ } from "./index-205456mf.js";
8
8
  import {
9
9
  assertPositiveSafeInteger
10
- } from "./index-kzavdze2.js";
10
+ } from "./index-gr0kxymw.js";
11
11
 
12
12
  // src/agent-runtime/harness-control.ts
13
13
  function reportAgentControlError(config, error, context) {
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  writeAllBytes,
10
10
  writeAtomicFileStaged
11
- } from "./index-5zwac8ft.js";
11
+ } from "./index-pp97q86a.js";
12
12
  import {
13
13
  AtomicFilePublicationError2
14
- } from "./index-xtkw9866.js";
14
+ } from "./index-2c5w2d1d.js";
15
15
  import {
16
16
  BoundedFileReadError,
17
17
  readBoundedFile
18
- } from "./index-nbv44x0x.js";
18
+ } from "./index-s2e3h616.js";
19
19
  import {
20
20
  errnoOf
21
21
  } from "./index-jj9228tt.js";
22
22
  import {
23
23
  assertPositiveSafeInteger
24
- } from "./index-kzavdze2.js";
24
+ } from "./index-gr0kxymw.js";
25
25
  import {
26
26
  assertTimerMs
27
27
  } from "./index-agy5fqgf.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-xrgn784x.js";
8
8
  import {
9
9
  stagingName
10
- } from "./index-39n02e0q.js";
10
+ } from "./index-psye60qn.js";
11
11
 
12
12
  // src/internal/contained-write.ts
13
13
  import { constants, fchmod, open as openDescriptor, write as writeDescriptor } from "node:fs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  streamNativeCommand2
3
- } from "./index-ky3ardqn.js";
3
+ } from "./index-3fym4j8n.js";
4
4
  import {
5
5
  createBoundedLineDecoder
6
- } from "./index-sfzfd2m2.js";
6
+ } from "./index-39rmc00v.js";
7
7
  import {
8
8
  assertPositiveSafeInteger
9
- } from "./index-kzavdze2.js";
9
+ } from "./index-gr0kxymw.js";
10
10
 
11
11
  // src/agent-executor/engine-process.ts
12
12
  var ENGINE_LINE_BYTES = 8 * 1024 * 1024;
@@ -20,7 +20,13 @@ function spawnEngineProcess2(input) {
20
20
  const maxLineBytes = input.maxLineBytes ?? ENGINE_LINE_BYTES;
21
21
  const maxPendingStdinBytes = input.maxPendingStdinBytes ?? ENGINE_PENDING_STDIN_BYTES;
22
22
  const maxStdinBytes = input.maxStdinBytes ?? ENGINE_STDIN_BYTES;
23
+ const stdoutMode = input.stdoutMode ?? "lines";
24
+ if (stdoutMode !== "lines" && stdoutMode !== "drain") {
25
+ throw new TypeError(`stdoutMode must be "lines" or "drain", received ${String(stdoutMode)}`);
26
+ }
23
27
  let written = 0;
28
+ let pid;
29
+ const pidReady = Promise.withResolvers();
24
30
  const encoder = new TextEncoder;
25
31
  let writer;
26
32
  let open = true;
@@ -41,7 +47,11 @@ function spawnEngineProcess2(input) {
41
47
  ownerLoss: "terminate",
42
48
  stdin,
43
49
  maxStdinBytes,
44
- signal: input.signal
50
+ signal: input.signal,
51
+ onLeaderStarted: ({ pid: startedPid }) => {
52
+ pid = startedPid;
53
+ pidReady.resolve(startedPid);
54
+ }
45
55
  });
46
56
  let tail = "";
47
57
  (async () => {
@@ -52,6 +62,13 @@ function spawnEngineProcess2(input) {
52
62
  }
53
63
  } catch {}
54
64
  })();
65
+ if (stdoutMode === "drain") {
66
+ (async () => {
67
+ try {
68
+ for await (const _chunk of command.stdout) {}
69
+ } catch {}
70
+ })();
71
+ }
55
72
  const closeInput = () => {
56
73
  if (!open)
57
74
  return;
@@ -60,9 +77,15 @@ function spawnEngineProcess2(input) {
60
77
  writer.close();
61
78
  } catch {}
62
79
  };
63
- command.result.then(closeInput, closeInput);
80
+ const onCommandSettled = () => {
81
+ closeInput();
82
+ pidReady.resolve(pid);
83
+ };
84
+ command.result.then(onCommandSettled, onCommandSettled);
64
85
  const cleanLine = (line) => line.endsWith("\r") ? line.slice(0, -1) : line;
65
86
  async function* lines() {
87
+ if (stdoutMode === "drain")
88
+ return;
66
89
  const decoder = createBoundedLineDecoder(maxLineBytes);
67
90
  for await (const chunk of command.stdout) {
68
91
  for (const line of decoder.push(chunk)) {
@@ -78,6 +101,10 @@ function spawnEngineProcess2(input) {
78
101
  }
79
102
  }
80
103
  return {
104
+ get pid() {
105
+ return pid;
106
+ },
107
+ pidReady: pidReady.promise,
81
108
  send(line) {
82
109
  if (!open)
83
110
  throw new Error("The engine process has closed its input");
@@ -105,4 +132,4 @@ function spawnEngineProcess2(input) {
105
132
  };
106
133
  }
107
134
 
108
- export { spawnEngineProcess2 };
135
+ export { ENGINE_LINE_BYTES, spawnEngineProcess2 };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-zsarb5xp.js";
4
4
  import {
5
5
  assertPositiveSafeInteger
6
- } from "./index-kzavdze2.js";
6
+ } from "./index-gr0kxymw.js";
7
7
  import {
8
8
  assertTimerMs
9
9
  } from "./index-agy5fqgf.js";