stitchkit 0.126.0 → 0.128.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 (1260) hide show
  1. package/CHANGELOG.md +1767 -0
  2. package/README.md +12 -4
  3. package/dist/agent-executor/acp/scenarios.d.ts +4 -0
  4. package/dist/agent-executor/acp/scenarios.d.ts.map +1 -0
  5. package/dist/agent-executor/acp/v1-connect.d.ts +97 -0
  6. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -0
  7. package/dist/agent-executor/acp/v1-driver.d.ts +37 -0
  8. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -0
  9. package/dist/agent-executor/acp/v1-map.d.ts +41 -0
  10. package/dist/agent-executor/acp/v1-map.d.ts.map +1 -0
  11. package/dist/agent-executor/acp/v1-protocol.d.ts +270 -0
  12. package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -0
  13. package/dist/agent-executor/acp/v1-session.d.ts +30 -0
  14. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -0
  15. package/dist/agent-executor/acp/v1-turn.d.ts +25 -0
  16. package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -0
  17. package/dist/agent-executor/claude/classify.d.ts +54 -0
  18. package/dist/agent-executor/claude/classify.d.ts.map +1 -0
  19. package/dist/agent-executor/claude/cli-driver.d.ts +31 -0
  20. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -0
  21. package/dist/agent-executor/claude/limits.d.ts +8 -0
  22. package/dist/agent-executor/claude/limits.d.ts.map +1 -0
  23. package/dist/agent-executor/claude/protocol.d.ts +206 -0
  24. package/dist/agent-executor/claude/protocol.d.ts.map +1 -0
  25. package/dist/agent-executor/claude/scenarios.d.ts +4 -0
  26. package/dist/agent-executor/claude/scenarios.d.ts.map +1 -0
  27. package/dist/agent-executor/claude/session.d.ts +23 -0
  28. package/dist/agent-executor/claude/session.d.ts.map +1 -0
  29. package/dist/agent-executor/claude/transcript.d.ts +36 -0
  30. package/dist/agent-executor/claude/transcript.d.ts.map +1 -0
  31. package/dist/agent-executor/claude-sdk/driver.d.ts +35 -0
  32. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -0
  33. package/dist/agent-executor/claude-sdk/session.d.ts +10 -0
  34. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -0
  35. package/dist/agent-executor/codex/classify.d.ts +28 -0
  36. package/dist/agent-executor/codex/classify.d.ts.map +1 -0
  37. package/dist/agent-executor/codex/driver.d.ts +27 -0
  38. package/dist/agent-executor/codex/driver.d.ts.map +1 -0
  39. package/dist/agent-executor/codex/limits.d.ts +4 -0
  40. package/dist/agent-executor/codex/limits.d.ts.map +1 -0
  41. package/dist/agent-executor/codex/protocol.d.ts +176 -0
  42. package/dist/agent-executor/codex/protocol.d.ts.map +1 -0
  43. package/dist/agent-executor/codex/scenarios.d.ts +4 -0
  44. package/dist/agent-executor/codex/scenarios.d.ts.map +1 -0
  45. package/dist/agent-executor/codex/session.d.ts +43 -0
  46. package/dist/agent-executor/codex/session.d.ts.map +1 -0
  47. package/dist/agent-executor/contract.d.ts +454 -0
  48. package/dist/agent-executor/contract.d.ts.map +1 -0
  49. package/dist/agent-executor/dispatch.d.ts +41 -0
  50. package/dist/agent-executor/dispatch.d.ts.map +1 -0
  51. package/dist/agent-executor/engine-process.d.ts +45 -0
  52. package/dist/agent-executor/engine-process.d.ts.map +1 -0
  53. package/dist/agent-executor/engine-requests.d.ts +63 -0
  54. package/dist/agent-executor/engine-requests.d.ts.map +1 -0
  55. package/dist/agent-executor/engine.d.ts +64 -0
  56. package/dist/agent-executor/engine.d.ts.map +1 -0
  57. package/dist/agent-executor/executor-contract.d.ts +387 -0
  58. package/dist/agent-executor/executor-contract.d.ts.map +1 -0
  59. package/dist/agent-executor/executor-machine.d.ts +50 -0
  60. package/dist/agent-executor/executor-machine.d.ts.map +1 -0
  61. package/dist/agent-executor/hello.d.ts +235 -0
  62. package/dist/agent-executor/hello.d.ts.map +1 -0
  63. package/dist/agent-executor/image-input.d.ts +71 -0
  64. package/dist/agent-executor/image-input.d.ts.map +1 -0
  65. package/dist/agent-executor/json-rpc-peer.d.ts +48 -0
  66. package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -0
  67. package/dist/agent-executor/leases.d.ts +159 -0
  68. package/dist/agent-executor/leases.d.ts.map +1 -0
  69. package/dist/agent-executor/plan-limits.d.ts +25 -0
  70. package/dist/agent-executor/plan-limits.d.ts.map +1 -0
  71. package/dist/agent-executor/profile.d.ts +52 -0
  72. package/dist/agent-executor/profile.d.ts.map +1 -0
  73. package/dist/agent-executor/projection.d.ts +14 -0
  74. package/dist/agent-executor/projection.d.ts.map +1 -0
  75. package/dist/agent-executor/session-primitives.d.ts +69 -0
  76. package/dist/agent-executor/session-primitives.d.ts.map +1 -0
  77. package/dist/agent-executor/testing/conformance.d.ts +55 -0
  78. package/dist/agent-executor/testing/conformance.d.ts.map +1 -0
  79. package/dist/agent-executor/testing/fake-claude-engine.d.ts +18 -0
  80. package/dist/agent-executor/testing/fake-claude-engine.d.ts.map +1 -0
  81. package/dist/agent-executor/testing/fake-engine.d.ts +52 -0
  82. package/dist/agent-executor/testing/fake-engine.d.ts.map +1 -0
  83. package/dist/agent-executor/turn-phases.d.ts +10 -0
  84. package/dist/agent-executor/turn-phases.d.ts.map +1 -0
  85. package/dist/agent-executor/vocabulary.d.ts +353 -0
  86. package/dist/agent-executor/vocabulary.d.ts.map +1 -0
  87. package/dist/agent-parts/parts.d.ts +160 -0
  88. package/dist/agent-parts/parts.d.ts.map +1 -0
  89. package/dist/agent-runtime/agent-tool.d.ts +22 -8
  90. package/dist/agent-runtime/agent-tool.d.ts.map +1 -1
  91. package/dist/agent-runtime/archive-projection.d.ts +5 -0
  92. package/dist/agent-runtime/archive-projection.d.ts.map +1 -1
  93. package/dist/agent-runtime/branch-contract.d.ts +60 -2
  94. package/dist/agent-runtime/branch-contract.d.ts.map +1 -1
  95. package/dist/agent-runtime/branch-events.d.ts +7 -0
  96. package/dist/agent-runtime/branch-events.d.ts.map +1 -1
  97. package/dist/agent-runtime/branch-identities.d.ts +43 -6
  98. package/dist/agent-runtime/branch-identities.d.ts.map +1 -1
  99. package/dist/agent-runtime/branch-messages.d.ts +11 -29
  100. package/dist/agent-runtime/branch-messages.d.ts.map +1 -1
  101. package/dist/agent-runtime/branch-observations.d.ts +153 -30
  102. package/dist/agent-runtime/branch-observations.d.ts.map +1 -1
  103. package/dist/agent-runtime/branch-provider.d.ts +43 -56
  104. package/dist/agent-runtime/branch-provider.d.ts.map +1 -1
  105. package/dist/agent-runtime/branch-refusal.d.ts +60 -0
  106. package/dist/agent-runtime/branch-refusal.d.ts.map +1 -0
  107. package/dist/agent-runtime/branch-runtime-tools.d.ts +14 -0
  108. package/dist/agent-runtime/branch-runtime-tools.d.ts.map +1 -0
  109. package/dist/agent-runtime/branch-source.d.ts +19 -2
  110. package/dist/agent-runtime/branch-source.d.ts.map +1 -1
  111. package/dist/agent-runtime/branch-transitions.d.ts.map +1 -1
  112. package/dist/agent-runtime/browser-control-contract.d.ts +2 -2
  113. package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
  114. package/dist/agent-runtime/child-blocking.d.ts +17 -6
  115. package/dist/agent-runtime/child-blocking.d.ts.map +1 -1
  116. package/dist/agent-runtime/child-budget-policy.d.ts +4 -9
  117. package/dist/agent-runtime/child-budget-policy.d.ts.map +1 -1
  118. package/dist/agent-runtime/child-tools.d.ts +82 -7
  119. package/dist/agent-runtime/child-tools.d.ts.map +1 -1
  120. package/dist/agent-runtime/children-contract.d.ts +84 -3
  121. package/dist/agent-runtime/children-contract.d.ts.map +1 -1
  122. package/dist/agent-runtime/children-control.d.ts +23 -2
  123. package/dist/agent-runtime/children-control.d.ts.map +1 -1
  124. package/dist/agent-runtime/children-spawn.d.ts +9 -0
  125. package/dist/agent-runtime/children-spawn.d.ts.map +1 -1
  126. package/dist/agent-runtime/children-state.d.ts +121 -19
  127. package/dist/agent-runtime/children-state.d.ts.map +1 -1
  128. package/dist/agent-runtime/children-usage.d.ts +10 -1
  129. package/dist/agent-runtime/children-usage.d.ts.map +1 -1
  130. package/dist/agent-runtime/children.d.ts +3 -3
  131. package/dist/agent-runtime/children.d.ts.map +1 -1
  132. package/dist/agent-runtime/{sandbox-coding.d.ts → coding-sandbox.d.ts} +2 -9
  133. package/dist/agent-runtime/coding-sandbox.d.ts.map +1 -0
  134. package/dist/agent-runtime/coding-shell-process.d.ts +2 -0
  135. package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
  136. package/dist/agent-runtime/coding-tool-contract.d.ts +32 -1
  137. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  138. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  139. package/dist/agent-runtime/coding-tools.d.ts.map +1 -1
  140. package/dist/agent-runtime/compaction.d.ts.map +1 -1
  141. package/dist/agent-runtime/companion-host.d.ts +38 -0
  142. package/dist/agent-runtime/companion-host.d.ts.map +1 -0
  143. package/dist/agent-runtime/context-issue.d.ts +5 -0
  144. package/dist/agent-runtime/context-issue.d.ts.map +1 -0
  145. package/dist/agent-runtime/control-schema.d.ts +2 -2
  146. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  147. package/dist/agent-runtime/conversations.d.ts.map +1 -1
  148. package/dist/agent-runtime/coordinator.d.ts.map +1 -1
  149. package/dist/agent-runtime/deferred-tool-types.d.ts +17 -5
  150. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  151. package/dist/agent-runtime/deferred-tools-internal.d.ts +2 -0
  152. package/dist/agent-runtime/deferred-tools-internal.d.ts.map +1 -1
  153. package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
  154. package/dist/agent-runtime/event-durability.d.ts +8 -0
  155. package/dist/agent-runtime/event-durability.d.ts.map +1 -0
  156. package/dist/agent-runtime/event-schema.d.ts +13 -5
  157. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  158. package/dist/agent-runtime/event-search-postgres.d.ts +38 -0
  159. package/dist/agent-runtime/event-search-postgres.d.ts.map +1 -0
  160. package/dist/agent-runtime/event-search-terms.d.ts +37 -0
  161. package/dist/agent-runtime/event-search-terms.d.ts.map +1 -0
  162. package/dist/agent-runtime/event-search-tools.d.ts +141 -4
  163. package/dist/agent-runtime/event-search-tools.d.ts.map +1 -1
  164. package/dist/agent-runtime/event-search.d.ts +16 -3
  165. package/dist/agent-runtime/event-search.d.ts.map +1 -1
  166. package/dist/agent-runtime/fault-bench.d.ts.map +1 -1
  167. package/dist/agent-runtime/harness-control.d.ts +8 -0
  168. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  169. package/dist/agent-runtime/harness-realtime.d.ts +0 -2
  170. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
  171. package/dist/agent-runtime/invocation-attempt.d.ts +1 -1
  172. package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -1
  173. package/dist/agent-runtime/invocation-payload.d.ts +12 -0
  174. package/dist/agent-runtime/invocation-payload.d.ts.map +1 -1
  175. package/dist/agent-runtime/invocation-read.d.ts +6 -3
  176. package/dist/agent-runtime/invocation-read.d.ts.map +1 -1
  177. package/dist/agent-runtime/invocation-schema.d.ts +70 -5
  178. package/dist/agent-runtime/invocation-schema.d.ts.map +1 -1
  179. package/dist/agent-runtime/invocation-spend.d.ts +9 -0
  180. package/dist/agent-runtime/invocation-spend.d.ts.map +1 -0
  181. package/dist/agent-runtime/invocations.d.ts +20 -9
  182. package/dist/agent-runtime/invocations.d.ts.map +1 -1
  183. package/dist/agent-runtime/managed-tools.d.ts +2 -2
  184. package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
  185. package/dist/agent-runtime/observability.d.ts +42 -4
  186. package/dist/agent-runtime/observability.d.ts.map +1 -1
  187. package/dist/agent-runtime/openrouter-admission.d.ts +81 -0
  188. package/dist/agent-runtime/openrouter-admission.d.ts.map +1 -0
  189. package/dist/agent-runtime/openrouter-catalog.d.ts +83 -0
  190. package/dist/agent-runtime/openrouter-catalog.d.ts.map +1 -0
  191. package/dist/agent-runtime/openrouter-models.d.ts +66 -0
  192. package/dist/agent-runtime/openrouter-models.d.ts.map +1 -0
  193. package/dist/agent-runtime/openrouter-options.d.ts +106 -0
  194. package/dist/agent-runtime/openrouter-options.d.ts.map +1 -0
  195. package/dist/agent-runtime/openrouter-route.d.ts +50 -0
  196. package/dist/agent-runtime/openrouter-route.d.ts.map +1 -0
  197. package/dist/agent-runtime/openrouter-spend.d.ts +24 -0
  198. package/dist/agent-runtime/openrouter-spend.d.ts.map +1 -0
  199. package/dist/agent-runtime/openrouter.d.ts +23 -2
  200. package/dist/agent-runtime/openrouter.d.ts.map +1 -1
  201. package/dist/agent-runtime/owned-provider-stream.d.ts.map +1 -1
  202. package/dist/agent-runtime/postgres-schema.d.ts +34 -0
  203. package/dist/agent-runtime/postgres-schema.d.ts.map +1 -0
  204. package/dist/agent-runtime/postgres-transactions.d.ts +54 -0
  205. package/dist/agent-runtime/postgres-transactions.d.ts.map +1 -0
  206. package/dist/agent-runtime/postgres.d.ts +72 -0
  207. package/dist/agent-runtime/postgres.d.ts.map +1 -0
  208. package/dist/agent-runtime/projections.d.ts +57 -17
  209. package/dist/agent-runtime/projections.d.ts.map +1 -1
  210. package/dist/agent-runtime/provider-journal.d.ts +57 -0
  211. package/dist/agent-runtime/provider-journal.d.ts.map +1 -1
  212. package/dist/agent-runtime/purge.d.ts.map +1 -1
  213. package/dist/agent-runtime/retry-policy.d.ts +6 -0
  214. package/dist/agent-runtime/retry-policy.d.ts.map +1 -1
  215. package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
  216. package/dist/agent-runtime/run-execution-state.d.ts +26 -2
  217. package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
  218. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  219. package/dist/agent-runtime/run-failure.d.ts.map +1 -1
  220. package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
  221. package/dist/agent-runtime/run-provider-ledger.d.ts +2 -0
  222. package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
  223. package/dist/agent-runtime/run-step-barriers.d.ts +72 -0
  224. package/dist/agent-runtime/run-step-barriers.d.ts.map +1 -0
  225. package/dist/agent-runtime/run-step-spend.d.ts +319 -0
  226. package/dist/agent-runtime/run-step-spend.d.ts.map +1 -0
  227. package/dist/agent-runtime/run-stream-parts.d.ts +2 -0
  228. package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -1
  229. package/dist/agent-runtime/{tool-progress.d.ts → run-tool-progress.d.ts} +1 -1
  230. package/dist/agent-runtime/run-tool-progress.d.ts.map +1 -0
  231. package/dist/agent-runtime/run-turn-preparation.d.ts +3 -1
  232. package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -1
  233. package/dist/agent-runtime/runtime-admission-gate.d.ts +0 -14
  234. package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -1
  235. package/dist/agent-runtime/runtime-internals.d.ts +6 -0
  236. package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
  237. package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
  238. package/dist/agent-runtime/runtime.d.ts +31 -2
  239. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  240. package/dist/agent-runtime/sandbox-binding.d.ts +10 -0
  241. package/dist/agent-runtime/sandbox-binding.d.ts.map +1 -0
  242. package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts.map +1 -1
  243. package/dist/agent-runtime/sandbox-contract.d.ts +1 -1
  244. package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
  245. package/dist/agent-runtime/sandbox.d.ts +5 -0
  246. package/dist/agent-runtime/sandbox.d.ts.map +1 -1
  247. package/dist/agent-runtime/schedule-contract.d.ts +3 -2
  248. package/dist/agent-runtime/schedule-contract.d.ts.map +1 -1
  249. package/dist/agent-runtime/schedule-dispatch.d.ts +3 -2
  250. package/dist/agent-runtime/schedule-dispatch.d.ts.map +1 -1
  251. package/dist/agent-runtime/schedule-records.d.ts +6 -6
  252. package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
  253. package/dist/agent-runtime/schedule-tools.d.ts +49 -8
  254. package/dist/agent-runtime/schedule-tools.d.ts.map +1 -1
  255. package/dist/agent-runtime/schedules.d.ts +13 -3
  256. package/dist/agent-runtime/schedules.d.ts.map +1 -1
  257. package/dist/agent-runtime/schemas-invocation-payload.d.ts +48 -0
  258. package/dist/agent-runtime/schemas-invocation-payload.d.ts.map +1 -0
  259. package/dist/agent-runtime/schemas-message.d.ts +118 -0
  260. package/dist/agent-runtime/schemas-message.d.ts.map +1 -0
  261. package/dist/agent-runtime/schemas-provider.d.ts +8 -0
  262. package/dist/agent-runtime/schemas-provider.d.ts.map +1 -0
  263. package/dist/agent-runtime/schemas-records.d.ts +5 -0
  264. package/dist/agent-runtime/schemas-records.d.ts.map +1 -0
  265. package/dist/agent-runtime/schemas-run.d.ts +487 -0
  266. package/dist/agent-runtime/schemas-run.d.ts.map +1 -0
  267. package/dist/agent-runtime/schemas-usage.d.ts +129 -0
  268. package/dist/agent-runtime/schemas-usage.d.ts.map +1 -0
  269. package/dist/agent-runtime/schemas.d.ts +11 -886
  270. package/dist/agent-runtime/schemas.d.ts.map +1 -1
  271. package/dist/agent-runtime/spill.d.ts +9 -7
  272. package/dist/agent-runtime/spill.d.ts.map +1 -1
  273. package/dist/agent-runtime/sql-events.d.ts +6 -0
  274. package/dist/agent-runtime/sql-events.d.ts.map +1 -0
  275. package/dist/agent-runtime/sql-history.d.ts +8 -0
  276. package/dist/agent-runtime/sql-history.d.ts.map +1 -0
  277. package/dist/agent-runtime/sql-ledger.d.ts +5 -0
  278. package/dist/agent-runtime/sql-ledger.d.ts.map +1 -0
  279. package/dist/agent-runtime/sql-purge.d.ts +13 -0
  280. package/dist/agent-runtime/sql-purge.d.ts.map +1 -0
  281. package/dist/agent-runtime/sql-reads.d.ts +16 -0
  282. package/dist/agent-runtime/sql-reads.d.ts.map +1 -0
  283. package/dist/agent-runtime/{sqlite-rows.d.ts → sql-rows.d.ts} +24 -10
  284. package/dist/agent-runtime/sql-rows.d.ts.map +1 -0
  285. package/dist/agent-runtime/sql-session.d.ts +82 -0
  286. package/dist/agent-runtime/sql-session.d.ts.map +1 -0
  287. package/dist/agent-runtime/sqlite-bun.d.ts +1 -1
  288. package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -1
  289. package/dist/agent-runtime/sqlite-node.d.ts +1 -1
  290. package/dist/agent-runtime/sqlite-node.d.ts.map +1 -1
  291. package/dist/agent-runtime/sqlite-purge.d.ts +2 -3
  292. package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
  293. package/dist/agent-runtime/sqlite-schema.d.ts +1 -1
  294. package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -1
  295. package/dist/agent-runtime/sqlite-transactions.d.ts +10 -6
  296. package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -1
  297. package/dist/agent-runtime/sqlite.d.ts +10 -29
  298. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  299. package/dist/agent-runtime/state-tools.d.ts +63 -4
  300. package/dist/agent-runtime/state-tools.d.ts.map +1 -1
  301. package/dist/agent-runtime/store-archive.d.ts.map +1 -1
  302. package/dist/agent-runtime/store-branch.d.ts +6 -1
  303. package/dist/agent-runtime/store-branch.d.ts.map +1 -1
  304. package/dist/agent-runtime/store-capabilities.d.ts +42 -0
  305. package/dist/agent-runtime/store-capabilities.d.ts.map +1 -0
  306. package/dist/agent-runtime/store-conformance-branch.d.ts +5 -2
  307. package/dist/agent-runtime/store-conformance-branch.d.ts.map +1 -1
  308. package/dist/agent-runtime/store-conformance-capabilities.d.ts +6 -0
  309. package/dist/agent-runtime/store-conformance-capabilities.d.ts.map +1 -0
  310. package/dist/agent-runtime/store-conformance-event-once.d.ts +12 -0
  311. package/dist/agent-runtime/store-conformance-event-once.d.ts.map +1 -0
  312. package/dist/agent-runtime/store-conformance-seed.d.ts +8 -0
  313. package/dist/agent-runtime/store-conformance-seed.d.ts.map +1 -0
  314. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  315. package/dist/agent-runtime/store-conformance.d.ts +31 -8
  316. package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
  317. package/dist/agent-runtime/store-create.d.ts +1 -1
  318. package/dist/agent-runtime/store-create.d.ts.map +1 -1
  319. package/dist/agent-runtime/store-driver-contract.d.ts +27 -8
  320. package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -1
  321. package/dist/agent-runtime/store-event-once.d.ts.map +1 -1
  322. package/dist/agent-runtime/store-events.d.ts +114 -0
  323. package/dist/agent-runtime/store-events.d.ts.map +1 -1
  324. package/dist/agent-runtime/store-memory-archive.d.ts +2 -0
  325. package/dist/agent-runtime/store-memory-archive.d.ts.map +1 -1
  326. package/dist/agent-runtime/store-memory-events.d.ts.map +1 -1
  327. package/dist/agent-runtime/store-memory.d.ts +2 -2
  328. package/dist/agent-runtime/store-memory.d.ts.map +1 -1
  329. package/dist/agent-runtime/store-mutate.d.ts.map +1 -1
  330. package/dist/agent-runtime/store-reduce-shared.d.ts +2 -1
  331. package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -1
  332. package/dist/agent-runtime/store-reducer.d.ts.map +1 -1
  333. package/dist/agent-runtime/store-replay.d.ts.map +1 -1
  334. package/dist/agent-runtime/store.d.ts +22 -2
  335. package/dist/agent-runtime/store.d.ts.map +1 -1
  336. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  337. package/dist/application/admission-run.d.ts.map +1 -1
  338. package/dist/application/admission.d.ts.map +1 -1
  339. package/dist/application/change-subscription.d.ts.map +1 -1
  340. package/dist/application/decisions.d.ts.map +1 -1
  341. package/dist/application/diagnostic-journal-lock-format.d.ts +9 -0
  342. package/dist/application/diagnostic-journal-lock-format.d.ts.map +1 -0
  343. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  344. package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
  345. package/dist/application/grammy-update-admission.d.ts.map +1 -1
  346. package/dist/application/health.d.ts.map +1 -1
  347. package/dist/application/kernel-admission.d.ts.map +1 -1
  348. package/dist/application/kernel-contract.d.ts.map +1 -1
  349. package/dist/application/kernel-restart.d.ts.map +1 -1
  350. package/dist/application/kernel-rollback.d.ts.map +1 -1
  351. package/dist/application/kernel-shutdown.d.ts.map +1 -1
  352. package/dist/application/kernel-state.d.ts.map +1 -1
  353. package/dist/application/notification-outbox-state.d.ts.map +1 -1
  354. package/dist/application/notification-outbox.d.ts +1 -1
  355. package/dist/application/notification-outbox.d.ts.map +1 -1
  356. package/dist/application/revision-signal.d.ts.map +1 -1
  357. package/dist/application/schedule-run.d.ts.map +1 -1
  358. package/dist/application/schedule.d.ts.map +1 -1
  359. package/dist/application/sqlite-migrations.d.ts +104 -0
  360. package/dist/application/sqlite-migrations.d.ts.map +1 -0
  361. package/dist/application/watch-hub-core.d.ts.map +1 -1
  362. package/dist/browser/bridge-errors.d.ts +24 -0
  363. package/dist/browser/bridge-errors.d.ts.map +1 -0
  364. package/dist/browser/bridge-fetch.d.ts +30 -0
  365. package/dist/browser/bridge-fetch.d.ts.map +1 -0
  366. package/dist/browser/bridge-inbound.d.ts +28 -0
  367. package/dist/browser/bridge-inbound.d.ts.map +1 -0
  368. package/dist/browser/cancellation.d.ts +10 -2
  369. package/dist/browser/cancellation.d.ts.map +1 -1
  370. package/dist/browser/chunked-upload.d.ts +1 -1
  371. package/dist/browser/chunked-upload.d.ts.map +1 -1
  372. package/dist/browser/client-call-arguments.d.ts +31 -0
  373. package/dist/browser/client-call-arguments.d.ts.map +1 -0
  374. package/dist/browser/client-executors.d.ts +6 -0
  375. package/dist/browser/client-executors.d.ts.map +1 -1
  376. package/dist/browser/client.d.ts +9 -0
  377. package/dist/browser/client.d.ts.map +1 -1
  378. package/dist/browser/http.d.ts +17 -2
  379. package/dist/browser/http.d.ts.map +1 -1
  380. package/dist/browser/realtime-client.d.ts +0 -5
  381. package/dist/browser/realtime-client.d.ts.map +1 -1
  382. package/dist/browser/session-credentials-storage.d.ts +48 -0
  383. package/dist/browser/session-credentials-storage.d.ts.map +1 -0
  384. package/dist/browser/session-credentials.d.ts +26 -5
  385. package/dist/browser/session-credentials.d.ts.map +1 -1
  386. package/dist/browser/session-refresh-policy.d.ts +124 -0
  387. package/dist/browser/session-refresh-policy.d.ts.map +1 -0
  388. package/dist/browser/session-refresh-timer.d.ts +30 -0
  389. package/dist/browser/session-refresh-timer.d.ts.map +1 -0
  390. package/dist/browser/session.d.ts.map +1 -1
  391. package/dist/browser/socket-io-connection.d.ts.map +1 -1
  392. package/dist/browser/socket-io-explicit-peer.d.ts +0 -1
  393. package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -1
  394. package/dist/browser/stream.d.ts +1 -1
  395. package/dist/browser/stream.d.ts.map +1 -1
  396. package/dist/browser/upload-progress.d.ts +3 -0
  397. package/dist/browser/upload-progress.d.ts.map +1 -1
  398. package/dist/contract/bridge-envelope.d.ts +155 -0
  399. package/dist/contract/bridge-envelope.d.ts.map +1 -0
  400. package/dist/contract/define-validation.d.ts +2 -0
  401. package/dist/contract/define-validation.d.ts.map +1 -1
  402. package/dist/contract/define.d.ts +3 -0
  403. package/dist/contract/define.d.ts.map +1 -1
  404. package/dist/contract/errors.d.ts +4 -4
  405. package/dist/contract/errors.d.ts.map +1 -1
  406. package/dist/contract/normalize.d.ts +3 -1
  407. package/dist/contract/normalize.d.ts.map +1 -1
  408. package/dist/contract/operation-effect.d.ts +29 -0
  409. package/dist/contract/operation-effect.d.ts.map +1 -0
  410. package/dist/contract/runtime-context.d.ts +2 -0
  411. package/dist/contract/runtime-context.d.ts.map +1 -1
  412. package/dist/contract/tool-options.d.ts +7 -0
  413. package/dist/contract/tool-options.d.ts.map +1 -1
  414. package/dist/declaration/command.d.ts +26 -0
  415. package/dist/declaration/command.d.ts.map +1 -0
  416. package/dist/declaration/declaration.d.ts +10 -25
  417. package/dist/declaration/declaration.d.ts.map +1 -1
  418. package/dist/declaration/machine-names.d.ts +11 -0
  419. package/dist/declaration/machine-names.d.ts.map +1 -0
  420. package/dist/durability/effect.d.ts.map +1 -1
  421. package/dist/durability/engine.d.ts.map +1 -1
  422. package/dist/durability/events.d.ts +5 -8
  423. package/dist/durability/events.d.ts.map +1 -1
  424. package/dist/durability/parks.d.ts +0 -5
  425. package/dist/durability/parks.d.ts.map +1 -1
  426. package/dist/durability/scheduler.d.ts +5 -0
  427. package/dist/durability/scheduler.d.ts.map +1 -1
  428. package/dist/entrypoints/agent-executor/acp.d.ts +4 -0
  429. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -0
  430. package/dist/entrypoints/agent-executor/acp.js +921 -0
  431. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +2 -0
  432. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -0
  433. package/dist/entrypoints/agent-executor/claude-sdk.js +325 -0
  434. package/dist/entrypoints/agent-executor/claude.d.ts +5 -0
  435. package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -0
  436. package/dist/entrypoints/agent-executor/claude.js +422 -0
  437. package/dist/entrypoints/agent-executor/codex.d.ts +4 -0
  438. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -0
  439. package/dist/entrypoints/agent-executor/codex.js +858 -0
  440. package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
  441. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -0
  442. package/dist/entrypoints/agent-executor/testing.js +375 -0
  443. package/dist/entrypoints/agent-executor.d.ts +15 -0
  444. package/dist/entrypoints/agent-executor.d.ts.map +1 -0
  445. package/dist/entrypoints/agent-executor.js +455 -0
  446. package/dist/entrypoints/agent-runtime/browser.d.ts +1 -0
  447. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -1
  448. package/dist/entrypoints/agent-runtime/browser.js +60 -30
  449. package/dist/entrypoints/agent-runtime/coding-tools.js +9 -12
  450. package/dist/entrypoints/agent-runtime/harness.js +34 -22
  451. package/dist/entrypoints/agent-runtime/openrouter.d.ts +6 -0
  452. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
  453. package/dist/entrypoints/agent-runtime/openrouter.js +675 -45
  454. package/dist/entrypoints/agent-runtime/postgres.d.ts +4 -0
  455. package/dist/entrypoints/agent-runtime/postgres.d.ts.map +1 -0
  456. package/dist/entrypoints/agent-runtime/postgres.js +335 -0
  457. package/dist/entrypoints/agent-runtime/realtime.js +46 -49
  458. package/dist/entrypoints/agent-runtime/sandbox.d.ts +3 -1
  459. package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -1
  460. package/dist/entrypoints/agent-runtime/sandbox.js +74 -67
  461. package/dist/entrypoints/agent-runtime/sqlite/bun.js +18 -18
  462. package/dist/entrypoints/agent-runtime/sqlite/node.js +18 -18
  463. package/dist/entrypoints/agent-runtime/testing.d.ts +1 -1
  464. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -1
  465. package/dist/entrypoints/agent-runtime/testing.js +394 -95
  466. package/dist/entrypoints/agent-runtime.d.ts +26 -16
  467. package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
  468. package/dist/entrypoints/agent-runtime.js +1439 -1198
  469. package/dist/entrypoints/application/diagnostic-journal.js +16 -11
  470. package/dist/entrypoints/application/directory-inbox.js +20 -14
  471. package/dist/entrypoints/application/grammy.js +11 -8
  472. package/dist/entrypoints/application/opentelemetry.js +3 -3
  473. package/dist/entrypoints/application.d.ts +4 -2
  474. package/dist/entrypoints/application.d.ts.map +1 -1
  475. package/dist/entrypoints/application.js +409 -108
  476. package/dist/entrypoints/bin/upgrade-cli.d.ts +0 -12
  477. package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
  478. package/dist/entrypoints/bin/upgrade-cli.js +11 -7
  479. package/dist/entrypoints/cli/publish.js +10 -9
  480. package/dist/entrypoints/cli.d.ts +10 -3
  481. package/dist/entrypoints/cli.d.ts.map +1 -1
  482. package/dist/entrypoints/cli.js +92 -29
  483. package/dist/entrypoints/contract.d.ts +2 -1
  484. package/dist/entrypoints/contract.d.ts.map +1 -1
  485. package/dist/entrypoints/contract.js +13 -7
  486. package/dist/entrypoints/declaration.d.ts +2 -0
  487. package/dist/entrypoints/declaration.d.ts.map +1 -1
  488. package/dist/entrypoints/declaration.js +54 -44
  489. package/dist/entrypoints/files/packaging.js +8 -5
  490. package/dist/entrypoints/files.d.ts +5 -0
  491. package/dist/entrypoints/files.d.ts.map +1 -1
  492. package/dist/entrypoints/files.js +259 -47
  493. package/dist/entrypoints/geo.js +9 -4
  494. package/dist/entrypoints/google.js +14 -13
  495. package/dist/entrypoints/handler.d.ts +12 -0
  496. package/dist/entrypoints/handler.d.ts.map +1 -0
  497. package/dist/entrypoints/handler.js +350 -0
  498. package/dist/entrypoints/http.d.ts +4 -0
  499. package/dist/entrypoints/http.d.ts.map +1 -1
  500. package/dist/entrypoints/http.js +411 -5
  501. package/dist/entrypoints/index.d.ts +2 -0
  502. package/dist/entrypoints/index.d.ts.map +1 -1
  503. package/dist/entrypoints/index.js +664 -91
  504. package/dist/entrypoints/live.js +22 -12
  505. package/dist/entrypoints/node.d.ts +2 -1
  506. package/dist/entrypoints/node.d.ts.map +1 -1
  507. package/dist/entrypoints/node.js +34 -25
  508. package/dist/entrypoints/observability.d.ts +2 -0
  509. package/dist/entrypoints/observability.d.ts.map +1 -1
  510. package/dist/entrypoints/observability.js +205 -131
  511. package/dist/entrypoints/primitives.js +152 -14
  512. package/dist/entrypoints/process/owner-loss.js +2 -2
  513. package/dist/entrypoints/process.js +18 -92
  514. package/dist/entrypoints/react.js +6 -5
  515. package/dist/entrypoints/realtime.d.ts +1 -0
  516. package/dist/entrypoints/realtime.d.ts.map +1 -1
  517. package/dist/entrypoints/realtime.js +6 -3
  518. package/dist/entrypoints/release.js +4 -0
  519. package/dist/entrypoints/remote.js +7 -6
  520. package/dist/entrypoints/server.d.ts +3 -1
  521. package/dist/entrypoints/server.d.ts.map +1 -1
  522. package/dist/entrypoints/server.js +295 -194
  523. package/dist/entrypoints/service-host/macos.d.ts +16 -0
  524. package/dist/entrypoints/service-host/macos.d.ts.map +1 -0
  525. package/dist/entrypoints/service-host/macos.js +1998 -0
  526. package/dist/entrypoints/service-host.d.ts +26 -0
  527. package/dist/entrypoints/service-host.d.ts.map +1 -0
  528. package/dist/entrypoints/service-host.js +3155 -0
  529. package/dist/entrypoints/spend/testing.d.ts +2 -0
  530. package/dist/entrypoints/spend/testing.d.ts.map +1 -0
  531. package/dist/entrypoints/spend/testing.js +442 -0
  532. package/dist/entrypoints/spend.d.ts +8 -0
  533. package/dist/entrypoints/spend.d.ts.map +1 -0
  534. package/dist/entrypoints/spend.js +593 -0
  535. package/dist/entrypoints/sync/postgres.d.ts +12 -0
  536. package/dist/entrypoints/sync/postgres.d.ts.map +1 -0
  537. package/dist/entrypoints/sync/postgres.js +737 -0
  538. package/dist/entrypoints/sync.d.ts +12 -0
  539. package/dist/entrypoints/sync.d.ts.map +1 -0
  540. package/dist/entrypoints/sync.js +782 -0
  541. package/dist/entrypoints/telegram/grammy.js +5 -5
  542. package/dist/entrypoints/telegram/html.d.ts +2 -0
  543. package/dist/entrypoints/telegram/html.d.ts.map +1 -1
  544. package/dist/entrypoints/telegram/html.js +839 -2
  545. package/dist/entrypoints/telegram/screens.js +13 -15
  546. package/dist/entrypoints/telegram.d.ts +1 -1
  547. package/dist/entrypoints/telegram.d.ts.map +1 -1
  548. package/dist/entrypoints/telegram.js +286 -76
  549. package/dist/entrypoints/testing.js +33 -41
  550. package/dist/entrypoints/tools/agent.js +13 -9
  551. package/dist/entrypoints/tools/connections.js +664 -63
  552. package/dist/entrypoints/tools/contract.d.ts +2 -2
  553. package/dist/entrypoints/tools/contract.js +4 -1
  554. package/dist/entrypoints/tools/invoker.js +10 -7
  555. package/dist/entrypoints/tools/mcp.js +17 -13
  556. package/dist/entrypoints/tools/toolkit.js +22 -18
  557. package/dist/entrypoints/tools.d.ts +4 -2
  558. package/dist/entrypoints/tools.d.ts.map +1 -1
  559. package/dist/entrypoints/tools.js +105 -90
  560. package/dist/entrypoints/tracking/contract.js +2 -1
  561. package/dist/entrypoints/tracking/performance.js +4 -0
  562. package/dist/entrypoints/tracking.js +6 -1
  563. package/dist/entrypoints/voice.js +3 -3
  564. package/dist/entrypoints/xlsx.js +1 -1
  565. package/dist/files/boundary.d.ts.map +1 -1
  566. package/dist/files/chunk-spool.d.ts +27 -0
  567. package/dist/files/chunk-spool.d.ts.map +1 -1
  568. package/dist/files/directory-appearance.d.ts +55 -0
  569. package/dist/files/directory-appearance.d.ts.map +1 -0
  570. package/dist/files/file-io.d.ts.map +1 -1
  571. package/dist/files/file-stamp.d.ts +35 -0
  572. package/dist/files/file-stamp.d.ts.map +1 -0
  573. package/dist/files/json-file-reading.d.ts +37 -0
  574. package/dist/files/json-file-reading.d.ts.map +1 -0
  575. package/dist/files/native-packaging.d.ts.map +1 -1
  576. package/dist/files/polled-json.d.ts +121 -0
  577. package/dist/files/polled-json.d.ts.map +1 -0
  578. package/dist/files/regular-file.d.ts +135 -0
  579. package/dist/files/regular-file.d.ts.map +1 -0
  580. package/dist/geo/index.d.ts +2 -1
  581. package/dist/geo/index.d.ts.map +1 -1
  582. package/dist/geo/resolver.d.ts.map +1 -1
  583. package/dist/geo/types.d.ts +0 -1
  584. package/dist/geo/types.d.ts.map +1 -1
  585. package/dist/google/google.d.ts +6 -0
  586. package/dist/google/google.d.ts.map +1 -1
  587. package/dist/{index-w0eqdhyd.js → index-09f7w2qq.js} +6 -1
  588. package/dist/index-0gqs8ght.js +558 -0
  589. package/dist/{index-t05a2ry4.js → index-0p0s5hrj.js} +8 -14
  590. package/dist/{index-1c945ten.js → index-0r15pkjq.js} +1 -1
  591. package/dist/{index-v1swr26p.js → index-0tyt97nk.js} +2 -2
  592. package/dist/{index-332d0m9g.js → index-0x4mnwg5.js} +4 -0
  593. package/dist/index-118aebbg.js +48 -0
  594. package/dist/index-13dnv6d0.js +296 -0
  595. package/dist/index-1q0n6zek.js +184 -0
  596. package/dist/index-1qwrczr1.js +405 -0
  597. package/dist/index-27hck3z2.js +307 -0
  598. package/dist/index-2c5w2d1d.js +107 -0
  599. package/dist/{index-fvd6pvw3.js → index-2nwvn7m2.js} +2 -2
  600. package/dist/index-2rf33y2h.js +77 -0
  601. package/dist/index-360j58vb.js +63 -0
  602. package/dist/{index-tt30h7mr.js → index-39n02e0q.js} +1 -1
  603. package/dist/{index-mfntvj58.js → index-3dq8466w.js} +1 -1
  604. package/dist/index-3tnwtz38.js +725 -0
  605. package/dist/{index-x2d51zay.js → index-3ypvpkwr.js} +309 -345
  606. package/dist/index-4gk6k3zc.js +248 -0
  607. package/dist/{index-kxff9e9w.js → index-4j8efqr3.js} +5 -4
  608. package/dist/index-4qvyhn23.js +40 -0
  609. package/dist/index-4ynw5ktx.js +78 -0
  610. package/dist/index-5awtbyns.js +19 -0
  611. package/dist/{index-nz06qw5a.js → index-5jyjb4s0.js} +1 -1
  612. package/dist/{index-7zksb1ty.js → index-5ptwb6ka.js} +1 -1
  613. package/dist/{index-w3nv6kr8.js → index-5q0qpw3v.js} +54 -9
  614. package/dist/{index-mm89hd8v.js → index-5t4fpdct.js} +1 -1
  615. package/dist/index-5v5vg85s.js +108 -0
  616. package/dist/{index-0v9xb8pz.js → index-5y7j383h.js} +5 -5
  617. package/dist/{index-bqzgaj57.js → index-673drwkn.js} +198 -61
  618. package/dist/{index-v62cpkx3.js → index-6g85s734.js} +1 -1
  619. package/dist/{index-sqc6ezrb.js → index-6kec3b14.js} +17 -4
  620. package/dist/{index-cvjddnvd.js → index-6wp4dn9d.js} +17 -8
  621. package/dist/{index-kqnd6a85.js → index-7416mhyh.js} +1 -1
  622. package/dist/{index-m0wsfmrc.js → index-7csn6pva.js} +37 -24
  623. package/dist/{index-dqpesdck.js → index-7grgs8cx.js} +25 -5
  624. package/dist/{index-jjvr9f15.js → index-7kfcb576.js} +129 -39
  625. package/dist/{index-ss67fxhj.js → index-877e9y8r.js} +7 -7
  626. package/dist/{index-aw6kx2e6.js → index-8gmmdz7k.js} +1 -1
  627. package/dist/index-8x22nprv.js +1461 -0
  628. package/dist/{index-rz3z13e9.js → index-97q9kykw.js} +1 -1
  629. package/dist/index-97rp94ff.js +8 -0
  630. package/dist/{index-0w0hxp7n.js → index-9pv126eh.js} +3 -9
  631. package/dist/{index-egg0yp2j.js → index-9xr44d2g.js} +86 -210
  632. package/dist/{index-b2sey031.js → index-9y0afd5f.js} +24 -23
  633. package/dist/{index-nmaqxdx7.js → index-ac5rj3d4.js} +203 -90
  634. package/dist/{index-wqzw3qg9.js → index-agy5fqgf.js} +32 -13
  635. package/dist/{index-ndjzbt2v.js → index-akf0xkrm.js} +4 -3
  636. package/dist/index-akfgymyr.js +8 -0
  637. package/dist/index-apv5xfef.js +13 -0
  638. package/dist/index-bh4pmtr9.js +317 -0
  639. package/dist/{index-fa53vygr.js → index-bmaz3jzy.js} +3 -3
  640. package/dist/{index-8kzct1d6.js → index-bn2baakz.js} +143 -143
  641. package/dist/{index-m8ddk770.js → index-brhhaygm.js} +1 -1
  642. package/dist/index-bz3gn6cs.js +407 -0
  643. package/dist/index-c5gp2gh6.js +51 -0
  644. package/dist/index-cbhxhma2.js +90 -0
  645. package/dist/index-cfnmvcq8.js +11 -0
  646. package/dist/index-cv9b7fz2.js +42 -0
  647. package/dist/index-d4svrknj.js +156 -0
  648. package/dist/{index-1szhrfsf.js → index-d54npte7.js} +7 -5
  649. package/dist/{index-ne4j9998.js → index-e06z0tkb.js} +123 -94
  650. package/dist/index-emgrmavr.js +1193 -0
  651. package/dist/{index-99nnsz39.js → index-en8e5zsj.js} +15 -135
  652. package/dist/{index-20hn8pbh.js → index-fmzg39a8.js} +1 -1
  653. package/dist/{index-ft2wvst5.js → index-g3e57qj6.js} +1928 -414
  654. package/dist/index-g56ht6qf.js +98 -0
  655. package/dist/{index-7cn66qdk.js → index-gf92hc87.js} +15 -7
  656. package/dist/{index-f56ct5gb.js → index-gj1rjf78.js} +4 -3
  657. package/dist/{index-g6a3na27.js → index-gnjgkecx.js} +7 -3
  658. package/dist/index-gzny6zsw.js +487 -0
  659. package/dist/{index-n6hvd1r2.js → index-hj1zq7mh.js} +26 -13
  660. package/dist/index-hy4653g4.js +345 -0
  661. package/dist/{index-t8jz0e20.js → index-j903yhp4.js} +30 -38
  662. package/dist/{index-9ypczvpj.js → index-jb4m241t.js} +2 -0
  663. package/dist/{index-wt6rw7rf.js → index-jfecdk1e.js} +29 -21
  664. package/dist/{index-cjzaj7ev.js → index-jxtg307y.js} +23 -21
  665. package/dist/{index-3ymcmpa9.js → index-ke02kxsr.js} +33 -163
  666. package/dist/{index-bz9cmnqq.js → index-kt6dh1n6.js} +4 -4
  667. package/dist/index-ky3ardqn.js +80 -0
  668. package/dist/index-kyejf658.js +14 -0
  669. package/dist/{index-zyc64nbh.js → index-kynwa08q.js} +52 -47
  670. package/dist/index-kzavdze2.js +15 -0
  671. package/dist/{index-48acz7z0.js → index-m18xm96h.js} +93 -46
  672. package/dist/{index-m200b8hs.js → index-mbd92r1w.js} +5 -3
  673. package/dist/index-mxt0wfjy.js +58 -0
  674. package/dist/{index-9cxxfkhb.js → index-n20tybgk.js} +14 -9
  675. package/dist/{index-1v3k5zgx.js → index-n7f89hjw.js} +610 -1168
  676. package/dist/index-ngwf1s3c.js +51 -0
  677. package/dist/{index-zfncctjp.js → index-nk0cy9g1.js} +5 -4
  678. package/dist/{index-hs76yzt7.js → index-paff5y0r.js} +17 -11
  679. package/dist/index-pn5b11ce.js +40 -0
  680. package/dist/{index-qaet40b2.js → index-prf6ayhf.js} +5 -7
  681. package/dist/{index-hkxgennw.js → index-ps3djm8d.js} +7 -1
  682. package/dist/index-pwskmywy.js +195 -0
  683. package/dist/{index-3bzk2645.js → index-r9kq5ark.js} +1 -1
  684. package/dist/{index-hkw233vx.js → index-rbd2rq3z.js} +2 -2
  685. package/dist/{index-r0xr7y4m.js → index-rhb33thr.js} +138 -33
  686. package/dist/{index-kffm4r8w.js → index-rj32hkkp.js} +2 -2
  687. package/dist/index-rptj3qnc.js +96 -0
  688. package/dist/{index-hqsbtvta.js → index-rpyn7geq.js} +11 -3
  689. package/dist/{index-x2rvpbtj.js → index-rxnyygke.js} +151 -17
  690. package/dist/index-rzeezh79.js +508 -0
  691. package/dist/index-s2e3h616.js +351 -0
  692. package/dist/{index-m9hb9wnk.js → index-sfzfd2m2.js} +2 -2
  693. package/dist/{index-sqkttz7z.js → index-sv5svtq7.js} +1 -1
  694. package/dist/{index-srs8hj9c.js → index-sx3g49y2.js} +5 -1
  695. package/dist/{index-9mjrnqxs.js → index-t1a2jrg7.js} +21 -91
  696. package/dist/index-t7wa7k12.js +221 -0
  697. package/dist/{index-a6w6mwda.js → index-tazm4dxf.js} +1 -1
  698. package/dist/{index-b51tzcgh.js → index-tf70nm22.js} +2 -2
  699. package/dist/index-ttexdtjj.js +28 -0
  700. package/dist/{index-btjwc7xr.js → index-v1mxss62.js} +15 -14
  701. package/dist/{index-103dp7fz.js → index-v37b2cd6.js} +1956 -3151
  702. package/dist/{index-0ndz5r8z.js → index-v59pxmf1.js} +17 -9
  703. package/dist/{index-rfkh44ss.js → index-vgytj9wp.js} +1 -1
  704. package/dist/index-vgzhw2zk.js +304 -0
  705. package/dist/index-vmbxj75t.js +177 -0
  706. package/dist/{index-tnnmekgb.js → index-wa6h4tz6.js} +3 -3
  707. package/dist/{index-pa9bhefy.js → index-waa6t4zx.js} +83 -10
  708. package/dist/{index-4efxzrht.js → index-wavv538x.js} +211 -196
  709. package/dist/index-werjqesf.js +43 -0
  710. package/dist/{index-7qyv50r4.js → index-wv8dqy7q.js} +2 -2
  711. package/dist/index-wz392jyz.js +10 -0
  712. package/dist/{index-1d7s7da0.js → index-x6sp5vpa.js} +36 -5
  713. package/dist/index-xgae0bn7.js +37 -0
  714. package/dist/index-xmr47znh.js +160 -0
  715. package/dist/{index-ftk3838x.js → index-xq4s9mka.js} +7 -2
  716. package/dist/{index-ww3gss55.js → index-xrgn784x.js} +1 -1
  717. package/dist/{index-fpwbskp2.js → index-xtby8rj3.js} +1 -1
  718. package/dist/index-xv9jb84s.js +929 -0
  719. package/dist/{index-v7rbjatr.js → index-y065r8g5.js} +1881 -1156
  720. package/dist/{index-yex7eg1v.js → index-y7sy1xdp.js} +6 -2
  721. package/dist/{index-a7ebd769.js → index-zwgwyvdt.js} +3 -3
  722. package/dist/internal/abort-error.d.ts +9 -0
  723. package/dist/internal/abort-error.d.ts.map +1 -0
  724. package/dist/internal/abort-race.d.ts +47 -4
  725. package/dist/internal/abort-race.d.ts.map +1 -1
  726. package/dist/internal/atomic-file.d.ts +19 -0
  727. package/dist/internal/atomic-file.d.ts.map +1 -1
  728. package/dist/internal/backoff.d.ts.map +1 -1
  729. package/dist/internal/bounded-body.d.ts +37 -1
  730. package/dist/internal/bounded-body.d.ts.map +1 -1
  731. package/dist/internal/bounded-file-confirm.d.ts +32 -0
  732. package/dist/internal/bounded-file-confirm.d.ts.map +1 -0
  733. package/dist/internal/bounded-file-read.d.ts +34 -15
  734. package/dist/internal/bounded-file-read.d.ts.map +1 -1
  735. package/dist/internal/bun-command.d.ts +11 -0
  736. package/dist/internal/bun-command.d.ts.map +1 -1
  737. package/dist/internal/channel.d.ts.map +1 -1
  738. package/dist/internal/darwin-binding-error.d.ts.map +1 -1
  739. package/dist/internal/darwin-binding.d.ts +10 -0
  740. package/dist/internal/darwin-binding.d.ts.map +1 -1
  741. package/dist/internal/deadline.d.ts +22 -2
  742. package/dist/internal/deadline.d.ts.map +1 -1
  743. package/dist/internal/exclusive-lock-owner.d.ts +20 -1
  744. package/dist/internal/exclusive-lock-owner.d.ts.map +1 -1
  745. package/dist/internal/exclusive-lock-read.d.ts +2 -0
  746. package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
  747. package/dist/internal/exclusive-lock.d.ts +26 -0
  748. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  749. package/dist/internal/file-observation.d.ts +53 -0
  750. package/dist/internal/file-observation.d.ts.map +1 -1
  751. package/dist/internal/json-response.d.ts +10 -0
  752. package/dist/internal/json-response.d.ts.map +1 -0
  753. package/dist/internal/open-descriptors.d.ts +5 -0
  754. package/dist/internal/open-descriptors.d.ts.map +1 -1
  755. package/dist/internal/optional-peer.d.ts.map +1 -1
  756. package/dist/internal/pinned-http.d.ts.map +1 -1
  757. package/dist/internal/positive-integer.d.ts +14 -6
  758. package/dist/internal/positive-integer.d.ts.map +1 -1
  759. package/dist/internal/postgres-query.d.ts +16 -0
  760. package/dist/internal/postgres-query.d.ts.map +1 -0
  761. package/dist/internal/process-identity.d.ts +21 -1
  762. package/dist/internal/process-identity.d.ts.map +1 -1
  763. package/dist/internal/process-instance.d.ts +14 -0
  764. package/dist/internal/process-instance.d.ts.map +1 -1
  765. package/dist/internal/request.d.ts +4 -0
  766. package/dist/internal/request.d.ts.map +1 -1
  767. package/dist/internal/secret-equal.d.ts +11 -0
  768. package/dist/internal/secret-equal.d.ts.map +1 -0
  769. package/dist/internal/secure-fetch.d.ts.map +1 -1
  770. package/dist/internal/sqlite.d.ts +8 -0
  771. package/dist/internal/sqlite.d.ts.map +1 -1
  772. package/dist/internal/timers.d.ts +20 -0
  773. package/dist/internal/timers.d.ts.map +1 -1
  774. package/dist/internal/typed.d.ts +11 -0
  775. package/dist/internal/typed.d.ts.map +1 -1
  776. package/dist/internal/unix-client-error.d.ts +21 -0
  777. package/dist/internal/unix-client-error.d.ts.map +1 -0
  778. package/dist/internal/unix-socket-lock.d.ts +23 -0
  779. package/dist/internal/unix-socket-lock.d.ts.map +1 -0
  780. package/dist/internal/unix-socket.d.ts +62 -0
  781. package/dist/internal/unix-socket.d.ts.map +1 -1
  782. package/dist/internal/upgrade-affects.d.ts +3 -3
  783. package/dist/internal/upgrade-affects.d.ts.map +1 -1
  784. package/dist/internal/upgrade-plan.d.ts.map +1 -1
  785. package/dist/json-schema/dialect.d.ts +0 -6
  786. package/dist/json-schema/dialect.d.ts.map +1 -1
  787. package/dist/json-schema/keywords.d.ts +116 -0
  788. package/dist/json-schema/keywords.d.ts.map +1 -0
  789. package/dist/json-schema/string-format.d.ts.map +1 -1
  790. package/dist/live/events.d.ts.map +1 -1
  791. package/dist/live/watch-client.d.ts.map +1 -1
  792. package/dist/observability/bounded-logger.d.ts +3 -0
  793. package/dist/observability/bounded-logger.d.ts.map +1 -1
  794. package/dist/observability/bounded-sink.d.ts.map +1 -1
  795. package/dist/observability/context.d.ts +12 -2
  796. package/dist/observability/context.d.ts.map +1 -1
  797. package/dist/observability/event-loop-delay.d.ts +62 -0
  798. package/dist/observability/event-loop-delay.d.ts.map +1 -0
  799. package/dist/observability/json-logger.d.ts.map +1 -1
  800. package/dist/observability/log-repeat.d.ts +44 -0
  801. package/dist/observability/log-repeat.d.ts.map +1 -0
  802. package/dist/observability/spool-core.d.ts +95 -0
  803. package/dist/observability/spool-core.d.ts.map +1 -0
  804. package/dist/observability/spool-file.d.ts +46 -0
  805. package/dist/observability/spool-file.d.ts.map +1 -0
  806. package/dist/observability/spool.d.ts +14 -8
  807. package/dist/observability/spool.d.ts.map +1 -1
  808. package/dist/observability/trace.d.ts.map +1 -1
  809. package/dist/observability/work.d.ts.map +1 -1
  810. package/dist/primitives/index.d.ts +1 -0
  811. package/dist/primitives/index.d.ts.map +1 -1
  812. package/dist/primitives/order-key.d.ts +37 -0
  813. package/dist/primitives/order-key.d.ts.map +1 -0
  814. package/dist/process/bun-child.d.ts.map +1 -1
  815. package/dist/process/command-owner.d.ts.map +1 -1
  816. package/dist/process/contract.d.ts +4 -3
  817. package/dist/process/contract.d.ts.map +1 -1
  818. package/dist/process/group-presence.d.ts.map +1 -1
  819. package/dist/process/group.d.ts +5 -1
  820. package/dist/process/group.d.ts.map +1 -1
  821. package/dist/process/launch.d.ts +5 -3
  822. package/dist/process/launch.d.ts.map +1 -1
  823. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  824. package/dist/react/cache-bridge.d.ts.map +1 -1
  825. package/dist/release/watcher.d.ts.map +1 -1
  826. package/dist/server/bridge-host.d.ts +51 -0
  827. package/dist/server/bridge-host.d.ts.map +1 -0
  828. package/dist/server/bun.d.ts +4 -4
  829. package/dist/server/bun.d.ts.map +1 -1
  830. package/dist/server/context-contribution.d.ts.map +1 -1
  831. package/dist/server/contract-method.d.ts.map +1 -1
  832. package/dist/server/create.d.ts +1 -0
  833. package/dist/server/create.d.ts.map +1 -1
  834. package/dist/server/endpoint-dispatch.d.ts.map +1 -1
  835. package/dist/server/endpoint-response.d.ts.map +1 -1
  836. package/dist/server/error-dispatch.d.ts +2 -0
  837. package/dist/server/error-dispatch.d.ts.map +1 -1
  838. package/dist/server/error-hook.d.ts +2 -0
  839. package/dist/server/error-hook.d.ts.map +1 -1
  840. package/dist/server/handler-state.d.ts +13 -2
  841. package/dist/server/handler-state.d.ts.map +1 -1
  842. package/dist/server/implement.d.ts +1 -0
  843. package/dist/server/implement.d.ts.map +1 -1
  844. package/dist/server/local-host.d.ts +47 -0
  845. package/dist/server/local-host.d.ts.map +1 -0
  846. package/dist/server/logger.d.ts +20 -3
  847. package/dist/server/logger.d.ts.map +1 -1
  848. package/dist/server/logging.d.ts +2 -1
  849. package/dist/server/logging.d.ts.map +1 -1
  850. package/dist/server/middleware/cors.d.ts +1 -0
  851. package/dist/server/middleware/cors.d.ts.map +1 -1
  852. package/dist/server/middleware/signed-link.d.ts +42 -0
  853. package/dist/server/middleware/signed-link.d.ts.map +1 -0
  854. package/dist/server/multipart-reader.d.ts +3 -1
  855. package/dist/server/multipart-reader.d.ts.map +1 -1
  856. package/dist/server/multipart.d.ts.map +1 -1
  857. package/dist/server/oauth/cimd.d.ts.map +1 -1
  858. package/dist/server/oauth/endpoints.d.ts.map +1 -1
  859. package/dist/server/openapi.d.ts.map +1 -1
  860. package/dist/server/protocol-outcome.d.ts +17 -0
  861. package/dist/server/protocol-outcome.d.ts.map +1 -0
  862. package/dist/server/raw.d.ts.map +1 -1
  863. package/dist/server/request-completion.d.ts +3 -1
  864. package/dist/server/request-completion.d.ts.map +1 -1
  865. package/dist/server/shutdown.d.ts.map +1 -1
  866. package/dist/server/socket-io-config.d.ts +1 -1
  867. package/dist/server/socket-io-config.d.ts.map +1 -1
  868. package/dist/server/streaming-route.d.ts.map +1 -1
  869. package/dist/server/types.d.ts +13 -10
  870. package/dist/server/types.d.ts.map +1 -1
  871. package/dist/server/unix-client-body.d.ts +4 -1
  872. package/dist/server/unix-client-body.d.ts.map +1 -1
  873. package/dist/server/unix-client-bun.d.ts.map +1 -1
  874. package/dist/server/unix-client.d.ts +8 -1
  875. package/dist/server/unix-client.d.ts.map +1 -1
  876. package/dist/service-host/artifact-activation.d.ts +58 -0
  877. package/dist/service-host/artifact-activation.d.ts.map +1 -0
  878. package/dist/service-host/artifact-manifest.d.ts +68 -0
  879. package/dist/service-host/artifact-manifest.d.ts.map +1 -0
  880. package/dist/service-host/artifact.d.ts +43 -0
  881. package/dist/service-host/artifact.d.ts.map +1 -0
  882. package/dist/service-host/config-reloader-contract.d.ts +66 -0
  883. package/dist/service-host/config-reloader-contract.d.ts.map +1 -0
  884. package/dist/service-host/config-reloader-helpers.d.ts +32 -0
  885. package/dist/service-host/config-reloader-helpers.d.ts.map +1 -0
  886. package/dist/service-host/config-reloader-source.d.ts +47 -0
  887. package/dist/service-host/config-reloader-source.d.ts.map +1 -0
  888. package/dist/service-host/config-reloader.d.ts +6 -0
  889. package/dist/service-host/config-reloader.d.ts.map +1 -0
  890. package/dist/service-host/host-adapter.d.ts +72 -0
  891. package/dist/service-host/host-adapter.d.ts.map +1 -0
  892. package/dist/service-host/identity-unix-socket.d.ts +101 -0
  893. package/dist/service-host/identity-unix-socket.d.ts.map +1 -0
  894. package/dist/service-host/identity.d.ts +117 -0
  895. package/dist/service-host/identity.d.ts.map +1 -0
  896. package/dist/service-host/launchd-plist.d.ts +77 -0
  897. package/dist/service-host/launchd-plist.d.ts.map +1 -0
  898. package/dist/service-host/launchd-render.d.ts +91 -0
  899. package/dist/service-host/launchd-render.d.ts.map +1 -0
  900. package/dist/service-host/launchd.d.ts +82 -0
  901. package/dist/service-host/launchd.d.ts.map +1 -0
  902. package/dist/service-host/macos/bundle-plist.d.ts +50 -0
  903. package/dist/service-host/macos/bundle-plist.d.ts.map +1 -0
  904. package/dist/service-host/macos/bundle.d.ts +66 -0
  905. package/dist/service-host/macos/bundle.d.ts.map +1 -0
  906. package/dist/service-host/macos/codesign.d.ts +95 -0
  907. package/dist/service-host/macos/codesign.d.ts.map +1 -0
  908. package/dist/service-host/macos/icon.d.ts +93 -0
  909. package/dist/service-host/macos/icon.d.ts.map +1 -0
  910. package/dist/service-host/macos/launch-services.d.ts +88 -0
  911. package/dist/service-host/macos/launch-services.d.ts.map +1 -0
  912. package/dist/service-host/macos/launcher.d.ts +59 -0
  913. package/dist/service-host/macos/launcher.d.ts.map +1 -0
  914. package/dist/service-host/macos/responsibility.d.ts +90 -0
  915. package/dist/service-host/macos/responsibility.d.ts.map +1 -0
  916. package/dist/service-host/macos/runner.d.ts +69 -0
  917. package/dist/service-host/macos/runner.d.ts.map +1 -0
  918. package/dist/service-host/plist-xml.d.ts +48 -0
  919. package/dist/service-host/plist-xml.d.ts.map +1 -0
  920. package/dist/service-host/process-evidence.d.ts +17 -0
  921. package/dist/service-host/process-evidence.d.ts.map +1 -0
  922. package/dist/service-host/systemd-inspect.d.ts +128 -0
  923. package/dist/service-host/systemd-inspect.d.ts.map +1 -0
  924. package/dist/service-host/systemd-links.d.ts +23 -0
  925. package/dist/service-host/systemd-links.d.ts.map +1 -0
  926. package/dist/service-host/systemd-render-shared.d.ts +64 -0
  927. package/dist/service-host/systemd-render-shared.d.ts.map +1 -0
  928. package/dist/service-host/systemd-render.d.ts +98 -0
  929. package/dist/service-host/systemd-render.d.ts.map +1 -0
  930. package/dist/service-host/systemd-timer-render.d.ts +31 -0
  931. package/dist/service-host/systemd-timer-render.d.ts.map +1 -0
  932. package/dist/service-host/systemd-timer-rollback.d.ts +26 -0
  933. package/dist/service-host/systemd-timer-rollback.d.ts.map +1 -0
  934. package/dist/service-host/systemd-timer.d.ts +82 -0
  935. package/dist/service-host/systemd-timer.d.ts.map +1 -0
  936. package/dist/service-host/systemd-unit-ops.d.ts +26 -0
  937. package/dist/service-host/systemd-unit-ops.d.ts.map +1 -0
  938. package/dist/service-host/systemd.d.ts +50 -0
  939. package/dist/service-host/systemd.d.ts.map +1 -0
  940. package/dist/spend/attribution.d.ts +17 -0
  941. package/dist/spend/attribution.d.ts.map +1 -0
  942. package/dist/spend/coverage-guard.d.ts +60 -0
  943. package/dist/spend/coverage-guard.d.ts.map +1 -0
  944. package/dist/spend/coverage-lexer.d.ts +20 -0
  945. package/dist/spend/coverage-lexer.d.ts.map +1 -0
  946. package/dist/spend/facts.d.ts +23 -0
  947. package/dist/spend/facts.d.ts.map +1 -0
  948. package/dist/spend/gateway-stream.d.ts +25 -0
  949. package/dist/spend/gateway-stream.d.ts.map +1 -0
  950. package/dist/spend/gateway.d.ts +64 -0
  951. package/dist/spend/gateway.d.ts.map +1 -0
  952. package/dist/spend/receipt-merge.d.ts +13 -0
  953. package/dist/spend/receipt-merge.d.ts.map +1 -0
  954. package/dist/spend/receipt-spool.d.ts +35 -0
  955. package/dist/spend/receipt-spool.d.ts.map +1 -0
  956. package/dist/spend/reconcile.d.ts +45 -0
  957. package/dist/spend/reconcile.d.ts.map +1 -0
  958. package/dist/spend/schemas.d.ts +249 -0
  959. package/dist/spend/schemas.d.ts.map +1 -0
  960. package/dist/sync/outbox.d.ts +131 -0
  961. package/dist/sync/outbox.d.ts.map +1 -0
  962. package/dist/sync/overlay.d.ts +59 -0
  963. package/dist/sync/overlay.d.ts.map +1 -0
  964. package/dist/sync/protocol.d.ts +132 -0
  965. package/dist/sync/protocol.d.ts.map +1 -0
  966. package/dist/sync/server-store-check.d.ts +10 -0
  967. package/dist/sync/server-store-check.d.ts.map +1 -0
  968. package/dist/sync/server-store-memory.d.ts +14 -0
  969. package/dist/sync/server-store-memory.d.ts.map +1 -0
  970. package/dist/sync/server-store-postgres.d.ts +25 -0
  971. package/dist/sync/server-store-postgres.d.ts.map +1 -0
  972. package/dist/sync/server-store.d.ts +139 -0
  973. package/dist/sync/server-store.d.ts.map +1 -0
  974. package/dist/sync/session-machine.d.ts +79 -0
  975. package/dist/sync/session-machine.d.ts.map +1 -0
  976. package/dist/sync/session-snapshot.d.ts +19 -0
  977. package/dist/sync/session-snapshot.d.ts.map +1 -0
  978. package/dist/sync/session-steps.d.ts +15 -0
  979. package/dist/sync/session-steps.d.ts.map +1 -0
  980. package/dist/sync/session.d.ts +142 -0
  981. package/dist/sync/session.d.ts.map +1 -0
  982. package/dist/sync/tombstones.d.ts +53 -0
  983. package/dist/sync/tombstones.d.ts.map +1 -0
  984. package/dist/telegram/bot-api.d.ts.map +1 -1
  985. package/dist/telegram/broadcast-failure.d.ts.map +1 -1
  986. package/dist/telegram/budget-transformer.d.ts.map +1 -1
  987. package/dist/telegram/crypto.d.ts +2 -10
  988. package/dist/telegram/crypto.d.ts.map +1 -1
  989. package/dist/telegram/html/markdown-inline.d.ts +19 -0
  990. package/dist/telegram/html/markdown-inline.d.ts.map +1 -0
  991. package/dist/telegram/html/markdown-lines.d.ts +51 -0
  992. package/dist/telegram/html/markdown-lines.d.ts.map +1 -0
  993. package/dist/telegram/html/markdown-split.d.ts +49 -0
  994. package/dist/telegram/html/markdown-split.d.ts.map +1 -0
  995. package/dist/telegram/html/markdown.d.ts +14 -0
  996. package/dist/telegram/html/markdown.d.ts.map +1 -0
  997. package/dist/telegram/html/nodes.d.ts +26 -4
  998. package/dist/telegram/html/nodes.d.ts.map +1 -1
  999. package/dist/telegram/html/parse.d.ts.map +1 -1
  1000. package/dist/telegram/html/render.d.ts.map +1 -1
  1001. package/dist/telegram/init-data.d.ts.map +1 -1
  1002. package/dist/telegram/local-files.d.ts.map +1 -1
  1003. package/dist/telegram/operator-channel.d.ts +15 -2
  1004. package/dist/telegram/operator-channel.d.ts.map +1 -1
  1005. package/dist/telegram/outbound-budget.d.ts.map +1 -1
  1006. package/dist/telegram/outbound-cost.d.ts +9 -1
  1007. package/dist/telegram/outbound-cost.d.ts.map +1 -1
  1008. package/dist/telegram/outbound-queue.d.ts +2 -1
  1009. package/dist/telegram/outbound-queue.d.ts.map +1 -1
  1010. package/dist/telegram/screens/outcome.d.ts.map +1 -1
  1011. package/dist/telegram/send-failure.d.ts.map +1 -1
  1012. package/dist/telegram/transport-connect.d.ts.map +1 -1
  1013. package/dist/telegram/transport.d.ts.map +1 -1
  1014. package/dist/telegram/update-intake.d.ts.map +1 -1
  1015. package/dist/telegram/update-store-postgres.d.ts +2 -2
  1016. package/dist/telegram/update-store-postgres.d.ts.map +1 -1
  1017. package/dist/telegram/webhook.d.ts.map +1 -1
  1018. package/dist/testing/managed-resource-conformance.d.ts.map +1 -1
  1019. package/dist/testing/surface-conformance.d.ts.map +1 -1
  1020. package/dist/testing/surface-manifest.d.ts +2 -0
  1021. package/dist/testing/surface-manifest.d.ts.map +1 -1
  1022. package/dist/tools/access.d.ts +63 -0
  1023. package/dist/tools/access.d.ts.map +1 -0
  1024. package/dist/tools/agent.d.ts +14 -6
  1025. package/dist/tools/agent.d.ts.map +1 -1
  1026. package/dist/tools/cli/args-classify.d.ts +154 -0
  1027. package/dist/tools/cli/args-classify.d.ts.map +1 -0
  1028. package/dist/tools/cli/args-fields.d.ts +14 -7
  1029. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  1030. package/dist/tools/cli/args-json.d.ts +1 -1
  1031. package/dist/tools/cli/args-json.d.ts.map +1 -1
  1032. package/dist/tools/cli/args-route.d.ts +4 -48
  1033. package/dist/tools/cli/args-route.d.ts.map +1 -1
  1034. package/dist/tools/cli/args-scan.d.ts +75 -0
  1035. package/dist/tools/cli/args-scan.d.ts.map +1 -0
  1036. package/dist/tools/cli/args-tokens.d.ts +2 -1
  1037. package/dist/tools/cli/args-tokens.d.ts.map +1 -1
  1038. package/dist/tools/cli/args.d.ts +37 -19
  1039. package/dist/tools/cli/args.d.ts.map +1 -1
  1040. package/dist/tools/cli/checkpoint.d.ts.map +1 -1
  1041. package/dist/tools/cli/command-shape.d.ts +5 -0
  1042. package/dist/tools/cli/command-shape.d.ts.map +1 -1
  1043. package/dist/tools/cli/command.d.ts +57 -2
  1044. package/dist/tools/cli/command.d.ts.map +1 -1
  1045. package/dist/tools/cli/config.d.ts +15 -58
  1046. package/dist/tools/cli/config.d.ts.map +1 -1
  1047. package/dist/tools/cli/create-cli.d.ts +7 -3
  1048. package/dist/tools/cli/create-cli.d.ts.map +1 -1
  1049. package/dist/tools/cli/format.d.ts.map +1 -1
  1050. package/dist/tools/cli/help.d.ts.map +1 -1
  1051. package/dist/tools/cli/invoke.d.ts +71 -20
  1052. package/dist/tools/cli/invoke.d.ts.map +1 -1
  1053. package/dist/tools/cli/io.d.ts.map +1 -1
  1054. package/dist/tools/cli/managed-surface.d.ts.map +1 -1
  1055. package/dist/tools/cli/notices.d.ts.map +1 -1
  1056. package/dist/tools/cli/policy.d.ts +66 -10
  1057. package/dist/tools/cli/policy.d.ts.map +1 -1
  1058. package/dist/tools/cli/prepare.d.ts +5 -4
  1059. package/dist/tools/cli/prepare.d.ts.map +1 -1
  1060. package/dist/tools/cli/run-managed.d.ts.map +1 -1
  1061. package/dist/tools/cli/run-native.d.ts.map +1 -1
  1062. package/dist/tools/cli/run-stream.d.ts.map +1 -1
  1063. package/dist/tools/cli/runner.d.ts +28 -0
  1064. package/dist/tools/cli/runner.d.ts.map +1 -0
  1065. package/dist/tools/cli/session.d.ts +12 -6
  1066. package/dist/tools/cli/session.d.ts.map +1 -1
  1067. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  1068. package/dist/tools/cli/stream.d.ts.map +1 -1
  1069. package/dist/tools/cli/unavailable.d.ts +2 -0
  1070. package/dist/tools/cli/unavailable.d.ts.map +1 -1
  1071. package/dist/tools/cli/unix-outcome.d.ts +8 -0
  1072. package/dist/tools/cli/unix-outcome.d.ts.map +1 -0
  1073. package/dist/tools/cli/update.d.ts.map +1 -1
  1074. package/dist/tools/cli/view-columns.d.ts +18 -0
  1075. package/dist/tools/cli/view-columns.d.ts.map +1 -0
  1076. package/dist/tools/cli/view.d.ts.map +1 -1
  1077. package/dist/tools/connections/define.d.ts.map +1 -1
  1078. package/dist/tools/connections/foreign-schema-join.d.ts +28 -0
  1079. package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -0
  1080. package/dist/tools/connections/foreign-schema.d.ts +9 -0
  1081. package/dist/tools/connections/foreign-schema.d.ts.map +1 -0
  1082. package/dist/tools/connections/limits.d.ts +1 -1
  1083. package/dist/tools/connections/limits.d.ts.map +1 -1
  1084. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  1085. package/dist/tools/connections/mcp.d.ts.map +1 -1
  1086. package/dist/tools/connections/openapi.d.ts.map +1 -1
  1087. package/dist/tools/connections/runtime.d.ts +18 -6
  1088. package/dist/tools/connections/runtime.d.ts.map +1 -1
  1089. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  1090. package/dist/tools/connections/types.d.ts +12 -2
  1091. package/dist/tools/connections/types.d.ts.map +1 -1
  1092. package/dist/tools/execute.d.ts.map +1 -1
  1093. package/dist/tools/internal/expose.d.ts +6 -0
  1094. package/dist/tools/internal/expose.d.ts.map +1 -0
  1095. package/dist/tools/internal/json-projection.d.ts +17 -0
  1096. package/dist/tools/internal/json-projection.d.ts.map +1 -0
  1097. package/dist/tools/internal/surface-projector.d.ts +18 -4
  1098. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  1099. package/dist/tools/invoker.d.ts +10 -2
  1100. package/dist/tools/invoker.d.ts.map +1 -1
  1101. package/dist/tools/lifecycle.d.ts +8 -2
  1102. package/dist/tools/lifecycle.d.ts.map +1 -1
  1103. package/dist/tools/list-names.d.ts +3 -4
  1104. package/dist/tools/list-names.d.ts.map +1 -1
  1105. package/dist/tools/manifest.d.ts +4 -3
  1106. package/dist/tools/manifest.d.ts.map +1 -1
  1107. package/dist/tools/mcp/handler.d.ts.map +1 -1
  1108. package/dist/tools/mcp/mount.d.ts +26 -14
  1109. package/dist/tools/mcp/mount.d.ts.map +1 -1
  1110. package/dist/tools/mcp/prepare.d.ts +2 -0
  1111. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  1112. package/dist/tools/mcp/register.d.ts +2 -1
  1113. package/dist/tools/mcp/register.d.ts.map +1 -1
  1114. package/dist/tools/mcp/runtime-tools.d.ts +1 -1
  1115. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  1116. package/dist/tools/mcp/stdio.d.ts.map +1 -1
  1117. package/dist/tools/mount.d.ts +7 -2
  1118. package/dist/tools/mount.d.ts.map +1 -1
  1119. package/dist/tools/native-definition.d.ts +1 -1
  1120. package/dist/tools/native-definition.d.ts.map +1 -1
  1121. package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -2
  1122. package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
  1123. package/dist/tools/operations/async-operation-runtime-types.d.ts +1 -1
  1124. package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
  1125. package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
  1126. package/dist/tools/operations/mount-wait.d.ts.map +1 -1
  1127. package/dist/tools/operations/wait-core.d.ts.map +1 -1
  1128. package/dist/tools/read-operation.d.ts +6 -4
  1129. package/dist/tools/read-operation.d.ts.map +1 -1
  1130. package/dist/tools/registry.d.ts.map +1 -1
  1131. package/dist/tools/runtime-tool-declaration.d.ts +4 -1
  1132. package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
  1133. package/dist/tools/runtime-tool.d.ts +6 -1
  1134. package/dist/tools/runtime-tool.d.ts.map +1 -1
  1135. package/dist/tools/schema/coerce.d.ts.map +1 -1
  1136. package/dist/tools/schema/inline-references.d.ts +7 -0
  1137. package/dist/tools/schema/inline-references.d.ts.map +1 -0
  1138. package/dist/tools/schema/json-schema-origin.d.ts +1 -1
  1139. package/dist/tools/schema/json-schema-origin.d.ts.map +1 -1
  1140. package/dist/tools/schema/presentation.d.ts +6 -0
  1141. package/dist/tools/schema/presentation.d.ts.map +1 -1
  1142. package/dist/tools/schema/schema.d.ts +2 -0
  1143. package/dist/tools/schema/schema.d.ts.map +1 -1
  1144. package/dist/tools/schema/untyped-properties.d.ts.map +1 -1
  1145. package/dist/tools/surface.d.ts.map +1 -1
  1146. package/dist/tools/toolkit.d.ts +6 -3
  1147. package/dist/tools/toolkit.d.ts.map +1 -1
  1148. package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
  1149. package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
  1150. package/dist/tools/transfer/define-view-file-tool.d.ts +2 -1
  1151. package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
  1152. package/dist/tools/transfer/mount-download.d.ts.map +1 -1
  1153. package/dist/tools/transfer/view-file-contract.d.ts +2 -2
  1154. package/dist/tools/transfer/view-file.d.ts +1 -2
  1155. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  1156. package/dist/tracking/client.d.ts +0 -13
  1157. package/dist/tracking/client.d.ts.map +1 -1
  1158. package/dist/tracking/delivery.d.ts.map +1 -1
  1159. package/dist/tracking/performance/collector.d.ts.map +1 -1
  1160. package/llms/agent-executor-acp.txt +55 -0
  1161. package/llms/agent-executor-claude-sdk.txt +31 -0
  1162. package/llms/agent-executor-claude.txt +29 -0
  1163. package/llms/agent-executor-codex.txt +25 -0
  1164. package/llms/agent-executor-testing.txt +26 -0
  1165. package/llms/agent-executor.txt +40 -0
  1166. package/llms/agent-runtime-harness.txt +68 -5
  1167. package/llms/agent-runtime-openrouter.txt +8 -2
  1168. package/llms/agent-runtime-postgres.txt +30 -0
  1169. package/llms/agent-runtime-react.txt +1 -1
  1170. package/llms/agent-runtime-realtime.txt +1 -1
  1171. package/llms/agent-runtime-sandbox.txt +5 -2
  1172. package/llms/agent-runtime-sqlite-bun.txt +2 -2
  1173. package/llms/agent-runtime-sqlite-node.txt +2 -2
  1174. package/llms/agent-runtime-testing.txt +2 -1
  1175. package/llms/agent-runtime.2.txt +450 -501
  1176. package/llms/agent-runtime.3.txt +229 -267
  1177. package/llms/agent-runtime.4.txt +39 -246
  1178. package/llms/agent-runtime.5.txt +1 -1
  1179. package/llms/agent-runtime.txt +551 -2
  1180. package/llms/application-diagnostic-journal.txt +2 -0
  1181. package/llms/application.2.txt +3 -0
  1182. package/llms/application.3.txt +21 -4
  1183. package/llms/application.txt +4 -1
  1184. package/llms/cli.2.txt +259 -99
  1185. package/llms/cli.3.txt +90 -0
  1186. package/llms/cli.txt +96 -184
  1187. package/llms/contract.txt +7 -6
  1188. package/llms/declaration.txt +3 -3
  1189. package/llms/files.txt +11 -0
  1190. package/llms/handler.txt +25 -0
  1191. package/llms/http.txt +18 -1
  1192. package/llms/node.txt +5 -4
  1193. package/llms/observability.2.txt +105 -0
  1194. package/llms/observability.txt +14 -90
  1195. package/llms/primitives.txt +27 -0
  1196. package/llms/process.2.txt +2 -2
  1197. package/llms/process.txt +10 -9
  1198. package/llms/realtime.txt +11 -0
  1199. package/llms/server.2.txt +355 -0
  1200. package/llms/server.4.txt +45 -6
  1201. package/llms/server.5.txt +8 -3
  1202. package/llms/server.txt +143 -256
  1203. package/llms/service-host-macos.txt +53 -0
  1204. package/llms/service-host.txt +69 -0
  1205. package/llms/spend-testing.txt +21 -0
  1206. package/llms/spend.txt +173 -0
  1207. package/llms/stitchkit.2.txt +368 -42
  1208. package/llms/stitchkit.3.txt +164 -13
  1209. package/llms/stitchkit.txt +99 -417
  1210. package/llms/sync-postgres.txt +31 -0
  1211. package/llms/sync.txt +396 -0
  1212. package/llms/telegram-html.txt +4 -1
  1213. package/llms/telegram.2.txt +4 -4
  1214. package/llms/telegram.txt +105 -14
  1215. package/llms/testing.txt +4 -3
  1216. package/llms/tools-connections.txt +4 -4
  1217. package/llms/tools.2.txt +78 -17
  1218. package/llms/tools.3.txt +14 -9
  1219. package/llms/tools.txt +85 -78
  1220. package/llms/upgrading-0.127.0.txt +1059 -0
  1221. package/llms/upgrading-0.128.0.txt +147 -0
  1222. package/llms/upgrading.txt +2 -0
  1223. package/llms-full.txt +3727 -542
  1224. package/llms.txt +44 -27
  1225. package/native/darwin-arm64.node +0 -0
  1226. package/native/darwin-x64.node +0 -0
  1227. package/native-assets.json +4 -4
  1228. package/package.json +67 -9
  1229. package/dist/agent-runtime/sandbox-coding.d.ts.map +0 -1
  1230. package/dist/agent-runtime/sqlite-events.d.ts +0 -5
  1231. package/dist/agent-runtime/sqlite-events.d.ts.map +0 -1
  1232. package/dist/agent-runtime/sqlite-history.d.ts +0 -7
  1233. package/dist/agent-runtime/sqlite-history.d.ts.map +0 -1
  1234. package/dist/agent-runtime/sqlite-ledger.d.ts +0 -7
  1235. package/dist/agent-runtime/sqlite-ledger.d.ts.map +0 -1
  1236. package/dist/agent-runtime/sqlite-reads.d.ts +0 -14
  1237. package/dist/agent-runtime/sqlite-reads.d.ts.map +0 -1
  1238. package/dist/agent-runtime/sqlite-rows.d.ts.map +0 -1
  1239. package/dist/agent-runtime/tool-progress.d.ts.map +0 -1
  1240. package/dist/entrypoints/application/schemas.d.ts +0 -15
  1241. package/dist/entrypoints/application/schemas.d.ts.map +0 -1
  1242. package/dist/entrypoints/application/schemas.js +0 -27
  1243. package/dist/index-0s4xebbg.js +0 -8
  1244. package/dist/index-57ppvpw0.js +0 -1150
  1245. package/dist/index-5dmk54h9.js +0 -256
  1246. package/dist/index-8x0q6yfb.js +0 -247
  1247. package/dist/index-a3z56mtn.js +0 -48
  1248. package/dist/index-a5qr2rj6.js +0 -26
  1249. package/dist/index-b0kddvzw.js +0 -35
  1250. package/dist/index-drcjjhy1.js +0 -40
  1251. package/dist/index-eemvahkc.js +0 -21
  1252. package/dist/index-gfk7nrht.js +0 -0
  1253. package/dist/index-jp2qd9jb.js +0 -108
  1254. package/dist/index-nx6eazt0.js +0 -160
  1255. package/dist/index-wxadzdb7.js +0 -55
  1256. package/dist/internal/until-aborted.d.ts +0 -9
  1257. package/dist/internal/until-aborted.d.ts.map +0 -1
  1258. package/dist/server/unix-client-error.d.ts +0 -9
  1259. package/dist/server/unix-client-error.d.ts.map +0 -1
  1260. package/llms/application-schemas.txt +0 -42
