@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
package/docs/consuming.md CHANGED
@@ -3,6 +3,9 @@
3
3
  The integration recipe, written down once — every rule here was re-derived
4
4
  independently by at least one real consumer before it landed in this file.
5
5
 
6
+ Short on time? Read [What products got wrong](#what-products-got-wrong-so-you-need-not)
7
+ first: each line is a mistake a real integration made, and what to do instead.
8
+
6
9
  ## Fold events with the shipped reducer
7
10
 
8
11
  Do not hand-roll a `switch (event.type)` state fold. The package ships the
@@ -65,6 +68,15 @@ The reducer encodes the rules consumers get wrong first:
65
68
  the mode it asks for: `state.permissionMode` holds the current one (the
66
69
  turn's, then the agent's switch), so send that mode next to stay with the
67
70
  agent.
71
+ - **Draw a tool call from its fields, not its input.** A tool part and a
72
+ request's `toolCall` say what the call acts on: `command` (the line as the
73
+ agent wrote it, never Codex's `/bin/zsh -lc` wrapper), `url`, and
74
+ `locations` (each hunk's start `line` once an edit is done); a request's
75
+ `reason` says why it asks, and its `title` is only a label. A result's
76
+ `content` holds its `diff` entries and `state.metadata.exitCode` a
77
+ command's exit code, failed or not, where the harness reports them.
78
+ `rawInput` and `state.input` stay each harness's own keys
79
+ (`docs/harnesses.md`, What a tool call says, per harness).
68
80
  - **Say why where the harness hears it.** A refused tool call's `message`
69
81
  reaches the agent when `initialize().harnesses[h].rejectionMessages` is
70
82
  true (Claude). Codex's refusal is a bare verdict and an ACP agent's an
@@ -100,7 +112,8 @@ The reducer encodes the rules consumers get wrong first:
100
112
  that changed (`five_hour`, `seven_day`, … with `usedPercent` and
101
113
  `resetsAt`); `state.limits` merges them by id. A recoverable `error` with
102
114
  `retry` means the harness is waiting to try again — show it, don't fail the
103
- turn.
115
+ turn. It reports a retry under way: its `category` is the failing call's,
116
+ not the turn's outcome, so show the attempt and the message, not "auth".
104
117
 
105
118
  Branch on the outcome with `isCleanStop` / `isFailureStopReason` rather than
106
119
  your own list: `cancelled` is clean (the user asked for the stop), `error` is
@@ -257,12 +270,18 @@ A harness's first turn on a machine without its CLI downloads it, about
257
270
  ```ts
258
271
  client.onCliProgress(({ harness, phase, receivedBytes, totalBytes }) => progressBar(harness, phase, receivedBytes, totalBytes));
259
272
  const [claude] = await client.prepareClis(["claude-code"]);
260
- if (claude?.state === "failed") showRetry(claude.error); // e.g. offline
273
+ if (claude?.state === "failed") showRetry(claude.error, claude.category); // "network": offline, ask again later
261
274
  ```
262
275
 
263
276
  `listClis()` says where each CLI is without installing (`ready`, `missing`,
264
- `installing`, `failed`, `unmanaged`); every connection hears `clis/progress`,
265
- whoever caused the install. `prepareClis()` waits on those, since the server
277
+ `installing`, `failed`, `unmanaged`; a `failed` one's `category` says what
278
+ failed, as a turn's error does); every connection hears `clis/progress`,
279
+ whoever caused the install. A read installs nothing: until a harness's CLI is
280
+ there, `authStatus()` answers it `unknown` with no `methods` and
281
+ `listModels()` the catalog, each with an `error` saying the CLI is not
282
+ installed yet, being installed, or failed to install; read again once
283
+ `clis/progress` says `ready` (the first model list after it is live). What
284
+ installs is an act: a turn, `prepareClis()`, `login()` and `logout()`. `prepareClis()` waits on those, since the server
266
285
  answers `clis/prepare` at once; its `signal` stops the waiting, not the
267
286
  install. In-process, `runtime.prepareClis()`, `runtime.listClis()` and
268
287
  `runtime.onCliProgress()` do the same. A product that bundles the Claude SDK
@@ -318,8 +337,12 @@ environment wins over the login; say so. Every connection hears
318
337
  it, and a status read notices a login made in a terminal. After a change,
319
338
  each session's next turn starts a new CLI, resuming its conversation. A turn
320
339
  that fails for its credential ends with `error.category: "auth"`: send the
321
- user to the login. A login handle that loses its connection settles at once:
322
- read the status again. Status reports the
340
+ user to the login. A login under way is `auth.loginUnderWay` (what
341
+ `client.login` answered: `loginId`, `url`, `codeUrl`, `userCode`,
342
+ `expiresAt`) in every status read and every `auth/updated`, which tells it as
343
+ it starts too, so a second window shows the same sign-in page and can cancel
344
+ it (`auth/cancel`). A login handle that loses its connection settles at once:
345
+ read the status again, which says whether the login still goes on. Status reports the
323
346
  CLI's own login and environment: a turn that brings its own `apiKey`, or runs
324
347
  on a credential the product holds (`credentials`), runs with that instead. In-process, `runtime.authStatus()`, `runtime.login()`,
325
348
  `runtime.completeLogin()`, `runtime.cancelLogin()`, `runtime.logout()` and
@@ -391,12 +414,15 @@ Fill a model picker from the harness's own list rather than a hard-coded one:
391
414
 
392
415
  ```ts
393
416
  const { models, source, error } = await client.listModels({ harness: "codex-app-server", cwd });
394
- // source: "catalog" + error = the CLI did not answer (e.g. logged out); offer a login.
417
+ // source: "catalog" + error = the CLI did not answer (e.g. logged out; offer a login)
418
+ // or is not installed yet (prepareClis, then list again).
395
419
  const choice = models.find((m) => m.isDefault) ?? models[0];
396
420
  const level = savedLevelFor(choice.id) ?? choice.thinking.default; // never invent one
397
421
  ```
398
422
 
399
- `thinking.levels` empty means the model has no thinking control. Keep the
423
+ `thinking.levels` empty means the model has no thinking control: a turn
424
+ that names a level for it runs without one (`off` is still sent on Claude),
425
+ and reports no `appliedThinkingLevel`. Keep the
400
426
  user's level per model, and use `clampThinkingLevel(level, model.thinking.levels)`
401
427
  only for a model the user has not set. Pass `refresh: true` after a login;
402
428
  lists are cached ten minutes.
@@ -413,6 +439,16 @@ model it rerouted to, after a reroute), and the requested `model` only where
413
439
  a harness names none. List models with the `cwd` (and credentials) your turns use: an alias
414
440
  such as `opus` is fitted only from its own login's list.
415
441
 
442
+ A setting a harness does not apply is said, not dropped in silence. Read
443
+ `capabilities.ignoredSettings` (from `initialize`) up front: the `RunConfig`
444
+ fields that harness never applies (`maxTurns` and `resumeSessionAt` on
445
+ Codex). Each turn names the ones it set in `turn.started.execution.notApplied`,
446
+ and `turn.ended.execution.notApplied` adds those the harness found it could
447
+ not apply as it ran (a model with no thinking control, an ACP agent that
448
+ takes no extra directories); the reducer keeps it on the turn. A product's own
449
+ "not on this harness" checks can go. `docs/harnesses.md`, "What each harness
450
+ does with each turn setting", has every field.
451
+
416
452
  ## Persist for resume
417
453
 
418
454
  Store `state.nativeSessionId` (from `session.created`) keyed by your logical
@@ -514,6 +550,18 @@ the turn ends. A command whose stop could not be confirmed is not closed as
514
550
  cancelled: its tool part fails with `TOOL_OUTCOME_UNKNOWN`, a failure the
515
551
  harness reports itself (no `closure`).
516
552
 
553
+ Two operator options time a cancel, each set once on `createAgentRuntime`
554
+ for every harness. `cancelConfirmMs` (2 s by default) is how long a cancel
555
+ waits for the agent to confirm it stopped before it answers `unconfirmed`;
556
+ a turn still starting is confirmed once it has ended within it.
557
+ `cancelGraceMs` is how long after a cancel the engine ends an agent that has
558
+ not stopped, and its turn then ends `cancelled`: 2 s on Codex, 10 s on
559
+ Claude and on an ACP agent. A Claude CLI that never answers its interrupt (a
560
+ hung or frozen process) is ended then, `onSessionEnd` says `replaced`, and
561
+ the session's next turn resumes the conversation on a new process. A Claude
562
+ cancel is `cancelled` when its turn ended within `cancelConfirmMs`, by the
563
+ interrupt or by that grace.
564
+
517
565
  Embedded `runtime.cancel(harness, sessionId)` cancels the session's active
518
566
  turn without a turn ID check. Prefer a per-turn `AbortSignal` when cancellation
519
567
  can arrive late; a completed turn's signal is detached before the next turn.
@@ -547,7 +595,7 @@ CLI's `--inherit-config`, choose how much (LLP 0001, D17):
547
595
  | Level | Claude Code | Codex app-server |
548
596
  | --- | --- | --- |
549
597
  | `all` (default) | every settings source (user, project, local) and the auto-memory Claude keeps for the repository, as the CLI itself does | the turn's `env.CODEX_HOME`, else the process's: the user's `~/.codex`, which the engine never writes |
550
- | `project` | the repository's settings, hooks, `.mcp.json` servers and instruction files; nothing of the user's, no auto-memory, no claude.ai connectors | the repository's `AGENTS.md` and skills, in a home of the session's own |
598
+ | `project` | the repository's settings, hooks, `.mcp.json` servers and instruction files; nothing of the user's, no auto-memory, no claude.ai connectors | the repository's `AGENTS.md` and skills, in a home of the session's own; no apps (the ChatGPT account's connectors) |
551
599
  | `none` | only the servers the host and the turn name | as `project`, without the repository's `AGENTS.md` |
552
600
 
553
601
  Choose by whose machine and whose repository it is. A desktop product that
@@ -571,9 +619,18 @@ At `project` and `none` every Codex turn needs `config.env.CODEX_HOME`, an
571
619
  existing absolute folder of the session's own: never the user's `~/.codex`,
572
620
  never another session's. A turn without one fails `invalid_request` before
573
621
  Codex starts. The engine owns that home's `mcp_servers` table, as for
574
- per-turn MCP in a home below. A fresh home has no login: hand one over with
575
- [`credentials`](harnesses.md#host-managed-codex-authentication) or the turn's
576
- `apiKey`. Codex loads the repository's skills and
622
+ per-turn MCP in a home below. A fresh home has no login: run it on the
623
+ person's own Codex login (`codexAppServer.userLogin`, below), or hand one over
624
+ with [`credentials`](harnesses.md#host-managed-codex-authentication) or the
625
+ turn's `apiKey`. Below `all` Codex's apps, the ChatGPT account's connectors,
626
+ are off in every thread, as Claude's claude.ai connectors are, and its
627
+ plugins are off in every app-server that runs in such a home
628
+ (`-c features.plugins=false`), so a fresh home stays about 4 MB where it
629
+ cloned Codex's plugin catalogue (about 85 MB); a product that wants a plugin
630
+ runs at `all` or brings it as an MCP server. A home removed and made again
631
+ under a session's warm process starts a new process on the next turn, which
632
+ resumes the thread if the home still holds it, or fails `resume_failed`.
633
+ Codex loads the repository's skills and
577
634
  `~/.agents/skills` at every level; turn one off by name in the home you
578
635
  supply (`[[skills.config]]` with `enabled = false`).
579
636
 
@@ -583,6 +640,93 @@ On Claude a `disableTools` turn runs at `none` whatever the level.
583
640
  auto-memory and the connectors. An ACP agent loads what its launch command
584
641
  says.
585
642
 
643
+ ### A product's own agent on the person's own login
644
+
645
+ A product whose agent works only through the product's own tools, on the
646
+ person's own Claude or Codex login and with none of their configuration,
647
+ runs its turns at `inheritConfig: "none"` (LLP 0017). Nothing of it comes
648
+ from the wire.
649
+
650
+ ```ts
651
+ createAgentRuntime({
652
+ inheritConfig: "none",
653
+ claudeCode: { sdkOptions: () => ({ tools: [] }), toolPolicy },
654
+ codexAppServer: {
655
+ userLogin: true,
656
+ builtInTools: { local: false, webSearch: false, imageGeneration: false },
657
+ },
658
+ });
659
+
660
+ // Each Codex turn names a home of its session's own: an existing folder you
661
+ // make for the session and keep for its resume, never ~/.codex.
662
+ await runtime.run({
663
+ sessionId,
664
+ turnId,
665
+ input,
666
+ config: { harness: "codex-app-server", cwd, mcpServers, env: { CODEX_HOME: sessionHome } },
667
+ }, sink);
668
+ ```
669
+
670
+ - **Claude** runs on the login of the person's own Claude Code (no
671
+ `CLAUDE_CONFIG_DIR`). At `none` it loads no settings source, no
672
+ settings file's, plugin's or claude.ai connector's server and no
673
+ auto-memory: only the servers you name. `sdkOptions: () => ({ tools: [] })`
674
+ takes Claude's own tools away and keeps the MCP servers; to keep a few,
675
+ list their names (`tools: ["Read", "Grep"]`, the SDK's option, passed
676
+ through). `toolPolicy` is asked only about the calls Claude itself would
677
+ ask about, so it cannot keep a tool off alone: with the policy alone, a
678
+ `Read` of a file in the turn's folder ran and the policy was asked 0 times,
679
+ with 29 of Claude's own tools offered (measured, Claude Code 2.1.288).
680
+ `disableTools` is no substitute: it drops the MCP servers too. In `default`
681
+ mode Claude asks about every MCP call, so `toolPolicy` sees each of
682
+ yours. Claude keeps each session's transcript under the person's own
683
+ `~/.claude/projects/<folder>/`, at `none` too, and it stays after
684
+ `session/close`: a resume needs it.
685
+ - **Codex** runs each turn in the home it names, which holds the session's
686
+ conversation (its transcript goes with the home) and the turn's MCP
687
+ servers and nothing of the person's: no
688
+ `config.toml`, MCP servers, hooks, profiles, `AGENTS.md` or skills of
689
+ theirs, no apps or plugins, and at `none` not the repository's `AGENTS.md`.
690
+ `userLogin` runs it on the person's own Codex login (the one `codex login`
691
+ keeps in `$CODEX_HOME`, else `~/.codex`), read from Codex before each turn
692
+ and held in the session's process's memory: nothing is copied or written
693
+ to the session's home, and Codex renews the login in the person's own home
694
+ when it needs to. A product's `credentials` and the turn's `apiKey` come
695
+ first. Signed out, the turn fails `auth` before Codex starts. Codex still
696
+ loads the repository's skills and `~/.agents/skills`.
697
+ - `builtInTools`: each of Codex's own tool groups is on unless set `false`.
698
+ `local: false` takes away the shell, `apply_patch`, `view_image` and
699
+ `write_stdin`, from the sub-agents Codex spawns too, so nothing the agent
700
+ runs reads or writes the disk;
701
+ `webSearch: false` and `imageGeneration: false` take away those. With
702
+ image generation on, a picture comes as an `image_generation` tool part
703
+ without its bytes: `metadata.savedPath`, when Codex gives one, names a file
704
+ on the engine's machine, which a client elsewhere cannot open; a client
705
+ that asks for `includeRaw` still receives Codex's own item, bytes included.
706
+ Codex still gives the model code mode's `exec`, its sub-agent tools and
707
+ its question tool, so `disableTools` stays refused.
708
+ - **Status and sign-in** are the person's own: read `auth/status` and start
709
+ `auth/login` with no `env`, since the turns run on the person's own login,
710
+ not on anything in a session's home.
711
+
712
+ Codex holds MCP tools back from the model until it searches for them, so
713
+ name your tools in the turn's `systemPromptAppend`.
714
+
715
+ Codex asks about an MCP tool call (a `permission.requested`) unless the
716
+ server marks the tool `readOnlyHint: true`, and never asks about one it
717
+ marks so: on Codex your server's annotations decide what is asked, not a
718
+ rule of yours (measured, Codex 0.160.0: a `save_note` marked read-only ran
719
+ with nothing asked; unmarked, it was asked about). Annotate your tools to
720
+ match what you want asked. To tell which of your tools a call is, read
721
+ `mcp.server` and `mcp.tool` on the tool part or the permission request's
722
+ `toolCall`, the same on both harnesses: `toolName` is each harness's own
723
+ spelling (`mcp__<server>__<tool>` on Claude, `<server>.<tool>` on Codex).
724
+ A Claude `toolPolicy`, which sees no part, gets Claude's own name and the
725
+ same `mcp` in its context. A Codex consent that cannot be linked to one
726
+ started call (none is open, or two of the tool are and neither has its
727
+ arguments) gets a `toolCallId` of its own and still names the server and the
728
+ tool its message names; one whose message names no tool carries no `mcp`.
729
+
586
730
  ## Own your session resources
587
731
 
588
732
  ### Configure MCP between turns
@@ -659,7 +803,8 @@ every Codex turn names one). An existing, absolute, session-specific
659
803
  directory, where the engine writes the turn's servers. Create it with mode
660
804
  `0700`, retain it while
661
805
  the conversation may resume, and delete it when that logical session is
662
- released. It contains conversation history and MCP credentials. Never share
806
+ released: `session/close` and `session/release` answer once the session's
807
+ processes have exited, so nothing writes to the home after the answer. It contains conversation history and MCP credentials. Never share
663
808
  it between sessions or use the operator's normal Codex home.
664
809
 
665
810
  This isolates writable MCP configuration and conversation state; it does not
@@ -674,11 +819,11 @@ can use an embedded server's external authentication instead. Without
674
819
  `--codex-home`, at `--inherit-config=all`, the CLI's Codex turns run in the
675
820
  user's own home with their `--mcp` servers in the thread's config.
676
821
  The ACP **server binding** (`createAcpAgentApp` /
677
- `agent-server --acp --harness codex-app-server`) has no per-session environment
678
- resource seam in this release. It rejects supplied Codex MCP servers explicitly
679
- at `session/new` or `session/resume`. Use the engine or standard JSON-RPC API
680
- for that combination. This limitation is separate
681
- from the engine's ACP **harness**, which forwards MCP to other ACP agents.
822
+ `agent-server --acp --harness codex-app-server`) names no home for a session,
823
+ so it runs at `all` and a client's stdio and HTTP servers ride the thread's
824
+ config, as above; it refuses an SSE server and the name `codex_apps` at
825
+ `session/new` or `session/resume`. A session that needs a home of its own
826
+ uses the engine or the JSON-RPC API.
682
827
 
