@zvada/agent-server 0.3.22 → 0.3.24

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 (558) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/README.md +14 -5
  3. package/dist/accounts/chatgpt.js +144 -0
  4. package/dist/accounts/check.js +71 -0
  5. package/dist/accounts/claude.js +80 -0
  6. package/dist/accounts/endpoint.js +104 -0
  7. package/dist/accounts/http.js +58 -0
  8. package/dist/accounts/index.js +9 -0
  9. package/dist/client/client.js +686 -0
  10. package/dist/client/connection.js +338 -0
  11. package/dist/client/history.js +49 -0
  12. package/dist/client/index.js +6 -0
  13. package/dist/client/listeners.js +19 -0
  14. package/dist/client/logins.js +92 -0
  15. package/dist/client/rpc.js +105 -0
  16. package/dist/client/streams.js +432 -0
  17. package/dist/client/transports.js +118 -0
  18. package/dist/client/turns.js +122 -0
  19. package/dist/core/agents/acp/acp-agent.js +425 -0
  20. package/dist/core/agents/acp/adapter.js +231 -0
  21. package/dist/core/agents/acp/client.js +222 -0
  22. package/dist/core/agents/acp/known-agents.js +57 -0
  23. package/dist/core/agents/acp/mappings.js +164 -0
  24. package/dist/core/agents/acp/requests.js +79 -0
  25. package/dist/core/agents/attachments.js +14 -0
  26. package/dist/core/agents/base.js +64 -0
  27. package/dist/core/agents/claude-code/adapter.js +474 -0
  28. package/dist/core/agents/claude-code/approvals.js +245 -0
  29. package/dist/core/agents/claude-code/claude-agent.js +319 -0
  30. package/dist/core/agents/claude-code/credentials.js +142 -0
  31. package/dist/core/agents/claude-code/events.js +11 -0
  32. package/dist/core/agents/claude-code/login.js +217 -0
  33. package/dist/core/agents/claude-code/mcp.js +181 -0
  34. package/dist/core/agents/claude-code/models.js +74 -0
  35. package/dist/core/agents/claude-code/options.js +240 -0
  36. package/dist/core/agents/claude-code/outcome.js +204 -0
  37. package/dist/core/agents/claude-code/results.js +58 -0
  38. package/dist/core/agents/claude-code/sdk-pair.js +59 -0
  39. package/dist/core/agents/claude-code/session.js +593 -0
  40. package/dist/core/agents/claude-code/spawn.js +125 -0
  41. package/dist/core/agents/claude-code/spend.js +118 -0
  42. package/dist/core/agents/claude-code/tools.js +131 -0
  43. package/dist/core/agents/claude-code/turn-usage.js +121 -0
  44. package/dist/core/agents/claude-code/turn.js +199 -0
  45. package/dist/core/agents/codex-app-server/adapter.js +463 -0
  46. package/dist/core/agents/codex-app-server/client.js +338 -0
  47. package/dist/core/agents/codex-app-server/codex-agent.js +294 -0
  48. package/dist/core/agents/codex-app-server/commands.js +184 -0
  49. package/dist/core/agents/codex-app-server/credentials.js +92 -0
  50. package/dist/core/agents/codex-app-server/effort.js +13 -0
  51. package/dist/core/agents/codex-app-server/events.js +18 -0
  52. package/dist/core/agents/codex-app-server/homes.js +118 -0
  53. package/dist/core/agents/codex-app-server/input.js +52 -0
  54. package/dist/core/agents/codex-app-server/items.js +307 -0
  55. package/dist/core/agents/codex-app-server/login.js +183 -0
  56. package/dist/core/agents/codex-app-server/mcp.js +323 -0
  57. package/dist/core/agents/codex-app-server/models.js +160 -0
  58. package/dist/core/agents/codex-app-server/options.js +155 -0
  59. package/dist/core/agents/codex-app-server/plan-approval.js +124 -0
  60. package/dist/core/agents/codex-app-server/protocol.js +38 -0
  61. package/dist/core/agents/codex-app-server/requests.js +250 -0
  62. package/dist/core/agents/codex-app-server/session.js +278 -0
  63. package/dist/core/agents/codex-app-server/subagents.js +260 -0
  64. package/dist/core/agents/codex-app-server/thread-settings.js +214 -0
  65. package/dist/core/agents/codex-app-server/turn-items.js +69 -0
  66. package/dist/core/agents/codex-app-server/turn.js +448 -0
  67. package/dist/core/agents/codex-app-server/user-login.js +78 -0
  68. package/dist/core/agents/config-fingerprint.js +10 -0
  69. package/dist/core/agents/credentials.js +71 -0
  70. package/dist/core/agents/diffs.js +27 -0
  71. package/dist/core/agents/elicitation.js +42 -0
  72. package/dist/core/agents/inherit-config.js +5 -0
  73. package/dist/core/agents/login.js +56 -0
  74. package/dist/core/agents/mcp-config.js +109 -0
  75. package/dist/core/agents/plan.js +6 -0
  76. package/dist/core/agents/process-pool.js +307 -0
  77. package/dist/core/agents/registry.js +49 -0
  78. package/dist/core/agents/scripted/adapter.js +86 -0
  79. package/dist/core/agents/scripted/mcp-call.js +74 -0
  80. package/dist/core/agents/scripted/scripted-agent.js +330 -0
  81. package/dist/core/agents/scripted/scripts.js +154 -0
  82. package/dist/core/agents/scripted/steps.js +87 -0
  83. package/dist/core/agents/session-agent.js +209 -0
  84. package/dist/core/agents/stderr-tail.js +71 -0
  85. package/dist/core/agents/thinking-levels.js +9 -0
  86. package/dist/core/agents/types.js +1 -0
  87. package/dist/core/diagnostics.js +23 -0
  88. package/dist/core/index.js +31 -0
  89. package/dist/core/presets.js +114 -0
  90. package/dist/core/processes/identity.js +91 -0
  91. package/dist/core/processes/lifeline.js +210 -0
  92. package/dist/core/processes/native-processes.js +299 -0
  93. package/dist/core/processes/process-table.js +163 -0
  94. package/dist/core/provision/cache-trust.js +121 -0
  95. package/dist/core/provision/cache-usage.js +61 -0
  96. package/dist/core/provision/checksums.js +22 -0
  97. package/dist/core/provision/extract.js +28 -0
  98. package/dist/core/provision/index.js +4 -0
  99. package/dist/core/provision/install-build.js +99 -0
  100. package/dist/core/provision/npm.js +316 -0
  101. package/dist/core/provision/pins.js +35 -0
  102. package/dist/core/provision/platform.js +65 -0
  103. package/dist/core/provision/provisioner.js +372 -0
  104. package/dist/core/provision/releases.js +68 -0
  105. package/dist/core/provision/tools.js +279 -0
  106. package/dist/core/proxy/anthropic-proxy.js +163 -0
  107. package/dist/core/proxy/api-key-store.js +30 -0
  108. package/dist/core/proxy/index.js +3 -0
  109. package/dist/core/proxy/loopback.js +86 -0
  110. package/dist/core/runtime/agent-runtime.js +434 -0
  111. package/dist/core/runtime/event-processor.js +379 -0
  112. package/dist/core/runtime/event-sink.js +65 -0
  113. package/dist/core/runtime/harness-clis.js +83 -0
  114. package/dist/core/runtime/harness-logins.js +313 -0
  115. package/dist/core/runtime/login-reads.js +71 -0
  116. package/dist/core/runtime/model-lists.js +160 -0
  117. package/dist/core/runtime/permission-policy.js +84 -0
  118. package/dist/core/runtime/request-broker.js +139 -0
  119. package/dist/core/runtime/steering.js +79 -0
  120. package/dist/core/runtime/turn-outcome.js +16 -0
  121. package/dist/core/runtime/turn.js +329 -0
  122. package/dist/core/utils/bounded.js +13 -0
  123. package/dist/core/utils/deadline.js +57 -0
  124. package/dist/core/utils/errors.js +176 -0
  125. package/dist/core/utils/is-record.js +4 -0
  126. package/dist/core/utils/loopback.js +11 -0
  127. package/dist/index.js +4 -0
  128. package/dist/operator/index.js +10 -0
  129. package/dist/operator/mcp.js +139 -0
  130. package/dist/operator/operator.js +499 -0
  131. package/dist/operator/render.js +408 -0
  132. package/dist/operator/view.js +35 -0
  133. package/dist/protocol/account.js +96 -0
  134. package/dist/protocol/async-queue.js +65 -0
  135. package/dist/protocol/auth.js +169 -0
  136. package/dist/protocol/canonical.js +18 -0
  137. package/dist/protocol/clis.js +63 -0
  138. package/dist/protocol/config.js +137 -0
  139. package/dist/protocol/conversation.js +231 -0
  140. package/dist/protocol/credentials.js +141 -0
  141. package/dist/protocol/errors.js +181 -0
  142. package/dist/protocol/execution.js +28 -0
  143. package/dist/protocol/factories.js +231 -0
  144. package/dist/protocol/guards.js +71 -0
  145. package/dist/protocol/harness.js +93 -0
  146. package/dist/protocol/history.js +201 -0
  147. package/dist/protocol/ids.js +37 -0
  148. package/dist/protocol/index.js +36 -0
  149. package/dist/protocol/lifecycle.js +562 -0
  150. package/dist/protocol/meta-keys.js +17 -0
  151. package/dist/protocol/meta.js +13 -0
  152. package/dist/protocol/model-catalog.js +223 -0
  153. package/dist/protocol/models.js +84 -0
  154. package/dist/protocol/part-input.js +94 -0
  155. package/dist/protocol/parts.js +166 -0
  156. package/dist/protocol/plan.js +31 -0
  157. package/dist/protocol/reduce.js +484 -0
  158. package/dist/protocol/selectors.js +136 -0
  159. package/dist/protocol/seq-cursor.js +37 -0
  160. package/dist/protocol/stop-reasons.js +41 -0
  161. package/dist/protocol/thinking.js +31 -0
  162. package/dist/protocol/time.js +21 -0
  163. package/dist/protocol/tokens.js +57 -0
  164. package/dist/protocol/tool-closure.js +70 -0
  165. package/dist/protocol/tool-state.js +153 -0
  166. package/dist/protocol/verify.js +467 -0
  167. package/dist/protocol/vocabulary.js +27 -0
  168. package/dist/protocol/wire-api.js +94 -0
  169. package/dist/protocol/wire.js +669 -0
  170. package/dist/server/acp/binding.js +251 -0
  171. package/dist/server/acp/session-records.js +53 -0
  172. package/dist/server/acp/translate.js +401 -0
  173. package/dist/server/agent-server.js +338 -0
  174. package/dist/server/bin.js +492 -0
  175. package/dist/server/feedback.js +216 -0
  176. package/dist/server/history.js +123 -0
  177. package/dist/server/index.js +8 -0
  178. package/dist/server/install.js +171 -0
  179. package/dist/server/open-parts.js +87 -0
  180. package/dist/server/routes.js +291 -0
  181. package/dist/server/secrets.js +19 -0
  182. package/dist/server/session-gate.js +54 -0
  183. package/dist/server/session-log.js +66 -0
  184. package/dist/server/session-store.js +243 -0
  185. package/dist/server/subscriptions.js +189 -0
  186. package/dist/server/transports.js +214 -0
  187. package/dist/server/wire-error.js +26 -0
  188. package/dist/sync/event-log.js +89 -0
  189. package/dist/sync/fit.js +202 -0
  190. package/dist/sync/history-reader.js +33 -0
  191. package/dist/sync/history-sqlite.js +281 -0
  192. package/dist/sync/history.js +163 -0
  193. package/dist/sync/index.js +5 -0
  194. package/dist/sync/journal-sqlite.js +316 -0
  195. package/dist/sync/journal.js +10 -0
  196. package/dist/sync/live-tails.js +85 -0
  197. package/dist/sync/node-sqlite.js +27 -0
  198. package/dist/sync/projection.js +32 -0
  199. package/dist/sync/recovery.js +117 -0
  200. package/dist/sync/retry.js +45 -0
  201. package/dist/sync/schema.js +73 -0
  202. package/dist/sync/sql.js +94 -0
  203. package/dist/sync/sqlite-file.js +31 -0
  204. package/dist/sync/sqlite.js +18 -0
  205. package/dist/sync/worker.js +212 -0
  206. package/dist/types/accounts/chatgpt.d.ts +1 -1
  207. package/dist/types/accounts/chatgpt.d.ts.map +1 -1
  208. package/dist/types/accounts/http.d.ts +2 -4
  209. package/dist/types/accounts/http.d.ts.map +1 -1
  210. package/dist/types/client/client.d.ts +37 -11
  211. package/dist/types/client/client.d.ts.map +1 -1
  212. package/dist/types/client/connection.d.ts +64 -13
  213. package/dist/types/client/connection.d.ts.map +1 -1
  214. package/dist/types/client/index.d.ts +1 -1
  215. package/dist/types/client/index.d.ts.map +1 -1
  216. package/dist/types/client/logins.d.ts +2 -1
  217. package/dist/types/client/logins.d.ts.map +1 -1
  218. package/dist/types/client/streams.d.ts +9 -3
  219. package/dist/types/client/streams.d.ts.map +1 -1
  220. package/dist/types/client/turns.d.ts +1 -1
  221. package/dist/types/client/turns.d.ts.map +1 -1
  222. package/dist/types/core/agents/acp/acp-agent.d.ts +34 -1
  223. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  224. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  225. package/dist/types/core/agents/acp/client.d.ts +12 -3
  226. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  227. package/dist/types/core/agents/acp/mappings.d.ts +8 -2
  228. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  229. package/dist/types/core/agents/base.d.ts +22 -8
  230. package/dist/types/core/agents/base.d.ts.map +1 -1
  231. package/dist/types/core/agents/claude-code/adapter.d.ts +7 -0
  232. package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -1
  233. package/dist/types/core/agents/claude-code/approvals.d.ts +4 -1
  234. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
  235. package/dist/types/core/agents/claude-code/claude-agent.d.ts +19 -5
  236. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  237. package/dist/types/core/agents/claude-code/events.d.ts +9 -1
  238. package/dist/types/core/agents/claude-code/events.d.ts.map +1 -1
  239. package/dist/types/core/agents/claude-code/login.d.ts +4 -1
  240. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  241. package/dist/types/core/agents/claude-code/mcp.d.ts +21 -7
  242. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
  243. package/dist/types/core/agents/claude-code/models.d.ts +5 -1
  244. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
  245. package/dist/types/core/agents/claude-code/options.d.ts +29 -10
  246. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  247. package/dist/types/core/agents/claude-code/outcome.d.ts +3 -5
  248. package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -1
  249. package/dist/types/core/agents/claude-code/results.d.ts +16 -0
  250. package/dist/types/core/agents/claude-code/results.d.ts.map +1 -0
  251. package/dist/types/core/agents/claude-code/sdk-pair.d.ts +13 -0
  252. package/dist/types/core/agents/claude-code/sdk-pair.d.ts.map +1 -0
  253. package/dist/types/core/agents/claude-code/session.d.ts +58 -12
  254. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  255. package/dist/types/core/agents/claude-code/spend.d.ts +2 -1
  256. package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -1
  257. package/dist/types/core/agents/claude-code/tools.d.ts +26 -3
  258. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
  259. package/dist/types/core/agents/codex-app-server/adapter.d.ts +2 -2
  260. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
  261. package/dist/types/core/agents/codex-app-server/client.d.ts +12 -2
  262. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  263. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +58 -13
  264. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
  265. package/dist/types/core/agents/codex-app-server/commands.d.ts +2 -2
  266. package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -1
  267. package/dist/types/core/agents/codex-app-server/credentials.d.ts +5 -1
  268. package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -1
  269. package/dist/types/core/agents/codex-app-server/effort.d.ts +2 -1
  270. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
  271. package/dist/types/core/agents/codex-app-server/homes.d.ts +25 -0
  272. package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -1
  273. package/dist/types/core/agents/codex-app-server/items.d.ts +27 -2
  274. package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -1
  275. package/dist/types/core/agents/codex-app-server/login.d.ts +16 -1
  276. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  277. package/dist/types/core/agents/codex-app-server/mcp.d.ts +15 -30
  278. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
  279. package/dist/types/core/agents/codex-app-server/models.d.ts +3 -10
  280. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
  281. package/dist/types/core/agents/codex-app-server/options.d.ts +27 -4
  282. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
  283. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +2 -1
  284. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -1
  285. package/dist/types/core/agents/codex-app-server/protocol.d.ts +16 -3
  286. package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -1
  287. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
  288. package/dist/types/core/agents/codex-app-server/session.d.ts +71 -40
  289. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
  290. package/dist/types/core/agents/codex-app-server/subagents.d.ts +9 -4
  291. package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -1
  292. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +3 -2
  293. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
  294. package/dist/types/core/agents/codex-app-server/turn-items.d.ts +2 -1
  295. package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -1
  296. package/dist/types/core/agents/codex-app-server/turn.d.ts +31 -8
  297. package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -1
  298. package/dist/types/core/agents/codex-app-server/user-login.d.ts +28 -0
  299. package/dist/types/core/agents/codex-app-server/user-login.d.ts.map +1 -0
  300. package/dist/types/core/agents/credentials.d.ts +3 -1
  301. package/dist/types/core/agents/credentials.d.ts.map +1 -1
  302. package/dist/types/core/agents/diffs.d.ts +9 -0
  303. package/dist/types/core/agents/diffs.d.ts.map +1 -0
  304. package/dist/types/core/agents/elicitation.d.ts +3 -2
  305. package/dist/types/core/agents/elicitation.d.ts.map +1 -1
  306. package/dist/types/core/agents/login.d.ts +6 -0
  307. package/dist/types/core/agents/login.d.ts.map +1 -1
  308. package/dist/types/core/agents/mcp-config.d.ts +0 -4
  309. package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
  310. package/dist/types/core/agents/process-pool.d.ts +201 -0
  311. package/dist/types/core/agents/process-pool.d.ts.map +1 -0
  312. package/dist/types/core/agents/scripted/adapter.d.ts +68 -0
  313. package/dist/types/core/agents/scripted/adapter.d.ts.map +1 -0
  314. package/dist/types/core/agents/scripted/mcp-call.d.ts +56 -0
  315. package/dist/types/core/agents/scripted/mcp-call.d.ts.map +1 -0
  316. package/dist/types/core/agents/scripted/scripted-agent.d.ts +73 -0
  317. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -0
  318. package/dist/types/core/agents/scripted/scripts.d.ts +29 -0
  319. package/dist/types/core/agents/scripted/scripts.d.ts.map +1 -0
  320. package/dist/types/core/agents/scripted/steps.d.ts +132 -0
  321. package/dist/types/core/agents/scripted/steps.d.ts.map +1 -0
  322. package/dist/types/core/agents/session-agent.d.ts +49 -6
  323. package/dist/types/core/agents/session-agent.d.ts.map +1 -1
  324. package/dist/types/core/diagnostics.d.ts +4 -1
  325. package/dist/types/core/diagnostics.d.ts.map +1 -1
  326. package/dist/types/core/index.d.ts +5 -0
  327. package/dist/types/core/index.d.ts.map +1 -1
  328. package/dist/types/core/presets.d.ts +32 -6
  329. package/dist/types/core/presets.d.ts.map +1 -1
  330. package/dist/types/core/processes/lifeline.d.ts +0 -20
  331. package/dist/types/core/processes/lifeline.d.ts.map +1 -1
  332. package/dist/types/core/provision/index.d.ts +2 -2
  333. package/dist/types/core/provision/index.d.ts.map +1 -1
  334. package/dist/types/core/provision/install-build.d.ts +2 -1
  335. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  336. package/dist/types/core/provision/npm.d.ts +20 -8
  337. package/dist/types/core/provision/npm.d.ts.map +1 -1
  338. package/dist/types/core/provision/provisioner.d.ts +4 -1
  339. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  340. package/dist/types/core/provision/tools.d.ts +2 -1
  341. package/dist/types/core/provision/tools.d.ts.map +1 -1
  342. package/dist/types/core/runtime/agent-runtime.d.ts +16 -8
  343. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  344. package/dist/types/core/runtime/event-processor.d.ts +5 -1
  345. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  346. package/dist/types/core/runtime/harness-clis.d.ts +9 -0
  347. package/dist/types/core/runtime/harness-clis.d.ts.map +1 -1
  348. package/dist/types/core/runtime/harness-logins.d.ts +33 -5
  349. package/dist/types/core/runtime/harness-logins.d.ts.map +1 -1
  350. package/dist/types/core/runtime/model-lists.d.ts +2 -0
  351. package/dist/types/core/runtime/model-lists.d.ts.map +1 -1
  352. package/dist/types/core/runtime/permission-policy.d.ts +5 -3
  353. package/dist/types/core/runtime/permission-policy.d.ts.map +1 -1
  354. package/dist/types/core/runtime/request-broker.d.ts +2 -1
  355. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  356. package/dist/types/core/runtime/turn.d.ts +12 -1
  357. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  358. package/dist/types/core/utils/deadline.d.ts +6 -0
  359. package/dist/types/core/utils/deadline.d.ts.map +1 -1
  360. package/dist/types/core/utils/errors.d.ts +7 -1
  361. package/dist/types/core/utils/errors.d.ts.map +1 -1
  362. package/dist/types/operator/operator.d.ts.map +1 -1
  363. package/dist/types/operator/render.d.ts +6 -4
  364. package/dist/types/operator/render.d.ts.map +1 -1
  365. package/dist/types/protocol/auth.d.ts +54 -24
  366. package/dist/types/protocol/auth.d.ts.map +1 -1
  367. package/dist/types/protocol/clis.d.ts +14 -7
  368. package/dist/types/protocol/clis.d.ts.map +1 -1
  369. package/dist/types/protocol/config.d.ts +2 -0
  370. package/dist/types/protocol/config.d.ts.map +1 -1
  371. package/dist/types/protocol/conversation.d.ts +40 -3
  372. package/dist/types/protocol/conversation.d.ts.map +1 -1
  373. package/dist/types/protocol/credentials.d.ts +7 -0
  374. package/dist/types/protocol/credentials.d.ts.map +1 -1
  375. package/dist/types/protocol/execution.d.ts +2 -1
  376. package/dist/types/protocol/execution.d.ts.map +1 -1
  377. package/dist/types/protocol/factories.d.ts +12 -2
  378. package/dist/types/protocol/factories.d.ts.map +1 -1
  379. package/dist/types/protocol/harness.d.ts +6 -2
  380. package/dist/types/protocol/harness.d.ts.map +1 -1
  381. package/dist/types/protocol/history.d.ts +19 -0
  382. package/dist/types/protocol/history.d.ts.map +1 -1
  383. package/dist/types/protocol/lifecycle.d.ts +47 -8
  384. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  385. package/dist/types/protocol/model-catalog.d.ts.map +1 -1
  386. package/dist/types/protocol/models.d.ts +3 -0
  387. package/dist/types/protocol/models.d.ts.map +1 -1
  388. package/dist/types/protocol/parts.d.ts +14 -0
  389. package/dist/types/protocol/parts.d.ts.map +1 -1
  390. package/dist/types/protocol/tool-state.d.ts +12 -0
  391. package/dist/types/protocol/tool-state.d.ts.map +1 -1
  392. package/dist/types/protocol/wire-api.d.ts +129 -23
  393. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  394. package/dist/types/protocol/wire.d.ts +70 -10
  395. package/dist/types/protocol/wire.d.ts.map +1 -1
  396. package/dist/types/server/acp/binding.d.ts +6 -1
  397. package/dist/types/server/acp/binding.d.ts.map +1 -1
  398. package/dist/types/server/acp/translate.d.ts +33 -7
  399. package/dist/types/server/acp/translate.d.ts.map +1 -1
  400. package/dist/types/server/agent-server.d.ts +6 -0
  401. package/dist/types/server/agent-server.d.ts.map +1 -1
  402. package/dist/types/server/bin.d.ts +3 -0
  403. package/dist/types/server/bin.d.ts.map +1 -0
  404. package/dist/types/server/feedback.d.ts +2 -1
  405. package/dist/types/server/feedback.d.ts.map +1 -1
  406. package/dist/types/server/install.d.ts +11 -0
  407. package/dist/types/server/install.d.ts.map +1 -1
  408. package/dist/types/server/session-gate.d.ts +2 -1
  409. package/dist/types/server/session-gate.d.ts.map +1 -1
  410. package/dist/types/server/session-store.d.ts +1 -0
  411. package/dist/types/server/session-store.d.ts.map +1 -1
  412. package/dist/types/server/subscriptions.d.ts +2 -1
  413. package/dist/types/server/subscriptions.d.ts.map +1 -1
  414. package/dist/types/server/transports.d.ts +2 -1
  415. package/dist/types/server/transports.d.ts.map +1 -1
  416. package/dist/types/sync/fit.d.ts +8 -7
  417. package/dist/types/sync/fit.d.ts.map +1 -1
  418. package/dist/types/sync/history-sqlite.d.ts.map +1 -1
  419. package/dist/types/sync/index.d.ts +1 -0
  420. package/dist/types/sync/index.d.ts.map +1 -1
  421. package/dist/types/sync/journal-sqlite.d.ts +2 -1
  422. package/dist/types/sync/journal-sqlite.d.ts.map +1 -1
  423. package/dist/types/sync/journal.d.ts +11 -3
  424. package/dist/types/sync/journal.d.ts.map +1 -1
  425. package/dist/types/sync/node-sqlite.d.ts +4 -1
  426. package/dist/types/sync/node-sqlite.d.ts.map +1 -1
  427. package/dist/types/sync/projection.d.ts +6 -0
  428. package/dist/types/sync/projection.d.ts.map +1 -1
  429. package/dist/types/sync/recovery.d.ts +2 -1
  430. package/dist/types/sync/recovery.d.ts.map +1 -1
  431. package/dist/types/sync/schema.d.ts +10 -0
  432. package/dist/types/sync/schema.d.ts.map +1 -1
  433. package/dist/types/sync/sql.d.ts +2 -1
  434. package/dist/types/sync/sql.d.ts.map +1 -1
  435. package/docs/consuming.md +304 -28
  436. package/docs/deploy.md +64 -8
  437. package/docs/durable-sessions.md +35 -5
  438. package/docs/harnesses.md +398 -25
  439. package/package.json +48 -18
  440. package/src/accounts/chatgpt.ts +2 -2
  441. package/src/accounts/http.ts +2 -16
  442. package/src/client/client.ts +92 -31
  443. package/src/client/connection.ts +103 -22
  444. package/src/client/index.ts +1 -0
  445. package/src/client/logins.ts +1 -1
  446. package/src/client/streams.ts +12 -4
  447. package/src/client/turns.ts +1 -1
  448. package/src/core/agents/acp/acp-agent.ts +181 -52
  449. package/src/core/agents/acp/adapter.ts +9 -1
  450. package/src/core/agents/acp/client.ts +16 -4
  451. package/src/core/agents/acp/mappings.ts +27 -0
  452. package/src/core/agents/base.ts +25 -10
  453. package/src/core/agents/claude-code/adapter.ts +47 -17
  454. package/src/core/agents/claude-code/approvals.ts +11 -6
  455. package/src/core/agents/claude-code/claude-agent.ts +89 -32
  456. package/src/core/agents/claude-code/events.ts +11 -1
  457. package/src/core/agents/claude-code/login.ts +14 -2
  458. package/src/core/agents/claude-code/mcp.ts +31 -15
  459. package/src/core/agents/claude-code/models.ts +7 -2
  460. package/src/core/agents/claude-code/options.ts +30 -9
  461. package/src/core/agents/claude-code/outcome.ts +10 -2
  462. package/src/core/agents/claude-code/results.ts +73 -0
  463. package/src/core/agents/claude-code/sdk-pair.ts +66 -0
  464. package/src/core/agents/claude-code/session.ts +179 -37
  465. package/src/core/agents/claude-code/spend.ts +1 -1
  466. package/src/core/agents/claude-code/tools.ts +108 -12
  467. package/src/core/agents/codex-app-server/adapter.ts +37 -12
  468. package/src/core/agents/codex-app-server/client.ts +37 -8
  469. package/src/core/agents/codex-app-server/codex-agent.ts +115 -50
  470. package/src/core/agents/codex-app-server/commands.ts +2 -2
  471. package/src/core/agents/codex-app-server/credentials.ts +10 -5
  472. package/src/core/agents/codex-app-server/effort.ts +1 -1
  473. package/src/core/agents/codex-app-server/homes.ts +54 -3
  474. package/src/core/agents/codex-app-server/items.ts +219 -31
  475. package/src/core/agents/codex-app-server/login.ts +44 -2
  476. package/src/core/agents/codex-app-server/mcp.ts +47 -32
  477. package/src/core/agents/codex-app-server/models.ts +9 -8
  478. package/src/core/agents/codex-app-server/options.ts +69 -10
  479. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  480. package/src/core/agents/codex-app-server/protocol.ts +14 -4
  481. package/src/core/agents/codex-app-server/requests.ts +17 -8
  482. package/src/core/agents/codex-app-server/session.ts +160 -113
  483. package/src/core/agents/codex-app-server/subagents.ts +21 -14
  484. package/src/core/agents/codex-app-server/thread-settings.ts +18 -8
  485. package/src/core/agents/codex-app-server/turn-items.ts +1 -1
  486. package/src/core/agents/codex-app-server/turn.ts +79 -32
  487. package/src/core/agents/codex-app-server/user-login.ts +107 -0
  488. package/src/core/agents/credentials.ts +5 -2
  489. package/src/core/agents/diffs.ts +25 -0
  490. package/src/core/agents/elicitation.ts +2 -2
  491. package/src/core/agents/login.ts +6 -0
  492. package/src/core/agents/mcp-config.ts +2 -2
  493. package/src/core/agents/process-pool.ts +458 -0
  494. package/src/core/agents/scripted/adapter.ts +142 -0
  495. package/src/core/agents/scripted/mcp-call.ts +134 -0
  496. package/src/core/agents/scripted/scripted-agent.ts +418 -0
  497. package/src/core/agents/scripted/scripts.ts +171 -0
  498. package/src/core/agents/scripted/steps.ts +127 -0
  499. package/src/core/agents/session-agent.ts +105 -8
  500. package/src/core/diagnostics.ts +9 -1
  501. package/src/core/index.ts +11 -0
  502. package/src/core/presets.ts +100 -14
  503. package/src/core/processes/lifeline.ts +99 -25
  504. package/src/core/provision/index.ts +1 -2
  505. package/src/core/provision/install-build.ts +4 -1
  506. package/src/core/provision/npm.ts +309 -97
  507. package/src/core/provision/provisioner.ts +22 -8
  508. package/src/core/provision/tools.ts +44 -19
  509. package/src/core/runtime/agent-runtime.ts +48 -18
  510. package/src/core/runtime/event-processor.ts +18 -2
  511. package/src/core/runtime/harness-clis.ts +36 -1
  512. package/src/core/runtime/harness-logins.ts +82 -31
  513. package/src/core/runtime/model-lists.ts +1 -1
  514. package/src/core/runtime/permission-policy.ts +4 -3
  515. package/src/core/runtime/request-broker.ts +1 -1
  516. package/src/core/runtime/turn.ts +51 -3
  517. package/src/core/utils/deadline.ts +23 -0
  518. package/src/core/utils/errors.ts +11 -4
  519. package/src/operator/operator.ts +8 -4
  520. package/src/operator/render.ts +46 -8
  521. package/src/protocol/auth.ts +30 -23
  522. package/src/protocol/clis.ts +12 -4
  523. package/src/protocol/credentials.ts +19 -0
  524. package/src/protocol/execution.ts +5 -0
  525. package/src/protocol/factories.ts +25 -3
  526. package/src/protocol/harness.ts +11 -1
  527. package/src/protocol/history.ts +20 -0
  528. package/src/protocol/lifecycle.ts +10 -1
  529. package/src/protocol/model-catalog.ts +19 -8
  530. package/src/protocol/parts.ts +12 -1
  531. package/src/protocol/tool-state.ts +14 -1
  532. package/src/protocol/wire.ts +14 -0
  533. package/src/server/acp/binding.ts +113 -23
  534. package/src/server/acp/translate.ts +161 -8
  535. package/src/server/agent-server.ts +10 -1
  536. package/src/server/bin.ts +108 -19
  537. package/src/server/feedback.ts +1 -1
  538. package/src/server/install.ts +82 -4
  539. package/src/server/session-gate.ts +1 -1
  540. package/src/server/session-store.ts +5 -1
  541. package/src/server/subscriptions.ts +1 -1
  542. package/src/server/transports.ts +20 -1
  543. package/src/sync/fit.ts +115 -28
  544. package/src/sync/history-sqlite.ts +6 -2
  545. package/src/sync/index.ts +1 -0
  546. package/src/sync/journal-sqlite.ts +20 -2
  547. package/src/sync/journal.ts +10 -2
  548. package/src/sync/node-sqlite.ts +19 -3
  549. package/src/sync/projection.ts +10 -0
  550. package/src/sync/recovery.ts +11 -4
  551. package/src/sync/schema.ts +7 -5
  552. package/src/sync/sql.ts +1 -1
  553. package/dist/types/core/agents/claude-code/session-pool.d.ts +0 -36
  554. package/dist/types/core/agents/claude-code/session-pool.d.ts.map +0 -1
  555. package/dist/types/core/agents/session-pool.d.ts +0 -41
  556. package/dist/types/core/agents/session-pool.d.ts.map +0 -1
  557. package/src/core/agents/claude-code/session-pool.ts +0 -136
  558. package/src/core/agents/session-pool.ts +0 -111
