@zvada/agent-server 0.3.21 → 0.3.23

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 (367) hide show
  1. package/CHANGELOG.md +332 -0
  2. package/README.md +2 -1
  3. package/dist/types/accounts/chatgpt.d.ts +1 -1
  4. package/dist/types/accounts/chatgpt.d.ts.map +1 -1
  5. package/dist/types/accounts/http.d.ts +2 -4
  6. package/dist/types/accounts/http.d.ts.map +1 -1
  7. package/dist/types/client/client.d.ts +37 -11
  8. package/dist/types/client/client.d.ts.map +1 -1
  9. package/dist/types/client/connection.d.ts +66 -13
  10. package/dist/types/client/connection.d.ts.map +1 -1
  11. package/dist/types/client/index.d.ts +1 -1
  12. package/dist/types/client/index.d.ts.map +1 -1
  13. package/dist/types/client/logins.d.ts +4 -3
  14. package/dist/types/client/logins.d.ts.map +1 -1
  15. package/dist/types/client/streams.d.ts +9 -3
  16. package/dist/types/client/streams.d.ts.map +1 -1
  17. package/dist/types/client/turns.d.ts +1 -1
  18. package/dist/types/client/turns.d.ts.map +1 -1
  19. package/dist/types/core/agents/acp/acp-agent.d.ts +34 -1
  20. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  21. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  22. package/dist/types/core/agents/acp/client.d.ts +12 -3
  23. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  24. package/dist/types/core/agents/acp/mappings.d.ts +8 -2
  25. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  26. package/dist/types/core/agents/base.d.ts +22 -8
  27. package/dist/types/core/agents/base.d.ts.map +1 -1
  28. package/dist/types/core/agents/claude-code/adapter.d.ts +7 -0
  29. package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -1
  30. package/dist/types/core/agents/claude-code/approvals.d.ts +4 -1
  31. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
  32. package/dist/types/core/agents/claude-code/claude-agent.d.ts +16 -5
  33. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  34. package/dist/types/core/agents/claude-code/events.d.ts +9 -1
  35. package/dist/types/core/agents/claude-code/events.d.ts.map +1 -1
  36. package/dist/types/core/agents/claude-code/login.d.ts +4 -1
  37. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  38. package/dist/types/core/agents/claude-code/mcp.d.ts +21 -7
  39. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
  40. package/dist/types/core/agents/claude-code/models.d.ts +5 -1
  41. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
  42. package/dist/types/core/agents/claude-code/options.d.ts +10 -4
  43. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  44. package/dist/types/core/agents/claude-code/outcome.d.ts +3 -5
  45. package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -1
  46. package/dist/types/core/agents/claude-code/results.d.ts +16 -0
  47. package/dist/types/core/agents/claude-code/results.d.ts.map +1 -0
  48. package/dist/types/core/agents/claude-code/sdk-pair.d.ts +13 -0
  49. package/dist/types/core/agents/claude-code/sdk-pair.d.ts.map +1 -0
  50. package/dist/types/core/agents/claude-code/session.d.ts +50 -12
  51. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  52. package/dist/types/core/agents/claude-code/spend.d.ts +2 -1
  53. package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -1
  54. package/dist/types/core/agents/claude-code/tools.d.ts +26 -3
  55. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
  56. package/dist/types/core/agents/codex-app-server/adapter.d.ts +2 -2
  57. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
  58. package/dist/types/core/agents/codex-app-server/client.d.ts +21 -2
  59. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  60. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +61 -14
  61. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
  62. package/dist/types/core/agents/codex-app-server/commands.d.ts +2 -2
  63. package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -1
  64. package/dist/types/core/agents/codex-app-server/credentials.d.ts +5 -1
  65. package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -1
  66. package/dist/types/core/agents/codex-app-server/effort.d.ts +2 -1
  67. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
  68. package/dist/types/core/agents/codex-app-server/homes.d.ts +26 -5
  69. package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -1
  70. package/dist/types/core/agents/codex-app-server/items.d.ts +27 -2
  71. package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -1
  72. package/dist/types/core/agents/codex-app-server/login.d.ts +4 -1
  73. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  74. package/dist/types/core/agents/codex-app-server/mcp.d.ts +45 -20
  75. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
  76. package/dist/types/core/agents/codex-app-server/models.d.ts +3 -10
  77. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
  78. package/dist/types/core/agents/codex-app-server/options.d.ts +32 -5
  79. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
  80. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +2 -1
  81. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -1
  82. package/dist/types/core/agents/codex-app-server/protocol.d.ts +16 -3
  83. package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -1
  84. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
  85. package/dist/types/core/agents/codex-app-server/session.d.ts +70 -33
  86. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
  87. package/dist/types/core/agents/codex-app-server/subagents.d.ts +9 -4
  88. package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -1
  89. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +3 -2
  90. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
  91. package/dist/types/core/agents/codex-app-server/turn-items.d.ts +2 -1
  92. package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -1
  93. package/dist/types/core/agents/codex-app-server/turn.d.ts +37 -8
  94. package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -1
  95. package/dist/types/core/agents/codex-app-server/user-login.d.ts +28 -0
  96. package/dist/types/core/agents/codex-app-server/user-login.d.ts.map +1 -0
  97. package/dist/types/core/agents/credentials.d.ts +3 -1
  98. package/dist/types/core/agents/credentials.d.ts.map +1 -1
  99. package/dist/types/core/agents/diffs.d.ts +9 -0
  100. package/dist/types/core/agents/diffs.d.ts.map +1 -0
  101. package/dist/types/core/agents/elicitation.d.ts +3 -2
  102. package/dist/types/core/agents/elicitation.d.ts.map +1 -1
  103. package/dist/types/core/agents/login.d.ts +6 -0
  104. package/dist/types/core/agents/login.d.ts.map +1 -1
  105. package/dist/types/core/agents/mcp-config.d.ts +0 -4
  106. package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
  107. package/dist/types/core/agents/plan.d.ts +2 -13
  108. package/dist/types/core/agents/plan.d.ts.map +1 -1
  109. package/dist/types/core/agents/process-pool.d.ts +193 -0
  110. package/dist/types/core/agents/process-pool.d.ts.map +1 -0
  111. package/dist/types/core/agents/scripted/adapter.d.ts +68 -0
  112. package/dist/types/core/agents/scripted/adapter.d.ts.map +1 -0
  113. package/dist/types/core/agents/scripted/mcp-call.d.ts +56 -0
  114. package/dist/types/core/agents/scripted/mcp-call.d.ts.map +1 -0
  115. package/dist/types/core/agents/scripted/scripted-agent.d.ts +73 -0
  116. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -0
  117. package/dist/types/core/agents/scripted/scripts.d.ts +29 -0
  118. package/dist/types/core/agents/scripted/scripts.d.ts.map +1 -0
  119. package/dist/types/core/agents/scripted/steps.d.ts +132 -0
  120. package/dist/types/core/agents/scripted/steps.d.ts.map +1 -0
  121. package/dist/types/core/agents/session-agent.d.ts +49 -6
  122. package/dist/types/core/agents/session-agent.d.ts.map +1 -1
  123. package/dist/types/core/diagnostics.d.ts +4 -1
  124. package/dist/types/core/diagnostics.d.ts.map +1 -1
  125. package/dist/types/core/index.d.ts +6 -1
  126. package/dist/types/core/index.d.ts.map +1 -1
  127. package/dist/types/core/presets.d.ts +32 -6
  128. package/dist/types/core/presets.d.ts.map +1 -1
  129. package/dist/types/core/processes/lifeline.d.ts +0 -20
  130. package/dist/types/core/processes/lifeline.d.ts.map +1 -1
  131. package/dist/types/core/provision/index.d.ts +2 -2
  132. package/dist/types/core/provision/index.d.ts.map +1 -1
  133. package/dist/types/core/provision/install-build.d.ts +2 -1
  134. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  135. package/dist/types/core/provision/npm.d.ts +20 -8
  136. package/dist/types/core/provision/npm.d.ts.map +1 -1
  137. package/dist/types/core/provision/provisioner.d.ts +4 -1
  138. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  139. package/dist/types/core/provision/tools.d.ts +2 -1
  140. package/dist/types/core/provision/tools.d.ts.map +1 -1
  141. package/dist/types/core/runtime/agent-runtime.d.ts +18 -9
  142. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  143. package/dist/types/core/runtime/event-processor.d.ts +5 -1
  144. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  145. package/dist/types/core/runtime/harness-clis.d.ts +9 -0
  146. package/dist/types/core/runtime/harness-clis.d.ts.map +1 -1
  147. package/dist/types/core/runtime/harness-logins.d.ts +33 -5
  148. package/dist/types/core/runtime/harness-logins.d.ts.map +1 -1
  149. package/dist/types/core/runtime/model-lists.d.ts +2 -0
  150. package/dist/types/core/runtime/model-lists.d.ts.map +1 -1
  151. package/dist/types/core/runtime/permission-policy.d.ts +5 -3
  152. package/dist/types/core/runtime/permission-policy.d.ts.map +1 -1
  153. package/dist/types/core/runtime/request-broker.d.ts +2 -1
  154. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  155. package/dist/types/core/runtime/turn.d.ts +14 -1
  156. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  157. package/dist/types/core/utils/deadline.d.ts +6 -0
  158. package/dist/types/core/utils/deadline.d.ts.map +1 -1
  159. package/dist/types/core/utils/errors.d.ts +15 -1
  160. package/dist/types/core/utils/errors.d.ts.map +1 -1
  161. package/dist/types/operator/index.d.ts +11 -0
  162. package/dist/types/operator/index.d.ts.map +1 -0
  163. package/dist/types/operator/mcp.d.ts +33 -0
  164. package/dist/types/operator/mcp.d.ts.map +1 -0
  165. package/dist/types/operator/operator.d.ts +206 -0
  166. package/dist/types/operator/operator.d.ts.map +1 -0
  167. package/dist/types/operator/render.d.ts +89 -0
  168. package/dist/types/operator/render.d.ts.map +1 -0
  169. package/dist/types/operator/view.d.ts +44 -0
  170. package/dist/types/operator/view.d.ts.map +1 -0
  171. package/dist/types/protocol/auth.d.ts +54 -24
  172. package/dist/types/protocol/auth.d.ts.map +1 -1
  173. package/dist/types/protocol/clis.d.ts +14 -7
  174. package/dist/types/protocol/clis.d.ts.map +1 -1
  175. package/dist/types/protocol/config.d.ts +2 -0
  176. package/dist/types/protocol/config.d.ts.map +1 -1
  177. package/dist/types/protocol/conversation.d.ts +40 -3
  178. package/dist/types/protocol/conversation.d.ts.map +1 -1
  179. package/dist/types/protocol/credentials.d.ts +7 -0
  180. package/dist/types/protocol/credentials.d.ts.map +1 -1
  181. package/dist/types/protocol/execution.d.ts +2 -1
  182. package/dist/types/protocol/execution.d.ts.map +1 -1
  183. package/dist/types/protocol/factories.d.ts +12 -2
  184. package/dist/types/protocol/factories.d.ts.map +1 -1
  185. package/dist/types/protocol/harness.d.ts +6 -2
  186. package/dist/types/protocol/harness.d.ts.map +1 -1
  187. package/dist/types/protocol/history.d.ts +19 -0
  188. package/dist/types/protocol/history.d.ts.map +1 -1
  189. package/dist/types/protocol/lifecycle.d.ts +47 -8
  190. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  191. package/dist/types/protocol/model-catalog.d.ts.map +1 -1
  192. package/dist/types/protocol/models.d.ts +3 -0
  193. package/dist/types/protocol/models.d.ts.map +1 -1
  194. package/dist/types/protocol/parts.d.ts +14 -0
  195. package/dist/types/protocol/parts.d.ts.map +1 -1
  196. package/dist/types/protocol/plan.d.ts +20 -0
  197. package/dist/types/protocol/plan.d.ts.map +1 -0
  198. package/dist/types/protocol/tool-state.d.ts +12 -0
  199. package/dist/types/protocol/tool-state.d.ts.map +1 -1
  200. package/dist/types/protocol/wire-api.d.ts +129 -23
  201. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  202. package/dist/types/protocol/wire.d.ts +70 -10
  203. package/dist/types/protocol/wire.d.ts.map +1 -1
  204. package/dist/types/server/acp/binding.d.ts +6 -1
  205. package/dist/types/server/acp/binding.d.ts.map +1 -1
  206. package/dist/types/server/acp/translate.d.ts +33 -7
  207. package/dist/types/server/acp/translate.d.ts.map +1 -1
  208. package/dist/types/server/agent-server.d.ts +6 -0
  209. package/dist/types/server/agent-server.d.ts.map +1 -1
  210. package/dist/types/server/feedback.d.ts +2 -1
  211. package/dist/types/server/feedback.d.ts.map +1 -1
  212. package/dist/types/server/install.d.ts +11 -0
  213. package/dist/types/server/install.d.ts.map +1 -1
  214. package/dist/types/server/session-gate.d.ts +2 -1
  215. package/dist/types/server/session-gate.d.ts.map +1 -1
  216. package/dist/types/server/session-store.d.ts +1 -0
  217. package/dist/types/server/session-store.d.ts.map +1 -1
  218. package/dist/types/server/subscriptions.d.ts +2 -1
  219. package/dist/types/server/subscriptions.d.ts.map +1 -1
  220. package/dist/types/server/transports.d.ts.map +1 -1
  221. package/dist/types/sync/fit.d.ts +8 -7
  222. package/dist/types/sync/fit.d.ts.map +1 -1
  223. package/dist/types/sync/history-sqlite.d.ts.map +1 -1
  224. package/dist/types/sync/index.d.ts +1 -0
  225. package/dist/types/sync/index.d.ts.map +1 -1
  226. package/dist/types/sync/journal-sqlite.d.ts +2 -1
  227. package/dist/types/sync/journal-sqlite.d.ts.map +1 -1
  228. package/dist/types/sync/journal.d.ts +11 -3
  229. package/dist/types/sync/journal.d.ts.map +1 -1
  230. package/dist/types/sync/projection.d.ts +6 -0
  231. package/dist/types/sync/projection.d.ts.map +1 -1
  232. package/dist/types/sync/recovery.d.ts +2 -1
  233. package/dist/types/sync/recovery.d.ts.map +1 -1
  234. package/dist/types/sync/schema.d.ts +10 -0
  235. package/dist/types/sync/schema.d.ts.map +1 -1
  236. package/dist/types/sync/sql.d.ts +2 -1
  237. package/dist/types/sync/sql.d.ts.map +1 -1
  238. package/dist/types/sync/worker.d.ts.map +1 -1
  239. package/docs/consuming.md +464 -40
  240. package/docs/deploy.md +36 -8
  241. package/docs/durable-sessions.md +35 -5
  242. package/docs/harnesses.md +396 -30
  243. package/package.json +11 -1
  244. package/src/accounts/chatgpt.ts +2 -2
  245. package/src/accounts/http.ts +2 -16
  246. package/src/client/client.ts +92 -31
  247. package/src/client/connection.ts +113 -22
  248. package/src/client/index.ts +1 -0
  249. package/src/client/logins.ts +24 -15
  250. package/src/client/streams.ts +12 -4
  251. package/src/client/turns.ts +1 -1
  252. package/src/core/agents/acp/acp-agent.ts +181 -52
  253. package/src/core/agents/acp/adapter.ts +9 -1
  254. package/src/core/agents/acp/client.ts +16 -4
  255. package/src/core/agents/acp/mappings.ts +27 -0
  256. package/src/core/agents/base.ts +25 -10
  257. package/src/core/agents/claude-code/adapter.ts +47 -17
  258. package/src/core/agents/claude-code/approvals.ts +6 -5
  259. package/src/core/agents/claude-code/claude-agent.ts +60 -30
  260. package/src/core/agents/claude-code/events.ts +11 -1
  261. package/src/core/agents/claude-code/login.ts +14 -2
  262. package/src/core/agents/claude-code/mcp.ts +31 -15
  263. package/src/core/agents/claude-code/models.ts +7 -2
  264. package/src/core/agents/claude-code/options.ts +11 -3
  265. package/src/core/agents/claude-code/outcome.ts +10 -2
  266. package/src/core/agents/claude-code/results.ts +73 -0
  267. package/src/core/agents/claude-code/sdk-pair.ts +66 -0
  268. package/src/core/agents/claude-code/session.ts +166 -37
  269. package/src/core/agents/claude-code/spend.ts +1 -1
  270. package/src/core/agents/claude-code/tools.ts +108 -12
  271. package/src/core/agents/codex-app-server/adapter.ts +37 -12
  272. package/src/core/agents/codex-app-server/client.ts +69 -10
  273. package/src/core/agents/codex-app-server/codex-agent.ts +141 -55
  274. package/src/core/agents/codex-app-server/commands.ts +2 -2
  275. package/src/core/agents/codex-app-server/credentials.ts +10 -5
  276. package/src/core/agents/codex-app-server/effort.ts +1 -1
  277. package/src/core/agents/codex-app-server/homes.ts +59 -10
  278. package/src/core/agents/codex-app-server/items.ts +219 -31
  279. package/src/core/agents/codex-app-server/login.ts +14 -2
  280. package/src/core/agents/codex-app-server/mcp.ts +142 -26
  281. package/src/core/agents/codex-app-server/models.ts +9 -8
  282. package/src/core/agents/codex-app-server/options.ts +79 -11
  283. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  284. package/src/core/agents/codex-app-server/protocol.ts +14 -4
  285. package/src/core/agents/codex-app-server/requests.ts +14 -6
  286. package/src/core/agents/codex-app-server/session.ts +156 -81
  287. package/src/core/agents/codex-app-server/subagents.ts +21 -14
  288. package/src/core/agents/codex-app-server/thread-settings.ts +18 -8
  289. package/src/core/agents/codex-app-server/turn-items.ts +1 -1
  290. package/src/core/agents/codex-app-server/turn.ts +96 -35
  291. package/src/core/agents/codex-app-server/user-login.ts +107 -0
  292. package/src/core/agents/credentials.ts +5 -2
  293. package/src/core/agents/diffs.ts +25 -0
  294. package/src/core/agents/elicitation.ts +2 -2
  295. package/src/core/agents/login.ts +6 -0
  296. package/src/core/agents/mcp-config.ts +2 -2
  297. package/src/core/agents/plan.ts +3 -19
  298. package/src/core/agents/process-pool.ts +432 -0
  299. package/src/core/agents/scripted/adapter.ts +142 -0
  300. package/src/core/agents/scripted/mcp-call.ts +134 -0
  301. package/src/core/agents/scripted/scripted-agent.ts +418 -0
  302. package/src/core/agents/scripted/scripts.ts +171 -0
  303. package/src/core/agents/scripted/steps.ts +127 -0
  304. package/src/core/agents/session-agent.ts +105 -8
  305. package/src/core/diagnostics.ts +9 -1
  306. package/src/core/index.ts +12 -0
  307. package/src/core/presets.ts +99 -14
  308. package/src/core/processes/lifeline.ts +99 -25
  309. package/src/core/provision/index.ts +1 -2
  310. package/src/core/provision/install-build.ts +4 -1
  311. package/src/core/provision/npm.ts +309 -97
  312. package/src/core/provision/provisioner.ts +22 -8
  313. package/src/core/provision/tools.ts +44 -19
  314. package/src/core/runtime/agent-runtime.ts +70 -34
  315. package/src/core/runtime/event-processor.ts +18 -2
  316. package/src/core/runtime/harness-clis.ts +36 -1
  317. package/src/core/runtime/harness-logins.ts +82 -31
  318. package/src/core/runtime/model-lists.ts +1 -1
  319. package/src/core/runtime/permission-policy.ts +4 -3
  320. package/src/core/runtime/request-broker.ts +1 -1
  321. package/src/core/runtime/turn.ts +53 -3
  322. package/src/core/utils/deadline.ts +23 -0
  323. package/src/core/utils/errors.ts +24 -4
  324. package/src/operator/index.ts +40 -0
  325. package/src/operator/mcp.ts +171 -0
  326. package/src/operator/operator.ts +782 -0
  327. package/src/operator/render.ts +473 -0
  328. package/src/operator/view.ts +82 -0
  329. package/src/protocol/auth.ts +30 -23
  330. package/src/protocol/clis.ts +12 -4
  331. package/src/protocol/credentials.ts +19 -0
  332. package/src/protocol/execution.ts +5 -0
  333. package/src/protocol/factories.ts +25 -3
  334. package/src/protocol/harness.ts +11 -1
  335. package/src/protocol/history.ts +20 -0
  336. package/src/protocol/lifecycle.ts +10 -1
  337. package/src/protocol/model-catalog.ts +19 -8
  338. package/src/protocol/parts.ts +12 -1
  339. package/src/protocol/plan.ts +35 -0
  340. package/src/protocol/tool-state.ts +14 -1
  341. package/src/protocol/wire.ts +14 -0
  342. package/src/server/acp/binding.ts +113 -22
  343. package/src/server/acp/translate.ts +161 -8
  344. package/src/server/agent-server.ts +10 -1
  345. package/src/server/bin.ts +83 -9
  346. package/src/server/feedback.ts +1 -1
  347. package/src/server/install.ts +82 -4
  348. package/src/server/session-gate.ts +1 -1
  349. package/src/server/session-store.ts +5 -1
  350. package/src/server/subscriptions.ts +1 -1
  351. package/src/server/transports.ts +14 -0
  352. package/src/sync/fit.ts +115 -28
  353. package/src/sync/history-sqlite.ts +6 -2
  354. package/src/sync/index.ts +1 -0
  355. package/src/sync/journal-sqlite.ts +20 -2
  356. package/src/sync/journal.ts +10 -2
  357. package/src/sync/projection.ts +10 -0
  358. package/src/sync/recovery.ts +11 -4
  359. package/src/sync/schema.ts +7 -5
  360. package/src/sync/sql.ts +1 -1
  361. package/src/sync/worker.ts +4 -0
  362. package/dist/types/core/agents/claude-code/session-pool.d.ts +0 -36
  363. package/dist/types/core/agents/claude-code/session-pool.d.ts.map +0 -1
  364. package/dist/types/core/agents/session-pool.d.ts +0 -41
  365. package/dist/types/core/agents/session-pool.d.ts.map +0 -1
  366. package/src/core/agents/claude-code/session-pool.ts +0 -136
  367. package/src/core/agents/session-pool.ts +0 -111
