@zvada/agent-server 0.3.21 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/CHANGELOG.md +332 -0
  2. package/README.md +2 -1
  3. package/dist/types/accounts/chatgpt.d.ts +1 -1
  4. package/dist/types/accounts/chatgpt.d.ts.map +1 -1
  5. package/dist/types/accounts/http.d.ts +2 -4
  6. package/dist/types/accounts/http.d.ts.map +1 -1
  7. package/dist/types/client/client.d.ts +37 -11
  8. package/dist/types/client/client.d.ts.map +1 -1
  9. package/dist/types/client/connection.d.ts +66 -13
  10. package/dist/types/client/connection.d.ts.map +1 -1
  11. package/dist/types/client/index.d.ts +1 -1
  12. package/dist/types/client/index.d.ts.map +1 -1
  13. package/dist/types/client/logins.d.ts +4 -3
  14. package/dist/types/client/logins.d.ts.map +1 -1
  15. package/dist/types/client/streams.d.ts +9 -3
  16. package/dist/types/client/streams.d.ts.map +1 -1
  17. package/dist/types/client/turns.d.ts +1 -1
  18. package/dist/types/client/turns.d.ts.map +1 -1
  19. package/dist/types/core/agents/acp/acp-agent.d.ts +34 -1
  20. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  21. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  22. package/dist/types/core/agents/acp/client.d.ts +12 -3
  23. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  24. package/dist/types/core/agents/acp/mappings.d.ts +8 -2
  25. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  26. package/dist/types/core/agents/base.d.ts +22 -8
  27. package/dist/types/core/agents/base.d.ts.map +1 -1
  28. package/dist/types/core/agents/claude-code/adapter.d.ts +7 -0
  29. package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -1
  30. package/dist/types/core/agents/claude-code/approvals.d.ts +4 -1
  31. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
  32. package/dist/types/core/agents/claude-code/claude-agent.d.ts +16 -5
  33. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  34. package/dist/types/core/agents/claude-code/events.d.ts +9 -1
  35. package/dist/types/core/agents/claude-code/events.d.ts.map +1 -1
  36. package/dist/types/core/agents/claude-code/login.d.ts +4 -1
  37. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  38. package/dist/types/core/agents/claude-code/mcp.d.ts +21 -7
  39. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
  40. package/dist/types/core/agents/claude-code/models.d.ts +5 -1
  41. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
  42. package/dist/types/core/agents/claude-code/options.d.ts +10 -4
  43. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  44. package/dist/types/core/agents/claude-code/outcome.d.ts +3 -5
  45. package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -1
  46. package/dist/types/core/agents/claude-code/results.d.ts +16 -0
  47. package/dist/types/core/agents/claude-code/results.d.ts.map +1 -0
  48. package/dist/types/core/agents/claude-code/sdk-pair.d.ts +13 -0
  49. package/dist/types/core/agents/claude-code/sdk-pair.d.ts.map +1 -0
  50. package/dist/types/core/agents/claude-code/session.d.ts +50 -12
  51. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  52. package/dist/types/core/agents/claude-code/spend.d.ts +2 -1
  53. package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -1
  54. package/dist/types/core/agents/claude-code/tools.d.ts +26 -3
  55. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
  56. package/dist/types/core/agents/codex-app-server/adapter.d.ts +2 -2
  57. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
  58. package/dist/types/core/agents/codex-app-server/client.d.ts +21 -2
  59. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  60. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +61 -14
  61. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
  62. package/dist/types/core/agents/codex-app-server/commands.d.ts +2 -2
  63. package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -1
  64. package/dist/types/core/agents/codex-app-server/credentials.d.ts +5 -1
  65. package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -1
  66. package/dist/types/core/agents/codex-app-server/effort.d.ts +2 -1
  67. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
  68. package/dist/types/core/agents/codex-app-server/homes.d.ts +26 -5
  69. package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -1
  70. package/dist/types/core/agents/codex-app-server/items.d.ts +27 -2
  71. package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -1
  72. package/dist/types/core/agents/codex-app-server/login.d.ts +4 -1
  73. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  74. package/dist/types/core/agents/codex-app-server/mcp.d.ts +45 -20
  75. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
  76. package/dist/types/core/agents/codex-app-server/models.d.ts +3 -10
  77. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
  78. package/dist/types/core/agents/codex-app-server/options.d.ts +32 -5
  79. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
  80. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +2 -1
  81. package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -1
  82. package/dist/types/core/agents/codex-app-server/protocol.d.ts +16 -3
  83. package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -1
  84. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
  85. package/dist/types/core/agents/codex-app-server/session.d.ts +70 -33
  86. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
  87. package/dist/types/core/agents/codex-app-server/subagents.d.ts +9 -4
  88. package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -1
  89. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +3 -2
  90. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
  91. package/dist/types/core/agents/codex-app-server/turn-items.d.ts +2 -1
  92. package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -1
  93. package/dist/types/core/agents/codex-app-server/turn.d.ts +37 -8
  94. package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -1
  95. package/dist/types/core/agents/codex-app-server/user-login.d.ts +28 -0
  96. package/dist/types/core/agents/codex-app-server/user-login.d.ts.map +1 -0
  97. package/dist/types/core/agents/credentials.d.ts +3 -1
  98. package/dist/types/core/agents/credentials.d.ts.map +1 -1
  99. package/dist/types/core/agents/diffs.d.ts +9 -0
  100. package/dist/types/core/agents/diffs.d.ts.map +1 -0
  101. package/dist/types/core/agents/elicitation.d.ts +3 -2
  102. package/dist/types/core/agents/elicitation.d.ts.map +1 -1
  103. package/dist/types/core/agents/login.d.ts +6 -0
  104. package/dist/types/core/agents/login.d.ts.map +1 -1
  105. package/dist/types/core/agents/mcp-config.d.ts +0 -4
  106. package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
  107. package/dist/types/core/agents/plan.d.ts +2 -13
  108. package/dist/types/core/agents/plan.d.ts.map +1 -1
  109. package/dist/types/core/agents/process-pool.d.ts +193 -0
  110. package/dist/types/core/agents/process-pool.d.ts.map +1 -0
  111. package/dist/types/core/agents/scripted/adapter.d.ts +68 -0
  112. package/dist/types/core/agents/scripted/adapter.d.ts.map +1 -0
  113. package/dist/types/core/agents/scripted/mcp-call.d.ts +56 -0
  114. package/dist/types/core/agents/scripted/mcp-call.d.ts.map +1 -0
  115. package/dist/types/core/agents/scripted/scripted-agent.d.ts +73 -0
  116. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -0
  117. package/dist/types/core/agents/scripted/scripts.d.ts +29 -0
  118. package/dist/types/core/agents/scripted/scripts.d.ts.map +1 -0
  119. package/dist/types/core/agents/scripted/steps.d.ts +132 -0
  120. package/dist/types/core/agents/scripted/steps.d.ts.map +1 -0
  121. package/dist/types/core/agents/session-agent.d.ts +49 -6
  122. package/dist/types/core/agents/session-agent.d.ts.map +1 -1
  123. package/dist/types/core/diagnostics.d.ts +4 -1
  124. package/dist/types/core/diagnostics.d.ts.map +1 -1
  125. package/dist/types/core/index.d.ts +6 -1
  126. package/dist/types/core/index.d.ts.map +1 -1
  127. package/dist/types/core/presets.d.ts +32 -6
  128. package/dist/types/core/presets.d.ts.map +1 -1
  129. package/dist/types/core/processes/lifeline.d.ts +0 -20
  130. package/dist/types/core/processes/lifeline.d.ts.map +1 -1
  131. package/dist/types/core/provision/index.d.ts +2 -2
  132. package/dist/types/core/provision/index.d.ts.map +1 -1
  133. package/dist/types/core/provision/install-build.d.ts +2 -1
  134. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  135. package/dist/types/core/provision/npm.d.ts +20 -8
  136. package/dist/types/core/provision/npm.d.ts.map +1 -1
  137. package/dist/types/core/provision/provisioner.d.ts +4 -1
  138. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  139. package/dist/types/core/provision/tools.d.ts +2 -1
  140. package/dist/types/core/provision/tools.d.ts.map +1 -1
  141. package/dist/types/core/runtime/agent-runtime.d.ts +18 -9
  142. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  143. package/dist/types/core/runtime/event-processor.d.ts +5 -1
  144. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  145. package/dist/types/core/runtime/harness-clis.d.ts +9 -0
  146. package/dist/types/core/runtime/harness-clis.d.ts.map +1 -1
  147. package/dist/types/core/runtime/harness-logins.d.ts +33 -5
  148. package/dist/types/core/runtime/harness-logins.d.ts.map +1 -1
  149. package/dist/types/core/runtime/model-lists.d.ts +2 -0
  150. package/dist/types/core/runtime/model-lists.d.ts.map +1 -1
  151. package/dist/types/core/runtime/permission-policy.d.ts +5 -3
  152. package/dist/types/core/runtime/permission-policy.d.ts.map +1 -1
  153. package/dist/types/core/runtime/request-broker.d.ts +2 -1
  154. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  155. package/dist/types/core/runtime/turn.d.ts +14 -1
  156. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  157. package/dist/types/core/utils/deadline.d.ts +6 -0
  158. package/dist/types/core/utils/deadline.d.ts.map +1 -1
  159. package/dist/types/core/utils/errors.d.ts +15 -1
  160. package/dist/types/core/utils/errors.d.ts.map +1 -1
  161. package/dist/types/operator/index.d.ts +11 -0
  162. package/dist/types/operator/index.d.ts.map +1 -0
  163. package/dist/types/operator/mcp.d.ts +33 -0
  164. package/dist/types/operator/mcp.d.ts.map +1 -0
  165. package/dist/types/operator/operator.d.ts +206 -0
  166. package/dist/types/operator/operator.d.ts.map +1 -0
  167. package/dist/types/operator/render.d.ts +89 -0
  168. package/dist/types/operator/render.d.ts.map +1 -0
  169. package/dist/types/operator/view.d.ts +44 -0
  170. package/dist/types/operator/view.d.ts.map +1 -0
  171. package/dist/types/protocol/auth.d.ts +54 -24
  172. package/dist/types/protocol/auth.d.ts.map +1 -1
  173. package/dist/types/protocol/clis.d.ts +14 -7
  174. package/dist/types/protocol/clis.d.ts.map +1 -1
  175. package/dist/types/protocol/config.d.ts +2 -0
  176. package/dist/types/protocol/config.d.ts.map +1 -1
  177. package/dist/types/protocol/conversation.d.ts +40 -3
  178. package/dist/types/protocol/conversation.d.ts.map +1 -1
  179. package/dist/types/protocol/credentials.d.ts +7 -0
  180. package/dist/types/protocol/credentials.d.ts.map +1 -1
  181. package/dist/types/protocol/execution.d.ts +2 -1
  182. package/dist/types/protocol/execution.d.ts.map +1 -1
  183. package/dist/types/protocol/factories.d.ts +12 -2
  184. package/dist/types/protocol/factories.d.ts.map +1 -1
  185. package/dist/types/protocol/harness.d.ts +6 -2
  186. package/dist/types/protocol/harness.d.ts.map +1 -1
  187. package/dist/types/protocol/history.d.ts +19 -0
  188. package/dist/types/protocol/history.d.ts.map +1 -1
  189. package/dist/types/protocol/lifecycle.d.ts +47 -8
  190. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  191. package/dist/types/protocol/model-catalog.d.ts.map +1 -1
  192. package/dist/types/protocol/models.d.ts +3 -0
  193. package/dist/types/protocol/models.d.ts.map +1 -1
  194. package/dist/types/protocol/parts.d.ts +14 -0
  195. package/dist/types/protocol/parts.d.ts.map +1 -1
  196. package/dist/types/protocol/plan.d.ts +20 -0
  197. package/dist/types/protocol/plan.d.ts.map +1 -0
  198. package/dist/types/protocol/tool-state.d.ts +12 -0
  199. package/dist/types/protocol/tool-state.d.ts.map +1 -1
  200. package/dist/types/protocol/wire-api.d.ts +129 -23
  201. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  202. package/dist/types/protocol/wire.d.ts +70 -10
  203. package/dist/types/protocol/wire.d.ts.map +1 -1
  204. package/dist/types/server/acp/binding.d.ts +6 -1
  205. package/dist/types/server/acp/binding.d.ts.map +1 -1
  206. package/dist/types/server/acp/translate.d.ts +33 -7
  207. package/dist/types/server/acp/translate.d.ts.map +1 -1
  208. package/dist/types/server/agent-server.d.ts +6 -0
  209. package/dist/types/server/agent-server.d.ts.map +1 -1
  210. package/dist/types/server/feedback.d.ts +2 -1
  211. package/dist/types/server/feedback.d.ts.map +1 -1
  212. package/dist/types/server/install.d.ts +11 -0
  213. package/dist/types/server/install.d.ts.map +1 -1
  214. package/dist/types/server/session-gate.d.ts +2 -1
  215. package/dist/types/server/session-gate.d.ts.map +1 -1
  216. package/dist/types/server/session-store.d.ts +1 -0
  217. package/dist/types/server/session-store.d.ts.map +1 -1
  218. package/dist/types/server/subscriptions.d.ts +2 -1
  219. package/dist/types/server/subscriptions.d.ts.map +1 -1
  220. package/dist/types/server/transports.d.ts.map +1 -1
  221. package/dist/types/sync/fit.d.ts +8 -7
  222. package/dist/types/sync/fit.d.ts.map +1 -1
  223. package/dist/types/sync/history-sqlite.d.ts.map +1 -1
  224. package/dist/types/sync/index.d.ts +1 -0
  225. package/dist/types/sync/index.d.ts.map +1 -1
  226. package/dist/types/sync/journal-sqlite.d.ts +2 -1
  227. package/dist/types/sync/journal-sqlite.d.ts.map +1 -1
  228. package/dist/types/sync/journal.d.ts +11 -3
  229. package/dist/types/sync/journal.d.ts.map +1 -1
  230. package/dist/types/sync/projection.d.ts +6 -0
  231. package/dist/types/sync/projection.d.ts.map +1 -1
  232. package/dist/types/sync/recovery.d.ts +2 -1
  233. package/dist/types/sync/recovery.d.ts.map +1 -1
  234. package/dist/types/sync/schema.d.ts +10 -0
  235. package/dist/types/sync/schema.d.ts.map +1 -1
  236. package/dist/types/sync/sql.d.ts +2 -1
  237. package/dist/types/sync/sql.d.ts.map +1 -1
  238. package/dist/types/sync/worker.d.ts.map +1 -1
  239. package/docs/consuming.md +464 -40
  240. package/docs/deploy.md +36 -8
  241. package/docs/durable-sessions.md +35 -5
  242. package/docs/harnesses.md +396 -30
  243. package/package.json +11 -1
  244. package/src/accounts/chatgpt.ts +2 -2
  245. package/src/accounts/http.ts +2 -16
  246. package/src/client/client.ts +92 -31
  247. package/src/client/connection.ts +113 -22
  248. package/src/client/index.ts +1 -0
  249. package/src/client/logins.ts +24 -15
  250. package/src/client/streams.ts +12 -4
  251. package/src/client/turns.ts +1 -1
  252. package/src/core/agents/acp/acp-agent.ts +181 -52
  253. package/src/core/agents/acp/adapter.ts +9 -1
  254. package/src/core/agents/acp/client.ts +16 -4
  255. package/src/core/agents/acp/mappings.ts +27 -0
  256. package/src/core/agents/base.ts +25 -10
  257. package/src/core/agents/claude-code/adapter.ts +47 -17
  258. package/src/core/agents/claude-code/approvals.ts +6 -5
  259. package/src/core/agents/claude-code/claude-agent.ts +60 -30
  260. package/src/core/agents/claude-code/events.ts +11 -1
  261. package/src/core/agents/claude-code/login.ts +14 -2
  262. package/src/core/agents/claude-code/mcp.ts +31 -15
  263. package/src/core/agents/claude-code/models.ts +7 -2
  264. package/src/core/agents/claude-code/options.ts +11 -3
  265. package/src/core/agents/claude-code/outcome.ts +10 -2
  266. package/src/core/agents/claude-code/results.ts +73 -0
  267. package/src/core/agents/claude-code/sdk-pair.ts +66 -0
  268. package/src/core/agents/claude-code/session.ts +166 -37
  269. package/src/core/agents/claude-code/spend.ts +1 -1
  270. package/src/core/agents/claude-code/tools.ts +108 -12
  271. package/src/core/agents/codex-app-server/adapter.ts +37 -12
  272. package/src/core/agents/codex-app-server/client.ts +69 -10
  273. package/src/core/agents/codex-app-server/codex-agent.ts +141 -55
  274. package/src/core/agents/codex-app-server/commands.ts +2 -2
  275. package/src/core/agents/codex-app-server/credentials.ts +10 -5
  276. package/src/core/agents/codex-app-server/effort.ts +1 -1
  277. package/src/core/agents/codex-app-server/homes.ts +59 -10
  278. package/src/core/agents/codex-app-server/items.ts +219 -31
  279. package/src/core/agents/codex-app-server/login.ts +14 -2
  280. package/src/core/agents/codex-app-server/mcp.ts +142 -26
  281. package/src/core/agents/codex-app-server/models.ts +9 -8
  282. package/src/core/agents/codex-app-server/options.ts +79 -11
  283. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  284. package/src/core/agents/codex-app-server/protocol.ts +14 -4
  285. package/src/core/agents/codex-app-server/requests.ts +14 -6
  286. package/src/core/agents/codex-app-server/session.ts +156 -81
  287. package/src/core/agents/codex-app-server/subagents.ts +21 -14
  288. package/src/core/agents/codex-app-server/thread-settings.ts +18 -8
  289. package/src/core/agents/codex-app-server/turn-items.ts +1 -1
  290. package/src/core/agents/codex-app-server/turn.ts +96 -35
  291. package/src/core/agents/codex-app-server/user-login.ts +107 -0
  292. package/src/core/agents/credentials.ts +5 -2
  293. package/src/core/agents/diffs.ts +25 -0
  294. package/src/core/agents/elicitation.ts +2 -2
  295. package/src/core/agents/login.ts +6 -0
  296. package/src/core/agents/mcp-config.ts +2 -2
  297. package/src/core/agents/plan.ts +3 -19
  298. package/src/core/agents/process-pool.ts +432 -0
  299. package/src/core/agents/scripted/adapter.ts +142 -0
  300. package/src/core/agents/scripted/mcp-call.ts +134 -0
  301. package/src/core/agents/scripted/scripted-agent.ts +418 -0
  302. package/src/core/agents/scripted/scripts.ts +171 -0
  303. package/src/core/agents/scripted/steps.ts +127 -0
  304. package/src/core/agents/session-agent.ts +105 -8
  305. package/src/core/diagnostics.ts +9 -1
  306. package/src/core/index.ts +12 -0
  307. package/src/core/presets.ts +99 -14
  308. package/src/core/processes/lifeline.ts +99 -25
  309. package/src/core/provision/index.ts +1 -2
  310. package/src/core/provision/install-build.ts +4 -1
  311. package/src/core/provision/npm.ts +309 -97
  312. package/src/core/provision/provisioner.ts +22 -8
  313. package/src/core/provision/tools.ts +44 -19
  314. package/src/core/runtime/agent-runtime.ts +70 -34
  315. package/src/core/runtime/event-processor.ts +18 -2
  316. package/src/core/runtime/harness-clis.ts +36 -1
  317. package/src/core/runtime/harness-logins.ts +82 -31
  318. package/src/core/runtime/model-lists.ts +1 -1
  319. package/src/core/runtime/permission-policy.ts +4 -3
  320. package/src/core/runtime/request-broker.ts +1 -1
  321. package/src/core/runtime/turn.ts +53 -3
  322. package/src/core/utils/deadline.ts +23 -0
  323. package/src/core/utils/errors.ts +24 -4
  324. package/src/operator/index.ts +40 -0
  325. package/src/operator/mcp.ts +171 -0
  326. package/src/operator/operator.ts +782 -0
  327. package/src/operator/render.ts +473 -0
  328. package/src/operator/view.ts +82 -0
  329. package/src/protocol/auth.ts +30 -23
  330. package/src/protocol/clis.ts +12 -4
  331. package/src/protocol/credentials.ts +19 -0
  332. package/src/protocol/execution.ts +5 -0
  333. package/src/protocol/factories.ts +25 -3
  334. package/src/protocol/harness.ts +11 -1
  335. package/src/protocol/history.ts +20 -0
  336. package/src/protocol/lifecycle.ts +10 -1
  337. package/src/protocol/model-catalog.ts +19 -8
  338. package/src/protocol/parts.ts +12 -1
  339. package/src/protocol/plan.ts +35 -0
  340. package/src/protocol/tool-state.ts +14 -1
  341. package/src/protocol/wire.ts +14 -0
  342. package/src/server/acp/binding.ts +113 -22
  343. package/src/server/acp/translate.ts +161 -8
  344. package/src/server/agent-server.ts +10 -1
  345. package/src/server/bin.ts +83 -9
  346. package/src/server/feedback.ts +1 -1
  347. package/src/server/install.ts +82 -4
  348. package/src/server/session-gate.ts +1 -1
  349. package/src/server/session-store.ts +5 -1
  350. package/src/server/subscriptions.ts +1 -1
  351. package/src/server/transports.ts +14 -0
  352. package/src/sync/fit.ts +115 -28
  353. package/src/sync/history-sqlite.ts +6 -2
  354. package/src/sync/index.ts +1 -0
  355. package/src/sync/journal-sqlite.ts +20 -2
  356. package/src/sync/journal.ts +10 -2
  357. package/src/sync/projection.ts +10 -0
  358. package/src/sync/recovery.ts +11 -4
  359. package/src/sync/schema.ts +7 -5
  360. package/src/sync/sql.ts +1 -1
  361. package/src/sync/worker.ts +4 -0
  362. package/dist/types/core/agents/claude-code/session-pool.d.ts +0 -36
  363. package/dist/types/core/agents/claude-code/session-pool.d.ts.map +0 -1
  364. package/dist/types/core/agents/session-pool.d.ts +0 -41
  365. package/dist/types/core/agents/session-pool.d.ts.map +0 -1
  366. package/src/core/agents/claude-code/session-pool.ts +0 -136
  367. package/src/core/agents/session-pool.ts +0 -111
