@zvada/agent-server 0.3.18 → 0.3.19

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 (572) hide show
  1. package/AGENTS.md +11 -26
  2. package/CHANGELOG.md +1005 -1
  3. package/README.md +35 -39
  4. package/dist/types/accounts/chatgpt.d.ts +34 -0
  5. package/dist/types/accounts/chatgpt.d.ts.map +1 -0
  6. package/dist/types/accounts/check.d.ts +24 -0
  7. package/dist/types/accounts/check.d.ts.map +1 -0
  8. package/dist/types/accounts/claude.d.ts +21 -0
  9. package/dist/types/accounts/claude.d.ts.map +1 -0
  10. package/dist/types/accounts/endpoint.d.ts +50 -0
  11. package/dist/types/accounts/endpoint.d.ts.map +1 -0
  12. package/dist/types/accounts/http.d.ts +38 -0
  13. package/dist/types/accounts/http.d.ts.map +1 -0
  14. package/dist/types/accounts/index.d.ts +6 -0
  15. package/dist/types/accounts/index.d.ts.map +1 -0
  16. package/dist/types/client/client.d.ts +272 -0
  17. package/dist/types/client/client.d.ts.map +1 -0
  18. package/dist/types/client/connection.d.ts +160 -0
  19. package/dist/types/client/connection.d.ts.map +1 -0
  20. package/dist/types/client/history.d.ts +8 -0
  21. package/dist/types/client/history.d.ts.map +1 -0
  22. package/dist/types/client/index.d.ts +5 -0
  23. package/dist/types/client/index.d.ts.map +1 -0
  24. package/dist/types/client/listeners.d.ts +8 -0
  25. package/dist/types/client/listeners.d.ts.map +1 -0
  26. package/dist/types/client/logins.d.ts +35 -0
  27. package/dist/types/client/logins.d.ts.map +1 -0
  28. package/dist/types/client/rpc.d.ts +46 -0
  29. package/dist/types/client/rpc.d.ts.map +1 -0
  30. package/dist/types/client/streams.d.ts +150 -0
  31. package/dist/types/client/streams.d.ts.map +1 -0
  32. package/dist/types/client/transports.d.ts +35 -0
  33. package/dist/types/client/transports.d.ts.map +1 -0
  34. package/dist/types/client/turns.d.ts +81 -0
  35. package/dist/types/client/turns.d.ts.map +1 -0
  36. package/dist/types/core/agents/acp/acp-agent.d.ts +68 -0
  37. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -0
  38. package/dist/types/core/agents/acp/adapter.d.ts +39 -0
  39. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -0
  40. package/dist/types/core/agents/acp/client.d.ts +90 -0
  41. package/dist/types/core/agents/acp/client.d.ts.map +1 -0
  42. package/dist/types/core/agents/acp/known-agents.d.ts +35 -0
  43. package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -0
  44. package/dist/types/core/agents/acp/mappings.d.ts +46 -0
  45. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -0
  46. package/dist/types/core/agents/acp/requests.d.ts +26 -0
  47. package/dist/types/core/agents/acp/requests.d.ts.map +1 -0
  48. package/dist/types/core/agents/attachments.d.ts +11 -0
  49. package/dist/types/core/agents/attachments.d.ts.map +1 -0
  50. package/dist/types/core/agents/base.d.ts +227 -0
  51. package/dist/types/core/agents/base.d.ts.map +1 -0
  52. package/dist/types/core/agents/claude-code/adapter.d.ts +58 -0
  53. package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -0
  54. package/dist/types/core/agents/claude-code/approvals.d.ts +26 -0
  55. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -0
  56. package/dist/types/core/agents/claude-code/claude-agent.d.ts +70 -0
  57. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -0
  58. package/dist/types/core/agents/claude-code/credentials.d.ts +54 -0
  59. package/dist/types/core/agents/claude-code/credentials.d.ts.map +1 -0
  60. package/dist/types/core/agents/claude-code/events.d.ts +42 -0
  61. package/dist/types/core/agents/claude-code/events.d.ts.map +1 -0
  62. package/dist/types/core/agents/claude-code/login.d.ts +61 -0
  63. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -0
  64. package/dist/types/core/agents/claude-code/mcp.d.ts +52 -0
  65. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -0
  66. package/dist/types/core/agents/claude-code/models.d.ts +30 -0
  67. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -0
  68. package/dist/types/core/agents/claude-code/options.d.ts +183 -0
  69. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -0
  70. package/dist/types/core/agents/claude-code/outcome.d.ts +50 -0
  71. package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -0
  72. package/dist/types/core/agents/claude-code/session-pool.d.ts +36 -0
  73. package/dist/types/core/agents/claude-code/session-pool.d.ts.map +1 -0
  74. package/dist/types/core/agents/claude-code/session.d.ts +148 -0
  75. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -0
  76. package/dist/types/core/agents/claude-code/spawn.d.ts +29 -0
  77. package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -0
  78. package/dist/types/core/agents/claude-code/spend.d.ts +58 -0
  79. package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -0
  80. package/dist/types/core/agents/claude-code/tools.d.ts +4 -0
  81. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -0
  82. package/dist/types/core/agents/claude-code/turn-usage.d.ts +52 -0
  83. package/dist/types/core/agents/claude-code/turn-usage.d.ts.map +1 -0
  84. package/dist/types/core/agents/claude-code/turn.d.ts +121 -0
  85. package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -0
  86. package/dist/types/core/agents/codex-app-server/adapter.d.ts +59 -0
  87. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -0
  88. package/dist/types/core/agents/codex-app-server/client.d.ts +116 -0
  89. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -0
  90. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +113 -0
  91. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -0
  92. package/dist/types/core/agents/codex-app-server/commands.d.ts +66 -0
  93. package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -0
  94. package/dist/types/core/agents/codex-app-server/credentials.d.ts +49 -0
  95. package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -0
  96. package/dist/types/core/agents/codex-app-server/effort.d.ts +12 -0
  97. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -0
  98. package/dist/types/core/agents/codex-app-server/events.d.ts +45 -0
  99. package/dist/types/core/agents/codex-app-server/events.d.ts.map +1 -0
  100. package/dist/types/core/agents/codex-app-server/homes.d.ts +20 -0
  101. package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -0
  102. package/dist/types/core/agents/codex-app-server/input.d.ts +26 -0
  103. package/dist/types/core/agents/codex-app-server/input.d.ts.map +1 -0
  104. package/dist/types/core/agents/codex-app-server/items.d.ts +31 -0
  105. package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -0
  106. package/dist/types/core/agents/codex-app-server/login.d.ts +38 -0
  107. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -0
  108. package/dist/types/core/agents/codex-app-server/mcp.d.ts +62 -0
  109. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -0
  110. package/dist/types/core/agents/codex-app-server/models.d.ts +67 -0
  111. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -0
  112. package/dist/types/core/agents/codex-app-server/options.d.ts +40 -0
  113. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -0
  114. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +19 -0
  115. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -0
  116. package/dist/types/core/agents/codex-app-server/protocol.d.ts +99 -0
  117. package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -0
  118. package/dist/types/core/agents/codex-app-server/requests.d.ts +42 -0
  119. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -0
  120. package/dist/types/core/agents/codex-app-server/session.d.ts +96 -0
  121. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -0
  122. package/dist/types/core/agents/codex-app-server/subagents.d.ts +53 -0
  123. package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -0
  124. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +87 -0
  125. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -0
  126. package/dist/types/core/agents/codex-app-server/turn-items.d.ts +33 -0
  127. package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -0
  128. package/dist/types/core/agents/codex-app-server/turn.d.ts +163 -0
  129. package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -0
  130. package/dist/types/core/agents/config-fingerprint.d.ts +5 -0
  131. package/dist/types/core/agents/config-fingerprint.d.ts.map +1 -0
  132. package/dist/types/core/agents/credentials.d.ts +28 -0
  133. package/dist/types/core/agents/credentials.d.ts.map +1 -0
  134. package/dist/types/core/agents/elicitation.d.ts +37 -0
  135. package/dist/types/core/agents/elicitation.d.ts.map +1 -0
  136. package/dist/types/core/agents/inherit-config.d.ts +18 -0
  137. package/dist/types/core/agents/inherit-config.d.ts.map +1 -0
  138. package/dist/types/core/agents/login.d.ts +67 -0
  139. package/dist/types/core/agents/login.d.ts.map +1 -0
  140. package/dist/types/core/agents/mcp-config.d.ts +57 -0
  141. package/dist/types/core/agents/mcp-config.d.ts.map +1 -0
  142. package/dist/types/core/agents/plan.d.ts +16 -0
  143. package/dist/types/core/agents/plan.d.ts.map +1 -0
  144. package/dist/types/core/agents/registry.d.ts +30 -0
  145. package/dist/types/core/agents/registry.d.ts.map +1 -0
  146. package/dist/types/core/agents/session-agent.d.ts +48 -0
  147. package/dist/types/core/agents/session-agent.d.ts.map +1 -0
  148. package/dist/types/core/agents/session-pool.d.ts +41 -0
  149. package/dist/types/core/agents/session-pool.d.ts.map +1 -0
  150. package/dist/types/core/agents/stderr-tail.d.ts +28 -0
  151. package/dist/types/core/agents/stderr-tail.d.ts.map +1 -0
  152. package/dist/types/core/agents/thinking-levels.d.ts +4 -0
  153. package/dist/types/core/agents/thinking-levels.d.ts.map +1 -0
  154. package/dist/types/core/agents/types.d.ts +124 -0
  155. package/dist/types/core/agents/types.d.ts.map +1 -0
  156. package/dist/types/core/diagnostics.d.ts +36 -0
  157. package/dist/types/core/diagnostics.d.ts.map +1 -0
  158. package/dist/types/core/index.d.ts +29 -0
  159. package/dist/types/core/index.d.ts.map +1 -0
  160. package/dist/types/core/presets.d.ts +80 -0
  161. package/dist/types/core/presets.d.ts.map +1 -0
  162. package/dist/types/core/processes/identity.d.ts +31 -0
  163. package/dist/types/core/processes/identity.d.ts.map +1 -0
  164. package/dist/types/core/processes/lifeline.d.ts +47 -0
  165. package/dist/types/core/processes/lifeline.d.ts.map +1 -0
  166. package/dist/types/core/processes/native-processes.d.ts +130 -0
  167. package/dist/types/core/processes/native-processes.d.ts.map +1 -0
  168. package/dist/types/core/processes/process-table.d.ts +43 -0
  169. package/dist/types/core/processes/process-table.d.ts.map +1 -0
  170. package/dist/types/core/provision/cache-trust.d.ts +13 -0
  171. package/dist/types/core/provision/cache-trust.d.ts.map +1 -0
  172. package/dist/types/core/provision/cache-usage.d.ts +14 -0
  173. package/dist/types/core/provision/cache-usage.d.ts.map +1 -0
  174. package/dist/types/core/provision/checksums.d.ts +46 -0
  175. package/dist/types/core/provision/checksums.d.ts.map +1 -0
  176. package/dist/types/core/provision/extract.d.ts +7 -0
  177. package/dist/types/core/provision/extract.d.ts.map +1 -0
  178. package/dist/types/core/provision/index.d.ts +5 -0
  179. package/dist/types/core/provision/index.d.ts.map +1 -0
  180. package/dist/types/core/provision/install-build.d.ts +36 -0
  181. package/dist/types/core/provision/install-build.d.ts.map +1 -0
  182. package/dist/types/core/provision/npm.d.ts +40 -0
  183. package/dist/types/core/provision/npm.d.ts.map +1 -0
  184. package/dist/types/core/provision/pins.d.ts +24 -0
  185. package/dist/types/core/provision/pins.d.ts.map +1 -0
  186. package/dist/types/core/provision/platform.d.ts +28 -0
  187. package/dist/types/core/provision/platform.d.ts.map +1 -0
  188. package/dist/types/core/provision/provisioner.d.ts +189 -0
  189. package/dist/types/core/provision/provisioner.d.ts.map +1 -0
  190. package/dist/types/core/provision/releases.d.ts +8 -0
  191. package/dist/types/core/provision/releases.d.ts.map +1 -0
  192. package/dist/types/core/provision/tools.d.ts +81 -0
  193. package/dist/types/core/provision/tools.d.ts.map +1 -0
  194. package/dist/types/core/proxy/anthropic-proxy.d.ts +52 -0
  195. package/dist/types/core/proxy/anthropic-proxy.d.ts.map +1 -0
  196. package/dist/types/core/proxy/api-key-store.d.ts +37 -0
  197. package/dist/types/core/proxy/api-key-store.d.ts.map +1 -0
  198. package/dist/types/core/proxy/index.d.ts +3 -0
  199. package/dist/types/core/proxy/index.d.ts.map +1 -0
  200. package/dist/types/core/proxy/loopback.d.ts +14 -0
  201. package/dist/types/core/proxy/loopback.d.ts.map +1 -0
  202. package/dist/types/core/runtime/agent-runtime.d.ts +181 -0
  203. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -0
  204. package/dist/types/core/runtime/event-processor.d.ts +87 -0
  205. package/dist/types/core/runtime/event-processor.d.ts.map +1 -0
  206. package/dist/types/core/runtime/event-sink.d.ts +44 -0
  207. package/dist/types/core/runtime/event-sink.d.ts.map +1 -0
  208. package/dist/types/core/runtime/harness-clis.d.ts +10 -0
  209. package/dist/types/core/runtime/harness-clis.d.ts.map +1 -0
  210. package/dist/types/core/runtime/harness-logins.d.ts +68 -0
  211. package/dist/types/core/runtime/harness-logins.d.ts.map +1 -0
  212. package/dist/types/core/runtime/login-reads.d.ts +28 -0
  213. package/dist/types/core/runtime/login-reads.d.ts.map +1 -0
  214. package/dist/types/core/runtime/model-lists.d.ts +37 -0
  215. package/dist/types/core/runtime/model-lists.d.ts.map +1 -0
  216. package/dist/types/core/runtime/permission-policy.d.ts +61 -0
  217. package/dist/types/core/runtime/permission-policy.d.ts.map +1 -0
  218. package/dist/types/core/runtime/request-broker.d.ts +49 -0
  219. package/dist/types/core/runtime/request-broker.d.ts.map +1 -0
  220. package/dist/types/core/runtime/steering.d.ts +38 -0
  221. package/dist/types/core/runtime/steering.d.ts.map +1 -0
  222. package/dist/types/core/runtime/turn-outcome.d.ts +21 -0
  223. package/dist/types/core/runtime/turn-outcome.d.ts.map +1 -0
  224. package/dist/types/core/runtime/turn.d.ts +121 -0
  225. package/dist/types/core/runtime/turn.d.ts.map +1 -0
  226. package/dist/types/core/utils/bounded.d.ts +6 -0
  227. package/dist/types/core/utils/bounded.d.ts.map +1 -0
  228. package/dist/types/core/utils/deadline.d.ts +14 -0
  229. package/dist/types/core/utils/deadline.d.ts.map +1 -0
  230. package/dist/types/core/utils/errors.d.ts +104 -0
  231. package/dist/types/core/utils/errors.d.ts.map +1 -0
  232. package/dist/types/core/utils/is-record.d.ts +3 -0
  233. package/dist/types/core/utils/is-record.d.ts.map +1 -0
  234. package/dist/types/core/utils/loopback.d.ts +6 -0
  235. package/dist/types/core/utils/loopback.d.ts.map +1 -0
  236. package/dist/types/index.d.ts +2 -0
  237. package/dist/types/index.d.ts.map +1 -0
  238. package/dist/types/protocol/account.d.ts +26 -0
  239. package/dist/types/protocol/account.d.ts.map +1 -0
  240. package/dist/types/protocol/async-queue.d.ts +21 -0
  241. package/dist/types/protocol/async-queue.d.ts.map +1 -0
  242. package/dist/types/protocol/auth.d.ts +228 -0
  243. package/dist/types/protocol/auth.d.ts.map +1 -0
  244. package/dist/types/protocol/canonical.d.ts +9 -0
  245. package/dist/types/protocol/canonical.d.ts.map +1 -0
  246. package/dist/types/protocol/clis.d.ts +74 -0
  247. package/dist/types/protocol/clis.d.ts.map +1 -0
  248. package/dist/types/protocol/config.d.ts +200 -0
  249. package/dist/types/protocol/config.d.ts.map +1 -0
  250. package/dist/types/protocol/conversation.d.ts +942 -0
  251. package/dist/types/protocol/conversation.d.ts.map +1 -0
  252. package/dist/types/protocol/credentials.d.ts +145 -0
  253. package/dist/types/protocol/credentials.d.ts.map +1 -0
  254. package/dist/types/protocol/errors.d.ts +36 -0
  255. package/dist/types/protocol/errors.d.ts.map +1 -0
  256. package/dist/types/protocol/execution.d.ts +28 -0
  257. package/dist/types/protocol/execution.d.ts.map +1 -0
  258. package/dist/types/protocol/factories.d.ts +94 -0
  259. package/dist/types/protocol/factories.d.ts.map +1 -0
  260. package/dist/types/protocol/guards.d.ts +55 -0
  261. package/dist/types/protocol/guards.d.ts.map +1 -0
  262. package/dist/types/protocol/harness.d.ts +70 -0
  263. package/dist/types/protocol/harness.d.ts.map +1 -0
  264. package/dist/types/protocol/history.d.ts +318 -0
  265. package/dist/types/protocol/history.d.ts.map +1 -0
  266. package/dist/types/protocol/ids.d.ts +9 -0
  267. package/dist/types/protocol/ids.d.ts.map +1 -0
  268. package/dist/types/protocol/index.d.ts +35 -0
  269. package/dist/types/protocol/index.d.ts.map +1 -0
  270. package/dist/types/protocol/lifecycle.d.ts +1190 -0
  271. package/dist/types/protocol/lifecycle.d.ts.map +1 -0
  272. package/dist/types/protocol/meta-keys.d.ts +17 -0
  273. package/dist/types/protocol/meta-keys.d.ts.map +1 -0
  274. package/dist/types/protocol/meta.d.ts +13 -0
  275. package/dist/types/protocol/meta.d.ts.map +1 -0
  276. package/dist/types/protocol/model-catalog.d.ts +11 -0
  277. package/dist/types/protocol/model-catalog.d.ts.map +1 -0
  278. package/dist/types/protocol/models.d.ts +107 -0
  279. package/dist/types/protocol/models.d.ts.map +1 -0
  280. package/dist/types/protocol/part-input.d.ts +101 -0
  281. package/dist/types/protocol/part-input.d.ts.map +1 -0
  282. package/dist/types/protocol/parts.d.ts +357 -0
  283. package/dist/types/protocol/parts.d.ts.map +1 -0
  284. package/dist/types/protocol/reduce.d.ts +26 -0
  285. package/dist/types/protocol/reduce.d.ts.map +1 -0
  286. package/dist/types/protocol/selectors.d.ts +64 -0
  287. package/dist/types/protocol/selectors.d.ts.map +1 -0
  288. package/dist/types/protocol/seq-cursor.d.ts +66 -0
  289. package/dist/types/protocol/seq-cursor.d.ts.map +1 -0
  290. package/dist/types/protocol/stop-reasons.d.ts +33 -0
  291. package/dist/types/protocol/stop-reasons.d.ts.map +1 -0
  292. package/dist/types/protocol/thinking.d.ts +28 -0
  293. package/dist/types/protocol/thinking.d.ts.map +1 -0
  294. package/dist/types/protocol/time.d.ts +21 -0
  295. package/dist/types/protocol/time.d.ts.map +1 -0
  296. package/dist/types/protocol/tokens.d.ts +29 -0
  297. package/dist/types/protocol/tokens.d.ts.map +1 -0
  298. package/dist/types/protocol/tool-closure.d.ts +25 -0
  299. package/dist/types/protocol/tool-closure.d.ts.map +1 -0
  300. package/dist/types/protocol/tool-state.d.ts +209 -0
  301. package/dist/types/protocol/tool-state.d.ts.map +1 -0
  302. package/dist/types/protocol/verify.d.ts +52 -0
  303. package/dist/types/protocol/verify.d.ts.map +1 -0
  304. package/dist/types/protocol/vocabulary.d.ts +19 -0
  305. package/dist/types/protocol/vocabulary.d.ts.map +1 -0
  306. package/dist/types/protocol/wire-api.d.ts +1983 -0
  307. package/dist/types/protocol/wire-api.d.ts.map +1 -0
  308. package/dist/types/protocol/wire.d.ts +1758 -0
  309. package/dist/types/protocol/wire.d.ts.map +1 -0
  310. package/dist/types/server/acp/binding.d.ts +33 -0
  311. package/dist/types/server/acp/binding.d.ts.map +1 -0
  312. package/dist/types/server/acp/session-records.d.ts +17 -0
  313. package/dist/types/server/acp/session-records.d.ts.map +1 -0
  314. package/dist/types/server/acp/translate.d.ts +48 -0
  315. package/dist/types/server/acp/translate.d.ts.map +1 -0
  316. package/dist/types/server/agent-server.d.ts +121 -0
  317. package/dist/types/server/agent-server.d.ts.map +1 -0
  318. package/dist/types/server/feedback.d.ts +37 -0
  319. package/dist/types/server/feedback.d.ts.map +1 -0
  320. package/dist/types/server/history.d.ts +15 -0
  321. package/dist/types/server/history.d.ts.map +1 -0
  322. package/dist/types/server/index.d.ts +7 -0
  323. package/dist/types/server/index.d.ts.map +1 -0
  324. package/dist/types/server/install.d.ts +42 -0
  325. package/dist/types/server/install.d.ts.map +1 -0
  326. package/dist/types/server/open-parts.d.ts +27 -0
  327. package/dist/types/server/open-parts.d.ts.map +1 -0
  328. package/dist/types/server/routes.d.ts +61 -0
  329. package/dist/types/server/routes.d.ts.map +1 -0
  330. package/dist/types/server/secrets.d.ts +11 -0
  331. package/dist/types/server/secrets.d.ts.map +1 -0
  332. package/dist/types/server/session-gate.d.ts +32 -0
  333. package/dist/types/server/session-gate.d.ts.map +1 -0
  334. package/dist/types/server/session-log.d.ts +39 -0
  335. package/dist/types/server/session-log.d.ts.map +1 -0
  336. package/dist/types/server/session-store.d.ts +119 -0
  337. package/dist/types/server/session-store.d.ts.map +1 -0
  338. package/dist/types/server/subscriptions.d.ts +74 -0
  339. package/dist/types/server/subscriptions.d.ts.map +1 -0
  340. package/dist/types/server/transports.d.ts +74 -0
  341. package/dist/types/server/transports.d.ts.map +1 -0
  342. package/dist/types/server/wire-error.d.ts +9 -0
  343. package/dist/types/server/wire-error.d.ts.map +1 -0
  344. package/dist/types/sync/event-log.d.ts +45 -0
  345. package/dist/types/sync/event-log.d.ts.map +1 -0
  346. package/dist/types/sync/fit.d.ts +40 -0
  347. package/dist/types/sync/fit.d.ts.map +1 -0
  348. package/dist/types/sync/history-reader.d.ts +8 -0
  349. package/dist/types/sync/history-reader.d.ts.map +1 -0
  350. package/dist/types/sync/history-sqlite.d.ts +37 -0
  351. package/dist/types/sync/history-sqlite.d.ts.map +1 -0
  352. package/dist/types/sync/history.d.ts +70 -0
  353. package/dist/types/sync/history.d.ts.map +1 -0
  354. package/dist/types/sync/index.d.ts +4 -0
  355. package/dist/types/sync/index.d.ts.map +1 -0
  356. package/dist/types/sync/journal-sqlite.d.ts +51 -0
  357. package/dist/types/sync/journal-sqlite.d.ts.map +1 -0
  358. package/dist/types/sync/journal.d.ts +107 -0
  359. package/dist/types/sync/journal.d.ts.map +1 -0
  360. package/dist/types/sync/live-tails.d.ts +30 -0
  361. package/dist/types/sync/live-tails.d.ts.map +1 -0
  362. package/dist/types/sync/node-sqlite.d.ts +7 -0
  363. package/dist/types/sync/node-sqlite.d.ts.map +1 -0
  364. package/dist/types/sync/projection.d.ts +10 -0
  365. package/dist/types/sync/projection.d.ts.map +1 -0
  366. package/dist/types/sync/recovery.d.ts +25 -0
  367. package/dist/types/sync/recovery.d.ts.map +1 -0
  368. package/dist/types/sync/retry.d.ts +25 -0
  369. package/dist/types/sync/retry.d.ts.map +1 -0
  370. package/dist/types/sync/schema.d.ts +4 -0
  371. package/dist/types/sync/schema.d.ts.map +1 -0
  372. package/dist/types/sync/sql.d.ts +38 -0
  373. package/dist/types/sync/sql.d.ts.map +1 -0
  374. package/dist/types/sync/sqlite-file.d.ts +9 -0
  375. package/dist/types/sync/sqlite-file.d.ts.map +1 -0
  376. package/dist/types/sync/sqlite.d.ts +6 -0
  377. package/dist/types/sync/sqlite.d.ts.map +1 -0
  378. package/dist/types/sync/worker.d.ts +63 -0
  379. package/dist/types/sync/worker.d.ts.map +1 -0
  380. package/docs/consuming.md +452 -53
  381. package/docs/deploy.md +218 -47
  382. package/docs/{sync-experiment.md → durable-sessions.md} +77 -72
  383. package/docs/feedback.md +116 -0
  384. package/docs/harnesses.md +212 -88
  385. package/docs/sync-history.md +29 -13
  386. package/docs/sync-integration.md +52 -66
  387. package/package.json +43 -25
  388. package/src/accounts/chatgpt.ts +194 -0
  389. package/src/accounts/check.ts +112 -0
  390. package/src/accounts/claude.ts +111 -0
  391. package/src/accounts/endpoint.ts +151 -0
  392. package/src/accounts/http.ts +97 -0
  393. package/src/accounts/index.ts +19 -0
  394. package/src/client/client.ts +604 -670
  395. package/src/client/connection.ts +371 -0
  396. package/src/client/history.ts +29 -52
  397. package/src/client/index.ts +11 -2
  398. package/src/client/listeners.ts +20 -0
  399. package/src/client/logins.ts +105 -0
  400. package/src/client/rpc.ts +144 -0
  401. package/src/client/streams.ts +488 -0
  402. package/src/client/transports.ts +62 -8
  403. package/src/client/turns.ts +171 -0
  404. package/src/core/agents/acp/acp-agent.ts +94 -118
  405. package/src/core/agents/acp/adapter.ts +20 -9
  406. package/src/core/agents/acp/client.ts +125 -47
  407. package/src/core/agents/acp/known-agents.ts +36 -4
  408. package/src/core/agents/acp/mappings.ts +64 -18
  409. package/src/core/agents/acp/requests.ts +125 -0
  410. package/src/core/agents/attachments.ts +18 -0
  411. package/src/core/agents/base.ts +120 -42
  412. package/src/core/agents/claude-code/adapter.ts +177 -238
  413. package/src/core/agents/claude-code/approvals.ts +270 -0
  414. package/src/core/agents/claude-code/claude-agent.ts +175 -158
  415. package/src/core/agents/claude-code/credentials.ts +171 -0
  416. package/src/core/agents/claude-code/events.ts +55 -0
  417. package/src/core/agents/claude-code/login.ts +269 -0
  418. package/src/core/agents/claude-code/mcp.ts +206 -0
  419. package/src/core/agents/claude-code/models.ts +15 -9
  420. package/src/core/agents/claude-code/options.ts +326 -39
  421. package/src/core/agents/claude-code/outcome.ts +209 -0
  422. package/src/core/agents/claude-code/session-pool.ts +136 -0
  423. package/src/core/agents/claude-code/session.ts +513 -0
  424. package/src/core/agents/claude-code/spawn.ts +144 -0
  425. package/src/core/agents/claude-code/spend.ts +160 -0
  426. package/src/core/agents/claude-code/tools.ts +47 -0
  427. package/src/core/agents/claude-code/turn-usage.ts +135 -0
  428. package/src/core/agents/claude-code/turn.ts +232 -0
  429. package/src/core/agents/codex-app-server/adapter.ts +314 -117
  430. package/src/core/agents/codex-app-server/client.ts +186 -84
  431. package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
  432. package/src/core/agents/codex-app-server/commands.ts +228 -0
  433. package/src/core/agents/codex-app-server/credentials.ts +126 -0
  434. package/src/core/agents/codex-app-server/effort.ts +29 -0
  435. package/src/core/agents/codex-app-server/events.ts +47 -0
  436. package/src/core/agents/codex-app-server/homes.ts +64 -0
  437. package/src/core/agents/codex-app-server/input.ts +60 -0
  438. package/src/core/agents/codex-app-server/items.ts +149 -0
  439. package/src/core/agents/codex-app-server/login.ts +180 -0
  440. package/src/core/agents/codex-app-server/mcp.ts +182 -37
  441. package/src/core/agents/codex-app-server/models.ts +99 -46
  442. package/src/core/agents/codex-app-server/options.ts +146 -0
  443. package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
  444. package/src/core/agents/codex-app-server/protocol.ts +117 -0
  445. package/src/core/agents/codex-app-server/requests.ts +332 -0
  446. package/src/core/agents/codex-app-server/session.ts +285 -0
  447. package/src/core/agents/codex-app-server/subagents.ts +108 -42
  448. package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
  449. package/src/core/agents/codex-app-server/turn-items.ts +88 -0
  450. package/src/core/agents/codex-app-server/turn.ts +463 -0
  451. package/src/core/agents/config-fingerprint.ts +7 -14
  452. package/src/core/agents/credentials.ts +98 -0
  453. package/src/core/agents/elicitation.ts +75 -0
  454. package/src/core/agents/inherit-config.ts +21 -0
  455. package/src/core/agents/login.ts +116 -0
  456. package/src/core/agents/mcp-config.ts +112 -8
  457. package/src/core/agents/plan.ts +25 -0
  458. package/src/core/agents/registry.ts +21 -4
  459. package/src/core/agents/session-agent.ts +96 -4
  460. package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
  461. package/src/core/agents/stderr-tail.ts +75 -0
  462. package/src/core/agents/types.ts +40 -5
  463. package/src/core/index.ts +58 -48
  464. package/src/core/presets.ts +100 -39
  465. package/src/core/processes/identity.ts +113 -0
  466. package/src/core/processes/lifeline.ts +170 -0
  467. package/src/core/processes/native-processes.ts +379 -0
  468. package/src/core/processes/process-table.ts +174 -0
  469. package/src/core/provision/cache-trust.ts +121 -0
  470. package/src/core/provision/cache-usage.ts +69 -0
  471. package/src/core/provision/checksums.ts +64 -0
  472. package/src/core/provision/extract.ts +11 -2
  473. package/src/core/provision/index.ts +4 -1
  474. package/src/core/provision/install-build.ts +136 -0
  475. package/src/core/provision/npm.ts +112 -17
  476. package/src/core/provision/pins.ts +9 -33
  477. package/src/core/provision/platform.ts +12 -1
  478. package/src/core/provision/provisioner.ts +329 -397
  479. package/src/core/provision/releases.ts +86 -0
  480. package/src/core/provision/tools.ts +329 -0
  481. package/src/core/proxy/anthropic-proxy.ts +55 -25
  482. package/src/core/proxy/api-key-store.ts +2 -12
  483. package/src/core/proxy/loopback.ts +106 -0
  484. package/src/core/runtime/agent-runtime.ts +327 -498
  485. package/src/core/runtime/event-processor.ts +197 -70
  486. package/src/core/runtime/harness-clis.ts +61 -0
  487. package/src/core/runtime/harness-logins.ts +328 -0
  488. package/src/core/runtime/login-reads.ts +78 -0
  489. package/src/core/runtime/model-lists.ts +33 -48
  490. package/src/core/runtime/permission-policy.ts +113 -0
  491. package/src/core/runtime/request-broker.ts +204 -0
  492. package/src/core/runtime/steering.ts +112 -0
  493. package/src/core/runtime/turn-outcome.ts +30 -0
  494. package/src/core/runtime/turn.ts +360 -0
  495. package/src/core/utils/bounded.ts +12 -0
  496. package/src/core/utils/deadline.ts +38 -0
  497. package/src/core/utils/errors.ts +113 -21
  498. package/src/core/utils/is-record.ts +4 -0
  499. package/src/core/utils/loopback.ts +10 -0
  500. package/src/protocol/account.ts +104 -0
  501. package/src/protocol/auth.ts +199 -0
  502. package/src/protocol/canonical.ts +16 -0
  503. package/src/protocol/clis.ts +69 -0
  504. package/src/protocol/config.ts +60 -6
  505. package/src/protocol/conversation.ts +272 -0
  506. package/src/protocol/credentials.ts +145 -0
  507. package/src/protocol/errors.ts +78 -20
  508. package/src/protocol/execution.ts +5 -2
  509. package/src/protocol/factories.ts +55 -7
  510. package/src/protocol/guards.ts +55 -2
  511. package/src/protocol/harness.ts +56 -6
  512. package/src/protocol/history.ts +72 -64
  513. package/src/protocol/ids.ts +0 -12
  514. package/src/protocol/index.ts +9 -0
  515. package/src/protocol/lifecycle.ts +250 -79
  516. package/src/protocol/meta-keys.ts +17 -0
  517. package/src/protocol/meta.ts +3 -3
  518. package/src/protocol/models.ts +2 -43
  519. package/src/protocol/part-input.ts +2 -1
  520. package/src/protocol/parts.ts +12 -3
  521. package/src/protocol/reduce.ts +302 -413
  522. package/src/protocol/selectors.ts +1 -20
  523. package/src/protocol/seq-cursor.ts +14 -0
  524. package/src/protocol/stop-reasons.ts +1 -1
  525. package/src/protocol/thinking.ts +1 -30
  526. package/src/protocol/time.ts +2 -2
  527. package/src/protocol/tool-closure.ts +93 -0
  528. package/src/protocol/tool-state.ts +19 -4
  529. package/src/protocol/verify.ts +222 -92
  530. package/src/protocol/vocabulary.ts +21 -5
  531. package/src/protocol/wire-api.ts +232 -0
  532. package/src/protocol/wire.ts +351 -64
  533. package/src/server/acp/binding.ts +63 -103
  534. package/src/server/acp/session-records.ts +53 -0
  535. package/src/server/acp/translate.ts +129 -20
  536. package/src/server/agent-server.ts +223 -387
  537. package/src/server/bin.ts +280 -78
  538. package/src/server/feedback.ts +204 -14
  539. package/src/server/history.ts +116 -122
  540. package/src/server/index.ts +3 -8
  541. package/src/server/install.ts +107 -8
  542. package/src/server/open-parts.ts +95 -0
  543. package/src/server/routes.ts +391 -0
  544. package/src/server/secrets.ts +24 -0
  545. package/src/server/session-gate.ts +69 -0
  546. package/src/server/session-log.ts +14 -2
  547. package/src/server/session-store.ts +136 -72
  548. package/src/server/subscriptions.ts +232 -0
  549. package/src/server/transports.ts +125 -25
  550. package/src/server/wire-error.ts +31 -45
  551. package/src/sync/event-log.ts +31 -3
  552. package/src/sync/fit.ts +27 -11
  553. package/src/sync/history-reader.ts +10 -5
  554. package/src/sync/history-sqlite.ts +37 -42
  555. package/src/sync/history.ts +9 -15
  556. package/src/sync/index.ts +17 -5
  557. package/src/sync/journal-sqlite.ts +162 -76
  558. package/src/sync/journal.ts +91 -32
  559. package/src/sync/live-tails.ts +107 -0
  560. package/src/sync/projection.ts +35 -0
  561. package/src/sync/recovery.ts +80 -51
  562. package/src/sync/schema.ts +27 -6
  563. package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
  564. package/docs/rfds/0002-native-subagents.md +0 -197
  565. package/src/client/request.ts +0 -19
  566. package/src/core/agents/claude-code/generator-session.ts +0 -572
  567. package/src/core/agents/claude-code/session-manager.ts +0 -166
  568. package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
  569. package/src/core/agents/codex-items.ts +0 -149
  570. package/src/core/agents/codex-sdk/adapter.ts +0 -237
  571. package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
  572. package/src/core/agents/tool-meta.ts +0 -68
