@elie-laloum/outpost 5.0.0 → 6.0.1

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 (270) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +11 -11
  3. package/SECURITY.md +2 -0
  4. package/dist/adapters/agents/antigravity-adapter.d.ts +3 -0
  5. package/dist/adapters/agents/antigravity-adapter.js +39 -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 +66 -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 +29 -0
  18. package/dist/adapters/agents/antigravity-request.js.map +1 -0
  19. package/dist/adapters/agents/{gemini.types.d.ts → antigravity.types.d.ts} +2 -2
  20. package/dist/adapters/agents/antigravity.types.js +2 -0
  21. package/dist/adapters/agents/antigravity.types.js.map +1 -0
  22. package/dist/adapters/agents/authentication.constants.d.ts +19 -9
  23. package/dist/adapters/agents/authentication.constants.js +12 -9
  24. package/dist/adapters/agents/authentication.constants.js.map +1 -1
  25. package/dist/adapters/agents/authentication.d.ts +11 -2
  26. package/dist/adapters/agents/authentication.js +70 -47
  27. package/dist/adapters/agents/authentication.js.map +1 -1
  28. package/dist/adapters/agents/authentication.types.d.ts +20 -0
  29. package/dist/adapters/agents/authentication.types.js +2 -0
  30. package/dist/adapters/agents/authentication.types.js.map +1 -0
  31. package/dist/adapters/agents/claude-adapter.js +4 -2
  32. package/dist/adapters/agents/claude-adapter.js.map +1 -1
  33. package/dist/adapters/agents/claude-authentication.d.ts +2 -0
  34. package/dist/adapters/agents/claude-authentication.js +34 -0
  35. package/dist/adapters/agents/claude-authentication.js.map +1 -0
  36. package/dist/adapters/agents/cli-diagnostics.constants.d.ts +6 -6
  37. package/dist/adapters/agents/cli-diagnostics.constants.js +6 -6
  38. package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -1
  39. package/dist/adapters/agents/cli-diagnostics.d.ts +1 -0
  40. package/dist/adapters/agents/cli-diagnostics.js +11 -0
  41. package/dist/adapters/agents/cli-diagnostics.js.map +1 -1
  42. package/dist/adapters/agents/codex-adapter.js +4 -2
  43. package/dist/adapters/agents/codex-adapter.js.map +1 -1
  44. package/dist/adapters/agents/codex-authentication.d.ts +3 -0
  45. package/dist/adapters/agents/codex-authentication.js +47 -0
  46. package/dist/adapters/agents/codex-authentication.js.map +1 -0
  47. package/dist/adapters/agents/copilot-adapter.d.ts +3 -0
  48. package/dist/adapters/agents/copilot-adapter.js +39 -0
  49. package/dist/adapters/agents/copilot-adapter.js.map +1 -0
  50. package/dist/adapters/agents/copilot-authentication.d.ts +2 -0
  51. package/dist/adapters/agents/copilot-authentication.js +45 -0
  52. package/dist/adapters/agents/copilot-authentication.js.map +1 -0
  53. package/dist/adapters/agents/copilot-diagnostics.d.ts +1 -0
  54. package/dist/adapters/agents/copilot-diagnostics.js +6 -0
  55. package/dist/adapters/agents/copilot-diagnostics.js.map +1 -0
  56. package/dist/adapters/agents/copilot-events.d.ts +2 -0
  57. package/dist/adapters/agents/copilot-events.js +50 -0
  58. package/dist/adapters/agents/copilot-events.js.map +1 -0
  59. package/dist/adapters/agents/copilot-request.d.ts +5 -0
  60. package/dist/adapters/agents/copilot-request.js +19 -0
  61. package/dist/adapters/agents/copilot-request.js.map +1 -0
  62. package/dist/adapters/agents/copilot.types.d.ts +6 -0
  63. package/dist/adapters/agents/copilot.types.js +2 -0
  64. package/dist/adapters/agents/copilot.types.js.map +1 -0
  65. package/dist/adapters/agents/event-decoder.d.ts +2 -2
  66. package/dist/adapters/agents/event-decoder.js +6 -5
  67. package/dist/adapters/agents/event-decoder.js.map +1 -1
  68. package/dist/adapters/agents/kimi-adapter.d.ts +3 -0
  69. package/dist/adapters/agents/kimi-adapter.js +35 -0
  70. package/dist/adapters/agents/kimi-adapter.js.map +1 -0
  71. package/dist/adapters/agents/kimi-authentication.d.ts +2 -0
  72. package/dist/adapters/agents/kimi-authentication.js +48 -0
  73. package/dist/adapters/agents/kimi-authentication.js.map +1 -0
  74. package/dist/adapters/agents/kimi-diagnostics.d.ts +1 -0
  75. package/dist/adapters/agents/kimi-diagnostics.js +6 -0
  76. package/dist/adapters/agents/kimi-diagnostics.js.map +1 -0
  77. package/dist/adapters/agents/kimi-events.d.ts +2 -0
  78. package/dist/adapters/agents/kimi-events.js +51 -0
  79. package/dist/adapters/agents/kimi-events.js.map +1 -0
  80. package/dist/adapters/agents/{gemini-request.d.ts → kimi-request.d.ts} +2 -2
  81. package/dist/adapters/agents/kimi-request.js +28 -0
  82. package/dist/adapters/agents/kimi-request.js.map +1 -0
  83. package/dist/adapters/agents/kimi.types.d.ts +6 -0
  84. package/dist/adapters/agents/kimi.types.js +2 -0
  85. package/dist/adapters/agents/kimi.types.js.map +1 -0
  86. package/dist/adapters/agents/model-support.constants.d.ts +3 -1
  87. package/dist/adapters/agents/model-support.constants.js +12 -2
  88. package/dist/adapters/agents/model-support.constants.js.map +1 -1
  89. package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -2
  90. package/dist/adapters/agents/protocol-fixtures.constants.js +135 -9
  91. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
  92. package/dist/adapters/agents/protocol-fixtures.types.d.ts +1 -0
  93. package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -1
  94. package/dist/adapters/agents/protocol.d.ts +1 -0
  95. package/dist/adapters/agents/protocol.js +9 -0
  96. package/dist/adapters/agents/protocol.js.map +1 -1
  97. package/dist/application/agent-authentication.d.ts +4 -0
  98. package/dist/application/agent-authentication.js +32 -0
  99. package/dist/application/agent-authentication.js.map +1 -0
  100. package/dist/application/agent-bootstrap.constants.d.ts +2 -5
  101. package/dist/application/agent-bootstrap.constants.js +29 -4
  102. package/dist/application/agent-bootstrap.constants.js.map +1 -1
  103. package/dist/application/agent-bootstrap.js +33 -12
  104. package/dist/application/agent-bootstrap.js.map +1 -1
  105. package/dist/application/agent-bootstrap.types.d.ts +20 -0
  106. package/dist/application/agent-bootstrap.types.js +2 -0
  107. package/dist/application/agent-bootstrap.types.js.map +1 -0
  108. package/dist/application/credential-installer.constants.d.ts +1 -0
  109. package/dist/application/credential-installer.constants.js +22 -0
  110. package/dist/application/credential-installer.constants.js.map +1 -0
  111. package/dist/application/doctor-agent.constants.d.ts +2 -8
  112. package/dist/application/doctor-agent.constants.js +40 -6
  113. package/dist/application/doctor-agent.constants.js.map +1 -1
  114. package/dist/application/doctor-agent.d.ts +2 -1
  115. package/dist/application/doctor-agent.js +11 -3
  116. package/dist/application/doctor-agent.js.map +1 -1
  117. package/dist/application/doctor-image.js +4 -6
  118. package/dist/application/doctor-image.js.map +1 -1
  119. package/dist/application/doctor-protocol.js +6 -11
  120. package/dist/application/doctor-protocol.js.map +1 -1
  121. package/dist/application/doctor-protocol.types.d.ts +1 -1
  122. package/dist/application/doctor-protocol.types.js.map +1 -1
  123. package/dist/application/doctor-sandbox.js +2 -5
  124. package/dist/application/doctor-sandbox.js.map +1 -1
  125. package/dist/application/doctor.js +2 -4
  126. package/dist/application/doctor.js.map +1 -1
  127. package/dist/application/doctor.types.d.ts +9 -1
  128. package/dist/application/doctor.types.js.map +1 -1
  129. package/dist/application/outpost.types.d.ts +0 -1
  130. package/dist/application/outpost.types.js.map +1 -1
  131. package/dist/application/recovery-retention.js +65 -24
  132. package/dist/application/recovery-retention.js.map +1 -1
  133. package/dist/application/sandbox-agents.js +9 -8
  134. package/dist/application/sandbox-agents.js.map +1 -1
  135. package/dist/application/sandbox-dispatch.js +0 -2
  136. package/dist/application/sandbox-dispatch.js.map +1 -1
  137. package/dist/application/sandbox-session.types.d.ts +5 -0
  138. package/dist/application/sandbox-session.types.js.map +1 -1
  139. package/dist/application/startup-recovery.js +1 -1
  140. package/dist/application/startup-recovery.js.map +1 -1
  141. package/dist/application/storage-reservation.js +9 -2
  142. package/dist/application/storage-reservation.js.map +1 -1
  143. package/dist/cli/doctor-command.js +5 -1
  144. package/dist/cli/doctor-command.js.map +1 -1
  145. package/dist/cli/init-authentication.d.ts +4 -1
  146. package/dist/cli/init-authentication.js +28 -33
  147. package/dist/cli/init-authentication.js.map +1 -1
  148. package/dist/cli/init-command.js +3 -3
  149. package/dist/cli/init-command.js.map +1 -1
  150. package/dist/cli/main.constants.d.ts +50 -13
  151. package/dist/cli/main.constants.js +70 -8
  152. package/dist/cli/main.constants.js.map +1 -1
  153. package/dist/cli/scaffold-files.js +1 -1
  154. package/dist/cli/scaffold-files.js.map +1 -1
  155. package/dist/cli/scaffold-validation.js +29 -22
  156. package/dist/cli/scaffold-validation.js.map +1 -1
  157. package/dist/cli/scaffold.constants.d.ts +0 -1
  158. package/dist/cli/scaffold.constants.js +5 -2
  159. package/dist/cli/scaffold.constants.js.map +1 -1
  160. package/dist/cli/scaffold.types.d.ts +8 -2
  161. package/dist/cli/scaffold.types.js.map +1 -1
  162. package/dist/cli/starters.js +1 -3
  163. package/dist/cli/starters.js.map +1 -1
  164. package/dist/domain/agent.types.d.ts +47 -11
  165. package/dist/domain/agent.types.js.map +1 -1
  166. package/dist/domain/authentication.constants.d.ts +3 -0
  167. package/dist/domain/authentication.constants.js +11 -0
  168. package/dist/domain/authentication.constants.js.map +1 -0
  169. package/dist/domain/authentication.d.ts +3 -0
  170. package/dist/domain/authentication.js +22 -0
  171. package/dist/domain/authentication.js.map +1 -0
  172. package/dist/domain/authentication.types.d.ts +5 -0
  173. package/dist/domain/authentication.types.js +2 -0
  174. package/dist/domain/authentication.types.js.map +1 -0
  175. package/dist/domain/harness.d.ts +2 -2
  176. package/dist/domain/harness.js.map +1 -1
  177. package/dist/domain/harness.types.d.ts +2 -2
  178. package/dist/domain/harness.types.js.map +1 -1
  179. package/dist/index.d.ts +4 -8
  180. package/dist/index.js +1 -3
  181. package/dist/index.js.map +1 -1
  182. package/dist/infrastructure/git/git.constants.d.ts +1 -1
  183. package/dist/infrastructure/git/git.constants.js +1 -0
  184. package/dist/infrastructure/git/git.constants.js.map +1 -1
  185. package/dist/infrastructure/host-credentials.constants.d.ts +1 -0
  186. package/dist/infrastructure/host-credentials.constants.js +2 -0
  187. package/dist/infrastructure/host-credentials.constants.js.map +1 -0
  188. package/dist/infrastructure/host-credentials.d.ts +4 -0
  189. package/dist/infrastructure/host-credentials.js +89 -0
  190. package/dist/infrastructure/host-credentials.js.map +1 -0
  191. package/dist/infrastructure/inspection-path.js +4 -3
  192. package/dist/infrastructure/inspection-path.js.map +1 -1
  193. package/dist/infrastructure/journal.js +7 -74
  194. package/dist/infrastructure/journal.js.map +1 -1
  195. package/dist/infrastructure/journal.types.d.ts +0 -2
  196. package/dist/infrastructure/journal.types.js.map +1 -1
  197. package/dist/infrastructure/local-transport.js +9 -4
  198. package/dist/infrastructure/local-transport.js.map +1 -1
  199. package/dist/infrastructure/repository-transport.constants.d.ts +1 -0
  200. package/dist/infrastructure/repository-transport.constants.js +2 -0
  201. package/dist/infrastructure/repository-transport.constants.js.map +1 -0
  202. package/dist/infrastructure/repository-transport.d.ts +2 -0
  203. package/dist/infrastructure/repository-transport.js +9 -0
  204. package/dist/infrastructure/repository-transport.js.map +1 -0
  205. package/dist/infrastructure/resource-activity-inspection.js +19 -24
  206. package/dist/infrastructure/resource-activity-inspection.js.map +1 -1
  207. package/dist/infrastructure/resource-activity.constants.d.ts +0 -1
  208. package/dist/infrastructure/resource-activity.constants.js +0 -1
  209. package/dist/infrastructure/resource-activity.constants.js.map +1 -1
  210. package/dist/infrastructure/resource-activity.js +20 -83
  211. package/dist/infrastructure/resource-activity.js.map +1 -1
  212. package/dist/infrastructure/storage-inventory.constants.js +1 -0
  213. package/dist/infrastructure/storage-inventory.constants.js.map +1 -1
  214. package/dist/infrastructure/storage-inventory.types.d.ts +1 -1
  215. package/dist/infrastructure/storage-inventory.types.js.map +1 -1
  216. package/dist/infrastructure/storage-reservations.types.d.ts +0 -8
  217. package/dist/infrastructure/storage-reservations.types.js.map +1 -1
  218. package/dist/infrastructure/transport-reservations.d.ts +1 -1
  219. package/dist/infrastructure/transport-reservations.js +14 -8
  220. package/dist/infrastructure/transport-reservations.js.map +1 -1
  221. package/dist/providers/agents.d.ts +7 -2
  222. package/dist/providers/agents.js +4 -1
  223. package/dist/providers/agents.js.map +1 -1
  224. package/dist/providers/versions.constants.d.ts +3 -1
  225. package/dist/providers/versions.constants.js +3 -1
  226. package/dist/providers/versions.constants.js.map +1 -1
  227. package/package.json +3 -3
  228. package/dist/adapters/agents/gemini-adapter.d.ts +0 -3
  229. package/dist/adapters/agents/gemini-adapter.js +0 -34
  230. package/dist/adapters/agents/gemini-adapter.js.map +0 -1
  231. package/dist/adapters/agents/gemini-diagnostics.d.ts +0 -2
  232. package/dist/adapters/agents/gemini-diagnostics.js +0 -15
  233. package/dist/adapters/agents/gemini-diagnostics.js.map +0 -1
  234. package/dist/adapters/agents/gemini-events.d.ts +0 -2
  235. package/dist/adapters/agents/gemini-events.js +0 -50
  236. package/dist/adapters/agents/gemini-events.js.map +0 -1
  237. package/dist/adapters/agents/gemini-request.js +0 -23
  238. package/dist/adapters/agents/gemini-request.js.map +0 -1
  239. package/dist/adapters/agents/gemini.types.js +0 -2
  240. package/dist/adapters/agents/gemini.types.js.map +0 -1
  241. package/dist/infrastructure/artifact-store.d.ts +0 -3
  242. package/dist/infrastructure/artifact-store.js +0 -110
  243. package/dist/infrastructure/artifact-store.js.map +0 -1
  244. package/dist/infrastructure/artifact-store.types.d.ts +0 -6
  245. package/dist/infrastructure/artifact-store.types.js +0 -2
  246. package/dist/infrastructure/artifact-store.types.js.map +0 -1
  247. package/dist/infrastructure/journal-retention.constants.d.ts +0 -4
  248. package/dist/infrastructure/journal-retention.constants.js +0 -5
  249. package/dist/infrastructure/journal-retention.constants.js.map +0 -1
  250. package/dist/infrastructure/journal-retention.d.ts +0 -2
  251. package/dist/infrastructure/journal-retention.js +0 -51
  252. package/dist/infrastructure/journal-retention.js.map +0 -1
  253. package/dist/infrastructure/storage-mutation-lock.constants.d.ts +0 -5
  254. package/dist/infrastructure/storage-mutation-lock.constants.js +0 -6
  255. package/dist/infrastructure/storage-mutation-lock.constants.js.map +0 -1
  256. package/dist/infrastructure/storage-mutation-lock.d.ts +0 -1
  257. package/dist/infrastructure/storage-mutation-lock.js +0 -21
  258. package/dist/infrastructure/storage-mutation-lock.js.map +0 -1
  259. package/dist/infrastructure/storage-reservations.constants.d.ts +0 -4
  260. package/dist/infrastructure/storage-reservations.constants.js +0 -5
  261. package/dist/infrastructure/storage-reservations.constants.js.map +0 -1
  262. package/dist/infrastructure/storage-reservations.d.ts +0 -2
  263. package/dist/infrastructure/storage-reservations.js +0 -150
  264. package/dist/infrastructure/storage-reservations.js.map +0 -1
  265. package/dist/infrastructure/workflow-checkpoint.d.ts +0 -3
  266. package/dist/infrastructure/workflow-checkpoint.js +0 -84
  267. package/dist/infrastructure/workflow-checkpoint.js.map +0 -1
  268. package/dist/infrastructure/workflow-checkpoint.types.d.ts +0 -6
  269. package/dist/infrastructure/workflow-checkpoint.types.js +0 -2
  270. package/dist/infrastructure/workflow-checkpoint.types.js.map +0 -1