@@ -25,11 +25,21 @@ export interface CodexConnection {
25
25
  onClose(handler: (error?: Error) => void): () => void;
26
26
  /** End the app-server now. Nothing confirms that what it ran stopped. */
27
27
  close(): void;
28
- /** End the app-server by its own shutdown: whether that confirmed its threads and tools stopped. */
28
+ /**
29
+ * End the app-server by its own shutdown: whether that confirmed its
30
+ * threads and tools stopped. It is stopped after `timeoutMs`
31
+ * (`SHUTDOWN_TIMEOUT_MS` by default) and given as long again to exit.
32
+ */
29
33
  closeAndWait(timeoutMs?: number): Promise<boolean>;
34
+ /**
35
+ * Settles once an app-server that was ended has exited, or could not be
36
+ * made to: Codex lets one process write a thread, so another resumes it
37
+ * after this. A connection without it has nothing to wait for.
38
+ */
39
+ gone?(): Promise<void>;
30
40
  }
31
41
  /** How far `pages` reads a list. */
32
- export interface PageLimits {
42
+ interface PageLimits {
33
43
  /** Each page's deadline. */
34
44
  timeoutMs?: number;
35
45
  /** Past this many pages the list did not end. */
@@ -59,6 +69,12 @@ export interface CodexAppServerClientOptions {
59
69
  * it would replace that home's own login.
60
70
  */
61
71
  ephemeralCredentials?: boolean;
72
+ /**
73
+ * Start with Codex's plugins off (`-c features.plugins=false`): set on the
74
+ * command line because a fresh `CODEX_HOME` clones the plugin catalogue
75
+ * as the process starts, before any thread's config is read.
76
+ */
77
+ pluginsOff?: boolean;
62
78
  startupTimeoutMs?: number;
63
79
  /** Default deadline for every JSON-RPC request. */
64
80
  requestTimeoutMs?: number;
@@ -92,6 +108,8 @@ export declare class CodexAppServerClient implements CodexConnection {
92
108
  private exited;
93
109
  private lastExit?;
94
110
  private nativeShutdownFailed;
111
+ /** The app-server's exit, or the end of a stop that could not end it. */
112
+ private leaving?;
95
113
  constructor(opts: CodexAppServerClientOptions);
96
114
  onNotification(handler: NotificationHandler): () => void;
97
115
  setRequestHandler(handler: ServerRequestHandler | undefined): void;
@@ -101,6 +119,7 @@ export declare class CodexAppServerClient implements CodexConnection {
101
119
  initialize(): Promise<void>;
102
120
  request(method: string, params: unknown, timeoutMs?: number): Promise<unknown>;
103
121
  close(): void;
122
+ gone(): Promise<void>;
104
123
  /** EOF invokes native thread/tool cleanup. Killing the server alone proves nothing about workers. */
105
124
  closeAndWait(timeoutMs?: number): Promise<boolean>;
106
125
  /** Every request still waiting for its answer fails, with the error `why` gives it. */
@@ -1 +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,MAA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rC,yEAAyE;IACzE,OAAO,CAAC,OAAO,CAAC,CAAmB;gBAEN,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,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrB,qGAAqG;IACrG,YAAY,CAAC,SAAS,SAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IA6C/D,uFAAuF;IACvF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,KAAK;IAoDb,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,aAAa;IA4CrB,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,KAAK;CAGb"}
@@ -1,25 +1,31 @@
1
1
  import type { AgentInput, ModelDescriptor } from "../../../protocol/index.ts";
2
2
  import { type NativeProcesses } from "../../processes/native-processes.ts";
3
- import type { AgentExecuteOptions, CancelResult, ListModelsOptions, RawAgentEvent } from "../base.ts";
3
+ import type { AgentExecuteOptions, ListModelsOptions, RawAgentEvent } from "../base.ts";
4
4
  import type { CredentialSource } from "../credentials.ts";
5
5
  import type { InheritConfig } from "../inherit-config.ts";
6
6
  import { SessionAgent } from "../session-agent.ts";
7
7
  import { type CodexAppServerClientOptions, type CodexConnection } from "./client.ts";
8
8
  import { CodexCliLogin } from "./login.ts";
9
+ import { type CodexBuiltInTools } from "./options.ts";
9
10
  export interface CodexAppServerAgentOptions {
10
11
  /** Make the connection to `codex app-server` (a test's fake); a `CodexAppServerClient` by default. */
11
12
  createClient?: (options: CodexAppServerClientOptions) => CodexConnection;
13
+ /** Idle time before a session's app-server is ended (5 minutes by default); 0 never ends one for idleness. */
12
14
  idleTimeoutMs?: number;
13
15
  /** Fail a turn if the app-server goes silent this long after a retryable error. */
14
16
  retryStallTimeoutMs?: number;
15
17
  /**
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.
18
+ * How long a cancel waits for Codex to confirm its turn stopped before it
19
+ * answers `confirmed: false` (`CANCEL_CONFIRM_MS`, 2 s, by default), and
20
+ * how long a failed turn waits for Codex to say it ended before its process
21
+ * is ended.
22
+ */
23
+ cancelConfirmMs?: number;
24
+ /**
25
+ * How long after a cancel Codex's process is ended when its turn has not
26
+ * stopped (2 s by default): its `turn/interrupt` unanswered, or the
27
+ * commands the turn started not confirmed stopped, which Codex's own
28
+ * shutdown then stops.
23
29
  */
24
30
  cancelGraceMs?: number;
25
31
  /**
@@ -44,7 +50,9 @@ export interface CodexAppServerAgentOptions {
44
50
  processes?: NativeProcesses;
45
51
  /**
46
52
  * 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`
53
+ * turn runs in the `CODEX_HOME` it names, else the process's, which the
54
+ * engine never writes: there a turn's MCP servers go in its thread's own
55
+ * config (D21). At `project`
48
56
  * every turn must name a home of its session's own (absolute, not the
49
57
  * shared one, one session to a home): the user's configuration stays out,
50
58
  * the repository's `AGENTS.md` and skills load. `none` also keeps the
@@ -52,6 +60,30 @@ export interface CodexAppServerAgentOptions {
52
60
  * the repository's skills and `~/.agents/skills` at every level.
53
61
  */
54
62
  inheritConfig?: InheritConfig;
63
+ /**
64
+ * Codex's own tools the model gets, each on unless set `false` (LLP 0017):
65
+ * `local` its shell, `apply_patch`, `view_image` and `write_stdin`, so
66
+ * that nothing it runs reads or writes the disk; `webSearch`; and
67
+ * `imageGeneration`, whose pictures come as an `image_generation` tool
68
+ * part, saying where Codex saved each, when it is on. `local: false` holds
69
+ * for the sub-agents Codex spawns too. A product whose agent works only
70
+ * through its own MCP tools turns all three off. Code mode's `exec`, its
71
+ * sub-agent tools and questions stay: `disableTools` is still refused.
72
+ * Operator-level only.
73
+ */
74
+ builtInTools?: CodexBuiltInTools;
75
+ /**
76
+ * A turn that names a `CODEX_HOME` of its session's own (every turn below
77
+ * `inheritConfig: "all"` does) runs on the user's own Codex login: the one
78
+ * of the engine's own Codex home (`$CODEX_HOME`, else `~/.codex`), read
79
+ * from Codex before each turn and held in the session's process's memory,
80
+ * never written to the session's home (LLP 0017). A product's
81
+ * `credentials` and the turn's `apiKey` come first; with no login there
82
+ * the turn fails (`auth`) before its process starts. A product reads
83
+ * that login's status and signs it in with no `env` (`auth/*`). Off by
84
+ * default. Operator-level only.
85
+ */
86
+ userLogin?: boolean;
55
87
  }
56
88
  /**
57
89
  * Codex harness backed by a long-lived `codex app-server` subprocess speaking
@@ -74,18 +106,29 @@ export declare class CodexAppServerAgent extends SessionAgent {
74
106
  rejectionMessages: boolean;
75
107
  turnScopedSubagents?: boolean | undefined;
76
108
  steering?: boolean | undefined;
109
+ ignoredSettings?: string[] | undefined;
77
110
  };
78
111
  /** Its CLIs start here: the runtime's, or this OS process's own when it was made without one. */
79
112
  readonly processes: NativeProcesses;
80
113
  private readonly timing;
81
114
  private readonly sessions;
82
- /** A cancel's acknowledgement belongs to one invocation, even after it drains. */
83
- private readonly turns;
84
115
  readonly login: CodexCliLogin;
116
+ /**
117
+ * The user's own login (`userLogin`), read from an app-server with the
118
+ * engine's own environment: never a session's `CODEX_HOME`.
119
+ */
120
+ private readonly readUserLogin;
85
121
  constructor(agentOptions?: CodexAppServerAgentOptions);
86
122
  /** On a product's credentials, each session may list as a different account. */
87
123
  get modelsPerSession(): boolean;
88
124
  protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<RawAgentEvent>;
125
+ /**
126
+ * The user's own login, for a turn (or a model list) whose `env` names a
127
+ * home, when the operator set `userLogin`: read again for each, so a login
128
+ * the user changed is the next turn's. None otherwise: a turn that names
129
+ * no home runs on its home's own login.
130
+ */
131
+ private userLoginFor;
89
132
  /** How the turn stops: by Codex's interrupt, or, managed, with its native cleanup. */
90
133
  private stopFor;
91
134
  protected checkSteerInput(input: AgentInput): void;
@@ -96,13 +139,17 @@ export declare class CodexAppServerAgent extends SessionAgent {
96
139
  * with the account the product's `credentials` hold for that session.
97
140
  */
98
141
  listModels(options: ListModelsOptions): Promise<ModelDescriptor[]>;
99
- cancel(sessionId: string): Promise<CancelResult>;
142
+ /** With no turn running, a managed session's process not yet confirmed stopped. */
143
+ protected stopWithoutTurn(sessionId: string): Promise<boolean> | undefined;
100
144
  /** Unchanged MCP config reloads retain dead remote connections after VM resume. */
101
145
  invalidateMcpConnections(): void;
102
- loginChanged(): void;
146
+ loginChanged(store?: string): void;
103
147
  release(sessionId: string): Promise<void>;
104
148
  terminateAll(): Promise<void>;
105
- /** The CLI to run: the provisioner's, else `$CODEX_CLI_PATH`; PATH's `codex` when neither. */
149
+ /**
150
+ * The CLI to run: the provisioner's, else `$CODEX_CLI_PATH`; PATH's `codex`
151
+ * when neither. A turn waits for it until the turn is cancelled.
152
+ */
106
153
  private cliPath;
107
154
  /**
108
155
  * A connection to a new `codex app-server` for a folder, its `env` and a
@@ -1 +1 @@
1
- {"version":3,"file":"codex-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/codex-agent.ts"],"names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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,QAAQ,CAAC,KAAK,gBAIX;IACH;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE5B;gBAE2B,YAAY,GAAE,0BAA+B;IA4B1E,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;IAuFvC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAOpB,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;IA0BxE,mFAAmF;cAChE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS;IAInF,mFAAmF;IACnF,wBAAwB,IAAI,IAAI;IAIhC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAInB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5C;;;OAGG;YACW,OAAO;IAOrB;;;OAGG;YACW,OAAO;CA4BrB"}
@@ -17,7 +17,7 @@ export declare function listBackgroundTerminals(client: Pick<CodexConnection, "r
17
17
  export declare class TurnCommands {
18
18
  private readonly client;
19
19
  private readonly threadId;
20
- /** How long a stop has to confirm the commands stopped (`cancelGraceMs`). */
20
+ /** How long the commands have to stop before Codex's own shutdown stops them (`cancelGraceMs`). */
21
21
  private readonly timeoutMs;
22
22
  private readonly commands;
23
23
  /** Completions that came after Codex's turn ended, which its events no longer take. */
@@ -26,7 +26,7 @@ export declare class TurnCommands {
26
26
  private interrupting;
27
27
  private stopping?;
28
28
  constructor(client: CodexConnection, threadId: string,
29
- /** How long a stop has to confirm the commands stopped (`cancelGraceMs`). */
29
+ /** How long the commands have to stop before Codex's own shutdown stops them (`cancelGraceMs`). */
30
30
  timeoutMs: number);
31
31
  /** Note an item Codex started: a command the turn owns, unless it is another's. */
32
32
  started(item: CodexItem | undefined): void;
@@ -1 +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,O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PT access token kept in the
26
26
  * app-server's memory, which asks the product again (with the token it
27
27
  * refused) when it needs a fresher one; without one, the turn's own `apiKey`;
28
- * without that, the CLI's own login.
28
+ * without that, the user's own login (`userLogin`, given for a turn that
29
+ * names a home of its session's own when the operator set it); without
30
+ * that, the CLI's own login.
29
31
  */
30
32
  export declare function authFor(ask: {
31
33
  credentials: CredentialSource | undefined;
@@ -33,6 +35,8 @@ export declare function authFor(ask: {
33
35
  sessionId: string | undefined;
34
36
  turnId?: string;
35
37
  apiKey: string | undefined;
38
+ /** The user's own login, read from Codex (`user-login.ts`); it throws when there is none. */
39
+ userLogin?: (signal?: AbortSignal) => Promise<CodexAuth>;
36
40
  signal?: AbortSignal;
37
41
  }): Promise<CodexAuth | undefined>;
38
42
  /** Who a process is logged in as: an account or key change needs a new process. */
@@ -1 +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"}
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;;;;;;;;GAQG;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,6FAA6F;IAC7F,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAyBjC;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"}
@@ -1,6 +1,6 @@
1
1
  import { type ThinkingLevel } from "../../../protocol/index.ts";
2
2
  /** Codex reasoning-effort string for a level (matches the `ReasoningEffort` enum). */
3
- export type CodexReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
3
+ type CodexReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
4
4
  /**
5
5
  * The effort Codex runs for `level`. `supported` is what the model accepts, in
6
6
  * this vocabulary, where `off` stands for its least effort: `offEffort`, the
@@ -9,4 +9,5 @@ export type CodexReasoningEffort = "none" | "minimal" | "low" | "medium" | "high
9
9
  * pinned CLI lists accepts `none` or `minimal`, and every one accepts `low`.
10
10
  */
11
11
  export declare function codexReasoningEffort<Off extends "none" | "minimal" = "minimal">(level: ThinkingLevel, supported?: readonly ThinkingLevel[], offEffort?: Off): Exclude<CodexReasoningEffort, "none" | "minimal"> | Off;
12
+ export {};
12
13
  //# sourceMappingURL=effort.d.ts.map
@@ -1 +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"}
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,KAAK,oBAAoB,GACtB,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"}
@@ -3,18 +3,39 @@ import type { InheritConfig } from "../inherit-config.ts";
3
3
  /**
4
4
  * Which logical session owns each `CODEX_HOME` its turns name. A turn that
5
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.
6
+ * through process eviction and failed preparation: one session to a home,
7
+ * since the engine writes the turn's MCP servers there. Below
8
+ * `inheritConfig: "all"` every turn must name one: the user's own home holds
9
+ * the user's configuration. At `all` a turn that names none runs in the
10
+ * process's, the user's own, which is never claimed, nor written to: its
11
+ * MCP servers go in its thread's config instead (`mcp.ts`).
10
12
  */
11
13
  export declare class CodexHomes {
12
14
  private readonly level;
13
15
  private readonly owners;
14
16
  constructor(level?: InheritConfig);
15
17
  /** Whether the turn runs in a home of its session's own, which it claims. */
16
- claim(options: AgentExecuteOptions, hasServers: boolean): boolean;
18
+ claim(options: AgentExecuteOptions): boolean;
17
19
  release(sessionId: string): void;
18
20
  clear(): void;
19
21
  }
22
+ /**
23
+ * Which folder a `CODEX_HOME` is now (its device and inode), `"gone"` when
24
+ * there is none; nothing when the turn names no home. A process keeps the
25
+ * files it opened in the home it started in, so a home removed or replaced
26
+ * under it is another home: the conversation it writes is in deleted files,
27
+ * and the `config.toml` it reads is not the one there. The comparison holds
28
+ * only while the session holds its home open (`holdHome`): on ext4 a removed
29
+ * folder's inode number goes to the next folder made, at once, unless a
30
+ * handle on the old one is open (measured under Node 22 and Bun 1.3.14), so
31
+ * `rm -rf home; mkdir home` would otherwise read as the same folder.
32
+ */
33
+ export declare function homeIdentity(home: string | undefined): string | undefined;
34
+ /**
35
+ * Hold the folder a `CODEX_HOME` is now open, keeping its inode number its
36
+ * own (`homeIdentity`), until the answer is called; calling it again does
37
+ * nothing. A turn that names no home, or a home that cannot be opened (no
38
+ * folder, a platform that does not open directories), holds nothing.
39
+ */
40
+ export declare function holdHome(home: string | undefined): () => void;
20
41
  //# sourceMappingURL=homes.d.ts.map
@@ -1 +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"}
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;;;;;;;;;GASG;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,GAAG,OAAO;IAwC5C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIhC,KAAK,IAAI,IAAI;CAGb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAQzE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,IAAI,CAa7D"}
@@ -1,11 +1,12 @@
1
- import type { ToolMeta } from "../../../protocol/index.ts";
2
- import type { CodexItem } from "./protocol.ts";
1
+ import type { ToolLocation, ToolMeta, ToolResultContent } from "../../../protocol/index.ts";
2
+ import type { CodexFileChange, CodexItem } from "./protocol.ts";
3
3
  /** Codex tools are already normalized names; kinds are fixed per item type. */
4
4
  export declare const CODEX_TOOL_KINDS: {
5
5
  readonly shell: "execute";
6
6
  readonly apply_patch: "edit";
7
7
  readonly web_search: "fetch";
8
8
  readonly mcp: "other";
9
+ readonly image_generation: "other";
9
10
  /** The plan Codex proposes in Plan mode, put to the user like Claude's ExitPlanMode. */
10
11
  readonly plan: "switch_mode";
11
12
  };
@@ -17,12 +18,36 @@ export declare const CODEX_TOOL_KINDS: {
17
18
  export interface CodexToolDescriptor {
18
19
  toolName(item: CodexItem): string;
19
20
  input(item: CodexItem): Record<string, unknown>;
21
+ /** Codex says this tool's input only once it is done: its completed item sets it again. */
22
+ inputAtCompletion?: true;
20
23
  meta(item: CodexItem): ToolMeta;
21
24
  result(item: CodexItem): {
22
25
  output: string;
23
26
  isError: boolean;
27
+ content?: ToolResultContent[];
28
+ metadata?: Record<string, unknown>;
24
29
  };
25
30
  }
31
+ /**
32
+ * The line a Codex command runs: Codex wraps it in a shell
33
+ * (`/bin/zsh -lc '<line>'`, quoted as Codex quotes it), and the line is that
34
+ * shell's one argument, unquoted. Codex's `commandActions` are not it: they
35
+ * keep only the pieces Codex recognizes (`cd sub && cat c.txt` is one read of
36
+ * `cat c.txt`) and normalize their quoting. A command of any other shape is
37
+ * as Codex reports it; one that is not a string, nothing.
38
+ */
39
+ export declare function codexCommandLine(command: unknown): string | undefined;
40
+ /**
41
+ * What a file change shows: a `diff` entry per hunk of an update, at the
42
+ * file it leaves (a move's destination); an add's content as `newText`; a
43
+ * delete's as `oldText`, its `newText` empty. Its locations are each hunk's
44
+ * start in the new file, a move's source too, and an add's or a delete's
45
+ * path alone.
46
+ */
47
+ export declare function codexChangeView(changes: CodexFileChange[] | undefined): {
48
+ content: ToolResultContent[];
49
+ locations: ToolLocation[];
50
+ };
26
51
  /**
27
52
  * The descriptor of an item type that is a tool. Its own keys only: an item
28
53
  * typed `constructor` is no tool, whatever the object's prototype holds.
@@ -1 +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"}
1
+ {"version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Method } from "../../../protocol/index.ts";
2
2
  import { type CliLogin, type LoginOptions, type LoginStatus, type NativeLogin } from "../login.ts";
3
3
  import type { CodexConnection } from "./client.ts";
4
- export interface CodexCliLoginOptions {
4
+ interface CodexCliLoginOptions {
5
5
  /**
6
6
  * A new app-server, not yet initialized, for a turn's `env`: its
7
7
  * `CODEX_HOME` is the store a login lands in.
@@ -21,10 +21,13 @@ interface CodexAccountRead {
21
21
  }
22
22
  /** A login as Codex's app-server says it (`account/read`). */
23
23
  export declare function codexLoginStatus(read: CodexAccountRead): LoginStatus;
24
+ /** The login store a turn or a login with this `env` uses: its `CODEX_HOME`, empty when unset. */
25
+ export declare function codexLoginStore(env: Record<string, string> | undefined): string;
24
26
  /** Codex's login, through its app-server: `account/read`, `account/login/start`, `account/logout`. */
25
27
  export declare class CodexCliLogin implements CliLogin {
26
28
  private readonly options;
27
29
  constructor(options: CodexCliLoginOptions);
30
+ store(env: Record<string, string> | undefined): string;
28
31
  /** Initialize a new app-server, run `use` on it, and end it. */
29
32
  private with;
30
33
  methods(options: LoginOptions): Promise<AuthMethod[]>;
@@ -1 +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,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
3
3
  import { type CodexConnection } from "./client.ts";
4
4
  import type { CodexHomes } from "./homes.ts";
5
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
6
  /**
13
7
  * Codex's startup error for a server, readable: its Rust type paths out, a
14
8
  * chain it repeats said once, and no prefix naming the server again.
15
9
  */
16
10
  export declare function codexMcpCause(name: string, error: string): string;
17
11
  /**
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.
12
+ * A turn's MCP servers: as the wire gave them, and as Codex takes them, by
13
+ * where they go. A turn that names a home has them written there
14
+ * (`servers`); one that names none has them in its thread's own config
15
+ * (`thread`), which is fixed when the thread is opened.
23
16
  */
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
17
  export interface CodexTurnMcp {
27
18
  wire: Record<string, McpServerConfig>;
28
- /** Absent when the turn runs in a home the engine does not write. */
19
+ /** For the home the turn names, `{}` when it has none: that home's servers are the turn's. */
29
20
  servers?: Record<string, unknown>;
21
+ /** For the thread's own config: a turn with servers that names no home, which the engine never writes. */
22
+ thread?: Record<string, unknown>;
30
23
  }
31
24
  /** The turn's servers, snapshotted before anything asynchronous can let the caller change them. */
32
25
  export declare function codexTurnMcp(options: AgentExecuteOptions, homes: CodexHomes): CodexTurnMcp;
33
26
  /**
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.
27
+ * Which `mcp_servers` table a thread was opened with (`threadServers`): a
28
+ * turn that needs another runs on the thread opened again in a new process.
29
+ */
30
+ export declare function threadServersFingerprint(table: Record<string, unknown> | undefined): string;
31
+ /**
32
+ * A session's MCP servers on Codex, for one process: the configuration last
33
+ * written to its home, why each server last failed to start, and the ones
34
+ * its turns went without.
37
35
  */
38
36
  export declare class CodexMcpState {
39
37
  private readonly client;
40
38
  private readonly cwd;
41
39
  /** Last native config write; readiness is checked separately before every prompt. */
42
40
  private fingerprint?;
41
+ /** A turn was prepared on this process: the servers its thread carries started when it opened. */
42
+ private prepared;
43
+ /** The last turn's servers did not settle: the next one starts them again. */
44
+ private unsettled;
43
45
  /**
44
46
  * Why each MCP server last failed to start, as Codex said, from the
45
47
  * client's first notification: a fast failure can come before a turn asks.
@@ -50,13 +52,36 @@ export declare class CodexMcpState {
50
52
  constructor(client: CodexConnection, cwd: string);
51
53
  /** Note what Codex says of a server's startup on the session's own thread, not a subagent's. */
52
54
  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
+ * Before the thread opens, and before each turn: servers for the home the
57
+ * turn names are written there, checked as Codex took them, and reloaded
58
+ * when they changed.
59
+ */
60
+ configure({ servers }: CodexTurnMcp): Promise<void>;
61
+ /**
62
+ * The `mcp_servers` table the thread carries, for a turn that names no
63
+ * home: the turn's servers, checked against Codex's own configuration.
64
+ * Read before the thread opens, so no connection is made first, and
65
+ * before each turn.
66
+ */
67
+ threadServers({ servers, thread, }: CodexTurnMcp): Promise<Record<string, unknown> | undefined>;
55
68
  /**
56
69
  * Get the thread's servers ready for a turn: configured, started, and the
57
70
  * ones it goes on without said through `onWarning`. A required server that
58
71
  * cannot connect fails the turn.
59
72
  */
60
- prepare(threadId: string, { wire, servers }: CodexTurnMcp, onWarning: ((warning: ErrorInfo) => Promise<void>) | undefined): Promise<void>;
73
+ prepare(threadId: string, mcp: CodexTurnMcp, onWarning: ((warning: ErrorInfo) => Promise<void>) | undefined): Promise<void>;
74
+ /**
75
+ * The servers of a home the turn names: written, checked and reloaded when
76
+ * they changed or are to be started `again`. Whether this turn started them.
77
+ */
78
+ private startHomeServers;
79
+ /**
80
+ * The servers a thread carries: they started when it opened, on the first
81
+ * turn this process prepares. After that a reload starts the ones that are
82
+ * not running `again` and leaves the others connected. Whether this turn
83
+ * started them.
84
+ */
85
+ private startThreadServers;
61
86
  }
62
87
  //# sourceMappingURL=mcp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAQtD,OAAO,EAAE,KAAK,eAAe,EAAS,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBjG;AAED,2EAA2E;AAC3E,wBAAsB,oBAAoB,CACzC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAWf;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;;;;;OAKG;YACW,kBAAkB;CAOhC"}
@@ -1,7 +1,7 @@
1
1
  import type { AgentHarness, ModelDescriptor, ThinkingLevel } from "../../../protocol/index.ts";
2
2
  import { type CodexConnection } from "./client.ts";
3
3
  /** One `model/list` entry, as far as agent-server reads it. */
4
- export type CodexModel = Record<string, unknown>;
4
+ type CodexModel = Record<string, unknown>;
5
5
  /** A model's thinking levels, and the native effort that `off` means for it. */
6
6
  export interface CodexModelThinking {
7
7
  levels: readonly ThinkingLevel[];
@@ -11,14 +11,6 @@ export interface CodexModelThinking {
11
11
  }
12
12
  /** The level a native Codex effort is: `none` and `minimal` are `off`. */
13
13
  export declare function codexThinkingLevel(effort: unknown): ThinkingLevel | undefined;
14
- /** Every page of `model/list`, hidden models included. Throws when the CLI cannot answer. */
15
- export declare function readCodexModels(client: Pick<CodexConnection, "request">): Promise<CodexModel[]>;
16
- /**
17
- * What each model accepts, by its `model` and `id`. Codex's `none` or
18
- * `minimal` is `off`, remembered so `off` sends the value the model
19
- * advertised (`none` when it offers both).
20
- */
21
- export declare function codexModelThinking(models: readonly CodexModel[]): Map<string, CodexModelThinking>;
22
14
  /**
23
15
  * The thinking levels each model the logged-in account can run accepts, from
24
16
  * `model/list`. `undefined` when the CLI cannot answer; callers fall back to
@@ -44,7 +36,7 @@ export declare function readCodexThreadDefaults(client: Pick<CodexConnection, "r
44
36
  */
45
37
  export declare function codexModelDescriptors(models: readonly CodexModel[], harness: Extract<AgentHarness, "codex-app-server">, configuredModel?: string): ModelDescriptor[];
46
38
  /** What one `codex app-server` says about its models. */
47
- export interface CodexModelListing {
39
+ interface CodexModelListing {
48
40
  models: CodexModel[];
49
41
  /**
50
42
  * The model a new thread in the listing's folder runs when the turn names
@@ -64,4 +56,5 @@ export declare function listCodexModels(client: CodexConnection, cwd: string, {
64
56
  signal?: AbortSignal;
65
57
  login?: (client: CodexConnection) => Promise<void>;
66
58
  }): Promise<CodexModelListing>;
59
+ export {};
67
60
  //# sourceMappingURL=models.d.ts.map