683
828
  An explicitly supplied `CODEX_HOME` gives the engine ownership of that home's
684
829
  user-layer `mcp_servers` table: each turn replaces that table, including
@@ -706,9 +851,11 @@ automatically replayed.
706
851
  After thawing a VM, call `runtime.invalidateMcpConnections()` before admitting
707
852
  new turns. Drain active turns before suspending the host. This embed-tier
708
853
  lifecycle signal retains conversation state and turn-admission receipts.
709
- Before the next prompt, the Claude and Codex app-server harnesses replace
710
- retained subprocesses and strictly resume their saved conversations, using
711
- that turn's current MCP credentials before reconnecting the tools.
854
+ It ends no process: before each session's next prompt, the Claude, Codex
855
+ app-server and ACP harnesses replace the retained subprocess and strictly
856
+ resume its saved conversation, using that turn's current MCP credentials
857
+ before reconnecting the tools. An ACP agent that can neither resume nor load
858
+ keeps its process, as it holds the only copy of its conversation.
712
859
  Missing history fails with `resume_failed`; it never silently starts an empty
713
860
  conversation. Ordinary warm turns still reuse the process.
714
861
 
@@ -752,6 +899,8 @@ Treat `unknownSession` on replay as "session over", not as an error to retry.
752
899
 