@@ -1,1150 +0,0 @@
1
- import {
2
- AgentStoreEventEnvelopeSchema2,
3
- AppendAgentStoreEventSchema2,
4
- AgentStoreEventPageSchema2,
5
- AgentRecoverableDescriptorSchema2,
6
- AgentRecoverablePageSchema2,
7
- canonicalAgentJson2,
8
- AgentRuntimeHeadSchema2,
9
- AgentStoredRunSchema2,
10
- AgentAdmissionReceiptSchema2,
11
- AgentSeedReceiptSchema2,
12
- AgentHistoryMutationSchema2
13
- } from "./index-egg0yp2j.js";
14
- import {
15
- appendEventIn,
16
- ArchiveProjectionSchema,
17
- createAgentRuntimeStore2
18
- } from "./index-ft2wvst5.js";
19
- import {
20
- AgentMessageSchema2,
21
- AgentRunSchema2
22
- } from "./index-8kzct1d6.js";
23
- import {
24
- AgentConversationPageSchema2,
25
- AgentConversationMessagePageSchema2
26
- } from "./index-kqnd6a85.js";
27
-
28
- // src/agent-runtime/sqlite-events.ts
29
- import { createHash } from "node:crypto";
30
- import { z as z2 } from "zod";
31
-
32
- // src/agent-runtime/sqlite-rows.ts
33
- import { z } from "zod";
34
- var HeadRowSchema = z.object({ version: z.number().int().nonnegative() });
35
- var RunRowSchema = z.object({
36
- payload: z.string(),
37
- terminal_assistant_payload: z.string().nullable()
38
- });
39
- var MessageRowSchema = z.object({ payload: z.string() });
40
- var PositionedMessageRowSchema = z.object({
41
- position: z.number().int().nonnegative()
42
- });
43
- var CountRowSchema = z.object({ count: z.number().int().nonnegative() });
44
- var EventRowSchema = z.object({
45
- event_id: z.string(),
46
- conversation_id: z.string(),
47
- seq: z.int().positive(),
48
- schema_version: z.int().positive(),
49
- kind: z.string(),
50
- occurred_at: z.string(),
51
- ignorable: z.union([z.literal(0), z.literal(1)]),
52
- payload: z.string()
53
- });
54
- function parseJson(value) {
55
- return JSON.parse(value);
56
- }
57
- function encodeJson(value) {
58
- return JSON.stringify(value);
59
- }
60
- function missing(value) {
61
- return value === null || value === undefined;
62
- }
63
- function placeholders(count) {
64
- return Array.from({ length: count }, () => "?").join(", ");
65
- }
66
- function parseRunRow(value) {
67
- const row = RunRowSchema.parse(value);
68
- return AgentStoredRunSchema2.parse({
69
- schemaVersion: 1,
70
- run: AgentRunSchema2.parse(parseJson(row.payload)),
71
- ...row.terminal_assistant_payload === null ? {} : {
72
- terminalAssistant: AgentMessageSchema2.parse(parseJson(row.terminal_assistant_payload))
73
- }
74
- });
75
- }
76
- function parseEventRow(value) {
77
- const row = EventRowSchema.parse(value);
78
- return AgentStoreEventEnvelopeSchema2.parse({
79
- schemaVersion: row.schema_version,
80
- eventId: row.event_id,
81
- conversationId: row.conversation_id,
82
- seq: row.seq,
83
- kind: row.kind,
84
- occurredAt: row.occurred_at,
85
- payload: parseJson(row.payload),
86
- ...row.ignorable === 1 && { ignorable: true }
87
- });
88
- }
89
-
90
- // src/agent-runtime/sqlite-events.ts
91
- var ArchiveProjectionRowSchema = z2.object({
92
- name: z2.string(),
93
- version: z2.int().positive(),
94
- upto_seq: z2.int().nonnegative(),
95
- payload: z2.string(),
96
- updated_at: z2.string()
97
- });
98
- var ArchiveSpillRowSchema = z2.object({
99
- reference_id: z2.string(),
100
- run_id: z2.string().nullable(),
101
- tool_call_id: z2.string().nullable(),
102
- media_type: z2.string(),
103
- bytes: z2.int().nonnegative(),
104
- sha256: z2.string(),
105
- created_at: z2.string(),
106
- expires_at: z2.string().nullable(),
107
- authorization_payload: z2.string().nullable(),
108
- payload: z2.instanceof(Uint8Array)
109
- });
110
- var sqliteEvents = {
111
- async append(transaction, rawEvent) {
112
- const event = rawEvent;
113
- const last = transaction.prepare("SELECT COALESCE(MAX(seq), 0) AS count FROM stitchkit_agent_runtime_events WHERE conversation_id = ?").get(event.conversationId);
114
- const seq = CountRowSchema.parse(last).count + 1;
115
- transaction.prepare(`
116
- INSERT INTO stitchkit_agent_runtime_events (
117
- conversation_id, seq, event_id, schema_version, kind, occurred_at, ignorable, payload
118
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
119
- `).run(event.conversationId, seq, event.eventId, event.schemaVersion, event.kind, event.occurredAt, event.ignorable ? 1 : 0, encodeJson(event.payload));
120
- return AgentStoreEventEnvelopeSchema2.parse({ ...event, seq });
121
- },
122
- async list(transaction, input) {
123
- const clauses = ["conversation_id = ?"];
124
- const values = [input.conversationId];
125
- if (input.fromSeq !== undefined) {
126
- clauses.push("seq >= ?");
127
- values.push(input.fromSeq);
128
- }
129
- if (input.toSeq !== undefined) {
130
- clauses.push("seq <= ?");
131
- values.push(input.toSeq);
132
- }
133
- const rows = transaction.prepare(`
134
- SELECT event_id, conversation_id, seq, schema_version, kind, occurred_at,
135
- ignorable, payload
136
- FROM stitchkit_agent_runtime_events
137
- WHERE ${clauses.join(" AND ")}
138
- ORDER BY seq ASC LIMIT ?
139
- `).all(...values, input.limit + 1).map(parseEventRow);
140
- const hasMore = rows.length > input.limit;
141
- const items = rows.slice(0, input.limit);
142
- const lastEvent = items.at(-1);
143
- return AgentStoreEventPageSchema2.parse({
144
- items,
145
- ...hasMore && lastEvent ? { nextSeq: lastEvent.seq + 1 } : {}
146
- });
147
- },
148
- async find(transaction, input) {
149
- const row = transaction.prepare(`
150
- SELECT event_id, conversation_id, seq, schema_version, kind, occurred_at,
151
- ignorable, payload
152
- FROM stitchkit_agent_runtime_events
153
- WHERE event_id = ? AND conversation_id = ?
154
- `).get(input.eventId, input.conversationId);
155
- return row === null || row === undefined ? undefined : parseEventRow(row);
156
- }
157
- };
158
- var sqliteArchive = {
159
- async export(transaction, conversationId) {
160
- const projections = transaction.prepare(`
161
- SELECT name, version, upto_seq, payload, updated_at
162
- FROM stitchkit_agent_runtime_projections
163
- WHERE conversation_id = ? ORDER BY name
164
- `).all(conversationId).map((raw) => {
165
- const row = ArchiveProjectionRowSchema.parse(raw);
166
- return {
167
- name: row.name,
168
- version: row.version,
169
- uptoSeq: row.upto_seq,
170
- value: z2.json().parse(parseJson(row.payload)),
171
- updatedAt: row.updated_at
172
- };
173
- });
174
- const spills = transaction.prepare(`
175
- SELECT reference_id, run_id, tool_call_id, media_type, bytes, sha256,
176
- created_at, expires_at, authorization_payload, payload
177
- FROM stitchkit_agent_runtime_spills
178
- WHERE conversation_id = ? ORDER BY created_at, reference_id
179
- `).all(conversationId).map((raw) => {
180
- const row = ArchiveSpillRowSchema.parse(raw);
181
- return {
182
- reference: row.reference_id,
183
- ...row.run_id && { runId: row.run_id },
184
- ...row.tool_call_id && { toolCallId: row.tool_call_id },
185
- mediaType: row.media_type,
186
- bytes: row.bytes,
187
- sha256: row.sha256,
188
- createdAt: row.created_at,
189
- ...row.expires_at && { expiresAt: row.expires_at },
190
- ...row.authorization_payload && {
191
- authorization: z2.json().parse(parseJson(row.authorization_payload))
192
- },
193
- base64: Buffer.from(row.payload).toString("base64")
194
- };
195
- });
196
- return { projections, spills };
197
- },
198
- async import(transaction, archive) {
199
- for (const raw of archive.projections) {
200
- if (typeof raw === "object" && raw !== null && !Array.isArray(raw) && raw.archiveType === "runtime-snapshot") {
201
- continue;
202
- }
203
- const projection = ArchiveProjectionSchema.parse(raw);
204
- transaction.prepare(`
205
- INSERT INTO stitchkit_agent_runtime_projections
206
- (conversation_id, name, version, upto_seq, payload, updated_at)
207
- VALUES (?, ?, ?, ?, ?, ?)
208
- `).run(archive.conversationId, projection.name, projection.version, projection.uptoSeq, encodeJson(projection.value), projection.updatedAt);
209
- }
210
- for (const raw of archive.spills) {
211
- const spill = z2.object({
212
- reference: z2.string(),
213
- runId: z2.string().optional(),
214
- toolCallId: z2.string().optional(),
215
- mediaType: z2.string(),
216
- bytes: z2.int().nonnegative(),
217
- sha256: z2.string(),
218
- createdAt: z2.string(),
219
- expiresAt: z2.string().optional(),
220
- authorization: z2.json().optional(),
221
- base64: z2.string()
222
- }).strict().parse(raw);
223
- const payload = Buffer.from(spill.base64, "base64");
224
- if (payload.byteLength !== spill.bytes) {
225
- throw new TypeError("Conversation archive spill byte count is inconsistent");
226
- }
227
- if (createHash("sha256").update(payload).digest("hex") !== spill.sha256) {
228
- throw new TypeError("Conversation archive spill digest is inconsistent");
229
- }
230
- transaction.prepare(`
231
- INSERT INTO stitchkit_agent_runtime_spills (
232
- reference_id, conversation_id, run_id, tool_call_id, media_type,
233
- bytes, sha256, created_at, expires_at, authorization_payload, payload
234
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
235
- `).run(spill.reference, archive.conversationId, spill.runId ?? null, spill.toolCallId ?? null, spill.mediaType, spill.bytes, spill.sha256, spill.createdAt, spill.expiresAt ?? null, spill.authorization ? encodeJson(spill.authorization) : null, payload);
236
- }
237
- }
238
- };
239
-
240
- // src/agent-runtime/sqlite-history.ts
241
- var sqliteHistory = {
242
- async restore(transaction, input) {
243
- const compacted = new Set(input.compactedMessageIds);
244
- for (const [position, message] of input.messages.entries()) {
245
- if (message.conversationId !== input.conversationId)
246
- throw new TypeError("Restored history has a foreign conversation");
247
- transaction.prepare(`INSERT INTO stitchkit_agent_runtime_messages
248
- (conversation_id, id, position, active, payload) VALUES (?, ?, ?, ?, ?)`).run(input.conversationId, message.id, position, compacted.has(message.id) ? 0 : 1, encodeJson(message));
249
- }
250
- },
251
- async load(transaction, conversationId) {
252
- return transaction.prepare(`
253
- SELECT payload FROM stitchkit_agent_runtime_messages
254
- WHERE conversation_id = ? AND active = 1 ORDER BY position ASC
255
- `).all(conversationId).map((value) => AgentMessageSchema2.parse(parseJson(MessageRowSchema.parse(value).payload)));
256
- },
257
- async hasMessage(transaction, input) {
258
- const row = transaction.prepare(`
259
- SELECT count(*) AS count FROM stitchkit_agent_runtime_messages
260
- WHERE conversation_id = ? AND id = ?
261
- `).get(input.conversationId, input.messageId);
262
- return CountRowSchema.parse(row).count > 0;
263
- },
264
- async apply(transaction, rawMutation) {
265
- const mutation = AgentHistoryMutationSchema2.parse(rawMutation);
266
- const message = mutation.type === "admit" ? mutation.input : mutation.type === "upsert-assistant" ? mutation.message : mutation.type === "seed" || mutation.type === "insert" ? mutation.message : mutation.summary;
267
- if (mutation.type === "seed") {
268
- transaction.prepare(`
269
- UPDATE stitchkit_agent_runtime_messages SET position = position + 1
270
- WHERE conversation_id = ?
271
- `).run(mutation.message.conversationId);
272
- transaction.prepare(`
273
- INSERT INTO stitchkit_agent_runtime_messages
274
- (conversation_id, id, position, active, payload)
275
- VALUES (?, ?, 0, 1, ?)
276
- ON CONFLICT (conversation_id, id) DO UPDATE SET
277
- position = excluded.position,
278
- active = excluded.active,
279
- payload = excluded.payload
280
- `).run(mutation.message.conversationId, mutation.message.id, encodeJson(mutation.message));
281
- return;
282
- }
283
- if (mutation.type === "replace-compacted-range") {
284
- const parameters = mutation.replacedMessageIds;
285
- const rows = transaction.prepare(`
286
- SELECT position FROM stitchkit_agent_runtime_messages
287
- WHERE conversation_id = ? AND active = 1
288
- AND id IN (${placeholders(parameters.length)})
289
- ORDER BY position ASC
290
- `).all(message.conversationId, ...parameters).map((row) => PositionedMessageRowSchema.parse(row));
291
- const anchor = rows.at(-1);
292
- if (!anchor || rows.length !== parameters.length) {
293
- throw new Error("Compaction range changed inside the transaction");
294
- }
295
- transaction.prepare(`
296
- UPDATE stitchkit_agent_runtime_messages SET active = 0
297
- WHERE conversation_id = ? AND id IN (${placeholders(parameters.length)})
298
- `).run(message.conversationId, ...parameters);
299
- transaction.prepare(`
300
- INSERT INTO stitchkit_agent_runtime_messages
301
- (conversation_id, id, position, active, payload)
302
- VALUES (?, ?, ?, 1, ?)
303
- `).run(message.conversationId, message.id, anchor.position, encodeJson(message));
304
- return;
305
- }
306
- const existing = transaction.prepare(`
307
- SELECT position FROM stitchkit_agent_runtime_messages
308
- WHERE conversation_id = ? AND id = ?
309
- `).get(message.conversationId, message.id);
310
- if (mutation.type === "insert" && missing(existing) && mutation.beforeMessageId) {
311
- const anchor = transaction.prepare(`
312
- SELECT position FROM stitchkit_agent_runtime_messages
313
- WHERE conversation_id = ? AND id = ? AND active = 1
314
- `).get(message.conversationId, mutation.beforeMessageId);
315
- if (missing(anchor))
316
- throw new Error("Insert anchor is not in the active history");
317
- const { position } = PositionedMessageRowSchema.parse(anchor);
318
- transaction.prepare(`
319
- UPDATE stitchkit_agent_runtime_messages SET position = position + 1
320
- WHERE conversation_id = ? AND position >= ?
321
- `).run(message.conversationId, position);
322
- transaction.prepare(`
323
- INSERT INTO stitchkit_agent_runtime_messages
324
- (conversation_id, id, position, active, payload)
325
- VALUES (?, ?, ?, 1, ?)
326
- `).run(message.conversationId, message.id, position, encodeJson(message));
327
- return;
328
- }
329
- if (!missing(existing)) {
330
- transaction.prepare(`
331
- UPDATE stitchkit_agent_runtime_messages SET payload = ?, active = 1
332
- WHERE conversation_id = ? AND id = ?
333
- `).run(encodeJson(message), message.conversationId, message.id);
334
- return;
335
- }
336
- const last = transaction.prepare(`
337
- SELECT position FROM stitchkit_agent_runtime_messages
338
- WHERE conversation_id = ? ORDER BY position DESC LIMIT 1
339
- `).get(message.conversationId);
340
- const position = missing(last) ? 0 : PositionedMessageRowSchema.parse(last).position + 1;
341
- transaction.prepare(`
342
- INSERT INTO stitchkit_agent_runtime_messages
343
- (conversation_id, id, position, active, payload)
344
- VALUES (?, ?, ?, 1, ?)
345
- `).run(message.conversationId, message.id, position, encodeJson(message));
346
- }
347
- };
348
-
349
- // src/agent-runtime/sqlite-ledger.ts
350
- import { z as z3 } from "zod";
351
- var AdmissionRowSchema = z3.object({
352
- conversation_id: z3.string(),
353
- idempotency_key: z3.string(),
354
- input_payload: z3.string(),
355
- run_id: z3.string(),
356
- assistant_message_id: z3.string()
357
- });
358
- var SeedRowSchema = z3.object({
359
- conversation_id: z3.string(),
360
- seed_key: z3.string(),
361
- message_ids: z3.string()
362
- });
363
- function parseAdmissionRow(value) {
364
- const row = AdmissionRowSchema.parse(value);
365
- return AgentAdmissionReceiptSchema2.parse({
366
- schemaVersion: 1,
367
- conversationId: row.conversation_id,
368
- idempotencyKey: row.idempotency_key,
369
- input: AgentMessageSchema2.parse(parseJson(row.input_payload)),
370
- runId: row.run_id,
371
- assistantMessageId: row.assistant_message_id
372
- });
373
- }
374
- var sqliteHeads = {
375
- async load(transaction, conversationId) {
376
- const value = transaction.prepare("SELECT version FROM stitchkit_agent_runtime_heads WHERE conversation_id = ?").get(conversationId);
377
- if (missing(value))
378
- return;
379
- const row = HeadRowSchema.parse(value);
380
- return AgentRuntimeHeadSchema2.parse({
381
- schemaVersion: 1,
382
- conversationId,
383
- version: row.version
384
- });
385
- },
386
- async compareAndSwap(transaction, input) {
387
- const current = transaction.prepare("SELECT version FROM stitchkit_agent_runtime_heads WHERE conversation_id = ?").get(input.conversationId);
388
- const actualVersion = missing(current) ? 0 : HeadRowSchema.parse(current).version;
389
- if (actualVersion !== input.expectedVersion)
390
- return { outcome: "conflict", actualVersion };
391
- transaction.prepare(`
392
- INSERT INTO stitchkit_agent_runtime_heads (conversation_id, version)
393
- VALUES (?, ?)
394
- ON CONFLICT (conversation_id) DO UPDATE SET version = excluded.version
395
- `).run(input.conversationId, input.next.version);
396
- return { outcome: "applied" };
397
- }
398
- };
399
- var sqliteRuns = {
400
- async load(transaction, input) {
401
- const row = transaction.prepare(`
402
- SELECT payload, terminal_assistant_payload
403
- FROM stitchkit_agent_runtime_runs
404
- WHERE conversation_id = ? AND run_id = ?
405
- `).get(input.conversationId, input.runId);
406
- return missing(row) ? undefined : parseRunRow(row);
407
- },
408
- async loadByAssistantMessageId(transaction, input) {
409
- const row = transaction.prepare(`
410
- SELECT payload, terminal_assistant_payload
411
- FROM stitchkit_agent_runtime_runs
412
- WHERE conversation_id = ? AND assistant_message_id = ?
413
- `).get(input.conversationId, input.assistantMessageId);
414
- return missing(row) ? undefined : parseRunRow(row);
415
- },
416
- async loadMany(transaction, input) {
417
- if (input.runIds.length === 0)
418
- return [];
419
- return transaction.prepare(`
420
- SELECT payload, terminal_assistant_payload
421
- FROM stitchkit_agent_runtime_runs
422
- WHERE conversation_id = ? AND run_id IN (${placeholders(input.runIds.length)})
423
- `).all(input.conversationId, ...input.runIds).map(parseRunRow);
424
- },
425
- async listActive(transaction, conversationId) {
426
- return transaction.prepare(`
427
- SELECT payload, terminal_assistant_payload
428
- FROM stitchkit_agent_runtime_runs
429
- WHERE conversation_id = ? AND state IN ('queued', 'running', 'interrupt_requested')
430
- `).all(conversationId).map(parseRunRow);
431
- },
432
- async save(transaction, rawRecord) {
433
- const record = AgentStoredRunSchema2.parse(rawRecord);
434
- transaction.prepare(`
435
- INSERT INTO stitchkit_agent_runtime_runs (
436
- conversation_id, run_id, assistant_message_id, state, created_at, payload,
437
- terminal_assistant_payload
438
- ) VALUES (?, ?, ?, ?, ?, ?, ?)
439
- ON CONFLICT (conversation_id, run_id) DO UPDATE SET
440
- assistant_message_id = excluded.assistant_message_id,
441
- state = excluded.state,
442
- created_at = excluded.created_at,
443
- payload = excluded.payload,
444
- terminal_assistant_payload = excluded.terminal_assistant_payload
445
- `).run(record.run.conversationId, record.run.id, record.run.assistantMessageId, record.run.state, record.run.createdAt, encodeJson(record.run), record.terminalAssistant ? encodeJson(record.terminalAssistant) : null);
446
- }
447
- };
448
- var sqliteAdmissions = {
449
- async load(transaction, input) {
450
- const value = transaction.prepare(`
451
- SELECT conversation_id, idempotency_key, input_payload, run_id, assistant_message_id
452
- FROM stitchkit_agent_runtime_admissions
453
- WHERE conversation_id = ? AND idempotency_key = ?
454
- `).get(input.conversationId, input.idempotencyKey);
455
- return missing(value) ? undefined : parseAdmissionRow(value);
456
- },
457
- async loadByInputMessageId(transaction, input) {
458
- const value = transaction.prepare(`
459
- SELECT conversation_id, idempotency_key, input_payload, run_id, assistant_message_id
460
- FROM stitchkit_agent_runtime_admissions
461
- WHERE conversation_id = ? AND input_message_id = ?
462
- `).get(input.conversationId, input.inputMessageId);
463
- return missing(value) ? undefined : parseAdmissionRow(value);
464
- },
465
- async create(transaction, rawReceipt) {
466
- const receipt = AgentAdmissionReceiptSchema2.parse(rawReceipt);
467
- transaction.prepare(`
468
- INSERT INTO stitchkit_agent_runtime_admissions (
469
- conversation_id, idempotency_key, input_message_id, run_id,
470
- assistant_message_id, input_payload
471
- ) VALUES (?, ?, ?, ?, ?, ?)
472
- `).run(receipt.conversationId, receipt.idempotencyKey, receipt.input.id, receipt.runId, receipt.assistantMessageId, encodeJson(receipt.input));
473
- }
474
- };
475
- var sqliteSeeds = {
476
- async load(transaction, input) {
477
- const value = transaction.prepare(`
478
- SELECT conversation_id, seed_key, message_ids
479
- FROM stitchkit_agent_runtime_seeds
480
- WHERE conversation_id = ? AND seed_key = ?
481
- `).get(input.conversationId, input.seedKey);
482
- if (missing(value))
483
- return;
484
- const row = SeedRowSchema.parse(value);
485
- return AgentSeedReceiptSchema2.parse({
486
- schemaVersion: 1,
487
- conversationId: row.conversation_id,
488
- seedKey: row.seed_key,
489
- messageIds: z3.array(z3.string().min(1)).parse(parseJson(row.message_ids))
490
- });
491
- },
492
- async create(transaction, rawReceipt) {
493
- const receipt = AgentSeedReceiptSchema2.parse(rawReceipt);
494
- transaction.prepare(`
495
- INSERT INTO stitchkit_agent_runtime_seeds (
496
- conversation_id, seed_key, message_ids, created_at
497
- ) VALUES (?, ?, ?, ?)
498
- `).run(receipt.conversationId, receipt.seedKey, encodeJson(receipt.messageIds), new Date().toISOString());
499
- }
500
- };
501
-
502
- // src/agent-runtime/sqlite-purge.ts
503
- var OWNED_TABLES = [
504
- "stitchkit_agent_runtime_spills",
505
- "stitchkit_agent_runtime_schedules",
506
- "stitchkit_agent_runtime_projections",
507
- "stitchkit_agent_runtime_events",
508
- "stitchkit_agent_runtime_messages",
509
- "stitchkit_agent_runtime_seeds",
510
- "stitchkit_agent_runtime_admissions",
511
- "stitchkit_agent_runtime_runs",
512
- "stitchkit_agent_runtime_heads"
513
- ];
514
- function initializeSqliteConversationPurge(database) {
515
- database.exec(`
516
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_purged (
517
- conversation_id TEXT PRIMARY KEY
518
- );
519
- `);
520
- for (const table of OWNED_TABLES) {
521
- for (const operation of ["INSERT", "UPDATE"]) {
522
- database.exec(`
523
- CREATE TRIGGER IF NOT EXISTS ${table}_purge_${operation.toLowerCase()}
524
- BEFORE ${operation} ON ${table}
525
- WHEN EXISTS (
526
- SELECT 1 FROM stitchkit_agent_runtime_purged WHERE conversation_id = NEW.conversation_id
527
- )
528
- BEGIN SELECT RAISE(ABORT, 'Agent conversation has been purged'); END;
529
- `);
530
- }
531
- }
532
- }
533
- function sqliteConversationPurge(database) {
534
- const table = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'stitchkit_agent_runtime_purged'").get();
535
- if (table === null || table === undefined)
536
- return;
537
- return {
538
- async isEmpty(transaction, conversationId) {
539
- for (const table of OWNED_TABLES) {
540
- const row = transaction.prepare(`SELECT 1 FROM ${table} WHERE conversation_id = ? LIMIT 1`).get(conversationId);
541
- if (row !== null && row !== undefined)
542
- return false;
543
- }
544
- return transaction.prepare("SELECT 1 FROM stitchkit_agent_runtime_children WHERE parent_conversation_id = ? OR child_conversation_id = ? LIMIT 1").get(conversationId, conversationId) == null;
545
- },
546
- async isPurged(transaction, conversationId) {
547
- const row = transaction.prepare("SELECT conversation_id FROM stitchkit_agent_runtime_purged WHERE conversation_id = ?").get(conversationId);
548
- return row !== null && row !== undefined;
549
- },
550
- async remove(transaction, conversationId) {
551
- transaction.prepare("INSERT INTO stitchkit_agent_runtime_purged (conversation_id) VALUES (?)").run(conversationId);
552
- for (const table of OWNED_TABLES) {
553
- transaction.prepare(`DELETE FROM ${table} WHERE conversation_id = ?`).run(conversationId);
554
- }
555
- transaction.prepare("DELETE FROM stitchkit_agent_runtime_children WHERE parent_conversation_id = ? OR child_conversation_id = ?").run(conversationId, conversationId);
556
- }
557
- };
558
- }
559
-
560
- // src/agent-runtime/sqlite-reads.ts
561
- import { z as z4 } from "zod";
562
-
563
- // src/agent-runtime/sqlite-transactions.ts
564
- import { AsyncLocalStorage } from "node:async_hooks";
565
- function createSqliteStoreState(database) {
566
- return {
567
- database,
568
- closing: false,
569
- closed: false,
570
- tail: Promise.resolve(),
571
- insideScope: new AsyncLocalStorage
572
- };
573
- }
574
- function serial(state, work) {
575
- if (state.closing || state.closed) {
576
- return Promise.reject(new Error("SQLite agent-runtime store is closing"));
577
- }
578
- if (state.insideScope.getStore()) {
579
- return Promise.reject(new Error("SQLite agent-runtime store called from inside its own transaction scope; use scope.database and scope.appendEvent"));
580
- }
581
- const result = state.tail.then(work, work);
582
- state.tail = result.then(() => {
583
- return;
584
- }, () => {
585
- return;
586
- });
587
- return result;
588
- }
589
- function runSqliteTransaction(state, access, work) {
590
- const database = state.database;
591
- return serial(state, async () => {
592
- database.exec(access === "read" ? "BEGIN" : "BEGIN IMMEDIATE");
593
- try {
594
- const result = await work(database);
595
- database.exec("COMMIT");
596
- return result;
597
- } catch (error) {
598
- database.exec("ROLLBACK");
599
- throw error;
600
- }
601
- });
602
- }
603
- function runSqliteStoreScope(state, driver, work) {
604
- return runSqliteTransaction(state, "write", (transaction) => state.insideScope.run(true, () => work({
605
- database: transaction,
606
- appendEvent: (input) => appendEventIn(driver, transaction, AppendAgentStoreEventSchema2.parse(input))
607
- })));
608
- }
609
- async function closeSqliteStore(state) {
610
- if (state.closed)
611
- return;
612
- state.closing = true;
613
- await state.tail;
614
- state.database.close();
615
- state.closed = true;
616
- }
617
-
618
- // src/agent-runtime/sqlite-reads.ts
619
- var RecoverableRowSchema = z4.object({
620
- conversation_id: z4.string(),
621
- run_id: z4.string(),
622
- payload: z4.string()
623
- });
624
- var ConversationHeadRowSchema = z4.object({
625
- conversation_id: z4.string(),
626
- version: z4.number().int().nonnegative()
627
- });
628
- var MessagePageRowSchema = z4.object({
629
- row_id: z4.number().int().positive(),
630
- position: z4.number().int().nonnegative(),
631
- active: z4.union([z4.literal(0), z4.literal(1)]),
632
- payload: z4.string()
633
- });
634
- function recoveryCursor(conversationId, runId) {
635
- return encodeJson([conversationId, runId]);
636
- }
637
- function parseRecoveryCursor(cursor) {
638
- return z4.tuple([z4.string().min(1), z4.string().min(1)]).parse(parseJson(cursor));
639
- }
640
- function conversationCursor(conversationId) {
641
- return encodeJson([conversationId]);
642
- }
643
- function parseConversationCursor(cursor) {
644
- return z4.tuple([z4.string().min(1)]).parse(parseJson(cursor))[0];
645
- }
646
- function messageCursor(position, rowId) {
647
- return encodeJson([position, rowId]);
648
- }
649
- function parseMessageCursor(cursor) {
650
- const parsed = z4.union([
651
- z4.tuple([z4.int().nonnegative(), z4.int().positive()]),
652
- z4.tuple([z4.int().nonnegative()])
653
- ]).parse(parseJson(cursor));
654
- const [position, rowId] = parsed;
655
- return { position, ...rowId !== undefined && { rowId } };
656
- }
657
- function messagePreview(message) {
658
- const text = message.parts.find((part) => part.type === "text");
659
- return text?.type === "text" ? text.text.slice(0, 160) : message.role;
660
- }
661
- function scanSqliteRecoverable(state, input) {
662
- const database = state.database;
663
- return runSqliteTransaction(state, "read", async () => {
664
- const cursor = input.cursor ? parseRecoveryCursor(input.cursor) : undefined;
665
- const values = cursor ? [cursor[0], cursor[0], cursor[1], input.limit + 1] : [input.limit + 1];
666
- const rows = database.prepare(`
667
- SELECT conversation_id, run_id, payload
668
- FROM stitchkit_agent_runtime_runs
669
- WHERE state IN ('queued', 'running', 'interrupt_requested')
670
- ${cursor ? "AND (conversation_id > ? OR (conversation_id = ? AND run_id > ?))" : ""}
671
- ORDER BY conversation_id ASC, run_id ASC LIMIT ?
672
- `).all(...values).map((row) => RecoverableRowSchema.parse(row));
673
- const hasMore = rows.length > input.limit;
674
- const pageRows = rows.slice(0, input.limit);
675
- const items = pageRows.map((row) => {
676
- const run = AgentRunSchema2.parse(parseJson(row.payload));
677
- return AgentRecoverableDescriptorSchema2.parse({
678
- conversationId: row.conversation_id,
679
- run
680
- });
681
- });
682
- const last = pageRows.at(-1);
683
- return AgentRecoverablePageSchema2.parse({
684
- items,
685
- ...hasMore && last ? { nextCursor: recoveryCursor(last.conversation_id, last.run_id) } : {}
686
- });
687
- });
688
- }
689
- function listSqliteConversations(state, input) {
690
- const database = state.database;
691
- return runSqliteTransaction(state, "read", async () => {
692
- if (!Number.isSafeInteger(input.limit) || input.limit < 1 || input.limit > 1000) {
693
- throw new TypeError("Conversation page limit must be between 1 and 1000");
694
- }
695
- const cursor = input.cursor ? parseConversationCursor(input.cursor) : undefined;
696
- const search = input.search?.trim();
697
- const clauses = [
698
- ...cursor ? ["conversation_id > ?"] : [],
699
- ...search ? ["instr(conversation_id, ?) > 0"] : []
700
- ];
701
- const parameters = [
702
- ...cursor ? [cursor] : [],
703
- ...search ? [search] : [],
704
- input.limit + 1
705
- ];
706
- const rows = database.prepare(`
707
- SELECT conversation_id, version FROM stitchkit_agent_runtime_heads
708
- ${clauses.length > 0 ? `WHERE ${clauses.join(" AND ")}` : ""}
709
- ORDER BY conversation_id ASC LIMIT ?
710
- `).all(...parameters).map((row) => ConversationHeadRowSchema.parse(row));
711
- const hasMore = rows.length > input.limit;
712
- const pageRows = rows.slice(0, input.limit);
713
- const items = pageRows.map((row) => {
714
- const latestRaw = database.prepare(`
715
- SELECT payload FROM stitchkit_agent_runtime_messages
716
- WHERE conversation_id = ? AND active = 1
717
- ORDER BY position DESC LIMIT 1
718
- `).get(row.conversation_id);
719
- if (missing(latestRaw)) {
720
- throw new Error("Agent conversation head has no active history");
721
- }
722
- const latest = AgentMessageSchema2.parse(parseJson(MessageRowSchema.parse(latestRaw).payload));
723
- const active = CountRowSchema.parse(database.prepare(`
724
- SELECT count(*) AS count FROM stitchkit_agent_runtime_runs
725
- WHERE conversation_id = ?
726
- AND state IN ('queued', 'running', 'interrupt_requested')
727
- `).get(row.conversation_id));
728
- return {
729
- conversationId: row.conversation_id,
730
- version: row.version,
731
- updatedAt: latest.updatedAt,
732
- preview: messagePreview(latest),
733
- activeRuns: active.count
734
- };
735
- });
736
- const last = pageRows.at(-1);
737
- return AgentConversationPageSchema2.parse({
738
- items,
739
- ...hasMore && last ? { nextCursor: conversationCursor(last.conversation_id) } : {}
740
- });
741
- });
742
- }
743
- function pageSqliteConversationMessages(state, input) {
744
- const database = state.database;
745
- return runSqliteTransaction(state, "read", async () => {
746
- if (!Number.isSafeInteger(input.limit) || input.limit < 1 || input.limit > 1000) {
747
- throw new TypeError("Conversation message page limit must be between 1 and 1000");
748
- }
749
- const cursor = input.cursor ? parseMessageCursor(input.cursor) : undefined;
750
- const before = input.direction === "before";
751
- const direction = before ? "DESC" : "ASC";
752
- const comparison = cursor === undefined ? "" : cursor.rowId === undefined ? `AND position ${before ? "<" : ">"} ?` : `AND (position, rowid) ${before ? "<" : ">"} (?, ?)`;
753
- const rows = database.prepare(`
754
- SELECT rowid AS row_id, position, active, payload
755
- FROM stitchkit_agent_runtime_messages
756
- WHERE conversation_id = ?
757
- ${input.includeCompacted === true ? "" : "AND active = 1"}
758
- ${comparison}
759
- ORDER BY position ${direction}, rowid ${direction} LIMIT ?
760
- `).all(input.conversationId, ...cursor === undefined ? [] : cursor.rowId === undefined ? [cursor.position] : [cursor.position, cursor.rowId], input.limit + 1).map((row) => MessagePageRowSchema.parse(row));
761
- const hasMore = rows.length > input.limit;
762
- const pageRows = rows.slice(0, input.limit);
763
- const ordered = before ? [...pageRows].reverse() : pageRows;
764
- const boundary = pageRows.at(-1);
765
- const items = ordered.map((row) => ({
766
- message: AgentMessageSchema2.parse(parseJson(row.payload)),
767
- active: row.active === 1
768
- }));
769
- return AgentConversationMessagePageSchema2.parse({
770
- items: items.map((entry) => entry.message),
771
- compacted: items.filter((entry) => !entry.active).map((entry) => entry.message.id),
772
- ...hasMore && boundary ? { nextCursor: messageCursor(boundary.position, boundary.row_id) } : {}
773
- });
774
- });
775
- }
776
-
777
- // src/agent-runtime/sqlite-schema.ts
778
- import { z as z6 } from "zod";
779
-
780
- // src/agent-runtime/store-migrations/v1-to-v2.ts
781
- import { randomUUID } from "node:crypto";
782
- import { z as z5 } from "zod";
783
- var ConversationRowSchema = z5.object({
784
- conversation_id: z5.string().min(1),
785
- version: z5.int().nonnegative()
786
- });
787
- var PayloadRowSchema = z5.object({
788
- payload: z5.string(),
789
- terminal_assistant_payload: z5.string().nullable().optional()
790
- });
791
- var HistoryRowSchema = z5.object({
792
- payload: z5.string(),
793
- active: z5.union([z5.literal(0), z5.literal(1)])
794
- });
795
- var AdmissionRowSchema2 = z5.object({
796
- conversation_id: z5.string(),
797
- idempotency_key: z5.string(),
798
- input_payload: z5.string(),
799
- run_id: z5.string(),
800
- assistant_message_id: z5.string()
801
- });
802
- function parseJson2(value) {
803
- return JSON.parse(value);
804
- }
805
- function createDurableTables(database) {
806
- database.exec(`
807
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_events (
808
- row_id INTEGER PRIMARY KEY AUTOINCREMENT,
809
- conversation_id TEXT NOT NULL,
810
- seq INTEGER NOT NULL CHECK (seq > 0),
811
- event_id TEXT NOT NULL UNIQUE,
812
- schema_version INTEGER NOT NULL CHECK (schema_version > 0),
813
- kind TEXT NOT NULL,
814
- occurred_at TEXT NOT NULL,
815
- ignorable INTEGER NOT NULL DEFAULT 0 CHECK (ignorable IN (0, 1)),
816
- payload TEXT NOT NULL,
817
- UNIQUE (conversation_id, seq)
818
- );
819
- CREATE INDEX IF NOT EXISTS stitchkit_agent_runtime_events_time
820
- ON stitchkit_agent_runtime_events (conversation_id, occurred_at, seq);
821
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_projections (
822
- conversation_id TEXT NOT NULL,
823
- name TEXT NOT NULL,
824
- version INTEGER NOT NULL CHECK (version > 0),
825
- upto_seq INTEGER NOT NULL CHECK (upto_seq >= 0),
826
- payload TEXT NOT NULL,
827
- updated_at TEXT NOT NULL,
828
- PRIMARY KEY (conversation_id, name)
829
- );
830
- CREATE INDEX IF NOT EXISTS stitchkit_agent_runtime_projection_updates
831
- ON stitchkit_agent_runtime_projections (name, updated_at, conversation_id);
832
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_spills (
833
- reference_id TEXT PRIMARY KEY,
834
- conversation_id TEXT NOT NULL,
835
- run_id TEXT,
836
- tool_call_id TEXT,
837
- media_type TEXT NOT NULL,
838
- bytes INTEGER NOT NULL CHECK (bytes >= 0),
839
- sha256 TEXT NOT NULL,
840
- created_at TEXT NOT NULL,
841
- expires_at TEXT,
842
- authorization_payload TEXT,
843
- payload BLOB NOT NULL
844
- );
845
- CREATE INDEX IF NOT EXISTS stitchkit_agent_runtime_spills_owner
846
- ON stitchkit_agent_runtime_spills (conversation_id, created_at);
847
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_schedules (
848
- id TEXT PRIMARY KEY,
849
- conversation_id TEXT NOT NULL,
850
- kind TEXT NOT NULL,
851
- next_at TEXT NOT NULL,
852
- interval_ms INTEGER,
853
- time_zone TEXT,
854
- input_payload TEXT NOT NULL,
855
- state TEXT NOT NULL,
856
- occurrence INTEGER NOT NULL DEFAULT 0 CHECK (occurrence >= 0),
857
- claim_owner TEXT,
858
- claim_until TEXT,
859
- created_at TEXT NOT NULL,
860
- updated_at TEXT NOT NULL
861
- );
862
- CREATE INDEX IF NOT EXISTS stitchkit_agent_runtime_schedules_due
863
- ON stitchkit_agent_runtime_schedules (state, next_at);
864
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_children (
865
- parent_conversation_id TEXT NOT NULL,
866
- child_conversation_id TEXT NOT NULL UNIQUE,
867
- seed_upto_seq INTEGER,
868
- state TEXT NOT NULL,
869
- budget_payload TEXT NOT NULL,
870
- usage_payload TEXT NOT NULL,
871
- result_reference TEXT,
872
- created_at TEXT NOT NULL,
873
- updated_at TEXT NOT NULL,
874
- PRIMARY KEY (parent_conversation_id, child_conversation_id)
875
- );
876
- `);
877
- try {
878
- database.exec(`
879
- CREATE VIRTUAL TABLE IF NOT EXISTS stitchkit_agent_runtime_events_fts
880
- USING fts5(
881
- conversation_id UNINDEXED,
882
- event_seq UNINDEXED,
883
- occurred_at UNINDEXED,
884
- body,
885
- tokenize = 'unicode61 remove_diacritics 2'
886
- );
887
- CREATE TRIGGER IF NOT EXISTS stitchkit_agent_runtime_events_fts_insert
888
- AFTER INSERT ON stitchkit_agent_runtime_events BEGIN
889
- INSERT INTO stitchkit_agent_runtime_events_fts(
890
- rowid, conversation_id, event_seq, occurred_at, body
891
- ) VALUES (new.row_id, new.conversation_id, new.seq, new.occurred_at, new.payload);
892
- END;
893
- CREATE TRIGGER IF NOT EXISTS stitchkit_agent_runtime_events_fts_delete
894
- AFTER DELETE ON stitchkit_agent_runtime_events BEGIN
895
- DELETE FROM stitchkit_agent_runtime_events_fts WHERE rowid = old.row_id;
896
- END;
897
- `);
898
- } catch (error) {
899
- throw new Error("SQLite agent-runtime requires FTS5 support", { cause: error });
900
- }
901
- }
902
- function writeBaselines(database, migratedAt) {
903
- const conversations = database.prepare("SELECT conversation_id, version FROM stitchkit_agent_runtime_heads ORDER BY conversation_id").all().map((row) => ConversationRowSchema.parse(row));
904
- const insert = database.prepare(`
905
- INSERT INTO stitchkit_agent_runtime_events (
906
- conversation_id, seq, event_id, schema_version, kind, occurred_at, ignorable, payload
907
- ) VALUES (?, 1, ?, 1, 'runtime/baseline', ?, 0, ?)
908
- `);
909
- for (const conversation of conversations) {
910
- const rows = database.prepare("SELECT payload, active FROM stitchkit_agent_runtime_messages WHERE conversation_id = ? ORDER BY position, rowid").all(conversation.conversation_id).map((row) => {
911
- const parsed = HistoryRowSchema.parse(row);
912
- return {
913
- message: AgentMessageSchema2.parse(parseJson2(parsed.payload)),
914
- active: parsed.active === 1
915
- };
916
- });
917
- const messages = rows.map((row) => row.message);
918
- const compacted = rows.filter((row) => !row.active).map((row) => row.message.id);
919
- const runs = database.prepare("SELECT payload, terminal_assistant_payload FROM stitchkit_agent_runtime_runs WHERE conversation_id = ? ORDER BY created_at, run_id").all(conversation.conversation_id).map((value) => {
920
- const row = PayloadRowSchema.parse(value);
921
- return {
922
- schemaVersion: 1,
923
- run: AgentRunSchema2.parse(parseJson2(row.payload)),
924
- ...row.terminal_assistant_payload ? {
925
- terminalAssistant: AgentMessageSchema2.parse(parseJson2(row.terminal_assistant_payload))
926
- } : {}
927
- };
928
- });
929
- const admissions = database.prepare("SELECT conversation_id, idempotency_key, input_payload, run_id, assistant_message_id FROM stitchkit_agent_runtime_admissions WHERE conversation_id = ? ORDER BY idempotency_key").all(conversation.conversation_id).map((value) => {
930
- const row = AdmissionRowSchema2.parse(value);
931
- return {
932
- schemaVersion: 1,
933
- conversationId: row.conversation_id,
934
- idempotencyKey: row.idempotency_key,
935
- input: AgentMessageSchema2.parse(parseJson2(row.input_payload)),
936
- runId: row.run_id,
937
- assistantMessageId: row.assistant_message_id
938
- };
939
- });
940
- const asOf = messages.at(-1)?.createdAt ?? runs.at(-1)?.run.createdAt;
941
- insert.run(conversation.conversation_id, randomUUID(), migratedAt, canonicalAgentJson2({
942
- migratedAt,
943
- ...asOf !== undefined && { asOf },
944
- head: {
945
- schemaVersion: 1,
946
- conversationId: conversation.conversation_id,
947
- version: conversation.version
948
- },
949
- messages,
950
- ...compacted.length > 0 && { compacted },
951
- runs,
952
- admissions
953
- }));
954
- }
955
- }
956
- function migrateAgentRuntimeSqliteV1ToV2(database, migratedAt = new Date().toISOString()) {
957
- createDurableTables(database);
958
- writeBaselines(database, migratedAt);
959
- database.prepare("UPDATE stitchkit_agent_runtime_meta SET value = '2' WHERE key = 'schema_version'").run();
960
- }
961
- function createAgentRuntimeSqliteV2Tables(database) {
962
- createDurableTables(database);
963
- }
964
-
965
- // src/agent-runtime/store-migrations/v2-to-v3.ts
966
- function createAgentRuntimeSqliteV3Tables(database) {
967
- database.exec(`
968
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_seeds (
969
- conversation_id TEXT NOT NULL,
970
- seed_key TEXT NOT NULL,
971
- message_ids TEXT NOT NULL,
972
- created_at TEXT NOT NULL,
973
- PRIMARY KEY (conversation_id, seed_key)
974
- );
975
- `);
976
- }
977
- function migrateAgentRuntimeSqliteV2ToV3(database) {
978
- createAgentRuntimeSqliteV3Tables(database);
979
- database.prepare("UPDATE stitchkit_agent_runtime_meta SET value = '3' WHERE key = 'schema_version'").run();
980
- }
981
-
982
- // src/agent-runtime/store-migrations/v3-to-v4.ts
983
- function migrateAgentRuntimeSqliteV3ToV4(database) {
984
- database.exec(`
985
- ALTER TABLE stitchkit_agent_runtime_schedules ADD COLUMN retry_at TEXT;
986
- ALTER TABLE stitchkit_agent_runtime_schedules ADD COLUMN attempts INTEGER NOT NULL DEFAULT 0;
987
- ALTER TABLE stitchkit_agent_runtime_schedules ADD COLUMN last_error TEXT;
988
- ALTER TABLE stitchkit_agent_runtime_schedules ADD COLUMN eligible_at TEXT
989
- GENERATED ALWAYS AS (MAX(next_at, COALESCE(retry_at, next_at), COALESCE(claim_until, next_at))) VIRTUAL;
990
- DROP INDEX stitchkit_agent_runtime_schedules_due;
991
- CREATE INDEX stitchkit_agent_runtime_schedules_due
992
- ON stitchkit_agent_runtime_schedules (eligible_at, id) WHERE state = 'scheduled';
993
- UPDATE stitchkit_agent_runtime_meta SET value = '4' WHERE key = 'schema_version';
994
- `);
995
- }
996
-
997
- // src/agent-runtime/sqlite-schema.ts
998
- var MetaRowSchema = z6.object({ value: z6.string() });
999
- var TableRowSchema = z6.object({ name: z6.string() });
1000
- var SCHEMA_VERSION = 4;
1001
- var TABLES = [
1002
- "stitchkit_agent_runtime_heads",
1003
- "stitchkit_agent_runtime_runs",
1004
- "stitchkit_agent_runtime_admissions",
1005
- "stitchkit_agent_runtime_messages",
1006
- "stitchkit_agent_runtime_seeds",
1007
- "stitchkit_agent_runtime_events",
1008
- "stitchkit_agent_runtime_projections",
1009
- "stitchkit_agent_runtime_spills",
1010
- "stitchkit_agent_runtime_schedules",
1011
- "stitchkit_agent_runtime_children"
1012
- ];
1013
- function initializeAgentRuntimeSqlite2(database) {
1014
- database.exec("BEGIN IMMEDIATE");
1015
- try {
1016
- const existing = database.prepare(`SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE 'stitchkit_agent_runtime_%' ORDER BY name`).all().map((row) => TableRowSchema.parse(row).name);
1017
- const hasMeta = existing.includes("stitchkit_agent_runtime_meta");
1018
- if (!hasMeta && existing.length > 0) {
1019
- throw new Error("Refusing an unversioned partial Stitchkit agent-runtime SQLite schema");
1020
- }
1021
- database.exec(`
1022
- CREATE TABLE IF NOT EXISTS stitchkit_agent_runtime_meta (
1023
- key TEXT PRIMARY KEY,
1024
- value TEXT NOT NULL
1025
- );
1026
- `);
1027
- const versionRow = database.prepare("SELECT value FROM stitchkit_agent_runtime_meta WHERE key = 'schema_version'").get();
1028
- if (!missing(versionRow)) {
1029
- const version = Number(MetaRowSchema.parse(versionRow).value);
1030
- if (version === 1) {
1031
- migrateAgentRuntimeSqliteV1ToV2(database);
1032
- migrateAgentRuntimeSqliteV2ToV3(database);
1033
- migrateAgentRuntimeSqliteV3ToV4(database);
1034
- initializeSqliteConversationPurge(database);
1035
- database.exec("COMMIT");
1036
- return;
1037
- }
1038
- if (version === 2) {
1039
- migrateAgentRuntimeSqliteV2ToV3(database);
1040
- migrateAgentRuntimeSqliteV3ToV4(database);
1041
- initializeSqliteConversationPurge(database);
1042
- database.exec("COMMIT");
1043
- return;
1044
- }
1045
- if (version === 3) {
1046
- migrateAgentRuntimeSqliteV3ToV4(database);
1047
- initializeSqliteConversationPurge(database);
1048
- database.exec("COMMIT");
1049
- return;
1050
- }
1051
- if (version !== SCHEMA_VERSION) {
1052
- throw new Error(`Unsupported Stitchkit agent-runtime SQLite schema version ${version}; expected ${SCHEMA_VERSION}`);
1053
- }
1054
- const missingTables = TABLES.filter((table) => !existing.includes(table));
1055
- if (missingTables.length > 0) {
1056
- throw new Error(`Refusing a partial Stitchkit agent-runtime SQLite schema; missing ${missingTables.join(", ")}`);
1057
- }
1058
- initializeSqliteConversationPurge(database);
1059
- database.exec("COMMIT");
1060
- return;
1061
- }
1062
- if (existing.some((table) => table !== "stitchkit_agent_runtime_meta")) {
1063
- throw new Error("Refusing an unversioned partial Stitchkit agent-runtime SQLite schema");
1064
- }
1065
- database.exec(`
1066
- CREATE TABLE stitchkit_agent_runtime_heads (
1067
- conversation_id TEXT PRIMARY KEY,
1068
- version INTEGER NOT NULL CHECK (version >= 0)
1069
- );
1070
- CREATE TABLE stitchkit_agent_runtime_runs (
1071
- conversation_id TEXT NOT NULL,
1072
- run_id TEXT NOT NULL,
1073
- assistant_message_id TEXT NOT NULL,
1074
- state TEXT NOT NULL,
1075
- created_at TEXT NOT NULL,
1076
- payload TEXT NOT NULL,
1077
- terminal_assistant_payload TEXT,
1078
- PRIMARY KEY (conversation_id, run_id),
1079
- UNIQUE (conversation_id, assistant_message_id)
1080
- );
1081
- CREATE INDEX stitchkit_agent_runtime_recoverable
1082
- ON stitchkit_agent_runtime_runs (state, conversation_id, run_id);
1083
- CREATE TABLE stitchkit_agent_runtime_admissions (
1084
- conversation_id TEXT NOT NULL,
1085
- idempotency_key TEXT NOT NULL,
1086
- input_message_id TEXT NOT NULL,
1087
- run_id TEXT NOT NULL,
1088
- assistant_message_id TEXT NOT NULL,
1089
- input_payload TEXT NOT NULL,
1090
- PRIMARY KEY (conversation_id, idempotency_key),
1091
- UNIQUE (conversation_id, input_message_id)
1092
- );
1093
- CREATE TABLE stitchkit_agent_runtime_messages (
1094
- conversation_id TEXT NOT NULL,
1095
- id TEXT NOT NULL,
1096
- position INTEGER NOT NULL CHECK (position >= 0),
1097
- active INTEGER NOT NULL DEFAULT 1 CHECK (active IN (0, 1)),
1098
- payload TEXT NOT NULL,
1099
- PRIMARY KEY (conversation_id, id)
1100
- );
1101
- `);
1102
- createAgentRuntimeSqliteV2Tables(database);
1103
- createAgentRuntimeSqliteV3Tables(database);
1104
- database.prepare("INSERT INTO stitchkit_agent_runtime_meta (key, value) VALUES ('schema_version', '3')").run();
1105
- migrateAgentRuntimeSqliteV3ToV4(database);
1106
- initializeSqliteConversationPurge(database);
1107
- database.exec("COMMIT");
1108
- } catch (error) {
1109
- database.exec("ROLLBACK");
1110
- throw error;
1111
- }
1112
- }
1113
-
1114
- // src/agent-runtime/sqlite.ts
1115
- function createSqliteAgentRuntimeStore2(config) {
1116
- const database = config.database;
1117
- if (config.initialize !== false) {
1118
- try {
1119
- initializeAgentRuntimeSqlite2(database);
1120
- } catch (error) {
1121
- database.close();
1122
- throw error;
1123
- }
1124
- }
1125
- const state = createSqliteStoreState(database);
1126
- const driver = {
1127
- conversations: sqliteConversationPurge(database),
1128
- transaction: (work, options) => runSqliteTransaction(state, options?.access ?? "write", work),
1129
- head: sqliteHeads,
1130
- runs: sqliteRuns,
1131
- admissions: sqliteAdmissions,
1132
- seeds: sqliteSeeds,
1133
- history: sqliteHistory,
1134
- events: sqliteEvents,
1135
- archive: sqliteArchive,
1136
- scanRecoverable: (input) => scanSqliteRecoverable(state, input)
1137
- };
1138
- return {
1139
- store: createAgentRuntimeStore2(driver),
1140
- database,
1141
- transaction: (work) => runSqliteStoreScope(state, driver, work),
1142
- conversations: {
1143
- list: (input) => listSqliteConversations(state, input),
1144
- messages: (input) => pageSqliteConversationMessages(state, input)
1145
- },
1146
- close: () => closeSqliteStore(state)
1147
- };
1148
- }
1149
-
1150
- export { initializeAgentRuntimeSqlite2, createSqliteAgentRuntimeStore2 };