@elie-laloum/outpost 5.0.0 → 7.0.0

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 (647) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +11 -11
  3. package/SECURITY.md +10 -0
  4. package/dist/adapters/agents/antigravity-adapter.d.ts +3 -0
  5. package/dist/adapters/agents/antigravity-adapter.js +41 -0
  6. package/dist/adapters/agents/antigravity-adapter.js.map +1 -0
  7. package/dist/adapters/agents/antigravity-authentication.d.ts +2 -0
  8. package/dist/adapters/agents/antigravity-authentication.js +27 -0
  9. package/dist/adapters/agents/antigravity-authentication.js.map +1 -0
  10. package/dist/adapters/agents/antigravity-diagnostics.d.ts +1 -0
  11. package/dist/adapters/agents/antigravity-diagnostics.js +6 -0
  12. package/dist/adapters/agents/antigravity-diagnostics.js.map +1 -0
  13. package/dist/adapters/agents/antigravity-events.d.ts +2 -0
  14. package/dist/adapters/agents/antigravity-events.js +75 -0
  15. package/dist/adapters/agents/antigravity-events.js.map +1 -0
  16. package/dist/adapters/agents/antigravity-request.d.ts +5 -0
  17. package/dist/adapters/agents/antigravity-request.js +37 -0
  18. package/dist/adapters/agents/antigravity-request.js.map +1 -0
  19. package/dist/adapters/agents/antigravity.constants.d.ts +3 -0
  20. package/dist/adapters/agents/antigravity.constants.js +4 -0
  21. package/dist/adapters/agents/antigravity.constants.js.map +1 -0
  22. package/dist/adapters/agents/{gemini.types.d.ts → antigravity.types.d.ts} +2 -2
  23. package/dist/adapters/agents/antigravity.types.js +2 -0
  24. package/dist/adapters/agents/antigravity.types.js.map +1 -0
  25. package/dist/adapters/agents/authentication.constants.d.ts +19 -9
  26. package/dist/adapters/agents/authentication.constants.js +12 -9
  27. package/dist/adapters/agents/authentication.constants.js.map +1 -1
  28. package/dist/adapters/agents/authentication.d.ts +11 -2
  29. package/dist/adapters/agents/authentication.js +70 -47
  30. package/dist/adapters/agents/authentication.js.map +1 -1
  31. package/dist/adapters/agents/authentication.types.d.ts +20 -0
  32. package/dist/adapters/agents/authentication.types.js +2 -0
  33. package/dist/adapters/agents/authentication.types.js.map +1 -0
  34. package/dist/adapters/agents/claude-adapter.js +4 -2
  35. package/dist/adapters/agents/claude-adapter.js.map +1 -1
  36. package/dist/adapters/agents/claude-authentication.d.ts +2 -0
  37. package/dist/adapters/agents/claude-authentication.js +34 -0
  38. package/dist/adapters/agents/claude-authentication.js.map +1 -0
  39. package/dist/adapters/agents/claude-events.js +52 -9
  40. package/dist/adapters/agents/claude-events.js.map +1 -1
  41. package/dist/adapters/agents/claude-request.js +2 -0
  42. package/dist/adapters/agents/claude-request.js.map +1 -1
  43. package/dist/adapters/agents/cli-diagnostics.constants.d.ts +6 -6
  44. package/dist/adapters/agents/cli-diagnostics.constants.js +6 -6
  45. package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -1
  46. package/dist/adapters/agents/cli-diagnostics.d.ts +1 -0
  47. package/dist/adapters/agents/cli-diagnostics.js +18 -0
  48. package/dist/adapters/agents/cli-diagnostics.js.map +1 -1
  49. package/dist/adapters/agents/codex-adapter.js +4 -2
  50. package/dist/adapters/agents/codex-adapter.js.map +1 -1
  51. package/dist/adapters/agents/codex-authentication.d.ts +3 -0
  52. package/dist/adapters/agents/codex-authentication.js +47 -0
  53. package/dist/adapters/agents/codex-authentication.js.map +1 -0
  54. package/dist/adapters/agents/codex-events.js +28 -2
  55. package/dist/adapters/agents/codex-events.js.map +1 -1
  56. package/dist/adapters/agents/copilot-adapter.d.ts +3 -0
  57. package/dist/adapters/agents/copilot-adapter.js +45 -0
  58. package/dist/adapters/agents/copilot-adapter.js.map +1 -0
  59. package/dist/adapters/agents/copilot-authentication.d.ts +2 -0
  60. package/dist/adapters/agents/copilot-authentication.js +46 -0
  61. package/dist/adapters/agents/copilot-authentication.js.map +1 -0
  62. package/dist/adapters/agents/copilot-diagnostics.d.ts +1 -0
  63. package/dist/adapters/agents/copilot-diagnostics.js +6 -0
  64. package/dist/adapters/agents/copilot-diagnostics.js.map +1 -0
  65. package/dist/adapters/agents/copilot-events.d.ts +2 -0
  66. package/dist/adapters/agents/copilot-events.js +66 -0
  67. package/dist/adapters/agents/copilot-events.js.map +1 -0
  68. package/dist/adapters/agents/copilot-request.d.ts +5 -0
  69. package/dist/adapters/agents/copilot-request.js +24 -0
  70. package/dist/adapters/agents/copilot-request.js.map +1 -0
  71. package/dist/adapters/agents/copilot-usage.d.ts +3 -0
  72. package/dist/adapters/agents/copilot-usage.js +19 -0
  73. package/dist/adapters/agents/copilot-usage.js.map +1 -0
  74. package/dist/adapters/agents/copilot.types.d.ts +6 -0
  75. package/dist/adapters/agents/copilot.types.js +2 -0
  76. package/dist/adapters/agents/copilot.types.js.map +1 -0
  77. package/dist/adapters/agents/event-decoder.d.ts +2 -2
  78. package/dist/adapters/agents/event-decoder.js +6 -5
  79. package/dist/adapters/agents/event-decoder.js.map +1 -1
  80. package/dist/adapters/agents/kimi-adapter.d.ts +3 -0
  81. package/dist/adapters/agents/kimi-adapter.js +51 -0
  82. package/dist/adapters/agents/kimi-adapter.js.map +1 -0
  83. package/dist/adapters/agents/kimi-authentication.d.ts +3 -0
  84. package/dist/adapters/agents/kimi-authentication.js +63 -0
  85. package/dist/adapters/agents/kimi-authentication.js.map +1 -0
  86. package/dist/adapters/agents/kimi-diagnostics.d.ts +2 -0
  87. package/dist/adapters/agents/kimi-diagnostics.js +14 -0
  88. package/dist/adapters/agents/kimi-diagnostics.js.map +1 -0
  89. package/dist/adapters/agents/kimi-events.d.ts +2 -0
  90. package/dist/adapters/agents/kimi-events.js +55 -0
  91. package/dist/adapters/agents/kimi-events.js.map +1 -0
  92. package/dist/adapters/agents/kimi-fork.d.ts +2 -0
  93. package/dist/adapters/agents/kimi-fork.js +11 -0
  94. package/dist/adapters/agents/kimi-fork.js.map +1 -0
  95. package/dist/adapters/agents/{gemini-request.d.ts → kimi-request.d.ts} +2 -2
  96. package/dist/adapters/agents/kimi-request.js +33 -0
  97. package/dist/adapters/agents/kimi-request.js.map +1 -0
  98. package/dist/adapters/agents/kimi-usage.d.ts +2 -0
  99. package/dist/adapters/agents/kimi-usage.js +7 -0
  100. package/dist/adapters/agents/kimi-usage.js.map +1 -0
  101. package/dist/adapters/agents/kimi.constants.d.ts +13 -0
  102. package/dist/adapters/agents/kimi.constants.js +14 -0
  103. package/dist/adapters/agents/kimi.constants.js.map +1 -0
  104. package/dist/adapters/agents/kimi.types.d.ts +7 -0
  105. package/dist/adapters/agents/kimi.types.js +2 -0
  106. package/dist/adapters/agents/kimi.types.js.map +1 -0
  107. package/dist/adapters/agents/model-support.constants.d.ts +3 -1
  108. package/dist/adapters/agents/model-support.constants.js +12 -2
  109. package/dist/adapters/agents/model-support.constants.js.map +1 -1
  110. package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -2
  111. package/dist/adapters/agents/protocol-fixtures.constants.js +131 -9
  112. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
  113. package/dist/adapters/agents/protocol-fixtures.types.d.ts +1 -0
  114. package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -1
  115. package/dist/adapters/agents/protocol.d.ts +1 -0
  116. package/dist/adapters/agents/protocol.js +9 -0
  117. package/dist/adapters/agents/protocol.js.map +1 -1
  118. package/dist/adapters/agents/session-usage.constants.d.ts +10 -0
  119. package/dist/adapters/agents/session-usage.constants.js +110 -0
  120. package/dist/adapters/agents/session-usage.constants.js.map +1 -0
  121. package/dist/adapters/agents/session-usage.d.ts +5 -0
  122. package/dist/adapters/agents/session-usage.js +45 -0
  123. package/dist/adapters/agents/session-usage.js.map +1 -0
  124. package/dist/adapters/agents/settings.types.d.ts +1 -0
  125. package/dist/adapters/agents/settings.types.js.map +1 -1
  126. package/dist/adapters/agents/tool-result.d.ts +2 -0
  127. package/dist/adapters/agents/tool-result.js +17 -0
  128. package/dist/adapters/agents/tool-result.js.map +1 -0
  129. package/dist/adapters/models/anthropic-response.js +3 -0
  130. package/dist/adapters/models/anthropic-response.js.map +1 -1
  131. package/dist/adapters/models/http-provider.js +6 -1
  132. package/dist/adapters/models/http-provider.js.map +1 -1
  133. package/dist/adapters/models/openai-responses.js +10 -0
  134. package/dist/adapters/models/openai-responses.js.map +1 -1
  135. package/dist/adapters/models/retry-after.d.ts +1 -0
  136. package/dist/adapters/models/retry-after.js +16 -0
  137. package/dist/adapters/models/retry-after.js.map +1 -0
  138. package/dist/application/activity-watchdog.js +1 -2
  139. package/dist/application/activity-watchdog.js.map +1 -1
  140. package/dist/application/agent-authentication.d.ts +4 -0
  141. package/dist/application/agent-authentication.js +32 -0
  142. package/dist/application/agent-authentication.js.map +1 -0
  143. package/dist/application/agent-bootstrap.constants.d.ts +2 -5
  144. package/dist/application/agent-bootstrap.constants.js +27 -4
  145. package/dist/application/agent-bootstrap.constants.js.map +1 -1
  146. package/dist/application/agent-bootstrap.js +39 -12
  147. package/dist/application/agent-bootstrap.js.map +1 -1
  148. package/dist/application/agent-bootstrap.types.d.ts +19 -0
  149. package/dist/application/agent-bootstrap.types.js +2 -0
  150. package/dist/application/agent-bootstrap.types.js.map +1 -0
  151. package/dist/application/agent-output.js +74 -8
  152. package/dist/application/agent-output.js.map +1 -1
  153. package/dist/application/agent-request.d.ts +3 -0
  154. package/dist/application/agent-request.js +11 -0
  155. package/dist/application/agent-request.js.map +1 -0
  156. package/dist/application/agent-turn.js +74 -6
  157. package/dist/application/agent-turn.js.map +1 -1
  158. package/dist/application/agent-usage.d.ts +6 -0
  159. package/dist/application/agent-usage.js +57 -0
  160. package/dist/application/agent-usage.js.map +1 -0
  161. package/dist/application/attach.js +2 -0
  162. package/dist/application/attach.js.map +1 -1
  163. package/dist/application/credential-installer.constants.d.ts +1 -0
  164. package/dist/application/credential-installer.constants.js +22 -0
  165. package/dist/application/credential-installer.constants.js.map +1 -0
  166. package/dist/application/custom-turn.js +44 -49
  167. package/dist/application/custom-turn.js.map +1 -1
  168. package/dist/application/dispatch-observation.d.ts +1 -1
  169. package/dist/application/dispatch-observation.js +141 -21
  170. package/dist/application/dispatch-observation.js.map +1 -1
  171. package/dist/application/dispatch-observation.types.d.ts +2 -0
  172. package/dist/application/dispatch-observation.types.js.map +1 -1
  173. package/dist/application/dispatch-validation.js +2 -0
  174. package/dist/application/dispatch-validation.js.map +1 -1
  175. package/dist/application/dispatch.js +1 -1
  176. package/dist/application/dispatch.js.map +1 -1
  177. package/dist/application/doctor-agent.constants.d.ts +2 -8
  178. package/dist/application/doctor-agent.constants.js +43 -6
  179. package/dist/application/doctor-agent.constants.js.map +1 -1
  180. package/dist/application/doctor-agent.d.ts +2 -1
  181. package/dist/application/doctor-agent.js +15 -3
  182. package/dist/application/doctor-agent.js.map +1 -1
  183. package/dist/application/doctor-image.js +4 -6
  184. package/dist/application/doctor-image.js.map +1 -1
  185. package/dist/application/doctor-protocol.js +6 -11
  186. package/dist/application/doctor-protocol.js.map +1 -1
  187. package/dist/application/doctor-protocol.types.d.ts +1 -1
  188. package/dist/application/doctor-protocol.types.js.map +1 -1
  189. package/dist/application/doctor-sandbox.js +2 -5
  190. package/dist/application/doctor-sandbox.js.map +1 -1
  191. package/dist/application/doctor.js +28 -10
  192. package/dist/application/doctor.js.map +1 -1
  193. package/dist/application/doctor.types.d.ts +10 -1
  194. package/dist/application/doctor.types.js.map +1 -1
  195. package/dist/application/execution.constants.d.ts +2 -0
  196. package/dist/application/execution.constants.js +2 -0
  197. package/dist/application/execution.constants.js.map +1 -1
  198. package/dist/application/execution.types.d.ts +8 -0
  199. package/dist/application/execution.types.js.map +1 -1
  200. package/dist/application/harness-budget.d.ts +3 -0
  201. package/dist/application/harness-budget.js +42 -0
  202. package/dist/application/harness-budget.js.map +1 -0
  203. package/dist/application/harness-budget.types.d.ts +5 -0
  204. package/dist/application/harness-budget.types.js +2 -0
  205. package/dist/application/harness-budget.types.js.map +1 -0
  206. package/dist/application/harness-hooks.js +34 -3
  207. package/dist/application/harness-hooks.js.map +1 -1
  208. package/dist/application/harness-loop.js +52 -24
  209. package/dist/application/harness-loop.js.map +1 -1
  210. package/dist/application/harness-model-provider.d.ts +3 -0
  211. package/dist/application/harness-model-provider.js +49 -0
  212. package/dist/application/harness-model-provider.js.map +1 -0
  213. package/dist/application/harness-model-provider.types.d.ts +10 -0
  214. package/dist/application/harness-model-provider.types.js +2 -0
  215. package/dist/application/harness-model-provider.types.js.map +1 -0
  216. package/dist/application/harness-subagent.d.ts +4 -0
  217. package/dist/application/harness-subagent.js +110 -0
  218. package/dist/application/harness-subagent.js.map +1 -0
  219. package/dist/application/harness.types.d.ts +11 -0
  220. package/dist/application/harness.types.js.map +1 -1
  221. package/dist/application/lifecycle-hooks.d.ts +1 -1
  222. package/dist/application/lifecycle-hooks.js +5 -4
  223. package/dist/application/lifecycle-hooks.js.map +1 -1
  224. package/dist/application/observed-lease.d.ts +3 -0
  225. package/dist/application/observed-lease.js +26 -0
  226. package/dist/application/observed-lease.js.map +1 -0
  227. package/dist/application/outpost.types.d.ts +3 -1
  228. package/dist/application/outpost.types.js.map +1 -1
  229. package/dist/application/output-lines.d.ts +4 -0
  230. package/dist/application/output-lines.js +28 -0
  231. package/dist/application/output-lines.js.map +1 -0
  232. package/dist/application/queue-worker.js +1 -1
  233. package/dist/application/queue-worker.js.map +1 -1
  234. package/dist/application/queue-worker.types.d.ts +1 -0
  235. package/dist/application/queue-worker.types.js.map +1 -1
  236. package/dist/application/queued-task.js +24 -5
  237. package/dist/application/queued-task.js.map +1 -1
  238. package/dist/application/recovery-archive.d.ts +3 -2
  239. package/dist/application/recovery-archive.js +9 -2
  240. package/dist/application/recovery-archive.js.map +1 -1
  241. package/dist/application/recovery-restore.d.ts +3 -2
  242. package/dist/application/recovery-restore.js +9 -2
  243. package/dist/application/recovery-restore.js.map +1 -1
  244. package/dist/application/recovery-retention.d.ts +3 -2
  245. package/dist/application/recovery-retention.js +74 -26
  246. package/dist/application/recovery-retention.js.map +1 -1
  247. package/dist/application/remote-workspace.js +5 -4
  248. package/dist/application/remote-workspace.js.map +1 -1
  249. package/dist/application/remote-workspace.types.d.ts +1 -0
  250. package/dist/application/remote-workspace.types.js.map +1 -1
  251. package/dist/application/sandbox-agents.js +19 -19
  252. package/dist/application/sandbox-agents.js.map +1 -1
  253. package/dist/application/sandbox-attach.js +12 -3
  254. package/dist/application/sandbox-attach.js.map +1 -1
  255. package/dist/application/sandbox-dispatch.js +13 -27
  256. package/dist/application/sandbox-dispatch.js.map +1 -1
  257. package/dist/application/sandbox-provision.js +15 -9
  258. package/dist/application/sandbox-provision.js.map +1 -1
  259. package/dist/application/sandbox-session.types.d.ts +7 -2
  260. package/dist/application/sandbox-session.types.js.map +1 -1
  261. package/dist/application/sandbox.js +13 -6
  262. package/dist/application/sandbox.js.map +1 -1
  263. package/dist/application/speculation-checkpoint.d.ts +6 -0
  264. package/dist/application/speculation-checkpoint.js +206 -0
  265. package/dist/application/speculation-checkpoint.js.map +1 -0
  266. package/dist/application/speculation-checkpoint.types.d.ts +24 -0
  267. package/dist/application/speculation-checkpoint.types.js +2 -0
  268. package/dist/application/speculation-checkpoint.types.js.map +1 -0
  269. package/dist/application/speculation-integration.constants.d.ts +4 -0
  270. package/dist/application/speculation-integration.constants.js +5 -0
  271. package/dist/application/speculation-integration.constants.js.map +1 -0
  272. package/dist/application/speculation-integration.d.ts +2 -0
  273. package/dist/application/speculation-integration.js +67 -0
  274. package/dist/application/speculation-integration.js.map +1 -0
  275. package/dist/application/speculation-resume.d.ts +4 -0
  276. package/dist/application/speculation-resume.js +71 -0
  277. package/dist/application/speculation-resume.js.map +1 -0
  278. package/dist/application/speculation-run.d.ts +4 -0
  279. package/dist/application/speculation-run.js +320 -0
  280. package/dist/application/speculation-run.js.map +1 -0
  281. package/dist/application/speculation-timeout.d.ts +1 -0
  282. package/dist/application/speculation-timeout.js +15 -0
  283. package/dist/application/speculation-timeout.js.map +1 -0
  284. package/dist/application/speculation.constants.d.ts +1 -0
  285. package/dist/application/speculation.constants.js +5 -1
  286. package/dist/application/speculation.constants.js.map +1 -1
  287. package/dist/application/speculation.js +41 -149
  288. package/dist/application/speculation.js.map +1 -1
  289. package/dist/application/speculation.types.d.ts +23 -0
  290. package/dist/application/speculation.types.js.map +1 -1
  291. package/dist/application/startup-recovery.js +14 -1
  292. package/dist/application/startup-recovery.js.map +1 -1
  293. package/dist/application/startup-recovery.types.d.ts +1 -0
  294. package/dist/application/startup-recovery.types.js.map +1 -1
  295. package/dist/application/stop-reason.d.ts +2 -0
  296. package/dist/application/stop-reason.js +21 -0
  297. package/dist/application/stop-reason.js.map +1 -0
  298. package/dist/application/stop-reason.types.d.ts +4 -0
  299. package/dist/application/stop-reason.types.js +2 -0
  300. package/dist/application/stop-reason.types.js.map +1 -0
  301. package/dist/application/storage-reservation.js +9 -2
  302. package/dist/application/storage-reservation.js.map +1 -1
  303. package/dist/application/task-observation.d.ts +3 -0
  304. package/dist/application/task-observation.js +22 -0
  305. package/dist/application/task-observation.js.map +1 -0
  306. package/dist/application/task-usage.js +5 -12
  307. package/dist/application/task-usage.js.map +1 -1
  308. package/dist/application/tasks.js +41 -16
  309. package/dist/application/tasks.js.map +1 -1
  310. package/dist/application/tool-execution.js +42 -19
  311. package/dist/application/tool-execution.js.map +1 -1
  312. package/dist/application/workspace.js +6 -4
  313. package/dist/application/workspace.js.map +1 -1
  314. package/dist/cli/doctor-command.js +6 -2
  315. package/dist/cli/doctor-command.js.map +1 -1
  316. package/dist/cli/init-authentication.d.ts +4 -1
  317. package/dist/cli/init-authentication.js +28 -33
  318. package/dist/cli/init-authentication.js.map +1 -1
  319. package/dist/cli/init-command.js +3 -3
  320. package/dist/cli/init-command.js.map +1 -1
  321. package/dist/cli/main.constants.d.ts +50 -13
  322. package/dist/cli/main.constants.js +70 -8
  323. package/dist/cli/main.constants.js.map +1 -1
  324. package/dist/cli/main.js +2 -1
  325. package/dist/cli/main.js.map +1 -1
  326. package/dist/cli/scaffold-files.js +1 -1
  327. package/dist/cli/scaffold-files.js.map +1 -1
  328. package/dist/cli/scaffold-validation.js +29 -22
  329. package/dist/cli/scaffold-validation.js.map +1 -1
  330. package/dist/cli/scaffold.constants.d.ts +0 -1
  331. package/dist/cli/scaffold.constants.js +6 -2
  332. package/dist/cli/scaffold.constants.js.map +1 -1
  333. package/dist/cli/scaffold.types.d.ts +8 -2
  334. package/dist/cli/scaffold.types.js.map +1 -1
  335. package/dist/cli/starters.js +1 -3
  336. package/dist/cli/starters.js.map +1 -1
  337. package/dist/domain/agent-observation.d.ts +4 -0
  338. package/dist/domain/agent-observation.js +27 -0
  339. package/dist/domain/agent-observation.js.map +1 -0
  340. package/dist/domain/agent.types.d.ts +122 -14
  341. package/dist/domain/agent.types.js.map +1 -1
  342. package/dist/domain/authentication.constants.d.ts +3 -0
  343. package/dist/domain/authentication.constants.js +11 -0
  344. package/dist/domain/authentication.constants.js.map +1 -0
  345. package/dist/domain/authentication.d.ts +3 -0
  346. package/dist/domain/authentication.js +22 -0
  347. package/dist/domain/authentication.js.map +1 -0
  348. package/dist/domain/authentication.types.d.ts +5 -0
  349. package/dist/domain/authentication.types.js +2 -0
  350. package/dist/domain/authentication.types.js.map +1 -0
  351. package/dist/domain/harness.d.ts +2 -2
  352. package/dist/domain/harness.js +6 -0
  353. package/dist/domain/harness.js.map +1 -1
  354. package/dist/domain/harness.types.d.ts +4 -3
  355. package/dist/domain/harness.types.js.map +1 -1
  356. package/dist/domain/model.types.d.ts +8 -0
  357. package/dist/domain/model.types.js.map +1 -1
  358. package/dist/domain/observation.constants.d.ts +8 -0
  359. package/dist/domain/observation.constants.js +9 -0
  360. package/dist/domain/observation.constants.js.map +1 -0
  361. package/dist/domain/observation.d.ts +2 -0
  362. package/dist/domain/observation.js +190 -0
  363. package/dist/domain/observation.js.map +1 -0
  364. package/dist/domain/observation.types.d.ts +84 -0
  365. package/dist/domain/observation.types.js +2 -0
  366. package/dist/domain/observation.types.js.map +1 -0
  367. package/dist/domain/observed-operation.d.ts +2 -0
  368. package/dist/domain/observed-operation.js +30 -0
  369. package/dist/domain/observed-operation.js.map +1 -0
  370. package/dist/domain/sandbox.types.d.ts +2 -0
  371. package/dist/domain/sandbox.types.js.map +1 -1
  372. package/dist/domain/subagent.constants.d.ts +13 -0
  373. package/dist/domain/subagent.constants.js +9 -0
  374. package/dist/domain/subagent.constants.js.map +1 -0
  375. package/dist/domain/subagent.d.ts +4 -0
  376. package/dist/domain/subagent.js +28 -0
  377. package/dist/domain/subagent.js.map +1 -0
  378. package/dist/domain/subagent.types.d.ts +13 -0
  379. package/dist/domain/subagent.types.js +2 -0
  380. package/dist/domain/subagent.types.js.map +1 -0
  381. package/dist/domain/transcript.types.d.ts +2 -0
  382. package/dist/domain/transcript.types.js.map +1 -1
  383. package/dist/domain/usage.d.ts +1 -0
  384. package/dist/domain/usage.js +16 -0
  385. package/dist/domain/usage.js.map +1 -1
  386. package/dist/domain/workflow/budget.d.ts +7 -3
  387. package/dist/domain/workflow/budget.js +26 -0
  388. package/dist/domain/workflow/budget.js.map +1 -1
  389. package/dist/domain/workflow/budget.types.d.ts +1 -1
  390. package/dist/domain/workflow/budget.types.js.map +1 -1
  391. package/dist/domain/workflow/checkpoint-validation.js +7 -1
  392. package/dist/domain/workflow/checkpoint-validation.js.map +1 -1
  393. package/dist/domain/workflow/checkpoint.js +3 -0
  394. package/dist/domain/workflow/checkpoint.js.map +1 -1
  395. package/dist/domain/workflow/gate-validation.js +14 -1
  396. package/dist/domain/workflow/gate-validation.js.map +1 -1
  397. package/dist/domain/workflow/gates.d.ts +1 -1
  398. package/dist/domain/workflow/gates.js +52 -4
  399. package/dist/domain/workflow/gates.js.map +1 -1
  400. package/dist/domain/workflow/gates.types.d.ts +15 -1
  401. package/dist/domain/workflow/gates.types.js.map +1 -1
  402. package/dist/domain/workflow/idempotency.d.ts +1 -0
  403. package/dist/domain/workflow/idempotency.js +7 -0
  404. package/dist/domain/workflow/idempotency.js.map +1 -0
  405. package/dist/domain/workflow/retry.constants.d.ts +2 -0
  406. package/dist/domain/workflow/retry.constants.js +3 -0
  407. package/dist/domain/workflow/retry.constants.js.map +1 -0
  408. package/dist/domain/workflow/retry.d.ts +4 -0
  409. package/dist/domain/workflow/retry.js +49 -0
  410. package/dist/domain/workflow/retry.js.map +1 -0
  411. package/dist/domain/workflow/task-runner.js +9 -5
  412. package/dist/domain/workflow/task-runner.js.map +1 -1
  413. package/dist/domain/workflow/task.js +6 -6
  414. package/dist/domain/workflow/task.js.map +1 -1
  415. package/dist/domain/workflow/workflow-scheduler.js +110 -72
  416. package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
  417. package/dist/domain/workflow/workflow-state.js +28 -12
  418. package/dist/domain/workflow/workflow-state.js.map +1 -1
  419. package/dist/domain/workflow.d.ts +1 -1
  420. package/dist/domain/workflow.js +1 -1
  421. package/dist/domain/workflow.js.map +1 -1
  422. package/dist/domain/workflow.types.d.ts +13 -2
  423. package/dist/domain/workflow.types.js.map +1 -1
  424. package/dist/index.d.ts +16 -11
  425. package/dist/index.js +7 -4
  426. package/dist/index.js.map +1 -1
  427. package/dist/infrastructure/conversations/capture.js +10 -0
  428. package/dist/infrastructure/conversations/capture.js.map +1 -1
  429. package/dist/infrastructure/conversations/harness-transcript.js +6 -0
  430. package/dist/infrastructure/conversations/harness-transcript.js.map +1 -1
  431. package/dist/infrastructure/conversations/harness-transcript.types.d.ts +2 -0
  432. package/dist/infrastructure/conversations/harness-transcript.types.js.map +1 -1
  433. package/dist/infrastructure/conversations/layout.js +2 -0
  434. package/dist/infrastructure/conversations/layout.js.map +1 -1
  435. package/dist/infrastructure/conversations/locate.js +7 -1
  436. package/dist/infrastructure/conversations/locate.js.map +1 -1
  437. package/dist/infrastructure/conversations/native-store.js +8 -1
  438. package/dist/infrastructure/conversations/native-store.js.map +1 -1
  439. package/dist/infrastructure/conversations/paths.js +3 -0
  440. package/dist/infrastructure/conversations/paths.js.map +1 -1
  441. package/dist/infrastructure/conversations/restore.js +7 -0
  442. package/dist/infrastructure/conversations/restore.js.map +1 -1
  443. package/dist/infrastructure/conversations/session-bundle.constants.d.ts +5 -0
  444. package/dist/infrastructure/conversations/session-bundle.constants.js +173 -0
  445. package/dist/infrastructure/conversations/session-bundle.constants.js.map +1 -0
  446. package/dist/infrastructure/conversations/session-bundle.d.ts +6 -0
  447. package/dist/infrastructure/conversations/session-bundle.js +98 -0
  448. package/dist/infrastructure/conversations/session-bundle.js.map +1 -0
  449. package/dist/infrastructure/conversations/session-bundle.types.d.ts +1 -0
  450. package/dist/infrastructure/conversations/session-bundle.types.js +2 -0
  451. package/dist/infrastructure/conversations/session-bundle.types.js.map +1 -0
  452. package/dist/infrastructure/conversations.js +4 -2
  453. package/dist/infrastructure/conversations.js.map +1 -1
  454. package/dist/infrastructure/conversations.types.d.ts +1 -1
  455. package/dist/infrastructure/conversations.types.js.map +1 -1
  456. package/dist/infrastructure/custom-reporter.js +32 -24
  457. package/dist/infrastructure/custom-reporter.js.map +1 -1
  458. package/dist/infrastructure/custom-reporter.types.d.ts +2 -0
  459. package/dist/infrastructure/custom-reporter.types.js.map +1 -1
  460. package/dist/infrastructure/git/git.constants.d.ts +1 -1
  461. package/dist/infrastructure/git/git.constants.js +1 -0
  462. package/dist/infrastructure/git/git.constants.js.map +1 -1
  463. package/dist/infrastructure/git/workspace-lease.js +4 -3
  464. package/dist/infrastructure/git/workspace-lease.js.map +1 -1
  465. package/dist/infrastructure/git/workspace.js +7 -6
  466. package/dist/infrastructure/git/workspace.js.map +1 -1
  467. package/dist/infrastructure/git/workspace.types.d.ts +1 -0
  468. package/dist/infrastructure/git/workspace.types.js.map +1 -1
  469. package/dist/infrastructure/host-credentials.constants.d.ts +1 -0
  470. package/dist/infrastructure/host-credentials.constants.js +2 -0
  471. package/dist/infrastructure/host-credentials.constants.js.map +1 -0
  472. package/dist/infrastructure/host-credentials.d.ts +4 -0
  473. package/dist/infrastructure/host-credentials.js +89 -0
  474. package/dist/infrastructure/host-credentials.js.map +1 -0
  475. package/dist/infrastructure/inspection-path.js +4 -3
  476. package/dist/infrastructure/inspection-path.js.map +1 -1
  477. package/dist/infrastructure/journal.constants.js +10 -1
  478. package/dist/infrastructure/journal.constants.js.map +1 -1
  479. package/dist/infrastructure/journal.d.ts +1 -1
  480. package/dist/infrastructure/journal.js +8 -75
  481. package/dist/infrastructure/journal.js.map +1 -1
  482. package/dist/infrastructure/journal.types.d.ts +2 -4
  483. package/dist/infrastructure/journal.types.js.map +1 -1
  484. package/dist/infrastructure/local-transport.js +9 -4
  485. package/dist/infrastructure/local-transport.js.map +1 -1
  486. package/dist/infrastructure/opentelemetry-dispatch.d.ts +3 -3
  487. package/dist/infrastructure/opentelemetry-dispatch.js +5 -4
  488. package/dist/infrastructure/opentelemetry-dispatch.js.map +1 -1
  489. package/dist/infrastructure/opentelemetry-observation.d.ts +5 -0
  490. package/dist/infrastructure/opentelemetry-observation.js +59 -0
  491. package/dist/infrastructure/opentelemetry-observation.js.map +1 -0
  492. package/dist/infrastructure/opentelemetry.js +15 -1
  493. package/dist/infrastructure/opentelemetry.js.map +1 -1
  494. package/dist/infrastructure/opentelemetry.types.d.ts +9 -1
  495. package/dist/infrastructure/opentelemetry.types.js.map +1 -1
  496. package/dist/infrastructure/reporter.d.ts +2 -2
  497. package/dist/infrastructure/reporter.js +5 -1
  498. package/dist/infrastructure/reporter.js.map +1 -1
  499. package/dist/infrastructure/repository-transport.constants.d.ts +1 -0
  500. package/dist/infrastructure/repository-transport.constants.js +2 -0
  501. package/dist/infrastructure/repository-transport.constants.js.map +1 -0
  502. package/dist/infrastructure/repository-transport.d.ts +2 -0
  503. package/dist/infrastructure/repository-transport.js +9 -0
  504. package/dist/infrastructure/repository-transport.js.map +1 -0
  505. package/dist/infrastructure/resource-activity-inspection.js +19 -24
  506. package/dist/infrastructure/resource-activity-inspection.js.map +1 -1
  507. package/dist/infrastructure/resource-activity.constants.d.ts +0 -1
  508. package/dist/infrastructure/resource-activity.constants.js +0 -1
  509. package/dist/infrastructure/resource-activity.constants.js.map +1 -1
  510. package/dist/infrastructure/resource-activity.js +20 -83
  511. package/dist/infrastructure/resource-activity.js.map +1 -1
  512. package/dist/infrastructure/s3-transport.constants.d.ts +2 -0
  513. package/dist/infrastructure/s3-transport.constants.js +3 -0
  514. package/dist/infrastructure/s3-transport.constants.js.map +1 -0
  515. package/dist/infrastructure/s3-transport.js +57 -3
  516. package/dist/infrastructure/s3-transport.js.map +1 -1
  517. package/dist/infrastructure/s3-transport.types.d.ts +1 -0
  518. package/dist/infrastructure/s3-transport.types.js.map +1 -1
  519. package/dist/infrastructure/speculation-store.constants.d.ts +3 -0
  520. package/dist/infrastructure/speculation-store.constants.js +2 -0
  521. package/dist/infrastructure/speculation-store.constants.js.map +1 -0
  522. package/dist/infrastructure/speculation-store.d.ts +4 -0
  523. package/dist/infrastructure/speculation-store.js +73 -0
  524. package/dist/infrastructure/speculation-store.js.map +1 -0
  525. package/dist/infrastructure/speculation-store.types.d.ts +12 -0
  526. package/dist/infrastructure/speculation-store.types.js +2 -0
  527. package/dist/infrastructure/speculation-store.types.js.map +1 -0
  528. package/dist/infrastructure/storage-inventory.constants.js +1 -0
  529. package/dist/infrastructure/storage-inventory.constants.js.map +1 -1
  530. package/dist/infrastructure/storage-inventory.types.d.ts +1 -1
  531. package/dist/infrastructure/storage-inventory.types.js.map +1 -1
  532. package/dist/infrastructure/storage-reservations.types.d.ts +0 -8
  533. package/dist/infrastructure/storage-reservations.types.js.map +1 -1
  534. package/dist/infrastructure/task-queue-bullmq-resources.js +3 -0
  535. package/dist/infrastructure/task-queue-bullmq-resources.js.map +1 -1
  536. package/dist/infrastructure/task-queue-http.js +29 -4
  537. package/dist/infrastructure/task-queue-http.js.map +1 -1
  538. package/dist/infrastructure/task-queue-http.types.d.ts +2 -2
  539. package/dist/infrastructure/task-queue-http.types.js.map +1 -1
  540. package/dist/infrastructure/transport-conversations.js +2 -0
  541. package/dist/infrastructure/transport-conversations.js.map +1 -1
  542. package/dist/infrastructure/transport-journal.d.ts +1 -1
  543. package/dist/infrastructure/transport-journal.js +8 -2
  544. package/dist/infrastructure/transport-journal.js.map +1 -1
  545. package/dist/infrastructure/transport-reservations.d.ts +1 -1
  546. package/dist/infrastructure/transport-reservations.js +14 -8
  547. package/dist/infrastructure/transport-reservations.js.map +1 -1
  548. package/dist/infrastructure/workflow-decision-signature.constants.d.ts +4 -0
  549. package/dist/infrastructure/workflow-decision-signature.constants.js +5 -0
  550. package/dist/infrastructure/workflow-decision-signature.constants.js.map +1 -0
  551. package/dist/infrastructure/workflow-decision-signature.d.ts +4 -0
  552. package/dist/infrastructure/workflow-decision-signature.js +83 -0
  553. package/dist/infrastructure/workflow-decision-signature.js.map +1 -0
  554. package/dist/infrastructure/workflow-decision-signature.types.d.ts +16 -0
  555. package/dist/infrastructure/workflow-decision-signature.types.js +2 -0
  556. package/dist/infrastructure/workflow-decision-signature.types.js.map +1 -0
  557. package/dist/providers/agents.d.ts +7 -2
  558. package/dist/providers/agents.js +4 -1
  559. package/dist/providers/agents.js.map +1 -1
  560. package/dist/providers/antigravity-install.constants.d.ts +2 -0
  561. package/dist/providers/antigravity-install.constants.js +28 -0
  562. package/dist/providers/antigravity-install.constants.js.map +1 -0
  563. package/dist/providers/antigravity-install.d.ts +2 -0
  564. package/dist/providers/antigravity-install.js +29 -0
  565. package/dist/providers/antigravity-install.js.map +1 -0
  566. package/dist/providers/antigravity-install.types.d.ts +4 -0
  567. package/dist/providers/antigravity-install.types.js +2 -0
  568. package/dist/providers/antigravity-install.types.js.map +1 -0
  569. package/dist/providers/container-recovery.d.ts +4 -0
  570. package/dist/providers/container-recovery.js +28 -0
  571. package/dist/providers/container-recovery.js.map +1 -0
  572. package/dist/providers/container.js +8 -0
  573. package/dist/providers/container.js.map +1 -1
  574. package/dist/providers/daytona-network.constants.d.ts +5 -0
  575. package/dist/providers/daytona-network.constants.js +8 -0
  576. package/dist/providers/daytona-network.constants.js.map +1 -0
  577. package/dist/providers/daytona-network.d.ts +4 -0
  578. package/dist/providers/daytona-network.js +33 -0
  579. package/dist/providers/daytona-network.js.map +1 -0
  580. package/dist/providers/daytona.d.ts +1 -0
  581. package/dist/providers/daytona.js +9 -3
  582. package/dist/providers/daytona.js.map +1 -1
  583. package/dist/providers/daytona.types.d.ts +2 -0
  584. package/dist/providers/daytona.types.js.map +1 -1
  585. package/dist/providers/firecracker-command.js +1 -1
  586. package/dist/providers/firecracker-command.js.map +1 -1
  587. package/dist/providers/firecracker-jailer.constants.d.ts +9 -0
  588. package/dist/providers/firecracker-jailer.constants.js +10 -0
  589. package/dist/providers/firecracker-jailer.constants.js.map +1 -0
  590. package/dist/providers/firecracker-jailer.d.ts +4 -0
  591. package/dist/providers/firecracker-jailer.js +171 -0
  592. package/dist/providers/firecracker-jailer.js.map +1 -0
  593. package/dist/providers/firecracker-machine.js +30 -8
  594. package/dist/providers/firecracker-machine.js.map +1 -1
  595. package/dist/providers/firecracker.types.d.ts +16 -0
  596. package/dist/providers/firecracker.types.js.map +1 -1
  597. package/dist/providers/vercel-network.js +1 -1
  598. package/dist/providers/vercel-network.js.map +1 -1
  599. package/dist/providers/vercel.js +6 -3
  600. package/dist/providers/vercel.js.map +1 -1
  601. package/dist/providers/versions.constants.d.ts +3 -1
  602. package/dist/providers/versions.constants.js +3 -1
  603. package/dist/providers/versions.constants.js.map +1 -1
  604. package/package.json +3 -3
  605. package/dist/adapters/agents/gemini-adapter.d.ts +0 -3
  606. package/dist/adapters/agents/gemini-adapter.js +0 -34
  607. package/dist/adapters/agents/gemini-adapter.js.map +0 -1
  608. package/dist/adapters/agents/gemini-diagnostics.d.ts +0 -2
  609. package/dist/adapters/agents/gemini-diagnostics.js +0 -15
  610. package/dist/adapters/agents/gemini-diagnostics.js.map +0 -1
  611. package/dist/adapters/agents/gemini-events.d.ts +0 -2
  612. package/dist/adapters/agents/gemini-events.js +0 -50
  613. package/dist/adapters/agents/gemini-events.js.map +0 -1
  614. package/dist/adapters/agents/gemini-request.js +0 -23
  615. package/dist/adapters/agents/gemini-request.js.map +0 -1
  616. package/dist/adapters/agents/gemini.types.js +0 -2
  617. package/dist/adapters/agents/gemini.types.js.map +0 -1
  618. package/dist/infrastructure/artifact-store.d.ts +0 -3
  619. package/dist/infrastructure/artifact-store.js +0 -110
  620. package/dist/infrastructure/artifact-store.js.map +0 -1
  621. package/dist/infrastructure/artifact-store.types.d.ts +0 -6
  622. package/dist/infrastructure/artifact-store.types.js +0 -2
  623. package/dist/infrastructure/artifact-store.types.js.map +0 -1
  624. package/dist/infrastructure/journal-retention.constants.d.ts +0 -4
  625. package/dist/infrastructure/journal-retention.constants.js +0 -5
  626. package/dist/infrastructure/journal-retention.constants.js.map +0 -1
  627. package/dist/infrastructure/journal-retention.d.ts +0 -2
  628. package/dist/infrastructure/journal-retention.js +0 -51
  629. package/dist/infrastructure/journal-retention.js.map +0 -1
  630. package/dist/infrastructure/storage-mutation-lock.constants.d.ts +0 -5
  631. package/dist/infrastructure/storage-mutation-lock.constants.js +0 -6
  632. package/dist/infrastructure/storage-mutation-lock.constants.js.map +0 -1
  633. package/dist/infrastructure/storage-mutation-lock.d.ts +0 -1
  634. package/dist/infrastructure/storage-mutation-lock.js +0 -21
  635. package/dist/infrastructure/storage-mutation-lock.js.map +0 -1
  636. package/dist/infrastructure/storage-reservations.constants.d.ts +0 -4
  637. package/dist/infrastructure/storage-reservations.constants.js +0 -5
  638. package/dist/infrastructure/storage-reservations.constants.js.map +0 -1
  639. package/dist/infrastructure/storage-reservations.d.ts +0 -2
  640. package/dist/infrastructure/storage-reservations.js +0 -150
  641. package/dist/infrastructure/storage-reservations.js.map +0 -1
  642. package/dist/infrastructure/workflow-checkpoint.d.ts +0 -3
  643. package/dist/infrastructure/workflow-checkpoint.js +0 -84
  644. package/dist/infrastructure/workflow-checkpoint.js.map +0 -1
  645. package/dist/infrastructure/workflow-checkpoint.types.d.ts +0 -6
  646. package/dist/infrastructure/workflow-checkpoint.types.js +0 -2
  647. package/dist/infrastructure/workflow-checkpoint.types.js.map +0 -1