753
900
  ## Let an outside agent operate your sessions
754
901
 
902
+ In this section the operator is that outside agent; elsewhere in this guide
903
+ it is whoever runs the engine (an operator option).
755
904
  `@zvada/agent-server/operator` gives a hosted assistant (ChatGPT, Claude, a
756
905
  CLI agent) the tools to operate your product's coding agents:
757
906
  `list_sessions`, `read_session`, `start_session`, `send_message`,
@@ -886,10 +1035,27 @@ line (`The tool failed: "…"`); turn your own refusals into `OperatorError`s.
886
1035
  ## Listen to the engine's diagnostics
887
1036
 
888
1037
  Pass `onDiagnostic` (registry/runtime/proxy options) and log what arrives:
889
- `interruptTimeout`, `sinkError`, `proxyUpstreamAuth`.
1038
+ `interruptTimeout`, `sinkError`, `proxyUpstreamAuth`, and `claudeSdkMismatch`:
1039
+ the Claude SDK that loaded (as it names itself when `query()` runs) and the
1040
+ CLI build it drives (its platform package's version) are different releases,
1041
+ said once per process with `detail: {sdkVersion, cliVersion, cliPath}` and on
1042
+ stderr. A package manager that lets another SDK in (bun says nothing of an
1043
+ exact peer) shows up here; the turn still runs.
890
1044
  These are the signals the engine deliberately does not fail turns over — a
891
1045
  product that doesn't surface them debugs blind.
892
1046
 
1047
+ ## Run it on Bun or Node
1048
+
1049
+ Import the package as it is, under either runtime: Bun loads its TypeScript
1050
+ sources, Node and your bundler its compiled JavaScript (`dist/`), and your
1051
+ `tsc` its declarations, so you need no loader, `allowImportingTsExtensions`
1052
+ or transpiling of its sources. Two things are Bun's alone: `listen` (under
1053
+ Node, serve over stdio, `dial`, or your own WebSocket server's sockets
1054
+ through `channelTransport` and `server.attach`) and `./sync/sqlite` (under
1055
+ Node, `./sync/node-sqlite`). The bin under Node is
1056
+ `node node_modules/@zvada/agent-server/dist/server/bin.js`
1057
+ ([deploy](deploy.md#on-node)).
1058
+
893
1059
  ## Wire transports
894
1060
 
895
1061
  `spawn` (stdio subprocess), `connect` (dial a `--listen` server; reconnects
@@ -909,7 +1075,13 @@ open parts, then its frames live; omitted, from the head) until
909
1075
  `unsubscribe`, which ends the watch (a turn of this client's there is still
910
1076
  followed to its end); `subscribeAll()` is for observers: every session, live
911
1077
  from then, with no history (`session/subscribeAll` on the wire; `unsubscribeAll()`
912
- is `session/unsubscribeAll`). `joinTurn(sessionId, {fromSeq})` watches the
1078
+ is `session/unsubscribeAll`). The client follows every session from the
1079
+ call until `unsubscribeAll()`: a connection that drops before the answer asks
1080
+ the server it redials, and `subscribeAll()` resolves on that answer. On a
1081
+ client that redials it resolves only once a server has answered, and fails
1082
+ only when one refuses it, the redials run out (`maxReconnectAttempts`) or the
1083
+ client closes: do not await it on a start path while no engine may be up,
1084
+ since the client follows every session from the call either way. `joinTurn(sessionId, {fromSeq})` watches the
913
1085
  session and joins the turn it runs (`undefined` when none): a handle that
914
1086
  yields the kept events from `fromSeq` (default: the turn's start), then the
915
1087
  turn's open parts, then live frames through its `turn.ended`, each once,
@@ -928,7 +1100,11 @@ with what the client kept of it. A redial subscribes again to each session
928
1100
  followed, from what the client holds, the running turns' first, and so does a
929
1101
  `session/overflow`: the notice a server sends when the connection fell
930
1102
  `maxBacklogBytes` (16 MiB) behind and it stopped streaming the session; what
931
- was dropped heals by replay and the open parts. A refused re-subscription
1103
+ was dropped heals by replay and the open parts. A connection is always told
1104
+ it overflowed, or closed: `listen` keeps Bun's own `backpressureLimit` 64 MiB
1105
+ above the bound, so the notice gets through, and a socket that still refuses
1106
+ a send (one frame larger than that headroom) is closed, which a client that
1107
+ reconnects heals by its redial and replay. Over stdio nothing is dropped. A refused re-subscription
932
1108
  fails the session's turns with `EventGapError` (`onEventGap`:
933
1109
  `session_missing`, or `subscription_refused`) instead of leaving them
934
1110
  waiting. When the answer says the turn it subscribed again for runs no more
@@ -957,10 +1133,15 @@ outage instead of going quiet: `disconnected` (with the reason), `reconnecting`
957
1133
  before each redial (`attempt`, `delayMs`, and the `error` the one before
958
1134
  failed with), `reconnected` (`attempts`, `downMs`, the new `initialize`, and
959
1135
  `serverChanged` when the server no longer holds the logs this client followed:
960
- another journal, none, or a volatile restart), `refused` (`reason`:
961
- `token_refused` or `token_required`) when the server refused a redial, which every
962
- redial would get, so the client stops and fails what waits with
963
- `ConnectionRefusedError`, and `closed` (`close()`, a connection that does not
1136
+ another journal, none, or a volatile restart), `refused` when the server
1137
+ refused the client, which every redial would get, so the client stops and
1138
+ fails what waits with `ConnectionRefusedError`: `reason` `token_refused` or
1139
+ `token_required` for a redial refused its token, or `protocol_mismatch`
1140
+ (with `protocolVersion`, this client's, and `supported`, the server's) for
1141
+ any handshake with a server of another wire protocol version, whose error is
1142
+ the `ProtocolVersionMismatchError` subclass (it carries the wire error's
1143
+ `code` and `data` too): only upgrading the older of the two helps, and `closed`
1144
+ (`close()`, a connection that does not
964
1145
  redial, redialing that gave up after `maxReconnectAttempts`, default 8,
965
1146
  `Infinity` redials until `close()`, or a refusal).
966
1147
  Handlers run before requests waiting on the redial are sent again. After
@@ -1006,6 +1187,101 @@ platform it dials, never `$AGENT_SERVER_TOKEN`, which a listener's clients
1006
1187
  present).
