stitchkit 0.135.1 → 0.136.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 (436) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +37 -11
  3. package/dist/agent-executor/acp/v1-session-build.d.ts +51 -0
  4. package/dist/agent-executor/acp/v1-session-build.d.ts.map +1 -0
  5. package/dist/agent-executor/acp/v1-session.d.ts +1 -1
  6. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  7. package/dist/agent-executor/claude/classify.d.ts +1 -1
  8. package/dist/agent-executor/claude/classify.d.ts.map +1 -1
  9. package/dist/agent-executor/claude/events-wire.d.ts +13 -0
  10. package/dist/agent-executor/claude/events-wire.d.ts.map +1 -0
  11. package/dist/agent-executor/claude/events.d.ts +1 -11
  12. package/dist/agent-executor/claude/events.d.ts.map +1 -1
  13. package/dist/agent-executor/codex/protocol.d.ts +0 -143
  14. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  15. package/dist/agent-executor/codex/request-answers.d.ts +1 -1
  16. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  17. package/dist/agent-executor/codex/server-requests.d.ts +150 -0
  18. package/dist/agent-executor/codex/server-requests.d.ts.map +1 -0
  19. package/dist/agent-executor/executor-contract.d.ts.map +1 -1
  20. package/dist/agent-executor/image-input.d.ts +10 -3
  21. package/dist/agent-executor/image-input.d.ts.map +1 -1
  22. package/dist/agent-executor/testing/replay-scenarios.d.ts.map +1 -1
  23. package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
  24. package/dist/agent-executor/vocabulary.d.ts +80 -0
  25. package/dist/agent-executor/vocabulary.d.ts.map +1 -1
  26. package/dist/agent-parts/model.d.ts +94 -0
  27. package/dist/agent-parts/model.d.ts.map +1 -1
  28. package/dist/agent-parts/parts.d.ts +176 -0
  29. package/dist/agent-parts/parts.d.ts.map +1 -1
  30. package/dist/agent-runtime/browser/browser-control-contract.d.ts +444 -0
  31. package/dist/agent-runtime/browser/browser-control-contract.d.ts.map +1 -1
  32. package/dist/agent-runtime/browser/control-schema.d.ts +532 -0
  33. package/dist/agent-runtime/browser/control-schema.d.ts.map +1 -1
  34. package/dist/agent-runtime/browser/control-view.d.ts.map +1 -1
  35. package/dist/agent-runtime/event-schema.d.ts +720 -3
  36. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  37. package/dist/agent-runtime/history/run-history-parts.d.ts.map +1 -1
  38. package/dist/agent-runtime/loop/deferred-tools.d.ts.map +1 -1
  39. package/dist/agent-runtime/loop/invocation-payload.d.ts.map +1 -1
  40. package/dist/agent-runtime/loop/invocation-stream.d.ts +9 -1
  41. package/dist/agent-runtime/loop/invocation-stream.d.ts.map +1 -1
  42. package/dist/agent-runtime/loop/provider-stream-parts.d.ts +6 -0
  43. package/dist/agent-runtime/loop/provider-stream-parts.d.ts.map +1 -1
  44. package/dist/agent-runtime/loop/provider-stream-segments.d.ts +1 -3
  45. package/dist/agent-runtime/loop/provider-stream-segments.d.ts.map +1 -1
  46. package/dist/agent-runtime/loop/run-acquisition.d.ts.map +1 -1
  47. package/dist/agent-runtime/loop/run-approval-signature.d.ts +38 -0
  48. package/dist/agent-runtime/loop/run-approval-signature.d.ts.map +1 -0
  49. package/dist/agent-runtime/loop/run-approval.d.ts +0 -28
  50. package/dist/agent-runtime/loop/run-approval.d.ts.map +1 -1
  51. package/dist/agent-runtime/loop/run-complete-port.d.ts +24 -0
  52. package/dist/agent-runtime/loop/run-complete-port.d.ts.map +1 -0
  53. package/dist/agent-runtime/loop/run-complete-stream.d.ts +7 -2
  54. package/dist/agent-runtime/loop/run-complete-stream.d.ts.map +1 -1
  55. package/dist/agent-runtime/loop/run-complete-types.d.ts +14 -1
  56. package/dist/agent-runtime/loop/run-complete-types.d.ts.map +1 -1
  57. package/dist/agent-runtime/loop/run-complete.d.ts +2 -2
  58. package/dist/agent-runtime/loop/run-complete.d.ts.map +1 -1
  59. package/dist/agent-runtime/loop/run-execution-state.d.ts +8 -0
  60. package/dist/agent-runtime/loop/run-execution-state.d.ts.map +1 -1
  61. package/dist/agent-runtime/loop/run-loop-events.d.ts +6 -1
  62. package/dist/agent-runtime/loop/run-loop-events.d.ts.map +1 -1
  63. package/dist/agent-runtime/loop/run-model-call.d.ts +44 -0
  64. package/dist/agent-runtime/loop/run-model-call.d.ts.map +1 -0
  65. package/dist/agent-runtime/loop/run-model-step.d.ts +25 -28
  66. package/dist/agent-runtime/loop/run-model-step.d.ts.map +1 -1
  67. package/dist/agent-runtime/loop/run-model-steps.d.ts +6 -0
  68. package/dist/agent-runtime/loop/run-model-steps.d.ts.map +1 -0
  69. package/dist/agent-runtime/loop/run-model-stream.d.ts +3 -1
  70. package/dist/agent-runtime/loop/run-model-stream.d.ts.map +1 -1
  71. package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts +0 -2
  72. package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts.map +1 -1
  73. package/dist/agent-runtime/loop/run-step-loop.d.ts +19 -0
  74. package/dist/agent-runtime/loop/run-step-loop.d.ts.map +1 -0
  75. package/dist/agent-runtime/loop/run-step-port.d.ts +175 -0
  76. package/dist/agent-runtime/loop/run-step-port.d.ts.map +1 -0
  77. package/dist/agent-runtime/loop/run-stream-parts.d.ts.map +1 -1
  78. package/dist/agent-runtime/loop/run-stream-recorded.d.ts.map +1 -1
  79. package/dist/agent-runtime/loop/run-stream-step-text.d.ts.map +1 -1
  80. package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts +2 -1
  81. package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts.map +1 -1
  82. package/dist/agent-runtime/loop/run-tool-call-input.d.ts +39 -0
  83. package/dist/agent-runtime/loop/run-tool-call-input.d.ts.map +1 -0
  84. package/dist/agent-runtime/loop/run-tool-call.d.ts +13 -34
  85. package/dist/agent-runtime/loop/run-tool-call.d.ts.map +1 -1
  86. package/dist/agent-runtime/loop/run-tool-errors.d.ts +5 -0
  87. package/dist/agent-runtime/loop/run-tool-errors.d.ts.map +1 -1
  88. package/dist/agent-runtime/loop/run-tool-executor.d.ts +1 -1
  89. package/dist/agent-runtime/loop/run-tool-executor.d.ts.map +1 -1
  90. package/dist/agent-runtime/loop/run-tool-slots.d.ts +2 -1
  91. package/dist/agent-runtime/loop/run-tool-slots.d.ts.map +1 -1
  92. package/dist/agent-runtime/loop/runtime-state.d.ts.map +1 -1
  93. package/dist/agent-runtime/loop/runtime.d.ts +0 -5
  94. package/dist/agent-runtime/loop/runtime.d.ts.map +1 -1
  95. package/dist/agent-runtime/providers/ai-sdk-convert.d.ts +1 -5
  96. package/dist/agent-runtime/providers/ai-sdk-convert.d.ts.map +1 -1
  97. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts +15 -0
  98. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts.map +1 -0
  99. package/dist/agent-runtime/providers/ai-sdk-tools.d.ts +11 -0
  100. package/dist/agent-runtime/providers/ai-sdk-tools.d.ts.map +1 -0
  101. package/dist/agent-runtime/providers/ai-sdk.d.ts +1 -9
  102. package/dist/agent-runtime/providers/ai-sdk.d.ts.map +1 -1
  103. package/dist/agent-runtime/providers/anthropic-sse.d.ts.map +1 -1
  104. package/dist/agent-runtime/providers/openrouter-admission.d.ts.map +1 -1
  105. package/dist/agent-runtime/providers/openrouter-audio.d.ts +123 -81
  106. package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -1
  107. package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
  108. package/dist/agent-runtime/providers/openrouter-catalog-query.d.ts.map +1 -1
  109. package/dist/agent-runtime/providers/openrouter-catalog.d.ts +2 -2
  110. package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
  111. package/dist/agent-runtime/providers/openrouter-client.d.ts +37 -0
  112. package/dist/agent-runtime/providers/openrouter-client.d.ts.map +1 -0
  113. package/dist/agent-runtime/providers/openrouter-http.d.ts +26 -6
  114. package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -1
  115. package/dist/agent-runtime/providers/openrouter-media.d.ts +91 -77
  116. package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -1
  117. package/dist/agent-runtime/providers/openrouter-models.d.ts +2 -23
  118. package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
  119. package/dist/agent-runtime/providers/openrouter-options.d.ts +2 -0
  120. package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
  121. package/dist/agent-runtime/providers/openrouter-request.d.ts +23 -0
  122. package/dist/agent-runtime/providers/openrouter-request.d.ts.map +1 -0
  123. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +86 -55
  124. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -1
  125. package/dist/agent-runtime/providers/openrouter-speech.d.ts +90 -0
  126. package/dist/agent-runtime/providers/openrouter-speech.d.ts.map +1 -0
  127. package/dist/agent-runtime/providers/openrouter-spend.d.ts +2 -2
  128. package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
  129. package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -1
  130. package/dist/agent-runtime/providers/openrouter-systemone.d.ts +87 -32
  131. package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -1
  132. package/dist/agent-runtime/providers/openrouter-url.d.ts +7 -1
  133. package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -1
  134. package/dist/agent-runtime/providers/openrouter-wire.d.ts +45 -0
  135. package/dist/agent-runtime/providers/openrouter-wire.d.ts.map +1 -0
  136. package/dist/agent-runtime/providers/openrouter.d.ts +1 -3
  137. package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
  138. package/dist/agent-runtime/providers/provider-http.d.ts +14 -2
  139. package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
  140. package/dist/agent-runtime/providers/provider-json-schema-strip.d.ts.map +1 -1
  141. package/dist/agent-runtime/providers/provider-json-schema.d.ts.map +1 -1
  142. package/dist/agent-runtime/providers/provider-openai-chat-sse.d.ts.map +1 -1
  143. package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts +42 -0
  144. package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts.map +1 -0
  145. package/dist/agent-runtime/providers/provider-usage.d.ts +9 -0
  146. package/dist/agent-runtime/providers/provider-usage.d.ts.map +1 -1
  147. package/dist/agent-runtime/runtime-internals.d.ts +1 -3
  148. package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
  149. package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts +9 -0
  150. package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts.map +1 -1
  151. package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts +6 -0
  152. package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts.map +1 -1
  153. package/dist/agent-runtime/sandbox/sandbox-contract.d.ts.map +1 -1
  154. package/dist/agent-runtime/sandbox/sandbox-process-linux.d.ts.map +1 -1
  155. package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts +5 -1
  156. package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts.map +1 -1
  157. package/dist/agent-runtime/sandbox/sandbox-process-wrapper.d.ts.map +1 -1
  158. package/dist/agent-runtime/schemas-json-projection.d.ts +29 -0
  159. package/dist/agent-runtime/schemas-json-projection.d.ts.map +1 -0
  160. package/dist/agent-runtime/schemas-message.d.ts +88 -0
  161. package/dist/agent-runtime/schemas-message.d.ts.map +1 -1
  162. package/dist/agent-runtime/schemas-run.d.ts +88 -0
  163. package/dist/agent-runtime/schemas-run.d.ts.map +1 -1
  164. package/dist/agent-runtime/stores/branch-messages.d.ts.map +1 -1
  165. package/dist/agent-runtime/stores/branch-observations.d.ts +42 -42
  166. package/dist/agent-runtime/stores/branch-replay.d.ts +264 -0
  167. package/dist/agent-runtime/stores/branch-replay.d.ts.map +1 -1
  168. package/dist/agent-runtime/stores/conversations.d.ts +88 -0
  169. package/dist/agent-runtime/stores/conversations.d.ts.map +1 -1
  170. package/dist/agent-runtime/stores/sql-rows.d.ts +74 -10
  171. package/dist/agent-runtime/stores/sql-rows.d.ts.map +1 -1
  172. package/dist/agent-runtime/stores/store-driver-contract.d.ts +616 -0
  173. package/dist/agent-runtime/stores/store-driver-contract.d.ts.map +1 -1
  174. package/dist/agent-runtime/stores/store-events.d.ts +1056 -0
  175. package/dist/agent-runtime/stores/store-events.d.ts.map +1 -1
  176. package/dist/agent-runtime/stores/store.d.ts +1232 -0
  177. package/dist/agent-runtime/stores/store.d.ts.map +1 -1
  178. package/dist/agent-runtime/terminal-commit.d.ts +74 -10
  179. package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
  180. package/dist/agent-runtime/testing/fault-bench.d.ts +5 -1
  181. package/dist/agent-runtime/testing/fault-bench.d.ts.map +1 -1
  182. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +158 -30
  183. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts.map +1 -1
  184. package/dist/agent-runtime/testing/store-conformance-support.d.ts +79 -15
  185. package/dist/agent-runtime/testing/store-conformance-support.d.ts.map +1 -1
  186. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  187. package/dist/application/diagnostic-journal-manager.d.ts +1 -1
  188. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  189. package/dist/application/notification-delivery.d.ts.map +1 -1
  190. package/dist/browser/client-executors.d.ts.map +1 -1
  191. package/dist/browser/client-url.d.ts.map +1 -1
  192. package/dist/contract/define.d.ts +3 -7
  193. package/dist/contract/define.d.ts.map +1 -1
  194. package/dist/contract/normalize.d.ts +17 -5
  195. package/dist/contract/normalize.d.ts.map +1 -1
  196. package/dist/entrypoints/agent-executor/acp.js +9 -6
  197. package/dist/entrypoints/agent-executor/claude-sdk.js +26 -25
  198. package/dist/entrypoints/agent-executor/claude.js +13 -12
  199. package/dist/entrypoints/agent-executor/codex.d.ts +2 -1
  200. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  201. package/dist/entrypoints/agent-executor/codex.js +135 -40
  202. package/dist/entrypoints/agent-executor/testing/claude-sdk.js +5 -4
  203. package/dist/entrypoints/agent-executor/testing.js +23 -18
  204. package/dist/entrypoints/agent-executor.js +8 -8
  205. package/dist/entrypoints/agent-runtime/ai-sdk.d.ts +2 -1
  206. package/dist/entrypoints/agent-runtime/ai-sdk.d.ts.map +1 -1
  207. package/dist/entrypoints/agent-runtime/ai-sdk.js +34 -30
  208. package/dist/entrypoints/agent-runtime/anthropic.js +15 -12
  209. package/dist/entrypoints/agent-runtime/browser.js +13 -8
  210. package/dist/entrypoints/agent-runtime/harness.js +26 -27
  211. package/dist/entrypoints/agent-runtime/openai.js +7 -7
  212. package/dist/entrypoints/agent-runtime/openrouter.d.ts +7 -5
  213. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
  214. package/dist/entrypoints/agent-runtime/openrouter.js +1097 -856
  215. package/dist/entrypoints/agent-runtime/postgres.js +9 -9
  216. package/dist/entrypoints/agent-runtime/realtime.js +9 -8
  217. package/dist/entrypoints/agent-runtime/sandbox.js +167 -139
  218. package/dist/entrypoints/agent-runtime/sqlite/bun.js +10 -10
  219. package/dist/entrypoints/agent-runtime/sqlite/node.js +10 -10
  220. package/dist/entrypoints/agent-runtime/testing.js +9 -9
  221. package/dist/entrypoints/agent-runtime.js +261 -375
  222. package/dist/entrypoints/application/diagnostic-journal.js +14 -10
  223. package/dist/entrypoints/application.js +18 -6
  224. package/dist/entrypoints/cli.js +36 -15
  225. package/dist/entrypoints/contract.js +12 -10
  226. package/dist/entrypoints/geo.js +1 -1
  227. package/dist/entrypoints/handler.js +5 -6
  228. package/dist/entrypoints/http.d.ts +2 -0
  229. package/dist/entrypoints/http.d.ts.map +1 -1
  230. package/dist/entrypoints/http.js +16 -4
  231. package/dist/entrypoints/index.js +26 -35
  232. package/dist/entrypoints/live.js +3 -3
  233. package/dist/entrypoints/node.js +7 -7
  234. package/dist/entrypoints/observability.js +9 -7
  235. package/dist/entrypoints/process.js +3 -3
  236. package/dist/entrypoints/remote.js +5 -5
  237. package/dist/entrypoints/server.js +29 -16
  238. package/dist/entrypoints/telegram/grammy.d.ts +1 -1
  239. package/dist/entrypoints/telegram/grammy.d.ts.map +1 -1
  240. package/dist/entrypoints/telegram/grammy.js +39 -5
  241. package/dist/entrypoints/telegram/screens.js +3 -0
  242. package/dist/entrypoints/telegram.d.ts +1 -1
  243. package/dist/entrypoints/telegram.d.ts.map +1 -1
  244. package/dist/entrypoints/telegram.js +19 -6
  245. package/dist/entrypoints/testing.js +10 -11
  246. package/dist/entrypoints/tools/agent.js +9 -10
  247. package/dist/entrypoints/tools/connections.js +27 -57
  248. package/dist/entrypoints/tools/contract.js +4 -4
  249. package/dist/entrypoints/tools/invoker.js +7 -8
  250. package/dist/entrypoints/tools/mcp.js +9 -10
  251. package/dist/entrypoints/tools/toolkit.js +11 -12
  252. package/dist/entrypoints/tools.js +24 -22
  253. package/dist/entrypoints/tracking/contract.js +1 -1
  254. package/dist/entrypoints/tracking/performance.js +1 -1
  255. package/dist/entrypoints/tracking.js +1 -1
  256. package/dist/{index-3czc3ykr.js → index-08a3qfr8.js} +1 -1
  257. package/dist/index-1psbyyhj.js +21 -0
  258. package/dist/{index-pdcbjd6a.js → index-1yky29qg.js} +6 -3
  259. package/dist/{index-b4c9dpzm.js → index-252den5a.js} +10 -11
  260. package/dist/{index-yhwx4fwk.js → index-26v8hjqm.js} +4 -4
  261. package/dist/{index-xtby8rj3.js → index-28kbdn63.js} +5 -47
  262. package/dist/{index-c24bj2r1.js → index-2wm9b9vs.js} +5 -5
  263. package/dist/{index-ht71v1ag.js → index-32ew02z1.js} +60 -45
  264. package/dist/{index-dm84tsd5.js → index-3kb8dw48.js} +1 -1
  265. package/dist/index-3tb82xr7.js +11 -0
  266. package/dist/{index-nr4fhfn4.js → index-4p2zx593.js} +2 -0
  267. package/dist/{index-grhhsrd5.js → index-4q9tmzea.js} +5 -4
  268. package/dist/{index-mcv7b2n0.js → index-63ctzjp4.js} +497 -495
  269. package/dist/{index-y0a4gt1s.js → index-65p8v81y.js} +3 -2
  270. package/dist/{index-z72vazf5.js → index-6y3eae97.js} +27 -83
  271. package/dist/{index-y0mwkgkf.js → index-8cnfgwg8.js} +1212 -1139
  272. package/dist/{index-mkmep637.js → index-9m1m92rg.js} +1 -1
  273. package/dist/{index-5awtbyns.js → index-9vj869rx.js} +1 -1
  274. package/dist/index-a1rjr381.js +114 -0
  275. package/dist/{index-6kwdfb9m.js → index-akesakvj.js} +23 -4
  276. package/dist/{index-5q0qpw3v.js → index-aqm7e864.js} +23 -8
  277. package/dist/{index-d4at0q09.js → index-b9mj31q7.js} +90 -88
  278. package/dist/{index-baba8ehy.js → index-bjrcbcn2.js} +2 -2
  279. package/dist/{index-fsw9wxk9.js → index-c9j8441q.js} +1 -103
  280. package/dist/{index-wdb5jhas.js → index-d1pdv8qc.js} +1 -1
  281. package/dist/{index-v0j22shs.js → index-d5mhgx72.js} +16 -11
  282. package/dist/{index-73wq9abg.js → index-df5xr2f9.js} +13 -59
  283. package/dist/{index-n9358ydy.js → index-dm50x3by.js} +1 -1
  284. package/dist/{index-zyyerdny.js → index-dmrx8xma.js} +3 -0
  285. package/dist/{index-78da4g74.js → index-dwq6a6sq.js} +17 -13
  286. package/dist/{index-9be3tf6r.js → index-e413q2cj.js} +49 -22
  287. package/dist/{index-57sbckhv.js → index-e4w0sfm1.js} +2 -2
  288. package/dist/{index-g4gstmp1.js → index-ednf2cxs.js} +1 -1
  289. package/dist/{index-84tp547a.js → index-edpkm3k7.js} +29 -97
  290. package/dist/{index-gs0jw0hy.js → index-efbzm2se.js} +3 -3
  291. package/dist/{index-asnd4h2k.js → index-f0dzyskg.js} +27 -4
  292. package/dist/{index-xbb8ysmq.js → index-fatke81t.js} +2 -2
  293. package/dist/{index-d3s070eh.js → index-gj4wdts6.js} +1 -1
  294. package/dist/{index-6nzzj7qr.js → index-gq35s3bm.js} +1 -1
  295. package/dist/index-gvgtmt7a.js +102 -0
  296. package/dist/{index-pd9e8rz4.js → index-gvv7y0s4.js} +1 -1
  297. package/dist/{index-m2b49tvc.js → index-h08xqfw9.js} +20 -21
  298. package/dist/{index-gk6dq9ay.js → index-ha1tv70k.js} +3 -26
  299. package/dist/{index-vebzvse6.js → index-jy907kcs.js} +24 -1
  300. package/dist/{index-q86qnzzf.js → index-k5azb3v3.js} +8 -25
  301. package/dist/{index-qcy8et93.js → index-kaq9nb7h.js} +6 -6
  302. package/dist/{index-vse7x1qt.js → index-knqye3gv.js} +1 -1
  303. package/dist/{index-tav72wz5.js → index-ks4rhtcc.js} +5 -0
  304. package/dist/{index-bvpevwt6.js → index-mtpcax6d.js} +210 -205
  305. package/dist/{index-7qza24g1.js → index-px9r6wv1.js} +1 -1
  306. package/dist/{index-x6sp5vpa.js → index-q4tr9vnf.js} +1 -1
  307. package/dist/{index-hce3hbdg.js → index-qj0sq69b.js} +6 -2
  308. package/dist/{index-de7b0kvz.js → index-r9w7wfgn.js} +2 -2
  309. package/dist/{index-8vzh5wpv.js → index-rw1caff2.js} +14 -26
  310. package/dist/index-s8af9jqw.js +6 -0
  311. package/dist/{index-bgj9hbm3.js → index-sdppfbrh.js} +30 -16
  312. package/dist/{index-aacwkve4.js → index-sjq4akrx.js} +3 -5
  313. package/dist/{index-fec05c9k.js → index-ta0e2daw.js} +9 -7
  314. package/dist/{index-5dxgx3yj.js → index-tcv71frn.js} +1 -1
  315. package/dist/{index-1zy31r3b.js → index-v92djygb.js} +1 -1
  316. package/dist/{index-c0yym4a0.js → index-w7e402wx.js} +11 -105
  317. package/dist/{index-9f60gnfn.js → index-xaa3603f.js} +4 -11
  318. package/dist/index-xrbrvn15.js +147 -0
  319. package/dist/{index-ac3rfec5.js → index-y6wzzk2e.js} +21 -1
  320. package/dist/{index-3d2c45jn.js → index-yjx5jna7.js} +2 -2
  321. package/dist/{index-j3r7r1mh.js → index-yv7d6tav.js} +1 -1
  322. package/dist/{index-wsv11dhg.js → index-zagc12j1.js} +5 -5
  323. package/dist/{index-npfdymav.js → index-zqc64g69.js} +3 -3
  324. package/dist/{index-rkphknhx.js → index-zthekmrt.js} +2 -2
  325. package/dist/internal/json-stringify.d.ts +37 -0
  326. package/dist/internal/json-stringify.d.ts.map +1 -0
  327. package/dist/internal/loopback-host.d.ts +8 -0
  328. package/dist/internal/loopback-host.d.ts.map +1 -0
  329. package/dist/internal/own-member.d.ts +7 -0
  330. package/dist/internal/own-member.d.ts.map +1 -0
  331. package/dist/internal/request.d.ts +17 -8
  332. package/dist/internal/request.d.ts.map +1 -1
  333. package/dist/internal/secret-shapes.d.ts +33 -4
  334. package/dist/internal/secret-shapes.d.ts.map +1 -1
  335. package/dist/json-schema/dialect.d.ts.map +1 -1
  336. package/dist/json-schema/keywords.d.ts +25 -6
  337. package/dist/json-schema/keywords.d.ts.map +1 -1
  338. package/dist/json-schema/string-format.d.ts.map +1 -1
  339. package/dist/live/events.d.ts.map +1 -1
  340. package/dist/live/watch-client.d.ts.map +1 -1
  341. package/dist/live/watch-delta.d.ts.map +1 -1
  342. package/dist/observability/context.d.ts +4 -3
  343. package/dist/observability/context.d.ts.map +1 -1
  344. package/dist/observability/sanitize.d.ts.map +1 -1
  345. package/dist/observability/secret-values.d.ts +0 -9
  346. package/dist/observability/secret-values.d.ts.map +1 -1
  347. package/dist/server/context.d.ts +3 -2
  348. package/dist/server/context.d.ts.map +1 -1
  349. package/dist/server/error-hook.d.ts +4 -3
  350. package/dist/server/error-hook.d.ts.map +1 -1
  351. package/dist/server/event-bus.d.ts.map +1 -1
  352. package/dist/server/file.d.ts +11 -3
  353. package/dist/server/file.d.ts.map +1 -1
  354. package/dist/server/handler-state.d.ts +2 -2
  355. package/dist/server/handler-state.d.ts.map +1 -1
  356. package/dist/server/middleware/jwt.d.ts +12 -1
  357. package/dist/server/middleware/jwt.d.ts.map +1 -1
  358. package/dist/server/middleware/trust-fence.d.ts +4 -0
  359. package/dist/server/middleware/trust-fence.d.ts.map +1 -1
  360. package/dist/server/multipart.d.ts +2 -3
  361. package/dist/server/multipart.d.ts.map +1 -1
  362. package/dist/server/raw.d.ts.map +1 -1
  363. package/dist/server/request-body.d.ts +12 -1
  364. package/dist/server/request-body.d.ts.map +1 -1
  365. package/dist/server/request-completion.d.ts.map +1 -1
  366. package/dist/server/types.d.ts +14 -9
  367. package/dist/server/types.d.ts.map +1 -1
  368. package/dist/telegram/crypto.d.ts.map +1 -1
  369. package/dist/telegram/init-data.d.ts +4 -4
  370. package/dist/telegram/init-data.d.ts.map +1 -1
  371. package/dist/telegram/outbound-cost.d.ts.map +1 -1
  372. package/dist/telegram/screens/test-chat.d.ts.map +1 -1
  373. package/dist/telegram/widget-api.d.ts +85 -13
  374. package/dist/telegram/widget-api.d.ts.map +1 -1
  375. package/dist/telegram/widget.d.ts +46 -2
  376. package/dist/telegram/widget.d.ts.map +1 -1
  377. package/dist/tools/cli/args-classify.d.ts +4 -74
  378. package/dist/tools/cli/args-classify.d.ts.map +1 -1
  379. package/dist/tools/cli/args-framework.d.ts +79 -0
  380. package/dist/tools/cli/args-framework.d.ts.map +1 -0
  381. package/dist/tools/cli/args-scan.d.ts.map +1 -1
  382. package/dist/tools/cli/args-tokens.d.ts.map +1 -1
  383. package/dist/tools/cli/checkpoint.d.ts +5 -0
  384. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  385. package/dist/tools/cli/stream.d.ts.map +1 -1
  386. package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -1
  387. package/dist/tools/connections/openapi.d.ts.map +1 -1
  388. package/dist/tools/connections/runtime.d.ts.map +1 -1
  389. package/dist/tools/execute-handler.d.ts +24 -0
  390. package/dist/tools/execute-handler.d.ts.map +1 -0
  391. package/dist/tools/execute.d.ts.map +1 -1
  392. package/dist/tools/mcp/round.d.ts.map +1 -1
  393. package/dist/tools/schema/coerce.d.ts.map +1 -1
  394. package/dist/tools/schema/flatten.d.ts.map +1 -1
  395. package/dist/tools/schema/inline-references.d.ts.map +1 -1
  396. package/dist/tools/schema/nesting-limit.d.ts.map +1 -1
  397. package/dist/tools/schema/presentation.d.ts.map +1 -1
  398. package/dist/tracking/privacy.d.ts.map +1 -1
  399. package/llms/agent-runtime-openrouter.txt +10 -9
  400. package/llms/agent-runtime-sandbox.txt +50 -11
  401. package/llms/agent-runtime-testing.txt +1 -1
  402. package/llms/agent-runtime.2.txt +9 -6
  403. package/llms/agent-runtime.3.txt +2 -2
  404. package/llms/agent-runtime.4.txt +11 -5
  405. package/llms/agent-runtime.5.txt +2 -2
  406. package/llms/agent-runtime.txt +297 -36
  407. package/llms/application.2.txt +6 -3
  408. package/llms/application.3.txt +2 -1
  409. package/llms/application.txt +7 -2
  410. package/llms/http.txt +1 -1
  411. package/llms/live.txt +3 -1
  412. package/llms/observability.txt +16 -9
  413. package/llms/server.2.txt +13 -8
  414. package/llms/server.4.txt +23 -11
  415. package/llms/server.5.txt +5 -5
  416. package/llms/server.txt +54 -1
  417. package/llms/spend.txt +1 -0
  418. package/llms/stitchkit.2.txt +4 -2
  419. package/llms/stitchkit.txt +113 -93
  420. package/llms/telegram-grammy.txt +3 -2
  421. package/llms/telegram.2.txt +3 -1
  422. package/llms/telegram.txt +35 -10
  423. package/llms/upgrading-0.128.0-0.129.0.txt +175 -0
  424. package/llms/{upgrading-0.128.0-0.135.0.txt → upgrading-0.130.0-0.136.0.txt} +353 -169
  425. package/llms/upgrading.txt +2 -1
  426. package/llms-full.txt +1021 -223
  427. package/llms.txt +14 -13
  428. package/package.json +6 -6
  429. package/dist/agent-runtime/loop/deferred-tools-internal.d.ts +0 -19
  430. package/dist/agent-runtime/loop/deferred-tools-internal.d.ts.map +0 -1
  431. package/dist/agent-runtime/loop/run-complete-retry.d.ts +0 -24
  432. package/dist/agent-runtime/loop/run-complete-retry.d.ts.map +0 -1
  433. package/dist/agent-runtime/loop/run-model-attempts.d.ts +0 -6
  434. package/dist/agent-runtime/loop/run-model-attempts.d.ts.map +0 -1
  435. package/dist/index-sznqf8fx.js +0 -20
  436. /package/dist/{index-fthw8dwa.js → index-4gbybjg6.js} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  PlanWindowSchema2,
