@zvada/agent-server 0.3.17 → 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 (578) hide show
  1. package/AGENTS.md +11 -26
  2. package/CHANGELOG.md +1060 -0
  3. package/README.md +50 -26
  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 +460 -54
  381. package/docs/deploy.md +218 -47
  382. package/docs/durable-sessions.md +195 -0
  383. package/docs/feedback.md +116 -0
  384. package/docs/harnesses.md +219 -87
  385. package/docs/sync-history.md +197 -0
  386. package/docs/sync-integration.md +119 -0
  387. package/package.json +53 -23
  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 +641 -602
  395. package/src/client/connection.ts +371 -0
  396. package/src/client/history.ts +65 -0
  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 +60 -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 +11 -34
  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 +340 -481
  485. package/src/core/runtime/event-processor.ts +207 -75
  486. package/src/core/runtime/event-sink.ts +45 -2
  487. package/src/core/runtime/harness-clis.ts +61 -0
  488. package/src/core/runtime/harness-logins.ts +328 -0
  489. package/src/core/runtime/login-reads.ts +78 -0
  490. package/src/core/runtime/model-lists.ts +57 -57
  491. package/src/core/runtime/permission-policy.ts +113 -0
  492. package/src/core/runtime/request-broker.ts +204 -0
  493. package/src/core/runtime/steering.ts +112 -0
  494. package/src/core/runtime/turn-outcome.ts +30 -0
  495. package/src/core/runtime/turn.ts +360 -0
  496. package/src/core/utils/bounded.ts +12 -0
  497. package/src/core/utils/deadline.ts +38 -0
  498. package/src/core/utils/errors.ts +113 -21
  499. package/src/core/utils/is-record.ts +4 -0
  500. package/src/core/utils/loopback.ts +10 -0
  501. package/src/protocol/account.ts +104 -0
  502. package/src/protocol/auth.ts +199 -0
  503. package/src/protocol/canonical.ts +16 -0
  504. package/src/protocol/clis.ts +69 -0
  505. package/src/protocol/config.ts +60 -6
  506. package/src/protocol/conversation.ts +272 -0
  507. package/src/protocol/credentials.ts +145 -0
  508. package/src/protocol/errors.ts +78 -20
  509. package/src/protocol/execution.ts +5 -2
  510. package/src/protocol/factories.ts +55 -7
  511. package/src/protocol/guards.ts +55 -2
  512. package/src/protocol/harness.ts +56 -6
  513. package/src/protocol/history.ts +275 -0
  514. package/src/protocol/ids.ts +4 -17
  515. package/src/protocol/index.ts +10 -0
  516. package/src/protocol/lifecycle.ts +250 -79
  517. package/src/protocol/meta-keys.ts +17 -0
  518. package/src/protocol/meta.ts +3 -3
  519. package/src/protocol/models.ts +2 -43
  520. package/src/protocol/part-input.ts +2 -1
  521. package/src/protocol/parts.ts +12 -3
  522. package/src/protocol/reduce.ts +302 -413
  523. package/src/protocol/selectors.ts +1 -20
  524. package/src/protocol/seq-cursor.ts +14 -0
  525. package/src/protocol/stop-reasons.ts +1 -1
  526. package/src/protocol/thinking.ts +1 -30
  527. package/src/protocol/time.ts +2 -2
  528. package/src/protocol/tool-closure.ts +93 -0
  529. package/src/protocol/tool-state.ts +19 -4
  530. package/src/protocol/verify.ts +222 -92
  531. package/src/protocol/vocabulary.ts +21 -5
  532. package/src/protocol/wire-api.ts +232 -0
  533. package/src/protocol/wire.ts +425 -57
  534. package/src/server/acp/binding.ts +63 -103
  535. package/src/server/acp/session-records.ts +53 -0
  536. package/src/server/acp/translate.ts +129 -20
  537. package/src/server/agent-server.ts +275 -366
  538. package/src/server/bin.ts +295 -72
  539. package/src/server/feedback.ts +204 -14
  540. package/src/server/history.ts +160 -0
  541. package/src/server/index.ts +4 -8
  542. package/src/server/install.ts +107 -8
  543. package/src/server/open-parts.ts +95 -0
  544. package/src/server/routes.ts +391 -0
  545. package/src/server/secrets.ts +24 -0
  546. package/src/server/session-gate.ts +69 -0
  547. package/src/server/session-log.ts +14 -2
  548. package/src/server/session-store.ts +289 -0
  549. package/src/server/subscriptions.ts +232 -0
  550. package/src/server/transports.ts +125 -25
  551. package/src/server/wire-error.ts +38 -0
  552. package/src/sync/event-log.ts +160 -0
  553. package/src/sync/fit.ts +140 -0
  554. package/src/sync/history-reader.ts +57 -0
  555. package/src/sync/history-sqlite.ts +339 -0
  556. package/src/sync/history.ts +220 -0
  557. package/src/sync/index.ts +18 -0
  558. package/src/sync/journal-sqlite.ts +439 -0
  559. package/src/sync/journal.ts +132 -0
  560. package/src/sync/live-tails.ts +107 -0
  561. package/src/sync/node-sqlite.ts +20 -0
  562. package/src/sync/projection.ts +35 -0
  563. package/src/sync/recovery.ts +141 -0
  564. package/src/sync/retry.ts +49 -0
  565. package/src/sync/schema.ts +77 -0
  566. package/src/sync/sql.ts +106 -0
  567. package/src/sync/sqlite-file.ts +38 -0
  568. package/src/sync/sqlite.ts +21 -0
  569. package/src/sync/worker.ts +259 -0
  570. package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
  571. package/docs/rfds/0002-native-subagents.md +0 -197
  572. package/src/core/agents/claude-code/generator-session.ts +0 -572
  573. package/src/core/agents/claude-code/session-manager.ts +0 -166
  574. package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
  575. package/src/core/agents/codex-items.ts +0 -149
  576. package/src/core/agents/codex-sdk/adapter.ts +0 -237
  577. package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
  578. package/src/core/agents/tool-meta.ts +0 -68