package/docs/deploy.md CHANGED
@@ -2,32 +2,114 @@
2
2
 
3
3
  ## CLI provisioning (deterministic agents)
4
4
 
5
- The native harnesses spawn real CLIs (`claude` ~220 MB, `codex` ~300 MB
5
+ The native harnesses spawn real CLIs (`claude` ~220 MB, `codex` ~320 MB
6
6
  unpacked). Instead of trusting whatever version a host happens to have, the
7
- engine can **download the pinned, engine-tested builds** from the npm registry
8
- into a local cache — sha512-verified, installed atomically, shared across
9
- processes. Three modes (`--provision`, `$AGENT_SERVER_PROVISION`, or
10
- `createAgentRuntime({ provision })`):
11
-
12
- - **`auto`** (default): explicit override → host install → managed cache →
13
- download. Zero-config: uses what the machine has, self-heals on bare ones.
14
- - **`pinned`**: override → cache → download. Never trusts host installs —
7
+ engine downloads **the builds this release pins** from the npm registry into
8
+ a local cache and installs them atomically, shared across processes. Nothing
9
+ needs to be installed on the machine first: no Node, npm or package manager,
10
+ only the system `tar` (macOS, Linux, Windows 10 and later have one). Three
11
+ modes (`--provision`, `$AGENT_SERVER_PROVISION`, or
12
+ `createAgentRuntime({ provision })`), each after the operator's override and
13
+ the bundle folders (below):
14
+
15
+ - **`auto`** (default): host install → managed cache → download. Zero-config:
16
+ uses what a lockfile installed, self-heals on bare machines.
17
+ - **`pinned`**: managed cache → download. Never trusts host installs —
15
18
  every process in a fleet runs the exact tested build.
16
- - **`system`**: override → host install only. Never downloads (air-gapped).
19
+ - **`system`**: host install only (a `codex` on `PATH` included). Never
20
+ downloads (air-gapped, "my machine, my CLIs").
17
21
 
18
- "Host install" means the build the installed SDK itself would run — claude's
19
- sibling platform package, codex's vendored `@openai/codex` tree (the JS ↔ CLI
20
- pair from your lockfile) — with PATH as codex's fallback. Overrides are
21
- operator-level only — `$CLAUDE_CLI_PATH` / `$CODEX_CLI_PATH` (or
22
+ "Host install" means claude's platform package beside the installed Claude SDK
23
+ (the build that SDK would run), and an installed `@openai/codex` package for
24
+ codex (so your lockfile can pin it). A `codex` on `PATH` counts only in
25
+ `system` mode: anywhere else it is no build anyone chose for this engine, and
26
+ may be another app's private copy (Conductor puts its own on `PATH`), of
27
+ another version whose app-server may not run the turn (an older one fails
28
+ on the default model).
29
+ Overrides are operator-level only — `$CLAUDE_CLI_PATH` / `$CODEX_CLI_PATH` (or
22
30
  `provision.overrides`), never wire config: a remote client must not choose the
23
31
  executable a server spawns. Auth stays host-side either way: managed CLIs read
24
32
  the same `~/.claude` / `~/.codex` (or per-turn `config.apiKey` BYOK) as your
25
33
  own installs. Every resolution logs one stderr line
26
- (`claude CLI: … (cache 0.3.168)`) so runs are diagnosable.
34
+ (`claude CLI: … (cache <version>)`) so runs are diagnosable.
35
+
36
+ **What a download must match.** `src/core/provision/releases.ts`, generated by
37
+ `bun run releases:refresh` when a pin moves, holds each platform's npm
38
+ integrity for the pinned versions and, for Claude, the binary's sha256 from
39
+ Anthropic's signed release manifest (the script verifies its signature). A
40
+ download is checked against that table, whatever registry serves it, so a
41
+ mirror (`$AGENT_SERVER_NPM_REGISTRY`) works and cannot hand out another
42
+ build: one that states another checksum is refused before anything
43
+ downloads, and a Claude binary that is not the one Anthropic signed is never
44
+ installed. (npm itself never changes a published version's bytes; the table
45
+ is what holds a mirror to them.) A version the table does not pin (an
46
+ operator's `provision.pins`) is checked against the installed Claude SDK's
47
+ manifest when it names that version, else against the registry's checksum
48
+ only, and the log says so once.
49
+
50
+ **A product that bundles the Claude SDK** (an ESM or single-file build of its
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.
27
54
 
28
55
  Pins live in `src/core/provision/pins.ts`: the claude pin tracks the
29
56
  lockfile's `@anthropic-ai/claude-agent-sdk` version (test-enforced); the codex
30
57
  pin is the version the app-server adapter's protocol was verified against.
58
+ After a bump, `bun run releases:refresh` and `bun run models:refresh` (both
59
+ test-enforced).
60
+
61
+ **The cache.** Version-keyed (`<cache>/claude/<version>-<platform>/…`), so
62
+ image layers and shared volumes dedupe naturally. Processes that cold-start
63
+ together on one cache each download, and the build's atomic rename leaves one
64
+ 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
68
+ recorded (again hourly while a process keeps resolving it), and after each
69
+ download builds whose recorded use is 14 days old are removed: several
70
+ products may share one cache, each keeping its own pins by using them.
71
+ `agent-server install --prune` also removes builds no use was ever recorded
72
+ for, by when they were installed: agent-server 0.3.18 and earlier record
73
+ none, and may be running them. A desktop app names a cache folder of its own
74
+ (`provision.cacheDir`), so removing the app removes its CLIs. The cache root
75
+ is created `0o700` and must be owned by the running user. On POSIX, its
76
+ ancestors must be owned by that user or root and must not be writable by
77
+ other users; trusted sticky shared parents such as `/tmp` are supported.
78
+ A symlink at the cache root is refused. Trusted ancestor aliases (including
79
+ macOS `/var`) resolve to canonical paths, which remain pinned for that
80
+ provisioner instance. Managed executables and their parent directories are
81
+ checked again on reuse, including memo hits. These uid/mode checks assume
82
+ trusted same-user/root code and do not evaluate filesystem ACLs.
83
+
84
+ Managed Claude processes run with `DISABLE_AUTOUPDATER=1`, whatever the environment says: the build that runs
85
+ is the one the provisioner chose.
86
+
87
+ ## Ready before the first turn
88
+
89
+ A turn whose CLI is not installed installs it first, about 100 MB per
90
+ harness: a few seconds on a good connection, during which the turn's own
91
+ stream says nothing. A product installs at setup instead, and shows it:
92
+
93
+ ```ts
94
+ // in-process
95
+ runtime.onCliProgress(show); // ({ harness, version, phase, receivedBytes, totalBytes }) => …
96
+ await runtime.prepareClis(["claude-code"]); // [{ harness, state: "ready", version, source }]
97
+
98
+ // over the wire (a server in a sandbox): every connection hears `clis/progress`
99
+ client.onCliProgress(show);
100
+ await client.prepareClis(["claude-code"]);
101
+ await client.listClis(); // ready | missing | installing | failed | unmanaged, installing nothing
102
+ ```
103
+
104
+ `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.
106
+ Over the wire, `clis/prepare` answers at once (`installing`), since an
107
+ install outlasts a request's timeout, and the client waits on `clis/progress`
108
+ and `clis/list`. `missing` without a `version` means the server installs
109
+ nothing (`system`): that harness cannot run there. A download's errors,
110
+ in a turn's error as in `clis/*`, carry URLs without their credentials or
111
+ query. The CLI says a download's start,
112
+ its quarters and its end, and `/info` shows the session harness's CLI.
31
113
 
32
114
  ## Single binary & sandbox cold starts
33
115
 
@@ -43,61 +125,150 @@ bun build --compile packages/agent-server/src/server/bin.ts --outfile dist/agent
43
125
 
44
126
  On macOS 27, binaries compiled by Bun 1.3.x carry an invalid signature and
45
127
  are killed at launch (exit 137, no output). Compile with Bun 1.4.2 or newer,
46
- or re-sign: `codesign --force --sign - dist/agent-server`.
128
+ or re-sign: `codesign --force --sign - dist/agent-server`. On Alpine, Bun's
129
+ musl build needs `apk add libstdc++ libgcc`.
47
130
 
48
131
  Inside a compiled binary the Claude SDK can't reach its platform package, so
49
132
  provisioning is what makes the binary *work*: first turn on a bare machine
50
- downloads the pinned CLIs (~7 s on datacenter bandwidth, parallel), every
133
+ downloads the pinned CLIs (~5 s in a datacenter, both in parallel), every
51
134
  later boot resolves from cache instantly.
52
135
 
53
136
  For sandboxes (E2B, Modal, Fly, plain Docker), erase even that first-turn cost
54
- by prefetching **at image build time**:
137
+ by prefetching **at image build time**, never when a sandbox is created:
55
138
 
56
139
  ```dockerfile
57
140
  FROM debian:bookworm-slim
58
- RUN apt-get update && apt-get install -y ca-certificates tar && rm -rf /var/lib/apt/lists/*
141
+ # the agents' own API calls need the system's CA certificates
142
+ RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
59
143
  COPY dist/agent-server /usr/local/bin/agent-server
60
144
  # bake the pinned CLIs into the image → zero downloads at runtime
61
145
  RUN agent-server install
62
146
  ENV ANTHROPIC_API_KEY="" # or mount ~/.claude / ~/.codex at runtime
63
- ENTRYPOINT ["agent-server", "--provision", "pinned", "--listen", "0.0.0.0:4747"]
147
+ # every interface of the container, so a token is required (see Trust boundary)
148
+ ENTRYPOINT ["agent-server", "--provision", "pinned", "--listen", "0.0.0.0:4747", \
149
+ "--token-file", "/run/secrets/agent-server-token"]
64
150
  ```
65
151
 
152
+ ```sh
153
+ # The token from a private file (chmod 600), mounted read-only, and the port
154
+ # published on the host's loopback or a private interface (-p 10.0.0.5:4747:4747),
155
+ # never on all of the host's interfaces.
156
+ docker run -p 127.0.0.1:4747:4747 \
157
+ -v "$PWD/agent-server-token:/run/secrets/agent-server-token:ro" agent-server
158
+ ```
159
+
160
+ Or drop `--token-file` and pass `-e AGENT_SERVER_TOKEN`: the name alone copies
161
+ the value from your environment without putting it on a command line. Clients
162
+ send the same token: `AgentServerClient.connect(url, { token })`, or the CLI's
163
+ `--connect` with `$AGENT_SERVER_TOKEN` set. A client can ask such a server
164
+ `clis/list` before its first turn; a sandbox without baked CLIs is prepared
165
+ remotely with `clis/prepare`, its progress streaming back.
166
+
66
167
  `agent-server install` respects `--harness a,b` (only fetch what you run) and
67
168
  `$AGENT_SERVER_CACHE_DIR` (e.g. point it at a persistent volume instead of
68
- baking). The cache layout is version-keyed
69
- (`<cache>/claude/0.3.168-darwin-arm64/…`), so image layers and shared volumes
70
- dedupe naturally and concurrent cold starts converge on one copy. The cache
71
- root is created `0o700` and must be owned by the running user. On POSIX, its
72
- ancestors must be owned by that user or root and must not be writable by
73
- other users; trusted sticky shared parents such as `/tmp` are supported.
74
- A symlink at the cache root is refused. Trusted ancestor aliases (including
75
- macOS `/var`) resolve to canonical paths, which remain pinned for that
76
- provisioner instance. Managed executables and their parent directories are
77
- checked again on reuse, including memo hits. These uid/mode checks assume
78
- trusted same-user/root code and do not evaluate filesystem ACLs.
169
+ baking).
79
170
 
80
- Measured in a live E2B sandbox (x86_64 Ubuntu, 2026-07): sandbox create 0.7 s,
81
- `install --harness claude-code` 3.0 s (71 MB, verified), first real Claude
82
- turn over the wire (BYOK `config.apiKey`) **2.0 s**. With the CLIs baked into
83
- the template, boot-to-first-token is effectively sandbox-create + turn time.
171
+ Measured (2026-10-31, `debian:bookworm-slim` arm64 under Docker, from a home
172
+ connection): `install` of both CLIs 5 s; a cold sandbox prepared over the
173
+ wire, ready in 5.7 s. In a live E2B sandbox (x86_64 Ubuntu, 2026-07): sandbox
174
+ create 0.7 s, `install --harness claude-code` 3.0 s (71 MB, verified), first
175
+ real Claude turn over the wire (BYOK `config.apiKey`) **2.0 s**. With the CLIs
176
+ baked into the template, boot-to-first-token is effectively sandbox-create +
177
+ turn time.
84
178
 
85
- ## Trust boundary
179
+ ### A sandbox with no login of its own
180
+
181
+ A sandbox image carries no login: start its engine with the product's
182
+ credential endpoint, and each turn asks it for the person's credential
183
+ (LLP 0012; [consuming.md](consuming.md#hold-the-login-yourself-for-sandboxes-and-other-devices)):
86
184
 
87
- The WebSocket wire carries no built-in authentication or TLS termination.
88
- Keep it on a trusted channel — localhost, sandbox-internal, or behind your own
89
- authenticated transport boundary. The stdio wire inherits the trust of
90
- whoever spawned the process.
185
+ ```sh
186
+ AGENT_SERVER_CREDENTIALS_TOKEN=<this sandbox's token> \
187
+ agent-server --listen 0.0.0.0:4747 --token-file /run/agent-server/token \
188
+ --credentials-url https://product.example/agent-credentials
189
+ ```
91
190
 
92
- ## Feedback
191
+ Claude's credential stays in the engine (its proxy on 127.0.0.1), not in the
192
+ CLI's environment its tools can read; Codex keeps ChatGPT tokens in memory.
93
193
 
94
- If anything in this guide is broken, confusing, outdated, or notably good,
95
- report it to the maintainers (no auth, one command):
194
+ ## App bundles and images for another machine
195
+
196
+ A desktop app that ships its CLIs (to run offline, or to show no download)
197
+ stages them at build time, for each platform it ships, from any machine:
96
198
 
97
199
  ```sh
98
- npx --yes hivenet@latest --to agent-server --category docs --subject "docs/deploy.md" "<specific, actionable feedback>"
200
+ agent-server install --platform darwin-arm64,darwin-x64 --dir build/agent-clis
99
201
  ```
100
202
 
101
- The response may include `guidance` (a maintainer reply) and an `ask` (their
102
- question plus a ready-to-run answer command — answer only from what you actually
103
- observed). Only specific, actionable reports.
203
+ `--dir` writes the cache's layout into a new or empty folder (or one it wrote
204
+ before; any other is refused, as staging opens what it writes to every
205
+ user), makes the builds it staged readable by every user, never through a
206
+ symlink, and leaves out the install's records; `--harness` selects
207
+ as usual. Where it runs, the app names the folder: `provision.bundleDirs`
208
+ (or `$AGENT_SERVER_BUNDLE_DIR`, a path list). A bundle folder is used in
209
+ every mode when it holds the version this engine runs, before the host and
210
+ the cache, and reports `source: "bundled"`; one that holds another version
211
+ (an agent-server upgrade the build did not restage) is passed over, so the
212
+ pinned build downloads instead of a stale one running. A bundle folder is
213
+ the operator's, like the overrides: what it holds runs, a regular file (a
214
+ symlink could redirect the spawn) whoever owns it. Its binaries' hashes are
215
+ not checked, since an app that signs them again (macOS notarization) changes
216
+ them, and its own signature is then what protects them. Staging opens the
217
+ builds to every user because an owner-only tree baked into an image and run
218
+ as another user fails with `Permission denied`. `--provision system` with a
219
+ bundle folder never downloads.
220
+
221
+ ## Trust boundary
222
+
223
+ A `--listen` server runs agents, and their tools, for whoever connects, so it
224
+ answers only what it can tell is its client (LLP 0001, D16):
225
+
226
+ - **Browsers are refused.** Any page a user visits may open a WebSocket to
227
+ localhost (CORS does not apply to WebSockets), so an upgrade that carries an
228
+ `Origin` header gets 403 unless `--allow-origin <origin>` names that origin
229
+ exactly as the browser sends it (`https://app.example`, `tauri://localhost`;
230
+ no wildcards, never `null`). Native clients send no `Origin`: the bundled
231
+ client, the CLI, Bun's and Node's WebSocket.
232
+ - **Beyond loopback, a token.** With `--token-file <path>` or
233
+ `$AGENT_SERVER_TOKEN`, every upgrade must carry `Authorization: Bearer
234
+ <token>`, or gets 401, which a client reports as `ConnectionRefusedError`
235
+ rather than redialing (the CLI says which token to set). A listener on any host but 127.0.0.0/8, `::1` or
236
+ `localhost` refuses to start without one; on loopback it is optional,
237
+ against the machine's other users. Keep the file private (`chmod 600`; the
238
+ server warns when others can read it), and never put the token on a command
239
+ line: `ps` shows argv to every user, so `--token` is refused. A browser
240
+ cannot send the header, so a renderer that connects directly does so to a
241
+ loopback listener without a token.
242
+ - **TLS is yours.** The server speaks plain `ws://`: put a TLS-terminating
243
+ proxy (`wss://`) in front of a listener other machines reach, or keep it on
244
+ a private network. The token authenticates the connection, not a user.
245
+
246
+ The stdio wire inherits the trust of whoever spawned the process. `--dial`
247
+ connects out, so nothing reaches it. With `$AGENT_SERVER_DIAL_TOKEN` set it
248
+ sends `Authorization: Bearer <token>` on every dial and redial: the
249
+ credential this server presents to the platform it dials, where
250
+ `$AGENT_SERVER_TOKEN` is the one a listener's clients present to it. Never
251
+ put it in the URL, where `?token=` ends up in logs, or on argv, which `ps`
252
+ shows; an embedder's `dial(server, url, { headers })` sends its own the same
253
+ way. Dial a `wss://` URL for a platform beyond this machine: over `ws://`
254
+ the token crosses the network in the clear.
255
+
256
+ ## What a turn loads
257
+
258
+ At `--inherit-config all`, the default, a turn loads the server user's own
259
+ Claude and Codex settings, MCP servers and memory as well as the
260
+ repository's configuration. In a cloud sandbox, start the server at
261
+ `--inherit-config project` for repositories you trust and `none` for any
262
+ other (LLP 0001, D17): a repository whose configuration loads runs its hooks
263
+ and `.mcp.json` servers as the server's user, with no trust prompt, and one
264
+ `env` line in it can send the turn's API traffic and its credential
265
+ elsewhere. Keep real provider keys out of the agent's environment: the BYOK
266
+ proxy (`@zvada/agent-server/core/proxy`) hands the agent a placeholder key
267
+ and swaps in the real one. Below `all`, every Codex turn names a
268
+ `CODEX_HOME` of its session's own (`config.env.CODEX_HOME`), whose login the
269
+ host hands over with `credentials` or the turn's `apiKey`.
270
+ See [Choose what a turn inherits](consuming.md#choose-what-a-turn-inherits).
271
+
272
+ ---
273
+
274
+ Something here wrong, unclear or missing? [Report it to the maintainers](feedback.md).
@@ -1,17 +1,18 @@
1
- # Durable sessions and shared history (experiment)
1
+ # Durable sessions and shared history
2
2
 
3
3
  An optional journal makes agent-server sessions survive process restarts: every
4
4
  admitted turn and every event is committed before it is acknowledged or
5
5
  delivered. The same journal serves each session's history over one portable
6
6
  history protocol (`history/*`), so other hosts can copy, follow, cache and fork
7
- it without running an agent. AGNT and Deus Machine are not connected or
8
- modified; [the integration guide](sync-integration.md) maps their seams and
9
- [shared history](sync-history.md) documents the history SDK.
7
+ it without running an agent. [The integration guide](sync-integration.md) shows
8
+ how a host adopts it, and [shared history](sync-history.md) documents the
9
+ history SDK.
10
10
 
11
11
  Agent-server owns admission receipts, event ordering, local persistence, replay
12
- and the history contract: shared execution infrastructure. The product owns
13
- identity, authorization, machine registration, cloud storage, routing,
14
- retention, native process ownership and its views.
12
+ and the history contract, and the native agent processes it starts:
13
+ shared execution infrastructure. The product owns identity, authorization,
14
+ machine registration, cloud storage, routing, retention, its views, the server
15
+ process and anything it starts with its own spawner.
15
16
 
16
17
  ```mermaid
17
18
  flowchart LR
@@ -43,7 +44,8 @@ import { AgentServer, listen } from "@zvada/agent-server/server";
43
44
  import { SqliteSessionJournal } from "@zvada/agent-server/sync/sqlite"; // Node: NodeSqliteSessionJournal from /sync/node-sqlite
44
45
 
45
46
  const journal = new SqliteSessionJournal("./data/sessions.sqlite");
46
- const server = new AgentServer(createAgentRuntime(), {
47
+ // `open` stops what a previous owner left running before it takes the journal.
48
+ const server = await AgentServer.open(createAgentRuntime(), {
47
49
  journal,
48
50
  history: { store: journal.history, authorize: (transport, ref, op) => acl.allows(transport, ref, op) },
49
51
  onJournalError: (error) => console.error("journal failed; restart recovers", error),
@@ -53,7 +55,9 @@ listen(server, { hostname: "127.0.0.1", port: 4747 });
53
55
  ```
54
56
 
55
57
  The server takes execution ownership of the journal (one owner per journal; a
56
- second `AgentServer` on it throws) and releases it on shutdown. The host opens
58
+ second `AgentServer` on it throws) and releases it on shutdown. Open it with
59
+ `AgentServer.open`, which runs the restart sweep first (step 5); the
60
+ constructor skips it and fences every session a restart cut off. The host opens
57
61
  the journal and closes it after shutdown. SQLite runs in WAL with
58
62
  `synchronous=FULL` and an exclusive lock, so a second process cannot open the
59
63
  file; serve other readers over the wire.
@@ -68,20 +72,25 @@ file; serve other readers over the wire.
68
72
  | `turn/get` | A turn's receipt: `admitted`, `completed` or `interrupted`, its input and terminal event. |
69
73
  | `session/get` | `headSeq`, `nativeSessionId`, `closed`, `recoveryRequired`. |
70
74
  | `session/confirmStopped` | Lifts the fence a restart put on a session, fenced by `expectedHeadSeq`. |
75
+ | `session/release` | Lets an idle session's agent go (its process, a Codex home it holds) and keeps the session open. Its next turn names its native conversation (`resumeRequired` until it does), as after a restart. Nothing is broadcast: another client of the session meets `resumeRequired` on its next turn. `released: false` for no open session by that id; `turnActive` while a turn runs. |
71
76
  | `history/*` | Opt-in (`history` option): the [history protocol](sync-history.md). |
72
77
 
73
- The three journal-only methods answer `methodNotFound` on volatile servers.
74
- Refusals have their own codes; anything else is an `internalError`:
78
+ The four journal-only methods answer `methodNotFound` on volatile servers,
79
+ where `session/close` is what frees a session.
80
+ Refusals have their own codes; anything else is an `internalError`. What a
81
+ refusal carries in `data` is typed by `WIRE_REFUSAL_DATA`, and
82
+ `refusalData(error, "resumeRequired")` (from `/client`) reads it:
75
83
 
76
84
  | Code | Meaning | `data` |
77
85
  | --- | --- | --- |
78
86
  | `turnConflict` (-32006) | The turn id was admitted with other input. | `turnId` |
79
87
  | `sessionClosed` (-32007) | A closed durable session id is never reused. | |
80
- | `recoveryRequired` (-32008) | A restart cut off the session's last turn. | `headSeq` |
88
+ | `recoveryRequired` (-32008) | A restart cut off the session's last turn. | `headSeq`, `reason` |
81
89
  | `resumeRequired` (-32009) | This process has not run the session: pass its native id as `config.resumeSessionId`. | `nativeSessionId` |
82
90
  | `notAuthorized` (-32010) | The host refused a history operation. | |
83
91
  | `unknownHistory` (-32011) | No such history, or not at that version. | |
84
- | `historyConflict` (-32012) | Contradicts committed history: payload, hash, stale expected head or reused commit id. | |
92
+ | `historyConflict` (-32012) | Contradicts committed history: payload, hash, stale expected head or reused commit id. | `headSeq`, for a stale `session/confirmStopped` |
93
+ | `unknownTurn` (-32013) | `turn/get` for a turn the session never admitted (`unknownSession` when the session itself is unknown). | |
85
94
 
86
95
  A request the journal cannot store (an id over 512 characters, input over the
87
96
  record limit, `includeRaw`) is `invalidParams`, never a server fault.
@@ -111,56 +120,59 @@ record limit, `includeRaw`) is `invalidParams`, never a server fault.
111
120
  did.
112
121
  5. **Restart recovery.** Taking ownership ends every turn a previous owner left
113
122
  admitted: pending permissions resolve as cancelled, running tools fail with
114
- an outcome-unknown error, streaming text is done and open messages end, so
115
- the history still passes `verifyStreamContract`. The receipt keeps its input
116
- and becomes `interrupted`; the session is fenced (`recoveryRequired`). Nothing
117
- is rerun. A host confirms the native process stopped (`session/confirmStopped`)
118
- and resumes the native session explicitly.
123
+ their outcome unknown (`closure: "interrupted"`), streaming parts end with
124
+ what they had streamed, open messages end, and the turn ends `error` with
125
+ the category `server_restart`, so the history still passes
126
+ `verifyStreamContract`. The receipt keeps its input and becomes
127
+ `interrupted`. Nothing is rerun. Before it takes ownership, `AgentServer.open`
128
+ stops what the dead owner left running: every native process is recorded
129
+ (pid, boot, start time, executable) before it gets work, and each record
130
+ that still names its running process is stopped with its tool sessions; a
131
+ pid now naming another process is left alone. The session is fenced
132
+ (`recoveryRequired`) only when its agent could not be confirmed stopped,
133
+ and says why (`recoveryReason`: `not_owned`, a host's own spawner started
134
+ it; `not_verified`; `not_stopped`, it survived SIGKILL); a host checks it
135
+ and confirms (`session/confirmStopped`). Either way the next turn resumes
136
+ the native session explicitly (`resumeRequired` names it). The turn's error
137
+ message says which it was.
138
+
139
+ While the server lives, its lifeline (one `/bin/sh` per process, holding a
140
+ pipe from it) stops every agent and tool it started when the server dies
141
+ in any way, SIGKILL included: within its 3 s grace (LLP 0007). The sweep is
142
+ for when the lifeline was lost too.
119
143
 
120
144
  No exactly-once external tool execution is claimed: a tool may act before its
121
145
  next event is recorded.
122
146
 
123
- ## Storage
124
-
125
- One schema (`user_version` 2) in `src/sync/schema.ts`. Every history this file
126
- holds, executed here or copied in, is a `histories` row (descriptor and head)
127
- and `events` rows `(source_id, session_id, seq, hash, body)`: the canonical
128
- event JSON with its hash inline. `sessions` and `turns` hold execution state;
129
- `commits` and `checkpoints` serve branches and cached projections.
130
- `EventLog.append` is the one write path for execution, commits, imports and
131
- recovery. Nothing has shipped, so there are no migrations; a journal from the
132
- earlier experiment layout is refused.
147
+ A client sees the server it follows change: `client.onConnection` reports
148
+ each drop, redial and reconnect, and `serverChanged` when the server behind
149
+ the address no longer holds the logs it followed (another journal, none, or a
150
+ volatile restart). A session continued there begins a new history, and its
151
+ native conversation continues only when the turn names it
152
+ (`config.resumeSessionId`); the repository CLI says so and names it.
133
153
 
134
- Measured on Bun 1.3.6 against the previous layout (separate replica and hash
135
- tables):
154
+ ## Storage
136
155
 
137
- | | Before | Now |
138
- | --- | --- | --- |
139
- | Statements to append one event | 7 | 4 |
140
- | Statements to read a 256-record history page | 264 | 5 |
141
- | Open with 2,000 sessions | 8,010 statements, 25 ms | 15 statements, 3.8 ms |
142
- | WAL per 330-byte event (FULL sync, one commit each) | 23.9 KB | 14.9 KB |
143
-
144
- Every stored hash is unchanged: the preimage is built from the stored body
145
- (`historyRecordPreimage`), checked against all records of a live run.
146
-
147
- ## Learned from Delta
148
-
149
- Delta.app's local client (0.1.0, inspected statically) persists pending facts,
150
- validates acceptance against prepared state, reconnects when a request times
151
- out, and checks history at the point of use. This experiment follows those
152
- principles on agent-server's own canonical model: commit before acknowledging,
153
- a receiver's committed prefix decides what is resent, an unanswered request
154
- replaces its connection, and imports verify the hash chain. Where measurement
155
- disagreed it diverges: Delta clusters tables `WITHOUT ROWID`, but for events of
156
- agent-server's size an ordinary table appended faster (77 vs 109 µs per 330-byte
157
- event) with the same WAL. Delta keeps a durable outbox because its history is a
158
- DAG; a linear log's destination head already is the outbox, so no receipts are
159
- stored locally.
160
-
161
- ## Outside this experiment
162
-
163
- - No AGNT/Deus integration, public relay, deployment or credential exchange.
156
+ One schema, `user_version` 6, in `src/sync/schema.ts`; a file of any other
157
+ version is refused, never migrated. It stores no token deltas and no
158
+ snapshots of a part while it streams: a streaming part's history is its
159
+ opening, the changes its harness reports and its end (a 13,891-character
160
+ answer is 2 records, 14.6 KB). What it streamed since its last kept snapshot
161
+ is in `live_tails`, a row per delta, outside every history, written before the
162
+ delta is delivered and deleted with the part's next kept snapshot or its
163
+ turn's end, so recovery closes the part with what was shown (LLP 0003,
164
+ LLP 0008). Every
165
+ history this file holds, executed here or copied in, is a `histories` row
166
+ (descriptor and head) and `events` rows `(source_id, session_id, seq, hash,
167
+ body)`: the canonical event JSON with its hash inline. `sessions` and `turns`
168
+ hold execution state; `native_processes` the agent processes its owners
169
+ started, until each is seen gone; `commits` and `checkpoints` serve branches
170
+ and cached projections. `EventLog.append` is the one write path for execution, commits,
171
+ imports and recovery.
172
+
173
+ ## Not covered
174
+
175
+ - No product integration, public relay, deployment or credential exchange.
164
176
  - Retention, compaction, blob offload and erasure are not implemented.
165
177
  - One writer per session. Copying an active journal into two writable stores is
166
178
  unsupported; fork instead.
@@ -171,20 +183,13 @@ stored locally.
171
183
 
172
184
  ## Verification
173
185
 
174
- From a checkout of this repository:
175
-
176
- ```sh
177
- bun run test packages/agent-server/test/sync # real Bun and Node SQLite, sockets, SIGKILL
178
- bun run control-agent-server replay session-sync --live-model
179
- ```
180
-
181
186
  The deterministic suite covers admission and refusals, recovery and fencing,
182
187
  sink failure, lost acknowledgements, tamper rollback, paged replay, the hash
183
- format and owner exclusion. On 2026-10-21 the live recipe passed 113 assertions
184
- with three real Claude Code 2.1.288 / Haiku turns (473 events): restart and
185
- native resume, a lost import ACK, two viewers, a friend following live (223 of
186
- 224 pages before the source finished), forks, the managed worker, checkpoints
187
- and a separate Node v22.23.3 viewer. A crash drill (SIGKILL while a tool runs,
188
- Claude and Codex) passed 14 of 14 checks per harness; a killed Claude CLI keeps
189
- running its tool, which is why recovery never reruns and asks the host to
190
- confirm.
188
+ format and owner exclusion, against real Bun and Node SQLite, sockets and
189
+ SIGKILL. Live drills in the source repository run the real CLI and models
190
+ through restarts, crashes, dropped connections, forks, the managed worker,
191
+ checkpoints and a separate Node viewer.
192
+
193
+ ---
194
+
195
+ Something here wrong, unclear or missing? [Report it to the maintainers](feedback.md).