@@ -1,7 +1,7 @@
1
1
  import type { McpSetServersResult, SDKResultError, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
2
2
  import type { AgentInput, McpServerConfig, ModelDescriptor } from "../../../protocol/index.ts";
3
3
  import { type NativeProcesses } from "../../processes/native-processes.ts";
4
- import type { AgentExecuteOptions, CancelResult, ListModelsOptions } from "../base.ts";
4
+ import type { AgentExecuteOptions, ListModelsOptions } from "../base.ts";
5
5
  import { SessionAgent } from "../session-agent.ts";
6
6
  import type { ClaudeRawEvent } from "./events.ts";
7
7
  import { ClaudeCliLogin } from "./login.ts";
@@ -40,6 +40,7 @@ export declare class ClaudeCodeAgent extends SessionAgent {
40
40
  rejectionMessages: boolean;
41
41
  turnScopedSubagents?: boolean | undefined;
42
42
  steering?: boolean | undefined;
43
+ ignoredSettings?: string[] | undefined;
43
44
  };
44
45
  /** Its CLIs start here: the runtime's, or this OS process's own when it was made without one. */
45
46
  readonly processes: NativeProcesses;
@@ -49,20 +50,30 @@ export declare class ClaudeCodeAgent extends SessionAgent {
49
50
  constructor(agentOptions?: ClaudeCodeAgentOptions);
50
51
  /** Options on a credential the product holds, when it holds one. */
51
52
  private withDelivery;
52
- loginChanged(): void;
53
+ loginChanged(store?: string): void;
53
54
  protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<ClaudeRawEvent>;
54
55
  protected checkSteerInput(input: AgentInput): void;
55
56
  /** The models this login offers in `options.cwd`, from the Claude Code CLI. */
56
57
  listModels(listing: ListModelsOptions): Promise<ModelDescriptor[]>;
57
58
  /**
58
59
  * Hot-swap the live session's wire MCP servers without a restart (context
59
- * intact). Returns false when the session isn't live. In-process servers
60
- * are preserved across swaps.
60
+ * intact). A session still starting takes it once ready, after the servers
61
+ * its turn attaches. Returns undefined when the session isn't live. In-process servers
62
+ * are preserved across swaps. The next turn's own `mcpServers` swap back
63
+ * when they still name the old set: keep them in step.
61
64
  */
62
65
  setMcpServers(sessionId: string, servers: Record<string, McpServerConfig>): Promise<McpSetServersResult | undefined>;
63
66
  /** Resume saved history in a fresh subprocess on the next turn after host suspension. */
64
67
  invalidateMcpConnections(): void;
65
- cancel(sessionId: string): Promise<CancelResult>;
68
+ /**
69
+ * Interrupt the turn's process for a cancel, which has already aborted the
70
+ * turn: the controller ends the engine's execute loop, so this turn
71
+ * classifies as cancelled even when the generator drains to a natural end
72
+ * before the SDK interrupt lands (the abort-order race that could surface
73
+ * a clean user cancel as `error`/`end_turn`). The SDK interrupt's
74
+ * round-trip is what confirms the cancel.
75
+ */
76
+ private interrupt;
66
77
  release(sessionId: string): Promise<void>;
67
78
  terminateAll(): Promise<void>;
68
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claude-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/claude-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAEX,UAAU,EACV,eAAe,EACf,eAAe,EACf,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ClaudeQuerySpend } from "./spend.ts";
9
9
  * another (an operator's `$CLAUDE_CLI_PATH`), so readers still tolerate a
10
10
  * field an older CLI leaves out.
11
11
  */
12
- export type ClaudeRawEvent = SDKMessage | ClaudeTurnInterrupted | ClaudeSteerRead | ClaudeQuerySettled;
12
+ export type ClaudeRawEvent = SDKMessage | ClaudeTurnInterrupted | ClaudeSteerRead | ClaudeQuerySettled | ClaudeMcpServerNames;
13
+ /**
14
+ * The MCP servers the session knows as the turn begins, which name its MCP
15
+ * tools (`mcp__<server>__<tool>`): a server's name may hold `__` itself.
16
+ */
17
+ export interface ClaudeMcpServerNames {
18
+ type: "agentServer/mcpServers";
19
+ names: string[];
20
+ }
13
21
  /**
14
22
  * The turn was asked to stop. An interrupted query and one that failed end on
15
23
  * the same result (`error_during_execution`, the stop reason of the step it
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACvB,UAAU,GACV,qBAAqB,GACrB,eAAe,GACf,kBAAkB,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,6BAA6B,CAAC;CACpC;AAED,+FAA+F;AAC/F,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC3D,IAAI,EAAE,0BAA0B,CAAC;IACjC,0FAA0F;IAC1F,aAAa,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAKpE"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACvB,UAAU,GACV,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,oBAAoB,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,6BAA6B,CAAC;CACpC;AAED,+FAA+F;AAC/F,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC3D,IAAI,EAAE,0BAA0B,CAAC;IACjC,0FAA0F;IAC1F,aAAa,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAKpE"}
@@ -21,7 +21,7 @@ type ClaudeQuery = (params: {
21
21
  prompt: AsyncIterable<SDKUserMessage>;
22
22
  options: CCOptions;
23
23
  }) => Query & ClaudeLoginControl;
24
- export interface ClaudeCliLoginOptions {
24
+ interface ClaudeCliLoginOptions {
25
25
  resolveCliPath?: () => Promise<string | undefined>;
26
26
  processes: NativeProcesses;
27
27
  inheritConfig?: InheritConfig;
@@ -44,10 +44,13 @@ interface ClaudeAuthStatus {
44
44
  * as the CLI decides it.
45
45
  */
46
46
  export declare function claudeLoginStatus(raw: ClaudeAuthStatus): LoginStatus;
47
+ /** The login store a turn or a login with this `env` uses: its `CLAUDE_CONFIG_DIR`, empty when unset. */
48
+ export declare function claudeLoginStore(env: Record<string, string> | undefined): string;
47
49
  /** Claude Code's login: `claude auth status`, its OAuth flows over the SDK, `claude auth logout`. */
48
50
  export declare class ClaudeCliLogin implements CliLogin {
49
51
  private readonly options;
50
52
  constructor(options: ClaudeCliLoginOptions);
53
+ store(env: Record<string, string> | undefined): string;
51
54
  /** The CLI to run a command of: the one turns run, else `$CLAUDE_CLI_PATH`, else `claude` on PATH. */
52
55
  private commandPath;
53
56
  /** The environment a turn with this `env` runs Claude Code in: whose login it is. */
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAc,KAAK,UAAU,EAAoB,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAIhB,MAAM,aAAa,CAAC;AAerB;;;;;GAKG;AACH,UAAU,kBAAkB;IAC3B,kBAAkB,CAAC,CAClB,iBAAiB,EAAE,OAAO,GACxB,OAAO,CAAC;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC5D,mBAAmB,CAAC,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF,4BAA4B,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAClD;AAED,KAAK,WAAW,GAAG,CAA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AAU,gBAAgB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAmBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAcpE;AAcD,yGAAyG;AACzG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAEhF;AAED,qGAAqG;AACrG,qBAAa,cAAe,YAAW,QAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,qBAAqB;IAE3D,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM;IAItD,sGAAsG;YACxF,WAAW;IAIzB,qFAAqF;IACrF,OAAO,CAAC,GAAG;IAOL,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAQrD,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBnD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAmG9D,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CASlD"}
@@ -3,7 +3,7 @@ import type { McpServerConfig } from "../../../protocol/index.ts";
3
3
  import { UnavailableMcpServers } from "../mcp-config.ts";
4
4
  import type { SdkMcpServers } from "./options.ts";
5
5
  /** What an MCP update asks of the live query. */
6
- export type McpControl = Pick<Query, "setMcpServers" | "mcpServerStatus">;
6
+ type McpControl = Pick<Query, "setMcpServers" | "mcpServerStatus">;
7
7
  /**
8
8
  * A Claude session's MCP servers: the turn's wire servers it runs with, the
9
9
  * host's in-process ones, and what is known of their connections. Every
@@ -11,8 +11,10 @@ export type McpControl = Pick<Query, "setMcpServers" | "mcpServerStatus">;
11
11
  * interleave on the CLI's control channel.
12
12
  */
13
13
  export declare class ClaudeMcpConnections {
14
+ private readonly hostResumed;
14
15
  private wire;
15
16
  private host;
17
+ private loaded;
16
18
  private updates;
17
19
  /**
18
20
  * Set while an update has not finished, with the servers that failed in it.
@@ -21,22 +23,33 @@ export declare class ClaudeMcpConnections {
21
23
  * uncertainty holds until a verified reattachment succeeds.
22
24
  */
23
25
  private failed?;
24
- private invalidated;
25
26
  /** Servers not required that could not connect: the session's turns go on without them. */
26
27
  readonly unavailable: UnavailableMcpServers;
27
- /** `servers`: the spawning turn's, attached before its prompt. */
28
- constructor(servers: Record<string, McpServerConfig> | undefined);
28
+ /**
29
+ * `servers`: the spawning turn's, attached before its prompt.
30
+ * `hostResumed`: whether a host resume came since the process began to
31
+ * start (the pool's `startedBeforeResume`).
32
+ */
33
+ constructor(servers: Record<string, McpServerConfig> | undefined, hostResumed?: () => boolean);
29
34
  /** The wire servers the session runs with: the last update's, or the spawning turn's. */
30
35
  get servers(): Readonly<Record<string, McpServerConfig>>;
36
+ /**
37
+ * Every server name the session knows: the wire's, the host's, and those
38
+ * Claude loaded from the person's configuration (above `inheritConfig:
39
+ * "none"`), which its `system/init` lists. A tool name is matched against them.
40
+ */
41
+ get names(): string[];
42
+ /** The servers Claude's `system/init` listed. */
43
+ sawLoaded(names: readonly string[]): void;
31
44
  /** The last update did not finish: what the CLI holds now is not known. */
32
45
  get uncertain(): boolean;
33
46
  /**
34
47
  * The process must be replaced: host suspension invalidated its
35
- * subprocess-wide HTTP pool, which replacing MCP clients cannot clear.
48
+ * subprocess-wide HTTP pool, which replacing MCP clients cannot clear. A
49
+ * thawed VM can retain clients whose sockets still appear connected, so it
50
+ * holds until the process is replaced, whatever an update says after.
36
51
  */
37
52
  get respawnRequired(): boolean;
38
- /** A thawed VM can retain clients whose sockets still appear connected. */
39
- invalidate(): void;
40
53
  /** The host's in-process servers, resolved at spawn: every update keeps them, and they win a name. */
41
54
  useHostServers(servers: SdkMcpServers | undefined): void;
42
55
  /** Whether a turn asking for `servers` must update the connections before its prompt. */
@@ -49,4 +62,5 @@ export declare class ClaudeMcpConnections {
49
62
  update(servers: Record<string, McpServerConfig>, control: () => McpControl | undefined): Promise<McpSetServersResult | undefined>;
50
63
  private apply;
51
64
  }
65
+ export {};
52
66
  //# sourceMappingURL=mcp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EACN,qBAAqB,EAKrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,iBAAiB,CAAC,CAAC;AAa1E;;;;;GAKG;AACH,qBAAa,oBAAoB;IAChC,OAAO,CAAC,IAAI,CAAkC;IAC9C,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,OAAO,CAAqB;IACpC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,WAAW,CAAS;IAC5B,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,wBAA+B;IAEnD,kEAAkE;gBACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS;IAIhE,yF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C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,wBAA+B;IAEnD;;;;OAIG;gBAEF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EACnC,WAAW,GAAE,MAAM,OAAqB;IAK1D,yFAAyF;IACzF,IAAI,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAEvD;IAED;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED,iDAAiD;IACjD,SAAS,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAIzC,2EAA2E;IAC3E,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;;OAKG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,sGAAsG;IACtG,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAIxD,yFAAyF;IACzF,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,GAAG,OAAO;IAW1E;;;;OAIG;IACH,MAAM,CACL,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACxC,OAAO,EAAE,MAAM,UAAU,GAAG,SAAS,GACnC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;YAc7B,KAAK;CAyFnB"}
@@ -13,7 +13,11 @@ export declare function claudeModelDescriptors(models: readonly ClaudeModelInfo[
13
13
  * lowers a level its model lacks on its own and does not say so (`max` and
14
14
  * `xhigh` become `high`), so the level is fitted here, where the model's levels
15
15
  * are known. `off` is sent as it is: some models do not let thinking be
16
- * disabled, and Claude Code then thinks at its default effort.
16
+ * disabled, and Claude Code then thinks at its default effort; Haiku, which
17
+ * Claude Code otherwise starts thinking, does not think with it. A model known
18
+ * to have no effort levels (`levels: []`, Haiku) is sent no other level, so it
19
+ * is not started on adaptive thinking at an effort it has no control for; a
20
+ * model whose levels are unknown (`undefined`) is sent the level as asked.
17
21
  */
18
22
  export declare function fitClaudeThinking(level: ThinkingLevel | undefined, levels: readonly ThinkingLevel[] | undefined): {
19
23
  send?: ThinkingLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAa5F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,GAC1C;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;IAAC,OAAO,CAAC,EAAE,aAAa,CAAA;CAAE,CAKnD;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAC,EACzF,SAAS,EAAE,eAAe,EAC1B,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,EAAE,CAAC,CAqB5B"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAa5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,GAC1C;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;IAAC,OAAO,CAAC,EAAE,aAAa,CAAA;CAAE,CAMnD;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAC,EACzF,SAAS,EAAE,eAAe,EAC1B,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,EAAE,CAAC,CAqB5B"}
@@ -77,6 +77,14 @@ export interface ClaudeCodeAgentOptions {
77
77
  credentials?: CredentialSource;
78
78
  /** Idle time before an unused session's subprocess is shut down (default 5 minutes). */
79
79
  idleTimeoutMs?: number;
80
+ /**
81
+ * How long a cancel waits for Claude to acknowledge its interrupt before
82
+ * it answers `confirmed: false` (`CANCEL_CONFIRM_MS`, 2 s, by default),
83
+ * and how long a turn the runtime stopped reading has to end before its
84
+ * process is replaced. An interrupt Claude never acknowledges leaves the
85
+ * process and the turn running (LLP 0016, decision 11).
86
+ */
87
+ cancelConfirmMs?: number;
80
88
  /**
81
89
  * In-process MCP servers to attach to every session (the SDK's
82
90
  * `createSdkMcpServer` output). Called once per session spawn. Operator
@@ -131,9 +139,9 @@ export interface ClaudeCodeAgentOptions {
131
139
  inheritConfig?: InheritConfig;
132
140
  }
133
141
  /** Embed-tier extras threaded from ClaudeCodeAgentOptions into each session. */
134
- export type ClaudeSessionExtras = Pick<ClaudeCodeAgentOptions, "sdkMcpServers" | "toolPolicy" | "hooks" | "sdkOptions" | "processes">;
142
+ export type ClaudeSessionExtras = Pick<ClaudeCodeAgentOptions, "sdkMcpServers" | "toolPolicy" | "hooks" | "sdkOptions" | "processes" | "onDiagnostic">;
135
143
  /** What every session of an agent runs with: fixed when the agent is made. */
136
- export type ClaudeSessionSettings = ClaudeSessionExtras & Pick<ClaudeCodeAgentOptions, "idleTimeoutMs"> & {
144
+ export type ClaudeSessionSettings = ClaudeSessionExtras & Pick<ClaudeCodeAgentOptions, "idleTimeoutMs" | "cancelConfirmMs"> & {
137
145
  /** The agent's: where its sessions' `claude` processes start. */
138
146
  processes: NativeProcesses;
139
147
  };
@@ -153,8 +161,6 @@ export type ClaudeSessionConfig = Pick<AgentExecuteOptions, "cwd" | "additionalD
153
161
  * not keep a turn's abort signal or callbacks.
154
162
  */
155
163
  export declare function claudeSessionConfig(options: AgentExecuteOptions, cliPath: string | undefined, inheritConfig?: InheritConfig): ClaudeSessionConfig;
156
- /** How many model turns a query may take unless the turn says otherwise. */
157
- export declare const DEFAULT_MAX_TURNS = 100;
158
164
  /**
159
165
  * Everything a Claude process is started with that it cannot change while it
160
166
  * runs. A turn whose key differs from its session's needs a new process, which
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,OAAO,IAAI,SAAS,EACpB,8BAA8B,EAC9B,gBAAgB,EAChB,gBAAgB,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK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AO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,aAAa,CAAC,EAAE,aAAa,GAC3B,mBAAmB,CAsBrB;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAyBlE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAgBjG;AAED,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAe1F;AA2CD,wGAAwG;AACxG,wBAAgB,SAAS,CACxB,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,GAAG,eAAe,CAAC,GACxD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAEpC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,EAC/C,aAAa,CAAC,EAAE,aAAa,EAC7B,SAAS,CAAC,EAAE,wBAAwB,EACpC,KAAK,CAAC,EAAE,WAAW,GACjB,SAAS,CA6EX"}
@@ -1,8 +1,6 @@
1
1
  import type { SDKRateLimitInfo, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
2
- import { type ErrorCategory, type StopReason } from "../../../protocol/index.ts";
2
+ import { type ErrorCategory } from "../../../protocol/index.ts";
3
3
  import type { AdapterEvent, TransformResult } from "../types.ts";
4
- /** Map Anthropic stop reasons / result subtypes onto the normalized enum. */
5
- export declare function mapClaudeStopReason(stopReason: string | null | undefined, subtype: string | undefined): StopReason | undefined;
6
4
  /**
7
5
  * Claude's typed API failure codes, and HTTP statuses, as engine error
8
6
  * categories. A code or status this build does not know returns `undefined`,
@@ -12,8 +10,6 @@ export declare function mapClaudeStopReason(stopReason: string | null | undefine
12
10
  export declare function claudeErrorCategory(code: string | undefined, status?: number | null): ErrorCategory | undefined;
13
11
  /** A window used up, and no extra usage (overage) answering in its place. */
14
12
  export declare function planUsedUp(info: SDKRateLimitInfo): boolean;
15
- /** A `rate_limit_event`: one window of the claude.ai plan (`resetsAt` is in seconds). */
16
- export declare function claudeLimits(info: SDKRateLimitInfo | undefined): AdapterEvent[];
17
13
  /**
18
14
  * How a Claude turn ended, from its results: its stop reason, its failure and
19
15
  * that failure's category, and whether an interrupt stopped it. A turn runs
@@ -25,6 +21,8 @@ export declare class ClaudeTurnOutcome {
25
21
  private error?;
26
22
  /** The typed code of the last failed API request the turn reported. */
27
23
  private errorCode?;
24
+ /** The HTTP status of the API failure its result reported (`api_error_status`). */
25
+ private errorStatus?;
28
26
  /** Plan windows Claude reports used up, with no extra usage serving requests. */
29
27
  private readonly usedUpWindows;
30
28
  private interrupted;
@@ -1 +1 @@
1
- {"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAiB,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,OAAO,EAAE,MAAM,GAAG,SAAS,GACzB,UAAU,GAAG,SAAS,CAexB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,aAAa,GAAG,SAAS,CAyB3B;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,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O,CAAC,aAAa;CAerB"}
@@ -0,0 +1,16 @@
1
+ import type { ToolLocation, ToolResultContent } from "../../../protocol/index.ts";
2
+ /** What a finished Claude tool shows beyond its text: diffs, their places, an exit code. */
3
+ export interface ClaudeResultView {
4
+ content?: ToolResultContent[];
5
+ locations?: ToolLocation[];
6
+ metadata?: Record<string, unknown>;
7
+ }
8
+ /**
9
+ * What a Claude tool's result shows, read from the CLI's structured result
10
+ * (`tool_use_result` on its `user` message) and, for a failed command, its
11
+ * text. A failure shows no diff. A command that succeeded carries no exit
12
+ * code: the CLI reports none, and counts some non-zero exits as success
13
+ * (`grep` finding nothing).
14
+ */
15
+ export declare function claudeResultView(toolName: string, structured: unknown, output: string, isError: boolean): ClaudeResultView;
16
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/results.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIlF,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAChC,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AA0BD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GACd,gBAAgB,CAyBlB"}
@@ -0,0 +1,13 @@
1
+ import { type DiagnosticHandler } from "../../diagnostics.ts";
2
+ /**
3
+ * Say, once per OS process for each pair, that the Claude SDK that loaded and
4
+ * the CLI build it drives are different releases: a package manager let
5
+ * another SDK in (bun says nothing of an exact peer), or the CLI came from a
6
+ * pin the SDK did not follow. Call it right after `query()`: the SDK names
7
+ * itself there, in `process.env.CLAUDE_AGENT_SDK_VERSION`, from a literal in
8
+ * its own code, so a bundle names it too and no file is read for it. A
9
+ * warning, through `onDiagnostic` and the log; it never fails a turn, and an
10
+ * SDK or a CLI that cannot be named is not compared.
11
+ */
12
+ export declare function notePairedReleases(cliPath: string | undefined, onDiagnostic: DiagnosticHandler | undefined, sessionId: string): void;
13
+ //# sourceMappingURL=sdk-pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-pair.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/sdk-pair.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,sBAAsB,CAAC;AA8B9E;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,YAAY,EAAE,iBAAiB,GAAG,SAAS,EAC3C,SAAS,EAAE,MAAM,GACf,IAAI,CAmBN"}
@@ -1,13 +1,19 @@
1
1
  import type { McpSetServersResult, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
2
2
  import type { McpServerConfig, PermissionMode } from "../../../protocol/index.ts";
3
+ import { type PooledClient, type PooledProcess, type ProcessEndReason, ProcessPool } from "../process-pool.ts";
3
4
  import { ClaudeMcpConnections } from "./mcp.ts";
4
- import { type ClaudeSessionConfig, type ClaudeSessionEndReason, type ClaudeSessionSettings } from "./options.ts";
5
+ import { type ClaudeCodeAgentOptions, type ClaudeSessionConfig, type ClaudeSessionEndReason, type ClaudeSessionSettings } from "./options.ts";
5
6
  import { ClaudeSpend } from "./spend.ts";
6
7
  import { ClaudeTurn, type ClaudeTurnStart } from "./turn.ts";
7
8
  type SessionState = "starting" | "idle" | "busy" | "terminated";
8
9
  type ClaudeContent = SDKUserMessage["message"]["content"];
9
- /** How long Claude has to confirm an interrupt before the turn counts as still running. */
10
- export declare const INTERRUPT_TIMEOUT_MS = 2000;
10
+ /** What a session asks of the pool that holds it. */
11
+ interface ClaudeSessionPooling {
12
+ /** A host resume came since its process began to start (`startedBeforeResume`). */
13
+ hostResumed(): boolean;
14
+ /** Claude answered a query of its own between turns: the idle wait starts again. */
15
+ betweenTurns(): void;
16
+ }
11
17
  /**
12
18
  * Wraps one long-lived Claude `query()` call. The prompt input is an AsyncQueue
13
19
  * that stays open across turns, so the same subprocess (and its context) is
@@ -15,12 +21,15 @@ export declare const INTERRUPT_TIMEOUT_MS = 2000;
15
21
  * of the session (`observe`) and hands it to the running turn (`route`); the
16
22
  * `result` answering the turn ends it.
17
23
  *
18
- * Lifecycle: starting → idle ⇄ busy → terminated.
24
+ * Lifecycle: starting → idle ⇄ busy → terminated. To the process pool it is
25
+ * both the process and its client: `closed` once its end began, from any
26
+ * state; `close` ends it whatever it is doing, a running turn with it.
19
27
  */
20
- export declare class ClaudeSession {
28
+ export declare class ClaudeSession implements PooledProcess, PooledClient {
21
29
  readonly id: string;
22
30
  private readonly settings;
23
31
  private readonly onTerminated?;
32
+ private readonly pooling?;
24
33
  private state;
25
34
  /** What the session runs with; its MCP servers are `mcp`'s. */
26
35
  private config;
@@ -48,12 +57,19 @@ export declare class ClaudeSession {
48
57
  * changes, so a turn after a used-up window starts from that report.
49
58
  */
50
59
  private readonly planWindows;
51
- private idleTimer?;
52
60
  /** The `claude` process the engine started for it; none under an operator's spawner. */
53
61
  private native?;
54
62
  /** Its end, once it began: settles when its process is stopped. */
55
63
  private ending?;
56
- constructor(id: string, config: ClaudeSessionConfig, settings: ClaudeSessionSettings, onTerminated?: ((reason: ClaudeSessionEndReason) => void) | undefined);
64
+ private readonly closeHandlers;
65
+ constructor(id: string, config: ClaudeSessionConfig, settings: ClaudeSessionSettings, onTerminated?: ((reason: ClaudeSessionEndReason) => void) | undefined, pooling?: ClaudeSessionPooling | undefined);
66
+ /** The pool's process is its own client. */
67
+ get client(): this;
68
+ get closed(): boolean;
69
+ close(reason?: ProcessEndReason): void;
70
+ onClose(handler: () => void): () => void;
71
+ /** Settles once its process is stopped and its end reported. */
72
+ gone(): Promise<void>;
57
73
  get currentState(): SessionState;
58
74
  get currentSessionId(): string | null;
59
75
  get currentConfig(): Readonly<Omit<ClaudeSessionConfig, "mcpServers">>;
@@ -72,8 +88,15 @@ export declare class ClaudeSession {
72
88
  * the host's own tools. A text-only session stays tool-free.
73
89
  */
74
90
  setMcpServers(servers: Record<string, McpServerConfig>): Promise<McpSetServersResult | undefined>;
75
- /** Host suspension: the next turn resumes the saved conversation in a new process. */
76
- invalidateMcpConnections(): void;
91
+ /**
92
+ * Switch what the live process can switch for the turn: its model, its
93
+ * permission mode, its MCP servers. All else is in its spawn key, so this
94
+ * never asks for a new process. The SDK gives these control requests no
95
+ * deadline: the turn's cancel (`signal`) ends the wait for each, and the
96
+ * process, since what it applied is not known; the session's next turn
97
+ * resumes the conversation on a new one.
98
+ */
99
+ applyLiveChange(next: ClaudeSessionConfig, signal: AbortSignal): Promise<boolean>;
77
100
  start(): Promise<void>;
78
101
  /**
79
102
  * Send a turn's prompt: the turn's events stream until its result. One turn
@@ -92,6 +115,8 @@ export declare class ClaudeSession {
92
115
  private rejectedWindowReports;
93
116
  /** A uuid-stamped user message: Claude names it when it replays or consumes it. */
94
117
  private userMessage;
118
+ /** How long Claude has to confirm an interrupt before the turn counts as still running. */
119
+ private get confirmMs();
95
120
  /**
96
121
  * Stop the in-flight turn without killing the session. Returns whether the
97
122
  * interrupt was CONFIRMED: true when there was nothing to interrupt or the
@@ -126,7 +151,7 @@ export declare class ClaudeSession {
126
151
  /**
127
152
  * End the session: close its query, and stop its process with its tool
128
153
  * sessions and MCP servers. Settles once they are gone (at most the grace);
129
- * every call shares that end.
154
+ * every call shares that end, and the first one's reason is reported.
130
155
  */
131
156
  terminate(reason?: ClaudeSessionEndReason): Promise<void>;
132
157
  private end;
@@ -141,8 +166,21 @@ export declare class ClaudeSession {
141
166
  */
142
167
  private settleUnshown;
143
168
  private endTurn;
144
- private resetIdleTimer;
145
- private clearIdleTimer;
146
169
  }
170
+ /** What a turn brings to the pool. `spawn` notes on it whether its process is new. */
171
+ export interface ClaudePoolTurn {
172
+ sessionId: string;
173
+ config: ClaudeSessionConfig;
174
+ /** The turn's process was started for it: a resume it asks for is not confirmed yet. */
175
+ spawned?: boolean;
176
+ }
177
+ /** Each logical session's Claude process, on the pool every harness runs on. */
178
+ export type ClaudeSessionPool = ProcessPool<ClaudeSession, ClaudePoolTurn>;
179
+ /**
180
+ * An agent's Claude sessions. Claude decides of a warm process only whether
181
+ * its spawn key is the turn's and what it switches live; the pool decides
182
+ * the rest (LLP 0001, D10).
183
+ */
184
+ export declare function claudeSessionPool(settings: ClaudeSessionSettings & Pick<ClaudeCodeAgentOptions, "onSessionEnd">): ClaudeSessionPool;
147
185
  export {};
148
186
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,mBAAmB,EAMnB,cAAc,EACd,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAK1B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAE7D,KAAK,YAAY,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAChE,KAAK,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;AAE1D,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAY1C;;;;;;;;GAQG;AACH,qBAAa,aAAa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AM7D,SAAS;IAcvB;;;;;;;OAOG;YACW,eAAe;IAc7B,oEAAoE;YACtD,YAAY;IAe1B;;;;OAIG;IACH,SAAS,CAAC,MAAM,GAAE,sBAAmC,GAAG,OAAO,CAAC,IAAI,CAAC;YAUvD,GAAG;YA0BH,aAAa;IAkB3B,oGAAoG;IACpG,OAAO,CAAC,OAAO;IA2Bf,iFAAiF;IACjF,OAAO,CAAC,KAAK;IAgCb;;;OAGG;IACH,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,OAAO;CAKf;AAED,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,GAC5E,iBAAiB,CAiDnB"}
@@ -5,7 +5,7 @@ import type { TokenUsage } from "../../../protocol/index.ts";
5
5
  * in `modelUsage`: every call through its query pipeline, sub-agents and
6
6
  * compaction included, where a result's `usage` counts only the main loop.
7
7
  */
8
- export interface ClaudeUsageTotals {
8
+ interface ClaudeUsageTotals {
9
9
  input: number;
10
10
  output: number;
11
11
  cacheRead: number;
@@ -55,4 +55,5 @@ export declare class ClaudeSpend {
55
55
  */
56
56
  charge(result: SDKResultMessage): ClaudeQuerySpend;
57
57
  }
58
+ export {};
58
59
  //# sourceMappingURL=spend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spend.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/spend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC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Y,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAKzC,qFAAqF;IACrF,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB;CASlD"}
@@ -1,4 +1,27 @@
1
- import type { ToolLocation, ToolMeta } from "../../../protocol/index.ts";
2
- export declare function toolLocationsFromInput(input: Record<string, unknown>): ToolLocation[] | undefined;
3
- export declare function claudeToolMeta(toolName: string, input?: Record<string, unknown>): ToolMeta;
1
+ import type { McpTool, ToolKind, ToolMeta } from "../../../protocol/index.ts";
2
+ /**
3
+ * Maps Claude Code's tool names onto the normalized ToolKind taxonomy and
4
+ * extracts touched file locations from tool inputs. Pure best-effort: unknown
5
+ * tools are `other` and produce no locations.
6
+ */
7
+ /**
8
+ * Each Claude tool's kind, decided on what the tool does. A map, not an
9
+ * object: a tool named `constructor` is no object member's kind. The free
10
+ * live check (`claude-tool-kinds.live.test.ts`) fails on a tool the pinned
11
+ * CLI offers that is not here, so a pin bump decides it.
12
+ */
13
+ export declare const CLAUDE_TOOL_KINDS: ReadonlyMap<string, ToolKind>;
14
+ /**
15
+ * The server and tool of a Claude MCP tool name, `mcp__<server>__<tool>`. A
16
+ * server's name may hold `__` itself, so the longest name the session
17
+ * attached that fits wins; with none, the name splits at its first `__`.
18
+ * Undefined for a name that is no MCP tool.
19
+ */
20
+ export declare function claudeMcpTool(toolName: string, servers?: Iterable<string>): McpTool | undefined;
21
+ /**
22
+ * A Claude tool's kind and touched files, a `Bash` call's command and a
23
+ * `WebFetch` call's address; for an MCP tool, its server and tool among
24
+ * `servers`.
25
+ */
26
+ export declare function claudeToolMeta(toolName: string, input?: Record<string, unknown>, servers?: Iterable<string>): ToolMeta;
4
27
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAiCnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,SAAS,CAMjG;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAK1F"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAgB,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE5F;;;;GAIG;AAGH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAiD1D,CAAC;AA2BH;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAM,GAC5B,OAAO,GAAG,SAAS,CAarB;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,GACxB,QAAQ,CAWV"}
@@ -4,8 +4,8 @@ import type { AdapterEvent, EventTransformer, TransformResult } from "../types.t
4
4
  * Parses `codex app-server` v2 notifications into AdapterEvents. This harness
5
5
  * streams token-level deltas (item/agentMessage/delta, item/reasoning/*Delta),
6
6
  * so no diffing is needed. Items carry camelCase fields. Tool-like items
7
- * (commandExecution/fileChange/mcpToolCall/webSearch) become tool parts that
8
- * complete on item/completed.
7
+ * (commandExecution/fileChange/mcpToolCall/webSearch/imageGeneration) become
8
+ * tool parts that complete on item/completed.
9
9
  */
10
10
  export declare class CodexAppServerTransformer implements EventTransformer<unknown> {
11
11
  private readonly ctx;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,aAAa,EAiBlB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyCnF;;;;;;GAMG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB,CAAC,OAAO,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+C;IACrE,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAE9D,OAAO,CAAC,KAAK,CAA0C;IACvD,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,kEAAkE;IAClE,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,oFAAoF;IACpF,OAAO,CAAC,WAAW,CAAS;gBAEhB,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAItC,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,EAAE;IAMrC,MAAM,IAAI,eAAe;IAYzB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,YAAY;IAuFpB,OAAO,CAAC,QAAQ;IA+BhB,OAAO,CAAC,YAAY;IA0C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