1007
1188
  Subscriptions filter delivery; they are not an authorization boundary.
1008
1189
 
1190
+ ## Test your integration for nothing
1191
+
1192
+ The `scripted` harness plays a script instead of a model, through the same
1193
+ runtime, server and client your product uses, under its own name, so your
1194
+ own code runs unchanged and costs nothing ([the steps](harnesses.md#the-scripted-harness)).
1195
+ A `call` step calls your real MCP server; `ask: true` goes through your
1196
+ permission handling; `echo: "config"` shows what your code sent.
1197
+
1198
+ ```ts
1199
+ const runtime = createAgentRuntime({
1200
+ harnesses: ["scripted"],
1201
+ scripted: {
1202
+ turn: scriptedQueue([
1203
+ { call: { server: "notes", tool: "search_notes", arguments: { query: "garden" } } },
1204
+ { say: "Found it." },
1205
+ { end: true },
1206
+ ]),
1207
+ },
1208
+ });
1209
+ ```
1210
+
1211
+ A product that spawns the stock program, or is not written in TypeScript,
1212
+ gives it a JSONL file instead, one step per line:
1213
+ `agent-server --script turns.jsonl --listen 4747`. `apps/agent-demo` runs
1214
+ its product checks this way: `bun run agent-demo -- --harness=scripted`.
1215
+
1216
+ ## What products got wrong, so you need not
1217
+
1218
+ Each of these was found in a product built on the engine, or measured against
1219
+ the agents themselves (LLP 0015). None needs code of your own to avoid.
1220
+
1221
+ **Sessions**
1222
+
1223
+ - **Close a session when you are done with it** (`closeSession`). Until then
1224
+ the engine keeps it bound to its harness and its process warm for the idle
1225
+ time (`idleTimeoutMs`, 5 minutes by default), and an ACP agent that cannot resume is never ended for idleness. One
1226
+ product never closed any. Remove what you made for the session (a Codex
1227
+ home) after the close answers: it answers once the agent's process has
1228
+ exited.
1229
+ - **Persist the native id** from `session.created` and pass it back as
1230
+ `resumeSessionId`. A wrong one fails every later turn of that `sessionId`
1231
+ on purpose; start a new `sessionId` to start over.
1232
+ - **Read how a reopened durable session's last turn ended from `getSession`**
1233
+ (`lastTurn`: `stopReason`, and `error` with the category `server_restart`
1234
+ for a turn a restart cut off), not by replaying its history; and whether it
1235
+ still waits for `confirmSessionStopped` from `recoveryRequired`, never from
1236
+ that turn's words, which a confirmation does not change.
1237
+ - **Name a journal file from `JOURNAL_SCHEMA_VERSION`**
1238
+ ([durable sessions](durable-sessions.md)), not from a number you copied.
1239
+
1240
+ **Logins and credentials**
1241
+
1242
+ - **Sign in through the engine** (`auth/login`), not by typing a CLI command
1243
+ into a terminal. The engine learns of a login made elsewhere only at the
1244
+ next status read.
1245
+ - **Hold a credential with [`./accounts`](#hold-the-login-yourself-for-sandboxes-and-other-devices),**
1246
+ not with a copy of it. One product rewrote about 550 lines of it.
1247
+ - **Offer models from `models/list`,** not from the built-in catalog: the
1248
+ live list belongs to the login and its route.
1249
+ - **Do not check the Claude SDK's version yourself.** The engine says when the
1250
+ SDK and the CLI build differ (`claudeSdkMismatch`, above); pin the CLI with
1251
+ `provision.pins` when your bundle carries its own SDK.
1252
+
1253
+ **What the agent may do**
1254
+
1255
+ - **Limit Claude's own tools with the SDK's `tools` list,** not with a
1256
+ `toolPolicy` alone: the policy hears only what Claude asks about, and a read
1257
+ in the turn's folder is not asked ([a product's own agent](#a-products-own-agent-on-the-persons-own-login)).
1258
+ - **Do not assume a permission mode means the same on both agents.**
1259
+ `accept_edits` lets Codex run shell writes unasked, `plan` stops writes on
1260
+ neither once a call is approved, and Codex never asks before a read
1261
+ ([the table](harnesses.md#what-each-permission-mode-does-per-agent)). Under
1262
+ `bypass_permissions` your policy and your approvals never run at all.
1263
+ - **Choose what a turn inherits with `inheritConfig`,** not with raw SDK
1264
+ options: `none` for a repository you do not trust.
1265
+ - **On Codex, mark your MCP tools as what they are.** A tool marked
1266
+ `readOnlyHint` is never asked about, any other always is.
1267
+
1268
+ **Reading the stream**
1269
+
1270
+ - **Read `mcp.server` and `mcp.tool`** on a tool part or a permission request,
1271
+ not the spelling of `toolName`, which differs by agent.
1272
+ - **Read `capabilities.ignoredSettings` and `execution.notApplied`,** not a
1273
+ table of your own of what each agent supports.
1274
+ - **Read an error's `category`,** not its text. One product classified
1275
+ failures by regular expressions on a provider's words.
1276
+ - **Ask `isFailureStopReason`** whether a turn failed. `max_tokens`,
1277
+ `max_turn_requests`, `refusal` and `cancelled` are clean ends; one product
1278
+ treated everything but `end_turn` as an interruption.
1279
+ - **Test against the engine, not a stand-in of your own,** where you can: the
1280
+ free scenario (`bun run harness -- --harness=codex-app-server
1281
+ --scenario=codex-tools-off`) and `apps/agent-demo` run real CLIs. Three
1282
+ products wrote a scripted agent of their own; the engine now ships one,
1283
+ the `scripted` harness ([test your integration for nothing](#test-your-integration-for-nothing)).
1284
+
1009
1285
  ---
1010
1286
 
1011
1287
  Something here wrong, unclear or missing? [Report it to the maintainers](feedback.md).
package/docs/deploy.md CHANGED
@@ -49,8 +49,15 @@ only, and the log says so once.
49
49
 
50
50
  **A product that bundles the Claude SDK** (an ESM or single-file build of its
51
51
  own) sets `provision.pins.claude` to the SDK's version: nothing on disk says
52
- which SDK runs, so the engine runs the CLI of its own pin and logs that once.
53
- Within a compiled `agent-server` binary the pin is the SDK it bundles.
52
+ which SDK runs, so the engine runs the CLI of its own pin and logs that once,
53
+ naming the folder it looked up from. The engine looks from where its own
54
+ module (or the bundle holding it) is, under Bun, Node's ESM (tsx, an ESM
55
+ bundle) and CJS alike, never from the working folder. Within a compiled
56
+ `agent-server` binary the pin is the SDK it bundles. When the SDK that
57
+ loaded and the CLI build it drives are different releases, the engine says
58
+ so once, on stderr and as the `claudeSdkMismatch` diagnostic
59
+ ([consuming.md](consuming.md#listen-to-the-engines-diagnostics)); the turn
60
+ still runs.
54
61
 
55
62
  Pins live in `src/core/provision/pins.ts`: the claude pin tracks the
56
63
  lockfile's `@anthropic-ai/claude-agent-sdk` version (test-enforced); the codex
@@ -62,9 +69,18 @@ test-enforced).
62
69
  image layers and shared volumes dedupe naturally. Processes that cold-start
63
70
  together on one cache each download, and the build's atomic rename leaves one
64
71
  copy (four at once took 15.8 s instead of 4.9 s): bake the CLIs into the
65
- image instead. A request that gets no response within 30 s (headers or
66
- body), a download that receives nothing for 30 s, or a `tar` still running
67
- after 5 min fails rather than holding a turn. Each use of a build is
72
+ image instead. A download that is cut (a reset connection, nothing
73
+ received for 30 s, or an end short of its stated size) goes on from the
74
+ bytes it has with an HTTP `Range` request, or starts over where the server
75
+ does not honour one; it gives up after five attempts in a row that get no
76
+ further into the file (25 in all), as a `network` failure saying how far it
77
+ got ("the transfer ended after 10485760 of 100276474 bytes"). The checksum is
78
+ checked once, over the whole file, so "Integrity mismatch" is said only of a
79
+ file that arrived whole (one put together from several responses is first
80
+ downloaded once more in one piece), and a build whose checksum is wrong is
81
+ never installed. The registry metadata is asked up to three times, waiting
82
+ 30 s, 60 s, then 90 s for its answer (headers and body); a `tar` still
83
+ running after 5 min fails rather than holding a turn. Each use of a build is
68
84
  recorded (again hourly while a process keeps resolving it), and after each
69
85
  download builds whose recorded use is 14 days old are removed: several
70
86
  products may share one cache, each keeping its own pins by using them.
@@ -102,7 +118,12 @@ await client.listClis(); // ready | missing | installing | failed | unmanaged, i
102
118
  ```
103
119
 
104
120
  `prepareClis` joins an install already running and answers once each CLI is
105
- ready or failed (`error` says why); it never throws for a failed install.
121
+ ready or failed (`error` says why, and `category` what failed, from the
122
+ error vocabulary: `network` for a registry that cannot be reached or answers
123
+ 5xx and for a transfer that was cut, so ask again later; `internal` for a
124
+ build whose checksum is wrong; `invalid_request` for an override that points
125
+ nowhere); it never throws for a failed install. A turn that fails on the
126
+ install carries the same category.
106
127
  Over the wire, `clis/prepare` answers at once (`installing`), since an
107
128
  install outlasts a request's timeout, and the client waits on `clis/progress`
108
129
  and `clis/list`. `missing` without a `version` means the server installs
@@ -111,6 +132,34 @@ in a turn's error as in `clis/*`, carry URLs without their credentials or
111
132
  query. The CLI says a download's start,
112
133
  its quarters and its end, and `/info` shows the session harness's CLI.
113
134
 
135
+ ## On Node
136
+
137
+ The package runs on Node as well as Bun. Under Bun each export loads its
138
+ TypeScript source (the `bun` export condition); under Node, and in a
139
+ bundler that does not target Bun, its compiled JavaScript in `dist/`
140
+ (`default`). Tested from the packed tarball on Node 22.16, 22.23 and 24.21
141
+ and Bun 1.3.6 (`test/package/runtime.test.ts`). What differs on Node:
142
+
143
+ - **The bin.** `bin` stays the Bun one (`src/server/bin.ts`). Under Node:
144
+ `node node_modules/@zvada/agent-server/dist/server/bin.js`, with the same
145
+ flags.
146
+ - **`--listen` and `listen` need Bun** (`Bun.serve`): under Node the bin
147
+ refuses `--listen` before it starts, and `listen` throws an error that
148
+ says what works there. Serve over `--stdio` (`stdioTransport`), `--dial`
149
+ (`dial`), or attach each socket of a WebSocket server of your own
150
+ (`channelTransport`, then `server.attach`).
151
+ - **The journal.** `--journal` opens `node:sqlite` under Node (Node >= 22.16;
152
+ Node 22 warns once that it is experimental) and `bun:sqlite` under Bun. In
153
+ code, `./sync/node-sqlite` is Node's and `./sync/sqlite` Bun's, which does
154
+ not load under Node. The Node adapter loads `node:sqlite` when a journal
155
+ opens, not on import, so a bundle holding both adapters starts on either
156
+ runtime.
157
+ - **A bundler** picks the compiled files (esbuild, tsup, Vite, and Bun's own
158
+ with `--target=node`); Bun's with `--target=bun`, as `bun build --compile`
159
+ below, picks the sources. The engine's source paths are unchanged
160
+ (`src/` stays in the package), so a build that copies or maps them keeps
161
+ working.
162
+
114
163
  ## Single binary & sandbox cold starts
115
164
 
116
165
  The server compiles to a self-contained executable — no bun, node, or
@@ -166,7 +215,10 @@ remotely with `clis/prepare`, its progress streaming back.
166
215
 
167
216
  `agent-server install` respects `--harness a,b` (only fetch what you run) and
168
217
  `$AGENT_SERVER_CACHE_DIR` (e.g. point it at a persistent volume instead of
169
- baking).
218
+ baking). It says what each version is: Claude's is the Claude SDK package's
219
+ (`claude: Claude SDK package 0.3.288 (Claude Code 2.1.288) for linux-x64
220
+ ready: …`), Codex's its CLI's. A harness it installs nothing for (an ACP
221
+ agent such as `pi`, which runs from its launch command) is said as such.
170
222
 
171
223
  Measured (2026-10-31, `debian:bookworm-slim` arm64 under Docker, from a home
172
224
  connection): `install` of both CLIs 5 s; a cold sandbox prepared over the
@@ -203,7 +255,11 @@ agent-server install --platform darwin-arm64,darwin-x64 --dir build/agent-clis
203
255
  `--dir` writes the cache's layout into a new or empty folder (or one it wrote
204
256
  before; any other is refused, as staging opens what it writes to every
205
257
  user), makes the builds it staged readable by every user, never through a
206
- symlink, and leaves out the install's records; `--harness` selects
258
+ symlink, creates the folder and the parents of it that are missing readable
259
+ and traversable by every user (0755, whatever the umask: `install --dir
260
+ /opt/app/clis` as root in an image build leaves `/opt/app` reachable by the
261
+ runtime user; a folder that was there is left as it is), and leaves out the
262
+ install's records; `--harness` selects
207
263
  as usual. Where it runs, the app names the folder: `provision.bundleDirs`
208
264
  (or `$AGENT_SERVER_BUNDLE_DIR`, a path list). A bundle folder is used in
209
265
  every mode when it holds the version this engine runs, before the host and