@@ -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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,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,UAAU,cAAc,CAC5B,OAAgC,EAAE;IAElC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,EAAE,MAAM,C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KAAK,EAAE,EAAE;QACf,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,CAAC,SAAS,EAAE,EAAE;YACnB,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;YACzC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,QAA4B,EAC5B,cAA+C,EAC/C,KAAkB;IAElB,IAAI,cAAc,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,SAAS,CACP,MAAM,EACN,GAAG,KAAK,qBAAqB,IAAI,oCAAoC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CACtH,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,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 ??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C/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,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,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C,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,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): readonly AgentCliDiagnostic[];
@@ -11,4 +11,15 @@ export function cliDiagnostics(request, usage) {
11
11
  };
12
12
  });
13
13
  }
14
+ export function helpDiagnostics(request, usage) {
15
+ const command = request({});
16
+ return [
17
+ {
18
+ mode: "start",
19
+ usage,
20
+ options: (command.arguments ?? []).filter((argument) => argument.startsWith("--")),
21
+ command: { executable: command.executable, arguments: ["--help"] },
22
+ },
23
+ ];
24
+ }
14
25
  //# 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,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;AAED,MAAM,UAAU,eAAe,CAC7B,OAAuC,EACvC,KAAa;IAEb,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL;YACE,IAAI,EAAE,OAAO;YACb,KAAK;YACL,OAAO,EAAE,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACrD,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAC1B;YACD,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE;SACnE;KACF,CAAC;AACJ,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): readonly AgentCliDiagnostic[] {\n const command = request({});\n return [\n {\n mode: \"start\",\n usage,\n options: (command.arguments ?? []).filter((argument) =>\n argument.startsWith(\"--\"),\n ),\n command: { executable: command.executable, arguments: [\"--help\"] },\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;