@@ -1,52 +1,75 @@
1
+ import { authenticationForm } from "../../domain/authentication.js";
1
2
  import { invariant } from "../../domain/errors.js";
2
- import { authenticationRecipes } from "./authentication.constants.js";
3
- export function authenticationCommand(name, authentication, externalModel = false) {
4
- if (!authentication)
5
- return () => undefined;
6
- const mode = authentication.mode;
7
- invariant(mode === "api-key" ||
8
- (mode === "oauth-token" && name === "claude") ||
9
- (mode === "login" && name === "codex" && !externalModel), "Unsupported harness authentication mode");
10
- if (mode === "login") {
11
- const credentials = authentication.credentials;
12
- if (credentials === undefined)
13
- return () => undefined;
14
- try {
15
- JSON.parse(credentials);
16
- }
17
- catch {
18
- throw new Error("Invalid Codex credential JSON");
19
- }
20
- return () => ({
21
- executable: "node",
22
- arguments: ["-e", authenticationRecipes.codex.seed],
23
- stdin: credentials,
24
- });
25
- }
26
- const environment = mode === "oauth-token"
27
- ? "CLAUDE_CODE_OAUTH_TOKEN"
28
- : (authentication.environment ??
29
- authenticationRecipes[name].environment.trim().replace("=", ""));
30
- invariant(/^[A-Za-z_][A-Za-z0-9_]*$/.test(environment), "Invalid authentication environment variable");
31
- invariant(name === "codex" ||
32
- mode === "oauth-token" ||
33
- environment ===
34
- authenticationRecipes[name].environment.trim().replace("=", ""), "This CLI requires its standard authentication environment variable");
35
- return (variables) => {
36
- invariant(variables[environment], `Missing ${environment}. Declare the selected credential explicitly.`);
37
- if (name === "claude") {
38
- const conflict = mode === "oauth-token"
39
- ? "ANTHROPIC_API_KEY"
40
- : "CLAUDE_CODE_OAUTH_TOKEN";
41
- invariant(!variables[conflict], "Conflicting Claude authentication methods");
42
- }
43
- if (name !== "codex" || externalModel)
44
- return undefined;
45
- return {
46
- executable: "node",
47
- arguments: ["-e", authenticationRecipes.codex.login],
48
- stdin: variables[environment],
3
+ import { credentialRecipes } from "./authentication.constants.js";
4
+ export function credentialPlan(plan = {}) {
5
+ return Object.freeze({
6
+ variables: Object.freeze({ ...plan.variables }),
7
+ host: Object.freeze([...(plan.host ?? [])]),
8
+ files: Object.freeze([...(plan.files ?? [])]),
9
+ commands: Object.freeze([...(plan.commands ?? [])]),
10
+ });
11
+ }
12
+ export function toolCommand(binary, args, options = {}) {
13
+ return {
14
+ executable: "node",
15
+ arguments: ["-e", credentialRecipes.tool, binary, ...args],
16
+ ...options,
17
+ };
18
+ }
19
+ export function requiredVariable(variables, name) {
20
+ const value = variables[name];
21
+ invariant(value, `Missing ${name}. Declare the selected credential explicitly.`);
22
+ return value;
23
+ }
24
+ export function variableCredential(options) {
25
+ const recipe = (read) => (input) => {
26
+ options.bind?.(input);
27
+ return (variables) => {
28
+ const secret = read(input.value, variables);
29
+ options.accept?.(secret);
30
+ const exposed = options.expose?.(secret, input) ?? {};
31
+ return credentialPlan({
32
+ ...exposed,
33
+ variables: { [options.variable]: secret, ...exposed.variables },
34
+ });
49
35
  };
50
36
  };
37
+ return {
38
+ preset: recipe((_, variables) => requiredVariable(variables, options.variable)),
39
+ key: (input) => {
40
+ options.accept?.(input.value);
41
+ return recipe((value) => value)(input);
42
+ },
43
+ variable: recipe((value, variables) => requiredVariable(variables, value)),
44
+ };
45
+ }
46
+ export function hostFile(options) {
47
+ const { files, source, ...credential } = options;
48
+ const recipe = (path) => () => credentialPlan({
49
+ host: [{ ...credential, source: path }],
50
+ ...(files ? { files } : {}),
51
+ });
52
+ return {
53
+ preset: () => recipe(source),
54
+ file: (input) => recipe({ path: input.value }),
55
+ };
56
+ }
57
+ export function excluding(recipe, variable, message) {
58
+ return (input) => {
59
+ const planFor = recipe(input);
60
+ return (variables) => {
61
+ invariant(!variables[variable], message);
62
+ return planFor(variables);
63
+ };
64
+ };
65
+ }
66
+ export function credentialPlanner(agent, strategy, authentication, model) {
67
+ if (authentication === undefined)
68
+ return undefined;
69
+ const { form, value = "" } = authenticationForm(authentication);
70
+ const recipe = Object.hasOwn(strategy, form) ? strategy[form] : undefined;
71
+ const accepted = Object.keys(strategy);
72
+ invariant(recipe, `${agent} does not support ${form} authentication. Accepted forms: ${accepted.length ? accepted.join(", ") : "none"}`);
73
+ return recipe(model === undefined ? { value } : { value, model });
51
74
  }
52
75
  //# sourceMappingURL=authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,UAAU,qBAAqB,CACnC,IAAmC,EACnC,cAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,cAAc;QAAE,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IAC5C,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;IACjC,SAAS,CACP,IAAI,KAAK,SAAS;QAChB,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,QAAQ,CAAC;QAC7C,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,EAC1D,yCAAyC,CAC1C,CAAC;IACF,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC;QAC/C,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;QACtD,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,GAAG,EAAE,CAAC,CAAC;YACZ,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;YACnD,KAAK,EAAE,WAAW;SACnB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,WAAW,GACf,IAAI,KAAK,aAAa;QACpB,CAAC,CAAC,yBAAyB;QAC3B,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW;YAC3B,qBAAqB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IACvE,SAAS,CACP,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,EAC5C,6CAA6C,CAC9C,CAAC;IACF,SAAS,CACP,IAAI,KAAK,OAAO;QACd,IAAI,KAAK,aAAa;QACtB,WAAW;YACT,qBAAqB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EACnE,oEAAoE,CACrE,CAAC;IACF,OAAO,CAAC,SAAS,EAAE,EAAE;QACnB,SAAS,CACP,SAAS,CAAC,WAAW,CAAC,EACtB,WAAW,WAAW,+CAA+C,CACtE,CAAC;QACF,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,MAAM,QAAQ,GACZ,IAAI,KAAK,aAAa;gBACpB,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,yBAAyB,CAAC;YAChC,SAAS,CACP,CAAC,SAAS,CAAC,QAAQ,CAAC,EACpB,2CAA2C,CAC5C,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,KAAK,OAAO,IAAI,aAAa;YAAE,OAAO,SAAS,CAAC;QACxD,OAAO;YACL,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC;YACpD,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC;SAC9B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport type {\n AgentAdapter,\n AgentAuthentication,\n} from \"../../domain/agent.types.ts\";\nimport { authenticationRecipes } from \"./authentication.constants.ts\";\n\nexport function authenticationCommand(\n name: \"codex\" | \"claude\" | \"gemini\",\n authentication: AgentAuthentication | undefined,\n externalModel = false,\n): NonNullable<AgentAdapter[\"authenticate\"]> {\n if (!authentication) return () => undefined;\n const mode = authentication.mode;\n invariant(\n mode === \"api-key\" ||\n (mode === \"oauth-token\" && name === \"claude\") ||\n (mode === \"login\" && name === \"codex\" && !externalModel),\n \"Unsupported harness authentication mode\",\n );\n if (mode === \"login\") {\n const credentials = authentication.credentials;\n if (credentials === undefined) return () => undefined;\n try {\n JSON.parse(credentials);\n } catch {\n throw new Error(\"Invalid Codex credential JSON\");\n }\n return () => ({\n executable: \"node\",\n arguments: [\"-e\", authenticationRecipes.codex.seed],\n stdin: credentials,\n });\n }\n const environment =\n mode === \"oauth-token\"\n ? \"CLAUDE_CODE_OAUTH_TOKEN\"\n : (authentication.environment ??\n authenticationRecipes[name].environment.trim().replace(\"=\", \"\"));\n invariant(\n /^[A-Za-z_][A-Za-z0-9_]*$/.test(environment),\n \"Invalid authentication environment variable\",\n );\n invariant(\n name === \"codex\" ||\n mode === \"oauth-token\" ||\n environment ===\n authenticationRecipes[name].environment.trim().replace(\"=\", \"\"),\n \"This CLI requires its standard authentication environment variable\",\n );\n return (variables) => {\n invariant(\n variables[environment],\n `Missing ${environment}. Declare the selected credential explicitly.`,\n );\n if (name === \"claude\") {\n const conflict =\n mode === \"oauth-token\"\n ? \"ANTHROPIC_API_KEY\"\n : \"CLAUDE_CODE_OAUTH_TOKEN\";\n invariant(\n !variables[conflict],\n \"Conflicting Claude authentication methods\",\n );\n }\n if (name !== \"codex\" || externalModel) return undefined;\n return {\n executable: \"node\",\n arguments: [\"-e\", authenticationRecipes.codex.login],\n stdin: variables[environment],\n };\n };\n}\n"]}
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AASlE,MAAM,UA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C,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type {\n AgentAdapter,\n AgentAuthentication,\n CredentialPlan,\n HostCredentialPath,\n} from \"../../domain/agent.types.ts\";\nimport { authenticationForm } from \"../../domain/authentication.ts\";\nimport type { Command, Variables } from \"../../domain/command.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialRecipes } from \"./authentication.constants.ts\";\nimport type {\n CredentialPlanner,\n CredentialRecipe,\n CredentialStrategy,\n HostFileOptions,\n VariableCredentialOptions,\n} from \"./authentication.types.ts\";\n\nexport function credentialPlan(\n plan: Partial<CredentialPlan> = {},\n): CredentialPlan {\n return Object.freeze({\n variables: Object.freeze({ ...plan.variables }),\n host: Object.freeze([...(plan.host ?? [])]),\n files: Object.freeze([...(plan.files ?? [])]),\n commands: Object.freeze([...(plan.commands ?? [])]),\n });\n}\n\nexport function toolCommand(\n binary: string,\n args: readonly string[],\n options: Pick<Command, \"stdin\" | \"deadlineMs\"> = {},\n): Command {\n return {\n executable: \"node\",\n arguments: [\"-e\", credentialRecipes.tool, binary, ...args],\n ...options,\n };\n}\n\nexport function requiredVariable(variables: Variables, name: string): string {\n const value = variables[name];\n invariant(\n value,\n `Missing ${name}. Declare the selected credential explicitly.`,\n );\n return value;\n}\n\nexport function variableCredential(\n options: VariableCredentialOptions,\n): Readonly<Record<\"preset\" | \"key\" | \"variable\", CredentialRecipe>> {\n const recipe =\n (read: (value: string, variables: Variables) => string): CredentialRecipe =>\n (input) => {\n options.bind?.(input);\n return (variables) => {\n const secret = read(input.value, variables);\n options.accept?.(secret);\n const exposed = options.expose?.(secret, input) ?? {};\n return credentialPlan({\n ...exposed,\n variables: { [options.variable]: secret, ...exposed.variables },\n });\n };\n };\n return {\n preset: recipe((_, variables) =>\n requiredVariable(variables, options.variable),\n ),\n key: (input) => {\n options.accept?.(input.value);\n return recipe((value) => value)(input);\n },\n variable: recipe((value, variables) => requiredVariable(variables, value)),\n };\n}\n\nexport function hostFile(\n options: HostFileOptions,\n): Readonly<Record<\"preset\" | \"file\", CredentialRecipe>> {\n const { files, source, ...credential } = options;\n const recipe =\n (path: HostCredentialPath): CredentialPlanner =>\n () =>\n credentialPlan({\n host: [{ ...credential, source: path }],\n ...(files ? { files } : {}),\n });\n return {\n preset: () => recipe(source),\n file: (input) => recipe({ path: input.value }),\n };\n}\n\nexport function excluding(\n recipe: CredentialRecipe,\n variable: string,\n message: string,\n): CredentialRecipe {\n return (input) => {\n const planFor = recipe(input);\n return (variables) => {\n invariant(!variables[variable], message);\n return planFor(variables);\n };\n };\n}\n\nexport function credentialPlanner(\n agent: string,\n strategy: CredentialStrategy,\n authentication: AgentAuthentication | undefined,\n model?: AgentModel,\n): AgentAdapter[\"credentials\"] {\n if (authentication === undefined) return undefined;\n const { form, value = \"\" } = authenticationForm(authentication);\n const recipe = Object.hasOwn(strategy, form) ? strategy[form] : undefined;\n const accepted = Object.keys(strategy);\n invariant(\n recipe,\n `${agent} does not support ${form} authentication. Accepted forms: ${accepted.length ? accepted.join(\", \") : \"none\"}`,\n );\n return recipe(model === undefined ? { value } : { value, model });\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { CredentialPlan, HostCredential } from "../../domain/agent.types.ts";
2
+ import type { AuthenticationForm } from "../../domain/authentication.types.ts";
3
+ import type { Variables } from "../../domain/command.types.ts";
4
+ import type { AgentModel } from "../../domain/model.types.ts";
5
+ export interface CredentialInput {
6
+ readonly value: string;
7
+ readonly model?: AgentModel;
8
+ }
9
+ export type CredentialPlanner = (variables: Variables) => CredentialPlan;
10
+ export type CredentialRecipe = (input: CredentialInput) => CredentialPlanner;
11
+ export type CredentialStrategy = Readonly<Partial<Record<AuthenticationForm, CredentialRecipe>>>;
12
+ export interface VariableCredentialOptions {
13
+ readonly variable: string;
14
+ accept?(secret: string): void;
15
+ bind?(input: CredentialInput): void;
16
+ expose?(secret: string, input: CredentialInput): Partial<CredentialPlan>;
17
+ }
18
+ export interface HostFileOptions extends HostCredential {
19
+ readonly files?: CredentialPlan["files"];
20
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authentication.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.types.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n CredentialPlan,\n HostCredential,\n} from \"../../domain/agent.types.ts\";\nimport type { AuthenticationForm } from \"../../domain/authentication.types.ts\";\nimport type { Variables } from \"../../domain/command.types.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\n\nexport interface CredentialInput {\n readonly value: string;\n readonly model?: AgentModel;\n}\n\nexport type CredentialPlanner = (variables: Variables) => CredentialPlan;\n\nexport type CredentialRecipe = (input: CredentialInput) => CredentialPlanner;\n\nexport type CredentialStrategy = Readonly<\n Partial<Record<AuthenticationForm, CredentialRecipe>>\n>;\n\nexport interface VariableCredentialOptions {\n readonly variable: string;\n accept?(secret: string): void;\n bind?(input: CredentialInput): void;\n expose?(secret: string, input: CredentialInput): Partial<CredentialPlan>;\n}\n\nexport interface HostFileOptions extends HostCredential {\n readonly files?: CredentialPlan[\"files\"];\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { invariant } from "../../domain/errors.js";
2
- import { authenticationCommand } from "./authentication.js";
2
+ import { credentialPlanner } from "./authentication.js";
3
+ import { claudeCredentials } from "./claude-authentication.js";
3
4
  import { claudeEvents, claudeTranscriptUsage } from "./claude-events.js";
4
5
  import { claudeRequest } from "./claude-request.js";
5
6
  import { CLAUDE_MAX_OUTPUT_VARIABLE, claudeModelSupport, } from "./model-support.constants.js";
@@ -9,9 +10,10 @@ function bindClaude(settings) {
9
10
  const maxOutputTokens = settings.model?.maxOutputTokens;
10
11
  invariant(maxOutputTokens === undefined ||
11
12
  !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE), `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`);
13
+ const credentials = credentialPlanner("Claude Code", claudeCredentials, settings.authentication, settings.model);
12
14
  return Object.freeze({
13
15
  name: "claude",
14
- authenticate: authenticationCommand("claude", settings.authentication),
16
+ ...(credentials ? { credentials } : {}),
15
17
  conversations: "claude",
16
18
  resumable: true,
17
19
  capture: settings.saveConversations ?? true,
@@ -1 +1 @@
1
- {"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,UAAU,CAAC,QAA+B;IACjD,YAAY,CAAC,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IACxD,SAAS,CACP,eAAe,KAAK,SAAS;QAC3B,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,0BAA0B,CAAC,EACtE,6CAA6C,0BAA0B,YAAY,CACpF,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC;QACtE,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,QAAQ,CAAC,iBAAiB,IAAI,IAAI;QAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,GAAG,QAAQ,CAAC,SAAS;YACrB,GAAG,CAAC,eAAe,KAAK,SAAS;gBAC/B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;SAC/D,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC;QAClD,MAAM,EAAE,YAAY;QACpB,eAAe,EAAE,qBAAqB;KAChB,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAA2B,EAAE;IACzD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,UAAU,CAAC;YACT,GAAG,UAAU;YACb,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { authenticationCommand } from \"./authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { claudeEvents, claudeTranscriptUsage } from \"./claude-events.ts\";\nimport { claudeRequest } from \"./claude-request.ts\";\nimport {\n CLAUDE_MAX_OUTPUT_VARIABLE,\n claudeModelSupport,\n} from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nfunction bindClaude(settings: Bound<ClaudeSettings>): AgentAdapter {\n supportModel(claudeModelSupport, settings.model);\n const maxOutputTokens = settings.model?.maxOutputTokens;\n invariant(\n maxOutputTokens === undefined ||\n !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE),\n `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`,\n );\n return Object.freeze({\n name: \"claude\",\n authenticate: authenticationCommand(\"claude\", settings.authentication),\n conversations: \"claude\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({\n ...settings.variables,\n ...(maxOutputTokens === undefined\n ? {}\n : { [CLAUDE_MAX_OUTPUT_VARIABLE]: String(maxOutputTokens) }),\n }),\n request: (input) => claudeRequest(settings, input),\n events: claudeEvents,\n transcriptUsage: claudeTranscriptUsage,\n } satisfies AgentAdapter);\n}\n\nexport function claudeHarness(settings: ClaudeSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindClaude({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
1
+ {"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,aAAa,EAA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;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAA2B,EAAE;IACzD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,UAAU,CAAC;YACT,GAAG,UAAU;YACb,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { claudeCredentials } from \"./claude-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { claudeEvents, claudeTranscriptUsage } from \"./claude-events.ts\";\nimport { claudeRequest } from \"./claude-request.ts\";\nimport {\n CLAUDE_MAX_OUTPUT_VARIABLE,\n claudeModelSupport,\n} from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nfunction bindClaude(settings: Bound<ClaudeSettings>): AgentAdapter {\n supportModel(claudeModelSupport, settings.model);\n const maxOutputTokens = settings.model?.maxOutputTokens;\n invariant(\n maxOutputTokens === undefined ||\n !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE),\n `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`,\n );\n const credentials = credentialPlanner(\n \"Claude Code\",\n claudeCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"claude\",\n ...(credentials ? { credentials } : {}),\n conversations: \"claude\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({\n ...settings.variables,\n ...(maxOutputTokens === undefined\n ? {}\n : { [CLAUDE_MAX_OUTPUT_VARIABLE]: String(maxOutputTokens) }),\n }),\n request: (input) => claudeRequest(settings, input),\n events: claudeEvents,\n transcriptUsage: claudeTranscriptUsage,\n } satisfies AgentAdapter);\n}\n\nexport function claudeHarness(settings: ClaudeSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindClaude({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { CredentialStrategy } from "./authentication.types.ts";
2
+ export declare const claudeCredentials: CredentialStrategy;
@@ -0,0 +1,34 @@
1
+ import { invariant } from "../../domain/errors.js";
2
+ import { credentialVariables } from "./authentication.constants.js";
3
+ import { excluding, hostFile, variableCredential } from "./authentication.js";
4
+ import { asRecord, parseCredential } from "./protocol.js";
5
+ const { account: tokenVariable, usage: keyVariable } = credentialVariables.claude;
6
+ const token = variableCredential({ variable: tokenVariable });
7
+ const key = variableCredential({ variable: keyVariable });
8
+ function subscription(content) {
9
+ const login = asRecord(parseCredential(content, "Claude")).claudeAiOauth;
10
+ invariant(login && typeof login === "object", "The Claude credential file has no claudeAiOauth subscription login");
11
+ return JSON.stringify({ claudeAiOauth: login });
12
+ }
13
+ const file = hostFile({
14
+ source: {
15
+ path: "~/.claude/.credentials.json",
16
+ home: { variable: "CLAUDE_CONFIG_DIR", path: ".credentials.json" },
17
+ },
18
+ destination: { file: ".claude/.credentials.json" },
19
+ login: "claude and /login",
20
+ alternative: `{ account: { variable: "${tokenVariable}" } } with a token from claude setup-token`,
21
+ select: subscription,
22
+ });
23
+ const account = (recipe) => excluding(recipe, keyVariable, `Conflicting Claude authentication: ${keyVariable} takes precedence over account credentials. Remove it or select usage authentication.`);
24
+ const usage = (recipe) => excluding(recipe, tokenVariable, `Conflicting Claude authentication: remove ${tokenVariable} or select account authentication.`);
25
+ export const claudeCredentials = Object.freeze({
26
+ account: account(file.preset),
27
+ "account.file": account(file.file),
28
+ "account.key": account(token.key),
29
+ "account.variable": account(token.variable),
30
+ usage: usage(key.preset),
31
+ "usage.key": usage(key.key),
32
+ "usage.variable": usage(key.variable),
33
+ });
34
+ //# sourceMappingURL=claude-authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAK9E,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GAClD,mBAAmB,CAAC,MAAM,CAAC;AAC7B,MAAM,KAAK,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;AAC9D,MAAM,GAAG,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;AAE1D,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;IACzE,SAAS,CACP,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAClC,oEAAoE,CACrE,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,6BAA6B;QACnC,IAAI,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,mBAAmB,EAAE;KACnE;IACD,WAAW,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,2BAA2B,aAAa,4CAA4C;IACjG,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,CAAC,MAAwB,EAAE,EAAE,CAC3C,SAAS,CACP,MAAM,EACN,WAAW,EACX,sCAAsC,WAAW,uFAAuF,CACzI,CAAC;AACJ,MAAM,KAAK,GAAG,CAAC,MAAwB,EAAE,EAAE,CACzC,SAAS,CACP,MAAM,EACN,aAAa,EACb,6CAA6C,aAAa,oCAAoC,CAC/F,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAuB,MAAM,CAAC,MAAM,CAAC;IACjE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3B,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;CACtC,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport { credentialVariables } from \"./authentication.constants.ts\";\nimport { excluding, hostFile, variableCredential } from \"./authentication.ts\";\nimport type {\n CredentialRecipe,\n CredentialStrategy,\n} from \"./authentication.types.ts\";\nimport { asRecord, parseCredential } from \"./protocol.ts\";\n\nconst { account: tokenVariable, usage: keyVariable } =\n credentialVariables.claude;\nconst token = variableCredential({ variable: tokenVariable });\nconst key = variableCredential({ variable: keyVariable });\n\nfunction subscription(content: string): string {\n const login = asRecord(parseCredential(content, \"Claude\")).claudeAiOauth;\n invariant(\n login && typeof login === \"object\",\n \"The Claude credential file has no claudeAiOauth subscription login\",\n );\n return JSON.stringify({ claudeAiOauth: login });\n}\n\nconst file = hostFile({\n source: {\n path: \"~/.claude/.credentials.json\",\n home: { variable: \"CLAUDE_CONFIG_DIR\", path: \".credentials.json\" },\n },\n destination: { file: \".claude/.credentials.json\" },\n login: \"claude and /login\",\n alternative: `{ account: { variable: \"${tokenVariable}\" } } with a token from claude setup-token`,\n select: subscription,\n});\n\nconst account = (recipe: CredentialRecipe) =>\n excluding(\n recipe,\n keyVariable,\n `Conflicting Claude authentication: ${keyVariable} takes precedence over account credentials. Remove it or select usage authentication.`,\n );\nconst usage = (recipe: CredentialRecipe) =>\n excluding(\n recipe,\n tokenVariable,\n `Conflicting Claude authentication: remove ${tokenVariable} or select account authentication.`,\n );\n\nexport const claudeCredentials: CredentialStrategy = Object.freeze({\n account: account(file.preset),\n \"account.file\": account(file.file),\n \"account.key\": account(token.key),\n \"account.variable\": account(token.variable),\n usage: usage(key.preset),\n \"usage.key\": usage(key.key),\n \"usage.variable\": usage(key.variable),\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import { toolResult } from "./tool-result.js";
1
2
  import { decodeEvent, decodeLine } from "./event-decoder.js";
2
3
  import { asRecord, decodeRecord, numberOrZero } from "./protocol.js";
3
4
  function tokens(value) {
@@ -15,17 +16,50 @@ function system(event) {
15
16
  : [];
16
17
  }
17
18
  function assistant(event) {
18
- const content = asRecord(event.message).content;
19
+ const message = asRecord(event.message);
20
+ const content = message.content;
19
21
  if (!Array.isArray(content))
20
22
  return [];
21
- return content.flatMap((part) => decodeEvent(asRecord(part), {
22
- text: (block) => typeof block.text === "string"
23
- ? [{ kind: "text", text: block.text }]
24
- : [],
25
- tool_use: (block) => [
26
- { kind: "tool", name: String(block.name), input: block.input },
27
- ],
28
- }));
23
+ const usage = message.usage
24
+ ? [
25
+ {
26
+ kind: "message-usage",
27
+ tokens: tokens(message.usage),
28
+ ...(typeof message.id === "string" ? { messageId: message.id } : {}),
29
+ ...(typeof event.parent_tool_use_id === "string"
30
+ ? { parentCallId: event.parent_tool_use_id }
31
+ : {}),
32
+ },
33
+ ]
34
+ : [];
35
+ return [
36
+ ...usage,
37
+ ...content.flatMap((part) => decodeEvent(asRecord(part), {
38
+ text: (block) => typeof block.text === "string"
39
+ ? [{ kind: "text", text: block.text }]
40
+ : [],
41
+ thinking: (block) => typeof block.thinking === "string"
42
+ ? [{ kind: "reasoning", text: block.thinking }]
43
+ : [],
44
+ tool_result: (block) => toolResult(block.tool_use_id, undefined, block.content, block.is_error === true).map((value) => ({
45
+ ...value,
46
+ ...(typeof event.parent_tool_use_id === "string"
47
+ ? { parentCallId: event.parent_tool_use_id }
48
+ : {}),
49
+ })),
50
+ tool_use: (block) => [
51
+ {
52
+ kind: "tool",
53
+ name: String(block.name),
54
+ input: block.input,
55
+ ...(typeof block.id === "string" ? { callId: block.id } : {}),
56
+ ...(typeof event.parent_tool_use_id === "string"
57
+ ? { parentCallId: event.parent_tool_use_id }
58
+ : {}),
59
+ },
60
+ ],
61
+ })),
62
+ ];
29
63
  }
30
64
  function result(event) {
31
65
  const events = [];
@@ -45,6 +79,15 @@ export function claudeEvents(line) {
45
79
  return decodeLine(line, {
46
80
  system,
47
81
  assistant,
82
+ user: assistant,
83
+ stream_event: (event) => {
84
+ const delta = asRecord(asRecord(event.event).delta);
85
+ if (delta.type === "text_delta" && typeof delta.text === "string")
86
+ return [{ kind: "text-delta", text: delta.text }];
87
+ if (delta.type === "thinking_delta" && typeof delta.thinking === "string")
88
+ return [{ kind: "reasoning", text: delta.thinking }];
89
+ return [];
90
+ },
48
91
  result,
49
92
  });
50
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claude-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrE,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC;QACvC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,2BAA2B,CAAC;QAC7D,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACnD,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,KAAqB;IACnC,OAAO,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACzC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,SAAS,CAAC,KAAqB;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACvC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC9B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC1B,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAC5B,CAAC,CAAC,C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AAC;IAC7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,IAAI,KAAK,WAAW;YAAE,SAAS;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,KAAK;YAAE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, decodeRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction tokens(value: unknown): Usage {\n const usage = asRecord(value);\n return {\n input: numberOrZero(usage.input_tokens),\n cacheCreated: numberOrZero(usage.cache_creation_input_tokens),\n cached: numberOrZero(usage.cache_read_input_tokens),\n output: numberOrZero(usage.output_tokens),\n };\n}\n\nfunction system(event: ProtocolRecord): AgentEvent[] {\n return typeof event.session_id === \"string\"\n ? [{ kind: \"conversation\", id: event.session_id }]\n : [];\n}\n\nfunction assistant(event: ProtocolRecord): AgentEvent[] {\n const content = asRecord(event.message).content;\n if (!Array.isArray(content)) return [];\n return content.flatMap((part) =>\n decodeEvent(asRecord(part), {\n text: (block) =>\n typeof block.text === \"string\"\n ? [{ kind: \"text\", text: block.text }]\n : [],\n tool_use: (block) => [\n { kind: \"tool\", name: String(block.name), input: block.input },\n ],\n }),\n );\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const events: AgentEvent[] = [];\n if (!event.is_error && typeof event.result === \"string\")\n events.push({ kind: \"result\", text: event.result });\n if (event.usage) events.push({ kind: \"usage\", tokens: tokens(event.usage) });\n events.push(\n event.is_error\n ? {\n kind: \"failure\",\n message: String(\n event.result ?? JSON.stringify(event.errors) ?? \"Agent failed\",\n ),\n }\n : { kind: \"finished\" },\n );\n return events;\n}\n\nexport function claudeEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n system,\n assistant,\n result,\n } satisfies EventDecoders);\n}\n\nexport function claudeTranscriptUsage(text: string): Usage | undefined {\n let usage: Usage | undefined;\n for (const line of text.split(/\\r?\\n/)) {\n const event = decodeRecord(line);\n if (event?.type !== \"assistant\") continue;\n const message = asRecord(event.message);\n if (message.usage) usage = tokens(message.usage);\n }\n return usage;\n}\n"]}
1
+ {"version":3,"file":"claude-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrE,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC;QACvC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,2BAA2B,CAAC;QAC7D,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACnD,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,KAAqB;IACnC,OAAO,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACzC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,SAAS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AAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,IAAI,KAAK,WAAW;YAAE,SAAS;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,KAAK;YAAE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, decodeRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction tokens(value: unknown): Usage {\n const usage = asRecord(value);\n return {\n input: numberOrZero(usage.input_tokens),\n cacheCreated: numberOrZero(usage.cache_creation_input_tokens),\n cached: numberOrZero(usage.cache_read_input_tokens),\n output: numberOrZero(usage.output_tokens),\n };\n}\n\nfunction system(event: ProtocolRecord): AgentEvent[] {\n return typeof event.session_id === \"string\"\n ? [{ kind: \"conversation\", id: event.session_id }]\n : [];\n}\n\nfunction assistant(event: ProtocolRecord): AgentEvent[] {\n const message = asRecord(event.message);\n const content = message.content;\n if (!Array.isArray(content)) return [];\n const usage: AgentEvent[] = message.usage\n ? [\n {\n kind: \"message-usage\",\n tokens: tokens(message.usage),\n ...(typeof message.id === \"string\" ? { messageId: message.id } : {}),\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n },\n ]\n : [];\n return [\n ...usage,\n ...content.flatMap((part) =>\n decodeEvent(asRecord(part), {\n text: (block) =>\n typeof block.text === \"string\"\n ? [{ kind: \"text\", text: block.text }]\n : [],\n thinking: (block) =>\n typeof block.thinking === \"string\"\n ? [{ kind: \"reasoning\", text: block.thinking }]\n : [],\n tool_result: (block) =>\n toolResult(\n block.tool_use_id,\n undefined,\n block.content,\n block.is_error === true,\n ).map((value) => ({\n ...value,\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n })),\n tool_use: (block) => [\n {\n kind: \"tool\",\n name: String(block.name),\n input: block.input,\n ...(typeof block.id === \"string\" ? { callId: block.id } : {}),\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n },\n ],\n }),\n ),\n ];\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const events: AgentEvent[] = [];\n if (!event.is_error && typeof event.result === \"string\")\n events.push({ kind: \"result\", text: event.result });\n if (event.usage) events.push({ kind: \"usage\", tokens: tokens(event.usage) });\n events.push(\n event.is_error\n ? {\n kind: \"failure\",\n message: String(\n event.result ?? JSON.stringify(event.errors) ?? \"Agent failed\",\n ),\n }\n : { kind: \"finished\" },\n );\n return events;\n}\n\nexport function claudeEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n system,\n assistant,\n user: assistant,\n stream_event: (event) => {\n const delta = asRecord(asRecord(event.event).delta);\n if (delta.type === \"text_delta\" && typeof delta.text === \"string\")\n return [{ kind: \"text-delta\", text: delta.text }];\n if (delta.type === \"thinking_delta\" && typeof delta.thinking === \"string\")\n return [{ kind: \"reasoning\", text: delta.thinking }];\n return [];\n },\n result,\n } satisfies EventDecoders);\n}\n\nexport function claudeTranscriptUsage(text: string): Usage | undefined {\n let usage: Usage | undefined;\n for (const line of text.split(/\\r?\\n/)) {\n const event = decodeRecord(line);\n if (event?.type !== \"assistant\") continue;\n const message = asRecord(event.message);\n if (message.usage) usage = tokens(message.usage);\n }\n return usage;\n}\n"]}
@@ -4,6 +4,8 @@ export function claudeRequest(settings, input) {
4
4
  const args = [];
5
5
  if (!input.interactive)
6
6
  args.push("--print", "--verbose", "--output-format", "stream-json");
7
+ if (!input.interactive && settings.partialMessages)
8
+ args.push("--include-partial-messages");
7
9
  if (settings.model)
8
10
  args.push("--model", settings.model.name);
9
11
  if (settings.model?.reasoning)
@@ -1 +1 @@
1
- {"version":3,"file":"claude-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,UAAU,aAAa,CAC3B,QAA+B,EAC/B,KAAiB;IAEjB,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,WAAW;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;IACtE,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,QAAQ,CAAC,WAAW;QACtB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,WAAW;QAC7C,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC9C,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,IAAI;QACf,GAAG,CAAC,KAAK,CAAC,WAAW;YACnB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;YACvB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { validateContinuation } from \"./continuation.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nexport function claudeRequest(\n settings: Bound<ClaudeSettings>,\n input: AgentInput,\n): Command {\n validateContinuation(input);\n const args: string[] = [];\n if (!input.interactive)\n args.push(\"--print\", \"--verbose\", \"--output-format\", \"stream-json\");\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (settings.model?.reasoning)\n args.push(\"--effort\", settings.model.reasoning);\n if (settings.permissions)\n args.push(\"--permission-mode\", settings.permissions);\n if (!settings.permissions && !input.interactive)\n args.push(\"--dangerously-skip-permissions\");\n if (input.continuation) {\n args.push(\"--resume\", input.continuation.id);\n if (input.continuation.fork) args.push(\"--fork-session\");\n }\n if (input.interactive && input.text !== undefined)\n args.push(\"--\", input.text);\n return {\n executable: \"claude\",\n arguments: args,\n ...(input.interactive\n ? { interactive: true }\n : { stdin: input.text ?? \"\" }),\n };\n}\n"]}
1
+ {"version":3,"file":"claude-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,UAAU,aAAa,CAC3B,QAA+B,EAC/B,KAAiB;IAEjB,oB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AK,CAAC,WAAW;YACnB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;YACvB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { validateContinuation } from \"./continuation.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nexport function claudeRequest(\n settings: Bound<ClaudeSettings>,\n input: AgentInput,\n): Command {\n validateContinuation(input);\n const args: string[] = [];\n if (!input.interactive)\n args.push(\"--print\", \"--verbose\", \"--output-format\", \"stream-json\");\n if (!input.interactive && settings.partialMessages)\n args.push(\"--include-partial-messages\");\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (settings.model?.reasoning)\n args.push(\"--effort\", settings.model.reasoning);\n if (settings.permissions)\n args.push(\"--permission-mode\", settings.permissions);\n if (!settings.permissions && !input.interactive)\n args.push(\"--dangerously-skip-permissions\");\n if (input.continuation) {\n args.push(\"--resume\", input.continuation.id);\n if (input.continuation.fork) args.push(\"--fork-session\");\n }\n if (input.interactive && input.text !== undefined)\n args.push(\"--\", input.text);\n return {\n executable: \"claude\",\n arguments: args,\n ...(input.interactive\n ? { interactive: true }\n : { stdin: input.text ?? \"\" }),\n };\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  import type { AgentCliScenario } from "./cli-diagnostics.types.ts";
2
2
  export declare const cliDiagnosticScenarios: readonly AgentCliScenario[];
3
3
  export declare const codexDiagnosticUsage: {
4
- readonly start: "codex exec";
5
- readonly resume: "codex exec resume";
6
- readonly fork: "codex exec fork";
4
+ readonly start: "Usage: codex exec [";
5
+ readonly resume: "Usage: codex exec resume [";
6
+ readonly fork: "Usage: codex exec fork [";
7
7
  };
8
8
  export declare const claudeDiagnosticUsage: {
9
- readonly start: "claude";
10
- readonly resume: "claude";
11
- readonly fork: "claude";
9
+ readonly start: "Usage: claude [";
10
+ readonly resume: "Usage: claude [";
11
+ readonly fork: "Usage: claude [";
12
12
  };
@@ -12,13 +12,13 @@ export const cliDiagnosticScenarios = [
12
12
  },
13
13
  ];
14
14
  export const codexDiagnosticUsage = {
15
- start: "codex exec",
16
- resume: "codex exec resume",
17
- fork: "codex exec fork",
15
+ start: "Usage: codex exec [",
16
+ resume: "Usage: codex exec resume [",
17
+ fork: "Usage: codex exec fork [",
18
18
  };
19
19
  export const claudeDiagnosticUsage = {
20
- start: "claude",
21
- resume: "claude",
22
- fork: "claude",
20
+ start: "Usage: claude [",
21
+ resume: "Usage: claude [",
22
+ fork: "Usage: claude [",
23
23
  };
24
24
  //# sourceMappingURL=cli-diagnostics.constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-diagnostics.constants.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IACjE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE;KACxE;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,IAAI,EAAE;SACzE;KACF;CACF,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,iBAAiB;CACf,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;CACN,CAAC","sourcesContent":["import type { AgentCliScenario } from \"./cli-diagnostics.types.ts\";\n\nexport const cliDiagnosticScenarios: readonly AgentCliScenario[] = [\n { mode: \"start\", input: {} },\n {\n mode: \"resume\",\n input: { continuation: { id: \"00000000-0000-0000-0000-000000000000\" } },\n },\n {\n mode: \"fork\",\n input: {\n continuation: { id: \"00000000-0000-0000-0000-000000000000\", fork: true },\n },\n },\n];\nexport const codexDiagnosticUsage = {\n start: \"codex exec\",\n resume: \"codex exec resume\",\n fork: \"codex exec fork\",\n} as const;\nexport const claudeDiagnosticUsage = {\n start: \"claude\",\n resume: \"claude\",\n fork: \"claude\",\n} as const;\n"]}
1
+ {"version":3,"file":"cli-diagnostics.constants.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IACjE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE;KACxE;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,IAAI,EAAE;SACzE;KACF;CACF,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,0BAA0B;CACxB,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,iBAAiB;CACf,CAAC","sourcesContent":["import type { AgentCliScenario } from \"./cli-diagnostics.types.ts\";\n\nexport const cliDiagnosticScenarios: readonly AgentCliScenario[] = [\n { mode: \"start\", input: {} },\n {\n mode: \"resume\",\n input: { continuation: { id: \"00000000-0000-0000-0000-000000000000\" } },\n },\n {\n mode: \"fork\",\n input: {\n continuation: { id: \"00000000-0000-0000-0000-000000000000\", fork: true },\n },\n },\n];\nexport const codexDiagnosticUsage = {\n start: \"Usage: codex exec [\",\n resume: \"Usage: codex exec resume [\",\n fork: \"Usage: codex exec fork [\",\n} as const;\nexport const claudeDiagnosticUsage = {\n start: \"Usage: claude [\",\n resume: \"Usage: claude [\",\n fork: \"Usage: claude [\",\n} as const;\n"]}
@@ -2,3 +2,4 @@ import type { AgentInput } from "../../domain/agent.types.ts";
2
2
  import type { Command } from "../../domain/command.types.ts";
3
3
  import type { AgentCliDiagnostic, AgentCliMode } from "./cli-diagnostics.types.ts";
4
4
  export declare function cliDiagnostics(request: (input: AgentInput) => Command, usage: Readonly<Record<AgentCliMode, string>>): readonly AgentCliDiagnostic[];
5
+ export declare function helpDiagnostics(request: (input: AgentInput) => Command, usage: string, resume?: boolean): readonly AgentCliDiagnostic[];
@@ -11,4 +11,22 @@ export function cliDiagnostics(request, usage) {
11
11
  };
12
12
  });
13
13
  }
14
+ export function helpDiagnostics(request, usage, resume = false) {
15
+ const modes = resume ? ["start", "resume"] : ["start"];
16
+ return modes.map((mode) => {
17
+ const command = request(mode === "resume"
18
+ ? { continuation: { id: "00000000-0000-0000-0000-000000000000" } }
19
+ : {});
20
+ return {
21
+ mode,
22
+ usage,
23
+ options: (command.arguments ?? []).filter((argument) => argument.startsWith("--")),
24
+ command: {
25
+ executable: command.executable,
26
+ arguments: ["--help"],
27
+ ...(command.variables ? { variables: command.variables } : {}),
28
+ },
29
+ };
30
+ });
31
+ }
14
32
  //# sourceMappingURL=cli-diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7D,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n"]}
1
+ {"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAA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C,CAAC,EAAE,CAAC;aAC/D;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n\nexport function helpDiagnostics(\n request: (input: AgentInput) => Command,\n usage: string,\n resume = false,\n): readonly AgentCliDiagnostic[] {\n const modes = resume ? ([\"start\", \"resume\"] as const) : ([\"start\"] as const);\n return modes.map((mode) => {\n const command = request(\n mode === \"resume\"\n ? { continuation: { id: \"00000000-0000-0000-0000-000000000000\" } }\n : {},\n );\n return {\n mode,\n usage,\n options: (command.arguments ?? []).filter((argument) =>\n argument.startsWith(\"--\"),\n ),\n command: {\n executable: command.executable,\n arguments: [\"--help\"],\n ...(command.variables ? { variables: command.variables } : {}),\n },\n };\n });\n}\n"]}
@@ -1,4 +1,5 @@
1
- import { authenticationCommand } from "./authentication.js";
1
+ import { credentialPlanner } from "./authentication.js";
2
+ import { codexCredentials } from "./codex-authentication.js";
2
3
  import { codexProvider } from "./codex-provider.js";
3
4
  import { codexEvents } from "./codex-events.js";
4
5
  import { codexRequest } from "./codex-request.js";
@@ -7,9 +8,10 @@ import { harnessSettings, supportModel } from "./model-support.js";
7
8
  function bindCodex(settings) {
8
9
  supportModel(codexModelSupport, settings.model);
9
10
  codexProvider(settings);
11
+ const credentials = credentialPlanner("Codex", codexCredentials(settings.modelProvider), settings.authentication, settings.model);
10
12
  return Object.freeze({
11
13
  name: "codex",
12
- authenticate: authenticationCommand("codex", settings.authentication, settings.modelProvider !== undefined),
14
+ ...(credentials ? { credentials } : {}),
13
15
  conversations: "codex",
14
16
  resumable: true,
15
17
  capture: settings.saveConversations ?? true,
@@ -1 +1 @@
1
- {"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,SAAS,CAAC,QAA8B;IAC/C,YAAY,CAAC,iBAAiB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,OAAO;QACb,YAAY,EAAE,qBAAqB,CACjC,OAAO,EACP,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,aAAa,KAAK,SAAS,CACrC;QACD,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,QAAQ,CAAC,iBAAiB,IAAI,IAAI;QAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;QACjD,MAAM,EAAE,WAAW;KACG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAA0B,EAAE;IACvD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,SAAS,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentModel } from \"../../domain/model.types.ts\";\nimport { authenticationCommand } from \"./authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { codexProvider } from \"./codex-provider.ts\";\nimport { codexEvents } from \"./codex-events.ts\";\nimport { codexRequest } from \"./codex-request.ts\";\nimport { codexModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, CodexSettings } from \"./settings.types.ts\";\n\nfunction bindCodex(settings: Bound<CodexSettings>): AgentAdapter {\n supportModel(codexModelSupport, settings.model);\n codexProvider(settings);\n return Object.freeze({\n name: \"codex\",\n authenticate: authenticationCommand(\n \"codex\",\n settings.authentication,\n settings.modelProvider !== undefined,\n ),\n conversations: \"codex\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({ ...settings.variables }),\n request: (input) => codexRequest(settings, input),\n events: codexEvents,\n } satisfies AgentAdapter);\n}\n\nexport function codexHarness(settings: CodexSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindCodex({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
1
+ {"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,SAAS,CAAC,QAA8B;IAC/C,YAAY,CAAC,iBAAiB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,iBAAiB,CACnC,OAAO,EACP,gBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,EACxC,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,OAAO;QACb,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,QAAQ,CAAC,iBAAiB,IAAI,IAAI;QAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;QACjD,MAAM,EAAE,WAAW;KACG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAA0B,EAAE;IACvD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,SAAS,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { codexCredentials } from \"./codex-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { codexProvider } from \"./codex-provider.ts\";\nimport { codexEvents } from \"./codex-events.ts\";\nimport { codexRequest } from \"./codex-request.ts\";\nimport { codexModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, CodexSettings } from \"./settings.types.ts\";\n\nfunction bindCodex(settings: Bound<CodexSettings>): AgentAdapter {\n supportModel(codexModelSupport, settings.model);\n codexProvider(settings);\n const credentials = credentialPlanner(\n \"Codex\",\n codexCredentials(settings.modelProvider),\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"codex\",\n ...(credentials ? { credentials } : {}),\n conversations: \"codex\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({ ...settings.variables }),\n request: (input) => codexRequest(settings, input),\n events: codexEvents,\n } satisfies AgentAdapter);\n}\n\nexport function codexHarness(settings: CodexSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindCodex({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { CredentialStrategy } from "./authentication.types.ts";
2
+ import type { CodexModelProvider } from "./settings.types.ts";
3
+ export declare function codexCredentials(provider: CodexModelProvider | undefined): CredentialStrategy;