@@ -9,7 +9,9 @@ import { type CredentialRequest, type HarnessCredential, type HarnessCredentials
9
9
  export type CredentialSource = (request: CredentialRequest, signal?: AbortSignal) => Promise<HarnessCredential | undefined>;
10
10
  /**
11
11
  * The product's credential for a harness, as the kind it runs on: one it
12
- * cannot run fails the turn here, before anything starts.
12
+ * cannot run fails the turn here, before anything starts. A turn cancelled
13
+ * meanwhile stops waiting at once, whether or not the source heeds `signal`,
14
+ * and an answer that comes after is dropped.
13
15
  */
14
16
  export declare function credentialFor<H extends keyof HarnessCredentials>(source: CredentialSource, request: CredentialRequest & {
15
17
  harness: H;
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,MAAM,CAAC,EAAE,WAAW,KAChB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,kBAAkB,EACrE,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,EAC3C,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAM5C;AAiCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,gBAAgB,CAkBnB"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,yBAAyB,CAAC;AAKjC;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,MAAM,CAAC,EAAE,WAAW,KAChB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;AAE5C;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,kBAAkB,EACrE,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,EAC3C,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAM5C;AAiCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,gBAAgB,CAkBnB"}
@@ -0,0 +1,9 @@
1
+ import type { ToolResultContent } from "../../protocol/index.ts";
2
+ /**
3
+ * One hunk of a unified diff as a `diff` entry: `oldText` is its context and
4
+ * removed lines, `newText` its context and added lines, each joined by a
5
+ * newline. A `` marker is no line of either file,
6
+ * so it is dropped. Undefined for a hunk with no lines.
7
+ */
8
+ export declare function hunkDiff(path: string, lines: readonly string[]): ToolResultContent | undefined;
9
+ //# sourceMappingURL=diffs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffs.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/diffs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,GAAG,SAAS,CAe9F"}
@@ -10,7 +10,7 @@ export declare function questionRequest(questions: ElicitationQuestion[], toolCa
10
10
  /** What the agent is told when the user leaves its question unanswered. */
11
11
  export declare function unanswered(action: "decline" | "cancel"): string;
12
12
  /** An MCP server's request for input: a form to fill in, or a URL to visit. */
13
- export interface McpInputRequest {
13
+ interface McpInputRequest {
14
14
  mode: "form" | "url";
15
15
  message: string;
16
16
  /** The server asking, when the harness names it. */
@@ -27,11 +27,12 @@ export declare function inputRequest(request: McpInputRequest): ElicitationReque
27
27
  * The user's answer as an MCP server takes it (MCP's `ElicitResult`). A type,
28
28
  * not an interface: the SDKs' reply types are indexable.
29
29
  */
30
- export type McpInputReply = {
30
+ type McpInputReply = {
31
31
  action: "accept" | "decline" | "cancel";
32
32
  /** What the user filled in; only an accept carries it. */
33
33
  content?: Record<string, string | number | boolean | string[]>;
34
34
  };
35
35
  /** The broker's outcome, as the MCP server that asked takes it. */
36
36
  export declare function inputReply(outcome: ElicitationOutcome): McpInputReply;
37
+ export {};
37
38
  //# sourceMappingURL=elicitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/elicitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,UAAU,2HACkG,CAAC;AAE1H,iHAAiH;AACjH,wBAAgB,eAAe,CAC9B,SAAS,EAAE,mBAAmB,EAAE,EAChC,UAAU,CAAC,EAAE,MAAM,GACjB,kBAAkB,CAOpB;AAED,2EAA2E;AAC3E,wBAAgB,UA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UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAI/D;AAED,+EAA+E;AAC/E,UAAU,eAAe;IACxB,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAUzE;AAED;;;GAGG;AACH,KAAK,aAAa,GAAG;IACpB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;CAC/D,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAOrE"}
@@ -40,6 +40,12 @@ export interface CliLogin {
40
40
  apiKey?: string;
41
41
  }): Promise<NativeLogin>;
42
42
  logout(options: LoginOptions): Promise<void>;
43
+ /**
44
+ * The store a turn or a login with this `env` reads its login from: the
45
+ * value of the CLI's store variable, empty when unset. A login changed
46
+ * there restarts that store's sessions alone. Absent: one store.
47
+ */
48
+ store?(env: Record<string, string> | undefined): string;
43
49
  }
44
50
  /** The method a login names, refused unless the harness offers it as a login. */
45
51
  export declare function loginMethod<M extends AuthMethod>(methods: readonly M[], id: string): M;
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/login.ts"],"names":[],"mappings":"AAC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;AAKD;;;GAGG;AACH,wBAAsB,cAAc,CACnC,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GACC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBlE"}
@@ -1,8 +1,6 @@
1
1
  import type { ErrorInfo, McpServerConfig } from "../../protocol/index.ts";
2
2
  /** A turn owns its wire configuration even when the caller reuses its objects. */
3
3
  export declare function snapshotMcpServers(servers: Record<string, McpServerConfig> | undefined): Record<string, McpServerConfig>;
4
- /** Whether a turn needs the server: each does unless it says `required: false`. */
5
- export declare function mcpServerRequired(server: McpServerConfig | undefined): boolean;
6
4
  /** The server as its harness takes it: whether a turn needs it is the engine's rule. */
7
5
  export declare function nativeMcpServer(server: McpServerConfig): McpServerConfig;
8
6
  export declare function mcpConnectionErrors(names: string[], statuses: Array<{
@@ -22,8 +20,6 @@ export declare function settleMcpFailures(errors: Record<string, string>, server
22
20
  * query, and the stream is journaled, replayed and synced.
23
21
  */
24
22
  export declare function mcpCause(cause: string): string;
25
- /** What a turn says of a server it goes on without. */
26
- export declare function mcpUnavailableWarning(name: string, cause: string): ErrorInfo;
27
23
  /**
28
24
  * How long a turn goes on without a server that could not connect before a
29
25
  * turn tries it again: a server that never answers would otherwise hold up
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/mcp-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1E,kFAAkF;AAClF,wBA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,MAAM,CAAC,CAKxB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9C;AAWD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,CAAC;AAGnC;;;;GAIG;AACH,qBAAa,qBAAqB;IACjC,OAAO,CAAC,OAAO,CAAyD;IAExE,yCAAyC;IACzC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE;IAOlF;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAW7F,kFAAkF;IAC5E,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7F"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Idle time before an unused session's process is ended, unless
3
+ * `idleTimeoutMs` says otherwise.
4
+ */
5
+ export declare const IDLE_TIMEOUT_MS: number;
6
+ /**
7
+ * The native process a pooled session runs on, as the pool sees it.
8
+ *
9
+ * A client sets what `gone()` returns before its `onClose` handlers run: the
10
+ * pool reads `gone()` in its handler, and a successor and a release wait for
11
+ * what it read. A client that set it after would be succeeded while it still
12
+ * runs.
13
+ */
14
+ export interface PooledClient {
15
+ /** The process exited, or the client was closed. */
16
+ readonly closed: boolean;
17
+ /**
18
+ * End the process now; its exit follows (`gone`). The pool says why
19
+ * (`reason`), for a harness that reports it; a client may ignore it.
20
+ */
21
+ close(reason?: ProcessEndReason): void;
22
+ /** Called once, when the process ends: closed by anyone, or exited by itself. */
23
+ onClose(handler: (error?: Error) => void): () => void;
24
+ /**
25
+ * Settles once a client that was closed has exited, or could not be made
26
+ * to, bounded by the client's own stop. Absent: nothing to wait for.
27
+ */
28
+ gone?(): Promise<void>;
29
+ }
30
+ /** What the pool needs of a harness's process: the client it runs on. */
31
+ export interface PooledProcess {
32
+ client: PooledClient;
33
+ }
34
+ /** Why a warm process did not take the session's next turn (`replaceReason`). */
35
+ export type ReplaceReason = "exited" | "hostResumed" | "loginChanged" | "otherConversation" | "doesNotFit" | "cannotChange";
36
+ /**
37
+ * Why the pool ended a session's process, or saw it end: an idle timeout, a
38
+ * release, a shutdown, its own exit (or its harness closing it), or a turn
39
+ * that needed another.
40
+ */
41
+ export type ProcessEndReason = "idle" | "released" | "shutdown" | "exited" | `replaced:${ReplaceReason}`;
42
+ /**
43
+ * What a harness tells the pool about its processes. The rest (the map, the
44
+ * idle timer, the login generation per store, the host resume, and the waits
45
+ * for an exit) is the pool's. `T` is the harness's turn: whatever it needs to
46
+ * decide and to start.
47
+ */
48
+ export interface ProcessHarness<P extends PooledProcess, T> {
49
+ /**
50
+ * The login store a turn's process reads its login from at its start (an
51
+ * `env` value, say). Absent: one store, which every login change names.
52
+ */
53
+ store?(turn: T): string;
54
+ /**
55
+ * A mark of the store's login as it looks now (never the login), for a
56
+ * process that keeps the login it started with. Taken as a start begins and
57
+ * compared when a turn takes a process that fits it: a difference is
58
+ * `loginChanged`. Undefined: nothing to follow this turn. Absent: only a
59
+ * login change the engine is told of replaces a process (LLP 0016.000).
60
+ */
61
+ loginMark?(turn: T): string | undefined;
62
+ /** The conversation the turn resumes, when it names one. */
63
+ resumeOf(turn: T): string | undefined;
64
+ /** The conversations a warm process is on: a turn that resumes another needs another process. */
65
+ conversationsOf(process: P): readonly string[];
66
+ /**
67
+ * Whether a warm process was started with what this turn needs, as the
68
+ * process is now: a process's identity can change while it runs (an
69
+ * approved Codex plan rewrites its sandbox), and can depend on what it
70
+ * said at its start (whether an ACP agent takes extra directories).
71
+ */
72
+ fits(process: P, turn: T): boolean;
73
+ /**
74
+ * Make on a warm process the change this turn needs that a restart need
75
+ * not (Codex: log the turn's account in again, then compare the MCP table
76
+ * its thread carries): `false` when it cannot, and a new process starts.
77
+ * A throw fails the turn; the process stays the session's unless the
78
+ * harness closed it. Absent: nothing to change.
79
+ */
80
+ applyLiveChange?(process: P, turn: T, signal: AbortSignal): Promise<boolean>;
81
+ /**
82
+ * Whether the process holds the only copy of its conversation (an ACP
83
+ * agent that can neither resume nor load): no other process could go on
84
+ * with it, so it is neither ended for idleness nor replaced for a host
85
+ * resume. A turn it cannot take still replaces it.
86
+ */
87
+ holdsOnlyCopy?(process: P): boolean;
88
+ /**
89
+ * Start a process for the turn. `own` takes its client as soon as it
90
+ * exists, before anything is asked of it: from then a release or a
91
+ * shutdown closes it, its exit is waited for, and `startedBeforeResume`
92
+ * answers for it. A throw must leave the client closed. `replacing` is the
93
+ * warm process this turn could not take, ended by now, for what a harness
94
+ * carries over to its successor (Claude: the conversation's spend).
95
+ */
96
+ spawn(turn: T, own: (client: P["client"]) => void, signal: AbortSignal, replacing?: P): Promise<P>;
97
+ }
98
+ export interface ProcessPoolOptions {
99
+ /** Idle time before an unused process is ended; 0 or less never ends one for idleness. */
100
+ idleMs: number;
101
+ }
102
+ /**
103
+ * Each logical session's native process: reused while it still fits the
104
+ * turn, replaced otherwise, ended when idle, and never succeeded before it
105
+ * has exited. Claude, Codex and ACP run on it; a harness keeps only what is
106
+ * its own.
107
+ */
108
+ export declare class ProcessPool<P extends PooledProcess, T> {
109
+ private readonly harness;
110
+ private readonly options;
111
+ private readonly held;
112
+ /** Clients still being started, per session: a release or a shutdown closes them too. */
113
+ private readonly starting;
114
+ /** Every exit still under way, per session: a successor and a release wait for all of them. */
115
+ private readonly exiting;
116
+ /** Per client, from the moment it is owned: a process still starting can ask too. */
117
+ private readonly started;
118
+ /** Login changes per store, and those that named none (every store). */
119
+ private readonly logins;
120
+ private loginsEverywhere;
121
+ /** Host resumes so far (`invalidate`). */
122
+ private resumes;
123
+ private closed;
124
+ constructor(harness: ProcessHarness<P, T>, options: ProcessPoolOptions);
125
+ /** The session's process, ready, between or during its turns. */
126
+ get(sessionId: string): P | undefined;
127
+ /**
128
+ * The session's client: its process's, or the one still starting, the
129
+ * latest when the start owns several. An explicit change a harness queues
130
+ * on its client (Claude's MCP swap) reaches a session that is starting.
131
+ */
132
+ client(sessionId: string): P["client"] | undefined;
133
+ /**
134
+ * The session's process for the turn, which has it until `leave`: the
135
+ * warm one when it can take the turn, else a new one, started once every
136
+ * process of the session that was ended has exited. A session runs one
137
+ * turn at a time (`SessionAgent`), so a warm process is never under a
138
+ * running turn here.
139
+ */
140
+ acquire(sessionId: string, turn: T, signal: AbortSignal): Promise<P>;
141
+ /**
142
+ * The one rule: why the warm process cannot take the turn, or nothing
143
+ * when it can. The facts first, the harness's checks next, and the live
144
+ * change last, since it acts on the process.
145
+ */
146
+ private replaceReason;
147
+ /**
148
+ * Activity on a warm process between turns (Claude answering a query it
149
+ * began itself): its idle wait starts again. Nothing while a turn has it.
150
+ */
151
+ touch(sessionId: string, process: P): void;
152
+ /** The turn is done with the process: a warm one waits for the next turn, at most `idleMs`. */
153
+ leave(sessionId: string, process: P): void;
154
+ /**
155
+ * A login changed in `store` (in every store when none is named): each
156
+ * session's next turn on it starts a new process, which resumes its
157
+ * conversation. A turn already starting or running finishes on its own.
158
+ */
159
+ loginChanged(store?: string): void;
160
+ /**
161
+ * The host resumed from suspension, which left every process's remote
162
+ * connections dead: each session's next turn starts a new process. Ends
163
+ * nothing now, since ending at once has killed a turn still setting up.
164
+ */
165
+ invalidate(): void;
166
+ /**
167
+ * Whether a host resume came since the process began to start (a harness
168
+ * may refuse to prompt it); asked while it starts, too.
169
+ */
170
+ startedBeforeResume(process: P): boolean;
171
+ /**
172
+ * End the session's process for good, and any still starting, and settle
173
+ * once every process of the session has exited, those ended earlier
174
+ * (idle, replaced) included: a host removes the session's folders on this
175
+ * answer, and a process still exiting can write to them. Each wait is
176
+ * bounded by its client's stop (LLP 0007).
177
+ */
178
+ release(sessionId: string): Promise<void>;
179
+ /**
180
+ * End every process and refuse new ones; settles once every process of
181
+ * every session has exited, bounded as a release is.
182
+ */
183
+ closeAll(): Promise<void>;
184
+ private generation;
185
+ /** Every exit under way for the session, as one wait. */
186
+ private exits;
187
+ /** Wait for every ended process of the session to exit; a cancelled turn does not sit it out. */
188
+ private exited;
189
+ private start;
190
+ /** Own a client from its first moment: a release closes it, and its exit is waited for. */
191
+ private own;
192
+ /** Keep the client's exit until it is done: `gone()` is set by now (`PooledClient`). */
193
+ private exitUnderWay;
194
+ private disown;
195
+ /** End the session's process and those still starting. */
196
+ private remove;
197
+ /** End a held process, when it is still the session's; its exit is then waited for. */
198
+ private end;
199
+ private clearIdle;
200
+ }
201
+ //# sourceMappingURL=process-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-pool.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/process-pool.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,iFAAiF;IACjF,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACtD;;;OAGG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,YAAY,CAAC;CACrB;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GACtB,QAAQ,GACR,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,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;IAMxC;;;;;;OAMG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B,OAAO,CAAC,UAAU;IAIlB,yDAAyD;IACzD,OAAO,CAAC,KAAK;IAKb,iGAAiG;YACnF,MAAM;YAWN,KAAK;IA4CnB,2FAA2F;IAC3F,OAAO,CAAC,GAAG;IAuBX,wFAAwF;IACxF,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,MAAM;IAOd,0DAA0D;IAC1D,OAAO,CAAC,MAAM;IAQd,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,SAAS;CAMjB"}
@@ -0,0 +1,68 @@
1
+ import { type McpTool, type StopReason, type TokenUsage, type ToolKind, type ToolLocation, type ToolResultContent } from "../../../protocol/index.ts";
2
+ import type { AdapterEvent, EventTransformer, TransformResult } from "../types.ts";
3
+ /**
4
+ * What the scripted agent yields as it plays a turn: its "native" events,
5
+ * which a real harness would read off its CLI. `includeRaw` puts them on the
6
+ * stream as they are.
7
+ */
8
+ export type ScriptedEvent = {
9
+ type: "text";
10
+ text: string;
11
+ }
12
+ /** One word of a streamed text part; the first opens the part. */
13
+ | {
14
+ type: "stream";
15
+ text: string;
16
+ }
17
+ /** The streamed part is complete. */
18
+ | {
19
+ type: "streamed";
20
+ } | {
21
+ type: "tool";
22
+ toolCallId: string;
23
+ toolName: string;
24
+ input: Record<string, unknown>;
25
+ kind?: ToolKind;
26
+ mcp?: McpTool;
27
+ command?: string;
28
+ url?: string;
29
+ locations?: ToolLocation[];
30
+ } | {
31
+ type: "tool-result";
32
+ toolCallId: string;
33
+ /** What ran instead of the input the call opened with (an approval that edited it). */
34
+ input?: Record<string, unknown>;
35
+ output?: string;
36
+ /** The call failed, or was rejected: why. */
37
+ error?: string;
38
+ content?: ToolResultContent[];
39
+ metadata?: Record<string, unknown>;
40
+ } | {
41
+ type: "end";
42
+ stopReason?: StopReason;
43
+ usage?: TokenUsage;
44
+ cost?: number;
45
+ }
46
+ /** The turn stopped as the user asked (a permission request answered as a cancel). */
47
+ | {
48
+ type: "cancelled";
49
+ };
50
+ /**
51
+ * The scripted harness's adapter: its events to the engine's `AdapterEvent`s.
52
+ * Every part goes into the turn's one assistant message, which the engine
53
+ * opens; ids, indices and clones are the engine's (`EventProcessor`).
54
+ */
55
+ export declare class ScriptedTransformer implements EventTransformer<ScriptedEvent> {
56
+ private readonly sessionId;
57
+ private streaming?;
58
+ private readonly tools;
59
+ private ended?;
60
+ private cancelled;
61
+ constructor(sessionId: string);
62
+ process(event: ScriptedEvent): AdapterEvent[];
63
+ finish(): TransformResult;
64
+ }
65
+ export declare function createScriptedTransformer(ctx: {
66
+ sessionId: string;
67
+ }): EventTransformer<ScriptedEvent>;
68
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EAItB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAChC,kEAAkE;GAChE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAClC,qCAAqC;GACnC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACA,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,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G,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAElC"}
@@ -0,0 +1,56 @@
1
+ import type { McpServerConfig, ToolResultContent } from "../../../protocol/index.ts";
2
+ /** What a `call` step's tool answered, as its tool part shows it. */
3
+ export interface McpCallResult {
4
+ output: string;
5
+ content?: ToolResultContent[];
6
+ /** The server's `structuredContent`, when it gave one. */
7
+ metadata?: Record<string, unknown>;
8
+ /** The server said the call failed (`isError`): `output` says why. */
9
+ isError: boolean;
10
+ }
11
+ /** The part of the MCP SDK a call uses, typed here so no declaration of ours names the optional SDK. */
12
+ interface McpClient {
13
+ connect(transport: unknown): Promise<void>;
14
+ callTool(params: {
15
+ name: string;
16
+ arguments?: Record<string, unknown>;
17
+ }, resultSchema?: undefined, options?: {
18
+ signal?: AbortSignal;
19
+ }): Promise<{
20
+ content?: unknown;
21
+ structuredContent?: unknown;
22
+ isError?: unknown;
23
+ }>;
24
+ close(): Promise<void>;
25
+ }
26
+ interface McpSdk {
27
+ Client: new (info: {
28
+ name: string;
29
+ version: string;
30
+ }) => McpClient;
31
+ StreamableHTTPClientTransport: new (url: URL, opts?: {
32
+ requestInit?: RequestInit;
33
+ }) => unknown;
34
+ }
35
+ /** An `http` MCP server of the turn's, with the SDK loaded to call it. */
36
+ export interface CallableServer {
37
+ url: string;
38
+ headers?: Record<string, string>;
39
+ sdk: McpSdk;
40
+ }
41
+ /**
42
+ * The turn's MCP server `name`, checked before its call opens a part: a server
43
+ * the turn does not have, one that is not `http`, or an SDK that is not
44
+ * installed fails the step.
45
+ */
46
+ export declare function callableServer(name: string, servers: Record<string, McpServerConfig> | undefined): Promise<CallableServer>;
47
+ /**
48
+ * Call one tool over Streamable HTTP, on a connection of its own. A call that
49
+ * fails (the server down, an error it answers) answers `isError`.
50
+ */
51
+ export declare function callMcpTool(server: CallableServer, call: {
52
+ tool: string;
53
+ arguments?: Record<string, unknown>;
54
+ }, signal: AbortSignal): Promise<McpCallResult>;
55
+ export {};
56
+ //# sourceMappingURL=mcp-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-call.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/mcp-call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGrF,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,wGAAwG;AACxG,UAAU,SAAS;IAClB,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CACP,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAC7D,YAAY,CAAC,EAAE,SAAS,EACxB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAChC,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AACD,UAAU,MAAM;IACf,MAAM,EAAE,KAAK,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IACnE,6BAA6B,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC;CAC/F;AA0BD,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,GAClD,OAAO,CAAC,cAAc,CAAC,CAWzB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAChC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAC3D,MAAM,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
@@ -0,0 +1,73 @@
1
+ import { type AgentInput, type ModelDescriptor } from "../../../protocol/index.ts";
2
+ import type { NativeProcesses } from "../../processes/native-processes.ts";
3
+ import type { AgentExecuteOptions, RawAgentEvent } from "../base.ts";
4
+ import type { CliLogin } from "../login.ts";
5
+ import { SessionAgent } from "../session-agent.ts";
6
+ import { type ScriptStep, type ScriptStepOutcome } from "./steps.ts";
7
+ /** A turn's config as the script sees it: the turn's `RunConfig`, as the engine hands it to a harness. */
8
+ export type ScriptedTurnConfig = Omit<AgentExecuteOptions, "sessionId" | "turnId" | "signal" | "modelThinking" | "onNativeSession" | "onPermissionRequest" | "onElicitationRequest" | "onExecution" | "onWarning">;
9
+ /** What a turn was asked: what the script plays may depend on it. */
10
+ export interface ScriptedTurnRequest {
11
+ sessionId: string;
12
+ turnId: string;
13
+ input: AgentInput;
14
+ config: ScriptedTurnConfig;
15
+ /** How many turns this session ran before this one, in this engine: 0 for its first. */
16
+ turnIndex: number;
17
+ /** Aborts when the turn is cancelled. */
18
+ signal: AbortSignal;
19
+ }
20
+ /**
21
+ * Where a turn's steps come from. An async iterable lets a test release steps
22
+ * when it wants; the turn waits for the next one until it is cancelled. Each
23
+ * `next` is passed what the step before did (`ScriptStepOutcome`), so a
24
+ * generator's `yield` of a step evaluates to it.
25
+ */
26
+ export type ScriptSource = (request: ScriptedTurnRequest) => Iterable<ScriptStep, unknown, ScriptStepOutcome> | AsyncIterable<ScriptStep, unknown, ScriptStepOutcome>;
27
+ export interface ScriptedAgentOptions {
28
+ /** The steps of each turn; `scriptedQueue`, `scriptedFile` and `scriptedBySession` build the common forms. */
29
+ turn: ScriptSource;
30
+ /**
31
+ * The registry's processes (`createAgentRegistry` passes them). It starts
32
+ * none, so its runtime can vouch after a restart that nothing of its was
33
+ * left running, as for a real agent its sweep saw stopped. Without it a
34
+ * restart fences its cut-off sessions.
35
+ */
36
+ processes?: NativeProcesses;
37
+ }
38
+ /** A harness that plays a script instead of a model (see the top of this file). */
39
+ export declare class ScriptedAgent extends SessionAgent {
40
+ private readonly options;
41
+ readonly harness: "scripted";
42
+ readonly capabilities: {
43
+ multiTurn: boolean;
44
+ sessionResume: boolean;
45
+ modelSwitch: (string & {}) | "in_session" | "restart_session" | "unsupported";
46
+ thinkingLevels: boolean;
47
+ images: boolean;
48
+ files: ((string & {}) | "text" | "pdf" | "binary")[];
49
+ mcpServers: boolean;
50
+ permissionRequests: boolean;
51
+ rejectionMessages: boolean;
52
+ turnScopedSubagents?: boolean | undefined;
53
+ steering?: boolean | undefined;
54
+ ignoredSettings?: string[] | undefined;
55
+ };
56
+ /** Signed in to nothing, and always able to run: there is no login to make or lose. */
57
+ readonly login: CliLogin;
58
+ /** Turns each session has run in this engine. */
59
+ private readonly turns;
60
+ readonly processes?: NativeProcesses;
61
+ constructor(options: ScriptedAgentOptions);
62
+ listModels(): Promise<ModelDescriptor[]>;
63
+ protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<RawAgentEvent>;
64
+ private play;
65
+ /**
66
+ * Ask the engine's permission broker about a call: the input to run (the
67
+ * approved edit, when the answer edited it), why it was rejected, or that
68
+ * the user cancelled the turn.
69
+ */
70
+ private permit;
71
+ release(sessionId: string): Promise<void>;
72
+ }
73
+ //# sourceMappingURL=scripted-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripted-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/scripted-agent.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAY,MAAM,YAAY,CAAC;AAoC9F,0GAA0G;AAC1G,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACpC,mBAAmB,EACjB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,iBAAiB,GACjB,qBAAqB,GACrB,sBAAsB,GACtB,aAAa,GACb,WAAW,CACb,CAAC;AAEF,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,MAAM,EAAE,WAAW,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,OAAO,EAAE,mBAAmB,KAE1B,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,CAAC,GAChD,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAOzD,MAAM,WAAW,oBAAoB;IACpC,8GAA8G;IAC9G,IAAI,EAAE,YAAY,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B;AA2CD,mFAAmF;AACnF,qBAAa,aAAc,SAAQ,YAAY;IAmBlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAlBpC,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAU;IACvC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;MAAgB;IACrC,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAStB;IACF,iDAAiD;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IAEnD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;gBAER,OAAO,EAAE,oBAAoB;IAKpD,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;cAIpB,WAAW,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,eAAe,GACzB,qBAAqB,CAAC,aAAa,CAAC;YA6CxB,IAAI;IA0HnB;;;;OAIG;YACW,MAAM;IAwBL,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxD"}
@@ -0,0 +1,29 @@
1
+ import type { ScriptSource } from "./scripted-agent.ts";
2
+ import { type ScriptStep } from "./steps.ts";
3
+ /**
4
+ * One queue of steps for the whole runtime, consumed turn by turn whatever
5
+ * the session, one turn at a time: `{ end: true }` closes a turn, and the next
6
+ * turn plays on from the step after it. A turn that finds the queue empty
7
+ * fails, saying the script ran out, and so does one that starts while another
8
+ * plays (`scriptedBySession` serves sessions that run at once). Every step is
9
+ * read here: one the schema does not know throws now.
10
+ */
11
+ export declare function scriptedQueue(steps: readonly ScriptStep[]): ScriptSource;
12
+ /**
13
+ * `scriptedQueue`, read from a JSONL file: one step per line (blank lines
14
+ * skipped), a bad line refused by its number. It plays from its start each
15
+ * time an engine reads it and writes nothing, unless `position` names a file
16
+ * that keeps how far it has played: then an engine restarted mid-script goes
17
+ * on where the last one stopped (inside a turn, from the next turn), and a
18
+ * changed script plays from its start.
19
+ */
20
+ export declare function scriptedFile(path: string, options?: {
21
+ position?: string;
22
+ }): ScriptSource;
23
+ /**
24
+ * A queue per session id, as `scriptedQueue` plays one; a session not named
25
+ * plays `otherwise` from its start, in a queue of its own. A session with
26
+ * neither fails its turn.
27
+ */
28
+ export declare function scriptedBySession(scripts: Readonly<Record<string, readonly ScriptStep[]>>, otherwise?: readonly ScriptStep[]): ScriptSource;
29
+ //# sourceMappingURL=scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/scripts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAiB,KAAK,UAAU,EAAY,MAAM,YAAY,CAAC;AAmFtE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,YAAY,CAGxE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CAyB5F;AAcD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CAAC,EACxD,SAAS,CAAC,EAAE,SAAS,UAAU,EAAE,GAC/B,YAAY,CAgBd"}