@@ -0,0 +1,47 @@
1
+ import { credentialVariables } from "./authentication.constants.js";
2
+ import { hostFile, toolCommand, variableCredential } from "./authentication.js";
3
+ import { parseCredential } from "./protocol.js";
4
+ const file = hostFile({
5
+ source: {
6
+ path: "~/.codex/auth.json",
7
+ home: { variable: "CODEX_HOME", path: "auth.json" },
8
+ },
9
+ destination: { file: ".codex/auth.json" },
10
+ login: 'codex login with cli_auth_credentials_store = "file"',
11
+ alternative: `"usage" with ${credentialVariables.codex.usage}`,
12
+ select: (content) => {
13
+ parseCredential(content, "Codex");
14
+ return content;
15
+ },
16
+ });
17
+ const key = variableCredential({
18
+ variable: credentialVariables.codex.usage,
19
+ expose: (secret) => ({
20
+ commands: [
21
+ toolCommand("codex", ["login", "--with-api-key"], { stdin: secret }),
22
+ ],
23
+ }),
24
+ });
25
+ function providerCredentials(provider) {
26
+ const variable = provider.apiKeyEnvironment ?? credentialVariables.codex.usage;
27
+ if (variable === false)
28
+ return {};
29
+ const external = variableCredential({ variable });
30
+ return Object.freeze({
31
+ usage: external.preset,
32
+ "usage.key": external.key,
33
+ "usage.variable": external.variable,
34
+ });
35
+ }
36
+ export function codexCredentials(provider) {
37
+ if (provider)
38
+ return providerCredentials(provider);
39
+ return Object.freeze({
40
+ account: file.preset,
41
+ "account.file": file.file,
42
+ usage: key.preset,
43
+ "usage.key": key.key,
44
+ "usage.variable": key.variable,
45
+ });
46
+ }
47
+ //# sourceMappingURL=codex-authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;KACpD;IACD,WAAW,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACzC,KAAK,EAAE,sDAAsD;IAC7D,WAAW,EAAE,gBAAgB,mBAAmB,CAAC,KAAK,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,mBAAmB,CAAC,KAAK,CAAC,KAAK;IACzC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnB,QAAQ,EAAE;YACR,WAAW,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;SACrE;KACF,CAAC;CACH,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,QAA4B;IACvD,MAAM,QAAQ,GACZ,QAAQ,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC;IAChE,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,WAAW,EAAE,QAAQ,CAAC,GAAG;QACzB,gBAAgB,EAAE,QAAQ,CAAC,QAAQ;KACpC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAwC;IAExC,IAAI,QAAQ;QAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,IAAI,CAAC,MAAM;QACpB,cAAc,EAAE,IAAI,CAAC,IAAI;QACzB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,WAAW,EAAE,GAAG,CAAC,GAAG;QACpB,gBAAgB,EAAE,GAAG,CAAC,QAAQ;KAC/B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { credentialVariables } from \"./authentication.constants.ts\";\nimport { hostFile, toolCommand, variableCredential } from \"./authentication.ts\";\nimport type { CredentialStrategy } from \"./authentication.types.ts\";\nimport { parseCredential } from \"./protocol.ts\";\nimport type { CodexModelProvider } from \"./settings.types.ts\";\n\nconst file = hostFile({\n source: {\n path: \"~/.codex/auth.json\",\n home: { variable: \"CODEX_HOME\", path: \"auth.json\" },\n },\n destination: { file: \".codex/auth.json\" },\n login: 'codex login with cli_auth_credentials_store = \"file\"',\n alternative: `\"usage\" with ${credentialVariables.codex.usage}`,\n select: (content) => {\n parseCredential(content, \"Codex\");\n return content;\n },\n});\n\nconst key = variableCredential({\n variable: credentialVariables.codex.usage,\n expose: (secret) => ({\n commands: [\n toolCommand(\"codex\", [\"login\", \"--with-api-key\"], { stdin: secret }),\n ],\n }),\n});\n\nfunction providerCredentials(provider: CodexModelProvider): CredentialStrategy {\n const variable =\n provider.apiKeyEnvironment ?? credentialVariables.codex.usage;\n if (variable === false) return {};\n const external = variableCredential({ variable });\n return Object.freeze({\n usage: external.preset,\n \"usage.key\": external.key,\n \"usage.variable\": external.variable,\n });\n}\n\nexport function codexCredentials(\n provider: CodexModelProvider | undefined,\n): CredentialStrategy {\n if (provider) return providerCredentials(provider);\n return Object.freeze({\n account: file.preset,\n \"account.file\": file.file,\n usage: key.preset,\n \"usage.key\": key.key,\n \"usage.variable\": key.variable,\n });\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { CliHarness } from "../../domain/agent.types.ts";
2
+ import type { CopilotSettings } from "./copilot.types.ts";
3
+ export declare function copilotHarness(settings?: CopilotSettings): CliHarness;
@@ -0,0 +1,39 @@
1
+ import { credentialPlanner } from "./authentication.js";
2
+ import { copilotCredentials } from "./copilot-authentication.js";
3
+ import { copilotEvents } from "./copilot-events.js";
4
+ import { copilotRequest } from "./copilot-request.js";
5
+ import { copilotModelSupport } from "./model-support.constants.js";
6
+ import { harnessSettings, supportModel } from "./model-support.js";
7
+ function bindCopilot(settings) {
8
+ supportModel(copilotModelSupport, settings.model);
9
+ const credentials = credentialPlanner("GitHub Copilot CLI", copilotCredentials, settings.authentication, settings.model);
10
+ return Object.freeze({
11
+ name: "copilot",
12
+ ...(credentials ? { credentials } : {}),
13
+ bootstrap: "copilot",
14
+ resumable: false,
15
+ capture: false,
16
+ requiresFinishedEvent: true,
17
+ variables: Object.freeze({
18
+ COPILOT_AUTO_UPDATE: "false",
19
+ ...settings.variables,
20
+ }),
21
+ request: (input) => copilotRequest(settings, input),
22
+ events: copilotEvents,
23
+ });
24
+ }
25
+ export function copilotHarness(settings = {}) {
26
+ harnessSettings(settings);
27
+ const configured = Object.freeze({
28
+ ...settings,
29
+ variables: Object.freeze({ ...settings.variables }),
30
+ });
31
+ return Object.freeze({
32
+ kind: "cli",
33
+ bind: (model) => bindCopilot({
34
+ ...configured,
35
+ ...(model === undefined ? {} : { model }),
36
+ }),
37
+ });
38
+ }
39
+ //# sourceMappingURL=copilot-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,WAAW,CAAC,QAAgC;IACnD,YAAY,CAAC,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,iBAAiB,CACnC,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,SAAS;QACf,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,mBAAmB,EAAE,OAAO;YAC5B,GAAG,QAAQ,CAAC,SAAS;SACtB,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC;QACnD,MAAM,EAAE,aAAa;KACC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAA4B,EAAE;IAC3D,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,WAAW,CAAC;YACV,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 type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { copilotCredentials } from \"./copilot-authentication.ts\";\nimport { copilotEvents } from \"./copilot-events.ts\";\nimport { copilotRequest } from \"./copilot-request.ts\";\nimport type { CopilotSettings } from \"./copilot.types.ts\";\nimport { copilotModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindCopilot(settings: Bound<CopilotSettings>): AgentAdapter {\n supportModel(copilotModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"GitHub Copilot CLI\",\n copilotCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"copilot\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"copilot\",\n resumable: false,\n capture: false,\n requiresFinishedEvent: true,\n variables: Object.freeze({\n COPILOT_AUTO_UPDATE: \"false\",\n ...settings.variables,\n }),\n request: (input) => copilotRequest(settings, input),\n events: copilotEvents,\n } satisfies AgentAdapter);\n}\n\nexport function copilotHarness(settings: CopilotSettings = {}): 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 bindCopilot({\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 copilotCredentials: CredentialStrategy;
@@ -0,0 +1,45 @@
1
+ import { invariant, OutpostError } from "../../domain/errors.js";
2
+ import { parseJsonc } from "../../infrastructure/host-credentials.js";
3
+ import { credentialVariables } from "./authentication.constants.js";
4
+ import { hostFile, variableCredential } from "./authentication.js";
5
+ import { asRecord } from "./protocol.js";
6
+ const variable = credentialVariables.copilot.account;
7
+ function acceptToken(token) {
8
+ invariant(!token.startsWith("ghp_"), "GitHub Copilot CLI rejects classic personal access tokens (ghp_). Use copilot login or a fine-grained token with the Copilot Requests permission.");
9
+ }
10
+ function parseConfiguration(content) {
11
+ try {
12
+ return asRecord(parseJsonc(content));
13
+ }
14
+ catch {
15
+ throw new OutpostError("configuration", "The Copilot config.json file is not valid JSON");
16
+ }
17
+ }
18
+ function storedToken(content) {
19
+ const configuration = parseConfiguration(content);
20
+ const user = asRecord(configuration.lastLoggedInUser);
21
+ const token = typeof user.host === "string" && typeof user.login === "string"
22
+ ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]
23
+ : undefined;
24
+ invariant(typeof token === "string" && token !== "", `Copilot config.json stores no token for the last logged-in user. Copilot keeps tokens in the system keychain by default, which Outpost never reads: pass { account: { variable: "${variable}" } } instead.`);
25
+ acceptToken(token);
26
+ return token;
27
+ }
28
+ const file = hostFile({
29
+ source: {
30
+ path: "~/.copilot/config.json",
31
+ home: { variable: "COPILOT_HOME", path: "config.json" },
32
+ },
33
+ destination: { variable },
34
+ login: "copilot login",
35
+ alternative: `{ account: { variable: "${variable}" } }`,
36
+ select: storedToken,
37
+ });
38
+ const token = variableCredential({ variable, accept: acceptToken });
39
+ export const copilotCredentials = Object.freeze({
40
+ account: file.preset,
41
+ "account.file": file.file,
42
+ "account.key": token.key,
43
+ "account.variable": token.variable,
44
+ });
45
+ //# sourceMappingURL=copilot-authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;AAErD,SAAS,WAAW,CAAC,KAAa;IAChC,SAAS,CACP,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,mJAAmJ,CACpJ,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,YAAY,CACpB,eAAe,EACf,gDAAgD,CACjD,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,MAAM,KAAK,GACT,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAC7D,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,CACP,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EACzC,oLAAoL,QAAQ,gBAAgB,CAC7M,CAAC;IACF,WAAW,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE;KACxD;IACD,WAAW,EAAE,EAAE,QAAQ,EAAE;IACzB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,2BAA2B,QAAQ,OAAO;IACvD,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,kBAAkB,GAAuB,MAAM,CAAC,MAAM,CAAC;IAClE,OAAO,EAAE,IAAI,CAAC,MAAM;IACpB,cAAc,EAAE,IAAI,CAAC,IAAI;IACzB,aAAa,EAAE,KAAK,CAAC,GAAG;IACxB,kBAAkB,EAAE,KAAK,CAAC,QAAQ;CACnC,CAAC,CAAC","sourcesContent":["import { invariant, OutpostError } from \"../../domain/errors.ts\";\nimport { parseJsonc } from \"../../infrastructure/host-credentials.ts\";\nimport { credentialVariables } from \"./authentication.constants.ts\";\nimport { hostFile, variableCredential } from \"./authentication.ts\";\nimport type { CredentialStrategy } from \"./authentication.types.ts\";\nimport { asRecord } from \"./protocol.ts\";\n\nconst variable = credentialVariables.copilot.account;\n\nfunction acceptToken(token: string): void {\n invariant(\n !token.startsWith(\"ghp_\"),\n \"GitHub Copilot CLI rejects classic personal access tokens (ghp_). Use copilot login or a fine-grained token with the Copilot Requests permission.\",\n );\n}\n\nfunction parseConfiguration(content: string): Record<string, unknown> {\n try {\n return asRecord(parseJsonc(content));\n } catch {\n throw new OutpostError(\n \"configuration\",\n \"The Copilot config.json file is not valid JSON\",\n );\n }\n}\n\nfunction storedToken(content: string): string {\n const configuration = parseConfiguration(content);\n const user = asRecord(configuration.lastLoggedInUser);\n const token =\n typeof user.host === \"string\" && typeof user.login === \"string\"\n ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]\n : undefined;\n invariant(\n typeof token === \"string\" && token !== \"\",\n `Copilot config.json stores no token for the last logged-in user. Copilot keeps tokens in the system keychain by default, which Outpost never reads: pass { account: { variable: \"${variable}\" } } instead.`,\n );\n acceptToken(token);\n return token;\n}\n\nconst file = hostFile({\n source: {\n path: \"~/.copilot/config.json\",\n home: { variable: \"COPILOT_HOME\", path: \"config.json\" },\n },\n destination: { variable },\n login: \"copilot login\",\n alternative: `{ account: { variable: \"${variable}\" } }`,\n select: storedToken,\n});\n\nconst token = variableCredential({ variable, accept: acceptToken });\n\nexport const copilotCredentials: CredentialStrategy = Object.freeze({\n account: file.preset,\n \"account.file\": file.file,\n \"account.key\": token.key,\n \"account.variable\": token.variable,\n});\n"]}
@@ -0,0 +1 @@
1
+ export declare function copilotDiagnostics(): readonly import("./cli-diagnostics.types.ts").AgentCliDiagnostic[];
@@ -0,0 +1,6 @@
1
+ import { helpDiagnostics } from "./cli-diagnostics.js";
2
+ import { copilotRequest } from "./copilot-request.js";
3
+ export function copilotDiagnostics() {
4
+ return helpDiagnostics((input) => copilotRequest({}, input), "Usage: copilot [");
5
+ }
6
+ //# sourceMappingURL=copilot-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,kBAAkB;IAChC,OAAO,eAAe,CACpB,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,EACpC,kBAAkB,CACnB,CAAC;AACJ,CAAC","sourcesContent":["import { helpDiagnostics } from \"./cli-diagnostics.ts\";\nimport { copilotRequest } from \"./copilot-request.ts\";\n\nexport function copilotDiagnostics() {\n return helpDiagnostics(\n (input) => copilotRequest({}, input),\n \"Usage: copilot [\",\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { AgentEvent } from "../../domain/agent.types.ts";
2
+ export declare function copilotEvents(line: string): AgentEvent[];
@@ -0,0 +1,50 @@
1
+ import { decodeLine } from "./event-decoder.js";
2
+ import { asRecord } from "./protocol.js";
3
+ function message(event) {
4
+ const data = asRecord(event.data);
5
+ const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];
6
+ const tools = requests.map(asRecord).flatMap((request) => typeof request.name === "string"
7
+ ? [
8
+ {
9
+ kind: "tool",
10
+ name: request.name,
11
+ input: request.arguments,
12
+ ...(typeof request.toolCallId === "string"
13
+ ? { callId: request.toolCallId }
14
+ : {}),
15
+ },
16
+ ]
17
+ : []);
18
+ return typeof data.content === "string" && data.content
19
+ ? [{ kind: "text", text: data.content }, ...tools]
20
+ : tools;
21
+ }
22
+ function result(event) {
23
+ const conversation = typeof event.sessionId === "string"
24
+ ? [{ kind: "conversation", id: event.sessionId }]
25
+ : [];
26
+ if (event.exitCode === 0 && event.outcome !== "blocked")
27
+ return [...conversation, { kind: "finished" }];
28
+ return [
29
+ ...conversation,
30
+ {
31
+ kind: "failure",
32
+ message: event.outcome === "blocked"
33
+ ? "GitHub Copilot CLI was blocked before completing the prompt"
34
+ : `GitHub Copilot CLI ended with exit code ${String(event.exitCode ?? "unknown")}`,
35
+ },
36
+ ];
37
+ }
38
+ export function copilotEvents(line) {
39
+ return decodeLine(line, {
40
+ "assistant.message": message,
41
+ "session.error": (event) => {
42
+ const data = asRecord(event.data);
43
+ return typeof data.message === "string"
44
+ ? [{ kind: "warning", message: data.message }]
45
+ : [];
46
+ },
47
+ result,
48
+ });
49
+ }
50
+ //# sourceMappingURL=copilot-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,SAAS,OAAO,CAAC,KAAqB;IACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAgB,EAAE,CACrE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,CAAC;YACE;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,GAAG,CAAC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;oBACxC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;oBAChC,C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AAE,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC9C,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeLine } from \"./event-decoder.ts\";\nimport { asRecord } from \"./protocol.ts\";\nimport type { ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction message(event: ProtocolRecord): AgentEvent[] {\n const data = asRecord(event.data);\n const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];\n const tools = requests.map(asRecord).flatMap((request): AgentEvent[] =>\n typeof request.name === \"string\"\n ? [\n {\n kind: \"tool\",\n name: request.name,\n input: request.arguments,\n ...(typeof request.toolCallId === \"string\"\n ? { callId: request.toolCallId }\n : {}),\n },\n ]\n : [],\n );\n return typeof data.content === \"string\" && data.content\n ? [{ kind: \"text\", text: data.content }, ...tools]\n : tools;\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const conversation: AgentEvent[] =\n typeof event.sessionId === \"string\"\n ? [{ kind: \"conversation\", id: event.sessionId }]\n : [];\n if (event.exitCode === 0 && event.outcome !== \"blocked\")\n return [...conversation, { kind: \"finished\" }];\n return [\n ...conversation,\n {\n kind: \"failure\",\n message:\n event.outcome === \"blocked\"\n ? \"GitHub Copilot CLI was blocked before completing the prompt\"\n : `GitHub Copilot CLI ended with exit code ${String(event.exitCode ?? \"unknown\")}`,\n },\n ];\n}\n\nexport function copilotEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n \"assistant.message\": message,\n \"session.error\": (event) => {\n const data = asRecord(event.data);\n return typeof data.message === \"string\"\n ? [{ kind: \"warning\", message: data.message }]\n : [];\n },\n result,\n });\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { AgentInput } from "../../domain/agent.types.ts";
2
+ import type { Command } from "../../domain/command.types.ts";
3
+ import type { CopilotSettings } from "./copilot.types.ts";
4
+ import type { Bound } from "./settings.types.ts";
5
+ export declare function copilotRequest(settings: Bound<CopilotSettings>, input: AgentInput): Command;
@@ -0,0 +1,19 @@
1
+ import { invariant } from "../../domain/errors.js";
2
+ export function copilotRequest(settings, input) {
3
+ invariant(!input.continuation, "GitHub Copilot CLI does not support continuation or fork in Outpost");
4
+ const args = [];
5
+ if (settings.model)
6
+ args.push("--model", settings.model.name);
7
+ if (input.interactive)
8
+ return {
9
+ executable: "copilot",
10
+ arguments: [
11
+ ...args,
12
+ ...(input.text === undefined ? [] : ["--interactive", input.text]),
13
+ ],
14
+ interactive: true,
15
+ };
16
+ args.push("--output-format", "json", "--allow-all", "--no-ask-user");
17
+ return { executable: "copilot", arguments: args, stdin: input.text ?? "" };
18
+ }
19
+ //# sourceMappingURL=copilot-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,UAAU,cAAc,CAC5B,QAAgC,EAChC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EACnB,qEAAqE,CACtE,CAAC;IACF,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,KAAK,CAAC,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE;gBACT,GAAG,IAAI;gBACP,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aACnE;YACD,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport type { CopilotSettings } from \"./copilot.types.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nexport function copilotRequest(\n settings: Bound<CopilotSettings>,\n input: AgentInput,\n): Command {\n invariant(\n !input.continuation,\n \"GitHub Copilot CLI does not support continuation or fork in Outpost\",\n );\n const args: string[] = [];\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (input.interactive)\n return {\n executable: \"copilot\",\n arguments: [\n ...args,\n ...(input.text === undefined ? [] : [\"--interactive\", input.text]),\n ],\n interactive: true,\n };\n args.push(\"--output-format\", \"json\", \"--allow-all\", \"--no-ask-user\");\n return { executable: \"copilot\", arguments: args, stdin: input.text ?? \"\" };\n}\n"]}