3
3
  PlanLimitsSchema2,
4
4
  clampPlanName
5
- } from "./index-aacwkve4.js";
5
+ } from "./index-sjq4akrx.js";
6
6
  import {
7
7
  isPositiveSafeInteger
8
8
  } from "./index-gr0kxymw.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redact2
3
- } from "./index-xtby8rj3.js";
3
+ } from "./index-28kbdn63.js";
4
4
 
5
5
  // src/tools/internal/json-projection.ts
6
6
  function projectJsonSafe(value, space) {
@@ -0,0 +1,114 @@
1
+ // src/internal/json-stringify.ts
2
+ class Refused extends Error {
3
+ refusal;
4
+ constructor(refusal) {
5
+ super(refusal.reason);
6
+ this.refusal = refusal;
7
+ }
8
+ }
9
+ var REFUSAL_TEXT = {
10
+ bigint: "a BigInt",
11
+ cycle: "a cycle",
12
+ threw: "a value whose serialization threw"
13
+ };
14
+ function describeJsonRefusal(refusal) {
15
+ const path = refusal.path.length > MAX_PATH_TEXT ? `${refusal.path.slice(0, MAX_PATH_TEXT)}…` : refusal.path;
16
+ const where = path.length > 0 ? path : "the root";
17
+ return `${REFUSAL_TEXT[refusal.reason]} at ${where}`;
18
+ }
19
+ var MAX_PATH_TEXT = 200;
20
+ function joinPath(path, key) {
21
+ return path.length > 0 ? `${path}.${key}` : key;
22
+ }
23
+ function resolveForJson(value, key) {
24
+ let resolved = value;
25
+ if (typeof resolved === "object" && resolved !== null || typeof resolved === "bigint") {
26
+ const toJSON = Reflect.get(Object(resolved), "toJSON");
27
+ if (typeof toJSON === "function")
28
+ resolved = toJSON.call(resolved, key);
29
+ }
30
+ if (resolved instanceof Number)
31
+ return Number(resolved);
32
+ if (resolved instanceof String)
33
+ return String(resolved);
34
+ if (resolved instanceof Boolean)
35
+ return Boolean.prototype.valueOf.call(resolved);
36
+ if (resolved instanceof BigInt)
37
+ return BigInt.prototype.valueOf.call(resolved);
38
+ return resolved;
39
+ }
40
+ function projectJson(value) {
41
+ const ancestors = new Set;
42
+ const visit = (raw, key, path) => {
43
+ let item;
44
+ try {
45
+ item = resolveForJson(raw, key);
46
+ } catch {
47
+ throw new Refused({ reason: "threw", path });
48
+ }
49
+ if (item === null || typeof item === "string" || typeof item === "boolean")
50
+ return item;
51
+ if (typeof item === "number")
52
+ return Number.isFinite(item) ? item + 0 : null;
53
+ if (typeof item === "bigint")
54
+ throw new Refused({ reason: "bigint", path });
55
+ if (typeof item !== "object")
56
+ return;
57
+ if (ancestors.has(item))
58
+ throw new Refused({ reason: "cycle", path });
59
+ ancestors.add(item);
60
+ try {
61
+ let length;
62
+ try {
63
+ length = Array.isArray(item) ? Number(Reflect.get(item, "length")) : undefined;
64
+ } catch {
65
+ throw new Refused({ reason: "threw", path });
66
+ }
67
+ if (length !== undefined) {
68
+ const out = [];
69
+ for (let index = 0;index < length; index += 1) {
70
+ const entry = readProperty(item, String(index), path);
71
+ out.push(visit(entry, String(index), joinPath(path, String(index))) ?? null);
72
+ }
73
+ return out;
74
+ }
75
+ const out = {};
76
+ let names;
77
+ try {
78
+ names = Object.keys(item);
79
+ } catch {
80
+ throw new Refused({ reason: "threw", path });
81
+ }
82
+ for (const name of names) {
83
+ const entry = visit(readProperty(item, name, path), name, joinPath(path, name));
84
+ if (name === "__proto__")
85
+ continue;
86
+ if (entry !== undefined)
87
+ out[name] = entry;
88
+ }
89
+ return out;
90
+ } finally {
91
+ ancestors.delete(item);
92
+ }
93
+ };
94
+ try {
95
+ return { ok: true, value: visit(value, "", "") ?? null };
96
+ } catch (error) {
97
+ if (error instanceof Refused)
98
+ return { ok: false, refusal: error.refusal };
99
+ return { ok: false, refusal: { reason: "threw", path: "" } };
100
+ }
101
+ }
102
+ function readProperty(holder, key, path) {
103
+ try {
104
+ return Reflect.get(holder, key);
105
+ } catch {
106
+ throw new Refused({ reason: "threw", path: joinPath(path, key) });
107
+ }
108
+ }
109
+ function recordedJson(value) {
110
+ const projected = projectJson(value);
111
+ return projected.ok ? projected.value : { unrecordable: describeJsonRefusal(projected.refusal) };
112
+ }
113
+
114
+ export { describeJsonRefusal, projectJson, recordedJson };
@@ -1,12 +1,31 @@
1
1
  import {
2
2
  AgentTextPartSchema2,
3
3
  AgentReasoningPartSchema2,
4
+ AgentFilePartSchema2,
5
+ AgentSourcePartSchema2,
4
6
  AgentToolCallPartSchema2,
5
- AgentToolResultPartSchema2
6
- } from "./index-tav72wz5.js";
7
+ AgentToolResultPartSchema2,
8
+ AgentToolApprovalRequestPartSchema2,
9
+ AgentToolApprovalResponsePartSchema2,
10
+ AgentOpaquePartSchema2,
11
+ AgentControlPartSchema2
12
+ } from "./index-ks4rhtcc.js";
7
13
 