@@ -0,0 +1,116 @@
1
+ import type { NativeProcesses } from "../../processes/native-processes.ts";
2
+ import type { CodexNotification } from "./protocol.ts";
3
+ type NotificationHandler = (n: CodexNotification) => void;
4
+ /** Answers a server→client request (approvals). Throwing rejects the request. */
5
+ export type ServerRequestHandler = (method: string, params: Record<string, unknown>) => Promise<unknown>;
6
+ /**
7
+ * What the harness uses of a connection to `codex app-server`.
8
+ * `CodexAppServerClient` is the one that runs Codex.
9
+ */
10
+ export interface CodexConnection {
11
+ /** The app-server exited, or the connection was closed. */
12
+ readonly closed: boolean;
13
+ /** Why the app-server went away: its exit, with its last stderr words. */
14
+ readonly exitError: Error | undefined;
15
+ /** Start the app-server and introduce the harness to it. */
16
+ initialize(): Promise<void>;
17
+ request(method: string, params: unknown, timeoutMs?: number): Promise<unknown>;
18
+ onNotification(handler: NotificationHandler): () => void;
19
+ /** Install the answerer for server→client requests (approval round-trips). */
20
+ setRequestHandler(handler: ServerRequestHandler | undefined): void;
21
+ /**
22
+ * Fires once the app-server exits or the connection is closed: a turn
23
+ * stops waiting for notifications that will never arrive.
24
+ */
25
+ onClose(handler: (error?: Error) => void): () => void;
26
+ /** End the app-server now. Nothing confirms that what it ran stopped. */
27
+ close(): void;
28
+ /** End the app-server by its own shutdown: whether that confirmed its threads and tools stopped. */
29
+ closeAndWait(timeoutMs?: number): Promise<boolean>;
30
+ }
31
+ /** How far `pages` reads a list. */
32
+ export interface PageLimits {
33
+ /** Each page's deadline. */
34
+ timeoutMs?: number;
35
+ /** Past this many pages the list did not end. */
36
+ maxPages?: number;
37
+ }
38
+ /**
39
+ * Every page of a list Codex answers in pages (`data` and `nextCursor`), in
40
+ * order. A page without `data`, a cursor Codex gave before or more than
41
+ * `maxPages` pages means Codex cannot say what the list holds: an error.
42
+ */
43
+ export declare function pages<T>(connection: Pick<CodexConnection, "request">, method: string, params: Record<string, unknown>, { timeoutMs, maxPages }?: PageLimits): AsyncGenerator<T[]>;
44
+ /** The JSON-RPC error Codex answered a request with. */
45
+ export declare class CodexRpcError extends Error {
46
+ readonly code?: number | undefined;
47
+ readonly data?: unknown | undefined;
48
+ constructor(message: string, code?: number | undefined, data?: unknown | undefined);
49
+ }
50
+ export interface CodexAppServerClientOptions {
51
+ codexPath?: string;
52
+ cwd?: string;
53
+ env?: NodeJS.ProcessEnv;
54
+ /** Opt into experimental app-server APIs, including externally managed ChatGPT auth. */
55
+ experimentalApi?: boolean;
56
+ /**
57
+ * Keep logins in this process's memory (`cli_auth_credentials_store =
58
+ * "ephemeral"`): a key the host supplies never lands in `CODEX_HOME`, where
59
+ * it would replace that home's own login.
60
+ */
61
+ ephemeralCredentials?: boolean;
62
+ startupTimeoutMs?: number;
63
+ /** Default deadline for every JSON-RPC request. */
64
+ requestTimeoutMs?: number;
65
+ /**
66
+ * Where the app-server starts: in a group of its own, held by the
67
+ * lifeline, and recorded for `sessionId` (`createAgentRegistry` passes the
68
+ * runtime's). Stopping it reaches the commands it started in sessions of
69
+ * their own, which a SIGKILLed app-server leaves running.
70
+ */
71
+ processes: NativeProcesses;
72
+ /** The logical session it runs, which its record names; absent for a model listing. */
73
+ sessionId?: string;
74
+ }
75
+ /**
76
+ * Newline-delimited (JSONL) JSON-RPC client over a `codex app-server` subprocess.
77
+ * Requests get monotonic ids resolved against a pending map; notifications fan
78
+ * out to handlers. Inbound server→client requests (approvals) go to the
79
+ * registered request handler; without one they are declined (-32601).
80
+ */
81
+ export declare class CodexAppServerClient implements CodexConnection {
82
+ private readonly opts;
83
+ private native?;
84
+ private shutdown?;
85
+ private nextId;
86
+ private buffer;
87
+ private readonly decoder;
88
+ private readonly pending;
89
+ private readonly handlers;
90
+ private readonly closeHandlers;
91
+ private requestHandler?;
92
+ private exited;
93
+ private lastExit?;
94
+ private nativeShutdownFailed;
95
+ constructor(opts: CodexAppServerClientOptions);
96
+ onNotification(handler: NotificationHandler): () => void;
97
+ setRequestHandler(handler: ServerRequestHandler | undefined): void;
98
+ onClose(handler: (error?: Error) => void): () => void;
99
+ get closed(): boolean;
100
+ get exitError(): Error | undefined;
101
+ initialize(): Promise<void>;
102
+ request(method: string, params: unknown, timeoutMs?: number): Promise<unknown>;
103
+ close(): void;
104
+ /** EOF invokes native thread/tool cleanup. Killing the server alone proves nothing about workers. */
105
+ closeAndWait(timeoutMs?: number): Promise<boolean>;
106
+ /** Every request still waiting for its answer fails, with the error `why` gives it. */
107
+ private rejectPending;
108
+ private notifyClosed;
109
+ private start;
110
+ private onStdout;
111
+ private handleMessage;
112
+ private onExit;
113
+ private write;
114
+ }
115
+ export {};
116
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAevD,KAAK,mBAAmB,GAAG,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAE1D,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC;IACtC,4DAA4D;IAC5D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI,CAAC;IACzD,8EAA8E;IAC9E,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAAC;IACnE;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACtD,yEAAyE;IACzE,KAAK,IAAI,IAAI,CAAC;IACd,oGAAoG;IACpG,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD;AAED,oCAAoC;AACpC,MAAM,WAAW,UAAU;IAC1B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAuB,KAAK,CAAC,CAAC,EAC7B,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EAC5C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,EAAE,SAAS,EAAE,QAAmC,EAAE,GAAE,UAAe,GACjE,cAAc,CAAC,CAAC,EAAE,CAAC,CAgBrB;AAeD,wDAAwD;AACxD,qBAAa,aAAc,SAAQ,KAAK;IAGtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO;gBAFvB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,IAAI,CAAC,EAAE,OAAO,YAAA;CAKxB;AAED,MAAM,WAAW,2BAA2B;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,wFAAwF;IACxF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAc/C,OAAO,CAAC,QAAQ,CAAC,IAAI;IAbjC,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAC,CAAmB;IACpC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsC;IACpE,OAAO,CAAC,cAAc,CAAC,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAS;gBAER,IAAI,EAAE,2BAA2B;IAE9D,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAKxD,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI;IAIlE,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI;IAKrD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAEjC;IAEK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB9E,KAAK,IAAI,IAAI;IAeb,qGAAqG;IACrG,YAAY,CAAC,SAAS,SAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCjD,uFAAuF;IACvF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,KAAK;IAiDb,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,aAAa;IA4CrB,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,KAAK;CAGb"}
@@ -0,0 +1,113 @@
1
+ import type { AgentInput, ModelDescriptor } from "../../../protocol/index.ts";
2
+ import { type NativeProcesses } from "../../processes/native-processes.ts";
3
+ import type { AgentExecuteOptions, CancelResult, ListModelsOptions, RawAgentEvent } from "../base.ts";
4
+ import type { CredentialSource } from "../credentials.ts";
5
+ import type { InheritConfig } from "../inherit-config.ts";
6
+ import { SessionAgent } from "../session-agent.ts";
7
+ import { type CodexAppServerClientOptions, type CodexConnection } from "./client.ts";
8
+ import { CodexCliLogin } from "./login.ts";
9
+ export interface CodexAppServerAgentOptions {
10
+ /** Make the connection to `codex app-server` (a test's fake); a `CodexAppServerClient` by default. */
11
+ createClient?: (options: CodexAppServerClientOptions) => CodexConnection;
12
+ idleTimeoutMs?: number;
13
+ /** Fail a turn if the app-server goes silent this long after a retryable error. */
14
+ retryStallTimeoutMs?: number;
15
+ /**
16
+ * How long Codex has to confirm a stop (2 s by default): to acknowledge a
17
+ * cancel's `turn/interrupt` before the turn's process is ended, and to let
18
+ * the interrupted turn drain; to stop the commands the turn started, and
19
+ * for its own shutdown when they will not stop; to put a thread's settings
20
+ * back after a failed turn (`thread/settings/update`); and for each request
21
+ * of a managed turn's cleanup and its shutdown, five times it for the whole
22
+ * cleanup.
23
+ */
24
+ cancelGraceMs?: number;
25
+ /**
26
+ * Resolve the `codex` binary to spawn (typically the provisioner's,
27
+ * memoized). Falls back to `$CODEX_CLI_PATH`, then PATH. Operator-level
28
+ * only — never sourced from the wire.
29
+ */
30
+ resolveCliPath?: () => Promise<string | undefined>;
31
+ /**
32
+ * Credentials the product holds (LLP 0012), asked before each turn: an API
33
+ * key, or a ChatGPT token kept in the app-server's memory and asked for
34
+ * again when Codex needs a fresher one; none runs the turn as it would
35
+ * without them (its own `apiKey`, else the CLI's own login). Operator-level
36
+ * only.
37
+ */
38
+ credentials?: CredentialSource;
39
+ /**
40
+ * Where the app-servers start: each in a group of its own, held by the
41
+ * lifeline and recorded for its session (`createAgentRegistry` passes the
42
+ * runtime's). Operator-level only.
43
+ */
44
+ processes?: NativeProcesses;
45
+ /**
46
+ * What a thread loads by itself (LLP 0001, D17). At `all` (the default) a
47
+ * turn runs in the `CODEX_HOME` it names, else the process's. At `project`
48
+ * every turn must name a home of its session's own (absolute, not the
49
+ * shared one, one session to a home): the user's configuration stays out,
50
+ * the repository's `AGENTS.md` and skills load. `none` also keeps the
51
+ * repository's `AGENTS.md` out (`project_doc_max_bytes = 0`). Codex loads
52
+ * the repository's skills and `~/.agents/skills` at every level.
53
+ */
54
+ inheritConfig?: InheritConfig;
55
+ }
56
+ /**
57
+ * Codex harness backed by a long-lived `codex app-server` subprocess speaking
58
+ * JSON-RPC. Unlike the SDK harness this streams token-level deltas. A client +
59
+ * thread is created per logical session and reused for multi-turn; model/effort
60
+ * are passed per `turn/start`. Resume uses `thread/resume` with the native id.
61
+ */
62
+ export declare class CodexAppServerAgent extends SessionAgent {
63
+ private readonly agentOptions;
64
+ readonly harness: "codex-app-server";
65
+ readonly capabilities: {
66
+ multiTurn: boolean;
67
+ sessionResume: boolean;
68
+ modelSwitch: (string & {}) | "in_session" | "restart_session" | "unsupported";
69
+ thinkingLevels: boolean;
70
+ images: boolean;
71
+ files: ((string & {}) | "text" | "pdf" | "binary")[];
72
+ mcpServers: boolean;
73
+ permissionRequests: boolean;
74
+ rejectionMessages: boolean;
75
+ turnScopedSubagents?: boolean | undefined;
76
+ steering?: boolean | undefined;
77
+ };
78
+ /** Its CLIs start here: the runtime's, or this OS process's own when it was made without one. */
79
+ readonly processes: NativeProcesses;
80
+ private readonly timing;
81
+ private readonly sessions;
82
+ /** A cancel's acknowledgement belongs to one invocation, even after it drains. */
83
+ private readonly turns;
84
+ readonly login: CodexCliLogin;
85
+ constructor(agentOptions?: CodexAppServerAgentOptions);
86
+ /** On a product's credentials, each session may list as a different account. */
87
+ get modelsPerSession(): boolean;
88
+ protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<RawAgentEvent>;
89
+ /** How the turn stops: by Codex's interrupt, or, managed, with its native cleanup. */
90
+ private stopFor;
91
+ protected checkSteerInput(input: AgentInput): void;
92
+ /**
93
+ * The models Codex offers this login. Reuses the session's process when
94
+ * `sessionId` has one started with the same `env` (its `CODEX_HOME` decides
95
+ * the login and config); otherwise starts `codex app-server` just to ask,
96
+ * with the account the product's `credentials` hold for that session.
97
+ */
98
+ listModels(options: ListModelsOptions): Promise<ModelDescriptor[]>;
99
+ cancel(sessionId: string): Promise<CancelResult>;
100
+ /** Unchanged MCP config reloads retain dead remote connections after VM resume. */
101
+ invalidateMcpConnections(): void;
102
+ loginChanged(): void;
103
+ release(sessionId: string): Promise<void>;
104
+ terminateAll(): Promise<void>;
105
+ /** The CLI to run: the provisioner's, else `$CODEX_CLI_PATH`; PATH's `codex` when neither. */
106
+ private cliPath;
107
+ /**
108
+ * A connection to a new `codex app-server` for a folder, its `env` and a
109
+ * login; recorded for `sessionId`, which a model listing has none of.
110
+ */
111
+ private connect;
112
+ }
113
+ //# sourceMappingURL=codex-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/codex-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,qCAAqC,CAAC;AAElG,OAAO,KAAK,EACX,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAqB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAEN,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgC3C,MAAM,WAAW,0BAA0B;IAC1C,sGAAsG;IACtG,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,eAAe,CAAC;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAexC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAdzC,QAAQ,CAAC,OAAO,EAAG,kBAAkB,CAAU;IAC/C,QAAQ,CAAC,YAAY;;;;;;;;;;;;MAAgB;IACrC,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6C;IACnE,QAAQ,CAAC,KAAK,gBAIX;gBAE0B,YAAY,GAAE,0BAA+B;IAwB1E,gFAAgF;IAChF,IAAI,gBAAgB,IAAI,OAAO,CAE9B;cAEyB,WAAW,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,eAAe,GACzB,qBAAqB,CAAC,aAAa,CAAC;IAgEvC,sFAAsF;IACtF,OAAO,CAAC,OAAO;cAgBI,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI3D;;;;;OAKG;IACG,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAyBzD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAgB/D,mFAAmF;IACnF,wBAAwB,IAAI,IAAI;IAIhC,YAAY,IAAI,IAAI;IAIL,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASzC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5C,8FAA8F;YAChF,OAAO;IAIrB;;;OAGG;YACW,OAAO;CAsBrB"}
@@ -0,0 +1,66 @@
1
+ import { type CodexConnection } from "./client.ts";
2
+ import { type CodexRawEvent } from "./events.ts";
3
+ import { type CodexItem, type CodexNotification } from "./protocol.ts";
4
+ /** A command Codex keeps running for a thread in its own terminal (0.160). */
5
+ interface CodexBackgroundTerminal {
6
+ itemId?: string;
7
+ processId?: string;
8
+ }
9
+ /** Every background terminal of a thread. Throws when Codex cannot say. */
10
+ export declare function listBackgroundTerminals(client: Pick<CodexConnection, "request">, threadId: string, timeoutMs: number): Promise<CodexBackgroundTerminal[]>;
11
+ /**
12
+ * The commands a turn started, by item id: which still run, which the stream
13
+ * showed ending, and what a cancel of the turn could not stop. When a turn
14
+ * ends cancelled, a command's outcome is unknown when its stop could not be
15
+ * confirmed, or, with nothing stopped, when the stream never showed its end.
16
+ */
17
+ export declare class TurnCommands {
18
+ private readonly client;
19
+ private readonly threadId;
20
+ /** How long a stop has to confirm the commands stopped (`cancelGraceMs`). */
21
+ private readonly timeoutMs;
22
+ private readonly commands;
23
+ /** Completions that came after Codex's turn ended, which its events no longer take. */
24
+ private readonly late;
25
+ /** Codex's turn was interrupted: what it started is to stop. */
26
+ private interrupting;
27
+ private stopping?;
28
+ constructor(client: CodexConnection, threadId: string,
29
+ /** How long a stop has to confirm the commands stopped (`cancelGraceMs`). */
30
+ timeoutMs: number);
31
+ /** Note an item Codex started: a command the turn owns, unless it is another's. */
32
+ started(item: CodexItem | undefined): void;
33
+ /** Note an item Codex completed: whether it was one of the turn's commands. */
34
+ completed(item: CodexItem | undefined): boolean;
35
+ /** Note an event reaching the stream: a command's completion shows how it ended. */
36
+ shown(event: CodexRawEvent): void;
37
+ /** Keep a completion that came after Codex's turn ended, for the stream to show later. */
38
+ holdLate(n: CodexNotification): void;
39
+ /**
40
+ * The completions kept since Codex's turn ended, to the stream, until none
41
+ * is left: shown before anything that follows. Once Codex's turn was
42
+ * interrupted there are none to show: a kill's completion is no news.
43
+ */
44
+ drainLate(): Generator<CodexRawEvent>;
45
+ /** Whether a command of the turn still runs, as far as Codex said. */
46
+ get running(): boolean;
47
+ /** Codex's turn was interrupted, by a cancel or by Codex itself: what it started is to stop. */
48
+ interrupted(): void;
49
+ /**
50
+ * Stop what the turn started, once Codex's turn has ended, at most once.
51
+ * Codex's own shutdown (EOF) stops every terminal it keeps: the last
52
+ * resort, which also ends this session's process (the next turn resumes
53
+ * the thread). Resolves the commands whose stop was not confirmed.
54
+ */
55
+ stop(): Promise<string[]>;
56
+ /**
57
+ * The commands whose outcome a turn that ended cancelled leaves unknown:
58
+ * the ones a stop could not confirm stopped, or, when nothing was to stop,
59
+ * the ones whose end the stream never showed, left running on purpose.
60
+ */
61
+ outcomeUnknown(): Promise<string[]>;
62
+ /** The commands whose item never completed. */
63
+ notDone(): string[];
64
+ }
65
+ export {};
66
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAS,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAa,MAAM,eAAe,CAAC;AAElF,8EAA8E;AAC9E,UAAU,uBAAuB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,2EAA2E;AAC3E,wBAAsB,uBAAuB,CAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAUpC;AA2FD;;;;;GAKG;AACH,qBAAa,YAAY;IASvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS;IAX3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,uFAAuF;IACvF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;IAChD,gEAAgE;IAChE,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAoB;gBAGnB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM;IACjC,6EAA6E;IAC5D,SAAS,EAAE,MAAM;IAGnC,mFAAmF;IACnF,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI;IAS1C,+EAA+E;IAC/E,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO;IAM/C,oFAAoF;IACpF,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAOjC,0FAA0F;IAC1F,QAAQ,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAIpC;;;;OAIG;IACF,SAAS,IAAI,SAAS,CAAC,aAAa,CAAC;IAQtC,sEAAsE;IACtE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,gGAAgG;IAChG,WAAW,IAAI,IAAI;IAInB;;;;;OAKG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAczB;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzC,+CAA+C;IAC/C,OAAO,IAAI,MAAM,EAAE;CAGnB"}
@@ -0,0 +1,49 @@
1
+ import { type CredentialSource } from "../credentials.ts";
2
+ import type { CodexConnection } from "./client.ts";
3
+ import type { CodexSession } from "./session.ts";
4
+ /** ChatGPT tokens as Codex's app-server takes them (`chatgptAuthTokens`). */
5
+ interface ChatGptTokens {
6
+ accessToken: string;
7
+ chatgptAccountId: string;
8
+ chatgptPlanType?: string | null;
9
+ }
10
+ /**
11
+ * What a Codex process logs in with when the engine chooses: a key, or
12
+ * ChatGPT tokens held in its memory and how to get fresher ones. None: the
13
+ * CLI's own login.
14
+ */
15
+ export type CodexAuth = {
16
+ type: "apiKey";
17
+ apiKey: string;
18
+ } | {
19
+ type: "chatgptAuthTokens";
20
+ tokens: ChatGptTokens;
21
+ refresh(): Promise<ChatGptTokens>;
22
+ };
23
+ /**
24
+ * The login a turn or a model list runs Codex on: the credential the product
25
+ * holds (`credentials`), an API key or a ChatGPT access token kept in the
26
+ * app-server's memory, which asks the product again (with the token it
27
+ * refused) when it needs a fresher one; without one, the turn's own `apiKey`;
28
+ * without that, the CLI's own login.
29
+ */
30
+ export declare function authFor(ask: {
31
+ credentials: CredentialSource | undefined;
32
+ /** Absent for a model listing of no session: no credential is asked for. */
33
+ sessionId: string | undefined;
34
+ turnId?: string;
35
+ apiKey: string | undefined;
36
+ signal?: AbortSignal;
37
+ }): Promise<CodexAuth | undefined>;
38
+ /** Who a process is logged in as: an account or key change needs a new process. */
39
+ export declare function authFingerprint(auth: CodexAuth | undefined): string | undefined;
40
+ /** Log the account in on Codex's process: without one, it runs the native login. */
41
+ export declare function logIn(client: Pick<CodexConnection, "request">, auth: CodexAuth | undefined): Promise<void>;
42
+ /**
43
+ * Codex asks for fresh ChatGPT tokens (`account/chatgptAuthTokens/refresh`):
44
+ * the product's source renews them, for the account the turn runs as and
45
+ * never another, and only while that turn is the session's.
46
+ */
47
+ export declare function refreshTokens(session: CodexSession, params: Record<string, unknown>): Promise<Record<string, unknown>>;
48
+ export {};
49
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/credentials.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,6EAA6E;AAC7E,UAAU,aAAa;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAA;CAAE,CAAC;AAS3F;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE;IAClC,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC1C,4EAA4E;IAC5E,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAwBjC;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK/E;AAED,oFAAoF;AACpF,wBAAsB,KAAK,CAC1B,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EACxC,IAAI,EAAE,SAAS,GAAG,SAAS,GACzB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAClC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqBlC"}
@@ -0,0 +1,12 @@
1
+ import { type ThinkingLevel } from "../../../protocol/index.ts";
2
+ /** Codex reasoning-effort string for a level (matches the `ReasoningEffort` enum). */
3
+ export type CodexReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
4
+ /**
5
+ * The effort Codex runs for `level`. `supported` is what the model accepts, in
6
+ * this vocabulary, where `off` stands for its least effort: `offEffort`, the
7
+ * native `none` or `minimal` the model advertises. A level it lacks becomes the
8
+ * nearest one it has. Without `supported`, `off` becomes `low`: no model the
9
+ * pinned CLI lists accepts `none` or `minimal`, and every one accepts `low`.
10
+ */
11
+ export declare function codexReasoningEffort<Off extends "none" | "minimal" = "minimal">(level: ThinkingLevel, supported?: readonly ThinkingLevel[], offEffort?: Off): Exclude<CodexReasoningEffort, "none" | "minimal"> | Off;
12
+ //# sourceMappingURL=effort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effort.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/effort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,4BAA4B,CAAC;AAEpF,sFAAsF;AACtF,MAAM,MAAM,oBAAoB,GAC7B,MAAM,GACN,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,KAAK,GACL,OAAO,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EAC9E,KAAK,EAAE,aAAa,EACpB,SAAS,CAAC,EAAE,SAAS,aAAa,EAAE,EACpC,SAAS,CAAC,EAAE,GAAG,GACb,OAAO,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,CAIzD"}
@@ -0,0 +1,45 @@
1
+ import type { PermissionMode } from "../../../protocol/index.ts";
2
+ import type { CodexNotification } from "./protocol.ts";
3
+ /**
4
+ * Synthetic: what the user decided about the plan Codex proposed. Codex ends
5
+ * its Plan-mode turn with the plan and asks nothing; the agent puts it to the
6
+ * user and reports the answer with this method, which Codex never sends.
7
+ */
8
+ export declare const CODEX_PLAN_DECIDED = "agentServer/planDecided";
9
+ export interface CodexPlanDecided {
10
+ itemId: string;
11
+ /**
12
+ * `presented`: nobody could be asked (no broker), so the plan stands as
13
+ * written. `cancelled`: the question was cancelled, unanswered.
14
+ */
15
+ decision: "approved" | "kept_planning" | "presented" | "cancelled";
16
+ /** The mode an approved plan is implemented in. */
17
+ permissionMode?: PermissionMode;
18
+ /** What the user said, keeping planning. */
19
+ message?: string;
20
+ }
21
+ /**
22
+ * Synthetic: commands that may still be running when their turn ends
23
+ * cancelled, which Codex never sends. Codex keeps a command running as a
24
+ * background terminal after `turn/interrupt`; the agent stops the turn's own
25
+ * and reports the ones it could not confirm, and the ones a finished plan
26
+ * turn left running on purpose when its question is cancelled.
27
+ */
28
+ export declare const CODEX_STOP_UNCONFIRMED = "agentServer/stopUnconfirmed";
29
+ export interface CodexStopUnconfirmed {
30
+ /** The commands' item ids. */
31
+ itemIds: string[];
32
+ }
33
+ /** An event the agent makes, which Codex never sends. */
34
+ export type CodexSyntheticEvent = {
35
+ method: typeof CODEX_PLAN_DECIDED;
36
+ params: CodexPlanDecided;
37
+ } | {
38
+ method: typeof CODEX_STOP_UNCONFIRMED;
39
+ params: CodexStopUnconfirmed;
40
+ };
41
+ /** What the Codex agent yields and its adapter reads: Codex's notifications, and its own. */
42
+ export type CodexRawEvent = CodexNotification | CodexSyntheticEvent;
43
+ /** Whether the agent made the event, not Codex. */
44
+ export declare function isSyntheticEvent(event: CodexRawEvent): event is CodexSyntheticEvent;
45
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAC5D,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,CAAC;IACnE,mDAAmD;IACnD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,MAAM,WAAW,oBAAoB;IACpC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAC5B;IAAE,MAAM,EAAE,OAAO,kBAAkB,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAC/D;IAAE,MAAM,EAAE,OAAO,sBAAsB,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAE3E,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEpE,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,mBAAmB,CAEnF"}
@@ -0,0 +1,20 @@
1
+ import type { AgentExecuteOptions } from "../base.ts";
2
+ import type { InheritConfig } from "../inherit-config.ts";
3
+ /**
4
+ * Which logical session owns each `CODEX_HOME` its turns name. A turn that
5
+ * names one claims it for its session, which keeps it until it is released,
6
+ * through process eviction and failed preparation: one session to a home. A
7
+ * turn with MCP servers must name one, since the engine writes them there,
8
+ * and below `inheritConfig: "all"` every turn must: the user's own home holds
9
+ * the user's configuration. That home is never claimed, nor written to.
10
+ */
11
+ export declare class CodexHomes {
12
+ private readonly level;
13
+ private readonly owners;
14
+ constructor(level?: InheritConfig);
15
+ /** Whether the turn runs in a home of its session's own, which it claims. */
16
+ claim(options: AgentExecuteOptions, hasServers: boolean): boolean;
17
+ release(sessionId: string): void;
18
+ clear(): void;
19
+ }
20
+ //# sourceMappingURL=homes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homes.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/homes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,UAAU;IAGV,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;gBAEvB,KAAK,GAAE,aAAqB;IAEzD,6EAA6E;IAC7E,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO;IAmCjE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIhC,KAAK,IAAI,IAAI;CAGb"}
@@ -0,0 +1,26 @@
1
+ import type { AgentInput } from "../../../protocol/index.ts";
2
+ /** One part of what a turn or a steer gives Codex (`UserInput`). */
3
+ export type UserInput = {
4
+ type: "text";
5
+ text: string;
6
+ text_elements: [];
7
+ } | {
8
+ type: "image";
9
+ url: string;
10
+ } | {
11
+ type: "localImage";
12
+ path: string;
13
+ } | {
14
+ type: "mention";
15
+ name: string;
16
+ path: string;
17
+ };
18
+ export declare const textInput: (text: string) => UserInput;
19
+ /**
20
+ * Codex takes images as data URLs or local paths (it refuses remote image URLs
21
+ * at turn/start, which fails the turn loudly) and has no input for file
22
+ * content: a text file given as data is inlined, a local file is mentioned for
23
+ * the agent to read, and anything else fails the turn instead of vanishing.
24
+ */
25
+ export declare function toUserInput(input: AgentInput): UserInput[];
26
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D,oEAAoE;AACpE,MAAM,MAAM,SAAS,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,SAAwD,CAAC;AAclG;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,CA2B1D"}
@@ -0,0 +1,31 @@
1
+ import type { ToolMeta } from "../../../protocol/index.ts";
2
+ import type { CodexItem } from "./protocol.ts";
3
+ /** Codex tools are already normalized names; kinds are fixed per item type. */
4
+ export declare const CODEX_TOOL_KINDS: {
5
+ readonly shell: "execute";
6
+ readonly apply_patch: "edit";
7
+ readonly web_search: "fetch";
8
+ readonly mcp: "other";
9
+ /** The plan Codex proposes in Plan mode, put to the user like Claude's ExitPlanMode. */
10
+ readonly plan: "switch_mode";
11
+ };
12
+ /**
13
+ * What an item that is a tool is to the stream. Descriptors are pure: the
14
+ * adapter keeps its own streaming mechanics and calls these for naming,
15
+ * input/meta shaping, and completion-result extraction.
16
+ */
17
+ export interface CodexToolDescriptor {
18
+ toolName(item: CodexItem): string;
19
+ input(item: CodexItem): Record<string, unknown>;
20
+ meta(item: CodexItem): ToolMeta;
21
+ result(item: CodexItem): {
22
+ output: string;
23
+ isError: boolean;
24
+ };
25
+ }
26
+ /**
27
+ * The descriptor of an item type that is a tool. Its own keys only: an item
28
+ * typed `constructor` is no tool, whatever the object's prototype holds.
29
+ */
30
+ export declare function codexToolDescriptor(itemType: string): CodexToolDescriptor | undefined;
31
+ //# sourceMappingURL=items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB;;;;;IAK5B,wFAAwF;;CAE5C,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAChC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAC9D;AAuHD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAErF"}
@@ -0,0 +1,38 @@
1
+ import type { AuthMethod } from "../../../protocol/index.ts";
2
+ import { type CliLogin, type LoginOptions, type LoginStatus, type NativeLogin } from "../login.ts";
3
+ import type { CodexConnection } from "./client.ts";
4
+ export interface CodexCliLoginOptions {
5
+ /**
6
+ * A new app-server, not yet initialized, for a turn's `env`: its
7
+ * `CODEX_HOME` is the store a login lands in.
8
+ */
9
+ connect(env: Record<string, string> | undefined): Promise<CodexConnection>;
10
+ /** The CLI turns run, for a terminal login. */
11
+ cliPath(): Promise<string>;
12
+ }
13
+ /** What `account/read` answers. */
14
+ interface CodexAccountRead {
15
+ account?: {
16
+ type?: string;
17
+ email?: string | null;
18
+ planType?: string | null;
19
+ } | null;
20
+ requiresOpenaiAuth?: boolean;
21
+ }
22
+ /** A login as Codex's app-server says it (`account/read`). */
23
+ export declare function codexLoginStatus(read: CodexAccountRead): LoginStatus;
24
+ /** Codex's login, through its app-server: `account/read`, `account/login/start`, `account/logout`. */
25
+ export declare class CodexCliLogin implements CliLogin {
26
+ private readonly options;
27
+ constructor(options: CodexCliLoginOptions);
28
+ /** Initialize a new app-server, run `use` on it, and end it. */
29
+ private with;
30
+ methods(options: LoginOptions): Promise<AuthMethod[]>;
31
+ status(options: LoginOptions): Promise<LoginStatus>;
32
+ start(id: string, options: LoginOptions & {
33
+ apiKey?: string;
34
+ }): Promise<NativeLogin>;
35
+ logout(options: LoginOptions): Promise<void>;
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI7D,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqBnD,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3E,+CAA+C;IAC/C,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,mCAAmC;AACnC,UAAU,gBAAgB;IACzB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACpF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,CA4BpE;AAED,sGAAsG;AACtG,qBAAa,aAAc,YAAW,QAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,oBAAoB;IAE1D,gEAAgE;YAClD,IAAI;IAgBZ,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAWrD,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IASnD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAuDpF,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlD"}
@@ -0,0 +1,62 @@
1
+ import { type ErrorInfo, type McpServerConfig } from "../../../protocol/index.ts";
2
+ import type { AgentExecuteOptions } from "../base.ts";
3
+ import { type CodexConnection } from "./client.ts";
4
+ import type { CodexHomes } from "./homes.ts";
5
+ import type { CodexNotification } from "./protocol.ts";
6
+ /** Codex supports stdio and Streamable HTTP, not the legacy SSE transport. */
7
+ export declare function codexMcpServers(servers: Record<string, McpServerConfig>): Record<string, unknown>;
8
+ /** Only call against an explicitly isolated, engine-managed CODEX_HOME. */
9
+ export declare function writeCodexMcpServers(client: Pick<CodexConnection, "request">, servers: Record<string, unknown>): Promise<void>;
10
+ /** User-layer write acknowledgements do not account for repository overrides. */
11
+ export declare function assertCodexMcpConfig(client: Pick<CodexConnection, "request">, cwd: string, servers: Record<string, unknown>): Promise<void>;
12
+ /**
13
+ * Codex's startup error for a server, readable: its Rust type paths out, a
14
+ * chain it repeats said once, and no prefix naming the server again.
15
+ */
16
+ export declare function codexMcpCause(name: string, error: string): string;
17
+ /**
18
+ * Wait for the thread's MCP servers to start, and settle the ones that did
19
+ * not: a required server's failure fails the turn (`McpUnavailableError`);
20
+ * the others are returned, each with why, for the turn to say and go on
21
+ * without. `servers` is the turn's wire configuration, by name, and `causes`
22
+ * why each server last failed, as Codex said.
23
+ */
24
+ export declare function settleCodexMcp(client: CodexConnection, threadId: string, servers: Readonly<Record<string, McpServerConfig>>, causes: ReadonlyMap<string, string>): Promise<Record<string, string>>;
25
+ /** A turn's MCP servers: as the wire gave them, and as Codex takes them, when its home is the engine's. */
26
+ export interface CodexTurnMcp {
27
+ wire: Record<string, McpServerConfig>;
28
+ /** Absent when the turn runs in a home the engine does not write. */
29
+ servers?: Record<string, unknown>;
30
+ }
31
+ /** The turn's servers, snapshotted before anything asynchronous can let the caller change them. */
32
+ export declare function codexTurnMcp(options: AgentExecuteOptions, homes: CodexHomes): CodexTurnMcp;
33
+ /**
34
+ * A session's MCP servers on Codex: the configuration last written to its
35
+ * home, why each server last failed to start, and the ones its turns went
36
+ * without.
37
+ */
38
+ export declare class CodexMcpState {
39
+ private readonly client;
40
+ private readonly cwd;
41
+ /** Last native config write; readiness is checked separately before every prompt. */
42
+ private fingerprint?;
43
+ /**
44
+ * Why each MCP server last failed to start, as Codex said, from the
45
+ * client's first notification: a fast failure can come before a turn asks.
46
+ */
47
+ private readonly causes;
48
+ /** The servers a turn went without, and when each was last tried. */
49
+ private readonly unavailable;
50
+ constructor(client: CodexConnection, cwd: string);
51
+ /** Note what Codex says of a server's startup on the session's own thread, not a subagent's. */
52
+ observe({ method, params }: CodexNotification, threadId: string): void;
53
+ /** Write the turn's servers to the session's home, check Codex took them, and reload them when they changed. */
54
+ configure(servers: Record<string, unknown> | undefined): Promise<void>;
55
+ /**
56
+ * Get the thread's servers ready for a turn: configured, started, and the
57
+ * ones it goes on without said through `onWarning`. A required server that
58
+ * cannot connect fails the turn.
59
+ */
60
+ prepare(threadId: string, { wire, servers }: CodexTurnMcp, onWarning: ((warning: ErrorInfo) => Promise<void>) | undefined): Promise<void>;
61
+ }
62
+ //# sourceMappingURL=mcp.d.ts.map