8
14
  // src/agent-executor/vocabulary.ts
9
15
  import { z } from "zod";
16
+ var ExecutorToolResultPartSchema = AgentToolResultPartSchema2.omit({ modelOutput: true });
17
+ var ExecutorMessagePartSchema = z.discriminatedUnion("type", [
18
+ AgentTextPartSchema2,
19
+ AgentReasoningPartSchema2,
20
+ AgentFilePartSchema2,
21
+ AgentSourcePartSchema2,
22
+ AgentToolCallPartSchema2,
23
+ ExecutorToolResultPartSchema,
24
+ AgentToolApprovalRequestPartSchema2,
25
+ AgentToolApprovalResponsePartSchema2,
26
+ AgentOpaquePartSchema2,
27
+ AgentControlPartSchema2
28
+ ]);
10
29
  var ExecutorRawSchema2 = z.strictObject({
11
30
  source: z.string().min(1),
12
31
  type: z.string().min(1)
@@ -19,7 +38,7 @@ var base = {
19
38
  var ExecutorTextDeltaSchema = AgentTextPartSchema2.omit({ provider: true }).extend(base).strict();
20
39
  var ExecutorReasoningDeltaSchema = AgentReasoningPartSchema2.extend(base).strict();
21
40
  var ExecutorToolCallDeltaSchema = AgentToolCallPartSchema2.extend(base).strict();
22
- var ExecutorToolResultDeltaSchema = AgentToolResultPartSchema2.extend(base).strict();
41
+ var ExecutorToolResultDeltaSchema = ExecutorToolResultPartSchema.extend(base).strict();
23
42
  var ExecutorRequestDeltaSchema = z.strictObject({
24
43
  type: z.literal("request"),
25
44
  ...base,
@@ -141,4 +160,4 @@ var ExecutorDeltaSchema2 = z.discriminatedUnion("type", [
141
160
  ExecutorWindowDeltaSchema
142
161
  ]);
143
162
 
144
- export { ExecutorRawSchema2, ExecutorTokenUsageSchema2, ExecutorModelUsageSchema2, ExecutorThreadDispositionSchema2, ExecutorStartupPhaseSchema2, ExecutorStatusDeltaSchema2, ExecutorPlanEntryStatusSchema2, ExecutorPlanEntryPrioritySchema2, ExecutorPlanEntrySchema2, ExecutorPlanDeltaSchema2, ExecutorErrorKindSchema2, ExecutorDeltaSchema2 };
163
+ export { ExecutorMessagePartSchema, ExecutorRawSchema2, ExecutorTokenUsageSchema2, ExecutorModelUsageSchema2, ExecutorThreadDispositionSchema2, ExecutorStartupPhaseSchema2, ExecutorStatusDeltaSchema2, ExecutorPlanEntryStatusSchema2, ExecutorPlanEntryPrioritySchema2, ExecutorPlanEntrySchema2, ExecutorPlanDeltaSchema2, ExecutorErrorKindSchema2, ExecutorDeltaSchema2 };
@@ -31,16 +31,31 @@ function resolveSocketIp2(req, server) {
31
31
  return req.ip;
32
32
  return;
33
33
  }
34
+ function unmapIpv4(address) {
35
+ return address.trim().replace(/^::ffff:/i, "");
36
+ }
37
+ function isIpAddress(value) {
38
+ return parseIpv4(value) !== undefined || parseIpv6(value) !== undefined;
39
+ }
34
40
  function extractIp2(req, options = {}) {
35
- if (options.trustProxy) {
36
- const forwarded = req.headers.get("x-forwarded-for");
37
- if (forwarded)
38
- return (forwarded.split(",")[0] ?? "").trim().replace(/^::ffff:/, "");
39
- const realIp = req.headers.get("x-real-ip");
40
- if (realIp)
41
- return realIp.trim().replace(/^::ffff:/, "");
41
+ const peer = unmapIpv4(options.socketIp ?? "");
42
+ const policy = options.trustProxy;
43
+ if (!policy || !peer || !policy.trustedPeer(peer))
44
+ return peer;
45
+ const forwarded = req.headers.get("x-forwarded-for");
46
+ if (!forwarded)
47
+ return peer;
48
+ const hops = forwarded.split(",").map(unmapIpv4);
49
+ let client = peer;
50
+ for (let index = hops.length - 1;index >= 0; index -= 1) {
51
+ const hop = hops[index] ?? "";
52
+ if (!isIpAddress(hop))
53
+ return "";
54
+ client = hop;
55
+ if (!policy.trustedPeer(hop))
56
+ return client;
42
57
  }
43
- return (options.socketIp ?? "").replace(/^::ffff:/, "");
58
+ return client;
44
59
  }
45
60
  function getClientInfo2(req, options = {}) {
46
61
  return {
@@ -1,7 +1,3 @@
1
- import {
2
- normalizeError2,
3
- validateDeclaredOutput
4
- } from "./index-78da4g74.js";
5
1
  import {
6
2
  localVerdict
7
3
  } from "./index-dsa676h8.js";
@@ -9,20 +5,24 @@ import {
9
5
  objectShapeKeys,
10
6
  rebuildObject,
11
7
  mergeSchemas
12
- } from "./index-n9358ydy.js";
8
+ } from "./index-dm50x3by.js";
13
9
  import {
14
10
  coerceJsonArgs2
15
- } from "./index-hce3hbdg.js";
11
+ } from "./index-qj0sq69b.js";
16
12
  import {
17
13
  applyToolViewDefaults,
18
14
  projectToolView,
19
15
  assertToolExtensionCompatible,
20
16
  projectToolSurface
21
- } from "./index-84tp547a.js";
17
+ } from "./index-edpkm3k7.js";
22
18
  import {
23
19
  runWithRequestContext2,
24
20
  getRequestContext2
25
- } from "./index-x6sp5vpa.js";
21
+ } from "./index-q4tr9vnf.js";
22
+ import {
23
+ normalizeError2,
24
+ validateDeclaredOutput
25
+ } from "./index-dwq6a6sq.js";
26
26
  import {
27
27
  projectedToolError
28
28
  } from "./index-dacxr7nf.js";
@@ -236,6 +236,88 @@ function parseToolCallArguments(method, callArgs, {
236
236
  return { ok: true, params, input };
237
237
  }
238
238
 
239
+ // src/tools/execute-handler.ts
240
+ async function invokeToolHandler(method, ctx, input, source, {
241
+ lifecycle,
242
+ onOutputStrip,
243
+ finalizeOutput,
244
+ toolSurface
245
+ }) {
246
+ if (lifecycle?.beforeHandle) {
247
+ await lifecycle.beforeHandle(ctx, method);
248
+ }
249
+ let data = await method.handler(ctx);
250
+ if (method.stream !== undefined)
251
+ return { ok: true, data };
252
+ if (lifecycle?.afterHandle) {
253
+ const transformed = await lifecycle.afterHandle(ctx, data, method);
254
+ if (transformed !== undefined)
255
+ data = transformed;
256
+ }
257
+ const checked = validateDeclaredOutput(method.outputSchema, data, onOutputStrip);
258
+ if (checked.ok) {
259
+ data = checked.data;
260
+ } else {
261
+ const verdict = checked.error && method.outputSchema ? localVerdict(method.outputSchema, checked.error) : undefined;
262
+ if (verdict !== null) {
263
+ const message = verdict && verdict !== checked.error ? `Handler output does not match the contract: ${formatZodError2(verdict)}` : checked.message;
264
+ return {
265
+ ok: false,
266
+ code: "INTERNAL_SERVER_ERROR",
267
+ details: { message }
268
+ };
269
+ }
270
+ }
271
+ if (toolSurface && method.toolView && method.outputSchema) {
272
+ const viewed = projectToolView({
273
+ view: method.toolView,
274
+ fullSchema: method.outputSchema,
275
+ full: data,
276
+ call: { input, source },
277
+ operation: `${method.serviceName}.${method.key}`,
278
+ onStripped: onOutputStrip
279
+ });
280
+ if (!viewed.ok) {
281
+ return {
282
+ ok: false,
283
+ code: "INTERNAL_SERVER_ERROR",
284
+ details: { message: viewed.message }
285
+ };
286
+ }
287
+ data = viewed.data;
288
+ }
289
+ if (finalizeOutput)
290
+ data = await finalizeOutput(data);
291
+ const output = (data === undefined || data === null) && !method.outputSchema ? { status: "ok" } : data;
292
+ return { ok: true, data: output };
293
+ }
294
+ async function resolveToolExtension(extension, keys, rawArgs, context) {
295
+ const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
296
+ let parsed;
297
+ try {
298
+ parsed = extension.schema.safeParse(extensionArgs);
299
+ } catch (err) {
300
+ return { thrown: err };
301
+ }
302
+ if (!parsed.success)
303
+ return { invalid: formatZodError2(parsed.error) };
304
+ try {
305
+ const resolved = await extension.resolve({ ...rawArgs, ...parsed.data });
306
+ return {
307
+ context: {
308
+ ...context,
309
+ ...resolved,
310
+ source: context.source,
311
+ ...context.mcp !== undefined && { mcp: context.mcp },
312
+ ...context.toolCallId !== undefined && { toolCallId: context.toolCallId }
313
+ },
314
+ args: Object.fromEntries(Object.entries(rawArgs).filter(([key]) => !keys.has(key)))
315
+ };
316
+ } catch (err) {
317
+ return { thrown: err };
318
+ }
319
+ }
320
+
239
321
  // src/tools/execute-result.ts
240
322
  var normalizedToolErrors = new WeakMap;
241
323
  function toolResultFromError(err) {
@@ -324,86 +406,6 @@ function inToolCallContext(call, body) {
324
406
  action: call.method.key
325
407
  }, body);
326
408
  }
327
- async function invokeToolHandler(method, ctx, input, source, {
328
- lifecycle,
329
- onOutputStrip,
330
- finalizeOutput,
331
- toolSurface
332
- }) {
333
- if (lifecycle?.beforeHandle) {
334
- await lifecycle.beforeHandle(ctx, method);
335
- }
336
- let data = await method.handler(ctx);
337
- if (method.stream !== undefined)
338
- return { ok: true, data };
339
- if (lifecycle?.afterHandle) {
340
- const transformed = await lifecycle.afterHandle(ctx, data, method);
341
- if (transformed !== undefined)
342
- data = transformed;
343
- }
344
- const checked = validateDeclaredOutput(method.outputSchema, data, onOutputStrip);
345
- if (checked.ok) {
346
- data = checked.data;
347
- } else {
348
- const verdict = checked.error && method.outputSchema ? localVerdict(method.outputSchema, checked.error) : undefined;
349
- if (verdict !== null) {
350
- const message = verdict && verdict !== checked.error ? `Handler output does not match the contract: ${formatZodError2(verdict)}` : checked.message;
351
- return {
352
- ok: false,
353
- code: "INTERNAL_SERVER_ERROR",
354
- details: { message }
355
- };
356
- }
357
- }
358
- if (toolSurface && method.toolView && method.outputSchema) {
359
- const viewed = projectToolView({
360
- view: method.toolView,
361
- fullSchema: method.outputSchema,
362
- full: data,
363
- call: { input, source },
364
- operation: `${method.serviceName}.${method.key}`,
365
- onStripped: onOutputStrip
366
- });
367
- if (!viewed.ok) {
368
- return {
369
- ok: false,
370
- code: "INTERNAL_SERVER_ERROR",
371
- details: { message: viewed.message }
372
- };
373
- }
374
- data = viewed.data;
375
- }
376
- if (finalizeOutput)
377
- data = await finalizeOutput(data);
378
- const output = (data === undefined || data === null) && !method.outputSchema ? { status: "ok" } : data;
379
- return { ok: true, data: output };
380
- }
381
- async function resolveToolExtension(extension, keys, rawArgs, context) {
382
- const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
383
- let parsed;
384
- try {
385
- parsed = extension.schema.safeParse(extensionArgs);
386
- } catch (err) {
387
- return { thrown: err };
388
- }
389
- if (!parsed.success)
390
- return { invalid: formatZodError2(parsed.error) };
391
- try {
392
- const resolved = await extension.resolve({ ...rawArgs, ...parsed.data });
393
- return {
394
- context: {
395
- ...context,
396
- ...resolved,
397
- source: context.source,
398
- ...context.mcp !== undefined && { mcp: context.mcp },
399
- ...context.toolCallId !== undefined && { toolCallId: context.toolCallId }
400
- },
401
- args: Object.fromEntries(Object.entries(rawArgs).filter(([key]) => !keys.has(key)))
402
- };
403
- } catch (err) {
404
- return { thrown: err };
405
- }
406
- }
407
409
  async function runToolMethod(method, { toolName, rawArgs, context }, {
408
410
  hooks,
409
411
  lifecycle,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  projectToolSurface
3
- } from "./index-84tp547a.js";
3
+ } from "./index-edpkm3k7.js";
4
4
  import {
5
5
  contractToolMountable
6
- } from "./index-d4at0q09.js";
6
+ } from "./index-b9mj31q7.js";
7
7
  import {
8
8
  runtimeToolMountable
9
9
  } from "./index-7csn6pva.js";
@@ -220,108 +220,6 @@ var CodexThreadRevertResponseSchema = z.looseObject({
220
220
  turnsBackwardsCursor: z.string().nullable().optional(),
221
221
  itemsBackwardsCursor: z.string().nullable().optional()
222
222
  });
223
- var CodexApprovalParamsSchema = z.looseObject({
224
- threadId: z.string().optional(),
225
- turnId: z.string().optional(),
226
- itemId: z.string(),
227
- command: z.string().nullable().optional(),
228
- cwd: z.string().nullable().optional(),
229
- reason: z.string().nullable().optional(),
230
- grantRoot: z.string().nullable().optional(),
231
- kind: z.string().nullable().optional(),
232
- approvalId: z.string().nullable().optional(),
233
- startedAtMs: z.number().int().nullable().optional(),
234
- commandActions: z.array(JsonRpcValueSchema2).nullable().optional(),
235
- availableDecisions: z.array(JsonRpcValueSchema2).nullable().optional()
236
- });
237
- var CodexUserInputOptionSchema = z.looseObject({
238
- label: z.string(),
239
- description: z.string()
240
- });
241
- var CodexUserInputQuestionSchema = z.looseObject({
242
- id: z.string(),
243
- question: z.string(),
244
- header: z.string(),
245
- isOther: z.boolean().optional(),
246
- isSecret: z.boolean().optional(),
247
- options: z.array(CodexUserInputOptionSchema).nullable().optional()
248
- });
249
- var CodexUserInputParamsSchema = z.looseObject({
250
- threadId: z.string().optional(),
251
- turnId: z.string().optional(),
252
- itemId: z.string(),
253
- questions: z.array(CodexUserInputQuestionSchema)
254
- });
255
- var CodexUserInputAnswersSchema = z.record(z.string(), z.strictObject({ answers: z.array(z.string()) }));
256
- var CodexPermissionProfileSchema = z.looseObject({
257
- fileSystem: JsonRpcValueSchema2.nullable().optional(),
258
- network: JsonRpcValueSchema2.nullable().optional()
259
- });
260
- var CodexPermissionsApprovalParamsSchema = z.looseObject({
261
- threadId: z.string(),
262
- turnId: z.string(),
263
- itemId: z.string(),
264
- cwd: z.string(),
265
- permissions: CodexPermissionProfileSchema,
266
- startedAtMs: z.number().int(),
267
- reason: z.string().nullable().optional(),
268
- environmentId: z.string().nullable().optional()
269
- });
270
- var CodexMcpElicitationBaseFields = {
271
- serverName: z.string(),
272
- threadId: z.string(),
273
- turnId: z.string().nullable().optional(),
274
- environmentId: z.string().nullable().optional(),
275
- message: z.string(),
276
- _meta: JsonRpcValueSchema2.optional()
277
- };
278
- var CodexMcpElicitationFormSchemaSchema = z.looseObject({
279
- type: z.literal("object"),
280
- properties: z.record(z.string(), JsonRpcValueSchema2),
281
- required: z.array(z.string()).nullable().optional(),
282
- $schema: z.string().nullable().optional()
283
- });
284
- var CodexMcpElicitationParamsSchema = z.discriminatedUnion("mode", [
285
- z.looseObject({
286
- ...CodexMcpElicitationBaseFields,
287
- mode: z.literal("form"),
288
- requestedSchema: CodexMcpElicitationFormSchemaSchema
289
- }),
290
- z.looseObject({
291
- ...CodexMcpElicitationBaseFields,
292
- mode: z.literal("openai/form"),
293
- requestedSchema: JsonRpcValueSchema2
294
- }),
295
- z.looseObject({
296
- ...CodexMcpElicitationBaseFields,
297
- mode: z.literal("openaiForm"),
298
- requestedSchema: JsonRpcValueSchema2
299
- }),
300
- z.looseObject({
301
- ...CodexMcpElicitationBaseFields,
302
- mode: z.literal("url"),
303
- elicitationId: z.string(),
304
- url: z.string()
305
- })
306
- ]);
307
- var CodexMcpElicitationAnswerSchema = z.strictObject({
308
- action: z.enum(["accept", "decline", "cancel"]),
309
- content: JsonRpcValueSchema2.optional(),
310
- _meta: JsonRpcValueSchema2.optional()
311
- });
312
- var CODEX_APPROVAL_REQUESTS = new Set([
313
- "item/commandExecution/requestApproval",
314
- "item/fileChange/requestApproval"
315
- ]);
316
- var CODEX_PERMISSIONS_APPROVAL_REQUEST = "item/permissions/requestApproval";
317
- var CODEX_INPUT_REQUEST = "item/tool/requestUserInput";
318
- var CODEX_ELICITATION_REQUEST = "mcpServer/elicitation/request";
319
- var CODEX_APPROVAL_DECISION = {
320
- approve: "accept",
321
- approveForSession: "acceptForSession",
322
- deny: "decline",
323
- interrupted: "cancel"
324
- };
325
223
 
326
224
  // src/agent-executor/codex/capabilities.ts
327
225
  function codexDriverCapabilities(options) {
@@ -346,4 +244,4 @@ function codexSharedServerCapabilities(driver) {
346
244
  return { ...driver, multiThreadPerProcess: true };
347
245
  }
348
246
 
349
- export { CodexProtocolError2, parseCodexResponse, unknownTypedRecordSchema, CodexApprovalPolicySchema2, CodexSandboxModeSchema2, CodexSandboxPolicySchema2, CodexThreadStatusSchema2, CodexTurnStatusSchema2, CodexTurnItemsViewSchema2, CODEX_THREAD_SOURCE_KINDS2, CodexThreadSourceKindSchema2, CodexCollaborationModeSchema2, CodexThreadItemSchema2, CodexTurnSchema, CodexListedTurnSchema2, CodexTurnsPageSchema2, CodexThreadSchema2, CodexThreadContextSchema2, CodexInitializeResponseSchema, CodexStartedThreadSchema, extractCodexThreadContext, CodexStartedTurnSchema, CodexTurnSteerResponseSchema, CodexThreadRevertResponseSchema, CodexApprovalParamsSchema, CodexUserInputParamsSchema, CodexUserInputAnswersSchema, CodexPermissionsApprovalParamsSchema, CodexMcpElicitationParamsSchema, CodexMcpElicitationAnswerSchema, CODEX_APPROVAL_REQUESTS, CODEX_PERMISSIONS_APPROVAL_REQUEST, CODEX_INPUT_REQUEST, CODEX_ELICITATION_REQUEST, CODEX_APPROVAL_DECISION, codexDriverCapabilities, codexSharedServerCapabilities };
247
+ export { CodexProtocolError2, parseCodexResponse, unknownTypedRecordSchema, CodexApprovalPolicySchema2, CodexSandboxModeSchema2, CodexSandboxPolicySchema2, CodexThreadStatusSchema2, CodexTurnStatusSchema2, CodexTurnItemsViewSchema2, CODEX_THREAD_SOURCE_KINDS2, CodexThreadSourceKindSchema2, CodexCollaborationModeSchema2, CodexThreadItemSchema2, CodexTurnSchema, CodexListedTurnSchema2, CodexTurnsPageSchema2, CodexThreadSchema2, CodexThreadContextSchema2, CodexInitializeResponseSchema, CodexStartedThreadSchema, extractCodexThreadContext, CodexStartedTurnSchema, CodexTurnSteerResponseSchema, CodexThreadRevertResponseSchema, codexDriverCapabilities, codexSharedServerCapabilities };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  keepFormatName
3
- } from "./index-gk6dq9ay.js";
3
+ } from "./index-ha1tv70k.js";
4
4
 
5
5
  // src/json-schema/json-schema.ts
6
6
  import { z } from "zod";
@@ -7,7 +7,7 @@ import {
7
7
  AgentRecordVersionSchema2,
8
8
  AgentTimestampSchema2,
9
9
  AgentMessageSchema2
10
- } from "./index-j3r7r1mh.js";
10
+ } from "./index-yv7d6tav.js";
11
11
  import {
12
12
  AgentCodingToolAuthorizationSchema2,
13
13
  ShellOutputSchema,
@@ -23,7 +23,7 @@ import {
23
23
  runStateForTerminalReason2,
24
24
  AgentRunSchema2,
25
25
  AgentSnapshotSchema2
26
- } from "./index-pd9e8rz4.js";
26
+ } from "./index-gvv7y0s4.js";
27
27
  import {
28
28
  PurgeInvocationPayloadsInputSchema2,
29
29
  PurgeInvocationPayloadsResultSchema2,
@@ -60,7 +60,7 @@ import {
60
60
  AgentSeedReceiptSchema2,
61
61
  isActiveRunState,
62
62
  emptyHead
63
- } from "./index-qcy8et93.js";
63
+ } from "./index-kaq9nb7h.js";
64
64
  import {
65
65
  StepEventPayloadSchema,
66
66
  ParkEventPayloadSchema,
@@ -70,6 +70,9 @@ import {
70
70
  import {
71
71
  assistantStatus
72
72
  } from "./index-kgj8j7bv.js";
73
+ import {
74
+ setOwnMember
75
+ } from "./index-3tb82xr7.js";
73
76
  import {
74
77
  assertPositiveSafeInteger
75
78
  } from "./index-gr0kxymw.js";
@@ -2108,7 +2111,7 @@ function branchOpaqueRecord(ids, value, path = "") {
2108
2111
  for (const [key, entry] of Object.entries(value)) {
2109
2112
  const at = path ? `${path}.${key}` : key;
2110
2113
  if (!RUNTIME_REFERENCE_KEYS.has(key)) {
2111
- out[key] = branchOpaqueJson(ids, entry, at);
2114
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2112
2115
  continue;
2113
2116
  }
2114
2117
  const mode = ids.applicationKey(key);
@@ -2119,14 +2122,14 @@ function branchOpaqueRecord(ids, value, path = "") {
2119
2122
  key,
2120
2123
  path: at
2121
2124
  });
2122
- out[key] = branchOpaqueJson(ids, entry, at);
2125
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2123
2126
  continue;
2124
2127
  }
2125
2128
  if (mode === "rekey-spill") {
2126
2129
  if (typeof entry === "string") {
2127
2130
  const kinds = ids.sourceIdentitiesOf(entry);
2128
2131
  if (kinds.size === 1 && kinds.has("spill")) {
2129
- out[key] = ids.reference("spill", entry);
2132
+ setOwnMember(out, key, ids.reference("spill", entry));
2130
2133
  } else {
2131
2134
  ids.refuse({
2132
2135
  code: "application-key-source-identity",
@@ -2134,10 +2137,10 @@ function branchOpaqueRecord(ids, value, path = "") {
2134
2137
  key,
2135
2138
  path: at
2136
2139
  });
2137
- out[key] = entry;
2140
+ setOwnMember(out, key, entry);
2138
2141
  }
2139
2142
  } else {
2140
- out[key] = branchOpaqueJson(ids, entry, at);
2143
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2141
2144
  }
2142
2145
  continue;
2143
2146
  }
@@ -2154,7 +2157,7 @@ function branchOpaqueRecord(ids, value, path = "") {
2154
2157
  break;
2155
2158
  }
2156
2159
  }
2157
- out[key] = branchOpaqueJson(ids, entry, at);
2160
+ setOwnMember(out, key, branchOpaqueJson(ids, entry, at));
2158
2161
  }
2159
2162
  return out;
2160
2163
  }
@@ -2177,14 +2180,16 @@ function branchPartAt(ids, part) {
2177
2180
  callId: ids.reference("call", part.callId),
2178
2181
  input: branchToolJson(ids, part.toolName, part.input, false)
2179
2182
  };
2180
- case "tool-result":
2183
+ case "tool-result": {
2184
+ const { modelOutput: _shownInSource, ...result } = part;
2181
2185
  return {
2182
- ...part,
2186
+ ...result,
2183
2187
  callId: ids.reference("call", part.callId),
2184
2188
  ...part.output !== undefined && {
2185
2189
  output: part.outcome === "success" ? branchToolJson(ids, part.toolName, part.output, true) : branchOpaqueJson(ids, part.output)
2186
2190
  }
2187
2191
  };
2192
+ }
2188
2193
  case "tool-approval-request":
2189
2194
  return {
2190
2195
  type: part.type,